From 0b616d0082239ac2cdc93f59c1a6a48c18215c15 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 7 Sep 2012 22:20:05 +1000 Subject: HOPKINS: Initial skeleton engine commit --- engines/configure.engines | 1 + engines/hopkins/detection.cpp | 143 ++++++++++ engines/hopkins/detection_tables.h | 45 ++++ engines/hopkins/globals.cpp | 37 +++ engines/hopkins/globals.h | 50 ++++ engines/hopkins/hopkins.cpp | 528 +++++++++++++++++++++++++++++++++++++ engines/hopkins/hopkins.h | 91 +++++++ engines/hopkins/module.mk | 15 ++ 8 files changed, 910 insertions(+) create mode 100644 engines/hopkins/detection.cpp create mode 100644 engines/hopkins/detection_tables.h create mode 100644 engines/hopkins/globals.cpp create mode 100644 engines/hopkins/globals.h create mode 100644 engines/hopkins/hopkins.cpp create mode 100644 engines/hopkins/hopkins.h create mode 100644 engines/hopkins/module.mk diff --git a/engines/configure.engines b/engines/configure.engines index 81cf1766f3..e0052c52ee 100644 --- a/engines/configure.engines +++ b/engines/configure.engines @@ -15,6 +15,7 @@ add_engine dreamweb "Dreamweb" yes add_engine gob "Gobli*ns" yes add_engine groovie "Groovie" yes "groovie2" add_engine groovie2 "Groovie 2 games" no +add_engine hopkins "Hopkins FBI" no add_engine hugo "Hugo Trilogy" yes add_engine kyra "Legend of Kyrandia" yes "lol eob" add_engine lol "Lands of Lore" yes diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp new file mode 100644 index 0000000000..3d1107271c --- /dev/null +++ b/engines/hopkins/detection.cpp @@ -0,0 +1,143 @@ +/* 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 "base/plugins.h" + +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/memstream.h" +#include "engines/advancedDetector.h" +#include "common/system.h" +#include "graphics/colormasks.h" +#include "graphics/surface.h" + +#include "hopkins/hopkins.h" + +namespace Hopkins { + +struct HopkinsGameDescription { + ADGameDescription desc; +}; + +uint32 HopkinsEngine::getFeatures() const { + return _gameDescription->desc.flags; +} + +Common::Language HopkinsEngine::getLanguage() const { + return _gameDescription->desc.language; +} + +bool HopkinsEngine::getIsDemo() const { + return _gameDescription->desc.flags & ADGF_DEMO; +} + +} // End of namespace Hopkins + +static const PlainGameDescriptor tonyGames[] = { + {"hopkins", "Hopkins FBI"}, + {0, 0} +}; + +#include "hopkins/detection_tables.h" + +class HopkinsMetaEngine : public AdvancedMetaEngine { +public: + HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), tonyGames) { + } + + virtual const char *getName() const { + return "Hopkins Engine"; + } + + virtual const char *getOriginalCopyright() const { + return "Hopkins Engine (C) ???"; + } + + virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; + virtual void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool HopkinsMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail); +} + +bool Hopkins::HopkinsEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +} + +bool HopkinsMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const Hopkins::HopkinsGameDescription *gd = (const Hopkins::HopkinsGameDescription *)desc; + if (gd) { + *engine = new Hopkins::HopkinsEngine(syst, gd); + } + return gd != 0; +} + +SaveStateList HopkinsMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String saveDesc; + Common::String pattern = "hopkins.0??"; + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; + // TODO + + return saveList; +} + +int HopkinsMetaEngine::getMaximumSaveSlot() const { + return 99; +} + +void HopkinsMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String filename = "todo"; + + g_system->getSavefileManager()->removeSavefile(filename); +} + +SaveStateDescriptor HopkinsMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + // TODO + return SaveStateDescriptor(); +} + + +#if PLUGIN_ENABLED_DYNAMIC(HOPKINS) +REGISTER_PLUGIN_DYNAMIC(HOPKINS, PLUGIN_TYPE_ENGINE, HopkinsMetaEngine); +#else +REGISTER_PLUGIN_STATIC(HOPKINS, PLUGIN_TYPE_ENGINE, HopkinsMetaEngine); +#endif diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h new file mode 100644 index 0000000000..7b2ea8fbd8 --- /dev/null +++ b/engines/hopkins/detection_tables.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +namespace Hopkins { + +static const HopkinsGameDescription gameDescriptions[] = { + { + // Hopkins FBI Demo + { + "hopkins", + 0, + { + {"vendor.txt", 0, "ce82907242166bfb594d97bdb68f96d2", 546}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp new file mode 100644 index 0000000000..555e8b6919 --- /dev/null +++ b/engines/hopkins/globals.cpp @@ -0,0 +1,37 @@ +/* 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 "hopkins/globals.h" + +namespace Hopkins { + +Globals::Globals() { + FR = 0; + SVGA = 2; + MANU_SCROLL = 0; + SPEED_SCROLL = 16; + internet = 1; + PUBEXIT = 0; + FADESPD = 15; +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h new file mode 100644 index 0000000000..bb6a3935dd --- /dev/null +++ b/engines/hopkins/globals.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_GLOBALS_H +#define HOPKINS_GLOBALS_H + +#include "common/scummsys.h" +#include "common/hash-str.h" + +namespace Hopkins { + +/** + * Engine Globals + */ +class Globals { +public: + int FADESPD; + int FR; + int SVGA; + int MANU_SCROLL; + int SPEED_SCROLL; + int internet; + int PUBEXIT; + Common::StringMap _iniParams; + + Globals(); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_GLOBALS_H */ diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp new file mode 100644 index 0000000000..f29a4237e7 --- /dev/null +++ b/engines/hopkins/hopkins.cpp @@ -0,0 +1,528 @@ +/* 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/scummsys.h" +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "common/events.h" +#include "common/file.h" +#include "hopkins/hopkins.h" +#include "hopkins/files.h" + +namespace Hopkins { + +HopkinsEngine *g_vm; + +HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst), + _gameDescription(gameDesc), _randomSource("Hopkins") { + g_vm = this; +} + +HopkinsEngine::~HopkinsEngine() { +} + +Common::Error HopkinsEngine::run() { +// char v1; // al@93 +// char v2; // al@114 + + FileManager::initSaves(); + + /* + Chage_Inifile(); + LOAD_CONFIG(); + *(_DWORD *)HOPIMAGE = dword_807B6D0; + *(_WORD *)&HOPIMAGE[4] = word_807B6D4; + HOPIMAGE[6] = byte_807B6D6; + *(_DWORD *)HOPANIM = dword_807B6D7; + HOPANIM[4] = byte_807B6DB; + *(_DWORD *)HOPLINK = dword_807B6DC; + HOPLINK[4] = byte_807B6E0; + *(_DWORD *)HOPSAVE = dword_807B6E1; + HOPSAVE[4] = byte_807B6E5; + if ( FR == 1 ) + { + *(_DWORD *)FICH_ZONE = dword_807B6E6; + *(_DWORD *)&FICH_ZONE[4] = dword_807B6EA; + *(_WORD *)&FICH_ZONE[8] = word_807B6EE; + FICH_ZONE[10] = byte_807B6F0; + *(_DWORD *)FICH_TEXTE = dword_807B6F1; + *(_DWORD *)&FICH_TEXTE[4] = dword_807B6F5; + *(_DWORD *)&FICH_TEXTE[8] = dword_807B6F9; + } + if ( !FR ) + { + *(_DWORD *)FICH_ZONE = dword_807B6FD; + *(_DWORD *)&FICH_ZONE[4] = dword_807B701; + *(_WORD *)&FICH_ZONE[8] = word_807B705; + FICH_ZONE[10] = byte_807B707; + *(_DWORD *)FICH_TEXTE = dword_807B708; + *(_DWORD *)&FICH_TEXTE[4] = dword_807B70C; + *(_DWORD *)&FICH_TEXTE[8] = dword_807B710; + } + if ( FR == 2 ) + { + *(_DWORD *)FICH_ZONE = dword_807B714; + *(_DWORD *)&FICH_ZONE[4] = dword_807B718; + *(_WORD *)&FICH_ZONE[8] = word_807B71C; + FICH_ZONE[10] = byte_807B71E; + *(_DWORD *)FICH_TEXTE = dword_807B71F; + *(_DWORD *)&FICH_TEXTE[4] = dword_807B723; + *(_DWORD *)&FICH_TEXTE[8] = dword_807B727; + } + *(_DWORD *)HOPSOUND = dword_807B72B; + *(_WORD *)&HOPSOUND[4] = word_807B72F; + *(_DWORD *)HOPMUSIC = dword_807B731; + *(_WORD *)&HOPMUSIC[4] = word_807B735; + *(_DWORD *)HOPVOICE = dword_807B737; + *(_WORD *)&HOPVOICE[4] = word_807B73B; + *(_DWORD *)HOPANM = dword_807B73D; + *(_DWORD *)HOPSEQ = dword_807B741; + MUSICVOL = 6; + SOUNDVOL = 6; + VOICEVOL = 6; + MUSICOFF = 0; + SOUNDOFF = 0; + VOICEOFF = 0; + F_Censure(); + INIT_SYSTEM(); + REDRAW = 0; + SDL_WM_SetCaption("Hopkins FBI for Linux ", "LINUX"); + Init_Interrupt(); + WSOUND_INIT(); + CHARGE_OBJET(); + CHANGE_OBJET(14); + AJOUTE_OBJET(14); + HELICO = 0; + SDL_ShowCursor(0); + DD_Lock(); + Cls_Video(); + DD_Unlock(); + LOAD_IMAGE("LINUX"); + FADE_INW(); + SDL_Delay(1500); + FADE_OUTW(); + if ( !internet ) + { + FADE_LINUX = 2; + PLAY_ANM("MP.ANM", 10, 16, 200); + } + LOAD_IMAGE("H2"); + FADE_INW(); + SDL_Delay(500); + FADE_OUTW(); + if ( !ESC_KEY ) + INTRORUN(a1); + iRegul = 0; + CONSTRUIT_SYSTEM("PERSO.SPR"); + PERSO = CHARGE_FICHIER(NFICHIER); + PERSO_TYPE = 0; + PLANX = 0; + PLANY = 0; + memset(SAUVEGARDE, 0, 0x7CFu); + SORTIE = 0; + PASSWORD = 1; +LABEL_12: + if ( SORTIE == 300 ) +LABEL_13: + SORTIE = 0; + if ( !SORTIE ) + { + SORTIE = MENU(); + if ( SORTIE == -1 ) + { + PUBQUIT(); + PERSO = (void *)dos_free2(PERSO); + REST_SYSTEM(); + } + } + while ( 1 ) + { + while ( 1 ) + { + while ( 1 ) + { + while ( 1 ) + { + while ( 1 ) + { + while ( 1 ) + { + while ( 1 ) + { + while ( 1 ) + { + if ( SORTIE == 300 ) + goto LABEL_13; + if ( SORTIE == 18 ) + PASS(); + if ( SORTIE == 23 ) + PASS(); + if ( SORTIE == 22 ) + PASS(); + if ( SORTIE == 19 ) + PASS(); + if ( SORTIE == 20 ) + PASS(); + if ( SORTIE != 1 ) + break; + Max_Propre = 50; + Max_Ligne_Long = 40; + Max_Propre_Gen = 20; + Max_Perso_Y = 435; + PERSONAGE2((int)"IM01", (int)"IM01", (int)"ANIM01", (int)"IM01", 1); + } + if ( SORTIE != 3 ) + break; + if ( !*((_BYTE *)SAUVEGARDE + 170) ) + { + WSOUND(3); + if ( FR == 1 ) + LOAD_IMAGE("fondfr"); + if ( !FR ) + LOAD_IMAGE("fondan"); + if ( FR == 2 ) + LOAD_IMAGE("fondes"); + FADE_INW(); + SDL_Delay(500); + FADE_OUTW(); + iRegul = 1; + SPECIAL_SOUND = 2; + DD_Lock(); + Cls_Video(); + DD_Unlock(); + Cls_Pal(); + FADE_LINUX = 2; + if ( !CENSURE ) + PLAY_ANM("BANQUE.ANM", 200, 28, 200); + if ( CENSURE == 1 ) + PLAY_ANM("BANKUK.ANM", 200, 28, 200); + SPECIAL_SOUND = 0; + DEL_SAMPLE(1); + DEL_SAMPLE(2); + DEL_SAMPLE(3); + DEL_SAMPLE(4); + *((_BYTE *)SAUVEGARDE + 170) = 1; + } + Max_Propre = 5; + Max_Ligne_Long = 5; + Max_Propre_Gen = 5; + Max_Perso_Y = 450; + NOSPRECRAN = 1; + PERSONAGE2((int)"IM03", (int)"IM03", (int)"ANIM03", (int)"IM03", 2); + } + if ( SORTIE != 4 ) + break; + DESACTIVE_INVENT = 1; + PLAN_BETA(a1); + DESACTIVE_INVENT = 0; + } + if ( SORTIE != 5 ) + break; + Max_Propre = 5; + Max_Ligne_Long = 5; + Max_Propre_Gen = 5; + Max_Perso_Y = 455; + NOSPRECRAN = 1; + v1 = *((_BYTE *)SAUVEGARDE + 80); + if ( v1 ) + { + if ( v1 == 1 ) + PERSONAGE2((int)"IM05", (int)"IM05A", (int)"ANIM05B", (int)"IM05", 3); + } + else + { + PERSONAGE2((int)"IM05", (int)"IM05", (int)"ANIM05", (int)"IM05", 3); + } + NOSPRECRAN = 0; + } + if ( SORTIE != 8 ) + break; + Max_Propre = 15; + Max_Ligne_Long = 15; + Max_Propre_Gen = 10; + Max_Perso_Y = 450; + PERSONAGE2((int)"IM08", (int)"IM08", (int)"ANIM08", (int)"IM08", 2); + } + if ( SORTIE != 6 ) + break; + Max_Propre = 15; + Max_Ligne_Long = 20; + Max_Propre_Gen = 10; + Max_Perso_Y = 460; + PERSONAGE2((int)"IM06", (int)"IM06", (int)"ANIM06", (int)"IM06", 2); + } + if ( SORTIE != 7 ) + break; + if ( *((_BYTE *)SAUVEGARDE + 220) ) + PERSONAGE((int)"BOMBEB", (int)"BOMBE", (int)"BOMBE", (int)"BOMBE", 2); + else + PERSONAGE((int)"BOMBEA", (int)"BOMBE", (int)"BOMBE", (int)"BOMBE", 2); + } + if ( SORTIE == 9 ) + { + Max_Propre = 15; + Max_Ligne_Long = 20; + Max_Propre_Gen = 10; + Max_Perso_Y = 440; + if ( !*((_BYTE *)SAUVEGARDE + 225) ) + goto LABEL_109; + PERSONAGE2((int)"IM09", (int)"IM09", (int)"ANIM09", (int)"IM09", 10); + } + else + { + if ( SORTIE == 10 ) + { + NOSPRECRAN = 1; + PERSONAGE((int)"IM10", (int)"IM10", (int)"ANIM10", (int)"IM10", 9); + goto LABEL_124; + } + if ( SORTIE == 11 ) + { + NOSPRECRAN = 1; + Max_Propre = 15; + Max_Ligne_Long = 20; + Max_Propre_Gen = 10; + Max_Perso_Y = 450; + PERSONAGE2((int)"IM11", (int)"IM11", (int)"ANIM11", (int)"IM11", 2); + goto LABEL_124; + } + switch ( SORTIE ) + { + case 12: + Max_Propre = 15; + Max_Ligne_Long = 20; + Max_Propre_Gen = 10; + Max_Perso_Y = 450; + if ( *((_BYTE *)SAUVEGARDE + 225) ) + { + NOSPRECRAN = 1; + PERSONAGE2((int)"IM12", (int)"IM12", (int)"ANIM12", (int)"IM12", 1); + } + else + { +LABEL_109: + BOOM(a1); + } + break; + case 13: + Max_Propre = 50; + Max_Ligne_Long = 40; + Max_Propre_Gen = 20; + Max_Perso_Y = 440; + PERSONAGE2((int)"IM13", (int)"IM13", (int)"ANIM13", (int)"IM13", 1); + break; + case 14: + Max_Propre = 50; + Max_Ligne_Long = 40; + Max_Propre_Gen = 20; + Max_Perso_Y = 440; + PERSONAGE2((int)"IM14", (int)"IM14", (int)"ANIM14", (int)"IM14", 1); + break; + default: + if ( SORTIE == 15 ) + { + NOSPRECRAN = 1; + PERSONAGE((int)"IM15", (int)"IM15", (int)"ANIM15", (int)"IM15", 29); + goto LABEL_124; + } + if ( SORTIE == 16 ) + { + Max_Propre = 5; + Max_Ligne_Long = 5; + Max_Propre_Gen = 5; + Max_Perso_Y = 450; + v2 = *((_BYTE *)SAUVEGARDE + 113); + if ( v2 == 1 ) + { + PERSONAGE2((int)"IM16", (int)"IM16A", (int)"ANIM16", (int)"IM16", 7); + } + else if ( !v2 ) + { + PERSONAGE2((int)"IM16", (int)"IM16", (int)"ANIM16", (int)"IM16", 7); + } + } + else + { + if ( SORTIE == 17 ) + PASS(); + if ( SORTIE == 24 ) + PASS(); + if ( SORTIE == 25 ) + { + Max_Propre = 15; + Max_Ligne_Long = 20; + Max_Propre_Gen = 10; + Max_Perso_Y = 445; + PERSONAGE2((int)"IM25", (int)"IM25", (int)"ANIM25", (int)"IM25", 30); + } + else + { + if ( SORTIE == 33 ) + { + NOSPRECRAN = 1; + PERSONAGE((int)"IM33", (int)"IM33", (int)"ANIM33", (int)"IM33", 8); + goto LABEL_124; + } + if ( SORTIE == 26 ) + { + Max_Propre = 50; + Max_Ligne_Long = 40; + Max_Propre_Gen = 20; + Max_Perso_Y = 435; + PERSONAGE2((int)"IM26", (int)"IM26", (int)"ANIM26", (int)"IM26", 30); + } + else + { + if ( SORTIE == 27 ) + PASS(); + if ( SORTIE == 28 ) + PASS(); + if ( SORTIE == 29 ) + PASS(); + if ( SORTIE == 30 ) + PASS(); + if ( SORTIE == 31 ) + PASS(); + if ( SORTIE == 35 ) + ENDEMO(); + if ( SORTIE == 32 ) + PASS(); + if ( SORTIE == 34 ) + PASS(); + if ( (unsigned __int16)(SORTIE - 51) <= 0x26u ) + PASS(); + if ( SORTIE == 111 ) + { + NOSPRECRAN = 1; + PERSONAGE((int)"IM111", (int)"IM111", (int)"ANIM111", (int)"IM111", 10); + goto LABEL_124; + } + if ( SORTIE == 112 ) + { + NOSPRECRAN = 1; + PERSONAGE((int)"IM112", (int)"IM112", (int)"ANIM112", (int)"IM112", 10); +LABEL_124: + NOSPRECRAN = 0; + } + else if ( SORTIE == 113 ) + { + SORTIE = 0; + OLD_ECRAN = ECRAN; + *((_BYTE *)SAUVEGARDE + 6) = ECRAN; + ECRAN = 113; + *((_BYTE *)SAUVEGARDE + 5) = 113; + COMPUT_HOPKINS(a1, 1); + DD_LOCK(); + Cls_Video(); + DD_UNLOCK(); + DD_VBL(); + memset(VESA_BUFFER, 0, 0x4B000u); + memset(VESA_SCREEN, 0, 0x4B000u); + Cls_Pal(); + RESET_SEGMENT_VESA(); + } + else + { + if ( SORTIE == 114 ) + { + SORTIE = 0; + OLD_ECRAN = ECRAN; + *((_BYTE *)SAUVEGARDE + 6) = ECRAN; + ECRAN = 114; + *((_BYTE *)SAUVEGARDE + 5) = 114; + COMPUT_HOPKINS(a1, 2); + goto LABEL_128; + } + if ( SORTIE == 115 ) + { + SORTIE = 0; + OLD_ECRAN = ECRAN; + *((_BYTE *)SAUVEGARDE + 6) = ECRAN; + ECRAN = 115; + *((_BYTE *)SAUVEGARDE + 5) = 115; + COMPUT_HOPKINS(a1, 3); +LABEL_128: + DD_LOCK(); + Cls_Video(); + DD_UNLOCK(); + } + else if ( (unsigned __int16)(SORTIE - 194) > 5u ) + { + if ( SORTIE == 151 ) + { + WSOUND(16); + iRegul = 1; + DD_Lock(); + Cls_Video(); + DD_Unlock(); + Cls_Pal(); + FADE_LINUX = 2; + PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + iRegul = 0; + SORTIE = 300; + } + if ( SORTIE == 150 ) + { + WSOUND(16); + iRegul = 1; + DD_Lock(); + Cls_Video(); + DD_Unlock(); + Cls_Pal(); + FADE_LINUX = 2; + PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + iRegul = 0; + SORTIE = 300; + } + if ( SORTIE == 152 ) + { + WSOUND(16); + iRegul = 1; + DD_Lock(); + Cls_Video(); + DD_Unlock(); + Cls_Pal(); + FADE_LINUX = 2; + PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + iRegul = 0; + SORTIE = 300; + } + goto LABEL_12; + } + } + } + } + } + break; + } + } + } +*/ + + return Common::kNoError; +} + +int HopkinsEngine::getRandomNumber(int maxNumber) { + return _randomSource.getRandomNumber(maxNumber); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h new file mode 100644 index 0000000000..f84463ab3e --- /dev/null +++ b/engines/hopkins/hopkins.h @@ -0,0 +1,91 @@ +/* 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_H +#define HOPKINS_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "common/error.h" +#include "common/random.h" +#include "common/util.h" +#include "engines/engine.h" +#include "hopkins/globals.h" + +/** + * This is the namespace of the Hopkins engine. + * + * Status of this engine: In Development + * + * Games using this engine: + * - Hopkins FBI + */ +namespace Hopkins { + +enum { + kHopkinsDebugAnimations = 1 << 0, + kHopkinsDebugActions = 1 << 1, + kHopkinsDebugSound = 1 << 2, + kHopkinsDebugMusic = 1 << 3, + kHopkinsDebugScripts = 1 << 4 +}; + +#define DEBUG_BASIC 1 +#define DEBUG_INTERMEDIATE 2 +#define DEBUG_DETAILED 3 + +struct HopkinsGameDescription; + +class HopkinsEngine : public Engine { +private: + const HopkinsGameDescription *_gameDescription; + Common::RandomSource _randomSource; + +protected: + // Engine APIs + virtual Common::Error run(); + virtual bool hasFeature(EngineFeature f) const; + +public: + Globals _globals; + +public: + HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc); + virtual ~HopkinsEngine(); + void GUIError(const Common::String &msg); + + uint32 getFeatures() const; + Common::Language getLanguage() const; + uint16 getVersion() const; + bool getIsDemo() const; + + int getRandomNumber(int maxNumber); +}; + +// Global reference to the HopkinsEngine object +extern HopkinsEngine *g_vm; + +#define GLOBALS g_vm->_globals + +} // End of namespace Hopkins + +#endif /* HOPKINS_H */ diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk new file mode 100644 index 0000000000..fd259e9148 --- /dev/null +++ b/engines/hopkins/module.mk @@ -0,0 +1,15 @@ +MODULE := engines/hopkins + +MODULE_OBJS := \ + detection.o \ + files.o \ + globals.o \ + hopkins.o + +# This module can be built as a plugin +ifeq ($(ENABLE_HOPKINS), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk -- cgit v1.2.3 From f2012c6ad9e48673270ec0c0acda363eb69cc275 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Sep 2012 09:08:24 +1000 Subject: HOPKINS: Added missing changes to hook in the new engine --- engines/engines.mk | 5 +++++ engines/hopkins/detection.cpp | 4 ++-- engines/hopkins/detection_tables.h | 24 ++++++++++++++++++++---- engines/plugins_table.h | 3 +++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/engines/engines.mk b/engines/engines.mk index fd97f67c08..8a08d93996 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -75,6 +75,11 @@ DEFINES += -DENABLE_GROOVIE2 endif endif +ifdef ENABLE_HOPKINS +DEFINES += -DENABLE_HUGO=$(ENABLE_HOPKINS) +MODULES += engines/hopkins +endif + ifdef ENABLE_HUGO DEFINES += -DENABLE_HUGO=$(ENABLE_HUGO) MODULES += engines/hugo diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 3d1107271c..ffbf243122 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -53,7 +53,7 @@ bool HopkinsEngine::getIsDemo() const { } // End of namespace Hopkins -static const PlainGameDescriptor tonyGames[] = { +static const PlainGameDescriptor hopkinsGames[] = { {"hopkins", "Hopkins FBI"}, {0, 0} }; @@ -62,7 +62,7 @@ static const PlainGameDescriptor tonyGames[] = { class HopkinsMetaEngine : public AdvancedMetaEngine { public: - HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), tonyGames) { + HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), hopkinsGames) { } virtual const char *getName() const { diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 7b2ea8fbd8..38548e1eda 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -24,17 +24,33 @@ namespace Hopkins { static const HopkinsGameDescription gameDescriptions[] = { { - // Hopkins FBI Demo + // Hopkins FBI Linux Demo 1.00 { "hopkins", 0, { - {"vendor.txt", 0, "ce82907242166bfb594d97bdb68f96d2", 546}, + {"Hopkins-PDemo.bin", 0, "88b4d6e14b9b1407083cb3d1213c0fa7", 272027}, AD_LISTEND }, Common::EN_ANY, - Common::kPlatformWindows, - ADGF_NO_FLAGS, + Common::kPlatformLinux, + ADGF_DEMO, + GUIO1(GUIO_NONE) + }, + }, + + { + // Hopkins FBI Linux Demo 1.02 + { + "hopkins", + 0, + { + {"Hopkins-PDemo.bin", 0, "f82f4e698f3a189419351be0de2b2f8e", 273760}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformLinux, + ADGF_DEMO, GUIO1(GUIO_NONE) }, }, diff --git a/engines/plugins_table.h b/engines/plugins_table.h index 9e6dd4ac80..c07dbc66a4 100644 --- a/engines/plugins_table.h +++ b/engines/plugins_table.h @@ -35,6 +35,9 @@ LINK_PLUGIN(GOB) #if PLUGIN_ENABLED_STATIC(GROOVIE) LINK_PLUGIN(GROOVIE) #endif +#if PLUGIN_ENABLED_STATIC(HOPKINS) +LINK_PLUGIN(HOPKINS) +#endif #if PLUGIN_ENABLED_STATIC(HUGO) LINK_PLUGIN(HUGO) #endif -- cgit v1.2.3 From c10f87f9c88b7ffd0a0652727fa91fd76929786f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Sep 2012 09:09:09 +1000 Subject: HOPKINS: Beginnings of file manager code --- engines/hopkins/files.cpp | 127 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/globals.h | 16 +++--- engines/hopkins/hopkins.cpp | 8 +++ engines/hopkins/hopkins.h | 2 + 4 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 engines/hopkins/files.cpp diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp new file mode 100644 index 0000000000..1f3434517e --- /dev/null +++ b/engines/hopkins/files.cpp @@ -0,0 +1,127 @@ +/* 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 "hopkins/files.h" +#include "hopkins/hopkins.h" +#include "hopkins/globals.h" +#include "common/system.h" +#include "common/debug.h" +#include "common/file.h" +#include "common/str.h" +#include "common/savefile.h" + +namespace Hopkins { + +void FileManager::initSaves() { + Common::String dataFilename = "HISCORE.DAT"; + byte data[100]; + Common::fill(&data[0], &data[100], 0); + + SAUVE_FICHIER(dataFilename, data, 100); +} + +bool FileManager::SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n) { + return bsave(file, buf, n); +} + +bool FileManager::bsave(const Common::String &file, const void *buf, size_t n) { + Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file); + + if (f) { + size_t bytesWritten = f->write(buf, n); + f->finalize(); + delete f; + + return bytesWritten == n; + } else + return false; +} + +void FileManager::Chage_Inifile(Common::StringMap &iniParams) { + char *iniData = (char *)CHARGE_FICHIER("config.ini"); + char *ptr = iniData; + + bool endOfFile = false; + while (!endOfFile) { + if (*ptr == '%') { + if (*(ptr + 1) == '%') { + endOfFile = true; + } else { + ++ptr; + + // Get the parameter name + Common::String paramName; + while (*ptr == ' ') + ++ptr; + while (*ptr != '=') { + paramName += toupper(*ptr++); + } + while (paramName.lastChar() == ' ') + paramName.deleteLastChar(); + + // Get the parameter value + Common::String paramValue; + while (*++ptr == ' ') + ; + while (*ptr != ';') { + paramValue += toupper(*ptr++); + } + while (paramValue.lastChar() == ' ') + paramValue.deleteLastChar(); + + iniParams[paramName] = paramValue; + } + } + + ++ptr; + } + + free(iniData); +} + +void *FileManager::CHARGE_FICHIER(const Common::String &file) { + DMESS1(); + + Common::File f; + if (!f.open(file)) + error("Error opening %s", file.c_str()); + + // Allocate space for the file contents + size_t filesize = f.size(); + void *data = malloc(filesize); + if (!data) + error("Error allocating space for file being loaded - %s", file.c_str()); + + bload_it(f, data, filesize); + f.close(); + + return data; +} + +void FileManager::DMESS1() { +} + +int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) { + return stream.read(buf, nbytes); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index bb6a3935dd..ec980a975d 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -24,7 +24,6 @@ #define HOPKINS_GLOBALS_H #include "common/scummsys.h" -#include "common/hash-str.h" namespace Hopkins { @@ -33,14 +32,13 @@ namespace Hopkins { */ class Globals { public: - int FADESPD; - int FR; - int SVGA; - int MANU_SCROLL; - int SPEED_SCROLL; - int internet; - int PUBEXIT; - Common::StringMap _iniParams; + int FADESPD; + int FR; + int SVGA; + int MANU_SCROLL; + int SPEED_SCROLL; + int internet; + int PUBEXIT; Globals(); }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index f29a4237e7..16e75784d5 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -46,6 +46,10 @@ Common::Error HopkinsEngine::run() { FileManager::initSaves(); + Common::StringMap iniParams; + FileManager::Chage_Inifile(iniParams); + processIniParams(iniParams); + /* Chage_Inifile(); LOAD_CONFIG(); @@ -525,4 +529,8 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } +void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { + +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index f84463ab3e..c4f8415543 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -27,6 +27,7 @@ #include "common/system.h" #include "common/error.h" #include "common/random.h" +#include "common/hash-str.h" #include "common/util.h" #include "engines/engine.h" #include "hopkins/globals.h" @@ -60,6 +61,7 @@ private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; + void processIniParams(Common::StringMap &iniParams); protected: // Engine APIs virtual Common::Error run(); -- cgit v1.2.3 From 578b1601fe624c23a68c39d115a6a58bf1ca58e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Sep 2012 10:08:12 +1000 Subject: HOPKINS: Added further configuration setup --- engines/hopkins/files.h | 46 +++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/globals.cpp | 37 +++++++++++++++++++++++++++++++++++- engines/hopkins/globals.h | 29 +++++++++++++++++++++++++++- engines/hopkins/hopkins.cpp | 27 +++++++++++++++----------- engines/hopkins/hopkins.h | 3 +++ 5 files changed, 129 insertions(+), 13 deletions(-) create mode 100644 engines/hopkins/files.h diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h new file mode 100644 index 0000000000..992ea8786f --- /dev/null +++ b/engines/hopkins/files.h @@ -0,0 +1,46 @@ +/* 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_FILES_H +#define HOPKINS_FILES_H + +#include "common/scummsys.h" +#include "common/hash-str.h" +#include "common/str.h" +#include "common/stream.h" + +namespace Hopkins { + +class FileManager { +public: + static void initSaves(); + static bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); + static bool bsave(const Common::String &file, const void *buf, size_t n); + static void Chage_Inifile(Common::StringMap &iniParams); + static void *CHARGE_FICHIER(const Common::String &file); + static void DMESS1(); + static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_GLOBALS_H */ diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 555e8b6919..2a98764c45 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -27,11 +27,46 @@ namespace Hopkins { Globals::Globals() { FR = 0; SVGA = 2; - MANU_SCROLL = 0; + MANU_SCROLL = 1; SPEED_SCROLL = 16; internet = 1; PUBEXIT = 0; FADESPD = 15; + vitesse = 1; + INSTALL_TYPE = 1; + MUSICVOL = 6; + SOUNDVOL = 6; + VOICEVOL = 6; + MUSICOFF = false; + SOUNDOFF = false; + VOICEOFF = false; +} + +void Globals::setConfig() { + HOPIMAGE = "BUFFER"; + HOPANIM = "ANIM"; + HOPLINK = "LINK"; + HOPSAVE = "SAVE"; + HOPSOUND = "SOUND"; + HOPMUSIC = "MUSIC"; + HOPVOICE = "VOICE"; + HOPANM = "ANM"; + HOPSEQ = "SEQ"; + + switch (FR) { + case 0: + FICH_ZONE = "ZONEAN.TXT"; + FICH_TEXTE = "TEXTEAN.TXT"; + break; + case 1: + FICH_ZONE = "ZONE01.TXT"; + FICH_TEXTE = "TEXTE01.TXT"; + break; + case 2: + FICH_ZONE = "ZONEES.TXT"; + FICH_TEXTE = "TEXTEES.TXT"; + break; + } } } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index ec980a975d..9867376415 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -24,6 +24,7 @@ #define HOPKINS_GLOBALS_H #include "common/scummsys.h" +#include "common/str.h" namespace Hopkins { @@ -39,8 +40,34 @@ public: int SPEED_SCROLL; int internet; int PUBEXIT; + bool XFULLSCREEN; + int XSETMODE; + int XZOOM; + bool XFORCE16; + bool XFORCE8; + bool CARD_SB; + int vitesse; + int INSTALL_TYPE; + Common::String HOPIMAGE; + Common::String HOPANIM; + Common::String HOPLINK; + Common::String HOPSAVE; + Common::String HOPSOUND; + Common::String HOPMUSIC; + Common::String HOPVOICE; + Common::String HOPANM; + Common::String HOPSEQ; + Common::String FICH_ZONE; + Common::String FICH_TEXTE; + int SOUNDVOL; + int MUSICVOL; + int VOICEVOL; + bool SOUNDOFF; + bool MUSICOFF; + bool VOICEOFF; - Globals(); + Globals(); + void setConfig(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 16e75784d5..ebf97c308d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -51,17 +51,6 @@ Common::Error HopkinsEngine::run() { processIniParams(iniParams); /* - Chage_Inifile(); - LOAD_CONFIG(); - *(_DWORD *)HOPIMAGE = dword_807B6D0; - *(_WORD *)&HOPIMAGE[4] = word_807B6D4; - HOPIMAGE[6] = byte_807B6D6; - *(_DWORD *)HOPANIM = dword_807B6D7; - HOPANIM[4] = byte_807B6DB; - *(_DWORD *)HOPLINK = dword_807B6DC; - HOPLINK[4] = byte_807B6E0; - *(_DWORD *)HOPSAVE = dword_807B6E1; - HOPSAVE[4] = byte_807B6E5; if ( FR == 1 ) { *(_DWORD *)FICH_ZONE = dword_807B6E6; @@ -530,7 +519,23 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { } void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { + GLOBALS.XFULLSCREEN = iniParams["FULLSCREEN"] == "YES"; + GLOBALS.XSETMODE = 1; + if (iniParams.contains("SETMODE")) { + int setMode = atoi(iniParams["SETMODE"].c_str()); + GLOBALS.XSETMODE = CLIP(setMode, 1, 5); + } + + GLOBALS.XZOOM = 0; + if (GLOBALS.XSETMODE == 5 && iniParams.contains("ZOOM")) { + int zoom = atoi(iniParams["ZOOM"].c_str()); + GLOBALS.XZOOM = CLIP(zoom, 25, 100); + } + + GLOBALS.XFORCE16 = iniParams["FORCE16BITS"] == "YES"; + GLOBALS.XFORCE8 = iniParams["FORCE8BITS"] == "YES"; + GLOBALS.CARD_SB = iniParams["SOUND"] == "YES"; } } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index c4f8415543..57dc3ea7ad 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -61,6 +61,9 @@ private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; + /** + * Processes the loaded list of ini file parameters + */ void processIniParams(Common::StringMap &iniParams); protected: // Engine APIs -- cgit v1.2.3 From b8086aabc53f2359f9a6952f083701b4a01282be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Sep 2012 18:45:22 +1000 Subject: HOPKINS: Commit of lots more initialisation code --- engines/hopkins/events.cpp | 62 +++++ engines/hopkins/events.h | 53 +++++ engines/hopkins/files.cpp | 38 ++- engines/hopkins/files.h | 5 +- engines/hopkins/globals.cpp | 549 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/globals.h | 128 +++++++++++ engines/hopkins/hopkins.cpp | 129 +++++++---- engines/hopkins/hopkins.h | 7 + engines/hopkins/module.mk | 1 + 9 files changed, 922 insertions(+), 50 deletions(-) create mode 100644 engines/hopkins/events.cpp create mode 100644 engines/hopkins/events.h diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp new file mode 100644 index 0000000000..c714338574 --- /dev/null +++ b/engines/hopkins/events.cpp @@ -0,0 +1,62 @@ +/* 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 "hopkins/events.h" + +namespace Hopkins { + +void Mouse::INSTALL_SOURIS() { + // No implementation in original +} + +void Mouse::souris_on() { + bool result; // eax@5 + + souris_flag = true; + + if (mouse_linux) { + souris_sizex = 52; + souris_sizey = 32; + } else { + souris_sizex = 34; + souris_sizey = 20; + } + + ofset_souris_x = 0; + ofset_souris_y = 0; + + if (!CASSE) + souris_xy(300, 200); + else + souris_xy(150, 100); +} + +void Mouse::souris_xy(int xp, int yp) { + g_system->warpMouse(xp, yp); +} + +void Mouse::souris_max() { + // No implementation in original +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h new file mode 100644 index 0000000000..c6fb6a3eab --- /dev/null +++ b/engines/hopkins/events.h @@ -0,0 +1,53 @@ +/* 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_EVENTS_H +#define HOPKINS_EVENTS_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class Mouse { +public: + bool souris_flag; + bool mouse_linux; + int souris_sizex; + int souris_sizey; + int ofset_souris_x; + int ofset_souris_y; + bool CASSE; + int souris_n; + int souris_bb; + int souris_b; + void *pointeur_souris; +public: + void INSTALL_SOURIS(); + void souris_on(); + void souris_xy(int xp, int yp); + void souris_max(); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_EVENTS_H */ diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 1f3434517e..1d9c3adb54 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -98,7 +98,7 @@ void FileManager::Chage_Inifile(Common::StringMap &iniParams) { free(iniData); } -void *FileManager::CHARGE_FICHIER(const Common::String &file) { +byte *FileManager::CHARGE_FICHIER(const Common::String &file) { DMESS1(); Common::File f; @@ -107,7 +107,7 @@ void *FileManager::CHARGE_FICHIER(const Common::String &file) { // Allocate space for the file contents size_t filesize = f.size(); - void *data = malloc(filesize); + byte *data = (byte *)malloc(filesize); if (!data) error("Error allocating space for file being loaded - %s", file.c_str()); @@ -124,4 +124,38 @@ int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) return stream.read(buf, nbytes); } +void FileManager::F_Censure() { + GLOBALS.CENSURE = false; + + CONSTRUIT_SYSTEM("BLOOD.DAT"); + char *data = (char *)CHARGE_FICHIER(GLOBALS.NFICHIER); + + if (*(data + 6) == 'f' && *(data + 7) == 'r') + GLOBALS.CENSURE = false; + if (*(data + 6) == 'F' && *(data + 7) == 'R') + GLOBALS.CENSURE = false; + if (*(data + 6) == 'u' && *(data + 7) == 'k') + GLOBALS.CENSURE = true; + if (*(data + 6) == 'U' && *(data + 7) == 'K') + GLOBALS.CENSURE = true; + + free(data); +} + +int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) { + GLOBALS.NFICHIER = Common::String::format("system/%s", file.c_str()); + return GLOBALS.NFICHIER.size(); +} + +void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file) { + // At this point, the original program did a big switch statement to determine + // whether to preprend the CD or installed directory path into REPJEU + + if (hop[0] == 'A' && hop[1] == 'N' && hop[2] == 'N') { + error("TODO: CONSTRUIT_FICHIER"); + } + + GLOBALS.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 992ea8786f..b90b80b3c5 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -36,9 +36,12 @@ public: static bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); static bool bsave(const Common::String &file, const void *buf, size_t n); static void Chage_Inifile(Common::StringMap &iniParams); - static void *CHARGE_FICHIER(const Common::String &file); + static byte *CHARGE_FICHIER(const Common::String &file); static void DMESS1(); static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); + static void F_Censure(); + static int CONSTRUIT_SYSTEM(const Common::String &file); + static void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2a98764c45..1c47b9b275 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -20,6 +20,7 @@ * */ +#include "common/textconsole.h" #include "hopkins/globals.h" namespace Hopkins { @@ -40,6 +41,51 @@ Globals::Globals() { MUSICOFF = false; SOUNDOFF = false; VOICEOFF = false; + + // Initialise pointers + ICONE = NULL; + BUF_ZONE = NULL; + CACHE_BANQUE[6] = NULL; + Winventaire = NULL; + texte_tmp = NULL; + SPRITE_ECRAN = NULL; + SAUVEGARDE = NULL; + BUFFERTAPE = NULL; + essai0 = NULL; + essai1 = NULL; + essai2 = NULL; + Bufferobjet = NULL; + inventaire2 = NULL; + GESTE = NULL; + INVENTAIRE_OBJET = NULL; + FORETSPR = NULL; + COUCOU = NULL; + chemin = NULL; + cache_souris = NULL; + BufLig = NULL; + Bufferdecor = NULL; + ADR_FICHIER_OBJ = NULL; +} + +Globals::~Globals() { + free(ICONE); + free(BUF_ZONE); + free(CACHE_BANQUE[6]); + free(Winventaire); + free(texte_tmp); + free(SPRITE_ECRAN); + free(SAUVEGARDE); + free(BUFFERTAPE); + free(Bufferobjet); + free(inventaire2); + free(GESTE); + free(INVENTAIRE_OBJET); + free(FORETSPR); + free(COUCOU); + free(chemin); + free(cache_souris); + free(Bufferdecor); + free(ADR_FICHIER_OBJ); } void Globals::setConfig() { @@ -69,4 +115,507 @@ void Globals::setConfig() { } } +void Globals::clearAll() { + // TODO: The original allocated an explicit memory block for the null pointer + // to point to. For now, we're seeing if the NULL value will do as well + + for (int idx = 0; idx < 6; ++idx) + CACHE_BANQUE[idx] = PTRNUL; + + nbrligne = 80; + INIT_ANIM(); + + texte_tmp = PTRNUL; + texte_long = 0; + police = (void *)PTRNUL; + police_h = 0; + police_l = 0; + hauteur_boite = 0; + largeur_boite = 0; + + for (int idx = 0; idx < 11; ++idx) { + Txt[idx].field0 = 0; + Txt[idx].field12 = 0; + Txt[idx].field3FC = 0; + Txt[idx].field3FE = 0; + Txt[idx].field400 = 0; + Txt[idx].field404 = 0; + Txt[idx].field406 = 0; + Txt[idx].field408 = 0; + + ListeTxt[idx].field0 = 0; + } + + INIT_VBOB(); + ADR_FICHIER_OBJ = PTRNUL; + NUM_FICHIER_OBJ = 0; + Bufferdecor = PTRNUL; + Bufferobjet = PTRNUL; + Winventaire = PTRNUL; + inventaire2 = PTRNUL; + COUCOU = PTRNUL; + SPRITE_ECRAN = PTRNUL; + SAUVEGARDE = PTRNUL; + OBJET_EN_COURS = 0; + + for (int idx = 0; idx < 105; ++idx) { + ZoneP[idx].field0 = 0; + ZoneP[idx].field2 = 0; + ZoneP[idx].field4 = 0; + } + + essai0 = PTRNUL; + essai1 = PTRNUL; + essai2 = PTRNUL; + BufLig = PTRNUL; + chemin = PTRNUL; + + for (int idx = 0; idx < 400; ++idx) { + Ligne[idx].field0 = 0; + Ligne[idx].field2 = 0; + Ligne[idx].field4 = 0; + Ligne[idx].field6 = 0; + Ligne[idx].field8 = 0; + Ligne[idx].field12 = PTRNUL; + + LigneZone[idx].field0 = 0; + LigneZone[idx].field2 = 0; + LigneZone[idx].field4 = PTRNUL; + } + + for (int idx = 0; idx < 100; ++idx) { + CarreZone[idx].field0 = 0; + } + + texte_long = 0; + texte_tmp = PTRNUL; + BUFFERTAPE = (byte *)malloc(85000); + + SAUVEGARDE = (byte *)malloc(2050); + memset(SAUVEGARDE, 0, 1999); + + essai0 = BUFFERTAPE; + essai1 = BUFFERTAPE + 25000; + essai2 = BUFFERTAPE + 50000; + BufLig = (BUFFERTAPE + 75000); + largeur_boite = 240; + TEXTE_FORMATE = 300; + + Bufferobjet = (byte *)malloc(2500); + INVENTAIRE_OBJET = (byte *)malloc(2500); + + ADR_FICHIER_OBJ = PTRNUL; + FORETSPR = PTRNUL; + FORET = 0; + + cache_souris = (byte *)malloc(2500); + GESTE = PTRNUL; + GESTE_FLAG = false; +} + +void Globals::HOPKINS_DATA() { + // TODO: Replace all the '/ 2' with constant values + switch (PERSO_TYPE) { + case 0: + HopkinsArr[0 / 2] = 0; + HopkinsArr[2 / 2] = -2; + HopkinsArr[4 / 2] = 0; + HopkinsArr[6 / 2] = -3; + HopkinsArr[8 / 2] = 0; + HopkinsArr[10 / 2] = -6; + HopkinsArr[12 / 2] = 0; + HopkinsArr[14 / 2] = -1; + HopkinsArr[16 / 2] = 0; + HopkinsArr[18 / 2] = -3; + HopkinsArr[20 / 2] = 0; + HopkinsArr[22 / 2] = -3; + HopkinsArr[24 / 2] = 0; + HopkinsArr[26 / 2] = -5; + HopkinsArr[28 / 2] = 0; + HopkinsArr[30 / 2] = -3; + HopkinsArr[32 / 2] = 0; + HopkinsArr[34 / 2] = -6; + HopkinsArr[36 / 2] = 0; + HopkinsArr[38 / 2] = -3; + HopkinsArr[40 / 2] = 0; + HopkinsArr[42 / 2] = -3; + HopkinsArr[44 / 2] = 0; + HopkinsArr[46 / 2] = -3; + HopkinsArr[48 / 2] = 9; + HopkinsArr[50 / 2] = -4; + HopkinsArr[52 / 2] = 8; + HopkinsArr[54 / 2] = -4; + HopkinsArr[56 / 2] = 6; + HopkinsArr[58 / 2] = -2; + HopkinsArr[60 / 2] = 9; + HopkinsArr[62 / 2] = -2; + HopkinsArr[64 / 2] = 9; + HopkinsArr[66 / 2] = -3; + HopkinsArr[68 / 2] = 9; + HopkinsArr[70 / 2] = -3; + HopkinsArr[72 / 2] = 9; + HopkinsArr[74 / 2] = -4; + HopkinsArr[76 / 2] = 9; + HopkinsArr[78 / 2] = -2; + HopkinsArr[80 / 2] = 9; + HopkinsArr[82 / 2] = -2; + HopkinsArr[84 / 2] = 8; + HopkinsArr[86 / 2] = -2; + HopkinsArr[88 / 2] = 9; + HopkinsArr[90 / 2] = -3; + HopkinsArr[92 / 2] = 9; + HopkinsArr[94 / 2] = -2; + HopkinsArr[96 / 2] = 13; + HopkinsArr[98 / 2] = 0; + HopkinsArr[100 / 2] = 13; + HopkinsArr[102 / 2] = 0; + HopkinsArr[104 / 2] = 13; + HopkinsArr[106 / 2] = 0; + HopkinsArr[108 / 2] = 13; + HopkinsArr[110 / 2] = 0; + HopkinsArr[112 / 2] = 14; + HopkinsArr[114 / 2] = 0; + HopkinsArr[116 / 2] = 13; + HopkinsArr[118 / 2] = 0; + HopkinsArr[120 / 2] = 13; + HopkinsArr[122 / 2] = 0; + HopkinsArr[124 / 2] = 12; + HopkinsArr[126 / 2] = 0; + HopkinsArr[128 / 2] = 12; + HopkinsArr[130 / 2] = 0; + HopkinsArr[132 / 2] = 14; + HopkinsArr[134 / 2] = 0; + HopkinsArr[136 / 2] = 13; + HopkinsArr[138 / 2] = 0; + HopkinsArr[140 / 2] = 14; + HopkinsArr[142 / 2] = 0; + HopkinsArr[144 / 2] = 10; + HopkinsArr[146 / 2] = 3; + HopkinsArr[148 / 2] = 9; + HopkinsArr[150 / 2] = 3; + HopkinsArr[152 / 2] = 10; + HopkinsArr[154 / 2] = 4; + HopkinsArr[156 / 2] = 8; + HopkinsArr[158 / 2] = 2; + HopkinsArr[160 / 2] = 7; + HopkinsArr[162 / 2] = 1; + HopkinsArr[164 / 2] = 10; + HopkinsArr[166 / 2] = 2; + HopkinsArr[168 / 2] = 9; + HopkinsArr[170 / 2] = 2; + HopkinsArr[172 / 2] = 7; + HopkinsArr[174 / 2] = 4; + HopkinsArr[176 / 2] = 7; + HopkinsArr[178 / 2] = 3; + HopkinsArr[180 / 2] = 8; + HopkinsArr[182 / 2] = 0; + HopkinsArr[184 / 2] = 9; + HopkinsArr[186 / 2] = 1; + HopkinsArr[188 / 2] = 9; + HopkinsArr[190 / 2] = 1; + HopkinsArr[192 / 2] = 0; + HopkinsArr[194 / 2] = 4; + HopkinsArr[196 / 2] = 0; + HopkinsArr[198 / 2] = 4; + HopkinsArr[200 / 2] = 0; + HopkinsArr[202 / 2] = 6; + HopkinsArr[204 / 2] = 0; + HopkinsArr[206 / 2] = 3; + HopkinsArr[208 / 2] = 0; + HopkinsArr[210 / 2] = 4; + HopkinsArr[212 / 2] = 0; + HopkinsArr[214 / 2] = 3; + HopkinsArr[216 / 2] = 0; + HopkinsArr[218 / 2] = 4; + HopkinsArr[220 / 2] = 0; + HopkinsArr[222 / 2] = 4; + HopkinsArr[224 / 2] = 0; + HopkinsArr[226 / 2] = 6; + HopkinsArr[228 / 2] = 0; + HopkinsArr[230 / 2] = 3; + HopkinsArr[232 / 2] = 0; + HopkinsArr[234 / 2] = 3; + HopkinsArr[236 / 2] = 0; + HopkinsArr[238 / 2] = 3; + break; + case 1: + HopkinsArr[0] = 0; + HopkinsArr[2 / 2] = -2; + HopkinsArr[4 / 2] = 0; + HopkinsArr[6 / 2] = -2; + HopkinsArr[8 / 2] = 0; + HopkinsArr[10 / 2] = -5; + HopkinsArr[12 / 2] = 0; + HopkinsArr[14 / 2] = -1; + HopkinsArr[16 / 2] = 0; + HopkinsArr[18 / 2] = -2; + HopkinsArr[20 / 2] = 0; + HopkinsArr[22 / 2] = -2; + HopkinsArr[24 / 2] = 0; + HopkinsArr[26 / 2] = -4; + HopkinsArr[28 / 2] = 0; + HopkinsArr[30 / 2] = -2; + HopkinsArr[32 / 2] = 0; + HopkinsArr[34 / 2] = -5; + HopkinsArr[36 / 2] = 0; + HopkinsArr[38 / 2] = -2; + HopkinsArr[40 / 2] = 0; + HopkinsArr[42 / 2] = -2; + HopkinsArr[44 / 2] = 0; + HopkinsArr[46 / 2] = -2; + HopkinsArr[48 / 2] = 11; + HopkinsArr[50 / 2] = 0; + HopkinsArr[52 / 2] = 10; + HopkinsArr[54 / 2] = 0; + HopkinsArr[56 / 2] = 11; + HopkinsArr[58 / 2] = 0; + HopkinsArr[60 / 2] = 11; + HopkinsArr[62 / 2] = 0; + HopkinsArr[64 / 2] = 11; + HopkinsArr[66 / 2] = 0; + HopkinsArr[68 / 2] = 11; + HopkinsArr[70 / 2] = 0; + HopkinsArr[72 / 2] = 12; + HopkinsArr[74 / 2] = 0; + HopkinsArr[76 / 2] = 11; + HopkinsArr[78 / 2] = 0; + HopkinsArr[80 / 2] = 9; + HopkinsArr[82 / 2] = 0; + HopkinsArr[84 / 2] = 10; + HopkinsArr[86 / 2] = 0; + HopkinsArr[88 / 2] = 11; + HopkinsArr[90 / 2] = 0; + HopkinsArr[92 / 2] = 11; + HopkinsArr[94 / 2] = 0; + HopkinsArr[96 / 2] = 11; + HopkinsArr[98 / 2] = 0; + HopkinsArr[100 / 2] = 10; + HopkinsArr[102 / 2] = 0; + HopkinsArr[104 / 2] = 11; + HopkinsArr[106 / 2] = 0; + HopkinsArr[108 / 2] = 11; + HopkinsArr[110 / 2] = 0; + HopkinsArr[112 / 2] = 11; + HopkinsArr[114 / 2] = 0; + HopkinsArr[116 / 2] = 11; + HopkinsArr[118 / 2] = 0; + HopkinsArr[120 / 2] = 12; + HopkinsArr[122 / 2] = 0; + HopkinsArr[124 / 2] = 11; + HopkinsArr[126 / 2] = 0; + HopkinsArr[128 / 2] = 9; + HopkinsArr[130 / 2] = 0; + HopkinsArr[132 / 2] = 10; + HopkinsArr[134 / 2] = 0; + HopkinsArr[136 / 2] = 11; + HopkinsArr[138 / 2] = 0; + HopkinsArr[140 / 2] = 11; + HopkinsArr[142 / 2] = 0; + HopkinsArr[144 / 2] = 11; + HopkinsArr[146 / 2] = 0; + HopkinsArr[148 / 2] = 10; + HopkinsArr[150 / 2] = 0; + HopkinsArr[152 / 2] = 11; + HopkinsArr[154 / 2] = 0; + HopkinsArr[156 / 2] = 11; + HopkinsArr[158 / 2] = 0; + HopkinsArr[160 / 2] = 11; + HopkinsArr[162 / 2] = 0; + HopkinsArr[164 / 2] = 11; + HopkinsArr[166 / 2] = 0; + HopkinsArr[168 / 2] = 12; + HopkinsArr[170 / 2] = 0; + HopkinsArr[172 / 2] = 11; + HopkinsArr[174 / 2] = 0; + HopkinsArr[176 / 2] = 9; + HopkinsArr[178 / 2] = 0; + HopkinsArr[180 / 2] = 10; + HopkinsArr[182 / 2] = 0; + HopkinsArr[184 / 2] = 11; + HopkinsArr[186 / 2] = 0; + HopkinsArr[188 / 2] = 11; + HopkinsArr[190 / 2] = 0; + HopkinsArr[192 / 2] = 0; + HopkinsArr[194 / 2] = 3; + HopkinsArr[196 / 2] = 0; + HopkinsArr[198 / 2] = 3; + HopkinsArr[200 / 2] = 0; + HopkinsArr[202 / 2] = 5; + HopkinsArr[204 / 2] = 0; + HopkinsArr[206 / 2] = 3; + HopkinsArr[208 / 2] = 0; + HopkinsArr[210 / 2] = 3; + HopkinsArr[212 / 2] = 0; + HopkinsArr[214 / 2] = 3; + HopkinsArr[216 / 2] = 0; + HopkinsArr[218 / 2] = 3; + HopkinsArr[220 / 2] = 0; + HopkinsArr[222 / 2] = 3; + HopkinsArr[224 / 2] = 0; + HopkinsArr[226 / 2] = 5; + HopkinsArr[228 / 2] = 0; + HopkinsArr[230 / 2] = 3; + HopkinsArr[232 / 2] = 0; + HopkinsArr[234 / 2] = 3; + HopkinsArr[236 / 2] = 0; + HopkinsArr[238 / 2] = 3; + break; + case 2: + HopkinsArr[0] = 0; + HopkinsArr[2 / 2] = -2; + HopkinsArr[4 / 2] = 0; + HopkinsArr[6 / 2] = 0; + HopkinsArr[8 / 2] = 0; + HopkinsArr[10 / 2] = -3; + HopkinsArr[12 / 2] = 0; + HopkinsArr[14 / 2] = -2; + HopkinsArr[16 / 2] = 0; + HopkinsArr[18 / 2] = -2; + HopkinsArr[20 / 2] = 0; + HopkinsArr[22 / 2] = -1; + HopkinsArr[24 / 2] = 0; + HopkinsArr[26 / 2] = -2; + HopkinsArr[28 / 2] = 0; + HopkinsArr[30 / 2] = -1; + HopkinsArr[32 / 2] = 0; + HopkinsArr[34 / 2] = -3; + HopkinsArr[36 / 2] = 0; + HopkinsArr[38 / 2] = -2; + HopkinsArr[40 / 2] = 0; + HopkinsArr[42 / 2] = -2; + HopkinsArr[44 / 2] = 0; + HopkinsArr[46 / 2] = -2; + HopkinsArr[48 / 2] = 8; + HopkinsArr[50 / 2] = 0; + HopkinsArr[52 / 2] = 9; + HopkinsArr[54 / 2] = 0; + HopkinsArr[56 / 2] = 5; + HopkinsArr[58 / 2] = 0; + HopkinsArr[60 / 2] = 9; + HopkinsArr[62 / 2] = 0; + HopkinsArr[64 / 2] = 7; + HopkinsArr[66 / 2] = 0; + HopkinsArr[68 / 2] = 7; + HopkinsArr[70 / 2] = 0; + HopkinsArr[72 / 2] = 7; + HopkinsArr[74 / 2] = 0; + HopkinsArr[76 / 2] = 7; + HopkinsArr[78 / 2] = 0; + HopkinsArr[80 / 2] = 6; + HopkinsArr[82 / 2] = 0; + HopkinsArr[84 / 2] = 7; + HopkinsArr[86 / 2] = 0; + HopkinsArr[88 / 2] = 6; + HopkinsArr[90 / 2] = 0; + HopkinsArr[92 / 2] = 9; + HopkinsArr[94 / 2] = 0; + HopkinsArr[96 / 2] = 8; + HopkinsArr[98 / 2] = 0; + HopkinsArr[100 / 2] = 9; + HopkinsArr[102 / 2] = 0; + HopkinsArr[104 / 2] = 5; + HopkinsArr[106 / 2] = 0; + HopkinsArr[108 / 2] = 9; + HopkinsArr[110 / 2] = 0; + HopkinsArr[112 / 2] = 7; + HopkinsArr[114 / 2] = 0; + HopkinsArr[116 / 2] = 7; + HopkinsArr[118 / 2] = 0; + HopkinsArr[120 / 2] = 7; + HopkinsArr[122 / 2] = 0; + HopkinsArr[124 / 2] = 7; + HopkinsArr[126 / 2] = 0; + HopkinsArr[128 / 2] = 6; + HopkinsArr[130 / 2] = 0; + HopkinsArr[132 / 2] = 7; + HopkinsArr[134 / 2] = 0; + HopkinsArr[136 / 2] = 6; + HopkinsArr[138 / 2] = 0; + HopkinsArr[140 / 2] = 9; + HopkinsArr[142 / 2] = 0; + HopkinsArr[144 / 2] = 8; + HopkinsArr[146 / 2] = 0; + HopkinsArr[148 / 2] = 9; + HopkinsArr[150 / 2] = 0; + HopkinsArr[152 / 2] = 5; + HopkinsArr[154 / 2] = 0; + HopkinsArr[156 / 2] = 9; + HopkinsArr[158 / 2] = 0; + HopkinsArr[160 / 2] = 7; + HopkinsArr[162 / 2] = 0; + HopkinsArr[164 / 2] = 7; + HopkinsArr[166 / 2] = 0; + HopkinsArr[168 / 2] = 7; + HopkinsArr[170 / 2] = 0; + HopkinsArr[172 / 2] = 7; + HopkinsArr[174 / 2] = 0; + HopkinsArr[176 / 2] = 6; + HopkinsArr[178 / 2] = 0; + HopkinsArr[180 / 2] = 7; + HopkinsArr[182 / 2] = 0; + HopkinsArr[184 / 2] = 6; + HopkinsArr[186 / 2] = 0; + HopkinsArr[188 / 2] = 9; + HopkinsArr[190 / 2] = 0; + HopkinsArr[192 / 2] = 0; + HopkinsArr[194 / 2] = 2; + HopkinsArr[196 / 2] = 0; + HopkinsArr[198 / 2] = 0; + HopkinsArr[200 / 2] = 0; + HopkinsArr[202 / 2] = 2; + HopkinsArr[204 / 2] = 0; + HopkinsArr[206 / 2] = 1; + HopkinsArr[208 / 2] = 0; + HopkinsArr[210 / 2] = 2; + HopkinsArr[212 / 2] = 0; + HopkinsArr[214 / 2] = 2; + HopkinsArr[216 / 2] = 0; + HopkinsArr[218 / 2] = 2; + HopkinsArr[220 / 2] = 0; + HopkinsArr[222 / 2] = 2; + HopkinsArr[224 / 2] = 0; + HopkinsArr[226 / 2] = 2; + HopkinsArr[228 / 2] = 0; + HopkinsArr[230 / 2] = 1; + HopkinsArr[232 / 2] = 0; + HopkinsArr[234 / 2] = 2; + HopkinsArr[236 / 2] = 0; + HopkinsArr[238 / 2] = 2; + break; + default: + break; + } + + g_old_anim = -1; + g_old_sens = -1; +} + +void Globals::INIT_ANIM() { + for (int idx = 0; idx < 35; ++idx) { + Bge_Anim[idx].field0 = PTRNUL; + Bge_Anim[idx].field4 = 0; + } + + for (int idx = 0; idx < 8; ++idx) { + Bank[idx].field0 = PTRNUL; + Bank[idx].field4 = 0; + Bank[idx].field5 = 0; + Bank[idx].field19 = 0; + Bank[idx].field1C = 0; + } +} + +void Globals::INIT_VBOB() { + for (int idx = 0; idx < 30; ++idx) { + VBob[idx].field4 = 0; + VBob[idx].field6 = 0; + VBob[idx].field8 = 0; + VBob[idx].fieldA = 0; + VBob[idx].fieldC = 0; + VBob[idx].field10 = PTRNUL; + VBob[idx].field0 = PTRNUL; + VBob[idx].field1C = PTRNUL; + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 9867376415..b9fa044a93 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -28,6 +28,70 @@ namespace Hopkins { +struct TxtItem { + int field0; + int field12; + int field3FC; + int field3FE; + int field400; + int field404; + int field406; + int field408; +}; + +struct ListeTxtItem { + int field0; +}; + +struct ZonePItem { + int field0; + int field2; + int field4; +}; + +struct LigneItem { + int field0; + int field2; + int field4; + int field6; + int field8; + byte *field12; +}; + +struct LigneZoneItem { + int field0; + int field2; + byte *field4; +}; + +struct CarreZoneItem { + int field0; +}; + +struct BgeAnimItem { + byte *field0; + int field4; +}; + +struct BankItem { + byte *field0; + int8 field4; + int8 field5; + int8 field19; + uint32 field1C; +}; + +struct VBobItem { + byte *field0; + int field4; + int field6; + int field8; + int fieldA; + int fieldC; + byte *field10; + byte *field1C; +}; + /** * Engine Globals */ @@ -46,6 +110,7 @@ public: bool XFORCE16; bool XFORCE8; bool CARD_SB; + int PERSO_TYPE; int vitesse; int INSTALL_TYPE; Common::String HOPIMAGE; @@ -59,17 +124,80 @@ public: Common::String HOPSEQ; Common::String FICH_ZONE; Common::String FICH_TEXTE; + Common::String NFICHIER; int SOUNDVOL; int MUSICVOL; int VOICEVOL; bool SOUNDOFF; bool MUSICOFF; bool VOICEOFF; + bool CENSURE; + int min_x; + int min_y; + int max_x; + int max_y; + int lItCounter; + int lOldItCounter; + int g_old_anim; + int g_old_sens; + int HopkinsArr[140]; + void *police; + int police_l; + int police_h; + byte *TETE; + byte *ICONE; + byte *BUF_ZONE; + byte *CACHE_BANQUE[6]; + TxtItem Txt[11]; + ListeTxtItem ListeTxt[11]; + ZonePItem ZoneP[105]; + LigneItem Ligne[400]; + LigneZoneItem LigneZone[400]; + CarreZoneItem CarreZone[100]; + BgeAnimItem Bge_Anim[35]; + BankItem Bank[8]; + VBobItem VBob[35]; + byte *Winventaire; + byte *texte_tmp; + int texte_long; + int TEXTE_FORMATE; + byte *SPRITE_ECRAN; + byte *SAUVEGARDE; + byte *BUFFERTAPE; + byte *essai0; + byte *essai1; + byte *essai2; + byte *Bufferobjet; + byte *inventaire2; + byte *GESTE; + int OBJET_EN_COURS; + int NUM_FICHIER_OBJ; + int nbrligne; + int largeur_boite; + byte *INVENTAIRE_OBJET; + int hauteur_boite; + bool GESTE_FLAG; + byte *FORETSPR; + int FORET; + byte *COUCOU; + byte *chemin; + byte *cache_souris; + byte *BufLig; + byte *Bufferdecor; + byte *ADR_FICHIER_OBJ; Globals(); + ~Globals(); + void setConfig(); + void clearAll(); + void HOPKINS_DATA(); + void INIT_ANIM(); + void INIT_VBOB(); }; +#define PTRNUL (byte *)NULL + } // End of namespace Hopkins #endif /* HOPKINS_GLOBALS_H */ diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ebf97c308d..8321457374 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -25,6 +25,7 @@ #include "common/debug-channels.h" #include "common/events.h" #include "common/file.h" +#include "engines/util.h" #include "hopkins/hopkins.h" #include "hopkins/files.h" @@ -50,53 +51,11 @@ Common::Error HopkinsEngine::run() { FileManager::Chage_Inifile(iniParams); processIniParams(iniParams); + GLOBALS.setConfig(); + FileManager::F_Censure(); + INIT_SYSTEM(); + /* - if ( FR == 1 ) - { - *(_DWORD *)FICH_ZONE = dword_807B6E6; - *(_DWORD *)&FICH_ZONE[4] = dword_807B6EA; - *(_WORD *)&FICH_ZONE[8] = word_807B6EE; - FICH_ZONE[10] = byte_807B6F0; - *(_DWORD *)FICH_TEXTE = dword_807B6F1; - *(_DWORD *)&FICH_TEXTE[4] = dword_807B6F5; - *(_DWORD *)&FICH_TEXTE[8] = dword_807B6F9; - } - if ( !FR ) - { - *(_DWORD *)FICH_ZONE = dword_807B6FD; - *(_DWORD *)&FICH_ZONE[4] = dword_807B701; - *(_WORD *)&FICH_ZONE[8] = word_807B705; - FICH_ZONE[10] = byte_807B707; - *(_DWORD *)FICH_TEXTE = dword_807B708; - *(_DWORD *)&FICH_TEXTE[4] = dword_807B70C; - *(_DWORD *)&FICH_TEXTE[8] = dword_807B710; - } - if ( FR == 2 ) - { - *(_DWORD *)FICH_ZONE = dword_807B714; - *(_DWORD *)&FICH_ZONE[4] = dword_807B718; - *(_WORD *)&FICH_ZONE[8] = word_807B71C; - FICH_ZONE[10] = byte_807B71E; - *(_DWORD *)FICH_TEXTE = dword_807B71F; - *(_DWORD *)&FICH_TEXTE[4] = dword_807B723; - *(_DWORD *)&FICH_TEXTE[8] = dword_807B727; - } - *(_DWORD *)HOPSOUND = dword_807B72B; - *(_WORD *)&HOPSOUND[4] = word_807B72F; - *(_DWORD *)HOPMUSIC = dword_807B731; - *(_WORD *)&HOPMUSIC[4] = word_807B735; - *(_DWORD *)HOPVOICE = dword_807B737; - *(_WORD *)&HOPVOICE[4] = word_807B73B; - *(_DWORD *)HOPANM = dword_807B73D; - *(_DWORD *)HOPSEQ = dword_807B741; - MUSICVOL = 6; - SOUNDVOL = 6; - VOICEVOL = 6; - MUSICOFF = 0; - SOUNDOFF = 0; - VOICEOFF = 0; - F_Censure(); - INIT_SYSTEM(); REDRAW = 0; SDL_WM_SetCaption("Hopkins FBI for Linux ", "LINUX"); Init_Interrupt(); @@ -126,7 +85,7 @@ Common::Error HopkinsEngine::run() { INTRORUN(a1); iRegul = 0; CONSTRUIT_SYSTEM("PERSO.SPR"); - PERSO = CHARGE_FICHIER(NFICHIER); + PERSO = CHARGE_FICHIER(GLOBALS.NFICHIER); PERSO_TYPE = 0; PLANX = 0; PLANY = 0; @@ -538,4 +497,80 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { GLOBALS.CARD_SB = iniParams["SOUND"] == "YES"; } +void HopkinsEngine::INIT_SYSTEM() { + initGraphics(640, 480, true); + + // TODO: init surfaces + //VESA_SCREEN = dos_malloc2(0x96000u); + //VESA_BUFFER = dos_malloc2(0x96000u); + _mouse.mouse_linux = true; + + switch (GLOBALS.FR) { + case 0: + if (!_mouse.mouse_linux) + FileManager::CONSTRUIT_SYSTEM("SOUAN.SPR"); + if (!GLOBALS.FR && _mouse.mouse_linux) + FileManager::CONSTRUIT_SYSTEM("LSOUAN.SPR"); + break; + case 1: + FileManager::CONSTRUIT_SYSTEM("LSOUFR.SPR"); + break; + case 2: + FileManager::CONSTRUIT_SYSTEM("SOUES.SPR"); + break; + } + + if (_mouse.mouse_linux) { + _mouse.souris_sizex = 52; + _mouse.souris_sizey = 32; + } else { + _mouse.souris_sizex = 34; + _mouse.souris_sizey = 20; + } + _mouse.pointeur_souris = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + + GLOBALS.clearAll(); + + FileManager::CONSTRUIT_SYSTEM("FONTE3.SPR"); + GLOBALS.police = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + GLOBALS.police_l = 12; + GLOBALS.police_h = 21; + FileManager::CONSTRUIT_SYSTEM("ICONE.SPR"); + GLOBALS.ICONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + FileManager::CONSTRUIT_SYSTEM("TETE.SPR"); + GLOBALS.TETE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + + switch (GLOBALS.FR) { + case 0: + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEAN.TXT"); + GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + case 1: + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONE01.TXT"); + GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + case 2: + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEES.TXT"); + GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + } + + GLOBALS.min_x = 0; + GLOBALS.min_y = 20; + GLOBALS.max_x = 1280; + GLOBALS.max_y = 460; + + _mouse.INSTALL_SOURIS(); + _mouse.souris_on(); + _mouse.souris_flag = false; + _mouse.souris_max(); + + GLOBALS.HOPKINS_DATA(); + + _mouse.ofset_souris_x = 0; + _mouse.ofset_souris_y = 0; + GLOBALS.lItCounter = 0; + GLOBALS.lOldItCounter = 0; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 57dc3ea7ad..e9976e5be4 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -30,6 +30,8 @@ #include "common/hash-str.h" #include "common/util.h" #include "engines/engine.h" +#include "graphics/surface.h" +#include "hopkins/events.h" #include "hopkins/globals.h" /** @@ -60,11 +62,16 @@ class HopkinsEngine : public Engine { private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; + Graphics::Surface VESA_SCREEN; + Graphics::Surface VESA_BUFFER; + Mouse _mouse; /** * Processes the loaded list of ini file parameters */ void processIniParams(Common::StringMap &iniParams); + + void INIT_SYSTEM(); protected: // Engine APIs virtual Common::Error run(); diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index fd259e9148..702a8c0a8f 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -2,6 +2,7 @@ MODULE := engines/hopkins MODULE_OBJS := \ detection.o \ + events.o \ files.o \ globals.o \ hopkins.o -- cgit v1.2.3 From ca84b2737f6bd1c6c971d5ff7451cfb164afadb8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Sep 2012 21:43:33 +1000 Subject: HOPKINS: Add object loading --- engines/hopkins/files.cpp | 5 +++ engines/hopkins/files.h | 1 + engines/hopkins/globals.cpp | 93 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/globals.h | 21 ++++++++++ engines/hopkins/graphics.cpp | 88 +++++++++++++++++++++++++++++++++++++++++ engines/hopkins/graphics.h | 45 +++++++++++++++++++++ engines/hopkins/hopkins.cpp | 15 ++++--- engines/hopkins/hopkins.h | 1 + engines/hopkins/module.mk | 4 +- engines/hopkins/sound.cpp | 32 +++++++++++++++ engines/hopkins/sound.h | 38 ++++++++++++++++++ 11 files changed, 337 insertions(+), 6 deletions(-) create mode 100644 engines/hopkins/graphics.cpp create mode 100644 engines/hopkins/graphics.h create mode 100644 engines/hopkins/sound.cpp create mode 100644 engines/hopkins/sound.h diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 1d9c3adb54..40cd238d1e 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -158,4 +158,9 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::Str GLOBALS.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); } +byte *FileManager::LIBERE_FICHIER(byte *ptr) { + free(ptr); + return PTRNUL; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index b90b80b3c5..52412c11e8 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -42,6 +42,7 @@ public: static void F_Censure(); 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); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1c47b9b275..f6db20fe8f 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -22,6 +22,8 @@ #include "common/textconsole.h" #include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/files.h" namespace Hopkins { @@ -65,6 +67,18 @@ Globals::Globals() { BufLig = NULL; Bufferdecor = NULL; ADR_FICHIER_OBJ = NULL; + + // Reset flags + XFULLSCREEN = false; + XFORCE16 = false; + XFORCE8 = false; + CARD_SB = false; + SOUNDOFF = false; + MUSICOFF = false; + VOICEOFF = false; + CENSURE = false; + GESTE_FLAG = false; + redraw = false; } Globals::~Globals() { @@ -618,4 +632,83 @@ void Globals::INIT_VBOB() { } } +void Globals::CHARGE_OBJET() { + FileManager::CONSTRUIT_SYSTEM("OBJET.DAT"); + byte *data = FileManager::CHARGE_FICHIER(NFICHIER); + byte *srcP = data; + + for (int idx = 0; idx < 300; ++idx) { + ObjetW[idx].field0 = *srcP++; + ObjetW[idx].field1 = *srcP++; + ObjetW[idx].field2 = *srcP++; + ObjetW[idx].field3 = *srcP++; + ObjetW[idx].field4 = *srcP++; + ObjetW[idx].field5 = *srcP++; + ObjetW[idx].field6 = *srcP++; + ObjetW[idx].field7 = *srcP++; + } + + free(data); +} + +byte *Globals::CHANGE_OBJET(int objIndex) { + byte *result = CAPTURE_OBJET(objIndex, 1); + Bufferobjet = result; + Nouv_objet = 1; + OBJET_EN_COURS = objIndex; + return result; +} + +byte *Globals::CAPTURE_OBJET(int objIndex, int mode) { + byte *result = NULL; + byte *dataP; + + dataP = 0; + int v2 = ObjetW[objIndex].field0; + int v3 = ObjetW[objIndex].field1; + + if (mode == 1) + ++v3; + if (v2 != NUM_FICHIER_OBJ) { + if (ADR_FICHIER_OBJ != PTRNUL) + ObjectManager::DEL_FICHIER_OBJ(); + if (v2 == 1) { + FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); + ADR_FICHIER_OBJ = ObjectManager::CHARGE_SPRITE(NFICHIER); + } + NUM_FICHIER_OBJ = v2; + } + + int width = ObjectManager::Get_Largeur(ADR_FICHIER_OBJ, v3); + int height = ObjectManager::Get_Hauteur(ADR_FICHIER_OBJ, v3); + OBJL = width; + OBJH = height; + + switch (mode) { + case 0: + dataP = (byte *)malloc(height * width); + if (dataP == PTRNUL) + error("CAPTURE_OBJET"); + + ObjectManager::capture_mem_sprite(ADR_FICHIER_OBJ, dataP, v3); + break; + + case 1: + ObjectManager::sprite_alone(ADR_FICHIER_OBJ, Bufferobjet, v3); + result = Bufferobjet; + break; + + case 3: + ObjectManager::capture_mem_sprite(ADR_FICHIER_OBJ, INVENTAIRE_OBJET, v3); + result = INVENTAIRE_OBJET; + break; + + default: + result = dataP; + break; + } + + return result; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index b9fa044a93..47100bb7ba 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -92,6 +92,17 @@ struct VBobItem { byte *field1C; }; +struct ObjetWItem { + byte field0; + byte field1; + byte field2; + byte field3; + byte field4; + byte field5; + byte field6; + byte field7; +}; + /** * Engine Globals */ @@ -157,6 +168,7 @@ public: BgeAnimItem Bge_Anim[35]; BankItem Bank[8]; VBobItem VBob[35]; + ObjetWItem ObjetW[300]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -185,6 +197,9 @@ public: byte *BufLig; byte *Bufferdecor; byte *ADR_FICHIER_OBJ; + bool redraw; + int OBJL, OBJH; + int Nouv_objet; Globals(); ~Globals(); @@ -194,8 +209,14 @@ public: void HOPKINS_DATA(); void INIT_ANIM(); void INIT_VBOB(); + void CHARGE_OBJET(); + byte *CHANGE_OBJET(int objIndex); + byte *CAPTURE_OBJET(int objIndex, int mode); }; +// TODO: The original pointed PTRNUL to a specially allocated memory block. If this proves +// to be necsesary, all malloc calls will need to be replaced with a stub that sets the +// result to PTRNUL if the memory block can't be allocated #define PTRNUL (byte *)NULL } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp new file mode 100644 index 0000000000..01a673f020 --- /dev/null +++ b/engines/hopkins/graphics.cpp @@ -0,0 +1,88 @@ +/* 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 "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" + +namespace Hopkins { + +int ObjectManager::Get_Largeur(const byte *objectData, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i ) + objP += READ_LE_UINT32(objP) + 16; + + return READ_LE_UINT16(objP + 4); +} + +int ObjectManager::Get_Hauteur(const byte *objectData, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) + objP += READ_LE_UINT32(objP) + 16; + + return READ_LE_UINT16(objP + 6); +} + +int ObjectManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) { + objP += READ_LE_UINT32(objP) + 16; + } + + objP += 4; + int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); + + memcpy(sprite + 3, objP - 4, result + 16); + return result; +} + +byte *ObjectManager::DEL_FICHIER_OBJ() { + GLOBALS.NUM_FICHIER_OBJ = 0; + if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) + GLOBALS.ADR_FICHIER_OBJ = FileManager::LIBERE_FICHIER(GLOBALS.ADR_FICHIER_OBJ); + + byte *result = PTRNUL; + GLOBALS.ADR_FICHIER_OBJ = PTRNUL; + return result; +} + +byte *ObjectManager::CHARGE_SPRITE(const Common::String &file) { + FileManager::DMESS1(); + return FileManager::CHARGE_FICHIER(file); +} + +int ObjectManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) { + objP += READ_LE_UINT32(objP) + 16; + } + + objP += 4; + int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); + + memcpy(sprite, objP + 12, result); + return result; +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h new file mode 100644 index 0000000000..523ab28575 --- /dev/null +++ b/engines/hopkins/graphics.h @@ -0,0 +1,45 @@ +/* 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_GRAPHICS_H +#define HOPKINS_GRAPHICS_H + +#include "common/scummsys.h" +#include "common/endian.h" +#include "common/str.h" + +namespace Hopkins { + +class ObjectManager { +public: + static int Get_Largeur(const byte *objectData, int objIndex); + static int Get_Hauteur(const byte *objectData, int objIndex); + static int sprite_alone(const byte *objectData, byte *sprite, int objIndex); + static byte *DEL_FICHIER_OBJ(); + + static byte *CHARGE_SPRITE(const Common::String &file); + static int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_GRAPHICS_H */ diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 8321457374..ecadd25953 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -28,6 +28,7 @@ #include "engines/util.h" #include "hopkins/hopkins.h" #include "hopkins/files.h" +#include "hopkins/sound.h" namespace Hopkins { @@ -54,13 +55,13 @@ Common::Error HopkinsEngine::run() { GLOBALS.setConfig(); FileManager::F_Censure(); INIT_SYSTEM(); + Init_Interrupt(); + + SoundManager::WSOUND_INIT(); + + GLOBALS.CHARGE_OBJET(); /* - REDRAW = 0; - SDL_WM_SetCaption("Hopkins FBI for Linux ", "LINUX"); - Init_Interrupt(); - WSOUND_INIT(); - CHARGE_OBJET(); CHANGE_OBJET(14); AJOUTE_OBJET(14); HELICO = 0; @@ -573,4 +574,8 @@ void HopkinsEngine::INIT_SYSTEM() { GLOBALS.lOldItCounter = 0; } +void HopkinsEngine::Init_Interrupt() { + // TODO: Determine whether the timer is needed +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index e9976e5be4..641be0113a 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -72,6 +72,7 @@ private: void processIniParams(Common::StringMap &iniParams); void INIT_SYSTEM(); + void Init_Interrupt(); protected: // Engine APIs virtual Common::Error run(); diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 702a8c0a8f..2bff26dbb2 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -4,8 +4,10 @@ MODULE_OBJS := \ detection.o \ events.o \ files.o \ + graphics.o \ globals.o \ - hopkins.o + hopkins.o \ + sound.o # This module can be built as a plugin ifeq ($(ENABLE_HOPKINS), DYNAMIC_PLUGIN) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp new file mode 100644 index 0000000000..f11bc25cae --- /dev/null +++ b/engines/hopkins/sound.cpp @@ -0,0 +1,32 @@ +/* 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 "hopkins/sound.h" + +namespace Hopkins { + +void SoundManager::WSOUND_INIT() { + // TODO: WSOUND_INIT +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h new file mode 100644 index 0000000000..15469ff8b5 --- /dev/null +++ b/engines/hopkins/sound.h @@ -0,0 +1,38 @@ +/* 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_SOUND_H +#define HOPKINS_SOUND_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class SoundManager { +public: + static void WSOUND_INIT(); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_SOUND_H */ -- cgit v1.2.3 From ecee539bfde463648d69e0330500ab5ad3cde080 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Sep 2012 23:43:35 +1000 Subject: HOPKINS: Implement proper graphics initialisation code --- engines/hopkins/events.cpp | 8 ++- engines/hopkins/events.h | 3 + engines/hopkins/files.cpp | 2 +- engines/hopkins/globals.cpp | 71 +++------------------- engines/hopkins/globals.h | 8 +-- engines/hopkins/graphics.cpp | 136 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/graphics.h | 29 +++++++++ engines/hopkins/hopkins.cpp | 14 +++-- engines/hopkins/hopkins.h | 2 + 9 files changed, 196 insertions(+), 77 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index c714338574..f498a4e383 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -30,8 +30,6 @@ void Mouse::INSTALL_SOURIS() { } void Mouse::souris_on() { - bool result; // eax@5 - souris_flag = true; if (mouse_linux) { @@ -59,4 +57,10 @@ void Mouse::souris_max() { // No implementation in original } +void Mouse::hideCursor() { +} + +void Mouse::showCursor() { +} + } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index c6fb6a3eab..3293d10b7a 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -46,6 +46,9 @@ public: void souris_on(); void souris_xy(int xp, int yp); void souris_max(); + + void hideCursor(); + void showCursor(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 40cd238d1e..cf6c06f22c 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -107,7 +107,7 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { // Allocate space for the file contents size_t filesize = f.size(); - byte *data = (byte *)malloc(filesize); + byte *data = GLOBALS.dos_malloc2(filesize); if (!data) error("Error allocating space for file being loaded - %s", file.c_str()); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f6db20fe8f..1f00651f9c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -203,9 +203,9 @@ void Globals::clearAll() { texte_long = 0; texte_tmp = PTRNUL; - BUFFERTAPE = (byte *)malloc(85000); + BUFFERTAPE = dos_malloc2(85000); - SAUVEGARDE = (byte *)malloc(2050); + SAUVEGARDE = dos_malloc2(2050); memset(SAUVEGARDE, 0, 1999); essai0 = BUFFERTAPE; @@ -215,14 +215,14 @@ void Globals::clearAll() { largeur_boite = 240; TEXTE_FORMATE = 300; - Bufferobjet = (byte *)malloc(2500); - INVENTAIRE_OBJET = (byte *)malloc(2500); + Bufferobjet = dos_malloc2(2500); + INVENTAIRE_OBJET = dos_malloc2(2500); ADR_FICHIER_OBJ = PTRNUL; FORETSPR = PTRNUL; FORET = 0; - cache_souris = (byte *)malloc(2500); + cache_souris = dos_malloc2(2500); GESTE = PTRNUL; GESTE_FLAG = false; } @@ -651,63 +651,10 @@ void Globals::CHARGE_OBJET() { free(data); } -byte *Globals::CHANGE_OBJET(int objIndex) { - byte *result = CAPTURE_OBJET(objIndex, 1); - Bufferobjet = result; - Nouv_objet = 1; - OBJET_EN_COURS = objIndex; - return result; -} - -byte *Globals::CAPTURE_OBJET(int objIndex, int mode) { - byte *result = NULL; - byte *dataP; - - dataP = 0; - int v2 = ObjetW[objIndex].field0; - int v3 = ObjetW[objIndex].field1; - - if (mode == 1) - ++v3; - if (v2 != NUM_FICHIER_OBJ) { - if (ADR_FICHIER_OBJ != PTRNUL) - ObjectManager::DEL_FICHIER_OBJ(); - if (v2 == 1) { - FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); - ADR_FICHIER_OBJ = ObjectManager::CHARGE_SPRITE(NFICHIER); - } - NUM_FICHIER_OBJ = v2; - } - - int width = ObjectManager::Get_Largeur(ADR_FICHIER_OBJ, v3); - int height = ObjectManager::Get_Hauteur(ADR_FICHIER_OBJ, v3); - OBJL = width; - OBJH = height; - - switch (mode) { - case 0: - dataP = (byte *)malloc(height * width); - if (dataP == PTRNUL) - error("CAPTURE_OBJET"); - - ObjectManager::capture_mem_sprite(ADR_FICHIER_OBJ, dataP, v3); - break; - - case 1: - ObjectManager::sprite_alone(ADR_FICHIER_OBJ, Bufferobjet, v3); - result = Bufferobjet; - break; - - case 3: - ObjectManager::capture_mem_sprite(ADR_FICHIER_OBJ, INVENTAIRE_OBJET, v3); - result = INVENTAIRE_OBJET; - break; - - default: - result = dataP; - break; - } - +byte *Globals::dos_malloc2(int count) { + byte *result = (byte *)malloc(count); + if (!result) + result = PTRNUL; return result; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 47100bb7ba..3289a49575 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -180,6 +180,7 @@ public: byte *essai1; byte *essai2; byte *Bufferobjet; + int INVENTAIRE[36]; byte *inventaire2; byte *GESTE; int OBJET_EN_COURS; @@ -200,6 +201,7 @@ public: bool redraw; int OBJL, OBJH; int Nouv_objet; + int HELICO; Globals(); ~Globals(); @@ -210,13 +212,9 @@ public: void INIT_ANIM(); void INIT_VBOB(); void CHARGE_OBJET(); - byte *CHANGE_OBJET(int objIndex); - byte *CAPTURE_OBJET(int objIndex, int mode); + byte *dos_malloc2(int count); }; -// TODO: The original pointed PTRNUL to a specially allocated memory block. If this proves -// to be necsesary, all malloc calls will need to be replaced with a stub that sets the -// result to PTRNUL if the memory block can't be allocated #define PTRNUL (byte *)NULL } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 01a673f020..7b04e1f1ba 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "engines/util.h" #include "hopkins/files.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" @@ -28,9 +29,69 @@ namespace Hopkins { +byte *ObjectManager::CHANGE_OBJET(int objIndex) { + byte *result = ObjectManager::CAPTURE_OBJET(objIndex, 1); + GLOBALS.Bufferobjet = result; + GLOBALS.Nouv_objet = 1; + GLOBALS.OBJET_EN_COURS = objIndex; + return result; +} + +byte *ObjectManager::CAPTURE_OBJET(int objIndex, int mode) { + byte *result = NULL; + byte *dataP; + + dataP = 0; + int v2 = GLOBALS.ObjetW[objIndex].field0; + int v3 = GLOBALS.ObjetW[objIndex].field1; + + if (mode == 1) + ++v3; + if (v2 != GLOBALS.NUM_FICHIER_OBJ) { + if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) + ObjectManager::DEL_FICHIER_OBJ(); + if (v2 == 1) { + FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); + GLOBALS.ADR_FICHIER_OBJ = ObjectManager::CHARGE_SPRITE(GLOBALS.NFICHIER); + } + GLOBALS.NUM_FICHIER_OBJ = v2; + } + + int width = ObjectManager::Get_Largeur(GLOBALS.ADR_FICHIER_OBJ, v3); + int height = ObjectManager::Get_Hauteur(GLOBALS.ADR_FICHIER_OBJ, v3); + GLOBALS.OBJL = width; + GLOBALS.OBJH = height; + + switch (mode) { + case 0: + dataP = GLOBALS.dos_malloc2(height * width); + if (dataP == PTRNUL) + error("CAPTURE_OBJET"); + + ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, dataP, v3); + break; + + case 1: + ObjectManager::sprite_alone(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.Bufferobjet, v3); + result = GLOBALS.Bufferobjet; + break; + + case 3: + ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.INVENTAIRE_OBJET, v3); + result = GLOBALS.INVENTAIRE_OBJET; + break; + + default: + result = dataP; + break; + } + + return result; +} + int ObjectManager::Get_Largeur(const byte *objectData, int objIndex) { const byte *objP = objectData + 3; - for (int i = objIndex; i; --i ) + for (int i = objIndex; i; --i) objP += READ_LE_UINT32(objP) + 16; return READ_LE_UINT16(objP + 4); @@ -85,4 +146,77 @@ int ObjectManager::capture_mem_sprite(const byte *objectData, byte *sprite, int return result; } +int ObjectManager::AJOUTE_OBJET(int objIndex) { + bool flag = false; + int arrIndex = 0; + do { + ++arrIndex; + if (!GLOBALS.INVENTAIRE[arrIndex]) + flag = true; + if (arrIndex == 32) + flag = true; + } while (!flag); + + GLOBALS.INVENTAIRE[arrIndex] = objIndex; + return arrIndex; +} + +GraphicsManager::GraphicsManager() { + SDL_MODEYES = false; +} + +void GraphicsManager::SET_MODE(int width, int height) { + if (!SDL_MODEYES) { + SDL_ECHELLE = 0; + + if (GLOBALS.XSETMODE == 1) + SDL_ECHELLE = 0; + if (GLOBALS.XSETMODE == 2) + SDL_ECHELLE = 25; + if (GLOBALS.XSETMODE == 3) + SDL_ECHELLE = 50; + if (GLOBALS.XSETMODE == 4) + SDL_ECHELLE = 75; + if (GLOBALS.XSETMODE == 5) + SDL_ECHELLE = GLOBALS.XZOOM; + + int bpp = 8; + if (GLOBALS.XFORCE8 == 1) + bpp = 8; + if (GLOBALS.XFORCE16 == 1) + bpp = 16; + + if (SDL_ECHELLE) { + error("TODO: Implement zooming support"); + //width = Reel_Zoom(a1, SDL_ECHELLE); + //height = Reel_Zoom(a2, SDL_ECHELLE); + } + + if (bpp == 8) + initGraphics(width, height, true); + else { + Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + initGraphics(width, height, true, &pixelFormat); + } + + XSCREEN = width; + YSCREEN = height; + + Linear = true; + Winbpp = bpp; + WinScan = width; + + PAL_PIXELS = SD_PIXELS; + nbrligne = width; + + for (int idx = 0; idx < 256; ++idx) { + cmap[idx].r = cmap[idx].g = cmap[idx].b = 0; + } + + SDL_MODEYES = true; + } else { + error("Called SET_MODE multiple times"); + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 523ab28575..de80160dda 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -29,8 +29,17 @@ namespace Hopkins { +struct RGB8 { + byte r; + byte g; + byte b; +}; + class ObjectManager { public: + static byte *CHANGE_OBJET(int objIndex); + static byte *CAPTURE_OBJET(int objIndex, int mode); + static int Get_Largeur(const byte *objectData, int objIndex); static int Get_Hauteur(const byte *objectData, int objIndex); static int sprite_alone(const byte *objectData, byte *sprite, int objIndex); @@ -38,6 +47,26 @@ public: static byte *CHARGE_SPRITE(const Common::String &file); static int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); + static int AJOUTE_OBJET(int objIndex); +}; + +class GraphicsManager { +public: + bool SDL_MODEYES; + int SDL_ECHELLE; + int XSCREEN; + int YSCREEN; + int WinScan; + int Winbpp; + byte SD_PIXELS[514]; + byte *PAL_PIXELS; + int nbrligne; + RGB8 cmap[256]; + bool Linear; +public: + GraphicsManager(); + + void SET_MODE(int width, int height); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ecadd25953..342d7d2361 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -25,7 +25,7 @@ #include "common/debug-channels.h" #include "common/events.h" #include "common/file.h" -#include "engines/util.h" +#include "hopkins/graphics.h" #include "hopkins/hopkins.h" #include "hopkins/files.h" #include "hopkins/sound.h" @@ -60,12 +60,13 @@ Common::Error HopkinsEngine::run() { SoundManager::WSOUND_INIT(); GLOBALS.CHARGE_OBJET(); + ObjectManager::CHANGE_OBJET(14); + ObjectManager::AJOUTE_OBJET(14); + + GLOBALS.HELICO = 0; + _mouse.hideCursor(); /* - CHANGE_OBJET(14); - AJOUTE_OBJET(14); - HELICO = 0; - SDL_ShowCursor(0); DD_Lock(); Cls_Video(); DD_Unlock(); @@ -499,7 +500,8 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { } void HopkinsEngine::INIT_SYSTEM() { - initGraphics(640, 480, true); + // Set graphics mode + _graphicsManager.SET_MODE(640, 480); // TODO: init surfaces //VESA_SCREEN = dos_malloc2(0x96000u); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 641be0113a..5f6b19d47a 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "hopkins/events.h" #include "hopkins/globals.h" +#include "hopkins/graphics.h" /** * This is the namespace of the Hopkins engine. @@ -65,6 +66,7 @@ private: Graphics::Surface VESA_SCREEN; Graphics::Surface VESA_BUFFER; Mouse _mouse; + GraphicsManager _graphicsManager; /** * Processes the loaded list of ini file parameters -- cgit v1.2.3 From 42a09f00b336ce3405ff7558719f07e6f15326aa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 00:12:27 +1000 Subject: HOPKINS: Implemented screen lock, unlock, and clear screen --- engines/hopkins/graphics.cpp | 26 ++++++++++++++++++++++++-- engines/hopkins/graphics.h | 6 ++++++ engines/hopkins/hopkins.cpp | 8 ++++---- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7b04e1f1ba..21c5d6c478 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/rect.h" #include "engines/util.h" #include "hopkins/files.h" #include "hopkins/globals.h" @@ -161,10 +162,16 @@ int ObjectManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } +/*------------------------------------------------------------------------*/ + GraphicsManager::GraphicsManager() { SDL_MODEYES = false; } +GraphicsManager::~GraphicsManager() { +} + + void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { SDL_ECHELLE = 0; @@ -192,13 +199,14 @@ void GraphicsManager::SET_MODE(int width, int height) { //height = Reel_Zoom(a2, SDL_ECHELLE); } - if (bpp == 8) + if (bpp == 8) { initGraphics(width, height, true); - else { + } else { Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); initGraphics(width, height, true, &pixelFormat); } + VideoPtr = NULL; XSCREEN = width; YSCREEN = height; @@ -219,4 +227,18 @@ void GraphicsManager::SET_MODE(int width, int height) { } } +void GraphicsManager::DD_Lock() { + VideoPtr = g_system->lockScreen(); +} + +void GraphicsManager::DD_Unlock() { + g_system->unlockScreen(); +} + +void GraphicsManager::Cls_Video() { + assert(VideoPtr); + + VideoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index de80160dda..18cb44254e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/endian.h" #include "common/str.h" +#include "graphics/surface.h" namespace Hopkins { @@ -63,10 +64,15 @@ public: int nbrligne; RGB8 cmap[256]; bool Linear; + Graphics::Surface *VideoPtr; public: GraphicsManager(); + ~GraphicsManager(); void SET_MODE(int width, int height); + void DD_Lock(); + void DD_Unlock(); + void Cls_Video(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 342d7d2361..af8cd668ef 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -66,10 +66,10 @@ Common::Error HopkinsEngine::run() { GLOBALS.HELICO = 0; _mouse.hideCursor(); - /* - DD_Lock(); - Cls_Video(); - DD_Unlock(); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + /* LOAD_IMAGE("LINUX"); FADE_INW(); SDL_Delay(1500); -- cgit v1.2.3 From 97e84b2169e8f3084e568776b1a9561a2df6878e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 19:55:05 +1000 Subject: HOPKINS: Implemented image loading code --- engines/hopkins/files.cpp | 161 ++++++++++ engines/hopkins/files.h | 1 + engines/hopkins/globals.cpp | 7 +- engines/hopkins/globals.h | 5 +- engines/hopkins/graphics.cpp | 710 +++++++++++++++++++++++++++++++++++++------ engines/hopkins/graphics.h | 64 +++- engines/hopkins/hopkins.cpp | 9 +- engines/hopkins/hopkins.h | 5 +- 8 files changed, 844 insertions(+), 118 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index cf6c06f22c..565143d3ff 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -163,4 +163,165 @@ byte *FileManager::LIBERE_FICHIER(byte *ptr) { return PTRNUL; } +bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { + byte *ptr; // [sp+1Ch] [bp-40h]@0 + Common::File f; + + switch (a2) { + case 1: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_INI.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_INI.RES"); + break; + + case 2: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_REP.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_REP.RES"); + break; + + case 3: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_LIN.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_LIN.RES"); + break; + + case 4: + CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_ANI.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_ANI.RES"); + break; + + case 5: + CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_PER.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_PER.RES"); + break; + + case 6: + CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, "PIC.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + + case 7: + CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_SAN.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + + case 8: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_SLI.CAT"); + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + + case 9: + switch (GLOBALS.FR) { + case 0: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_VAN.CAT"); + break; + case 1: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_VFR.CAT"); + break; + case 2: + CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_VES.CAT"); + break; + } + + if (!f.exists(GLOBALS.NFICHIER)) + return PTRNUL; + + ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + break; + // Deliberate fall-through to + default: + break; + } + + // Scan for an entry in the catalogue + const byte *startP = ptr; + int result; // eax@50 + void *v22; // ebx@53 + bool matchFlag = false; + int offsetVal = 0; + + do { + Common::String name = (const char *)startP; + + if (file == name) { + // Found entry for file, so get it's details from the catalogue entry + const byte *pData = startP + offsetVal; + startP += offsetVal + 15; + GLOBALS.CAT_POSI = READ_LE_UINT32(pData + 15); + GLOBALS.CAT_TAILLE = READ_LE_UINT32(pData + 19); + matchFlag = true; + } + + const char *finishString = "FINIS"; + const char *nameP = name.c_str(); + int finishRemainingChars = 6; + int v19 = 0; + bool finishMatch = true; + + do { + if (!finishRemainingChars) + break; + finishMatch = *finishString++ == *nameP++; + --finishRemainingChars; + } while (finishMatch); + + if (!finishMatch) + v19 = *(byte *)(finishString - 1) - *(byte *)(nameP - 1); + if (!v19) { + GLOBALS.dos_free2(ptr); + return PTRNUL; + } + + offsetVal += 23; + } while (!matchFlag); + GLOBALS.dos_free2(ptr); + + // TODO: Double check whether this really should be an unsigned int comparison + if ((uint16)(a2 - 6) > 1 && (uint16)(a2 - 8) > 1) { + if (!f.open(GLOBALS.NFICHIER)) + error("CHARGE_FICHIER"); + + f.seek(GLOBALS.CAT_POSI); + + byte *catData = GLOBALS.dos_malloc2(GLOBALS.CAT_TAILLE); + if (catData == PTRNUL) + error("CHARGE_FICHIER"); + + bload_it(f, catData, GLOBALS.CAT_TAILLE); + f.close(); + result = true; + } else { + result = false; + } + + return result; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 52412c11e8..8c8f01004d 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -43,6 +43,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); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1f00651f9c..a04387e3a4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -30,8 +30,6 @@ namespace Hopkins { Globals::Globals() { FR = 0; SVGA = 2; - MANU_SCROLL = 1; - SPEED_SCROLL = 16; internet = 1; PUBEXIT = 0; FADESPD = 15; @@ -658,4 +656,9 @@ byte *Globals::dos_malloc2(int count) { return result; } +byte *Globals::dos_free2(byte *p) { + free(p); + return PTRNUL; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 3289a49575..8a10315cf7 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -111,8 +111,6 @@ public: int FADESPD; int FR; int SVGA; - int MANU_SCROLL; - int SPEED_SCROLL; int internet; int PUBEXIT; bool XFULLSCREEN; @@ -202,6 +200,8 @@ public: int OBJL, OBJH; int Nouv_objet; int HELICO; + uint32 CAT_POSI; + uint32 CAT_TAILLE; Globals(); ~Globals(); @@ -213,6 +213,7 @@ public: void INIT_VBOB(); void CHARGE_OBJET(); byte *dos_malloc2(int count); + byte *dos_free2(byte *p); }; #define PTRNUL (byte *)NULL diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 21c5d6c478..385d9f46e8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/file.h" #include "common/rect.h" #include "engines/util.h" #include "hopkins/files.h" @@ -30,6 +31,614 @@ namespace Hopkins { +GraphicsManager::GraphicsManager() { + SDL_MODEYES = false; + MANU_SCROLL = 1; + SPEED_SCROLL = 16; + Agr_x = Agr_y = 0; + Agr_Flag_x = Agr_Flag_y = 0; +} + +GraphicsManager::~GraphicsManager() { +} + + +void GraphicsManager::SET_MODE(int width, int height) { + if (!SDL_MODEYES) { + SDL_ECHELLE = 0; + + if (GLOBALS.XSETMODE == 1) + SDL_ECHELLE = 0; + if (GLOBALS.XSETMODE == 2) + SDL_ECHELLE = 25; + if (GLOBALS.XSETMODE == 3) + SDL_ECHELLE = 50; + if (GLOBALS.XSETMODE == 4) + SDL_ECHELLE = 75; + if (GLOBALS.XSETMODE == 5) + SDL_ECHELLE = GLOBALS.XZOOM; + + int bpp = 8; + if (GLOBALS.XFORCE8 == 1) + bpp = 8; + if (GLOBALS.XFORCE16 == 1) + bpp = 16; + + if (SDL_ECHELLE) { + error("TODO: Implement zooming support"); + //width = Reel_Zoom(width, SDL_ECHELLE); + //height = Reel_Zoom(height, SDL_ECHELLE); + } + + if (bpp == 8) { + initGraphics(width, height, true); + } else { + Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + initGraphics(width, height, true, &pixelFormat); + } + + // Init surfaces + //VESA_SCREEN = dos_malloc2(0x96000u); + //VESA_BUFFER = dos_malloc2(0x96000u); + + VideoPtr = NULL; + XSCREEN = width; + YSCREEN = height; + + Linear = true; + Winbpp = bpp; + WinScan = width; + + PAL_PIXELS = SD_PIXELS; + nbrligne = width; + + for (int idx = 0; idx < 256; ++idx) { + cmap[idx].r = cmap[idx].g = cmap[idx].b = 0; + } + + SDL_MODEYES = true; + } else { + error("Called SET_MODE multiple times"); + } +} + +void GraphicsManager::DD_Lock() { + VideoPtr = g_system->lockScreen(); +} + +void GraphicsManager::DD_Unlock() { + g_system->unlockScreen(); +} + +void GraphicsManager::Cls_Video() { + assert(VideoPtr); + + VideoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); +} + +void GraphicsManager::LOAD_IMAGE(const Common::String &file) { + Common::String filename = Common::String::format("%s.PCX", file); + CHARGE_ECRAN(filename); + GraphicsManager::INIT_TABLE(165, 170, Palette); +} + +void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { + int v1; + byte *v4; + byte *v5; + Common::File f; + + FileManager::DMESS1(); + + v1 = 1; + if (FileManager::RECHERCHE_CAT(file, 6)) { + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, file); + if (!f.open(GLOBALS.NFICHIER)) + error("CHARGE_ECRAN - %s", file.c_str()); + + f.seek(0, SEEK_END); + f.close(); + v1 = 0; + } + + SCROLL_ECRAN(0); + A_PCXSCREEN_WIDTH_SCREEN_HEIGHT((byte *)VESA_SCREEN.pixels, file, Palette, v1); + + SCROLL = 0; + OLD_SCROLL = 0; + Cls_Pal(); + + if (!DOUBLE_ECRAN) { + souris_max(); + SCANLINE(SCREEN_WIDTH); + GLOBALS.max_x = SCREEN_WIDTH; + DD_Lock(); + Cls_Video(); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16((byte *)VESA_SCREEN.pixels, 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); + else + m_scroll2A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + SCANLINE(0x500u); + GLOBALS.max_x = SCREEN_WIDTH * 2; + DD_Lock(); + Cls_Video(); + DD_Unlock(); + + if (MANU_SCROLL == 1) { + DD_Lock(); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16((byte *)VESA_SCREEN.pixels, 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); + else + m_scroll2A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + + DD_Unlock(); + } + } + + v4 = (byte *)VESA_BUFFER.pixels; + v5 = (byte *)VESA_SCREEN.pixels; + memcpy(v4, v5, 614396); + + v5 = (byte *)v5 + 614396; + v4 = (byte *)v4 + 614396; + WRITE_LE_UINT16(v4, READ_LE_UINT16(v5)); + *((byte *)v4 + 2) = *((byte *)v5 + 2); +} + +void GraphicsManager::INIT_TABLE(int a1, int a2, byte *a3) { + for (int idx = 0; idx < 256; ++idx) + TABLE_COUL[idx] = idx; + + Trans_bloc(TABLE_COUL, a3, 256, a1, a2); + + for (int idx = 0; idx < 256; ++idx) { + byte v = TABLE_COUL[idx]; + if (v > 27) + TABLE_COUL[idx] = 0; + if (!v) + TABLE_COUL[idx] = 0; + } + + TABLE_COUL[0] = 1; +} + +int GraphicsManager::SCROLL_ECRAN(int amount) { + int result = CLIP(amount, 0, SCREEN_WIDTH); + start_x = result; + ofscroll = result; + SCROLL = result; + return result; +} + +void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2) { + byte *v5; + int v6; + int v7; + int v8; + unsigned int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + unsigned int v18; + char v19; + int v20; + bool breakFlag; + + v5 = destP; + v6 = count - 1; + do { + breakFlag = v6; + v7 = *(byte *)v5++; + v8 = (unsigned int)(3 * v7); + + // TODO: Ensure this is the right calculation + v11 = *(byte *)(v8 + srcP) + *(byte *)(v8 + srcP + 1) + + *(byte *)(v8 + srcP + 2); + + v12 = 0; + for (;;) { + v13 = v12 + 1; + if ( v13 == 38 ) + break; + + v20 = v13; + v8 = 3 * v8; + v14 = *(byte *)(v8 + srcP); + v15 = v14; + v14 = *(byte *)(v8 + srcP + 1); + v16 = v14 + v15; + v14 = *(byte *)(v8 + srcP + 2); + v17 = v14 + v16; + v12 = v20; + v18 = param1 + v17; + if (v18 >= v11 && (unsigned int)(v18 - param2) <= v11) { + v19 = v20; + if (!v20) + v19 = 1; + *(byte *)(v5 - 1) = v19; + break; + } + } + + v6 = breakFlag - 1; + } while ( !breakFlag); +} + +// TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder +void GraphicsManager::A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { + int filesize; + signed __int16 v6; + int v7; + __int16 v8; + int v9; + int v10; + int v11; + unsigned __int8 v12; + int v13; + int v14; + char v15; + int v18; + int v19; + int v20; + unsigned int v21; + int v22; + int32 v23; + byte *ptr; + Common::File f; + + // Clear the passed surface + memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + + if (typeFlag) { + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, "PIC.RES"); + if (!f.open(GLOBALS.NFICHIER)) + error("(nom)Erreur en cours de lecture."); + f.seek(GLOBALS.CAT_POSI); + + v7 = GLOBALS.CAT_TAILLE - 896; + v8 = f.read(HEADER_PCX, 128); + + v6 = READ_LE_UINT16(&HEADER_PCX[8]) + 1; + v20 = READ_LE_UINT16(&HEADER_PCX[10]) + 1; + if ((READ_LE_UINT16(&HEADER_PCX[8]) + 1) <= SCREEN_WIDTH) { + DOUBLE_ECRAN = false; + } else { + v6 = SCREEN_WIDTH * 2; + DOUBLE_ECRAN = true; + } + if (v20 > SCREEN_HEIGHT) + v20 = SCREEN_HEIGHT; + PCX_L = v6; + PCX_H = v20; + if (v8 == -1) + error("Erreur en cours de lecture."); + } else { + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, file); + if (!f.open(GLOBALS.NFICHIER)) + error("(nom)Erreur en cours de lecture."); + + filesize = f.size(); + int bytesRead = f.read(HEADER_PCX, 128); + if (bytesRead < 128) + error("Erreur en cours de lecture."); + + v6 = READ_LE_UINT16(&HEADER_PCX[8]) + 1; + v20 = READ_LE_UINT16(&HEADER_PCX[10]) + 1; + if (v6 <= SCREEN_WIDTH) { + DOUBLE_ECRAN = false; + } else { + v6 = SCREEN_WIDTH * 2; + DOUBLE_ECRAN = true; + } + if (v20 > SCREEN_HEIGHT) + v20 = SCREEN_HEIGHT; + PCX_L = v6; + PCX_H = v20; + v7 = filesize - 896; + } + + ptr = GLOBALS.dos_malloc2(0xEE60u); + if (v7 >= 60000) { + v21 = v7 / 60000 + 1; + v23 = 60000 * (v7 / 60000) - v7; + + if (((uint32)v23 & 0x80000000u) != 0) + v23 = -v23; + f.read(ptr, 60000); + v7 = 60000; + } else { + v21 = 1; + v23 = v7; + f.read(ptr, v7); + } + v22 = v21 - 1; + v18 = 0; + v9 = 0; + v10 = 0; + v19 = v6; + + do { + if (v9 == v7) { + v9 = 0; + --v22; + v7 = 60000; + if ( !v22 ) + v7 = v23; + v11 = v10; + f.read(ptr, v7); + v10 = v11; + } + + v12 = *((byte *)ptr + v9++); + if (v12 > 0xC0u) { + v13 = v12 - 192; + if (v9 == v7) { + v9 = 0; + --v22; + v7 = 60000; + if ( v22 == 1 ) + v7 = v23; + v14 = v10; + f.read(ptr, v7); + v10 = v14; + } + v15 = *((byte *)ptr + v9++); + + do { + *((byte *)surface + v10++) = v15; + ++v18; + --v13; + } while (v13); + } else { + *((byte *)surface + v10++) = v12; + ++v18; + } + } while (v18 < v19 * v20); + + if (typeFlag) { + f.seek(GLOBALS.CAT_TAILLE + GLOBALS.CAT_POSI - 768); + } else { + filesize = f.size(); + f.seek(filesize - 768); + } + + if (f.read(palette, PALETTE_SIZE * 3) != (PALETTE_SIZE * 3)) + error("A_PCXSCREEN_WIDTH_SCREEN_HEIGHT"); + + f.close(); + GLOBALS.dos_free2(ptr); +} + +void GraphicsManager::Cls_Pal() { + warning("TODO"); +} +void GraphicsManager::souris_max() { + warning("TODO"); +} + +void GraphicsManager::SCANLINE(int width) { + // Original has no implementatoin +} + +void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { + const byte *v7; + byte *v8; + int v9; + int v10; + byte *v11; + const byte *v12; + unsigned int v13; + + assert(VideoPtr); + v7 = xs + nbrligne2 * ys + surface; + v8 = destX + WinScan * destY + (byte *)VideoPtr->pixels; + v9 = height; + do { + v10 = v9; + memcpy((byte *)v8, (const byte *)v7, 4 * (width >> 2)); + v12 = (const byte *)(v7 + 4 * (width >> 2)); + v11 = (byte *)(v8 + 4 * (width >> 2)); + v13 = width - 4 * (width >> 2); + memcpy(v11, v12, v13); + v8 = ((byte *)v11 + v13 + WinScan - width); + v7 = ((byte *)v12 + v13 + nbrligne2 - width); + v9 = v10 - 1; + } while (v10 != 1); +} + +void GraphicsManager::m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { + const byte *v7; + byte *v8; + int v9; + int v10; + int v11; + + assert(VideoPtr); + v7 = (const byte *)(xs + nbrligne2 * ys + surface); + v8 = (byte *)(destX + WinScan * destY + (byte *)VideoPtr->pixels); + v9 = WinScan - SCREEN_WIDTH; + v10 = nbrligne2 - SCREEN_WIDTH; + v11 = height; + + do { + memcpy(v8, v7, SCREEN_WIDTH); + v8 = (byte *)v8 + v9 + SCREEN_WIDTH; + v7 = (const byte *)v7 + v10 + SCREEN_WIDTH; + --v11; + } while (v11); +} + +void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { + const byte *v7; + const byte *v8; + int v9; + int v10; + byte v11; + const byte *v12; + const byte *v13; + + assert(VideoPtr); + v7 = xs + nbrligne2 * ys + surface; + v8 = destX + WinScan * destY + (byte *)VideoPtr->pixels; + v9 = height; + Agr_x = 0; + Agr_y = 0; + Agr_Flag_y = 0; + do { + for (;;) { + v13 = v8; + v12 = v7; + v10 = width; + Agr_x = 0; + do { + v11 = *(byte *)v7; + *(byte *)v8++ = *(byte *)v7++; + Agr_x += SDL_ECHELLE; + if ((unsigned int)Agr_x >= 100) { + Agr_x -= 100; + *(byte *)v8++ = v11; + } + --v10; + } while ( v10 ); + + v7 = v12; + v8 = WinScan + v13; + if (Agr_Flag_y) + break; + + Agr_y += SDL_ECHELLE; + if ((unsigned int)Agr_y < 100) + break; + + Agr_y -= 100; + Agr_Flag_y = 1; + } + + Agr_Flag_y = 0; + v7 = nbrligne2 + v12; + --v9; + } while (v9); +} + +void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { + const byte *v7; + const byte *v8; + int v9; + int v10; + const byte *v11; + int v12; + const byte *v13; + const byte *v14; + + assert(VideoPtr); + v7 = xs + nbrligne2 * ys + surface; + v8 = destX + destX + WinScan * destY + (byte *)VideoPtr->pixels; + v9 = height; + + do { + v14 = v8; + v13 = v7; + v10 = width; + v12 = v9; + v11 = PAL_PIXELS; + + do { + *(uint16 *)v8 = *(uint16 *)(v11 + 2 * *(byte *)v7++); + v8 += 2; + --v10; + } while (v10); + + v7 = nbrligne2 + v13; + v8 = WinScan + v14; + v9 = v12 - 1; + } while (v12 != 1); +} + +void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { + const byte *v7; + const byte *v8; + int v9; + int v10; + const byte *v11; + int v12; + int v13; + const byte *v14; + const byte *v15; + + assert(VideoPtr); + v7 = xs + nbrligne2 * ys + surface; + v8 = destX + destX + WinScan * destY + (byte *)VideoPtr->pixels; + v9 = height; + Agr_x = 0; + Agr_y = 0; + Agr_Flag_y = 0; + + do { + for (;;) { + v15 = v8; + v14 = v7; + v10 = width; + v13 = v9; + v11 = PAL_PIXELS; + Agr_x = 0; + + do { + v12 = *(uint16 *)(v11 + 2 * *(byte *)v7); + *(uint16 *)v8 = v12; + ++v7; + v8 += 2; + Agr_x += SDL_ECHELLE; + if ((unsigned int)Agr_x >= 100) { + Agr_x -= 100; + *(uint16 *)v8 = v12; + v8 += 2; + } + + --v10; + } while (v10); + + v9 = v13; + v7 = v14; + v8 = WinScan + v15; + if (Agr_Flag_y == 1) + break; + + Agr_y += SDL_ECHELLE; + + if ((unsigned int)Agr_y < 100) + break; + + Agr_y -= 100; + Agr_Flag_y = 1; + } + + Agr_Flag_y = 0; + v7 = nbrligne2 + v14; + v9 = v13 - 1; + } while (v13 != 1); +} + +/*------------------------------------------------------------------------*/ + byte *ObjectManager::CHANGE_OBJET(int objIndex) { byte *result = ObjectManager::CAPTURE_OBJET(objIndex, 1); GLOBALS.Bufferobjet = result; @@ -43,23 +652,23 @@ byte *ObjectManager::CAPTURE_OBJET(int objIndex, int mode) { byte *dataP; dataP = 0; - int v2 = GLOBALS.ObjetW[objIndex].field0; - int v3 = GLOBALS.ObjetW[objIndex].field1; + int val1 = GLOBALS.ObjetW[objIndex].field0; + int val2 = GLOBALS.ObjetW[objIndex].field1; if (mode == 1) - ++v3; - if (v2 != GLOBALS.NUM_FICHIER_OBJ) { + ++val2; + if (val1 != GLOBALS.NUM_FICHIER_OBJ) { if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) ObjectManager::DEL_FICHIER_OBJ(); - if (v2 == 1) { + if (val1 == 1) { FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); GLOBALS.ADR_FICHIER_OBJ = ObjectManager::CHARGE_SPRITE(GLOBALS.NFICHIER); } - GLOBALS.NUM_FICHIER_OBJ = v2; + GLOBALS.NUM_FICHIER_OBJ = val1; } - int width = ObjectManager::Get_Largeur(GLOBALS.ADR_FICHIER_OBJ, v3); - int height = ObjectManager::Get_Hauteur(GLOBALS.ADR_FICHIER_OBJ, v3); + int width = ObjectManager::Get_Largeur(GLOBALS.ADR_FICHIER_OBJ, val2); + int height = ObjectManager::Get_Hauteur(GLOBALS.ADR_FICHIER_OBJ, val2); GLOBALS.OBJL = width; GLOBALS.OBJH = height; @@ -69,16 +678,16 @@ byte *ObjectManager::CAPTURE_OBJET(int objIndex, int mode) { if (dataP == PTRNUL) error("CAPTURE_OBJET"); - ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, dataP, v3); + ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, dataP, val2); break; case 1: - ObjectManager::sprite_alone(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.Bufferobjet, v3); + ObjectManager::sprite_alone(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.Bufferobjet, val2); result = GLOBALS.Bufferobjet; break; case 3: - ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.INVENTAIRE_OBJET, v3); + ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.INVENTAIRE_OBJET, val2); result = GLOBALS.INVENTAIRE_OBJET; break; @@ -162,83 +771,4 @@ int ObjectManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } -/*------------------------------------------------------------------------*/ - -GraphicsManager::GraphicsManager() { - SDL_MODEYES = false; -} - -GraphicsManager::~GraphicsManager() { -} - - -void GraphicsManager::SET_MODE(int width, int height) { - if (!SDL_MODEYES) { - SDL_ECHELLE = 0; - - if (GLOBALS.XSETMODE == 1) - SDL_ECHELLE = 0; - if (GLOBALS.XSETMODE == 2) - SDL_ECHELLE = 25; - if (GLOBALS.XSETMODE == 3) - SDL_ECHELLE = 50; - if (GLOBALS.XSETMODE == 4) - SDL_ECHELLE = 75; - if (GLOBALS.XSETMODE == 5) - SDL_ECHELLE = GLOBALS.XZOOM; - - int bpp = 8; - if (GLOBALS.XFORCE8 == 1) - bpp = 8; - if (GLOBALS.XFORCE16 == 1) - bpp = 16; - - if (SDL_ECHELLE) { - error("TODO: Implement zooming support"); - //width = Reel_Zoom(a1, SDL_ECHELLE); - //height = Reel_Zoom(a2, SDL_ECHELLE); - } - - if (bpp == 8) { - initGraphics(width, height, true); - } else { - Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); - initGraphics(width, height, true, &pixelFormat); - } - - VideoPtr = NULL; - XSCREEN = width; - YSCREEN = height; - - Linear = true; - Winbpp = bpp; - WinScan = width; - - PAL_PIXELS = SD_PIXELS; - nbrligne = width; - - for (int idx = 0; idx < 256; ++idx) { - cmap[idx].r = cmap[idx].g = cmap[idx].b = 0; - } - - SDL_MODEYES = true; - } else { - error("Called SET_MODE multiple times"); - } -} - -void GraphicsManager::DD_Lock() { - VideoPtr = g_system->lockScreen(); -} - -void GraphicsManager::DD_Unlock() { - g_system->unlockScreen(); -} - -void GraphicsManager::Cls_Video() { - assert(VideoPtr); - - VideoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 18cb44254e..e6d56575f5 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -30,28 +30,17 @@ namespace Hopkins { +#define PALETTE_SIZE 256 + struct RGB8 { byte r; byte g; byte b; }; -class ObjectManager { -public: - static byte *CHANGE_OBJET(int objIndex); - static byte *CAPTURE_OBJET(int objIndex, int mode); - - static int Get_Largeur(const byte *objectData, int objIndex); - static int Get_Hauteur(const byte *objectData, int objIndex); - static int sprite_alone(const byte *objectData, byte *sprite, int objIndex); - static byte *DEL_FICHIER_OBJ(); - - static byte *CHARGE_SPRITE(const Common::String &file); - static int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); - static int AJOUTE_OBJET(int objIndex); -}; - class GraphicsManager { +private: + void CHARGE_ECRAN(const Common::String &file); public: bool SDL_MODEYES; int SDL_ECHELLE; @@ -62,9 +51,26 @@ public: byte SD_PIXELS[514]; byte *PAL_PIXELS; int nbrligne; + byte TABLE_COUL[256]; RGB8 cmap[256]; + byte Palette[PALETTE_SIZE * 3]; bool Linear; Graphics::Surface *VideoPtr; + Graphics::Surface VESA_SCREEN; + Graphics::Surface VESA_BUFFER; + int start_x; + int ofscroll; + int SCROLL; + byte HEADER_PCX[128]; + int PCX_L, PCX_H; + bool DOUBLE_ECRAN; + int OLD_SCROLL; + int MANU_SCROLL; + int SPEED_SCROLL; + int nbrligne2; + int Agr_x, Agr_y; + int Agr_Flag_x, Agr_Flag_y; + public: GraphicsManager(); ~GraphicsManager(); @@ -73,6 +79,34 @@ public: void DD_Lock(); void DD_Unlock(); void Cls_Video(); + void LOAD_IMAGE(const Common::String &file); + void INIT_TABLE(int a1, int a2, byte *a3); + int SCROLL_ECRAN(int amount); + void Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2); + void A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void Cls_Pal(); + void souris_max(); + void SCANLINE(int width); + void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); +}; + +class ObjectManager { +public: + static byte *CHANGE_OBJET(int objIndex); + static byte *CAPTURE_OBJET(int objIndex, int mode); + + static int Get_Largeur(const byte *objectData, int objIndex); + static int Get_Hauteur(const byte *objectData, int objIndex); + static int sprite_alone(const byte *objectData, byte *sprite, int objIndex); + static byte *DEL_FICHIER_OBJ(); + + static byte *CHARGE_SPRITE(const Common::String &file); + static int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); + static int AJOUTE_OBJET(int objIndex); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index af8cd668ef..0dd1fbc03b 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -43,9 +43,6 @@ HopkinsEngine::~HopkinsEngine() { } Common::Error HopkinsEngine::run() { -// char v1; // al@93 -// char v2; // al@114 - FileManager::initSaves(); Common::StringMap iniParams; @@ -69,8 +66,9 @@ Common::Error HopkinsEngine::run() { _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); + + _graphicsManager.LOAD_IMAGE("LINUX"); /* - LOAD_IMAGE("LINUX"); FADE_INW(); SDL_Delay(1500); FADE_OUTW(); @@ -503,9 +501,6 @@ void HopkinsEngine::INIT_SYSTEM() { // Set graphics mode _graphicsManager.SET_MODE(640, 480); - // TODO: init surfaces - //VESA_SCREEN = dos_malloc2(0x96000u); - //VESA_BUFFER = dos_malloc2(0x96000u); _mouse.mouse_linux = true; switch (GLOBALS.FR) { diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 5f6b19d47a..1a2e6961b2 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -57,14 +57,15 @@ enum { #define DEBUG_INTERMEDIATE 2 #define DEBUG_DETAILED 3 +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 480 + struct HopkinsGameDescription; class HopkinsEngine : public Engine { private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; - Graphics::Surface VESA_SCREEN; - Graphics::Surface VESA_BUFFER; Mouse _mouse; GraphicsManager _graphicsManager; -- cgit v1.2.3 From 8501e1cd85ecdef723599af81f14dbf19cc6e8b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 20:10:32 +1000 Subject: HOPKINS: Added initialisation of graphics manager and globals fields --- engines/hopkins/globals.cpp | 31 ++++++++++++++++++++++++++++--- engines/hopkins/graphics.cpp | 16 ++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a04387e3a4..f0b06bf975 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -38,9 +38,30 @@ Globals::Globals() { MUSICVOL = 6; SOUNDVOL = 6; VOICEVOL = 6; - MUSICOFF = false; - SOUNDOFF = false; - VOICEOFF = false; + XSETMODE = 0; + XZOOM = 0; + min_x = min_y = 0; + max_x = max_y = 0; + lItCounter = 0; + lOldItCounter = 0; + g_old_anim = 0; + g_old_sens = 0; + police_l = police_h = 0; + TETE = NULL; + texte_long = 0; + TEXTE_FORMATE = 0; + OBJET_EN_COURS = 0; + NUM_FICHIER_OBJ = 0; + nbrligne = 0; + largeur_boite = 0; + hauteur_boite = 0; + FORET = 0; + OBJL = OBJH = 0; + HELICO = 0; + CAT_POSI = 0; + CAT_TAILLE = 0; + Nouv_objet = 0; + // Initialise pointers ICONE = NULL; @@ -65,8 +86,12 @@ Globals::Globals() { BufLig = NULL; Bufferdecor = NULL; ADR_FICHIER_OBJ = NULL; + police = NULL; // Reset flags + MUSICOFF = false; + SOUNDOFF = false; + VOICEOFF = false; XFULLSCREEN = false; XFORCE16 = false; XFORCE8 = false; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 385d9f46e8..870d947ffe 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -33,8 +33,23 @@ namespace Hopkins { GraphicsManager::GraphicsManager() { SDL_MODEYES = false; + SDL_ECHELLE = 0; + XSCREEN = YSCREEN = 0; + WinScan = 0; + Winbpp = 0; + PAL_PIXELS = NULL; + nbrligne = 0; + Linear = false; + VideoPtr = NULL; + start_x = 0; + ofscroll = 0; + SCROLL = 0; + PCX_L = PCX_H = 0; + DOUBLE_ECRAN = false; + OLD_SCROLL = 0; MANU_SCROLL = 1; SPEED_SCROLL = 16; + nbrligne2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; } @@ -107,6 +122,7 @@ void GraphicsManager::DD_Lock() { } void GraphicsManager::DD_Unlock() { + assert(VideoPtr); g_system->unlockScreen(); } -- cgit v1.2.3 From 8fd0d0629a79d0e7813c7219dbab90a30c3b2bfe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 20:15:32 +1000 Subject: HOPKINS: Added stub event loop --- engines/hopkins/hopkins.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0dd1fbc03b..2fc9a3b007 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -470,6 +470,13 @@ LABEL_128: } */ + // Stub event loop + Common::Event evt; + while (!g_system->getEventManager()->shouldQuit()) { + while (g_system->getEventManager()->pollEvent(evt)) + ; + } + return Common::kNoError; } -- cgit v1.2.3 From 56c454fcb5db788ccdb662bc19e1675a72d73f8d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 20:28:04 +1000 Subject: HOPKINS: Fix some obvious crashes in image loading --- engines/hopkins/graphics.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 870d947ffe..ebe01405e0 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -55,9 +55,10 @@ GraphicsManager::GraphicsManager() { } GraphicsManager::~GraphicsManager() { + VESA_SCREEN.free(); + VESA_BUFFER.free(); } - void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { SDL_ECHELLE = 0; @@ -85,16 +86,17 @@ void GraphicsManager::SET_MODE(int width, int height) { //height = Reel_Zoom(height, SDL_ECHELLE); } + Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 0, 10, 5, 0, 0); + if (bpp == 8) { initGraphics(width, height, true); } else { - Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); - initGraphics(width, height, true, &pixelFormat); + initGraphics(width, height, true, &pixelFormat16); } // Init surfaces - //VESA_SCREEN = dos_malloc2(0x96000u); - //VESA_BUFFER = dos_malloc2(0x96000u); + VESA_SCREEN.create(SCREEN_WIDTH, SCREEN_HEIGHT, pixelFormat16); + VESA_BUFFER.create(SCREEN_WIDTH, SCREEN_HEIGHT, pixelFormat16); VideoPtr = NULL; XSCREEN = width; @@ -133,7 +135,7 @@ void GraphicsManager::Cls_Video() { } void GraphicsManager::LOAD_IMAGE(const Common::String &file) { - Common::String filename = Common::String::format("%s.PCX", file); + Common::String filename = Common::String::format("%s.PCX", file.c_str()); CHARGE_ECRAN(filename); GraphicsManager::INIT_TABLE(165, 170, Palette); } -- cgit v1.2.3 From 14cd54fc398c312566ea2dec3a91d775f2159f0f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 21:15:09 +1000 Subject: HOPKINS: Add temporary copy of VESA surface to screen, and other bugfixes --- engines/hopkins/graphics.cpp | 39 +++++++++++++++++++-------------------- engines/hopkins/graphics.h | 4 ++-- engines/hopkins/hopkins.cpp | 7 ++++++- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ebe01405e0..9b95b3f515 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "graphics/palette.h" #include "common/file.h" #include "common/rect.h" #include "engines/util.h" @@ -109,10 +110,7 @@ void GraphicsManager::SET_MODE(int width, int height) { PAL_PIXELS = SD_PIXELS; nbrligne = width; - for (int idx = 0; idx < 256; ++idx) { - cmap[idx].r = cmap[idx].g = cmap[idx].b = 0; - } - + Common::fill(&cmap[0], &cmap[256 * 3], 0); SDL_MODEYES = true; } else { error("Called SET_MODE multiple times"); @@ -126,6 +124,7 @@ void GraphicsManager::DD_Lock() { void GraphicsManager::DD_Unlock() { assert(VideoPtr); g_system->unlockScreen(); + VideoPtr = NULL; } void GraphicsManager::Cls_Video() { @@ -141,14 +140,12 @@ void GraphicsManager::LOAD_IMAGE(const Common::String &file) { } void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { - int v1; - byte *v4; - byte *v5; + bool flag; Common::File f; FileManager::DMESS1(); - v1 = 1; + flag = true; if (FileManager::RECHERCHE_CAT(file, 6)) { FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, file); if (!f.open(GLOBALS.NFICHIER)) @@ -156,11 +153,11 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { f.seek(0, SEEK_END); f.close(); - v1 = 0; + flag = false; } SCROLL_ECRAN(0); - A_PCXSCREEN_WIDTH_SCREEN_HEIGHT((byte *)VESA_SCREEN.pixels, file, Palette, v1); + A_PCXSCREEN_WIDTH_SCREEN_HEIGHT((byte *)VESA_SCREEN.pixels, file, Palette, flag); SCROLL = 0; OLD_SCROLL = 0; @@ -183,6 +180,8 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { else m_scroll2A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } + + DD_Unlock(); } else { SCANLINE(0x500u); GLOBALS.max_x = SCREEN_WIDTH * 2; @@ -209,14 +208,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { } } - v4 = (byte *)VESA_BUFFER.pixels; - v5 = (byte *)VESA_SCREEN.pixels; - memcpy(v4, v5, 614396); - - v5 = (byte *)v5 + 614396; - v4 = (byte *)v4 + 614396; - WRITE_LE_UINT16(v4, READ_LE_UINT16(v5)); - *((byte *)v4 + 2) = *((byte *)v5 + 2); + memcpy((byte *)VESA_BUFFER.pixels, (byte *)VESA_SCREEN.pixels, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); } void GraphicsManager::INIT_TABLE(int a1, int a2, byte *a3) { @@ -447,10 +439,17 @@ void GraphicsManager::A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Commo } void GraphicsManager::Cls_Pal() { - warning("TODO"); + if (Winbpp == 2) { + Common::fill(&cmap[0], &cmap[PALETTE_SIZE * 3], 0); + + // TODO: Figure out what this is for + //SD_PIXELS[2 * v0] = SDL_MapRGB(*(_DWORD *)(LinuxScr + 4), 0, 0, 0); + g_system->getPaletteManager()->setPalette(cmap, 0, 256); + } } + void GraphicsManager::souris_max() { - warning("TODO"); + // Original has no implementatoin } void GraphicsManager::SCANLINE(int width) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e6d56575f5..a3257f3044 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -48,11 +48,11 @@ public: int YSCREEN; int WinScan; int Winbpp; - byte SD_PIXELS[514]; + byte SD_PIXELS[257 * 2]; byte *PAL_PIXELS; int nbrligne; byte TABLE_COUL[256]; - RGB8 cmap[256]; + byte cmap[PALETTE_SIZE * 3]; byte Palette[PALETTE_SIZE * 3]; bool Linear; Graphics::Surface *VideoPtr; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2fc9a3b007..cae33551b8 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -469,12 +469,17 @@ LABEL_128: } } */ + // Copy vesa surface to screen + _graphicsManager.DD_Lock(); + memcpy((byte *)_graphicsManager.VideoPtr->pixels, (byte *)_graphicsManager.VESA_SCREEN.pixels, + SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + _graphicsManager.DD_Unlock(); // Stub event loop Common::Event evt; while (!g_system->getEventManager()->shouldQuit()) { while (g_system->getEventManager()->pollEvent(evt)) - ; + g_system->updateScreen(); } return Common::kNoError; -- cgit v1.2.3 From 7b15f9ae3c326419bbba13f375762da7fd6d18b1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Sep 2012 20:26:24 +1000 Subject: HOPKINS: Implemented some of the fade methods --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/graphics.cpp | 235 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/graphics.h | 17 +++- engines/hopkins/hopkins.cpp | 18 +++- engines/hopkins/hopkins.h | 1 + 6 files changed, 263 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f0b06bf975..837b287ee4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -32,7 +32,6 @@ Globals::Globals() { SVGA = 2; internet = 1; PUBEXIT = 0; - FADESPD = 15; vitesse = 1; INSTALL_TYPE = 1; MUSICVOL = 6; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 8a10315cf7..201f22b4f7 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -108,7 +108,6 @@ struct ObjetWItem { */ class Globals { public: - int FADESPD; int FR; int SVGA; int internet; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9b95b3f515..7c43d0449f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -53,6 +53,7 @@ GraphicsManager::GraphicsManager() { nbrligne2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; + FADESPD = 15; } GraphicsManager::~GraphicsManager() { @@ -431,7 +432,7 @@ void GraphicsManager::A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Commo f.seek(filesize - 768); } - if (f.read(palette, PALETTE_SIZE * 3) != (PALETTE_SIZE * 3)) + if (f.read(palette, PALETTE_BLOCK_SIZE) != (PALETTE_BLOCK_SIZE)) error("A_PCXSCREEN_WIDTH_SCREEN_HEIGHT"); f.close(); @@ -440,7 +441,7 @@ void GraphicsManager::A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Commo void GraphicsManager::Cls_Pal() { if (Winbpp == 2) { - Common::fill(&cmap[0], &cmap[PALETTE_SIZE * 3], 0); + Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); // TODO: Figure out what this is for //SD_PIXELS[2 * v0] = SDL_MapRGB(*(_DWORD *)(LinuxScr + 4), 0, 0, 0); @@ -654,6 +655,236 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } while (v13 != 1); } +void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface) { + __int16 v3; + int v4; + __int16 v5; + __int16 v6; + char *v7; + __int16 v8; + char *v9; + __int16 v10; + signed __int16 v12; + unsigned __int16 v13; + byte palData[PALETTE_BLOCK_SIZE]; + byte v15[3]; + __int16 v16; + char v17[2]; + char v18[1532]; + + v13 = FADESPD; + v3 = 0; + do { + v4 = v3; + *(&v16 + v4) = 0; + palData[v4] = 0; + ++v3; + } while (v3 < (PALETTE_BLOCK_SIZE)); + + setpal_vga256(palData); + v12 = 0; + + if ((signed __int16)v13 > 0) { + do { + v5 = 0; + do { + if ((unsigned __int8)palData[v5] < *(byte *)(v5 + palette)) { + v6 = *(&v16 + v5) + ((unsigned int)*(byte *)(v5 + palette) << 8) / (signed __int16)v13; + *(&v16 + v5) = v6; + palData[v5] = (v6 >> 8) & 0xff; + } + + if (v15[v5] < *(byte *)(palette + v5 + 1)) { + v7 = &v17[2 * v5]; + v8 = *(uint16 *)v7 + ((unsigned int)*(byte *)(palette + v5 + 1) << 8) / (signed __int16)v13; + *(uint16 *)v7 = v8; + v15[v5] = (v8 >> 8) & 0xff; + } + + if (v15[v5 + 1] < *(byte *)(palette + v5 + 2)) { + v9 = &v18[2 * v5]; + v10 = *(uint16 *)v9 + ((unsigned int)*(byte *)(palette + v5 + 2) << 8) / (signed __int16)v13; + *(uint16 *)v9 = v10; + v15[v5 + 1] = (v10 >> 8) & 0xff; + } + + v5 += 3; + } while (v5 < (PALETTE_BLOCK_SIZE)); + + setpal_vga256(palData); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + else + m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + DD_VBL(); + } + + ++v12; + } while (v12 < (signed __int16)v13); + } + + setpal_vga256(palette); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + else + m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + DD_VBL(); + } +} + +void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { + __int16 v3; + __int16 v4; + int v5; + signed __int16 v6; + __int16 v7; + int v8; + __int16 v9; + __int16 v10; + __int16 v12; + unsigned __int16 v13; + byte palData[PALETTE_BLOCK_SIZE]; + __int16 v15[PALETTE_BLOCK_SIZE]; + + v13 = v3 = FADESPD; + if (palette) { + v4 = 0; + do { + v5 = v4; + v3 = *(byte *)(v4 + palette); + v3 <<= 8; + v15[v5] = v3; + palData[v5] = *(byte *)(v4++ + palette); + } while (v4 < PALETTE_BLOCK_SIZE); + + setpal_vga256(palData); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + else + m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + DD_VBL(); + } + + v6 = 0; + if ((signed __int16)v13 > 0) { + do { + v7 = 0; + do { + v8 = v7; + v9 = v15[v7] - ((unsigned int)*(byte *)(v7 + palette) << 8) / (signed __int16)v13; + v15[v8] = v9; + palData[v8] = (v9 >> 8) & 0xff; + ++v7; + } while (v7 < (PALETTE_BLOCK_SIZE)); + + setpal_vga256(palData); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + else + m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + + DD_VBL(); + } + ++v6; + } while ((signed __int16)v13 > v6); + } + + v10 = 0; + do { + palData[v10++] = 0; + } while (v10 < (PALETTE_BLOCK_SIZE)); + + setpal_vga256(palData); + + if (Winbpp == 2) { + if (!SDL_ECHELLE) { + m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + return DD_VBL(); + } + goto LABEL_28; + } + } else { + v12 = 0; + do { + palData[v12++] = 0; + } while (v12 < (PALETTE_BLOCK_SIZE)); + + setpal_vga256(palData); + if (Winbpp == 2) { + if (!SDL_ECHELLE) { + m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + return DD_VBL(); + } + +LABEL_28: + m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + return DD_VBL(); + } + } +} + +void GraphicsManager::FADE_INS() { + FADESPD = 1; + fade_in(Palette, 1, (const byte *)VESA_BUFFER.pixels); +} + +void GraphicsManager::FADE_OUTS() { + FADESPD = 1; + fade_out(Palette, 1, (const byte *)VESA_BUFFER.pixels); +} + +void GraphicsManager::FADE_INW() { + FADESPD = 15; + fade_in(Palette, 20, (const byte *)VESA_BUFFER.pixels); +} + +void GraphicsManager::FADE_OUTW() { + FADESPD = 15; + fade_out(Palette, 20, (const byte *)VESA_BUFFER.pixels); +} + +void GraphicsManager::setpal_vga256(const byte *palette) { + CHANGE_PALETTE(palette); +} + +void GraphicsManager::CHANGE_PALETTE(const byte *palette) { + signed int v1; + signed int v2; + int v3; + const byte *v4; + + v1 = 0; + do { + PALPCX[v1] = *(byte *)(palette + v1); + ++v1; + } while (v1 < PALETTE_BLOCK_SIZE); + + v2 = 0; + do { + v3 = 3 * v2; + cmap[v3] = *(byte *)(palette + 3 * v2); + v4 = palette + 3 * v2; + cmap[v3 + 1] = *(byte *)(v4 + 1); + cmap[v3 + 2] = *(byte *)(v4 + 2); + + // TODO: Validate pixel encoding is correct + *(uint16 *)&SD_PIXELS[2 * v2++] = + *(byte *)v4 | (*(byte *)(v4 + 1) << 5) | (*(byte *)(v4 + 2) << 10); + } while (v2 < PALETTE_SIZE); + + g_system->getPaletteManager()->setPalette(cmap, 0, PALETTE_SIZE); +} + +void GraphicsManager::DD_VBL() { + // TODO: Is this okay here? + g_system->updateScreen(); +} + + /*------------------------------------------------------------------------*/ byte *ObjectManager::CHANGE_OBJET(int objIndex) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index a3257f3044..9151e62684 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -31,6 +31,7 @@ namespace Hopkins { #define PALETTE_SIZE 256 +#define PALETTE_BLOCK_SIZE (PALETTE_SIZE * 3) struct RGB8 { byte r; @@ -52,8 +53,8 @@ public: byte *PAL_PIXELS; int nbrligne; byte TABLE_COUL[256]; - byte cmap[PALETTE_SIZE * 3]; - byte Palette[PALETTE_SIZE * 3]; + byte cmap[PALETTE_BLOCK_SIZE]; + byte Palette[PALETTE_BLOCK_SIZE]; bool Linear; Graphics::Surface *VideoPtr; Graphics::Surface VESA_SCREEN; @@ -70,7 +71,8 @@ public: int nbrligne2; int Agr_x, Agr_y; int Agr_Flag_x, Agr_Flag_y; - + int FADESPD; + byte PALPCX[800]; public: GraphicsManager(); ~GraphicsManager(); @@ -92,6 +94,15 @@ public: void m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void fade_in(const byte *palette, int step, const byte *surface); + void fade_out(const byte *palette, int step, const byte *surface); + void FADE_INS(); + void FADE_OUTS(); + void FADE_INW(); + void FADE_OUTW(); + void setpal_vga256(const byte *palette); + void CHANGE_PALETTE(const byte *palette); + void DD_VBL(); }; class ObjectManager { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index cae33551b8..916e7202e5 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -68,8 +68,11 @@ Common::Error HopkinsEngine::run() { _graphicsManager.DD_Unlock(); _graphicsManager.LOAD_IMAGE("LINUX"); - /* - FADE_INW(); + +#ifdef HOPKINS_DEBUG + _graphicsManager.FADE_INW(); + delay(1500); +/* SDL_Delay(1500); FADE_OUTW(); if ( !internet ) @@ -469,6 +472,7 @@ LABEL_128: } } */ +#else // Copy vesa surface to screen _graphicsManager.DD_Lock(); memcpy((byte *)_graphicsManager.VideoPtr->pixels, (byte *)_graphicsManager.VESA_SCREEN.pixels, @@ -481,7 +485,7 @@ LABEL_128: while (g_system->getEventManager()->pollEvent(evt)) g_system->updateScreen(); } - +#endif return Common::kNoError; } @@ -587,4 +591,12 @@ void HopkinsEngine::Init_Interrupt() { // TODO: Determine whether the timer is needed } +void HopkinsEngine::delay(int delay) { + uint32 delayEnd = g_system->getMillis() + delay; + + while (!g_vm->shouldQuit() && g_system->getMillis() < delayEnd) { + g_system->delayMillis(10); + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 1a2e6961b2..c9c956ed53 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -95,6 +95,7 @@ public: bool getIsDemo() const; int getRandomNumber(int maxNumber); + void delay(int delay); }; // Global reference to the HopkinsEngine object -- cgit v1.2.3 From 254d4ac72b42a944b7d8c873530ec5d8ba73d738 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Sep 2012 22:18:43 +1000 Subject: HOPKINS: Improved on the initial image display hack --- engines/hopkins/hopkins.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 916e7202e5..b717f3fb75 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -475,8 +475,17 @@ LABEL_128: #else // Copy vesa surface to screen _graphicsManager.DD_Lock(); - memcpy((byte *)_graphicsManager.VideoPtr->pixels, (byte *)_graphicsManager.VESA_SCREEN.pixels, - SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + + const byte *srcP = (const byte *)_graphicsManager.VESA_SCREEN.pixels; + uint16 *destP = (uint16 *)_graphicsManager.VideoPtr->pixels; + for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); ++i, ++srcP, ++destP) { + byte r = _graphicsManager.Palette[*srcP * 3]; + byte g = _graphicsManager.Palette[*srcP * 3 + 1]; + byte b = _graphicsManager.Palette[*srcP * 3 + 2]; + + *destP = (b >> 2) | ((g >> 2) << 5) | ((r >> 2) << 10); + } + _graphicsManager.DD_Unlock(); // Stub event loop -- cgit v1.2.3 From e66ce45d0ab44bcc0e0ce10864da5bf0296cf075 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 13 Sep 2012 21:08:54 +1000 Subject: HOPKINS: Further work and bugfixes on palette processing --- engines/hopkins/files.cpp | 5 +- engines/hopkins/graphics.cpp | 261 ++++++++++++++++++++----------------------- engines/hopkins/graphics.h | 10 +- engines/hopkins/hopkins.cpp | 6 +- 4 files changed, 134 insertions(+), 148 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 565143d3ff..bbe3fbc7d0 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -164,7 +164,7 @@ byte *FileManager::LIBERE_FICHIER(byte *ptr) { } bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { - byte *ptr; // [sp+1Ch] [bp-40h]@0 + byte *ptr = NULL; Common::File f; switch (a2) { @@ -262,8 +262,7 @@ bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { // Scan for an entry in the catalogue const byte *startP = ptr; - int result; // eax@50 - void *v22; // ebx@53 + int result; bool matchFlag = false; int offsetVal = 0; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7c43d0449f..2fbf12f76a 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -33,6 +33,7 @@ namespace Hopkins { GraphicsManager::GraphicsManager() { + _lockCtr = 0; SDL_MODEYES = false; SDL_ECHELLE = 0; XSCREEN = YSCREEN = 0; @@ -54,6 +55,11 @@ GraphicsManager::GraphicsManager() { Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; FADESPD = 15; + + Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); + Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); + Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); + Common::fill(&Palette[0], &Palette[PALETTE_BLOCK_SIZE], 0); } GraphicsManager::~GraphicsManager() { @@ -88,7 +94,8 @@ void GraphicsManager::SET_MODE(int width, int height) { //height = Reel_Zoom(height, SDL_ECHELLE); } - Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 0, 10, 5, 0, 0); + //Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 0, 10, 5, 0, 0); + Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); if (bpp == 8) { initGraphics(width, height, true); @@ -105,8 +112,8 @@ void GraphicsManager::SET_MODE(int width, int height) { YSCREEN = height; Linear = true; - Winbpp = bpp; - WinScan = width; + Winbpp = bpp / 8; + WinScan = width * Winbpp; PAL_PIXELS = SD_PIXELS; nbrligne = width; @@ -119,13 +126,16 @@ void GraphicsManager::SET_MODE(int width, int height) { } void GraphicsManager::DD_Lock() { - VideoPtr = g_system->lockScreen(); + if (_lockCtr++ == 0) + VideoPtr = g_system->lockScreen(); } void GraphicsManager::DD_Unlock() { assert(VideoPtr); - g_system->unlockScreen(); - VideoPtr = NULL; + if (--_lockCtr == 0) { + g_system->unlockScreen(); + VideoPtr = NULL; + } } void GraphicsManager::Cls_Video() { @@ -158,7 +168,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { } SCROLL_ECRAN(0); - A_PCXSCREEN_WIDTH_SCREEN_HEIGHT((byte *)VESA_SCREEN.pixels, file, Palette, flag); + A_PCX640_480((byte *)VESA_SCREEN.pixels, file, Palette, flag); SCROLL = 0; OLD_SCROLL = 0; @@ -184,7 +194,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { DD_Unlock(); } else { - SCANLINE(0x500u); + SCANLINE(SCREEN_WIDTH * 2); GLOBALS.max_x = SCREEN_WIDTH * 2; DD_Lock(); Cls_Video(); @@ -212,11 +222,11 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { memcpy((byte *)VESA_BUFFER.pixels, (byte *)VESA_SCREEN.pixels, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); } -void GraphicsManager::INIT_TABLE(int a1, int a2, byte *a3) { +void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) { for (int idx = 0; idx < 256; ++idx) TABLE_COUL[idx] = idx; - Trans_bloc(TABLE_COUL, a3, 256, a1, a2); + Trans_bloc(TABLE_COUL, palette, 256, a1, a2); for (int idx = 0; idx < 256; ++idx) { byte v = TABLE_COUL[idx]; @@ -295,7 +305,7 @@ void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1, } // TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder -void GraphicsManager::A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { +void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { int filesize; signed __int16 v6; int v7; @@ -433,28 +443,27 @@ void GraphicsManager::A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Commo } if (f.read(palette, PALETTE_BLOCK_SIZE) != (PALETTE_BLOCK_SIZE)) - error("A_PCXSCREEN_WIDTH_SCREEN_HEIGHT"); + error("A_PCX640_480"); f.close(); GLOBALS.dos_free2(ptr); } void GraphicsManager::Cls_Pal() { - if (Winbpp == 2) { - Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); + Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); + SD_PIXELS[0] = 0; - // TODO: Figure out what this is for - //SD_PIXELS[2 * v0] = SDL_MapRGB(*(_DWORD *)(LinuxScr + 4), 0, 0, 0); + if (Winbpp == 1) { g_system->getPaletteManager()->setPalette(cmap, 0, 256); } } void GraphicsManager::souris_max() { - // Original has no implementatoin + // Original has no implementation } -void GraphicsManager::SCANLINE(int width) { - // Original has no implementatoin +void GraphicsManager::SCANLINE(int pitch) { + nbrligne = nbrligne2 = pitch; } void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { @@ -557,38 +566,30 @@ void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, } while (v9); } +/** + * Copies data from a 8-bit palette surface into the 16-bit screen + */ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *v7; - const byte *v8; - int v9; - int v10; - const byte *v11; - int v12; - const byte *v13; - const byte *v14; + DD_Lock(); assert(VideoPtr); - v7 = xs + nbrligne2 * ys + surface; - v8 = destX + destX + WinScan * destY + (byte *)VideoPtr->pixels; - v9 = height; + const byte *srcP = xs + nbrligne2 * ys + surface; + uint16 *destP = (uint16 *)((byte *)VideoPtr->pixels + destX * 2 + WinScan * destY); - do { - v14 = v8; - v13 = v7; - v10 = width; - v12 = v9; - v11 = PAL_PIXELS; - - do { - *(uint16 *)v8 = *(uint16 *)(v11 + 2 * *(byte *)v7++); - v8 += 2; - --v10; - } while (v10); - - v7 = nbrligne2 + v13; - v8 = WinScan + v14; - v9 = v12 - 1; - } while (v12 != 1); + for (int yp = 0; yp < height; ++yp) { + // Copy over the line, using the source pixels as lookups into the pixels palette + const byte *lineSrcP = srcP; + uint16 *lineDestP = destP; + + for (int xp = 0; xp < width; ++xp) + *lineDestP++ = PAL_PIXELS[*lineSrcP++]; + + // Move to the start of the next line + srcP += nbrligne2; + destP += WinScan / 2; + } + + DD_Unlock(); } void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { @@ -656,80 +657,62 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface) { - __int16 v3; - int v4; - __int16 v5; - __int16 v6; - char *v7; - __int16 v8; - char *v9; - __int16 v10; - signed __int16 v12; - unsigned __int16 v13; - byte palData[PALETTE_BLOCK_SIZE]; - byte v15[3]; - __int16 v16; - char v17[2]; - char v18[1532]; + uint16 palData1[PALETTE_BLOCK_SIZE * 2]; + byte palData2[PALETTE_BLOCK_SIZE]; - v13 = FADESPD; - v3 = 0; - do { - v4 = v3; - *(&v16 + v4) = 0; - palData[v4] = 0; - ++v3; - } while (v3 < (PALETTE_BLOCK_SIZE)); - - setpal_vga256(palData); - v12 = 0; - - if ((signed __int16)v13 > 0) { - do { - v5 = 0; - do { - if ((unsigned __int8)palData[v5] < *(byte *)(v5 + palette)) { - v6 = *(&v16 + v5) + ((unsigned int)*(byte *)(v5 + palette) << 8) / (signed __int16)v13; - *(&v16 + v5) = v6; - palData[v5] = (v6 >> 8) & 0xff; - } + // Initialise temporary palettes + Common::fill(&palData1[0], &palData1[PALETTE_BLOCK_SIZE], 0); + Common::fill(&palData2[0], &palData2[PALETTE_BLOCK_SIZE], 0); - if (v15[v5] < *(byte *)(palette + v5 + 1)) { - v7 = &v17[2 * v5]; - v8 = *(uint16 *)v7 + ((unsigned int)*(byte *)(palette + v5 + 1) << 8) / (signed __int16)v13; - *(uint16 *)v7 = v8; - v15[v5] = (v8 >> 8) & 0xff; - } + // Set current palette to black + setpal_vga256(palData2); + + // Loop through fading in the palette + uint16 *pTemp1 = &palData1[2]; + for (int fadeIndex = 0; fadeIndex < FADESPD; ++fadeIndex) { + uint16 *pTemp2 = &palData1[4]; + + for (int palOffset = 0; palOffset < PALETTE_BLOCK_SIZE; palOffset += 3) { + if (palData2[palOffset] < palette[palOffset]) { + uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD; + palData1[palOffset] = v; + palData2[palOffset] = (v >> 8) & 0xff; + } - if (v15[v5 + 1] < *(byte *)(palette + v5 + 2)) { - v9 = &v18[2 * v5]; - v10 = *(uint16 *)v9 + ((unsigned int)*(byte *)(palette + v5 + 2) << 8) / (signed __int16)v13; - *(uint16 *)v9 = v10; - v15[v5 + 1] = (v10 >> 8) & 0xff; - } + if (palData2[palOffset + 1] < palette[palOffset + 1]) { + uint16 *pDest = &pTemp1[palOffset]; + uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; + *pDest = v; + palData2[palOffset + 1] = (v >> 8) & 0xff; + } - v5 += 3; - } while (v5 < (PALETTE_BLOCK_SIZE)); - - setpal_vga256(palData); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); - else - m_scroll16(surface, start_x, 0, 640, 480, 0, 0); - DD_VBL(); + if (palData2[palOffset + 1] < palette[palOffset + 1]) { + uint16 *pDest = &pTemp2[palOffset]; + uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; + *pDest = v; + palData2[palOffset + 1] = (v >> 8) & 0xff; } + } - ++v12; - } while (v12 < (signed __int16)v13); + setpal_vga256(palData2); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + DD_VBL(); + } } + // Set the final palette setpal_vga256(palette); + + // Refresh the screen if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } } @@ -762,9 +745,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -783,9 +766,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -802,7 +785,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac if (Winbpp == 2) { if (!SDL_ECHELLE) { - m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } goto LABEL_28; @@ -816,12 +799,12 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (!SDL_ECHELLE) { - m_scroll16(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } LABEL_28: - m_scroll16A(surface, start_x, 0, 640, 480, 0, 0); + m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } } @@ -852,31 +835,33 @@ void GraphicsManager::setpal_vga256(const byte *palette) { } void GraphicsManager::CHANGE_PALETTE(const byte *palette) { - signed int v1; - signed int v2; - int v3; - const byte *v4; + // Copy the palette into the PALPCX block +// TODO: Likely either one or both of the destination arrays can be removed, +// since PALPCX is only used in SAVE_IMAGE, and cmap in the original was a RGBA +// array specifically intended just for passing to the SDL palette setter + Common::copy(&palette[0], &palette[PALETTE_BLOCK_SIZE], &PALPCX[0]); + Common::copy(&palette[0], &palette[PALETTE_BLOCK_SIZE], &cmap[0]); + + const byte *srcP = &palette[0]; + for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { + // TODO: Validate pixel encoding is correct + *(uint16 *)&SD_PIXELS[2 * idx] = MapRGB(*srcP, *(srcP + 1), *(srcP + 2)); + } - v1 = 0; - do { - PALPCX[v1] = *(byte *)(palette + v1); - ++v1; - } while (v1 < PALETTE_BLOCK_SIZE); - - v2 = 0; - do { - v3 = 3 * v2; - cmap[v3] = *(byte *)(palette + 3 * v2); - v4 = palette + 3 * v2; - cmap[v3 + 1] = *(byte *)(v4 + 1); - cmap[v3 + 2] = *(byte *)(v4 + 2); + if (Winbpp == 1) + g_system->getPaletteManager()->setPalette(cmap, 0, PALETTE_SIZE); +} - // TODO: Validate pixel encoding is correct - *(uint16 *)&SD_PIXELS[2 * v2++] = - *(byte *)v4 | (*(byte *)(v4 + 1) << 5) | (*(byte *)(v4 + 2) << 10); - } while (v2 < PALETTE_SIZE); +uint16 GraphicsManager::MapRGB(byte r, byte g, byte b) { + if (Winbpp == 1) { + error("TODO: Support in 8-bit graphics mode"); + } else { + Graphics::PixelFormat format = g_system->getScreenFormat(); - g_system->getPaletteManager()->setPalette(cmap, 0, PALETTE_SIZE); + return (r >> format.rLoss) << format.rShift + | (g >> format.gLoss) << format.gShift + | (b >> format.bLoss) << format.bShift; + } } void GraphicsManager::DD_VBL() { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 9151e62684..804498c122 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -43,16 +43,17 @@ class GraphicsManager { private: void CHARGE_ECRAN(const Common::String &file); public: + int _lockCtr; bool SDL_MODEYES; int SDL_ECHELLE; int XSCREEN; int YSCREEN; int WinScan; int Winbpp; - byte SD_PIXELS[257 * 2]; + byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; int nbrligne; - byte TABLE_COUL[256]; + byte TABLE_COUL[PALETTE_SIZE]; byte cmap[PALETTE_BLOCK_SIZE]; byte Palette[PALETTE_BLOCK_SIZE]; bool Linear; @@ -85,10 +86,10 @@ public: void INIT_TABLE(int a1, int a2, byte *a3); int SCROLL_ECRAN(int amount); void Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2); - void A_PCXSCREEN_WIDTH_SCREEN_HEIGHT(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); void Cls_Pal(); void souris_max(); - void SCANLINE(int width); + void SCANLINE(int pitch); void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); @@ -102,6 +103,7 @@ public: void FADE_OUTW(); void setpal_vga256(const byte *palette); void CHANGE_PALETTE(const byte *palette); + uint16 MapRGB(byte r, byte g, byte b); void DD_VBL(); }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b717f3fb75..e5ba60f402 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -69,7 +69,6 @@ Common::Error HopkinsEngine::run() { _graphicsManager.LOAD_IMAGE("LINUX"); -#ifdef HOPKINS_DEBUG _graphicsManager.FADE_INW(); delay(1500); /* @@ -472,7 +471,7 @@ LABEL_128: } } */ -#else +#if 0 // Copy vesa surface to screen _graphicsManager.DD_Lock(); @@ -487,6 +486,7 @@ LABEL_128: } _graphicsManager.DD_Unlock(); +#endif // Stub event loop Common::Event evt; @@ -494,7 +494,7 @@ LABEL_128: while (g_system->getEventManager()->pollEvent(evt)) g_system->updateScreen(); } -#endif + return Common::kNoError; } -- cgit v1.2.3 From ec4c7a8baf5f276914c287f1f777e5f27d98eb0e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 13 Sep 2012 22:55:50 +1000 Subject: HOPKINS: Fix blitting 8-bit images to the screen --- engines/hopkins/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 2fbf12f76a..d326598e56 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -582,7 +582,7 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, uint16 *lineDestP = destP; for (int xp = 0; xp < width; ++xp) - *lineDestP++ = PAL_PIXELS[*lineSrcP++]; + *lineDestP++ = *(uint16 *)&PAL_PIXELS[*lineSrcP++ * 2]; // Move to the start of the next line srcP += nbrligne2; -- cgit v1.2.3 From f1fce64994e687aada097f6293776108bdedcd68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Sep 2012 10:27:15 +1000 Subject: HOPKINS: Initial implementation of main animation player method --- engines/hopkins/anim.cpp | 285 +++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/anim.h | 50 ++++++++ engines/hopkins/events.cpp | 63 +++++++++- engines/hopkins/events.h | 15 ++- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 1 + engines/hopkins/graphics.cpp | 59 ++++++--- engines/hopkins/graphics.h | 12 +- engines/hopkins/hopkins.cpp | 55 +++++---- engines/hopkins/hopkins.h | 9 +- engines/hopkins/module.mk | 1 + engines/hopkins/sound.cpp | 16 +++ engines/hopkins/sound.h | 11 +- 13 files changed, 516 insertions(+), 63 deletions(-) create mode 100644 engines/hopkins/anim.cpp create mode 100644 engines/hopkins/anim.h 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 -- cgit v1.2.3 From 6e8fd5812ba1d03c8dd4753eb75d6da34f8d7033 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Sep 2012 11:45:36 +1000 Subject: HOPKINS: Cleanup and refactoring of frame counting and delays --- engines/hopkins/anim.cpp | 5 +---- engines/hopkins/events.cpp | 16 +++++++++++++++- engines/hopkins/events.h | 2 ++ engines/hopkins/hopkins.cpp | 21 +++++++-------------- engines/hopkins/hopkins.h | 1 - 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index f7e4df4c76..cb3c5af2c5 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -51,10 +51,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui doneFlag = 0; for (;;) { MAIN_LOOP: - v15 = 0; - v14 = 0; - v17 = 0; - v16 = 0; + v14 = v15 = v16 = v17 = 0; v18 = 1; screenP = _vm->_graphicsManager.VESA_SCREEN; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index c0c3c6e3e8..49e472ad17 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -83,13 +83,25 @@ void EventsManager::CONTROLE_MES() { pollEvents(); } -void EventsManager::pollEvents() { +void EventsManager::checkForNextFrameCounter() { uint32 milli = g_system->getMillis(); if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { _priorFrameTime = milli; ++lItCounter; + + g_system->updateScreen(); } +} + +void EventsManager::delay(int delay) { + uint32 delayEnd = g_system->getMillis() + delay; + while (!g_system->getEventManager()->shouldQuit() && g_system->getMillis() < delayEnd) { + g_system->delayMillis(10); + } +} + +void EventsManager::pollEvents() { Common::Event event; while (g_system->getEventManager()->pollEvent(event)) { // Handle keypress @@ -111,6 +123,8 @@ void EventsManager::pollEvents() { default: break; } + + checkForNextFrameCounter(); } } diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 8dc00a04c3..19629bfc5f 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -34,6 +34,7 @@ namespace Hopkins { class EventsManager { private: void pollEvents(); + void checkForNextFrameCounter(); public: bool souris_flag; bool mouse_linux; @@ -60,6 +61,7 @@ public: void showCursor(); void CONTROLE_MES(); + void delay(int delay); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dae6cceb03..a0d192e091 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -72,18 +72,19 @@ Common::Error HopkinsEngine::run() { _graphicsManager.LOAD_IMAGE("LINUX"); _graphicsManager.FADE_INW(); - delay(1500); + _eventsManager.delay(1500); _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); - FADE_OUTW(); + + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); +/* if ( !ESC_KEY ) INTRORUN(a1); iRegul = 0; @@ -601,12 +602,4 @@ void HopkinsEngine::Init_Interrupt() { // TODO: Determine whether the timer is needed } -void HopkinsEngine::delay(int delay) { - uint32 delayEnd = g_system->getMillis() + delay; - - while (!g_vm->shouldQuit() && g_system->getMillis() < delayEnd) { - g_system->delayMillis(10); - } -} - } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 6a9398fd49..568b9db6db 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -98,7 +98,6 @@ public: bool getIsDemo() const; int getRandomNumber(int maxNumber); - void delay(int delay); }; // Global reference to the HopkinsEngine object -- cgit v1.2.3 From 10bb7730ea559f62682db053eda2f532d25ffe68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Sep 2012 11:46:10 +1000 Subject: HOPKINS: Fix loading images other than the first item in a picture index --- engines/hopkins/files.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index bbe3fbc7d0..951db67483 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -261,45 +261,29 @@ bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { } // Scan for an entry in the catalogue - const byte *startP = ptr; int result; bool matchFlag = false; int offsetVal = 0; do { - Common::String name = (const char *)startP; + Common::String name = (const char *)ptr + offsetVal; - if (file == name) { + if (name == file) { // Found entry for file, so get it's details from the catalogue entry - const byte *pData = startP + offsetVal; - startP += offsetVal + 15; + const byte *pData = ptr + offsetVal; GLOBALS.CAT_POSI = READ_LE_UINT32(pData + 15); GLOBALS.CAT_TAILLE = READ_LE_UINT32(pData + 19); matchFlag = true; } - const char *finishString = "FINIS"; - const char *nameP = name.c_str(); - int finishRemainingChars = 6; - int v19 = 0; - bool finishMatch = true; - - do { - if (!finishRemainingChars) - break; - finishMatch = *finishString++ == *nameP++; - --finishRemainingChars; - } while (finishMatch); - - if (!finishMatch) - v19 = *(byte *)(finishString - 1) - *(byte *)(nameP - 1); - if (!v19) { + if (name == "FINIS") { GLOBALS.dos_free2(ptr); - return PTRNUL; + return false; } offsetVal += 23; } while (!matchFlag); + GLOBALS.dos_free2(ptr); // TODO: Double check whether this really should be an unsigned int comparison -- cgit v1.2.3 From d007e0aafe7932899cdf87d6007bf10ebed1cad6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Sep 2012 13:23:46 +1000 Subject: HOPKINS: initial implementation of INTORUN method --- engines/hopkins/anim.cpp | 12 ++ engines/hopkins/anim.h | 3 + engines/hopkins/events.cpp | 20 +++ engines/hopkins/events.h | 11 +- engines/hopkins/globals.cpp | 1 + engines/hopkins/globals.h | 1 + engines/hopkins/graphics.cpp | 20 +++ engines/hopkins/graphics.h | 7 + engines/hopkins/hopkins.cpp | 296 ++++++++++++++++++++++++++++++++++++++++--- engines/hopkins/hopkins.h | 6 +- engines/hopkins/sound.cpp | 16 ++- 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 -- cgit v1.2.3 From e02e950a40a5abbef9f53569d99b66af6dc30345 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Sep 2012 21:42:20 +1000 Subject: HOPKINS: Implemented Vbe decoding so introduction now runs --- engines/hopkins/anim.cpp | 26 ++++++++++++++------ engines/hopkins/events.cpp | 4 +-- engines/hopkins/graphics.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/graphics.h | 5 ++-- engines/hopkins/hopkins.cpp | 6 ++--- 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; -- cgit v1.2.3 From d2bf3ae78c693e119ac765b1af3578eefecee773 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Sep 2012 17:21:24 +1000 Subject: HOPKINS: Implementing code for CHARGE_ANIM and dependent methods --- engines/hopkins/anim.cpp | 310 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/anim.h | 9 +- engines/hopkins/files.cpp | 13 ++ engines/hopkins/files.h | 5 + engines/hopkins/globals.cpp | 11 +- engines/hopkins/globals.h | 15 ++- 6 files changed, 349 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 325dadcbf9..b0e48a9e59 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -297,8 +297,314 @@ void AnimationManager::BOBANIM_OFF(int a1) { warning("TODO: BOBANIM_OFF"); } -void AnimationManager::CHARGE_ANIM(const Common::String &filename) { - warning("TODO: CHARGE_ANIM"); +void AnimationManager::CHARGE_ANIM(const Common::String &animName) { + byte v20[15]; + char header[10]; + char filename1[15]; + char filename2[15]; + char filename3[15]; + char filename4[15]; + char filename5[15]; + char filename6[15]; + + CLEAR_ANIM(); + + Common::String filename = animName + ".ANI"; + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, filename); + + Common::File f; + if (!f.open(GLOBALS.NFICHIER)) + error("Failed to open %s", GLOBALS.NFICHIER); + + int filesize = f.size(); + int nbytes = filesize - 115; + f.read(header, 10); + f.read(v20, 15); + f.read(filename1, 15); + f.read(filename2, 15); + f.read(filename3, 15); + f.read(filename4, 15); + f.read(filename5, 15); + f.read(filename6, 15); + + if (header[0] != 'A' || header[1] != 'N' || header[2] != 'I' || header[3] != 'S') + error("File incompatible with this soft."); + + const char *files[6] = { &filename1[0], &filename2[0], &filename3[0], &filename4[0], + &filename5[0], &filename6[0] }; + + for (int idx = 1; idx <= 6; ++idx) { + if (files[idx - 1][0]) { + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, files[idx - 1]); + + if (!f.exists(GLOBALS.NFICHIER)) + error("File not found"); + if (CHARGE_BANK_SPRITE1(idx, files[idx - 1])) + error("File not compatible with this soft."); + } + } + + byte *data = GLOBALS.dos_malloc2(nbytes + 1); + f.read(data, nbytes); + f.close(); + + for (int idx = 1; idx <= 20; ++idx) { + RECHERCHE_ANIM(data, idx, nbytes); + } + + GLOBALS.dos_free2(data); +} + +void AnimationManager::CLEAR_ANIM() { + for (int idx = 0; idx < 35; ++idx) { + if (GLOBALS.Bqe_Anim[idx].data != PTRNUL) + GLOBALS.Bqe_Anim[idx].data = GLOBALS.dos_free2(GLOBALS.Bqe_Anim[idx].data); + GLOBALS.Bqe_Anim[idx].field4 = 0; + } + + for (int idx = 0; idx < 8; ++idx) { + if (GLOBALS.Bank[idx].data != PTRNUL) + GLOBALS.Bank[idx].data = GLOBALS.dos_free2(GLOBALS.Bank[idx].data); + GLOBALS.Bank[idx].field4 = 0; + GLOBALS.Bank[idx].filename1 = ""; + GLOBALS.Bank[idx].fileHeader = 0; + GLOBALS.Bank[idx].field1C = 0; + } +} + +int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filename) { + byte *v3; + byte *v4; + int v7; + int v8; + int width; + int height; + byte *v13; + __int16 v16; + __int16 v17; + byte *ptr; + byte *v19; + __int16 v20; + __int16 v21; + int result = 0; + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, filename); + GLOBALS.Bank[idx].field1C = FileManager::FLONG(GLOBALS.NFICHIER); + GLOBALS.Bank[idx].field4 = 1; + GLOBALS.Bank[idx].filename1 = filename; + GLOBALS.Bank[idx].filename2 = GLOBALS.REP_SPR; + + v3 = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + v4 = v3; + + GLOBALS.Bank[idx].fileHeader = 0; + if (*(v3 + 1) == 'L' && *(v3 + 2) == 'E') + GLOBALS.Bank[idx].fileHeader = 1; + if (*(v3 + 1) == 'O' && *(v3 + 2) == 'R') + GLOBALS.Bank[184].fileHeader = 2; + + if (GLOBALS.Bank[idx].fileHeader) { + GLOBALS.Bank[idx].data = v3; + + v7 = 0; + v8 = 0; + do { + ptr = v4; + width = Get_Largeur(v4, v8); + height = Get_Hauteur(ptr, v8); + v4 = ptr; + if (!width && !height) + v7 = 1; + if (!v7) + ++v8; + if (v8 > 249) + v7 = 1; + } while (v7 != 1); + + if (v8 <= 249) { + GLOBALS.Bank[idx].field1A = v8; + + Common::String ofsFilename = GLOBALS.Bank[idx].filename1; + while (ofsFilename.lastChar() != '.') + ofsFilename.deleteLastChar(); + ofsFilename += ".OFS"; + + FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, ofsFilename); + Common::File f; + if (!f.exists(GLOBALS.NFICHIER)) { + v19 = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + v13 = v19; + + if (GLOBALS.Bank[idx].field1A > 0) { + for (int v14 = 0; v14 < GLOBALS.Bank[idx].field1A; ++v14) { + v16 = READ_LE_UINT16(v13); + v17 = READ_LE_UINT16(v13 + 2); + v21 = READ_LE_UINT16(v13 + 4); + v20 = READ_LE_UINT16(v13 + 6); + v13 += 8; + + set_offsetxy(GLOBALS.Bank[idx].data, v14, v16, v17, 0); + if (GLOBALS.Bank[idx].fileHeader == 2) + set_offsetxy(GLOBALS.Bank[idx].data, v14, v21, v20, 1); + } + } + + GLOBALS.dos_free2(v19); + } + + result = 0; + } else { + GLOBALS.dos_free2(ptr); + GLOBALS.Bank[idx].field4 = 0; + result = -2; + } + } else { + GLOBALS.dos_free2(v3); + GLOBALS.Bank[idx].field4 = 0; + result = -1; + } + + return result; +} + +void AnimationManager::set_offsetxy(byte *data, int idx, int xp, __int16 yp, bool isSize) { + byte *startP = data + 3; + for (int i = idx; i; --i) + startP += READ_LE_UINT32(startP) + 16; + + byte *rectP = startP + 8; + if (isSize == 1) { + // Set size + byte *pointP = rectP + 4; + WRITE_LE_UINT16(pointP, xp); + WRITE_LE_UINT16(pointP + 2, yp); + } else { + // Set position + WRITE_LE_UINT16(rectP, xp); + WRITE_LE_UINT16(rectP + 2, yp); + } +} + +void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { + int v4; + const byte *v5; + int v6; + int v7; + byte *v9; + __int16 v10; + __int16 v11; + __int16 v12; + char v13; + signed int v14; + __int16 v15; + __int16 v16; + char v17; + int v19; + char v20; + int v21; + __int16 v22; + const byte *v23; + int v24; + + bool doneFlag = false; + bool breakFlag; + + v21 = 0; + v4 = 8 * idx; + v19 = 8 * idx; + + do { + v20 = *(v21 + data); + if (*(data + v20) == 'A' && *(data + v20 + 1) == 'N' && *(data + v20 + 2) == 'I' + && *(data + v20 + 3) == 'M') { + v4 = *(data + v21 + 4); + if (idx == v4) { + v5 = v21 + data + 5; + v6 = v21 + 5; + v7 = 0; + breakFlag = false; + + do { + if (*v5 == 'A' && *(v5 + 1) == 'N' && *(v5 + 2) == 'I' && *(v5 + 3) == 'M') + breakFlag = true; + + if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') + breakFlag = true; + + if (nbytes < v6) { + GLOBALS.Bqe_Anim[idx].field4 = 0; + GLOBALS.Bqe_Anim[idx].data = PTRNUL; + } + + ++v6; + ++v7; + ++v5; + } while (!breakFlag); + + GLOBALS.Bqe_Anim[idx].data = GLOBALS.dos_malloc2(v7 + 50); + GLOBALS.Bqe_Anim[idx].field4 = 1; + memcpy(GLOBALS.Bqe_Anim[idx].data, v21 + data + 5, 20); + + byte *dataP = GLOBALS.Bqe_Anim[idx].data; + + v9 = dataP + 20; + v23 = v21 + data + 25; + v10 = READ_LE_UINT16(v21 + data + 25); + v11 = READ_LE_UINT16(v21 + data + 27); + v22 = READ_LE_UINT16(v21 + data + 29); + v12 = READ_LE_UINT16(v21 + data + 31); + v13 = READ_LE_UINT16(v21 + data + 33); + *(dataP + 29) = *(v21 + data + 34); + WRITE_LE_UINT16(dataP + 20, v10); + WRITE_LE_UINT16(dataP + 22, v11); + WRITE_LE_UINT16(dataP + 24, v22); + WRITE_LE_UINT16(dataP + 26, v12); + WRITE_LE_UINT16(dataP + 28, v13); + v14 = 1; + + do { + v9 += 10; + v23 += 10; + if (!v22) + break; + + v24 = READ_LE_UINT16(v23); + v15 = READ_LE_UINT16(v23 + 2); + v22 = READ_LE_UINT16(v23 + 4); + v16 = READ_LE_UINT16(v23 + 6); + v17 = READ_LE_UINT16(v23 + 8); + *(v9 + 9) = *(v23 + 9); + WRITE_LE_UINT16(v9, v24); + WRITE_LE_UINT16(v9 + 2, v15); + WRITE_LE_UINT16(v9 + 4, v22); + WRITE_LE_UINT16(v9 + 6, v16); + WRITE_LE_UINT16(v9 + 8, v17); + ++v14; + } while (v14 <= 4999); + + doneFlag = 1; + } + } + + if (*(data + v20) == 'F' && *(data + v21 + 1) == 'I' && *(data + v21 + 2) == 'N') + doneFlag = 1; + ++v21; + } while (v21 <= nbytes && !doneFlag); +} + +int AnimationManager::Get_Largeur(const byte *data, int idx) { + const byte *rectP = data + 3; + for (int i = idx; i; --i) + rectP += READ_LE_UINT32(rectP) + 16; + + return (int16)READ_LE_UINT16(rectP + 4); +} + +int AnimationManager::Get_Hauteur(const byte *data, int idx) { + const byte *rectP = data + 3; + for (int i = idx; i; --i) + rectP += READ_LE_UINT32(rectP) + 16; + + return (int16)READ_LE_UINT16(rectP + 6); } } // End of namespace Hopkins diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index b18fc9be80..dcd04bd36c 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -33,6 +33,8 @@ namespace Hopkins { class HopkinsEngine; class AnimationManager { +private: + int CHARGE_BANK_SPRITE1(int idx, const Common::String &filename); public: HopkinsEngine *_vm; bool CLS_ANM; @@ -45,7 +47,12 @@ public: bool REDRAW_ANIM(); void BOBANIM_ON(int a1); void BOBANIM_OFF(int a1); - void CHARGE_ANIM(const Common::String &filename); + void CHARGE_ANIM(const Common::String &animName); + void CLEAR_ANIM(); + void set_offsetxy(byte *data, int idx, int xp, __int16 yp, bool isSize); + void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); + int Get_Largeur(const byte *data, int idx); + int Get_Hauteur(const byte *data, int idx); }; } // End of namespace Hopkins diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 951db67483..90b5cf0ae8 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -307,4 +307,17 @@ bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { return result; } +uint32 FileManager::FLONG(const Common::String &filename) { + Common::File f; + uint32 size; + + if (!f.open(filename)) + error("Could not find file %s", filename.c_str()); + + size = f.size(); + f.close(); + + return size; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 8c8f01004d..e5e4be3566 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -44,6 +44,11 @@ public: 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); + + /** + * Returns the size of a file. Throws an error if the file can't be found + */ + static uint32 FLONG(const Common::String &filename); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f7d94ee90f..85d7033e7a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -629,16 +629,17 @@ void Globals::HOPKINS_DATA() { void Globals::INIT_ANIM() { for (int idx = 0; idx < 35; ++idx) { - Bge_Anim[idx].field0 = PTRNUL; - Bge_Anim[idx].field4 = 0; + Bqe_Anim[idx].data = PTRNUL; + Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - Bank[idx].field0 = PTRNUL; + Bank[idx].data = PTRNUL; Bank[idx].field4 = 0; - Bank[idx].field5 = 0; - Bank[idx].field19 = 0; + Bank[idx].filename1 = ""; + Bank[idx].fileHeader = 0; Bank[idx].field1C = 0; + Bank[idx].filename2 = ""; } } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 0495607b5d..572d73ba8e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -68,17 +68,19 @@ struct CarreZoneItem { int field0; }; -struct BgeAnimItem { - byte *field0; +struct BqeAnimItem { + byte *data; int field4; }; struct BankItem { - byte *field0; + byte *data; int8 field4; - int8 field5; - int8 field19; + Common::String filename1; + int fileHeader; + int field1A; uint32 field1C; + Common::String filename2; }; struct VBobItem { @@ -133,6 +135,7 @@ public: Common::String FICH_ZONE; Common::String FICH_TEXTE; Common::String NFICHIER; + Common::String REP_SPR; int SOUNDVOL; int MUSICVOL; int VOICEVOL; @@ -162,7 +165,7 @@ public: LigneItem Ligne[400]; LigneZoneItem LigneZone[400]; CarreZoneItem CarreZone[100]; - BgeAnimItem Bge_Anim[35]; + BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; VBobItem VBob[35]; ObjetWItem ObjetW[300]; -- cgit v1.2.3 From 809ab3e7b5f038aa02933535090e8e5c9258fe80 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Sep 2012 17:33:33 +1000 Subject: HOPKINS: Implemented BOB_ANIM_ON and BOB_ANIM_OFF --- engines/hopkins/anim.cpp | 17 ++++++++++++----- engines/hopkins/anim.h | 6 +++--- engines/hopkins/globals.h | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index b0e48a9e59..3977729b75 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -289,12 +289,19 @@ bool AnimationManager::REDRAW_ANIM() { return false; } -void AnimationManager::BOBANIM_ON(int a1) { - warning("TODO: BOBANIM_ON"); +void AnimationManager::BOBANIM_ON(int idx) { + if (GLOBALS.Bob[idx].field16) { + GLOBALS.Bob[idx].field16 = 0; + GLOBALS.Bob[idx].field10 = 5; + GLOBALS.Bob[idx].fieldC = 250; + GLOBALS.Bob[idx].field12 = 0; + GLOBALS.Bob[idx].field14 = 0; + } } -void AnimationManager::BOBANIM_OFF(int a1) { - warning("TODO: BOBANIM_OFF"); +void AnimationManager::BOBANIM_OFF(int idx) { + GLOBALS.Bob[idx].field16 = 1; + } void AnimationManager::CHARGE_ANIM(const Common::String &animName) { @@ -466,7 +473,7 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } -void AnimationManager::set_offsetxy(byte *data, int idx, int xp, __int16 yp, bool isSize) { +void AnimationManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { byte *startP = data + 3; for (int i = idx; i; --i) startP += READ_LE_UINT32(startP) + 16; diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index dcd04bd36c..a85fc3cbad 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -45,11 +45,11 @@ 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 BOBANIM_ON(int idx); + void BOBANIM_OFF(int idx); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); - void set_offsetxy(byte *data, int idx, int xp, __int16 yp, bool isSize); + void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); int Get_Largeur(const byte *data, int idx); int Get_Hauteur(const byte *data, int idx); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 572d73ba8e..48b88babd8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -83,6 +83,19 @@ struct BankItem { Common::String filename2; }; +struct BobItem { + int fieldC; + int field10; + int field12; + int field14; + int field16; +}; + +struct BlAnimItem { + uint32 v1; + uint32 v2; +}; + struct VBobItem { byte *field0; int field4; @@ -167,6 +180,8 @@ public: CarreZoneItem CarreZone[100]; BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; + BobItem Bob[36]; + BlAnimItem BL_ANIM[30]; VBobItem VBob[35]; ObjetWItem ObjetW[300]; byte *Winventaire; -- cgit v1.2.3 From 0b610c45dff6b715f1f5e3e5161619dc57d19061 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Sep 2012 16:53:21 +1000 Subject: HOPKINS: Implemented rest of main method, with stubs for sub-method calls --- engines/hopkins/events.cpp | 15 +- engines/hopkins/events.h | 6 +- engines/hopkins/globals.cpp | 17 + engines/hopkins/globals.h | 15 + engines/hopkins/graphics.cpp | 4 + engines/hopkins/graphics.h | 1 + engines/hopkins/hopkins.cpp | 858 +++++++++++++++++++++++-------------------- engines/hopkins/hopkins.h | 13 + engines/hopkins/sound.cpp | 4 + engines/hopkins/sound.h | 1 + 10 files changed, 522 insertions(+), 412 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f3c913f606..5470f3167b 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -89,10 +89,21 @@ int EventsManager::YMOUSE() { return souris_x + ofset_souris_x; } -void EventsManager::hideCursor() { +bool EventsManager::BMOUSE() { + CONTROLE_MES(); + return souris_bb; } -void EventsManager::showCursor() { +void EventsManager::MOUSE_OFF() { + warning("TODO: MOUSE_OFF"); +} + +void EventsManager::MOUSE_ON() { + warning("TODO: MOUSE_ON"); +} + +void EventsManager::CHANGE_MOUSE(int id) { + warning("TODO: CHANGE_MOUSE"); } void EventsManager::CONTROLE_MES() { diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index ca6d8e5fd2..792e2774c4 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -59,8 +59,10 @@ public: void souris_max(); int XMOUSE(); int YMOUSE(); - void hideCursor(); - void showCursor(); + bool BMOUSE(); + void MOUSE_ON(); + void MOUSE_OFF(); + void CHANGE_MOUSE(int id); void VBL(); void CONTROLE_MES(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 85d7033e7a..cc96588f9a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -61,6 +61,18 @@ Globals::Globals() { CAT_TAILLE = 0; Nouv_objet = 0; iRegul = 0; + SORTIE = 0; + PLANX = PLANY = 0; + PERSO = 0; + PASSWORD = 0; + ECRAN = 0; + NOSPRECRAN = 0; + OLD_ECRAN = 0; + Max_Propre_Gen = 0; + Max_Ligne_Long = 0; + Max_Perso_Y = 0; + Max_Propre = 0; + btsouris = 0; // Initialise pointers ICONE = NULL; @@ -86,6 +98,7 @@ Globals::Globals() { Bufferdecor = NULL; ADR_FICHIER_OBJ = NULL; police = NULL; + PERSO = NULL; // Reset flags MUSICOFF = false; @@ -102,6 +115,9 @@ Globals::Globals() { GESTE_FLAG = false; redraw = false; BPP_NOAFF = false; + DESACTIVE_INVENT = false; + FLAG_VISIBLE = false; + netscape = false; } Globals::~Globals() { @@ -123,6 +139,7 @@ Globals::~Globals() { free(cache_souris); free(Bufferdecor); free(ADR_FICHIER_OBJ); + free(PERSO); } void Globals::setConfig() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 48b88babd8..e73df7e159 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -213,6 +213,7 @@ public: byte *BufLig; byte *Bufferdecor; byte *ADR_FICHIER_OBJ; + byte *PERSO; bool redraw; int OBJL, OBJH; int Nouv_objet; @@ -221,6 +222,20 @@ public: uint32 CAT_TAILLE; int iRegul; bool BPP_NOAFF; + int SORTIE; + int PLANX, PLANY; + int PASSWORD; + int NOSPRECRAN; + int ECRAN; + int OLD_ECRAN; + int Max_Propre; + int Max_Propre_Gen; + int Max_Ligne_Long; + int Max_Perso_Y; + bool DESACTIVE_INVENT; + bool FLAG_VISIBLE; + bool netscape; + int btsouris; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b02a81123f..f183adee41 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -965,6 +965,10 @@ void GraphicsManager::VISU_ALL() { warning("TODO: VISU_ALL"); } +void GraphicsManager::RESET_SEGMENT_VESA() { + warning("TODO: RESET_SEGMENT_VESA"); +} + /*------------------------------------------------------------------------*/ byte *ObjectManager::CHANGE_OBJET(int objIndex) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 6bb8f333b5..93b6ebcebd 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -119,6 +119,7 @@ public: void Copy_Video_Vbe16(const byte *surface); void FIN_VISU(); void VISU_ALL(); + void RESET_SEGMENT_VESA(); }; class ObjectManager { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c01b3b1cba..ebfe694d28 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4,9 +4,9 @@ * 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 + * This program is _globals.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 + * as published by the _globals.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, @@ -15,8 +15,8 @@ * 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. + * along with this program; if not, write to the _globals.FRee Software + * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -62,7 +62,7 @@ Common::Error HopkinsEngine::run() { ObjectManager::AJOUTE_OBJET(14); GLOBALS.HELICO = 0; - _eventsManager.hideCursor(); + _eventsManager.MOUSE_OFF(); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -86,410 +86,373 @@ Common::Error HopkinsEngine::run() { if (!_eventsManager.ESC_KEY) INTRORUN(); - /* - _globals.iRegul = 0; - CONSTRUIT_SYSTEM("PERSO.SPR"); - PERSO = CHARGE_FICHIER(GLOBALS.NFICHIER); - PERSO_TYPE = 0; - PLANX = 0; - PLANY = 0; - memset(SAUVEGARDE, 0, 0x7CFu); - SORTIE = 0; - PASSWORD = 1; + + _globals.iRegul = 0; + FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); + GLOBALS.PERSO = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + GLOBALS.PERSO_TYPE = 0; + GLOBALS.PLANX = GLOBALS.PLANY = 0; + memset(GLOBALS.SAUVEGARDE, 0, 2000); + GLOBALS.SORTIE = 0; + GLOBALS.PASSWORD = 1; + LABEL_12: - if ( SORTIE == 300 ) + if (GLOBALS.SORTIE == 300) LABEL_13: - SORTIE = 0; - if ( !SORTIE ) - { - SORTIE = MENU(); - if ( SORTIE == -1 ) - { - PUBQUIT(); - PERSO = (void *)dos_free2(PERSO); - REST_SYSTEM(); - } - } - while ( 1 ) - { - while ( 1 ) - { - while ( 1 ) - { - while ( 1 ) - { - while ( 1 ) - { - while ( 1 ) - { - while ( 1 ) - { - while ( 1 ) - { - if ( SORTIE == 300 ) - goto LABEL_13; - if ( SORTIE == 18 ) - PASS(); - if ( SORTIE == 23 ) - PASS(); - if ( SORTIE == 22 ) - PASS(); - if ( SORTIE == 19 ) - PASS(); - if ( SORTIE == 20 ) - PASS(); - if ( SORTIE != 1 ) - break; - Max_Propre = 50; - Max_Ligne_Long = 40; - Max_Propre_Gen = 20; - Max_Perso_Y = 435; - PERSONAGE2((int)"IM01", (int)"IM01", (int)"ANIM01", (int)"IM01", 1); - } - if ( SORTIE != 3 ) - break; - if ( !*((_BYTE *)SAUVEGARDE + 170) ) - { - _soundManager.WSOUND(3); - if ( FR == 1 ) - LOAD_IMAGE("fondfr"); - if ( !FR ) - LOAD_IMAGE("fondan"); - if ( FR == 2 ) - LOAD_IMAGE("fondes"); - FADE_INW(); - SDL_Delay(500); - FADE_OUTW(); - _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; - DD_Lock(); - Cls_Video(); - DD_Unlock(); - Cls_Pal(); - FADE_LINUX = 2; - if ( !CENSURE ) - PLAY_ANM("BANQUE.ANM", 200, 28, 200); - if ( CENSURE == 1 ) - PLAY_ANM("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; - DEL_SAMPLE(1); - DEL_SAMPLE(2); - DEL_SAMPLE(3); - DEL_SAMPLE(4); - *((_BYTE *)SAUVEGARDE + 170) = 1; - } - Max_Propre = 5; - Max_Ligne_Long = 5; - Max_Propre_Gen = 5; - Max_Perso_Y = 450; - NOSPRECRAN = 1; - PERSONAGE2((int)"IM03", (int)"IM03", (int)"ANIM03", (int)"IM03", 2); - } - if ( SORTIE != 4 ) - break; - DESACTIVE_INVENT = 1; - PLAN_BETA(a1); - DESACTIVE_INVENT = 0; - } - if ( SORTIE != 5 ) - break; - Max_Propre = 5; - Max_Ligne_Long = 5; - Max_Propre_Gen = 5; - Max_Perso_Y = 455; - NOSPRECRAN = 1; - v1 = *((_BYTE *)SAUVEGARDE + 80); - if ( v1 ) - { - if ( v1 == 1 ) - PERSONAGE2((int)"IM05", (int)"IM05A", (int)"ANIM05B", (int)"IM05", 3); - } - else - { - PERSONAGE2((int)"IM05", (int)"IM05", (int)"ANIM05", (int)"IM05", 3); - } - NOSPRECRAN = 0; - } - if ( SORTIE != 8 ) - break; - Max_Propre = 15; - Max_Ligne_Long = 15; - Max_Propre_Gen = 10; - Max_Perso_Y = 450; - PERSONAGE2((int)"IM08", (int)"IM08", (int)"ANIM08", (int)"IM08", 2); - } - if ( SORTIE != 6 ) - break; - Max_Propre = 15; - Max_Ligne_Long = 20; - Max_Propre_Gen = 10; - Max_Perso_Y = 460; - PERSONAGE2((int)"IM06", (int)"IM06", (int)"ANIM06", (int)"IM06", 2); - } - if ( SORTIE != 7 ) - break; - if ( *((_BYTE *)SAUVEGARDE + 220) ) - PERSONAGE((int)"BOMBEB", (int)"BOMBE", (int)"BOMBE", (int)"BOMBE", 2); - else - PERSONAGE((int)"BOMBEA", (int)"BOMBE", (int)"BOMBE", (int)"BOMBE", 2); - } - if ( SORTIE == 9 ) - { - Max_Propre = 15; - Max_Ligne_Long = 20; - Max_Propre_Gen = 10; - Max_Perso_Y = 440; - if ( !*((_BYTE *)SAUVEGARDE + 225) ) - goto LABEL_109; - PERSONAGE2((int)"IM09", (int)"IM09", (int)"ANIM09", (int)"IM09", 10); - } - else - { - if ( SORTIE == 10 ) - { - NOSPRECRAN = 1; - PERSONAGE((int)"IM10", (int)"IM10", (int)"ANIM10", (int)"IM10", 9); - goto LABEL_124; - } - if ( SORTIE == 11 ) - { - NOSPRECRAN = 1; - Max_Propre = 15; - Max_Ligne_Long = 20; - Max_Propre_Gen = 10; - Max_Perso_Y = 450; - PERSONAGE2((int)"IM11", (int)"IM11", (int)"ANIM11", (int)"IM11", 2); - goto LABEL_124; - } - switch ( SORTIE ) - { - case 12: - Max_Propre = 15; - Max_Ligne_Long = 20; - Max_Propre_Gen = 10; - Max_Perso_Y = 450; - if ( *((_BYTE *)SAUVEGARDE + 225) ) - { - NOSPRECRAN = 1; - PERSONAGE2((int)"IM12", (int)"IM12", (int)"ANIM12", (int)"IM12", 1); - } - else - { + GLOBALS.SORTIE = 0; + + if (!GLOBALS.SORTIE) { + GLOBALS.SORTIE = MENU(); + if (GLOBALS.SORTIE == -1) { + PUBQUIT(); + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + } + } + + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + if (GLOBALS.SORTIE == 300) + goto LABEL_13; + if (GLOBALS.SORTIE == 18) + PASS(); + if (GLOBALS.SORTIE == 23) + PASS(); + if (GLOBALS.SORTIE == 22) + PASS(); + if (GLOBALS.SORTIE == 19) + PASS(); + if (GLOBALS.SORTIE == 20) + PASS(); + if (GLOBALS.SORTIE != 1) + break; + + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + } + + if (GLOBALS.SORTIE != 3) + break; + + if (!*((byte *)GLOBALS.SAUVEGARDE + 170)) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fond_globals.FR"); + if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + if (_globals.FR == 2) + _graphicsManager.LOAD_IMAGE("fondes"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + + if (!GLOBALS.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + if (GLOBALS.CENSURE == 1) + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + *((byte *)GLOBALS.SAUVEGARDE + 170) = 1; + } + + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + GLOBALS.NOSPRECRAN = 1; + PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + } + + if (GLOBALS.SORTIE != 4) + break; + _globals.DESACTIVE_INVENT = true; + PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + } + + if (GLOBALS.SORTIE != 5) + break; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 455; + GLOBALS.NOSPRECRAN = 1; + byte v1 = *((byte *)GLOBALS.SAUVEGARDE + 80); + if (v1) { + if (v1 == 1) + PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + GLOBALS.NOSPRECRAN = 0; + } + + if (GLOBALS.SORTIE != 8) + break; + + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + } + + if (GLOBALS.SORTIE != 6) + break; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + } + + if (GLOBALS.SORTIE != 7) + break; + if (*((byte *)GLOBALS.SAUVEGARDE + 220)) + PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + } + + if (GLOBALS.SORTIE == 9) { + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + + if (!*((byte *)GLOBALS.SAUVEGARDE + 225)) + goto LABEL_109; + PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + } else { + if (GLOBALS.SORTIE == 10) { + GLOBALS.NOSPRECRAN = 1; + PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + goto LABEL_124; + } + + if (GLOBALS.SORTIE == 11) { + GLOBALS.NOSPRECRAN = 1; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + goto LABEL_124; + } + + switch (GLOBALS.SORTIE) { + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (*((byte *)GLOBALS.SAUVEGARDE + 225)) { + GLOBALS.NOSPRECRAN = 1; + PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { LABEL_109: - BOOM(a1); - } - break; - case 13: - Max_Propre = 50; - Max_Ligne_Long = 40; - Max_Propre_Gen = 20; - Max_Perso_Y = 440; - PERSONAGE2((int)"IM13", (int)"IM13", (int)"ANIM13", (int)"IM13", 1); - break; - case 14: - Max_Propre = 50; - Max_Ligne_Long = 40; - Max_Propre_Gen = 20; - Max_Perso_Y = 440; - PERSONAGE2((int)"IM14", (int)"IM14", (int)"ANIM14", (int)"IM14", 1); - break; - default: - if ( SORTIE == 15 ) - { - NOSPRECRAN = 1; - PERSONAGE((int)"IM15", (int)"IM15", (int)"ANIM15", (int)"IM15", 29); - goto LABEL_124; - } - if ( SORTIE == 16 ) - { - Max_Propre = 5; - Max_Ligne_Long = 5; - Max_Propre_Gen = 5; - Max_Perso_Y = 450; - v2 = *((_BYTE *)SAUVEGARDE + 113); - if ( v2 == 1 ) - { - PERSONAGE2((int)"IM16", (int)"IM16A", (int)"ANIM16", (int)"IM16", 7); - } - else if ( !v2 ) - { - PERSONAGE2((int)"IM16", (int)"IM16", (int)"ANIM16", (int)"IM16", 7); - } - } - else - { - if ( SORTIE == 17 ) - PASS(); - if ( SORTIE == 24 ) - PASS(); - if ( SORTIE == 25 ) - { - Max_Propre = 15; - Max_Ligne_Long = 20; - Max_Propre_Gen = 10; - Max_Perso_Y = 445; - PERSONAGE2((int)"IM25", (int)"IM25", (int)"ANIM25", (int)"IM25", 30); - } - else - { - if ( SORTIE == 33 ) - { - NOSPRECRAN = 1; - PERSONAGE((int)"IM33", (int)"IM33", (int)"ANIM33", (int)"IM33", 8); - goto LABEL_124; - } - if ( SORTIE == 26 ) - { - Max_Propre = 50; - Max_Ligne_Long = 40; - Max_Propre_Gen = 20; - Max_Perso_Y = 435; - PERSONAGE2((int)"IM26", (int)"IM26", (int)"ANIM26", (int)"IM26", 30); - } - else - { - if ( SORTIE == 27 ) - PASS(); - if ( SORTIE == 28 ) - PASS(); - if ( SORTIE == 29 ) - PASS(); - if ( SORTIE == 30 ) - PASS(); - if ( SORTIE == 31 ) - PASS(); - if ( SORTIE == 35 ) - ENDEMO(); - if ( SORTIE == 32 ) - PASS(); - if ( SORTIE == 34 ) - PASS(); - if ( (unsigned __int16)(SORTIE - 51) <= 0x26u ) - PASS(); - if ( SORTIE == 111 ) - { - NOSPRECRAN = 1; - PERSONAGE((int)"IM111", (int)"IM111", (int)"ANIM111", (int)"IM111", 10); - goto LABEL_124; - } - if ( SORTIE == 112 ) - { - NOSPRECRAN = 1; - PERSONAGE((int)"IM112", (int)"IM112", (int)"ANIM112", (int)"IM112", 10); + BOOM(); + } + break; + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + default: + if (GLOBALS.SORTIE == 15) { + GLOBALS.NOSPRECRAN = 1; + PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + goto LABEL_124; + } + if (GLOBALS.SORTIE == 16) { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + + byte v2 = *((byte *)GLOBALS.SAUVEGARDE + 113); + if (v2 == 1) { + PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!v2) { + PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + } else { + if (GLOBALS.SORTIE == 17) + PASS(); + if (GLOBALS.SORTIE == 24) + PASS(); + if (GLOBALS.SORTIE == 25) { + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + } else { + if (GLOBALS.SORTIE == 33) { + GLOBALS.NOSPRECRAN = 1; + PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + goto LABEL_124; + } + + if (GLOBALS.SORTIE == 26) { + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + } else { + if (GLOBALS.SORTIE == 27) + PASS(); + if (GLOBALS.SORTIE == 28) + PASS(); + if (GLOBALS.SORTIE == 29) + PASS(); + if (GLOBALS.SORTIE == 30) + PASS(); + if (GLOBALS.SORTIE == 31) + PASS(); + if (GLOBALS.SORTIE == 35) + ENDEMO(); + if (GLOBALS.SORTIE == 32) + PASS(); + if (GLOBALS.SORTIE == 34) + PASS(); + + if ((uint16)(GLOBALS.SORTIE - 51) <= 38) + PASS(); + if (GLOBALS.SORTIE == 111) { + GLOBALS.NOSPRECRAN = 1; + PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + goto LABEL_124; + } + + if (GLOBALS.SORTIE == 112) { + GLOBALS.NOSPRECRAN = 1; + PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); LABEL_124: - NOSPRECRAN = 0; - } - else if ( SORTIE == 113 ) - { - SORTIE = 0; - OLD_ECRAN = ECRAN; - *((_BYTE *)SAUVEGARDE + 6) = ECRAN; - ECRAN = 113; - *((_BYTE *)SAUVEGARDE + 5) = 113; - COMPUT_HOPKINS(a1, 1); - DD_LOCK(); - Cls_Video(); - DD_UNLOCK(); - DD_VBL(); - memset(VESA_BUFFER, 0, 0x4B000u); - memset(VESA_SCREEN, 0, 0x4B000u); - Cls_Pal(); - RESET_SEGMENT_VESA(); - } - else - { - if ( SORTIE == 114 ) - { - SORTIE = 0; - OLD_ECRAN = ECRAN; - *((_BYTE *)SAUVEGARDE + 6) = ECRAN; - ECRAN = 114; - *((_BYTE *)SAUVEGARDE + 5) = 114; - COMPUT_HOPKINS(a1, 2); - goto LABEL_128; - } - if ( SORTIE == 115 ) - { - SORTIE = 0; - OLD_ECRAN = ECRAN; - *((_BYTE *)SAUVEGARDE + 6) = ECRAN; - ECRAN = 115; - *((_BYTE *)SAUVEGARDE + 5) = 115; - COMPUT_HOPKINS(a1, 3); -LABEL_128: - DD_LOCK(); - Cls_Video(); - DD_UNLOCK(); - } - else if ( (unsigned __int16)(SORTIE - 194) > 5u ) - { - if ( SORTIE == 151 ) - { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - DD_Lock(); - Cls_Video(); - DD_Unlock(); - Cls_Pal(); - FADE_LINUX = 2; - PLAY_ANM("JOUR3A.anm", 12, 12, 2000); - _globals.iRegul = 0; - SORTIE = 300; - } - if ( SORTIE == 150 ) - { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - DD_Lock(); - Cls_Video(); - DD_Unlock(); - Cls_Pal(); - FADE_LINUX = 2; - PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - SORTIE = 300; - } - if ( SORTIE == 152 ) - { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - DD_Lock(); - Cls_Video(); - DD_Unlock(); - Cls_Pal(); - FADE_LINUX = 2; - PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - SORTIE = 300; - } - goto LABEL_12; - } - } - } - } - } - break; - } - } - } -*/ -#if 0 - // Copy vesa surface to screen - _graphicsManager.DD_Lock(); - - 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]; - byte g = _graphicsManager.Palette[*srcP * 3 + 1]; - byte b = _graphicsManager.Palette[*srcP * 3 + 2]; + GLOBALS.NOSPRECRAN = 0; + } else if (GLOBALS.SORTIE == 113) { + GLOBALS.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 113; + *((byte *)GLOBALS.SAUVEGARDE + 5) = 113; + COMPUT_HOPKINS(1); + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); + memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + _graphicsManager.Cls_Pal(); + _graphicsManager.RESET_SEGMENT_VESA(); + } else { + if (GLOBALS.SORTIE == 114) { + GLOBALS.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 114; + *((byte *)GLOBALS.SAUVEGARDE + 5) = 114; + COMPUT_HOPKINS(2); + goto LABEL_128; + } + if (GLOBALS.SORTIE == 115) { + GLOBALS.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 115; + *((byte *)GLOBALS.SAUVEGARDE + 5) = 115; + COMPUT_HOPKINS(3); - *destP = (b >> 2) | ((g >> 2) << 5) | ((r >> 2) << 10); +LABEL_128: + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + } else if ((uint16)(GLOBALS.SORTIE - 194) > 5) { + if (GLOBALS.SORTIE == 151) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + GLOBALS.SORTIE = 300; + } + + if (GLOBALS.SORTIE == 150) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + GLOBALS.SORTIE = 300; + } + + if (GLOBALS.SORTIE == 152) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + GLOBALS.SORTIE = 300; + } + goto LABEL_12; + } + } + } + } + } + break; + } + } } - _graphicsManager.DD_Unlock(); -#endif - // Stub event loop Common::Event evt; while (!g_system->getEventManager()->shouldQuit()) { @@ -530,15 +493,15 @@ void HopkinsEngine::INIT_SYSTEM() { _eventsManager.mouse_linux = true; - switch (GLOBALS.FR) { + switch (_globals.FR) { case 0: if (!_eventsManager.mouse_linux) FileManager::CONSTRUIT_SYSTEM("SOUAN.SPR"); - if (!GLOBALS.FR && _eventsManager.mouse_linux) + if (!_globals.FR && _eventsManager.mouse_linux) FileManager::CONSTRUIT_SYSTEM("LSOUAN.SPR"); break; case 1: - FileManager::CONSTRUIT_SYSTEM("LSOUFR.SPR"); + FileManager::CONSTRUIT_SYSTEM("LSOU_globals.FR.SPR"); break; case 2: FileManager::CONSTRUIT_SYSTEM("SOUES.SPR"); @@ -565,7 +528,7 @@ void HopkinsEngine::INIT_SYSTEM() { FileManager::CONSTRUIT_SYSTEM("TETE.SPR"); GLOBALS.TETE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); - switch (GLOBALS.FR) { + switch (_globals.FR) { case 0: FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEAN.TXT"); GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); @@ -639,9 +602,9 @@ void HopkinsEngine::INTRORUN() { if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(3, 3); - _graphicsManager.DD_LOCK(); + _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.DD_VBL(); _soundManager.WSOUND(11); @@ -858,4 +821,83 @@ void HopkinsEngine::INTRORUN() { _eventsManager.ESC_KEY = false; } +void HopkinsEngine::PASS() { + warning("TODO: PASS"); +} + +void HopkinsEngine::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + warning("TODO: PERSONAGE2"); +} + +void HopkinsEngine::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + warning("TODO: PERSONAGE2"); +} + +void HopkinsEngine::REST_SYSTEM() { + warning("REST_SYSTEM"); +} + +void HopkinsEngine::PLAN_BETA() { + warning("PLAN_BETA"); +} + +void HopkinsEngine::PUBQUIT() { + _globals.PUBEXIT = 1; + _graphicsManager.RESET_SEGMENT_VESA(); + _globals.FORET = 0; + _eventsManager.CASSE = 0; + _globals.DESACTIVE_INVENT = true; + _globals.FLAG_VISIBLE = false; + _graphicsManager.LOAD_IMAGE("BOX"); + _soundManager.WSOUND(28); + _graphicsManager.FADE_INW(); + _eventsManager.MOUSE_ON(); + _eventsManager.CHANGE_MOUSE(0); + _globals.btsouris = 0; + _eventsManager.souris_n = 0; + _globals.netscape = true; + + bool mouseClicked = false; + int xp, yp; + do { + xp = _eventsManager.XMOUSE(); + yp = _eventsManager.YMOUSE(); + _eventsManager.VBL(); + + if (_eventsManager.BMOUSE() == 1) + mouseClicked = true; + } while (!mouseClicked && g_system->getEventManager()->shouldQuit()); + + if ((unsigned int)(xp - 167) <= 302 && (unsigned int)(yp - 47) <= 387) { + warning("Try to Connect..."); + _eventsManager.delay(25000); +// open_URL((int)"http://www.hopkinsfbi.com"); + + while (1) { + _globals.iRegul = 10; + _eventsManager.VBL(); + } + } + return _graphicsManager.FADE_OUTW(); +} + +void HopkinsEngine::COMPUT_HOPKINS(int a1) { + warning("TODO: COMPUT_HOPKINS"); +} + +int HopkinsEngine::MENU() { + warning("TODO: MENU"); + return 0; +} + +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 df4c2b793f..9dcd17c4f9 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -80,6 +80,19 @@ private: * Run the introduction sequence */ void INTRORUN(); + + void PASS(); + void REST_SYSTEM(); + void PLAN_BETA(); + void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v); + void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v); + void PUBQUIT(); + void COMPUT_HOPKINS(int a1); + int MENU(); + void ENDEMO(); + void BOOM(); protected: // Engine APIs virtual Common::Error run(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index f38deb408b..219797b190 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -55,4 +55,8 @@ void SoundManager::VOICE_MIX(int a1, int a2) { warning("TODO: VOICE_MIX"); } +void SoundManager::DEL_SAMPLE(int soundNumber) { + warning("TODO: DEL_SAMPLE"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 0e8897f8af..696ac79fa5 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -44,6 +44,7 @@ public: void PLAY_ANM_SOUND(int soundNumber); void WSOUND(int soundNumber); void VOICE_MIX(int a1, int a2); + void DEL_SAMPLE(int soundNumber); }; } // End of namespace Hopkins -- cgit v1.2.3 From df410953c98ff5ca4a3ef9626d0ae680186378ac Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Sep 2012 18:03:25 +1000 Subject: HOPKINS: Initial implementation of main menu method --- engines/hopkins/globals.cpp | 5 + engines/hopkins/globals.h | 1 + engines/hopkins/graphics.cpp | 134 ------------------------ engines/hopkins/graphics.h | 15 --- engines/hopkins/hopkins.cpp | 11 +- engines/hopkins/hopkins.h | 19 ++-- engines/hopkins/menu.cpp | 235 +++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/menu.h | 49 +++++++++ engines/hopkins/module.mk | 2 + engines/hopkins/objects.cpp | 166 ++++++++++++++++++++++++++++++ engines/hopkins/objects.h | 49 +++++++++ 11 files changed, 521 insertions(+), 165 deletions(-) create mode 100644 engines/hopkins/menu.cpp create mode 100644 engines/hopkins/menu.h create mode 100644 engines/hopkins/objects.cpp create mode 100644 engines/hopkins/objects.h diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index cc96588f9a..aecad64dde 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -704,4 +704,9 @@ byte *Globals::dos_free2(byte *p) { return PTRNUL; } +byte *Globals::LIBERE_FICHIER(byte *p) { + dos_free2(p); + return PTRNUL; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e73df7e159..47ea2b09ef 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -248,6 +248,7 @@ public: void CHARGE_OBJET(); byte *dos_malloc2(int count); byte *dos_free2(byte *p); + byte *LIBERE_FICHIER(byte *p); }; #define PTRNUL (byte *)NULL diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f183adee41..72fbd0319b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -969,138 +969,4 @@ void GraphicsManager::RESET_SEGMENT_VESA() { warning("TODO: RESET_SEGMENT_VESA"); } -/*------------------------------------------------------------------------*/ - -byte *ObjectManager::CHANGE_OBJET(int objIndex) { - byte *result = ObjectManager::CAPTURE_OBJET(objIndex, 1); - GLOBALS.Bufferobjet = result; - GLOBALS.Nouv_objet = 1; - GLOBALS.OBJET_EN_COURS = objIndex; - return result; -} - -byte *ObjectManager::CAPTURE_OBJET(int objIndex, int mode) { - byte *result = NULL; - byte *dataP; - - dataP = 0; - int val1 = GLOBALS.ObjetW[objIndex].field0; - int val2 = GLOBALS.ObjetW[objIndex].field1; - - if (mode == 1) - ++val2; - if (val1 != GLOBALS.NUM_FICHIER_OBJ) { - if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) - ObjectManager::DEL_FICHIER_OBJ(); - if (val1 == 1) { - FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); - GLOBALS.ADR_FICHIER_OBJ = ObjectManager::CHARGE_SPRITE(GLOBALS.NFICHIER); - } - GLOBALS.NUM_FICHIER_OBJ = val1; - } - - int width = ObjectManager::Get_Largeur(GLOBALS.ADR_FICHIER_OBJ, val2); - int height = ObjectManager::Get_Hauteur(GLOBALS.ADR_FICHIER_OBJ, val2); - GLOBALS.OBJL = width; - GLOBALS.OBJH = height; - - switch (mode) { - case 0: - dataP = GLOBALS.dos_malloc2(height * width); - if (dataP == PTRNUL) - error("CAPTURE_OBJET"); - - ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, dataP, val2); - break; - - case 1: - ObjectManager::sprite_alone(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.Bufferobjet, val2); - result = GLOBALS.Bufferobjet; - break; - - case 3: - ObjectManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.INVENTAIRE_OBJET, val2); - result = GLOBALS.INVENTAIRE_OBJET; - break; - - default: - result = dataP; - break; - } - - return result; -} - -int ObjectManager::Get_Largeur(const byte *objectData, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) - objP += READ_LE_UINT32(objP) + 16; - - return READ_LE_UINT16(objP + 4); -} - -int ObjectManager::Get_Hauteur(const byte *objectData, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) - objP += READ_LE_UINT32(objP) + 16; - - return READ_LE_UINT16(objP + 6); -} - -int ObjectManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) { - objP += READ_LE_UINT32(objP) + 16; - } - - objP += 4; - int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); - - memcpy(sprite + 3, objP - 4, result + 16); - return result; -} - -byte *ObjectManager::DEL_FICHIER_OBJ() { - GLOBALS.NUM_FICHIER_OBJ = 0; - if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) - GLOBALS.ADR_FICHIER_OBJ = FileManager::LIBERE_FICHIER(GLOBALS.ADR_FICHIER_OBJ); - - byte *result = PTRNUL; - GLOBALS.ADR_FICHIER_OBJ = PTRNUL; - return result; -} - -byte *ObjectManager::CHARGE_SPRITE(const Common::String &file) { - FileManager::DMESS1(); - return FileManager::CHARGE_FICHIER(file); -} - -int ObjectManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) { - objP += READ_LE_UINT32(objP) + 16; - } - - objP += 4; - int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); - - memcpy(sprite, objP + 12, result); - return result; -} - -int ObjectManager::AJOUTE_OBJET(int objIndex) { - bool flag = false; - int arrIndex = 0; - do { - ++arrIndex; - if (!GLOBALS.INVENTAIRE[arrIndex]) - flag = true; - if (arrIndex == 32) - flag = true; - } while (!flag); - - GLOBALS.INVENTAIRE[arrIndex] = objIndex; - return arrIndex; -} - } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 93b6ebcebd..be1bc751cd 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -122,21 +122,6 @@ public: void RESET_SEGMENT_VESA(); }; -class ObjectManager { -public: - static byte *CHANGE_OBJET(int objIndex); - static byte *CAPTURE_OBJET(int objIndex, int mode); - - static int Get_Largeur(const byte *objectData, int objIndex); - static int Get_Hauteur(const byte *objectData, int objIndex); - static int sprite_alone(const byte *objectData, byte *sprite, int objIndex); - static byte *DEL_FICHIER_OBJ(); - - static byte *CHARGE_SPRITE(const Common::String &file); - static int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); - static int AJOUTE_OBJET(int objIndex); -}; - } // End of namespace Hopkins #endif /* HOPKINS_GRAPHICS_H */ diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ebfe694d28..460ae1355e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -58,8 +58,8 @@ Common::Error HopkinsEngine::run() { _soundManager.WSOUND_INIT(); GLOBALS.CHARGE_OBJET(); - ObjectManager::CHANGE_OBJET(14); - ObjectManager::AJOUTE_OBJET(14); + _objectsManager.CHANGE_OBJET(14); + _objectsManager.AJOUTE_OBJET(14); GLOBALS.HELICO = 0; _eventsManager.MOUSE_OFF(); @@ -102,7 +102,7 @@ LABEL_13: GLOBALS.SORTIE = 0; if (!GLOBALS.SORTIE) { - GLOBALS.SORTIE = MENU(); + GLOBALS.SORTIE = _menuManager.MENU(); if (GLOBALS.SORTIE == -1) { PUBQUIT(); _globals.PERSO = _globals.dos_free2(_globals.PERSO); @@ -887,11 +887,6 @@ void HopkinsEngine::COMPUT_HOPKINS(int a1) { warning("TODO: COMPUT_HOPKINS"); } -int HopkinsEngine::MENU() { - warning("TODO: MENU"); - return 0; -} - void HopkinsEngine::ENDEMO() { warning("TODO: ENDEMO"); } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 9dcd17c4f9..da62e43b0d 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -35,6 +35,8 @@ #include "hopkins/events.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" +#include "hopkins/menu.h" +#include "hopkins/objects.h" #include "hopkins/sound.h" /** @@ -76,11 +78,6 @@ private: void INIT_SYSTEM(); - /** - * Run the introduction sequence - */ - void INTRORUN(); - void PASS(); void REST_SYSTEM(); void PLAN_BETA(); @@ -90,7 +87,6 @@ private: const Common::String &s4, int v); void PUBQUIT(); void COMPUT_HOPKINS(int a1); - int MENU(); void ENDEMO(); void BOOM(); protected: @@ -99,10 +95,12 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: - Globals _globals; + AnimationManager _animationManager; EventsManager _eventsManager; + Globals _globals; GraphicsManager _graphicsManager; - AnimationManager _animationManager; + MenuManager _menuManager; + ObjectsManager _objectsManager; SoundManager _soundManager; public: HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc); @@ -115,6 +113,11 @@ public: bool getIsDemo() const; int getRandomNumber(int maxNumber); + + /** + * Run the introduction sequence + */ + void INTRORUN(); }; // Global reference to the HopkinsEngine object diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp new file mode 100644 index 0000000000..5aa54b9fa6 --- /dev/null +++ b/engines/hopkins/menu.cpp @@ -0,0 +1,235 @@ +/* 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 _globals.FRee software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the _globals.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 _globals.FRee Software + * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/scummsys.h" +#include "hopkins/menu.h" +#include "hopkins/files.h" +#include "hopkins/hopkins.h" +#include "hopkins/globals.h" +#include "hopkins/events.h" +#include "hopkins/graphics.h" +#include "hopkins/sound.h" + +namespace Hopkins { + +void MenuManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +int MenuManager::MENU() { + signed int v0; + byte *v1; + signed int v2; + int v3; + int v4; + signed int v6; + signed __int16 v7; + signed __int16 v8; + signed __int16 v9; + signed __int16 v10; + __int16 v11; + signed int v12; + + v6 = 0; + for (;;) { + _vm->_globals.FORET = 0; + _vm->_eventsManager.CASSE = 0; + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.FLAG_VISIBLE = 0; + _vm->_globals.SORTIE = 0; + + for (int idx = 0; idx < 31; ++idx) + _vm->_globals.INVENTAIRE[idx] = 0; + + memset(_vm->_globals.SAUVEGARDE, 0, 2000); + _vm->_objectsManager.AJOUTE_OBJET(14); + v7 = 0; + v8 = 0; + v9 = 0; + v10 = 0; + v11 = 0; + + + if (_vm->_globals.FR == 0) + _vm->_graphicsManager.LOAD_IMAGE("MENUAN"); + else if (_vm->_globals.FR == 1) + _vm->_graphicsManager.LOAD_IMAGE("MENUFR"); + else if (_vm->_globals.FR == 2) + _vm->_graphicsManager.LOAD_IMAGE("MENUES"); + + _vm->_graphicsManager.FADE_INW(); + if (_vm->_globals.FR == 0) + FileManager::CONSTRUIT_SYSTEM("MENUAN.SPR"); + if (_vm->_globals.FR == 1) + FileManager::CONSTRUIT_SYSTEM("MENUFR.SPR"); + if (_vm->_globals.FR == 2) + FileManager::CONSTRUIT_SYSTEM("MENUES.SPR"); + + v1 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_globals.btsouris = 0; + _vm->_eventsManager.souris_n = 0; + + for (;;) { + for (;;) { + _vm->_soundManager.WSOUND(28); + v12 = 0; + + do { + v2 = 0; + v3 = _vm->_eventsManager.XMOUSE(); + v4 = _vm->_eventsManager.YMOUSE(); + + if ((unsigned int)(v3 - 232) <= 0xB0) { + if ((unsigned int)(v4 - 261) <= 23) + v2 = 1; + if ((unsigned int)(v4 - 293) <= 23) + v2 = 2; + if ((unsigned int)(v4 - 325) <= 22) + v2 = 3; + if ((unsigned int)(v4 - 356) <= 23) + v2 = 4; + + if ((unsigned int)(v4 - 388) <= 23) + v2 = 5; + } + + switch (v2) { + case 0: + v11 = 0; + v10 = 0; + v9 = 0; + v8 = 0; + v7 = 0; + break; + case 1: + v11 = 1; + v10 = 0; + v9 = 0; + v8 = 0; + v7 = 0; + break; + case 2: + v11 = 0; + v10 = 1; + v9 = 0; + v8 = 0; + v7 = 0; + break; + case 3: + v11 = 0; + v10 = 0; + v9 = 1; + v8 = 0; + v7 = 0; + break; + case 4: + v11 = 0; + v10 = 0; + v9 = 0; + v8 = 1; + v7 = 0; + break; + case 5: + v11 = 0; + v10 = 0; + v9 = 0; + v8 = 0; + v7 = 1; + default: + break; + } + + AFFICHE_SPEED(v1, 230, 259, v11); + AFFICHE_SPEED(v1, 230, 291, v10 + 2); + AFFICHE_SPEED(v1, 230, 322, v9 + 4); + AFFICHE_SPEED(v1, 230, 354, v8 + 6); + AFFICHE_SPEED(v1, 230, 386, v7 + 8); + _vm->_eventsManager.VBL(); + + if (_vm->_eventsManager.BMOUSE() == 1 && v2 > 0) + v12 = 1; + } while (v12 != 1); + + if (v2 == 1) { + AFFICHE_SPEED(v1, 230, 259, 10); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.delay(200); + v6 = 1; + } + if (v2 != 2) + break; + + AFFICHE_SPEED(v1, 230, 291, 11); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.delay(200); + + _vm->_globals.SORTIE = -1; + CHARGE_PARTIE(); + + if (_vm->_globals.SORTIE != -1) { + v6 = _vm->_globals.SORTIE; + break; + } + _vm->_globals.SORTIE = 0; + } + + if (v2 != 3) + break; + + AFFICHE_SPEED(v1, 230, 322, 12); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.delay(200); + + CHOICE_OPTION(); + } + if (v2 == 4) { + AFFICHE_SPEED(v1, 230, 354, 13); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.delay(200); + _vm->INTRORUN(); + continue; + } + break; + } + + _vm->_globals.LIBERE_FICHIER(v1); + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.FLAG_VISIBLE = 0; + _vm->_graphicsManager.FADE_OUTW(); + return v6; +} + +void MenuManager::AFFICHE_SPEED(byte *a1, int a2, int a3, int a4) { + warning("AFFICHE_SPEED"); +} + +void MenuManager::CHOICE_OPTION() { + warning("CHOICE_OPTION"); +} + +void MenuManager::CHARGE_PARTIE() { + warning("CHARGE_PARTIE"); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h new file mode 100644 index 0000000000..a120157ebe --- /dev/null +++ b/engines/hopkins/menu.h @@ -0,0 +1,49 @@ +/* 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_MENU_H +#define HOPKINS_MENU_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "common/error.h" + +namespace Hopkins { + +class HopkinsEngine; + +class MenuManager { +private: + HopkinsEngine *_vm; + + void CHOICE_OPTION(); +public: + void setParent(HopkinsEngine *vm); + + int MENU(); + void AFFICHE_SPEED(byte *a1, int a2, int a3, int a4); + void CHARGE_PARTIE(); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_MENU_H */ diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index b0b00f9aba..6768c6add2 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -8,6 +8,8 @@ MODULE_OBJS := \ graphics.o \ globals.o \ hopkins.o \ + menu.o \ + objects.o \ sound.o # This module can be built as a plugin diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp new file mode 100644 index 0000000000..441dc874b3 --- /dev/null +++ b/engines/hopkins/objects.cpp @@ -0,0 +1,166 @@ +/* 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/files.h" +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" + +namespace Hopkins { + +byte *ObjectsManager::CHANGE_OBJET(int objIndex) { + byte *result = ObjectsManager::CAPTURE_OBJET(objIndex, 1); + GLOBALS.Bufferobjet = result; + GLOBALS.Nouv_objet = 1; + GLOBALS.OBJET_EN_COURS = objIndex; + return result; +} + +byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { + byte *result = NULL; + byte *dataP; + + dataP = 0; + int val1 = GLOBALS.ObjetW[objIndex].field0; + int val2 = GLOBALS.ObjetW[objIndex].field1; + + if (mode == 1) + ++val2; + if (val1 != GLOBALS.NUM_FICHIER_OBJ) { + if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) + ObjectsManager::DEL_FICHIER_OBJ(); + if (val1 == 1) { + FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); + GLOBALS.ADR_FICHIER_OBJ = ObjectsManager::CHARGE_SPRITE(GLOBALS.NFICHIER); + } + GLOBALS.NUM_FICHIER_OBJ = val1; + } + + int width = ObjectsManager::Get_Largeur(GLOBALS.ADR_FICHIER_OBJ, val2); + int height = ObjectsManager::Get_Hauteur(GLOBALS.ADR_FICHIER_OBJ, val2); + GLOBALS.OBJL = width; + GLOBALS.OBJH = height; + + switch (mode) { + case 0: + dataP = GLOBALS.dos_malloc2(height * width); + if (dataP == PTRNUL) + error("CAPTURE_OBJET"); + + ObjectsManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, dataP, val2); + break; + + case 1: + ObjectsManager::sprite_alone(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.Bufferobjet, val2); + result = GLOBALS.Bufferobjet; + break; + + case 3: + ObjectsManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.INVENTAIRE_OBJET, val2); + result = GLOBALS.INVENTAIRE_OBJET; + break; + + default: + result = dataP; + break; + } + + return result; +} + +int ObjectsManager::Get_Largeur(const byte *objectData, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) + objP += READ_LE_UINT32(objP) + 16; + + return READ_LE_UINT16(objP + 4); +} + +int ObjectsManager::Get_Hauteur(const byte *objectData, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) + objP += READ_LE_UINT32(objP) + 16; + + return READ_LE_UINT16(objP + 6); +} + +int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) { + objP += READ_LE_UINT32(objP) + 16; + } + + objP += 4; + int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); + + memcpy(sprite + 3, objP - 4, result + 16); + return result; +} + +byte *ObjectsManager::DEL_FICHIER_OBJ() { + GLOBALS.NUM_FICHIER_OBJ = 0; + if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) + GLOBALS.ADR_FICHIER_OBJ = FileManager::LIBERE_FICHIER(GLOBALS.ADR_FICHIER_OBJ); + + byte *result = PTRNUL; + GLOBALS.ADR_FICHIER_OBJ = PTRNUL; + return result; +} + +byte *ObjectsManager::CHARGE_SPRITE(const Common::String &file) { + FileManager::DMESS1(); + return FileManager::CHARGE_FICHIER(file); +} + +int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) { + objP += READ_LE_UINT32(objP) + 16; + } + + objP += 4; + int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); + + memcpy(sprite, objP + 12, result); + return result; +} + +int ObjectsManager::AJOUTE_OBJET(int objIndex) { + bool flag = false; + int arrIndex = 0; + do { + ++arrIndex; + if (!GLOBALS.INVENTAIRE[arrIndex]) + flag = true; + if (arrIndex == 32) + flag = true; + } while (!flag); + + GLOBALS.INVENTAIRE[arrIndex] = objIndex; + return arrIndex; +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h new file mode 100644 index 0000000000..8f97a5a7bc --- /dev/null +++ b/engines/hopkins/objects.h @@ -0,0 +1,49 @@ +/* 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_OBJECTS_H +#define HOPKINS_OBJECTS_H + +#include "common/scummsys.h" +#include "common/endian.h" +#include "common/str.h" + +namespace Hopkins { + +class ObjectsManager { +public: + byte *CHANGE_OBJET(int objIndex); + byte *CAPTURE_OBJET(int objIndex, int mode); + + int Get_Largeur(const byte *objectData, int objIndex); + int Get_Hauteur(const byte *objectData, int objIndex); + int sprite_alone(const byte *objectData, byte *sprite, int objIndex); + byte *DEL_FICHIER_OBJ(); + + byte *CHARGE_SPRITE(const Common::String &file); + int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); + int AJOUTE_OBJET(int objIndex); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_OBJECTS_H */ -- cgit v1.2.3 From 044f9b83ec5964dc352174de43a6889d350a5e2e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Sep 2012 18:53:29 +1000 Subject: HOPKINS: Bugfixes to the display of the starting menu --- engines/hopkins/hopkins.cpp | 10 ++++++++-- engines/hopkins/menu.cpp | 16 +++++++++++++--- engines/hopkins/objects.cpp | 4 ++++ engines/hopkins/objects.h | 6 ++++++ 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 460ae1355e..65b31903ac 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -38,6 +38,8 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() { g_vm = this; _animationManager.setParent(this); + _menuManager.setParent(this); + _objectsManager.setParent(this); _soundManager.setParent(this); } @@ -104,7 +106,8 @@ LABEL_13: if (!GLOBALS.SORTIE) { GLOBALS.SORTIE = _menuManager.MENU(); if (GLOBALS.SORTIE == -1) { - PUBQUIT(); + if (!g_system->getEventManager()->shouldQuit()) + PUBQUIT(); _globals.PERSO = _globals.dos_free2(_globals.PERSO); REST_SYSTEM(); } @@ -118,6 +121,9 @@ LABEL_13: for (;;) { for (;;) { for (;;) { + if (g_system->getEventManager()->shouldQuit()) + return Common::kNoError; + if (GLOBALS.SORTIE == 300) goto LABEL_13; if (GLOBALS.SORTIE == 18) @@ -868,7 +874,7 @@ void HopkinsEngine::PUBQUIT() { if (_eventsManager.BMOUSE() == 1) mouseClicked = true; - } while (!mouseClicked && g_system->getEventManager()->shouldQuit()); + } while (!mouseClicked && !g_system->getEventManager()->shouldQuit()); if ((unsigned int)(xp - 167) <= 302 && (unsigned int)(yp - 47) <= 387) { warning("Try to Connect..."); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 5aa54b9fa6..17ee630aa9 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -21,6 +21,7 @@ */ #include "common/scummsys.h" +#include "common/events.h" #include "hopkins/menu.h" #include "hopkins/files.h" #include "hopkins/hopkins.h" @@ -36,8 +37,7 @@ void MenuManager::setParent(HopkinsEngine *vm) { } int MenuManager::MENU() { - signed int v0; - byte *v1; + byte *v1 = NULL; signed int v2; int v3; int v4; @@ -50,7 +50,7 @@ int MenuManager::MENU() { signed int v12; v6 = 0; - for (;;) { + while (!g_system->getEventManager()->shouldQuit()) { _vm->_globals.FORET = 0; _vm->_eventsManager.CASSE = 0; _vm->_globals.DESACTIVE_INVENT = 1; @@ -96,6 +96,9 @@ int MenuManager::MENU() { v12 = 0; do { + if (g_system->getEventManager()->shouldQuit()) + return -1; + v2 = 0; v3 = _vm->_eventsManager.XMOUSE(); v4 = _vm->_eventsManager.YMOUSE(); @@ -210,6 +213,13 @@ int MenuManager::MENU() { _vm->INTRORUN(); continue; } + + if ( v2 == 5 ) { + AFFICHE_SPEED(v1, 230, 386, 14); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.delay(200); + v6 = -1; + } break; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 441dc874b3..c464a0241f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -31,6 +31,10 @@ namespace Hopkins { +void ObjectsManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + byte *ObjectsManager::CHANGE_OBJET(int objIndex) { byte *result = ObjectsManager::CAPTURE_OBJET(objIndex, 1); GLOBALS.Bufferobjet = result; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 8f97a5a7bc..7ebb93da9e 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -29,8 +29,14 @@ namespace Hopkins { +class HopkinsEngine; + class ObjectsManager { +private: + HopkinsEngine *_vm; public: + void setParent(HopkinsEngine *vm); + byte *CHANGE_OBJET(int objIndex); byte *CAPTURE_OBJET(int objIndex, int mode); -- cgit v1.2.3 From 9900adf18cd88196c949ccbc3033bea5ef58d975 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Sep 2012 21:34:23 +1000 Subject: HOPKINS: Initial implementation of some code that will be needed for cursor display --- engines/hopkins/anim.cpp | 42 +------ engines/hopkins/anim.h | 3 - engines/hopkins/events.cpp | 278 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/events.h | 11 +- engines/hopkins/files.cpp | 5 + engines/hopkins/files.h | 1 + engines/hopkins/font.cpp | 37 ++++++ engines/hopkins/font.h | 46 +++++++ engines/hopkins/globals.cpp | 7 +- engines/hopkins/globals.h | 12 +- engines/hopkins/graphics.cpp | 59 ++++++++- engines/hopkins/graphics.h | 18 +++ engines/hopkins/hopkins.cpp | 9 +- engines/hopkins/hopkins.h | 2 + engines/hopkins/menu.cpp | 2 +- engines/hopkins/module.mk | 1 + engines/hopkins/objects.cpp | 40 +++++-- engines/hopkins/objects.h | 6 +- 18 files changed, 502 insertions(+), 77 deletions(-) create mode 100644 engines/hopkins/font.cpp create mode 100644 engines/hopkins/font.h diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 3977729b75..665f5590e1 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -416,8 +416,8 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam v8 = 0; do { ptr = v4; - width = Get_Largeur(v4, v8); - height = Get_Hauteur(ptr, v8); + width = _vm->_objectsManager.Get_Largeur(v4, v8); + height = _vm->_objectsManager.Get_Hauteur(ptr, v8); v4 = ptr; if (!width && !height) v7 = 1; @@ -449,9 +449,9 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam v20 = READ_LE_UINT16(v13 + 6); v13 += 8; - set_offsetxy(GLOBALS.Bank[idx].data, v14, v16, v17, 0); + _vm->_objectsManager.set_offsetxy(GLOBALS.Bank[idx].data, v14, v16, v17, 0); if (GLOBALS.Bank[idx].fileHeader == 2) - set_offsetxy(GLOBALS.Bank[idx].data, v14, v21, v20, 1); + _vm->_objectsManager.set_offsetxy(GLOBALS.Bank[idx].data, v14, v21, v20, 1); } } @@ -473,24 +473,6 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } -void AnimationManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { - byte *startP = data + 3; - for (int i = idx; i; --i) - startP += READ_LE_UINT32(startP) + 16; - - byte *rectP = startP + 8; - if (isSize == 1) { - // Set size - byte *pointP = rectP + 4; - WRITE_LE_UINT16(pointP, xp); - WRITE_LE_UINT16(pointP + 2, yp); - } else { - // Set position - WRITE_LE_UINT16(rectP, xp); - WRITE_LE_UINT16(rectP + 2, yp); - } -} - void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { int v4; const byte *v5; @@ -598,20 +580,4 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { } while (v21 <= nbytes && !doneFlag); } -int AnimationManager::Get_Largeur(const byte *data, int idx) { - const byte *rectP = data + 3; - for (int i = idx; i; --i) - rectP += READ_LE_UINT32(rectP) + 16; - - return (int16)READ_LE_UINT16(rectP + 4); -} - -int AnimationManager::Get_Hauteur(const byte *data, int idx) { - const byte *rectP = data + 3; - for (int i = idx; i; --i) - rectP += READ_LE_UINT32(rectP) + 16; - - return (int16)READ_LE_UINT16(rectP + 6); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index a85fc3cbad..3046142623 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -49,10 +49,7 @@ public: void BOBANIM_OFF(int idx); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); - void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); - int Get_Largeur(const byte *data, int idx); - int Get_Hauteur(const byte *data, int idx); }; } // End of namespace Hopkins diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 5470f3167b..af1b5385d2 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -24,12 +24,22 @@ #include "common/events.h" #include "common/textconsole.h" #include "hopkins/events.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" +#include "hopkins/sound.h" namespace Hopkins { EventsManager::EventsManager() { souris_flag = false; mouse_linux = false; + min_x = 0; + min_y = 20; + max_x = 1280; + max_y = 460; + min_x = min_y = 0; + max_x = max_y = 0; souris_sizex = souris_sizey = 0; ofset_souris_x = ofset_souris_y = 0; start_x = start_y = 0; @@ -41,6 +51,11 @@ EventsManager::EventsManager() { lItCounter = 0; ESC_KEY = false; _priorFrameTime = 0; + btsouris = 0; +} + +void EventsManager::setParent(HopkinsEngine *vm) { + _vm = vm; } void EventsManager::INSTALL_SOURIS() { @@ -95,15 +110,28 @@ bool EventsManager::BMOUSE() { } void EventsManager::MOUSE_OFF() { - warning("TODO: MOUSE_OFF"); + souris_flag = false; } void EventsManager::MOUSE_ON() { - warning("TODO: MOUSE_ON"); + souris_on(); + souris_flag = true; } void EventsManager::CHANGE_MOUSE(int id) { - warning("TODO: CHANGE_MOUSE"); + int cursorId = id; + + if (btsouris != 23) { + if (id == 4 && btsouris == 4 && _vm->_globals.NOMARCHE) + cursorId = 0; + if (cursorId == 25) + cursorId = 5; + + if (OLD_ICONE != cursorId || !cursorId) { + OLD_ICONE = cursorId; + souris_n = cursorId; + } + } } void EventsManager::CONTROLE_MES() { @@ -156,7 +184,247 @@ void EventsManager::pollEvents() { } void EventsManager::VBL() { - warning("TODO: VBL"); -} + int a1 = 0; + signed __int16 v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v10; + signed int v11 = 0; + signed int v12 = 0; + int v13 = 0; + unsigned int v14 = 0; + int v15 = 0; + + if (_vm->_graphicsManager.REDRAW) { + _vm->_graphicsManager.DD_Lock(); + if (CASSE) { + _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.REDRAW = 0; + } else { + if (_vm->_globals.iRegul == 3) + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); + else + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); + FileManager::DMESS(); + --_vm->_graphicsManager.REDRAW; + } + _vm->_graphicsManager.DD_Unlock(); + } + + if (souris_flag) { + v1 = 20; + if (!mouse_linux) + v1 = 10; + v2 = 20; + if (!mouse_linux) + v2 = 15; + + v15 = souris_x - v1; + a1 = souris_y; + v14 = souris_sizex; + v13 = souris_sizey; + if (btsouris == 23) { + v14 = _vm->_globals.OBJL; + v13 = _vm->_globals.OBJH; + goto LABEL_35; + } + + if (CASSE) { + if (v15 < min_x) + v15 = min_x; + if (souris_y < min_y) + a1 = min_y; + + if (souris_sizex + v15 >= max_x) + v14 = souris_sizex - (souris_sizex + v15 - max_x); + if (a1 + souris_sizey < max_y) + goto LABEL_34; + + v3 = a1 + souris_sizey - max_y; + } else { + if (v15 < min_x) + v15 = min_x - v1; + v2 = (signed __int16)v2; + if (souris_y < min_y - (signed __int16)v2) + a1 = min_y - (signed __int16)v2; + if (souris_sizex + v15 >= max_x) + v14 = souris_sizex - (souris_sizex + v15 - max_x - v1); + if (a1 + souris_sizey < v2 + max_y) + goto LABEL_34; + + v3 = v2 + a1 + souris_sizey - max_y; + } + + v13 = souris_sizey - v3; +LABEL_34: + v12 = v14 + v15; + v11 = a1 + v13; + } +LABEL_35: + + if (!_vm->_globals.PUBEXIT) + _vm->_graphicsManager.AFF_SPRITES(); + if (souris_flag != 1) + goto LABEL_54; + if (btsouris == 23) + goto LABEL_45; + + if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { + if (btsouris != 23) + goto LABEL_54; + +LABEL_45: + if (a1 < max_y && v15 < max_x) { + if ((signed int)(v14 + v15) > max_x) + v14 -= v14 + v15 - max_x; + if (a1 + v13 > max_y) + v13 -= a1 + v13 - max_y; + + if ((signed int)v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + goto LABEL_54; + } + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, a1 + 300, souris_n); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); + +LABEL_54: + _vm->_globals.vitesse = 2; + + do { + for (;;) { + while (CASSE || _vm->_globals.iRegul != 1) { + if (CASSE != 1) + goto LABEL_63; + + if (lItCounter > 1) + goto LABEL_65; + } + + if (_vm->_globals.vitesse != 2) + break; + + if (lItCounter > 9) + goto LABEL_65; + } +LABEL_63: + ; + } while (_vm->_globals.iRegul == 3 && lItCounter <= 15); + +LABEL_65: + _vm->_globals.vitesse = 2; + lItCounter = 0; + + if (_vm->_graphicsManager.DOUBLE_ECRAN != 1 || _vm->_graphicsManager.no_scroll == 1) { + _vm->_graphicsManager.Affiche_Segment_Vesa(); + } else { + if (_vm->_graphicsManager.no_scroll != 2) { + if ((signed __int16)XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; + + if ((signed __int16)XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; + } + + if (_vm->_graphicsManager.SCROLL < 0) + _vm->_graphicsManager.SCROLL = 0; + + if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) + _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; + + if (_vm->_graphicsManager.SDL_ECHELLE) + v4 = _vm->_graphicsManager.Magic_Number(_vm->_graphicsManager.SCROLL); + else + v4 = _vm->_graphicsManager.SCROLL; + + if (_vm->_graphicsManager.OLD_SCROLL == v4) { + _vm->_graphicsManager.Affiche_Segment_Vesa(); + } else { + _vm->_fontManager.TEXTE_OFF(9); + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.SDL_ECHELLE) { + if (_vm->_graphicsManager.Winbpp == 2) { + v5 = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v5); + } else { + v6 = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v6); + } + + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.Reel_Zoom(0, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.Reel_Zoom(SCREEN_WIDTH, _vm->_graphicsManager.SDL_ECHELLE)); + _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.Reel_Zoom(440, _vm->_graphicsManager.SDL_ECHELLE)); + } else { + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); + } + + if (!_vm->_globals.BPP_NOAFF) { + // TODO: Useful for future dirty rect processing? +// SDL_UpdateRects(LinuxScr, 1, dstrect); + } + if (_vm->_globals.NBBLOC) { + v7 = 1; + v10 = _vm->_globals.NBBLOC + 1; + + do { + if (_vm->_globals.BLOC[v7].field0 == 1) + _vm->_globals.BLOC[v7].field0 = 0; + ++v7; + } while (v10 != v7); + } + + _vm->_globals.NBBLOC = 0; + start_x = v4; + _vm->_graphicsManager.ofscroll = v4; + _vm->_graphicsManager.SCROLL = v4; + } + + _vm->_graphicsManager.OLD_SCROLL = v4; + start_x = v4; + _vm->_graphicsManager.ofscroll = v4; + } + + souris_bb = souris_b; + souris_b = 0; + if (souris_flag == 1) { + if (btsouris != 23) { + if (a1 < max_y && v15 < max_x && (signed int)v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); + goto LABEL_113; + } + + if (btsouris != 23) + goto LABEL_113; + } + + if (a1 < max_y && v15 < max_x && (signed int)v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + +LABEL_113: + + _vm->_soundManager.VERIF_SOUND(); + return CONTROLE_MES(); +} } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 792e2774c4..51decf7912 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -31,27 +31,36 @@ namespace Hopkins { #define GAME_FRAME_RATE 50 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) +class HopkinsEngine; + class EventsManager { private: + HopkinsEngine *_vm; + void pollEvents(); void checkForNextFrameCounter(); public: bool souris_flag; bool mouse_linux; + int min_x, min_y; + int max_x, max_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 OLD_ICONE; int souris_n; int souris_bb; int souris_b; - void *pointeur_souris; + byte *pointeur_souris; uint32 lItCounter; uint32 _priorFrameTime; bool ESC_KEY; + int btsouris; public: EventsManager(); + void setParent(HopkinsEngine *vm); void INSTALL_SOURIS(); void souris_on(); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 90b5cf0ae8..68c32bfde0 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -117,7 +117,12 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { return data; } +void FileManager::DMESS() { + // No implementation in original +} + void FileManager::DMESS1() { + // No implementation in original } int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) { diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index e5e4be3566..fbc8a04cab 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -37,6 +37,7 @@ public: static bool bsave(const Common::String &file, const void *buf, size_t n); static void Chage_Inifile(Common::StringMap &iniParams); static byte *CHARGE_FICHIER(const Common::String &file); + static void DMESS(); static void DMESS1(); static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); static void F_Censure(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp new file mode 100644 index 0000000000..fe4e9df46c --- /dev/null +++ b/engines/hopkins/font.cpp @@ -0,0 +1,37 @@ +/* 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/font.h" + +namespace Hopkins { + +void FontManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void FontManager::TEXTE_OFF(int idx) { + warning("TODO: TEXTE_OFF"); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h new file mode 100644 index 0000000000..4ecab0c176 --- /dev/null +++ b/engines/hopkins/font.h @@ -0,0 +1,46 @@ +/* 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_FONT_H +#define HOPKINS_FONT_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +class FontManager { +public: + HopkinsEngine *_vm; + + +public: + void setParent(HopkinsEngine *vm); + + void TEXTE_OFF(int idx); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_FONT_H */ diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index aecad64dde..55c943baa2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -39,8 +39,6 @@ Globals::Globals() { VOICEVOL = 6; XSETMODE = 0; XZOOM = 0; - min_x = min_y = 0; - max_x = max_y = 0; lItCounter = 0; lOldItCounter = 0; g_old_anim = 0; @@ -72,7 +70,7 @@ Globals::Globals() { Max_Ligne_Long = 0; Max_Perso_Y = 0; Max_Propre = 0; - btsouris = 0; + NBBLOC = 0; // Initialise pointers ICONE = NULL; @@ -100,6 +98,8 @@ Globals::Globals() { police = NULL; PERSO = NULL; + + // Reset flags MUSICOFF = false; SOUNDOFF = false; @@ -118,6 +118,7 @@ Globals::Globals() { DESACTIVE_INVENT = false; FLAG_VISIBLE = false; netscape = false; + NOMARCHE = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 47ea2b09ef..c1209d01fb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -118,6 +118,10 @@ struct ObjetWItem { byte field7; }; +struct BlocItem { + uint16 field0; +}; + /** * Engine Globals */ @@ -156,10 +160,6 @@ public: bool MUSICOFF; bool VOICEOFF; bool CENSURE; - int min_x; - int min_y; - int max_x; - int max_y; int lItCounter; int lOldItCounter; int g_old_anim; @@ -184,6 +184,7 @@ public: BlAnimItem BL_ANIM[30]; VBobItem VBob[35]; ObjetWItem ObjetW[300]; + BlocItem BLOC[250]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -235,7 +236,8 @@ public: bool DESACTIVE_INVENT; bool FLAG_VISIBLE; bool netscape; - int btsouris; + bool NOMARCHE; + int NBBLOC; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 72fbd0319b..a1a5206fe3 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -58,6 +58,7 @@ GraphicsManager::GraphicsManager() { FADE_LINUX = 0; NOLOCK = false; no_scroll = 0; + REDRAW = false; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); @@ -70,6 +71,10 @@ GraphicsManager::~GraphicsManager() { GLOBALS.dos_free2(VESA_BUFFER); } +void GraphicsManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { SDL_ECHELLE = 0; @@ -182,7 +187,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (!DOUBLE_ECRAN) { souris_max(); SCANLINE(SCREEN_WIDTH); - GLOBALS.max_x = SCREEN_WIDTH; + _vm->_eventsManager.max_x = SCREEN_WIDTH; DD_Lock(); Cls_Video(); if (Winbpp == 2) { @@ -200,7 +205,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { DD_Unlock(); } else { SCANLINE(SCREEN_WIDTH * 2); - GLOBALS.max_x = SCREEN_WIDTH * 2; + _vm->_eventsManager.max_x = SCREEN_WIDTH * 2; DD_Lock(); Cls_Video(); DD_Unlock(); @@ -957,6 +962,14 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { } } +void GraphicsManager::Capture_Mem(byte *a1, void *a2, int a3, int a4, unsigned int a5, int a6) { + warning("TODO: Capture_Mem"); +} + +void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) { + warning("TODO: Sprite_Vesa"); +} + void GraphicsManager::FIN_VISU() { warning("TODO: FIN_VISU"); } @@ -969,4 +982,46 @@ void GraphicsManager::RESET_SEGMENT_VESA() { warning("TODO: RESET_SEGMENT_VESA"); } +void GraphicsManager::Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4) { + warning("TODO: Ajoute_Segment_Vesa"); +} + +int GraphicsManager::Magic_Number(signed int v) { + int result = v; + + if (!v) + result = 4; + if (result & 1) + ++result; + if (result & 2) + result += 2; + + return result; +} + +void GraphicsManager::Affiche_Segment_Vesa() { + warning("TODO: Affiche_Segment_Vesa"); +} + +void GraphicsManager::CopyAsm(const byte *surface) { + warning("TODO: CopyAsm"); +} + +void GraphicsManager::Restore_Mem(const byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6) { + warning("TODO: Restore_Mem"); +} + +int GraphicsManager::Reel_Zoom(int a1, int a2) { + warning("TODO: Reel_Zoom"); + return 0; +} + +void GraphicsManager::AFF_SPRITES() { + warning("TODO: AFF_SPRITES"); +} + +void GraphicsManager::Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8) { + warning("TODO: Affice_Perfect"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index be1bc751cd..113147ba7d 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/endian.h" +#include "common/rect.h" #include "common/str.h" #include "graphics/surface.h" @@ -40,8 +41,12 @@ struct RGB8 { byte b; }; +class HopkinsEngine; + class GraphicsManager { private: + HopkinsEngine *_vm; + void CHARGE_ECRAN(const Common::String &file); public: int _lockCtr; @@ -78,9 +83,12 @@ public: int FADE_LINUX; bool NOLOCK; int no_scroll; + Common::Rect dstrect[50]; + int REDRAW; public: GraphicsManager(); ~GraphicsManager(); + void setParent(HopkinsEngine *vm); void SET_MODE(int width, int height); void DD_Lock(); @@ -117,9 +125,19 @@ 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 Capture_Mem(byte *a1, void *a2, int a3, int a4, unsigned int a5, int a6); + void Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5); void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); + void Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4); + int Magic_Number(int v); + void Affiche_Segment_Vesa(); + void CopyAsm(const byte *surface); + void Restore_Mem(const byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); + int Reel_Zoom(int a1, int a2); + void AFF_SPRITES(); + void Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 65b31903ac..0b41bf16aa 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -38,6 +38,8 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() { g_vm = this; _animationManager.setParent(this); + _eventsManager.setParent(this); + _fontManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); _soundManager.setParent(this); @@ -549,11 +551,6 @@ void HopkinsEngine::INIT_SYSTEM() { break; } - GLOBALS.min_x = 0; - GLOBALS.min_y = 20; - GLOBALS.max_x = 1280; - GLOBALS.max_y = 460; - _eventsManager.INSTALL_SOURIS(); _eventsManager.souris_on(); _eventsManager.souris_flag = false; @@ -861,7 +858,7 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_INW(); _eventsManager.MOUSE_ON(); _eventsManager.CHANGE_MOUSE(0); - _globals.btsouris = 0; + _eventsManager.btsouris = 0; _eventsManager.souris_n = 0; _globals.netscape = true; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index da62e43b0d..062fc1e191 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "hopkins/anim.h" #include "hopkins/events.h" +#include "hopkins/font.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" #include "hopkins/menu.h" @@ -97,6 +98,7 @@ protected: public: AnimationManager _animationManager; EventsManager _eventsManager; + FontManager _fontManager; Globals _globals; GraphicsManager _graphicsManager; MenuManager _menuManager; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 17ee630aa9..93d30f96a9 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -87,7 +87,7 @@ int MenuManager::MENU() { v1 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.MOUSE_ON(); _vm->_eventsManager.CHANGE_MOUSE(0); - _vm->_globals.btsouris = 0; + _vm->_eventsManager.btsouris = 0; _vm->_eventsManager.souris_n = 0; for (;;) { diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 6768c6add2..b924037680 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS := \ detection.o \ events.o \ files.o \ + font.o \ graphics.o \ globals.o \ hopkins.o \ diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c464a0241f..938099f083 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -95,20 +95,38 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { return result; } -int ObjectsManager::Get_Largeur(const byte *objectData, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) - objP += READ_LE_UINT32(objP) + 16; - - return READ_LE_UINT16(objP + 4); +void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { + byte *startP = data + 3; + for (int i = idx; i; --i) + startP += READ_LE_UINT32(startP) + 16; + + byte *rectP = startP + 8; + if (isSize == 1) { + // Set size + byte *pointP = rectP + 4; + WRITE_LE_UINT16(pointP, xp); + WRITE_LE_UINT16(pointP + 2, yp); + } else { + // Set position + WRITE_LE_UINT16(rectP, xp); + WRITE_LE_UINT16(rectP + 2, yp); + } } -int ObjectsManager::Get_Hauteur(const byte *objectData, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) - objP += READ_LE_UINT32(objP) + 16; +int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { + const byte *rectP = objectData + 3; + for (int i = idx; i; --i) + rectP += READ_LE_UINT32(rectP) + 16; + + return (int16)READ_LE_UINT16(rectP + 4); +} - return READ_LE_UINT16(objP + 6); +int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { + const byte *rectP = objectData + 3; + for (int i = idx; i; --i) + rectP += READ_LE_UINT32(rectP) + 16; + + return (int16)READ_LE_UINT16(rectP + 6); } int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7ebb93da9e..845c4077a3 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -40,12 +40,14 @@ public: byte *CHANGE_OBJET(int objIndex); byte *CAPTURE_OBJET(int objIndex, int mode); - int Get_Largeur(const byte *objectData, int objIndex); - int Get_Hauteur(const byte *objectData, int objIndex); + int Get_Largeur(const byte *objectData, int idx); + int Get_Hauteur(const byte *objectData, int idx); int sprite_alone(const byte *objectData, byte *sprite, int objIndex); byte *DEL_FICHIER_OBJ(); byte *CHARGE_SPRITE(const Common::String &file); + void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); int AJOUTE_OBJET(int objIndex); }; -- cgit v1.2.3 From 06f83a0775b79b06dbb38bc11c3622122b9ccc3e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Sep 2012 20:54:03 +1000 Subject: HOPKINS: Implemented more blitting/display methods --- engines/hopkins/events.cpp | 58 +++--- engines/hopkins/events.h | 2 - engines/hopkins/graphics.cpp | 456 ++++++++++++++++++++++++++++++++++++++++--- engines/hopkins/graphics.h | 14 +- 4 files changed, 464 insertions(+), 66 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index af1b5385d2..53f1fe9d73 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -34,12 +34,6 @@ namespace Hopkins { EventsManager::EventsManager() { souris_flag = false; mouse_linux = false; - min_x = 0; - min_y = 20; - max_x = 1280; - max_y = 460; - min_x = min_y = 0; - max_x = max_y = 0; souris_sizex = souris_sizey = 0; ofset_souris_x = ofset_souris_y = 0; start_x = start_y = 0; @@ -234,29 +228,29 @@ void EventsManager::VBL() { } if (CASSE) { - if (v15 < min_x) - v15 = min_x; - if (souris_y < min_y) - a1 = min_y; + if (v15 < _vm->_graphicsManager.min_x) + v15 = _vm->_graphicsManager.min_x; + if (souris_y < _vm->_graphicsManager.min_y) + a1 = _vm->_graphicsManager.min_y; - if (souris_sizex + v15 >= max_x) - v14 = souris_sizex - (souris_sizex + v15 - max_x); - if (a1 + souris_sizey < max_y) + if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) + v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x); + if (a1 + souris_sizey < _vm->_graphicsManager.max_y) goto LABEL_34; - v3 = a1 + souris_sizey - max_y; + v3 = a1 + souris_sizey - _vm->_graphicsManager.max_y; } else { - if (v15 < min_x) - v15 = min_x - v1; + if (v15 < _vm->_graphicsManager.min_x) + v15 = _vm->_graphicsManager.min_x - v1; v2 = (signed __int16)v2; - if (souris_y < min_y - (signed __int16)v2) - a1 = min_y - (signed __int16)v2; - if (souris_sizex + v15 >= max_x) - v14 = souris_sizex - (souris_sizex + v15 - max_x - v1); - if (a1 + souris_sizey < v2 + max_y) + if (souris_y < _vm->_graphicsManager.min_y - (signed __int16)v2) + a1 = _vm->_graphicsManager.min_y - (signed __int16)v2; + if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) + v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x - v1); + if (a1 + souris_sizey < v2 + _vm->_graphicsManager.max_y) goto LABEL_34; - v3 = v2 + a1 + souris_sizey - max_y; + v3 = v2 + a1 + souris_sizey - _vm->_graphicsManager.max_y; } v13 = souris_sizey - v3; @@ -273,16 +267,16 @@ LABEL_35: if (btsouris == 23) goto LABEL_45; - if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { + if (a1 >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || (signed int)v14 <= 1 || v13 <= 1) { if (btsouris != 23) goto LABEL_54; LABEL_45: - if (a1 < max_y && v15 < max_x) { - if ((signed int)(v14 + v15) > max_x) - v14 -= v14 + v15 - max_x; - if (a1 + v13 > max_y) - v13 -= a1 + v13 - max_y; + if (a1 < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x) { + if ((signed int)(v14 + v15) > _vm->_graphicsManager.max_x) + v14 -= v14 + v15 - _vm->_graphicsManager.max_x; + if (a1 + v13 > _vm->_graphicsManager.max_y) + v13 -= a1 + v13 - _vm->_graphicsManager.max_y; if ((signed int)v14 > 1 && v13 > 1) { _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); @@ -328,10 +322,10 @@ LABEL_65: _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { if (_vm->_graphicsManager.no_scroll != 2) { - if ((signed __int16)XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + if (XMOUSE() > _vm->_graphicsManager.SCROLL + 620) _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; - if ((signed __int16)XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + if (XMOUSE() < _vm->_graphicsManager.SCROLL + 10) _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; } @@ -405,7 +399,7 @@ LABEL_65: souris_b = 0; if (souris_flag == 1) { if (btsouris != 23) { - if (a1 < max_y && v15 < max_x && (signed int)v14 > 1 && v13 > 1) { + if (a1 < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); goto LABEL_113; @@ -415,7 +409,7 @@ LABEL_65: goto LABEL_113; } - if (a1 < max_y && v15 < max_x && (signed int)v14 > 1 && v13 > 1) { + if (a1 < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); } diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 51decf7912..d58b602735 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -42,8 +42,6 @@ private: public: bool souris_flag; bool mouse_linux; - int min_x, min_y; - int max_x, max_y; int souris_sizex, souris_sizey; int ofset_souris_x, ofset_souris_y; int start_x, start_y; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a1a5206fe3..23ea17813e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -59,6 +59,13 @@ GraphicsManager::GraphicsManager() { NOLOCK = false; no_scroll = 0; REDRAW = false; + min_x = 0; + min_y = 20; + max_x = SCREEN_WIDTH * 2; + max_y = SCREEN_HEIGHT - 20 * 2; + clip_x = clip_y = 0; + clip_x1 = clip_y1 = 0; + clip_flag = false; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); @@ -97,9 +104,8 @@ void GraphicsManager::SET_MODE(int width, int height) { bpp = 16; if (SDL_ECHELLE) { - error("TODO: Implement zooming support"); - //width = Reel_Zoom(width, SDL_ECHELLE); - //height = Reel_Zoom(height, SDL_ECHELLE); + width = Reel_Zoom(width, SDL_ECHELLE); + height = Reel_Zoom(height, SDL_ECHELLE); } //Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 0, 10, 5, 0, 0); @@ -187,25 +193,25 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (!DOUBLE_ECRAN) { souris_max(); SCANLINE(SCREEN_WIDTH); - _vm->_eventsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.max_x = SCREEN_WIDTH; DD_Lock(); Cls_Video(); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else if (Winbpp == 1) { if (!SDL_ECHELLE) - m_scroll2((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll2(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll2A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll2A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } DD_Unlock(); } else { SCANLINE(SCREEN_WIDTH * 2); - _vm->_eventsManager.max_x = SCREEN_WIDTH * 2; + _vm->_graphicsManager.max_x = SCREEN_WIDTH * 2; DD_Lock(); Cls_Video(); DD_Unlock(); @@ -214,22 +220,22 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { DD_Lock(); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (Winbpp == 1) { if (!SDL_ECHELLE) - m_scroll2((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll2(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll2A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll2A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } DD_Unlock(); } } - memcpy((byte *)VESA_BUFFER, (byte *)VESA_SCREEN, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + memcpy(VESA_BUFFER, VESA_SCREEN, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); } void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) { @@ -737,7 +743,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac __int16 v9; __int16 v10; __int16 v12; - unsigned __int16 v13; + uint16 v13; byte palData[PALETTE_BLOCK_SIZE]; __int16 v15[PALETTE_BLOCK_SIZE]; @@ -845,7 +851,16 @@ void GraphicsManager::setpal_vga256(const byte *palette) { } void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { - warning("TODO: setpal_vga256_linux"); + CHANGE_PALETTE(palette); + + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + + DD_VBL(); + } } void GraphicsManager::SETCOLOR3(int palIndex, int r, int g, int b) { @@ -865,7 +880,6 @@ void GraphicsManager::CHANGE_PALETTE(const byte *palette) { const byte *srcP = &palette[0]; for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { - // TODO: Validate pixel encoding is correct *(uint16 *)&SD_PIXELS[2 * idx] = MapRGB(*srcP, *(srcP + 1), *(srcP + 2)); } @@ -891,15 +905,152 @@ void GraphicsManager::DD_VBL() { } void GraphicsManager::FADE_OUTW_LINUX(const byte *surface) { - warning("TODO: FADE_OUTW_LINUX"); + fade_out(Palette, FADESPD, surface); +} + +void GraphicsManager::FADE_INW_LINUX(const byte *surface) { + return fade_in(Palette, FADESPD, surface); } void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface) { - warning("TODO: Copy_WinScan_Vbe3"); + int result; + int v3; + int v4; + const byte *v5; + uint8 v6; + int v7; + unsigned int v8; + byte *v9; + int v10; + unsigned int v11; + byte *v12; + + result = 0; + v3 = 0; + v4 = 0; + v5 = sourceSurface; + for (;;) { + v6 = *v5; + if (*(byte *)v5 < 222) + goto Video_Cont3_wVbe; + + if (v6 == 252) + return; + + if (v6 < 251) { + v3 += (unsigned __int8)(*(byte *)v5 + 35); + v6 = *(v5++ + 1); + } else if (v6 == 253) { + v3 += *(v5 + 1); + v6 = *(v5 + 2); + v5 += 2; + } else if (v6 == 254) { + v3 += READ_LE_UINT16(v5 + 1); + v6 = *(v5 + 3); + v5 += 3; + } else { + v3 += READ_LE_UINT32(v5 + 1); + v6 = *(v5 + 5); + v5 += 5; + } + +Video_Cont3_wVbe: + if (v6 > 210) { + if (v6 == 211) { + v7 = v4; + v8 = *(v5 + 1); + result = *(v5 + 2); + v9 = v3 + destSurface; + v3 += v8; + memset(v9, result, v8); + v5 += 3; + v4 = v7; + } else { + v10 = v4; + v11 = *v5 + 45; + result = *(v5 + 1); + v12 = v3 + destSurface; + v3 += v11; + memset(v12, result, v11); + v5 += 2; + v4 = v10; + } + } else { + *(v3 + destSurface) = v6; + ++v5; + ++v3; + } + } } void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { - warning("TODO: Copy_Video_Vbe3"); + int result; // eax@1 + int v2; // ebx@1 + int v3; // ecx@1 + const byte *v4; // esi@1 + uint8 v5; // dl@2 + int v6; // ST00_4@9 + unsigned int v7; // ecx@9 + byte *v8; // edi@9 + int v9; // ST00_4@10 + unsigned int v10; // ecx@10 + byte *v11; // edi@10 + + assert(VideoPtr); + result = 0; + v2 = 0; + v3 = 0; + v4 = surface; + for (;;) { + v5 = *v4; + if (*v4 < 222) + goto Video_Cont3_Vbe; + + if (v5 == 252) + return; + if (v5 < 251) { + v2 += (unsigned __int8)(*v4 + 35); + v5 = *(v4++ + 1); + } else if (v5 == -3) { + v2 += *(v4 + 1); + v5 = *(v4 + 2); + v4 += 2; + } else if (v5 == -2) { + v2 += READ_LE_UINT16(v4 + 1); + v5 = *(v4 + 3); + v4 += 3; + } else { + v2 += READ_LE_UINT32(v4 + 1); + v5 = *(v4 + 5); + v4 += 5; + } +Video_Cont3_Vbe: + if (v5 > 210) { + if (v5 == 211) { + v6 = v3; + v7 = *(v4 + 1); + result = *(v4 + 2); + v8 = v2 + (byte *)VideoPtr->pixels; + v2 += v7; + memset(v8, result, v7); + v4 += 3; + v3 = v6; + } else { + v9 = v3; + v10 = (unsigned __int8)(*v4 + 45); + result = *(v4 + 1); + v11 = (byte *)(v2 + (byte *)VideoPtr->pixels); + v2 += v10; + memset(v11, result, v10); + v4 += 2; + v3 = v9; + } + } else { + *(v2 + (byte *)VideoPtr->pixels) = v5; + ++v4; + ++v2; + } + } } void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { @@ -962,12 +1113,187 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { } } -void GraphicsManager::Capture_Mem(byte *a1, void *a2, int a3, int a4, unsigned int a5, int a6) { - warning("TODO: Capture_Mem"); +void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height) { + const byte *srcP; + byte *destP; + int yCtr; + unsigned int i; + int yTemp; + + srcP = srcSurface + xs + nbrligne2 * ys; + destP = destSurface; + + yCtr = height; + do { + yTemp = yCtr; + if (width & 1) { + memcpy(destP, srcP, width); + srcP += width; + destP += width; + } else if (width & 2) { + for (i = width >> 1; i; --i) { + *(uint16 *)destP = *(uint16 *)srcP; + srcP += 2; + destP = (byte *)destP + 2; + } + } else { + memcpy(destP, srcP, 4 * (width >> 2)); + srcP += 4 * (width >> 2); + destP = (byte *)destP + 4 * (width >> 2); + } + srcP = nbrligne2 + srcP - width; + yCtr = yTemp - 1; + } while (yTemp != 1); } void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) { - warning("TODO: Sprite_Vesa"); + byte *v5; + int i; + byte *v7; + uint16 v8; + byte *v9; + int v10; + uint16 v11; + uint16 v12; + uint16 v13; + uint16 v14; + byte *v15; + byte *v16; + const byte *v17; + byte *v18; + int v19; + byte *v20; + byte *v21; + int v22; + unsigned int v23; + byte *v24; + const byte *v25; + byte *v26; + byte *v27; + byte *v28; + byte *v29; + int v30; + int v31; + + v5 = a2 + 3; + for (i = a5; i; --i) + v5 += READ_LE_UINT32(v5) + 16; + v10 = 0; + v7 = v5 + 4; + v8 = READ_LE_UINT16(v7); + v9 = v7 + 2; + v10 = READ_LE_UINT16(v9); + clip_x = 0; + clip_y = 0; + clip_flag = false; + clip_x1 = v8; + if ((uint16)(v8 + a3) > v8) { + if ((uint16)a3 < (uint16)(min_x + 300)) { + clip_x = min_x + 300 - a3; + clip_flag = true; + } + if ((uint16)(v10 + (uint16)a4) > (uint16)v10) { + if ((uint16)a4 < (uint16)(min_y + 300)) { + clip_y = min_y + 300 - a4; + clip_flag = true; + } + v11 = max_x + 300; + if ((uint16)a3 < (uint16)(max_x + 300)) { + if ((uint16)(v8 + a3) > v11) { + v12 = v8 + 10 - (v8 + a3 - v11); + if (v12 <= 10) + return; + clip_x1 = v12 - 10; + clip_flag = true; + } + v13 = max_y + 300; + if ((uint16)a4 < (uint16)(max_y + 300)) { + if ((uint16)(v10 + (uint16)a4) > v13) { + v14 = v10 + 10 - (v10 + (uint16)a4 - v13); + if (v14 <= 10) + return; + v10 -= 10; + clip_y1 = v10; + clip_flag = true; + } + v15 = v9 + 6; + v16 = v15 + 4; + v17 = READ_LE_UINT32(v15) + v15 + 4; + v18 = a3 + nbrligne2 * (a4 - 300) - 300 + a1; + v19 = 0; + if (clip_flag) { + do { + v31 = v10; + v29 = v18; + v19 = 0; + while (*v16 != -3) { + if (*v16 == -2) { + v27 = v16 + 1; + v10 = READ_LE_UINT16(v27); + + do { + if (!clip_y && (uint16)v19 >= clip_x && (uint16)v19 < clip_x1) + *v18 = *v17; + ++v17; + ++v18; + ++v19; + --v10; + } while (v10); + + v16 = v27 + 2; + } else { + v26 = v16 + 1; + v10 = *(uint16 *)v26; + v18 += v10; + v19 += v10; + v16 = v26 + 2; + } + } + + if (clip_y) + --clip_y; + v16 += 3; + v18 = nbrligne2 + v29; + v10 = v31 - 1; + } while (v31 != 1); + } else { + do { + v30 = v10; + v28 = v18; + while (*v16 != -3) { + if (*v16 == -2) { + v21 = v16 + 1; + v10 = READ_LE_UINT16(v21); + + v22 = v10; + v23 = (unsigned int)v10 >> 2; + memcpy(v18, v17, 4 * v23); + v25 = (v17 + 4 * v23); + v24 = (v18 + 4 * v23); + v10 = v22 - 4 * v23; + memcpy(v24, v25, v10); + + v17 = v25 + v10; + v18 = v24 + v10; + v10 = 0; + v16 = v21 + 2; + } else { + v20 = v16 + 1; + v10 = READ_LE_UINT16(v20); + v18 += v10; + v16 = v20 + 2; + } + } + + v16 += 3; + v18 = nbrligne2 + v28; + v10 = v30 - 1; + } while (v30 != 1); + } + } + } + } + } } void GraphicsManager::FIN_VISU() { @@ -1004,16 +1330,88 @@ void GraphicsManager::Affiche_Segment_Vesa() { } void GraphicsManager::CopyAsm(const byte *surface) { - warning("TODO: CopyAsm"); + const byte *v1; + byte srcByte; + byte *v3; + signed int v4; + signed int v5; + byte *v6; + byte *v7; + byte *v8; + byte *v9; + const byte *v10; + + assert(VideoPtr); + v1 = surface; + srcByte = 30 * WinScan; + v3 = (byte *)VideoPtr->pixels + 30 * WinScan; + v4 = 200; + do { + v10 = v1; + v9 = v3; + v5 = 320; + + do { + srcByte = *(byte *)v1; + *(byte *)v3 = *(byte *)v1; + v6 = WinScan + v3; + *(byte *)v6 = srcByte; + v7 = v6 - WinScan + 1; + *(byte *)v7 = srcByte; + v8 = WinScan + v7; + *(byte *)v8 = srcByte; + v3 = v8 - WinScan + 1; + ++v1; + --v5; + } while (v5); + + v1 = v10 + 320; + v3 = WinScan + WinScan + v9; + --v4; + } while (v4); +} + +void GraphicsManager::Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6) { + byte *v6; + int v7; + const byte *v8; + unsigned int i; + int v10; + + v6 = a3 + nbrligne2 * a4 + a1; + v7 = a6; + v8 = a2; + do { + v10 = v7; + if (a5 & 1) { + memcpy(v6, v8, a5); + v8 += a5; + v6 += a5; + } else if (a5 & 2) { + for (i = a5 >> 1; i; --i) { + *(uint16 *)v6 = *(uint16 *)v8; + v8 += 2; + v6 += 2; + } + } else { + memcpy(v6, v8, 4 * (a5 >> 2)); + v8 += 4 * (a5 >> 2); + v6 += 4 * (a5 >> 2); + } + v6 = nbrligne2 + v6 - a5; + v7 = v10 - 1; + } while (v10 != 1); } -void GraphicsManager::Restore_Mem(const byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6) { - warning("TODO: Restore_Mem"); +int GraphicsManager::Reel_Zoom(int v, int percentage) { + return Asm_Zoom(v, percentage); } -int GraphicsManager::Reel_Zoom(int a1, int a2) { - warning("TODO: Reel_Zoom"); - return 0; +int GraphicsManager::Asm_Zoom(int v, int percentage) { + if (v) + v += percentage * (long int)v / 100; + + return v; } void GraphicsManager::AFF_SPRITES() { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 113147ba7d..d57c7b063a 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -48,6 +48,7 @@ private: HopkinsEngine *_vm; void CHARGE_ECRAN(const Common::String &file); + int Asm_Zoom(int v, int percentage); public: int _lockCtr; bool SDL_MODEYES; @@ -85,6 +86,12 @@ public: int no_scroll; Common::Rect dstrect[50]; int REDRAW; + int min_x, min_y; + int max_x, max_y; + int clip_x, clip_y; + int clip_x1, clip_y1; + bool clip_flag; + public: GraphicsManager(); ~GraphicsManager(); @@ -115,17 +122,18 @@ public: void FADE_OUTS(); void FADE_INW(); void FADE_OUTW(); + void FADE_OUTW_LINUX(const byte *surface); + void FADE_INW_LINUX(const byte *surface); 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(); - 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); - void Capture_Mem(byte *a1, void *a2, int a3, int a4, unsigned int a5, int a6); + void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height); void Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5); void FIN_VISU(); void VISU_ALL(); @@ -134,7 +142,7 @@ public: int Magic_Number(int v); void Affiche_Segment_Vesa(); void CopyAsm(const byte *surface); - void Restore_Mem(const byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); + void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); int Reel_Zoom(int a1, int a2); void AFF_SPRITES(); void Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8); -- cgit v1.2.3 From 3d917112c99ddff23f58a959342b5c95b8d52f9d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Sep 2012 22:02:55 +1000 Subject: HOPKINS: Implemented some BOB methods --- engines/hopkins/globals.h | 31 +++++++++++++ engines/hopkins/graphics.cpp | 26 ++++++++++- engines/hopkins/objects.cpp | 104 +++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/objects.h | 8 ++++ 4 files changed, 167 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c1209d01fb..5b9c683867 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -84,11 +84,41 @@ struct BankItem { }; struct BobItem { + int field0; + byte *field4; + int field8; + int fieldA; int fieldC; + int fieldE; int field10; int field12; int field14; int field16; + byte *field18; + int field1A; + int field1C; + int field1E; + int field20; + int field22; + int field24; + int field26; + int field28; + int field2A; + int field2C; + byte *field30; + int field34; + int field36; + int field38; + int field3A; + int field46; +}; + +struct Liste2Item { + int field0; + int field2; + int field4; + int field6; + int field8; }; struct BlAnimItem { @@ -181,6 +211,7 @@ public: BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; BobItem Bob[36]; + Liste2Item Liste2[35]; BlAnimItem BL_ANIM[30]; VBobItem VBob[35]; ObjetWItem ObjetW[300]; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 23ea17813e..a537ea1db9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1297,11 +1297,33 @@ void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) { } void GraphicsManager::FIN_VISU() { - warning("TODO: FIN_VISU"); + for (int idx = 1; idx <= 20; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_OFF(idx); + } + + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + + for (int idx = 1; idx <= 20; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_ZERO(idx); + } + + for (int idx = 1; idx <= 29; ++idx) { + _vm->_globals.BL_ANIM[idx].v1 = 0; + } + + for (int idx = 1; idx <= 20; ++idx) { + _vm->_globals.Bqe_Anim[idx].field4 = 0; + } } void GraphicsManager::VISU_ALL() { - warning("TODO: VISU_ALL"); + for (int idx = 1; idx <= 20; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_VISU(idx); + } } void GraphicsManager::RESET_SEGMENT_VESA() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 938099f083..fbc131e0f0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -31,6 +31,10 @@ namespace Hopkins { +ObjectsManager::ObjectsManager() { + PRIORITY = 0; +} + void ObjectsManager::setParent(HopkinsEngine *vm) { _vm = vm; } @@ -185,4 +189,104 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } +void ObjectsManager::INIT_BOB() { + for (int idx = 0; idx < 35; ++idx) { + BOB_ZERO(idx); + } +} + +void ObjectsManager::BOB_ZERO(int idx) { + BobItem &bob = _vm->_globals.Bob[idx]; + Liste2Item &item = _vm->_globals.Liste2[idx]; + + bob.field0 = 0; + bob.field4 = PTRNUL; + bob.field8 = 0; + bob.fieldA = 0; + bob.fieldC = 0; + bob.fieldE = 0; + bob.field10 = 0; + bob.field12 = 0; + bob.field14 = 0; + bob.field16 = 0; + bob.field18 = PTRNUL; + bob.field1A = 0; + bob.field1C = 0; + bob.field1E = 0; + bob.field20 = 0; + bob.field22 = 0; + bob.field24 = 0; + bob.field26 = 0; + bob.field28 = 0; + bob.field2A = 0; + bob.field2C = 0; + bob.field30 = PTRNUL; + bob.field34 = 0; + bob.field36 = 0; + bob.field38 = 0; + bob.field46 = 0; + + item.field0 = 0; + item.field2 = 0; + item.field4 = 0; + item.field6 = 0; + item.field8 = 0; +} + +void ObjectsManager::BOB_VISU(int idx) { + int v1; + const byte *data; + int16 v6; + int16 v7; + int16 v8; + int16 v9; + + PRIORITY = 1; + + if (!_vm->_globals.Bob[idx].field0) { + BOB_ZERO(idx); + + data = _vm->_globals.Bqe_Anim[idx].data; + v1 = READ_LE_UINT16(data); + v9 = READ_LE_UINT16(data + 2); + v8 = READ_LE_UINT16(data + 4); + v7 = READ_LE_UINT16(data + 6); + v6 = READ_LE_UINT16(data + 8); + if (READ_LE_UINT16(data)) { + if (_vm->_globals.Bank[idx].field4) { + if (!v9) + v9 = 1; + if (!v6) + v6 = -1; + + if (READ_LE_UINT16(data + 24)) { + _vm->_globals.Bob[idx].field3A = 0; + + if (_vm->_globals.Bank[idx].fileHeader == 1) { + _vm->_globals.Bob[idx].field3A = 1; + _vm->_globals.Bob[idx].field36 = 0; + _vm->_globals.Bob[idx].field38 = 0; + } + + _vm->_globals.Bob[idx].field18 = _vm->_globals.Bqe_Anim[idx].data; + _vm->_globals.Bob[idx].field0 = 10; + _vm->_globals.Bob[idx].field4 = _vm->_globals.Bank[idx].data; + + _vm->_globals.Bob[idx].field1E = v9; + _vm->_globals.Bob[idx].field20 = v6; + _vm->_globals.Bob[idx].field22 = v8; + _vm->_globals.Bob[idx].field24 = v7; + } + } + } + } +} + +void ObjectsManager::BOB_OFF(int idx) { + if (_vm->_globals.Bob[idx].field0 == 3) + _vm->_globals.Bob[idx].field0 = 4; + else if (_vm->_globals.Bob[idx].field0 == 10) + _vm->_globals.Bob[idx].field0 = 11; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 845c4077a3..f9017cc63f 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -34,7 +34,10 @@ class HopkinsEngine; class ObjectsManager { private: HopkinsEngine *_vm; + + int PRIORITY; public: + ObjectsManager(); void setParent(HopkinsEngine *vm); byte *CHANGE_OBJET(int objIndex); @@ -50,6 +53,11 @@ public: int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); int AJOUTE_OBJET(int objIndex); + + void INIT_BOB(); + void BOB_ZERO(int idx); + void BOB_VISU(int idx); + void BOB_OFF(int idx); }; } // End of namespace Hopkins -- cgit v1.2.3 From 0ef0ff60993533c58ffec0c02d8c1742b92cc914 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Sep 2012 22:23:07 +1000 Subject: HOPKINS: Implemented some more blitting methods --- engines/hopkins/globals.h | 4 +++ engines/hopkins/graphics.cpp | 79 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5b9c683867..40ddc85c53 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -150,6 +150,10 @@ struct ObjetWItem { struct BlocItem { uint16 field0; + int x1; + int y1; + int x2; + int y2; }; /** diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a537ea1db9..3785b6ff45 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -984,17 +984,17 @@ Video_Cont3_wVbe: } void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { - int result; // eax@1 - int v2; // ebx@1 - int v3; // ecx@1 - const byte *v4; // esi@1 - uint8 v5; // dl@2 - int v6; // ST00_4@9 - unsigned int v7; // ecx@9 - byte *v8; // edi@9 - int v9; // ST00_4@10 - unsigned int v10; // ecx@10 - byte *v11; // edi@10 + int result; + int v2; + int v3; + const byte *v4; + uint8 v5; + int v6; + unsigned int v7; + byte *v8; + int v9; + unsigned int v10; + byte *v11; assert(VideoPtr); result = 0; @@ -1327,11 +1327,62 @@ void GraphicsManager::VISU_ALL() { } void GraphicsManager::RESET_SEGMENT_VESA() { - warning("TODO: RESET_SEGMENT_VESA"); + int v1; + int v2; + + if (_vm->_globals.NBBLOC > 0) { + v1 = 0; + v2 = _vm->_globals.NBBLOC; + do { + _vm->_globals.BLOC[v1++].field0 = 0; + } while (v1 != v2); + + _vm->_globals.NBBLOC = 0; + } } -void GraphicsManager::Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4) { - warning("TODO: Ajoute_Segment_Vesa"); +void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { + int v4; + int v5; + int16 v6; + int16 v10; + + v4 = x1; + v10 = 1; + if (x2 > max_x) + x2 = max_x; + if (y2 > max_y) + y2 = max_y; + if (x1 < min_x) + v4 = min_x; + if (y1 < min_y) + y1 = min_y; + + v5 = _vm->_globals.NBBLOC; + if (_vm->_globals.NBBLOC > 1) { + + v6 = 0; + do { + BlocItem &bloc = _vm->_globals.BLOC[v6]; + + if (bloc.field0 == 1 + && v4 >= bloc.x1 && x2 <= bloc.x2 + && y1 >= bloc.y1 && y2 <= bloc.y2) + v10 = 0; + ++v6; + v5 = v6; + } while (_vm->_globals.NBBLOC + 1 != v6); + } + + if (v10 == 1) { + BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; + + bloc.field0 = 1; + bloc.x1 = v4; + bloc.x2 = x2; + bloc.y1 = y1; + bloc.y2 = y2; + } } int GraphicsManager::Magic_Number(signed int v) { -- cgit v1.2.3 From 391e3da119b7cf7be8a9422e8fe390a2b5e55398 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Sep 2012 23:30:28 +1000 Subject: HOPKINS: Implemented Affiche_Segment_Vesa and support methods --- engines/hopkins/graphics.cpp | 168 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/graphics.h | 4 +- 2 files changed, 170 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3785b6ff45..1a22ff42ce 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -66,6 +66,7 @@ GraphicsManager::GraphicsManager() { clip_x = clip_y = 0; clip_x1 = clip_y1 = 0; clip_flag = false; + SDL_NBLOCS = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); @@ -672,6 +673,99 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } while (v13 != 1); } +void GraphicsManager::Copy_Vga(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { + const byte *v7; + byte *v8; + int v9; + int v10; + byte v11; + byte *v12; + byte *v13; + byte *v14; + byte *v15; + const byte *v16; + int v17; + + assert(VideoPtr); + v7 = xp + 320 * yp + surface; + v8 = 30 * WinScan + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels; + v9 = height; + + do { + v17 = v9; + v10 = width; + v16 = v7; + v15 = v8; + do { + v11 = *v7; + *v8 = *v7; + v12 = WinScan + v8; + *v12 = v11; + v13 = v12 - WinScan + 1; + *v13 = v11; + v14 = WinScan + v13; + *v14 = v11; + ++v7; + v8 = v14 - WinScan + 1; + --v10; + } while (v10); + + v8 = WinScan + WinScan + v15; + v7 = v16 + 320; + v9 = v17 - 1; + } while (v17 != 1); +} + +void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { + const byte *v7; + uint16 *v8; + int v9; + int v10; + int v11; + const byte *v12; + uint16 *v13; + uint16 v14; + uint16 *v15; + int v16; + uint16 *v17; + const byte *v18; + int v19; + + assert(VideoPtr); + v7 = xp + 320 * yp + surface; + v8 = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels); + v9 = height; + v10 = width; + + do { + v19 = v9; + v11 = v10; + v18 = v7; + v17 = v8; + v16 = v10; + v12 = PAL_PIXELS; + + do { + v13 = (uint16 *)(v12 + 2 * *v7); + v14 = *v13; + *v8 = *v13; + *(v8 + 1) = v14; + + v15 = (uint16 *)((byte *)v8 + WinScan); + *v15 = v14; + *(v15 + 1) = v14; + ++v7; + v8 = (uint16 *)((byte *)v15 - WinScan + 4); + --v11; + } while (v11); + + v10 = v16; + v8 = (uint16 *)((byte *)v17 + WinScan * 2); + v7 = v18 + 320; + v9 = v19 - 1; + } while (v19 != 1); +} + void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface) { uint16 palData1[PALETTE_BLOCK_SIZE * 2]; byte palData2[PALETTE_BLOCK_SIZE]; @@ -1399,7 +1493,79 @@ int GraphicsManager::Magic_Number(signed int v) { } void GraphicsManager::Affiche_Segment_Vesa() { - warning("TODO: Affiche_Segment_Vesa"); + if (_vm->_globals.NBBLOC == 0) + return; + + _vm->_graphicsManager.SDL_NBLOCS = _vm->_globals.NBBLOC; + + for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { + BlocItem &bloc = _vm->_globals.BLOC[idx]; + Common::Rect &dstRect = dstrect[idx - 1]; + if (bloc.field0 != 1) + continue; + + if (_vm->_eventsManager.CASSE != 0) { + if (Winbpp == 1) { + Copy_Vga(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); + } else if (Winbpp == 2) { + Copy_Vga16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); + } + + dstRect.left = bloc.x1 * 2; + dstRect.top = bloc.y1 * 2 + 30; + dstRect.setWidth((bloc.x2 - bloc.x1) * 2); + dstRect.setHeight((bloc.y2 - bloc.y1) * 2); + } else if (bloc.x2 > start_x && bloc.x1 < (start_x + SCREEN_WIDTH)) { + if (bloc.x1 < start_x) + bloc.x1 = start_x; + if (bloc.x2 > (start_x + SCREEN_WIDTH)) + bloc.x2 = start_x + SCREEN_WIDTH; + + if (!SDL_ECHELLE) { + // Calculate the bounds + int xp = Magic_Number(bloc.x1) - 4; + if (xp < start_x) + xp = start_x; + int yp = Magic_Number(bloc.y1) - 4; + if (yp < 0) + yp = 0; + int width = Magic_Number(bloc.x2) + 4 - xp; + if (width < 4) + width = 4; + int height = Magic_Number(bloc.y2) + 4 - yp; + if (height < 4) + height = 4; + + if ((xp - start_x + width) > SCREEN_WIDTH) + xp -= 4; + if ((height - yp) > (SCREEN_HEIGHT - 40)) + yp -= 4; + + if (Winbpp == 2) { + m_scroll16A(VESA_BUFFER, xp, yp, width, height, + Reel_Zoom(xp - start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + } else { + m_scroll2A(VESA_BUFFER, xp, yp, width, height, + Reel_Zoom(xp - start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + } + + dstRect.left = Reel_Zoom(xp - start_x, SDL_ECHELLE); + dstRect.top = Reel_Zoom(yp, SDL_ECHELLE); + dstRect.setWidth(Reel_Zoom(width, SDL_ECHELLE)); + dstRect.setHeight(Reel_Zoom(height, SDL_ECHELLE)); + } else { + if (Winbpp == 2) { + m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, + bloc.x1 - start_x, bloc.y1); + } else { + m_scroll(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, + bloc.x1 - start_x, bloc.y1); + } + } + } + + _vm->_globals.BLOC[idx].field0 = 0; + } } void GraphicsManager::CopyAsm(const byte *surface) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index d57c7b063a..222ba2edd7 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -91,7 +91,7 @@ public: int clip_x, clip_y; int clip_x1, clip_y1; bool clip_flag; - + int SDL_NBLOCS; public: GraphicsManager(); ~GraphicsManager(); @@ -116,6 +116,8 @@ public: void m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void Copy_Vga(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); + void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); void fade_in(const byte *palette, int step, const byte *surface); void fade_out(const byte *palette, int step, const byte *surface); void FADE_INS(); -- cgit v1.2.3 From fc5d6bfb9976d24147d2e8c073c9ca9e9cc5b8fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Sep 2012 20:54:26 +1000 Subject: HOPKINS: Implemented Affiche_Perfect and support methods --- engines/hopkins/graphics.cpp | 488 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/graphics.h | 11 +- 2 files changed, 495 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 1a22ff42ce..788af5a801 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -67,6 +67,11 @@ GraphicsManager::GraphicsManager() { clip_x1 = clip_y1 = 0; clip_flag = false; SDL_NBLOCS = 0; + Red_x = Red_y = 0; + Red = 0; + Largeur = 0; + Compteur_y = 0; + spec_largeur = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); @@ -1653,12 +1658,491 @@ int GraphicsManager::Asm_Zoom(int v, int percentage) { return v; } +int GraphicsManager::Reel_Reduc(int v, int percentage) { + return Asm_Reduc(v, percentage); +} + +int GraphicsManager::Asm_Reduc(int v, int percentage) { + if (v) + v -= percentage * (long int)v / 100; + + return v; +} + void GraphicsManager::AFF_SPRITES() { warning("TODO: AFF_SPRITES"); } -void GraphicsManager::Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8) { - warning("TODO: Affice_Perfect"); +void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8) { + const byte *v8; + int i; + const byte *v10; + int v11; + int v12; + const byte *v13; + byte *v14; + int v15; + byte *v16; + int v17; + int v18; + int v19; + int v20; + int v21 = 0; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + byte *v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36 = 0; + int v37; + int v38; + int v39; + byte *v40; + int v41; + int v42; + const byte *v43; + const byte *v44; + const byte *v45; + const byte *v46; + byte *v47; + byte *v48; + int v49; + int v50; + byte *v51; + unsigned int v52; + byte *v53; + byte *v54; + byte *v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; + int v63; + int v64; + int v65; + + v8 = srcData + 3; + for (i = a5; i; --i) + v8 += READ_LE_UINT32(v8) + 16; + + v11 = 0; + v12 = 0; + v10 = v8 + 4; + v11 = *(uint16 *)v10; + v10 += 2; + v12 = *(uint16 *)v10; + v13 = v10 + 10; + clip_x = clip_y = 0; + clip_x1 = clip_y1 = 0; + + if ((unsigned __int16)a3 > min_x) { + if ((unsigned __int16)a3 < (unsigned __int16)(min_x + 300)) + clip_x = min_x + 300 - a3; + if ((unsigned __int16)a4 > min_y) { + if ((unsigned __int16)a4 < (unsigned __int16)(min_y + 300)) + clip_y = min_y + 300 - a4; + if ((unsigned __int16)a3 < (unsigned __int16)(max_x + 300)) { + clip_x1 = max_x + 300 - a3; + if ((unsigned __int16)a4 < (unsigned __int16)(max_y + 300)) { + clip_y1 = max_y + 300 - a4; + v14 = a3 + nbrligne2 * (a4 - 300) - 300 + destSurface; + + if ((uint16)a7) { + Compteur_y = 0; + Agr_x = 0; + Agr_y = 0; + Agr_Flag_y = 0; + Agr_Flag_x = 0; + Largeur = v11; + v20 = Asm_Zoom(v11, a7); + v22 = Asm_Zoom(v21, a7); + + if (a8) { + v29 = v20 + v14; + if (clip_y) { + if ((unsigned __int16)clip_y >= v22) + return; + v61 = v22; + v52 = v20; + v30 = 0; + v31 = (unsigned __int16)clip_y; + + while (Asm_Zoom(v30 + 1, a7) < v31) + ; + v20 = v52; + v13 += Largeur * v30; + v29 += nbrligne2 * (unsigned __int16)clip_y; + v22 = v61 - (unsigned __int16)clip_y; + } + + if (v22 > (unsigned __int16)clip_y1) + v22 = (unsigned __int16)clip_y1; + if (clip_x) { + if ((unsigned __int16)clip_x >= v20) + return; + v20 -= (unsigned __int16)clip_x; + } + + if (v20 > (unsigned __int16)clip_x1) { + v32 = v20 - (unsigned __int16)clip_x1; + v29 -= v32; + v62 = v22; + v33 = 0; + + while (Asm_Zoom(v33 + 1, a7) < v32) + ; + v34 = v33; + v22 = v62; + v13 += v34; + v20 = (unsigned __int16)clip_x1; + } + + do { + for (;;) { + v63 = v22; + v53 = v29; + v46 = v13; + Agr_Flag_x = 0; + Agr_x = 0; + v35 = v20; + + do { + for (;;) { + if (*v13) + *v29 = *v13; + --v29; + ++v13; + if (!Agr_Flag_x) + Agr_x = a7 + Agr_x; + + if ((unsigned __int16)Agr_x < 100) + break; + + Agr_x = Agr_x - 100; + --v13; + Agr_Flag_x = 1; + --v35; + if (!v35) + goto R_Aff_Zoom_Larg_Cont1; + } + + Agr_Flag_x = 0; + --v35; + } while (v35); + +R_Aff_Zoom_Larg_Cont1: + v13 = Largeur + v46; + v29 = nbrligne2 + v53; + ++Compteur_y; + if (!(uint16)Agr_Flag_y) + Agr_y = a7 + Agr_y; + + if ((unsigned __int16)Agr_y < 100) + break; + + Agr_y = Agr_y - 100; + v13 = v46; + Agr_Flag_y = 1; + v22 = v63 - 1; + if (v63 == 1) + return; + } + + Agr_Flag_y = 0; + v22 = v63 - 1; + } while (v63 != 1); + } else { + if (clip_y) { + if ((unsigned __int16)clip_y >= v22) + return; + v58 = v22; + v49 = v20; + v23 = 0; + v24 = (unsigned __int16)clip_y; + + while (Asm_Zoom(v23 + 1, a7) < v24) + ; + v20 = v49; + v13 += Largeur * v23; + v14 += nbrligne2 * (unsigned __int16)clip_y; + v22 = v58 - (unsigned __int16)clip_y; + } + + if (v22 > (unsigned __int16)clip_y1) + v22 = (unsigned __int16)clip_y1; + + if (clip_x) { + if ((unsigned __int16)clip_x >= v20) + return; + v59 = v22; + v50 = v20; + v25 = (unsigned __int16)clip_x; + v26 = 0; + + while (Asm_Zoom(v26 + 1, a7) < v25) + ; + v27 = v26; + v22 = v59; + v13 += v27; + v14 += (unsigned __int16)clip_x; + v20 = v50 - (unsigned __int16)clip_x; + } + + if (v20 > (unsigned __int16)clip_x1) + v20 = (unsigned __int16)clip_x1; + + do { + for (;;) { + v60 = v22; + v51 = v14; + v45 = v13; + v28 = v20; + Agr_Flag_x = 0; + Agr_x = 0; + + do { + for (;;) { + if (*v13) + *v14 = *v13; + ++v14; + ++v13; + + if (!Agr_Flag_x) + Agr_x = a7 + Agr_x; + if ((unsigned __int16)Agr_x < 100) + break; + + Agr_x = Agr_x - 100; + --v13; + Agr_Flag_x = 1; + --v28; + + if (!v28) + goto Aff_Zoom_Larg_Cont1; + } + + Agr_Flag_x = 0; + --v28; + } + while (v28); + +Aff_Zoom_Larg_Cont1: + v13 = Largeur + v45; + v14 = nbrligne2 + v51; + if (!(uint16)Agr_Flag_y) + Agr_y = a7 + Agr_y; + + if ((unsigned __int16)Agr_y < 100) + break; + + Agr_y = Agr_y - 100; + v13 = v45; + Agr_Flag_y = 1; + v22 = v60 - 1; + + if (v60 == 1) + return; + } + + Agr_Flag_y = 0; + v22 = v60 - 1; + } while (v60 != 1); + } + } else if ((uint16)a6) { + Compteur_y = 0; + Red_x = 0; + Red_y = 0; + Largeur = v11; + Red = a6; + + if ((unsigned __int16)a6 < 100) { + v37 = Asm_Reduc(v11, Red); + if (a8) { + v40 = v37 + v14; + + do { + v65 = v36; + v55 = v40; + Red_y = Red + Red_y; + + if ((unsigned __int16)Red_y < 100) { + Red_x = 0; + v41 = Largeur; + v42 = v37; + + do { + Red_x = Red + Red_x; + if (Red_x < 100) { + if (v42 >= clip_x && v42 < clip_x1 && *v13) + *v40 = *v13; + --v40; + ++v13; + --v42; + } else { + Red_x = Red_x - 100; + ++v13; + } + --v41; + } while (v41); + + v36 = v65; + v40 = nbrligne2 + v55; + } else { + Red_y = Red_y - 100; + v13 += Largeur; + } + + --v36; + } while ( v36 ); + } else { + do { + v64 = v36; + v54 = v14; + Red_y = Red + Red_y; + + if ((unsigned __int16)Red_y < 100) { + Red_x = 0; + v38 = Largeur; + v39 = 0; + + do { + Red_x = Red + Red_x; + if ((unsigned __int16)Red_x < 100) { + if (v39 >= clip_x && v39 < clip_x1 && *v13) + *v14 = *v13; + ++v14; + ++v13; + ++v39; + } else { + Red_x = Red_x - 100; + ++v13; + } + + --v38; + } while ( v38 ); + + v36 = v64; + v14 = nbrligne2 + v54; + } else { + Red_y = Red_y - 100; + v13 += Largeur; + } + + --v36; + } while (v36); + } + } + } else { + Largeur = v11; + Compteur_y = 0; + if (a8) { + v16 = v11 + v14; + spec_largeur = v11; + if (clip_y) { + if ((unsigned __int16)clip_y >= (unsigned int)v12) + return; + v13 += v11 * (unsigned __int16)clip_y; + v16 += nbrligne2 * (unsigned __int16)clip_y; + v12 -= (unsigned __int16)clip_y; + } + + v17 = (unsigned __int16)clip_y1; + if (v12 > clip_y1) + v12 = clip_y1; + + v17 = clip_x; + if (clip_x) { + if (v17 >= v11) + return; + v11 -= v17; + } + + if (v11 > (unsigned __int16)clip_x1) { + v18 = v11 - (unsigned __int16)clip_x1; + v13 += v18; + v16 -= v18; + v11 = (unsigned __int16)clip_x1; + } + + do { + v57 = v12; + v48 = v16; + v44 = v13; + v19 = v11; + + do { + if (*v13) + *v16 = *v13; + ++v13; + --v16; + --v19; + } while (v19); + + v13 = spec_largeur + v44; + v16 = nbrligne2 + v48; + v12 = v57 - 1; + } while (v57 != 1); + } else { + spec_largeur = v11; + if (clip_y) { + if ((unsigned __int16)clip_y >= (unsigned int)v12) + return; + + v13 += v11 * (unsigned __int16)clip_y; + v14 += nbrligne2 * (unsigned __int16)clip_y; + v12 -= (unsigned __int16)clip_y; + } + + if (v12 > clip_y1) + v12 = clip_y1; + if (clip_x) { + if ((unsigned __int16)clip_x >= v11) + return; + + v13 += (unsigned __int16)clip_x; + v14 += (unsigned __int16)clip_x; + v11 -= (unsigned __int16)clip_x; + } + + if (v11 > (unsigned __int16)clip_x1) + v11 = (unsigned __int16)clip_x1; + + do { + v56 = v12; + v47 = v14; + v43 = v13; + v15 = v11; + + do { + if (*v13) + *v14 = *v13; + ++v14; + ++v13; + --v15; + } while (v15); + + v13 = spec_largeur + v43; + v14 = nbrligne2 + v47; + v12 = v56 - 1; + } while (v56 != 1); + } + } + } + } + } + } } } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 222ba2edd7..e02343132c 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -49,6 +49,7 @@ private: void CHARGE_ECRAN(const Common::String &file); int Asm_Zoom(int v, int percentage); + int Asm_Reduc(int v, int percentage); public: int _lockCtr; bool SDL_MODEYES; @@ -92,6 +93,11 @@ public: int clip_x1, clip_y1; bool clip_flag; int SDL_NBLOCS; + int Red_x, Red_y; + int Red; + int Largeur; + int Compteur_y; + int spec_largeur; public: GraphicsManager(); ~GraphicsManager(); @@ -145,9 +151,10 @@ public: void Affiche_Segment_Vesa(); void CopyAsm(const byte *surface); void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); - int Reel_Zoom(int a1, int a2); + int Reel_Zoom(int v, int percentage); + int Reel_Reduc(int v, int percentage); void AFF_SPRITES(); - void Affiche_Perfect(const byte *a1, const byte *a2, int a3, int a4, int a5, int a6, int a7, int a8); + void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); }; } // End of namespace Hopkins -- cgit v1.2.3 From 507af7e8a5933903131fa1d9c1ac65ae9e31cfa0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Sep 2012 21:05:19 +1000 Subject: HOPKINS: Moved VBL method from EventsManager to GraphicsManager --- engines/hopkins/events.cpp | 244 ------------------------------------------- engines/hopkins/events.h | 1 - engines/hopkins/graphics.cpp | 244 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/graphics.h | 1 + engines/hopkins/hopkins.cpp | 38 +++---- engines/hopkins/menu.cpp | 12 +-- 6 files changed, 268 insertions(+), 272 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 53f1fe9d73..f3c1740d17 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -177,248 +177,4 @@ void EventsManager::pollEvents() { } } -void EventsManager::VBL() { - int a1 = 0; - signed __int16 v1; - int v2; - int v3; - int v4; - int v5; - int v6; - signed __int16 v7; - int v10; - signed int v11 = 0; - signed int v12 = 0; - int v13 = 0; - unsigned int v14 = 0; - int v15 = 0; - - if (_vm->_graphicsManager.REDRAW) { - _vm->_graphicsManager.DD_Lock(); - if (CASSE) { - _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager.VESA_BUFFER); - _vm->_graphicsManager.REDRAW = 0; - } else { - if (_vm->_globals.iRegul == 3) - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); - else - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); - FileManager::DMESS(); - --_vm->_graphicsManager.REDRAW; - } - _vm->_graphicsManager.DD_Unlock(); - } - - if (souris_flag) { - v1 = 20; - if (!mouse_linux) - v1 = 10; - v2 = 20; - if (!mouse_linux) - v2 = 15; - - v15 = souris_x - v1; - a1 = souris_y; - v14 = souris_sizex; - v13 = souris_sizey; - if (btsouris == 23) { - v14 = _vm->_globals.OBJL; - v13 = _vm->_globals.OBJH; - goto LABEL_35; - } - - if (CASSE) { - if (v15 < _vm->_graphicsManager.min_x) - v15 = _vm->_graphicsManager.min_x; - if (souris_y < _vm->_graphicsManager.min_y) - a1 = _vm->_graphicsManager.min_y; - - if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) - v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x); - if (a1 + souris_sizey < _vm->_graphicsManager.max_y) - goto LABEL_34; - - v3 = a1 + souris_sizey - _vm->_graphicsManager.max_y; - } else { - if (v15 < _vm->_graphicsManager.min_x) - v15 = _vm->_graphicsManager.min_x - v1; - v2 = (signed __int16)v2; - if (souris_y < _vm->_graphicsManager.min_y - (signed __int16)v2) - a1 = _vm->_graphicsManager.min_y - (signed __int16)v2; - if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) - v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x - v1); - if (a1 + souris_sizey < v2 + _vm->_graphicsManager.max_y) - goto LABEL_34; - - v3 = v2 + a1 + souris_sizey - _vm->_graphicsManager.max_y; - } - - v13 = souris_sizey - v3; -LABEL_34: - v12 = v14 + v15; - v11 = a1 + v13; - } -LABEL_35: - - if (!_vm->_globals.PUBEXIT) - _vm->_graphicsManager.AFF_SPRITES(); - if (souris_flag != 1) - goto LABEL_54; - if (btsouris == 23) - goto LABEL_45; - - if (a1 >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || (signed int)v14 <= 1 || v13 <= 1) { - if (btsouris != 23) - goto LABEL_54; - -LABEL_45: - if (a1 < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x) { - if ((signed int)(v14 + v15) > _vm->_graphicsManager.max_x) - v14 -= v14 + v15 - _vm->_graphicsManager.max_x; - if (a1 + v13 > _vm->_graphicsManager.max_y) - v13 -= a1 + v13 - _vm->_graphicsManager.max_y; - - if ((signed int)v14 > 1 && v13 > 1) { - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); - } - } - goto LABEL_54; - } - - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, a1 + 300, souris_n); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); - -LABEL_54: - _vm->_globals.vitesse = 2; - - do { - for (;;) { - while (CASSE || _vm->_globals.iRegul != 1) { - if (CASSE != 1) - goto LABEL_63; - - if (lItCounter > 1) - goto LABEL_65; - } - - if (_vm->_globals.vitesse != 2) - break; - - if (lItCounter > 9) - goto LABEL_65; - } -LABEL_63: - ; - } while (_vm->_globals.iRegul == 3 && lItCounter <= 15); - -LABEL_65: - _vm->_globals.vitesse = 2; - lItCounter = 0; - - if (_vm->_graphicsManager.DOUBLE_ECRAN != 1 || _vm->_graphicsManager.no_scroll == 1) { - _vm->_graphicsManager.Affiche_Segment_Vesa(); - } else { - if (_vm->_graphicsManager.no_scroll != 2) { - if (XMOUSE() > _vm->_graphicsManager.SCROLL + 620) - _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; - - if (XMOUSE() < _vm->_graphicsManager.SCROLL + 10) - _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; - } - - if (_vm->_graphicsManager.SCROLL < 0) - _vm->_graphicsManager.SCROLL = 0; - - if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) - _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; - - if (_vm->_graphicsManager.SDL_ECHELLE) - v4 = _vm->_graphicsManager.Magic_Number(_vm->_graphicsManager.SCROLL); - else - v4 = _vm->_graphicsManager.SCROLL; - - if (_vm->_graphicsManager.OLD_SCROLL == v4) { - _vm->_graphicsManager.Affiche_Segment_Vesa(); - } else { - _vm->_fontManager.TEXTE_OFF(9); - _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) { - if (_vm->_graphicsManager.Winbpp == 2) { - v5 = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v5); - } else { - v6 = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v6); - } - - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.Reel_Zoom(0, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.Reel_Zoom(20, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.Reel_Zoom(SCREEN_WIDTH, _vm->_graphicsManager.SDL_ECHELLE)); - _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.Reel_Zoom(440, _vm->_graphicsManager.SDL_ECHELLE)); - } else { - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); - - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); - } - - if (!_vm->_globals.BPP_NOAFF) { - // TODO: Useful for future dirty rect processing? -// SDL_UpdateRects(LinuxScr, 1, dstrect); - } - if (_vm->_globals.NBBLOC) { - v7 = 1; - v10 = _vm->_globals.NBBLOC + 1; - - do { - if (_vm->_globals.BLOC[v7].field0 == 1) - _vm->_globals.BLOC[v7].field0 = 0; - ++v7; - } while (v10 != v7); - } - - _vm->_globals.NBBLOC = 0; - start_x = v4; - _vm->_graphicsManager.ofscroll = v4; - _vm->_graphicsManager.SCROLL = v4; - } - - _vm->_graphicsManager.OLD_SCROLL = v4; - start_x = v4; - _vm->_graphicsManager.ofscroll = v4; - } - - souris_bb = souris_b; - souris_b = 0; - if (souris_flag == 1) { - if (btsouris != 23) { - if (a1 < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v12, v11); - goto LABEL_113; - } - - if (btsouris != 23) - goto LABEL_113; - } - - if (a1 < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); - } - } - -LABEL_113: - - _vm->_soundManager.VERIF_SOUND(); - return CONTROLE_MES(); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index d58b602735..b5c0ade35f 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -70,7 +70,6 @@ public: void MOUSE_ON(); void MOUSE_OFF(); void CHANGE_MOUSE(int id); - void VBL(); void CONTROLE_MES(); void delay(int delay); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 788af5a801..50c33dddaf 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1401,8 +1401,8 @@ void GraphicsManager::FIN_VISU() { _vm->_objectsManager.BOB_OFF(idx); } - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); + _vm->_graphicsManager.VBL(); for (int idx = 1; idx <= 20; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) @@ -2145,4 +2145,244 @@ Aff_Zoom_Larg_Cont1: } } +void GraphicsManager::VBL() { + int a1 = 0; + signed __int16 v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v10; + signed int v11 = 0; + signed int v12 = 0; + int v13 = 0; + unsigned int v14 = 0; + int v15 = 0; + + if (REDRAW) { + DD_Lock(); + if (_vm->_eventsManager.CASSE) { + CopyAsm(VESA_BUFFER); + REDRAW = 0; + } else { + if (_vm->_globals.iRegul == 3) + m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); + else + m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); + FileManager::DMESS(); + --REDRAW; + } + DD_Unlock(); + } + + if (_vm->_eventsManager.souris_flag) { + v1 = 20; + if (!_vm->_eventsManager.mouse_linux) + v1 = 10; + v2 = 20; + if (!_vm->_eventsManager.mouse_linux) + v2 = 15; + + v15 = _vm->_eventsManager.souris_x - v1; + a1 = _vm->_eventsManager.souris_y; + v14 = _vm->_eventsManager.souris_sizex; + v13 = _vm->_eventsManager.souris_sizey; + if (_vm->_eventsManager.btsouris == 23) { + v14 = _vm->_globals.OBJL; + v13 = _vm->_globals.OBJH; + goto LABEL_35; + } + + if (_vm->_eventsManager.CASSE) { + if (v15 < min_x) + v15 = min_x; + if (_vm->_eventsManager.souris_y < min_y) + a1 = min_y; + + if (_vm->_eventsManager.souris_sizex + v15 >= max_x) + v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x); + if (a1 + _vm->_eventsManager.souris_sizey < max_y) + goto LABEL_34; + + v3 = a1 + _vm->_eventsManager.souris_sizey - max_y; + } else { + if (v15 < min_x) + v15 = min_x - v1; + v2 = (signed __int16)v2; + if (_vm->_eventsManager.souris_y < min_y - (signed __int16)v2) + a1 = min_y - (signed __int16)v2; + if (_vm->_eventsManager.souris_sizex + v15 >= max_x) + v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); + if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) + goto LABEL_34; + + v3 = v2 + a1 + _vm->_eventsManager.souris_sizey - max_y; + } + + v13 = _vm->_eventsManager.souris_sizey - v3; +LABEL_34: + v12 = v14 + v15; + v11 = a1 + v13; + } +LABEL_35: + + if (!_vm->_globals.PUBEXIT) + AFF_SPRITES(); + if (_vm->_eventsManager.souris_flag != 1) + goto LABEL_54; + if (_vm->_eventsManager.btsouris == 23) + goto LABEL_45; + + if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { + if (_vm->_eventsManager.btsouris != 23) + goto LABEL_54; + +LABEL_45: + if (a1 < max_y && v15 < max_x) { + if ((signed int)(v14 + v15) > max_x) + v14 -= v14 + v15 - max_x; + if (a1 + v13 > max_y) + v13 -= a1 + v13 - max_y; + + if ((signed int)v14 > 1 && v13 > 1) { + Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Affiche_Perfect(VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); + Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + goto LABEL_54; + } + + Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Sprite_Vesa(VESA_BUFFER, _vm->_eventsManager.pointeur_souris, v15 + 300, a1 + 300, _vm->_eventsManager.souris_n); + Ajoute_Segment_Vesa(v15, a1, v12, v11); + +LABEL_54: + _vm->_globals.vitesse = 2; + + do { + for (;;) { + while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { + if (_vm->_eventsManager.CASSE != 1) + goto LABEL_63; + + if (_vm->_eventsManager.lItCounter > 1) + goto LABEL_65; + } + + if (_vm->_globals.vitesse != 2) + break; + + if (_vm->_eventsManager.lItCounter > 9) + goto LABEL_65; + } +LABEL_63: + ; + } while (_vm->_globals.iRegul == 3 && _vm->_eventsManager.lItCounter <= 15); + +LABEL_65: + _vm->_globals.vitesse = 2; + _vm->_eventsManager.lItCounter = 0; + + if (DOUBLE_ECRAN != 1 || no_scroll == 1) { + Affiche_Segment_Vesa(); + } else { + if (no_scroll != 2) { + if (_vm->_eventsManager.XMOUSE() > SCROLL + 620) + SCROLL += SPEED_SCROLL; + + if (_vm->_eventsManager.XMOUSE() < SCROLL + 10) + SCROLL -= SPEED_SCROLL; + } + + SCROLL = CLIP(SCROLL, 0, SCREEN_WIDTH); + + if (SDL_ECHELLE) + v4 = Magic_Number(SCROLL); + else + v4 = SCROLL; + + if (OLD_SCROLL == v4) { + Affiche_Segment_Vesa(); + } else { + _vm->_fontManager.TEXTE_OFF(9); + DD_Lock(); + if (SDL_ECHELLE) { + if (Winbpp == 2) { + v5 = Reel_Zoom(20, SDL_ECHELLE); + m_scroll16A(VESA_BUFFER, v4, 20, 640, 440, 0, v5); + } else { + v6 = Reel_Zoom(20, SDL_ECHELLE); + m_scroll2A(VESA_BUFFER, v4, 20, 640, 440, 0, v6); + } + + DD_Unlock(); + dstrect[0].left = Reel_Zoom(0, SDL_ECHELLE); + dstrect[0].top = Reel_Zoom(20, SDL_ECHELLE); + dstrect[0].setWidth(Reel_Zoom(SCREEN_WIDTH, SDL_ECHELLE)); + dstrect[0].setHeight(Reel_Zoom(440, SDL_ECHELLE)); + } else { + if (Winbpp == 2) + m_scroll16(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + else + m_scroll2(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + + DD_Unlock(); + dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); + } + + if (!_vm->_globals.BPP_NOAFF) { + // TODO: Useful for future dirty rect processing? +// SDL_UpdateRects(LinuxScr, 1, dstrect); + } + if (_vm->_globals.NBBLOC) { + v7 = 1; + v10 = _vm->_globals.NBBLOC + 1; + + do { + if (_vm->_globals.BLOC[v7].field0 == 1) + _vm->_globals.BLOC[v7].field0 = 0; + ++v7; + } while (v10 != v7); + } + + _vm->_globals.NBBLOC = 0; + start_x = v4; + ofscroll = v4; + SCROLL = v4; + } + + OLD_SCROLL = v4; + start_x = v4; + ofscroll = v4; + } + + _vm->_eventsManager.souris_bb = _vm->_eventsManager.souris_b; + _vm->_eventsManager.souris_b = 0; + if (_vm->_eventsManager.souris_flag == 1) { + if (_vm->_eventsManager.btsouris != 23) { + if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { + Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Ajoute_Segment_Vesa(v15, a1, v12, v11); + goto LABEL_113; + } + + if (_vm->_eventsManager.btsouris != 23) + goto LABEL_113; + } + + if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { + Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + +LABEL_113: + + _vm->_soundManager.VERIF_SOUND(); + return _vm->_eventsManager.CONTROLE_MES(); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e02343132c..a3a6e81624 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -155,6 +155,7 @@ public: int Reel_Reduc(int v, int percentage); void AFF_SPRITES(); void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); + void VBL(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0b41bf16aa..68c580c77b 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -588,10 +588,10 @@ void HopkinsEngine::INTRORUN() { byte paletteData2[PALETTE_EXT_BLOCK_SIZE]; memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE); - _eventsManager.VBL(); + _graphicsManager.VBL(); _eventsManager.souris_flag = 0; _globals.iRegul = 1; - _eventsManager.VBL(); + _graphicsManager.VBL(); _soundManager.WSOUND(16); _animationManager.CLS_ANM = 1; _animationManager.PLAY_ANM("J1.anm", 12, 12, 50); @@ -621,7 +621,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = 1; v2 = 0; do { - _eventsManager.VBL(); + _graphicsManager.VBL(); ++v2; } while (v2 <= 4); @@ -644,10 +644,10 @@ void HopkinsEngine::INTRORUN() { v4 = _eventsManager.YMOUSE(); _eventsManager.souris_xy(_eventsManager.souris_x + 4, v4); } - _eventsManager.VBL(); + _graphicsManager.VBL(); } while (v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); - _eventsManager.VBL(); + _graphicsManager.VBL(); _graphicsManager.no_scroll = 0; } @@ -670,7 +670,7 @@ void HopkinsEngine::INTRORUN() { v5 = 0; do { - _eventsManager.VBL(); + _graphicsManager.VBL(); ++v5; } while (v5 <= 4); @@ -678,12 +678,12 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _graphicsManager.FADE_INW(); for (i = 0; i < 200 / _globals.vitesse; ++i) - _eventsManager.VBL(); + _graphicsManager.VBL(); _animationManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(5, 3); _animationManager.BOBANIM_OFF(3); - _eventsManager.VBL(); + _graphicsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); v21 = *(uint16 *)&_graphicsManager.Palette[796]; v22 = _graphicsManager.Palette[798]; @@ -713,7 +713,7 @@ void HopkinsEngine::INTRORUN() { v8 = 0; do { - _eventsManager.VBL(); + _graphicsManager.VBL(); ++v8; } while (v8 <= 3); @@ -725,9 +725,9 @@ void HopkinsEngine::INTRORUN() { while (!_eventsManager.ESC_KEY) { if (v9 == 12) { _animationManager.BOBANIM_ON(3); - _eventsManager.VBL(); + _graphicsManager.VBL(); _soundManager.VOICE_MIX(6, 3); - _eventsManager.VBL(); + _graphicsManager.VBL(); _animationManager.BOBANIM_OFF(3); } @@ -748,7 +748,7 @@ void HopkinsEngine::INTRORUN() { v7 = 2 * v9; do { - _eventsManager.VBL(); + _graphicsManager.VBL(); ++v13; } while (v13 < v7); } @@ -759,7 +759,7 @@ void HopkinsEngine::INTRORUN() { v7 = 20 - v9; do { - _eventsManager.VBL(); + _graphicsManager.VBL(); ++v14; } while (v14 < v7); } @@ -768,17 +768,17 @@ void HopkinsEngine::INTRORUN() { if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); for (j = 1; j < 100 / _globals.vitesse; ++j) - _eventsManager.VBL(); + _graphicsManager.VBL(); _animationManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _animationManager.BOBANIM_OFF(3); for (k = 1; k < 60 / _globals.vitesse; ++k) - _eventsManager.VBL(); + _graphicsManager.VBL(); _animationManager.BOBANIM_ON(5); for (l = 0; l < 20 / _globals.vitesse; ++l) - _eventsManager.VBL(); + _graphicsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); @@ -790,7 +790,7 @@ void HopkinsEngine::INTRORUN() { _animationManager.BOBANIM_OFF(3); } - _eventsManager.VBL(); + _graphicsManager.VBL(); } _graphicsManager.FADE_OUTW(); @@ -867,7 +867,7 @@ void HopkinsEngine::PUBQUIT() { do { xp = _eventsManager.XMOUSE(); yp = _eventsManager.YMOUSE(); - _eventsManager.VBL(); + _graphicsManager.VBL(); if (_eventsManager.BMOUSE() == 1) mouseClicked = true; @@ -880,7 +880,7 @@ void HopkinsEngine::PUBQUIT() { while (1) { _globals.iRegul = 10; - _eventsManager.VBL(); + _graphicsManager.VBL(); } } return _graphicsManager.FADE_OUTW(); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 93d30f96a9..d25f642be2 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -168,7 +168,7 @@ int MenuManager::MENU() { AFFICHE_SPEED(v1, 230, 322, v9 + 4); AFFICHE_SPEED(v1, 230, 354, v8 + 6); AFFICHE_SPEED(v1, 230, 386, v7 + 8); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); if (_vm->_eventsManager.BMOUSE() == 1 && v2 > 0) v12 = 1; @@ -176,7 +176,7 @@ int MenuManager::MENU() { if (v2 == 1) { AFFICHE_SPEED(v1, 230, 259, 10); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); v6 = 1; } @@ -184,7 +184,7 @@ int MenuManager::MENU() { break; AFFICHE_SPEED(v1, 230, 291, 11); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); _vm->_globals.SORTIE = -1; @@ -201,14 +201,14 @@ int MenuManager::MENU() { break; AFFICHE_SPEED(v1, 230, 322, 12); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); CHOICE_OPTION(); } if (v2 == 4) { AFFICHE_SPEED(v1, 230, 354, 13); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); _vm->INTRORUN(); continue; @@ -216,7 +216,7 @@ int MenuManager::MENU() { if ( v2 == 5 ) { AFFICHE_SPEED(v1, 230, 386, 14); - _vm->_eventsManager.VBL(); + _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); v6 = -1; } -- cgit v1.2.3 From b6eba95cc1ddbdae511cf05369adb916258290a1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Sep 2012 21:20:07 +1000 Subject: HOPKINS: Minor renaming and bugifxes --- engines/hopkins/graphics.cpp | 36 ++++++++++++++++++------------------ engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 1 + 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 50c33dddaf..ca2e40b9fd 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -199,7 +199,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (!DOUBLE_ECRAN) { souris_max(); SCANLINE(SCREEN_WIDTH); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + max_x = SCREEN_WIDTH; DD_Lock(); Cls_Video(); if (Winbpp == 2) { @@ -217,7 +217,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { DD_Unlock(); } else { SCANLINE(SCREEN_WIDTH * 2); - _vm->_graphicsManager.max_x = SCREEN_WIDTH * 2; + max_x = SCREEN_WIDTH * 2; DD_Lock(); Cls_Video(); DD_Unlock(); @@ -1245,37 +1245,37 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int } while (yTemp != 1); } -void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) { - byte *v5; +void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int a3, int a4, int spriteIndex) { + const byte *v5; int i; - byte *v7; + const byte *v7; uint16 v8; - byte *v9; + const byte *v9; int v10; uint16 v11; uint16 v12; uint16 v13; uint16 v14; - byte *v15; - byte *v16; + const byte *v15; + const byte *v16; const byte *v17; byte *v18; int v19; - byte *v20; - byte *v21; + const byte *v20; + const byte *v21; int v22; unsigned int v23; byte *v24; const byte *v25; - byte *v26; - byte *v27; + const byte *v26; + const byte *v27; byte *v28; byte *v29; int v30; int v31; - v5 = a2 + 3; - for (i = a5; i; --i) + v5 = spriteData + 3; + for (i = spriteIndex; i; --i) v5 += READ_LE_UINT32(v5) + 16; v10 = 0; v7 = v5 + 4; @@ -1318,7 +1318,7 @@ void GraphicsManager::Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5) { v15 = v9 + 6; v16 = v15 + 4; v17 = READ_LE_UINT32(v15) + v15 + 4; - v18 = a3 + nbrligne2 * (a4 - 300) - 300 + a1; + v18 = a3 + nbrligne2 * (a4 - 300) - 300 + surface; v19 = 0; if (clip_flag) { do { @@ -1401,8 +1401,8 @@ void GraphicsManager::FIN_VISU() { _vm->_objectsManager.BOB_OFF(idx); } - _vm->_graphicsManager.VBL(); - _vm->_graphicsManager.VBL(); + VBL(); + VBL(); for (int idx = 1; idx <= 20; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) @@ -1501,7 +1501,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (_vm->_globals.NBBLOC == 0) return; - _vm->_graphicsManager.SDL_NBLOCS = _vm->_globals.NBBLOC; + SDL_NBLOCS = _vm->_globals.NBBLOC; for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { BlocItem &bloc = _vm->_globals.BLOC[idx]; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index a3a6e81624..0296acf75c 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -142,7 +142,7 @@ public: void Copy_Video_Vbe3(const byte *surface); void Copy_Video_Vbe16(const byte *surface); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height); - void Sprite_Vesa(byte *a1, byte *a2, int a3, int a4, int a5); + void Sprite_Vesa(byte *surface, const byte *spriteData, int a3, int a4, int spriteIndex); void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 68c580c77b..e515329eb4 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -40,6 +40,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _animationManager.setParent(this); _eventsManager.setParent(this); _fontManager.setParent(this); + _graphicsManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); _soundManager.setParent(this); -- cgit v1.2.3 From f20e411734ea67e940218fcd83f0bac7be2b41be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Sep 2012 07:48:21 +1000 Subject: HOPKINS: Rewrite of Sprite_Vesa from scratch --- engines/hopkins/graphics.cpp | 265 ++++++++++++++++++++----------------------- engines/hopkins/graphics.h | 12 +- 2 files changed, 136 insertions(+), 141 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ca2e40b9fd..c18fa352ef 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -169,7 +169,7 @@ void GraphicsManager::Cls_Video() { void GraphicsManager::LOAD_IMAGE(const Common::String &file) { Common::String filename = Common::String::format("%s.PCX", file.c_str()); CHARGE_ECRAN(filename); - GraphicsManager::INIT_TABLE(165, 170, Palette); + INIT_TABLE(165, 170, Palette); } void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { @@ -1245,152 +1245,137 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int } while (yTemp != 1); } -void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int a3, int a4, int spriteIndex) { - const byte *v5; - int i; - const byte *v7; - uint16 v8; - const byte *v9; - int v10; - uint16 v11; - uint16 v12; - uint16 v13; - uint16 v14; - const byte *v15; - const byte *v16; - const byte *v17; - byte *v18; - int v19; - const byte *v20; - const byte *v21; - int v22; - unsigned int v23; - byte *v24; - const byte *v25; - const byte *v26; - const byte *v27; - byte *v28; - byte *v29; - int v30; - int v31; - - v5 = spriteData + 3; - for (i = spriteIndex; i; --i) - v5 += READ_LE_UINT32(v5) + 16; - v10 = 0; - v7 = v5 + 4; - v8 = READ_LE_UINT16(v7); - v9 = v7 + 2; - v10 = READ_LE_UINT16(v9); +void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex) { + // Get a pointer to the start of the desired sprite + const byte *spriteP = spriteData + 3; + for (int i = spriteIndex; i; --i) + spriteP += READ_LE_UINT32(spriteP) + 16; + clip_x = 0; clip_y = 0; clip_flag = false; - clip_x1 = v8; - if ((uint16)(v8 + a3) > v8) { - if ((uint16)a3 < (uint16)(min_x + 300)) { - clip_x = min_x + 300 - a3; - clip_flag = true; - } - if ((uint16)(v10 + (uint16)a4) > (uint16)v10) { - if ((uint16)a4 < (uint16)(min_y + 300)) { - clip_y = min_y + 300 - a4; - clip_flag = true; - } - v11 = max_x + 300; - if ((uint16)a3 < (uint16)(max_x + 300)) { - if ((uint16)(v8 + a3) > v11) { - v12 = v8 + 10 - (v8 + a3 - v11); - if (v12 <= 10) - return; - clip_x1 = v12 - 10; - clip_flag = true; - } - v13 = max_y + 300; - if ((uint16)a4 < (uint16)(max_y + 300)) { - if ((uint16)(v10 + (uint16)a4) > v13) { - v14 = v10 + 10 - (v10 + (uint16)a4 - v13); - if (v14 <= 10) - return; - v10 -= 10; - clip_y1 = v10; - clip_flag = true; - } - v15 = v9 + 6; - v16 = v15 + 4; - v17 = READ_LE_UINT32(v15) + v15 + 4; - v18 = a3 + nbrligne2 * (a4 - 300) - 300 + surface; - v19 = 0; - if (clip_flag) { - do { - v31 = v10; - v29 = v18; - v19 = 0; - while (*v16 != -3) { - if (*v16 == -2) { - v27 = v16 + 1; - v10 = READ_LE_UINT16(v27); - do { - if (!clip_y && (uint16)v19 >= clip_x && (uint16)v19 < clip_x1) - *v18 = *v17; - ++v17; - ++v18; - ++v19; - --v10; - } while (v10); - - v16 = v27 + 2; - } else { - v26 = v16 + 1; - v10 = *(uint16 *)v26; - v18 += v10; - v19 += v10; - v16 = v26 + 2; - } - } - - if (clip_y) - --clip_y; - v16 += 3; - v18 = nbrligne2 + v29; - v10 = v31 - 1; - } while (v31 != 1); - } else { - do { - v30 = v10; - v28 = v18; - while (*v16 != -3) { - if (*v16 == -2) { - v21 = v16 + 1; - v10 = READ_LE_UINT16(v21); - - v22 = v10; - v23 = (unsigned int)v10 >> 2; - memcpy(v18, v17, 4 * v23); - v25 = (v17 + 4 * v23); - v24 = (v18 + 4 * v23); - v10 = v22 - 4 * v23; - memcpy(v24, v25, v10); - - v17 = v25 + v10; - v18 = v24 + v10; - v10 = 0; - v16 = v21 + 2; - } else { - v20 = v16 + 1; - v10 = READ_LE_UINT16(v20); - v18 += v10; - v16 = v20 + 2; - } - } - - v16 += 3; - v18 = nbrligne2 + v28; - v10 = v30 - 1; - } while (v30 != 1); + spriteP += 4; + int width = READ_LE_UINT16(spriteP); + spriteP += 2; + int height = READ_LE_UINT16(spriteP); + + // Clip X + clip_x1 = width; + if ((xp + width) <= (min_x + 300)) + return; + if (xp < (min_x + 300)) { + clip_x = min_x + 300 - xp; + clip_flag = true; + } + + // Clip Y + // TODO: This is weird, but it's that way in the original. Original game bug? + if ((yp + height) <= height) + return; + if (yp < (min_y + 300)) { + clip_y = min_y + 300 - yp; + clip_flag = true; + } + + // Clip X1 + if (xp >= (max_x + 300)) + return; + if ((xp + width) > (max_x + 300)) { + int xAmount = width + 10 - (xp + width - (max_x + 300)); + if (xAmount <= 10) + return; + + clip_x1 = xAmount - 10; + clip_flag = true; + } + + // Clip Y1 + if (yp >= (max_y + 300)) + return; + if ((yp + height) > (max_y + 300)) { + int yAmount = height + 10 - (yp + height - (max_y + 300)); + if (yAmount <= 10) + return; + + clip_y1 = yAmount - 10; + clip_flag = true; + } + + // Sprite display + + // Set up source + spriteP += 6; + int srcOffset = READ_LE_UINT16(spriteP); + spriteP += 4; + const byte *srcP = spriteP; + spriteP += srcOffset; + + // Set up surface destination + byte *destP = surface + (yp - 300) * nbrligne2 + (xp - 300); + + // Handling for clipped versus non-clipped + if (clip_flag) { + // Clipped version + for (int yc = 0; yc < height; ++yc, destP += nbrligne2) { + byte *tempDestP = destP; + byte byteVal; + int xc = 0; + + // Loop through sequences of bytes to skip or output + while ((byteVal = *srcP) != 253) { + ++srcP; + int width = READ_LE_UINT16(srcP); + + if (byteVal != 254) { + // Skip over output bytes + tempDestP += width; + xc += width; + } else { + // Output byte range + while (width-- > 0) { + // Get the next byte + byteVal = *spriteP; + if (clip_y == 0 && xc >= clip_x && xc < clip_x1) + // Not clipped, so display it + *tempDestP = byteVal; + + // Move to next pixel + xc++; + ++srcP; + ++tempDestP; } } + + srcP += 2; } + + if (clip_y > 0) + --clip_y; + srcP += 3; + } + } else { + // Non-clipped + for (int yc = 0; yc < height; ++yc, destP += nbrligne2) { + byte *tempDestP = destP; + byte byteVal; + + while ((byteVal = *srcP) != 253) { + ++srcP; + int width = READ_LE_UINT16(srcP); + srcP += 2; + + if (byteVal == 254) { + // Copy pixel range + Common::copy(spriteP, spriteP + width, tempDestP); + spriteP += width; + } + + tempDestP += width; + } + + // Skip over control byte and width + srcP += 3; } } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 0296acf75c..ca343cc1b4 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -142,7 +142,17 @@ public: void Copy_Video_Vbe3(const byte *surface); void Copy_Video_Vbe16(const byte *surface); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height); - void Sprite_Vesa(byte *surface, const byte *spriteData, int a3, int a4, int spriteIndex); + + /** + * Draws a sprite onto the screen + * @param surface Destination surface + * @param spriteData The raw data for a sprite set + * @param xp X co-ordinate. For some reason, starts from 300 = first column + * @param yp Y co-ordinate. FOr some reason, starts from 300 = top row + * @param spriteIndex Index of the sprite to draw + */ + void Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex); + void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); -- cgit v1.2.3 From 1a639302782e35307ee82d4961f7f784fb2fd917 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Sep 2012 09:55:40 +1000 Subject: HOPKINS: Disabled VBL() method code and added ScummVM cursor display. I'm not yet sure whether VBL was only concerned with displaying the cursor, but it had some loops using the lItCounter, so it was causing infinite loops. Whatever else VBL actually does besides cursor display will have to be converted to a more ScummVM friendly implementation. --- engines/hopkins/events.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/graphics.cpp | 9 ++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f3c1740d17..e2f6c9df1f 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -105,11 +105,13 @@ bool EventsManager::BMOUSE() { void EventsManager::MOUSE_OFF() { souris_flag = false; + g_system->showMouse(false); } void EventsManager::MOUSE_ON() { souris_on(); souris_flag = true; + g_system->showMouse(true); } void EventsManager::CHANGE_MOUSE(int id) { @@ -124,6 +126,53 @@ void EventsManager::CHANGE_MOUSE(int id) { if (OLD_ICONE != cursorId || !cursorId) { OLD_ICONE = cursorId; souris_n = cursorId; + + // Backup the current sprite clipping bounds and reset them + Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, + _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); + _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; + _vm->_graphicsManager.max_x = _vm->_globals.OBJL; + _vm->_graphicsManager.max_y = _vm->_globals.OBJH; + int pitch = _vm->_graphicsManager.nbrligne2; + _vm->_graphicsManager.nbrligne2 = _vm->_globals.OBJL; + + // Draw the cursor onto a temporary surface + byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL]; + Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0); + _vm->_graphicsManager.Sprite_Vesa(cursorSurface, pointeur_souris, 300, 300, cursorId); + + // Reset the clipping bounds + _vm->_graphicsManager.min_x = clipBounds.left; + _vm->_graphicsManager.min_y = clipBounds.top; + _vm->_graphicsManager.max_x = clipBounds.right; + _vm->_graphicsManager.max_y = clipBounds.bottom; + _vm->_graphicsManager.nbrligne2 = pitch; + + // Convert the cursor to the pixel format. At the moment, it's hardcoded + // to expect the game to be in 16-bit mode + uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL]; + const byte *srcP = cursorSurface; + uint16 *destP = cursorPixels; + + for (int yp = 0; yp < _vm->_globals.OBJH; ++yp) { + const byte *lineSrcP = srcP; + uint16 *lineDestP = destP; + + for (int xp = 0; xp < _vm->_globals.OBJL; ++xp) + *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; + + srcP += _vm->_globals.OBJL; + destP += _vm->_globals.OBJL; + } + + // Set the ScummVM cursor from the surface + Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); + g_system->setMouseCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, + 0, 0, 0, true, &pixelFormat); + + // Delete the cursor surface + delete[] cursorPixels; + delete[] cursorSurface; } } } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c18fa352ef..aa6f54529c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -114,7 +114,6 @@ void GraphicsManager::SET_MODE(int width, int height) { height = Reel_Zoom(height, SDL_ECHELLE); } - //Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 0, 10, 5, 0, 0); Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); if (bpp == 8) { @@ -2131,6 +2130,8 @@ Aff_Zoom_Larg_Cont1: } void GraphicsManager::VBL() { + // Bulk of method currently disabled +/* int a1 = 0; signed __int16 v1; int v2; @@ -2249,6 +2250,10 @@ LABEL_54: do { for (;;) { + // TODO: Figure out the purpose of this loop waiting on lItCounter.. + // maybe it's for cursor animatoin? + _vm->_eventsManager.delay(10); + while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { if (_vm->_eventsManager.CASSE != 1) goto LABEL_63; @@ -2365,7 +2370,7 @@ LABEL_65: } LABEL_113: - + */ _vm->_soundManager.VERIF_SOUND(); return _vm->_eventsManager.CONTROLE_MES(); } -- cgit v1.2.3 From 460b4eb17b02dd1bc5653d8f4c7732654bad77ed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Sep 2012 10:36:18 +1000 Subject: HOPKINS: Implemented AFFICHE_SPEED method --- engines/hopkins/globals.cpp | 1 + engines/hopkins/globals.h | 1 + engines/hopkins/graphics.cpp | 16 ++++++++++++++++ engines/hopkins/graphics.h | 1 + engines/hopkins/menu.cpp | 30 +++++++++++++----------------- engines/hopkins/menu.h | 1 - 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 55c943baa2..0a5bd707c1 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -119,6 +119,7 @@ Globals::Globals() { FLAG_VISIBLE = false; netscape = false; NOMARCHE = false; + NO_VISU = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 40ddc85c53..18aca79f25 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -273,6 +273,7 @@ public: bool netscape; bool NOMARCHE; int NBBLOC; + bool NO_VISU; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index aa6f54529c..b7eb48937c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2375,4 +2375,20 @@ LABEL_113: return _vm->_eventsManager.CONTROLE_MES(); } +void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { + int width, height; + + width = _vm->_objectsManager.Get_Largeur(spriteData, spriteIndex); + height = _vm->_objectsManager.Get_Hauteur(spriteData, spriteIndex); + if (*spriteData == 78) { + Affiche_Perfect(VESA_SCREEN, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); + Affiche_Perfect(VESA_BUFFER, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); + } else { + Sprite_Vesa(VESA_BUFFER, spriteData, xp + 300, yp + 300, spriteIndex); + Sprite_Vesa(VESA_SCREEN, spriteData, xp + 300, yp + 300, spriteIndex); + } + if (!_vm->_globals.NO_VISU) + Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index ca343cc1b4..0fc5222408 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -166,6 +166,7 @@ public: void AFF_SPRITES(); void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); void VBL(); + void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); }; } // End of namespace Hopkins diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index d25f642be2..b204223757 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -37,7 +37,7 @@ void MenuManager::setParent(HopkinsEngine *vm) { } int MenuManager::MENU() { - byte *v1 = NULL; + byte *spriteData = NULL; signed int v2; int v3; int v4; @@ -84,7 +84,7 @@ int MenuManager::MENU() { if (_vm->_globals.FR == 2) FileManager::CONSTRUIT_SYSTEM("MENUES.SPR"); - v1 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.MOUSE_ON(); _vm->_eventsManager.CHANGE_MOUSE(0); _vm->_eventsManager.btsouris = 0; @@ -163,11 +163,11 @@ int MenuManager::MENU() { break; } - AFFICHE_SPEED(v1, 230, 259, v11); - AFFICHE_SPEED(v1, 230, 291, v10 + 2); - AFFICHE_SPEED(v1, 230, 322, v9 + 4); - AFFICHE_SPEED(v1, 230, 354, v8 + 6); - AFFICHE_SPEED(v1, 230, 386, v7 + 8); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, v11); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, v10 + 2); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, v9 + 4); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, v8 + 6); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8); _vm->_graphicsManager.VBL(); if (_vm->_eventsManager.BMOUSE() == 1 && v2 > 0) @@ -175,7 +175,7 @@ int MenuManager::MENU() { } while (v12 != 1); if (v2 == 1) { - AFFICHE_SPEED(v1, 230, 259, 10); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); v6 = 1; @@ -183,7 +183,7 @@ int MenuManager::MENU() { if (v2 != 2) break; - AFFICHE_SPEED(v1, 230, 291, 11); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); @@ -200,14 +200,14 @@ int MenuManager::MENU() { if (v2 != 3) break; - AFFICHE_SPEED(v1, 230, 322, 12); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, 12); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); CHOICE_OPTION(); } if (v2 == 4) { - AFFICHE_SPEED(v1, 230, 354, 13); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); _vm->INTRORUN(); @@ -215,7 +215,7 @@ int MenuManager::MENU() { } if ( v2 == 5 ) { - AFFICHE_SPEED(v1, 230, 386, 14); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); v6 = -1; @@ -223,17 +223,13 @@ int MenuManager::MENU() { break; } - _vm->_globals.LIBERE_FICHIER(v1); + _vm->_globals.LIBERE_FICHIER(spriteData); _vm->_globals.DESACTIVE_INVENT = 0; _vm->_globals.FLAG_VISIBLE = 0; _vm->_graphicsManager.FADE_OUTW(); return v6; } -void MenuManager::AFFICHE_SPEED(byte *a1, int a2, int a3, int a4) { - warning("AFFICHE_SPEED"); -} - void MenuManager::CHOICE_OPTION() { warning("CHOICE_OPTION"); } diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index a120157ebe..8d3d8d696a 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -40,7 +40,6 @@ public: void setParent(HopkinsEngine *vm); int MENU(); - void AFFICHE_SPEED(byte *a1, int a2, int a3, int a4); void CHARGE_PARTIE(); }; -- cgit v1.2.3 From 2876790a086c6c6daa2b9c9afb3d11247aab406e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Sep 2012 11:11:26 +1000 Subject: HOPKINS: Added Txt structure with currently known structure offsets --- engines/hopkins/font.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 4ecab0c176..8cb86fbd9c 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -30,11 +30,25 @@ namespace Hopkins { class HopkinsEngine; +struct TxtItem { + int field0; + int field2; + int field4; + int field8; + int fieldA; + int fieldC; + int fieldE; + int field10; + int field3FC; + int field3FE; + int field40A; +}; + class FontManager { -public: +private: HopkinsEngine *_vm; - - +public: + TxtItem Txt[12]; public: void setParent(HopkinsEngine *vm); -- cgit v1.2.3 From 1597aff3c7e39fd7c6b0acf6ae4d2a9cffbef460 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Sep 2012 19:54:30 +1000 Subject: HOPKINS: Clean up of moving Txt array from Globals to FontManager --- engines/hopkins/events.cpp | 1 + engines/hopkins/font.cpp | 15 +++++++++++++++ engines/hopkins/font.h | 12 ++++++++++++ engines/hopkins/globals.cpp | 21 ++++++++------------- engines/hopkins/globals.h | 22 +++++----------------- engines/hopkins/hopkins.cpp | 1 + engines/hopkins/menu.cpp | 30 +++++++++++++++--------------- engines/hopkins/sound.cpp | 2 +- 8 files changed, 58 insertions(+), 46 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index e2f6c9df1f..531ae51456 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -218,6 +218,7 @@ void EventsManager::pollEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONDOWN: case Common::EVENT_RBUTTONUP: + return; default: diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index fe4e9df46c..4a99dd357a 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -30,6 +30,21 @@ void FontManager::setParent(HopkinsEngine *vm) { _vm = vm; } +void FontManager::clearAll() { + for (int idx = 0; idx < 11; ++idx) { + Txt[idx].field0 = 0; + Txt[idx].field12 = 0; + Txt[idx].field3FC = 0; + Txt[idx].field3FE = 0; + Txt[idx].field400 = 0; + Txt[idx].field404 = 0; + Txt[idx].field406 = 0; + Txt[idx].field408 = 0; + + ListeTxt[idx].field0 = 0; + } +} + void FontManager::TEXTE_OFF(int idx) { warning("TODO: TEXTE_OFF"); } diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 8cb86fbd9c..8402de0ba0 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -39,18 +39,30 @@ struct TxtItem { int fieldC; int fieldE; int field10; + int field12; int field3FC; int field3FE; + int field400; + int field404; + int field406; + int field408; int field40A; }; +struct ListeTxtItem { + int field0; +}; + + class FontManager { private: HopkinsEngine *_vm; public: TxtItem Txt[12]; + ListeTxtItem ListeTxt[11]; public: void setParent(HopkinsEngine *vm); + void clearAll(); void TEXTE_OFF(int idx); }; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0a5bd707c1..fd4fa48a66 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -22,8 +22,10 @@ #include "common/textconsole.h" #include "hopkins/globals.h" -#include "hopkins/graphics.h" #include "hopkins/files.h" +#include "hopkins/font.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" namespace Hopkins { @@ -144,6 +146,10 @@ Globals::~Globals() { free(PERSO); } +void Globals::setParent(HopkinsEngine *vm) { + _vm = vm; +} + void Globals::setConfig() { HOPIMAGE = "BUFFER"; HOPANIM = "ANIM"; @@ -189,18 +195,7 @@ void Globals::clearAll() { hauteur_boite = 0; largeur_boite = 0; - for (int idx = 0; idx < 11; ++idx) { - Txt[idx].field0 = 0; - Txt[idx].field12 = 0; - Txt[idx].field3FC = 0; - Txt[idx].field3FE = 0; - Txt[idx].field400 = 0; - Txt[idx].field404 = 0; - Txt[idx].field406 = 0; - Txt[idx].field408 = 0; - - ListeTxt[idx].field0 = 0; - } + _vm->_fontManager.clearAll(); INIT_VBOB(); ADR_FICHIER_OBJ = PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 18aca79f25..f018b187a2 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -28,21 +28,6 @@ namespace Hopkins { -struct TxtItem { - int field0; - int field12; - int field3FC; - int field3FE; - int field400; - int field404; - int field406; - int field408; -}; - -struct ListeTxtItem { - int field0; -}; - struct ZonePItem { int field0; int field2; @@ -156,10 +141,14 @@ struct BlocItem { int y2; }; +class HopkinsEngine; + /** * Engine Globals */ class Globals { +private: + HopkinsEngine *_vm; public: int FR; int SVGA; @@ -206,8 +195,6 @@ public: byte *ICONE; byte *BUF_ZONE; byte *CACHE_BANQUE[6]; - TxtItem Txt[11]; - ListeTxtItem ListeTxt[11]; ZonePItem ZoneP[105]; LigneItem Ligne[400]; LigneZoneItem LigneZone[400]; @@ -277,6 +264,7 @@ public: Globals(); ~Globals(); + void setParent(HopkinsEngine *vm); void setConfig(); void clearAll(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index e515329eb4..343f12b9d7 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -40,6 +40,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _animationManager.setParent(this); _eventsManager.setParent(this); _fontManager.setParent(this); + _globals.setParent(this); _graphicsManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b204223757..950acc5ab1 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -38,7 +38,7 @@ void MenuManager::setParent(HopkinsEngine *vm) { int MenuManager::MENU() { byte *spriteData = NULL; - signed int v2; + signed int menuIndex; int v3; int v4; signed int v6; @@ -99,25 +99,25 @@ int MenuManager::MENU() { if (g_system->getEventManager()->shouldQuit()) return -1; - v2 = 0; + menuIndex = 0; v3 = _vm->_eventsManager.XMOUSE(); v4 = _vm->_eventsManager.YMOUSE(); - if ((unsigned int)(v3 - 232) <= 0xB0) { + if ((unsigned int)(v3 - 232) <= 176) { if ((unsigned int)(v4 - 261) <= 23) - v2 = 1; + menuIndex = 1; if ((unsigned int)(v4 - 293) <= 23) - v2 = 2; + menuIndex = 2; if ((unsigned int)(v4 - 325) <= 22) - v2 = 3; + menuIndex = 3; if ((unsigned int)(v4 - 356) <= 23) - v2 = 4; + menuIndex = 4; if ((unsigned int)(v4 - 388) <= 23) - v2 = 5; + menuIndex = 5; } - switch (v2) { + switch (menuIndex) { case 0: v11 = 0; v10 = 0; @@ -170,17 +170,17 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8); _vm->_graphicsManager.VBL(); - if (_vm->_eventsManager.BMOUSE() == 1 && v2 > 0) + if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex > 0) v12 = 1; } while (v12 != 1); - if (v2 == 1) { + if (menuIndex == 1) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); v6 = 1; } - if (v2 != 2) + if (menuIndex != 2) break; _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); @@ -197,7 +197,7 @@ int MenuManager::MENU() { _vm->_globals.SORTIE = 0; } - if (v2 != 3) + if (menuIndex != 3) break; _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, 12); @@ -206,7 +206,7 @@ int MenuManager::MENU() { CHOICE_OPTION(); } - if (v2 == 4) { + if (menuIndex == 4) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); @@ -214,7 +214,7 @@ int MenuManager::MENU() { continue; } - if ( v2 == 5 ) { + if ( menuIndex == 5 ) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 219797b190..ea19b8fba7 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -36,7 +36,7 @@ void SoundManager::WSOUND_INIT() { } void SoundManager::VERIF_SOUND() { - warning("TODO: VERIF_SOUND"); +// warning("TODO: VERIF_SOUND"); } void SoundManager::LOAD_ANM_SOUND() { -- cgit v1.2.3 From e0c9eeae160d9521b3ece41da8a4edd7e5d19cc9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Sep 2012 20:45:08 +1000 Subject: HOPKINS: Bugfixes to making menu selections, and quitting game --- engines/hopkins/events.cpp | 8 ++++-- engines/hopkins/hopkins.cpp | 20 +++++--------- engines/hopkins/menu.cpp | 67 ++++++++++++++++++++++----------------------- 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 531ae51456..f934dcae6f 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -95,7 +95,7 @@ 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; + return souris_y + ofset_souris_y; } bool EventsManager::BMOUSE() { @@ -215,10 +215,12 @@ void EventsManager::pollEvents() { return; case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONDOWN: + souris_bb = true; + break; + case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: - + souris_bb = false; return; default: diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 343f12b9d7..41ca377d5e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -841,7 +841,8 @@ void HopkinsEngine::PERSONAGE2(const Common::String &s1, const Common::String &s } void HopkinsEngine::REST_SYSTEM() { - warning("REST_SYSTEM"); + quitGame(); + _eventsManager.CONTROLE_MES(); } void HopkinsEngine::PLAN_BETA() { @@ -874,18 +875,11 @@ void HopkinsEngine::PUBQUIT() { if (_eventsManager.BMOUSE() == 1) mouseClicked = true; } while (!mouseClicked && !g_system->getEventManager()->shouldQuit()); - - if ((unsigned int)(xp - 167) <= 302 && (unsigned int)(yp - 47) <= 387) { - warning("Try to Connect..."); - _eventsManager.delay(25000); -// open_URL((int)"http://www.hopkinsfbi.com"); - - while (1) { - _globals.iRegul = 10; - _graphicsManager.VBL(); - } - } - return _graphicsManager.FADE_OUTW(); + + // Original tried to open a web browser link here. Since ScummVM doesn't support + // that, it's being skipped in favour of simply exitting + + _graphicsManager.FADE_OUTW(); } void HopkinsEngine::COMPUT_HOPKINS(int a1) { diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 950acc5ab1..b1b230c82f 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/util.h" #include "hopkins/menu.h" #include "hopkins/files.h" #include "hopkins/hopkins.h" @@ -36,18 +37,18 @@ void MenuManager::setParent(HopkinsEngine *vm) { _vm = vm; } +enum MenuSelection { MENU_NONE = 0, PLAY_GAME = 1, LOAD_GAME = 2, OPTIONS = 3, INTRODUCTION = 4, QUIT = 5 }; + int MenuManager::MENU() { byte *spriteData = NULL; - signed int menuIndex; - int v3; - int v4; + MenuSelection menuIndex; + Common::Point mousePos; signed int v6; signed __int16 v7; signed __int16 v8; signed __int16 v9; signed __int16 v10; __int16 v11; - signed int v12; v6 = 0; while (!g_system->getEventManager()->shouldQuit()) { @@ -93,74 +94,72 @@ int MenuManager::MENU() { for (;;) { for (;;) { _vm->_soundManager.WSOUND(28); - v12 = 0; + // Loop to make menu selection + bool selectionMade = false; do { if (g_system->getEventManager()->shouldQuit()) return -1; - menuIndex = 0; - v3 = _vm->_eventsManager.XMOUSE(); - v4 = _vm->_eventsManager.YMOUSE(); + menuIndex = MENU_NONE; + mousePos = Common::Point(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); - if ((unsigned int)(v3 - 232) <= 176) { - if ((unsigned int)(v4 - 261) <= 23) - menuIndex = 1; - if ((unsigned int)(v4 - 293) <= 23) - menuIndex = 2; - if ((unsigned int)(v4 - 325) <= 22) - menuIndex = 3; - if ((unsigned int)(v4 - 356) <= 23) - menuIndex = 4; + if (ABS(mousePos.x - 232) <= 176) { + if (ABS(mousePos.y - 261) <= 23) + menuIndex = PLAY_GAME; + if (ABS(mousePos.y - 293) <= 23) + menuIndex = LOAD_GAME; + if (ABS(mousePos.y - 325) <= 22) + menuIndex = OPTIONS; + if (ABS(mousePos.y - 356) <= 23) + menuIndex = INTRODUCTION; - if ((unsigned int)(v4 - 388) <= 23) - menuIndex = 5; + if (ABS(mousePos.y - 388) <= 23) + menuIndex = QUIT; } switch (menuIndex) { - case 0: + case MENU_NONE: v11 = 0; v10 = 0; v9 = 0; v8 = 0; v7 = 0; break; - case 1: + case PLAY_GAME: v11 = 1; v10 = 0; v9 = 0; v8 = 0; v7 = 0; break; - case 2: + case LOAD_GAME: v11 = 0; v10 = 1; v9 = 0; v8 = 0; v7 = 0; break; - case 3: + case OPTIONS: v11 = 0; v10 = 0; v9 = 1; v8 = 0; v7 = 0; break; - case 4: + case INTRODUCTION: v11 = 0; v10 = 0; v9 = 0; v8 = 1; v7 = 0; break; - case 5: + case QUIT: v11 = 0; v10 = 0; v9 = 0; v8 = 0; v7 = 1; - default: - break; } _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, v11); @@ -170,17 +169,17 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8); _vm->_graphicsManager.VBL(); - if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex > 0) - v12 = 1; - } while (v12 != 1); + if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex != MENU_NONE) + selectionMade = 1; + } while (!selectionMade); - if (menuIndex == 1) { + if (menuIndex == PLAY_GAME) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); v6 = 1; } - if (menuIndex != 2) + if (menuIndex != LOAD_GAME) break; _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); @@ -206,7 +205,7 @@ int MenuManager::MENU() { CHOICE_OPTION(); } - if (menuIndex == 4) { + if (menuIndex == INTRODUCTION) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); @@ -214,7 +213,7 @@ int MenuManager::MENU() { continue; } - if ( menuIndex == 5 ) { + if ( menuIndex == QUIT) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); _vm->_graphicsManager.VBL(); _vm->_eventsManager.delay(200); -- cgit v1.2.3 From 01bcd87ba43482ef5e773fc6abdf3cb0e918bbe5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Sep 2012 10:59:52 +1000 Subject: HOPKINS: Initial implementation of CHOICE_OPTION and AFF_SPRITES --- engines/hopkins/dialogs.cpp | 271 +++++++++++++++++++++++++++++++++++++ engines/hopkins/dialogs.h | 44 ++++++ engines/hopkins/events.cpp | 257 ++++++++++++++++++++++++++++++++++- engines/hopkins/events.h | 1 + engines/hopkins/font.h | 6 +- engines/hopkins/globals.cpp | 15 ++- engines/hopkins/globals.h | 30 +++++ engines/hopkins/graphics.cpp | 315 +++++++++---------------------------------- engines/hopkins/graphics.h | 6 +- engines/hopkins/hopkins.cpp | 36 ++--- engines/hopkins/menu.cpp | 37 +++-- engines/hopkins/menu.h | 2 - engines/hopkins/module.mk | 1 + engines/hopkins/objects.cpp | 313 ++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/objects.h | 33 +++++ engines/hopkins/sound.cpp | 17 +++ engines/hopkins/sound.h | 14 ++ 17 files changed, 1099 insertions(+), 299 deletions(-) create mode 100644 engines/hopkins/dialogs.cpp create mode 100644 engines/hopkins/dialogs.h diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp new file mode 100644 index 0000000000..fdcdc48931 --- /dev/null +++ b/engines/hopkins/dialogs.cpp @@ -0,0 +1,271 @@ +/* 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 _globals.FRee software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the _globals.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 _globals.FRee Software + * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/scummsys.h" +#include "common/events.h" +#include "common/util.h" +#include "hopkins/dialogs.h" +#include "hopkins/events.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" +#include "hopkins/sound.h" + +namespace Hopkins { + +void OptionsDialog::show(HopkinsEngine *vm) { + bool doneFlag; + + doneFlag = false; + vm->_eventsManager.CHANGE_MOUSE(0); + vm->_eventsManager.VBL(); + if (vm->_globals.FR == 1) + FileManager::CONSTRUIT_SYSTEM("OPTIFR.SPR"); + if (!vm->_globals.FR) + FileManager::CONSTRUIT_SYSTEM("OPTIAN.SPR"); + if (vm->_globals.FR == 2) + FileManager::CONSTRUIT_SYSTEM("OPTIES.SPR"); + + vm->_globals.OPTION_SPR = FileManager::CHARGE_FICHIER(vm->_globals.NFICHIER); + vm->_globals.OPTION_FLAG = true; + + do { + if (vm->_eventsManager.BMOUSE()) { + Common::Point mousePos(vm->_eventsManager.XMOUSE(), vm->_eventsManager.YMOUSE()); + mousePos.x = vm->_eventsManager.XMOUSE(); + mousePos.y = vm->_eventsManager.YMOUSE(); + + if (!vm->_soundManager.MUSICOFF) { + if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { + ++vm->_soundManager.MUSICVOL; + vm->_soundManager.OLD_MUSICVOL = vm->_soundManager.MUSICVOL; + + if (vm->_soundManager.MUSICVOL <= 12) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + vm->_soundManager.MUSICVOL = 12; + vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + } + + if (!vm->_soundManager.MUSICOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + --vm->_soundManager.MUSICVOL; + if (vm->_soundManager.MUSICVOL >= 0) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + vm->_soundManager.MUSICVOL = 0; + + vm->_soundManager.OLD_MUSICVOL = vm->_soundManager.MUSICVOL; + vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + } + } + if (!vm->_soundManager.SOUNDOFF) { + if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { + ++vm->_soundManager.SOUNDVOL; + if (vm->_soundManager.SOUNDVOL <= 16) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + vm->_soundManager.SOUNDVOL = 16; + vm->_soundManager.OLD_SOUNDVOL = vm->_soundManager.SOUNDVOL; + vm->_soundManager.MODSetSampleVolume(); + } + + if (!vm->_soundManager.SOUNDOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { + --vm->_soundManager.SOUNDVOL; + if (vm->_soundManager.SOUNDVOL >= 0) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + vm->_soundManager.SOUNDVOL = 0; + vm->_soundManager.OLD_SOUNDVOL = vm->_soundManager.SOUNDVOL; + vm->_soundManager.MODSetSampleVolume(); + } + } + + if (!vm->_soundManager.VOICEOFF) { + if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { + ++vm->_soundManager.VOICEVOL; + + if (vm->_soundManager.VOICEVOL <= 16) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + vm->_soundManager.VOICEVOL = 16; + vm->_soundManager.OLD_VOICEVOL = vm->_soundManager.VOICEVOL; + vm->_soundManager.MODSetVoiceVolume(); + } + + if (!vm->_soundManager.VOICEOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + --vm->_soundManager.VOICEVOL; + if (vm->_soundManager.VOICEVOL >= 0) + vm->_soundManager.PLAY_SOUND("bruit2.wav"); + else + vm->_soundManager.VOICEVOL = 0; + vm->_soundManager.OLD_VOICEVOL = vm->_soundManager.VOICEVOL; + vm->_soundManager.MODSetVoiceVolume(); + } + } + + if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 194 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) + vm->_soundManager.TEXTOFF = vm->_soundManager.TEXTOFF != 1; + + if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) + vm->_soundManager.VOICEOFF = vm->_soundManager.VOICEOFF != 1; + if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { + if (vm->_soundManager.MUSICOFF == 1) { + vm->_soundManager.MUSICOFF = 0; + vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + } else { + vm->_soundManager.MUSICOFF = 1; + vm->_soundManager.MODSetMusicVolume(0); + } + } + + if (mousePos.x >= vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) + vm->_soundManager.SOUNDOFF = vm->_soundManager.SOUNDOFF != 1; + } + } + } + + if (mousePos.x >= vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { + vm->_globals.SORTIE = 300; + doneFlag = true; + } + if (mousePos.x >= vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) + doneFlag = 1; + if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { + switch (vm->_graphicsManager.SPEED_SCROLL) { + case 1: + vm->_graphicsManager.SPEED_SCROLL = 2; + break; + case 2: + vm->_graphicsManager.SPEED_SCROLL = 4; + break; + case 4: + vm->_graphicsManager.SPEED_SCROLL = 8; + break; + case 8: + vm->_graphicsManager.SPEED_SCROLL = 16; + break; + case 16: + vm->_graphicsManager.SPEED_SCROLL = 32; + break; + case 32: + vm->_graphicsManager.SPEED_SCROLL = 48; + break; + case 48: + vm->_graphicsManager.SPEED_SCROLL = 64; + break; + case 64: + vm->_graphicsManager.SPEED_SCROLL = 128; + break; + case 128: + vm->_graphicsManager.SPEED_SCROLL = 160; + break; + case 160: + vm->_graphicsManager.SPEED_SCROLL = 320; + break; + case 320: + vm->_graphicsManager.SPEED_SCROLL = 1; + break; + } + } + + if (mousePos.x >= vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) + vm->_globals.vitesse = 2; + if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) + vm->_globals.SVGA = 2; + if (mousePos.x < vm->_graphicsManager.ofscroll + 165 || mousePos.x > vm->_graphicsManager.ofscroll + 496 || (unsigned __int16)(mousePos.y - 107) > 0xD3u) + doneFlag = true; + } + + if (!vm->_graphicsManager.MANU_SCROLL) + vm->_globals.opt_scrtype = 2; + if (vm->_graphicsManager.MANU_SCROLL == 1) + vm->_globals.opt_scrtype = 1; + if (vm->_globals.vitesse == 1) + vm->_globals.opt_vitesse = 6; + if (vm->_globals.vitesse == 2) + vm->_globals.opt_vitesse = 5; + if (vm->_globals.vitesse == 3) + vm->_globals.opt_vitesse = 4; + if (!vm->_soundManager.TEXTOFF) + vm->_globals.opt_txt = 7; + if (vm->_soundManager.TEXTOFF == 1) + vm->_globals.opt_txt = 8; + if (!vm->_soundManager.VOICEOFF) + vm->_globals.opt_voice = 7; + if (vm->_soundManager.VOICEOFF == 1) + vm->_globals.opt_voice = 8; + if (!vm->_soundManager.SOUNDOFF) + vm->_globals.opt_sound = 7; + if (vm->_soundManager.SOUNDOFF == 1) + vm->_globals.opt_sound = 8; + if (!vm->_soundManager.MUSICOFF) + vm->_globals.opt_music = 7; + if (vm->_soundManager.MUSICOFF == 1) + vm->_globals.opt_music = 8; + if (vm->_globals.SVGA == 1) + vm->_globals.opt_anm = 10; + if (vm->_globals.SVGA == 2) + vm->_globals.opt_anm = 9; + if (vm->_globals.SVGA == 3) + vm->_globals.opt_anm = 11; + if (vm->_graphicsManager.SPEED_SCROLL == 1) + vm->_globals.opt_scrspeed = 12; + if (vm->_graphicsManager.SPEED_SCROLL == 2) + vm->_globals.opt_scrspeed = 13; + if (vm->_graphicsManager.SPEED_SCROLL == 4) + vm->_globals.opt_scrspeed = 14; + if (vm->_graphicsManager.SPEED_SCROLL == 8) + vm->_globals.opt_scrspeed = 15; + if (vm->_graphicsManager.SPEED_SCROLL == 16) + vm->_globals.opt_scrspeed = 16; + if (vm->_graphicsManager.SPEED_SCROLL == 32) + vm->_globals.opt_scrspeed = 17; + if (vm->_graphicsManager.SPEED_SCROLL == 48) + vm->_globals.opt_scrspeed = 18; + if (vm->_graphicsManager.SPEED_SCROLL == 64) + vm->_globals.opt_scrspeed = 19; + if (vm->_graphicsManager.SPEED_SCROLL == 128) + vm->_globals.opt_scrspeed = 20; + if (vm->_graphicsManager.SPEED_SCROLL == 160) + vm->_globals.opt_scrspeed = 21; + if (vm->_graphicsManager.SPEED_SCROLL == 320) + vm->_globals.opt_scrspeed = 22; + if (vm->_graphicsManager.SPEED_SCROLL == 640) + vm->_globals.opt_scrspeed = 23; + + vm->_eventsManager.VBL(); + } while (!doneFlag); + + vm->_graphicsManager.SCOPY(vm->_graphicsManager.VESA_SCREEN, vm->_graphicsManager.ofscroll + 164, + 107, 335, 215, vm->_graphicsManager.VESA_BUFFER, vm->_graphicsManager.ofscroll + 164, 107); + vm->_graphicsManager.Ajoute_Segment_Vesa(vm->_graphicsManager.ofscroll + 164, 107, + vm->_graphicsManager.ofscroll + 498, 320); + + vm->_globals.OPTION_SPR = vm->_globals.dos_free2(vm->_globals.OPTION_SPR); + vm->_globals.OPTION_FLAG = false; +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h new file mode 100644 index 0000000000..caaa9f5575 --- /dev/null +++ b/engines/hopkins/dialogs.h @@ -0,0 +1,44 @@ +/* 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_DIALOGS_H +#define HOPKINS_DIALOGS_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "common/error.h" + +namespace Hopkins { + +class HopkinsEngine; + +/** + * Class for showing the options dialog + */ +class OptionsDialog { +public: + static void show(HopkinsEngine *vm); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_MENU_H */ diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f934dcae6f..fc7c12238a 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -216,11 +216,11 @@ void EventsManager::pollEvents() { case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: - souris_bb = true; + souris_b = true; break; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: - souris_bb = false; + souris_b = false; return; default: @@ -229,4 +229,257 @@ void EventsManager::pollEvents() { } } +void EventsManager::VBL() { + // Bulk of method currently disabled + + // Move any button press status into the active button status state + souris_bb = souris_b; + souris_b = false; + + if (!_vm->_globals.PUBEXIT) + _vm->_objectsManager.AFF_SPRITES(); +/* + int a1 = 0; + signed __int16 v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v10; + signed int v11 = 0; + signed int v12 = 0; + int v13 = 0; + unsigned int v14 = 0; + int v15 = 0; + + if (REDRAW) { + DD_Lock(); + if (_vm->_eventsManager.CASSE) { + CopyAsm(VESA_BUFFER); + REDRAW = 0; + } else { + if (_vm->_globals.iRegul == 3) + m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); + else + m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); + FileManager::DMESS(); + --REDRAW; + } + DD_Unlock(); + } + + if (_vm->_eventsManager.souris_flag) { + v1 = 20; + if (!_vm->_eventsManager.mouse_linux) + v1 = 10; + v2 = 20; + if (!_vm->_eventsManager.mouse_linux) + v2 = 15; + + v15 = _vm->_eventsManager.souris_x - v1; + a1 = _vm->_eventsManager.souris_y; + v14 = _vm->_eventsManager.souris_sizex; + v13 = _vm->_eventsManager.souris_sizey; + if (_vm->_eventsManager.btsouris == 23) { + v14 = _vm->_globals.OBJL; + v13 = _vm->_globals.OBJH; + goto LABEL_35; + } + + if (_vm->_eventsManager.CASSE) { + if (v15 < min_x) + v15 = min_x; + if (_vm->_eventsManager.souris_y < min_y) + a1 = min_y; + + if (_vm->_eventsManager.souris_sizex + v15 >= max_x) + v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x); + if (a1 + _vm->_eventsManager.souris_sizey < max_y) + goto LABEL_34; + + v3 = a1 + _vm->_eventsManager.souris_sizey - max_y; + } else { + if (v15 < min_x) + v15 = min_x - v1; + v2 = (signed __int16)v2; + if (_vm->_eventsManager.souris_y < min_y - (signed __int16)v2) + a1 = min_y - (signed __int16)v2; + if (_vm->_eventsManager.souris_sizex + v15 >= max_x) + v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); + if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) + goto LABEL_34; + + v3 = v2 + a1 + _vm->_eventsManager.souris_sizey - max_y; + } + + v13 = _vm->_eventsManager.souris_sizey - v3; +LABEL_34: + v12 = v14 + v15; + v11 = a1 + v13; + } +LABEL_35: + + if (!_vm->_globals.PUBEXIT) + AFF_SPRITES(); + if (_vm->_eventsManager.souris_flag != 1) + goto LABEL_54; + if (_vm->_eventsManager.btsouris == 23) + goto LABEL_45; + + if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { + if (_vm->_eventsManager.btsouris != 23) + goto LABEL_54; + +LABEL_45: + if (a1 < max_y && v15 < max_x) { + if ((signed int)(v14 + v15) > max_x) + v14 -= v14 + v15 - max_x; + if (a1 + v13 > max_y) + v13 -= a1 + v13 - max_y; + + if ((signed int)v14 > 1 && v13 > 1) { + Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Affiche_Perfect(VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); + Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + goto LABEL_54; + } + + Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Sprite_Vesa(VESA_BUFFER, _vm->_eventsManager.pointeur_souris, v15 + 300, a1 + 300, _vm->_eventsManager.souris_n); + Ajoute_Segment_Vesa(v15, a1, v12, v11); + +LABEL_54: + _vm->_globals.vitesse = 2; + + do { + for (;;) { + // TODO: Figure out the purpose of this loop waiting on lItCounter.. + // maybe it's for cursor animatoin? + _vm->_eventsManager.delay(10); + + while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { + if (_vm->_eventsManager.CASSE != 1) + goto LABEL_63; + + if (_vm->_eventsManager.lItCounter > 1) + goto LABEL_65; + } + + if (_vm->_globals.vitesse != 2) + break; + + if (_vm->_eventsManager.lItCounter > 9) + goto LABEL_65; + } +LABEL_63: + ; + } while (_vm->_globals.iRegul == 3 && _vm->_eventsManager.lItCounter <= 15); + +LABEL_65: + _vm->_globals.vitesse = 2; + _vm->_eventsManager.lItCounter = 0; + + if (DOUBLE_ECRAN != 1 || no_scroll == 1) { + Affiche_Segment_Vesa(); + } else { + if (no_scroll != 2) { + if (_vm->_eventsManager.XMOUSE() > SCROLL + 620) + SCROLL += SPEED_SCROLL; + + if (_vm->_eventsManager.XMOUSE() < SCROLL + 10) + SCROLL -= SPEED_SCROLL; + } + + SCROLL = CLIP(SCROLL, 0, SCREEN_WIDTH); + + if (SDL_ECHELLE) + v4 = Magic_Number(SCROLL); + else + v4 = SCROLL; + + if (OLD_SCROLL == v4) { + Affiche_Segment_Vesa(); + } else { + _vm->_fontManager.TEXTE_OFF(9); + DD_Lock(); + if (SDL_ECHELLE) { + if (Winbpp == 2) { + v5 = Reel_Zoom(20, SDL_ECHELLE); + m_scroll16A(VESA_BUFFER, v4, 20, 640, 440, 0, v5); + } else { + v6 = Reel_Zoom(20, SDL_ECHELLE); + m_scroll2A(VESA_BUFFER, v4, 20, 640, 440, 0, v6); + } + + DD_Unlock(); + dstrect[0].left = Reel_Zoom(0, SDL_ECHELLE); + dstrect[0].top = Reel_Zoom(20, SDL_ECHELLE); + dstrect[0].setWidth(Reel_Zoom(SCREEN_WIDTH, SDL_ECHELLE)); + dstrect[0].setHeight(Reel_Zoom(440, SDL_ECHELLE)); + } else { + if (Winbpp == 2) + m_scroll16(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + else + m_scroll2(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + + DD_Unlock(); + dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); + } + + if (!_vm->_globals.BPP_NOAFF) { + // TODO: Useful for future dirty rect processing? +// SDL_UpdateRects(LinuxScr, 1, dstrect); + } + if (_vm->_globals.NBBLOC) { + v7 = 1; + v10 = _vm->_globals.NBBLOC + 1; + + do { + if (_vm->_globals.BLOC[v7].field0 == 1) + _vm->_globals.BLOC[v7].field0 = 0; + ++v7; + } while (v10 != v7); + } + + _vm->_globals.NBBLOC = 0; + start_x = v4; + ofscroll = v4; + SCROLL = v4; + } + + OLD_SCROLL = v4; + start_x = v4; + ofscroll = v4; + } + + _vm->_eventsManager.souris_bb = _vm->_eventsManager.souris_b; + _vm->_eventsManager.souris_b = 0; + if (_vm->_eventsManager.souris_flag == 1) { + if (_vm->_eventsManager.btsouris != 23) { + if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { + Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Ajoute_Segment_Vesa(v15, a1, v12, v11); + goto LABEL_113; + } + + if (_vm->_eventsManager.btsouris != 23) + goto LABEL_113; + } + + if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { + Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); + Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + } + } + +LABEL_113: + */ + _vm->_soundManager.VERIF_SOUND(); + return _vm->_eventsManager.CONTROLE_MES(); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index b5c0ade35f..a288228fb7 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -73,6 +73,7 @@ public: void CONTROLE_MES(); void delay(int delay); + void VBL(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 8402de0ba0..fb53401f13 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -51,6 +51,10 @@ struct TxtItem { struct ListeTxtItem { int field0; + int x1; + int y1; + int x2; + int y2; }; @@ -59,7 +63,7 @@ private: HopkinsEngine *_vm; public: TxtItem Txt[12]; - ListeTxtItem ListeTxt[11]; + ListeTxtItem ListeTxt[12]; public: void setParent(HopkinsEngine *vm); void clearAll(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fd4fa48a66..cd8915cbc9 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -73,6 +73,16 @@ Globals::Globals() { Max_Perso_Y = 0; Max_Propre = 0; NBBLOC = 0; + opt_scrtype = 0; + opt_scrspeed = 0; + opt_vitesse = 0; + opt_sound = 0; + opt_voice = 0; + opt_music = 0; + opt_txt = 0; + opt_anm = 0; + NBTRI = 0; + AFFINVEN = 0; // Initialise pointers ICONE = NULL; @@ -99,8 +109,7 @@ Globals::Globals() { ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; - - + OPTION_SPR = NULL; // Reset flags MUSICOFF = false; @@ -122,6 +131,8 @@ Globals::Globals() { netscape = false; NOMARCHE = false; NO_VISU = false; + OPTION_FLAG = false; + CACHEFLAG = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f018b187a2..420df345d8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -68,6 +68,14 @@ struct BankItem { Common::String filename2; }; +struct ListeItem { + int field0; + int field2; + int field4; + int x2; + int y2; +}; + struct BobItem { int field0; byte *field4; @@ -141,6 +149,13 @@ struct BlocItem { int y2; }; +struct TriItem { + int field0; + int field2; + int field4; + int field6; +}; + class HopkinsEngine; /** @@ -207,6 +222,7 @@ public: VBobItem VBob[35]; ObjetWItem ObjetW[300]; BlocItem BLOC[250]; + ListeItem Liste[7]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -219,6 +235,7 @@ public: byte *essai2; byte *Bufferobjet; int INVENTAIRE[36]; + TriItem Tri[51]; byte *inventaire2; byte *GESTE; int OBJET_EN_COURS; @@ -261,6 +278,19 @@ public: bool NOMARCHE; int NBBLOC; bool NO_VISU; + byte *OPTION_SPR; + bool OPTION_FLAG; + int opt_anm; + int opt_vitesse; + int opt_scrtype; + int opt_scrspeed; + int opt_sound; + int opt_voice; + int opt_music; + int opt_txt; + int NBTRI; + bool CACHEFLAG; + int AFFINVEN; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b7eb48937c..048d07241f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1385,8 +1385,8 @@ void GraphicsManager::FIN_VISU() { _vm->_objectsManager.BOB_OFF(idx); } - VBL(); - VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); for (int idx = 1; idx <= 20; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) @@ -1653,10 +1653,6 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { return v; } -void GraphicsManager::AFF_SPRITES() { - warning("TODO: AFF_SPRITES"); -} - void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8) { const byte *v8; int i; @@ -2129,252 +2125,6 @@ Aff_Zoom_Larg_Cont1: } } -void GraphicsManager::VBL() { - // Bulk of method currently disabled -/* - int a1 = 0; - signed __int16 v1; - int v2; - int v3; - int v4; - int v5; - int v6; - signed __int16 v7; - int v10; - signed int v11 = 0; - signed int v12 = 0; - int v13 = 0; - unsigned int v14 = 0; - int v15 = 0; - - if (REDRAW) { - DD_Lock(); - if (_vm->_eventsManager.CASSE) { - CopyAsm(VESA_BUFFER); - REDRAW = 0; - } else { - if (_vm->_globals.iRegul == 3) - m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); - else - m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); - FileManager::DMESS(); - --REDRAW; - } - DD_Unlock(); - } - - if (_vm->_eventsManager.souris_flag) { - v1 = 20; - if (!_vm->_eventsManager.mouse_linux) - v1 = 10; - v2 = 20; - if (!_vm->_eventsManager.mouse_linux) - v2 = 15; - - v15 = _vm->_eventsManager.souris_x - v1; - a1 = _vm->_eventsManager.souris_y; - v14 = _vm->_eventsManager.souris_sizex; - v13 = _vm->_eventsManager.souris_sizey; - if (_vm->_eventsManager.btsouris == 23) { - v14 = _vm->_globals.OBJL; - v13 = _vm->_globals.OBJH; - goto LABEL_35; - } - - if (_vm->_eventsManager.CASSE) { - if (v15 < min_x) - v15 = min_x; - if (_vm->_eventsManager.souris_y < min_y) - a1 = min_y; - - if (_vm->_eventsManager.souris_sizex + v15 >= max_x) - v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x); - if (a1 + _vm->_eventsManager.souris_sizey < max_y) - goto LABEL_34; - - v3 = a1 + _vm->_eventsManager.souris_sizey - max_y; - } else { - if (v15 < min_x) - v15 = min_x - v1; - v2 = (signed __int16)v2; - if (_vm->_eventsManager.souris_y < min_y - (signed __int16)v2) - a1 = min_y - (signed __int16)v2; - if (_vm->_eventsManager.souris_sizex + v15 >= max_x) - v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); - if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) - goto LABEL_34; - - v3 = v2 + a1 + _vm->_eventsManager.souris_sizey - max_y; - } - - v13 = _vm->_eventsManager.souris_sizey - v3; -LABEL_34: - v12 = v14 + v15; - v11 = a1 + v13; - } -LABEL_35: - - if (!_vm->_globals.PUBEXIT) - AFF_SPRITES(); - if (_vm->_eventsManager.souris_flag != 1) - goto LABEL_54; - if (_vm->_eventsManager.btsouris == 23) - goto LABEL_45; - - if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { - if (_vm->_eventsManager.btsouris != 23) - goto LABEL_54; - -LABEL_45: - if (a1 < max_y && v15 < max_x) { - if ((signed int)(v14 + v15) > max_x) - v14 -= v14 + v15 - max_x; - if (a1 + v13 > max_y) - v13 -= a1 + v13 - max_y; - - if ((signed int)v14 > 1 && v13 > 1) { - Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Affiche_Perfect(VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); - Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); - } - } - goto LABEL_54; - } - - Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Sprite_Vesa(VESA_BUFFER, _vm->_eventsManager.pointeur_souris, v15 + 300, a1 + 300, _vm->_eventsManager.souris_n); - Ajoute_Segment_Vesa(v15, a1, v12, v11); - -LABEL_54: - _vm->_globals.vitesse = 2; - - do { - for (;;) { - // TODO: Figure out the purpose of this loop waiting on lItCounter.. - // maybe it's for cursor animatoin? - _vm->_eventsManager.delay(10); - - while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { - if (_vm->_eventsManager.CASSE != 1) - goto LABEL_63; - - if (_vm->_eventsManager.lItCounter > 1) - goto LABEL_65; - } - - if (_vm->_globals.vitesse != 2) - break; - - if (_vm->_eventsManager.lItCounter > 9) - goto LABEL_65; - } -LABEL_63: - ; - } while (_vm->_globals.iRegul == 3 && _vm->_eventsManager.lItCounter <= 15); - -LABEL_65: - _vm->_globals.vitesse = 2; - _vm->_eventsManager.lItCounter = 0; - - if (DOUBLE_ECRAN != 1 || no_scroll == 1) { - Affiche_Segment_Vesa(); - } else { - if (no_scroll != 2) { - if (_vm->_eventsManager.XMOUSE() > SCROLL + 620) - SCROLL += SPEED_SCROLL; - - if (_vm->_eventsManager.XMOUSE() < SCROLL + 10) - SCROLL -= SPEED_SCROLL; - } - - SCROLL = CLIP(SCROLL, 0, SCREEN_WIDTH); - - if (SDL_ECHELLE) - v4 = Magic_Number(SCROLL); - else - v4 = SCROLL; - - if (OLD_SCROLL == v4) { - Affiche_Segment_Vesa(); - } else { - _vm->_fontManager.TEXTE_OFF(9); - DD_Lock(); - if (SDL_ECHELLE) { - if (Winbpp == 2) { - v5 = Reel_Zoom(20, SDL_ECHELLE); - m_scroll16A(VESA_BUFFER, v4, 20, 640, 440, 0, v5); - } else { - v6 = Reel_Zoom(20, SDL_ECHELLE); - m_scroll2A(VESA_BUFFER, v4, 20, 640, 440, 0, v6); - } - - DD_Unlock(); - dstrect[0].left = Reel_Zoom(0, SDL_ECHELLE); - dstrect[0].top = Reel_Zoom(20, SDL_ECHELLE); - dstrect[0].setWidth(Reel_Zoom(SCREEN_WIDTH, SDL_ECHELLE)); - dstrect[0].setHeight(Reel_Zoom(440, SDL_ECHELLE)); - } else { - if (Winbpp == 2) - m_scroll16(VESA_BUFFER, v4, 20, 640, 440, 0, 20); - else - m_scroll2(VESA_BUFFER, v4, 20, 640, 440, 0, 20); - - DD_Unlock(); - dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); - } - - if (!_vm->_globals.BPP_NOAFF) { - // TODO: Useful for future dirty rect processing? -// SDL_UpdateRects(LinuxScr, 1, dstrect); - } - if (_vm->_globals.NBBLOC) { - v7 = 1; - v10 = _vm->_globals.NBBLOC + 1; - - do { - if (_vm->_globals.BLOC[v7].field0 == 1) - _vm->_globals.BLOC[v7].field0 = 0; - ++v7; - } while (v10 != v7); - } - - _vm->_globals.NBBLOC = 0; - start_x = v4; - ofscroll = v4; - SCROLL = v4; - } - - OLD_SCROLL = v4; - start_x = v4; - ofscroll = v4; - } - - _vm->_eventsManager.souris_bb = _vm->_eventsManager.souris_b; - _vm->_eventsManager.souris_b = 0; - if (_vm->_eventsManager.souris_flag == 1) { - if (_vm->_eventsManager.btsouris != 23) { - if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { - Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Ajoute_Segment_Vesa(v15, a1, v12, v11); - goto LABEL_113; - } - - if (_vm->_eventsManager.btsouris != 23) - goto LABEL_113; - } - - if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { - Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); - } - } - -LABEL_113: - */ - _vm->_soundManager.VERIF_SOUND(); - return _vm->_eventsManager.CONTROLE_MES(); -} - void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { int width, height; @@ -2391,4 +2141,65 @@ void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); } +void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY) { + int top; + int width; + int height; + int v11; + int height2; + int top2; + int left; + + left = x1; + top = y1; + width = x2; + height = y2; + + if (x1 < min_x) { + width = x2 - (min_x - x1); + left = min_x; + } + if (y1 < min_y) { + height = y2 - (min_y - y1); + top = min_y; + } + top2 = top; + if (top + height > max_y) + height = max_y - top; + v11 = left + width; + if (v11 > max_x) + width = max_x - left; + + if (width > 0 && height > 0) { + height2 = height; + Copy_Mem(surface, left, top2, width, height, destSurface, destX, destY); + Ajoute_Segment_Vesa(left, top2, left + width, top2 + height2); + } +} + +void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY) { + const byte *srcP; + byte *destP; + int yp; + int yCurrent; + byte *dest2P; + const byte *src2P; + unsigned int pitch; + + srcP = x1 + nbrligne2 * y1 + srcSurface; + destP = destX + nbrligne2 * destY + destSurface; + yp = height; + do { + yCurrent = yp; + memcpy(destP, srcP, 4 * (width >> 2)); + src2P = (srcP + 4 * (width >> 2)); + dest2P = (destP + 4 * (width >> 2)); + pitch = width - 4 * (width >> 2); + memcpy(dest2P, src2P, pitch); + destP = (dest2P + pitch + nbrligne2 - width); + srcP = (src2P + pitch + nbrligne2 - width); + yp = yCurrent - 1; + } while (yCurrent != 1); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 0fc5222408..3a3b4c5e9e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -156,17 +156,17 @@ public: void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); - void Ajoute_Segment_Vesa(int a1, int a2, int a3, int a4); + void Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2); int Magic_Number(int v); void Affiche_Segment_Vesa(); void CopyAsm(const byte *surface); void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); - void AFF_SPRITES(); void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); - void VBL(); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); + void SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY); + void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 41ca377d5e..61fb368794 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -590,10 +590,10 @@ void HopkinsEngine::INTRORUN() { byte paletteData2[PALETTE_EXT_BLOCK_SIZE]; memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE); - _graphicsManager.VBL(); + _eventsManager.VBL(); _eventsManager.souris_flag = 0; _globals.iRegul = 1; - _graphicsManager.VBL(); + _eventsManager.VBL(); _soundManager.WSOUND(16); _animationManager.CLS_ANM = 1; _animationManager.PLAY_ANM("J1.anm", 12, 12, 50); @@ -623,7 +623,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = 1; v2 = 0; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v2; } while (v2 <= 4); @@ -646,10 +646,10 @@ void HopkinsEngine::INTRORUN() { v4 = _eventsManager.YMOUSE(); _eventsManager.souris_xy(_eventsManager.souris_x + 4, v4); } - _graphicsManager.VBL(); + _eventsManager.VBL(); } while (v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); - _graphicsManager.VBL(); + _eventsManager.VBL(); _graphicsManager.no_scroll = 0; } @@ -672,7 +672,7 @@ void HopkinsEngine::INTRORUN() { v5 = 0; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v5; } while (v5 <= 4); @@ -680,12 +680,12 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _graphicsManager.FADE_INW(); for (i = 0; i < 200 / _globals.vitesse; ++i) - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(5, 3); _animationManager.BOBANIM_OFF(3); - _graphicsManager.VBL(); + _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); v21 = *(uint16 *)&_graphicsManager.Palette[796]; v22 = _graphicsManager.Palette[798]; @@ -715,7 +715,7 @@ void HopkinsEngine::INTRORUN() { v8 = 0; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v8; } while (v8 <= 3); @@ -727,9 +727,9 @@ void HopkinsEngine::INTRORUN() { while (!_eventsManager.ESC_KEY) { if (v9 == 12) { _animationManager.BOBANIM_ON(3); - _graphicsManager.VBL(); + _eventsManager.VBL(); _soundManager.VOICE_MIX(6, 3); - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_OFF(3); } @@ -750,7 +750,7 @@ void HopkinsEngine::INTRORUN() { v7 = 2 * v9; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v13; } while (v13 < v7); } @@ -761,7 +761,7 @@ void HopkinsEngine::INTRORUN() { v7 = 20 - v9; do { - _graphicsManager.VBL(); + _eventsManager.VBL(); ++v14; } while (v14 < v7); } @@ -770,17 +770,17 @@ void HopkinsEngine::INTRORUN() { if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); for (j = 1; j < 100 / _globals.vitesse; ++j) - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _animationManager.BOBANIM_OFF(3); for (k = 1; k < 60 / _globals.vitesse; ++k) - _graphicsManager.VBL(); + _eventsManager.VBL(); _animationManager.BOBANIM_ON(5); for (l = 0; l < 20 / _globals.vitesse; ++l) - _graphicsManager.VBL(); + _eventsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); @@ -792,7 +792,7 @@ void HopkinsEngine::INTRORUN() { _animationManager.BOBANIM_OFF(3); } - _graphicsManager.VBL(); + _eventsManager.VBL(); } _graphicsManager.FADE_OUTW(); @@ -870,7 +870,7 @@ void HopkinsEngine::PUBQUIT() { do { xp = _eventsManager.XMOUSE(); yp = _eventsManager.YMOUSE(); - _graphicsManager.VBL(); + _eventsManager.VBL(); if (_eventsManager.BMOUSE() == 1) mouseClicked = true; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b1b230c82f..2fb40d6046 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -24,6 +24,7 @@ #include "common/events.h" #include "common/util.h" #include "hopkins/menu.h" +#include "hopkins/dialogs.h" #include "hopkins/files.h" #include "hopkins/hopkins.h" #include "hopkins/globals.h" @@ -104,17 +105,17 @@ int MenuManager::MENU() { menuIndex = MENU_NONE; mousePos = Common::Point(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); - if (ABS(mousePos.x - 232) <= 176) { - if (ABS(mousePos.y - 261) <= 23) + if ((uint16)(mousePos.x - 232) <= 176) { + if ((uint16)(mousePos.y - 261) <= 23) menuIndex = PLAY_GAME; - if (ABS(mousePos.y - 293) <= 23) + if ((uint16)(mousePos.y - 293) <= 23) menuIndex = LOAD_GAME; - if (ABS(mousePos.y - 325) <= 22) + if ((uint16)(mousePos.y - 325) <= 22) menuIndex = OPTIONS; - if (ABS(mousePos.y - 356) <= 23) + if ((uint16)(mousePos.y - 356) <= 23) menuIndex = INTRODUCTION; - if (ABS(mousePos.y - 388) <= 23) + if ((uint16)(mousePos.y - 388) <= 23) menuIndex = QUIT; } @@ -167,7 +168,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, v9 + 4); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, v8 + 6); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex != MENU_NONE) selectionMade = 1; @@ -175,7 +176,7 @@ int MenuManager::MENU() { if (menuIndex == PLAY_GAME) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); v6 = 1; } @@ -183,7 +184,7 @@ int MenuManager::MENU() { break; _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); _vm->_globals.SORTIE = -1; @@ -196,18 +197,20 @@ int MenuManager::MENU() { _vm->_globals.SORTIE = 0; } - if (menuIndex != 3) + if (menuIndex != OPTIONS) break; + // Options menu item selected _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, 12); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - - CHOICE_OPTION(); + + // Show the options dialog + OptionsDialog::show(_vm); } if (menuIndex == INTRODUCTION) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); _vm->INTRORUN(); continue; @@ -215,7 +218,7 @@ int MenuManager::MENU() { if ( menuIndex == QUIT) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); - _vm->_graphicsManager.VBL(); + _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); v6 = -1; } @@ -229,10 +232,6 @@ int MenuManager::MENU() { return v6; } -void MenuManager::CHOICE_OPTION() { - warning("CHOICE_OPTION"); -} - void MenuManager::CHARGE_PARTIE() { warning("CHARGE_PARTIE"); } diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 8d3d8d696a..11f232746a 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -34,8 +34,6 @@ class HopkinsEngine; class MenuManager { private: HopkinsEngine *_vm; - - void CHOICE_OPTION(); public: void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index b924037680..fe84d67ccf 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -3,6 +3,7 @@ MODULE := engines/hopkins MODULE_OBJS := \ anim.o \ detection.o \ + dialogs.o \ events.o \ files.o \ font.o \ diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index fbc131e0f0..ec2bdfe54a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -189,6 +189,279 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } +void ObjectsManager::AFF_SPRITES() { + int v0; + __int16 v1; + __int16 v2; + __int16 destX; + __int16 destY; + int v5; + __int16 v6; + __int16 v7; + __int16 v8; + __int16 v9; + int v10; + __int16 v11; + uint16 *v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + __int16 v20; + __int16 v21; + __int16 v23; + __int16 v24; + __int16 v25; + __int16 v26; + __int16 v27; + __int16 v28; + __int16 v29; + __int16 v30; + __int16 v31; + __int16 v32; + __int16 v33; + signed __int16 v34; + signed __int16 v35; + signed __int16 v36; + __int16 v37; + __int16 v38; + uint16 arr[50]; + + _vm->_globals.NBTRI = 0; + v30 = 0; + do { + v0 = v30; + if (_vm->_fontManager.ListeTxt[v0].field0 && _vm->_fontManager.Txt[v30].field3FC != 2) { + v1 = _vm->_fontManager.ListeTxt[v30].x1; + v28 = v1 - 2; + + if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) + v28 = _vm->_graphicsManager.min_x; + v2 = _vm->_fontManager.ListeTxt[v30].y1; + v23 = v2 - 2; + + if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) + v23 = _vm->_graphicsManager.min_y; + destX = v1 - 2; + if (destX < _vm->_graphicsManager.min_x) + destX = _vm->_graphicsManager.min_x; + destY = v2 - 2; + if (destY < _vm->_graphicsManager.min_y) + destY = _vm->_graphicsManager.min_y; + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v28, v23, + _vm->_fontManager.ListeTxt[v30].x2 + 4, _vm->_fontManager.ListeTxt[destX].y2 + 4, + _vm->_graphicsManager.VESA_BUFFER, + destX, destY); + _vm->_fontManager.ListeTxt[v0].field0 = 0; + } + ++v30; + } while (v30 <= 10); + + if (!PERSO_ON) { + v31 = 0; + do { + v5 = v31; + if (_vm->_globals.Liste[v5].field0) { + v6 = _vm->_globals.Liste[v5].field2; + v29 = v6 - 2; + if ((int16)(v6 - 2) < _vm->_graphicsManager.min_x) + v29 = _vm->_graphicsManager.min_x; + v7 = _vm->_globals.Liste[v31].field4; + v24 = v7 - 2; + if ((int16)(v7 - 2) < _vm->_graphicsManager.min_y) + v24 = _vm->_graphicsManager.min_y; + v8 = v6 - 2; + if (v8 < _vm->_graphicsManager.min_x) + v8 = _vm->_graphicsManager.min_x; + v9 = v7 - 2; + if (v9 < _vm->_graphicsManager.min_y) + v9 = _vm->_graphicsManager.min_y; + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24, _vm->_globals.Liste[v31].x2 + 4, + _vm->_globals.Liste[v31].y2 + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); + _vm->_globals.Liste[v5].field0 = 0; + } + ++v31; + } while (v31 <= 4); + } + + AFF_BOB_ANIM(); + AFF_VBOB(); + if (!PERSO_ON) { + v32 = 0; + do { + _vm->_globals.Liste[v32].field0 = 0; + v10 = v32; + if (Sprite[v10].field0 == 1) { + CALCUL_SPRITE(v32); + if (Sprite[v10].field2A == 1) + AvantTri(2, v32, Sprite[v10].field32 + Sprite[v10].field2E); + } + ++v32; + } while (v32 <= 4); + + if (_vm->_globals.CACHEFLAG) + VERIFCACHE(); + } + + if (PRIORITY == 1 && _vm->_globals.NBTRI) { + v33 = 1; + do { + arr[v33] = v33; + ++v33; + } while (v33 <= 48); + + v25 = _vm->_globals.NBTRI; + do { + v27 = 0; + v34 = 1; + if (v25 > 1) { + v26 = _vm->_globals.NBTRI; + + do { + v11 = arr[v34]; + v12 = &arr[v34 + 1]; + if (_vm->_globals.Tri[arr[v34]].field4 > _vm->_globals.Tri[*v12].field4) { + arr[v34] = *v12; + *v12 = v11; + ++v27; + } + ++v34; + } while (v34 < v26); + } + } while (v27); + + v35 = 1; + if (_vm->_globals.NBTRI + 1 > 1) { + do { + v13 = arr[v35]; + if (_vm->_globals.Tri[v13].field0 == 1) + DEF_BOB(_vm->_globals.Tri[v13].field2); + if (_vm->_globals.Tri[v13].field0 == 2) + DEF_SPRITE(_vm->_globals.Tri[v13].field2); + if (_vm->_globals.Tri[v13].field0 == 3) + DEF_CACHE(_vm->_globals.Tri[v13].field2); + _vm->_globals.Tri[v13].field0 = 0; + ++v35; + } while (v35 < _vm->_globals.NBTRI + 1); + } + } else { + v36 = 1; + if (_vm->_globals.NBTRI + 1 > 1) { + do { + v14 = v36; + if (_vm->_globals.Tri[v14].field0 == 1) + DEF_BOB(_vm->_globals.Tri[v14].field2); + if (_vm->_globals.Tri[v14].field0 == 2) + DEF_SPRITE(_vm->_globals.Tri[v14].field2); + if (_vm->_globals.Tri[v14].field0 == 3) + DEF_CACHE(_vm->_globals.Tri[v14].field2); + _vm->_globals.Tri[v14].field0 = 0; + ++v36; + } while (v36 < _vm->_globals.NBTRI + 1); + } + } + + v37 = 0; + do { + v15 = v37; + _vm->_globals.Tri[v15].field0 = 0; + _vm->_globals.Tri[v15].field4 = 0; + _vm->_globals.Tri[v15].field2 = 0; + _vm->_globals.Tri[v15].field6 = 0; + ++v37; + } while (v37 <= 49); + + _vm->_globals.NBTRI = 0; + if (_vm->_globals.AFFINVEN == 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, Winventaire, inventairex, inventairey, inventairel, inventaireh); + if (old_cadx && old_cady) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); + if (cadx && cady) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, cadx + 300, cady + 300, cadi); + _vm->_graphicsManager.Ajoute_Segment_Vesa(inventairex, inventairey, inventairex + inventairel, inventairey + inventaireh); + } + + if (SL_FLAG == 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + if (SL_X && SL_Y) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager.start_x + 300, SL_Y + 300, 0); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + } + + if (_vm->_globals.OPTION_FLAG) { + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 464, 407, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 657, 556, _vm->_globals.opt_vitesse); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 495, _vm->_globals.opt_txt); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 468, _vm->_globals.opt_voice); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 441, _vm->_globals.opt_sound); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 731, 414, _vm->_globals.opt_music); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 600, 522, _vm->_globals.opt_anm); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_eventsManager.start_x + 611, 502, _vm->_globals.opt_scrspeed); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 164, 107, _vm->_eventsManager.start_x + 498, 320); + } + + v38 = 0; + do { + v16 = v38; + if (_vm->_fontManager.Txt[v16].field0 == 1) { + if ((uint16)(_vm->_fontManager.Txt[v16].field3FC - 2) > 1) + BOITE(v38, + _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].field4, + _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].field8, _vm->_fontManager.Txt[v16].fieldA); + else + BOITE( + v38, + _vm->_fontManager.Txt[v16].fieldC, + _vm->_fontManager.Txt[v16].field4, + _vm->_fontManager.Txt[v16].field8, + _vm->_fontManager.Txt[v16].fieldA); + _vm->_fontManager.ListeTxt[v38].field0 = 1; + + v17 = v38; + if ((uint16)(_vm->_fontManager.Txt[v17].field3FC - 2) > 1) + _vm->_fontManager.ListeTxt[v38].x1 = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].field8; + else + _vm->_fontManager.ListeTxt[v38].x1 = _vm->_fontManager.Txt[v17].field8; + + v18 = v38; + v19 = v38; + _vm->_fontManager.ListeTxt[v18].y1 = _vm->_fontManager.Txt[v19].fieldA; + _vm->_fontManager.ListeTxt[v18].x2 = _vm->_fontManager.Txt[v19].field404; + _vm->_fontManager.ListeTxt[v18].y2 = _vm->_fontManager.Txt[v19].field406; + + if (_vm->_fontManager.ListeTxt[v38].x1 < _vm->_graphicsManager.min_x) + _vm->_fontManager.ListeTxt[v38].x1 = _vm->_graphicsManager.min_x - 1; + if (_vm->_fontManager.ListeTxt[v38].y1 < _vm->_graphicsManager.min_y) + _vm->_fontManager.ListeTxt[v38].y1 = _vm->_graphicsManager.min_y - 1; + v20 = _vm->_fontManager.ListeTxt[v38].x1; + if (_vm->_fontManager.ListeTxt[v38].x2 + v20 > _vm->_graphicsManager.max_x) + _vm->_fontManager.ListeTxt[v38].x2 = _vm->_graphicsManager.max_x - v20; + v21 = _vm->_fontManager.ListeTxt[v38].y1; + if (_vm->_fontManager.ListeTxt[v38].y2 + v21 > _vm->_graphicsManager.max_y) + _vm->_fontManager.ListeTxt[v38].y2 = _vm->_graphicsManager.max_y - v21; + if (_vm->_fontManager.ListeTxt[v38].x2 <= 0 || _vm->_fontManager.ListeTxt[v38].y2 <= 0) + _vm->_fontManager.ListeTxt[v18].field0 = 0; + } + ++v38; + } while (v38 <= 10); + + INVENT_ANIM(); +} + void ObjectsManager::INIT_BOB() { for (int idx = 0; idx < 35; ++idx) { BOB_ZERO(idx); @@ -233,6 +506,10 @@ void ObjectsManager::BOB_ZERO(int idx) { item.field8 = 0; } +void ObjectsManager::DEF_BOB(int idx) { + warning("TODO: DEF_BOB"); +} + void ObjectsManager::BOB_VISU(int idx) { int v1; const byte *data; @@ -289,4 +566,40 @@ void ObjectsManager::BOB_OFF(int idx) { _vm->_globals.Bob[idx].field0 = 11; } +void ObjectsManager::VERIFCACHE() { + warning("TODO: VERIFCACHE"); +} + +void ObjectsManager::INVENT_ANIM() { + warning("TODO: INVENT_ANIM"); +} + +void ObjectsManager::DEF_SPRITE(int idx) { + warning("TODO: DEF_SPRITE"); +} + +void ObjectsManager::DEF_CACHE(int a1) { + warning("TODO: DEF_CACHE"); +} + +void ObjectsManager::CALCUL_SPRITE(int idx) { + warning("TODO: CALCUL_SPRITE"); +} + +void ObjectsManager::AvantTri(int a1, int a2, int a3) { + warning("TODO: AvantTri"); +} + +void ObjectsManager::AFF_BOB_ANIM() { + warning("TODO: AFF_BOB_ANIM"); +} + +void ObjectsManager::AFF_VBOB() { + warning("TODO: AFF_VBOB"); +} + +void ObjectsManager::BOITE(int a1, int a2, int a3, int a4, int a5) { + warning("TODO: BOITE"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index f9017cc63f..1d1a445b63 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -29,13 +29,33 @@ namespace Hopkins { +struct SpriteItem { + int field0; + int field2A; + int field2E; + int field32; +}; + class HopkinsEngine; class ObjectsManager { private: HopkinsEngine *_vm; +public: int PRIORITY; + int inventairex, inventairey; + int inventairel, inventaireh; + int old_cadx, old_cady, old_cadi; + int cadx, cady, cadi; + int SL_X, SL_Y; + byte *Winventaire; + byte *inventaire2; + byte *SL_SPR; + byte *SL_SPR2; + SpriteItem Sprite[6]; + bool PERSO_ON; + bool SL_FLAG; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -50,14 +70,27 @@ public: byte *CHARGE_SPRITE(const Common::String &file); void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + void AFF_SPRITES(); int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); int AJOUTE_OBJET(int objIndex); void INIT_BOB(); void BOB_ZERO(int idx); + void DEF_BOB(int idx); void BOB_VISU(int idx); void BOB_OFF(int idx); + + void VERIFCACHE(); + void INVENT_ANIM(); + void DEF_SPRITE(int idx); + void DEF_CACHE(int idx); + void CALCUL_SPRITE(int idx); + void AvantTri(int a1, int a2, int a3); + void AFF_BOB_ANIM(); + void AFF_VBOB(); + + void BOITE(int a1, int a2, int a3, int a4, int a5); }; } // End of namespace Hopkins diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index ea19b8fba7..14576da7f1 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -59,4 +59,21 @@ void SoundManager::DEL_SAMPLE(int soundNumber) { warning("TODO: DEL_SAMPLE"); } +void SoundManager::PLAY_SOUND(const Common::String &file) { + warning("TODO: PLAY_SOUND"); +} + +void SoundManager::MODSetSampleVolume() { + warning("TODO MODSetSampleVolume"); +} + +void SoundManager::MODSetVoiceVolume() { + warning("TODO MODSetVoiceVolume"); +} + +void SoundManager::MODSetMusicVolume(int volume) { + warning("TODO MODSetMusicVolume"); +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 696ac79fa5..c7e142c112 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -35,6 +35,16 @@ public: HopkinsEngine *_vm; int SPECIAL_SOUND; + int SOUNDVOL; + int VOICEVOL; + int MUSICVOL; + int OLD_SOUNDVOL; + int OLD_MUSICVOL; + int OLD_VOICEVOL; + bool SOUNDOFF; + bool MUSICOFF; + bool VOICEOFF; + bool TEXTOFF; public: void setParent(HopkinsEngine *vm); @@ -45,6 +55,10 @@ public: void WSOUND(int soundNumber); void VOICE_MIX(int a1, int a2); void DEL_SAMPLE(int soundNumber); + void PLAY_SOUND(const Common::String &file); + void MODSetSampleVolume(); + void MODSetVoiceVolume(); + void MODSetMusicVolume(int volume); }; } // End of namespace Hopkins -- cgit v1.2.3 From 4f40d98af0faa54922e1321157335001a3457145 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Sep 2012 11:25:21 +1000 Subject: HOPKINS: Fix bug with clipping in Sprite_Vesa --- engines/hopkins/graphics.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 048d07241f..4d8a3b79a5 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1321,32 +1321,22 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, byte byteVal; int xc = 0; - // Loop through sequences of bytes to skip or output while ((byteVal = *srcP) != 253) { ++srcP; int width = READ_LE_UINT16(srcP); + srcP += 2; - if (byteVal != 254) { - // Skip over output bytes - tempDestP += width; - xc += width; - } else { - // Output byte range - while (width-- > 0) { - // Get the next byte - byteVal = *spriteP; + if (byteVal == 254) { + // Copy pixel range + for (int xv = 0; xv < width; ++xv, ++xc, ++spriteP, ++tempDestP) { if (clip_y == 0 && xc >= clip_x && xc < clip_x1) - // Not clipped, so display it - *tempDestP = byteVal; - - // Move to next pixel - xc++; - ++srcP; - ++tempDestP; + *tempDestP = *spriteP; } + } else { + // Skip over bytes + tempDestP += width; + xc += width; } - - srcP += 2; } if (clip_y > 0) -- cgit v1.2.3 From 3fcff82dae63c3f45ad481c1038a7c7142b361c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Sep 2012 21:05:55 +1000 Subject: HOPKINS: Added extra shouldQuit check to animation player --- engines/hopkins/anim.cpp | 6 +++--- engines/hopkins/hopkins.cpp | 4 ++++ engines/hopkins/hopkins.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 665f5590e1..33717eeb2f 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -170,7 +170,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate2); + } while (_vm->_eventsManager.lItCounter < rate2 && !_vm->shouldQuit()); } _vm->_eventsManager.lItCounter = 0; @@ -196,7 +196,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); } - } while (!doneFlag); + } while (!doneFlag && !_vm->shouldQuit()); if (_vm->_globals.iRegul != 1) { _vm->_eventsManager.lItCounter = 0; @@ -225,7 +225,7 @@ REDRAW_ANIM: _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate3); + } while (_vm->_eventsManager.lItCounter < rate3 && !_vm->shouldQuit()); _vm->_eventsManager.lItCounter = 0; _vm->_soundManager.VERIF_SOUND(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 61fb368794..9ab4d4cf27 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -473,6 +473,10 @@ LABEL_128: return Common::kNoError; } +bool HopkinsEngine::shouldQuit() const { + return g_system->getEventManager()->shouldQuit(); +} + int HopkinsEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 062fc1e191..6e7c3db020 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -113,6 +113,7 @@ public: Common::Language getLanguage() const; uint16 getVersion() const; bool getIsDemo() const; + bool shouldQuit() const; int getRandomNumber(int maxNumber); -- cgit v1.2.3 From c9f904b7ca5591de2f61dcc71cd313644045965d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Sep 2012 22:52:12 +1000 Subject: HOPKINS: Implemented some more of the object/sprite methods --- engines/hopkins/globals.cpp | 6 +- engines/hopkins/globals.h | 29 +++- engines/hopkins/objects.cpp | 347 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 15 +- 4 files changed, 386 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index cd8915cbc9..771b0b2aea 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -217,7 +217,7 @@ void Globals::clearAll() { inventaire2 = PTRNUL; COUCOU = PTRNUL; SPRITE_ECRAN = PTRNUL; - SAUVEGARDE = PTRNUL; + SAUVEGARDE = (Sauvegarde *)PTRNUL; OBJET_EN_COURS = 0; for (int idx = 0; idx < 105; ++idx) { @@ -253,8 +253,8 @@ void Globals::clearAll() { texte_tmp = PTRNUL; BUFFERTAPE = dos_malloc2(85000); - SAUVEGARDE = dos_malloc2(2050); - memset(SAUVEGARDE, 0, 1999); + SAUVEGARDE = (Sauvegarde *)malloc(sizeof(Sauvegarde)); + memset(SAUVEGARDE, 0, sizeof(Sauvegarde)); essai0 = BUFFERTAPE; essai1 = BUFFERTAPE + 25000; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 420df345d8..187918b3e1 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -103,7 +103,13 @@ struct BobItem { int field36; int field38; int field3A; + int field3E; + int field40; + int field42; + int field44; int field46; + int field48; + int field4A; }; struct Liste2Item { @@ -156,6 +162,26 @@ struct TriItem { int field6; }; +struct CacheItem { + int field0; + int field2; + int field4; + int field6; + int field8; + int fieldA; + int field10; + int field14; +}; + +// Note: Fields decimal based for now +struct Sauvegarde { + int field353; + int field354; + int field355; + int field356; + int field357; +}; + class HopkinsEngine; /** @@ -223,12 +249,13 @@ public: ObjetWItem ObjetW[300]; BlocItem BLOC[250]; ListeItem Liste[7]; + CacheItem Cache[25]; byte *Winventaire; byte *texte_tmp; int texte_long; int TEXTE_FORMATE; byte *SPRITE_ECRAN; - byte *SAUVEGARDE; + Sauvegarde *SAUVEGARDE; byte *BUFFERTAPE; byte *essai0; byte *essai1; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ec2bdfe54a..8cc3f6d826 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -33,6 +33,21 @@ namespace Hopkins { ObjectsManager::ObjectsManager() { PRIORITY = 0; + inventairex = inventairey = 0; + inventairel = inventaireh = 0; + old_cadx = old_cady = old_cadi = 0; + cadx = cady = cadi = 0; + SL_X = SL_Y = 0; + I_old_x = I_old_y = 0; + FLAG_VISIBLE_EFFACE = 0; + Winventaire = PTRNUL; + inventaire2 = PTRNUL; + SL_SPR = PTRNUL; + SL_SPR2 = PTRNUL; + PERSO_ON = false; + SL_FLAG = false; + FLAG_VISIBLE = false; + DESACTIVE_INVENT = false; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -507,7 +522,74 @@ void ObjectsManager::BOB_ZERO(int idx) { } void ObjectsManager::DEF_BOB(int idx) { - warning("TODO: DEF_BOB"); + int v2; + int v3; + int v4; + __int16 v5; + __int16 v6; + __int16 v7; + __int16 v8; + __int16 v9; + __int16 v10; + int v11; + __int16 v12; + __int16 v13; + + v2 = idx; + if (_vm->_globals.Bob[v2].field40) { + v12 = _vm->_globals.Bob[v2].field42; + v13 = _vm->_globals.Bob[v2].field44; + if (_vm->_globals.Bob[v2].field3E) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[v2].field4, + v12 + 300, v13 + 300, _vm->_globals.Bob[v2].fieldC); + else + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, + _vm->_globals.Bob[v2].field4, v12 + 300, + _vm->_globals.Bob[v2].field44 + 300, _vm->_globals.Bob[v2].fieldC, + _vm->_globals.Bob[v2].field4A, _vm->_globals.Bob[v2].field48, + _vm->_globals.Bob[v2].field38); + + v3 = idx; + _vm->_globals.Liste2[v3].field0 = 1; + _vm->_globals.Liste2[v3].field2 = v12; + _vm->_globals.Liste2[v3].field4 = v13; + + v4 = idx; + _vm->_globals.Liste2[v3].field6 = _vm->_globals.Bob[v4].field46; + _vm->_globals.Liste2[v3].field8 = _vm->_globals.Bob[v4].field48; + v5 = _vm->_globals.Liste2[v3].field2; + + v6 = _vm->_graphicsManager.min_x; + if (v5 < _vm->_graphicsManager.min_x) { + _vm->_globals.Liste2[v3].field6 -= _vm->_graphicsManager.min_x - v5; + _vm->_globals.Liste2[v3].field2 = v6; + } + + v7 = _vm->_globals.Liste2[v3].field4; + v8 = _vm->_graphicsManager.min_y; + if (v7 < _vm->_graphicsManager.min_y) { + _vm->_globals.Liste2[v3].field8 -= _vm->_graphicsManager.min_y - v7; + _vm->_globals.Liste2[v3].field4 = v8; + } + + v9 = _vm->_globals.Liste2[v3].field2; + if (_vm->_globals.Liste2[v3].field6 + v9 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste2[v3].field6 = _vm->_graphicsManager.max_x - v9; + v10 = _vm->_globals.Liste2[v3].field4; + if (_vm->_globals.Liste2[v3].field8 + v10 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste2[v3].field8 = _vm->_graphicsManager.max_y - v10; + + if (_vm->_globals.Liste2[v3].field6 <= 0 || _vm->_globals.Liste2[v3].field8 <= 0) + _vm->_globals.Liste2[v3].field0 = 0; + + v11 = idx; + if (_vm->_globals.Liste2[v11].field0 == 1) + _vm->_graphicsManager.Ajoute_Segment_Vesa( + _vm->_globals.Liste2[v11].field2, + _vm->_globals.Liste2[v11].field4, + _vm->_globals.Liste2[v11].field2 + _vm->_globals.Liste2[v11].field6, + _vm->_globals.Liste2[v11].field4 + _vm->_globals.Liste2[v11].field8); + } } void ObjectsManager::BOB_VISU(int idx) { @@ -566,20 +648,273 @@ void ObjectsManager::BOB_OFF(int idx) { _vm->_globals.Bob[idx].field0 = 11; } +void ObjectsManager::SCBOB(int idx) { + int v1; + signed __int16 v2; + signed __int16 v3; + signed __int16 v4; + signed __int16 v6; + signed __int16 v7; + __int16 v8; + signed __int16 v9; + + v1 = idx; + if (_vm->_globals.Cache[idx].fieldA > 0) { + v8 = 0; + do { + v1 = v8; + if (_vm->_globals.Bob[v1].field0) { + if (!_vm->_globals.Bob[v8].field16) { + if (!_vm->_globals.Bob[v8].field34) { + if ( _vm->_globals.Bob[v8].fieldC != 250) { + v2 = _vm->_globals.Bob[v8].field42;; + v9 = _vm->_globals.Bob[v8].field46 + _vm->_globals.Bob[v8].field42; + v6 = _vm->_globals.Bob[v8].field48 + _vm->_globals.Bob[v8].field44; + v3 =_vm->_globals.Cache[idx].field0; + v4 =_vm->_globals.Cache[idx].field4;; + v7 =_vm->_globals.Cache[idx].field6 + v3; + v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; + + if (v6 > v4) { + if (v6 < (signed __int16)v1) { + v1 = 0; + if (v9 >= v3 && v9 <= (signed __int16)(_vm->_globals.Cache[idx].field6 + v3)) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + + if (!(uint16)v1) { + if (v2 >= v3 && v7 >= v2) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + if (!(uint16)v1) { + if ( v7 >= v2 && v2 >= v3 ) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + if (!(uint16)v1) { + if (v2 >= v3 && v9 <= v7) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + if (!(uint16)v1 && v2 <= v3 && v9 >= v7) + ++_vm->_globals.Cache[idx].fieldA; + } + } + } + } + } + } + } + } + } + ++v8; + } while (v8 <= 20); + } +} + void ObjectsManager::VERIFCACHE() { - warning("TODO: VERIFCACHE"); + __int16 v1; + signed __int16 v2; + signed __int16 v3; + signed __int16 v4; + __int16 v5; + __int16 v6; + __int16 v7; + __int16 v8; + __int16 v9; + __int16 v10; + __int16 v11; + + v8 = 0; + do { + if (_vm->_globals.Cache[v8].fieldA > 0) { + v7 = _vm->_globals.Cache[v8].fieldA; + v10 = 0; + do { + if (_vm->_objectsManager.Sprite[v10].field0 == 1) { + if (_vm->_objectsManager.Sprite[v10].field10 != 250) { + v1 = _vm->_objectsManager.Sprite[v10].field2C; + v11 = _vm->_objectsManager.Sprite[v10].field30 + v1; + v2 = _vm->_objectsManager.Sprite[v10].field32 + _vm->_objectsManager.Sprite[v10].field2E; + v6 = _vm->_globals.Cache[v8].field0; + v3 = _vm->_globals.Cache[v8].field4; + v9 = _vm->_globals.Cache[v8].field6 + v6; + + if (v2 > v3) { + if (v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + v3)) { + v4 = 0; + if (v11 >= v6 && v11 <= v9) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = 1; + } + if (!v4) { + if (v6 <= v1 && v9 >= v1) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = 1; + } + if (!v4) { + if (v9 >= v1 && v6 <= v1) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = 1; + } + if (!v4) { + if (v6 <= v1 && v11 <= v9) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = 1; + } + if (!v4 && v6 >= v1 && v11 >= v9) + ++_vm->_globals.Cache[v8].fieldA; + } + } + } + } + } + } + } + + ++v10; + } while (v10 <= 4); + + SCBOB(v8); + if (_vm->_globals.Cache[v8].fieldA == v7) { + if (_vm->_globals.Cache[v8].field10 == 1) { + _vm->_globals.Cache[v8].field10 = 0; + _vm->_globals.Cache[v8].fieldA = 1; + } + } else { + v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + + _vm->_globals.Cache[v8].field4; + if (v5 > 440) + v5 = 500; + + AvantTri(3, v8, v5); + _vm->_globals.Cache[v8].fieldA = 1; + _vm->_globals.Cache[v8].field10 = 1; + } + } + ++v8; + } while (v8 <= 19); } void ObjectsManager::INVENT_ANIM() { - warning("TODO: INVENT_ANIM"); + __int16 v0; + signed int v1; + + if (!DESACTIVE_INVENT) { + if (FLAG_VISIBLE_EFFACE && !FLAG_VISIBLE) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, I_old_x, 27, 48, 38, + _vm->_graphicsManager.VESA_BUFFER, I_old_x, 27); + _vm->_graphicsManager.Ajoute_Segment_Vesa(I_old_x, 27, I_old_x + 48, 65); + --FLAG_VISIBLE_EFFACE; + } + + if (FLAG_VISIBLE) { + if (I_old_x <= 1) + I_old_x = 2; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, I_old_x, 27, 48, 38, + _vm->_graphicsManager.VESA_BUFFER, I_old_x, 27); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(I_old_x, 27, I_old_x + 48, 65); + v0 = _vm->_graphicsManager.ofscroll + 2; + v1 = _vm->_graphicsManager.ofscroll + 2; + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); + I_old_x = v0; + } + + if (_vm->_globals.SAUVEGARDE->field357 == 1) { + if (_vm->_globals.SAUVEGARDE->field353 == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + if (_vm->_globals.SAUVEGARDE->field355 == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); + } + if (_vm->_globals.SAUVEGARDE->field356 == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } + + if (_vm->_globals.SAUVEGARDE->field354 == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } + } } void ObjectsManager::DEF_SPRITE(int idx) { - warning("TODO: DEF_SPRITE"); + int v2; + __int16 v3; + __int16 v4; + int v5; + int v6; + __int16 v7; + __int16 v8; + __int16 v9; + __int16 v10; + __int16 v11; + __int16 v12; + int v13; + + v2 = idx; + if (Sprite[v2].field2A) { + v3 = Sprite[v2].field2C; + v4 = Sprite[v2].field2E; + if (Sprite[v2].field28) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, + v3 + 300, v4 + 300, Sprite[v2].field10); + else + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, + v3 + 300, v4 + 300, Sprite[v2].field10, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); + + v5 = idx; + v6 = idx; + _vm->_globals.Liste[v5].x2 = Sprite[v6].field30; + _vm->_globals.Liste[v5].y2 = Sprite[v6].field32; + v7 = _vm->_globals.Liste[v5].field2; + v8 = _vm->_graphicsManager.min_x; + + if (v7 < _vm->_graphicsManager.min_x) { + _vm->_globals.Liste[v5].x2 -= _vm->_graphicsManager.min_x - v7; + _vm->_globals.Liste[v5].field2 = v8; + } + + v9 = _vm->_globals.Liste[v5].field4; + v10 = _vm->_graphicsManager.min_y; + if (v9 < _vm->_graphicsManager.min_y) { + _vm->_globals.Liste[v5].y2 -= _vm->_graphicsManager.min_y - v9; + _vm->_globals.Liste[v5].field4 = v10; + } + v11 = _vm->_globals.Liste[v5].field2; + if (_vm->_globals.Liste[v5].x2 + v11 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste[v5].x2 = _vm->_graphicsManager.max_x - v11; + v12 = _vm->_globals.Liste[v5].field4; + if ( _vm->_globals.Liste[v5].y2 + v12 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste[v5].y2 = _vm->_graphicsManager.max_y - v12; + if ( _vm->_globals.Liste[v5].x2 <= 0 || _vm->_globals.Liste[v5].y2 <= 0) + _vm->_globals.Liste[v5].field0 = 0; + + v13 = idx; + if (_vm->_globals.Liste[v13].field0 == 1) + _vm->_graphicsManager.Ajoute_Segment_Vesa( + _vm->_globals.Liste[v13].field2, + _vm->_globals.Liste[v13].field4, + _vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13].x2, + _vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13].y2); + } } -void ObjectsManager::DEF_CACHE(int a1) { - warning("TODO: DEF_CACHE"); +void ObjectsManager::DEF_CACHE(int idx) { + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.CACHE_BANQUE[1], + _vm->_globals.Cache[idx].field0 + 300, _vm->_globals.Cache[idx].field4 + 300, + _vm->_globals.Cache[idx].field2); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx].field0, + _vm->_globals.Cache[idx].field4, + _vm->_globals.Cache[idx].field0 + _vm->_globals.Cache[idx].field6, + _vm->_globals.Cache[idx].field4 + _vm->_globals.Cache[idx].field8); } void ObjectsManager::CALCUL_SPRITE(int idx) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 1d1a445b63..d34af65264 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -31,9 +31,17 @@ namespace Hopkins { struct SpriteItem { int field0; + byte *spriteData; + int fieldE; + int field10; + int field28; int field2A; + int field2C; int field2E; + int field30; int field32; + int field34; + int field36; }; class HopkinsEngine; @@ -49,13 +57,17 @@ public: int old_cadx, old_cady, old_cadi; int cadx, cady, cadi; int SL_X, SL_Y; + int I_old_x, I_old_y; + int FLAG_VISIBLE_EFFACE; byte *Winventaire; byte *inventaire2; byte *SL_SPR; byte *SL_SPR2; - SpriteItem Sprite[6]; bool PERSO_ON; bool SL_FLAG; + bool FLAG_VISIBLE; + bool DESACTIVE_INVENT; + SpriteItem Sprite[6]; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -80,6 +92,7 @@ public: void DEF_BOB(int idx); void BOB_VISU(int idx); void BOB_OFF(int idx); + void SCBOB(int idx); void VERIFCACHE(); void INVENT_ANIM(); -- cgit v1.2.3 From 0fbf1df76a353cb33da71ba4ab69f5c77436fa46 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Sep 2012 21:10:50 +1000 Subject: HOPKINS: Implemented some more sprite and bob methods --- engines/hopkins/globals.h | 4 + engines/hopkins/objects.cpp | 259 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 7 ++ 3 files changed, 268 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 187918b3e1..e9e85c0370 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -132,7 +132,11 @@ struct VBobItem { int field8; int fieldA; int fieldC; + int fieldE; byte *field10; + int field14; + int field16; + int field18; byte *field1C; }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8cc3f6d826..f7cdbff19e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -132,6 +132,32 @@ void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSi } } +int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool isSize) { + const byte *v3 = spriteData + 3; + for (int i = spriteIndex; i; --i) + v3 += READ_LE_UINT16(v3) + 16; + + const byte *v5 = v3 + 8; + int result = READ_LE_UINT16(v5); + if (isSize) + result = READ_LE_UINT16(v5 + 4); + + return result; +} + +int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool isSize) { + const byte *v3 = spriteData + 3; + for (int i = spriteIndex; i; --i) + v3 += READ_LE_UINT16(v3) + 16; + + const byte *v5 = v3 + 10; + int result = READ_LE_UINT16(v5); + if (isSize) + result = READ_LE_UINT16(v5 + 4); + + return result; +} + int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) @@ -918,7 +944,126 @@ void ObjectsManager::DEF_CACHE(int idx) { } void ObjectsManager::CALCUL_SPRITE(int idx) { - warning("TODO: CALCUL_SPRITE"); + int width, height; + __int16 v3; + __int16 v4; + __int16 v5; + __int16 v6; + __int16 v7; + __int16 v8; + int v9; + int v10; + int v11; + int v12; + int v13; + __int16 v15; + __int16 v16; + int v17; + __int16 v22; + + Sprite[idx + 42].field2A = 0; + int v0 = Sprite[idx].field10; + if (v0 != 250) { + if (Sprite[idx].fieldE) { + v5 = get_offsetx(Sprite[idx].spriteData, v0, 1); + v22 = Sprite[idx].field12 + v5; + v4 = Sprite[idx].field12 + v5; + v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].field10, 1); + } else { + v3 = get_offsetx(Sprite[idx].spriteData, v0, 0); + v22 = Sprite[idx].field12 + v3; + v4 = Sprite[idx].field12 + v3; + v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].field10, 0); + } + + v9 = Sprite[idx].field14 + v6; + v7 = v9; + v8 = v9; + int zoomPercent = 0; + int reducePercent = 0; + + v9 = Sprite[idx].fieldC; + if ((signed __int16)v9 < 0) { + v9 = (signed __int16)v9; + if ((signed __int16)v9 < 0) + v9 = -v9; + reducePercent = v9; + if ((signed __int16)v9 > 95) + reducePercent = 95; + } + if (Sprite[idx].fieldC > 0) + zoomPercent = Sprite[idx].fieldC; + + if (zoomPercent) { + if (v4 >= 0) { + v22 = _vm->_graphicsManager.Reel_Zoom(v4, zoomPercent); + } else { + v10 = v4; + + if (v4 < 0) + v10 = -v4; + v4 = v10; + v22 = -_vm->_graphicsManager.Reel_Zoom((signed __int16)v10, zoomPercent); + } + + if (v8 >= 0) { + v7 = _vm->_graphicsManager.Reel_Zoom(v8, zoomPercent); + } else { + v11 = v4; + if (v4 < 0) + v11 = -v4; + v8 = v11; + v7 = -_vm->_graphicsManager.Reel_Zoom((signed __int16)v11, zoomPercent); + } + } + if (reducePercent) { + if (v4 >= 0) { + v22 = _vm->_graphicsManager.Reel_Reduc(v4, reducePercent); + } else { + v12 = v4; + if (v4 < 0) + v12 = -v4; + v4 = v12; + v22 = -_vm->_graphicsManager.Reel_Reduc((signed __int16)v12, reducePercent); + } + if (v8 >= 0) { + v7 = _vm->_graphicsManager.Reel_Reduc(v8, reducePercent); + } else { + v13 = v4; + if (v4 < 0) + v13 = -v4; + v7 = -_vm->_graphicsManager.Reel_Reduc((signed __int16)v13, reducePercent); + } + } + + v15 = Sprite[idx].field8 - v22; + v16 = Sprite[idx].fieldA - v7; + Sprite[idx].field2C = v15; + Sprite[idx].field2E = v16; + Sprite[idx].field2A = 1; + Sprite[idx].field34 = zoomPercent; + Sprite[idx].field36 = reducePercent; + + v17 = idx; + _vm->_globals.Liste[v17].field0 = 1; + _vm->_globals.Liste[v17].field2 = v15; + _vm->_globals.Liste[v17].field4 = v16; + width = Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10); + height = Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10); + + if (zoomPercent) { + width = _vm->_graphicsManager.Reel_Zoom(width, zoomPercent); + height = _vm->_graphicsManager.Reel_Zoom(height, zoomPercent); + } + + if (reducePercent) { + height = _vm->_graphicsManager.Reel_Reduc(height, reducePercent); + width = _vm->_graphicsManager.Reel_Reduc(width, reducePercent); + } + + Sprite[idx].field30 = width; + Sprite[idx].field32 = height; + } } void ObjectsManager::AvantTri(int a1, int a2, int a3) { @@ -930,7 +1075,117 @@ void ObjectsManager::AFF_BOB_ANIM() { } void ObjectsManager::AFF_VBOB() { - warning("TODO: AFF_VBOB"); + int width, height; + + int idx = 0; + do { + if (_vm->_globals.VBob[idx].field4 == 4) { + width = Get_Largeur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); + height = Get_Hauteur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); + + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, + _vm->_globals.VBob[idx].field10, _vm->_globals.VBob[idx].field6, + _vm->_globals.VBob[idx].field8, + width, height); + + _vm->_graphicsManager.Restore_Mem( + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].field10, + _vm->_globals.VBob[idx].field6, _vm->_globals.VBob[idx].field8, + width, height); + + _vm->_graphicsManager.Ajoute_Segment_Vesa( + _vm->_globals.VBob[idx].field6, _vm->_globals.VBob[idx].field8, + _vm->_globals.VBob[idx].field6 + width, + height + _vm->_globals.VBob[idx].field8); + + if (PTRNUL != _vm->_globals.VBob[idx].field10) + _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + + _vm->_globals.VBob[idx].field4 = 0; + _vm->_globals.VBob[idx].field10 = PTRNUL; + _vm->_globals.VBob[idx].field0 = PTRNUL; + _vm->_globals.VBob[idx].field6 = 0; + _vm->_globals.VBob[idx].field8 = 0; + _vm->_globals.VBob[idx].field14 = 0; + _vm->_globals.VBob[idx].field16 = 0; + _vm->_globals.VBob[idx].fieldA = 0; + _vm->_globals.VBob[idx].field18 = 0; + _vm->_globals.VBob[idx].field1C = PTRNUL; + } + + if (_vm->_globals.VBob[idx].field4 == 3) { + width = Get_Largeur(_vm->_globals.VBob[idx].field1C, _vm->_globals.VBob[idx].field18); + height = Get_Hauteur(_vm->_globals.VBob[idx].field1C, _vm->_globals.VBob[idx].field18); + + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, + _vm->_globals.VBob[idx].field10, _vm->_globals.VBob[idx].field14, + _vm->_globals.VBob[idx].field16, + width, height); + + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, + _vm->_globals.VBob[idx].field10, _vm->_globals.VBob[idx].field14, + _vm->_globals.VBob[idx].field16, + width, height); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].field14, + _vm->_globals.VBob[idx].field16, _vm->_globals.VBob[idx].field14 + width, + _vm->_globals.VBob[idx].field16 + height); + + _vm->_globals.VBob[idx].field4 = 1; + _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; + + if (PTRNUL != _vm->_globals.VBob[idx].field10) + _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + + _vm->_globals.VBob[idx].field10 = PTRNUL; + _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; + _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; + _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; + } + + if (_vm->_globals.VBob[idx].field4 == 1) { + width = Get_Largeur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); + height = Get_Hauteur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); + + if (PTRNUL != _vm->_globals.VBob[idx].field10) + _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + + byte *surface = _vm->_globals.dos_malloc2(height * width); + _vm->_globals.VBob[idx].field10 = surface; + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, + _vm->_globals.VBob[idx].field6, _vm->_globals.VBob[idx].field8, width, height); + + byte *v10 = _vm->_globals.VBob[idx].field0; + if (*v10 == 78) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_SCREEN, v10, + _vm->_globals.VBob[idx].field6 + 300, + _vm->_globals.VBob[idx].field8 + 300, + _vm->_globals.VBob[idx].fieldA, + 0, 0, 0); + + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, + _vm->_globals.VBob[idx].field0, + _vm->_globals.VBob[idx].field6 + 300, _vm->_globals.VBob[idx].field8 + 300, + _vm->_globals.VBob[idx].fieldA, + 0, 0, 0); + } else { + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, + v10, _vm->_globals.VBob[idx].field6 + 300, _vm->_globals.VBob[idx].field8 + 300, + _vm->_globals.VBob[idx].fieldA); + + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].field0, + _vm->_globals.VBob[idx].field6 + 300, _vm->_globals.VBob[idx].field8 + 300, + _vm->_globals.VBob[idx].fieldA); + } + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].field6, + _vm->_globals.VBob[idx].field8, _vm->_globals.VBob[idx].field6 + width, + _vm->_globals.VBob[idx].field8 + height); + _vm->_globals.VBob[idx].field4 = 2; + } + ++idx; + } while ( idx <= 29 ); } void ObjectsManager::BOITE(int a1, int a2, int a3, int a4, int a5) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d34af65264..4b76f03563 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -32,8 +32,13 @@ namespace Hopkins { struct SpriteItem { int field0; byte *spriteData; + int field8; + int fieldA; + int fieldC; int fieldE; int field10; + int field12; + int field14; int field28; int field2A; int field2C; @@ -82,6 +87,8 @@ public: byte *CHARGE_SPRITE(const Common::String &file); void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + int get_offsetx(const byte *spriteData, int spriteIndex, bool isSize); + int get_offsety(const byte *spriteData, int spriteIndex, bool isSize); void AFF_SPRITES(); int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); -- cgit v1.2.3 From 377554ec6280064c755e88e26b48f24fcbe572c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Sep 2012 22:21:04 +1000 Subject: HOPKINS: Implemented CALCUL_BOB, AvantTri, and AFF_BOB_ANIM --- engines/hopkins/globals.h | 1 + engines/hopkins/objects.cpp | 330 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 4 +- 3 files changed, 331 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e9e85c0370..207c187d0d 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -103,6 +103,7 @@ struct BobItem { int field36; int field38; int field3A; + int field3C; int field3E; int field40; int field42; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index f7cdbff19e..5dec33df09 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -48,6 +48,7 @@ ObjectsManager::ObjectsManager() { SL_FLAG = false; FLAG_VISIBLE = false; DESACTIVE_INVENT = false; + BOBTOUS = false; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -740,6 +741,134 @@ void ObjectsManager::SCBOB(int idx) { } } +void ObjectsManager::CALCUL_BOB(int idx) { + __int16 result; + __int16 v3; + __int16 v4; + __int16 v5; + __int16 v6; + int v7; + int v8; + int v9; + int v10; + int v11; + __int16 v13; + __int16 v14; + __int16 v15; + __int16 v17; + signed __int16 v20; + __int16 v21; + __int16 v22; + + _vm->_globals.Bob[idx].field3C = 0; + if (_vm->_globals.Bob[idx].field3A == 1) { + _vm->_globals.Bob[idx].field38 = 0; + _vm->_globals.Bob[idx].field36 = 0; + } + + result = _vm->_globals.Bob[idx].fieldC; + if (result != 250) { + if (_vm->_globals.Bob[idx].field38) { + v4 = get_offsetx(_vm->_globals.Bob[idx].field4, result, 1); + v22 = v4; + v15 = v4; + v5 = get_offsety(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC, 1); + } else { + v3 = get_offsetx(_vm->_globals.Bob[idx].field4, result, 0); + v22 = v3; + v15 = v3; + v5 = get_offsety(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC, 0); + } + + v17 = v5; + v6 = v5; + v21 = 0; + v20 = 0; + v7 = _vm->_globals.Bob[idx].field36; + + if ((signed __int16)v7 < 0) { + v7 = (signed __int16)v7; + if ((signed __int16)v7 < 0) + v7 = -v7; + v20 = v7; + if ((signed __int16)v7 > 95) + v20 = 95; + } + if (_vm->_globals.Bob[idx].field36 > 0) + v21 = _vm->_globals.Bob[idx].field36; + if (v21) { + if (v15 >= 0) { + v22 = _vm->_graphicsManager.Reel_Zoom(v15, v21); + } else { + v8 = v15; + if (v15 < 0) + v8 = -v15; + v15 = v8; + v22 = -(signed __int16)_vm->_graphicsManager.Reel_Zoom((signed __int16)v8, v21); + } + if (v6 >= 0) { + v17 = _vm->_graphicsManager.Reel_Zoom(v6, v21); + } else { + v9 = v15; + if (v15 < 0) + v9 = -v15; + v6 = v9; + v17 = -(signed __int16)_vm->_graphicsManager.Reel_Zoom((signed __int16)v9, v21); + } + } + + if (v20) { + if (v15 >= 0) { + v22 = _vm->_graphicsManager.Reel_Reduc(v15, v20); + } else { + v10 = v15; + if (v15 < 0) + v10 = -v15; + v15 = v10; + v22 = -(signed __int16)_vm->_graphicsManager.Reel_Reduc((signed __int16)v10, v20); + } + if (v6 >= 0) { + v17 = _vm->_graphicsManager.Reel_Reduc(v6, v20); + } else { + v11 = v15; + if (v15 < 0) + v11 = -v15; + v17 = -(signed __int16)_vm->_graphicsManager.Reel_Reduc((signed __int16)v11, v20); + } + } + + idx = idx; + v13 = _vm->_globals.Bob[idx].field8 - v22; + v14 = _vm->_globals.Bob[idx].fieldA - v17; + _vm->_globals.Bob[idx].field3C = 1; + _vm->_globals.Bob[idx].field3E = v13; + _vm->_globals.Bob[idx].field40 = v14; + _vm->_globals.Bob[idx].field48 = v21; + _vm->_globals.Bob[idx].field4A = v20; + + _vm->_globals.Liste2[idx].field0 = 1; + _vm->_globals.Liste2[idx].field2 = v13; + _vm->_globals.Liste2[idx].field4 = v14; + + int width = Get_Largeur(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC); + int height = Get_Hauteur(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC); + + if (v21) { + width = _vm->_graphicsManager.Reel_Zoom(width, v21); + height = _vm->_graphicsManager.Reel_Zoom(height, v21); + } + if (v20) { + height = _vm->_graphicsManager.Reel_Reduc(height, v20); + width = _vm->_graphicsManager.Reel_Reduc(width, v20); + } + + _vm->_globals.Liste2[idx].field6 = width; + _vm->_globals.Liste2[idx].field8 = height; + _vm->_globals.Bob[idx].field42 = width; + _vm->_globals.Bob[idx].field44 = height; + } +} + void ObjectsManager::VERIFCACHE() { __int16 v1; signed __int16 v2; @@ -1066,12 +1195,207 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } } -void ObjectsManager::AvantTri(int a1, int a2, int a3) { - warning("TODO: AvantTri"); +int ObjectsManager::AvantTri(int a1, int a2, int a3) { + int result; + + ++_vm->_globals.NBTRI; + if (_vm->_globals.NBTRI > 48) + error("NBTRI TROP GRAND"); + + result = _vm->_globals.NBTRI; + _vm->_globals.Tri[result].field0 = a1; + _vm->_globals.Tri[result].field2 = a2; + _vm->_globals.Tri[result].field4 = a3; + + return result; } void ObjectsManager::AFF_BOB_ANIM() { - warning("TODO: AFF_BOB_ANIM"); + signed int v1; + __int16 v2; + signed __int16 v5; + __int16 v6; + __int16 v7; + __int16 v8; + signed __int16 v10; + __int16 v11; + int v12; + int v13; + __int16 v14; + int v18; + int v19; + byte *v20; + byte *v21; + int v22; + __int16 v24; + __int16 v26; + __int16 v27; + __int16 v28; + + int idx = 0; + do { + ++idx; + if (idx <= 20 && PERSO_ON == 1) { + _vm->_globals.Bob[idx].field1C = 0; + continue; + } + + if (_vm->_globals.Bob[idx].field0 == 10) { + _vm->_globals.Bob[idx].field1C = 0; + v1 = _vm->_globals.Bob[idx].field20; + if (v1 == -1) + v1 = 50; + if (_vm->_globals.Bob[idx].field18 == PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) + goto LABEL_38; + + v2 = _vm->_globals.Bob[idx].field14; + if (_vm->_globals.Bob[idx].field12 == v2) { + _vm->_globals.Bob[idx].field1C = 1; + } else { + _vm->_globals.Bob[idx].field14 = v2 + 1; + _vm->_globals.Bob[idx].field1C = 0; + } + + if (_vm->_globals.Bob[idx].field1C != 1) + goto LABEL_38; + + v20 = _vm->_globals.Bob[idx].field18 + 20; + v24 = _vm->_globals.Bob[idx].field10; + _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v20 + 2 * v24); + if (_vm->_globals.BL_ANIM[idx].v1 == 1) + _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; + if ( PERSO_ON == 1 && idx > 20 ) + _vm->_globals.Bob[idx].field8 += _vm->_graphicsManager.start_x; + + _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); + _vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v20 + 2 * v24 + 4); + _vm->_globals.Bob[idx].field36 = READ_LE_UINT16(v20 + 2 * v24 + 6); + _vm->_globals.Bob[idx].fieldC = *(v20 + 2 * v24 + 8); + _vm->_globals.Bob[idx].field38 = *(v20 + 2 * v24 + 9); + _vm->_globals.Bob[idx].field10 += 5; + v5 = _vm->_globals.Bob[idx].field12; + + if (v5 > 0) { + v6 = v5 / _vm->_globals.vitesse; + _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals.vitesse; + if (v6 > 0) { +LABEL_37: + _vm->_globals.Bob[idx].field14 = 1; +LABEL_38: + v12 = idx; + + if ((unsigned __int16)(_vm->_globals.Bob[v12].field1E - 1) <= 1u) + _vm->_globals.Bob[v12].field1C = 1; + continue; + } + + _vm->_globals.Bob[idx].field12 = 1; + } + if (!_vm->_globals.Bob[idx].field12) { + v7 = _vm->_globals.Bob[idx].field20; + if (v7 > 0) + _vm->_globals.Bob[idx].field20 = v7 - 1; + v8 = _vm->_globals.Bob[idx].field20; + if (v8 != -1 && v8 <= 0) { + _vm->_globals.Bob[idx].field0 = 11; + } else { + _vm->_globals.Bob[idx].field10 = 0; + v21 = _vm->_globals.Bob[idx].field18 + 20; + _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v21); + + if (_vm->_globals.BL_ANIM[idx].v1 == 1) + _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; + if (PERSO_ON == 1 && idx > 20) + _vm->_globals.Bob[idx].field8 += _vm->_graphicsManager.start_x; + + _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); + _vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v21 + 4); + _vm->_globals.Bob[idx].field36 = READ_LE_UINT16(v21 + 6); + _vm->_globals.Bob[idx].fieldC = *(v21 + 8); + _vm->_globals.Bob[idx].field38 = *(v21 + 9); + _vm->_globals.Bob[idx].field10 += 5; + v10 = _vm->_globals.Bob[idx].field12; + + if (v10 > 0) { + v11 = v10 / _vm->_globals.vitesse; + _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals.vitesse; + if (v11 <= 0) + _vm->_globals.Bob[idx].field12 = 1; + } + } + } + + goto LABEL_37; + } + } while (idx != 35); + + if (!PERSO_ON && BOBTOUS == 1) { + v26 = 0; + do { + v13 = v26; + if (_vm->_globals.Bob[v13].field0 == 10 && !_vm->_globals.Bob[v13].field16) + _vm->_globals.Bob[v13].field1C = 1; + ++v26; + } while (v26 != 35); + } + + BOBTOUS = 0; + v27 = 0; + + do { + ++v27; + if (v27 > 20 || PERSO_ON != 1) { + if (_vm->_globals.Bob[v27].field0 == 10) { + if (_vm->_globals.Bob[v27].field1C == 1) { + v14 = _vm->_globals.Bob[v27].field1E; + + if (v14 != 2) { + if (v14 != 4) { + if (_vm->_globals.Liste2[v27].field0) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, + _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4, + _vm->_globals.Liste2[v27].field6, _vm->_globals.Liste2[v27].field8, + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].field2, + _vm->_globals.Liste2[v27].field4); + _vm->_globals.Liste2[v27].field0 = 0; + } + } + } + } + } + + v22 = v27; + if (_vm->_globals.Bob[v22].field0 == 11) { + if (_vm->_globals.Liste2[v27].field0) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, + _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4, + _vm->_globals.Liste2[v27].field6, _vm->_globals.Liste2[v27].field8, + _vm->_graphicsManager.VESA_BUFFER, + _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4); + _vm->_globals.Liste2[v27].field0 = 0; + } + + _vm->_globals.Bob[v22].field0 = 0; + } + } + } while (v27 != 35); + + v28 = 0; + do { + ++v28; + v18 = v28; + _vm->_globals.Bob[v18].field40 = 0; + if (_vm->_globals.Bob[v18].field0 == 10 && !_vm->_globals.Bob[v18].field16 && _vm->_globals.Bob[v18].field1C == 1) { + CALCUL_BOB(v28); + int v = _vm->_globals.Bob[v18].field44 + _vm->_globals.Bob[v18].field40; + v19 = _vm->_globals.Bob[v18].field46 + v; + + if (v19 > 450) + v19 = 600; + if (_vm->_globals.Bob[v18].field3C == 1) + AvantTri(1, v28, v19); + } + } while (v28 != 35); } void ObjectsManager::AFF_VBOB() { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 4b76f03563..1055dfdb1a 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; + bool BOBTOUS; SpriteItem Sprite[6]; public: ObjectsManager(); @@ -100,13 +101,14 @@ public: void BOB_VISU(int idx); void BOB_OFF(int idx); void SCBOB(int idx); + void CALCUL_BOB(int idx); void VERIFCACHE(); void INVENT_ANIM(); void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void CALCUL_SPRITE(int idx); - void AvantTri(int a1, int a2, int a3); + int AvantTri(int a1, int a2, int a3); void AFF_BOB_ANIM(); void AFF_VBOB(); -- cgit v1.2.3 From ddb4fdcf12f8a0e09d7f9b5583984edec99325cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Sep 2012 22:13:15 +1000 Subject: HOPKINS: Implementing font methods --- engines/hopkins/font.cpp | 498 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/font.h | 16 +- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 49 +++++ engines/hopkins/graphics.h | 1 + engines/hopkins/objects.cpp | 8 +- engines/hopkins/objects.h | 2 - 8 files changed, 565 insertions(+), 13 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 4a99dd357a..bbf83518a0 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -23,6 +23,11 @@ #include "common/system.h" #include "common/textconsole.h" #include "hopkins/font.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" +#include "hopkins/objects.h" namespace Hopkins { @@ -45,8 +50,499 @@ void FontManager::clearAll() { } } +void FontManager::TEXTE_ON(int idx) { + if ((signed __int16)(idx - 5) > 11) + error("Attempted to display text > MAX_TEXT."); + + TxtItem &txt = Txt[idx - 5]; + txt.field0 = 1; + txt.field408 = 0; + + if (txt.field400 != PTRNUL) { + _vm->_globals.dos_free2(txt.field400); + txt.field400 = PTRNUL; + } +} + + void FontManager::TEXTE_OFF(int idx) { - warning("TODO: TEXTE_OFF"); + if ((signed __int16)(idx - 5) > 11) + error("Attempted to display text > MAX_TEXT."); + + TxtItem &txt = Txt[idx - 5]; + txt.field0 = 0; + txt.field408 = 0; + + if (txt.field400 != PTRNUL) { + _vm->_globals.dos_free2(txt.field400); + txt.field400 = PTRNUL; + } +} + +void FontManager::COUL_TXT(int idx, byte colByte) { + Txt[idx - 5].field40A = colByte; +} + +void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { + COUL_TXT(idx1, 255); + COUL_TXT(idx2, 255); + COUL_TXT(idx3, 255); + COUL_TXT(idx4, 253); +} + +void FontManager::DOS_TEXT(int idx, int a2, const Common::String &filename, int a4, int a5, int a6, int a7, int a8, int a9, int a10) { + if ((idx - 5) > 11) + error("Attempted to display text > MAX_TEXT."); + + TxtItem &txt = Txt[idx - 5]; + txt.field0 = 0; + txt.field4 = filename; + txt.field8 = a4; + txt.fieldA = a5; + txt.fieldC = a2; + txt.fieldE = a6; + txt.field10 = a7; + txt.field3FC = a8; + txt.field3FE = a9; + txt.field40A = a10; +} + +void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int xp, int yp) { + /* There's something seriously wrong with the automatic disassembly.. it seems to have + * an extra code end block. I'll likely need to manually disassemble the method + + byte *v5; + int v6; + int v7; + int v8; + byte *v9; + const byte *v10; + int v11; + int v12; + char v13; + char v14; + int v15; + char v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + char v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int ptr; + char *ptra; + int ptrb; + int ptrc; + void *ptrd; + void *ptre; + int s; + int v49; + int v50; + int v51; + int v52; + int v53; + int v54; + int v55; + int v56; + int v57; + int v58; + void *v59; + void *v60; + void *v61; + int v62; + int v63; + int v64; + int v65; + int v66; + int v67; + int v68; + int v69; + int v70; + int v71; + int v72; + int v73; + int i; + int v75; + Common::String fname; + + v73 = xp; + v70 = yp; + v58 = 0; + if (idx < 0) + error("Bad number for text"); + + _vm->_globals.police_l = 11; + + v5 = idx; + largeur_boite = 11 * Txt[idx].field3FE; + if (Txt[idx].field408) { + v34 = Txt[idx].field3FC; + if (v34 != 6 && v34 != 1 && v34 != 3 && v34 != 5) { + v72 = yp + 5; + v38 = 0; + if (Txt[idx].field12 > 0) { + do { + v40 = idx; + TEXT_NOW1(xp + 5, v72, Txt[idx].field14[v38], Txt[idx].field40A); + v5 = police_h + v72 + 1; + v72 += police_h + 1; + ++v38; + idx = v40; + } while (Txt[v40].field12 > v38); + } + } else { + v35 = idx; + v36 = *(_WORD *)&Txt[v35 + 1030]; + v37 = *(_WORD *)&Txt[v35 + 1028]; + + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, + Txt[v35].field400, xp, yp, Txt[v35].field404, Txt[v35].field406); + v5 = _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); + } + } else { + v62 = 0; + do { + TRIER_TEXT[v62++] = 0; + while (v62 <= 19); + + &Txt[idx].field408 = 1; + FileManager::CONSTRUIT_FICHIER(HOPLINK, filename); + fname = _vm->_globals.NFICHIER; + + if (strncmp(fname.c_str(), oldname.c_str(), fname.size())) { + oldname = fname; + nom_indexoldname = fname; + + //*(int *)((char *)&dword_80AE4DC + strlen(nom_index) + 1) = dword_807C98D; + Common::File f; + if (!f.open(nom_index)) + error("error opening file - %s", nom_index.c_str()); + + int fileSize = f.size(); + for (int i = 0; i < (fileSize / 4); ++i) + Index[i] = f.readUint32LE(); + f.close(); + } + + if (fname[0] != 'Z' || fname[1] != 'O') { + Common::File f; + if (!f.open(fname)) + error("error opening file - %s", fname.c_str()); + + v69 = 2048; + f.seek(Index[fileIndex]); + texte_tmp = _vm->_globals.dos_malloc2(2058); + if (texte_tmp == PTRNUL) + error("temporary text"); + + f.read(texte_temp, 2048); + f.close(); + texte_long = 2048; + } else { + v69 = 100; + texte_long = 100; + v9 = _vm->_globals.dos_malloc2(110); + texte_tmp = v9; + v10 = BUF_ZONE + Index[fileIndex]; + memcpy(v9, v10, 96); + + v11 = 0; + WRITE_LE_UINT16((uint16 *)v9 + 48, READ_LE_UINT16((uint16 *)v10 + 48)); + } + + v59 = texte_tmp; + v63 = 0; + + if (!v69) + goto LABEL_43; + + do { + v13 = v59; + if ((unsigned __int8)(*v59 + 46) > 0x1Bu) { + if ((unsigned __int8)(v13 + 80) > 0x1Bu) { + if ((unsigned __int8)(v13 - 65) <= 0x19u || (unsigned __int8)(v13 - 97) <= 0x19u) + v13 = 32; + } else { + v13 -= 79; + } + } else { + v13 += 111; + } + + *v59 = v13; + v59 = v59 + 1; + ++v63; + } while (v63 < v69); + + v60 = texte_tmp; + v64 = 0; + if (v69) { + ptr = idx; + + for (;;) { + v14 = *(v60 + v64); + if (v14 == 10 || v14 == 13) { + *(v60 + v64) = 0; + v11 = &Txt[0]; + if (!Txt[ptr].field3FE) + break; + } + + ++v64; + if (v69 <= v64) + goto LABEL_43; + } + + Txt[ptr].field3FE = v64; + largeur_boite = 0; + + v15 = 0; + if (v64 + 1 > 0) { + do { + v16 = *(v60 + v15); + if ((unsigned __int8)v16 <= 0x1Fu) + v16 = 32; + largeur_boite += _vm->_objectManager.Get_Largeur(police, (unsigned __int8)v16 - 32); + ++v15; + } while (v15 < v64 + 1); + } + + largeur_boite += 2; + v17 = largeur_boite / 2; + if (v17 < 0) + v17 = -v17; + *Txt[idx].field8 = 320 - v17; + v73 = start_x + 320 - v17; + v58 = 1; + v18 = 0; + + if (v64 + 1 > 0) { + ptra = Txt[ptr]; + + do { + ptra.field14[v18].field0 = *(v60 + v18); + ++v18; + } while (v18 < v64 + 1); + } + } else { +LABEL_43: + + if (!largeur_boite) + largeur_boite = 240; + v65 = 0; + v61 = texte_tmp; + + do { + v19 = 0; + ptrb = largeur_boite - 4; + + for (;;) { + v57 = v19; + do { + v11 = *(v61 + v65 + v19++); + } while (v11 != 32 && v11 != 37); + + if (v19 >= ptrb / police_l) + break; + if (v11 == 37) { + if (v19 < ptrb / police_l) + goto LABEL_55; + break; + } + } + + if (v11 != 37) + goto LABEL_57; + v11 = 32; +LABEL_55: + if (v11 == 37) + v57 = v19; +LABEL_57: + v20 = v58; + v21 = v11; + + Txt[idx].field14[v20] = (const char *)v61 + v65; + //strncpy((char *)(v20 + 1036 * idx + 134911728), (const char *)v61 + v65, v57); + TRIER_TEXT[v58++] = v57; + + v65 += v57; + v11 = v21; + } while ((byte)v21 != 37); + + v66 = 0; + do { + v22 = TRIER_TEXT[v66]; + if (v22 <= 0) { + TRIER_TEXT[v66] = 0; + } else { + ptrc = 0; + v23 = 0; + if (v22 - 1 > 0) { + do { + v24 = *(&Txt[1036 * idx + 20] + 100 * v66 + v23); + if ((unsigned __int8)v24 <= 0x1Fu) + v24 = 32; + + ptrc += _vm->_objectManager.Get_Largeur(police, (unsigned __int8)v24 - 32); + ++v23; + } while (v23 < TRIER_TEXT[v66] - 1); + } + + TRIER_TEXT[v66] = ptrc; + } + ++v66; + } while (v66 <= 19); + + v67 = 0; + do { + v25 = v67; + do { + ++v25; + if (v25 == 20) + v25 = 0; + if (TRIER_TEXT[v67] < TRIER_TEXT[v25]) + TRIER_TEXT[v67] = 0; + } while (v25 != v67); + ++v67; + } while ((signed __int16)v67 <= 19); + + v68 = 0; + do { + if (TRIER_TEXT[v68]) + largeur_boite = TRIER_TEXT[v68]; + ++v68; + } while (v68 <= 19); + + if ((unsigned __int16)(Txt[idx].field3FC - 2) > 1u) { + for (i = xp - start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2) + ; + Txt[idx].field8 = i; + v73 = start_x + i; + } else { + if (nbrligne == 639) { + while (largeur_boite + v73 > 638 && v73 > -2) + v73 -= 2; + } + if (nbrligne == (SCREEN_WIDTH * 2)) { + while (largeur_boite + v73 > 1278 && v73 > -2) + v73 -= 2; + } + Txt[idx].field8 = v73; + } + } + + hauteur_boite = (police_h + 1) * v58 + 2; + v56 = v73; + v55 = yp; + v53 = largeur_boite + 10; + v51 = (police_h + 1) * v58 + 12; + + v26 = idx; + if (Txt[idx].field3FC == 6) { + v27 = v53 / 2; + if (v27 < 0) + v27 = -v27; + + Txt[v26].field8 = 315 - v27; + v28 = start_x + 315 - v27; + v73 = start_x + 315 - v27; + Txt[v26].fieldA = 50; + v70 = 50; + v55 = 50; + v56 = v28; + } + + v29 = Txt[idx].field3FC; + if (v29 == 1 || v29 == 3 || (unsigned __int16)(v29 - 5) <= 1u) { + v49 = v51 * v53; + ptrd = _vm->_globals.dos_malloc2(v51 * v53); + + if (ptrd == PTRNUL) + error("Error allocating block (%d)", v49); + } + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); + _vm->_graphicsManager.Trans_bloc2(ptrd, TABLE_COUL, v49); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); + _vm->_globals.dos_free2(ptrd); + + _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, -2); + _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, (signed __int16)(v51 + v55), v53, -2); + _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, -2); + _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, (signed __int16)(v53 + v56), v70, v51, -2); + } + + Txt[idx].field12 = v58; + v75 = v73 + 5; + v71 = v70 + 5; + v30 = 0; + + if (v58 > 0) { + do { + TEXT_NOW1(v75, v71, Txt[idx].field14[v30], Txt[idx].field40A); + v71 += police_h + 1; + ++v30; + } while ( v58 > v30 ); + } + + v54 = v53 + 1; + v52 = v51 + 1; + v31 = 1036 * idx; + Txt[v31].field404 = v54; + Txt[v31].field406 = v52; + v32 = Txt[v31].field3FC; + + if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { + v33 = idx; + if (Txt[v33].field400 != PTRNUL) + Txt[v33].field400 = _vm->_globals.dos_free2(Txt[v33].field400); + + v50 = v52 * v54; + ptre = dos_malloc2(v50 + 20); + if (ptre == PTRNUL) + error("Error allocating block (%d)", v50); + } + + Txt[v33].field400 = ptre; + Txt[v33].field404 = v54; + Txt[v33].field406 = v52; + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, Txt[v33].field400, v56, v55, + Txt[v33].field404, v52); + } + + texte_tmp = _vm->_globals.dos_free2(texte_tmp); + */ +} + +void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int transColour) { + for (uint idx = 0; idx < message.size(); ++idx) { + char currentChar = message[idx]; + + if (currentChar > 31) { + int characterIndex = currentChar - 32; + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + xp, yp, characterIndex, transColour); + xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, characterIndex); + } + } } } // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index fb53401f13..89f74ca673 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -33,16 +33,17 @@ class HopkinsEngine; struct TxtItem { int field0; int field2; - int field4; + Common::String field4; int field8; int fieldA; int fieldC; int fieldE; int field10; int field12; + Common::String field14[10]; int field3FC; int field3FE; - int field400; + byte *field400; int field404; int field406; int field408; @@ -64,11 +65,22 @@ private: public: TxtItem Txt[12]; ListeTxtItem ListeTxt[12]; + int TRIER_TEXT[21]; + Common::String oldname; + Common::String nom_index; + int Index[4048]; + byte *texte_tmp; public: void setParent(HopkinsEngine *vm); void clearAll(); + void TEXTE_ON(int idx); void TEXTE_OFF(int idx); + void COUL_TXT(int idx, byte colByte); + void OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4); + void DOS_TEXT(int idx, int a2, const Common::String &filename, int a4, int a5, int a6, int a7, int a8, int a9, int a10); + void BOITE(int idx, int a2, const Common::String &filename, int xp, int yp); + void TEXT_NOW1(int xp, int yp, const Common::String &message, int transColour); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 771b0b2aea..446e5788f4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -200,7 +200,7 @@ void Globals::clearAll() { texte_tmp = PTRNUL; texte_long = 0; - police = (void *)PTRNUL; + police = PTRNUL; police_h = 0; police_l = 0; hauteur_boite = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 207c187d0d..78601a916a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -234,7 +234,7 @@ public: int g_old_anim; int g_old_sens; int HopkinsArr[140]; - void *police; + byte *police; int police_l; int police_h; byte *TETE; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 4d8a3b79a5..d8ad4de283 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2192,4 +2192,53 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned } while (yCurrent != 1); } +void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, + int characterIndex, int transColour) { + const byte *v6; + int i; + const byte *v8; + int v9; + int v10; + const byte *v11; + byte *destP; + int v13; + byte v14; + byte *destLineP; + int v16; + + v6 = spriteData + 3; + for (i = characterIndex; i; --i) + v6 += READ_LE_UINT32(v6) + 16; + + v9 = 0; + v10 = 0; + v8 = v6 + 4; + v9 = READ_LE_UINT16(v8); + v8 += 2; + v10 = READ_LE_UINT16(v8); + v11 = v8 + 10; + destP = surface + xp + nbrligne2 * yp; + Largeur = v9; + + do { + v16 = v10; + destLineP = destP; + v13 = v9; + do { + v14 = *v11; + if (*v11) { + if (v14 == (byte)-4) + v14 = transColour; + *destP = v14; + } + + ++destP; + ++v11; + --v13; + } while (v13); + destP = nbrligne2 + destLineP; + v10 = v16 - 1; + } while (v16 != 1); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 3a3b4c5e9e..4a567e9a00 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -167,6 +167,7 @@ public: void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); + void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int transColour); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5dec33df09..170692d9e4 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -461,11 +461,11 @@ void ObjectsManager::AFF_SPRITES() { v16 = v38; if (_vm->_fontManager.Txt[v16].field0 == 1) { if ((uint16)(_vm->_fontManager.Txt[v16].field3FC - 2) > 1) - BOITE(v38, + _vm->_fontManager.BOITE(v38, _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].field4, _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].field8, _vm->_fontManager.Txt[v16].fieldA); else - BOITE( + _vm->_fontManager.BOITE( v38, _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].field4, @@ -1512,8 +1512,4 @@ void ObjectsManager::AFF_VBOB() { } while ( idx <= 29 ); } -void ObjectsManager::BOITE(int a1, int a2, int a3, int a4, int a5) { - warning("TODO: BOITE"); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 1055dfdb1a..67460323e6 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -111,8 +111,6 @@ public: int AvantTri(int a1, int a2, int a3); void AFF_BOB_ANIM(); void AFF_VBOB(); - - void BOITE(int a1, int a2, int a3, int a4, int a5); }; } // End of namespace Hopkins -- cgit v1.2.3 From 1885141be56d3ce0acc58098876488c73ad26d2b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Sep 2012 23:34:10 +1000 Subject: HOPKINS: Starting implementation of talk manager --- engines/hopkins/files.cpp | 8 +-- engines/hopkins/files.h | 2 +- engines/hopkins/globals.cpp | 1 + engines/hopkins/globals.h | 2 + engines/hopkins/hopkins.cpp | 86 ++++++++++++++++++++++++--- engines/hopkins/hopkins.h | 2 + engines/hopkins/module.mk | 3 +- engines/hopkins/objects.h | 1 + engines/hopkins/talk.cpp | 139 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/talk.h | 57 ++++++++++++++++++ 10 files changed, 286 insertions(+), 15 deletions(-) create mode 100644 engines/hopkins/talk.cpp create mode 100644 engines/hopkins/talk.h 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 */ -- cgit v1.2.3 From 221050f39f677bcbc1396d7e24d70a3e8ed98a75 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 27 Sep 2012 23:05:09 +1000 Subject: HOPKINS: Implemented more talk manager methods --- engines/hopkins/sound.cpp | 3 +- engines/hopkins/sound.h | 2 +- engines/hopkins/talk.cpp | 474 +++++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/talk.h | 10 +- 4 files changed, 480 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 14576da7f1..813eb26933 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -51,8 +51,9 @@ void SoundManager::WSOUND(int soundNumber) { warning("TODO: WSOUND"); } -void SoundManager::VOICE_MIX(int a1, int a2) { +bool SoundManager::VOICE_MIX(int a1, int a2) { warning("TODO: VOICE_MIX"); + return false; } void SoundManager::DEL_SAMPLE(int soundNumber) { diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index c7e142c112..26bfaa53e1 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -53,7 +53,7 @@ public: void LOAD_ANM_SOUND(); void PLAY_ANM_SOUND(int soundNumber); void WSOUND(int soundNumber); - void VOICE_MIX(int a1, int a2); + bool VOICE_MIX(int a1, int a2); void DEL_SAMPLE(int soundNumber); void PLAY_SOUND(const Common::String &file); void MODSetSampleVolume(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e3477628ee..0051c4efc1 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -21,6 +21,8 @@ */ #include "common/system.h" +#include "common/endian.h" +#include "common/file.h" #include "common/textconsole.h" #include "hopkins/talk.h" #include "hopkins/files.h" @@ -122,18 +124,478 @@ void TalkManager::RENVOIE_FICHIER(int srcStart, Common::String &dest, const char dest = Common::String(srcData + srcStart); } -int TalkManager::DIALOGUE_REP(int idx) { - warning("TODO: DIALOGUE_REP"); - return 0; +int TalkManager::DIALOGUE() { + byte *v0; + int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + byte *v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v18; + int v19; + int v20; + int v21; + + if (STATI) { + v0 = BUFFERPERSO; + v1 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + if (v1) + _vm->_animationManager.BOBANIM_ON(v1); + if (READ_LE_UINT16((uint16 *)v0 + 48) != 1) + _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 49)); + if (READ_LE_UINT16((uint16 *)v0 + 48) != 2) + _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 50)); + if ( READ_LE_UINT16((uint16 *)v0 + 48) != 3) + _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 51)); + if (READ_LE_UINT16((uint16 *)v0 + 48) != 4) + _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 52)); + } else { + VISU_WAIT(); + } + + v19 = VERIF_BOITE(PLIGNE1, FQUEST, 65); + v2 = VERIF_BOITE(PLIGNE2, FQUEST, 65); + v3 = VERIF_BOITE(PLIGNE3, FQUEST, 65); + v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, FQUEST, 65); + v21 = v20 - 20 * v3; + v18 = v20 - 20 * v3 - 1; + v4 = v20 - 20 * v3 - 20 * v2; + _vm->_fontManager.DOS_TEXT(5, PLIGNE1, FQUEST, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); + _vm->_fontManager.DOS_TEXT(6, PLIGNE2, FQUEST, 5, v4, 0, 0, 0, 65, 255); + _vm->_fontManager.DOS_TEXT(7, PLIGNE3, FQUEST, 5, v21, 0, 0, 0, 65, 255); + _vm->_fontManager.DOS_TEXT(8, PLIGNE4, FQUEST, 5, v20, 0, 0, 0, 65, 255); + _vm->_fontManager.TEXTE_ON(5); + _vm->_fontManager.TEXTE_ON(6); + _vm->_fontManager.TEXTE_ON(7); + _vm->_fontManager.TEXTE_ON(8); + + v5 = -1; + v6 = 0; + do { + v7 = _vm->_eventsManager.YMOUSE(); + if ((signed __int16)(v4 - 20 * v19) < v7 && (signed __int16)(v4 - 1) > v7) { + v8 = v7; + _vm->_fontManager.OPTI_COUL_TXT(6, 7, 8, 5); + v5 = PLIGNE1; + v7 = v8; + } + if (v7 > v4 && v18 > v7) { + v9 = v7; + _vm->_fontManager.OPTI_COUL_TXT(5, 7, 8, 6); + v5 = PLIGNE2; + v7 = v9; + } + if (v21 < v7 && (signed __int16)(v20 - 1) > v7) { + v10 = v7; + _vm->_fontManager.OPTI_COUL_TXT(5, 6, 8, 7); + v5 = PLIGNE3; + v7 = v10; + } + if (v20 < v7 && v7 < 419) { + _vm->_fontManager.OPTI_COUL_TXT(5, 6, 7, 8); + v5 = PLIGNE4; + } + + _vm->_eventsManager.VBL(); + if (_vm->_eventsManager.BMOUSE()) + v6 = 1; + if (v5 == -1) + v6 = 0; + } while (v6 != 1); + + _vm->_soundManager.VOICE_MIX(v5, 1); + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(6); + _vm->_fontManager.TEXTE_OFF(7); + _vm->_fontManager.TEXTE_OFF(8); + + if (STATI) { + v11 = BUFFERPERSO; + v12 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + if (v12) + _vm->_animationManager.BOBANIM_OFF(v12); + v13 = READ_LE_UINT16((uint16 *)v11 + 49); + if (v13 != 1) + _vm->_animationManager.BOBANIM_OFF(v13); + v14 = READ_LE_UINT16((uint16 *)v11 + 50); + if (v14 != 2) + _vm->_animationManager.BOBANIM_OFF(v14); + v15 = READ_LE_UINT16((uint16 *)v11 + 51); + if (v15 != 3) + _vm->_animationManager.BOBANIM_OFF(v15); + v16 = READ_LE_UINT16((uint16 *)v11 + 52); + if (v16 != 4) + _vm->_animationManager.BOBANIM_OFF(v16); + } else { + FIN_VISU_WAIT(); + } + + _vm->_eventsManager.VBL(); + return v5; } -int TalkManager::DIALOGUE() { - warning("TODO: DIALOGUE"); - return 0; +int TalkManager::DIALOGUE_REP(int idx) { + int v1; + int v2; + byte *v3; + int i; + int v6; + int v7; + byte *v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + void *v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + + v1 = 0; + v2 = 0; + v3 = BUFFERPERSO + 110; + for (i = idx; READ_LE_UINT16(v3) != idx; v3 = BUFFERPERSO + 20 * v1 + 110) { + ++v1; + if (READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) < v1) + v2 = 1; + if (v2 == 1) + return -1; +// HIWORD(i) = HIWORD(BUFFERPERSO); + } + if (v2 == 1) + return -1; + + v22 = READ_LE_UINT16((uint16 *)v3 + 1); + v25 = READ_LE_UINT16((uint16 *)v3 + 2); + v24 = READ_LE_UINT16((uint16 *)v3 + 3); + i = READ_LE_UINT16((uint16 *)v3 + 4); + v23 = READ_LE_UINT16((uint16 *)v3 + 4); + PLIGNE1 = READ_LE_UINT16((uint16 *)v3 + 5); + PLIGNE2 = READ_LE_UINT16((uint16 *)v3 + 6); + PLIGNE3 = READ_LE_UINT16((uint16 *)v3 + 7); + v6 = READ_LE_UINT16((uint16 *)v3 + 8); + v7 = READ_LE_UINT16((uint16 *)v3 + 9); + + if (v7) + _vm->_globals.SAUVEGARDE->field4 = v7; + + if (!v6) + v6 = 10; + if (STATI) { + v8 = BUFFERPERSO; + v9 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + if (v9) + _vm->_animationManager.BOBANIM_ON(v9); + v10 = READ_LE_UINT16((uint16 *)v8 + 44); + if (v10) + _vm->_animationManager.BOBANIM_ON(v10); + v11 = READ_LE_UINT16((uint16 *)v8 + 45); + if (v11) + _vm->_animationManager.BOBANIM_ON(v11); + v12 = READ_LE_UINT16((uint16 *)v8 + 46); + if (v12) + _vm->_animationManager.BOBANIM_ON(v12); + v13 = READ_LE_UINT16((uint16 *)v8 + 47); + if (v13) + _vm->_animationManager.BOBANIM_ON(v13); + } else { + VISU_PARLE(); + } + + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, v22, FREPON, v25, v24, 20, 25, 5, v23, 252); + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICE_MIX(v22, 1)) { + v14 = 0; + _vm->_eventsManager.souris_bb = false; + _vm->_eventsManager.souris_b = false; + + do { + _vm->_eventsManager.VBL(); + ++v14; + } while (v14 != v6); + } + + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_OFF(9); + if (STATI) { + v15 = BUFFERPERSO; + v16 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + if (v16) + _vm->_animationManager.BOBANIM_OFF(v16); + v17 = READ_LE_UINT16((uint16 *)v15 + 44); + if (v17) + _vm->_animationManager.BOBANIM_OFF(v17); + v18 = READ_LE_UINT16((uint16 *)v15 + 45); + if (v18) + _vm->_animationManager.BOBANIM_OFF(v18); + v19 = READ_LE_UINT16((uint16 *)v15 + 46); + if (v19) + _vm->_animationManager.BOBANIM_OFF(v19); + v20 = READ_LE_UINT16((uint16 *)v15 + 47); + if (v20) + _vm->_animationManager.BOBANIM_OFF(v20); + } else { + FIN_VISU_PARLE(i); + } + v21 = 0; + if (!PLIGNE1) + v21 = -1; + + return v21; } void TalkManager::CHERCHE_PAL(int a1, int a2) { + __int16 v2; + size_t v4; + unsigned __int16 v5; + byte *palette; + signed __int16 v8; + + v2 = 0; + v8 = 0; + v4 = a1; + for (;;) { + if ( *(BUFFERPERSO + v4) == 'P' + && *(BUFFERPERSO + v4 + 1) == 'A' + && *(BUFFERPERSO + v4 + 2) == 'L') { + v8 = 1; + v2 = v4; + } + ++v4; + if (v8 == 1) + break; + if (TAILLEPERSO == v4) + return; + } + + v5 = v2 + 5; + palette = BUFFERPERSO + v5; + PALPERSO = BUFFERPERSO + v5; + if (a2 == 0) { + *(palette + 762) = 0; + *(palette + 763) = 0; + *(palette + 764) = 0; + *(palette + 765) = 0xe0; + *(palette + 766) = 0xe0; + *(palette + 767) = 0xff; + *(palette + 759) = 0xff; + *(palette + 760) = 0xff; + *(palette + 761) = 86; + *palette = 0; + *(palette + 1) = 0; + *(palette + 2) = 0; + } + if (a2 == 1) { + *(palette + 765) = 0xe0; + *(palette + 766) = 0xe0; + *(palette + 767) = 0xff; + *(palette + 759) = 0xff; + *(palette + 760) = 0xff; + *(palette + 761) = 0xff; + *palette = 0; + *(palette + 1) = 0; + *(palette + 2) = 0; + *(palette + 762) = 0; + *(palette + 763) = 0; + *(palette + 764) = 0; + } + + _vm->_graphicsManager.setpal_vga256(palette); + _vm->_graphicsManager.INIT_TABLE(145, 150, palette); +} + +void TalkManager::VISU_WAIT() { + for (int idx = 26; idx <= 30; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + BOB_VISU_PARLE(idx); + } +} + +void TalkManager::FIN_VISU_WAIT() { + for (int idx = 26; idx <= 30; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_OFF(idx); + } + + for (int idx = 26; idx <= 30; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_ZERO(idx); + } +} + +void TalkManager::FIN_VISU_PARLE(int a1) { + for (int idx = 21; idx <= 25; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_OFF(idx); + } + + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + + for (int idx = 21; idx <= 25; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + _vm->_objectsManager.BOB_ZERO(idx); + } +} + +int TalkManager::VERIF_BOITE(__int16 idx, const Common::String &file, __int16 a3) { + int v6; + int v7; + char v8; + int v9; + int v10; + char v11; + char v13; + char v14; + signed int v15; + byte *ptr; + int v17; + int v18; + byte *v19; + byte indexData[16188]; + Common::String filename; + Common::String dest; + Common::File f; + int filesize; + + v18 = 0; + _vm->_globals.police_l = 11; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + filename = dest = _vm->_globals.NFICHIER; + filename += "IND"; + + if (!f.open(filename)) + error("Could not open file - %s", filename.c_str()); + filesize = f.size(); + assert(filesize < 16188); + + f.read(indexData, filesize); + f.close(); + + if (!f.open(dest)) + error("Error opening file - %s", dest.c_str()); + f.seek(READ_LE_UINT32(&indexData[idx * 4])); + ptr = _vm->_globals.dos_malloc2(2058); + if (ptr == PTRNUL) + error("temporary TEXT"); + f.read(ptr, 2048); + f.close(); + + v19 = ptr; + v6 = 0; + do { + v13 = *v19; + if ((unsigned __int8)(*v19 + 46) > 0x1Bu) { + if ((unsigned __int8)(v13 + 80) > 0x1Bu) { + if ((unsigned __int8)(v13 - 65) <= 0x19u || (unsigned __int8)(v13 - 97) <= 0x19u) + v13 = 32; + } else { + v13 -= 79; + } + } else { + v13 = *v19 + 111; + } + *v19 = v13; + v19 = v19 + 1; + ++v6; + } while ( (unsigned int)v6 < 0x800 ); + + v7 = 0; + do { + v8 = *(ptr + v7); + if ( v8 == 10 || v8 == 13 ) + *(ptr + v7) = 0; + ++v7; + } while ((unsigned int)v7 < 0x800); + + v9 = 0; + v15 = (signed __int16)(11 * a3) - 4; + do { + v10 = 0; + for (;;) { + v17 = v10; + do { + v11 = *(ptr + v9 + v10); + v14 = v11; + ++v10; + } while (v11 != 32 && v11 != 37); + if (v10 >= v15 / _vm->_globals.police_l) + break; + if (v11 == 37) { + if (v10 < v15 / _vm->_globals.police_l) + goto LABEL_31; + break; + } + } + if (v11 != 37) + goto LABEL_33; + v14 = 32; +LABEL_31: + if (v14 == 37) + v17 = v10; +LABEL_33: + ++v18; + v9 += v17; + } while (v14 != 37); + free(ptr); + return v18; +} + +void TalkManager::VISU_PARLE() { + for (int idx = 21; idx <= 25; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + BOB_VISU_PARLE(idx); + } +} + +void TalkManager::BOB_VISU_PARLE(int idx) { + int v4; + byte *v5; + + _vm->_objectsManager.PRIORITY = 1; + if (!_vm->_globals.Bob[idx].field0) { + _vm->_objectsManager.BOB_ZERO(idx); + v5 = _vm->_globals.Bqe_Anim[idx].data; + v4 = READ_LE_UINT16(v5 + 2); + if (!v4) + v4 = 1; + if (READ_LE_UINT16(v5 + 24)) { + _vm->_globals.Bob[idx].field3A = 1; + _vm->_globals.Bob[idx].field36 = 0; + _vm->_globals.Bob[idx].field38 = 0; + _vm->_globals.Bob[idx].field18 = _vm->_globals.Bqe_Anim[idx].data; + _vm->_globals.Bob[idx].field0 = 10; + v5 = PERSOSPR; + _vm->_globals.Bob[idx].field4 = PERSOSPR; + _vm->_globals.Bob[idx].field1E = v4; + _vm->_globals.Bob[idx].field20 = -1; + _vm->_globals.Bob[idx].field22 = 0; + _vm->_globals.Bob[idx].field24 = 0; + } + } } } // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 7c1ed0db94..6e6cb2d608 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -37,6 +37,8 @@ public: Common::String FQUEST; Common::String FREPON; byte *BUFFERPERSO; + byte *PALPERSO; + byte *PERSOSPR; size_t TAILLEPERSO; int STATI; int PLIGNE1, PLIGNE2; @@ -47,9 +49,15 @@ public: 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(); + int DIALOGUE_REP(int idx); void CHERCHE_PAL(int a1, int a2); + void VISU_WAIT(); + void FIN_VISU_WAIT(); + void FIN_VISU_PARLE(int a1); + int VERIF_BOITE(__int16 a1, const Common::String &a2, __int16 a3); + void VISU_PARLE(); + void BOB_VISU_PARLE(int idx); }; } // End of namespace Hopkins -- cgit v1.2.3 From 7c9ad56aac27ea9dc799abc50314a0cdaa3fe0d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Sep 2012 22:15:59 +1000 Subject: HOPKINS: Implemented many of the previously stubbed methods --- engines/hopkins/events.cpp | 10 +- engines/hopkins/files.cpp | 13 + engines/hopkins/files.h | 2 + engines/hopkins/font.cpp | 10 +- engines/hopkins/globals.cpp | 107 ++++++++ engines/hopkins/globals.h | 45 +++- engines/hopkins/graphics.cpp | 133 +++++++--- engines/hopkins/graphics.h | 8 +- engines/hopkins/hopkins.cpp | 6 +- engines/hopkins/hopkins.h | 1 - engines/hopkins/objects.cpp | 608 ++++++++++++++++++++++++++++++++----------- engines/hopkins/objects.h | 41 ++- engines/hopkins/talk.cpp | 151 +++++++++++ engines/hopkins/talk.h | 4 + 14 files changed, 920 insertions(+), 219 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index fc7c12238a..9482b4ce09 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -36,7 +36,7 @@ EventsManager::EventsManager() { mouse_linux = false; souris_sizex = souris_sizey = 0; ofset_souris_x = ofset_souris_y = 0; - start_x = start_y = 0; + _vm->_eventsManager.start_x = start_y = 0; CASSE = false; souris_n = 0; souris_bb = 0; @@ -85,14 +85,14 @@ void EventsManager::souris_max() { } int EventsManager::XMOUSE() { - souris_x = start_x + g_system->getEventManager()->getMousePos().x; + souris_x = _vm->_eventsManager.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_x = _vm->_eventsManager.start_x + g_system->getEventManager()->getMousePos().x; souris_y = g_system->getEventManager()->getMousePos().y; return souris_y + ofset_souris_y; @@ -446,13 +446,13 @@ LABEL_65: } _vm->_globals.NBBLOC = 0; - start_x = v4; + _vm->_eventsManager.start_x = v4; ofscroll = v4; SCROLL = v4; } OLD_SCROLL = v4; - start_x = v4; + _vm->_eventsManager.start_x = v4; ofscroll = v4; } diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 4e8eb0d80f..f84b597c9a 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -125,6 +125,15 @@ void FileManager::DMESS1() { // No implementation in original } +void FileManager::bload(const Common::String &file, byte *buf) { + Common::File f; + if (!f.open(file)) + error("Error openinig file - %s", file.c_str()); + int32 filesize = f.size(); + FileManager::bload_it(f, buf, filesize); + f.close(); +} + int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) { return stream.read(buf, nbytes); } @@ -325,4 +334,8 @@ uint32 FileManager::FLONG(const Common::String &filename) { return size; } +void FileManager::CONSTRUIT_LINUX(const Common::String &file) { + warning("TODO: CONSTRUIT_LINUX"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index b323006110..9a587efa80 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -39,12 +39,14 @@ public: static byte *CHARGE_FICHIER(const Common::String &file); static void DMESS(); static void DMESS1(); + static void bload(const Common::String &file, byte *buf); static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); static void F_Censure(); 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 byte *RECHERCHE_CAT(const Common::String &file, int a2); + static void CONSTRUIT_LINUX(const Common::String &file); /** * Returns the size of a file. Throws an error if the file can't be found diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index bbf83518a0..5618ea9767 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -330,7 +330,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, if (v17 < 0) v17 = -v17; *Txt[idx].field8 = 320 - v17; - v73 = start_x + 320 - v17; + v73 = _vm->_eventsManager.start_x + 320 - v17; v58 = 1; v18 = 0; @@ -432,10 +432,10 @@ LABEL_57: } while (v68 <= 19); if ((unsigned __int16)(Txt[idx].field3FC - 2) > 1u) { - for (i = xp - start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2) + for (i = xp - _vm->_eventsManager.start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2) ; Txt[idx].field8 = i; - v73 = start_x + i; + v73 = _vm->_eventsManager.start_x + i; } else { if (nbrligne == 639) { while (largeur_boite + v73 > 638 && v73 > -2) @@ -462,8 +462,8 @@ LABEL_57: v27 = -v27; Txt[v26].field8 = 315 - v27; - v28 = start_x + 315 - v27; - v73 = start_x + 315 - v27; + v28 = _vm->_eventsManager.start_x + 315 - v27; + v73 = _vm->_eventsManager.start_x + 315 - v27; Txt[v26].fieldA = 50; v70 = 50; v55 = 50; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 7074e05c0b..7caf57c7b6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -21,6 +21,7 @@ */ #include "common/textconsole.h" +#include "common/file.h" #include "hopkins/globals.h" #include "hopkins/files.h" #include "hopkins/font.h" @@ -718,4 +719,110 @@ byte *Globals::LIBERE_FICHIER(byte *p) { return PTRNUL; } +void Globals::RESET_CACHE() { + byte *dataP; + + for (int idx = 1; idx <= 5; ++idx) { + dataP = CACHE_BANQUE[idx]; + if (dataP != PTRNUL && dataP) + CACHE_BANQUE[idx] = dos_free2(CACHE_BANQUE[idx]); + CACHE_BANQUE[idx] = PTRNUL; + } + + for (int idx = 0; idx <= 20; ++idx) { + Cache[idx].fieldC = PTRNUL; + Cache[idx].field0 = 0; + Cache[idx].field4 = 0; + Cache[idx].field2 = 0; + Cache[idx].fieldA = 0; + Cache[idx].field6 = 0; + Cache[idx].field8 = 0; + Cache[idx].field10 = 0; + Cache[idx].field12 = 0; + Cache[idx].field14 = 0; + } + + CACHEFLAG = 0; +} + +void Globals::CACHE_ON() { + CACHEFLAG = 1; +} + +void Globals::CACHE_OFF() { + CACHEFLAG = 0; +} + +void Globals::CACHE_SUB(int idx) { + Cache[idx].fieldA = 0; +} + +void Globals::CACHE_ADD(int idx) { + Cache[idx].fieldA = 1; +} + +void Globals::CHARGE_CACHE(const Common::String &file) { + byte *v2; + int v4; + int v5; + int v6; + int v8; + int v9; + int v11; + byte *spriteData; + byte *ptr; + int v14; + int v15; + Common::String v16; + Common::File f; + + RESET_CACHE(); + FileManager::CONSTRUIT_FICHIER(HOPLINK, file); + ptr = FileManager::CHARGE_FICHIER(NFICHIER); + v16 = Common::String((const char *)ptr); + + FileManager::CONSTRUIT_FICHIER(HOPLINK, v16); + + if (!f.exists(NFICHIER)) { + spriteData = FileManager::CHARGE_FICHIER(NFICHIER); + CACHE_BANQUE[1] = spriteData; + v15 = 60; + v14 = 0; + do { + v11 = READ_LE_UINT16((uint16 *)ptr + v15); + v4 = READ_LE_UINT16((uint16 *)ptr + v15 + 1); + v5 = READ_LE_UINT16((uint16 *)ptr + v15 + 2); + v6 = v14; + Cache[v6].field14 = READ_LE_UINT16((uint16 *)ptr + v15 + 4); + Cache[v6].field2 = v11; + Cache[v6].field0 = v4; + Cache[v6].field4 = v5; + Cache[v6].field12 = 1; + if (spriteData == PTRNUL) { + Cache[v14].fieldA = 0; + } else { + v8 = _vm->_objectsManager.Get_Largeur(spriteData, v11); + v9 = _vm->_objectsManager.Get_Hauteur(spriteData, v11); + Cache[v14].fieldC = spriteData; + Cache[v14].field6 = v8; + Cache[v14].field8 = v9; + Cache[v14].fieldA = 1; + } + + if ( !Cache[v14].field0 && !Cache[v14].field4 && !Cache[v14].field2) + Cache[v14].fieldA = 0; + v15 += 5; + ++v14; + } while (v14 <= 21); + CACHE_ON(); + v2 = ptr; + } + dos_free2(v2); +} + +void Globals::B_CACHE_OFF(int idx) { + Bob[idx].field34 = 1; +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 9d94873a09..ffb80fd9a0 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -72,8 +72,17 @@ struct ListeItem { int field0; int field2; int field4; - int x2; - int y2; + int width; + int height; + int fieldA; +}; + +struct Liste2Item { + int field0; + int field2; + int field4; + int width; + int height; }; struct BobItem { @@ -113,14 +122,6 @@ struct BobItem { int field4A; }; -struct Liste2Item { - int field0; - int field2; - int field4; - int field6; - int field8; -}; - struct BlAnimItem { uint32 v1; uint32 v2; @@ -174,13 +175,19 @@ struct CacheItem { int field6; int field8; int fieldA; + byte *fieldC; int field10; + int field12; int field14; }; // Note: Fields decimal based for now struct Sauvegarde { int field4; + int field80; + int field170; + int field171; + int field172; int field353; int field354; int field355; @@ -249,12 +256,12 @@ public: BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; BobItem Bob[36]; + ListeItem Liste[6]; Liste2Item Liste2[35]; BlAnimItem BL_ANIM[30]; VBobItem VBob[35]; ObjetWItem ObjetW[300]; BlocItem BLOC[250]; - ListeItem Liste[7]; CacheItem Cache[25]; byte *Winventaire; byte *texte_tmp; @@ -293,10 +300,12 @@ public: int HELICO; uint32 CAT_POSI; uint32 CAT_TAILLE; + bool CAT_FLAG; int iRegul; bool BPP_NOAFF; int SORTIE; int PLANX, PLANY; + int PLANI; int PASSWORD; int NOSPRECRAN; int ECRAN; @@ -322,9 +331,15 @@ public: int opt_music; int opt_txt; int NBTRI; + int AFFLI; + int AFFIVBL; + int NOT_VERIF; bool CACHEFLAG; int AFFINVEN; bool NOPARLE; + bool PLAN_FLAG; + int GOACTION; + int NECESSAIRE; Globals(); ~Globals(); @@ -339,6 +354,14 @@ public: byte *dos_malloc2(int count); byte *dos_free2(byte *p); byte *LIBERE_FICHIER(byte *p); + + void RESET_CACHE(); + void CACHE_ON(); + void CACHE_OFF(); + void CACHE_SUB(int idx); + void CACHE_ADD(int idx); + void CHARGE_CACHE(const Common::String &file); + void B_CACHE_OFF(int idx); }; #define PTRNUL (byte *)NULL diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index d8ad4de283..e1d360e731 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -43,7 +43,7 @@ GraphicsManager::GraphicsManager() { nbrligne = 0; Linear = false; VideoPtr = NULL; - start_x = 0; + _vm->_eventsManager.start_x = 0; ofscroll = 0; SCROLL = 0; PCX_L = PCX_H = 0; @@ -262,7 +262,7 @@ void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) { int GraphicsManager::SCROLL_ECRAN(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); - start_x = result; + _vm->_eventsManager.start_x = result; ofscroll = result; SCROLL = result; return result; @@ -325,6 +325,10 @@ void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1, } while ( !breakFlag); } +void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { + warning("TODO: Trans_bloc2"); +} + // TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { int filesize; @@ -811,9 +815,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface setpal_vga256(palData2); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } } @@ -824,9 +828,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface // Refresh the screen if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } } @@ -859,9 +863,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -880,9 +884,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -899,7 +903,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac if (Winbpp == 2) { if (!SDL_ECHELLE) { - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } goto LABEL_28; @@ -913,12 +917,12 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (!SDL_ECHELLE) { - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } LABEL_28: - m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } } @@ -953,9 +957,9 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -1494,17 +1498,17 @@ void GraphicsManager::Affiche_Segment_Vesa() { dstRect.top = bloc.y1 * 2 + 30; dstRect.setWidth((bloc.x2 - bloc.x1) * 2); dstRect.setHeight((bloc.y2 - bloc.y1) * 2); - } else if (bloc.x2 > start_x && bloc.x1 < (start_x + SCREEN_WIDTH)) { - if (bloc.x1 < start_x) - bloc.x1 = start_x; - if (bloc.x2 > (start_x + SCREEN_WIDTH)) - bloc.x2 = start_x + SCREEN_WIDTH; + } else if (bloc.x2 > _vm->_eventsManager.start_x && bloc.x1 < (_vm->_eventsManager.start_x + SCREEN_WIDTH)) { + if (bloc.x1 < _vm->_eventsManager.start_x) + bloc.x1 = _vm->_eventsManager.start_x; + if (bloc.x2 > (_vm->_eventsManager.start_x + SCREEN_WIDTH)) + bloc.x2 = _vm->_eventsManager.start_x + SCREEN_WIDTH; if (!SDL_ECHELLE) { // Calculate the bounds int xp = Magic_Number(bloc.x1) - 4; - if (xp < start_x) - xp = start_x; + if (xp < _vm->_eventsManager.start_x) + xp = _vm->_eventsManager.start_x; int yp = Magic_Number(bloc.y1) - 4; if (yp < 0) yp = 0; @@ -1515,30 +1519,30 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (height < 4) height = 4; - if ((xp - start_x + width) > SCREEN_WIDTH) + if ((xp - _vm->_eventsManager.start_x + width) > SCREEN_WIDTH) xp -= 4; if ((height - yp) > (SCREEN_HEIGHT - 40)) yp -= 4; if (Winbpp == 2) { m_scroll16A(VESA_BUFFER, xp, yp, width, height, - Reel_Zoom(xp - start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } else { m_scroll2A(VESA_BUFFER, xp, yp, width, height, - Reel_Zoom(xp - start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } - dstRect.left = Reel_Zoom(xp - start_x, SDL_ECHELLE); + dstRect.left = Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE); dstRect.top = Reel_Zoom(yp, SDL_ECHELLE); dstRect.setWidth(Reel_Zoom(width, SDL_ECHELLE)); dstRect.setHeight(Reel_Zoom(height, SDL_ECHELLE)); } else { if (Winbpp == 2) { m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, - bloc.x1 - start_x, bloc.y1); + bloc.x1 - _vm->_eventsManager.start_x, bloc.y1); } else { m_scroll(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, - bloc.x1 - start_x, bloc.y1); + bloc.x1 - _vm->_eventsManager.start_x, bloc.y1); } } } @@ -2131,10 +2135,10 @@ void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); } -void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY) { +void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { int top; - int width; - int height; + int croppedWidth; + int croppedHeight; int v11; int height2; int top2; @@ -2142,28 +2146,28 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int x2, int y2, left = x1; top = y1; - width = x2; - height = y2; + croppedWidth = width; + croppedHeight = height; if (x1 < min_x) { - width = x2 - (min_x - x1); + croppedWidth = width - (min_x - x1); left = min_x; } if (y1 < min_y) { - height = y2 - (min_y - y1); + croppedHeight = height - (min_y - y1); top = min_y; } top2 = top; - if (top + height > max_y) - height = max_y - top; - v11 = left + width; + if (top + croppedHeight > max_y) + croppedHeight = max_y - top; + v11 = left + croppedWidth; if (v11 > max_x) - width = max_x - left; + croppedWidth = max_x - left; - if (width > 0 && height > 0) { - height2 = height; - Copy_Mem(surface, left, top2, width, height, destSurface, destX, destY); - Ajoute_Segment_Vesa(left, top2, left + width, top2 + height2); + if (croppedWidth > 0 && croppedHeight > 0) { + height2 = croppedHeight; + Copy_Mem(surface, left, top2, croppedWidth, croppedHeight, destSurface, destX, destY); + Ajoute_Segment_Vesa(left, top2, left + croppedWidth, top2 + height2); } } @@ -2241,4 +2245,47 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x } while (v16 != 1); } +void GraphicsManager::INI_ECRAN(const Common::String &file) { + warning("TODO: INI_ECRAN"); +} + +void GraphicsManager::INI_ECRAN2(const Common::String &file) { + warning("TODO: INI_ECRAN2"); +} + +void GraphicsManager::NB_SCREEN() { + byte *v0; + const byte *v1; + + if (!_vm->_globals.NECESSAIRE) + INIT_TABLE(50, 65, Palette); + if (nbrligne == SCREEN_WIDTH) + Trans_bloc2(VESA_BUFFER, TABLE_COUL, 307200); + if (nbrligne == 1280) + Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400); + _vm->_graphicsManager.DD_Lock(); + if (Winbpp == 2) { + if (SDL_ECHELLE) + m_scroll16A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (Winbpp == 1) { + if (SDL_ECHELLE) + m_scroll2A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll2(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + _vm->_graphicsManager.DD_Unlock(); + + v0 = VESA_SCREEN; + v1 = VESA_BUFFER; + memcpy(VESA_SCREEN, VESA_BUFFER, 0x95FFCu); + v1 = v1 + 614396; + v0 = v0 + 614396; + *v0 = *v1; + *(v0 + 2) = *(v1 + 2); + DD_VBL(); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 4a567e9a00..8e64e44785 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -68,7 +68,6 @@ public: Graphics::Surface *VideoPtr; byte *VESA_SCREEN; byte *VESA_BUFFER; - int start_x; int ofscroll; int SCROLL; byte HEADER_PCX[128]; @@ -98,6 +97,7 @@ public: int Largeur; int Compteur_y; int spec_largeur; + bool NOFADE; public: GraphicsManager(); ~GraphicsManager(); @@ -113,6 +113,7 @@ public: void INIT_TABLE(int a1, int a2, byte *a3); int SCROLL_ECRAN(int amount); void Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2); + void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); void Cls_Pal(); void souris_max(); @@ -165,9 +166,12 @@ public: int Reel_Reduc(int v, int percentage); void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); - void SCOPY(const byte *surface, int x1, int y1, int x2, int y2, byte *destSurface, int destX, int destY); + void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int transColour); + void INI_ECRAN(const Common::String &file); + void INI_ECRAN2(const Common::String &file); + void NB_SCREEN(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a13f9c0cdf..1da0295b35 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -197,7 +197,7 @@ LABEL_13: if (GLOBALS.SORTIE != 4) break; _globals.DESACTIVE_INVENT = true; - PLAN_BETA(); + _objectsManager.PLAN_BETA(); _globals.DESACTIVE_INVENT = false; } @@ -925,10 +925,6 @@ void HopkinsEngine::REST_SYSTEM() { _eventsManager.CONTROLE_MES(); } -void HopkinsEngine::PLAN_BETA() { - warning("PLAN_BETA"); -} - void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = 1; _graphicsManager.RESET_SEGMENT_VESA(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 7692a83643..7930eae32b 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -82,7 +82,6 @@ private: void PASS(); void REST_SYSTEM(); - void PLAN_BETA(); void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, const Common::String &s4, int v); void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 170692d9e4..b943def1bd 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -233,17 +233,17 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { void ObjectsManager::AFF_SPRITES() { int v0; - __int16 v1; - __int16 v2; - __int16 destX; - __int16 destY; + int v1; + int v2; + int destX; + int destY; int v5; - __int16 v6; - __int16 v7; - __int16 v8; - __int16 v9; + int v6; + int v7; + int v8; + int v9; int v10; - __int16 v11; + int v11; uint16 *v12; int v13; int v14; @@ -252,24 +252,24 @@ void ObjectsManager::AFF_SPRITES() { int v17; int v18; int v19; - __int16 v20; - __int16 v21; - __int16 v23; - __int16 v24; - __int16 v25; - __int16 v26; - __int16 v27; - __int16 v28; - __int16 v29; - __int16 v30; - __int16 v31; - __int16 v32; - __int16 v33; - signed __int16 v34; - signed __int16 v35; - signed __int16 v36; - __int16 v37; - __int16 v38; + int v20; + int v21; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + signed int v34; + signed int v35; + signed int v36; + int v37; + int v38; uint16 arr[50]; _vm->_globals.NBTRI = 0; @@ -323,8 +323,9 @@ void ObjectsManager::AFF_SPRITES() { if (v9 < _vm->_graphicsManager.min_y) v9 = _vm->_graphicsManager.min_y; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24, _vm->_globals.Liste[v31].x2 + 4, - _vm->_globals.Liste[v31].y2 + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24, + _vm->_globals.Liste[v31].width + 4, _vm->_globals.Liste[v31].height + 4, + _vm->_graphicsManager.VESA_BUFFER, v8, v9); _vm->_globals.Liste[v5].field0 = 0; } ++v31; @@ -544,23 +545,23 @@ void ObjectsManager::BOB_ZERO(int idx) { item.field0 = 0; item.field2 = 0; item.field4 = 0; - item.field6 = 0; - item.field8 = 0; + item.width = 0; + item.height = 0; } void ObjectsManager::DEF_BOB(int idx) { int v2; int v3; int v4; - __int16 v5; - __int16 v6; - __int16 v7; - __int16 v8; - __int16 v9; - __int16 v10; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; int v11; - __int16 v12; - __int16 v13; + int v12; + int v13; v2 = idx; if (_vm->_globals.Bob[v2].field40) { @@ -582,31 +583,31 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[v3].field4 = v13; v4 = idx; - _vm->_globals.Liste2[v3].field6 = _vm->_globals.Bob[v4].field46; - _vm->_globals.Liste2[v3].field8 = _vm->_globals.Bob[v4].field48; + _vm->_globals.Liste2[v3].width = _vm->_globals.Bob[v4].field46; + _vm->_globals.Liste2[v3].height = _vm->_globals.Bob[v4].field48; v5 = _vm->_globals.Liste2[v3].field2; v6 = _vm->_graphicsManager.min_x; if (v5 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste2[v3].field6 -= _vm->_graphicsManager.min_x - v5; + _vm->_globals.Liste2[v3].width -= _vm->_graphicsManager.min_x - v5; _vm->_globals.Liste2[v3].field2 = v6; } v7 = _vm->_globals.Liste2[v3].field4; v8 = _vm->_graphicsManager.min_y; if (v7 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste2[v3].field8 -= _vm->_graphicsManager.min_y - v7; + _vm->_globals.Liste2[v3].height -= _vm->_graphicsManager.min_y - v7; _vm->_globals.Liste2[v3].field4 = v8; } v9 = _vm->_globals.Liste2[v3].field2; - if (_vm->_globals.Liste2[v3].field6 + v9 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste2[v3].field6 = _vm->_graphicsManager.max_x - v9; + if (_vm->_globals.Liste2[v3].width + v9 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste2[v3].width = _vm->_graphicsManager.max_x - v9; v10 = _vm->_globals.Liste2[v3].field4; - if (_vm->_globals.Liste2[v3].field8 + v10 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste2[v3].field8 = _vm->_graphicsManager.max_y - v10; + if (_vm->_globals.Liste2[v3].height + v10 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste2[v3].height = _vm->_graphicsManager.max_y - v10; - if (_vm->_globals.Liste2[v3].field6 <= 0 || _vm->_globals.Liste2[v3].field8 <= 0) + if (_vm->_globals.Liste2[v3].width <= 0 || _vm->_globals.Liste2[v3].height <= 0) _vm->_globals.Liste2[v3].field0 = 0; v11 = idx; @@ -614,8 +615,8 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_graphicsManager.Ajoute_Segment_Vesa( _vm->_globals.Liste2[v11].field2, _vm->_globals.Liste2[v11].field4, - _vm->_globals.Liste2[v11].field2 + _vm->_globals.Liste2[v11].field6, - _vm->_globals.Liste2[v11].field4 + _vm->_globals.Liste2[v11].field8); + _vm->_globals.Liste2[v11].field2 + _vm->_globals.Liste2[v11].width, + _vm->_globals.Liste2[v11].field4 + _vm->_globals.Liste2[v11].height); } } @@ -677,13 +678,13 @@ void ObjectsManager::BOB_OFF(int idx) { void ObjectsManager::SCBOB(int idx) { int v1; - signed __int16 v2; - signed __int16 v3; - signed __int16 v4; - signed __int16 v6; - signed __int16 v7; - __int16 v8; - signed __int16 v9; + signed int v2; + signed int v3; + signed int v4; + signed int v6; + signed int v7; + int v8; + signed int v9; v1 = idx; if (_vm->_globals.Cache[idx].fieldA > 0) { @@ -703,9 +704,9 @@ void ObjectsManager::SCBOB(int idx) { v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; if (v6 > v4) { - if (v6 < (signed __int16)v1) { + if (v6 < (signed int)v1) { v1 = 0; - if (v9 >= v3 && v9 <= (signed __int16)(_vm->_globals.Cache[idx].field6 + v3)) { + if (v9 >= v3 && v9 <= (signed int)(_vm->_globals.Cache[idx].field6 + v3)) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } @@ -742,23 +743,23 @@ void ObjectsManager::SCBOB(int idx) { } void ObjectsManager::CALCUL_BOB(int idx) { - __int16 result; - __int16 v3; - __int16 v4; - __int16 v5; - __int16 v6; + int result; + int v3; + int v4; + int v5; + int v6; int v7; int v8; int v9; int v10; int v11; - __int16 v13; - __int16 v14; - __int16 v15; - __int16 v17; - signed __int16 v20; - __int16 v21; - __int16 v22; + int v13; + int v14; + int v15; + int v17; + signed int v20; + int v21; + int v22; _vm->_globals.Bob[idx].field3C = 0; if (_vm->_globals.Bob[idx].field3A == 1) { @@ -786,12 +787,12 @@ void ObjectsManager::CALCUL_BOB(int idx) { v20 = 0; v7 = _vm->_globals.Bob[idx].field36; - if ((signed __int16)v7 < 0) { - v7 = (signed __int16)v7; - if ((signed __int16)v7 < 0) + if ((signed int)v7 < 0) { + v7 = (signed int)v7; + if ((signed int)v7 < 0) v7 = -v7; v20 = v7; - if ((signed __int16)v7 > 95) + if ((signed int)v7 > 95) v20 = 95; } if (_vm->_globals.Bob[idx].field36 > 0) @@ -804,7 +805,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 < 0) v8 = -v15; v15 = v8; - v22 = -(signed __int16)_vm->_graphicsManager.Reel_Zoom((signed __int16)v8, v21); + v22 = -(signed int)_vm->_graphicsManager.Reel_Zoom((signed int)v8, v21); } if (v6 >= 0) { v17 = _vm->_graphicsManager.Reel_Zoom(v6, v21); @@ -813,7 +814,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 < 0) v9 = -v15; v6 = v9; - v17 = -(signed __int16)_vm->_graphicsManager.Reel_Zoom((signed __int16)v9, v21); + v17 = -(signed int)_vm->_graphicsManager.Reel_Zoom((signed int)v9, v21); } } @@ -825,7 +826,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 < 0) v10 = -v15; v15 = v10; - v22 = -(signed __int16)_vm->_graphicsManager.Reel_Reduc((signed __int16)v10, v20); + v22 = -(signed int)_vm->_graphicsManager.Reel_Reduc((signed int)v10, v20); } if (v6 >= 0) { v17 = _vm->_graphicsManager.Reel_Reduc(v6, v20); @@ -833,7 +834,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { v11 = v15; if (v15 < 0) v11 = -v15; - v17 = -(signed __int16)_vm->_graphicsManager.Reel_Reduc((signed __int16)v11, v20); + v17 = -(signed int)_vm->_graphicsManager.Reel_Reduc((signed int)v11, v20); } } @@ -862,25 +863,25 @@ void ObjectsManager::CALCUL_BOB(int idx) { width = _vm->_graphicsManager.Reel_Reduc(width, v20); } - _vm->_globals.Liste2[idx].field6 = width; - _vm->_globals.Liste2[idx].field8 = height; + _vm->_globals.Liste2[idx].width = width; + _vm->_globals.Liste2[idx].height = height; _vm->_globals.Bob[idx].field42 = width; _vm->_globals.Bob[idx].field44 = height; } } void ObjectsManager::VERIFCACHE() { - __int16 v1; - signed __int16 v2; - signed __int16 v3; - signed __int16 v4; - __int16 v5; - __int16 v6; - __int16 v7; - __int16 v8; - __int16 v9; - __int16 v10; - __int16 v11; + int v1; + signed int v2; + signed int v3; + signed int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; v8 = 0; do { @@ -954,7 +955,7 @@ void ObjectsManager::VERIFCACHE() { } void ObjectsManager::INVENT_ANIM() { - __int16 v0; + int v0; signed int v1; if (!DESACTIVE_INVENT) { @@ -1001,16 +1002,16 @@ void ObjectsManager::INVENT_ANIM() { void ObjectsManager::DEF_SPRITE(int idx) { int v2; - __int16 v3; - __int16 v4; + int v3; + int v4; int v5; int v6; - __int16 v7; - __int16 v8; - __int16 v9; - __int16 v10; - __int16 v11; - __int16 v12; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; int v13; v2 = idx; @@ -1026,29 +1027,29 @@ void ObjectsManager::DEF_SPRITE(int idx) { v5 = idx; v6 = idx; - _vm->_globals.Liste[v5].x2 = Sprite[v6].field30; - _vm->_globals.Liste[v5].y2 = Sprite[v6].field32; + _vm->_globals.Liste[v5].width = Sprite[v6].field30; + _vm->_globals.Liste[v5].height = Sprite[v6].field32; v7 = _vm->_globals.Liste[v5].field2; v8 = _vm->_graphicsManager.min_x; if (v7 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste[v5].x2 -= _vm->_graphicsManager.min_x - v7; + _vm->_globals.Liste[v5].width -= _vm->_graphicsManager.min_x - v7; _vm->_globals.Liste[v5].field2 = v8; } v9 = _vm->_globals.Liste[v5].field4; v10 = _vm->_graphicsManager.min_y; if (v9 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste[v5].y2 -= _vm->_graphicsManager.min_y - v9; + _vm->_globals.Liste[v5].height -= _vm->_graphicsManager.min_y - v9; _vm->_globals.Liste[v5].field4 = v10; } v11 = _vm->_globals.Liste[v5].field2; - if (_vm->_globals.Liste[v5].x2 + v11 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste[v5].x2 = _vm->_graphicsManager.max_x - v11; + if (_vm->_globals.Liste[v5].width + v11 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste[v5].width = _vm->_graphicsManager.max_x - v11; v12 = _vm->_globals.Liste[v5].field4; - if ( _vm->_globals.Liste[v5].y2 + v12 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste[v5].y2 = _vm->_graphicsManager.max_y - v12; - if ( _vm->_globals.Liste[v5].x2 <= 0 || _vm->_globals.Liste[v5].y2 <= 0) + if ( _vm->_globals.Liste[v5].height + v12 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste[v5].height = _vm->_graphicsManager.max_y - v12; + if ( _vm->_globals.Liste[v5].width <= 0 || _vm->_globals.Liste[v5].height <= 0) _vm->_globals.Liste[v5].field0 = 0; v13 = idx; @@ -1056,8 +1057,8 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_graphicsManager.Ajoute_Segment_Vesa( _vm->_globals.Liste[v13].field2, _vm->_globals.Liste[v13].field4, - _vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13].x2, - _vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13].y2); + _vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13].width, + _vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13].height); } } @@ -1074,21 +1075,21 @@ void ObjectsManager::DEF_CACHE(int idx) { void ObjectsManager::CALCUL_SPRITE(int idx) { int width, height; - __int16 v3; - __int16 v4; - __int16 v5; - __int16 v6; - __int16 v7; - __int16 v8; + int v3; + int v4; + int v5; + int v6; + int v7; + int v8; int v9; int v10; int v11; int v12; int v13; - __int16 v15; - __int16 v16; + int v15; + int v16; int v17; - __int16 v22; + int v22; Sprite[idx + 42].field2A = 0; int v0 = Sprite[idx].field10; @@ -1112,12 +1113,12 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int reducePercent = 0; v9 = Sprite[idx].fieldC; - if ((signed __int16)v9 < 0) { - v9 = (signed __int16)v9; - if ((signed __int16)v9 < 0) + if ((signed int)v9 < 0) { + v9 = (signed int)v9; + if ((signed int)v9 < 0) v9 = -v9; reducePercent = v9; - if ((signed __int16)v9 > 95) + if ((signed int)v9 > 95) reducePercent = 95; } if (Sprite[idx].fieldC > 0) @@ -1132,7 +1133,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (v4 < 0) v10 = -v4; v4 = v10; - v22 = -_vm->_graphicsManager.Reel_Zoom((signed __int16)v10, zoomPercent); + v22 = -_vm->_graphicsManager.Reel_Zoom((signed int)v10, zoomPercent); } if (v8 >= 0) { @@ -1142,7 +1143,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (v4 < 0) v11 = -v4; v8 = v11; - v7 = -_vm->_graphicsManager.Reel_Zoom((signed __int16)v11, zoomPercent); + v7 = -_vm->_graphicsManager.Reel_Zoom((signed int)v11, zoomPercent); } } if (reducePercent) { @@ -1153,7 +1154,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (v4 < 0) v12 = -v4; v4 = v12; - v22 = -_vm->_graphicsManager.Reel_Reduc((signed __int16)v12, reducePercent); + v22 = -_vm->_graphicsManager.Reel_Reduc((signed int)v12, reducePercent); } if (v8 >= 0) { v7 = _vm->_graphicsManager.Reel_Reduc(v8, reducePercent); @@ -1161,7 +1162,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { v13 = v4; if (v4 < 0) v13 = -v4; - v7 = -_vm->_graphicsManager.Reel_Reduc((signed __int16)v13, reducePercent); + v7 = -_vm->_graphicsManager.Reel_Reduc((signed int)v13, reducePercent); } } @@ -1212,25 +1213,25 @@ int ObjectsManager::AvantTri(int a1, int a2, int a3) { void ObjectsManager::AFF_BOB_ANIM() { signed int v1; - __int16 v2; - signed __int16 v5; - __int16 v6; - __int16 v7; - __int16 v8; - signed __int16 v10; - __int16 v11; + int v2; + signed int v5; + int v6; + int v7; + int v8; + signed int v10; + int v11; int v12; int v13; - __int16 v14; + int v14; int v18; int v19; byte *v20; byte *v21; int v22; - __int16 v24; - __int16 v26; - __int16 v27; - __int16 v28; + int v24; + int v26; + int v27; + int v28; int idx = 0; do { @@ -1265,7 +1266,7 @@ void ObjectsManager::AFF_BOB_ANIM() { if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == 1 && idx > 20 ) - _vm->_globals.Bob[idx].field8 += _vm->_graphicsManager.start_x; + _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v20 + 2 * v24 + 4); @@ -1284,7 +1285,7 @@ LABEL_37: LABEL_38: v12 = idx; - if ((unsigned __int16)(_vm->_globals.Bob[v12].field1E - 1) <= 1u) + if ((unsigned int)(_vm->_globals.Bob[v12].field1E - 1) <= 1u) _vm->_globals.Bob[v12].field1C = 1; continue; } @@ -1306,7 +1307,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == 1 && idx > 20) - _vm->_globals.Bob[idx].field8 += _vm->_graphicsManager.start_x; + _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); _vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v21 + 4); @@ -1354,7 +1355,7 @@ LABEL_38: if (_vm->_globals.Liste2[v27].field0) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4, - _vm->_globals.Liste2[v27].field6, _vm->_globals.Liste2[v27].field8, + _vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height, _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4); _vm->_globals.Liste2[v27].field0 = 0; @@ -1369,7 +1370,7 @@ LABEL_38: if (_vm->_globals.Liste2[v27].field0) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4, - _vm->_globals.Liste2[v27].field6, _vm->_globals.Liste2[v27].field8, + _vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height, _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4); _vm->_globals.Liste2[v27].field0 = 0; @@ -1512,4 +1513,319 @@ void ObjectsManager::AFF_VBOB() { } while ( idx <= 29 ); } +int ObjectsManager::XSPR(int idx) { + if (idx > 5) + error("request of the Coord. x a sprite > MAX_SPRITE."); + return Sprite[idx].field8; +} + +int ObjectsManager::YSPR(int idx) { + if (idx > 5) + error("request of the Coord. y a sprite > MAX_SPRITE."); + return Sprite[idx].fieldA; +} + +void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, spriteData, a2, a3, a5, a6, a7, a8); +} + +void ObjectsManager::CLEAR_SPR() { + int idx; + + idx = 0; + do { + Sprite[idx].field1C = PTRNUL; + Sprite[idx].spriteData = PTRNUL; + Sprite[idx].field0 = 0; + ++idx; + } while (idx <= 4); + + idx = 0; + do { + _vm->_globals.Liste[idx].field0 = 0; + _vm->_globals.Liste[idx].field2 = 0; + _vm->_globals.Liste[idx].field4 = 0; + _vm->_globals.Liste[idx].width = 0; + _vm->_globals.Liste[idx].height = 0; + _vm->_globals.Liste[idx].fieldA = 0; + ++idx; + } while (idx <= 4); +} + +void ObjectsManager::SPRITE_ON(int idx) { + if (idx > 5) + error("Tentative d'affichage d'un sprite > MAX_SPRITE."); + + Sprite[idx].field0 = 1; +} + +void ObjectsManager::SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9) { + if (idx > 5 ) + (8, (int)"Tentative d'affichage d'un sprite > MAX_SPRITE."); + Sprite[idx].spriteData = spriteData; + Sprite[idx].field8 = a2; + Sprite[idx].fieldA = a3; + Sprite[idx].field10 = a5; + Sprite[idx].fieldC = a6; + Sprite[idx].field12 = a8; + Sprite[idx].field14 = a9; + Sprite[idx].field1C = PTRNUL; + Sprite[idx].field20 = 0; + Sprite[idx].field24 = 0; + Sprite[idx].field26 = 0; + Sprite[idx].field22 = 0; + Sprite[idx].field0 = 0; + Sprite[idx].field28 = 0; + Sprite[idx].fieldE = a7; + if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') + Sprite[idx].field28 = 1; + + if (Sprite[idx].field28 == 1) { + Sprite[idx].fieldC = 0; + Sprite[idx].fieldE = 0; + } +} + +void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5) { + Sprite[idx].spriteData = spriteData; + Sprite[idx].field1C = a3; + Sprite[idx].field20 = a4; + Sprite[idx].field24 = 0; + Sprite[idx].field26 = 0; + Sprite[idx].fieldC = 0; + Sprite[idx].fieldE = 0; + Sprite[idx].field0 = 1; + Sprite[idx].field22 = 0; + Sprite[idx].field14 = a5; + if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') + Sprite[idx].field28 = 1; + + if (Sprite[idx].field28 == 1) { + Sprite[idx].fieldC = 0; + Sprite[idx].fieldE = 0; + } +} + +void ObjectsManager::SPRITE_OFF(int idx) { + Sprite[idx].field0 = 3; + if (Sprite[idx].field1C != PTRNUL) + _vm->_globals.dos_free2(Sprite[idx].field1C); + Sprite[idx].field1C = PTRNUL; +} + +void ObjectsManager::SPRITE_GEL(int idx) { + Sprite[idx].field0 = 3; +} + +int ObjectsManager::SXSPR(int idx) { + if (idx > 5) + error("request of the size of a sprite x > MAX_SPRITE."); + return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10); +} + +int ObjectsManager::SYSPR(int idx) { + if (idx > 5) + error("request of the size of a sprite y > MAX_SPRITE."); + return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10); +} + +int ObjectsManager::POSISPR(int idx) { + return Sprite[idx].field22 / 6; +} + +void ObjectsManager::SETPOSISPR(int idx, int a2) { + Sprite[idx].field22 = 6 * a2; + Sprite[idx].field24 = 0; + Sprite[idx].field26 = 0; +} + +void ObjectsManager::SETXSPR(int idx, int xp) { + if (idx > 5) + error("Set the Coord. x a sprite> MAX_SPRITE."); + Sprite[idx].field8 = xp; +} + +void ObjectsManager::SETANISPR(int idx, int a2) { + if (idx > 5) + error("Set the Coord. x a sprite> MAX_SPRITE."); + + Sprite[idx].field10 = a2; +} + +void ObjectsManager::SETYSPR(int idx, int yp) { + if ( idx > 5 ) + error("Set the Coord. y a sprite> MAX_SPRITE."); + Sprite[idx].fieldA = yp; +} + +void ObjectsManager::SETTAILLESPR(int idx, int a2) { + if (idx > 5) + error("Set the Coord. there a sprite> MAX_SPRITE."); + + if (Sprite[idx].field28 != 1) + Sprite[idx].fieldC = a2; +} + +void ObjectsManager::SETFLIPSPR(int idx, int a2) { + if (Sprite[idx].field28 != 1) { + if (idx > 5) + error("Set the Coord. there a sprite> MAX_SPRITE."); + Sprite[idx].fieldE = a2; + } +} + +void ObjectsManager::VERIFZONE() { + warning("VERIFZONE"); +} + +void ObjectsManager::GOHOME2() { + warning("GOHOME2"); +} + +void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { + warning("CHARGE_OBSTACLE"); +} + +void ObjectsManager::CHARGE_CACHE(const Common::String &file) { + warning("CHARGE_CACHE"); +} + +void ObjectsManager::CHARGE_ZONE(const Common::String &file) { + warning("CHARGE_ZONE"); +} + +void ObjectsManager::PLAN_BETA() { + int v1; + int v2; + int v3; + int v4; + int v5; + + v1 = 0; + INVENTFLAG = false; + KEY_INVENT = 0; + _vm->_globals.Max_Propre = 1; + _vm->_globals.Max_Ligne_Long = 1; + _vm->_globals.Max_Propre_Gen = 1; + _vm->_globals.Max_Perso_Y = 440; + _vm->_globals.NOSPRECRAN = 1; + _vm->_globals.PLAN_FLAG = 1; + _vm->_graphicsManager.NOFADE = false; + _vm->_globals.NOMARCHE = 0; + sprite_ptr = PTRNUL; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + _vm->_globals.NOT_VERIF = 1; + _vm->_soundManager.WSOUND(31); + _vm->_globals.iRegul = 1; + _vm->_graphicsManager.LOAD_IMAGE("PLAN"); + CHARGE_OBSTACLE("PLAN.OB2"); + CHARGE_CACHE("PLAN.CA2"); + CHARGE_ZONE("PLAN.ZO2"); + FileManager::CONSTRUIT_SYSTEM("VOITURE.SPR"); + sprite_ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_animationManager.CHARGE_ANIM("PLAN"); + _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.INI_ECRAN2("PLAN"); + v2 = 0; + do { + _vm->_globals.B_CACHE_OFF(v2++); + } while (v2 <= 15); + _vm->_globals.B_CACHE_OFF(19); + _vm->_globals.B_CACHE_OFF(20); + _vm->_globals.CACHE_ON(); + + if (!_vm->_globals.PLANX && !_vm->_globals.PLANY) { + _vm->_globals.PLANX = 900; + _vm->_globals.PLANY = 319; + _vm->_globals.PLANI = 1; + } + SPRITE(sprite_ptr, _vm->_globals.PLANX, _vm->_globals.PLANY, 0, _vm->_globals.PLANI, 0, 0, 5, 5); + _vm->_eventsManager.souris_xy(_vm->_globals.PLANX, _vm->_globals.PLANY); + my_anim = 0; + _vm->_eventsManager.MOUSE_ON(); + v3 = XSPR(0); + _vm->_graphicsManager.SCROLL_ECRAN(v3 - 320); + _vm->_graphicsManager.ofscroll = XSPR(0) - 320; + SPRITE_ON(0); + _vm->_globals.chemin = PTRNUL; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_globals.BPP_NOAFF = 1; + + v4 = 0; + do { + _vm->_eventsManager.VBL(); + ++v4; + } while (v4 <= 4); + + _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.iRegul = 1; + _vm->_graphicsManager.FADE_INW(); + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_graphicsManager.NOFADE = false; + + do { + v5 = _vm->_eventsManager.BMOUSE(); + if (v5) { + if (_vm->_globals.SAUVEGARDE->field170 == 1 && !_vm->_globals.SAUVEGARDE->field171) { + _vm->_globals.SAUVEGARDE->field171 = 1; + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); + _vm->_globals.NOPARLE = false; + v5 = 0; + } + if (_vm->_globals.SAUVEGARDE->field80 == 1 && !_vm->_globals.SAUVEGARDE->field172) { + _vm->_globals.SAUVEGARDE->field172 = 1; + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); + _vm->_globals.NOPARLE = 0; + v5 = 0; + _vm->_eventsManager.souris_bb = false; + } + if (v5 == 1) + BTGAUCHE(); + } + + VERIFZONE(); + GOHOME2(); + + if (_vm->_globals.chemin == PTRNUL && _vm->_globals.GOACTION == 1) + PARADISE(); + _vm->_eventsManager.VBL(); + + if (_vm->_globals.SORTIE) + v1 = 1; + } while (v1 != 1); + + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.iRegul = 0; + _vm->_graphicsManager.NOFADE = false; + _vm->_globals.PLANX = XSPR(0); + _vm->_globals.PLANY = YSPR(0); + _vm->_globals.PLANI = 1; + SPRITE_OFF(0); + _vm->_globals.AFFLI = 0; + sprite_ptr = _vm->_globals.LIBERE_FICHIER(sprite_ptr); + CLEAR_ECRAN(); + _vm->_globals.NOSPRECRAN = 0; + _vm->_globals.PLAN_FLAG = 0; +} + +void ObjectsManager::BTGAUCHE() { + warning("TODO: BTGAUCHE"); +} + +void ObjectsManager::PARADISE() { + warning("TODO: PARADISE"); +} + +void ObjectsManager::CLEAR_ECRAN() { + warning("TODO: CLEAR_ECRAN"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 8212fa7dee..d17764881b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -31,7 +31,7 @@ namespace Hopkins { struct SpriteItem { int field0; - byte *spriteData; + const byte *spriteData; int field8; int fieldA; int fieldC; @@ -39,6 +39,11 @@ struct SpriteItem { int field10; int field12; int field14; + byte *field1C; + int field20; + int field22; + int field24; + int field26; int field28; int field2A; int field2C; @@ -68,6 +73,7 @@ public: byte *inventaire2; byte *SL_SPR; byte *SL_SPR2; + byte *sprite_ptr; bool PERSO_ON; bool SL_FLAG; bool FLAG_VISIBLE; @@ -75,6 +81,9 @@ public: int DESACTIVE_CURSOR; bool BOBTOUS; SpriteItem Sprite[6]; + bool INVENTFLAG; + int KEY_INVENT; + int my_anim; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -112,6 +121,36 @@ public: int AvantTri(int a1, int a2, int a3); void AFF_BOB_ANIM(); void AFF_VBOB(); + + int XSPR(int idx); + int YSPR(int idx); + void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8); + + void CLEAR_SPR(); + void SPRITE_ON(int idx); + void SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9); + void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5); + void SPRITE_OFF(int idx); + void SPRITE_GEL(int idx); + int SXSPR(int idx); + int SYSPR(int idx); + int POSISPR(int idx); + void SETPOSISPR(int idx, int a2); + void SETXSPR(int idx, int xp); + void SETANISPR(int idx, int a2); + void SETYSPR(int idx, int yp); + void SETTAILLESPR(int idx, int a2); + void SETFLIPSPR(int idx, int a2); + + void VERIFZONE(); + void GOHOME2(); + void CHARGE_OBSTACLE(const Common::String &file); + void CHARGE_CACHE(const Common::String &file); + void CHARGE_ZONE(const Common::String &file); + void PLAN_BETA(); + void BTGAUCHE(); + void PARADISE(); + void CLEAR_ECRAN(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0051c4efc1..2043f9a245 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -37,6 +37,145 @@ void TalkManager::setParent(HopkinsEngine *vm) { _vm = vm; } +void TalkManager::PARLER_PERSO(const Common::String &filename) { + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + byte *v8; + byte *v9; + byte *v10; + int v11; + byte v13; + int v14; + int v15; + Common::String v16; + + v15 = 0; + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.no_scroll = 1; + v13 = _vm->_globals.DESACTIVE_INVENT; + _vm->_globals.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(40, v16, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); + if (_vm->_globals.FR == 1) { + FREPON = FQUEST = "RUE.TXT"; + } else if (!_vm->_globals.FR) { + FREPON = FQUEST = "RUEAN.TXT"; + } else if (_vm->_globals.FR == 2) { + FREPON = FQUEST = "RUEES.TXT"; + } + v2 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); + v3 = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + PERSOSPR = FileManager::RECHERCHE_CAT(v16, 7); + if (PERSOSPR) { + _vm->_globals.CAT_FLAG = 0; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v16); + } else { + _vm->_globals.CAT_FLAG = 1; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); + } + PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_globals.CAT_FLAG = 0; + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + if (_vm->_graphicsManager.nbrligne == 640) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (_vm->_graphicsManager.nbrligne == 1280) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) + _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_objectsManager.PERSO_ON = 1; + CHERCHE_PAL(v3, 0); + CHERCHE_ANIM0(v3, 0); + ANIM_PERSO_INIT(); + PLIGNE1 = v2; + PLIGNE2 = v2 + 1; + PLIGNE3 = v2 + 2; + PLIGNE4 = v2 + 3; + v14 = _vm->_eventsManager.btsouris; + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(0); + if (!_vm->_globals.NOPARLE) { + v4 = v2 + 3; + do { + v5 = DIALOGUE(); + if ((signed __int16)v5 != v4) + v15 = DIALOGUE_REP(v5); + if (v15 == -1) + v5 = v2 + 3; + _vm->_eventsManager.VBL(); + } while ((signed __int16)v5 != v4); + } + if (_vm->_globals.NOPARLE == 1) { + v6 = 1; + do + v7 = DIALOGUE_REP(v6++); + while (v7 != -1); + } + CLEAR_ANIM_PERSO(); + _vm->_globals.NOPARLE = 0; + _vm->_globals.NECESSAIRE = 1; + BUFFERPERSO = FileManager::LIBERE_FICHIER(BUFFERPERSO); + PERSOSPR = FileManager::LIBERE_FICHIER(PERSOSPR); + _vm->_graphicsManager.NB_SCREEN(); + _vm->_globals.NECESSAIRE = 0; + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_objectsManager.PERSO_ON = 0; + _vm->_eventsManager.btsouris = v14; + + _vm->_eventsManager.CHANGE_MOUSE(v14); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.DD_LOCK(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + } + _vm->_graphicsManager.DD_UNLOCK(); + v8 = _vm->_graphicsManager.VESA_BUFFER; + v9 = _vm->_graphicsManager.VESA_SCREEN; + memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); + v9 = v9 + 614396; + v8 = v8 + 614396; + *v8 = *v9; + v8 = v8 + 2; + *v8 = *(v9 + 2); + v10 = v8 + 1; + _vm->_globals.DESACTIVE_INVENT = v13; + _vm->_graphicsManager.DD_VBL(); + v11 = 0; + do { + _vm->_eventsManager.VBL(); + ++v11; + } while (v11 <= 4); + _vm->_graphicsManager.no_scroll = 0; +} + void TalkManager::PARLER_PERSO2(const Common::String &filename) { int v1; int v2; @@ -598,4 +737,16 @@ void TalkManager::BOB_VISU_PARLE(int idx) { } } +void TalkManager::CHERCHE_ANIM0(int a1, int a2) { + warning("TODO: CHERCHE_ANIM0"); +} + +void TalkManager::ANIM_PERSO_INIT() { + warning("TODO: ANIM_PERSO_INIT"); +} + +void TalkManager::CLEAR_ANIM_PERSO() { + warning("TODO: CLEAR_ANIM_PERSO"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 6e6cb2d608..137ff983d4 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -48,6 +48,7 @@ public: void setParent(HopkinsEngine *vm); void PARLER_PERSO2(const Common::String &filename); + void PARLER_PERSO(const Common::String &filename); void RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData); int DIALOGUE(); int DIALOGUE_REP(int idx); @@ -58,6 +59,9 @@ public: int VERIF_BOITE(__int16 a1, const Common::String &a2, __int16 a3); void VISU_PARLE(); void BOB_VISU_PARLE(int idx); + void CHERCHE_ANIM0(int a1, int a2); + void ANIM_PERSO_INIT(); + void CLEAR_ANIM_PERSO(); }; } // End of namespace Hopkins -- cgit v1.2.3 From 3594a691abbc678cf8c31dd94b54453ed0534335 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Sep 2012 22:49:43 +1000 Subject: HOPKINS: Implemented stubbed talk manager methods --- engines/hopkins/talk.cpp | 214 +++++++++++++++++++++++++++++++++++++++++++---- engines/hopkins/talk.h | 4 +- 2 files changed, 202 insertions(+), 16 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2043f9a245..12a8b83b76 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -114,12 +114,12 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v4 = v2 + 3; do { v5 = DIALOGUE(); - if ((signed __int16)v5 != v4) + if (v5 != v4) v15 = DIALOGUE_REP(v5); if (v15 == -1) v5 = v2 + 3; _vm->_eventsManager.VBL(); - } while ((signed __int16)v5 != v4); + } while (v5 != v4); } if (_vm->_globals.NOPARLE == 1) { v6 = 1; @@ -179,7 +179,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { void TalkManager::PARLER_PERSO2(const Common::String &filename) { int v1; int v2; - uint v3; + int v3; int v4; int v5; byte v7; @@ -233,12 +233,12 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { v2 = v1 + 3; do { v3 = DIALOGUE(); - if ((signed __int16)v3 != v2) + if (v3 != v2) v9 = DIALOGUE_REP(v3); if (v9 == -1) v3 = v1 + 3; - } while ((signed __int16)v3 != v2); + } while (v3 != v2); } if (_vm->_globals.NOPARLE) { @@ -323,7 +323,7 @@ int TalkManager::DIALOGUE() { v6 = 0; do { v7 = _vm->_eventsManager.YMOUSE(); - if ((signed __int16)(v4 - 20 * v19) < v7 && (signed __int16)(v4 - 1) > v7) { + if ((v4 - 20 * v19) < v7 && (v4 - 1) > v7) { v8 = v7; _vm->_fontManager.OPTI_COUL_TXT(6, 7, 8, 5); v5 = PLIGNE1; @@ -335,7 +335,7 @@ int TalkManager::DIALOGUE() { v5 = PLIGNE2; v7 = v9; } - if (v21 < v7 && (signed __int16)(v20 - 1) > v7) { + if (v21 < v7 && (v20 - 1) > v7) { v10 = v7; _vm->_fontManager.OPTI_COUL_TXT(5, 6, 8, 7); v5 = PLIGNE3; @@ -506,11 +506,11 @@ int TalkManager::DIALOGUE_REP(int idx) { } void TalkManager::CHERCHE_PAL(int a1, int a2) { - __int16 v2; + int v2; size_t v4; - unsigned __int16 v5; + unsigned int v5; byte *palette; - signed __int16 v8; + signed int v8; v2 = 0; v8 = 0; @@ -599,7 +599,7 @@ void TalkManager::FIN_VISU_PARLE(int a1) { } } -int TalkManager::VERIF_BOITE(__int16 idx, const Common::String &file, __int16 a3) { +int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { int v6; int v7; char v8; @@ -671,7 +671,7 @@ int TalkManager::VERIF_BOITE(__int16 idx, const Common::String &file, __int16 a3 } while ((unsigned int)v7 < 0x800); v9 = 0; - v15 = (signed __int16)(11 * a3) - 4; + v15 = (11 * a3) - 4; do { v10 = 0; for (;;) { @@ -738,15 +738,199 @@ void TalkManager::BOB_VISU_PARLE(int idx) { } void TalkManager::CHERCHE_ANIM0(int a1, int a2) { - warning("TODO: CHERCHE_ANIM0"); + size_t v2; + signed int v3; + size_t v4; + unsigned int v5; + unsigned int v6; + int v7; + byte *v8; + byte *v9; + + v2 = 0; + v3 = 0; + v4 = a1; + while (1) { + if (*(BUFFERPERSO + v4) == 'A' + && *(BUFFERPERSO + v4 + 1) == 'N' + && *(BUFFERPERSO + v4 + 2) == 'I' + && *(BUFFERPERSO + v4 + 3) == 'M' + && *(BUFFERPERSO + v4 + 4) == 1) { + v3 = 1; + v2 = v4; + } + ++v4; + if (v3 == 1) + break; + if (TAILLEPERSO == v4) + return; + } + v5 = v2 + 25; + v9 = BUFFERPERSO + v5; + v8 = BUFFERPERSO + v5; + ADR_ANIM = BUFFERPERSO + v5; + if (!a2) { + v6 = 0; + do { + v7 = READ_LE_UINT16(&v8[2 * v6 + 4]); + if (v7 && _vm->_globals.vitesse != 501) + _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager.start_x + READ_LE_UINT16(&v8[2 * v6]), + READ_LE_UINT16(&v8[2 * v6 + 2]), (unsigned __int8)v9[2 * v6 + 8]); + v6 += 5; + } while (_vm->_globals.vitesse != 501 && v7); + } } void TalkManager::ANIM_PERSO_INIT() { - warning("TODO: ANIM_PERSO_INIT"); + byte *v0; + byte *v1; + int v2; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + + v0 = BUFFERPERSO; + v1 = BUFFERPERSO + 110; + v2 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + if (v2) + RECHERCHE_ANIM_PERSO(21, (BUFFERPERSO + 110), v2, TAILLEPERSO); + v4 = READ_LE_UINT16((uint16 *)v0 + 44); + if (v4) + RECHERCHE_ANIM_PERSO(22, v1, v4, TAILLEPERSO); + v5 = READ_LE_UINT16((uint16 *)v0 + 45); + if (v5) + RECHERCHE_ANIM_PERSO(23, v1, v5, TAILLEPERSO); + v6 = READ_LE_UINT16((uint16 *)v0 + 46); + if (v6) + RECHERCHE_ANIM_PERSO(24, v1, v6, TAILLEPERSO); + v7 = READ_LE_UINT16((uint16 *)v0 + 47); + if (v7) + RECHERCHE_ANIM_PERSO(25, v1, v7, TAILLEPERSO); + v8 = READ_LE_UINT16((uint16 *)v0 + 48); + if (v8) + RECHERCHE_ANIM_PERSO(26, v1, v8, TAILLEPERSO); + v9 = READ_LE_UINT16((uint16 *)v0 + 49); + if (v9) + RECHERCHE_ANIM_PERSO(27, v1, v9, TAILLEPERSO); + v10 = READ_LE_UINT16((uint16 *)v0 + 50); + if (v10) + RECHERCHE_ANIM_PERSO(28, v1, v10, TAILLEPERSO); + v11 = READ_LE_UINT16((uint16 *)v0 + 51); + if (v11) + RECHERCHE_ANIM_PERSO(29, v1, v11, TAILLEPERSO); + v12 = READ_LE_UINT16((uint16 *)v0 + 52); + if (v12) + RECHERCHE_ANIM_PERSO(30, v1, v12, TAILLEPERSO); } void TalkManager::CLEAR_ANIM_PERSO() { - warning("TODO: CLEAR_ANIM_PERSO"); + for (int idx = 21; idx <= 34; ++idx) { + if (_vm->_globals.Bqe_Anim[idx].data != PTRNUL) + _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); + + _vm->_globals.Bqe_Anim[idx].data = PTRNUL; + _vm->_globals.Bqe_Anim[idx].field4 = 0; + } +} + +bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int a4) { + bool result; + const byte *v5; + int v6; + signed int v7; + byte *v8; + byte *v9; + __int16 v10; + __int16 v11; + __int16 v12; + char v13; + __int16 v14; + __int16 v15; + __int16 v16; + char v17; + int v18; + signed int v19; + int v20; + int v22; + __int16 v23; + const byte *v24; + + v22 = 0; + result = false; + + v20 = a1; + do { + if (*(v22 + bufPerso) == 'A' && *(bufPerso + v22 + 1) == 'N' && *(bufPerso + v22 + 2) == 'I' && *(bufPerso + v22 + 3) == 'M' + && *(bufPerso + v22 + 4) == a3) { + v5 = v22 + bufPerso + 5; + v18 = v22 + 5; + v6 = 0; + v7 = 0; + do { + if (*v5 == 'A' && *(v5 + 1) == 'N' && *(v5 + 2) == 'I' && *(v5 + 3) == 'M') + v7 = 1; + if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') + v7 = 1; + if (v18 > a4) { + _vm->_globals.Bqe_Anim[a1].field4 = 0; + result = PTRNUL; + _vm->_globals.Bqe_Anim[v20].data = PTRNUL; + } + ++v18; + ++v6; + ++v5; + } while (v7 != 1); + _vm->_globals.Bqe_Anim[v20].data = _vm->_globals.dos_malloc2(v6 + 50); + _vm->_globals.Bqe_Anim[a1].field4 = 1; + memcpy(_vm->_globals.Bqe_Anim[v20].data, (const byte *)(v22 + bufPerso + 5), 20); + v8 = _vm->_globals.Bqe_Anim[v20].data; + + v9 = v8 + 20; + v24 = v22 + bufPerso + 25; + v10 = READ_LE_UINT16(v22 + bufPerso + 25); + v11 = READ_LE_UINT16(v22 + bufPerso + 27); + v23 = READ_LE_UINT16(v22 + bufPerso + 29); + v12 = READ_LE_UINT16(v22 + bufPerso + 31); + v13 = *(v22 + bufPerso + 33); + *(v8 + 29) = *(v22 + bufPerso + 34); + WRITE_LE_UINT16(v8 + 20, v10); + WRITE_LE_UINT16(v8 + 22, v11); + WRITE_LE_UINT16(v8 + 24, v23); + WRITE_LE_UINT16(v8 + 26, v12); + *(v8 + 28) = v13; + v19 = 1; + do { + v9 += 10; + v24 += 10; + if (!v23) + break; + v14 = READ_LE_UINT16(v24); + v15 = READ_LE_UINT16(v24 + 2); + v23 = READ_LE_UINT16(v24 + 4); + v16 = READ_LE_UINT16(v24 + 6); + v17 = *(v24 + 8); + *(v9 + 9) = *(v24 + 9); + WRITE_LE_UINT16(v9, v14); + WRITE_LE_UINT16(v9 + 2, v15); + WRITE_LE_UINT16(v9 + 4, v23); + WRITE_LE_UINT16(v9 + 6, v16); + *(v9 + 8) = v17; + ++v19; + } while (v19 <= 4999); + result = 1; + } + if (*(bufPerso + v22) == 'F' && *(bufPerso + v22 + 1) == 'I' && *(bufPerso + v22 + 2) == 'N') + result = true; + ++v22; + } while (v22 <= a4 && result != 1); + + return result; } } // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 137ff983d4..cb97a02e0c 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -39,6 +39,7 @@ public: byte *BUFFERPERSO; byte *PALPERSO; byte *PERSOSPR; + byte *ADR_ANIM; size_t TAILLEPERSO; int STATI; int PLIGNE1, PLIGNE2; @@ -56,12 +57,13 @@ public: void VISU_WAIT(); void FIN_VISU_WAIT(); void FIN_VISU_PARLE(int a1); - int VERIF_BOITE(__int16 a1, const Common::String &a2, __int16 a3); + int VERIF_BOITE(int a1, const Common::String &a2, int a3); void VISU_PARLE(); void BOB_VISU_PARLE(int idx); void CHERCHE_ANIM0(int a1, int a2); void ANIM_PERSO_INIT(); void CLEAR_ANIM_PERSO(); + bool RECHERCHE_ANIM_PERSO(int a1, const byte *a2, int a3, int a4); }; } // End of namespace Hopkins -- cgit v1.2.3 From 92313216dd0b9a42de528ccab02f87d1894dff2c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Sep 2012 09:33:42 +1000 Subject: HOPKINS: Implemented more graphics and object methods --- engines/hopkins/globals.cpp | 21 +- engines/hopkins/globals.h | 31 ++- engines/hopkins/graphics.cpp | 41 +++- engines/hopkins/graphics.h | 3 + engines/hopkins/objects.cpp | 556 ++++++++++++++++++++++++++++++++++++++++--- engines/hopkins/objects.h | 35 +++ engines/hopkins/talk.cpp | 9 + engines/hopkins/talk.h | 2 + 8 files changed, 659 insertions(+), 39 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 7caf57c7b6..6f6543d3d0 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -223,9 +223,9 @@ void Globals::clearAll() { OBJET_EN_COURS = 0; for (int idx = 0; idx < 105; ++idx) { - ZoneP[idx].field0 = 0; - ZoneP[idx].field2 = 0; - ZoneP[idx].field4 = 0; + ZONEP[idx].field0 = 0; + ZONEP[idx].field2 = 0; + ZONEP[idx].field4 = 0; } essai0 = PTRNUL; @@ -683,6 +683,19 @@ void Globals::INIT_VBOB() { } } +void Globals::CLEAR_VBOB() { + for (int idx = 0; idx < 30; ++idx) { + VBob[idx].field4 = 0; + VBob[idx].field6 = 0; + VBob[idx].field8 = 0; + VBob[idx].fieldA = 0; + VBob[idx].fieldC = 0; + VBob[idx].field10 = PTRNUL; + VBob[idx].field0 = PTRNUL; + VBob[idx].field1C = PTRNUL; + } +} + void Globals::CHARGE_OBJET() { FileManager::CONSTRUIT_SYSTEM("OBJET.DAT"); byte *data = FileManager::CHARGE_FICHIER(NFICHIER); @@ -762,7 +775,7 @@ void Globals::CACHE_ADD(int idx) { } void Globals::CHARGE_CACHE(const Common::String &file) { - byte *v2; + byte *v2 = PTRNUL; int v4; int v5; int v6; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index ffb80fd9a0..49a982b686 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -32,6 +32,18 @@ struct ZonePItem { int field0; int field2; int field4; + int field6; + int field7; + int field8; + int field9; + int fieldA; + int fieldB; + int fieldC; + int fieldD; + int fieldE; + int fieldF; + int field12; + int field16; }; struct LigneItem { @@ -183,7 +195,11 @@ struct CacheItem { // Note: Fields decimal based for now struct Sauvegarde { + int field1; + int field2; + int field3; int field4; + int field13; int field80; int field170; int field171; @@ -240,7 +256,7 @@ public: int lItCounter; int lOldItCounter; int g_old_anim; - int g_old_sens; + int g_old_sens, g_old_sens2; int HopkinsArr[140]; byte *police; int police_l; @@ -249,7 +265,7 @@ public: byte *ICONE; byte *BUF_ZONE; byte *CACHE_BANQUE[6]; - ZonePItem ZoneP[105]; + ZonePItem ZONEP[106]; LigneItem Ligne[400]; LigneZoneItem LigneZone[400]; CarreZoneItem CarreZone[100]; @@ -263,6 +279,8 @@ public: ObjetWItem ObjetW[300]; BlocItem BLOC[250]; CacheItem Cache[25]; + int BOBZONE[105]; + bool BOBZONE_FLAG[105]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -340,6 +358,14 @@ public: bool PLAN_FLAG; int GOACTION; int NECESSAIRE; + int Compteur; + int ACTION_SENS; + + int force_to_data_0; + int old_zone_68; + int old_x_69, old_y_70; + int compteur_71; + int zozo_73; Globals(); ~Globals(); @@ -350,6 +376,7 @@ public: void HOPKINS_DATA(); void INIT_ANIM(); void INIT_VBOB(); + void CLEAR_VBOB(); void CHARGE_OBJET(); byte *dos_malloc2(int count); byte *dos_free2(byte *p); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index e1d360e731..dab66f1709 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -965,11 +965,44 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa } } +void GraphicsManager::SETCOLOR(int palIndex, int r, int g, int b) { + _vm->_graphicsManager.Palette[palIndex * 3] = 255 * r / 100; + _vm->_graphicsManager.Palette[palIndex * 3 + 1] = 255 * g / 100; + _vm->_graphicsManager.Palette[palIndex * 3 + 2] = 255 * b / 100; + + setpal_vga256(Palette); +} + +void GraphicsManager::SETCOLOR2(int palIndex, int r, int g, int b) { + return SETCOLOR(palIndex, r, g, b); +} + 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; + Palette[palIndex * 3] = 255 * r / 100; + Palette[palIndex * 3 + 1] = 255 * g / 100; + Palette[palIndex * 3 + 2] = 255 * b / 100; +} + +void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { + int rv, gv, bv; + int palOffset; + int v8; + + rv = 255 * r / 100; + gv = 255 * g / 100; + bv = 255 * b / 100; + palOffset = 3 * palIndex; + Palette[palOffset] = 255 * r / 100; + Palette[palOffset + 1] = gv; + Palette[palOffset + 2] = bv; + + v8 = 4 * palIndex; + cmap[v8] = rv; + cmap[v8 + 1] = gv; + cmap[v8 + 2] = bv; + + WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); + g_system->getPaletteManager()->setPalette(cmap, palIndex, 1); } void GraphicsManager::CHANGE_PALETTE(const byte *palette) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 8e64e44785..8cd6a7b10e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -135,7 +135,10 @@ public: void FADE_INW_LINUX(const byte *surface); void setpal_vga256(const byte *palette); void setpal_vga256_linux(const byte *palette, const byte *surface); + void SETCOLOR(int palIndex, int r, int g, int b); + void SETCOLOR2(int palIndex, int r, int g, int b); void SETCOLOR3(int palIndex, int r, int g, int b); + void SETCOLOR4(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(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b943def1bd..edd700b577 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -57,9 +57,9 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { byte *ObjectsManager::CHANGE_OBJET(int objIndex) { byte *result = ObjectsManager::CAPTURE_OBJET(objIndex, 1); - GLOBALS.Bufferobjet = result; - GLOBALS.Nouv_objet = 1; - GLOBALS.OBJET_EN_COURS = objIndex; + _vm->_globals.Bufferobjet = result; + _vm->_globals.Nouv_objet = 1; + _vm->_globals.OBJET_EN_COURS = objIndex; return result; } @@ -68,43 +68,43 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { byte *dataP; dataP = 0; - int val1 = GLOBALS.ObjetW[objIndex].field0; - int val2 = GLOBALS.ObjetW[objIndex].field1; + int val1 = _vm->_globals.ObjetW[objIndex].field0; + int val2 = _vm->_globals.ObjetW[objIndex].field1; if (mode == 1) ++val2; - if (val1 != GLOBALS.NUM_FICHIER_OBJ) { - if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) + if (val1 != _vm->_globals.NUM_FICHIER_OBJ) { + if (_vm->_globals.ADR_FICHIER_OBJ != PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); - GLOBALS.ADR_FICHIER_OBJ = ObjectsManager::CHARGE_SPRITE(GLOBALS.NFICHIER); + _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::CHARGE_SPRITE(_vm->_globals.NFICHIER); } - GLOBALS.NUM_FICHIER_OBJ = val1; + _vm->_globals.NUM_FICHIER_OBJ = val1; } - int width = ObjectsManager::Get_Largeur(GLOBALS.ADR_FICHIER_OBJ, val2); - int height = ObjectsManager::Get_Hauteur(GLOBALS.ADR_FICHIER_OBJ, val2); - GLOBALS.OBJL = width; - GLOBALS.OBJH = height; + int width = ObjectsManager::Get_Largeur(_vm->_globals.ADR_FICHIER_OBJ, val2); + int height = ObjectsManager::Get_Hauteur(_vm->_globals.ADR_FICHIER_OBJ, val2); + _vm->_globals.OBJL = width; + _vm->_globals.OBJH = height; switch (mode) { case 0: - dataP = GLOBALS.dos_malloc2(height * width); + dataP = _vm->_globals.dos_malloc2(height * width); if (dataP == PTRNUL) error("CAPTURE_OBJET"); - ObjectsManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, dataP, val2); + ObjectsManager::capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); break; case 1: - ObjectsManager::sprite_alone(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.Bufferobjet, val2); - result = GLOBALS.Bufferobjet; + ObjectsManager::sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.Bufferobjet, val2); + result = _vm->_globals.Bufferobjet; break; case 3: - ObjectsManager::capture_mem_sprite(GLOBALS.ADR_FICHIER_OBJ, GLOBALS.INVENTAIRE_OBJET, val2); - result = GLOBALS.INVENTAIRE_OBJET; + ObjectsManager::capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.INVENTAIRE_OBJET, val2); + result = _vm->_globals.INVENTAIRE_OBJET; break; default: @@ -189,12 +189,12 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn } byte *ObjectsManager::DEL_FICHIER_OBJ() { - GLOBALS.NUM_FICHIER_OBJ = 0; - if (GLOBALS.ADR_FICHIER_OBJ != PTRNUL) - GLOBALS.ADR_FICHIER_OBJ = FileManager::LIBERE_FICHIER(GLOBALS.ADR_FICHIER_OBJ); + _vm->_globals.NUM_FICHIER_OBJ = 0; + if (_vm->_globals.ADR_FICHIER_OBJ != PTRNUL) + _vm->_globals.ADR_FICHIER_OBJ = FileManager::LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); byte *result = PTRNUL; - GLOBALS.ADR_FICHIER_OBJ = PTRNUL; + _vm->_globals.ADR_FICHIER_OBJ = PTRNUL; return result; } @@ -221,13 +221,13 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { int arrIndex = 0; do { ++arrIndex; - if (!GLOBALS.INVENTAIRE[arrIndex]) + if (!_vm->_globals.INVENTAIRE[arrIndex]) flag = true; if (arrIndex == 32) flag = true; } while (!flag); - GLOBALS.INVENTAIRE[arrIndex] = objIndex; + _vm->_globals.INVENTAIRE[arrIndex] = objIndex; return arrIndex; } @@ -1675,7 +1675,109 @@ void ObjectsManager::SETFLIPSPR(int idx, int a2) { } void ObjectsManager::VERIFZONE() { - warning("VERIFZONE"); + __int16 v0; + int v1; + __int16 v2; + unsigned __int16 v3; + __int16 v4; + + v0 = _vm->_eventsManager.XMOUSE(); + v1 = _vm->_eventsManager.YMOUSE(); + v2 = v1; + if (_vm->_globals.PLAN_FLAG + || _vm->_eventsManager.start_x >= v0 + || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) + || (v1 = v2 - 1, (unsigned __int16)(v2 - 1) > 0x3Bu)) { + if (FLAG_VISIBLE == 1) + FLAG_VISIBLE_EFFACE = 4; + FLAG_VISIBLE = 0; + } else { + FLAG_VISIBLE = 1; + } + if (FORCEZONE == 1) { + _vm->_globals.compteur_71 = 100; + _vm->_globals.old_zone_68 = -1; + _vm->_globals.old_x_69 = -200; + _vm->_globals.old_y_70 = -220; + FORCEZONE = 0; + } + v3 = _vm->_globals.compteur_71 + 1; + _vm->_globals.compteur_71 = v3; + if (v3 > 1u) { + if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == PTRNUL) || v3 > 4u) { + _vm->_globals.compteur_71 = 0; + if (_vm->_globals.old_x_69 != v0 || _vm->_globals.old_y_70 != v2) { + v4 = MZONE(); + } else { + v4 = _vm->_globals.old_zone_68; + } + if (_vm->_globals.old_zone_68 != v4) { + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(4); + if (_vm->_globals.zozo_73 == 1) { + _vm->_fontManager.TEXTE_OFF(5); + _vm->_globals.zozo_73 = 0; + return; + } + if (_vm->_globals.old_zone_68 != v4) + goto LABEL_54; + } + if (v4 != -1) { +LABEL_54: + if (v4 != -1 + && ((_vm->_globals.ZONEP[v4].field6) + || _vm->_globals.ZONEP[v4].field7 + || _vm->_globals.ZONEP[v4].field8 + || _vm->_globals.ZONEP[v4].field9 + || _vm->_globals.ZONEP[v4].fieldA + || _vm->_globals.ZONEP[v4].fieldB + || _vm->_globals.ZONEP[v4].fieldC + || _vm->_globals.ZONEP[v4].fieldD + || _vm->_globals.ZONEP[v4].fieldE + || _vm->_globals.ZONEP[v4].fieldF)) { + if (_vm->_globals.old_zone_68 != v4) { + _vm->_fontManager.DOS_TEXT(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 20, 25, 0, 0, 252); + _vm->_fontManager.TEXTE_ON(5); + _vm->_globals.zozo_73 = 1; + } + _vm->_globals.force_to_data_0 += 25; + if (_vm->_globals.force_to_data_0 > 100) + _vm->_globals.force_to_data_0 = 0; + _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, + _vm->_globals.force_to_data_0); + if (_vm->_eventsManager.btsouris == 4) { + v1 = 5 * v4; + if (_vm->_globals.ZONEP[v4].field6 == 2) { + _vm->_eventsManager.CHANGE_MOUSE(16); + _vm->_eventsManager.btsouris = 16; + verbe = 16; + } + } + } else { + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(4); + } + } + _vm->_objectsManager.NUMZONE = v4; + _vm->_globals.old_x_69 = v0; + _vm->_globals.old_y_70 = v2; + _vm->_globals.old_zone_68 = v4; + if (_vm->_globals.NOMARCHE == 1) { + if (_vm->_eventsManager.btsouris == 4) { + v1 = v4 + 1; + if ((unsigned __int16)(v4 + 1) > 1u) + BTDROITE(); + } + } + if (_vm->_globals.PLAN_FLAG == 1 && v4 == -1 || !v4) { + verbe = 0; + _vm->_eventsManager.btsouris = 0; + _vm->_eventsManager.CHANGE_MOUSE(0); + } + } + } } void ObjectsManager::GOHOME2() { @@ -1817,15 +1919,411 @@ void ObjectsManager::PLAN_BETA() { } void ObjectsManager::BTGAUCHE() { - warning("TODO: BTGAUCHE"); + int v0; + __int16 v1; + __int16 v2; + byte *v3; + byte *v4; + byte *v5; + int v6; + __int16 v7; + __int16 v8; + byte *v9; + __int16 v10; + __int16 v11; + __int16 v12; + byte *v13; + __int16 v14; + __int16 v15; + byte *v16; + __int16 v17; + __int16 v18; + __int16 v19; + + _vm->_fontManager.TEXTE_OFF(9); + v19 = _vm->_eventsManager.XMOUSE(); + v0 = _vm->_eventsManager.YMOUSE(); + if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && v19 > _vm->_graphicsManager.ofscroll - 30 && v19 < _vm->_graphicsManager.ofscroll + 50 && (uint16)(v0 + 29) <= 0x4Eu) { + v1 = _vm->_eventsManager.btsouris; + INVENTFLAG = 1; + INVENT(); + INVENTFLAG = 0; + KEY_INVENT = 0; + if (!_vm->_globals.SORTIE) { + INVENTFLAG = 0; + _vm->_eventsManager.btsouris = v1; + } + return; + } + if (_vm->_globals.SAUVEGARDE->field354 == 1 + && !_vm->_globals.PLAN_FLAG + && (uint16)(v19 - 533) <= 0x1Au + && (uint16)(v0 - 26) <= 0x21u) { + CHANGE_TETE(1, 0); + return; + } + if (_vm->_globals.SAUVEGARDE->field356 == 1 + && !_vm->_globals.PLAN_FLAG + && (uint16)(v19 - 533) <= 0x1Au + && (uint16)(v0 - 26) <= 0x21u) { + CHANGE_TETE(2, 0); + return; + } + if (_vm->_globals.SAUVEGARDE->field357 == 1) { + if (_vm->_globals.SAUVEGARDE->field353 == 1 + && !_vm->_globals.PLAN_FLAG + && (uint16)(v19 - 533) <= 0x1Au + && (uint16)(v0 - 26) <= 0x21u) { + CHANGE_TETE(0, 1); + return; + } + if (_vm->_globals.SAUVEGARDE->field355 == 1 + && !_vm->_globals.PLAN_FLAG + && (uint16)(v19 - 567) <= 0x1Au + && (uint16)(v0 - 26) <= 0x21u) { + CHANGE_TETE(0, 2); + return; + } + } + if (_vm->_globals.PLAN_FLAG == 1) { + if (GOACTION != 1) + goto LABEL_38; + VERIFZONE(); + if (NUMZONE <= 0) + return; + v2 = 0; + v3 = _vm->_globals.essai2; + v4 = _vm->_globals.chemin; + do { + WRITE_LE_UINT16(v3 + 2 * v2, READ_LE_UINT16(v4 + 2 * v2)); + ++v2; + } while ((int16)READ_LE_UINT16(v4 + 2 * v2) != -1); + v5 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v2, (uint16)-1); + WRITE_LE_UINT16(v5 + 2 * v2 + 2, (uint16)-1); + WRITE_LE_UINT16(v5 + 2 * v2 + 4, (uint16)-1); + WRITE_LE_UINT16(v5 + 2 * v2 + 6, (uint16)-1); + } + if (GOACTION == 1) { + VERIFZONE(); + GOACTION = 0; + _vm->_globals.SAUVEGARDE->field1 = 0; + _vm->_globals.SAUVEGARDE->field2 = 0; + } +LABEL_38: + if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) + return; + if ((uint16)(NUMZONE + 1) > 1u) { + v6 = NUMZONE; + v7 = _vm->_globals.ZONEP[v6].field0; + if (v7) { + v8 = _vm->_globals.ZONEP[v6].field2; + if (v8) { + if (v8 != 31) { + v19 = v7; + v0 = v8; + } + } + } + } + GOACTION = 0; + v9 = _vm->_globals.chemin; + _vm->_globals.chemin = PTRNUL; + if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { + if ((signed __int16)YSPR(0) <= 374 || (signed __int16)YSPR(0) > 410) { + v10 = XSPR(0); + v11 = YSPR(0); + v12 = XSPR(0); + v13 = PARCOURS2(v12, v11, v10, 390); + _vm->_globals.chemin = v13; + if (PTRNUL != v13) + PACOURS_PROPRE(v13); + g_old_x = XSPR(0); + g_old_y = YSPR(0); + _vm->_globals.Compteur = 0; + if (PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) { +LABEL_64: + _vm->_globals.g_old_sens = -1; + goto LABEL_65; + } + goto LABEL_63; + } + _vm->_globals.chemin = PTRNUL; + SETANISPR(0, _vm->_globals.g_old_sens2 + 59); + _vm->_globals.ACTION_SENS = 0; + _vm->_globals.chemin = PTRNUL; + VERIFTAILLE(); + SETFLIPSPR(0, 0); + _vm->_globals.Compteur = 0; + _vm->_globals.g_old_sens = -1; + goto LABEL_65; + } + if (!_vm->_globals.NOMARCHE) { + if (!_vm->_globals.PLAN_FLAG) { + v14 = YSPR(0); + v15 = XSPR(0); + v16 = PARCOURS2(v15, v14, v19, v0); + _vm->_globals.chemin = v16; + if (PTRNUL != v16) + PACOURS_PROPRE(v16); + g_old_x = XSPR(0); + g_old_y = YSPR(0); + _vm->_globals.Compteur = 0; + if (PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) + goto LABEL_64; +LABEL_63: + _vm->_globals.chemin = v9; + } +LABEL_65: + if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == 1) { + v17 = YSPR(0); + v18 = XSPR(0); + _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0); + } + } + if ((uint16)(NUMZONE + 1) > 1u) { + // TODO: Reformat the weird if statement generated by the decompiler + if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->field1 = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) + _vm->_globals.SAUVEGARDE->field1 = 5; + if (_vm->_globals.PLAN_FLAG == 1) + _vm->_globals.SAUVEGARDE->field1 = 6; + _vm->_globals.SAUVEGARDE->field2 = NUMZONE; + _vm->_globals.SAUVEGARDE->field3 = _vm->_globals.OBJET_EN_COURS; + GOACTION = 1; + } + _vm->_fontManager.TEXTE_OFF(5); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + ARRET_PERSO_FLAG = 0; + if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[NUMZONE]) { + ARRET_PERSO_FLAG = 1; + ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; + } + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->field13 == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 + && _vm->_eventsManager.btsouris == 23) { + _vm->_globals.chemin = PTRNUL; + XSPR(0); + YSPR(0); + } } void ObjectsManager::PARADISE() { - warning("TODO: PARADISE"); + signed int v1; // esi@1 + char result; // al@1 + int v3; // eax@11 + unsigned __int16 v4; // ax@19 + int v5; // eax@24 + unsigned __int16 v6; // ax@33 + + v1 = 0; + ARRET_PERSO_FLAG = 0; + ARRET_PERSO_NUM = 0; + result = _vm->_globals.SAUVEGARDE->field1; + if (result && _vm->_globals.SAUVEGARDE->field2 && result != 4 && result > 3) { + _vm->_fontManager.TEXTE_OFF(5); + if (_vm->_globals.FORET != 1 || (unsigned __int16)(NUMZONE - 20) > 1u && (unsigned __int16)(NUMZONE - 22) > 1u) { + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.no_scroll = 2; + if (_vm->_eventsManager.start_x >= (signed __int16)XSPR(0) - 320) + goto LABEL_64; + v3 = _vm->_eventsManager.start_x + 320 - (signed __int16)XSPR(0); + if (v3 < 0) + v3 = -v3; + if (v3 <= 160) { +LABEL_64: + if (_vm->_eventsManager.start_x > (signed __int16)XSPR(0) - 320) { + v5 = _vm->_eventsManager.start_x + 320 - (signed __int16)XSPR(0); + if (v5 < 0) + v5 = -v5; + if (v5 > 160) { + _vm->_graphicsManager.no_scroll = 2; + do { + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; + if (_vm->_graphicsManager.SCROLL < 0) { + _vm->_graphicsManager.SCROLL = 0; + v1 = 1; + } + if (_vm->_graphicsManager.SCROLL > 640) { + _vm->_graphicsManager.SCROLL = 640; + v1 = 1; + } + if ((signed __int16)_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) { + v6 = _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.souris_xy(_vm->_eventsManager.souris_x - 4, v6); + } + _vm->_eventsManager.VBL(); + } while (v1 != 1 && _vm->_eventsManager.start_x > (signed __int16)XSPR(0) - 320); + } + } + } else { + do { + _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; + if (_vm->_graphicsManager.SCROLL < 0) { + _vm->_graphicsManager.SCROLL = 0; + v1 = 1; + } + if (_vm->_graphicsManager.SCROLL > 640) { + _vm->_graphicsManager.SCROLL = 640; + v1 = 1; + } + if ((signed __int16)_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) { + v4 = _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.souris_xy(_vm->_eventsManager.souris_x + 4, v4); + } + _vm->_eventsManager.VBL(); + } while (v1 != 1 && _vm->_eventsManager.start_x < (signed __int16)XSPR(0) - 320); + } + if ((signed __int16)_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + _vm->_eventsManager.souris_xy(_vm->_graphicsManager.SCROLL + 610, 0); + if ((signed __int16)_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + _vm->_eventsManager.souris_xy(_vm->_graphicsManager.SCROLL + 10, 0); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.no_scroll = 0; + } + _vm->_talkManager.REPONSE(_vm->_globals.SAUVEGARDE->field2, _vm->_globals.SAUVEGARDE->field1); + } else { + _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->field2, _vm->_globals.SAUVEGARDE->field1); + } + _vm->_eventsManager.CHANGE_MOUSE(4); + if ((unsigned __int16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { + NUMZONE = -1; + FORCEZONE = 1; + } + if (NUMZONE != _vm->_globals.SAUVEGARDE->field2 || (unsigned __int16)(NUMZONE + 1) <= 1u) { + _vm->_eventsManager.btsouris = 4; + CHANGEVERBE = 0; + } else { + _vm->_eventsManager.btsouris = _vm->_globals.SAUVEGARDE->field1; + if (CHANGEVERBE == 1) { + VERBEPLUS(); + CHANGEVERBE = 0; + } + if (_vm->_eventsManager.btsouris == 5) + _vm->_eventsManager.btsouris = 4; + } + if (_vm->_eventsManager.btsouris != 23) + _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + NUMZONE = 0; + _vm->_globals.SAUVEGARDE->field1 = 0; + _vm->_globals.SAUVEGARDE->field2 = 0; + } + if (_vm->_globals.PLAN_FLAG == 1) { + _vm->_eventsManager.btsouris = 0; + _vm->_eventsManager.CHANGE_MOUSE(0); + } + if (_vm->_globals.NOMARCHE == 1) { + if (_vm->_eventsManager.btsouris == 4) { + result = NUMZONE + 1; + if ((unsigned __int16)(NUMZONE + 1) > 1u) + BTDROITE(); + } + } + GOACTION = 0; } void ObjectsManager::CLEAR_ECRAN() { - warning("TODO: CLEAR_ECRAN"); + __int16 v1; + int v2; + + CLEAR_SPR(); + _vm->_graphicsManager.FIN_VISU(); + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_globals.CLEAR_VBOB(); + _vm->_animationManager.CLEAR_ANIM(); + CLEAR_ZONE(); + RESET_OBSTACLE(); + _vm->_globals.RESET_CACHE(); + + v1 = 0; + do { + v2 = v1; + _vm->_globals.BOBZONE[v2] = 0; + _vm->_globals.BOBZONE_FLAG[v2] = 0; + ++v1; + } while (v1 <= 48); + _vm->_eventsManager.btsouris = 4; + verbe = 4; + NUMZONE = 0; + Vold_taille = 0; + SPEED_FLAG = 0; + SPEED_PTR = PTRNUL; + SPEED_X = 0; + SPEED_Y = 0; + SPEED_IMAGE = 0; + FORCEZONE = 1; + TOTAL_LIGNES = 0; + DERLIGNE = 0; + _vm->_globals.chemin = PTRNUL; + if (_vm->_globals.COUCOU != (void *)PTRNUL) + _vm->_globals.COUCOU = FileManager::LIBERE_FICHIER(_vm->_globals.COUCOU); + if ((void *)PTRNUL != _vm->_globals.SPRITE_ECRAN) + _vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_eventsManager.start_x = 0; + _vm->_eventsManager.souris_n = 0; + Vold_taille = 200; + _vm->_globals.SAUVEGARDE->field1 = 0; + _vm->_globals.SAUVEGARDE->field2 = 0; + GOACTION = 0; + FORCEZONE = 1; + CHANGEVERBE = 0; + _vm->_globals.NOSPRECRAN = 0; + _vm->_globals.chemin = PTRNUL; + g_old_sens = -1; + my_anim = 1; + A_ANIM = 0; + MA_ANIM = 0; + MA_ANIM1 = 0; + A_DEPA = 0; + MAX_DEPA = 0; + MAX_DEPA1 = 0; + _vm->_graphicsManager.RESET_SEGMENT_VESA(); +} + +void ObjectsManager::INVENT() { + warning("TODO: INVENT"); +} + +void ObjectsManager::CHANGE_TETE(int a1, int a2) { + warning("TODO: CHANGE_TETE"); +} + +byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { + warning("TODO: PARCOURS2"); + return NULL; +} + +void ObjectsManager::VERIFTAILLE() { + warning("TODO: VERIFTAILLE"); +} + +void ObjectsManager::PACOURS_PROPRE(byte *a1) { + warning("TODO: PACOURS_PROPRE"); +} + +byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { + warning("TODO: PARC_VOITURE"); + return NULL; +} + +void ObjectsManager::VERBEPLUS() { + warning("TODO: VERBEPLUS"); +} + +void ObjectsManager::BTDROITE() { + warning("TODO: BTDROITE"); +} + +int ObjectsManager::MZONE() { + warning("TODO: MZONE"); + return 0; +} + +void ObjectsManager::CLEAR_ZONE() { + warning("TODO: CLEAR_ZONE"); +} + +void ObjectsManager::RESET_OBSTACLE() { + warning("TODO: CLEAR_ZONE"); } } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d17764881b..009be78fb8 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -68,6 +68,7 @@ public: int cadx, cady, cadi; int SL_X, SL_Y; int I_old_x, I_old_y; + int g_old_x, g_old_y; int FLAG_VISIBLE_EFFACE; byte *Winventaire; byte *inventaire2; @@ -84,6 +85,28 @@ public: bool INVENTFLAG; int KEY_INVENT; int my_anim; + int GOACTION; + int NUMZONE; + int ARRET_PERSO_FLAG; + int ARRET_PERSO_NUM; + int FORCEZONE; + int CHANGEVERBE; + int verbe; + int Vold_taille; + int TOTAL_LIGNES; + bool SPEED_FLAG; + int SPEED_X, SPEED_Y; + int SPEED_IMAGE; + byte *SPEED_PTR; + int DERLIGNE; + int g_old_sens; + int A_ANIM; + int MA_ANIM; + int MA_ANIM1; + int A_DEPA; + int MAX_DEPA; + int MAX_DEPA1; + public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -151,6 +174,18 @@ public: void BTGAUCHE(); void PARADISE(); void CLEAR_ECRAN(); + + void INVENT(); + void CHANGE_TETE(int a1, int a2); + byte *PARCOURS2(int a1, int a2, int a3, int a4); + void VERIFTAILLE(); + void PACOURS_PROPRE(byte *a1); + byte *PARC_VOITURE(int a1, int a2, int a3, int a4); + void VERBEPLUS(); + void BTDROITE(); + int MZONE(); + void CLEAR_ZONE(); + void RESET_OBSTACLE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 12a8b83b76..49ad99971a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -933,4 +933,13 @@ bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int return result; } +void TalkManager::REPONSE(int a1, int a2) { + warning("TODO: RESPONSE"); +} + +void TalkManager::REPONSE2(int a1, int a2) { + warning("TODO: RESPONSE2"); +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index cb97a02e0c..97795d8d1f 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -64,6 +64,8 @@ public: void ANIM_PERSO_INIT(); void CLEAR_ANIM_PERSO(); bool RECHERCHE_ANIM_PERSO(int a1, const byte *a2, int a3, int a4); + void REPONSE(int a1, int a2); + void REPONSE2(int a1, int a2); }; } // End of namespace Hopkins -- cgit v1.2.3 From 8fa33e7714fca1aeb80834ee5d97bcfdf8a3efb1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 21:02:39 +1000 Subject: HOPKINS: Implemented more object manager methods --- engines/hopkins/anim.cpp | 8 +- engines/hopkins/anim.h | 1 + engines/hopkins/events.h | 1 + engines/hopkins/files.cpp | 17 +- engines/hopkins/files.h | 3 +- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 87 +- engines/hopkins/graphics.cpp | 97 +- engines/hopkins/graphics.h | 3 + engines/hopkins/menu.cpp | 4 + engines/hopkins/menu.h | 1 + engines/hopkins/objects.cpp | 3534 +++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 60 +- engines/hopkins/sound.cpp | 27 + engines/hopkins/sound.h | 8 + engines/hopkins/talk.cpp | 6 +- 16 files changed, 3790 insertions(+), 71 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 33717eeb2f..970e5d82f0 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -87,12 +87,12 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui 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); + memcpy(screenCopy, screenP, SCREEN_WIDTH * SCREEN_HEIGHT); } if (NO_SEQ) { if (doneFlag == 1) - memcpy((void *)screenCopy, _vm->_graphicsManager.VESA_BUFFER, SCREEN_WIDTH * SCREEN_HEIGHT); + memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, SCREEN_WIDTH * SCREEN_HEIGHT); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); @@ -285,6 +285,10 @@ FINISH: _vm->_graphicsManager.NOLOCK = false; } +void AnimationManager::PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4) { + warning("TODO: PLAY_ANM2"); +} + bool AnimationManager::REDRAW_ANIM() { return false; } diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 3046142623..8373b00104 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -44,6 +44,7 @@ public: void setParent(HopkinsEngine *vm) { _vm = vm; } void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); + void PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4); bool REDRAW_ANIM(); void BOBANIM_ON(int idx); void BOBANIM_OFF(int idx); diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index a288228fb7..0ab4ea36a1 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -55,6 +55,7 @@ public: uint32 lItCounter; uint32 _priorFrameTime; bool ESC_KEY; + bool NOESC; int btsouris; public: EventsManager(); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index f84b597c9a..0708c1d178 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -117,6 +117,19 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { return data; } +void FileManager::CHARGE_FICHIER2(const Common::String &file, byte *buf) { + Common::File f; + size_t filesize; + + DMESS1(); + if (!f.open(file)) + error("Error opening file - %s", file.c_str()); + + filesize = f.size(); + FileManager::bload_it(f, buf, filesize); + f.close(); +} + void FileManager::DMESS() { // No implementation in original } @@ -334,8 +347,8 @@ uint32 FileManager::FLONG(const Common::String &filename) { return size; } -void FileManager::CONSTRUIT_LINUX(const Common::String &file) { - warning("TODO: CONSTRUIT_LINUX"); +Common::String FileManager::CONSTRUIT_LINUX(const Common::String &file) { + return file; } } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 9a587efa80..77361b2920 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -37,6 +37,7 @@ public: static bool bsave(const Common::String &file, const void *buf, size_t n); static void Chage_Inifile(Common::StringMap &iniParams); static byte *CHARGE_FICHIER(const Common::String &file); + static void CHARGE_FICHIER2(const Common::String &file, byte *a2); static void DMESS(); static void DMESS1(); static void bload(const Common::String &file, byte *buf); @@ -46,7 +47,7 @@ public: static void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file); static byte *LIBERE_FICHIER(byte *ptr); static byte *RECHERCHE_CAT(const Common::String &file, int a2); - static void CONSTRUIT_LINUX(const Common::String &file); + static Common::String CONSTRUIT_LINUX(const Common::String &file); /** * 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 6f6543d3d0..a69a8be359 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -761,8 +761,8 @@ void Globals::RESET_CACHE() { void Globals::CACHE_ON() { CACHEFLAG = 1; } - -void Globals::CACHE_OFF() { +// TODO: Find why some calls have a parameter value +void Globals::CACHE_OFF(int v1) { CACHEFLAG = 0; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 49a982b686..9bdece2a18 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -52,6 +52,7 @@ struct LigneItem { int field4; int field6; int field8; + byte *fieldC; byte *field12; }; @@ -193,22 +194,73 @@ struct CacheItem { int field14; }; -// Note: Fields decimal based for now -struct Sauvegarde { +struct Sauvegarde1 { + int field0; int field1; int field2; int field3; int field4; - int field13; - int field80; - int field170; - int field171; - int field172; - int field353; - int field354; - int field355; - int field356; - int field357; +}; + +enum SauvegardeOffset { + svField1 + , svField2 + , svField3 + , svField4 + , svField5 + , svField6 + , svField8 + , svField9 + , svField13 + , svField80 + , svField94 + , svField95 + , svField121 + , svField122 + , svField133 + , svField170 + , svField171 + , svField172 + , svField176 + , svField180 + , svField181 + , svField182 + , svField183 + , svField184 + , svField185 + , svField186 + , svField187 + , svField188 + , svField189 + , svField190 + , svField191 + , svField192 + , svField193 + , svField194 + , svField228 + , svField253 + , svField231 + , svField270 + , svField338 + , svField339 + , svField340 + , svField341 + , svField349 + , svField352 + , svField353 + , svField354 + , svField355 + , svField356 + , svField357 + , svField399 + , svField401 +}; + +struct Sauvegarde { + byte data[999]; // TODO: GET CORRECT SIZE + Sauvegarde1 field360; + Sauvegarde1 field370; + Sauvegarde1 field380; }; class HopkinsEngine; @@ -281,6 +333,9 @@ public: CacheItem Cache[25]; int BOBZONE[105]; bool BOBZONE_FLAG[105]; + int STAILLE[500]; + int super_parcours[32002]; + int Param[2100]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -360,12 +415,18 @@ public: int NECESSAIRE; int Compteur; int ACTION_SENS; + int STOP_BUG; int force_to_data_0; + int old_x1_65; + int old_y1_66; + int old_x2_67; int old_zone_68; int old_x_69, old_y_70; int compteur_71; int zozo_73; + int old_y2_68; + int old_z_69; Globals(); ~Globals(); @@ -384,7 +445,7 @@ public: void RESET_CACHE(); void CACHE_ON(); - void CACHE_OFF(); + void CACHE_OFF(int v1 = 0); void CACHE_SUB(int idx); void CACHE_ADD(int idx); void CHARGE_CACHE(const Common::String &file); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index dab66f1709..96d81aa903 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -326,7 +326,17 @@ void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1, } void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { - warning("TODO: Trans_bloc2"); + byte *dataP; + int count; + byte dataVal; + + dataP = surface; + count = size - 1; + do { + dataVal = *dataP++; + *(dataP - 1) = *(dataVal + col); + --count; + } while (count); } // TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder @@ -2279,11 +2289,85 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x } void GraphicsManager::INI_ECRAN(const Common::String &file) { - warning("TODO: INI_ECRAN"); + OPTI_INI(file, 0); } void GraphicsManager::INI_ECRAN2(const Common::String &file) { - warning("TODO: INI_ECRAN2"); + OPTI_INI(file, 2); +} + +void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { + int v2; + unsigned int v3; + int v6; + unsigned int v9; + signed int v11; + byte *ptr; + Common::String v13; + + v2 = 1; + v3 = 0; + v9 = 0; + // TODO: Set extension as text + v13 = file + ".XXX"; // + #105#110#105; + + ptr = FileManager::RECHERCHE_CAT(v13, 1); + if (PTRNUL == ptr) { + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (!a2) { + // 5ODO: Set extension as text + v13 = file + ".XXX"; //#115#112#114; + if (PTRNUL != _vm->_globals.SPRITE_ECRAN) + _vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + if (!_vm->_globals.NOSPRECRAN) { + _vm->_globals.SPRITE_ECRAN = FileManager::RECHERCHE_CAT(v13, 8); + if (_vm->_globals.SPRITE_ECRAN) { + _vm->_globals.CAT_FLAG = 0; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + } else { + _vm->_globals.CAT_FLAG = 1; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); + } + _vm->_globals.SPRITE_ECRAN = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.CAT_FLAG = 0; + } + } + if (*ptr != 73 || *(ptr + 1) != 78 || *(ptr + 2) != 73) { + error("Erreur, fichier non INI"); + } else { + v11 = 0; + do { + v6 = _vm->_objectsManager.Traduction(ptr + 20 * v2); + if (v6 == 2) + v2 = _vm->_objectsManager.Control_Goto((ptr + 20 * v2)); + if (v6 == 3) + v2 = _vm->_objectsManager.Control_If(ptr, v2); + if (v2 == -1) + error("fonction IFF d‚fectueuse"); + if (v6 == 1 || v6 == 4) + ++v2; + if (!v6 || v6 == 5) + v11 = 1; + } while (v11 != 1); + } + _vm->_globals.dos_free2(ptr); + if (a2 != 1) { + if (PTRNUL != _vm->_globals.COUCOU) + _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); + + v13 = file + ".XXX"; // #114#101#112 + byte *dataP = FileManager::RECHERCHE_CAT(v13, 2); + _vm->_globals.COUCOU = dataP; + if (PTRNUL == dataP) { + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + dataP = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.COUCOU = dataP; + } + } + _vm->_objectsManager.FORCEZONE = 1; + _vm->_objectsManager.CHANGEVERBE = 0; } void GraphicsManager::NB_SCREEN() { @@ -2320,5 +2404,10 @@ void GraphicsManager::NB_SCREEN() { *(v0 + 2) = *(v1 + 2); DD_VBL(); } - +/* +int GraphicsManager::colision2_ligne(int a1, int a2, int a3, int a4, int a5, int a6) { + warning("TODO: colision2_ligne"); + return 0; +} +*/ } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 8cd6a7b10e..7910e8f500 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -64,6 +64,7 @@ public: byte TABLE_COUL[PALETTE_SIZE]; byte cmap[PALETTE_BLOCK_SIZE]; byte Palette[PALETTE_EXT_BLOCK_SIZE]; + byte OLD_PAL[PALETTE_EXT_BLOCK_SIZE]; bool Linear; Graphics::Surface *VideoPtr; byte *VESA_SCREEN; @@ -174,7 +175,9 @@ public: void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int transColour); void INI_ECRAN(const Common::String &file); void INI_ECRAN2(const Common::String &file); + void OPTI_INI(const Common::String &file, int a2); void NB_SCREEN(); + int colision2_ligne(int a1, int a2, int a3, int a4, int a5, int a6); }; } // End of namespace Hopkins diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 2fb40d6046..c16d266afa 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -236,4 +236,8 @@ void MenuManager::CHARGE_PARTIE() { warning("CHARGE_PARTIE"); } +void MenuManager::SAUVE_PARTIE() { + warning("SAUVE_PARTIE"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 11f232746a..1aca03663e 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -39,6 +39,7 @@ public: int MENU(); void CHARGE_PARTIE(); + void SAUVE_PARTIE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index edd700b577..8873ba7b62 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -25,6 +25,8 @@ #include "common/file.h" #include "common/rect.h" #include "engines/util.h" +#include "hopkins/objects.h" +#include "hopkins/dialogs.h" #include "hopkins/files.h" #include "hopkins/globals.h" #include "hopkins/hopkins.h" @@ -40,7 +42,7 @@ ObjectsManager::ObjectsManager() { SL_X = SL_Y = 0; I_old_x = I_old_y = 0; FLAG_VISIBLE_EFFACE = 0; - Winventaire = PTRNUL; + _vm->_globals.Winventaire = PTRNUL; inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; @@ -115,6 +117,32 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { return result; } +void ObjectsManager::DELETE_OBJET(int objIndex) { + int v1; + int v2; + int i; + + v1 = 0; + v2 = 0; + do { + ++v2; + if (_vm->_globals.INVENTAIRE[v2] == objIndex) + v1 = 1; + if (v2 > 32) + v1 = 1; + } while (v1 != 1); + if (v2 <= 32) { + if (v2 == 32) { + _vm->_globals.INVENTAIRE[32] = 0; + } else { + for (i = v2; i < 32; ++i) + _vm->_globals.INVENTAIRE[i] = _vm->_globals.INVENTAIRE[i + 1]; + } + } + CHANGE_OBJET(14); + +} + void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { byte *startP = data + 3; for (int i = idx; i; --i) @@ -421,7 +449,7 @@ void ObjectsManager::AFF_SPRITES() { _vm->_globals.NBTRI = 0; if (_vm->_globals.AFFINVEN == 1) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, Winventaire, inventairex, inventairey, inventairel, inventaireh); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); if (old_cadx && old_cady) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); if (cadx && cady) @@ -676,6 +704,18 @@ void ObjectsManager::BOB_OFF(int idx) { _vm->_globals.Bob[idx].field0 = 11; } +void ObjectsManager::BOB_OFFSET(int idx, int v) { + _vm->_globals.Bob[idx].field46 = v; +} + +void ObjectsManager::BOB_ADJUST(int idx, int v) { + _vm->_globals.Bob[idx].field46 = v; +} + +void ObjectsManager::BOB_OFFSETY(int idx, int v) { + _vm->_globals.Bob[idx].field24 = v; +} + void ObjectsManager::SCBOB(int idx) { int v1; signed int v2; @@ -980,20 +1020,20 @@ void ObjectsManager::INVENT_ANIM() { I_old_x = v0; } - if (_vm->_globals.SAUVEGARDE->field357 == 1) { - if (_vm->_globals.SAUVEGARDE->field353 == 1) + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - if (_vm->_globals.SAUVEGARDE->field355 == 1) + if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); } - if (_vm->_globals.SAUVEGARDE->field356 == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } - if (_vm->_globals.SAUVEGARDE->field354 == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } @@ -1780,6 +1820,10 @@ LABEL_54: } } +void ObjectsManager::GOHOME() { + warning("GOHOME"); +} + void ObjectsManager::GOHOME2() { warning("GOHOME2"); } @@ -1832,10 +1876,10 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.INI_ECRAN2("PLAN"); v2 = 0; do { - _vm->_globals.B_CACHE_OFF(v2++); + _vm->_globals.CACHE_OFF(v2++); } while (v2 <= 15); - _vm->_globals.B_CACHE_OFF(19); - _vm->_globals.B_CACHE_OFF(20); + _vm->_globals.CACHE_OFF(19); + _vm->_globals.CACHE_OFF(20); _vm->_globals.CACHE_ON(); if (!_vm->_globals.PLANX && !_vm->_globals.PLANY) { @@ -1873,15 +1917,15 @@ void ObjectsManager::PLAN_BETA() { do { v5 = _vm->_eventsManager.BMOUSE(); if (v5) { - if (_vm->_globals.SAUVEGARDE->field170 == 1 && !_vm->_globals.SAUVEGARDE->field171) { - _vm->_globals.SAUVEGARDE->field171 = 1; + if (_vm->_globals.SAUVEGARDE->data[svField170] == 1 && !_vm->_globals.SAUVEGARDE->data[svField171]) { + _vm->_globals.SAUVEGARDE->data[svField171] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); _vm->_globals.NOPARLE = false; v5 = 0; } - if (_vm->_globals.SAUVEGARDE->field80 == 1 && !_vm->_globals.SAUVEGARDE->field172) { - _vm->_globals.SAUVEGARDE->field172 = 1; + if (_vm->_globals.SAUVEGARDE->data[svField180] == 1 && !_vm->_globals.SAUVEGARDE->data[svField172]) { + _vm->_globals.SAUVEGARDE->data[svField172] = 1; _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); _vm->_globals.NOPARLE = 0; @@ -1955,29 +1999,29 @@ void ObjectsManager::BTGAUCHE() { } return; } - if (_vm->_globals.SAUVEGARDE->field354 == 1 + if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(v19 - 533) <= 0x1Au && (uint16)(v0 - 26) <= 0x21u) { CHANGE_TETE(1, 0); return; } - if (_vm->_globals.SAUVEGARDE->field356 == 1 + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(v19 - 533) <= 0x1Au && (uint16)(v0 - 26) <= 0x21u) { CHANGE_TETE(2, 0); return; } - if (_vm->_globals.SAUVEGARDE->field357 == 1) { - if (_vm->_globals.SAUVEGARDE->field353 == 1 + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField353] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(v19 - 533) <= 0x1Au && (uint16)(v0 - 26) <= 0x21u) { CHANGE_TETE(0, 1); return; } - if (_vm->_globals.SAUVEGARDE->field355 == 1 + if (_vm->_globals.SAUVEGARDE->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(v19 - 567) <= 0x1Au && (uint16)(v0 - 26) <= 0x21u) { @@ -2007,8 +2051,8 @@ void ObjectsManager::BTGAUCHE() { if (GOACTION == 1) { VERIFZONE(); GOACTION = 0; - _vm->_globals.SAUVEGARDE->field1 = 0; - _vm->_globals.SAUVEGARDE->field2 = 0; + _vm->_globals.SAUVEGARDE->data[svField1] = 0; + _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) @@ -2083,12 +2127,12 @@ LABEL_65: } if ((uint16)(NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler - if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->field1 = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) - _vm->_globals.SAUVEGARDE->field1 = 5; + if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) + _vm->_globals.SAUVEGARDE->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == 1) - _vm->_globals.SAUVEGARDE->field1 = 6; - _vm->_globals.SAUVEGARDE->field2 = NUMZONE; - _vm->_globals.SAUVEGARDE->field3 = _vm->_globals.OBJET_EN_COURS; + _vm->_globals.SAUVEGARDE->data[svField1] = 6; + _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; + _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); @@ -2098,7 +2142,7 @@ LABEL_65: ARRET_PERSO_FLAG = 1; ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->field13 == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { _vm->_globals.chemin = PTRNUL; XSPR(0); @@ -2117,8 +2161,8 @@ void ObjectsManager::PARADISE() { v1 = 0; ARRET_PERSO_FLAG = 0; ARRET_PERSO_NUM = 0; - result = _vm->_globals.SAUVEGARDE->field1; - if (result && _vm->_globals.SAUVEGARDE->field2 && result != 4 && result > 3) { + result = _vm->_globals.SAUVEGARDE->data[svField1]; + if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); if (_vm->_globals.FORET != 1 || (unsigned __int16)(NUMZONE - 20) > 1u && (unsigned __int16)(NUMZONE - 22) > 1u) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { @@ -2179,20 +2223,20 @@ LABEL_64: _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 0; } - _vm->_talkManager.REPONSE(_vm->_globals.SAUVEGARDE->field2, _vm->_globals.SAUVEGARDE->field1); + _vm->_talkManager.REPONSE(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } else { - _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->field2, _vm->_globals.SAUVEGARDE->field1); + _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } _vm->_eventsManager.CHANGE_MOUSE(4); if ((unsigned __int16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { NUMZONE = -1; FORCEZONE = 1; } - if (NUMZONE != _vm->_globals.SAUVEGARDE->field2 || (unsigned __int16)(NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (unsigned __int16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager.btsouris = 4; CHANGEVERBE = 0; } else { - _vm->_eventsManager.btsouris = _vm->_globals.SAUVEGARDE->field1; + _vm->_eventsManager.btsouris = _vm->_globals.SAUVEGARDE->data[svField1]; if (CHANGEVERBE == 1) { VERBEPLUS(); CHANGEVERBE = 0; @@ -2203,8 +2247,8 @@ LABEL_64: if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); NUMZONE = 0; - _vm->_globals.SAUVEGARDE->field1 = 0; - _vm->_globals.SAUVEGARDE->field2 = 0; + _vm->_globals.SAUVEGARDE->data[svField1] = 0; + _vm->_globals.SAUVEGARDE->data[svField2] = 0; } if (_vm->_globals.PLAN_FLAG == 1) { _vm->_eventsManager.btsouris = 0; @@ -2254,15 +2298,15 @@ void ObjectsManager::CLEAR_ECRAN() { TOTAL_LIGNES = 0; DERLIGNE = 0; _vm->_globals.chemin = PTRNUL; - if (_vm->_globals.COUCOU != (void *)PTRNUL) + if (_vm->_globals.COUCOU != PTRNUL) _vm->_globals.COUCOU = FileManager::LIBERE_FICHIER(_vm->_globals.COUCOU); - if ((void *)PTRNUL != _vm->_globals.SPRITE_ECRAN) + if (PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager.start_x = 0; _vm->_eventsManager.souris_n = 0; Vold_taille = 200; - _vm->_globals.SAUVEGARDE->field1 = 0; - _vm->_globals.SAUVEGARDE->field2 = 0; + _vm->_globals.SAUVEGARDE->data[svField1] = 0; + _vm->_globals.SAUVEGARDE->data[svField2] = 0; GOACTION = 0; FORCEZONE = 1; CHANGEVERBE = 0; @@ -2280,16 +2324,1082 @@ void ObjectsManager::CLEAR_ECRAN() { } void ObjectsManager::INVENT() { - warning("TODO: INVENT"); + __int16 v1; + size_t filesize; + __int16 v4; + signed __int16 v5; + __int16 v6; + byte *v7; + __int16 v8; + signed int v9; + __int16 v10; + __int16 v11; + __int16 v12; + __int16 v13; + signed __int16 v14; + __int16 v15; + __int16 v16; + __int16 v17; + __int16 v18; + __int16 v19; + signed __int16 v20; + Common::File f; + + v13 = 0; + if (VIRE_INVENT != 1 && AFFINVEN != 1 && _vm->_globals.DESACTIVE_INVENT != 1) { + _vm->_graphicsManager.no_scroll = 1; + FLAG_VISIBLE_EFFACE = 4; + FLAG_VISIBLE = 0; + v1 = 0; + do { + INVENT_ANIM(); + _vm->_eventsManager.XMOUSE(); + _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.VBL(); + ++v1; + } while (v1 <= 1); + _vm->_globals.Winventaire = PTRNUL; +LABEL_7: + _vm->_eventsManager.souris_bb = 0; + _vm->_eventsManager.souris_b = 0; + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + if (_vm->_globals.FR == 1) + FileManager::CONSTRUIT_SYSTEM("INVENTFR.SPR"); + if (!_vm->_globals.FR) + FileManager::CONSTRUIT_SYSTEM("INVENTAN.SPR"); + if (_vm->_globals.FR == 2) + FileManager::CONSTRUIT_SYSTEM("INVENTES.SPR"); + + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + + filesize = f.size(); + _vm->_globals.Winventaire = _vm->_globals.dos_malloc2(filesize); + FileManager::bload_it(f, _vm->_globals.Winventaire, filesize); + f.close(); + + FileManager::CONSTRUIT_SYSTEM("INVENT2.SPR"); + inventaire2 = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + v19 = _vm->_graphicsManager.ofscroll + 152; + v18 = _vm->_objectsManager.Get_Largeur(_vm->_globals.Winventaire, 0); + v17 = _vm->_objectsManager.Get_Hauteur(_vm->_globals.Winventaire, 0); + inventairex = v19; + inventairey = 114; + inventairel = v18; + inventaireh = v17; + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, v19 + 300, 414, 0, 0, 0, 0); + v15 = 0; + v4 = 0; + v14 = 1; + do { + v16 = 0; + v5 = 1; + do { + ++v4; + v6 = _vm->_globals.INVENTAIRE[v4]; + if (v6 && v4 <= 29) { + v7 = CAPTURE_OBJET(v6, 0); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); + _vm->_globals.dos_free2(v7); + } + v16 += 54; + ++v5; + } while (v5 <= 6); + v15 += 38; + ++v14; + } while (v14 <= 5); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); + _vm->_eventsManager.souris_bb = 0; + v20 = 0; + while (1) { + AFFINVEN = 1; + v8 = _vm->_eventsManager.XMOUSE(); + v9 = _vm->_eventsManager.YMOUSE(); + v12 = _vm->_eventsManager.BMOUSE(); + v10 = v13; + v11 = ZONE_OBJET(v8, v9); + v13 = v11; + if (v11 != v10) + PARAMCADRE(v11); + if (_vm->_eventsManager.btsouris != 16) { + if ((unsigned __int16)(_vm->_eventsManager.btsouris - 1) > 1u) { + if (_vm->_eventsManager.btsouris != 3) { + if (v12 == 2) { + OBJETPLUS(v13); + if (_vm->_eventsManager.btsouris != 23) + _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + } + } + } + } + if (v12 == 1) { + if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (unsigned __int16)(_vm->_eventsManager.btsouris - 2) <= 1u) + break; + v9 = v13; + VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); + if (_vm->_eventsManager.btsouris == 8) + v20 = 1; + if (v20 != 1) { + TRAVAILOBJET = 1; + _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; + _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; + _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; + OPTI_OBJET(); + TRAVAILOBJET = 0; + if (_vm->_soundManager.VOICEOFF == 1) { + do + _vm->_eventsManager.VBL(); + while (!_vm->_globals.SORTIE && _vm->_eventsManager.BMOUSE() != 1); + _vm->_fontManager.TEXTE_OFF(9); + } + if (_vm->_globals.SORTIE) { + if (_vm->_globals.SORTIE == 2) + v20 = 1; + _vm->_globals.SORTIE = 0; + if (v20 != 1) { + inventaire2 = _vm->_globals.dos_free2(inventaire2); + if (PTRNUL != _vm->_globals.Winventaire) + _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); + goto LABEL_7; + } + } else if (v20 != 1) { + AFFINVEN = 1; + } + } + } + if (VIRE_INVENT == 1) + v20 = 1; + if (v20 == 1) + break; + _vm->_eventsManager.VBL(); + if ((unsigned __int16)(_vm->_globals.ECRAN - 35) <= 5u) + SPECIAL_JEU(v9); + } + _vm->_fontManager.TEXTE_OFF(9); + if (AFFINVEN == 1) { + AFFINVEN = 0; + v9 = 114; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); + BOBTOUS = 1; + } + if (PTRNUL != _vm->_globals.Winventaire) + _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); + inventaire2 = _vm->_globals.dos_free2(inventaire2); + if (_vm->_eventsManager.btsouris == 1) + OptionsDialog::show(_vm); + if (_vm->_eventsManager.btsouris == 3) + _vm->_menuManager.CHARGE_PARTIE();//v9); + if (_vm->_eventsManager.btsouris == 2) + _vm->_menuManager.SAUVE_PARTIE();//v9); + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(4); + old_cady = 0; + cady = 0; + old_cadx = 0; + cadx = 0; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.no_scroll = 0; + } } void ObjectsManager::CHANGE_TETE(int a1, int a2) { - warning("TODO: CHANGE_TETE"); + int v2; + Sauvegarde1 *v3; + Sauvegarde1 *v4; + Sauvegarde1 *v5; + Sauvegarde1 *v6; + Sauvegarde1 *v7; + Sauvegarde1 *v8; + Sauvegarde1 *v9; + + CH_TETE = 1; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, 532, 25, 65, 40, _vm->_graphicsManager.VESA_BUFFER, 532, 25); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); + _vm->_globals.NOT_VERIF = 1; + _vm->_globals.chemin = PTRNUL; + if (a1 == 2) { + if (!a2) { + if (_vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { + CH_TETE = 0; + v3 = &_vm->_globals.SAUVEGARDE->field380; + v3->field0 = XSPR(0); + v3->field1 = YSPR(0); + v3->field2 = 64; + v3->field3 = _vm->_globals.ECRAN; + v3->field4 = Sprite[12].field0; // TODO: Double-check this + SPRITE_OFF(1); + SPRITE(_vm->_globals.TETE, v3->field0, v3->field1, 1, 3, v3->field4, 0, 20, 127); + SPRITE_ON(1); + SPRITE_OFF(0); + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField357] = 1; + T_RECTIF = 0; + v4 = &_vm->_globals.SAUVEGARDE->field370; + FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + SPRITE(_vm->_globals.PERSO, v4->field0, v4->field1, 0, 64, v4->field4, 0, 34, 190); +LABEL_9: + SPRITE_ON(0); + return; + } + } + } + if (!a1) { + if (a2 == 2 && _vm->_globals.SAUVEGARDE->data[svField193] == _vm->_globals.ECRAN) { + CH_TETE = 0; + v5 = &_vm->_globals.SAUVEGARDE->field370; + v5->field0 = XSPR(0); + v5->field1 = YSPR(0); + v5->field2 = 64; + v5->field3 = _vm->_globals.ECRAN; + v5->field4 = Sprite[12].field0; + SPRITE_OFF(1); + SPRITE(_vm->_globals.TETE, v5->field0, v5->field1, 1, 2, v5->field4, 0, 34, 190); + SPRITE_ON(1); + SPRITE_OFF(0); + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 1; + _vm->_globals.SAUVEGARDE->data[svField357] = 0; + v6 = &_vm->_globals.SAUVEGARDE->field380; + FileManager::CONSTRUIT_SYSTEM("PSAMAN.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 2; + SPRITE(_vm->_globals.PERSO, v6->field0, v6->field1, 0, 64, v6->field4, 0, 20, 127); + goto LABEL_9; + } + v7 = &_vm->_globals.SAUVEGARDE->field370; + v7->field0 = XSPR(0); + v7->field1 = YSPR(0); + v7->field2 = 64; + v7->field3 = _vm->_globals.ECRAN; + v7->field4 = Sprite[12].field0; + } + if (a1 == 1) { + v8 = &_vm->_globals.SAUVEGARDE->field360; + v8->field0 = XSPR(0); + v8->field1 = YSPR(0); + v8->field2 = 64; + v8->field3 = _vm->_globals.ECRAN; + v8->field4 = Sprite[12].field0; + } + if (a1 == 2) { + v9 = &_vm->_globals.SAUVEGARDE->field380; + v9->field0 = XSPR(0); + v9->field1 = YSPR(0); + v9->field2 = 64; + v9->field3 = _vm->_globals.ECRAN; + v9->field4 = Sprite[12].field0; + } + if (!a2) { + _vm->_globals.SAUVEGARDE->data[svField121] = 0; + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField357] = 1; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField188]; + } + if (a2 == 1) { + _vm->_globals.SAUVEGARDE->data[svField121] = 1; + _vm->_globals.SAUVEGARDE->data[svField354] = 1; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField357] = 0; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField183]; + } + if (a2 == 2) { + _vm->_globals.SAUVEGARDE->data[svField121] = 0; + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 1; + _vm->_globals.SAUVEGARDE->data[svField357] = 0; + v2 = _vm->_globals.SAUVEGARDE->data[svField193]; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField193]; + } } byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { - warning("TODO: PARCOURS2"); - return NULL; + return NULL; //_vm->_globals.STOP_BUG == 0 ? NULL : NULL; + /* + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49; + int v50; + int v51; + int v52; + int v53; + int v54; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; + int v63; + int v64; + int v65; + int v66; + int v67; + int v68; + int i; + byte *v70; + int v71; + int v72; + int j; + byte *v74; + int v75; + int v76; + int v77; + int v78; + int v79; + int v80; + byte *v81; + int v82; + int v83; + byte *v84; + int v85; + int v86; + int v87; + int v88; + int v89; + int v90; + byte *v91; + int v92; + int v93; + int v94; + byte *v95; + int v96; + int v97; + int v98; + int v99; + int v100; + int v101; + int v102; + int v103; + int v104; + int v105; + int v106; + int v107; + int v108; + int v109; + int v110; + int v111; + int v112; + int v113; + int v114; + int v115; + int v116; + int v117; + int v118; + int v119; + int v120; + int v121; + int v122; + int v123; + int v124; + int v125; + int v126; + int v127; + int v128; + int v129; + int v130; + int v131; + int v132; + int v133; + int v134; + int v135; + int v136; + int v137; + int v138; + int v139; + int v140; + int v141; + int v142; + int v143; + int v144; + int v145; + + v123 = a3; + v122 = a4; + v121 = 0; + v120 = 0; + v115 = 0; + v114 = 0; + v113 = 0; + v111 = 0; + if (a4 <= 24) + v122 = 25; + if (!_vm->_globals.NOT_VERIF) { + v4 = a1 - _vm->_globals.old_x1_65; + if (v4 < 0) + v4 = -v4; + if (v4 <= 4) { + v5 = a2 - _vm->_globals.old_y1_66; + if (v5 < 0) + v5 = -v5; + if (v5 <= 4) { + v6 = _vm->_globals.old_x2_67 - a3; + if (v6 < 0) + v6 = -v6; + if (v6 <= 4) { + v7 = _vm->_globals.old_y2_68 - v122; + if (v7 < 0) + v7 = -v7; + if (v7 <= 4) + return PTRNUL; + } + } + } + v8 = a1 - a3; + if (v8 < 0) + v8 = -v8; + if (v8 <= 4) { + v9 = a2 - v122; + if (v9 < 0) + v9 = -v9; + if (v9 <= 4) + return PTRNUL; + } + if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) + return PTRNUL; + } + _vm->_globals.NOT_VERIF = 0; + _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; + _vm->_globals.old_x1_65 = a1; + _vm->_globals.old_x2_67 = a3; + _vm->_globals.old_y1_66 = a2; + _vm->_globals.old_y2_68 = v122; + _vm->_globals.STOP_BUG = 0; + v112 = 0; + if (a3 <= 19) + v123 = 20; + if (v122 <= 19) + v122 = 20; + if (v123 > _vm->_graphicsManager.max_x - 10) + v123 = _vm->_graphicsManager.max_x - 10; + if (v122 > _vm->_globals.Max_Perso_Y) + v122 = _vm->_globals.Max_Perso_Y; + v10 = a1 - v123; + if (v10 < 0) + v10 = -v10; + if (v10 <= 3) { + v11 = a2 - v122; + if (v11 < 0) + v11 = -v11; + if (v11 <= 3) + return PTRNUL; + } + v12 = 0; + do { + v13 = v12; + *(&v141 + v13) = -1; + *(&v136 + v13) = 0; + *(&v131 + v13) = 1300; + *(&v126 + v13) = 1300; + ++v12; + } while (v12 <= 8); + if (PARC_PERS(a1, a2, v123, v122, -1, -1, 0) != 1) { + v14 = 0; + v15 = v122; + if (_vm->_graphicsManager.max_y > v122) { + v16 = 5; + do { + v101 = v16; + v17 = _vm->_graphicsManager.colision2_ligne(v123, v15, (int)&v139, (int)&v144, 0, _vm->_objectsManager.DERLIGNE); + v16 = v101; + if (v17 == 1 && *(&v141 + v101) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v101) = 0; + *(&v141 + v101) = -1; + ++v14; + ++v15; + } while (_vm->_graphicsManager.max_y > v15); + } + v134 = v14; + v18 = 0; + v19 = v122; + if (_vm->_graphicsManager.min_y < v122) { + v20 = 1; + do { + v102 = v20; + v21 = _vm->_graphicsManager.colision2_ligne(v123, v19, (int)&v137, (int)&v142, 0, _vm->_objectsManager.DERLIGNE); + v20 = v102; + if (v21 == 1 && *(&v141 + v102) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v102) = 0; + *(&v141 + v102) = -1; + if (v134 < v18) { + if (v144 != -1) + break; + } + ++v18; + --v19; + } while (_vm->_graphicsManager.min_y < v19); + } + v132 = v18; + v22 = 0; + v23 = v123; + if (_vm->_graphicsManager.max_x > v123) { + v24 = 3; + do { + v103 = v24; + v25 = _vm->_graphicsManager.colision2_ligne(v23, v122, (int)&v138, (int)&v143, 0, _vm->_objectsManager.DERLIGNE); + v24 = v103; + if (v25 == 1 && *(&v141 + v103) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v103) = 0; + *(&v141 + v103) = -1; + ++v22; + if (v132 < v22) { + if (v142 != -1) + break; + } + if (v134 < v22 && v144 != -1) + break; + ++v23; + } while (_vm->_graphicsManager.max_x > v23); + } + v133 = v22; + v26 = 0; + v27 = v123; + if (_vm->_graphicsManager.min_x < v123) { + v28 = 7; + do { + v104 = v28; + v29 = _vm->_graphicsManager.colision2_ligne(v27, v122, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); + v28 = v104; + if (v29 == 1 && *(&v141 + v104) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v104) = 0; + *(&v141 + v104) = -1; + ++v26; + if (v132 < v26) { + if (v142 != -1) + break; + } + if (v134 < v26 && v144 != -1) + break; + if (v133 < v26 && v143 != -1) + break; + --v27; + } while (_vm->_graphicsManager.min_x < v27); + } + v135 = v26; + if (v142 < 0 || _vm->_objectsManager.DERLIGNE < v142) + v142 = -1; + if (v143 < 0 || _vm->_objectsManager.DERLIGNE < v143) + v143 = -1; + if (v144 < 0 || _vm->_objectsManager.DERLIGNE < v144) + v144 = -1; + if (v145 < 0 || _vm->_objectsManager.DERLIGNE < v145) + v145 = -1; + if (v142 < 0) + v132 = 1300; + if (v143 < 0) + v133 = 1300; + if (v144 < 0) + v134 = 1300; + if (v145 < 0) + v135 = 1300; + if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) + return PTRNUL; + v31 = 0; + if (v144 != -1 && v132 >= v134 && v133 >= v134 && v135 >= v134) { + v121 = v144; + v120 = v139; + v31 = 1; + } + if (v142 != -1 && !v31 && v134 >= v132 && v133 >= v132 && v135 >= v132) { + v121 = v142; + v120 = v137; + v31 = 1; + } + if (v143 != -1 && !v31 && v132 >= v133 && v134 >= v133 && v135 >= v133) { + v121 = v143; + v120 = v138; + v31 = 1; + } + if (v145 != -1 && !v31 && v134 >= v135 && v133 >= v135 && v132 >= v135) { + v121 = v145; + v120 = v140; + } + v32 = 0; + do { + v33 = v32; + *(&v141 + v33) = -1; + *(&v136 + v33) = 0; + *(&v131 + v33) = 1300; + *(&v126 + v33) = 1300; + ++v32; + } while (v32 <= 8); + v34 = 0; + v35 = a2; + if (_vm->_graphicsManager.max_y > a2) { + v36 = 5; + do { + v105 = v36; + v37 = _vm->_graphicsManager.colision2_ligne(a1, v35, (int)&v139, (int)&v144, 0, _vm->_objectsManager.DERLIGNE); + v36 = v105; + if (v37 == 1 && *(&v141 + v105) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v105) = 0; + *(&v141 + v105) = -1; + ++v34; + ++v35; + } while (_vm->_graphicsManager.max_y > v35); + } + v134 = v34 + 1; + v38 = 0; + v39 = a2; + if (_vm->_graphicsManager.min_y < a2) { + v40 = 1; + do { + v106 = v40; + v41 = _vm->_graphicsManager.colision2_ligne(a1, v39, (int)&v137, (int)&v142, 0, _vm->_objectsManager.DERLIGNE); + v40 = v106; + if (v41 == 1 && *(&v141 + v106) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v106) = 0; + *(&v141 + v106) = -1; + ++v38; + if (v144 != -1) { + if (v38 > 80) + break; + } + --v39; + } while (_vm->_graphicsManager.min_y < v39); + } + v132 = v38 + 1; + v42 = 0; + v43 = a1; + if (_vm->_graphicsManager.max_x > a1) { + v44 = 3; + do { + v107 = v44; + v45 = _vm->_graphicsManager.colision2_ligne(v43, a2, (int)&v138, (int)&v143, 0, _vm->_objectsManager.DERLIGNE); + v44 = v107; + if (v45 == 1 && *(&v141 + v107) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v107) = 0; + *(&v141 + v107) = -1; + ++v42; + if (v144 != -1 || v142 != -1) { + if (v42 > 100) + break; + } + ++v43; + } while (_vm->_graphicsManager.max_x > v43); + } + v133 = v42 + 1; + v46 = 0; + v47 = a1; + if (_vm->_graphicsManager.min_x < a1) { + v48 = 7; + do { + v108 = v48; + v49 = _vm->_graphicsManager.colision2_ligne(v47, a2, (int)&v140, (int)&v145, 0, _vm->_objectsManager.DERLIGNE); + v48 = v108; + if (v49 == 1 && *(&v141 + v108) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v108) = 0; + *(&v141 + v108) = -1; + ++v46; + if (v144 != -1 || v142 != -1 || v143 != -1) { + if (v46 > 100) + break; + } + --v47; + } while (_vm->_graphicsManager.min_x < v47); + } + v135 = v46 + 1; + if (v142 != -1) { + v50 = v142 - v121; + if (v50 < 0) + v50 = -v50; + v127 = v50; + } + if (v143 != -1) { + v51 = v143 - v121; + if (v51 < 0) + v51 = -v51; + v128 = v51; + } + if (v144 != -1) { + v52 = v144 - v121; + if (v52 < 0) + v52 = -v52; + v129 = v52; + } + if (v145 != -1) { + v53 = v145 - v121; + if (v53 < 0) + v53 = -v53; + v130 = v53; + } + if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) + error("ERREUR POINT PLUS PROCHE Du perso NON TROUVE"); + v54 = 0; + if (v142 != -1 && v128 >= v127 && v129 >= v127 && v130 >= v127) { + v54 = 1; + v115 = v142; + v111 = v132; + v113 = 1; + v114 = v137; + } + if (!v54) { + if (v144 != -1 && v128 >= v129 && v127 >= v129 && v130 >= v129) { + v54 = 1; + v115 = v144; + v111 = v134; + v113 = 5; + v114 = v139; + } + if (!v54) { + if (v143 != -1 && v127 >= v128 && v129 >= v128 && v130 >= v128) { + v54 = 1; + v115 = v143; + v111 = v133; + v113 = 3; + v114 = v138; + } + if (!v54 && v145 != -1 && v127 >= v130 && v129 >= v130 && v128 >= v130) { + v115 = v145; + v111 = v135; + v113 = 7; + v114 = v140; + } + } + } + v55 = PARC_PERS(a1, a2, v123, v122, v115, v121, 0); + if (v55 != 1) { + if (v55 == 2) { +LABEL_201: + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + } else { + if (v113 == 1) { + v56 = 0; + if (v111 > 0) { + do { + if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(a1, a2 - v56, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, _vm->_globals.super_parcours, 4); + if (v58 == -1) + goto LABEL_282; + v112 = v58; + if (NVPY != -1) + v56 = a2 - NVPY; + } + v59 = v112; + _vm->_globals.super_parcours[v59] = a1; + _vm->_globals.super_parcours[v59 + 1] = a2 - v56; + _vm->_globals.super_parcours[v59 + 2] = 1; + _vm->_globals.super_parcours[v59 + 3] = 0; + v112 += 4; + ++v56; + } while (v111 > v56); + } + } + if (v113 == 5) { + v60 = 0; + if (v111 > 0) { + do { + if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(a1, v60 + a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, _vm->_globals.super_parcours, 4); + if (v61 == -1) + goto LABEL_282; + v112 = v61; + if (NVPY != -1) + v60 = NVPY - a2; + } + v62 = v112; + _vm->_globals.super_parcours[v62] = a1; + _vm->_globals.super_parcours[v62 + 1] = v60 + a2; + _vm->_globals.super_parcours[v62 + 2] = 5; + _vm->_globals.super_parcours[v62 + 3] = 0; + v112 += 4; + ++v60; + } while (v111 > v60); + } + } + if (v113 == 7) { + v63 = 0; + if (v111 > 0) { + do { + if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(a1 - v63, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, _vm->_globals.super_parcours, 4); + if (v64 == -1) + goto LABEL_282; + v112 = v64; + if (NVPX != -1) + v63 = a1 - NVPX; + } + v65 = v112; + _vm->_globals.super_parcours[v65] = a1 - v63; + _vm->_globals.super_parcours[v65 + 1] = a2; + _vm->_globals.super_parcours[v65 + 2] = 7; + _vm->_globals.super_parcours[v65 + 3] = 0; + v112 += 4; + ++v63; + } while (v111 > v63); + } + } + if (v113 == 3) { + v66 = 0; + if (v111 > 0) { + do { + if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(v66 + a1, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, _vm->_globals.super_parcours, 4); + if (v67 == -1) + goto LABEL_282; + v112 = v67; + if (NVPX != -1) + v66 = NVPX - a1; + } + v68 = v112; + _vm->_globals.super_parcours[v68] = v66 + a1; + _vm->_globals.super_parcours[v68 + 1] = a2; + _vm->_globals.super_parcours[v68 + 2] = 3; + _vm->_globals.super_parcours[v68 + 3] = 0; + v112 += 4; + ++v66; + } while (v111 > v66); + } + } + } +LABEL_234: + if (v115 < v121) { + for (i = v114; _vm->_globals.Ligne[v115].field0 > i; ++i) { + v70 = _vm->_globals.Ligne[v115].fieldC; + v119 = READ_LE_UINT16(v70 + 4 * i); + v118 = READ_LE_UINT16(v70 + 4 * i + 2); + v71 = v112; + _vm->_globals.super_parcours[v71] = v119; + _vm->_globals.super_parcours[v71 + 1] = v118; + _vm->_globals.super_parcours[v71 + 2] = _vm->_globals.Ligne[v115].field6; + _vm->_globals.super_parcours[v71 + 3] = 0; + v112 += 4; + } + v116 = v115 + 1; + if ((signed __int16)(v115 + 1) < v121) { + do { + v72 = 0; + v110 = v116; + for (j = v116; _vm->_globals.Ligne[j].field0 > v72; j = v116) { + v74 = _vm->_globals.Ligne[v110].fieldC; + v119 = READ_LE_UINT16(v74 + 4 * v72); + v118 = READ_LE_UINT16(v74 + 4 * v72 + 2); + v75 = v112; + _vm->_globals.super_parcours[v75] = v119; + _vm->_globals.super_parcours[v75 + 1] = v118; + _vm->_globals.super_parcours[v75 + 2] = _vm->_globals.Ligne[v110].field6; + _vm->_globals.super_parcours[v75 + 3] = 0; + v112 += 4; + v76 = _vm->_globals.Ligne[v110].field0; + if (v76 > 30) { + v77 = v76 / 2; + if (v77 < 0) + v77 = -v77; + if (v72 == v77) { + v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); + if (v78 == 1) + return &_vm->_globals.super_parcours[0]; + if (v78 == 2) + goto LABEL_200; + if (MIRACLE(v119, v118, v110, v121, v112) == 1) + goto LABEL_201; + } + } + ++v72; + v110 = v116; + } + v79 = PARC_PERS(v119, v118, v123, v122, v116, v121, v112); + if (v79 == 1) + return &_vm->_globals.super_parcours[0]; + if (v79 == 2) { +LABEL_200: + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; + } + if (MIRACLE(v119, v118, v116, v121, v112) == 1) + goto LABEL_201; + ++v116; + } while (v116 < v121); + } + v114 = 0; + v115 = v121; + } + if (v115 > v121) { + v80 = v114; + if (v114 > 0) { + v98 = 16 * v115; + do { + v81 = _vm->_globals.Ligne[v98].fieldC; + v119 = READ_LE_UINT16(v81 + 4 * v80); + v118 = READ_LE_UINT16(v81 + 4 * v80 + 2); + v82 = v112; + _vm->_globals.super_parcours[v82] = v119; + _vm->_globals.super_parcours[v82 + 1] = v118; + _vm->_globals.super_parcours[v82 + 2] = _vm->_globals.Ligne[v98].field8; + _vm->_globals.super_parcours[v82 + 3] = 0; + v112 += 4; + --v80; + } while (v80 > 0); + } + v117 = v115 - 1; + if ((signed __int16)(v115 - 1) > v121) { + do { + v83 = _vm->_globals.Ligne[v117].field0 - 1; + if (v83 > -1) { + v109 = 16 * v117; + do { + v84 = _vm->_globals.Ligne[v109].fieldC; + v119 = READ_LE_UINT16(v84 + 4 * v83); + v118 = READ_LE_UINT16(v84 + 4 * v83 + 2); + v85 = v112; + _vm->_globals.super_parcours[v85] = v119; + _vm->_globals.super_parcours[v85 + 1] = v118; + _vm->_globals.super_parcours[v85 + 2] = _vm->_globals.Ligne[v109].field8; + _vm->_globals.super_parcours[v85 + 3] = 0; + v112 += 4; + v86 = _vm->_globals.Ligne[v109].field0; + if (v86 > 30) { + v87 = v86 / 2; + if (v87 < 0) + v87 = -v87; + if (v83 == v87) { + v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); + if (v88 == 1) + return &_vm->_globals.super_parcours[0]; + if (v88 == 2) + goto LABEL_200; + if (MIRACLE(v119, v118, v117, v121, v112) == 1) + goto LABEL_201; + } + } + --v83; + } while (v83 > -1); + } + v89 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); + if (v89 == 1) + return &_vm->_globals.super_parcours[0]; + if (v89 == 2) + goto LABEL_200; + if (MIRACLE(v119, v118, v117, v121, v112) == 1) + goto LABEL_201; + --v117; + } while (v117 > v121); + } + v114 = _vm->_globals.Ligne[v121].field0 - 1; + v115 = v121; + } + if (v115 == v121) { + if (v114 <= v120) { + if (v114 < v120) { + v94 = v114; + v100 = 16 * v121; + do { + v95 = _vm->_globals.Ligne[v100].fieldC;; + v96 = READ_LE_UINT16(v95 + 4 * v94 + 2); + v97 = v112; + _vm->_globals.super_parcours[v97] = READ_LE_UINT16(v95 + 4 * v94); + _vm->_globals.super_parcours[v97 + 1] = v96; + _vm->_globals.super_parcours[v97 + 2] = _vm->_globals.Ligne[v100].field6; + _vm->_globals.super_parcours[v97 + 3] = 0; + v112 += 4; + ++v94; + } while (v120 > v94); + } + } else { + v90 = v114; + v99 = 16 * v121; + do { + v91 = _vm->_globals.Ligne[v99].fieldC; + v92 = READ_LE_UINT16(v91 + 4 * v90 + 2); + v93 = v112; + _vm->_globals.super_parcours[v93] = READ_LE_UINT16(v91 + 4 * v90); + _vm->_globals.super_parcours[v93 + 1] = v92; + _vm->_globals.super_parcours[v93 + 2] = _vm->_globals.Ligne[v99].field8; + _vm->_globals.super_parcours[v93 + 3] = 0; + v112 += 4; + --v90; + } while (v120 < v90); + } + } + v57 = v112; + if (PARC_PERS( + _vm->_globals.Param[v112 + 4192 / 2], + _vm->_globals.Param[v112 + 4194 / 2], + v123, + v122, + -1, + -1, + v112) != 1) { +LABEL_282: + _vm->_globals.super_parcours[v57] = -1; + _vm->_globals.super_parcours[v57 + 1] = -1; + _vm->_globals.super_parcours[v57 + 2] = -1; + _vm->_globals.super_parcours[v57 + 3] = -1; + } + return &_vm->_globals.super_parcours[0]; + } + } + return &_vm->_globals.super_parcours[0]; + */ } void ObjectsManager::VERIFTAILLE() { @@ -2326,4 +3436,2342 @@ void ObjectsManager::RESET_OBSTACLE() { warning("TODO: CLEAR_ZONE"); } +int ObjectsManager::ZONE_OBJET(int a1, int a2) { + warning("TODO: ZONE_OBJET"); + return 0; +} + +void ObjectsManager::PARAMCADRE(int a1) { + warning("TODO: PARAMCADRE"); +} + +void ObjectsManager::OBJETPLUS(int a1) { + warning("TODO: OBJETPLUS"); +} + +void ObjectsManager::VALID_OBJET(int a1) { + if (_vm->_eventsManager.btsouris == 8) + CHANGE_OBJET(a1); +} + +void ObjectsManager::OPTI_OBJET() { + warning("TODO: OPTI_OBJET"); +} + +void ObjectsManager::SPECIAL_JEU(int a1) { + warning("TODO: SPECIAL_JEU"); +} + +int ObjectsManager::Traduction(byte *a1) { + signed int v1; + __int16 v2; + signed __int16 v3; + signed __int16 v4; + __int16 v5; + __int16 v6; + __int16 v7; + __int16 v8; + __int16 v9; + __int16 v10; + __int16 v11; + __int16 v12; + __int16 v13; + __int16 v14; + signed __int16 v15; + __int16 v16; + __int16 v17; + signed __int16 v18; + signed __int16 v19; + signed __int16 v20; + signed __int16 v21; + __int16 v22; + __int16 v23; + signed __int16 v24; + signed __int16 v25; + signed __int16 v26; + __int16 v27; + __int16 v28; + __int16 v29; + __int16 v30; + __int16 v31; + __int16 v32; + signed __int16 v33; + signed __int16 v34; + signed __int16 v35; + signed __int16 v36; + __int16 v37; + __int16 v38; + __int16 v39; + __int16 v40; + signed __int16 v41; + signed __int16 v42; + __int16 v43; + __int16 v44; + signed __int16 v45; + signed __int16 v46; + char v47; + char v48; + char v49; + signed __int16 v50; + Sauvegarde1 *v51; + signed __int16 v52; + Sauvegarde1 *v53; + int v54; + __int16 v55; + __int16 v56; + __int16 v57; + __int16 v58; + __int16 v59; + __int16 v60; + signed __int16 v61; + __int16 v62; + int v63; + __int16 v65; + __int16 v66; + __int16 v67; + __int16 v68; + __int16 v69; + __int16 v70; + __int16 v71; + __int16 v72; + signed __int16 v73; + signed __int16 v74; + __int16 v75; + __int16 v76; + char v77[12]; + Common::String s; + char v79; + char v80; + char v81; + char v82[16]; + + v1 = 0; + v70 = 0; + if (*a1 != 70 || *(a1 + 1) != 67) + return 0; + // TODO: Change to chars + if (*(a1 + 2) == 84 && *(a1 + 3) == 88 && *(a1 + 4) == 84) { + v70 = *(a1 + 6); + v2 = *(a1 + 7); + v69 = *(a1 + 8); + v67 = READ_LE_UINT16(a1 + 9); + v65 = READ_LE_UINT16(a1 + 11); + v3 = READ_LE_UINT16(a1 + 13); + v1 = 1; + if (!_vm->_objectsManager.TRAVAILOBJET) { + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { + if (v3 == 53) + v3 = 644; + if (v3 == 624) + v3 = 639; + if (v3 == 627) + v3 = 630; + if (v3 == 625) + v3 = 639; + if (v3 == 8) + v3 = 637; + if (v3 == 53) + v3 = 644; + if (v3 == 557) + v3 = 636; + if (v3 == 51) + v3 = 644; + if (v3 == 287) + v3 = 636; + if (v3 == 619) + v3 = 633; + if (v3 == 620) + v3 = 634; + if (v3 == 622) + v3 = 644; + if (v3 == 297) + v3 = 636; + if (v3 == 612) + v3 = 636; + if ((unsigned __int16)(v3 - 613) <= 1u || v3 == 134) + v3 = 636; + if (v3 == 615) + v3 = 635; + if (v3 == 618) + v3 = 632; + if (v3 == 611) + v3 = 642; + if (v3 == 610) + v3 = 641; + if (v3 == 18) + v3 = 643; + if (v3 == 602) + v3 = 645; + if (v3 == 603) + v3 = 646; + if (v3 == 604) + v3 = 647; + if (v3 == 51) + v3 = 644; + if (v3 == 607) + v3 = 650; + if (v3 == 605) + v3 = 648; + if (v3 == 606) + v3 = 649; + if (v3 == 601) + v3 = 652; + if (v3 == 37) + v3 = 636; + if (v3 == 595) + v3 = 633; + if (v3 == 596) + v3 = 634; + if (v3 == 532) + v3 = 636; + if (v3 == 599) + v3 = 636; + if (v3 == 363) + v3 = 636; + } + if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { + do + _vm->_eventsManager.VBL(); + while (_vm->_soundManager.SOUND_FLAG); + } + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(v3, 4); + } + if (_vm->_objectsManager.TRAVAILOBJET == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField356]) { + _vm->_fontManager.DOS_TEXT(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(635, 4); + goto LABEL_104; + } + if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) + _vm->_fontManager.DOS_TEXT(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) + _vm->_fontManager.DOS_TEXT(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + if (_vm->_globals.FR == 2) { + if (_vm->_soundManager.TEXTOFF) { +LABEL_98: + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(v3, 5); + goto LABEL_104; + } + _vm->_fontManager.DOS_TEXT(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + } + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + goto LABEL_98; + } + } +LABEL_104: + // TODO + if (*(a1 + 2) == 66 && *(a1 + 3) == 79 && *(a1 + 4) == 66) { + if (DESACTIVE != 1) { + v72 = *(a1 + 5); + v70 = *(a1 + 6); + v4 = *(a1 + 7); + v68 = READ_LE_UINT16(a1 + 8); + v66 = READ_LE_UINT16(a1 + 10); + if (v72 == 52) { + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, READ_LE_UINT16(a1 + 10), v70); + } else if (v72 == 51) { + BOB_VIVANT(v70); + } else { + if (v72 == 50) + goto LABEL_1141; + VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); + if (v4) + v4 /= _vm->_globals.vitesse; + if (v4 > 1) { + do { + --v4; + _vm->_eventsManager.VBL(); + } while (v4); + } + if (v72 == 50) +LABEL_1141: + AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); + } + } + v1 = 1; + } + if (*(a1 + 2) == 83) { + if (*(a1 + 3) == 84 && *(a1 + 4) == 80) { + if (DESACTIVE != 1) { + DEUXPERSO = 0; + v5 = *(a1 + 5); + v6 = *(a1 + 8); + _vm->_objectsManager.PERX = READ_LE_UINT16(a1 + 6); + _vm->_objectsManager.PERY = v6; + _vm->_objectsManager.PERI = v5; + if (_vm->_objectsManager.CH_TETE == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 + && _vm->_globals.SAUVEGARDE->data[svField180] + && _vm->_globals.SAUVEGARDE->data[svField181] + && _vm->_globals.SAUVEGARDE->data[svField182] + && _vm->_globals.SAUVEGARDE->data[svField183]) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField180]; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField181]; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField182]; + } + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 + && _vm->_globals.SAUVEGARDE->data[svField190] + && _vm->_globals.SAUVEGARDE->data[svField191] + && _vm->_globals.SAUVEGARDE->data[svField192] + && _vm->_globals.SAUVEGARDE->data[svField193]) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField190]; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField191]; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField192]; + } + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 + && _vm->_globals.SAUVEGARDE->data[svField185] + && _vm->_globals.SAUVEGARDE->data[svField186] + && _vm->_globals.SAUVEGARDE->data[svField187] + && _vm->_globals.SAUVEGARDE->data[svField188]) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField185]; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField186]; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField187]; + } + } + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { + SPRITE( + _vm->_globals.TETE, + _vm->_globals.SAUVEGARDE->data[svField185], + _vm->_globals.SAUVEGARDE->data[svField186], + 1, + 2, + _vm->_globals.SAUVEGARDE->data[svField189], + 0, + 34, + 190); + SPRITE_ON(1); + DEUXPERSO = 1; + } + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 + && _vm->_globals.SAUVEGARDE->data[svField355] == 1 + && _vm->_globals.SAUVEGARDE->data[svField193] == _vm->_globals.ECRAN) { + SPRITE( + _vm->_globals.TETE, + _vm->_globals.SAUVEGARDE->data[svField190], + _vm->_globals.SAUVEGARDE->data[svField191], + 1, + 3, + _vm->_globals.SAUVEGARDE->data[svField194], + 0, + 20, + 127); + SPRITE_ON(1); + DEUXPERSO = 1; + } + } + v1 = 1; + _vm->_objectsManager.CH_TETE = 0; + } + if (*(a1 + 2) == 83 && *(a1 + 3) == 84 && *(a1 + 4) == 69) { + if (DESACTIVE != 1) { + v7 = *(a1 + 5); + v70 = *(a1 + 6); + v8 = *(a1 + 7); + v9 = *(a1 + 8); + RECALL = 0; + _vm->_globals.OLD_ECRAN = _vm->_globals.ECRAN; + _vm->_globals.SAUVEGARDE->data[svField6] = _vm->_globals.ECRAN; + _vm->_globals.ECRAN = v7; + _vm->_globals.SAUVEGARDE->data[svField5] = v7; + PTAILLE = v70; + PEROFX = v8; + PEROFY = v9; + } + v1 = 1; + } + } + if (*(a1 + 2) == 66 && *(a1 + 3) == 79 && *(a1 + 4) == 70) { + if (DESACTIVE != 1) + VBOB_OFF(READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + if (*(a1 + 2) == 80 && *(a1 + 3) == 69 && *(a1 + 4) == 82) { + v73 = READ_LE_UINT16(a1 + 5); + if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + v70 = 0; + if (READ_LE_UINT16(a1 + 5) == 14) + v73 = 1; + if (v73 == 17) + v73 = 7; + if (v73 == 18) + v73 = 8; + if (v73 == 19) + v73 = 4; + if (v73 == 15) + v73 = 11; + if (v73 == 16) + v73 = 12; + if (v73 == 1) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(4); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(4); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(4); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(4); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(4); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(4); + } + if (v73 == 2) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(7); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(7); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(7); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(7); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(7); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(7); + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(8); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(8); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(8); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(8); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(8); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(8); + } + if (v73 == 4) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(1); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(1); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(1); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(1); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(1); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(1); + } + if (v73 == 5) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(5); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(5); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(5); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(5); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(5); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(5); + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(6); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(6); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(6); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(6); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(6); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(6); + } + if (v73 == 7) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(2); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(2); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(2); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(2); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(2); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(2); + } + if (v73 == 8) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(3); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(3); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(3); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(3); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(3); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(3); + } + if (v73 == 9) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(5); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(5); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(5); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(5); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(5); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(5); + } + if (v73 == 10) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(6); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(6); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(6); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(6); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(6); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(6); + } + if (v73 == 11) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(7); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(7); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(7); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(7); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(7); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(7); + } + if (v73 == 12) { + if (_vm->_globals.ACTION_SENS == 1) + ACTION_DOS(8); + if (_vm->_globals.ACTION_SENS == 3) + ACTION_DROITE(8); + if (_vm->_globals.ACTION_SENS == 2) + Q_DROITE(8); + if (_vm->_globals.ACTION_SENS == 5) + ACTION_FACE(8); + if (_vm->_globals.ACTION_SENS == 8) + Q_GAUCHE(8); + if (_vm->_globals.ACTION_SENS == 7) + ACTION_GAUCHE(8); + } + } + v1 = 1; + } + if (*(a1 + 2) == 77 && *(a1 + 3) == 85 && *(a1 + 4) == 83) + v1 = 1; + if (*(a1 + 2) == 87 && *(a1 + 3) == 65 && *(a1 + 4) == 73) { + v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + if (!v74) + v74 = 1; + v10 = 0; + if (v74 + 1 > 0) { + do { + _vm->_eventsManager.VBL(); + ++v10; + } while (v10 < v74 + 1); + } + v1 = 1; + } + if (*(a1 + 2) == 79) { + if (*(a1 + 3) == 66 && *(a1 + 4) == 80) { + v1 = 1; + AJOUTE_OBJET(READ_LE_UINT16(a1 + 5)); + } + if (*(a1 + 2) == 79 && *(a1 + 3) == 66 && *(a1 + 4) == 77) { + v1 = 1; + DELETE_OBJET(READ_LE_UINT16(a1 + 5)); + } + } + if (*(a1 + 2) == 71 && *(a1 + 3) == 79 && *(a1 + 4) == 84) + v1 = 2; + if (*(a1 + 2) == 90) { + if (*(a1 + 3) == 79 && *(a1 + 4) == 78) { + ZONE_ON(READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + if (*(a1 + 2) == 90 && *(a1 + 3) == 79 && *(a1 + 4) == 70) { + ZONE_OFF(READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + } + if (*(a1 + 2) == 69 && *(a1 + 3) == 88 && *(a1 + 4) == 73) + v1 = 5; + if (*(a1 + 2) == 83 && *(a1 + 3) == 79 && *(a1 + 4) == 82) { + _vm->_globals.SORTIE = READ_LE_UINT16(a1 + 5); + v1 = 5; + } + if (*(a1 + 2) == 66 && *(a1 + 3) == 67 && *(a1 + 4) == 65) { + _vm->_globals.CACHE_OFF(READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + if (*(a1 + 2) == 65 && *(a1 + 3) == 78 && *(a1 + 4) == 73) { + v75 = READ_LE_UINT16(a1 + 5); + if (v75 <= 100) + _vm->_animationManager.BOBANIM_ON(v75); + else + _vm->_animationManager.BOBANIM_OFF(v75 - 100); + v1 = 1; + } + if (*(a1 + 2) == 83 && *(a1 + 3) == 80 && *(a1 + 4) == 69) { + v76 = READ_LE_UINT16(a1 + 5); + if (v76 == 7) + _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); + if (v76 == 8) + _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); + if (v76 == 6) { + SPRITE_OFF(0); + OPTI_ONE(20, 0, 14, 4); + } + if (v76 == 12) { + _vm->_fontManager.TEXTE_OFF(9); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); + } + if (v76 == 600) { + if (!_vm->_globals.internet) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_graphicsManager.FADESPD = 1; + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE1A.ANM", 100, 18, 100); + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE1.ANM", 100, 18, 100); + } + _vm->_graphicsManager.LOAD_IMAGE("BOMBEB"); + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_graphicsManager.OPTI_INI("BOMBE", 2); + _vm->_graphicsManager.FADE_INS(); + } + if (v76 == 601) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + OPTI_ONE(2, 0, 16, 4); + } + if (v76 == 602) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + OPTI_ONE(4, 0, 16, 4); + } + if (v76 == 603) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + OPTI_ONE(3, 0, 16, 4); + _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_graphicsManager.FADE_LINUX = 2; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.SORTIE = 151; + } + if (v76 == 604) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + OPTI_ONE(1, 0, 16, 4); + _vm->_soundManager.SPECIAL_SOUND = 199; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.NOFADE = 1; + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_globals.SORTIE = 151; + } + if (v76 == 605) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + OPTI_ONE(5, 0, 16, 4); + _vm->_graphicsManager.FADE_OUTS(); + _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_graphicsManager.FADE_LINUX = 2; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.NOFADE = 1; + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_globals.SORTIE = 151; + } + if (v76 == 606) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + OPTI_ONE(6, 0, 16, 4); + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_globals.SORTIE = 6; + } + if (v76 == 607) { + if (!_vm->_globals.internet) { + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + v1 = _vm->_graphicsManager.OLD_PAL[769]; + _vm->_animationManager.PLAY_ANM2("plan.ANm", 50, 10, 800); + } + _vm->_globals.NBBLOC = 0; + } + if (v76 == 608) { + _vm->_animationManager.BOBANIM_OFF(2); + _vm->_animationManager.BOBANIM_OFF(3); + _vm->_animationManager.BOBANIM_OFF(4); + _vm->_animationManager.BOBANIM_OFF(6); + _vm->_animationManager.BOBANIM_OFF(11); + _vm->_animationManager.BOBANIM_OFF(10); + } + if (v76 == 609) { + _vm->_animationManager.BOBANIM_ON(2); + _vm->_animationManager.BOBANIM_ON(3); + _vm->_animationManager.BOBANIM_ON(4); + _vm->_animationManager.BOBANIM_ON(6); + _vm->_animationManager.BOBANIM_ON(11); + _vm->_animationManager.BOBANIM_ON(10); + } + if (v76 == 611) { + _vm->_animationManager.BOBANIM_ON(5); + _vm->_animationManager.BOBANIM_ON(7); + _vm->_animationManager.BOBANIM_ON(8); + _vm->_animationManager.BOBANIM_ON(9); + _vm->_animationManager.BOBANIM_ON(12); + _vm->_animationManager.BOBANIM_ON(13); + } + if (v76 == 610) { + _vm->_animationManager.BOBANIM_OFF(5); + _vm->_animationManager.BOBANIM_OFF(7); + _vm->_animationManager.BOBANIM_OFF(8); + _vm->_animationManager.BOBANIM_OFF(9); + _vm->_animationManager.BOBANIM_OFF(12); + _vm->_animationManager.BOBANIM_OFF(13); + } + if (v76 == 10) + _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); + if (v76 == 11) + _vm->_talkManager.PARLER_PERSO("bqeflic2.pe2"); + if (v76 == 16) + _vm->_talkManager.PARLER_PERSO("ftoubib.pe2"); + if (v76 == 17) + _vm->_talkManager.PARLER_PERSO("flic2b.pe2"); + if (v76 == 18) + _vm->_talkManager.PARLER_PERSO("fjour.pe2"); + if (v76 == 13) { + _vm->_eventsManager.souris_b = _vm->_eventsManager.souris_bb; + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.CACHE_OFF(); + SPRITE_OFF(0); + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_graphicsManager.FIN_VISU(); + CLEAR_ECRAN(); + _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_soundManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); + _vm->_animationManager.CHARGE_ANIM("otage"); + _vm->_graphicsManager.LOAD_IMAGE("IM05"); + _vm->_graphicsManager.VISU_ALL(); + v11 = 0; + do { + _vm->_eventsManager.VBL(); + ++v11; + } while (v11 <= 4); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(3) != 100); + _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FIN_VISU(); + if (!_vm->_globals.CENSURE) { + _vm->_soundManager.SPECIAL_SOUND = 16; + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_ANM("EGORGE.ANM", 50, 28, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + } + _vm->_animationManager.CHARGE_ANIM("ASCEN"); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); + _vm->_graphicsManager.VISU_ALL(); + v12 = 0; + do { + _vm->_eventsManager.VBL(); + ++v12; + } while (v12 <= 4); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + SCI_OPTI_ONE(1, 0, 17, 3); + _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FIN_VISU(); + _vm->_soundManager.SPECIAL_SOUND = 14; + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_soundManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.HELICO = 1; + } + if (v76 == 36) { + if (_vm->_globals.SAUVEGARDE->data[svField270] == 2 && _vm->_globals.SAUVEGARDE->data[svField94] == 1 && _vm->_globals.SAUVEGARDE->data[svField95] == 1) + _vm->_globals.SAUVEGARDE->data[svField270] = 3; + if (!_vm->_globals.SAUVEGARDE->data[svField270]) + _vm->_talkManager.PARLER_PERSO2("PATRON0.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] == 1) + _vm->_talkManager.PARLER_PERSO2("PATRON1.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] == 2) + _vm->_talkManager.PARLER_PERSO2("PATRON2.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] == 3) + _vm->_talkManager.PARLER_PERSO2("PATRON3.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] > 3) { + _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); + _vm->_globals.SAUVEGARDE->data[svField270] = 5; + } + } + if (v76 == 37) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_soundManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); + _vm->_graphicsManager.NOFADE = 1; + } + if (v76 == 38) { + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); + _vm->_soundManager.SPECIAL_SOUND = 17; + _vm->_soundManager.PLAY_SEQ(v1, "grenade.SEQ", 1, 32, 100); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_ANM("CREVE17.ANM", 24, 24, 200); + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.DEL_SAMPLE(2); + _vm->_soundManager.DEL_SAMPLE(3); + _vm->_graphicsManager.NOFADE = 1; + } + if (v76 == 29) { + _vm->_globals.DESACTIVE_INVENT = 1; + OBJET_VIVANT("TELEP.pe2"); + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (v76 == 22) + OBJET_VIVANT("CADAVRE1.pe2"); + if (v76 == 20) + _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); + if (v76 == 23) + _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); + if (v76 == 35) { + if (!_vm->_soundManager.SOUNDOFF) { + do + _vm->_eventsManager.VBL(); + while (_vm->_soundManager.SOUND_FLAG); + } + _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); + } + if (v76 == 46) { + _vm->_globals.NOT_VERIF = 1; + _vm->_globals.chemin = PTRNUL; + v13 = YSPR(0); + v14 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v14, v13, 564, 420); + _vm->_objectsManager.NUMZONE = -1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SPRITE_OFF(0); + _vm->_globals.NOT_VERIF = 1; + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); + OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + v15 = 0; + do { + if ((unsigned __int16)BOBPOSI(9) == 4 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v15 = 1; + } + if ((unsigned __int16)BOBPOSI(9) == 5) + v15 = 0; + if ((unsigned __int16)BOBPOSI(9) == 16 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v15 = 1; + } + if ((unsigned __int16)BOBPOSI(9) == 17) + v15 = 0; + if ((unsigned __int16)BOBPOSI(9) == 28 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v15 = 1; + } + if ((unsigned __int16)BOBPOSI(9) == 29) + v15 = 0; + if ((unsigned __int16)BOBPOSI(10) == 10 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(2); + v15 = 1; + } + if ((unsigned __int16)BOBPOSI(10) == 11) + v15 = 0; + if ((unsigned __int16)BOBPOSI(10) == 22 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(2); + v15 = 1; + } + if ((unsigned __int16)BOBPOSI(10) == 23) + v15 = 0; + if ((unsigned __int16)BOBPOSI(10) == 33 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(2); + v15 = 1; + } + if ((unsigned __int16)BOBPOSI(10) == 34) + v15 = 0; + if ((unsigned __int16)BOBPOSI(10) == 12) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); + if ((unsigned __int16)BOBPOSI(10) == 23) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); + if ((unsigned __int16)BOBPOSI(10) == 34) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(9) != 36); + SPRITE_ON(0); + _vm->_animationManager.BOBANIM_OFF(9); + _vm->_animationManager.BOBANIM_OFF(10); + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.DEL_SAMPLE(2); + } + if (v76 == 59) { + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + v16 = YSPR(0); + v17 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v17, v16, 445, 332); + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(7); + SET_BOBPOSI(7, 0); + v18 = 0; + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + do { + if ((unsigned __int16)BOBPOSI(7) == 10 && !v18) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v18 = 1; + } + if ((unsigned __int16)BOBPOSI(7) == 11) + v18 = 0; + if ((unsigned __int16)BOBPOSI(7) == 18 && !v18) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v18 = 1; + } + if ((unsigned __int16)BOBPOSI(7) == 19) + v18 = 0; + if ((unsigned __int16)BOBPOSI(7) == 19) + _vm->_animationManager.BOBANIM_ON(3); + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(3) != 48); + _vm->_soundManager.DEL_SAMPLE(1); + SETANISPR(0, 62); + SPRITE_ON(0); + _vm->_animationManager.BOBANIM_ON(6); + _vm->_animationManager.BOBANIM_OFF(7); + _vm->_animationManager.BOBANIM_OFF(3); + } + if (v76 == 50) { + _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); + OPTI_ONE(11, 0, 23, 0); + } + if (v76 == 49) { + _vm->_globals.CACHE_OFF(); + SPRITE_OFF(0); + OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + v19 = 12; + if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) + v19 = 41; + v20 = 0; + do { + if ((unsigned __int16)BOBPOSI(9) == 4 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); + v20 = 1; + } + if ((unsigned __int16)BOBPOSI(9) == 5) + v20 = 0; + if ((unsigned __int16)BOBPOSI(9) == 18 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); + v20 = 1; + } + if ((unsigned __int16)BOBPOSI(9) == 19) + v20 = 0; + if ((unsigned __int16)BOBPOSI(10) == 11 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); + v20 = 1; + } + if ((unsigned __int16)BOBPOSI(10) == 12) + v20 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(9) != v19); + if (v19 == 12) { + SPRITE_ON(0); + _vm->_animationManager.BOBANIM_OFF(9); + } + _vm->_globals.CACHE_ON(); + } + if (v76 == 80) { + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(12); + _vm->_animationManager.BOBANIM_ON(13); + SET_BOBPOSI(12, 0); + SET_BOBPOSI(13, 0); + v21 = 0; + _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); + do { + if ((unsigned __int16)BOBPOSI(12) == 4 && !v21) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + v21 = 1; + } + if ((unsigned __int16)BOBPOSI(12) == 5) + v21 = 0; + if ((unsigned __int16)BOBPOSI(4) == 5 && !v21) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + v21 = 1; + } + if ((unsigned __int16)BOBPOSI(4) == 6) + v21 = 0; + if ((unsigned __int16)BOBPOSI(13) == 8) { + _vm->_animationManager.BOBANIM_OFF(13); + _vm->_animationManager.BOBANIM_OFF(3); + _vm->_animationManager.BOBANIM_ON(4); + SET_BOBPOSI(4, 0); + SET_BOBPOSI(13, 0); + } + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(4) != 16); + _vm->_animationManager.BOBANIM_OFF(12); + _vm->_animationManager.BOBANIM_OFF(4); + SPRITE_ON(0); + OBSSEUL = 1; + INILINK("IM27a"); + OBSSEUL = 0; + } + if (v76 == 81) { + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + v22 = YSPR(0); + v23 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v23, v22, 119, 268); + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(11); + _vm->_animationManager.BOBANIM_ON(8); + SET_BOBPOSI(11, 0); + SET_BOBPOSI(8, 0); + _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND48.WAV", 2); + _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); + v24 = 0; + do { + if ((unsigned __int16)BOBPOSI(11) == 4 && !v24) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + v24 = 1; + } + if ((unsigned __int16)BOBPOSI(11) == 5) + v24 = 0; + if ((unsigned __int16)BOBPOSI(8) == 11 && !v24) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + v24 = 1; + } + if ((unsigned __int16)BOBPOSI(8) == 12) + v24 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(8) != 32); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); + SPRITE_ON(0); + _vm->_animationManager.BOBANIM_OFF(11); + _vm->_animationManager.BOBANIM_OFF(8); + _vm->_animationManager.BOBANIM_ON(5); + _vm->_animationManager.BOBANIM_ON(6); + SET_BOBPOSI(5, 0); + SET_BOBPOSI(6, 0); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(5) != 74); + _vm->_animationManager.BOBANIM_OFF(5); + _vm->_animationManager.BOBANIM_OFF(6); + _vm->_animationManager.BOBANIM_ON(9); + _vm->_animationManager.BOBANIM_ON(7); + } + if (v76 == 95) { + _vm->_animationManager.BOBANIM_ON(9); + _vm->_animationManager.BOBANIM_ON(10); + _vm->_animationManager.BOBANIM_ON(12); + SET_BOBPOSI(9, 0); + SET_BOBPOSI(10, 0); + SET_BOBPOSI(12, 0); + SPRITE_OFF(0); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(9) != 15); + _vm->_animationManager.BOBANIM_OFF(9); + SPRITE_ON(0); + _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(12) != 117); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); + _vm->_animationManager.BOBANIM_OFF(12); + _vm->_animationManager.BOBANIM_OFF(10); + _vm->_animationManager.BOBANIM_ON(11); + } + if (v76 == 85) { + _vm->_animationManager.BOBANIM_OFF(3); + _vm->_animationManager.BOBANIM_ON(5); + SET_BOBPOSI(5, 0); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(5) != 6); + _vm->_animationManager.BOBANIM_OFF(5); + _vm->_animationManager.BOBANIM_ON(6); + OBSSEUL = 1; + INILINK("IM24a"); + OBSSEUL = 0; + } + if (v76 == 88) { + if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { + SET_BOBPOSI(1, 0); + SET_BOBPOSI(2, 0); + _vm->_animationManager.BOBANIM_ON(1); + _vm->_animationManager.BOBANIM_ON(2); + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + v25 = 0; + do { + if ((unsigned __int16)BOBPOSI(1) == 1 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 2) + v25 = 0; + if ((unsigned __int16)BOBPOSI(1) == 3 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 4) + v25 = 0; + if ((unsigned __int16)BOBPOSI(1) == 5 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 6) + v25 = 0; + if ((unsigned __int16)BOBPOSI(1) == 7 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 8) + v25 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(1) != 9); + _vm->_animationManager.BOBANIM_OFF(1); + _vm->_animationManager.BOBANIM_OFF(2); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); + _vm->_soundManager.DEL_SAMPLE(1); + } + if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { + SET_BOBPOSI(1, 0); + SET_BOBPOSI(3, 0); + _vm->_animationManager.BOBANIM_ON(1); + _vm->_animationManager.BOBANIM_ON(3); + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + v26 = 0; + do { + if ((unsigned __int16)BOBPOSI(1) == 1 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 2) + v26 = 0; + if ((unsigned __int16)BOBPOSI(1) == 3 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 4) + v26 = 0; + if ((unsigned __int16)BOBPOSI(1) == 5 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 6) + v26 = 0; + if ((unsigned __int16)BOBPOSI(1) == 7 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 8) + v26 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(1) != 9); + _vm->_animationManager.BOBANIM_OFF(1); + _vm->_animationManager.BOBANIM_OFF(3); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); + _vm->_soundManager.DEL_SAMPLE(1); + } + } + if (v76 == 90) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField186]) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB5A.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + } + if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB5C.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); + } + } + if (v76 == 91) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField186]) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB5B.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + } + if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB5D.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); + } + } + if (v76 == 92) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField184]) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB6A.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + } + if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB6C.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); + } + } + if (v76 == 93) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField184]) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB6B.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + } + if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { + _vm->_soundManager.PLAY_SEQ(v1, "CIB6D.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); + } + } + if (v76 == 62) + OBJET_VIVANT("SBCADA.pe2"); + if (v76 == 65) + OBJET_VIVANT("ScCADA.pe2"); + if (v76 == 105) { + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { + v27 = YSPR(0); + v28 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v28, v27, 201, 294); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { + v29 = YSPR(0); + v30 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v30, v29, 158, 338); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { + v31 = YSPR(0); + v32 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v32, v31, 211, 393); + } + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SPRITE_OFF(0); + SETANISPR(0, 60); + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); + if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { + _vm->_animationManager.BOBANIM_ON(4); + v33 = 0; + do { + if ((unsigned __int16)BOBPOSI(4) == 9 && !v33) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v33 = 1; + } + if ((unsigned __int16)BOBPOSI(4) == 10) + v33 = 0; + if ((unsigned __int16)BOBPOSI(4) == 32 && !v33) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v33 = 1; + } + if ((unsigned __int16)BOBPOSI(4) == 33) + v33 = 0; + if ((unsigned __int16)BOBPOSI(4) == 55 && !v33) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v33 = 1; + } + if ((unsigned __int16)BOBPOSI(4) == 56) + v33 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(4) != 72); + _vm->_animationManager.BOBANIM_OFF(4); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { + _vm->_animationManager.BOBANIM_ON(6); + v34 = 0; + do { + if ((unsigned __int16)BOBPOSI(6) == 9 && !v34) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v34 = 1; + } + if ((unsigned __int16)BOBPOSI(6) == 10) + v34 = 0; + if ((unsigned __int16)BOBPOSI(6) == 32 && !v34) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v34 = 1; + } + if ((unsigned __int16)BOBPOSI(6) == 33) + v34 = 0; + if ((unsigned __int16)BOBPOSI(6) == 55 && !v34) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v34 = 1; + } + if ((unsigned __int16)BOBPOSI(6) == 56) + v34 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(6) != 72); + _vm->_animationManager.BOBANIM_OFF(6); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { + _vm->_animationManager.BOBANIM_ON(5); + v35 = 0; + do { + if ((unsigned __int16)BOBPOSI(5) == 9 && !v35) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v35 = 1; + } + if ((unsigned __int16)BOBPOSI(5) == 10) + v35 = 0; + if ((unsigned __int16)BOBPOSI(5) == 32 && !v35) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v35 = 1; + } + if ((unsigned __int16)BOBPOSI(5) == 33) + v35 = 0; + if ((unsigned __int16)BOBPOSI(5) == 55 && !v35) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v35 = 1; + } + if ((unsigned __int16)BOBPOSI(5) == 56) + v35 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(5) != 72); + _vm->_animationManager.BOBANIM_OFF(5); + } + SPRITE_ON(0); + ACTION_DOS(1); + _vm->_soundManager.DEL_SAMPLE(1); + } + if (v76 == 106) { + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(4); + SET_BOBPOSI(4, 0); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(4) != 10); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(4) != 18); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(4) != 62); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(4) != 77); + _vm->_animationManager.BOBANIM_OFF(4); + SPRITE_ON(0); + } + if (v76 == 107) { + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(5); + SET_BOBPOSI(5, 0); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(5) != 10); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(5) != 18); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(5) != 38); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(5) != 53); + _vm->_animationManager.BOBANIM_OFF(5); + SPRITE_ON(0); + } + if (v76 == 210) { + _vm->_animationManager.NO_SEQ = 1; + _vm->_soundManager.SPECIAL_SOUND = 210; + _vm->_soundManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); + _vm->_animationManager.BOBANIM_ON(9); + OBSSEUL = 1; + INILINK("IM73a"); + OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + _vm->_animationManager.NO_SEQ = 0; + _vm->_globals.CACHE_ADD(0); + _vm->_globals.CACHE_ADD(1); + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); + } + if (v76 == 211) { + SPRITE_OFF(0); + _vm->_globals.CACHE_OFF(); + _vm->_animationManager.NO_SEQ = 1; + _vm->_globals.NO_VISU = 0; + _vm->_soundManager.SPECIAL_SOUND = 211; + _vm->_soundManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_animationManager.NO_SEQ = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.FADE_OUTW(); + v36 = 1; + do { + _vm->_eventsManager.VBL(); + ++v36; + } while (v36 <= 39); + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); + } + if (v76 == 207) + OBJET_VIVANT("PANNEAU.PE2"); + if (v76 == 208) { + _vm->_globals.DESACTIVE_INVENT = 1; + if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { + _vm->_soundManager.SPECIAL_SOUND = 208; + _vm->_eventsManager.NOESC = true; + _vm->_soundManager.PLAY_SEQ(v1, "SORT.SEQ", 10, 4, 10); + _vm->_eventsManager.NOESC = false; + _vm->_soundManager.SPECIAL_SOUND = 0; + } + _vm->_globals.NOT_VERIF = 1; + _vm->_globals.chemin = PTRNUL; + v37 = YSPR(0); + v38 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v38, v37, 330, 418); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = 0; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SETANISPR(0, 64); + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (v76 == 209) { + SET_BOBPOSI(1, 0); + SET_BOBPOSI(2, 0); + SETANISPR(0, 60); + _vm->_animationManager.BOBANIM_OFF(4); + _vm->_animationManager.BOBANIM_ON(1); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(1) != 9); + _vm->_animationManager.BOBANIM_OFF(1); + _vm->_globals.NO_VISU = 1; + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v39 = YSPR(0); + v40 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v40, v39, 330, 314); + _vm->_objectsManager.NUMZONE = 0; + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SETANISPR(0, 64); + _vm->_animationManager.BOBANIM_ON(2); + _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(2) != 10); + _vm->_animationManager.BOBANIM_OFF(2); + _vm->_animationManager.BOBANIM_ON(4); + } + if (v76 == 201) { + _vm->_animationManager.BOBANIM_ON(3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(3) != 18); + _vm->_animationManager.BOBANIM_OFF(3); + _vm->_animationManager.BOBANIM_ON(4); + } + if (v76 == 203) { + _vm->_globals.NO_VISU = 1; + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(4); + do { + _vm->_eventsManager.VBL(); + if ((unsigned __int16)BOBPOSI(4) == 18) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); + } while ((unsigned __int16)BOBPOSI(4) != 26); + _vm->_animationManager.BOBANIM_OFF(4); + _vm->_globals.NO_VISU = 0; + SPRITE_ON(0); + } + if (v76 == 204) { + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(3); + _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); + v41 = 0; + do { + if ((unsigned __int16)BOBPOSI(3) == 10 && !v41) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + v41 = 1; + } + if ((unsigned __int16)BOBPOSI(3) == 11) + v41 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(3) != 50); + _vm->_animationManager.BOBANIM_OFF(3); + SPRITE_ON(0); + } + if (v76 == 205) { + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(4); + _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); + v42 = 0; + do { + if ((unsigned __int16)BOBPOSI(4) == 10 && !v42) { + _vm->_soundManager.PLAY_WAV(1); + v42 = 1; + } + if ((unsigned __int16)BOBPOSI(4) == 11) + v42 = 0; + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(4) != 24); + _vm->_animationManager.BOBANIM_OFF(4); + SPRITE_ON(0); + } + if (v76 == 175) { + SETANISPR(0, 55); + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(9); + _vm->_animationManager.BOBANIM_ON(10); + BOB_OFFSET(10, 300); + _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(10) != 7); + _vm->_animationManager.BOBANIM_ON(6); + _vm->_animationManager.BOBANIM_OFF(3); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(6) != 10); + _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); + _vm->_animationManager.BOBANIM_ON(7); + _vm->_animationManager.BOBANIM_OFF(4); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(7) != 15); + _vm->_animationManager.BOBANIM_OFF(5); + _vm->_animationManager.BOBANIM_ON(8); + _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(8) != 76); + _vm->_animationManager.BOBANIM_OFF(6); + _vm->_animationManager.BOBANIM_OFF(7); + _vm->_animationManager.BOBANIM_OFF(8); + _vm->_animationManager.BOBANIM_OFF(9); + _vm->_animationManager.BOBANIM_OFF(10); + SPRITE_ON(0); + } + if (v76 == 229) { + _vm->_soundManager.SPECIAL_SOUND = 229; + _vm->_soundManager.PLAY_SEQ(v1, "MUR.SEQ", 1, 12, 1); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); + } + if (v76 == 230) { + OBSSEUL = 1; + INILINK("IM93a"); + OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v43 = YSPR(0); + v44 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v44, v43, 488, 280); + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SPRITE_OFF(0); + v45 = 0; + _vm->_animationManager.BOBANIM_ON(7); + do { + if ((unsigned __int16)BOBPOSI(7) == 9 && !v45) { + v45 = 1; + _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); + } + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(7) != 15); + _vm->_animationManager.BOBANIM_OFF(7); + SETXSPR(0, 476); + SETYSPR(0, 278); + SPRITE_ON(0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); + OBSSEUL = 1; + INILINK("IM93c"); + OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + } + if (v76 == 231) { + _vm->_globals.CACHE_OFF(); + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(12); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(12) != 6); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); + _vm->_globals.NOPARLE = 0; + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(12) != 12); + SPRITE_ON(0); + _vm->_animationManager.BOBANIM_OFF(12); + _vm->_globals.CACHE_ON(); + } + if (v76 == 233) { + _vm->_globals.CACHE_OFF(); + SPRITE_OFF(0); + _vm->_animationManager.BOBANIM_ON(11); + v46 = 0; + do { + _vm->_eventsManager.VBL(); + if ((unsigned __int16)BOBPOSI(11) == 10 && !v46) + v46 = 1; + } while ((unsigned __int16)BOBPOSI(11) != 13); + _vm->_animationManager.BOBANIM_OFF(11); + _vm->_globals.CACHE_ON(); + _vm->_animationManager.BOBANIM_ON(13); + do + _vm->_eventsManager.VBL(); + while ((unsigned __int16)BOBPOSI(13) != 48); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); + _vm->_globals.NOPARLE = 0; + _vm->_graphicsManager.FADE_OUTW(); + _vm->_animationManager.BOBANIM_OFF(13); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.SORTIE = 94; + } + if (v76 == 52) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 53) + _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); + if (v76 == 54) + _vm->_talkManager.PARLER_PERSO("GARDE2.pe2"); + if (v76 == 40) + _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); + if (v76 == 236) { + v47 = _vm->_globals.SAUVEGARDE->data[svField341]; + if (v47) { + if (v47 == 2) + v70 = 5; + if (v47 == 3) + v70 = 4; + if (v47 == 1) + v70 = 6; + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + OPTI_ONE(v70, 26, 50, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_globals.SAUVEGARDE->data[svField338] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_globals.SAUVEGARDE->data[svField339] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_globals.SAUVEGARDE->data[svField340] = 0; + } + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + OPTI_ONE(6, 0, 23, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); + } + if (v76 == 237) { + v48 = _vm->_globals.SAUVEGARDE->data[svField341]; + if (v48) { + if (v48 == 2) + v70 = 5; + if (v48 == 3) + v70 = 4; + if (v48 == 1) + v70 = 6; + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + OPTI_ONE(v70, 26, 50, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_globals.SAUVEGARDE->data[svField338] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_globals.SAUVEGARDE->data[svField339] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_globals.SAUVEGARDE->data[svField340] = 0; + } + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + OPTI_ONE(5, 0, 23, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); + } + if (v76 == 238) { + v49 = _vm->_globals.SAUVEGARDE->data[svField341]; + if (v49) { + if (v49 == 2) + v70 = 5; + if (v49 == 3) + v70 = 4; + if (v49 == 1) + v70 = 6; + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + OPTI_ONE(v70, 26, 50, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_globals.SAUVEGARDE->data[svField338] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_globals.SAUVEGARDE->data[svField339] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_globals.SAUVEGARDE->data[svField340] = 0; + } + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + OPTI_ONE(4, 0, 23, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); + } + if (v76 == 239) { + SPRITE_OFF(0); + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); + OPTI_ONE(16, 0, 10, 0); + } + if (v76 == 240) { + _vm->_animationManager.BOBANIM_ON(1); + v50 = 0; + do { + _vm->_eventsManager.VBL(); + if ((unsigned __int16)BOBPOSI(1) == 12 && !v50) { + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); + v50 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 13) + v50 = 0; + if ((unsigned __int16)BOBPOSI(1) == 25 && !v50) { + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); + v50 = 1; + } + if ((unsigned __int16)BOBPOSI(1) == 25) + v50 = 0; + } while ((unsigned __int16)BOBPOSI(1) != 32); + _vm->_animationManager.BOBANIM_OFF(1); + _vm->_animationManager.BOBANIM_ON(2); + _vm->_fontManager.TEXTE_OFF(9); + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(617, 4); + v71 = 0; + do { + _vm->_eventsManager.VBL(); + ++v71; + } while (v71 <= 29); + v51 = &_vm->_globals.SAUVEGARDE->field370; + v51->field0 = XSPR(0); + v51->field1 = YSPR(0); + v51->field2 = 57; + v51->field3 = 97; + _vm->_globals.SAUVEGARDE->data[svField121] = 1; + _vm->_globals.SAUVEGARDE->data[svField352] = 1; + _vm->_globals.SAUVEGARDE->data[svField353] = 1; + _vm->_globals.SAUVEGARDE->data[svField354] = 1; + } + if (v76 == 56) { + FileManager::CONSTRUIT_SYSTEM("HOPFEM.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 1; + _vm->_globals.SAUVEGARDE->data[svField122] = 1; + _vm->_globals.HOPKINS_DATA(); + Sprite[18].field0 = 28; + Sprite[20].field0 = 155; + VERIFTAILLE(); + } + if (v76 == 57) { + FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + _vm->_globals.SAUVEGARDE->data[svField122] = 0; + _vm->_globals.HOPKINS_DATA(); + Sprite[18].field0 = 34; + Sprite[20].field0 = 190; + VERIFTAILLE(); + } + if (v76 == 25) + _vm->_talkManager.PARLER_PERSO("AGENT1.pe2"); + if (v76 == 26) + _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); + if (v76 == 87) { + if (_vm->_globals.SAUVEGARDE->data[svField188]) + _vm->_talkManager.PARLER_PERSO("stand2.pe2"); + else + _vm->_talkManager.PARLER_PERSO("stand1.pe2"); + } + if (v76 == 86) { + if (_vm->_globals.SAUVEGARDE->data[svField231] == 1) { + _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); + } else { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); + _vm->_globals.NOPARLE = 0; + } + } + if (v76 == 51) { + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.CACHE_OFF(); + SPRITE_OFF(0); + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.LOAD_IMAGE("IM20f"); + _vm->_animationManager.CHARGE_ANIM("ANIM20f"); + _vm->_graphicsManager.VISU_ALL(); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_INW(); + v52 = 0; + _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); + do { + if ((unsigned __int16)BOBPOSI(12) == 5 && !v52) { + _vm->_soundManager.PLAY_WAV(1); + v52 = 1; + } + _vm->_eventsManager.VBL(); + } while ((unsigned __int16)BOBPOSI(12) != 34); + _vm->_animationManager.BOBANIM_OFF(2); + _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.SORTIE = 20; + } + if (v76 == 41) + _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); + if (v76 == 44) + _vm->_talkManager.PARLER_PERSO("MORT3A.pe2"); + if (v76 == 42) + _vm->_talkManager.PARLER_PERSO("MORT2.pe2"); + if (v76 == 43) + _vm->_talkManager.PARLER_PERSO("MORT1.pe2"); + if (v76 == 47) + _vm->_talkManager.PARLER_PERSO("BARMAN.pe2"); + if (v76 == 45) + _vm->_talkManager.PARLER_PERSO("FEM3.pe2"); + if (v76 == 48) + _vm->_talkManager.PARLER_PERSO("SAMAN2.pe2"); + if (v76 == 21) + _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); + if (v76 == 94) { + if (!_vm->_globals.SAUVEGARDE->data[svField228]) + _vm->_talkManager.PARLER_PERSO("flicn.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField228] == 1) + _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); + } + if (v76 == 27) { + if (_vm->_globals.SAUVEGARDE->data[svField94] != 1 || _vm->_globals.SAUVEGARDE->data[svField95] != 1) + _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); + else + _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); + } + if (v76 == 58) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); + _vm->_globals.SAUVEGARDE->data[svField176] = 1; + _vm->_globals.SAUVEGARDE->data[svField270] = 2; + _vm->_globals.NOPARLE = 0; + } + if (v76 == 200) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 84) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 98) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 83) + _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); + if (v76 == 32) + _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); + if (v76 == 215) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("aviat.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 216) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 170) + _vm->_talkManager.PARLER_PERSO("GRED.pe2"); + if (v76 == 172) + _vm->_talkManager.PARLER_PERSO("GBLEU.pe2"); + if (v76 == 100) + _vm->_talkManager.PARLER_PERSO("tourist.pe2"); + if (v76 == 103) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); + _vm->_globals.NOPARLE = 0; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM2("T421.ANM", 100, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM2("T421a.ANM", 100, 14, 500); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 104) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 108) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche1.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 109) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 110) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche3.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 111) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche4.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 112) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("teint1.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 176) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gred2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 177) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 113) + _vm->_talkManager.PARLER_PERSO("teint.pe2"); + if (v76 == 114) + _vm->_talkManager.PARLER_PERSO("tahibar.pe2"); + if (v76 == 115) + _vm->_talkManager.PARLER_PERSO("ilebar.pe2"); + if (v76 == 116) + _vm->_talkManager.PARLER_PERSO("Profred.pe2"); + if (v76 == 101) + _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); + if (v76 == 243) { + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { + _vm->_animationManager.NO_SEQ = 1; + _vm->_soundManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); + _vm->_animationManager.NO_SEQ = 0; + } else { + OPTI_ONE(7, 0, 14, 0); + } + } + if (v76 == 242) { + _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); + _vm->_animationManager.NO_SEQ = 1; + _vm->_soundManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); + _vm->_animationManager.NO_SEQ = 0; + v53 = &_vm->_globals.SAUVEGARDE->field380; + v53->field0 = 404; + v53->field1 = 395; + v53->field2 = 64; + v53->field3 = _vm->_globals.ECRAN; + + v54 = _vm->_globals.STAILLE[790 / 2]; + if (_vm->_globals.STAILLE[790 / 2] < 0) + v54 = -_vm->_globals.STAILLE[790 / 2]; + v76 = -(signed __int16)(100 * (67 - (signed __int16)(100 - v54)) / 67); + v53->field4 = v76; + _vm->_globals.SAUVEGARDE->data[svField357] = 1; + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField355] = 1; + DEUXPERSO = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); + SPRITE(_vm->_globals.TETE, v53->field0, v53->field1, 1, 3, v53->field4, 0, 20, 127); + SPRITE_ON(1); + } + if (v76 == 245) { + _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); + OPTI_ONE(5, 0, 6, 0); + // TODO: is 98 correct? + _vm->_globals.ZONEP[98].field0 = 276; + VERBE_ON(4, 19); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); + _vm->_globals.SAUVEGARDE->data[svField399] = 1; + } + if (v76 == 246) { + SPRITE_OFF(0); + OPTI_ONE(6, 0, 15, 0); + _vm->_objectsManager.PERSO_ON = 1; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_animationManager.NO_SEQ = 1; + _vm->_soundManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); + _vm->_animationManager.NO_SEQ = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.FADE_OUTW(); + _vm->_objectsManager.PERSO_ON = 0; + _vm->_globals.SORTIE = 100; + } + if (v76 == 55) { + _vm->_animationManager.BOBANIM_OFF(1); + OPTI_ONE(15, 0, 12, 0); + _vm->_animationManager.BOBANIM_OFF(15); + OBSSEUL = 1; + INILINK("IM19a"); + OBSSEUL = 0; + } + if (v76 == 241) + _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); + if (v76 == 171) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gred1.pe2"); + _vm->_globals.NOPARLE = 0; + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v55 = YSPR(0); + v56 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v56, v55, 361, 325); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = -1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + _vm->_globals.SORTIE = 59; + } + if (v76 == 173) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); + _vm->_globals.NOPARLE = 0; + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v57 = YSPR(0); + v58 = XSPR(0); + _vm->_globals.chemin = PARCOURS2(v58, v57, 361, 325); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = -1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + _vm->_globals.SORTIE = 59; + } + if (v76 == 174) + _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); + if (v76 == 202) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); + _vm->_globals.NOPARLE = 0; + } + v1 = 1; + } + if (*(a1 + 2) == 69 && *(a1 + 3) == 73 && *(a1 + 4) == 70) + v1 = 4; + if (*(a1 + 2) == 86 && *(a1 + 3) == 65 && *(a1 + 4) == 76) { + v1 = 1; + _vm->_globals.SAUVEGARDE->data[READ_LE_UINT16(a1 + 5)] = READ_LE_UINT16(a1 + 7); + } + if (*(a1 + 2) == 65 && *(a1 + 3) == 68 && *(a1 + 4) == 68) { + v1 = 1; + _vm->_globals.SAUVEGARDE->data[READ_LE_UINT16(a1 + 5)] += *(a1 + 7); + } + if (*(a1 + 2) == 66 && *(a1 + 3) == 79 && *(a1 + 4) == 83) { + v1 = 1; + BOB_OFFSET(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); + } + if (*(a1 + 2) == 86 && *(a1 + 3) == 79 && *(a1 + 4) == 78) { + VERBE_ON(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); + v1 = 1; + } + if (*(a1 + 2) == 90 && *(a1 + 3) == 67 && *(a1 + 4) == 72) { + _vm->_globals.ZONEP[READ_LE_UINT16(a1 + 5)].field12 = READ_LE_UINT16(a1 + 7); + v1 = 1; + } + if (*(a1 + 2) == 74 && *(a1 + 3) == 85 && *(a1 + 4) == 77) { + v59 = READ_LE_UINT16(a1 + 7); + NVZONE = READ_LE_UINT16(a1 + 5); + NVVERBE = v59; + v1 = 6; + } + if (*(a1 + 2) == 83 && *(a1 + 3) == 79 && *(a1 + 4) == 85) { + v60 = READ_LE_UINT16(a1 + 5); + memset(&s, 0, 0x13u); + memset(v77, 0, 5u); + sprintf(v77, "%d", v60); + s = 83; + v79 = 79; + v80 = 85; + v81 = 78; + v82[0] = 68; + v61 = 5; + v62 = 0; + do + *(&s + v61++) = v77[v62++]; + while (v77[v62]); + v63 = v61; + *(&s + v63) = 46; + *(&v79 + v63) = 87; + *(&v80 + v63) = 65; + *(&v81 + v63) = 86; + v82[v63] = 0; + _vm->_soundManager.PLAY_SOUND(s); + v1 = 1; + } + if (*(a1 + 2) == 86 && *(a1 + 3) == 79 && *(a1 + 4) == 70) { + VERBE_OFF(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); + v1 = 1; + } + if (*(a1 + 2) == 73 && *(a1 + 3) == 73) { + if (*(a1 + 4) == 70) + v1 = 3; + } + + return v1; +} + +void ObjectsManager::BOB_VIVANT(int a1) { + warning("TODO: BOB_VIVANT"); +} + +void ObjectsManager::VBOB(byte *a1, int a2, int a3, int a4, int a5) { + warning("TODO: VBOB"); +} + +void ObjectsManager::VBOB_OFF(int idx) { + warning("TODO: VBOB_OFF"); +} + +void ObjectsManager::ACTION_DOS(int idx) { + warning("TODO: ACTION_DOS"); +} + +void ObjectsManager::ACTION_DROITE(int idx) { + warning("TODO: ACTION_DROITE"); +} + +void ObjectsManager::Q_DROITE(int idx) { + warning("TODO: Q_DROITE"); +} + +void ObjectsManager::ACTION_FACE(int idx) { + warning("TODO: ACTION_FACE"); +} + +void ObjectsManager::Q_GAUCHE(int idx) { + warning("TODO: Q_GAUCHE"); +} + +void ObjectsManager::ACTION_GAUCHE(int idx) { + warning("TODO: ACTION_GAUCHE"); +} + +void ObjectsManager::ZONE_ON(int idx) { + warning("TODO: ZONE_ON"); +} + +void ObjectsManager::ZONE_OFF(int idx) { + warning("TODO: ZONE_OFF"); +} + +void ObjectsManager::OPTI_ONE(int a1, int a2, int a3, int a4) { + warning("TODO: OPTI_ONE"); +} + +int ObjectsManager::BOBPOSI(int a1) { + warning("BOBPOSI"); + return 0; +} + +void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { + SPEED_FLAG = true; + SPEED_PTR = speedData; + _vm->_objectsManager.SPEED_X = xp; + _vm->_objectsManager.SPEED_Y = yp; + SPEED_IMAGE = img; +} + +void ObjectsManager::SET_BOBPOSI(int a1, int a2) { + warning("TODO: SET_BOBPOSI"); +} + +void ObjectsManager::INILINK(const Common::String &file) { + warning("TODO: INILINK"); +} + +void ObjectsManager::OBJET_VIVANT(const Common::String &a2) { + warning("TODO: OBJET_VIVANT"); +} + +void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { + warning("TODO: OPTI_BOBON"); +} + +void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { + warning("TODO: SCI_OPTI_ONE"); +} + +int ObjectsManager::Control_Goto(const byte *dataP) { + return READ_LE_UINT16(dataP + 5); +} + +int ObjectsManager::Control_If(const byte *dataP, int a2) { + warning("TODO: Control_If"); + return 0; +} + +void ObjectsManager::VERBE_OFF(int a1, int a2) { + warning("TODO: VERBE_OFF"); +} + +void ObjectsManager::VERBE_ON(int a1, int a2) { + warning("TODO: VERBE_ON"); +} +/* +int ObjectsManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { + warning("TODO: PARC_PERS"); + return 0; +} + +int ObjectsManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { + warning("TODO: MIRACLE"); + return 0; +} +*/ + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 009be78fb8..a6a4324f2b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -106,13 +106,34 @@ public: int A_DEPA; int MAX_DEPA; int MAX_DEPA1; - + int VIRE_INVENT; + int AFFINVEN; + int TRAVAILOBJET; + int CH_TETE; + int T_RECTIF; + int DESACTIVE; + int DEUXPERSO; + int PERX, PERY; + int PERI; + int RECALL; + int PTAILLE; + int PEROFX; + int PEROFY; + int OBSSEUL; + int NVVERBE; + int NVZONE; + int NV_LIGNEDEP; + int NV_LIGNEOFS; + int NV_POSI; + int NVPX; + int NVPY; public: ObjectsManager(); void setParent(HopkinsEngine *vm); byte *CHANGE_OBJET(int objIndex); byte *CAPTURE_OBJET(int objIndex, int mode); + void DELETE_OBJET(int objIndex); int Get_Largeur(const byte *objectData, int idx); int Get_Hauteur(const byte *objectData, int idx); @@ -133,6 +154,9 @@ public: void DEF_BOB(int idx); void BOB_VISU(int idx); void BOB_OFF(int idx); + void BOB_OFFSET(int idx, int v); + void BOB_ADJUST(int idx, int v); + void BOB_OFFSETY(int idx, int v); void SCBOB(int idx); void CALCUL_BOB(int idx); @@ -166,6 +190,7 @@ public: void SETFLIPSPR(int idx, int a2); void VERIFZONE(); + void GOHOME(); void GOHOME2(); void CHARGE_OBSTACLE(const Common::String &file); void CHARGE_CACHE(const Common::String &file); @@ -186,6 +211,39 @@ public: int MZONE(); void CLEAR_ZONE(); void RESET_OBSTACLE(); + int ZONE_OBJET(int a1, int a2); + void PARAMCADRE(int a1); + void OBJETPLUS(int a1); + void VALID_OBJET(int a1); + void OPTI_OBJET(); + void SPECIAL_JEU(int a1); + int Traduction(byte *a1); + void BOB_VIVANT(int a1); + void VBOB(byte *a1, int a2, int a3, int a4, int a5); + void VBOB_OFF(int idx); + void ACTION_DOS(int idx); + void ACTION_DROITE(int idx); + void Q_DROITE(int idx); + void ACTION_FACE(int idx); + void Q_GAUCHE(int idx); + void ACTION_GAUCHE(int idx); + + void ZONE_ON(int idx); + void ZONE_OFF(int idx); + void OPTI_ONE(int a1, int a2, int a3, int a4); + int BOBPOSI(int a1); + void AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img); + void SET_BOBPOSI(int a1, int a2); + void INILINK(const Common::String &file); + void OBJET_VIVANT(const Common::String &a2); + void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); + void SCI_OPTI_ONE(int a1, int a2, int a3, int a4); + int Control_Goto(const byte *dataP); + int Control_If(const byte *dataP, int a2); + void VERBE_OFF(int a1, int a2); + void VERBE_ON(int a1, int a2); + int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); + int MIRACLE(int a1, int a2, int a3, int a4, int a5); }; } // End of namespace Hopkins diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 813eb26933..b138ee36ba 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -43,6 +43,10 @@ void SoundManager::LOAD_ANM_SOUND() { warning("TODO: LOAD_ANIM_SOUND"); } +void SoundManager::LOAD_WAV(const Common::String &file, int a2) { + warning("TODO: LOAD_WAV"); +} + void SoundManager::PLAY_ANM_SOUND(int soundNumber) { warning("TODO: PLAAY_ANIM_SOUND"); } @@ -64,6 +68,10 @@ void SoundManager::PLAY_SOUND(const Common::String &file) { warning("TODO: PLAY_SOUND"); } +void SoundManager::PLAY_SOUND2(const Common::String &file) { + warning("TODO: PLAY_SOUND2"); +} + void SoundManager::MODSetSampleVolume() { warning("TODO MODSetSampleVolume"); } @@ -76,5 +84,24 @@ void SoundManager::MODSetMusicVolume(int volume) { warning("TODO MODSetMusicVolume"); } +void SoundManager::CHARGE_SAMPLE(int a1, const Common::String &file) { + warning("TODO: CHARGE_SAMPLE"); +} + +void SoundManager::PLAY_SAMPLE2(int idx) { + warning("PLAY_SAMPLE2"); +} + +void SoundManager::PLAY_SEQ(int a1, const Common::String &a2, int a3, int a4, int a5) { + warning("PLAY_SEQ"); +} + +void SoundManager::PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4) { + warning("PLAY_SEQ2"); +} + +void SoundManager::PLAY_WAV(int a1) { + warning("PLAY_WAV"); +} } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 26bfaa53e1..d962233f73 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -45,20 +45,28 @@ public: bool MUSICOFF; bool VOICEOFF; bool TEXTOFF; + bool SOUND_FLAG; public: void setParent(HopkinsEngine *vm); void WSOUND_INIT(); void VERIF_SOUND(); void LOAD_ANM_SOUND(); + void LOAD_WAV(const Common::String &file, int a2); void PLAY_ANM_SOUND(int soundNumber); void WSOUND(int soundNumber); bool VOICE_MIX(int a1, int a2); void DEL_SAMPLE(int soundNumber); void PLAY_SOUND(const Common::String &file); + void PLAY_SOUND2(const Common::String &file2); void MODSetSampleVolume(); void MODSetVoiceVolume(); void MODSetMusicVolume(int volume); + void CHARGE_SAMPLE(int a1, const Common::String &file); + void PLAY_SAMPLE2(int idx); + void PLAY_SEQ(int a1, const Common::String &a2, int a3, int a4, int a5); + void PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4); + void PLAY_WAV(int a1); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 49ad99971a..1e76458fa5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -67,7 +67,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { BUFFERPERSO = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); TAILLEPERSO = FileManager::FLONG(_vm->_globals.NFICHIER); } - _vm->_globals.SAUVEGARDE->field4 = 0; + _vm->_globals.SAUVEGARDE->data[svField4] = 0; RENVOIE_FICHIER(40, v16, (const char *)BUFFERPERSO); RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); @@ -199,7 +199,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { TAILLEPERSO = FileManager::FLONG(_vm->_globals.NFICHIER); } - _vm->_globals.SAUVEGARDE->field4 = 0; + _vm->_globals.SAUVEGARDE->data[svField4] = 0; RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); @@ -436,7 +436,7 @@ int TalkManager::DIALOGUE_REP(int idx) { v7 = READ_LE_UINT16((uint16 *)v3 + 9); if (v7) - _vm->_globals.SAUVEGARDE->field4 = v7; + _vm->_globals.SAUVEGARDE->data[svField4] = v7; if (!v6) v6 = 10; -- cgit v1.2.3 From 84e07ae7253217c4b1ad650abdef57ffaa6b0032 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 21:21:09 +1000 Subject: HOPKINS: Changed all __int16 to int --- engines/hopkins/anim.cpp | 22 +- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/events.cpp | 10 +- engines/hopkins/font.cpp | 14 +- engines/hopkins/graphics.cpp | 144 +++++------ engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/menu.cpp | 10 +- engines/hopkins/objects.cpp | 584 +++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 24 +- 9 files changed, 407 insertions(+), 407 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 970e5d82f0..2cc147df58 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -325,7 +325,7 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { Common::File f; if (!f.open(GLOBALS.NFICHIER)) - error("Failed to open %s", GLOBALS.NFICHIER); + error("Failed to open %s", GLOBALS.NFICHIER.c_str()); int filesize = f.size(); int nbytes = filesize - 115; @@ -391,12 +391,12 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam int width; int height; byte *v13; - __int16 v16; - __int16 v17; + int v16; + int v17; byte *ptr; byte *v19; - __int16 v20; - __int16 v21; + int v20; + int v21; int result = 0; FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, filename); GLOBALS.Bank[idx].field1C = FileManager::FLONG(GLOBALS.NFICHIER); @@ -483,18 +483,18 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { int v6; int v7; byte *v9; - __int16 v10; - __int16 v11; - __int16 v12; + int v10; + int v11; + int v12; char v13; signed int v14; - __int16 v15; - __int16 v16; + int v15; + int v16; char v17; int v19; char v20; int v21; - __int16 v22; + int v22; const byte *v23; int v24; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index fdcdc48931..0cf1af84b5 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -195,7 +195,7 @@ void OptionsDialog::show(HopkinsEngine *vm) { vm->_globals.vitesse = 2; if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) vm->_globals.SVGA = 2; - if (mousePos.x < vm->_graphicsManager.ofscroll + 165 || mousePos.x > vm->_graphicsManager.ofscroll + 496 || (unsigned __int16)(mousePos.y - 107) > 0xD3u) + if (mousePos.x < vm->_graphicsManager.ofscroll + 165 || mousePos.x > vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 0xD3u) doneFlag = true; } diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 9482b4ce09..1dda365518 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -240,13 +240,13 @@ void EventsManager::VBL() { _vm->_objectsManager.AFF_SPRITES(); /* int a1 = 0; - signed __int16 v1; + signed int v1; int v2; int v3; int v4; int v5; int v6; - signed __int16 v7; + signed int v7; int v10; signed int v11 = 0; signed int v12 = 0; @@ -303,9 +303,9 @@ void EventsManager::VBL() { } else { if (v15 < min_x) v15 = min_x - v1; - v2 = (signed __int16)v2; - if (_vm->_eventsManager.souris_y < min_y - (signed __int16)v2) - a1 = min_y - (signed __int16)v2; + //v2 = v2; + if (_vm->_eventsManager.souris_y < min_y - v2) + a1 = min_y - v2; if (_vm->_eventsManager.souris_sizex + v15 >= max_x) v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 5618ea9767..c44f0cdca9 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -51,7 +51,7 @@ void FontManager::clearAll() { } void FontManager::TEXTE_ON(int idx) { - if ((signed __int16)(idx - 5) > 11) + if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); TxtItem &txt = Txt[idx - 5]; @@ -66,7 +66,7 @@ void FontManager::TEXTE_ON(int idx) { void FontManager::TEXTE_OFF(int idx) { - if ((signed __int16)(idx - 5) > 11) + if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); TxtItem &txt = Txt[idx - 5]; @@ -422,7 +422,7 @@ LABEL_57: TRIER_TEXT[v67] = 0; } while (v25 != v67); ++v67; - } while ((signed __int16)v67 <= 19); + } while (v67 <= 19); v68 = 0; do { @@ -431,7 +431,7 @@ LABEL_57: ++v68; } while (v68 <= 19); - if ((unsigned __int16)(Txt[idx].field3FC - 2) > 1u) { + if ((Txt[idx].field3FC - 2) > 1u) { for (i = xp - _vm->_eventsManager.start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2) ; Txt[idx].field8 = i; @@ -471,7 +471,7 @@ LABEL_57: } v29 = Txt[idx].field3FC; - if (v29 == 1 || v29 == 3 || (unsigned __int16)(v29 - 5) <= 1u) { + if (v29 == 1 || v29 == 3 || (uint16)(v29 - 5) <= 1u) { v49 = v51 * v53; ptrd = _vm->_globals.dos_malloc2(v51 * v53); @@ -485,9 +485,9 @@ LABEL_57: _vm->_globals.dos_free2(ptrd); _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, -2); - _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, (signed __int16)(v51 + v55), v53, -2); + _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, (v51 + v55), v53, -2); _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, -2); - _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, (signed __int16)(v53 + v56), v70, v51, -2); + _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, (v53 + v56), v70, v51, -2); } Txt[idx].field12 = v58; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 96d81aa903..0fb3fedcad 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -342,13 +342,13 @@ void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { // TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { int filesize; - signed __int16 v6; + int v6; int v7; - __int16 v8; + int v8; int v9; int v10; int v11; - unsigned __int8 v12; + byte v12; int v13; int v14; char v15; @@ -846,18 +846,18 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface } void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { - __int16 v3; - __int16 v4; + int v3; + int v4; int v5; - signed __int16 v6; - __int16 v7; + int v6; + int v7; int v8; - __int16 v9; - __int16 v10; - __int16 v12; + int v9; + int v10; + int v12; uint16 v13; byte palData[PALETTE_BLOCK_SIZE]; - __int16 v15[PALETTE_BLOCK_SIZE]; + int v15[PALETTE_BLOCK_SIZE]; v13 = v3 = FADESPD; if (palette) { @@ -880,12 +880,12 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } v6 = 0; - if ((signed __int16)v13 > 0) { + if ((int)v13 > 0) { do { v7 = 0; do { v8 = v7; - v9 = v15[v7] - ((unsigned int)*(byte *)(v7 + palette) << 8) / (signed __int16)v13; + v9 = v15[v7] - ((unsigned int)*(byte *)(v7 + palette) << 8) / (int)v13; v15[v8] = v9; palData[v8] = (v9 >> 8) & 0xff; ++v7; @@ -901,7 +901,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac DD_VBL(); } ++v6; - } while ((signed __int16)v13 > v6); + } while ((int)v13 > v6); } v10 = 0; @@ -1083,7 +1083,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSur return; if (v6 < 251) { - v3 += (unsigned __int8)(*(byte *)v5 + 35); + v3 += (byte)(*(byte *)v5 + 35); v6 = *(v5++ + 1); } else if (v6 == 253) { v3 += *(v5 + 1); @@ -1154,7 +1154,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { if (v5 == 252) return; if (v5 < 251) { - v2 += (unsigned __int8)(*v4 + 35); + v2 += (byte)(*v4 + 35); v5 = *(v4++ + 1); } else if (v5 == -3) { v2 += *(v4 + 1); @@ -1182,7 +1182,7 @@ Video_Cont3_Vbe: v3 = v6; } else { v9 = v3; - v10 = (unsigned __int8)(*v4 + 45); + v10 = (byte)(*v4 + 45); result = *(v4 + 1); v11 = (byte *)(v2 + (byte *)VideoPtr->pixels); v2 += v10; @@ -1764,15 +1764,15 @@ void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, in clip_x = clip_y = 0; clip_x1 = clip_y1 = 0; - if ((unsigned __int16)a3 > min_x) { - if ((unsigned __int16)a3 < (unsigned __int16)(min_x + 300)) + if (a3 > min_x) { + if ((uint)a3 < (uint)(min_x + 300)) clip_x = min_x + 300 - a3; - if ((unsigned __int16)a4 > min_y) { - if ((unsigned __int16)a4 < (unsigned __int16)(min_y + 300)) + if (a4 > min_y) { + if ((uint)a4 < (uint)(min_y + 300)) clip_y = min_y + 300 - a4; - if ((unsigned __int16)a3 < (unsigned __int16)(max_x + 300)) { + if ((uint)a3 < (uint)(max_x + 300)) { clip_x1 = max_x + 300 - a3; - if ((unsigned __int16)a4 < (unsigned __int16)(max_y + 300)) { + if ((uint)a4 < (uint)(max_y + 300)) { clip_y1 = max_y + 300 - a4; v14 = a3 + nbrligne2 * (a4 - 300) - 300 + destSurface; @@ -1789,31 +1789,31 @@ void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, in if (a8) { v29 = v20 + v14; if (clip_y) { - if ((unsigned __int16)clip_y >= v22) + if (clip_y >= v22) return; v61 = v22; v52 = v20; v30 = 0; - v31 = (unsigned __int16)clip_y; + v31 = (uint)clip_y; while (Asm_Zoom(v30 + 1, a7) < v31) ; v20 = v52; v13 += Largeur * v30; - v29 += nbrligne2 * (unsigned __int16)clip_y; - v22 = v61 - (unsigned __int16)clip_y; + v29 += nbrligne2 * (uint)clip_y; + v22 = v61 - (uint)clip_y; } - if (v22 > (unsigned __int16)clip_y1) - v22 = (unsigned __int16)clip_y1; + if (v22 > clip_y1) + v22 = clip_y1; if (clip_x) { - if ((unsigned __int16)clip_x >= v20) + if (clip_x >= v20) return; - v20 -= (unsigned __int16)clip_x; + v20 -= (uint)clip_x; } - if (v20 > (unsigned __int16)clip_x1) { - v32 = v20 - (unsigned __int16)clip_x1; + if (v20 > clip_x1) { + v32 = v20 - clip_x1; v29 -= v32; v62 = v22; v33 = 0; @@ -1823,7 +1823,7 @@ void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, in v34 = v33; v22 = v62; v13 += v34; - v20 = (unsigned __int16)clip_x1; + v20 = (uint)clip_x1; } do { @@ -1844,7 +1844,7 @@ void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, in if (!Agr_Flag_x) Agr_x = a7 + Agr_x; - if ((unsigned __int16)Agr_x < 100) + if ((uint)Agr_x < 100) break; Agr_x = Agr_x - 100; @@ -1866,7 +1866,7 @@ R_Aff_Zoom_Larg_Cont1: if (!(uint16)Agr_Flag_y) Agr_y = a7 + Agr_y; - if ((unsigned __int16)Agr_y < 100) + if ((uint)Agr_y < 100) break; Agr_y = Agr_y - 100; @@ -1882,30 +1882,30 @@ R_Aff_Zoom_Larg_Cont1: } while (v63 != 1); } else { if (clip_y) { - if ((unsigned __int16)clip_y >= v22) + if (clip_y >= v22) return; v58 = v22; v49 = v20; v23 = 0; - v24 = (unsigned __int16)clip_y; + v24 = (uint)clip_y; while (Asm_Zoom(v23 + 1, a7) < v24) ; v20 = v49; v13 += Largeur * v23; - v14 += nbrligne2 * (unsigned __int16)clip_y; - v22 = v58 - (unsigned __int16)clip_y; + v14 += nbrligne2 * (uint)clip_y; + v22 = v58 - (uint)clip_y; } - if (v22 > (unsigned __int16)clip_y1) - v22 = (unsigned __int16)clip_y1; + if (v22 > clip_y1) + v22 = clip_y1; if (clip_x) { - if ((unsigned __int16)clip_x >= v20) + if (clip_x >= v20) return; v59 = v22; v50 = v20; - v25 = (unsigned __int16)clip_x; + v25 = (uint)clip_x; v26 = 0; while (Asm_Zoom(v26 + 1, a7) < v25) @@ -1913,12 +1913,12 @@ R_Aff_Zoom_Larg_Cont1: v27 = v26; v22 = v59; v13 += v27; - v14 += (unsigned __int16)clip_x; - v20 = v50 - (unsigned __int16)clip_x; + v14 += (uint)clip_x; + v20 = v50 - (uint)clip_x; } - if (v20 > (unsigned __int16)clip_x1) - v20 = (unsigned __int16)clip_x1; + if (v20 > clip_x1) + v20 = clip_x1; do { for (;;) { @@ -1938,7 +1938,7 @@ R_Aff_Zoom_Larg_Cont1: if (!Agr_Flag_x) Agr_x = a7 + Agr_x; - if ((unsigned __int16)Agr_x < 100) + if ((uint)Agr_x < 100) break; Agr_x = Agr_x - 100; @@ -1961,7 +1961,7 @@ Aff_Zoom_Larg_Cont1: if (!(uint16)Agr_Flag_y) Agr_y = a7 + Agr_y; - if ((unsigned __int16)Agr_y < 100) + if ((uint)Agr_y < 100) break; Agr_y = Agr_y - 100; @@ -1984,7 +1984,7 @@ Aff_Zoom_Larg_Cont1: Largeur = v11; Red = a6; - if ((unsigned __int16)a6 < 100) { + if ((uint)a6 < 100) { v37 = Asm_Reduc(v11, Red); if (a8) { v40 = v37 + v14; @@ -1994,7 +1994,7 @@ Aff_Zoom_Larg_Cont1: v55 = v40; Red_y = Red + Red_y; - if ((unsigned __int16)Red_y < 100) { + if ((uint)Red_y < 100) { Red_x = 0; v41 = Largeur; v42 = v37; @@ -2029,14 +2029,14 @@ Aff_Zoom_Larg_Cont1: v54 = v14; Red_y = Red + Red_y; - if ((unsigned __int16)Red_y < 100) { + if ((uint)Red_y < 100) { Red_x = 0; v38 = Largeur; v39 = 0; do { Red_x = Red + Red_x; - if ((unsigned __int16)Red_x < 100) { + if ((uint)Red_x < 100) { if (v39 >= clip_x && v39 < clip_x1 && *v13) *v14 = *v13; ++v14; @@ -2068,14 +2068,14 @@ Aff_Zoom_Larg_Cont1: v16 = v11 + v14; spec_largeur = v11; if (clip_y) { - if ((unsigned __int16)clip_y >= (unsigned int)v12) + if ((uint)clip_y >= (unsigned int)v12) return; - v13 += v11 * (unsigned __int16)clip_y; - v16 += nbrligne2 * (unsigned __int16)clip_y; - v12 -= (unsigned __int16)clip_y; + v13 += v11 * (uint)clip_y; + v16 += nbrligne2 * (uint)clip_y; + v12 -= (uint)clip_y; } - v17 = (unsigned __int16)clip_y1; + v17 = (uint)clip_y1; if (v12 > clip_y1) v12 = clip_y1; @@ -2086,11 +2086,11 @@ Aff_Zoom_Larg_Cont1: v11 -= v17; } - if (v11 > (unsigned __int16)clip_x1) { - v18 = v11 - (unsigned __int16)clip_x1; + if (v11 > clip_x1) { + v18 = v11 - clip_x1; v13 += v18; v16 -= v18; - v11 = (unsigned __int16)clip_x1; + v11 = (uint)clip_x1; } do { @@ -2114,27 +2114,27 @@ Aff_Zoom_Larg_Cont1: } else { spec_largeur = v11; if (clip_y) { - if ((unsigned __int16)clip_y >= (unsigned int)v12) + if ((uint)clip_y >= (unsigned int)v12) return; - v13 += v11 * (unsigned __int16)clip_y; - v14 += nbrligne2 * (unsigned __int16)clip_y; - v12 -= (unsigned __int16)clip_y; + v13 += v11 * (uint)clip_y; + v14 += nbrligne2 * (uint)clip_y; + v12 -= (uint)clip_y; } if (v12 > clip_y1) v12 = clip_y1; if (clip_x) { - if ((unsigned __int16)clip_x >= v11) + if (clip_x >= v11) return; - v13 += (unsigned __int16)clip_x; - v14 += (unsigned __int16)clip_x; - v11 -= (unsigned __int16)clip_x; + v13 += (uint)clip_x; + v14 += (uint)clip_x; + v11 -= (uint)clip_x; } - if (v11 > (unsigned __int16)clip_x1) - v11 = (unsigned __int16)clip_x1; + if (v11 > clip_x1) + v11 = clip_x1; do { v56 = v12; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1da0295b35..5bc6d399fb 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -574,7 +574,7 @@ void HopkinsEngine::INIT_SYSTEM() { void HopkinsEngine::INTRORUN() { signed int v2; signed int v3; - unsigned __int16 v4; + uint16 v4; signed int v5; int i; int v7; @@ -588,7 +588,7 @@ void HopkinsEngine::INTRORUN() { int k; int l; int m; - __int16 v21; + int v21; char v22; char v23; byte paletteData[PALETTE_EXT_BLOCK_SIZE]; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index c16d266afa..3fa7c55290 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -45,11 +45,11 @@ int MenuManager::MENU() { MenuSelection menuIndex; Common::Point mousePos; signed int v6; - signed __int16 v7; - signed __int16 v8; - signed __int16 v9; - signed __int16 v10; - __int16 v11; + int v7; + int v8; + int v9; + int v10; + int v11; v6 = 0; while (!g_system->getEventManager()->shouldQuit()) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8873ba7b62..c75074f571 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -293,9 +293,9 @@ void ObjectsManager::AFF_SPRITES() { int v31; int v32; int v33; - signed int v34; - signed int v35; - signed int v36; + int v34; + int v35; + int v36; int v37; int v38; uint16 arr[50]; @@ -718,13 +718,13 @@ void ObjectsManager::BOB_OFFSETY(int idx, int v) { void ObjectsManager::SCBOB(int idx) { int v1; - signed int v2; - signed int v3; - signed int v4; - signed int v6; - signed int v7; + int v2; + int v3; + int v4; + int v6; + int v7; int v8; - signed int v9; + int v9; v1 = idx; if (_vm->_globals.Cache[idx].fieldA > 0) { @@ -744,9 +744,9 @@ void ObjectsManager::SCBOB(int idx) { v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; if (v6 > v4) { - if (v6 < (signed int)v1) { + if (v6 < v1) { v1 = 0; - if (v9 >= v3 && v9 <= (signed int)(_vm->_globals.Cache[idx].field6 + v3)) { + if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx].field6 + v3)) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } @@ -797,7 +797,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { int v14; int v15; int v17; - signed int v20; + int v20; int v21; int v22; @@ -827,12 +827,12 @@ void ObjectsManager::CALCUL_BOB(int idx) { v20 = 0; v7 = _vm->_globals.Bob[idx].field36; - if ((signed int)v7 < 0) { - v7 = (signed int)v7; - if ((signed int)v7 < 0) + if (v7 < 0) { + v7 = v7; + if (v7 < 0) v7 = -v7; v20 = v7; - if ((signed int)v7 > 95) + if (v7 > 95) v20 = 95; } if (_vm->_globals.Bob[idx].field36 > 0) @@ -845,7 +845,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 < 0) v8 = -v15; v15 = v8; - v22 = -(signed int)_vm->_graphicsManager.Reel_Zoom((signed int)v8, v21); + v22 = -_vm->_graphicsManager.Reel_Zoom(v8, v21); } if (v6 >= 0) { v17 = _vm->_graphicsManager.Reel_Zoom(v6, v21); @@ -854,7 +854,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 < 0) v9 = -v15; v6 = v9; - v17 = -(signed int)_vm->_graphicsManager.Reel_Zoom((signed int)v9, v21); + v17 = -_vm->_graphicsManager.Reel_Zoom(v9, v21); } } @@ -866,7 +866,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 < 0) v10 = -v15; v15 = v10; - v22 = -(signed int)_vm->_graphicsManager.Reel_Reduc((signed int)v10, v20); + v22 = -_vm->_graphicsManager.Reel_Reduc(v10, v20); } if (v6 >= 0) { v17 = _vm->_graphicsManager.Reel_Reduc(v6, v20); @@ -874,7 +874,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { v11 = v15; if (v15 < 0) v11 = -v15; - v17 = -(signed int)_vm->_graphicsManager.Reel_Reduc((signed int)v11, v20); + v17 = -_vm->_graphicsManager.Reel_Reduc(v11, v20); } } @@ -912,9 +912,9 @@ void ObjectsManager::CALCUL_BOB(int idx) { void ObjectsManager::VERIFCACHE() { int v1; - signed int v2; - signed int v3; - signed int v4; + int v2; + int v3; + int v4; int v5; int v6; int v7; @@ -996,7 +996,7 @@ void ObjectsManager::VERIFCACHE() { void ObjectsManager::INVENT_ANIM() { int v0; - signed int v1; + int v1; if (!DESACTIVE_INVENT) { if (FLAG_VISIBLE_EFFACE && !FLAG_VISIBLE) { @@ -1153,12 +1153,12 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int reducePercent = 0; v9 = Sprite[idx].fieldC; - if ((signed int)v9 < 0) { - v9 = (signed int)v9; - if ((signed int)v9 < 0) + if (v9 < 0) { + v9 = v9; + if (v9 < 0) v9 = -v9; reducePercent = v9; - if ((signed int)v9 > 95) + if (v9 > 95) reducePercent = 95; } if (Sprite[idx].fieldC > 0) @@ -1173,7 +1173,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (v4 < 0) v10 = -v4; v4 = v10; - v22 = -_vm->_graphicsManager.Reel_Zoom((signed int)v10, zoomPercent); + v22 = -_vm->_graphicsManager.Reel_Zoom(v10, zoomPercent); } if (v8 >= 0) { @@ -1183,7 +1183,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (v4 < 0) v11 = -v4; v8 = v11; - v7 = -_vm->_graphicsManager.Reel_Zoom((signed int)v11, zoomPercent); + v7 = -_vm->_graphicsManager.Reel_Zoom(v11, zoomPercent); } } if (reducePercent) { @@ -1194,7 +1194,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (v4 < 0) v12 = -v4; v4 = v12; - v22 = -_vm->_graphicsManager.Reel_Reduc((signed int)v12, reducePercent); + v22 = -_vm->_graphicsManager.Reel_Reduc(v12, reducePercent); } if (v8 >= 0) { v7 = _vm->_graphicsManager.Reel_Reduc(v8, reducePercent); @@ -1202,7 +1202,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { v13 = v4; if (v4 < 0) v13 = -v4; - v7 = -_vm->_graphicsManager.Reel_Reduc((signed int)v13, reducePercent); + v7 = -_vm->_graphicsManager.Reel_Reduc(v13, reducePercent); } } @@ -1252,13 +1252,13 @@ int ObjectsManager::AvantTri(int a1, int a2, int a3) { } void ObjectsManager::AFF_BOB_ANIM() { - signed int v1; + int v1; int v2; - signed int v5; + int v5; int v6; int v7; int v8; - signed int v10; + int v10; int v11; int v12; int v13; @@ -1715,11 +1715,11 @@ void ObjectsManager::SETFLIPSPR(int idx, int a2) { } void ObjectsManager::VERIFZONE() { - __int16 v0; + int v0; int v1; - __int16 v2; - unsigned __int16 v3; - __int16 v4; + int v2; + uint16 v3; + int v4; v0 = _vm->_eventsManager.XMOUSE(); v1 = _vm->_eventsManager.YMOUSE(); @@ -1727,7 +1727,7 @@ void ObjectsManager::VERIFZONE() { if (_vm->_globals.PLAN_FLAG || _vm->_eventsManager.start_x >= v0 || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) - || (v1 = v2 - 1, (unsigned __int16)(v2 - 1) > 0x3Bu)) { + || (v1 = v2 - 1, (uint16)(v2 - 1) > 0x3Bu)) { if (FLAG_VISIBLE == 1) FLAG_VISIBLE_EFFACE = 4; FLAG_VISIBLE = 0; @@ -1807,7 +1807,7 @@ LABEL_54: if (_vm->_globals.NOMARCHE == 1) { if (_vm->_eventsManager.btsouris == 4) { v1 = v4 + 1; - if ((unsigned __int16)(v4 + 1) > 1u) + if ((uint16)(v4 + 1) > 1u) BTDROITE(); } } @@ -1964,25 +1964,25 @@ void ObjectsManager::PLAN_BETA() { void ObjectsManager::BTGAUCHE() { int v0; - __int16 v1; - __int16 v2; + int v1; + int v2; byte *v3; byte *v4; byte *v5; int v6; - __int16 v7; - __int16 v8; + int v7; + int v8; byte *v9; - __int16 v10; - __int16 v11; - __int16 v12; + int v10; + int v11; + int v12; byte *v13; - __int16 v14; - __int16 v15; + int v14; + int v15; byte *v16; - __int16 v17; - __int16 v18; - __int16 v19; + int v17; + int v18; + int v19; _vm->_fontManager.TEXTE_OFF(9); v19 = _vm->_eventsManager.XMOUSE(); @@ -2074,7 +2074,7 @@ LABEL_38: v9 = _vm->_globals.chemin; _vm->_globals.chemin = PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { - if ((signed __int16)YSPR(0) <= 374 || (signed __int16)YSPR(0) > 410) { + if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); v11 = YSPR(0); v12 = XSPR(0); @@ -2151,12 +2151,12 @@ LABEL_65: } void ObjectsManager::PARADISE() { - signed int v1; // esi@1 - char result; // al@1 - int v3; // eax@11 - unsigned __int16 v4; // ax@19 - int v5; // eax@24 - unsigned __int16 v6; // ax@33 + int v1; + char result; + int v3; + uint16 v4; + int v5; + uint16 v6; v1 = 0; ARRET_PERSO_FLAG = 0; @@ -2164,18 +2164,18 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || (unsigned __int16)(NUMZONE - 20) > 1u && (unsigned __int16)(NUMZONE - 22) > 1u) { + if (_vm->_globals.FORET != 1 || (uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { _vm->_graphicsManager.no_scroll = 2; - if (_vm->_eventsManager.start_x >= (signed __int16)XSPR(0) - 320) + if (_vm->_eventsManager.start_x >= XSPR(0) - 320) goto LABEL_64; - v3 = _vm->_eventsManager.start_x + 320 - (signed __int16)XSPR(0); + v3 = _vm->_eventsManager.start_x + 320 - XSPR(0); if (v3 < 0) v3 = -v3; if (v3 <= 160) { LABEL_64: - if (_vm->_eventsManager.start_x > (signed __int16)XSPR(0) - 320) { - v5 = _vm->_eventsManager.start_x + 320 - (signed __int16)XSPR(0); + if (_vm->_eventsManager.start_x > XSPR(0) - 320) { + v5 = _vm->_eventsManager.start_x + 320 - XSPR(0); if (v5 < 0) v5 = -v5; if (v5 > 160) { @@ -2190,12 +2190,12 @@ LABEL_64: _vm->_graphicsManager.SCROLL = 640; v1 = 1; } - if ((signed __int16)_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) { + if (_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) { v6 = _vm->_eventsManager.YMOUSE(); _vm->_eventsManager.souris_xy(_vm->_eventsManager.souris_x - 4, v6); } _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager.start_x > (signed __int16)XSPR(0) - 320); + } while (v1 != 1 && _vm->_eventsManager.start_x > XSPR(0) - 320); } } } else { @@ -2209,16 +2209,16 @@ LABEL_64: _vm->_graphicsManager.SCROLL = 640; v1 = 1; } - if ((signed __int16)_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) { + if (_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) { v4 = _vm->_eventsManager.YMOUSE(); _vm->_eventsManager.souris_xy(_vm->_eventsManager.souris_x + 4, v4); } _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager.start_x < (signed __int16)XSPR(0) - 320); + } while (v1 != 1 && _vm->_eventsManager.start_x < XSPR(0) - 320); } - if ((signed __int16)_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + if (_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) _vm->_eventsManager.souris_xy(_vm->_graphicsManager.SCROLL + 610, 0); - if ((signed __int16)_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + if (_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) _vm->_eventsManager.souris_xy(_vm->_graphicsManager.SCROLL + 10, 0); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 0; @@ -2228,11 +2228,11 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } _vm->_eventsManager.CHANGE_MOUSE(4); - if ((unsigned __int16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { + if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { NUMZONE = -1; FORCEZONE = 1; } - if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (unsigned __int16)(NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager.btsouris = 4; CHANGEVERBE = 0; } else { @@ -2257,7 +2257,7 @@ LABEL_64: if (_vm->_globals.NOMARCHE == 1) { if (_vm->_eventsManager.btsouris == 4) { result = NUMZONE + 1; - if ((unsigned __int16)(NUMZONE + 1) > 1u) + if ((uint16)(NUMZONE + 1) > 1u) BTDROITE(); } } @@ -2265,7 +2265,7 @@ LABEL_64: } void ObjectsManager::CLEAR_ECRAN() { - __int16 v1; + int v1; int v2; CLEAR_SPR(); @@ -2324,25 +2324,25 @@ void ObjectsManager::CLEAR_ECRAN() { } void ObjectsManager::INVENT() { - __int16 v1; + int v1; size_t filesize; - __int16 v4; - signed __int16 v5; - __int16 v6; + int v4; + int v5; + int v6; byte *v7; - __int16 v8; - signed int v9; - __int16 v10; - __int16 v11; - __int16 v12; - __int16 v13; - signed __int16 v14; - __int16 v15; - __int16 v16; - __int16 v17; - __int16 v18; - __int16 v19; - signed __int16 v20; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; Common::File f; v13 = 0; @@ -2423,7 +2423,7 @@ LABEL_7: if (v11 != v10) PARAMCADRE(v11); if (_vm->_eventsManager.btsouris != 16) { - if ((unsigned __int16)(_vm->_eventsManager.btsouris - 1) > 1u) { + if ((uint16)(_vm->_eventsManager.btsouris - 1) > 1u) { if (_vm->_eventsManager.btsouris != 3) { if (v12 == 2) { OBJETPLUS(v13); @@ -2434,7 +2434,7 @@ LABEL_7: } } if (v12 == 1) { - if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (unsigned __int16)(_vm->_eventsManager.btsouris - 2) <= 1u) + if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (uint16)(_vm->_eventsManager.btsouris - 2) <= 1u) break; v9 = v13; VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); @@ -2473,7 +2473,7 @@ LABEL_7: if (v20 == 1) break; _vm->_eventsManager.VBL(); - if ((unsigned __int16)(_vm->_globals.ECRAN - 35) <= 5u) + if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) SPECIAL_JEU(v9); } _vm->_fontManager.TEXTE_OFF(9); @@ -3126,7 +3126,7 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(a1, a2 - v56, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, a2 - v56, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, _vm->_globals.super_parcours, 4); @@ -3150,7 +3150,7 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(a1, v60 + a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, v60 + a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, _vm->_globals.super_parcours, 4); @@ -3174,7 +3174,7 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(a1 - v63, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(a1 - v63, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, _vm->_globals.super_parcours, 4); @@ -3198,7 +3198,7 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if ((unsigned __int16)_vm->_graphicsManager.colision2_ligne(v66 + a1, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(v66 + a1, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, _vm->_globals.super_parcours, 4); @@ -3233,7 +3233,7 @@ LABEL_234: v112 += 4; } v116 = v115 + 1; - if ((signed __int16)(v115 + 1) < v121) { + if ((v115 + 1) < v121) { do { v72 = 0; v110 = v116; @@ -3301,7 +3301,7 @@ LABEL_200: } while (v80 > 0); } v117 = v115 - 1; - if ((signed __int16)(v115 - 1) > v121) { + if ((v115 - 1) > v121) { do { v83 = _vm->_globals.Ligne[v117].field0 - 1; if (v83 > -1) { @@ -3463,81 +3463,81 @@ void ObjectsManager::SPECIAL_JEU(int a1) { } int ObjectsManager::Traduction(byte *a1) { - signed int v1; - __int16 v2; - signed __int16 v3; - signed __int16 v4; - __int16 v5; - __int16 v6; - __int16 v7; - __int16 v8; - __int16 v9; - __int16 v10; - __int16 v11; - __int16 v12; - __int16 v13; - __int16 v14; - signed __int16 v15; - __int16 v16; - __int16 v17; - signed __int16 v18; - signed __int16 v19; - signed __int16 v20; - signed __int16 v21; - __int16 v22; - __int16 v23; - signed __int16 v24; - signed __int16 v25; - signed __int16 v26; - __int16 v27; - __int16 v28; - __int16 v29; - __int16 v30; - __int16 v31; - __int16 v32; - signed __int16 v33; - signed __int16 v34; - signed __int16 v35; - signed __int16 v36; - __int16 v37; - __int16 v38; - __int16 v39; - __int16 v40; - signed __int16 v41; - signed __int16 v42; - __int16 v43; - __int16 v44; - signed __int16 v45; - signed __int16 v46; + int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; char v47; char v48; char v49; - signed __int16 v50; + int v50; Sauvegarde1 *v51; - signed __int16 v52; + int v52; Sauvegarde1 *v53; int v54; - __int16 v55; - __int16 v56; - __int16 v57; - __int16 v58; - __int16 v59; - __int16 v60; - signed __int16 v61; - __int16 v62; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; int v63; - __int16 v65; - __int16 v66; - __int16 v67; - __int16 v68; - __int16 v69; - __int16 v70; - __int16 v71; - __int16 v72; - signed __int16 v73; - signed __int16 v74; - __int16 v75; - __int16 v76; + int v65; + int v66; + int v67; + int v68; + int v69; + int v70; + int v71; + int v72; + int v73; + int v74; + int v75; + int v76; char v77[12]; Common::String s; char v79; @@ -3588,7 +3588,7 @@ int ObjectsManager::Traduction(byte *a1) { v3 = 636; if (v3 == 612) v3 = 636; - if ((unsigned __int16)(v3 - 613) <= 1u || v3 == 134) + if ((uint16)(v3 - 613) <= 1u || v3 == 134) v3 = 636; if (v3 == 615) v3 = 635; @@ -4214,7 +4214,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(3) != 100); + while ((uint16)BOBPOSI(3) != 100); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.FIN_VISU(); if (!_vm->_globals.CENSURE) { @@ -4316,50 +4316,50 @@ LABEL_1141: OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); v15 = 0; do { - if ((unsigned __int16)BOBPOSI(9) == 4 && !v15) { + if ((uint16)BOBPOSI(9) == 4 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; } - if ((unsigned __int16)BOBPOSI(9) == 5) + if ((uint16)BOBPOSI(9) == 5) v15 = 0; - if ((unsigned __int16)BOBPOSI(9) == 16 && !v15) { + if ((uint16)BOBPOSI(9) == 16 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; } - if ((unsigned __int16)BOBPOSI(9) == 17) + if ((uint16)BOBPOSI(9) == 17) v15 = 0; - if ((unsigned __int16)BOBPOSI(9) == 28 && !v15) { + if ((uint16)BOBPOSI(9) == 28 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; } - if ((unsigned __int16)BOBPOSI(9) == 29) + if ((uint16)BOBPOSI(9) == 29) v15 = 0; - if ((unsigned __int16)BOBPOSI(10) == 10 && !v15) { + if ((uint16)BOBPOSI(10) == 10 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = 1; } - if ((unsigned __int16)BOBPOSI(10) == 11) + if ((uint16)BOBPOSI(10) == 11) v15 = 0; - if ((unsigned __int16)BOBPOSI(10) == 22 && !v15) { + if ((uint16)BOBPOSI(10) == 22 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = 1; } - if ((unsigned __int16)BOBPOSI(10) == 23) + if ((uint16)BOBPOSI(10) == 23) v15 = 0; - if ((unsigned __int16)BOBPOSI(10) == 33 && !v15) { + if ((uint16)BOBPOSI(10) == 33 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = 1; } - if ((unsigned __int16)BOBPOSI(10) == 34) + if ((uint16)BOBPOSI(10) == 34) v15 = 0; - if ((unsigned __int16)BOBPOSI(10) == 12) + if ((uint16)BOBPOSI(10) == 12) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); - if ((unsigned __int16)BOBPOSI(10) == 23) + if ((uint16)BOBPOSI(10) == 23) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); - if ((unsigned __int16)BOBPOSI(10) == 34) + if ((uint16)BOBPOSI(10) == 34) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(9) != 36); + } while ((uint16)BOBPOSI(9) != 36); SPRITE_ON(0); _vm->_animationManager.BOBANIM_OFF(9); _vm->_animationManager.BOBANIM_OFF(10); @@ -4386,22 +4386,22 @@ LABEL_1141: v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); do { - if ((unsigned __int16)BOBPOSI(7) == 10 && !v18) { + if ((uint16)BOBPOSI(7) == 10 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; } - if ((unsigned __int16)BOBPOSI(7) == 11) + if ((uint16)BOBPOSI(7) == 11) v18 = 0; - if ((unsigned __int16)BOBPOSI(7) == 18 && !v18) { + if ((uint16)BOBPOSI(7) == 18 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; } - if ((unsigned __int16)BOBPOSI(7) == 19) + if ((uint16)BOBPOSI(7) == 19) v18 = 0; - if ((unsigned __int16)BOBPOSI(7) == 19) + if ((uint16)BOBPOSI(7) == 19) _vm->_animationManager.BOBANIM_ON(3); _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(3) != 48); + } while ((uint16)BOBPOSI(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); SETANISPR(0, 62); SPRITE_ON(0); @@ -4422,26 +4422,26 @@ LABEL_1141: v19 = 41; v20 = 0; do { - if ((unsigned __int16)BOBPOSI(9) == 4 && !v20) { + if ((uint16)BOBPOSI(9) == 4 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); v20 = 1; } - if ((unsigned __int16)BOBPOSI(9) == 5) + if ((uint16)BOBPOSI(9) == 5) v20 = 0; - if ((unsigned __int16)BOBPOSI(9) == 18 && !v20) { + if ((uint16)BOBPOSI(9) == 18 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); v20 = 1; } - if ((unsigned __int16)BOBPOSI(9) == 19) + if ((uint16)BOBPOSI(9) == 19) v20 = 0; - if ((unsigned __int16)BOBPOSI(10) == 11 && !v20) { + if ((uint16)BOBPOSI(10) == 11 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); v20 = 1; } - if ((unsigned __int16)BOBPOSI(10) == 12) + if ((uint16)BOBPOSI(10) == 12) v20 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(9) != v19); + } while ((uint16)BOBPOSI(9) != v19); if (v19 == 12) { SPRITE_ON(0); _vm->_animationManager.BOBANIM_OFF(9); @@ -4458,19 +4458,19 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); do { - if ((unsigned __int16)BOBPOSI(12) == 4 && !v21) { + if ((uint16)BOBPOSI(12) == 4 && !v21) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); v21 = 1; } - if ((unsigned __int16)BOBPOSI(12) == 5) + if ((uint16)BOBPOSI(12) == 5) v21 = 0; - if ((unsigned __int16)BOBPOSI(4) == 5 && !v21) { + if ((uint16)BOBPOSI(4) == 5 && !v21) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); v21 = 1; } - if ((unsigned __int16)BOBPOSI(4) == 6) + if ((uint16)BOBPOSI(4) == 6) v21 = 0; - if ((unsigned __int16)BOBPOSI(13) == 8) { + if ((uint16)BOBPOSI(13) == 8) { _vm->_animationManager.BOBANIM_OFF(13); _vm->_animationManager.BOBANIM_OFF(3); _vm->_animationManager.BOBANIM_ON(4); @@ -4478,7 +4478,7 @@ LABEL_1141: SET_BOBPOSI(13, 0); } _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(4) != 16); + } while ((uint16)BOBPOSI(4) != 16); _vm->_animationManager.BOBANIM_OFF(12); _vm->_animationManager.BOBANIM_OFF(4); SPRITE_ON(0); @@ -4510,20 +4510,20 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); v24 = 0; do { - if ((unsigned __int16)BOBPOSI(11) == 4 && !v24) { + if ((uint16)BOBPOSI(11) == 4 && !v24) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); v24 = 1; } - if ((unsigned __int16)BOBPOSI(11) == 5) + if ((uint16)BOBPOSI(11) == 5) v24 = 0; - if ((unsigned __int16)BOBPOSI(8) == 11 && !v24) { + if ((uint16)BOBPOSI(8) == 11 && !v24) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); v24 = 1; } - if ((unsigned __int16)BOBPOSI(8) == 12) + if ((uint16)BOBPOSI(8) == 12) v24 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(8) != 32); + } while ((uint16)BOBPOSI(8) != 32); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); SPRITE_ON(0); _vm->_animationManager.BOBANIM_OFF(11); @@ -4535,7 +4535,7 @@ LABEL_1141: _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(5) != 74); + while ((uint16)BOBPOSI(5) != 74); _vm->_animationManager.BOBANIM_OFF(5); _vm->_animationManager.BOBANIM_OFF(6); _vm->_animationManager.BOBANIM_ON(9); @@ -4551,13 +4551,13 @@ LABEL_1141: SPRITE_OFF(0); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(9) != 15); + while ((uint16)BOBPOSI(9) != 15); _vm->_animationManager.BOBANIM_OFF(9); SPRITE_ON(0); _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(12) != 117); + while ((uint16)BOBPOSI(12) != 117); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); _vm->_animationManager.BOBANIM_OFF(12); _vm->_animationManager.BOBANIM_OFF(10); @@ -4569,7 +4569,7 @@ LABEL_1141: SET_BOBPOSI(5, 0); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(5) != 6); + while ((uint16)BOBPOSI(5) != 6); _vm->_animationManager.BOBANIM_OFF(5); _vm->_animationManager.BOBANIM_ON(6); OBSSEUL = 1; @@ -4585,32 +4585,32 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v25 = 0; do { - if ((unsigned __int16)BOBPOSI(1) == 1 && !v25) { + if ((uint16)BOBPOSI(1) == 1 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 2) + if ((uint16)BOBPOSI(1) == 2) v25 = 0; - if ((unsigned __int16)BOBPOSI(1) == 3 && !v25) { + if ((uint16)BOBPOSI(1) == 3 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 4) + if ((uint16)BOBPOSI(1) == 4) v25 = 0; - if ((unsigned __int16)BOBPOSI(1) == 5 && !v25) { + if ((uint16)BOBPOSI(1) == 5 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 6) + if ((uint16)BOBPOSI(1) == 6) v25 = 0; - if ((unsigned __int16)BOBPOSI(1) == 7 && !v25) { + if ((uint16)BOBPOSI(1) == 7 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 8) + if ((uint16)BOBPOSI(1) == 8) v25 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(1) != 9); + } while ((uint16)BOBPOSI(1) != 9); _vm->_animationManager.BOBANIM_OFF(1); _vm->_animationManager.BOBANIM_OFF(2); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); @@ -4624,32 +4624,32 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v26 = 0; do { - if ((unsigned __int16)BOBPOSI(1) == 1 && !v26) { + if ((uint16)BOBPOSI(1) == 1 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 2) + if ((uint16)BOBPOSI(1) == 2) v26 = 0; - if ((unsigned __int16)BOBPOSI(1) == 3 && !v26) { + if ((uint16)BOBPOSI(1) == 3 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 4) + if ((uint16)BOBPOSI(1) == 4) v26 = 0; - if ((unsigned __int16)BOBPOSI(1) == 5 && !v26) { + if ((uint16)BOBPOSI(1) == 5 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 6) + if ((uint16)BOBPOSI(1) == 6) v26 = 0; - if ((unsigned __int16)BOBPOSI(1) == 7 && !v26) { + if ((uint16)BOBPOSI(1) == 7 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 8) + if ((uint16)BOBPOSI(1) == 8) v26 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(1) != 9); + } while ((uint16)BOBPOSI(1) != 9); _vm->_animationManager.BOBANIM_OFF(1); _vm->_animationManager.BOBANIM_OFF(3); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); @@ -4741,78 +4741,78 @@ LABEL_1141: _vm->_animationManager.BOBANIM_ON(4); v33 = 0; do { - if ((unsigned __int16)BOBPOSI(4) == 9 && !v33) { + if ((uint16)BOBPOSI(4) == 9 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if ((unsigned __int16)BOBPOSI(4) == 10) + if ((uint16)BOBPOSI(4) == 10) v33 = 0; - if ((unsigned __int16)BOBPOSI(4) == 32 && !v33) { + if ((uint16)BOBPOSI(4) == 32 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if ((unsigned __int16)BOBPOSI(4) == 33) + if ((uint16)BOBPOSI(4) == 33) v33 = 0; - if ((unsigned __int16)BOBPOSI(4) == 55 && !v33) { + if ((uint16)BOBPOSI(4) == 55 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if ((unsigned __int16)BOBPOSI(4) == 56) + if ((uint16)BOBPOSI(4) == 56) v33 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(4) != 72); + } while ((uint16)BOBPOSI(4) != 72); _vm->_animationManager.BOBANIM_OFF(4); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { _vm->_animationManager.BOBANIM_ON(6); v34 = 0; do { - if ((unsigned __int16)BOBPOSI(6) == 9 && !v34) { + if ((uint16)BOBPOSI(6) == 9 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if ((unsigned __int16)BOBPOSI(6) == 10) + if ((uint16)BOBPOSI(6) == 10) v34 = 0; - if ((unsigned __int16)BOBPOSI(6) == 32 && !v34) { + if ((uint16)BOBPOSI(6) == 32 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if ((unsigned __int16)BOBPOSI(6) == 33) + if ((uint16)BOBPOSI(6) == 33) v34 = 0; - if ((unsigned __int16)BOBPOSI(6) == 55 && !v34) { + if ((uint16)BOBPOSI(6) == 55 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if ((unsigned __int16)BOBPOSI(6) == 56) + if ((uint16)BOBPOSI(6) == 56) v34 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(6) != 72); + } while ((uint16)BOBPOSI(6) != 72); _vm->_animationManager.BOBANIM_OFF(6); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { _vm->_animationManager.BOBANIM_ON(5); v35 = 0; do { - if ((unsigned __int16)BOBPOSI(5) == 9 && !v35) { + if ((uint16)BOBPOSI(5) == 9 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if ((unsigned __int16)BOBPOSI(5) == 10) + if ((uint16)BOBPOSI(5) == 10) v35 = 0; - if ((unsigned __int16)BOBPOSI(5) == 32 && !v35) { + if ((uint16)BOBPOSI(5) == 32 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if ((unsigned __int16)BOBPOSI(5) == 33) + if ((uint16)BOBPOSI(5) == 33) v35 = 0; - if ((unsigned __int16)BOBPOSI(5) == 55 && !v35) { + if ((uint16)BOBPOSI(5) == 55 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if ((unsigned __int16)BOBPOSI(5) == 56) + if ((uint16)BOBPOSI(5) == 56) v35 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(5) != 72); + } while ((uint16)BOBPOSI(5) != 72); _vm->_animationManager.BOBANIM_OFF(5); } SPRITE_ON(0); @@ -4828,19 +4828,19 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(4) != 10); + while ((uint16)BOBPOSI(4) != 10); _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(4) != 18); + while ((uint16)BOBPOSI(4) != 18); _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(4) != 62); + while ((uint16)BOBPOSI(4) != 62); _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(4) != 77); + while ((uint16)BOBPOSI(4) != 77); _vm->_animationManager.BOBANIM_OFF(4); SPRITE_ON(0); } @@ -4853,19 +4853,19 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(5) != 10); + while ((uint16)BOBPOSI(5) != 10); _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(5) != 18); + while ((uint16)BOBPOSI(5) != 18); _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(5) != 38); + while ((uint16)BOBPOSI(5) != 38); _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(5) != 53); + while ((uint16)BOBPOSI(5) != 53); _vm->_animationManager.BOBANIM_OFF(5); SPRITE_ON(0); } @@ -4943,7 +4943,7 @@ LABEL_1141: _vm->_animationManager.BOBANIM_ON(1); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(1) != 9); + while ((uint16)BOBPOSI(1) != 9); _vm->_animationManager.BOBANIM_OFF(1); _vm->_globals.NO_VISU = 1; _vm->_globals.chemin = PTRNUL; @@ -4962,7 +4962,7 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(2) != 10); + while ((uint16)BOBPOSI(2) != 10); _vm->_animationManager.BOBANIM_OFF(2); _vm->_animationManager.BOBANIM_ON(4); } @@ -4970,7 +4970,7 @@ LABEL_1141: _vm->_animationManager.BOBANIM_ON(3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(3) != 18); + while ((uint16)BOBPOSI(3) != 18); _vm->_animationManager.BOBANIM_OFF(3); _vm->_animationManager.BOBANIM_ON(4); } @@ -4980,9 +4980,9 @@ LABEL_1141: _vm->_animationManager.BOBANIM_ON(4); do { _vm->_eventsManager.VBL(); - if ((unsigned __int16)BOBPOSI(4) == 18) + if ((uint16)BOBPOSI(4) == 18) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); - } while ((unsigned __int16)BOBPOSI(4) != 26); + } while ((uint16)BOBPOSI(4) != 26); _vm->_animationManager.BOBANIM_OFF(4); _vm->_globals.NO_VISU = 0; SPRITE_ON(0); @@ -4993,14 +4993,14 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); v41 = 0; do { - if ((unsigned __int16)BOBPOSI(3) == 10 && !v41) { + if ((uint16)BOBPOSI(3) == 10 && !v41) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); v41 = 1; } - if ((unsigned __int16)BOBPOSI(3) == 11) + if ((uint16)BOBPOSI(3) == 11) v41 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(3) != 50); + } while ((uint16)BOBPOSI(3) != 50); _vm->_animationManager.BOBANIM_OFF(3); SPRITE_ON(0); } @@ -5010,14 +5010,14 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); v42 = 0; do { - if ((unsigned __int16)BOBPOSI(4) == 10 && !v42) { + if ((uint16)BOBPOSI(4) == 10 && !v42) { _vm->_soundManager.PLAY_WAV(1); v42 = 1; } - if ((unsigned __int16)BOBPOSI(4) == 11) + if ((uint16)BOBPOSI(4) == 11) v42 = 0; _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(4) != 24); + } while ((uint16)BOBPOSI(4) != 24); _vm->_animationManager.BOBANIM_OFF(4); SPRITE_ON(0); } @@ -5030,24 +5030,24 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(10) != 7); + while ((uint16)BOBPOSI(10) != 7); _vm->_animationManager.BOBANIM_ON(6); _vm->_animationManager.BOBANIM_OFF(3); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(6) != 10); + while ((uint16)BOBPOSI(6) != 10); _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); _vm->_animationManager.BOBANIM_ON(7); _vm->_animationManager.BOBANIM_OFF(4); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(7) != 15); + while ((uint16)BOBPOSI(7) != 15); _vm->_animationManager.BOBANIM_OFF(5); _vm->_animationManager.BOBANIM_ON(8); _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(8) != 76); + while ((uint16)BOBPOSI(8) != 76); _vm->_animationManager.BOBANIM_OFF(6); _vm->_animationManager.BOBANIM_OFF(7); _vm->_animationManager.BOBANIM_OFF(8); @@ -5084,12 +5084,12 @@ LABEL_1141: v45 = 0; _vm->_animationManager.BOBANIM_ON(7); do { - if ((unsigned __int16)BOBPOSI(7) == 9 && !v45) { + if ((uint16)BOBPOSI(7) == 9 && !v45) { v45 = 1; _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); } _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(7) != 15); + } while ((uint16)BOBPOSI(7) != 15); _vm->_animationManager.BOBANIM_OFF(7); SETXSPR(0, 476); SETYSPR(0, 278); @@ -5106,13 +5106,13 @@ LABEL_1141: _vm->_animationManager.BOBANIM_ON(12); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(12) != 6); + while ((uint16)BOBPOSI(12) != 6); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); _vm->_globals.NOPARLE = 0; do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(12) != 12); + while ((uint16)BOBPOSI(12) != 12); SPRITE_ON(0); _vm->_animationManager.BOBANIM_OFF(12); _vm->_globals.CACHE_ON(); @@ -5124,15 +5124,15 @@ LABEL_1141: v46 = 0; do { _vm->_eventsManager.VBL(); - if ((unsigned __int16)BOBPOSI(11) == 10 && !v46) + if ((uint16)BOBPOSI(11) == 10 && !v46) v46 = 1; - } while ((unsigned __int16)BOBPOSI(11) != 13); + } while ((uint16)BOBPOSI(11) != 13); _vm->_animationManager.BOBANIM_OFF(11); _vm->_globals.CACHE_ON(); _vm->_animationManager.BOBANIM_ON(13); do _vm->_eventsManager.VBL(); - while ((unsigned __int16)BOBPOSI(13) != 48); + while ((uint16)BOBPOSI(13) != 48); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals.NOPARLE = 0; @@ -5246,19 +5246,19 @@ LABEL_1141: v50 = 0; do { _vm->_eventsManager.VBL(); - if ((unsigned __int16)BOBPOSI(1) == 12 && !v50) { + if ((uint16)BOBPOSI(1) == 12 && !v50) { _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); v50 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 13) + if ((uint16)BOBPOSI(1) == 13) v50 = 0; - if ((unsigned __int16)BOBPOSI(1) == 25 && !v50) { + if ((uint16)BOBPOSI(1) == 25 && !v50) { _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); v50 = 1; } - if ((unsigned __int16)BOBPOSI(1) == 25) + if ((uint16)BOBPOSI(1) == 25) v50 = 0; - } while ((unsigned __int16)BOBPOSI(1) != 32); + } while ((uint16)BOBPOSI(1) != 32); _vm->_animationManager.BOBANIM_OFF(1); _vm->_animationManager.BOBANIM_ON(2); _vm->_fontManager.TEXTE_OFF(9); @@ -5337,12 +5337,12 @@ LABEL_1141: v52 = 0; _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); do { - if ((unsigned __int16)BOBPOSI(12) == 5 && !v52) { + if ((uint16)BOBPOSI(12) == 5 && !v52) { _vm->_soundManager.PLAY_WAV(1); v52 = 1; } _vm->_eventsManager.VBL(); - } while ((unsigned __int16)BOBPOSI(12) != 34); + } while ((uint16)BOBPOSI(12) != 34); _vm->_animationManager.BOBANIM_OFF(2); _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = 1; @@ -5507,7 +5507,7 @@ LABEL_1141: v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; - v76 = -(signed __int16)(100 * (67 - (signed __int16)(100 - v54)) / 67); + v76 = -(100 * (67 - (100 - v54)) / 67); v53->field4 = v76; _vm->_globals.SAUVEGARDE->data[svField357] = 1; _vm->_globals.SAUVEGARDE->data[svField354] = 0; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 1e76458fa5..283108664a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -510,7 +510,7 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { size_t v4; unsigned int v5; byte *palette; - signed int v8; + int v8; v2 = 0; v8 = 0; @@ -608,7 +608,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { char v11; char v13; char v14; - signed int v15; + int v15; byte *ptr; int v17; int v18; @@ -739,7 +739,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { void TalkManager::CHERCHE_ANIM0(int a1, int a2) { size_t v2; - signed int v3; + int v3; size_t v4; unsigned int v5; unsigned int v6; @@ -843,22 +843,22 @@ bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int bool result; const byte *v5; int v6; - signed int v7; + int v7; byte *v8; byte *v9; - __int16 v10; - __int16 v11; - __int16 v12; + int v10; + int v11; + int v12; char v13; - __int16 v14; - __int16 v15; - __int16 v16; + int v14; + int v15; + int v16; char v17; int v18; - signed int v19; + int v19; int v20; int v22; - __int16 v23; + int v23; const byte *v24; v22 = 0; -- cgit v1.2.3 From b34091852c2f2994ac82aeb0e0ace8550508eaaa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 21:33:00 +1000 Subject: HOPKINS: Fix casting errors identified by gcc --- engines/hopkins/events.cpp | 4 ++-- engines/hopkins/font.cpp | 2 +- engines/hopkins/graphics.cpp | 48 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 9 ++++----- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 1dda365518..b1c70ff02b 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -191,8 +191,8 @@ void EventsManager::checkForNextFrameCounter() { } } -void EventsManager::delay(int delay) { - uint32 delayEnd = g_system->getMillis() + delay; +void EventsManager::delay(int totalMilli) { + uint32 delayEnd = g_system->getMillis() + totalMilli; while (!g_system->getEventManager()->shouldQuit() && g_system->getMillis() < delayEnd) { g_system->delayMillis(10); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index c44f0cdca9..fb938bfbf6 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -231,7 +231,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, oldname = fname; nom_indexoldname = fname; - //*(int *)((char *)&dword_80AE4DC + strlen(nom_index) + 1) = dword_807C98D; + // *(int *)((char *)&dword_80AE4DC + strlen(nom_index) + 1) = dword_807C98D; Common::File f; if (!f.open(nom_index)) error("error opening file - %s", nom_index.c_str()); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0fb3fedcad..896a393f35 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -521,8 +521,8 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i v11 = (byte *)(v8 + 4 * (width >> 2)); v13 = width - 4 * (width >> 2); memcpy(v11, v12, v13); - v8 = ((byte *)v11 + v13 + WinScan - width); - v7 = ((byte *)v12 + v13 + nbrligne2 - width); + v8 = v11 + v13 + WinScan - width; + v7 = v12 + v13 + nbrligne2 - width; v9 = v10 - 1; } while (v10 != 1); } @@ -535,28 +535,28 @@ void GraphicsManager::m_scroll2(const byte *surface, int xs, int ys, int width, int v11; assert(VideoPtr); - v7 = (const byte *)(xs + nbrligne2 * ys + surface); - v8 = (byte *)(destX + WinScan * destY + (byte *)VideoPtr->pixels); + v7 = xs + nbrligne2 * ys + surface; + v8 = destX + WinScan * destY + (byte *)VideoPtr->pixels; v9 = WinScan - SCREEN_WIDTH; v10 = nbrligne2 - SCREEN_WIDTH; v11 = height; do { memcpy(v8, v7, SCREEN_WIDTH); - v8 = (byte *)v8 + v9 + SCREEN_WIDTH; - v7 = (const byte *)v7 + v10 + SCREEN_WIDTH; + v8 = v8 + v9 + SCREEN_WIDTH; + v7 = v7 + v10 + SCREEN_WIDTH; --v11; } while (v11); } void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { const byte *v7; - const byte *v8; + byte *v8; int v9; int v10; byte v11; const byte *v12; - const byte *v13; + byte *v13; assert(VideoPtr); v7 = xs + nbrligne2 * ys + surface; @@ -572,12 +572,12 @@ void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, v10 = width; Agr_x = 0; do { - v11 = *(byte *)v7; - *(byte *)v8++ = *(byte *)v7++; + v11 = *v7; + *v8++ = *v7++; Agr_x += SDL_ECHELLE; if ((unsigned int)Agr_x >= 100) { Agr_x -= 100; - *(byte *)v8++ = v11; + *v8++ = v11; } --v10; } while ( v10 ); @@ -864,10 +864,10 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac v4 = 0; do { v5 = v4; - v3 = *(byte *)(v4 + palette); + v3 = *(v4 + palette); v3 <<= 8; v15[v5] = v3; - palData[v5] = *(byte *)(v4++ + palette); + palData[v5] = *(v4++ + palette); } while (v4 < PALETTE_BLOCK_SIZE); setpal_vga256(palData); @@ -885,7 +885,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac v7 = 0; do { v8 = v7; - v9 = v15[v7] - ((unsigned int)*(byte *)(v7 + palette) << 8) / (int)v13; + v9 = v15[v7] - (*(v7 + palette) << 8) / v13; v15[v8] = v9; palData[v8] = (v9 >> 8) & 0xff; ++v7; @@ -1076,14 +1076,14 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSur v5 = sourceSurface; for (;;) { v6 = *v5; - if (*(byte *)v5 < 222) + if (*v5 < 222) goto Video_Cont3_wVbe; if (v6 == 252) return; if (v6 < 251) { - v3 += (byte)(*(byte *)v5 + 35); + v3 += *v5 + 35; v6 = *(v5++ + 1); } else if (v6 == 253) { v3 += *(v5 + 1); @@ -1154,7 +1154,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { if (v5 == 252) return; if (v5 < 251) { - v2 += (byte)(*v4 + 35); + v2 += *v4 + 35; v5 = *(v4++ + 1); } else if (v5 == -3) { v2 += *(v4 + 1); @@ -1370,7 +1370,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, while ((byteVal = *srcP) != 253) { ++srcP; - int width = READ_LE_UINT16(srcP); + width = READ_LE_UINT16(srcP); srcP += 2; if (byteVal == 254) { @@ -1398,7 +1398,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, while ((byteVal = *srcP) != 253) { ++srcP; - int width = READ_LE_UINT16(srcP); + width = READ_LE_UINT16(srcP); srcP += 2; if (byteVal == 254) { @@ -1617,14 +1617,14 @@ void GraphicsManager::CopyAsm(const byte *surface) { v5 = 320; do { - srcByte = *(byte *)v1; - *(byte *)v3 = *(byte *)v1; + srcByte = *v1; + *v3 = *v1; v6 = WinScan + v3; - *(byte *)v6 = srcByte; + *v6 = srcByte; v7 = v6 - WinScan + 1; - *(byte *)v7 = srcByte; + *v7 = srcByte; v8 = WinScan + v7; - *(byte *)v8 = srcByte; + *v8 = srcByte; v3 = v8 - WinScan + 1; ++v1; --v5; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 283108664a..23ff2ed3ba 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -647,9 +647,9 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v6 = 0; do { v13 = *v19; - if ((unsigned __int8)(*v19 + 46) > 0x1Bu) { - if ((unsigned __int8)(v13 + 80) > 0x1Bu) { - if ((unsigned __int8)(v13 - 65) <= 0x19u || (unsigned __int8)(v13 - 97) <= 0x19u) + if ((byte)(*v19 + 46) > 0x1Bu) { + if ((byte)(v13 + 80) > 0x1Bu) { + if ((byte)(v13 - 65) <= 0x19u || (byte)(v13 - 97) <= 0x19u) v13 = 32; } else { v13 -= 79; @@ -660,7 +660,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { *v19 = v13; v19 = v19 + 1; ++v6; - } while ( (unsigned int)v6 < 0x800 ); + } while ((unsigned int)v6 < 0x800); v7 = 0; do { @@ -941,5 +941,4 @@ void TalkManager::REPONSE2(int a1, int a2) { warning("TODO: RESPONSE2"); } - } // End of namespace Hopkins -- cgit v1.2.3 From 1f87e4836a3fef4317fe5491ba6b075c8ff9c381 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 21:41:47 +1000 Subject: HOPKINS: Fixed some more castings identified by gcc --- engines/hopkins/graphics.cpp | 6 +++--- engines/hopkins/talk.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 896a393f35..f99b0a1990 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -656,7 +656,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width Agr_x = 0; do { - v12 = *(uint16 *)(v11 + 2 * *(byte *)v7); + v12 = *(uint16 *)(v11 + 2 * *v7); *(uint16 *)v8 = v12; ++v7; v8 += 2; @@ -1156,11 +1156,11 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { if (v5 < 251) { v2 += *v4 + 35; v5 = *(v4++ + 1); - } else if (v5 == -3) { + } else if (v5 == (byte)-3) { v2 += *(v4 + 1); v5 = *(v4 + 2); v4 += 2; - } else if (v5 == -2) { + } else if (v5 == (byte)-2) { v2 += READ_LE_UINT16(v4 + 1); v5 = *(v4 + 3); v4 += 3; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 23ff2ed3ba..07b481f298 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -775,7 +775,7 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v7 = READ_LE_UINT16(&v8[2 * v6 + 4]); if (v7 && _vm->_globals.vitesse != 501) _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager.start_x + READ_LE_UINT16(&v8[2 * v6]), - READ_LE_UINT16(&v8[2 * v6 + 2]), (unsigned __int8)v9[2 * v6 + 8]); + READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); v6 += 5; } while (_vm->_globals.vitesse != 501 && v7); } -- cgit v1.2.3 From 7eb6fffdbd6315ad68f424a99c643d8966fcef12 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 22:18:50 +1000 Subject: HOPKINS: Converted many numeric values to character constants --- engines/hopkins/graphics.cpp | 14 ++++------ engines/hopkins/objects.cpp | 65 ++++++++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f99b0a1990..3ee0d2c115 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2308,17 +2308,15 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { v2 = 1; v3 = 0; v9 = 0; - // TODO: Set extension as text - v13 = file + ".XXX"; // + #105#110#105; + v13 = file + ".ini"; ptr = FileManager::RECHERCHE_CAT(v13, 1); if (PTRNUL == ptr) { FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (!a2) { - // 5ODO: Set extension as text - v13 = file + ".XXX"; //#115#112#114; + v13 = file + ".spr"; if (PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); if (!_vm->_globals.NOSPRECRAN) { @@ -2334,8 +2332,8 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { _vm->_globals.CAT_FLAG = 0; } } - if (*ptr != 73 || *(ptr + 1) != 78 || *(ptr + 2) != 73) { - error("Erreur, fichier non INI"); + if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { + error("Error, file not ini"); } else { v11 = 0; do { @@ -2345,7 +2343,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { if (v6 == 3) v2 = _vm->_objectsManager.Control_If(ptr, v2); if (v2 == -1) - error("fonction IFF d‚fectueuse"); + error("Error, defective IFF"); if (v6 == 1 || v6 == 4) ++v2; if (!v6 || v6 == 5) @@ -2357,7 +2355,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { if (PTRNUL != _vm->_globals.COUCOU) _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); - v13 = file + ".XXX"; // #114#101#112 + v13 = file + ".rep"; byte *dataP = FileManager::RECHERCHE_CAT(v13, 2); _vm->_globals.COUCOU = dataP; if (PTRNUL == dataP) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c75074f571..d009c7cf66 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1600,8 +1600,8 @@ void ObjectsManager::SPRITE_ON(int idx) { } void ObjectsManager::SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9) { - if (idx > 5 ) - (8, (int)"Tentative d'affichage d'un sprite > MAX_SPRITE."); + if (idx > 5) + error("Tentative d'affichage d'un sprite > MAX_SPRITE."); Sprite[idx].spriteData = spriteData; Sprite[idx].field8 = a2; Sprite[idx].fieldA = a3; @@ -1811,7 +1811,7 @@ LABEL_54: BTDROITE(); } } - if (_vm->_globals.PLAN_FLAG == 1 && v4 == -1 || !v4) { + if ((_vm->_globals.PLAN_FLAG == 1 && v4 == -1) || !v4) { verbe = 0; _vm->_eventsManager.btsouris = 0; _vm->_eventsManager.CHANGE_MOUSE(0); @@ -2164,7 +2164,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || (uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u) { + if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) @@ -2528,7 +2528,7 @@ void ObjectsManager::CHANGE_TETE(int a1, int a2) { v3->field1 = YSPR(0); v3->field2 = 64; v3->field3 = _vm->_globals.ECRAN; - v3->field4 = Sprite[12].field0; // TODO: Double-check this + v3->field4 = Sprite[0].field0; SPRITE_OFF(1); SPRITE(_vm->_globals.TETE, v3->field0, v3->field1, 1, 3, v3->field4, 0, 20, 127); SPRITE_ON(1); @@ -2556,7 +2556,7 @@ LABEL_9: v5->field1 = YSPR(0); v5->field2 = 64; v5->field3 = _vm->_globals.ECRAN; - v5->field4 = Sprite[12].field0; + v5->field4 = Sprite[0].fieldC; SPRITE_OFF(1); SPRITE(_vm->_globals.TETE, v5->field0, v5->field1, 1, 2, v5->field4, 0, 34, 190); SPRITE_ON(1); @@ -2576,7 +2576,7 @@ LABEL_9: v7->field1 = YSPR(0); v7->field2 = 64; v7->field3 = _vm->_globals.ECRAN; - v7->field4 = Sprite[12].field0; + v7->field4 = Sprite[0].fieldC; } if (a1 == 1) { v8 = &_vm->_globals.SAUVEGARDE->field360; @@ -2584,7 +2584,7 @@ LABEL_9: v8->field1 = YSPR(0); v8->field2 = 64; v8->field3 = _vm->_globals.ECRAN; - v8->field4 = Sprite[12].field0; + v8->field4 = Sprite[0].fieldC; } if (a1 == 2) { v9 = &_vm->_globals.SAUVEGARDE->field380; @@ -2592,7 +2592,7 @@ LABEL_9: v9->field1 = YSPR(0); v9->field2 = 64; v9->field3 = _vm->_globals.ECRAN; - v9->field4 = Sprite[12].field0; + v9->field4 = Sprite[0].fieldC; } if (!a2) { _vm->_globals.SAUVEGARDE->data[svField121] = 0; @@ -3547,10 +3547,10 @@ int ObjectsManager::Traduction(byte *a1) { v1 = 0; v70 = 0; - if (*a1 != 70 || *(a1 + 1) != 67) + if (*a1 != 'F' || *(a1 + 1) != 'C') return 0; // TODO: Change to chars - if (*(a1 + 2) == 84 && *(a1 + 3) == 88 && *(a1 + 4) == 84) { + if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { v70 = *(a1 + 6); v2 = *(a1 + 7); v69 = *(a1 + 8); @@ -3671,7 +3671,7 @@ LABEL_98: } LABEL_104: // TODO - if (*(a1 + 2) == 66 && *(a1 + 3) == 79 && *(a1 + 4) == 66) { + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { if (DESACTIVE != 1) { v72 = *(a1 + 5); v70 = *(a1 + 6); @@ -3701,8 +3701,8 @@ LABEL_1141: } v1 = 1; } - if (*(a1 + 2) == 83) { - if (*(a1 + 3) == 84 && *(a1 + 4) == 80) { + if (*(a1 + 2) == 'S') { + if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { if (DESACTIVE != 1) { DEUXPERSO = 0; v5 = *(a1 + 5); @@ -3773,7 +3773,7 @@ LABEL_1141: v1 = 1; _vm->_objectsManager.CH_TETE = 0; } - if (*(a1 + 2) == 83 && *(a1 + 3) == 84 && *(a1 + 4) == 69) { + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { if (DESACTIVE != 1) { v7 = *(a1 + 5); v70 = *(a1 + 6); @@ -3791,12 +3791,12 @@ LABEL_1141: v1 = 1; } } - if (*(a1 + 2) == 66 && *(a1 + 3) == 79 && *(a1 + 4) == 70) { + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { if (DESACTIVE != 1) VBOB_OFF(READ_LE_UINT16(a1 + 5)); v1 = 1; } - if (*(a1 + 2) == 80 && *(a1 + 3) == 69 && *(a1 + 4) == 82) { + if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { v73 = READ_LE_UINT16(a1 + 5); if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { v70 = 0; @@ -3979,9 +3979,9 @@ LABEL_1141: } v1 = 1; } - if (*(a1 + 2) == 77 && *(a1 + 3) == 85 && *(a1 + 4) == 83) + if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') v1 = 1; - if (*(a1 + 2) == 87 && *(a1 + 3) == 65 && *(a1 + 4) == 73) { + if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; @@ -3994,39 +3994,39 @@ LABEL_1141: } v1 = 1; } - if (*(a1 + 2) == 79) { - if (*(a1 + 3) == 66 && *(a1 + 4) == 80) { + if (*(a1 + 2) == 'O') { + if (*(a1 + 3) == 'B' && *(a1 + 4) == 'P') { v1 = 1; AJOUTE_OBJET(READ_LE_UINT16(a1 + 5)); } - if (*(a1 + 2) == 79 && *(a1 + 3) == 66 && *(a1 + 4) == 77) { + if (*(a1 + 2) == 'O' && *(a1 + 3) == 'B' && *(a1 + 4) == 'M') { v1 = 1; DELETE_OBJET(READ_LE_UINT16(a1 + 5)); } } - if (*(a1 + 2) == 71 && *(a1 + 3) == 79 && *(a1 + 4) == 84) + if (*(a1 + 2) == 'G' && *(a1 + 3) == 'O' && *(a1 + 4) == 'T') v1 = 2; - if (*(a1 + 2) == 90) { - if (*(a1 + 3) == 79 && *(a1 + 4) == 78) { + if (*(a1 + 2) == 'Z') { + if (*(a1 + 3) == 'O' && *(a1 + 4) == 'N') { ZONE_ON(READ_LE_UINT16(a1 + 5)); v1 = 1; } - if (*(a1 + 2) == 90 && *(a1 + 3) == 79 && *(a1 + 4) == 70) { + if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { ZONE_OFF(READ_LE_UINT16(a1 + 5)); v1 = 1; } } - if (*(a1 + 2) == 69 && *(a1 + 3) == 88 && *(a1 + 4) == 73) + if (*(a1 + 2) == 'E' && *(a1 + 3) == 'X' && *(a1 + 4) == 'I') v1 = 5; - if (*(a1 + 2) == 83 && *(a1 + 3) == 79 && *(a1 + 4) == 82) { + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'R') { _vm->_globals.SORTIE = READ_LE_UINT16(a1 + 5); v1 = 5; } - if (*(a1 + 2) == 66 && *(a1 + 3) == 67 && *(a1 + 4) == 65) { + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'C' && *(a1 + 4) == 'A') { _vm->_globals.CACHE_OFF(READ_LE_UINT16(a1 + 5)); v1 = 1; } - if (*(a1 + 2) == 65 && *(a1 + 3) == 78 && *(a1 + 4) == 73) { + if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { v75 = READ_LE_UINT16(a1 + 5); if (v75 <= 100) _vm->_animationManager.BOBANIM_ON(v75); @@ -4034,7 +4034,7 @@ LABEL_1141: _vm->_animationManager.BOBANIM_OFF(v75 - 100); v1 = 1; } - if (*(a1 + 2) == 83 && *(a1 + 3) == 80 && *(a1 + 4) == 69) { + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { v76 = READ_LE_UINT16(a1 + 5); if (v76 == 7) _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); @@ -5521,8 +5521,7 @@ LABEL_1141: if (v76 == 245) { _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); OPTI_ONE(5, 0, 6, 0); - // TODO: is 98 correct? - _vm->_globals.ZONEP[98].field0 = 276; + _vm->_globals.ZONEP[4].field0 = 276; VERBE_ON(4, 19); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals.SAUVEGARDE->data[svField399] = 1; -- cgit v1.2.3 From c306fe01a6a0bb018caa5d5b2f7ba636c974dbee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 22:41:10 +1000 Subject: HOPKINS: Fixed compilation errors with previously commented out methods --- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 6 ++-- engines/hopkins/graphics.h | 2 +- engines/hopkins/objects.cpp | 75 +++++++++++++++++++++++--------------------- engines/hopkins/objects.h | 1 + 5 files changed, 45 insertions(+), 41 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 9bdece2a18..9f580dc2f7 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -334,7 +334,7 @@ public: int BOBZONE[105]; bool BOBZONE_FLAG[105]; int STAILLE[500]; - int super_parcours[32002]; + int16 super_parcours[32002]; int Param[2100]; byte *Winventaire; byte *texte_tmp; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3ee0d2c115..b4810d3af2 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2402,10 +2402,10 @@ void GraphicsManager::NB_SCREEN() { *(v0 + 2) = *(v1 + 2); DD_VBL(); } -/* -int GraphicsManager::colision2_ligne(int a1, int a2, int a3, int a4, int a5, int a6) { + +int GraphicsManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { warning("TODO: colision2_ligne"); return 0; } -*/ + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 7910e8f500..4c76a7f15e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -177,7 +177,7 @@ public: void INI_ECRAN2(const Common::String &file); void OPTI_INI(const Common::String &file, int a2); void NB_SCREEN(); - int colision2_ligne(int a1, int a2, int a3, int a4, int a5, int a6); + int colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d009c7cf66..e905f57748 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2618,9 +2618,9 @@ LABEL_9: } } +// TODO: method casting int arrays as byte pointers. Double-check later whether +// we can convert the return to a uint16 * byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { - return NULL; //_vm->_globals.STOP_BUG == 0 ? NULL : NULL; - /* int v4; int v5; int v6; @@ -2734,8 +2734,8 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v115; int v116; int v117; - int v118; - int v119; + int v118 = 0; + int v119 = 0; int v120; int v121; int v122; @@ -2743,25 +2743,25 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v124; int v125; int v126; - int v127; - int v128; - int v129; - int v130; + int v127 = 0; + int v128 = 0; + int v129 = 0; + int v130 = 0; int v131; int v132; int v133; int v134; int v135; int v136; - int v137; - int v138; - int v139; - int v140; + int v137 = 0; + int v138 = 0; + int v139 = 0; + int v140 = 0; int v141; - int v142; - int v143; - int v144; - int v145; + int v142 = 0; + int v143 = 0; + int v144 = 0; + int v145 = 0; v123 = a3; v122 = a4; @@ -2849,7 +2849,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v16 = 5; do { v101 = v16; - v17 = _vm->_graphicsManager.colision2_ligne(v123, v15, (int)&v139, (int)&v144, 0, _vm->_objectsManager.DERLIGNE); + v17 = _vm->_graphicsManager.colision2_ligne(v123, v15, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); v16 = v101; if (v17 == 1 && *(&v141 + v101) <= _vm->_objectsManager.DERLIGNE) break; @@ -2866,7 +2866,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v20 = 1; do { v102 = v20; - v21 = _vm->_graphicsManager.colision2_ligne(v123, v19, (int)&v137, (int)&v142, 0, _vm->_objectsManager.DERLIGNE); + v21 = _vm->_graphicsManager.colision2_ligne(v123, v19, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); v20 = v102; if (v21 == 1 && *(&v141 + v102) <= _vm->_objectsManager.DERLIGNE) break; @@ -2887,7 +2887,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v24 = 3; do { v103 = v24; - v25 = _vm->_graphicsManager.colision2_ligne(v23, v122, (int)&v138, (int)&v143, 0, _vm->_objectsManager.DERLIGNE); + v25 = _vm->_graphicsManager.colision2_ligne(v23, v122, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); v24 = v103; if (v25 == 1 && *(&v141 + v103) <= _vm->_objectsManager.DERLIGNE) break; @@ -2982,7 +2982,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v36 = 5; do { v105 = v36; - v37 = _vm->_graphicsManager.colision2_ligne(a1, v35, (int)&v139, (int)&v144, 0, _vm->_objectsManager.DERLIGNE); + v37 = _vm->_graphicsManager.colision2_ligne(a1, v35, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); v36 = v105; if (v37 == 1 && *(&v141 + v105) <= _vm->_objectsManager.DERLIGNE) break; @@ -2999,7 +2999,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v40 = 1; do { v106 = v40; - v41 = _vm->_graphicsManager.colision2_ligne(a1, v39, (int)&v137, (int)&v142, 0, _vm->_objectsManager.DERLIGNE); + v41 = _vm->_graphicsManager.colision2_ligne(a1, v39, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); v40 = v106; if (v41 == 1 && *(&v141 + v106) <= _vm->_objectsManager.DERLIGNE) break; @@ -3020,7 +3020,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v44 = 3; do { v107 = v44; - v45 = _vm->_graphicsManager.colision2_ligne(v43, a2, (int)&v138, (int)&v143, 0, _vm->_objectsManager.DERLIGNE); + v45 = _vm->_graphicsManager.colision2_ligne(v43, a2, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); v44 = v107; if (v45 == 1 && *(&v141 + v107) <= _vm->_objectsManager.DERLIGNE) break; @@ -3041,7 +3041,7 @@ byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { v48 = 7; do { v108 = v48; - v49 = _vm->_graphicsManager.colision2_ligne(v47, a2, (int)&v140, (int)&v145, 0, _vm->_objectsManager.DERLIGNE); + v49 = _vm->_graphicsManager.colision2_ligne(v47, a2, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); v48 = v108; if (v49 == 1 && *(&v141 + v108) <= _vm->_objectsManager.DERLIGNE) break; @@ -3126,7 +3126,7 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, a2 - v56, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, _vm->_globals.super_parcours, 4); @@ -3150,7 +3150,7 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, v60 + a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, _vm->_globals.super_parcours, 4); @@ -3174,7 +3174,7 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(a1 - v63, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, _vm->_globals.super_parcours, 4); @@ -3198,7 +3198,7 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(v66 + a1, a2, (int)&v125, (int)&v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if ((uint16)_vm->_graphicsManager.colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, _vm->_globals.super_parcours, 4); @@ -3255,7 +3255,7 @@ LABEL_234: if (v72 == v77) { v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); if (v78 == 1) - return &_vm->_globals.super_parcours[0]; + return (byte *)&_vm->_globals.super_parcours[0]; if (v78 == 2) goto LABEL_200; if (MIRACLE(v119, v118, v110, v121, v112) == 1) @@ -3267,7 +3267,7 @@ LABEL_234: } v79 = PARC_PERS(v119, v118, v123, v122, v116, v121, v112); if (v79 == 1) - return &_vm->_globals.super_parcours[0]; + return (byte *)&_vm->_globals.super_parcours[0]; if (v79 == 2) { LABEL_200: v115 = NV_LIGNEDEP; @@ -3324,7 +3324,7 @@ LABEL_200: if (v83 == v87) { v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); if (v88 == 1) - return &_vm->_globals.super_parcours[0]; + return (byte *)&_vm->_globals.super_parcours[0]; if (v88 == 2) goto LABEL_200; if (MIRACLE(v119, v118, v117, v121, v112) == 1) @@ -3336,7 +3336,7 @@ LABEL_200: } v89 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); if (v89 == 1) - return &_vm->_globals.super_parcours[0]; + return (byte *)&_vm->_globals.super_parcours[0]; if (v89 == 2) goto LABEL_200; if (MIRACLE(v119, v118, v117, v121, v112) == 1) @@ -3395,11 +3395,10 @@ LABEL_282: _vm->_globals.super_parcours[v57 + 2] = -1; _vm->_globals.super_parcours[v57 + 3] = -1; } - return &_vm->_globals.super_parcours[0]; + return (byte *)&_vm->_globals.super_parcours[0]; } } - return &_vm->_globals.super_parcours[0]; - */ + return (byte *)&_vm->_globals.super_parcours[0]; } void ObjectsManager::VERIFTAILLE() { @@ -5761,7 +5760,7 @@ void ObjectsManager::VERBE_OFF(int a1, int a2) { void ObjectsManager::VERBE_ON(int a1, int a2) { warning("TODO: VERBE_ON"); } -/* + int ObjectsManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { warning("TODO: PARC_PERS"); return 0; @@ -5771,6 +5770,10 @@ int ObjectsManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { warning("TODO: MIRACLE"); return 0; } -*/ + +int ObjectsManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { + warning("TODO: GENIAL"); + return 0; +} } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index a6a4324f2b..3513c6e9c1 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -244,6 +244,7 @@ public: void VERBE_ON(int a1, int a2); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int MIRACLE(int a1, int a2, int a3, int a4, int a5); + int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); }; } // End of namespace Hopkins -- cgit v1.2.3 From c0f658847c558334dce323c43532763bae7dc5c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Sep 2012 23:28:21 +1000 Subject: HOPKINS: Implemented several stubbed ObjectsManager methods --- engines/hopkins/objects.cpp | 525 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 2 + 2 files changed, 523 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e905f57748..692c652d5a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3402,16 +3402,500 @@ LABEL_282: } void ObjectsManager::VERIFTAILLE() { - warning("TODO: VERIFTAILLE"); + int v0; + int v1; + int v2; + + v0 = _vm->_globals.STAILLE[YSPR(0)]; + if (_vm->_globals.PERSO_TYPE == 1) { + v1 = v0; + if (v0 < 0) + v1 = -v0; + v0 = 20 * (5 * v1 - 100) / -80; + } + if (_vm->_globals.PERSO_TYPE == 2) { + v2 = v0; + if (v0 < 0) + v2 = -v0; + v0 = 20 * (5 * v2 - 165) / -67; + } + SETTAILLESPR(0, v0); } void ObjectsManager::PACOURS_PROPRE(byte *a1) { - warning("TODO: PACOURS_PROPRE"); + int v1; + int v2; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + + v1 = 0; + v13 = 0; + v14 = -1; + v2 = READ_LE_UINT16(a1 + 2); + v15 = READ_LE_UINT16(a1 + 4); + if ((int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { + while (1) { + if (v14 != -1 && v15 != v14) { + v11 = v1; + v12 = 0; + v10 = CALC_PROPRE(v2); + v4 = READ_LE_UINT16(a1 + 2 * v1); + v9 = READ_LE_UINT16(a1 + 2 * v1); + v5 = READ_LE_UINT16(a1 + 2 * v1 + 2); + v6 = 0; + while (v4 != -1 || v5 != -1) { + int idx = v1; + v1 += 4; + ++v12; + if (READ_LE_UINT16(a1 + 2 * idx + 4) != v15) + v6 = 1; + if (v6 == 1) + break; + v4 = READ_LE_UINT16(a1 + 2 * v1); + v9 = READ_LE_UINT16(a1 + 2 * v1); + v5 = READ_LE_UINT16(a1 + 2 * v1 + 2); + } + if (v12 < v10) { + v7 = v11; + v8 = 0; + if (v12 > 0) { + do { + WRITE_LE_UINT16(a1 + 2 * v7 + 4, v14); + v7 += 4; + ++v8; + } while (v12 > v8); + } + v15 = v14; + } + v1 = v11; + if (v9 == -1 && v5 == -1) + v13 = 1; + } + v1 += 4; + if (v13 == 1) + break; + v14 = v15; + v2 = READ_LE_UINT16(a1 + 2 * v1 + 2); + v15 = READ_LE_UINT16(a1 + 2 * v1 + 4); + if (READ_LE_UINT16(a1 + 2 * v1) == -1) { + if (v2 == -1) + break; + } + } + } } byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { - warning("TODO: PARC_VOITURE"); - return NULL; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + byte *result; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + byte *v33; + int v34; + int v35; + int i; + byte *v37; + int v38; + int v39; + int v40; + byte *v41; + int v42; + int v43; + int k; + byte *v45; + int v46; + int v47; + int v48; + int v49; + byte *v50; + int v51; + int v52; + int v53; + byte *v54; + int v55; + int v56; + int v57; + byte *v58; + int v59; + int v60; + int v61; + int v62; + int v63; + int v64; + int v65; + int v66; + int v67; + int v68; + int v69; + int j; + int l; + int v72; + int v73; + int v74; + int v75; + int v76[10]; + int v77; + int v78; + int v79; + int v80; + int v81; + int v82; + int v83 = 0; + int v84 = 0; + int v85 = 0; + int v86 = 0; + int v87; + int v88 = 0; + int v89 = 0; + int v90 = 0; + int v91 = 0; + + v4 = a3; + v5 = a4; + v67 = 0; + if (a3 <= 14) + v4 = 15; + if (a4 <= 14) + v5 = 15; + if (v4 > _vm->_graphicsManager.max_x - 10) + v4 = _vm->_graphicsManager.max_x - 10; + if (v5 > 445) + v5 = 440; + v75 = v4; + v74 = v5; + v6 = 0; + v7 = v74; + if (_vm->_graphicsManager.max_y > v74) { + v8 = 5; + do { + v62 = v8; + v9 = _vm->_graphicsManager.colision2_ligne(v75, v7, &v85, &v90, 0, _vm->_objectsManager.DERLIGNE); + v8 = v62; + if (v9 == 1 && *(&v87 + v62) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v82 + v62) = 0; + *(&v87 + v62) = -1; + ++v6; + ++v7; + } while (_vm->_graphicsManager.max_y > v7); + } + v80 = v6; + v10 = 0; + v11 = v74; + if (_vm->_graphicsManager.min_y < v74) { + v12 = 1; + do { + v63 = v12; + v13 = _vm->_graphicsManager.colision2_ligne(v75, v11, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v12 = v63; + if (v13 == 1 && *(&v87 + v63) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v82 + v63) = 0; + *(&v87 + v63) = -1; + if (v80 < v10) { + if (v90 != -1) + break; + } + ++v10; + --v11; + } while (_vm->_graphicsManager.min_y < v11); + } + v78 = v10; + v14 = 0; + v15 = v75; + if (_vm->_graphicsManager.max_x > v75) { + v16 = 3; + do { + v64 = v16; + v17 = _vm->_graphicsManager.colision2_ligne(v15, v74, &v84, &v89, 0, _vm->_objectsManager.DERLIGNE); + v16 = v64; + if (v17 == 1 && *(&v87 + v64) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v82 + v64) = 0; + *(&v87 + v64) = -1; + ++v14; + if (v78 < v14) { + if (v88 != -1) + break; + } + if (v80 < v14 && v90 != -1) + break; + ++v15; + } while (_vm->_graphicsManager.max_x > v15); + } + v79 = v14; + v18 = 0; + v19 = v75; + if (_vm->_graphicsManager.min_x < v75) { + v20 = 7; + do { + v65 = v20; + v21 = _vm->_graphicsManager.colision2_ligne(v19, v74, &v86, &v91, 0, _vm->_objectsManager.DERLIGNE); + v20 = v65; + if (v21 == 1 && *(&v87 + v65) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v82 + v65) = 0; + *(&v87 + v65) = -1; + ++v18; + if (v78 < v18) { + if (v88 != -1) + break; + } + if (v80 < v18 && v90 != -1) + break; + if (v79 < v18 && v89 != -1) + break; + --v19; + } while (_vm->_graphicsManager.min_x < v19); + } + v81 = v18; + if (v88 == -1) + v78 = 1300; + if (v89 == -1) + v79 = 1300; + if (v90 == -1) + v80 = 1300; + if (v91 == -1) + v81 = 1300; + if (v88 != -1 || v89 != -1 || v90 != -1 || v91 != -1) { + v23 = 0; + if (v90 != -1 && v78 >= v80 && v79 >= v80 && v81 >= v80) { + v73 = v90; + v72 = v85; + v23 = 1; + } + if (v88 != -1 && !v23 && v80 >= v78 && v79 >= v78 && v81 >= v78) { + v73 = v88; + v72 = v83; + v23 = 1; + } + if (v89 != -1 && !v23 && v78 >= v79 && v80 >= v79 && v81 >= v79) { + v73 = v89; + v72 = v84; + v23 = 1; + } + if (v91 != -1 && !v23 && v80 >= v81 && v79 >= v81 && v78 >= v81) { + v73 = v91; + v72 = v86; + } + v24 = 0; + do { + v25 = v24; + *(&v87 + v25) = -1; + *(&v82 + v25) = 0; + *(&v77 + v25) = 1300; + v76[v25] = 1300; + ++v24; + } while (v24 <= 8); + v26 = _vm->_graphicsManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + if (v26 == 1) { + v69 = v88; + v68 = v83; + } + if (!v26) { + if (_vm->_graphicsManager.colision2_ligne(a1, a2, &v83, &v88, 0, TOTAL_LIGNES) == 1) { + v27 = 0; + while (1) { + v28 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27); + v29 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 2); + v66 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 4); + v27 = v27 + 4; + v30 = v27; + v31 = _vm->_graphicsManager.colision2_ligne(v28, v29, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v27 = v30; + if (v31) + break; + v32 = v67; + _vm->_globals.super_parcours[v32] = v28; + _vm->_globals.super_parcours[v32 + 1] = v29; + _vm->_globals.super_parcours[v32 + 2] = v66; + _vm->_globals.super_parcours[v32 + 3] = 0; + v33 = _vm->_globals.essai0; + WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v32, v28); + WRITE_LE_UINT16(v33 + 2 * v32 + 2, v29); + WRITE_LE_UINT16(v33 + 2 * v32 + 4, v66); + WRITE_LE_UINT16(v33 + 2 * v32 + 6, 0); + v67 += 4; + if (v28 == -1) + goto LABEL_90; + } + v69 = v88; + v68 = v83; + } else { + v69 = 1; + v68 = 1; + v67 = 0; + } + } +LABEL_90: + if (v69 < v73) { + v34 = v68; + v35 = v68; + for (i = _vm->_globals.Ligne[v69].field0; v35 < (i - 2); i = _vm->_globals.Ligne[v69].field0) { + v37 = _vm->_globals.Ligne[v69].fieldC; + v38 = READ_LE_UINT16(v37 + 4 * v35); + int v37_2 = READ_LE_UINT16(v37 + 4 * v35 + 2); + v39 = v67; + _vm->_globals.super_parcours[v39] = v38; + _vm->_globals.super_parcours[v39 + 1] = v37_2; + _vm->_globals.super_parcours[v39 + 2] = _vm->_globals.Ligne[v69].field6; + _vm->_globals.super_parcours[v39 + 3] = 0; + v67 += 4; + ++v34; + v35 = v34; + } + for (j = v69 + 1; j < v73; ++j) { + if (PLAN_TEST( + READ_LE_UINT16(_vm->_globals.Ligne[j].fieldC), + READ_LE_UINT16(_vm->_globals.Ligne[j].fieldC + 2), + v67, + j, + v73, + 0) == 1) { +LABEL_88: + v69 = NV_LIGNEDEP; + v68 = NV_LIGNEOFS; + v67 = NV_POSI; + goto LABEL_90; + } + v40 = 0; + if (_vm->_globals.Ligne[j].field0 - 2 > 0) { + do { + v41 = _vm->_globals.Ligne[j].fieldC; + v42 = READ_LE_UINT16(v41 + 4 * v40); + int v41_2 = READ_LE_UINT16(v41 + 4 * v40 + 2); + v43 = v67; + _vm->_globals.super_parcours[v43] = v42; + _vm->_globals.super_parcours[v43 + 1] = v41_2; + _vm->_globals.super_parcours[v43 + 2] = _vm->_globals.Ligne[j].field6; + _vm->_globals.super_parcours[v43 + 3] = 0; + v67 += 4; + ++v40; + } while (v40 < _vm->_globals.Ligne[j].field0 - 2); + } + } + v68 = 0; + v69 = v73; + } + if (v69 > v73) { + for (k = v68; k > 0; --k) { + v45 = _vm->_globals.Ligne[v69].fieldC; + v46 = READ_LE_UINT16(v45 + 4 * k); + int v45_2 = READ_LE_UINT16(v45 + 4 * k + 2); + v47 = v67; + _vm->_globals.super_parcours[v47] = v46; + _vm->_globals.super_parcours[v47 + 1] = v45_2; + _vm->_globals.super_parcours[v47 + 2] = _vm->_globals.Ligne[v69].field8; + _vm->_globals.super_parcours[v47 + 3] = 0; + v67 += 4; + } + for (l = v69 - 1; l > v73; --l) { + v48 = l; + if (PLAN_TEST( + READ_LE_UINT32(_vm->_globals.Ligne[l].fieldC) + 4 * _vm->_globals.Ligne[v48].field0 - 4, + READ_LE_UINT32(_vm->_globals.Ligne[l].fieldC) + 4 * _vm->_globals.Ligne[v48].field0 - 2, + v67, + l, + v73, + 0) == 1) + goto LABEL_88; + v49 = _vm->_globals.Ligne[v48].field0 - 2; + if ((_vm->_globals.Ligne[v48].field0 - 2) > 0) { + do { + v50 = _vm->_globals.Ligne[l].fieldC; + v51 = READ_LE_UINT16(v50 + 4 * v49); + int v50_2 = READ_LE_UINT16(v50 + 4 * v49 + 2); + v52 = v67; + _vm->_globals.super_parcours[v52] = v51; + _vm->_globals.super_parcours[v52 + 1] = v50_2; + _vm->_globals.super_parcours[v52 + 2] = _vm->_globals.Ligne[l].field8; + _vm->_globals.super_parcours[v52 + 3] = 0; + v67 += 4; + --v49; + } while (v49 > 0); + } + } + v68 = _vm->_globals.Ligne[v73].field0 - 1; + v69 = v73; + } + if (v69 == v73) { + if (v68 <= v72) { + if (v68 < v72) { + v57 = v68; + do { + v58 = _vm->_globals.Ligne[v73].fieldC; + v59 = READ_LE_UINT16(v58 + 4 * v57); + int v58_2 = READ_LE_UINT16(v58 + 4 * v57 + 2); + v60 = v67; + _vm->_globals.super_parcours[v60] = v59; + _vm->_globals.super_parcours[v60 + 1] = v58_2; + _vm->_globals.super_parcours[v60 + 2] = _vm->_globals.Ligne[v73].field6; + _vm->_globals.super_parcours[v60 + 3] = 0; + v67 += 4; + ++v57; + } while (v72 > v57); + } + } else { + v53 = v68; + do { + v54 = _vm->_globals.Ligne[v73].fieldC; + v55 = READ_LE_UINT16(v54 + 4 * v53); + int v54_2 = READ_LE_UINT16(v54 + 4 * v53 + 2); + v56 = v67; + _vm->_globals.super_parcours[2 * v56] = v55; + _vm->_globals.super_parcours[2 * v56 + 1] = v54_2; + _vm->_globals.super_parcours[2 * v56 + 2] = _vm->_globals.Ligne[v73].field8; + _vm->_globals.super_parcours[2 * v56 + 3] = 0; + v67 += 4; + --v53; + } while (v72 < v53); + } + } + v61 = v67; + _vm->_globals.super_parcours[v61] = -1; + _vm->_globals.super_parcours[v61 + 1] = -1; + _vm->_globals.super_parcours[v61 + 2] = -1; + _vm->_globals.super_parcours[v61 + 3] = -1; + result = (byte *)&_vm->_globals.super_parcours[0]; + } else { + result = PTRNUL; + } + return result; } void ObjectsManager::VERBEPLUS() { @@ -5776,4 +6260,37 @@ int ObjectsManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a return 0; } +int ObjectsManager::CALC_PROPRE(int idx) { + signed int v1; + int v2; + int v3; + int v4; + + v1 = 25; + v2 = _vm->_globals.STAILLE[idx]; + if (_vm->_globals.PERSO_TYPE == 1) { + v3 = _vm->_globals.STAILLE[idx]; + if (v2 < 0) + v3 = -v2; + v2 = 20 * (5 * v3 - 100) / -80; + } + if (_vm->_globals.PERSO_TYPE == 2) { + v4 = v2; + if (v2 < 0) + v4 = -v2; + v2 = 20 * (5 * v4 - 165) / -67; + } + if (v2 < 0) + return _vm->_graphicsManager.Reel_Reduc(0x19u, -v2); + if (v2 > 0) + return _vm->_graphicsManager.Reel_Zoom(0x19u, v2); + + return v1; +} + +int ObjectsManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { + warning("TODO: PLAN_TEST"); + return 0; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 3513c6e9c1..073f5d2d55 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -245,6 +245,8 @@ public: int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); + int CALC_PROPRE(int idx); + int PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); }; } // End of namespace Hopkins -- cgit v1.2.3 From 0cd848b9a5e69746740b4afc6fe26065cf3a95b7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 1 Oct 2012 23:02:45 +1000 Subject: HOPKINS: Manually implemented colision method --- engines/hopkins/globals.h | 21 ++- engines/hopkins/objects.cpp | 407 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 3 +- 3 files changed, 420 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 9f580dc2f7..057ce09da8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -42,6 +42,7 @@ struct ZonePItem { int fieldD; int fieldE; int fieldF; + int field10; int field12; int field16; }; @@ -64,6 +65,13 @@ struct LigneZoneItem { struct CarreZoneItem { int field0; + int field2; + int field4; + int field6; + int field8; + int fieldA; + int fieldC; + int fieldE; }; struct BqeAnimItem { @@ -194,6 +202,12 @@ struct CacheItem { int field14; }; +struct SegmentItem { + int field0; + int field2; + int field4; +}; + struct Sauvegarde1 { int field0; int field1; @@ -319,8 +333,8 @@ public: byte *CACHE_BANQUE[6]; ZonePItem ZONEP[106]; LigneItem Ligne[400]; - LigneZoneItem LigneZone[400]; - CarreZoneItem CarreZone[100]; + LigneZoneItem LigneZone[401]; + CarreZoneItem CarreZone[101]; BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; BobItem Bob[36]; @@ -331,6 +345,7 @@ public: ObjetWItem ObjetW[300]; BlocItem BLOC[250]; CacheItem Cache[25]; + SegmentItem Segment[101]; int BOBZONE[105]; bool BOBZONE_FLAG[105]; int STAILLE[500]; @@ -416,8 +431,10 @@ public: int Compteur; int ACTION_SENS; int STOP_BUG; + int SegmentEnCours; int force_to_data_0; + int oldzone_46; int old_x1_65; int old_y1_66; int old_x2_67; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 692c652d5a..5309df0a89 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3781,7 +3781,7 @@ LABEL_90: } for (j = v69 + 1; j < v73; ++j) { if (PLAN_TEST( - READ_LE_UINT16(_vm->_globals.Ligne[j].fieldC), + _vm->_globals.Ligne[j].fieldC, READ_LE_UINT16(_vm->_globals.Ligne[j].fieldC + 2), v67, j, @@ -3827,8 +3827,8 @@ LABEL_88: for (l = v69 - 1; l > v73; --l) { v48 = l; if (PLAN_TEST( - READ_LE_UINT32(_vm->_globals.Ligne[l].fieldC) + 4 * _vm->_globals.Ligne[v48].field0 - 4, - READ_LE_UINT32(_vm->_globals.Ligne[l].fieldC) + 4 * _vm->_globals.Ligne[v48].field0 - 2, + _vm->_globals.Ligne[l].fieldC + 4 * _vm->_globals.Ligne[v48].field0 - 4, + READ_LE_UINT16(_vm->_globals.Ligne[l].fieldC + 4 * _vm->_globals.Ligne[v48].field0 - 2), v67, l, v73, @@ -3899,16 +3899,350 @@ LABEL_88: } void ObjectsManager::VERBEPLUS() { - warning("TODO: VERBEPLUS"); + int v; + + v = _vm->_eventsManager.btsouris + 1; + _vm->_eventsManager.btsouris = v; + if (v == 4) + goto LABEL_24; + if (v == 5) + goto LABEL_28; + if (v == 6) + goto LABEL_29; + if (v == 7) + goto LABEL_31; + if (v == 8) + goto LABEL_33; + if (v == 9) + goto LABEL_35; + if (v == 10) + goto LABEL_37; + if (v == 11) + goto LABEL_39; + if (v == 12) + goto LABEL_41; + if (v == 13) + goto LABEL_43; + if (v == 14) + goto LABEL_45; + if (v == 15) + goto LABEL_47; + if (v == 16) + goto LABEL_49; + if (v == 17) + goto LABEL_51; + if (v == 18) + goto LABEL_53; + if (v == 19) + goto LABEL_55; + if (v == 20) + goto LABEL_57; + if (v == 21) + goto LABEL_59; + if (v == 22) + goto LABEL_61; + if (v == 23) + goto LABEL_63; + if (v == 24) + goto LABEL_65; + if (v == 25) + goto LABEL_67; + do { + do { + _vm->_eventsManager.btsouris = 4; +LABEL_24: + if (_vm->_globals.NOMARCHE != 1 || (v = _vm->_objectsManager.NUMZONE + 1, (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u)) { + if (_vm->_eventsManager.btsouris == 4) + return; + } else { + _vm->_eventsManager.btsouris = 5; + } +LABEL_28: + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 6) { +LABEL_29: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 7) { +LABEL_31: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field7 == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 8) { +LABEL_33: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 9) { +LABEL_35: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 10) { +LABEL_37: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 11) { +LABEL_39: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 12) { +LABEL_41: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 13) { +LABEL_43: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 14) { +LABEL_45: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 15) { +LABEL_47: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 16) { +LABEL_49: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 17) { +LABEL_51: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 18) { +LABEL_53: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 19) { +LABEL_55: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 20) { +LABEL_57: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 21) { +LABEL_59: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 22) { +LABEL_61: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 23) { +LABEL_63: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 2) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 24) { +LABEL_65: + v = 5 * _vm->_objectsManager.NUMZONE; + if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 3) + return; + } + v = _vm->_eventsManager.btsouris + 1; + _vm->_eventsManager.btsouris = v; + } while (v != 25); +LABEL_67: + v = 5 * _vm->_objectsManager.NUMZONE; + } while (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE != 2); } void ObjectsManager::BTDROITE() { - warning("TODO: BTDROITE"); + if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + VERBEPLUS(); + if (_vm->_eventsManager.btsouris != 23) + _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + _vm->_objectsManager.verbe = _vm->_eventsManager.btsouris; + } } int ObjectsManager::MZONE() { - warning("TODO: MZONE"); - return 0; + signed int result; + __int16 v1; + __int16 v2; + int v3; + __int16 v4; + __int16 v5; + int v6; + __int16 v7; + int v8; + int v9; + __int16 i; + __int16 v11; + __int16 j; + __int16 k; + __int16 l; + int v15; + __int16 v16; + __int16 v17; + __int16 v18; + __int16 v19; + __int16 v20; + __int16 v21; + + v19 = 0; + v18 = 0; + v17 = 0; + v16 = 0; + v21 = _vm->_eventsManager.souris_x + _vm->_eventsManager.ofset_souris_x; + v20 = _vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y; + if ((_vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y) > 19) { + v1 = 0; + do { + v2 = _vm->_globals.BOBZONE[v1]; + if (v2) { + if (_vm->_globals.BOBZONE_FLAG[v1] == 1) { + v3 = v2; + v15 = v3; + if (_vm->_globals.Bob[v3].field0) { + if (_vm->_globals.Bob[v3].fieldC != 250) { + if (!_vm->_globals.Bob[v3].field16) { + v4 = _vm->_globals.Bob[v3].field3E; + if (v21 > v4) { + if (v21 < _vm->_globals.Bob[v3].field42 + v4) { + v5 = _vm->_globals.Bob[v3].field40; + if (v20 > v5) { + if (v20 < _vm->_globals.Bob[v3].field44 + v5) { + v6 = v1; + if (_vm->_globals.ZONEP[v1].field4 == -1) { + _vm->_globals.ZONEP[v6].field0 = 0; + _vm->_globals.ZONEP[v1].field2 = 0; + } + if (!_vm->_globals.ZONEP[v6].field0) { + if (!_vm->_globals.ZONEP[v1].field2) { + _vm->_globals.ZONEP[v6].field0 = _vm->_globals.Bob[v15].field42 + _vm->_globals.Bob[v15].field3E; + _vm->_globals.ZONEP[v1].field2 = _vm->_globals.Bob[v15].field44 + _vm->_globals.Bob[v15].field40 + 6; + _vm->_globals.ZONEP[v1].field4 = -1; + } + } + return v1; + } + } + } + } + } + } + } + } + } + ++v1; + } while (v1 <= 48); + _vm->_globals.SegmentEnCours = 0; + v7 = 0; + do { + if (_vm->_globals.ZONEP[v7].field10 == 1) { + v8 = v7; + if (_vm->_globals.CarreZone[v8].field0 == 1) { + if (_vm->_globals.CarreZone[v7].field2 <= v21 + && _vm->_globals.CarreZone[v7].field4 >= v21 + && _vm->_globals.CarreZone[v7].field6 <= v20 + && _vm->_globals.CarreZone[v7].field8 >= v20) { + if (_vm->_globals.CarreZone[v7].fieldE == 1) { + _vm->_globals.oldzone_46 = _vm->_globals.LigneZone[_vm->_globals.CarreZone[v7].fieldA].field2; + return _vm->_globals.oldzone_46; + } + v9 = _vm->_globals.SegmentEnCours; + _vm->_globals.Segment[v9].field2 = _vm->_globals.CarreZone[v7].fieldA; + _vm->_globals.Segment[v9].field4 = _vm->_globals.CarreZone[v7].fieldC; + ++_vm->_globals.SegmentEnCours; + } + } + } + ++v7; + } while (v7 <= 99); + if (!_vm->_globals.SegmentEnCours) + goto LABEL_58; + for (i = v20; i >= 0; --i) { + v11 = colision(v21, i); + v19 = v11; + if (v11 != -1 && _vm->_globals.ZONEP[v11].field10 == 1) + break; + } + if (v19 == -1) + goto LABEL_58; + for (j = v20; _vm->_graphicsManager.max_y > j; ++j) { + v18 = colision(v21, j); + if (v18 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) + break; + } + if (v18 == -1) + goto LABEL_58; + for (k = v21; k >= 0; --k) { + v16 = colision(k, v20); + if (v16 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) + break; + } + if (v16 == -1) + goto LABEL_58; + for (l = v21; _vm->_graphicsManager.max_x > l; ++l) { + v17 = colision(l, v20); + if (v17 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) + break; + } + if (v19 == v18 && v19 == v16 && v19 == v17) { + _vm->_globals.oldzone_46 = v19; + result = v19; + } else { +LABEL_58: + _vm->_globals.oldzone_46 = -1; + result = -1; + } + } else { + result = 0; + } + return result; } void ObjectsManager::CLEAR_ZONE() { @@ -6288,9 +6622,66 @@ int ObjectsManager::CALC_PROPRE(int idx) { return v1; } -int ObjectsManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { +int ObjectsManager::PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6) { warning("TODO: PLAN_TEST"); return 0; } +int ObjectsManager::colision(int a1, int a2) { + if (_vm->_globals.SegmentEnCours <= 0) + return -1; + + int v2 = a1; + int v3 = v2; + int v4 = v2 + 4; + int v5 = v2 - 4; + + for (int idx = 0; idx <= _vm->_globals.SegmentEnCours; ++idx) { + int v8 = _vm->_globals.Segment[idx].field2; + if (v8 < _vm->_globals.Segment[idx].field4) + continue; + + int v6 = a2 + 4; + int v7 = a2 - 4; + int v9 = v3 + 1; + + do { + byte *srcP = _vm->_globals.LigneZone[v8].field4; + if (srcP != PTRNUL) { + bool flag = true; + int v11 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 2); + int dataV2 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 2 + 2); + int v12 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 4 - 4); + int v13 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 4 - 2); + int v10 = v13; + + if (v11 < v12 && v4 >= v11 && v5 > v13) + flag = false; + if (v11 >= v12 && v5 <= v13 && v4 < v13) + flag = false; + if (dataV2 < v10 && v6 >= dataV2 && v7 > v10) + flag = false; + if (dataV2 >= v10 && v7 <= dataV2 && v6 < v10) + flag = false; + + + if (!flag) { + if (v11 < _vm->_globals.LigneZone[v8].field0) { + for (; v11 < _vm->_globals.LigneZone[v8].field0; ++idx) { + int v11 = READ_LE_UINT16(srcP); + int v12 = READ_LE_UINT16(srcP + 2); + srcP += 4; + + if ((v2 == v11 || v9 == v11) && a2 == v12) + return _vm->_globals.LigneZone[v8].field2; + } + } + } + } + } while (++v8 < _vm->_globals.Segment[idx].field0); + } + + return -1; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 073f5d2d55..bb88d08c12 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -246,7 +246,8 @@ public: int MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); int CALC_PROPRE(int idx); - int PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); + int PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6); + int colision(int a1, int a2); }; } // End of namespace Hopkins -- cgit v1.2.3 From 28099ee00d2351a7b86646cc63c90cd953e8032b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 2 Oct 2012 21:44:23 +1000 Subject: HOPKINS: Added new LinesManager class with lots of line methods --- engines/hopkins/globals.cpp | 20 +- engines/hopkins/globals.h | 20 +- engines/hopkins/graphics.cpp | 5 - engines/hopkins/graphics.h | 1 - engines/hopkins/hopkins.h | 2 + engines/hopkins/lines.cpp | 2363 ++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/lines.h | 82 ++ engines/hopkins/module.mk | 1 + engines/hopkins/objects.cpp | 912 ++-------------- engines/hopkins/objects.h | 10 - 10 files changed, 2518 insertions(+), 898 deletions(-) create mode 100644 engines/hopkins/lines.cpp create mode 100644 engines/hopkins/lines.h diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a69a8be359..b7f5b51b5d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -235,16 +235,16 @@ void Globals::clearAll() { chemin = PTRNUL; for (int idx = 0; idx < 400; ++idx) { - Ligne[idx].field0 = 0; - Ligne[idx].field2 = 0; - Ligne[idx].field4 = 0; - Ligne[idx].field6 = 0; - Ligne[idx].field8 = 0; - Ligne[idx].field12 = PTRNUL; - - LigneZone[idx].field0 = 0; - LigneZone[idx].field2 = 0; - LigneZone[idx].field4 = PTRNUL; + _vm->_linesManager.Ligne[idx].field0 = 0; + _vm->_linesManager.Ligne[idx].field2 = 0; + _vm->_linesManager.Ligne[idx].field4 = 0; + _vm->_linesManager.Ligne[idx].field6 = 0; + _vm->_linesManager.Ligne[idx].field8 = 0; + _vm->_linesManager.Ligne[idx].field12 = PTRNUL; + + _vm->_linesManager.LigneZone[idx].field0 = 0; + _vm->_linesManager.LigneZone[idx].field2 = 0; + _vm->_linesManager.LigneZone[idx].field4 = PTRNUL; } for (int idx = 0; idx < 100; ++idx) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 057ce09da8..f2a27e3f88 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -47,22 +47,6 @@ struct ZonePItem { int field16; }; -struct LigneItem { - int field0; - int field2; - int field4; - int field6; - int field8; - byte *fieldC; - byte *field12; -}; - -struct LigneZoneItem { - int field0; - int field2; - byte *field4; -}; - struct CarreZoneItem { int field0; int field2; @@ -332,8 +316,6 @@ public: byte *BUF_ZONE; byte *CACHE_BANQUE[6]; ZonePItem ZONEP[106]; - LigneItem Ligne[400]; - LigneZoneItem LigneZone[401]; CarreZoneItem CarreZone[101]; BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; @@ -432,6 +414,8 @@ public: int ACTION_SENS; int STOP_BUG; int SegmentEnCours; + int NVPX; + int NVPY; int force_to_data_0; int oldzone_46; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b4810d3af2..76782cf4d8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2403,9 +2403,4 @@ void GraphicsManager::NB_SCREEN() { DD_VBL(); } -int GraphicsManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - warning("TODO: colision2_ligne"); - return 0; -} - } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 4c76a7f15e..60c972957c 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -177,7 +177,6 @@ public: void INI_ECRAN2(const Common::String &file); void OPTI_INI(const Common::String &file, int a2); void NB_SCREEN(); - int colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 7930eae32b..9453966ff7 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -36,6 +36,7 @@ #include "hopkins/font.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" +#include "hopkins/lines.h" #include "hopkins/menu.h" #include "hopkins/objects.h" #include "hopkins/sound.h" @@ -101,6 +102,7 @@ public: FontManager _fontManager; Globals _globals; GraphicsManager _graphicsManager; + LinesManager _linesManager; MenuManager _menuManager; ObjectsManager _objectsManager; SoundManager _soundManager; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp new file mode 100644 index 0000000000..f25f068054 --- /dev/null +++ b/engines/hopkins/lines.cpp @@ -0,0 +1,2363 @@ +/* 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/lines.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" + +namespace Hopkins { + +void LinesManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void LinesManager::CLEAR_ZONE() { + for (int idx = 0; idx < 400; ++idx) + RETIRE_LIGNE_ZONE(idx); + + next_ligne = 0; +} + +void LinesManager::RETIRE_LIGNE_ZONE(int idx) { + if (idx > 400) + error("Attempting to add a line obstacle > MAX_LIGNE."); + if (_vm->_linesManager.LigneZone[idx].field4 != PTRNUL) + _vm->_globals.dos_free2(_vm->_linesManager.LigneZone[idx].field4); + + _vm->_linesManager.LigneZone[idx].field4 = PTRNUL; +} + + +void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { + int v7; + int v8; + int v9; + byte *v10; + int v11; + byte *v12; + int v13; + int v14; + byte *v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + + if (a2 != a3 || a3 != a4 || a3 != a5) { + if (idx > 400) + error("Attempting to add a line obstacle > MAX_LIGNE."); + v7 = idx; + if (LigneZone[v7].field4 != PTRNUL) + LigneZone[v7].field4 = _vm->_globals.dos_free2(LigneZone[v7].field4); + v8 = a2 - a4; + if (a2 - a4 < 0) + v8 = -v8; + v19 = v8; + v9 = a3 - a5; + if (a3 - a5 < 0) + v9 = -v9; + v18 = v9; + if (v19 <= (int)v9) + v20 = v9 + 1; + else + v20 = v19 + 1; + v10 = _vm->_globals.dos_malloc2(4 * v20 + 8); + v11 = idx; + LigneZone[v11].field4 = v10; + if (PTRNUL == v10) + error("AJOUTE LIGNE ZONE"); + + v12 = LigneZone[v11].field4; + v23 = 1000 * v19 / v20; + v22 = 1000 * v18 / v20; + if (a4 < a2) + v23 = -v23; + if (a5 < a3) + v22 = -v22; + v13 = 1000 * a2; + v16 = 1000 * a3; + v17 = 1000 * a2 / 1000; + v21 = 1000 * a3 / 1000; + v14 = 0; + if (v20 > 0) { + do { + WRITE_LE_UINT16(v12, v17); + v15 = v12 + 2; + WRITE_LE_UINT16(v15, v21); + v12 = v15 + 2; + v13 += v23; + v16 += v22; + v17 = v13 / 1000; + v21 = v16 / 1000; + ++v14; + } while (v20 > v14); + } + WRITE_LE_UINT16(v12, (uint16)-1); + WRITE_LE_UINT16(v12 + 2, (uint16)-1); + + LigneZone[idx].field0 = v20; + LigneZone[idx].field2 = a6; + } else { + _vm->_globals.BOBZONE_FLAG[idx] = 1; + _vm->_globals.BOBZONE[idx] = a3; + } +} + + +void LinesManager::RESET_OBSTACLE() { + for (int idx =0; idx < 400; ++idx) { + RETIRE_LIGNE(idx); + Ligne[idx].field0 = 0; + Ligne[idx].fieldC = PTRNUL; + } +} + +void LinesManager::RETIRE_LIGNE(int idx) { + if (idx > 400) + error("Attempting to add a line obstacle > MAX_LIGNE."); + if (Ligne[idx].fieldC != PTRNUL) + _vm->_globals.dos_free2(Ligne[idx].fieldC); + Ligne[idx].fieldC = PTRNUL; +} + +void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { + int v7; + int v8; + int v9; + byte *v10; + int v11; + int v12; + int v13; + int v24; + int v25; + int v26; + byte *v27; + int v30; + int v31; + byte *v32; + int v33; + int v34; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + + if (idx > 400) + error("Attempting to add a line obstacle > MAX_LIGNE."); + if (TOTAL_LIGNES < idx) + TOTAL_LIGNES = idx; + + if (Ligne[idx].fieldC != PTRNUL) + _vm->_globals.dos_free2(Ligne[idx].fieldC); + v7 = a3 - a5; + if (a3 - a5 < 0) + v7 = -v7; + v8 = v7 + 1; + v9 = a4 - a6; + if (a4 - a6 < 0) + v9 = -v9; + v34 = v9 + 1; + v33 = v9 + 1; + if (v8 > (int)(v9 + 1)) + v34 = v8; + v10 = _vm->_globals.dos_malloc2(4 * v34 + 8); + Ligne[idx].fieldC = v10; + if (v10 == PTRNUL) + error("AJOUTE LIGNE OBSTACLE"); + v32 = Ligne[idx].fieldC; + v36 = 1000 * v8; + v39 = 1000 * v8 / (v34 - 1); + v37 = 1000 * v33 / (v34 - 1); + if (a5 < a3) + v39 = -v39; + if (a6 < a4) + v37 = -v37; + v11 = (int)v39 / 1000; + v12 = (int)v37 / 1000; + v13 = (int)v37 / 1000; + if (!((int)v39 / 1000)) { + if (v12 == -1) { + Ligne[idx].field6 = 1; + Ligne[idx].field8 = 5; + } + if (v12 == 1) { + Ligne[idx].field6 = 5; + Ligne[idx].field8 = 1; + } + } + if (v11 == 1) { + if (v12 == -1) { + Ligne[idx].field6 = 2; + Ligne[idx].field8 = 6; + } + if (!v13) { + Ligne[idx].field6 = 3; + Ligne[idx].field8 = 7; + } + if (v13 == 1) { + Ligne[idx].field6 = 4; + Ligne[idx].field8 = 8; + } + } + if (v11 == -1) { + if (v13 == 1) { + Ligne[idx].field6 = 6; + Ligne[idx].field8 = 2; + } + if (!v13) { + Ligne[idx].field6 = 7; + Ligne[idx].field8 = 3; + } + if (v13 == -1) { + Ligne[idx].field6 = 8; + Ligne[idx].field8 = 4; + } + } + if (v11 == 1 && (unsigned int)(v37 - 251) <= 0x2EC) { + Ligne[idx].field6 = 4; + Ligne[idx].field8 = 8; + } + if (v11 == -1 && (unsigned int)(v37 - 251) <= 0x2EC) { + Ligne[idx].field6 = 6; + Ligne[idx].field8 = 2; + } + if (v11 == 1 && (unsigned int)(v37 + 999) <= 0x2EC) { + Ligne[idx].field6 = 2; + Ligne[idx].field8 = 6; + } + if (v11 == -1 && v37 <= 249 && v37 > 1000) { + Ligne[idx].field6 = 8; + Ligne[idx].field8 = 4; + } + v40 = v36 / v34; + v38 = 1000 * v33 / v34; + if (a5 < a3) + v40 = -v40; + if (a6 < a4) + v38 = -v38; + v24 = 1000 * a3; + v25 = 1000 * a4; + v31 = 1000 * a3 / 1000; + v30 = 1000 * a4 / 1000; + v35 = v34 - 1; + v26 = 0; + if (v35 > 0) { + do { + WRITE_LE_UINT16(v32, v31); + WRITE_LE_UINT16(v32 + 2, v30); + v32 += 4; + v24 += v40; + v25 += v38; + v31 = v24 / 1000; + v30 = v25 / 1000; + ++v26; + } while (v35 > v26); + } + WRITE_LE_UINT16(v32, a5); + WRITE_LE_UINT16(v32 + 2, a6); + v27 = v32 + 4; + WRITE_LE_UINT16(v27, (uint16)-1); + WRITE_LE_UINT16(v27 + 2, (uint16)-1); + + Ligne[idx].field0 = v35 + 1; + Ligne[idx].field2 = a7; + Ligne[idx].field4 = a2; +} + +int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { + int v6; + byte *v7; + int v8; + int v9; + int v10; + int v11; + int v12; + byte *v13; + int v14; + int result; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + + v24 = a5; + v6 = a5; + if (a5 >= a6 + 1) { +LABEL_29: + result = 0; + } else { + v22 = a1 + 4; + v21 = a1 - 4; + v20 = a2 + 4; + v19 = a2 - 4; + while (1) { + v7 = Ligne[v6].fieldC; + if (v7 != PTRNUL) { + v23 = 1; + v8 = 2 * Ligne[v6].field0; + v9 = READ_LE_UINT16(v7); + v16 = READ_LE_UINT16(v7 + 2); + v10 = READ_LE_UINT16(v7 + 2 * v8 - 4); + v18 = READ_LE_UINT16(v7 + 2 * v8 - 2); + if (READ_LE_UINT16(v7) >= v10) + goto LABEL_32; + if (v22 < v9 || v21 > v10) + v23 = 0; + if (v9 >= v10) { +LABEL_32: + if (v21 > v9 || v22 < v10) + v23 = 0; + } + if (v16 >= v18) + goto LABEL_33; + if (v20 < v16 || v19 > v18) + v23 = 0; + if (v16 >= v18) { +LABEL_33: + if (v19 > v16 || v20 < v18) + v23 = 0; + } + if (v23 == 1) { + v11 = 0; + v17 = Ligne[v24].field0; + if (v17 > 0) + break; + } + } +LABEL_28: + ++v24; + v6 = v24; + if (v24 >= a6 + 1) + goto LABEL_29; + } + while (1) { + v12 = READ_LE_UINT16(v7); + v13 = v7 + 2; + v14 = READ_LE_UINT16(v13); + v7 = v13 + 2; + if (a1 == v12 || a1 + 1 == v12) { + if (a2 == v14 || a2 + 1 == v14) + break; + } + ++v11; + if (v17 <= v11) + goto LABEL_28; + } + *a3 = v11; + *a4 = v24; + result = 1; + } + return result; +} + +int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { + int v6; + byte *v7; + int v8; + int v9; + int v10; + int v11; + int v12; + byte *v13; + int result; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + + v24 = a5; + v6 = a5; + if (a5 >= a6 + 1) { +LABEL_47: + result = 0; + } else { + v22 = a1 + 10; + v21 = a1 - 10; + v20 = a2 + 10; + v19 = a2 - 10; + while (1) { + v7 = Ligne[v6].fieldC; + if (PTRNUL != v7) { + v23 = 1; + v8 = 2 * Ligne[v6].field0; + v9 = READ_LE_UINT16(v7); + v15 = READ_LE_UINT16(v7 + 2); + v10 = READ_LE_UINT16(v7 + 2 * v8 - 4); + v17 = READ_LE_UINT16(v7 + 2 * v8 - 2); + if (READ_LE_UINT16(v7) >= v10) + goto LABEL_50; + if (v22 < v9 || v21 > v10) + v23 = 0; + if (v9 >= v10) { +LABEL_50: + if (v21 > v9 || v22 < v10) + v23 = 0; + } + if (v15 >= v17) + goto LABEL_51; + if (v20 < v15 || v19 > v17) + v23 = 0; + if (v15 >= v17) { +LABEL_51: + if (v19 > v15 || v20 < v17) + v23 = 0; + } + if (v23 == 1) { + v11 = 0; + v18 = Ligne[v24].field0; + if (v18 > 0) + break; + } + } +LABEL_46: + ++v24; + v6 = v24; + if (v24 >= a6 + 1) + goto LABEL_47; + } + while (1) { + v12 = READ_LE_UINT16(v7); + v13 = v7 + 2; + v16 = READ_LE_UINT16(v13); + v7 = v13 + 2; + if (a1 == v12 + || v12 == a1 + 1 + || v12 == a1 + 2 + || v12 == a1 + 3 + || v12 == a1 + 4 + || v12 == a1 + 5 + || v12 == a1 + 6 + || v12 == a1 + 7 + || v12 == a1 + 8 + || v12 == a1 + 9 + || a1 + 10 == v12) { + if (v16 == a2 + || v16 == a2 + 1 + || v16 == a2 + 2 + || v16 == a2 + 3 + || v16 == a2 + 4 + || v16 == a2 + 5 + || v16 == a2 + 6 + || v16 == a2 + 7 + || v16 == a2 + 8 + || v16 == a2 + 9 + || a2 + 10 == v16) + break; + } + ++v11; + if (v18 <= v11) + goto LABEL_46; + } + *a3 = v11; + *a4 = v24; + result = 1; + } + return result; +} + +void LinesManager::INIPARCOURS() { + int v0; + int v1; + int v2; + byte *v3; + int v4; + int v5; + int v6; + byte *v7; + int v8; + int v9; + int v11; + int v12; + int v13; + int v14; + int v15; + + v15 = READ_LE_UINT16(Ligne[0].fieldC); + v14 = READ_LE_UINT16(Ligne[0].fieldC + 2); + + v0 = 1; + v1 = 0; + do { + v2 = Ligne[v0].field0; + v3 = Ligne[v0].fieldC; + v4 = READ_LE_UINT16(v3 + 4 * v2 - 4); + v5 = READ_LE_UINT16(v3 + 4 * v2 - 2); + if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 + || _vm->_graphicsManager.min_y == v5) + v1 = 1; + if (v15 == v4 && v14 == v5) + v1 = 1; + if (v0 == 400) { + v6 = v1; + error("ERROR - LAST LINE NOT FOUND"); + v1 = v6; + } + v7 = Ligne[v0 + 1].fieldC; + if (READ_LE_UINT16(v7) != v4 && READ_LE_UINT16(v7 + 2) != v5) + v1 = 1; + if (!v1) + ++v0; + } while (v1 != 1); + + _vm->_objectsManager.DERLIGNE = v0; + v8 = 1; + v13 = _vm->_globals.Max_Ligne_Long; + v9 = _vm->_objectsManager.DERLIGNE + 1; + do { + v11 = v8; + if (Ligne[v11].field0 < v13) { + if (v8 != v9) { + v12 = v8 - 1; + Ligne[v11].field6 = Ligne[v12].field6; + Ligne[v11].field8 = Ligne[v12].field8; + } + } + ++v8; + } while (v8 != 400); +} + +int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7) { + int v7; + int v8; + int i; + byte *v10; + int v11; + int v12; + int v13; + byte *v14; + int v15; + int v16; + int j; + byte *v18; + int v19; + int v20; + int k; + byte *v22; + int v23; + int v24; + int v25; + byte *v26; + int v27; + int v28; + int v29; + byte *v30; + int v31; + int v32; + int v34; + int v35; + int v36; + int v50; + + v36 = a1; + v7 = a2; + v8 = a3; + if (a1 < a4) { + for (i = a2; Ligne[a1].field0 > i; ++i) { + v10 = Ligne[a1].fieldC; + v11 = READ_LE_UINT16(v10 + 4 * i); + v50 = READ_LE_UINT16(v10 + 4 * i + 2); + v12 = v8; + WRITE_LE_UINT16(a6 + 2 * v12, v11); + WRITE_LE_UINT16(a6 + 2 * v12 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v12 + 4, Ligne[a1].field6); + v8 += a7; + } + v34 = a1 + 1; + if ((int)(a1 + 1) < a4) { + do { + v13 = 0; + if (Ligne[v34].field0 > 0) { + do { + v14 = Ligne[v34].fieldC; + v15 = READ_LE_UINT16(v14 + 4 * v13); + v50 = READ_LE_UINT16(v14 + 4 * v13 + 2); + v16 = v8; + WRITE_LE_UINT16(a6 + 2 * v16, v15); + WRITE_LE_UINT16(a6 + 2 * v16 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v16 + 4, Ligne[v34].field6); + v8 += a7; + ++v13; + } while (Ligne[v34].field0 > v13); + } + ++v34; + } while (v34 < a4); + } + v7 = 0; + v36 = a4; + } + if (v36 > a4) { + for (j = v7; j > 0; --j) { + v18 = Ligne[v36].fieldC; + v19 = READ_LE_UINT16(v18 + 4 * j); + v50 = READ_LE_UINT16(v18 + 4 * j + 2); + v20 = v8; + WRITE_LE_UINT16(a6 + 2 * v20, v19); + WRITE_LE_UINT16(a6 + 2 * v20 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v20 + 4, Ligne[v36].field8); + v8 += a7; + } + v35 = v36 - 1; + if ((int)(v36 - 1) > a4) { + do { + for (k = Ligne[v35].field0 - 1; k > 0; --k) { + v22 = Ligne[v35].fieldC; + v23 = READ_LE_UINT16(v22 + 4 * k); + v50 = READ_LE_UINT16(v22 + 4 * k + 2); + v24 = v8; + WRITE_LE_UINT16(a6 + 2 * v24, v23); + WRITE_LE_UINT16(a6 + 2 * v24 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v24 + 4, Ligne[v35].field8); + v8 += a7; + } + --v35; + } while (v35 > a4); + } + v7 = Ligne[a4].field0 - 1; + v36 = a4; + } + if (v36 == a4) { + if (a5 >= v7) { + if (a5 > v7) { + v29 = v7; + do { + v30 = Ligne[a4].fieldC; + v31 = READ_LE_UINT16(v30 + 4 * v29); + v50 = READ_LE_UINT16(v30 + 4 * v29 + 2); + v32 = v8; + WRITE_LE_UINT16(a6 + 2 * v32, v31); + WRITE_LE_UINT16(a6 + 2 * v32 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v32 + 4, Ligne[a4].field6); + v8 += a7; + ++v29; + } while (a5 > v29); + } + } else { + v25 = v7; + do { + v26 = Ligne[a4].fieldC; + v27 = READ_LE_UINT16(v26 + 4 * v25); + v50 = READ_LE_UINT16(v26 + 4 * v25 + 2); + v28 = v8; + WRITE_LE_UINT16(a6 + 2 * v28, v27); + WRITE_LE_UINT16(a6 + 2 * v28 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v28 + 4, Ligne[a4].field8); + v8 += a7; + --v25; + } while (a5 < v25); + } + } + return v8; +} + +int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7, int a8, int a9) { + int v9; + int v10; + int i; + byte *v12; + int v13; + int v14; + int v15; + int v16; + byte *v17; + int v18; + int v19; + int j; + byte *v21; + int v22; + int v23; + int v24; + int k; + byte *v26; + int v27; + int v28; + int v29; + byte *v30; + int v31; + int v32; + int v33; + byte *v34; + int v35; + int v36; + int v38; + int v39; + int v40; + int v50; + + v9 = a1; + v10 = a2; + v40 = a3; + if (a4 < a1) { + for (i = a2; Ligne[a1].field0 > i; ++i) { + v12 = Ligne[a1].fieldC; + v13 = READ_LE_UINT16(v12 + 4 * i); + v50 = READ_LE_UINT16(v12 + 4 * i + 2); + v14 = v40; + WRITE_LE_UINT16(a6 + 2 * v14, v13); + WRITE_LE_UINT16(a6 + 2 * v14 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v14 + 4, Ligne[a1].field6); + v40 += a7; + } + v15 = a1 + 1; + if ((int)(a1 + 1) == a9 + 1) + v15 = a8; + while (a4 != v15) { + v16 = 0; + if (Ligne[v15].field0 > 0) { + do { + v17 = Ligne[v15].fieldC; + v18 = READ_LE_UINT16(v17 + 4 * v16); + v50 = READ_LE_UINT16(v17 + 4 * v16 + 2); + v19 = v40; + WRITE_LE_UINT16(a6 + 2 * v19, v18); + WRITE_LE_UINT16(a6 + 2 * v19 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v19 + 4, Ligne[v15].field6); + v40 += a7; + ++v16; + } while (Ligne[v15].field0 > v16); + } + ++v15; + if (a9 + 1 == v15) + v15 = a8; + } + v10 = 0; + v9 = a4; + } + if (a4 > v9) { + for (j = v10; j > 0; --j) { + v21 = Ligne[v9].fieldC;; + v22 = READ_LE_UINT16(v21 + 4 * j); + v50 = READ_LE_UINT16(v21 + 4 * j + 2); + v23 = v40; + WRITE_LE_UINT16(a6 + 2 * v23, v22); + WRITE_LE_UINT16(a6 + 2 * v23 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v23 + 4, Ligne[v9].field8); + v40 += a7; + } + v24 = v9 - 1; + if (v24 == a8 - 1) + v24 = a9; + while (a4 != v24) { + for (k = Ligne[v24].field0 - 1; k > 0; --k) { + v26 = Ligne[v24].fieldC; + v27 = READ_LE_UINT16(v26 + 4 * k); + v50 = READ_LE_UINT16(v26 + 4 * k + 2); + v28 = v40; + WRITE_LE_UINT16(a6 + 2 * v28, v27); + WRITE_LE_UINT16(a6 + 2 * v28 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v28 + 4, Ligne[v24].field8); + v40 += a7; + } + --v24; + if (a8 - 1 == v24) + v24 = a9; + } + v10 = Ligne[a4].field0 - 1; + v9 = a4; + } + if (a4 == v9) { + if (a5 >= v10) { + if (a5 > v10) { + v33 = v10; + v39 = a4; + do { + v34 = Ligne[v39].fieldC; + v35 = READ_LE_UINT16(v34 + 4 * v33); + v50 = READ_LE_UINT16(v34 + 4 * v33 + 2); + v36 = v40; + WRITE_LE_UINT16(a6 + 2 * v36, v35); + WRITE_LE_UINT16(a6 + 2 * v36 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v36 + 4, Ligne[v39].field6); + v40 += a7; + ++v33; + } while (a5 > v33); + } + } else { + v29 = v10; + v38 = a4; + do { + v30 = Ligne[v38].fieldC; + v31 = READ_LE_UINT16(v30 + 4 * v29); + v50 = READ_LE_UINT16(v30 + 4 * v29 + 2); + v32 = v40; + WRITE_LE_UINT16(a6 + 2 * v32, v31); + WRITE_LE_UINT16(a6 + 2 * v32 + 2, v50); + WRITE_LE_UINT16(a6 + 2 * v32 + 4, Ligne[v38].field8); + v40 += a7; + --v29; + } while (a5 < v29); + } + } + return v40; +} + +int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int i; + int v12; + int v13; + int j; + int v15; + int v16; + int k; + int v18; + int v19; + int l; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49; + int v50; + int v51; + + v5 = a1; + v6 = a2; + v50 = a3; + v7 = a5; + if (colision2_ligne(a1, a2, &v51, &v50, 0, TOTAL_LIGNES) == 1) { + v8 = Ligne[v50].field4; + if (v8 == 1) + v6 = a2 - 2; + if (v8 == 2) { + v6 -= 2; + v5 = a1 + 2; + } + if (v8 == 3) + v5 += 2; + if (v8 == 4) { + v6 += 2; + v5 += 2; + } + if (v8 == 5) + v6 += 2; + if (v8 == 6) { + v6 += 2; + v5 -= 2; + } + if (v8 == 7) + v5 -= 2; + if (v8 == 8) { + v6 -= 2; + v5 -= 2; + } + } + v41 = v5; + v40 = v6; + v9 = 0; + v10 = v40; + for (i = v40; v40 + 200 > v10; i = v10) { + if (colision2_ligne(v41, i, &v49, &v48, 0, _vm->_objectsManager.DERLIGNE) == 1 && v48 <= _vm->_objectsManager.DERLIGNE) + break; + v49 = 0; + v48 = -1; + ++v9; + ++v10; + } + v37 = v9; + v12 = 0; + v13 = v40; + for (j = v40; v40 - 200 < v13; j = v13) { + if (colision2_ligne(v41, j, &v47, &v46, 0, _vm->_objectsManager.DERLIGNE) == 1 && v46 <= _vm->_objectsManager.DERLIGNE) + break; + v47 = 0; + v46 = -1; + ++v12; + --v13; + } + v39 = v12; + v15 = 0; + v16 = v41; + for (k = v41; v41 + 200 > v16; k = v16) { + if (colision2_ligne(k, v40, &v45, &v44, 0, _vm->_objectsManager.DERLIGNE) == 1 && v44 <= _vm->_objectsManager.DERLIGNE) + break; + v45 = 0; + v44 = -1; + ++v15; + ++v16; + } + v38 = v15; + v18 = 0; + v19 = v41; + for (l = v41; v41 - 200 < v19; l = v19) { + if (colision2_ligne(l, v40, &v43, &v42, 0, _vm->_objectsManager.DERLIGNE) == 1 && v42 <= _vm->_objectsManager.DERLIGNE) + break; + v43 = 0; + v42 = -1; + ++v18; + --v19; + } + if (a4 > v50) { + if (v46 != -1 && v46 <= v50) + v46 = -1; + if (v44 != -1 && v50 >= v44) + v44 = -1; + if (v48 != -1 && v50 >= v48) + v48 = -1; + if (v42 != -1 && v50 >= v42) + v42 = -1; + if (v46 != -1 && a4 < v46) + v46 = -1; + if (v44 != -1 && a4 < v44) + v44 = -1; + if (v48 != -1 && a4 < v48) + v48 = -1; + if (v42 != -1 && a4 < v42) + v42 = -1; + } + if (a4 < v50) { + if (v46 != -1 && v46 >= v50) + v46 = -1; + if (v44 != -1 && v50 <= v44) + v44 = -1; + if (v48 != -1 && v50 <= v48) + v48 = -1; + if (v42 != -1 && v50 <= v42) + v42 = -1; + if (v46 != -1 && a4 > v46) + v46 = -1; + if (v44 != -1 && a4 > v44) + v44 = -1; + if (v48 != -1 && a4 > v48) + v48 = -1; + if (v42 != -1 && a4 > v42) + v42 = -1; + } + if (v46 != -1 || v44 != -1 || v48 != -1 || v42 != -1) { + v21 = 0; + if (a4 > v50) { + if (v48 <= v46 && v44 <= v46 && v42 <= v46 && v46 > v50) + v21 = 1; + if (v48 <= v44 && v46 <= v44 && v42 <= v44 && v50 < v44) + v21 = 3; + if (v46 <= v48 && v44 <= v48 && v42 <= v48 && v50 < v48) + v21 = 5; + if (v48 <= v42 && v44 <= v42 && v46 <= v42 && v50 < v42) + v21 = 7; + } + if (a4 < v50) { + if (v46 == -1) + v46 = 1300; + if (v44 == -1) + v44 = 1300; + if (v48 == -1) + v48 = 1300; + if (v42 == -1) + v42 = 1300; + if (v46 != 1300 && v48 >= v46 && v44 >= v46 && v42 >= v46 && v46 < v50) + v21 = 1; + if (v44 != 1300 && v48 >= v44 && v46 >= v44 && v42 >= v44 && v50 > v44) + v21 = 3; + if (v48 != 1300 && v46 >= v48 && v44 >= v48 && v42 >= v48 && v50 > v48) + v21 = 5; + if (v42 != 1300 && v48 >= v42 && v44 >= v42 && v46 >= v42 && v50 > v42) + v21 = 7; + } + if (v21) { + if (v21 == 1) { + v36 = v46; + v35 = v47; + } + if (v21 == 3) { + v36 = v44; + v35 = v45; + } + if (v21 == 5) { + v36 = v48; + v35 = v49; + } + if (v21 == 7) { + v36 = v42; + v35 = v43; + } + if (v21 == 1) { + v22 = 0; + if (v39 > 0) { + do { + if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v23 == -1) + return 0; + v7 = v23; + if (_vm->_globals.NVPY != -1) + v22 = _vm->_globals.NVPY - v40; + } + v24 = v7; + _vm->_globals.super_parcours[v24] = v41; + _vm->_globals.super_parcours[v24 + 1] = v40 - v22; + _vm->_globals.super_parcours[v24 + 2] = 1; + _vm->_globals.super_parcours[v24 + 3] = 0; + v7 += 4; + ++v22; + } while (v39 > v22); + } +LABEL_186: + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return 1; + } + if (v21 == 5) { + v25 = 0; + if (v37 > 0) { + do { + if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v26 == -1) + return 0; + v7 = v26; + if (_vm->_globals.NVPY != -1) + v25 = v40 - _vm->_globals.NVPY; + } + v27 = v7; + _vm->_globals.super_parcours[v27] = v41; + _vm->_globals.super_parcours[v27 + 1] = v25 + v40; + _vm->_globals.super_parcours[v27 + 2] = 5; + _vm->_globals.super_parcours[v27 + 3] = 0; + v7 += 4; + ++v25; + } while (v37 > v25); + } + goto LABEL_186; + } + if (v21 == 7) { + v28 = 0; + if (v18 > 0) { + do { + if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v29 == -1) + return 0; + v7 = v29; + if (_vm->_globals.NVPX != -1) + v28 = v41 - _vm->_globals.NVPX; + } + v30 = v7; + _vm->_globals.super_parcours[v30] = v41 - v28; + _vm->_globals.super_parcours[v30 + 1] = v40; + _vm->_globals.super_parcours[v30 + 2] = 7; + _vm->_globals.super_parcours[v30 + 3] = 0; + v7 += 4; + ++v28; + } while (v18 > v28); + } + goto LABEL_186; + } + if (v21 == 3) { + v31 = 0; + if (v38 > 0) { + do { + if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v32 == -1) + return 0; + v7 = v32; + if (_vm->_globals.NVPX != -1) + v31 = _vm->_globals.NVPX - v41; + } + v33 = v7; + _vm->_globals.super_parcours[v33] = v31 + v41; + _vm->_globals.super_parcours[v33 + 1] = v40; + _vm->_globals.super_parcours[v33 + 2] = 3; + _vm->_globals.super_parcours[v33 + 3] = 0; + v7 += 4; + ++v31; + } while (v38 > v31); + } + goto LABEL_186; + } + } + } + return 0; +} + +int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, byte *a8, int a9) { + int v9; + byte *v10; + int v11; + byte *v12; + byte *v13; + int v14; + int v15; + byte *v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + byte *v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35 = 0; + int v36 = 0; + int v37; + int v38; + int v40; + int v41; + int v42 = 0; + int v43 = 0; + int v44 = 0; + int v45 = 0; + int v46 = 0; + int v47 = 0; + int v48 = 0; + int v49 = 0; + int v50; + void *v51; + int v52; + int v53; + int v54; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; + int v63; + int v64; + int v65; + int v66 = 0; + int v67; + int v68 = 0; + int v69; + int v70 = 0; + int v71; + int v72 = 0; + int v73; + int v74; + int v75; + int v76; + int v77 = 0; + int v78 = 0; + int v79 = 0; + int v80; + int v81; + int v82; + int v83; + int v84; + int v85; + int v86; + int v87; + int v88; + int v89; + int i; + int v91; + int v92; + int v93; + int v94; + int v95; + int v96; + int v97; + int v98; + int v99; + int v100; + int v101; + + v99 = a7; + v80 = -1; + ++_vm->_globals.STOP_BUG; + if (_vm->_globals.STOP_BUG > 10) { + v9 = a7; +LABEL_112: + WRITE_LE_UINT16(a8 + 2 * v9, (uint16)-1); + WRITE_LE_UINT16(a8 + 2 * v9 + 2, (uint16)-1); + WRITE_LE_UINT16(a8 + 2 * v9 + 4, (uint16)-1); + return -1; + } + v10 = Ligne[a1].fieldC; + v98 = READ_LE_UINT16(v10); + v97 = READ_LE_UINT16(v10 + 2); + v92 = a1; + + while (1) { + v86 = v92 - 1; + v11 = 2 * Ligne[v92 - 1].field0; + v12 = Ligne[v92 - 1].fieldC; + if (v12 == PTRNUL) + break; + while (READ_LE_UINT16(v12 + 2 * v11 - 4) != v98 || v97 != READ_LE_UINT16(v12 + 2 * v11 - 2)) { + --v86; + if (_vm->_objectsManager.DERLIGNE - 1 != v86) { + v11 = 2 * Ligne[v86].field0; + v12 = Ligne[v86].fieldC; + if (v12 != PTRNUL) + continue; + } + goto LABEL_11; + } + v92 = v86; + v98 = READ_LE_UINT16(v12); + v97 = READ_LE_UINT16(v12 + 2); + } +LABEL_11: + v13 = Ligne[a1].fieldC; + v14 = 2 * Ligne[a1].field0; + v95 = READ_LE_UINT16(v13 + 2 * v14 - 4); + v93 = READ_LE_UINT16(v13 + 2 * v14 - 2); + v91 = a1; + while (1) { + v87 = v91 + 1; + v15 = 2 * Ligne[v91 + 1].field0; + v16 = Ligne[v91 + 1].fieldC; + if (PTRNUL == v16) + break; + while (1) { + v65 = v15; + v17 = READ_LE_UINT16(v16 + 2 * v15 - 4); + if (READ_LE_UINT16(v16) == v95) { + if (v93 == READ_LE_UINT16(v16 + 2)) + break; + } + ++v87; + if (v87 != TOTAL_LIGNES + 1) { + v15 = 2 * Ligne[v87].field0; + v16 = Ligne[v87].fieldC; + if (v16 != PTRNUL) + continue; + } + goto LABEL_17; + } + v91 = v87; + v95 = v17; + v93 = READ_LE_UINT16(v16 + 2 * v65 - 2); + } +LABEL_17: + v18 = a3 - a5; + if (a3 - a5 < 0) + v18 = -v18; + v58 = v18 + 1; + v19 = a4 - a6; + if (a4 - a6 < 0) + v19 = -v19; + v85 = v19 + 1; + v20 = v19 + 1; + if (v58 > v20) + v85 = v18 + 1; + v84 = 1000 * v58 / v85; + v83 = 1000 * v20 / v85; + v21 = 1000 * a3; + v22 = 1000 * a4; + v82 = v21 / 1000; + v81 = v22 / 1000; + if (a5 < a3) + v84 = -v84; + if (a6 < a4) + v83 = -v83; + if (v85 > 800) + v85 = 800; + memset(_vm->_globals.BufLig, 0, 0x7D0u); + v23 = 0; + v88 = 0; + if (v85 + 1 > 0) { + v51 = _vm->_globals.BufLig; + do { + v24 = v23; + *((uint16 *)v51 + v24) = v82; + *((uint16 *)v51 + v24 + 1) = v81; + v21 += v84; + v22 += v83; + v82 = v21 / 1000; + v81 = v22 / 1000; + v23 += 2; + ++v88; + } while (v88 < v85 + 1); + } + v25 = v23 - 2; + v26 = 0; + v89 = v85 + 1; + if ((int)(v85 + 1) > 0) { + do { + v96 = READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25); + v94 = READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25 + 1); + if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { + v80 = v100; + v77 = v101; + v78 = v96; + v79 = v94; + v26 = 1; + } + if (v26 == 1) + break; + v25 -= 2; + --v89; + } while (v89 > 0); + } + for (i = v92; i < v91 + 1; ++i) { + v27 = 2 * Ligne[i].field0; + v28 = Ligne[i].fieldC; + if (PTRNUL == v28) + error("erreur dans da routine genial"); + v29 = *(uint16 *)v28; + v30 = READ_LE_UINT16(v28 + 2); + v59 = READ_LE_UINT16(v28 + 2); + v31 = v27; + v32 = READ_LE_UINT16(v28 + 2 * v27 - 4); + v33 = READ_LE_UINT16(v28 + 2 * v31 - 2); + if (i == v92) { + v72 = v33; + if (v30 <= v33) + v72 = v30; + v70 = v33; + if (v59 >= v33) + v70 = v59; + v68 = v32; + if (v29 <= v32) + v68 = v29; + v66 = v32; + if (v29 >= v32) + v66 = v29; + } else { + if (v59 < v33 && v59 < v72) + v72 = v59; + if (v33 < v59 && v33 < v72) + v72 = v33; + if (v59 > v33 && v59 > v70) + v70 = v59; + if (v33 > v59 && v33 > v70) + v70 = v33; + if (v29 < v32 && v68 > v29) + v68 = v29; + if (v32 < v29 && v68 > v32) + v68 = v32; + if (v29 > v32 && v66 < v29) + v66 = v29; + if (v32 > v29 && v66 < v32) + v66 = v32; + } + } + v69 = v68 - 2; + v73 = v72 - 2; + v67 = v66 + 2; + v71 = v70 + 2; + if (a5 >= v69 && a5 <= v67 && a6 >= v73 && a6 <= v71) { + v34 = a6; + v76 = -1; + do { + --v34; + v60 = colision2_ligne(a5, v34, &v101, &v100, v92, v91); + if (v60 == 1) + v76 = v100; + if (!v34 || v73 > v34) + v60 = 1; + } while (v60 != 1); + v35 = a6; + v75 = -1; + do { + ++v35; + v61 = colision2_ligne(a5, v35, &v101, &v100, v92, v91); + if (v61 == 1) + v75 = v100; + if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) + v61 = 1; + } while (v61 != 1); + v36 = a5; + v74 = -1; + do { + ++v36; + v62 = colision2_ligne(v36, a6, &v101, &v100, v92, v91); + if (v62 == 1) + v74 = v100; + if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) + v62 = 1; + } while (v62 != 1); + v37 = a5; + v38 = -1; + do { + --v37; + v63 = colision2_ligne(v37, a6, &v101, &v100, v92, v91); + if (v63 == 1) + v38 = v100; + if (v37 <= 0 || v69 >= v37) + v63 = 1; + } while (v63 != 1); + if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) { + v9 = a7; + goto LABEL_112; + } + } + if (v78 < a3 - 1 || v78 > a3 + 1 || v79 < a4 - 1 || v79 > a4 + 1) { + _vm->_globals.NVPX = v78; + _vm->_globals.NVPY = v79; + if (a1 < v80) { + v40 = v80 - a1; + if (v80 - a1 < 0) + v40 = -v40; + v41 = v40; + v42 = a1; + v43 = 0; + v52 = v92 - 1; + do { + if (v52 == v42) + v42 = v91; + ++v43; + --v42; + if (v52 == v42) + v42 = v91; + } while (v80 != v42); + if (v41 == v43) { + v44 = Ligne[a1].field0 / 2; + v54 = Ligne[a1].field0 / 2; + if (v44 < 0) + v54 = -v44; + if (a2 > v54) { + v55 = Ligne[a1].field0 / 2; + if (v44 < 0) + v55 = -v44; + if (a2 >= v55) + v99 = CONTOURNE(a1, a2, a7, v80, v77, a8, a9); + } else { + v99 = CONTOURNE1(a1, a2, a7, v80, v77, a8, a9, v92, v91); + } + } + if (v41 < v43) + v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); + if (v43 < v41) + v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + } + if (a1 > v80) { + v45 = a1 - v80; + if (a1 - v80 < 0) + v45 = -v45; + v46 = v45; + v47 = a1; + v48 = 0; + v53 = v91 + 1; + do { + if (v53 == v47) + v47 = v92; + ++v48; + ++v47; + if (v53 == v47) + v47 = v92; + } while (v80 != v47); + if (v46 == v48) { + v49 = Ligne[a1].field0 / 2; + v56 = Ligne[a1].field0 / 2; + if (v49 < 0) + v56 = -v49; + if (a2 > v56) { + v57 = Ligne[a1].field0 / 2; + if (v49 < 0) + v57 = -v49; + if (a2 >= v57) + v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + } else { + v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); + } + } + if (v46 < v48) + v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); + if (v48 < v46) + v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + } + if (a1 == v80) + v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); + do { + v64 = colision2_ligne(_vm->_globals.NVPX, _vm->_globals.NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); + if (v64 == 1) { + v50 = 16 * v100; + if (*(uint16 *)&Ligne[v50 + 4] == 1) + --_vm->_globals.NVPY; + if (*(uint16 *)&Ligne[v50 + 4] == 2) { + --_vm->_globals.NVPY; + ++_vm->_globals.NVPX; + } + if (*(uint16 *)&Ligne[v50 + 4] == 3) + ++_vm->_globals.NVPX; + if (*(uint16 *)&Ligne[v50 + 4] == 4) { + ++_vm->_globals.NVPY; + ++_vm->_globals.NVPX; + } + if (*(uint16 *)&Ligne[v50 + 4] == 5) + ++_vm->_globals.NVPY; + if (*(uint16 *)&Ligne[v50 + 4] == 6) { + ++_vm->_globals.NVPY; + --_vm->_globals.NVPX; + } + if (*(uint16 *)&Ligne[v50 + 4] == 7) + --_vm->_globals.NVPX; + if (*(uint16 *)&Ligne[v50 + 4] == 8) { + --_vm->_globals.NVPY; + --_vm->_globals.NVPX; + } + } + } while (v64); + } else { + _vm->_globals.NVPX = -1; + _vm->_globals.NVPY = -1; + } + return v99; +} + +// TODO: method casting int arrays as byte pointers. Double-check later whether +// we can convert the return to a uint16 * +byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49; + int v50; + int v51; + int v52; + int v53; + int v54; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; + int v63; + int v64; + int v65; + int v66; + int v67; + int v68; + int i; + byte *v70; + int v71; + int v72; + int j; + byte *v74; + int v75; + int v76; + int v77; + int v78; + int v79; + int v80; + byte *v81; + int v82; + int v83; + byte *v84; + int v85; + int v86; + int v87; + int v88; + int v89; + int v90; + byte *v91; + int v92; + int v93; + int v94; + byte *v95; + int v96; + int v97; + int v98; + int v99; + int v100; + int v101; + int v102; + int v103; + int v104; + int v105; + int v106; + int v107; + int v108; + int v109; + int v110; + int v111; + int v112; + int v113; + int v114; + int v115; + int v116; + int v117; + int v118 = 0; + int v119 = 0; + int v120; + int v121; + int v122; + int v123; + int v124; + int v125; + int v126; + int v127 = 0; + int v128 = 0; + int v129 = 0; + int v130 = 0; + int v131; + int v132; + int v133; + int v134; + int v135; + int v136; + int v137 = 0; + int v138 = 0; + int v139 = 0; + int v140 = 0; + int v141; + int v142 = 0; + int v143 = 0; + int v144 = 0; + int v145 = 0; + + v123 = a3; + v122 = a4; + v121 = 0; + v120 = 0; + v115 = 0; + v114 = 0; + v113 = 0; + v111 = 0; + if (a4 <= 24) + v122 = 25; + if (!_vm->_globals.NOT_VERIF) { + v4 = a1 - _vm->_globals.old_x1_65; + if (v4 < 0) + v4 = -v4; + if (v4 <= 4) { + v5 = a2 - _vm->_globals.old_y1_66; + if (v5 < 0) + v5 = -v5; + if (v5 <= 4) { + v6 = _vm->_globals.old_x2_67 - a3; + if (v6 < 0) + v6 = -v6; + if (v6 <= 4) { + v7 = _vm->_globals.old_y2_68 - v122; + if (v7 < 0) + v7 = -v7; + if (v7 <= 4) + return PTRNUL; + } + } + } + v8 = a1 - a3; + if (v8 < 0) + v8 = -v8; + if (v8 <= 4) { + v9 = a2 - v122; + if (v9 < 0) + v9 = -v9; + if (v9 <= 4) + return PTRNUL; + } + if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) + return PTRNUL; + } + _vm->_globals.NOT_VERIF = 0; + _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; + _vm->_globals.old_x1_65 = a1; + _vm->_globals.old_x2_67 = a3; + _vm->_globals.old_y1_66 = a2; + _vm->_globals.old_y2_68 = v122; + _vm->_globals.STOP_BUG = 0; + v112 = 0; + if (a3 <= 19) + v123 = 20; + if (v122 <= 19) + v122 = 20; + if (v123 > _vm->_graphicsManager.max_x - 10) + v123 = _vm->_graphicsManager.max_x - 10; + if (v122 > _vm->_globals.Max_Perso_Y) + v122 = _vm->_globals.Max_Perso_Y; + v10 = a1 - v123; + if (v10 < 0) + v10 = -v10; + if (v10 <= 3) { + v11 = a2 - v122; + if (v11 < 0) + v11 = -v11; + if (v11 <= 3) + return PTRNUL; + } + v12 = 0; +error("TODO: Fix v141/v136 - they look like arrays, not a single int"); + do { + v13 = v12; + *(&v141 + v13) = -1; + *(&v136 + v13) = 0; + *(&v131 + v13) = 1300; + *(&v126 + v13) = 1300; + ++v12; + } while (v12 <= 8); + if (PARC_PERS(a1, a2, v123, v122, -1, -1, 0) != 1) { + v14 = 0; + v15 = v122; + if (_vm->_graphicsManager.max_y > v122) { + v16 = 5; + do { + v101 = v16; + v17 = colision2_ligne(v123, v15, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); + v16 = v101; + if (v17 == 1 && *(&v141 + v101) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v101) = 0; + *(&v141 + v101) = -1; + ++v14; + ++v15; + } while (_vm->_graphicsManager.max_y > v15); + } + v134 = v14; + v18 = 0; + v19 = v122; + if (_vm->_graphicsManager.min_y < v122) { + v20 = 1; + do { + v102 = v20; + v21 = colision2_ligne(v123, v19, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); + v20 = v102; + if (v21 == 1 && *(&v141 + v102) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v102) = 0; + *(&v141 + v102) = -1; + if (v134 < v18) { + if (v144 != -1) + break; + } + ++v18; + --v19; + } while (_vm->_graphicsManager.min_y < v19); + } + v132 = v18; + v22 = 0; + v23 = v123; + if (_vm->_graphicsManager.max_x > v123) { + v24 = 3; + do { + v103 = v24; + v25 = colision2_ligne(v23, v122, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); + v24 = v103; + if (v25 == 1 && *(&v141 + v103) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v103) = 0; + *(&v141 + v103) = -1; + ++v22; + if (v132 < v22) { + if (v142 != -1) + break; + } + if (v134 < v22 && v144 != -1) + break; + ++v23; + } while (_vm->_graphicsManager.max_x > v23); + } + v133 = v22; + v26 = 0; + v27 = v123; + if (_vm->_graphicsManager.min_x < v123) { + v28 = 7; + do { + v104 = v28; + v29 = colision2_ligne(v27, v122, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); + v28 = v104; + if (v29 == 1 && *(&v141 + v104) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v104) = 0; + *(&v141 + v104) = -1; + ++v26; + if (v132 < v26) { + if (v142 != -1) + break; + } + if (v134 < v26 && v144 != -1) + break; + if (v133 < v26 && v143 != -1) + break; + --v27; + } while (_vm->_graphicsManager.min_x < v27); + } + v135 = v26; + if (v142 < 0 || _vm->_objectsManager.DERLIGNE < v142) + v142 = -1; + if (v143 < 0 || _vm->_objectsManager.DERLIGNE < v143) + v143 = -1; + if (v144 < 0 || _vm->_objectsManager.DERLIGNE < v144) + v144 = -1; + if (v145 < 0 || _vm->_objectsManager.DERLIGNE < v145) + v145 = -1; + if (v142 < 0) + v132 = 1300; + if (v143 < 0) + v133 = 1300; + if (v144 < 0) + v134 = 1300; + if (v145 < 0) + v135 = 1300; + if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) + return PTRNUL; + v31 = 0; + if (v144 != -1 && v132 >= v134 && v133 >= v134 && v135 >= v134) { + v121 = v144; + v120 = v139; + v31 = 1; + } + if (v142 != -1 && !v31 && v134 >= v132 && v133 >= v132 && v135 >= v132) { + v121 = v142; + v120 = v137; + v31 = 1; + } + if (v143 != -1 && !v31 && v132 >= v133 && v134 >= v133 && v135 >= v133) { + v121 = v143; + v120 = v138; + v31 = 1; + } + if (v145 != -1 && !v31 && v134 >= v135 && v133 >= v135 && v132 >= v135) { + v121 = v145; + v120 = v140; + } + v32 = 0; + do { + v33 = v32; + *(&v141 + v33) = -1; + *(&v136 + v33) = 0; + *(&v131 + v33) = 1300; + *(&v126 + v33) = 1300; + ++v32; + } while (v32 <= 8); + v34 = 0; + v35 = a2; + if (_vm->_graphicsManager.max_y > a2) { + v36 = 5; + do { + v105 = v36; + v37 = colision2_ligne(a1, v35, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); + v36 = v105; + if (v37 == 1 && *(&v141 + v105) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v105) = 0; + *(&v141 + v105) = -1; + ++v34; + ++v35; + } while (_vm->_graphicsManager.max_y > v35); + } + v134 = v34 + 1; + v38 = 0; + v39 = a2; + if (_vm->_graphicsManager.min_y < a2) { + v40 = 1; + do { + v106 = v40; + v41 = colision2_ligne(a1, v39, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); + v40 = v106; + if (v41 == 1 && *(&v141 + v106) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v106) = 0; + *(&v141 + v106) = -1; + ++v38; + if (v144 != -1) { + if (v38 > 80) + break; + } + --v39; + } while (_vm->_graphicsManager.min_y < v39); + } + v132 = v38 + 1; + v42 = 0; + v43 = a1; + if (_vm->_graphicsManager.max_x > a1) { + v44 = 3; + do { + v107 = v44; + v45 = colision2_ligne(v43, a2, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); + v44 = v107; + if (v45 == 1 && *(&v141 + v107) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v107) = 0; + *(&v141 + v107) = -1; + ++v42; + if (v144 != -1 || v142 != -1) { + if (v42 > 100) + break; + } + ++v43; + } while (_vm->_graphicsManager.max_x > v43); + } + v133 = v42 + 1; + v46 = 0; + v47 = a1; + if (_vm->_graphicsManager.min_x < a1) { + v48 = 7; + do { + v108 = v48; + v49 = colision2_ligne(v47, a2, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); + v48 = v108; + if (v49 == 1 && *(&v141 + v108) <= _vm->_objectsManager.DERLIGNE) + break; + *(&v136 + v108) = 0; + *(&v141 + v108) = -1; + ++v46; + if (v144 != -1 || v142 != -1 || v143 != -1) { + if (v46 > 100) + break; + } + --v47; + } while (_vm->_graphicsManager.min_x < v47); + } + v135 = v46 + 1; + if (v142 != -1) { + v50 = v142 - v121; + if (v50 < 0) + v50 = -v50; + v127 = v50; + } + if (v143 != -1) { + v51 = v143 - v121; + if (v51 < 0) + v51 = -v51; + v128 = v51; + } + if (v144 != -1) { + v52 = v144 - v121; + if (v52 < 0) + v52 = -v52; + v129 = v52; + } + if (v145 != -1) { + v53 = v145 - v121; + if (v53 < 0) + v53 = -v53; + v130 = v53; + } + if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) + error("ERREUR POINT PLUS PROCHE Du perso NON TROUVE"); + v54 = 0; + if (v142 != -1 && v128 >= v127 && v129 >= v127 && v130 >= v127) { + v54 = 1; + v115 = v142; + v111 = v132; + v113 = 1; + v114 = v137; + } + if (!v54) { + if (v144 != -1 && v128 >= v129 && v127 >= v129 && v130 >= v129) { + v54 = 1; + v115 = v144; + v111 = v134; + v113 = 5; + v114 = v139; + } + if (!v54) { + if (v143 != -1 && v127 >= v128 && v129 >= v128 && v130 >= v128) { + v54 = 1; + v115 = v143; + v111 = v133; + v113 = 3; + v114 = v138; + } + if (!v54 && v145 != -1 && v127 >= v130 && v129 >= v130 && v128 >= v130) { + v115 = v145; + v111 = v135; + v113 = 7; + v114 = v140; + } + } + } + v55 = PARC_PERS(a1, a2, v123, v122, v115, v121, 0); + if (v55 != 1) { + if (v55 == 2) { +LABEL_201: + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + } else { + if (v113 == 1) { + v56 = 0; + if (v111 > 0) { + do { + if ((uint16)colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v58 == -1) + goto LABEL_282; + v112 = v58; + if (_vm->_globals.NVPY != -1) + v56 = a2 - _vm->_globals.NVPY; + } + v59 = v112; + _vm->_globals.super_parcours[v59] = a1; + _vm->_globals.super_parcours[v59 + 1] = a2 - v56; + _vm->_globals.super_parcours[v59 + 2] = 1; + _vm->_globals.super_parcours[v59 + 3] = 0; + v112 += 4; + ++v56; + } while (v111 > v56); + } + } + if (v113 == 5) { + v60 = 0; + if (v111 > 0) { + do { + if ((uint16)colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v61 == -1) + goto LABEL_282; + v112 = v61; + if (_vm->_globals.NVPY != -1) + v60 = _vm->_globals.NVPY - a2; + } + v62 = v112; + _vm->_globals.super_parcours[v62] = a1; + _vm->_globals.super_parcours[v62 + 1] = v60 + a2; + _vm->_globals.super_parcours[v62 + 2] = 5; + _vm->_globals.super_parcours[v62 + 3] = 0; + v112 += 4; + ++v60; + } while (v111 > v60); + } + } + if (v113 == 7) { + v63 = 0; + if (v111 > 0) { + do { + if ((uint16)colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v64 == -1) + goto LABEL_282; + v112 = v64; + if (_vm->_globals.NVPX != -1) + v63 = a1 - _vm->_globals.NVPX; + } + v65 = v112; + _vm->_globals.super_parcours[v65] = a1 - v63; + _vm->_globals.super_parcours[v65 + 1] = a2; + _vm->_globals.super_parcours[v65 + 2] = 7; + _vm->_globals.super_parcours[v65 + 3] = 0; + v112 += 4; + ++v63; + } while (v111 > v63); + } + } + if (v113 == 3) { + v66 = 0; + if (v111 > 0) { + do { + if ((uint16)colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v124) { + v57 = v112; + v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + if (v67 == -1) + goto LABEL_282; + v112 = v67; + if (_vm->_globals.NVPX != -1) + v66 = _vm->_globals.NVPX - a1; + } + v68 = v112; + _vm->_globals.super_parcours[v68] = v66 + a1; + _vm->_globals.super_parcours[v68 + 1] = a2; + _vm->_globals.super_parcours[v68 + 2] = 3; + _vm->_globals.super_parcours[v68 + 3] = 0; + v112 += 4; + ++v66; + } while (v111 > v66); + } + } + } +LABEL_234: + if (v115 < v121) { + for (i = v114; Ligne[v115].field0 > i; ++i) { + v70 = Ligne[v115].fieldC; + v119 = READ_LE_UINT16(v70 + 4 * i); + v118 = READ_LE_UINT16(v70 + 4 * i + 2); + v71 = v112; + _vm->_globals.super_parcours[v71] = v119; + _vm->_globals.super_parcours[v71 + 1] = v118; + _vm->_globals.super_parcours[v71 + 2] = Ligne[v115].field6; + _vm->_globals.super_parcours[v71 + 3] = 0; + v112 += 4; + } + v116 = v115 + 1; + if ((v115 + 1) < v121) { + do { + v72 = 0; + v110 = v116; + for (j = v116; Ligne[j].field0 > v72; j = v116) { + v74 = Ligne[v110].fieldC; + v119 = READ_LE_UINT16(v74 + 4 * v72); + v118 = READ_LE_UINT16(v74 + 4 * v72 + 2); + v75 = v112; + _vm->_globals.super_parcours[v75] = v119; + _vm->_globals.super_parcours[v75 + 1] = v118; + _vm->_globals.super_parcours[v75 + 2] = Ligne[v110].field6; + _vm->_globals.super_parcours[v75 + 3] = 0; + v112 += 4; + v76 = Ligne[v110].field0; + if (v76 > 30) { + v77 = v76 / 2; + if (v77 < 0) + v77 = -v77; + if (v72 == v77) { + v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); + if (v78 == 1) + return (byte *)&_vm->_globals.super_parcours[0]; + if (v78 == 2) + goto LABEL_200; + if (MIRACLE(v119, v118, v110, v121, v112) == 1) + goto LABEL_201; + } + } + ++v72; + v110 = v116; + } + v79 = PARC_PERS(v119, v118, v123, v122, v116, v121, v112); + if (v79 == 1) + return (byte *)&_vm->_globals.super_parcours[0]; + if (v79 == 2) { +LABEL_200: + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; + } + if (MIRACLE(v119, v118, v116, v121, v112) == 1) + goto LABEL_201; + ++v116; + } while (v116 < v121); + } + v114 = 0; + v115 = v121; + } + if (v115 > v121) { + v80 = v114; + if (v114 > 0) { + v98 = 16 * v115; + do { + v81 = Ligne[v98].fieldC; + v119 = READ_LE_UINT16(v81 + 4 * v80); + v118 = READ_LE_UINT16(v81 + 4 * v80 + 2); + v82 = v112; + _vm->_globals.super_parcours[v82] = v119; + _vm->_globals.super_parcours[v82 + 1] = v118; + _vm->_globals.super_parcours[v82 + 2] = Ligne[v98].field8; + _vm->_globals.super_parcours[v82 + 3] = 0; + v112 += 4; + --v80; + } while (v80 > 0); + } + v117 = v115 - 1; + if ((v115 - 1) > v121) { + do { + v83 = Ligne[v117].field0 - 1; + if (v83 > -1) { + v109 = 16 * v117; + do { + v84 = Ligne[v109].fieldC; + v119 = READ_LE_UINT16(v84 + 4 * v83); + v118 = READ_LE_UINT16(v84 + 4 * v83 + 2); + v85 = v112; + _vm->_globals.super_parcours[v85] = v119; + _vm->_globals.super_parcours[v85 + 1] = v118; + _vm->_globals.super_parcours[v85 + 2] = Ligne[v109].field8; + _vm->_globals.super_parcours[v85 + 3] = 0; + v112 += 4; + v86 = Ligne[v109].field0; + if (v86 > 30) { + v87 = v86 / 2; + if (v87 < 0) + v87 = -v87; + if (v83 == v87) { + v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); + if (v88 == 1) + return (byte *)&_vm->_globals.super_parcours[0]; + if (v88 == 2) + goto LABEL_200; + if (MIRACLE(v119, v118, v117, v121, v112) == 1) + goto LABEL_201; + } + } + --v83; + } while (v83 > -1); + } + v89 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); + if (v89 == 1) + return (byte *)&_vm->_globals.super_parcours[0]; + if (v89 == 2) + goto LABEL_200; + if (MIRACLE(v119, v118, v117, v121, v112) == 1) + goto LABEL_201; + --v117; + } while (v117 > v121); + } + v114 = Ligne[v121].field0 - 1; + v115 = v121; + } + if (v115 == v121) { + if (v114 <= v120) { + if (v114 < v120) { + v94 = v114; + v100 = 16 * v121; + do { + v95 = Ligne[v100].fieldC;; + v96 = READ_LE_UINT16(v95 + 4 * v94 + 2); + v97 = v112; + _vm->_globals.super_parcours[v97] = READ_LE_UINT16(v95 + 4 * v94); + _vm->_globals.super_parcours[v97 + 1] = v96; + _vm->_globals.super_parcours[v97 + 2] = Ligne[v100].field6; + _vm->_globals.super_parcours[v97 + 3] = 0; + v112 += 4; + ++v94; + } while (v120 > v94); + } + } else { + v90 = v114; + v99 = 16 * v121; + do { + v91 = Ligne[v99].fieldC; + v92 = READ_LE_UINT16(v91 + 4 * v90 + 2); + v93 = v112; + _vm->_globals.super_parcours[v93] = READ_LE_UINT16(v91 + 4 * v90); + _vm->_globals.super_parcours[v93 + 1] = v92; + _vm->_globals.super_parcours[v93 + 2] = Ligne[v99].field8; + _vm->_globals.super_parcours[v93 + 3] = 0; + v112 += 4; + --v90; + } while (v120 < v90); + } + } + v57 = v112; + if (PARC_PERS( + _vm->_globals.Param[v112 + 4192 / 2], + _vm->_globals.Param[v112 + 4194 / 2], + v123, + v122, + -1, + -1, + v112) != 1) { +LABEL_282: + _vm->_globals.super_parcours[v57] = -1; + _vm->_globals.super_parcours[v57 + 1] = -1; + _vm->_globals.super_parcours[v57 + 2] = -1; + _vm->_globals.super_parcours[v57 + 3] = -1; + } + return (byte *)&_vm->_globals.super_parcours[0]; + } + } + return (byte *)&_vm->_globals.super_parcours[0]; +} + +int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { + warning("TODO: PARC_PERS"); + return 0; +} + + +} // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h new file mode 100644 index 0000000000..8cbae6ba08 --- /dev/null +++ b/engines/hopkins/lines.h @@ -0,0 +1,82 @@ +/* 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_LINES_H +#define HOPKINS_LINES_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +struct LigneZoneItem { + int field0; + int field2; + byte *field4; +}; + +struct LigneItem { + int field0; + int field2; + int field4; + int field6; + int field8; + byte *fieldC; + byte *field12; +}; + +class LinesManager { +private: + HopkinsEngine *_vm; +public: + LigneZoneItem LigneZone[401]; + LigneItem Ligne[400]; + int next_ligne; + int TOTAL_LIGNES; + int NV_LIGNEDEP; + int NV_LIGNEOFS; + int NV_POSI; +public: + void setParent(HopkinsEngine *vm); + + void CLEAR_ZONE(); + void RETIRE_LIGNE_ZONE(int idx); + void AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6); + void RESET_OBSTACLE(); + void RETIRE_LIGNE(int idx); + void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); + int colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); + int Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); + void INIPARCOURS(); + int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7, int a8, int a9); + int CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7); + int MIRACLE(int a1, int a2, int a3, int a4, int a5); + int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, byte *a8, int a9); + byte *PARCOURS2(int a1, int a2, int a3, int a4); + int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_FONT_H */ diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 49b7c5fbca..7fc92c5ea1 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS := \ graphics.o \ globals.o \ hopkins.o \ + lines.o \ menu.o \ objects.o \ sound.o \ diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5309df0a89..6771f24958 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2078,7 +2078,7 @@ LABEL_38: v10 = XSPR(0); v11 = YSPR(0); v12 = XSPR(0); - v13 = PARCOURS2(v12, v11, v10, 390); + v13 = _vm->_linesManager.PARCOURS2(v12, v11, v10, 390); _vm->_globals.chemin = v13; if (PTRNUL != v13) PACOURS_PROPRE(v13); @@ -2106,7 +2106,7 @@ LABEL_64: if (!_vm->_globals.PLAN_FLAG) { v14 = YSPR(0); v15 = XSPR(0); - v16 = PARCOURS2(v15, v14, v19, v0); + v16 = _vm->_linesManager.PARCOURS2(v15, v14, v19, v0); _vm->_globals.chemin = v16; if (PTRNUL != v16) PACOURS_PROPRE(v16); @@ -2274,7 +2274,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_fontManager.TEXTE_OFF(9); _vm->_globals.CLEAR_VBOB(); _vm->_animationManager.CLEAR_ANIM(); - CLEAR_ZONE(); + _vm->_linesManager.CLEAR_ZONE(); RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); @@ -2295,7 +2295,7 @@ void ObjectsManager::CLEAR_ECRAN() { SPEED_Y = 0; SPEED_IMAGE = 0; FORCEZONE = 1; - TOTAL_LIGNES = 0; + _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; _vm->_globals.chemin = PTRNUL; if (_vm->_globals.COUCOU != PTRNUL) @@ -2618,789 +2618,6 @@ LABEL_9: } } -// TODO: method casting int arrays as byte pointers. Double-check later whether -// we can convert the return to a uint16 * -byte *ObjectsManager::PARCOURS2(int a1, int a2, int a3, int a4) { - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int v28; - int v29; - int v31; - int v32; - int v33; - int v34; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v43; - int v44; - int v45; - int v46; - int v47; - int v48; - int v49; - int v50; - int v51; - int v52; - int v53; - int v54; - int v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v61; - int v62; - int v63; - int v64; - int v65; - int v66; - int v67; - int v68; - int i; - byte *v70; - int v71; - int v72; - int j; - byte *v74; - int v75; - int v76; - int v77; - int v78; - int v79; - int v80; - byte *v81; - int v82; - int v83; - byte *v84; - int v85; - int v86; - int v87; - int v88; - int v89; - int v90; - byte *v91; - int v92; - int v93; - int v94; - byte *v95; - int v96; - int v97; - int v98; - int v99; - int v100; - int v101; - int v102; - int v103; - int v104; - int v105; - int v106; - int v107; - int v108; - int v109; - int v110; - int v111; - int v112; - int v113; - int v114; - int v115; - int v116; - int v117; - int v118 = 0; - int v119 = 0; - int v120; - int v121; - int v122; - int v123; - int v124; - int v125; - int v126; - int v127 = 0; - int v128 = 0; - int v129 = 0; - int v130 = 0; - int v131; - int v132; - int v133; - int v134; - int v135; - int v136; - int v137 = 0; - int v138 = 0; - int v139 = 0; - int v140 = 0; - int v141; - int v142 = 0; - int v143 = 0; - int v144 = 0; - int v145 = 0; - - v123 = a3; - v122 = a4; - v121 = 0; - v120 = 0; - v115 = 0; - v114 = 0; - v113 = 0; - v111 = 0; - if (a4 <= 24) - v122 = 25; - if (!_vm->_globals.NOT_VERIF) { - v4 = a1 - _vm->_globals.old_x1_65; - if (v4 < 0) - v4 = -v4; - if (v4 <= 4) { - v5 = a2 - _vm->_globals.old_y1_66; - if (v5 < 0) - v5 = -v5; - if (v5 <= 4) { - v6 = _vm->_globals.old_x2_67 - a3; - if (v6 < 0) - v6 = -v6; - if (v6 <= 4) { - v7 = _vm->_globals.old_y2_68 - v122; - if (v7 < 0) - v7 = -v7; - if (v7 <= 4) - return PTRNUL; - } - } - } - v8 = a1 - a3; - if (v8 < 0) - v8 = -v8; - if (v8 <= 4) { - v9 = a2 - v122; - if (v9 < 0) - v9 = -v9; - if (v9 <= 4) - return PTRNUL; - } - if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) - return PTRNUL; - } - _vm->_globals.NOT_VERIF = 0; - _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; - _vm->_globals.old_x1_65 = a1; - _vm->_globals.old_x2_67 = a3; - _vm->_globals.old_y1_66 = a2; - _vm->_globals.old_y2_68 = v122; - _vm->_globals.STOP_BUG = 0; - v112 = 0; - if (a3 <= 19) - v123 = 20; - if (v122 <= 19) - v122 = 20; - if (v123 > _vm->_graphicsManager.max_x - 10) - v123 = _vm->_graphicsManager.max_x - 10; - if (v122 > _vm->_globals.Max_Perso_Y) - v122 = _vm->_globals.Max_Perso_Y; - v10 = a1 - v123; - if (v10 < 0) - v10 = -v10; - if (v10 <= 3) { - v11 = a2 - v122; - if (v11 < 0) - v11 = -v11; - if (v11 <= 3) - return PTRNUL; - } - v12 = 0; - do { - v13 = v12; - *(&v141 + v13) = -1; - *(&v136 + v13) = 0; - *(&v131 + v13) = 1300; - *(&v126 + v13) = 1300; - ++v12; - } while (v12 <= 8); - if (PARC_PERS(a1, a2, v123, v122, -1, -1, 0) != 1) { - v14 = 0; - v15 = v122; - if (_vm->_graphicsManager.max_y > v122) { - v16 = 5; - do { - v101 = v16; - v17 = _vm->_graphicsManager.colision2_ligne(v123, v15, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); - v16 = v101; - if (v17 == 1 && *(&v141 + v101) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v101) = 0; - *(&v141 + v101) = -1; - ++v14; - ++v15; - } while (_vm->_graphicsManager.max_y > v15); - } - v134 = v14; - v18 = 0; - v19 = v122; - if (_vm->_graphicsManager.min_y < v122) { - v20 = 1; - do { - v102 = v20; - v21 = _vm->_graphicsManager.colision2_ligne(v123, v19, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); - v20 = v102; - if (v21 == 1 && *(&v141 + v102) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v102) = 0; - *(&v141 + v102) = -1; - if (v134 < v18) { - if (v144 != -1) - break; - } - ++v18; - --v19; - } while (_vm->_graphicsManager.min_y < v19); - } - v132 = v18; - v22 = 0; - v23 = v123; - if (_vm->_graphicsManager.max_x > v123) { - v24 = 3; - do { - v103 = v24; - v25 = _vm->_graphicsManager.colision2_ligne(v23, v122, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); - v24 = v103; - if (v25 == 1 && *(&v141 + v103) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v103) = 0; - *(&v141 + v103) = -1; - ++v22; - if (v132 < v22) { - if (v142 != -1) - break; - } - if (v134 < v22 && v144 != -1) - break; - ++v23; - } while (_vm->_graphicsManager.max_x > v23); - } - v133 = v22; - v26 = 0; - v27 = v123; - if (_vm->_graphicsManager.min_x < v123) { - v28 = 7; - do { - v104 = v28; - v29 = _vm->_graphicsManager.colision2_ligne(v27, v122, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); - v28 = v104; - if (v29 == 1 && *(&v141 + v104) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v104) = 0; - *(&v141 + v104) = -1; - ++v26; - if (v132 < v26) { - if (v142 != -1) - break; - } - if (v134 < v26 && v144 != -1) - break; - if (v133 < v26 && v143 != -1) - break; - --v27; - } while (_vm->_graphicsManager.min_x < v27); - } - v135 = v26; - if (v142 < 0 || _vm->_objectsManager.DERLIGNE < v142) - v142 = -1; - if (v143 < 0 || _vm->_objectsManager.DERLIGNE < v143) - v143 = -1; - if (v144 < 0 || _vm->_objectsManager.DERLIGNE < v144) - v144 = -1; - if (v145 < 0 || _vm->_objectsManager.DERLIGNE < v145) - v145 = -1; - if (v142 < 0) - v132 = 1300; - if (v143 < 0) - v133 = 1300; - if (v144 < 0) - v134 = 1300; - if (v145 < 0) - v135 = 1300; - if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) - return PTRNUL; - v31 = 0; - if (v144 != -1 && v132 >= v134 && v133 >= v134 && v135 >= v134) { - v121 = v144; - v120 = v139; - v31 = 1; - } - if (v142 != -1 && !v31 && v134 >= v132 && v133 >= v132 && v135 >= v132) { - v121 = v142; - v120 = v137; - v31 = 1; - } - if (v143 != -1 && !v31 && v132 >= v133 && v134 >= v133 && v135 >= v133) { - v121 = v143; - v120 = v138; - v31 = 1; - } - if (v145 != -1 && !v31 && v134 >= v135 && v133 >= v135 && v132 >= v135) { - v121 = v145; - v120 = v140; - } - v32 = 0; - do { - v33 = v32; - *(&v141 + v33) = -1; - *(&v136 + v33) = 0; - *(&v131 + v33) = 1300; - *(&v126 + v33) = 1300; - ++v32; - } while (v32 <= 8); - v34 = 0; - v35 = a2; - if (_vm->_graphicsManager.max_y > a2) { - v36 = 5; - do { - v105 = v36; - v37 = _vm->_graphicsManager.colision2_ligne(a1, v35, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); - v36 = v105; - if (v37 == 1 && *(&v141 + v105) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v105) = 0; - *(&v141 + v105) = -1; - ++v34; - ++v35; - } while (_vm->_graphicsManager.max_y > v35); - } - v134 = v34 + 1; - v38 = 0; - v39 = a2; - if (_vm->_graphicsManager.min_y < a2) { - v40 = 1; - do { - v106 = v40; - v41 = _vm->_graphicsManager.colision2_ligne(a1, v39, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); - v40 = v106; - if (v41 == 1 && *(&v141 + v106) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v106) = 0; - *(&v141 + v106) = -1; - ++v38; - if (v144 != -1) { - if (v38 > 80) - break; - } - --v39; - } while (_vm->_graphicsManager.min_y < v39); - } - v132 = v38 + 1; - v42 = 0; - v43 = a1; - if (_vm->_graphicsManager.max_x > a1) { - v44 = 3; - do { - v107 = v44; - v45 = _vm->_graphicsManager.colision2_ligne(v43, a2, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); - v44 = v107; - if (v45 == 1 && *(&v141 + v107) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v107) = 0; - *(&v141 + v107) = -1; - ++v42; - if (v144 != -1 || v142 != -1) { - if (v42 > 100) - break; - } - ++v43; - } while (_vm->_graphicsManager.max_x > v43); - } - v133 = v42 + 1; - v46 = 0; - v47 = a1; - if (_vm->_graphicsManager.min_x < a1) { - v48 = 7; - do { - v108 = v48; - v49 = _vm->_graphicsManager.colision2_ligne(v47, a2, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); - v48 = v108; - if (v49 == 1 && *(&v141 + v108) <= _vm->_objectsManager.DERLIGNE) - break; - *(&v136 + v108) = 0; - *(&v141 + v108) = -1; - ++v46; - if (v144 != -1 || v142 != -1 || v143 != -1) { - if (v46 > 100) - break; - } - --v47; - } while (_vm->_graphicsManager.min_x < v47); - } - v135 = v46 + 1; - if (v142 != -1) { - v50 = v142 - v121; - if (v50 < 0) - v50 = -v50; - v127 = v50; - } - if (v143 != -1) { - v51 = v143 - v121; - if (v51 < 0) - v51 = -v51; - v128 = v51; - } - if (v144 != -1) { - v52 = v144 - v121; - if (v52 < 0) - v52 = -v52; - v129 = v52; - } - if (v145 != -1) { - v53 = v145 - v121; - if (v53 < 0) - v53 = -v53; - v130 = v53; - } - if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) - error("ERREUR POINT PLUS PROCHE Du perso NON TROUVE"); - v54 = 0; - if (v142 != -1 && v128 >= v127 && v129 >= v127 && v130 >= v127) { - v54 = 1; - v115 = v142; - v111 = v132; - v113 = 1; - v114 = v137; - } - if (!v54) { - if (v144 != -1 && v128 >= v129 && v127 >= v129 && v130 >= v129) { - v54 = 1; - v115 = v144; - v111 = v134; - v113 = 5; - v114 = v139; - } - if (!v54) { - if (v143 != -1 && v127 >= v128 && v129 >= v128 && v130 >= v128) { - v54 = 1; - v115 = v143; - v111 = v133; - v113 = 3; - v114 = v138; - } - if (!v54 && v145 != -1 && v127 >= v130 && v129 >= v130 && v128 >= v130) { - v115 = v145; - v111 = v135; - v113 = 7; - v114 = v140; - } - } - } - v55 = PARC_PERS(a1, a2, v123, v122, v115, v121, 0); - if (v55 != 1) { - if (v55 == 2) { -LABEL_201: - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - } else { - if (v113 == 1) { - v56 = 0; - if (v111 > 0) { - do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v124) { - v57 = v112; - v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, _vm->_globals.super_parcours, 4); - if (v58 == -1) - goto LABEL_282; - v112 = v58; - if (NVPY != -1) - v56 = a2 - NVPY; - } - v59 = v112; - _vm->_globals.super_parcours[v59] = a1; - _vm->_globals.super_parcours[v59 + 1] = a2 - v56; - _vm->_globals.super_parcours[v59 + 2] = 1; - _vm->_globals.super_parcours[v59 + 3] = 0; - v112 += 4; - ++v56; - } while (v111 > v56); - } - } - if (v113 == 5) { - v60 = 0; - if (v111 > 0) { - do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v124) { - v57 = v112; - v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, _vm->_globals.super_parcours, 4); - if (v61 == -1) - goto LABEL_282; - v112 = v61; - if (NVPY != -1) - v60 = NVPY - a2; - } - v62 = v112; - _vm->_globals.super_parcours[v62] = a1; - _vm->_globals.super_parcours[v62 + 1] = v60 + a2; - _vm->_globals.super_parcours[v62 + 2] = 5; - _vm->_globals.super_parcours[v62 + 3] = 0; - v112 += 4; - ++v60; - } while (v111 > v60); - } - } - if (v113 == 7) { - v63 = 0; - if (v111 > 0) { - do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v124) { - v57 = v112; - v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, _vm->_globals.super_parcours, 4); - if (v64 == -1) - goto LABEL_282; - v112 = v64; - if (NVPX != -1) - v63 = a1 - NVPX; - } - v65 = v112; - _vm->_globals.super_parcours[v65] = a1 - v63; - _vm->_globals.super_parcours[v65 + 1] = a2; - _vm->_globals.super_parcours[v65 + 2] = 7; - _vm->_globals.super_parcours[v65 + 3] = 0; - v112 += 4; - ++v63; - } while (v111 > v63); - } - } - if (v113 == 3) { - v66 = 0; - if (v111 > 0) { - do { - if ((uint16)_vm->_graphicsManager.colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v124) { - v57 = v112; - v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, _vm->_globals.super_parcours, 4); - if (v67 == -1) - goto LABEL_282; - v112 = v67; - if (NVPX != -1) - v66 = NVPX - a1; - } - v68 = v112; - _vm->_globals.super_parcours[v68] = v66 + a1; - _vm->_globals.super_parcours[v68 + 1] = a2; - _vm->_globals.super_parcours[v68 + 2] = 3; - _vm->_globals.super_parcours[v68 + 3] = 0; - v112 += 4; - ++v66; - } while (v111 > v66); - } - } - } -LABEL_234: - if (v115 < v121) { - for (i = v114; _vm->_globals.Ligne[v115].field0 > i; ++i) { - v70 = _vm->_globals.Ligne[v115].fieldC; - v119 = READ_LE_UINT16(v70 + 4 * i); - v118 = READ_LE_UINT16(v70 + 4 * i + 2); - v71 = v112; - _vm->_globals.super_parcours[v71] = v119; - _vm->_globals.super_parcours[v71 + 1] = v118; - _vm->_globals.super_parcours[v71 + 2] = _vm->_globals.Ligne[v115].field6; - _vm->_globals.super_parcours[v71 + 3] = 0; - v112 += 4; - } - v116 = v115 + 1; - if ((v115 + 1) < v121) { - do { - v72 = 0; - v110 = v116; - for (j = v116; _vm->_globals.Ligne[j].field0 > v72; j = v116) { - v74 = _vm->_globals.Ligne[v110].fieldC; - v119 = READ_LE_UINT16(v74 + 4 * v72); - v118 = READ_LE_UINT16(v74 + 4 * v72 + 2); - v75 = v112; - _vm->_globals.super_parcours[v75] = v119; - _vm->_globals.super_parcours[v75 + 1] = v118; - _vm->_globals.super_parcours[v75 + 2] = _vm->_globals.Ligne[v110].field6; - _vm->_globals.super_parcours[v75 + 3] = 0; - v112 += 4; - v76 = _vm->_globals.Ligne[v110].field0; - if (v76 > 30) { - v77 = v76 / 2; - if (v77 < 0) - v77 = -v77; - if (v72 == v77) { - v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); - if (v78 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; - if (v78 == 2) - goto LABEL_200; - if (MIRACLE(v119, v118, v110, v121, v112) == 1) - goto LABEL_201; - } - } - ++v72; - v110 = v116; - } - v79 = PARC_PERS(v119, v118, v123, v122, v116, v121, v112); - if (v79 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; - if (v79 == 2) { -LABEL_200: - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v116, v121, v112) == 1) - goto LABEL_201; - ++v116; - } while (v116 < v121); - } - v114 = 0; - v115 = v121; - } - if (v115 > v121) { - v80 = v114; - if (v114 > 0) { - v98 = 16 * v115; - do { - v81 = _vm->_globals.Ligne[v98].fieldC; - v119 = READ_LE_UINT16(v81 + 4 * v80); - v118 = READ_LE_UINT16(v81 + 4 * v80 + 2); - v82 = v112; - _vm->_globals.super_parcours[v82] = v119; - _vm->_globals.super_parcours[v82 + 1] = v118; - _vm->_globals.super_parcours[v82 + 2] = _vm->_globals.Ligne[v98].field8; - _vm->_globals.super_parcours[v82 + 3] = 0; - v112 += 4; - --v80; - } while (v80 > 0); - } - v117 = v115 - 1; - if ((v115 - 1) > v121) { - do { - v83 = _vm->_globals.Ligne[v117].field0 - 1; - if (v83 > -1) { - v109 = 16 * v117; - do { - v84 = _vm->_globals.Ligne[v109].fieldC; - v119 = READ_LE_UINT16(v84 + 4 * v83); - v118 = READ_LE_UINT16(v84 + 4 * v83 + 2); - v85 = v112; - _vm->_globals.super_parcours[v85] = v119; - _vm->_globals.super_parcours[v85 + 1] = v118; - _vm->_globals.super_parcours[v85 + 2] = _vm->_globals.Ligne[v109].field8; - _vm->_globals.super_parcours[v85 + 3] = 0; - v112 += 4; - v86 = _vm->_globals.Ligne[v109].field0; - if (v86 > 30) { - v87 = v86 / 2; - if (v87 < 0) - v87 = -v87; - if (v83 == v87) { - v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); - if (v88 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; - if (v88 == 2) - goto LABEL_200; - if (MIRACLE(v119, v118, v117, v121, v112) == 1) - goto LABEL_201; - } - } - --v83; - } while (v83 > -1); - } - v89 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); - if (v89 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; - if (v89 == 2) - goto LABEL_200; - if (MIRACLE(v119, v118, v117, v121, v112) == 1) - goto LABEL_201; - --v117; - } while (v117 > v121); - } - v114 = _vm->_globals.Ligne[v121].field0 - 1; - v115 = v121; - } - if (v115 == v121) { - if (v114 <= v120) { - if (v114 < v120) { - v94 = v114; - v100 = 16 * v121; - do { - v95 = _vm->_globals.Ligne[v100].fieldC;; - v96 = READ_LE_UINT16(v95 + 4 * v94 + 2); - v97 = v112; - _vm->_globals.super_parcours[v97] = READ_LE_UINT16(v95 + 4 * v94); - _vm->_globals.super_parcours[v97 + 1] = v96; - _vm->_globals.super_parcours[v97 + 2] = _vm->_globals.Ligne[v100].field6; - _vm->_globals.super_parcours[v97 + 3] = 0; - v112 += 4; - ++v94; - } while (v120 > v94); - } - } else { - v90 = v114; - v99 = 16 * v121; - do { - v91 = _vm->_globals.Ligne[v99].fieldC; - v92 = READ_LE_UINT16(v91 + 4 * v90 + 2); - v93 = v112; - _vm->_globals.super_parcours[v93] = READ_LE_UINT16(v91 + 4 * v90); - _vm->_globals.super_parcours[v93 + 1] = v92; - _vm->_globals.super_parcours[v93 + 2] = _vm->_globals.Ligne[v99].field8; - _vm->_globals.super_parcours[v93 + 3] = 0; - v112 += 4; - --v90; - } while (v120 < v90); - } - } - v57 = v112; - if (PARC_PERS( - _vm->_globals.Param[v112 + 4192 / 2], - _vm->_globals.Param[v112 + 4194 / 2], - v123, - v122, - -1, - -1, - v112) != 1) { -LABEL_282: - _vm->_globals.super_parcours[v57] = -1; - _vm->_globals.super_parcours[v57 + 1] = -1; - _vm->_globals.super_parcours[v57 + 2] = -1; - _vm->_globals.super_parcours[v57 + 3] = -1; - } - return (byte *)&_vm->_globals.super_parcours[0]; - } - } - return (byte *)&_vm->_globals.super_parcours[0]; -} - void ObjectsManager::VERIFTAILLE() { int v0; int v1; @@ -3604,7 +2821,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v8 = 5; do { v62 = v8; - v9 = _vm->_graphicsManager.colision2_ligne(v75, v7, &v85, &v90, 0, _vm->_objectsManager.DERLIGNE); + v9 = _vm->_linesManager.colision2_ligne(v75, v7, &v85, &v90, 0, _vm->_objectsManager.DERLIGNE); v8 = v62; if (v9 == 1 && *(&v87 + v62) <= _vm->_objectsManager.DERLIGNE) break; @@ -3621,7 +2838,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v12 = 1; do { v63 = v12; - v13 = _vm->_graphicsManager.colision2_ligne(v75, v11, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v13 = _vm->_linesManager.colision2_ligne(v75, v11, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); v12 = v63; if (v13 == 1 && *(&v87 + v63) <= _vm->_objectsManager.DERLIGNE) break; @@ -3642,7 +2859,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v16 = 3; do { v64 = v16; - v17 = _vm->_graphicsManager.colision2_ligne(v15, v74, &v84, &v89, 0, _vm->_objectsManager.DERLIGNE); + v17 = _vm->_linesManager.colision2_ligne(v15, v74, &v84, &v89, 0, _vm->_objectsManager.DERLIGNE); v16 = v64; if (v17 == 1 && *(&v87 + v64) <= _vm->_objectsManager.DERLIGNE) break; @@ -3665,7 +2882,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v20 = 7; do { v65 = v20; - v21 = _vm->_graphicsManager.colision2_ligne(v19, v74, &v86, &v91, 0, _vm->_objectsManager.DERLIGNE); + v21 = _vm->_linesManager.colision2_ligne(v19, v74, &v86, &v91, 0, _vm->_objectsManager.DERLIGNE); v20 = v65; if (v21 == 1 && *(&v87 + v65) <= _vm->_objectsManager.DERLIGNE) break; @@ -3722,13 +2939,13 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v76[v25] = 1300; ++v24; } while (v24 <= 8); - v26 = _vm->_graphicsManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); if (v26 == 1) { v69 = v88; v68 = v83; } if (!v26) { - if (_vm->_graphicsManager.colision2_ligne(a1, a2, &v83, &v88, 0, TOTAL_LIGNES) == 1) { + if (_vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { v27 = 0; while (1) { v28 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27); @@ -3736,7 +2953,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v66 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 4); v27 = v27 + 4; v30 = v27; - v31 = _vm->_graphicsManager.colision2_ligne(v28, v29, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); v27 = v30; if (v31) break; @@ -3766,14 +2983,14 @@ LABEL_90: if (v69 < v73) { v34 = v68; v35 = v68; - for (i = _vm->_globals.Ligne[v69].field0; v35 < (i - 2); i = _vm->_globals.Ligne[v69].field0) { - v37 = _vm->_globals.Ligne[v69].fieldC; + for (i = _vm->_linesManager.Ligne[v69].field0; v35 < (i - 2); i = _vm->_linesManager.Ligne[v69].field0) { + v37 = _vm->_linesManager.Ligne[v69].fieldC; v38 = READ_LE_UINT16(v37 + 4 * v35); int v37_2 = READ_LE_UINT16(v37 + 4 * v35 + 2); v39 = v67; _vm->_globals.super_parcours[v39] = v38; _vm->_globals.super_parcours[v39 + 1] = v37_2; - _vm->_globals.super_parcours[v39 + 2] = _vm->_globals.Ligne[v69].field6; + _vm->_globals.super_parcours[v39 + 2] = _vm->_linesManager.Ligne[v69].field6; _vm->_globals.super_parcours[v39 + 3] = 0; v67 += 4; ++v34; @@ -3781,32 +2998,33 @@ LABEL_90: } for (j = v69 + 1; j < v73; ++j) { if (PLAN_TEST( - _vm->_globals.Ligne[j].fieldC, - READ_LE_UINT16(_vm->_globals.Ligne[j].fieldC + 2), + _vm->_linesManager.Ligne[j].fieldC, + READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC + 2), v67, j, v73, 0) == 1) { LABEL_88: - v69 = NV_LIGNEDEP; - v68 = NV_LIGNEOFS; - v67 = NV_POSI; - goto LABEL_90; + v69 = _vm->_linesManager.NV_LIGNEDEP; + v68 = _vm->_linesManager.NV_LIGNEOFS; + v67 = _vm->_linesManager.NV_POSI; + goto LABEL_90; } + v40 = 0; - if (_vm->_globals.Ligne[j].field0 - 2 > 0) { + if (_vm->_linesManager.Ligne[j].field0 - 2 > 0) { do { - v41 = _vm->_globals.Ligne[j].fieldC; + v41 = _vm->_linesManager.Ligne[j].fieldC; v42 = READ_LE_UINT16(v41 + 4 * v40); int v41_2 = READ_LE_UINT16(v41 + 4 * v40 + 2); v43 = v67; _vm->_globals.super_parcours[v43] = v42; _vm->_globals.super_parcours[v43 + 1] = v41_2; - _vm->_globals.super_parcours[v43 + 2] = _vm->_globals.Ligne[j].field6; + _vm->_globals.super_parcours[v43 + 2] = _vm->_linesManager.Ligne[j].field6; _vm->_globals.super_parcours[v43 + 3] = 0; v67 += 4; ++v40; - } while (v40 < _vm->_globals.Ligne[j].field0 - 2); + } while (v40 < _vm->_linesManager.Ligne[j].field0 - 2); } } v68 = 0; @@ -3814,43 +3032,43 @@ LABEL_88: } if (v69 > v73) { for (k = v68; k > 0; --k) { - v45 = _vm->_globals.Ligne[v69].fieldC; + v45 = _vm->_linesManager.Ligne[v69].fieldC; v46 = READ_LE_UINT16(v45 + 4 * k); int v45_2 = READ_LE_UINT16(v45 + 4 * k + 2); v47 = v67; _vm->_globals.super_parcours[v47] = v46; _vm->_globals.super_parcours[v47 + 1] = v45_2; - _vm->_globals.super_parcours[v47 + 2] = _vm->_globals.Ligne[v69].field8; + _vm->_globals.super_parcours[v47 + 2] = _vm->_linesManager.Ligne[v69].field8; _vm->_globals.super_parcours[v47 + 3] = 0; v67 += 4; } for (l = v69 - 1; l > v73; --l) { v48 = l; if (PLAN_TEST( - _vm->_globals.Ligne[l].fieldC + 4 * _vm->_globals.Ligne[v48].field0 - 4, - READ_LE_UINT16(_vm->_globals.Ligne[l].fieldC + 4 * _vm->_globals.Ligne[v48].field0 - 2), + _vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 4, + READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 2), v67, l, v73, 0) == 1) goto LABEL_88; - v49 = _vm->_globals.Ligne[v48].field0 - 2; - if ((_vm->_globals.Ligne[v48].field0 - 2) > 0) { + v49 = _vm->_linesManager.Ligne[v48].field0 - 2; + if ((_vm->_linesManager.Ligne[v48].field0 - 2) > 0) { do { - v50 = _vm->_globals.Ligne[l].fieldC; + v50 = _vm->_linesManager.Ligne[l].fieldC; v51 = READ_LE_UINT16(v50 + 4 * v49); int v50_2 = READ_LE_UINT16(v50 + 4 * v49 + 2); v52 = v67; _vm->_globals.super_parcours[v52] = v51; _vm->_globals.super_parcours[v52 + 1] = v50_2; - _vm->_globals.super_parcours[v52 + 2] = _vm->_globals.Ligne[l].field8; + _vm->_globals.super_parcours[v52 + 2] = _vm->_linesManager.Ligne[l].field8; _vm->_globals.super_parcours[v52 + 3] = 0; v67 += 4; --v49; } while (v49 > 0); } } - v68 = _vm->_globals.Ligne[v73].field0 - 1; + v68 = _vm->_linesManager.Ligne[v73].field0 - 1; v69 = v73; } if (v69 == v73) { @@ -3858,13 +3076,13 @@ LABEL_88: if (v68 < v72) { v57 = v68; do { - v58 = _vm->_globals.Ligne[v73].fieldC; + v58 = _vm->_linesManager.Ligne[v73].fieldC; v59 = READ_LE_UINT16(v58 + 4 * v57); int v58_2 = READ_LE_UINT16(v58 + 4 * v57 + 2); v60 = v67; _vm->_globals.super_parcours[v60] = v59; _vm->_globals.super_parcours[v60 + 1] = v58_2; - _vm->_globals.super_parcours[v60 + 2] = _vm->_globals.Ligne[v73].field6; + _vm->_globals.super_parcours[v60 + 2] = _vm->_linesManager.Ligne[v73].field6; _vm->_globals.super_parcours[v60 + 3] = 0; v67 += 4; ++v57; @@ -3873,13 +3091,13 @@ LABEL_88: } else { v53 = v68; do { - v54 = _vm->_globals.Ligne[v73].fieldC; + v54 = _vm->_linesManager.Ligne[v73].fieldC; v55 = READ_LE_UINT16(v54 + 4 * v53); int v54_2 = READ_LE_UINT16(v54 + 4 * v53 + 2); v56 = v67; _vm->_globals.super_parcours[2 * v56] = v55; _vm->_globals.super_parcours[2 * v56 + 1] = v54_2; - _vm->_globals.super_parcours[2 * v56 + 2] = _vm->_globals.Ligne[v73].field8; + _vm->_globals.super_parcours[2 * v56 + 2] = _vm->_linesManager.Ligne[v73].field8; _vm->_globals.super_parcours[2 * v56 + 3] = 0; v67 += 4; --v53; @@ -4190,7 +3408,7 @@ int ObjectsManager::MZONE() { && _vm->_globals.CarreZone[v7].field6 <= v20 && _vm->_globals.CarreZone[v7].field8 >= v20) { if (_vm->_globals.CarreZone[v7].fieldE == 1) { - _vm->_globals.oldzone_46 = _vm->_globals.LigneZone[_vm->_globals.CarreZone[v7].fieldA].field2; + _vm->_globals.oldzone_46 = _vm->_linesManager.LigneZone[_vm->_globals.CarreZone[v7].fieldA].field2; return _vm->_globals.oldzone_46; } v9 = _vm->_globals.SegmentEnCours; @@ -4245,10 +3463,6 @@ LABEL_58: return result; } -void ObjectsManager::CLEAR_ZONE() { - warning("TODO: CLEAR_ZONE"); -} - void ObjectsManager::RESET_OBSTACLE() { warning("TODO: CLEAR_ZONE"); } @@ -5120,7 +4334,7 @@ LABEL_1141: _vm->_globals.chemin = PTRNUL; v13 = YSPR(0); v14 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v14, v13, 564, 420); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); _vm->_objectsManager.NUMZONE = -1; do { GOHOME(); @@ -5191,7 +4405,7 @@ LABEL_1141: _vm->_globals.chemin = PTRNUL; v16 = YSPR(0); v17 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v17, v16, 445, 332); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); _vm->_globals.NOT_VERIF = 1; do { GOHOME(); @@ -5311,7 +4525,7 @@ LABEL_1141: _vm->_globals.chemin = PTRNUL; v22 = YSPR(0); v23 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v23, v22, 119, 268); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); _vm->_globals.NOT_VERIF = 1; do { GOHOME(); @@ -5534,17 +4748,17 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { v27 = YSPR(0); v28 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v28, v27, 201, 294); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { v29 = YSPR(0); v30 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v30, v29, 158, 338); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); } if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { v31 = YSPR(0); v32 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v32, v31, 211, 393); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); } _vm->_globals.NOT_VERIF = 1; do { @@ -5741,7 +4955,7 @@ LABEL_1141: _vm->_globals.chemin = PTRNUL; v37 = YSPR(0); v38 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v38, v37, 330, 418); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = 0; do { @@ -5767,7 +4981,7 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; v39 = YSPR(0); v40 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v40, v39, 330, 314); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); _vm->_objectsManager.NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; do { @@ -5891,7 +5105,7 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; v43 = YSPR(0); v44 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v44, v43, 488, 280); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); _vm->_globals.NOT_VERIF = 1; do { GOHOME(); @@ -6378,7 +5592,7 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; v55 = YSPR(0); v56 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v56, v55, 361, 325); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; do { @@ -6399,7 +5613,7 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; v57 = YSPR(0); v58 = XSPR(0); - _vm->_globals.chemin = PARCOURS2(v58, v57, 361, 325); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; do { @@ -6579,16 +5793,6 @@ void ObjectsManager::VERBE_ON(int a1, int a2) { warning("TODO: VERBE_ON"); } -int ObjectsManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { - warning("TODO: PARC_PERS"); - return 0; -} - -int ObjectsManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { - warning("TODO: MIRACLE"); - return 0; -} - int ObjectsManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { warning("TODO: GENIAL"); return 0; @@ -6646,13 +5850,13 @@ int ObjectsManager::colision(int a1, int a2) { int v9 = v3 + 1; do { - byte *srcP = _vm->_globals.LigneZone[v8].field4; + byte *srcP = _vm->_linesManager.LigneZone[v8].field4; if (srcP != PTRNUL) { bool flag = true; - int v11 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 2); - int dataV2 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 2 + 2); - int v12 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 4 - 4); - int v13 = READ_LE_UINT16(srcP + _vm->_globals.LigneZone[v8].field0 * 4 - 2); + int v11 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2); + int dataV2 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2 + 2); + int v12 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 4); + int v13 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 2); int v10 = v13; if (v11 < v12 && v4 >= v11 && v5 > v13) @@ -6666,14 +5870,14 @@ int ObjectsManager::colision(int a1, int a2) { if (!flag) { - if (v11 < _vm->_globals.LigneZone[v8].field0) { - for (; v11 < _vm->_globals.LigneZone[v8].field0; ++idx) { + if (v11 < _vm->_linesManager.LigneZone[v8].field0) { + for (; v11 < _vm->_linesManager.LigneZone[v8].field0; ++idx) { int v11 = READ_LE_UINT16(srcP); int v12 = READ_LE_UINT16(srcP + 2); srcP += 4; if ((v2 == v11 || v9 == v11) && a2 == v12) - return _vm->_globals.LigneZone[v8].field2; + return _vm->_linesManager.LigneZone[v8].field2; } } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index bb88d08c12..1f79283215 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -93,7 +93,6 @@ public: int CHANGEVERBE; int verbe; int Vold_taille; - int TOTAL_LIGNES; bool SPEED_FLAG; int SPEED_X, SPEED_Y; int SPEED_IMAGE; @@ -122,11 +121,6 @@ public: int OBSSEUL; int NVVERBE; int NVZONE; - int NV_LIGNEDEP; - int NV_LIGNEOFS; - int NV_POSI; - int NVPX; - int NVPY; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -202,14 +196,12 @@ public: void INVENT(); void CHANGE_TETE(int a1, int a2); - byte *PARCOURS2(int a1, int a2, int a3, int a4); void VERIFTAILLE(); void PACOURS_PROPRE(byte *a1); byte *PARC_VOITURE(int a1, int a2, int a3, int a4); void VERBEPLUS(); void BTDROITE(); int MZONE(); - void CLEAR_ZONE(); void RESET_OBSTACLE(); int ZONE_OBJET(int a1, int a2); void PARAMCADRE(int a1); @@ -242,8 +234,6 @@ public: int Control_If(const byte *dataP, int a2); void VERBE_OFF(int a1, int a2); void VERBE_ON(int a1, int a2); - int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); - int MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); int CALC_PROPRE(int idx); int PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6); -- cgit v1.2.3 From b06cabee4b4ffedd138e1d2462e3ae299138dfbd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 2 Oct 2012 22:41:13 +1000 Subject: HOPKINS: Implemented VERIF_SMOOTH and SMOOTH_MOVE --- engines/hopkins/globals.h | 8 +- engines/hopkins/lines.cpp | 1212 +++++++++++++++++++++++++++++++++++++++++++-- engines/hopkins/lines.h | 12 + 3 files changed, 1196 insertions(+), 36 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f2a27e3f88..d254ecde48 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -192,6 +192,11 @@ struct SegmentItem { int field4; }; +struct HopkinsItem { + int field0; + int field2; +}; + struct Sauvegarde1 { int field0; int field1; @@ -333,6 +338,7 @@ public: int STAILLE[500]; int16 super_parcours[32002]; int Param[2100]; + HopkinsItem Hopkins[70]; byte *Winventaire; byte *texte_tmp; int texte_long; @@ -414,8 +420,6 @@ public: int ACTION_SENS; int STOP_BUG; int SegmentEnCours; - int NVPX; - int NVPY; int force_to_data_0; int oldzone_46; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index f25f068054..3bc29f03f1 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1045,8 +1045,8 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v23 == -1) return 0; v7 = v23; - if (_vm->_globals.NVPY != -1) - v22 = _vm->_globals.NVPY - v40; + if (NVPY != -1) + v22 = NVPY - v40; } v24 = v7; _vm->_globals.super_parcours[v24] = v41; @@ -1073,8 +1073,8 @@ LABEL_186: if (v26 == -1) return 0; v7 = v26; - if (_vm->_globals.NVPY != -1) - v25 = v40 - _vm->_globals.NVPY; + if (NVPY != -1) + v25 = v40 - NVPY; } v27 = v7; _vm->_globals.super_parcours[v27] = v41; @@ -1097,8 +1097,8 @@ LABEL_186: if (v29 == -1) return 0; v7 = v29; - if (_vm->_globals.NVPX != -1) - v28 = v41 - _vm->_globals.NVPX; + if (NVPX != -1) + v28 = v41 - NVPX; } v30 = v7; _vm->_globals.super_parcours[v30] = v41 - v28; @@ -1121,8 +1121,8 @@ LABEL_186: if (v32 == -1) return 0; v7 = v32; - if (_vm->_globals.NVPX != -1) - v31 = _vm->_globals.NVPX - v41; + if (NVPX != -1) + v31 = NVPX - v41; } v33 = v7; _vm->_globals.super_parcours[v33] = v31 + v41; @@ -1457,8 +1457,8 @@ LABEL_17: } } if (v78 < a3 - 1 || v78 > a3 + 1 || v79 < a4 - 1 || v79 > a4 + 1) { - _vm->_globals.NVPX = v78; - _vm->_globals.NVPY = v79; + NVPX = v78; + NVPY = v79; if (a1 < v80) { v40 = v80 - a1; if (v80 - a1 < 0) @@ -1534,38 +1534,38 @@ LABEL_17: if (a1 == v80) v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); do { - v64 = colision2_ligne(_vm->_globals.NVPX, _vm->_globals.NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); + v64 = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); if (v64 == 1) { v50 = 16 * v100; if (*(uint16 *)&Ligne[v50 + 4] == 1) - --_vm->_globals.NVPY; + --NVPY; if (*(uint16 *)&Ligne[v50 + 4] == 2) { - --_vm->_globals.NVPY; - ++_vm->_globals.NVPX; + --NVPY; + ++NVPX; } if (*(uint16 *)&Ligne[v50 + 4] == 3) - ++_vm->_globals.NVPX; + ++NVPX; if (*(uint16 *)&Ligne[v50 + 4] == 4) { - ++_vm->_globals.NVPY; - ++_vm->_globals.NVPX; + ++NVPY; + ++NVPX; } if (*(uint16 *)&Ligne[v50 + 4] == 5) - ++_vm->_globals.NVPY; + ++NVPY; if (*(uint16 *)&Ligne[v50 + 4] == 6) { - ++_vm->_globals.NVPY; - --_vm->_globals.NVPX; + ++NVPY; + --NVPX; } if (*(uint16 *)&Ligne[v50 + 4] == 7) - --_vm->_globals.NVPX; + --NVPX; if (*(uint16 *)&Ligne[v50 + 4] == 8) { - --_vm->_globals.NVPY; - --_vm->_globals.NVPX; + --NVPY; + --NVPX; } } } while (v64); } else { - _vm->_globals.NVPX = -1; - _vm->_globals.NVPY = -1; + NVPX = -1; + NVPY = -1; } return v99; } @@ -2086,8 +2086,8 @@ LABEL_201: if (v58 == -1) goto LABEL_282; v112 = v58; - if (_vm->_globals.NVPY != -1) - v56 = a2 - _vm->_globals.NVPY; + if (NVPY != -1) + v56 = a2 - NVPY; } v59 = v112; _vm->_globals.super_parcours[v59] = a1; @@ -2110,8 +2110,8 @@ LABEL_201: if (v61 == -1) goto LABEL_282; v112 = v61; - if (_vm->_globals.NVPY != -1) - v60 = _vm->_globals.NVPY - a2; + if (NVPY != -1) + v60 = NVPY - a2; } v62 = v112; _vm->_globals.super_parcours[v62] = a1; @@ -2134,8 +2134,8 @@ LABEL_201: if (v64 == -1) goto LABEL_282; v112 = v64; - if (_vm->_globals.NVPX != -1) - v63 = a1 - _vm->_globals.NVPX; + if (NVPX != -1) + v63 = a1 - NVPX; } v65 = v112; _vm->_globals.super_parcours[v65] = a1 - v63; @@ -2158,8 +2158,8 @@ LABEL_201: if (v67 == -1) goto LABEL_282; v112 = v67; - if (_vm->_globals.NVPX != -1) - v66 = _vm->_globals.NVPX - a1; + if (NVPX != -1) + v66 = NVPX - a1; } v68 = v112; _vm->_globals.super_parcours[v68] = v66 + a1; @@ -2355,9 +2355,1153 @@ LABEL_282: } int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { - warning("TODO: PARC_PERS"); + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + byte *v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + byte *v26; + int v27; + byte *v28; + byte *v29; + int v30; + int v31; + byte *v32; + int v33; + int v34; + byte *v35; + int v36; + int v37; + byte *v38; + int v39; + int v40; + int v41; + byte *v42; + int v43; + int v44; + int v45; + int v46; + byte *v47; + int v48; + byte *v49; + byte *v50; + int v51; + int v52; + byte *v53; + int v54; + int v55; + int v56; + byte *v57; + int v58; + int v59; + byte *v60; + int v61; + int v62; + int v63; + byte *v64; + int v65; + int v66; + int v67; + int v68; + byte *v69; + int v70; + byte *v71; + byte *v72; + int v73; + int v74; + int v76; + byte *v77; + byte *v78; + int v79; + byte *v80; + int v81; + byte *v82; + int v83; + byte *v84; + int v85; + byte *v86; + int v87; + byte *v88; + int v89; + int v90; + int v91; + int v92; + int v93; + int v94; + int v95; + int v96; + int v97; + int v98; + int v99; + int v100; + int v101; + int v102; + int v103; + int v104; + int v105; + int v106; + int v107; + int v108; + int v109; + int v110; + int v111; + int v112; + int v113; + int v114; + int v115; + int v116; + int v117; + int v118; + int v119; + int v120; + int v121; + int v122; + int v123; + int v124; + int v125; + int v126; + int v127; + int v128; + int v129; + int v130; + int v131; + int v132; + int v133; + int v134; + int v135; + int v136; + int v137; + int v138; + int v139; + int v140; + int v141; + int v142; + int v143; + int v144; + int v145; + int colResult; + + v7 = a1; + v90 = a2; + v137 = a7; + v136 = 0; + if (a5 == -1 && a6 == -1) + v136 = 1; + v144 = a5; + if (colision2_ligne(a1, a2, &v145, &v144, 0, TOTAL_LIGNES) == 1) { + v8 = Ligne[v144].field4; + if (v8 == 1) + v90 = a2 - 2; + if (v8 == 2) { + v90 -= 2; + v7 = a1 + 2; + } + if (v8 == 3) + v7 += 2; + if (v8 == 4) { + v90 += 2; + v7 += 2; + } + if (v8 == 5) + v90 += 2; + if (v8 == 6) { + v90 += 2; + v7 -= 2; + } + if (v8 == 7) + v7 -= 2; + if (v8 == 8) { + v90 -= 2; + v7 -= 2; + } + } + v98 = v7; + v97 = v90; + v115 = 0; + v142 = -1; + v140 = -1; + v138 = -1; + while (1) { + v111 = v7; + v109 = v90; + if (a3 >= v7 - 2 && a3 <= v7 + 2 && a4 >= v90 - 2 && a4 <= v90 + 2) { +LABEL_149: + v27 = v115; + v28 = _vm->_globals.essai0; + WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v27, (uint16)-1); + WRITE_LE_UINT16(v28 + 2 * v27 + 2, (uint16)-1); + WRITE_LE_UINT16(v28 + 2 * v27 + 4, (uint16)-1); +LABEL_150: + if (v115) { + v127 = 0; + v116 = 0; + v29 = _vm->_globals.essai0; + do { + v30 = v137; + _vm->_globals.super_parcours[v30] = READ_LE_UINT16(v29 + 2 * v116); + _vm->_globals.super_parcours[v30 + 1] = READ_LE_UINT16(v29 + 2 * v116 + 2); + _vm->_globals.super_parcours[v30 + 2] = READ_LE_UINT16(v29 + 2 * v116 + 4); + _vm->_globals.super_parcours[v30 + 3] = 0; + v116 += 3; + v137 += 4; + if (READ_LE_UINT16(v29 + 2 * v116) == -1) { + if (READ_LE_UINT16(v29 + 2 * v116 + 2) == -1) + v127 = 1; + } + } while (v127 != 1); + } + goto LABEL_248; + } + v9 = v7 - a3; + if (v7 - a3 < 0) + v9 = -v9; + v10 = v9 + 1; + v11 = v90 - a4; + if (v90 - a4 < 0) + v11 = -v11; + v107 = v11 + 1; + if (v10 > (signed __int16)(v11 + 1)) + v107 = v10; + v12 = v107 - 1; + v101 = 1000 * v10 / v12; + v99 = 1000 * (signed __int16)(v11 + 1) / v12; + if (a3 < v7) + v101 = -v101; + if (a4 < v90) + v99 = -v99; + v13 = (signed __int16)v101 / 1000; + v94 = (signed __int16)v99 / 1000; + v91 = -1; + if ((signed __int16)v99 / 1000 == -1 && (unsigned int)v101 <= 0x96) + v91 = 1; + if (v13 == 1) { + if ((unsigned int)(v99 + 1) <= 0x97) + v91 = 3; + if ((unsigned int)v99 <= 0x96) + v91 = 3; + } + if (v94 == 1) { + if ((unsigned int)v101 <= 0x96) + v91 = 5; + if ((unsigned int)(v101 + 150) <= 0x96) + v91 = 5; + } + if (v13 == -1) { + if ((unsigned int)v99 <= 0x96) + v91 = 7; + if ((unsigned int)(v99 + 150) <= 0x96) + v91 = 7; + } + if (v94 == -1 && (unsigned int)(v101 + 150) <= 0x96) + v91 = 1; + if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(0, a3, v7, v109, a3, a4) != -1) + break; +LABEL_72: + v19 = v111 - a3; + if (v111 - a3 < 0) + v19 = -v19; + v20 = v19 + 1; + v95 = v109 - a4; + if (v95 < 0) + v95 = -(v109 - a4); + v108 = v95 + 1; + if (v20 > (signed __int16)(v95 + 1)) + v108 = v20; + if (v108 <= 10) + goto LABEL_149; + v21 = v108 - 1; + v102 = 1000 * v20 / v21; + v100 = 1000 * (signed __int16)(v95 + 1) / v21; + if (a3 < v111) + v102 = -v102; + if (a4 < v109) + v100 = -v100; + v22 = (signed __int16)v102 / 1000; + v96 = (signed __int16)v100 / 1000; + v106 = 1000 * v111; + v105 = 1000 * v109; + v104 = 1000 * v111 / 1000; + v103 = v105 / 1000; + if (!((signed __int16)v102 / 1000) && v96 == -1) + v91 = 1; + if (v22 == 1) { + if (v96 == -1) + v91 = 2; + if (!v96) + v91 = 3; + if (v96 == 1) + v91 = 4; + } + if (!v22 && v96 == 1) + v91 = 5; + if (v22 != -1) + goto LABEL_103; + if (v96 == 1) + v91 = 6; + if (!v96) + v91 = 7; + if (v96 == -1) { + v91 = 8; +LABEL_103: + if (v96 == -1) { + if ((unsigned int)v102 <= 0x1FE) + v91 = 1; + if ((unsigned int)(v102 - 510) <= 0x1EA) + v91 = 2; + } + } + if (v22 == 1) { + if ((unsigned int)(v100 + 1) <= 0x1FF) + v91 = 2; + if ((unsigned int)(v100 + 510) <= 0x1FE) + v91 = 3; + if ((unsigned int)v100 <= 0x1FE) + v91 = 3; + if ((unsigned int)(v100 - 510) <= 0x1EA) + v91 = 4; + } + if (v96 == 1) { + if ((unsigned int)(v102 - 510) <= 0x1EA) + v91 = 4; + if ((unsigned int)v102 <= 0x1FE) + v91 = 5; + if (v102 >= -1 && v102 <= -510) + v91 = 6; + if ((unsigned int)(v102 + 510) <= 0x1FE) + v91 = 5; + } + if (v22 == -1) { + if ((unsigned int)(v100 - 510) <= 0x1EA) + v91 = 6; + if ((unsigned int)v100 <= 0x1FE) + v91 = 7; + if ((unsigned int)(v100 + 1000) <= 0x1EA) + v91 = 8; + if ((unsigned int)(v100 + 510) <= 0x1FE) + v91 = 7; + } + if (v96 == -1) { + if ((unsigned int)(v102 + 1000) <= 0x1EA) + v91 = 8; + if ((unsigned int)(v102 + 510) <= 0x1FE) + v91 = 1; + } + v23 = 0; + if (v108 + 1 <= 0) + goto LABEL_149; + while (colision2_ligne(v104, v103, &v143, &v142, 0, TOTAL_LIGNES) != 1) { + v25 = v115; + v26 = _vm->_globals.essai0; + WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v25, v104); + WRITE_LE_UINT16(v26 + 2 * v25 + 2, v103); + WRITE_LE_UINT16(v26 + 2 * v25 + 4, v91); + v106 += v102; + v105 += v100; + v104 = v106 / 1000; + v103 = v105 / 1000; + v115 += 3; + ++v23; + if (v23 >= v108 + 1) + goto LABEL_149; + } + if (_vm->_objectsManager.DERLIGNE >= v142) + goto LABEL_157; + v24 = GENIAL(v142, v143, v104, v103, a3, a4, v115, _vm->_globals.essai0, 3); + if (v24 == -1) + goto LABEL_150; + v115 = v24; + if (NVPX != -1 || NVPY != -1) { +LABEL_67: + v142 = -1; + goto LABEL_157; + } + v7 = -1; + v90 = -1; + } + v91 = SMOOTH_SENS; + v14 = 0; + while (1) { + v15 = SMOOTH[v14].field0; + v112 = v15; + v110 = SMOOTH[v14].field2; + if (v15 == -1 || SMOOTH[v14].field2 == -1) { + v126 = 1; + goto LABEL_70; + } + if (colision2_ligne(v15, v110, &v143, &v142, 0, TOTAL_LIGNES) == 1) + break; + v16 = v115; + v17 = _vm->_globals.essai0; + WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v16, v112); + WRITE_LE_UINT16(v17 + 2 * v16 + 2, v110); + WRITE_LE_UINT16(v17 + 2 * v16 + 4, v91); + v115 += 3; + ++v14; +LABEL_70: + if (v126 == 1) { + v18 = v14 - 1; + v111 = SMOOTH[v18].field0; + v109 = SMOOTH[v18].field2; + goto LABEL_72; + } + } + if (v142 > _vm->_objectsManager.DERLIGNE) + goto LABEL_67; +LABEL_157: + v31 = v115; + v32 = _vm->_globals.essai0; + WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v31, (uint16)-1); + WRITE_LE_UINT16(v32 + 2 * v31 + 2, (uint16)-1); + WRITE_LE_UINT16(v32 + 2 * v31 + 4, (uint16)-1); + v117 = 0; + v33 = v98; + v92 = v97; +LABEL_158: + v113 = v33; + if (a3 >= v33 - 2 && a3 <= v33 + 2 && a4 >= v92 - 2 && a4 <= v92 + 2) + goto LABEL_194; + if (v33 >= a3) { +LABEL_165: + if (v113 > a3) { + v36 = v113; + while (colision2_ligne(v36, v92, &v141, &v140, 0, TOTAL_LIGNES) != 1) { + v37 = v117; + v38 = _vm->_globals.essai1; + WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v37, v36); + WRITE_LE_UINT16(v38 + 2 * v37 + 2, v92); + WRITE_LE_UINT16(v38 + 2 * v37 + 4, 7); + v117 += 3; + --v36; + if (a3 >= v36) + goto LABEL_171; + } + goto LABEL_168; + } +LABEL_171: + if (v92 >= a4) { +LABEL_181: + if (v92 > a4) { + v43 = v92; + do { + if (colision2_ligne(a3, v43, &v141, &v140, 0, TOTAL_LIGNES) == 1) { + if (_vm->_objectsManager.DERLIGNE < v140) { + v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); + if (v44 == -1) + goto LABEL_195; + v117 = v44; + if (NVPX != -1) { + if (NVPY != -1) { + v33 = NVPX; + v92 = NVPY; + v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager.DERLIGNE); + goto LABEL_189; + } + } + } + if (v140 <= _vm->_objectsManager.DERLIGNE) + goto LABEL_202; + } + v46 = v117; + v47 = _vm->_globals.essai1; + WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v46, a3); + WRITE_LE_UINT16(v47 + 2 * v46 + 2, v43); + WRITE_LE_UINT16(v47 + 2 * v46 + 4, 1); + v117 += 3; + --v43; + } while (a4 < v43); + } +LABEL_194: + v48 = v117; + v49 = _vm->_globals.essai1; + WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v48, (uint16)-1); + WRITE_LE_UINT16(v49 + 2 * v48 + 2, (uint16)-1); + WRITE_LE_UINT16(v49 + 2 * v48 + 4, (uint16)-1); +LABEL_195: + if (v117) { + v128 = 0; + v118 = 0; + v50 = _vm->_globals.essai1; + do { + v51 = v137; + _vm->_globals.super_parcours[v51] = READ_LE_UINT16(v50 + 2 * v118); + _vm->_globals.super_parcours[v51 + 1] = READ_LE_UINT16(v50 + 2 * v118 + 2); + _vm->_globals.super_parcours[v51 + 2] = READ_LE_UINT16(v50 + 2 * v118 + 4); + _vm->_globals.super_parcours[v51 + 3] = 0; + v118 += 3; + v137 += 4; + if (READ_LE_UINT16(v50 + 2 * v118) == -1 && READ_LE_UINT16(v50 + 2 * v118 + 2) == -1) + v128 = 1; + } while (v128 != 1); + } + goto LABEL_248; + } + v39 = v92; + while (1) { + if (colision2_ligne(a3, v39, &v141, &v140, 0, TOTAL_LIGNES) == 1) { + if (_vm->_objectsManager.DERLIGNE < v140) { + v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3); + if (v40 == -1) + goto LABEL_195; + v117 = v40; + if (NVPX != -1) { + if (NVPY != -1) { + v33 = NVPX; + v92 = NVPY; + v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager.DERLIGNE); +LABEL_189: + if (v45 == 1 && v140 <= _vm->_objectsManager.DERLIGNE) + goto LABEL_202; + goto LABEL_158; + } + } + } + if (v140 <= _vm->_objectsManager.DERLIGNE) + goto LABEL_202; + } + v41 = v117; + v42 = _vm->_globals.essai1; + WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v41, a3); + WRITE_LE_UINT16(v42 + 2 * v41 + 2, v39); + WRITE_LE_UINT16(v42 + 2 * v41 + 4, 5); + v117 += 3; + ++v39; + if (a4 <= v39) + goto LABEL_181; + } + } + while (colision2_ligne(v33, v92, &v141, &v140, 0, TOTAL_LIGNES) != 1) { + v34 = v117; + v35 = _vm->_globals.essai1; + WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v34,v33); + WRITE_LE_UINT16(v35 + 2 * v34 + 2, v92); + WRITE_LE_UINT16(v35 + 2 * v34 + 4, 3); + v117 += 3; + ++v33; + if (a3 <= v33) + goto LABEL_165; + } +LABEL_168: + if (v140 > _vm->_objectsManager.DERLIGNE) + v140 = -1; +LABEL_202: + v52 = v117; + v53 = _vm->_globals.essai1; + WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v52, (uint16)-1); + WRITE_LE_UINT16(v53 + 2 * v52 + 2, (uint16)-1); + WRITE_LE_UINT16(v53 + 2 * v52 + 4, (uint16)-1); + v117 = 0; + v54 = v98; + v93 = v97; +LABEL_203: + v114 = v54; + if (a3 >= v54 - 2 && a3 <= v54 + 2 && a4 >= v93 - 2 && a4 <= v93 + 2) + goto LABEL_241; + if (v93 < a4) { + v55 = v93; + while (colision2_ligne(v114, v55, &v139, &v138, 0, TOTAL_LIGNES) != 1) { + v56 = v117; + v57 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v56, v114); + WRITE_LE_UINT16(v57 + 2 * v56 + 2, v55); + WRITE_LE_UINT16(v57 + 2 * v56 + 4, 5); + v117 += 3; + ++v55; + if (a4 <= v55) + goto LABEL_211; + } + goto LABEL_214; + } +LABEL_211: + if (v93 > a4) { + v58 = v93; + while (colision2_ligne(v114, v58, &v139, &v138, 0, TOTAL_LIGNES) != 1) { + v59 = v117; + v60 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v59, v114); + WRITE_LE_UINT16(v60 + 2 * v59 + 2, v58); + WRITE_LE_UINT16(v60 + 2 * v59 + 4, 1); + v117 += 3; + --v58; + if (a4 >= v58) + goto LABEL_217; + } +LABEL_214: + if (v138 > _vm->_objectsManager.DERLIGNE) + v138 = -1; +LABEL_249: + v76 = v117; + v77 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v76, (uint16)-1); + WRITE_LE_UINT16(v77 + 2 * v76 + 2, (uint16)-1); + WRITE_LE_UINT16(v77 + 2 * v76 + 4, (uint16)-1); + if (v136 != 1) { + if (a6 > v144) { + if (READ_LE_UINT16(_vm->_globals.essai0) != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { + NV_LIGNEDEP = v142; + NV_LIGNEOFS = v143; + v130 = 0; + v120 = 0; + v78 = _vm->_globals.essai0; + do { + v79 = v137; + _vm->_globals.super_parcours[v79] = READ_LE_UINT16(v78 + 2 * v120); + _vm->_globals.super_parcours[v79 + 1] = READ_LE_UINT16(v78 + 2 * v120 + 2); + _vm->_globals.super_parcours[v79 + 2] = READ_LE_UINT16(v78 + 2 * v120 + 4); + _vm->_globals.super_parcours[v79 + 3] = 0; + v120 += 3; + v137 += 4; + if (READ_LE_UINT16(v78 + 2 * v120) == -1 && READ_LE_UINT16(v78 + 2 * v120 + 2) == -1) + v130 = 1; + } while (v130 != 1); +LABEL_323: + NV_POSI = v137; + return 2; + } + v80 = _vm->_globals.essai1; + if (READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { + NV_LIGNEDEP = v140; + NV_LIGNEOFS = v141; + v131 = 0; + v121 = 0; + do { + v81 = v137; + _vm->_globals.super_parcours[v81] = READ_LE_UINT16(v80 + 2 * v121); + _vm->_globals.super_parcours[v81 + 1] = READ_LE_UINT16(v80 + 2 * v121 + 2); + _vm->_globals.super_parcours[v81 + 2] = READ_LE_UINT16(v80 + 2 * v121 + 4); + _vm->_globals.super_parcours[v81 + 3] = 0; + v121 += 3; + v137 += 4; + if ((int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) + v131 = 1; + } while (v131 != 1); +LABEL_301: + NV_POSI = v137; + return 2; + } + v82 = _vm->_globals.essai2; + if (READ_LE_UINT16(_vm->_globals.essai2) != -1) { + if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) { + NV_LIGNEDEP = v138; + NV_LIGNEOFS = v139; + v132 = 0; + v122 = 0; + do { + v83 = v137; + _vm->_globals.super_parcours[v83] = READ_LE_UINT16(v82 + 2 * v122); + _vm->_globals.super_parcours[v83 + 1] = READ_LE_UINT16(v82 + 2 * v122 + 2); + _vm->_globals.super_parcours[v83 + 2] = READ_LE_UINT16(v82 + 2 * v122 + 4); + _vm->_globals.super_parcours[v83 + 3] = 0; + v122 += 3; + v137 += 4; + if (READ_LE_UINT16(v82 + 2 * v122) == -1 && READ_LE_UINT16(v82 + 2 * v122 + 2) == -1) + v132 = 1; + } while (v132 != 1); +LABEL_312: + NV_POSI = v137; + return 2; + } + } + } + if (a6 < v144) { + if (v142 == -1) + v142 = 1300; + if (v140 == -1) + v142 = 1300; + if (v138 == -1) + v142 = 1300; + if (READ_LE_UINT16(_vm->_globals.essai1) != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { + NV_LIGNEDEP = v140; + NV_LIGNEOFS = v141; + v133 = 0; + v123 = 0; + v84 = _vm->_globals.essai1; + do { + v85 = v137; + _vm->_globals.super_parcours[v85] = READ_LE_UINT16(v84 + 2 * v123); + _vm->_globals.super_parcours[v85 + 1] = READ_LE_UINT16(v84 + 2 * v123 + 2); + _vm->_globals.super_parcours[v85 + 2] = READ_LE_UINT16(v84 + 2 * v123 + 4); + _vm->_globals.super_parcours[v85 + 3] = 0; + v123 += 3; + v137 += 4; + if (READ_LE_UINT16(v84 + 2 * v123) == -1 && READ_LE_UINT16(v84 + 2 * v123 + 2) == -1) + v133 = 1; + } while (v133 != 1); + goto LABEL_301; + } + v86 = _vm->_globals.essai2; + if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { + NV_LIGNEDEP = v138; + NV_LIGNEOFS = v139; + v134 = 0; + v124 = 0; + do { + v87 = v137; + _vm->_globals.super_parcours[v87] = READ_LE_UINT16(v86 + 2 * v124); + _vm->_globals.super_parcours[v87 + 1] = READ_LE_UINT16(v86 + 2 * v124 + 2); + _vm->_globals.super_parcours[v87 + 2] = READ_LE_UINT16(v86 + 2 * v124 + 4); + _vm->_globals.super_parcours[v87 + 3] = 0; + v124 += 3; + v137 += 4; + if (READ_LE_UINT16(v86 + 2 * v124) == -1 && READ_LE_UINT16(v86 + 2 * v124 + 2) == -1) + v134 = 1; + } while (v134 != 1); + goto LABEL_312; + } + if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { + NV_LIGNEDEP = v142; + NV_LIGNEOFS = v143; + v135 = 0; + v125 = 0; + v88 = _vm->_globals.essai0; + do { + v89 = v137; + _vm->_globals.super_parcours[v89] = READ_LE_UINT16(v88 + 2 * v125); + _vm->_globals.super_parcours[v89 + 1] = READ_LE_UINT16(v88 + 2 * v125 + 2); + _vm->_globals.super_parcours[v89 + 2] = READ_LE_UINT16(v88 + 2 * v125 + 4); + _vm->_globals.super_parcours[v89 + 3] = 0; + v125 += 3; + v137 += 4; + if (READ_LE_UINT16(v88 + 2 * v125) == -1 && READ_LE_UINT16(v88 + 2 * v125 + 2) == -1) + v135 = 1; + } while (v135 != 1); + goto LABEL_323; + } + } + } + return 0; + } +LABEL_217: + if (v114 < a3) { + v61 = v114; + do { + if (colision2_ligne(v61, a4, &v139, &v138, 0, TOTAL_LIGNES) == 1) { + if (_vm->_objectsManager.DERLIGNE < v138) { + v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); + if (v62 == -1) + goto LABEL_195; + v117 = v62; + if (NVPX != -1) { + if (NVPY != -1) { + v54 = NVPX; + v93 = NVPY; + colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); +LABEL_235: + if (colResult == 1 && v138 <= _vm->_objectsManager.DERLIGNE) + goto LABEL_249; + goto LABEL_203; + } + } + } + if (v138 <= _vm->_objectsManager.DERLIGNE) + goto LABEL_249; + } + v63 = v117; + v64 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v63, v61); + WRITE_LE_UINT16(v64 + 2 * v63 + 2, a4); + WRITE_LE_UINT16(v64 + 2 * v63 + 4, 3); + v117 += 3; + ++v61; + } while (a3 > v61); + } + if (v114 > a3) { + v65 = v114; + do { + if (colision2_ligne(v65, a4, &v139, &v138, 0, TOTAL_LIGNES) == 1) { + if (_vm->_objectsManager.DERLIGNE < v138) { + v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3); + if (v66 == -1) + goto LABEL_242; + v117 = v66; + if (NVPX != -1) { + if (NVPY != -1) { + v54 = NVPX; + v93 = NVPY; + v67 = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); + goto LABEL_235; + } + } + } + if (v138 <= _vm->_objectsManager.DERLIGNE) + goto LABEL_249; + } + v68 = v117; + v69 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v68, v65); + WRITE_LE_UINT16(v69 + 2 * v68 + 2, a4); + WRITE_LE_UINT16(v69 + 2 * v68 + 4, 7); + v117 += 3; + --v65; + } while (a3 < v65); + } + v138 = -1; +LABEL_241: + v70 = v117; + v71 = _vm->_globals.essai2; + WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v70, (uint16)-1); + WRITE_LE_UINT16(v71 + 2 * v70 + 2, (uint16)-1); + WRITE_LE_UINT16(v71 + 2 * v70 + 4, (uint16)-1); +LABEL_242: + if (v117) { + v129 = 0; + v119 = 0; + v72 = _vm->_globals.essai2; + do { + v73 = v137; + _vm->_globals.super_parcours[v73] = READ_LE_UINT16(v72 + 2 * v119); + _vm->_globals.super_parcours[v73 + 1] = READ_LE_UINT16(v72 + 2 * v119 + 2); + _vm->_globals.super_parcours[v73 + 2] = READ_LE_UINT16(v72 + 2 * v119 + 4); + _vm->_globals.super_parcours[v73 + 3] = 0; + v119 += 3; + v137 += 4; + if (READ_LE_UINT16(v72 + 2 * v119) == -1 && READ_LE_UINT16(v72 + 2 * v119 + 2) == -1) + v129 = 1; + } while (v129 != 1); + } +LABEL_248: + v74 = v137; + _vm->_globals.super_parcours[v74] = -1; + _vm->_globals.super_parcours[v74 + 1] = -1; + _vm->_globals.super_parcours[v74 + 2] = -1; + _vm->_globals.super_parcours[v74 + 3] = -1; + return 1; +} + +int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + + v4 = a1 - a3; + if (a1 - a3 < 0) + v4 = -v4; + v5 = v4 + 1; + v11 = a2 - a4; + if (a2 - a4 < 0) + v11 = -(a2 - a4); + v13 = v11 + 1; + if (v5 > (int)(v11 + 1)) + v13 = v5; + if (v13 <= 10) + return -1; + v6 = v13 - 1; + v16 = 1000 * v5 / v6; + v15 = 1000 * (int)(v11 + 1) / v6; + if (a3 < a1) + v16 = -v16; + if (a4 < a2) + v15 = -v15; + v7 = 1000 * a1; + v8 = 1000 * a2; + v9 = 1000 * a1 / 1000; + v12 = 1000 * a2 / 1000; + v14 = 0; + if (v13 + 1 > 0) { + while (colision2_ligne(v9, v12, &v18, &v17, 0, TOTAL_LIGNES) != 1 || v17 > _vm->_objectsManager.DERLIGNE) { + v7 += v16; + v8 += v15; + v9 = v7 / 1000; + v12 = v8 / 1000; + ++v14; + if (v14 >= v13 + 1) + return 0; + } + return -1; + } return 0; } +int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49; + int v50; + int v51; + int v52; + int v53; + int v54; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; + + warning("TODO: SMOOTH_MOVE - a1 = a4 doesn't look like that in the IDB, need to double-check"); + v62 = a3; + a1 = a4; + if (a3 >= a5 || a6 >= a4) { + if (a3 <= a5 || a6 >= a4) { + if (a3 >= a5 || a6 <= a4) { + if (a3 > a5 && a6 > a4) { + v53 = 36; + v61 = 0; + v57 = 0; + do { + v25 = _vm->_globals.Hopkins[v53].field0; + v40 = _vm->_globals.Hopkins[v53].field2; + v26 = _vm->_globals.STAILLE[a1]; + if (v26 < 0) { + v27 = v26; + v28 = v26; + if (v26 < 0) + v28 = -v26; + v48 = _vm->_globals.STAILLE[a1]; + v45 = a1; + v25 = _vm->_graphicsManager.Reel_Reduc(v25, v28); + v29 = v27; + if ((v27 & 0x80000000u) != 0) + v29 = -v27; + v40 = _vm->_graphicsManager.Reel_Reduc(v40, v29); + a1 = v45; + v26 = v48; + } + if (v26 > 0) { + v30 = v26; + v31 = v26; + if (v26 < 0) + v31 = -v26; + v46 = a1; + v25 = _vm->_graphicsManager.Reel_Zoom(v25, v31); + v32 = v30; + if ((v30 & 0x80000000u) != 0) + v32 = -v30; + v40 = _vm->_graphicsManager.Reel_Zoom(v40, v32); + a1 = v46; + } + v33 = a1 + v40; + v34 = 0; + if (v25 > 0) { + do { + --v62; + SMOOTH[v61].field0 = v62; + if (a1 != v33) + a1 = a1 + 1; + SMOOTH[v61++].field2 = a1; + ++v34; + } while (v34 < v25); + } + ++v53; + if (v53 == 48) + v53 = 36; + ++v57; + if (v62 <= a5 || a6 <= a1) + v49 = 1; + } while (v49 != 1); + if (v57 > 5) { + v35 = v61; + SMOOTH[v35].field0 = -1; + SMOOTH[v35].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 6; + goto LABEL_85; + } + } + } else { + v52 = 36; + v60 = 0; + v56 = 0; + do { + v14 = _vm->_globals.Hopkins[v52].field0; + v39 = _vm->_globals.Hopkins[v52].field2; + v15 = _vm->_globals.STAILLE[a1]; + if (v15 < 0) { + v16 = v15; + v17 = v15; + if (v15 < 0) + v17 = -v15; + v47 = _vm->_globals.STAILLE[a1]; + v43 = a1; + v14 = _vm->_graphicsManager.Reel_Reduc(v14, v17); + v18 = v16; + if ((v16 & 0x80000000u) != 0) + v18 = -v16; + v39 = _vm->_graphicsManager.Reel_Reduc(v39, v18); + a1 = v43; + v15 = v47; + } + if (v15 > 0) { + v19 = v15; + v20 = v15; + if (v15 < 0) + v20 = -v15; + v44 = a1; + v14 = _vm->_graphicsManager.Reel_Zoom(v14, v20); + v21 = v19; + if ((v19 & 0x80000000u) != 0) + v21 = -v19; + v39 = _vm->_graphicsManager.Reel_Zoom(v39, v21); + a1 = v44; + } + v22 = a1 + v39; + v23 = 0; + if (v14 > 0) { + do { + ++v62; + SMOOTH[v60].field0 = v62; + if (a1 != v22) + a1 = a1 + 1; + SMOOTH[v60++].field2 = a1; + ++v23; + } while (v23 < v14); + } + ++v52; + if (v52 == 48) + v52 = 36; + ++v56; + if (v62 >= a5 || a6 <= (int)a1) + v49 = 1; + } while (v49 != 1); + if (v56 > 5) { + v24 = v60; + SMOOTH[v24].field0 = -1; + SMOOTH[v24].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 4; + goto LABEL_85; + } + } + } else { + v51 = 12; + v59 = 0; + v55 = 0; + do { + v10 = _vm->_globals.Hopkins[v51].field2; + v42 = a1; + v11 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v51].field0, 0x19u); + v38 = _vm->_graphicsManager.Reel_Reduc(v10, 0x19u); + a1 = v42; + v12 = 0; + if (v11 > 0) { + do { + --v62; + SMOOTH[v59].field0 = v62; + if ((uint16)a1 != (uint16)v42 + v38) + a1 = a1 - 1; + SMOOTH[v59++].field2 = a1; + ++v12; + } while (v12 < v11); + } + ++v51; + if (v51 == 24) + v51 = 12; + ++v55; + if (v62 <= a5 || a6 >= (int)a1) + v49 = 1; + } while (v49 != 1); + if (v55 > 5) { + v13 = 4 * v59; + SMOOTH[v13].field0 = -1; + SMOOTH[v13].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 8; + goto LABEL_85; + } + } + } else { + v50 = 12; + v58 = 0; + v54 = 0; + do { + v6 = _vm->_globals.Hopkins[v50].field2; + v41 = a1; + v7 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v50].field0, 0x19u); + v37 = _vm->_graphicsManager.Reel_Reduc(v6, 0x19u); + a1 = v41; + v8 = 0; + if (v7 > 0) { + do { + ++v62; + SMOOTH[v58].field0 = v62; + if ((uint16)a1 != (uint16)v41 + v37) + a1 = a1 - 1; + SMOOTH[v58++].field2 = a1; + ++v8; + } while (v8 < v7); + } + ++v50; + if (v50 == 24) + v50 = 12; + ++v54; + if (v62 >= a5 || a6 >= (int)a1) + v49 = 1; + } while (v49 != 1); + if (v54 > 5) { + v9 = v58; + SMOOTH[v9].field0 = -1; + SMOOTH[v9].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 2; +LABEL_85: + SMOOTH_X = v62; + SMOOTH_Y = a1; + return 0; + } + } + return -1; +} } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 8cbae6ba08..33cb0cd7d2 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -46,17 +46,27 @@ struct LigneItem { byte *field12; }; +struct SmoothItem { + int field0; + int field2; +}; + class LinesManager { private: HopkinsEngine *_vm; public: LigneZoneItem LigneZone[401]; LigneItem Ligne[400]; + SmoothItem SMOOTH[4000]; int next_ligne; int TOTAL_LIGNES; int NV_LIGNEDEP; int NV_LIGNEOFS; int NV_POSI; + int NVPX; + int NVPY; + int SMOOTH_SENS; + int SMOOTH_X, SMOOTH_Y; public: void setParent(HopkinsEngine *vm); @@ -75,6 +85,8 @@ public: int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, byte *a8, int a9); byte *PARCOURS2(int a1, int a2, int a3, int a4); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); + int VERIF_SMOOTH(int a1, int a2, int a3, int a4); + int SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6); }; } // End of namespace Hopkins -- cgit v1.2.3 From bc863bd24194a3578505dd151fc3a981a98dbc45 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 3 Oct 2012 22:15:39 +1000 Subject: HOPKINS: Implemented more stubbed object manager methods --- engines/hopkins/anim.cpp | 15 - engines/hopkins/anim.h | 2 - engines/hopkins/globals.h | 9 +- engines/hopkins/graphics.cpp | 4 + engines/hopkins/graphics.h | 1 + engines/hopkins/hopkins.cpp | 32 +- engines/hopkins/lines.cpp | 94 +++- engines/hopkins/lines.h | 2 + engines/hopkins/objects.cpp | 1201 ++++++++++++++++++++++++++++++++---------- engines/hopkins/objects.h | 19 +- engines/hopkins/talk.cpp | 40 +- 11 files changed, 1065 insertions(+), 354 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 2cc147df58..7733358a6f 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -293,21 +293,6 @@ bool AnimationManager::REDRAW_ANIM() { return false; } -void AnimationManager::BOBANIM_ON(int idx) { - if (GLOBALS.Bob[idx].field16) { - GLOBALS.Bob[idx].field16 = 0; - GLOBALS.Bob[idx].field10 = 5; - GLOBALS.Bob[idx].fieldC = 250; - GLOBALS.Bob[idx].field12 = 0; - GLOBALS.Bob[idx].field14 = 0; - } -} - -void AnimationManager::BOBANIM_OFF(int idx) { - GLOBALS.Bob[idx].field16 = 1; - -} - void AnimationManager::CHARGE_ANIM(const Common::String &animName) { byte v20[15]; char header[10]; diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 8373b00104..60eb71b940 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -46,8 +46,6 @@ public: void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); void PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4); bool REDRAW_ANIM(); - void BOBANIM_ON(int idx); - void BOBANIM_OFF(int idx); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index d254ecde48..3c81d6af19 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -220,10 +220,12 @@ enum SauvegardeOffset { , svField95 , svField121 , svField122 + , svField132 , svField133 , svField170 , svField171 , svField172 + , svField173 , svField176 , svField180 , svField181 @@ -243,7 +245,9 @@ enum SauvegardeOffset { , svField228 , svField253 , svField231 + , svField261 , svField270 + , svField333 , svField338 , svField339 , svField340 @@ -360,7 +364,7 @@ public: int largeur_boite; byte *INVENTAIRE_OBJET; int hauteur_boite; - bool GESTE_FLAG; + int GESTE_FLAG; byte *FORETSPR; int FORET; byte *COUCOU; @@ -418,8 +422,9 @@ public: int NECESSAIRE; int Compteur; int ACTION_SENS; - int STOP_BUG; int SegmentEnCours; + int STOP_BUG; + bool NO_OFFSET; int force_to_data_0; int oldzone_46; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 76782cf4d8..38193e62c5 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2403,4 +2403,8 @@ void GraphicsManager::NB_SCREEN() { DD_VBL(); } +void GraphicsManager::SHOW_PALETTE() { + warning("TODO: SHOW_PALETTE"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 60c972957c..dc6ad04fba 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -177,6 +177,7 @@ public: void INI_ECRAN2(const Common::String &file); void OPTI_INI(const Common::String &file, int a2); void NB_SCREEN(); + void SHOW_PALETTE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5bc6d399fb..5d01582b26 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -666,8 +666,8 @@ void HopkinsEngine::INTRORUN() { _animationManager.CHARGE_ANIM("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); - _animationManager.BOBANIM_OFF(3); - _animationManager.BOBANIM_OFF(5); + _objectsManager.BOBANIM_OFF(3); + _objectsManager.BOBANIM_OFF(5); _graphicsManager.ofscroll = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -687,9 +687,9 @@ void HopkinsEngine::INTRORUN() { for (i = 0; i < 200 / _globals.vitesse; ++i) _eventsManager.VBL(); - _animationManager.BOBANIM_ON(3); + _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(5, 3); - _animationManager.BOBANIM_OFF(3); + _objectsManager.BOBANIM_OFF(3); _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); v21 = *(uint16 *)&_graphicsManager.Palette[796]; @@ -708,9 +708,9 @@ void HopkinsEngine::INTRORUN() { _animationManager.CHARGE_ANIM("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); - _animationManager.BOBANIM_OFF(3); - _animationManager.BOBANIM_OFF(5); - _animationManager.BOBANIM_OFF(1); + _objectsManager.BOBANIM_OFF(3); + _objectsManager.BOBANIM_OFF(5); + _objectsManager.BOBANIM_OFF(1); _graphicsManager.ofscroll = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -731,11 +731,11 @@ void HopkinsEngine::INTRORUN() { while (!_eventsManager.ESC_KEY) { if (v9 == 12) { - _animationManager.BOBANIM_ON(3); + _objectsManager.BOBANIM_ON(3); _eventsManager.VBL(); _soundManager.VOICE_MIX(6, 3); _eventsManager.VBL(); - _animationManager.BOBANIM_OFF(3); + _objectsManager.BOBANIM_OFF(3); } Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); @@ -777,13 +777,13 @@ void HopkinsEngine::INTRORUN() { for (j = 1; j < 100 / _globals.vitesse; ++j) _eventsManager.VBL(); - _animationManager.BOBANIM_ON(3); + _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); - _animationManager.BOBANIM_OFF(3); + _objectsManager.BOBANIM_OFF(3); for (k = 1; k < 60 / _globals.vitesse; ++k) _eventsManager.VBL(); - _animationManager.BOBANIM_ON(5); + _objectsManager.BOBANIM_ON(5); for (l = 0; l < 20 / _globals.vitesse; ++l) _eventsManager.VBL(); @@ -792,9 +792,9 @@ void HopkinsEngine::INTRORUN() { for (m = 0; m < 50 / _globals.vitesse; ++m) { if (m == 30 / _globals.vitesse) { - _animationManager.BOBANIM_ON(3); + _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(8, 3); - _animationManager.BOBANIM_OFF(3); + _objectsManager.BOBANIM_OFF(3); } _eventsManager.VBL(); @@ -880,7 +880,7 @@ void HopkinsEngine::BOOM() { _graphicsManager.LOAD_IMAGE("IM15"); _animationManager.CHARGE_ANIM("ANIM15"); _graphicsManager.VISU_ALL(); - _animationManager.BOBANIM_OFF(7); + _objectsManager.BOBANIM_OFF(7); _globals.BPP_NOAFF = 1; for (int idx = 0; idx < 5; ++idx) { @@ -898,7 +898,7 @@ void HopkinsEngine::BOOM() { _globals.NOPARLE = true; _talkManager.PARLER_PERSO2("vire.pe2"); _globals.NOPARLE = false; - _animationManager.BOBANIM_ON(7); + _objectsManager.BOBANIM_ON(7); for (int idx = 0; idx < 100; ++idx) { _eventsManager.VBL(); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 3bc29f03f1..55ad7761b6 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -39,6 +39,74 @@ void LinesManager::CLEAR_ZONE() { next_ligne = 0; } +int LinesManager::ZONE_OBJET(int a1, int a2) { + int v2; + + v2 = 0; + if ((uint)(a2 - 120) <= 0x21u) + v2 = OPTI_ZONE(a1, 1, 0); + if ((uint)(a2 - 154) <= 0x25u) + v2 = OPTI_ZONE(a1, 7, 0); + if ((uint)(a2 - 192) <= 0x25u) + v2 = OPTI_ZONE(a1, 13, 0); + if ((uint)(a2 - 230) <= 0x25u) + v2 = OPTI_ZONE(a1, 19, 0); + if ((uint)(a2 - 268) <= 0x25u) + v2 = OPTI_ZONE(a1, 25, 1); + if ((uint)(a2 - 268) <= 0x14u && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) + v2 = 30; + if ((uint)(a2 - 290) <= 0x10u && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) + v2 = 31; + if (a1 < _vm->_graphicsManager.ofscroll + 152 || a1 > _vm->_graphicsManager.ofscroll + 484) + v2 = 32; + if ((uint)(a2 - 114) > 0xC0u) + v2 = 32; + return v2; +} + +int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { + int v3; + signed int v4; + + v3 = a2; + v4 = 0; + if (a1 >= _vm->_graphicsManager.ofscroll + 158 && a1 <= _vm->_graphicsManager.ofscroll + 208) + v4 = 1; + if (!v4) { + if (a1 >= _vm->_graphicsManager.ofscroll + 208 && a1 <= _vm->_graphicsManager.ofscroll + 266) { + v3 = a2 + 1; + v4 = 1; + } + if (!v4) { + if (a1 >= _vm->_graphicsManager.ofscroll + 266 && a1 <= _vm->_graphicsManager.ofscroll + 320) { + v3 += 2; + v4 = 1; + } + if (!v4) { + if (a1 >= _vm->_graphicsManager.ofscroll + 320 && a1 <= _vm->_graphicsManager.ofscroll + 370) { + v3 += 3; + v4 = 1; + } + if (!v4) { + if (a1 >= _vm->_graphicsManager.ofscroll + 370 && a1 <= _vm->_graphicsManager.ofscroll + 424) { + v3 += 4; + v4 = 1; + } + if (!v4) { + if (!a3 && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) { + v3 += 5; + v4 = 1; + } + if (!v4) + v3 = 0; + } + } + } + } + } + return v3; +} + void LinesManager::RETIRE_LIGNE_ZONE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); @@ -858,21 +926,21 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int v31; int v32; int v33; - int v35; - int v36; + int v35 = 0; + int v36 = 0; int v37; int v38; int v39; int v40; int v41; - int v42; - int v43; - int v44; - int v45; - int v46; - int v47; - int v48; - int v49; + int v42 = 0; + int v43 = 0; + int v44 = 0; + int v45 = 0; + int v46 = 0; + int v47 = 0; + int v48 = 0; + int v49 = 0; int v50; int v51; @@ -2473,7 +2541,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v123; int v124; int v125; - int v126; + int v126 = 0; int v127; int v128; int v129; @@ -2493,7 +2561,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v143; int v144; int v145; - int colResult; + int colResult = 0; v7 = a1; v90 = a2; @@ -3279,7 +3347,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { int v46; int v47; int v48; - int v49; + int v49 = 0; int v50; int v51; int v52; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 33cb0cd7d2..4baee6cb77 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -71,6 +71,8 @@ public: void setParent(HopkinsEngine *vm); void CLEAR_ZONE(); + int ZONE_OBJET(int a1, int a2); + int OPTI_ZONE(int a1, int a2, int a3); void RETIRE_LIGNE_ZONE(int idx); void AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6); void RESET_OBSTACLE(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6771f24958..76ac105f87 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2275,7 +2275,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.CLEAR_VBOB(); _vm->_animationManager.CLEAR_ANIM(); _vm->_linesManager.CLEAR_ZONE(); - RESET_OBSTACLE(); + _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); v1 = 0; @@ -2418,7 +2418,7 @@ LABEL_7: v9 = _vm->_eventsManager.YMOUSE(); v12 = _vm->_eventsManager.BMOUSE(); v10 = v13; - v11 = ZONE_OBJET(v8, v9); + v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); v13 = v11; if (v11 != v10) PARAMCADRE(v11); @@ -2474,7 +2474,7 @@ LABEL_7: break; _vm->_eventsManager.VBL(); if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) - SPECIAL_JEU(v9); + SPECIAL_JEU(); } _vm->_fontManager.TEXTE_OFF(9); if (AFFINVEN == 1) { @@ -3463,21 +3463,152 @@ LABEL_58: return result; } -void ObjectsManager::RESET_OBSTACLE() { - warning("TODO: CLEAR_ZONE"); -} - -int ObjectsManager::ZONE_OBJET(int a1, int a2) { - warning("TODO: ZONE_OBJET"); - return 0; -} - void ObjectsManager::PARAMCADRE(int a1) { - warning("TODO: PARAMCADRE"); + old_cadx = cadx; + old_cady = cady; + old_cadi = cadi; + if ((uint16)(a1 - 1) <= 5u) + cady = 120; + if ((uint16)(a1 - 7) <= 5u) + cady = 158; + if ((uint16)(a1 - 13) <= 5u) + cady = 196; + if ((uint16)(a1 - 19) <= 5u) + cady = 234; + if ((uint16)(a1 - 25) <= 4u) + cady = 272; + if (a1 == 1 || a1 == 7 || a1 == 13 || a1 == 19 || a1 == 25) + cadx = _vm->_graphicsManager.ofscroll + 158; + if (a1 == 2 || a1 == 8 || a1 == 14 || a1 == 20 || a1 == 26) + cadx = _vm->_graphicsManager.ofscroll + 212; + if (a1 == 3 || a1 == 9 || a1 == 15 || a1 == 21 || a1 == 27) + cadx = _vm->_graphicsManager.ofscroll + 266; + if (a1 == 4 || a1 == 10 || a1 == 16 || a1 == 22 || a1 == 28) + cadx = _vm->_graphicsManager.ofscroll + 320; + if (a1 == 5 || a1 == 11 || a1 == 17 || a1 == 23 || a1 == 29) + cadx = _vm->_graphicsManager.ofscroll + 374; + if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u) + cadx = _vm->_graphicsManager.ofscroll + 428; + if ((uint16)(a1 - 1) <= 0x1Cu) + cadi = 0; + if ((uint16)(a1 - 30) <= 1u) + cadi = 2; + if (a1 == 30) + cady = 272; + if (a1 == 31) + cady = 290; + if (!a1 || a1 == 32) { + cadx = 0; + cady = 0; + cadi = 0; + } + if (!a1) + _vm->_eventsManager.btsouris = 0; + if (a1 == 32) + _vm->_eventsManager.btsouris = 16; + if (a1 == 30) + _vm->_eventsManager.btsouris = 2; + if (a1 == 31) + _vm->_eventsManager.btsouris = 3; + if ((uint16)(a1 - 1) <= 0x1Cu) + _vm->_eventsManager.btsouris = 8; + if (a1 == 29) + _vm->_eventsManager.btsouris = 1; + if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals.INVENTAIRE[a1]) { + _vm->_eventsManager.btsouris = 0; + cadx = 0; + cady = 0; + cadi = 0; + } + if (_vm->_eventsManager.btsouris != 23) + _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + _vm->_eventsManager.XMOUSE(); + _vm->_eventsManager.YMOUSE(); } -void ObjectsManager::OBJETPLUS(int a1) { - warning("TODO: OBJETPLUS"); +void ObjectsManager::OBJETPLUS(int idx) { + int v1; + int v2; + int v3; + + v1 = _vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris && _vm->_eventsManager.btsouris != 16 && (uint16)(_vm->_eventsManager.btsouris - 2) > 1u) { + v2 = _vm->_eventsManager.btsouris++ + 1; + if (v1 == 5) + goto LABEL_24; + if (v2 == 7) + goto LABEL_26; + if (v2 != 8) { + if (v2 == 9) + _vm->_eventsManager.btsouris = 10; + if (_vm->_eventsManager.btsouris == 10) + goto LABEL_29; + if (_vm->_eventsManager.btsouris == 11) + goto LABEL_31; + if (_vm->_eventsManager.btsouris == 12) + _vm->_eventsManager.btsouris = 13; + if (_vm->_eventsManager.btsouris == 13) + goto LABEL_33; + if (_vm->_eventsManager.btsouris == 14) + _vm->_eventsManager.btsouris = 15; + if (_vm->_eventsManager.btsouris == 15) + goto LABEL_35; + if ((uint16)(_vm->_eventsManager.btsouris - 16) <= 6u) + _vm->_eventsManager.btsouris = 23; + if (_vm->_eventsManager.btsouris == 23) + goto LABEL_37; + if (_vm->_eventsManager.btsouris == 24) + _vm->_eventsManager.btsouris = 25; + if (_vm->_eventsManager.btsouris == 25) + goto LABEL_39; + do { + _vm->_eventsManager.btsouris = 6; +LABEL_24: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field2 == 1) + break; + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 7) { +LABEL_26: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field3 == 1) + return; + } + v3 = _vm->_eventsManager.btsouris++; + if (_vm->_eventsManager.btsouris == 8) + break; + _vm->_eventsManager.btsouris = v3 + 3; + if (v3 == 7) { +LABEL_29: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field7 == 1) + return; + } + ++_vm->_eventsManager.btsouris; + if (_vm->_eventsManager.btsouris == 11) { +LABEL_31: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field4 == 1) + return; + } + _vm->_eventsManager.btsouris += 2; + if (_vm->_eventsManager.btsouris == 13) { +LABEL_33: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field5 == 1) + return; + } + _vm->_eventsManager.btsouris += 2; + if (_vm->_eventsManager.btsouris == 15) { +LABEL_35: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field6 == 1) + return; + } + _vm->_eventsManager.btsouris = 23; +LABEL_37: + if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field6 == 2) + break; + _vm->_eventsManager.btsouris = 25; +LABEL_39: + ; + } while (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field7 != 2); + } + } } void ObjectsManager::VALID_OBJET(int a1) { @@ -3486,11 +3617,170 @@ void ObjectsManager::VALID_OBJET(int a1) { } void ObjectsManager::OPTI_OBJET() { - warning("TODO: OPTI_OBJET"); + byte *data; + Common::String file; + int v0 = 1; + int v5; + int v7; + + file = "OBJET1.ini"; + data = FileManager::RECHERCHE_CAT(file, 1); + if (data == PTRNUL) { + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + data = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + + if ((data == PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { + error("Not an INI file"); + } else { + v7 = 0; + do { + v5 = Traduction(data + 20 * v0); + if (v5 == 2) + v0 = Control_Goto(data + 20 * v0); + if (v5 == 3) + v0 = Control_If(data, v0); + if (v0 == -1) + error("defective IFF function"); + if (v5 == 1 || v5 == 4) + ++v0; + if (!v5 || v5 == 5) + v7 = 1; + } while (v7 != 1); + } + _vm->_globals.dos_free2(data); } -void ObjectsManager::SPECIAL_JEU(int a1) { - warning("TODO: SPECIAL_JEU"); +void ObjectsManager::SPECIAL_JEU() { + byte *v1; + byte *v2; + byte *v3; + + if ((uint16)(_vm->_globals.ECRAN - 35) <= 6u) { + if (_vm->_globals.OLD_ECRAN == 16 && _vm->_globals.ECRAN == 35) + TEST_FORET(35, 500, 555, 100, 440, 1); + if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals.ECRAN == 35) + TEST_FORET(35, 6, 84, 100, 440, 4); + if (_vm->_globals.OLD_ECRAN == 35 && _vm->_globals.ECRAN == 36) + TEST_FORET(36, 551, 633, 100, 440, 2); + if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals.ECRAN == 36) + TEST_FORET(36, 6, 84, 100, 440, 4); + if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals.ECRAN == 37) + TEST_FORET(37, 551, 633, 100, 440, 1); + if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals.ECRAN == 37) + TEST_FORET(37, 392, 529, 100, 440, 2); + if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals.ECRAN == 38) + TEST_FORET(38, 133, 252, 100, 440, 4); + if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals.ECRAN == 38) + TEST_FORET(38, 6, 84, 100, 440, 3); + if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals.ECRAN == 39) + TEST_FORET(39, 551, 633, 100, 440, 2); + if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals.ECRAN == 39) + TEST_FORET(39, 6, 84, 100, 440, 3); + if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals.ECRAN == 40) + TEST_FORET(40, 133, 252, 100, 440, 4); + if (_vm->_globals.OLD_ECRAN == 41 && _vm->_globals.ECRAN == 40) + TEST_FORET(40, 392, 529, 100, 440, 2); + if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals.ECRAN == 41) + TEST_FORET(41, 551, 633, 100, 440, 1); + if (_vm->_globals.OLD_ECRAN == 17 && _vm->_globals.ECRAN == 41) + TEST_FORET(41, 6, 84, 100, 440, 3); + } + if (_vm->_globals.ECRAN == 5) { + if (YSPR(0) <= 399) { + if (!_vm->_globals.SAUVEGARDE->data[svField173]) { + _vm->_globals.SAUVEGARDE->data[svField173] = 1; + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); + _vm->_globals.NOPARLE = 0; + if (!_vm->_globals.CENSURE) { + v1 = _vm->_globals.dos_malloc2(0x3E8u); + memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); + FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (!_vm->_graphicsManager.nbrligne) + _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_soundManager.SPECIAL_SOUND = 198; + _vm->_objectsManager.PERSO_ON = 1; + _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.CLS_ANM = 0; + _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); + _vm->_animationManager.NO_SEQ = 0; + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_globals.NECESSAIRE = 1; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_globals.NECESSAIRE = 0; + FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_objectsManager.PERSO_ON = 0; + memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); + _vm->_graphicsManager.SHOW_PALETTE(); + _vm->_globals.dos_free2(v1); + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + } + _vm->_graphicsManager.DD_Unlock(); + v2 = _vm->_graphicsManager.VESA_BUFFER; + v3 = _vm->_graphicsManager.VESA_SCREEN; + memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); + v3 = v3 + 614396; + v2 = v2 + 614396; + *v2 = *v3; + v2 = v2 + 2; + *v2 = *(v3 + 2); + + _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager.DD_VBL(); + } + } + } + } + if (_vm->_globals.ECRAN == 20) + _vm->_globals.SAUVEGARDE->data[svField132] = XSPR(0) > 65 + && XSPR(0) <= 124 + && YSPR(0) > 372 + && YSPR(0) <= 398; + if (_vm->_globals.ECRAN == 57) { + _vm->_globals.DESACTIVE_INVENT = 1; + if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { + _vm->_objectsManager.BOBANIM_OFF(5); + SET_BOBPOSI(5, 0); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_globals.SAUVEGARDE->data[svField261] = 2; + ZONE_OFF(15); + _vm->_soundManager.PLAY_SOUND("SOUND75.WAV"); + } + if (_vm->_globals.SAUVEGARDE->data[svField261] == 2 && BOBPOSI(6) == 6) { + _vm->_objectsManager.BOBANIM_OFF(6); + SET_BOBPOSI(6, 0); + _vm->_objectsManager.BOBANIM_ON(7); + ZONE_ON(14); + _vm->_globals.SAUVEGARDE->data[svField261] = 3; + } + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (_vm->_globals.ECRAN == 93 && !_vm->_globals.SAUVEGARDE->data[svField333]) { + _vm->_globals.DESACTIVE_INVENT = 1; + do + _vm->_eventsManager.VBL(); + while (BOBPOSI(8) != 3); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("GM3.PE2"); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_globals.SAUVEGARDE->data[svField333] = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } } int ObjectsManager::Traduction(byte *a1) { @@ -4060,9 +4350,9 @@ LABEL_1141: if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { v75 = READ_LE_UINT16(a1 + 5); if (v75 <= 100) - _vm->_animationManager.BOBANIM_ON(v75); + _vm->_objectsManager.BOBANIM_ON(v75); else - _vm->_animationManager.BOBANIM_OFF(v75 - 100); + _vm->_objectsManager.BOBANIM_OFF(v75 - 100); v1 = 1; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { @@ -4179,36 +4469,36 @@ LABEL_1141: _vm->_globals.NBBLOC = 0; } if (v76 == 608) { - _vm->_animationManager.BOBANIM_OFF(2); - _vm->_animationManager.BOBANIM_OFF(3); - _vm->_animationManager.BOBANIM_OFF(4); - _vm->_animationManager.BOBANIM_OFF(6); - _vm->_animationManager.BOBANIM_OFF(11); - _vm->_animationManager.BOBANIM_OFF(10); + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_OFF(11); + _vm->_objectsManager.BOBANIM_OFF(10); } if (v76 == 609) { - _vm->_animationManager.BOBANIM_ON(2); - _vm->_animationManager.BOBANIM_ON(3); - _vm->_animationManager.BOBANIM_ON(4); - _vm->_animationManager.BOBANIM_ON(6); - _vm->_animationManager.BOBANIM_ON(11); - _vm->_animationManager.BOBANIM_ON(10); + _vm->_objectsManager.BOBANIM_ON(2); + _vm->_objectsManager.BOBANIM_ON(3); + _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_ON(11); + _vm->_objectsManager.BOBANIM_ON(10); } if (v76 == 611) { - _vm->_animationManager.BOBANIM_ON(5); - _vm->_animationManager.BOBANIM_ON(7); - _vm->_animationManager.BOBANIM_ON(8); - _vm->_animationManager.BOBANIM_ON(9); - _vm->_animationManager.BOBANIM_ON(12); - _vm->_animationManager.BOBANIM_ON(13); + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.BOBANIM_ON(8); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.BOBANIM_ON(13); } if (v76 == 610) { - _vm->_animationManager.BOBANIM_OFF(5); - _vm->_animationManager.BOBANIM_OFF(7); - _vm->_animationManager.BOBANIM_OFF(8); - _vm->_animationManager.BOBANIM_OFF(9); - _vm->_animationManager.BOBANIM_OFF(12); - _vm->_animationManager.BOBANIM_OFF(13); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(13); } if (v76 == 10) _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); @@ -4245,7 +4535,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(3) != 100); + while (BOBPOSI(3) != 100); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.FIN_VISU(); if (!_vm->_globals.CENSURE) { @@ -4347,53 +4637,53 @@ LABEL_1141: OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); v15 = 0; do { - if ((uint16)BOBPOSI(9) == 4 && !v15) { + if (BOBPOSI(9) == 4 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; } - if ((uint16)BOBPOSI(9) == 5) + if (BOBPOSI(9) == 5) v15 = 0; - if ((uint16)BOBPOSI(9) == 16 && !v15) { + if (BOBPOSI(9) == 16 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; } - if ((uint16)BOBPOSI(9) == 17) + if (BOBPOSI(9) == 17) v15 = 0; - if ((uint16)BOBPOSI(9) == 28 && !v15) { + if (BOBPOSI(9) == 28 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; } - if ((uint16)BOBPOSI(9) == 29) + if (BOBPOSI(9) == 29) v15 = 0; - if ((uint16)BOBPOSI(10) == 10 && !v15) { + if (BOBPOSI(10) == 10 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = 1; } - if ((uint16)BOBPOSI(10) == 11) + if (BOBPOSI(10) == 11) v15 = 0; - if ((uint16)BOBPOSI(10) == 22 && !v15) { + if (BOBPOSI(10) == 22 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = 1; } - if ((uint16)BOBPOSI(10) == 23) + if (BOBPOSI(10) == 23) v15 = 0; - if ((uint16)BOBPOSI(10) == 33 && !v15) { + if (BOBPOSI(10) == 33 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = 1; } - if ((uint16)BOBPOSI(10) == 34) + if (BOBPOSI(10) == 34) v15 = 0; - if ((uint16)BOBPOSI(10) == 12) + if (BOBPOSI(10) == 12) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); - if ((uint16)BOBPOSI(10) == 23) + if (BOBPOSI(10) == 23) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); - if ((uint16)BOBPOSI(10) == 34) + if (BOBPOSI(10) == 34) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(9) != 36); + } while (BOBPOSI(9) != 36); SPRITE_ON(0); - _vm->_animationManager.BOBANIM_OFF(9); - _vm->_animationManager.BOBANIM_OFF(10); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(10); _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); } @@ -4412,33 +4702,33 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != PTRNUL); SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(7); + _vm->_objectsManager.BOBANIM_ON(7); SET_BOBPOSI(7, 0); v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); do { - if ((uint16)BOBPOSI(7) == 10 && !v18) { + if (BOBPOSI(7) == 10 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; } - if ((uint16)BOBPOSI(7) == 11) + if (BOBPOSI(7) == 11) v18 = 0; - if ((uint16)BOBPOSI(7) == 18 && !v18) { + if (BOBPOSI(7) == 18 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; } - if ((uint16)BOBPOSI(7) == 19) + if (BOBPOSI(7) == 19) v18 = 0; - if ((uint16)BOBPOSI(7) == 19) - _vm->_animationManager.BOBANIM_ON(3); + if (BOBPOSI(7) == 19) + _vm->_objectsManager.BOBANIM_ON(3); _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(3) != 48); + } while (BOBPOSI(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); SETANISPR(0, 62); SPRITE_ON(0); - _vm->_animationManager.BOBANIM_ON(6); - _vm->_animationManager.BOBANIM_OFF(7); - _vm->_animationManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.BOBANIM_OFF(3); } if (v76 == 50) { _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); @@ -4453,65 +4743,65 @@ LABEL_1141: v19 = 41; v20 = 0; do { - if ((uint16)BOBPOSI(9) == 4 && !v20) { + if (BOBPOSI(9) == 4 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); v20 = 1; } - if ((uint16)BOBPOSI(9) == 5) + if (BOBPOSI(9) == 5) v20 = 0; - if ((uint16)BOBPOSI(9) == 18 && !v20) { + if (BOBPOSI(9) == 18 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); v20 = 1; } - if ((uint16)BOBPOSI(9) == 19) + if (BOBPOSI(9) == 19) v20 = 0; - if ((uint16)BOBPOSI(10) == 11 && !v20) { + if (BOBPOSI(10) == 11 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); v20 = 1; } - if ((uint16)BOBPOSI(10) == 12) + if (BOBPOSI(10) == 12) v20 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(9) != v19); + } while (BOBPOSI(9) != v19); if (v19 == 12) { SPRITE_ON(0); - _vm->_animationManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(9); } _vm->_globals.CACHE_ON(); } if (v76 == 80) { SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(12); - _vm->_animationManager.BOBANIM_ON(13); + _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.BOBANIM_ON(13); SET_BOBPOSI(12, 0); SET_BOBPOSI(13, 0); v21 = 0; _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); do { - if ((uint16)BOBPOSI(12) == 4 && !v21) { + if (BOBPOSI(12) == 4 && !v21) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); v21 = 1; } - if ((uint16)BOBPOSI(12) == 5) + if (BOBPOSI(12) == 5) v21 = 0; - if ((uint16)BOBPOSI(4) == 5 && !v21) { + if (BOBPOSI(4) == 5 && !v21) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); v21 = 1; } - if ((uint16)BOBPOSI(4) == 6) + if (BOBPOSI(4) == 6) v21 = 0; - if ((uint16)BOBPOSI(13) == 8) { - _vm->_animationManager.BOBANIM_OFF(13); - _vm->_animationManager.BOBANIM_OFF(3); - _vm->_animationManager.BOBANIM_ON(4); + if (BOBPOSI(13) == 8) { + _vm->_objectsManager.BOBANIM_OFF(13); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(4); SET_BOBPOSI(4, 0); SET_BOBPOSI(13, 0); } _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(4) != 16); - _vm->_animationManager.BOBANIM_OFF(12); - _vm->_animationManager.BOBANIM_OFF(4); + } while (BOBPOSI(4) != 16); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(4); SPRITE_ON(0); OBSSEUL = 1; INILINK("IM27a"); @@ -4532,8 +4822,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != PTRNUL); SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(11); - _vm->_animationManager.BOBANIM_ON(8); + _vm->_objectsManager.BOBANIM_ON(11); + _vm->_objectsManager.BOBANIM_ON(8); SET_BOBPOSI(11, 0); SET_BOBPOSI(8, 0); _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); @@ -4541,68 +4831,68 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); v24 = 0; do { - if ((uint16)BOBPOSI(11) == 4 && !v24) { + if (BOBPOSI(11) == 4 && !v24) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); v24 = 1; } - if ((uint16)BOBPOSI(11) == 5) + if (BOBPOSI(11) == 5) v24 = 0; - if ((uint16)BOBPOSI(8) == 11 && !v24) { + if (BOBPOSI(8) == 11 && !v24) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); v24 = 1; } - if ((uint16)BOBPOSI(8) == 12) + if (BOBPOSI(8) == 12) v24 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(8) != 32); + } while (BOBPOSI(8) != 32); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); SPRITE_ON(0); - _vm->_animationManager.BOBANIM_OFF(11); - _vm->_animationManager.BOBANIM_OFF(8); - _vm->_animationManager.BOBANIM_ON(5); - _vm->_animationManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_OFF(11); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_ON(6); SET_BOBPOSI(5, 0); SET_BOBPOSI(6, 0); _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(5) != 74); - _vm->_animationManager.BOBANIM_OFF(5); - _vm->_animationManager.BOBANIM_OFF(6); - _vm->_animationManager.BOBANIM_ON(9); - _vm->_animationManager.BOBANIM_ON(7); + while (BOBPOSI(5) != 74); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(7); } if (v76 == 95) { - _vm->_animationManager.BOBANIM_ON(9); - _vm->_animationManager.BOBANIM_ON(10); - _vm->_animationManager.BOBANIM_ON(12); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(10); + _vm->_objectsManager.BOBANIM_ON(12); SET_BOBPOSI(9, 0); SET_BOBPOSI(10, 0); SET_BOBPOSI(12, 0); SPRITE_OFF(0); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(9) != 15); - _vm->_animationManager.BOBANIM_OFF(9); + while (BOBPOSI(9) != 15); + _vm->_objectsManager.BOBANIM_OFF(9); SPRITE_ON(0); _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(12) != 117); + while (BOBPOSI(12) != 117); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); - _vm->_animationManager.BOBANIM_OFF(12); - _vm->_animationManager.BOBANIM_OFF(10); - _vm->_animationManager.BOBANIM_ON(11); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_objectsManager.BOBANIM_ON(11); } if (v76 == 85) { - _vm->_animationManager.BOBANIM_OFF(3); - _vm->_animationManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(5); SET_BOBPOSI(5, 0); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(5) != 6); - _vm->_animationManager.BOBANIM_OFF(5); - _vm->_animationManager.BOBANIM_ON(6); + while (BOBPOSI(5) != 6); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_ON(6); OBSSEUL = 1; INILINK("IM24a"); OBSSEUL = 0; @@ -4611,78 +4901,78 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { SET_BOBPOSI(1, 0); SET_BOBPOSI(2, 0); - _vm->_animationManager.BOBANIM_ON(1); - _vm->_animationManager.BOBANIM_ON(2); + _vm->_objectsManager.BOBANIM_ON(1); + _vm->_objectsManager.BOBANIM_ON(2); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v25 = 0; do { - if ((uint16)BOBPOSI(1) == 1 && !v25) { + if (BOBPOSI(1) == 1 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((uint16)BOBPOSI(1) == 2) + if (BOBPOSI(1) == 2) v25 = 0; - if ((uint16)BOBPOSI(1) == 3 && !v25) { + if (BOBPOSI(1) == 3 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((uint16)BOBPOSI(1) == 4) + if (BOBPOSI(1) == 4) v25 = 0; - if ((uint16)BOBPOSI(1) == 5 && !v25) { + if (BOBPOSI(1) == 5 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((uint16)BOBPOSI(1) == 6) + if (BOBPOSI(1) == 6) v25 = 0; - if ((uint16)BOBPOSI(1) == 7 && !v25) { + if (BOBPOSI(1) == 7 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if ((uint16)BOBPOSI(1) == 8) + if (BOBPOSI(1) == 8) v25 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(1) != 9); - _vm->_animationManager.BOBANIM_OFF(1); - _vm->_animationManager.BOBANIM_OFF(2); + } while (BOBPOSI(1) != 9); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_OFF(2); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { SET_BOBPOSI(1, 0); SET_BOBPOSI(3, 0); - _vm->_animationManager.BOBANIM_ON(1); - _vm->_animationManager.BOBANIM_ON(3); + _vm->_objectsManager.BOBANIM_ON(1); + _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v26 = 0; do { - if ((uint16)BOBPOSI(1) == 1 && !v26) { + if (BOBPOSI(1) == 1 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((uint16)BOBPOSI(1) == 2) + if (BOBPOSI(1) == 2) v26 = 0; - if ((uint16)BOBPOSI(1) == 3 && !v26) { + if (BOBPOSI(1) == 3 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((uint16)BOBPOSI(1) == 4) + if (BOBPOSI(1) == 4) v26 = 0; - if ((uint16)BOBPOSI(1) == 5 && !v26) { + if (BOBPOSI(1) == 5 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((uint16)BOBPOSI(1) == 6) + if (BOBPOSI(1) == 6) v26 = 0; - if ((uint16)BOBPOSI(1) == 7 && !v26) { + if (BOBPOSI(1) == 7 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if ((uint16)BOBPOSI(1) == 8) + if (BOBPOSI(1) == 8) v26 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(1) != 9); - _vm->_animationManager.BOBANIM_OFF(1); - _vm->_animationManager.BOBANIM_OFF(3); + } while (BOBPOSI(1) != 9); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_OFF(3); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); _vm->_soundManager.DEL_SAMPLE(1); } @@ -4769,82 +5059,82 @@ LABEL_1141: SETANISPR(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - _vm->_animationManager.BOBANIM_ON(4); + _vm->_objectsManager.BOBANIM_ON(4); v33 = 0; do { - if ((uint16)BOBPOSI(4) == 9 && !v33) { + if (BOBPOSI(4) == 9 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if ((uint16)BOBPOSI(4) == 10) + if (BOBPOSI(4) == 10) v33 = 0; - if ((uint16)BOBPOSI(4) == 32 && !v33) { + if (BOBPOSI(4) == 32 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if ((uint16)BOBPOSI(4) == 33) + if (BOBPOSI(4) == 33) v33 = 0; - if ((uint16)BOBPOSI(4) == 55 && !v33) { + if (BOBPOSI(4) == 55 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if ((uint16)BOBPOSI(4) == 56) + if (BOBPOSI(4) == 56) v33 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(4) != 72); - _vm->_animationManager.BOBANIM_OFF(4); + } while (BOBPOSI(4) != 72); + _vm->_objectsManager.BOBANIM_OFF(4); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - _vm->_animationManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_ON(6); v34 = 0; do { - if ((uint16)BOBPOSI(6) == 9 && !v34) { + if (BOBPOSI(6) == 9 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if ((uint16)BOBPOSI(6) == 10) + if (BOBPOSI(6) == 10) v34 = 0; - if ((uint16)BOBPOSI(6) == 32 && !v34) { + if (BOBPOSI(6) == 32 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if ((uint16)BOBPOSI(6) == 33) + if (BOBPOSI(6) == 33) v34 = 0; - if ((uint16)BOBPOSI(6) == 55 && !v34) { + if (BOBPOSI(6) == 55 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if ((uint16)BOBPOSI(6) == 56) + if (BOBPOSI(6) == 56) v34 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(6) != 72); - _vm->_animationManager.BOBANIM_OFF(6); + } while (BOBPOSI(6) != 72); + _vm->_objectsManager.BOBANIM_OFF(6); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - _vm->_animationManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_ON(5); v35 = 0; do { - if ((uint16)BOBPOSI(5) == 9 && !v35) { + if (BOBPOSI(5) == 9 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if ((uint16)BOBPOSI(5) == 10) + if (BOBPOSI(5) == 10) v35 = 0; - if ((uint16)BOBPOSI(5) == 32 && !v35) { + if (BOBPOSI(5) == 32 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if ((uint16)BOBPOSI(5) == 33) + if (BOBPOSI(5) == 33) v35 = 0; - if ((uint16)BOBPOSI(5) == 55 && !v35) { + if (BOBPOSI(5) == 55 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if ((uint16)BOBPOSI(5) == 56) + if (BOBPOSI(5) == 56) v35 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(5) != 72); - _vm->_animationManager.BOBANIM_OFF(5); + } while (BOBPOSI(5) != 72); + _vm->_objectsManager.BOBANIM_OFF(5); } SPRITE_ON(0); ACTION_DOS(1); @@ -4852,52 +5142,52 @@ LABEL_1141: } if (v76 == 106) { SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(4); + _vm->_objectsManager.BOBANIM_ON(4); SET_BOBPOSI(4, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(4) != 10); + while (BOBPOSI(4) != 10); _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(4) != 18); + while (BOBPOSI(4) != 18); _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(4) != 62); + while (BOBPOSI(4) != 62); _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(4) != 77); - _vm->_animationManager.BOBANIM_OFF(4); + while (BOBPOSI(4) != 77); + _vm->_objectsManager.BOBANIM_OFF(4); SPRITE_ON(0); } if (v76 == 107) { SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_ON(5); SET_BOBPOSI(5, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(5) != 10); + while (BOBPOSI(5) != 10); _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(5) != 18); + while (BOBPOSI(5) != 18); _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(5) != 38); + while (BOBPOSI(5) != 38); _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(5) != 53); - _vm->_animationManager.BOBANIM_OFF(5); + while (BOBPOSI(5) != 53); + _vm->_objectsManager.BOBANIM_OFF(5); SPRITE_ON(0); } if (v76 == 210) { @@ -4906,7 +5196,7 @@ LABEL_1141: _vm->_soundManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); - _vm->_animationManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(9); OBSSEUL = 1; INILINK("IM73a"); OBSSEUL = 0; @@ -4970,12 +5260,12 @@ LABEL_1141: SET_BOBPOSI(1, 0); SET_BOBPOSI(2, 0); SETANISPR(0, 60); - _vm->_animationManager.BOBANIM_OFF(4); - _vm->_animationManager.BOBANIM_ON(1); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.BOBANIM_ON(1); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(1) != 9); - _vm->_animationManager.BOBANIM_OFF(1); + while (BOBPOSI(1) != 9); + _vm->_objectsManager.BOBANIM_OFF(1); _vm->_globals.NO_VISU = 1; _vm->_globals.chemin = PTRNUL; _vm->_globals.NOT_VERIF = 1; @@ -4989,101 +5279,101 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != PTRNUL); SETANISPR(0, 64); - _vm->_animationManager.BOBANIM_ON(2); + _vm->_objectsManager.BOBANIM_ON(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(2) != 10); - _vm->_animationManager.BOBANIM_OFF(2); - _vm->_animationManager.BOBANIM_ON(4); + while (BOBPOSI(2) != 10); + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.BOBANIM_ON(4); } if (v76 == 201) { - _vm->_animationManager.BOBANIM_ON(3); + _vm->_objectsManager.BOBANIM_ON(3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(3) != 18); - _vm->_animationManager.BOBANIM_OFF(3); - _vm->_animationManager.BOBANIM_ON(4); + while (BOBPOSI(3) != 18); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(4); } if (v76 == 203) { _vm->_globals.NO_VISU = 1; SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(4); + _vm->_objectsManager.BOBANIM_ON(4); do { _vm->_eventsManager.VBL(); - if ((uint16)BOBPOSI(4) == 18) + if (BOBPOSI(4) == 18) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); - } while ((uint16)BOBPOSI(4) != 26); - _vm->_animationManager.BOBANIM_OFF(4); + } while (BOBPOSI(4) != 26); + _vm->_objectsManager.BOBANIM_OFF(4); _vm->_globals.NO_VISU = 0; SPRITE_ON(0); } if (v76 == 204) { SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(3); + _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); v41 = 0; do { - if ((uint16)BOBPOSI(3) == 10 && !v41) { + if (BOBPOSI(3) == 10 && !v41) { _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); v41 = 1; } - if ((uint16)BOBPOSI(3) == 11) + if (BOBPOSI(3) == 11) v41 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(3) != 50); - _vm->_animationManager.BOBANIM_OFF(3); + } while (BOBPOSI(3) != 50); + _vm->_objectsManager.BOBANIM_OFF(3); SPRITE_ON(0); } if (v76 == 205) { SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(4); + _vm->_objectsManager.BOBANIM_ON(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); v42 = 0; do { - if ((uint16)BOBPOSI(4) == 10 && !v42) { + if (BOBPOSI(4) == 10 && !v42) { _vm->_soundManager.PLAY_WAV(1); v42 = 1; } - if ((uint16)BOBPOSI(4) == 11) + if (BOBPOSI(4) == 11) v42 = 0; _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(4) != 24); - _vm->_animationManager.BOBANIM_OFF(4); + } while (BOBPOSI(4) != 24); + _vm->_objectsManager.BOBANIM_OFF(4); SPRITE_ON(0); } if (v76 == 175) { SETANISPR(0, 55); SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(9); - _vm->_animationManager.BOBANIM_ON(10); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(10); BOB_OFFSET(10, 300); _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(10) != 7); - _vm->_animationManager.BOBANIM_ON(6); - _vm->_animationManager.BOBANIM_OFF(3); + while (BOBPOSI(10) != 7); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_OFF(3); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(6) != 10); + while (BOBPOSI(6) != 10); _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); - _vm->_animationManager.BOBANIM_ON(7); - _vm->_animationManager.BOBANIM_OFF(4); + _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.BOBANIM_OFF(4); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(7) != 15); - _vm->_animationManager.BOBANIM_OFF(5); - _vm->_animationManager.BOBANIM_ON(8); + while (BOBPOSI(7) != 15); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_ON(8); _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(8) != 76); - _vm->_animationManager.BOBANIM_OFF(6); - _vm->_animationManager.BOBANIM_OFF(7); - _vm->_animationManager.BOBANIM_OFF(8); - _vm->_animationManager.BOBANIM_OFF(9); - _vm->_animationManager.BOBANIM_OFF(10); + while (BOBPOSI(8) != 76); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(10); SPRITE_ON(0); } if (v76 == 229) { @@ -5113,15 +5403,15 @@ LABEL_1141: } while (_vm->_globals.chemin != PTRNUL); SPRITE_OFF(0); v45 = 0; - _vm->_animationManager.BOBANIM_ON(7); + _vm->_objectsManager.BOBANIM_ON(7); do { - if ((uint16)BOBPOSI(7) == 9 && !v45) { + if (BOBPOSI(7) == 9 && !v45) { v45 = 1; _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); } _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(7) != 15); - _vm->_animationManager.BOBANIM_OFF(7); + } while (BOBPOSI(7) != 15); + _vm->_objectsManager.BOBANIM_OFF(7); SETXSPR(0, 476); SETYSPR(0, 278); SPRITE_ON(0); @@ -5134,41 +5424,41 @@ LABEL_1141: if (v76 == 231) { _vm->_globals.CACHE_OFF(); SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(12); + _vm->_objectsManager.BOBANIM_ON(12); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(12) != 6); + while (BOBPOSI(12) != 6); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); _vm->_globals.NOPARLE = 0; do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(12) != 12); + while (BOBPOSI(12) != 12); SPRITE_ON(0); - _vm->_animationManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(12); _vm->_globals.CACHE_ON(); } if (v76 == 233) { _vm->_globals.CACHE_OFF(); SPRITE_OFF(0); - _vm->_animationManager.BOBANIM_ON(11); + _vm->_objectsManager.BOBANIM_ON(11); v46 = 0; do { _vm->_eventsManager.VBL(); - if ((uint16)BOBPOSI(11) == 10 && !v46) + if (BOBPOSI(11) == 10 && !v46) v46 = 1; - } while ((uint16)BOBPOSI(11) != 13); - _vm->_animationManager.BOBANIM_OFF(11); + } while (BOBPOSI(11) != 13); + _vm->_objectsManager.BOBANIM_OFF(11); _vm->_globals.CACHE_ON(); - _vm->_animationManager.BOBANIM_ON(13); + _vm->_objectsManager.BOBANIM_ON(13); do _vm->_eventsManager.VBL(); - while ((uint16)BOBPOSI(13) != 48); + while (BOBPOSI(13) != 48); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals.NOPARLE = 0; _vm->_graphicsManager.FADE_OUTW(); - _vm->_animationManager.BOBANIM_OFF(13); + _vm->_objectsManager.BOBANIM_OFF(13); _vm->_graphicsManager.NOFADE = 1; _vm->_globals.SORTIE = 94; } @@ -5273,25 +5563,25 @@ LABEL_1141: OPTI_ONE(16, 0, 10, 0); } if (v76 == 240) { - _vm->_animationManager.BOBANIM_ON(1); + _vm->_objectsManager.BOBANIM_ON(1); v50 = 0; do { _vm->_eventsManager.VBL(); - if ((uint16)BOBPOSI(1) == 12 && !v50) { + if (BOBPOSI(1) == 12 && !v50) { _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); v50 = 1; } - if ((uint16)BOBPOSI(1) == 13) + if (BOBPOSI(1) == 13) v50 = 0; - if ((uint16)BOBPOSI(1) == 25 && !v50) { + if (BOBPOSI(1) == 25 && !v50) { _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); v50 = 1; } - if ((uint16)BOBPOSI(1) == 25) + if (BOBPOSI(1) == 25) v50 = 0; - } while ((uint16)BOBPOSI(1) != 32); - _vm->_animationManager.BOBANIM_OFF(1); - _vm->_animationManager.BOBANIM_ON(2); + } while (BOBPOSI(1) != 32); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_ON(2); _vm->_fontManager.TEXTE_OFF(9); if (!_vm->_soundManager.TEXTOFF) { _vm->_fontManager.DOS_TEXT(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); @@ -5368,13 +5658,13 @@ LABEL_1141: v52 = 0; _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); do { - if ((uint16)BOBPOSI(12) == 5 && !v52) { + if (BOBPOSI(12) == 5 && !v52) { _vm->_soundManager.PLAY_WAV(1); v52 = 1; } _vm->_eventsManager.VBL(); - } while ((uint16)BOBPOSI(12) != 34); - _vm->_animationManager.BOBANIM_OFF(2); + } while (BOBPOSI(12) != 34); + _vm->_objectsManager.BOBANIM_OFF(2); _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = 1; _vm->_globals.SORTIE = 20; @@ -5571,9 +5861,9 @@ LABEL_1141: _vm->_globals.SORTIE = 100; } if (v76 == 55) { - _vm->_animationManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_OFF(1); OPTI_ONE(15, 0, 12, 0); - _vm->_animationManager.BOBANIM_OFF(15); + _vm->_objectsManager.BOBANIM_OFF(15); OBSSEUL = 1; INILINK("IM19a"); OBSSEUL = 0; @@ -5695,58 +5985,264 @@ LABEL_1141: return v1; } -void ObjectsManager::BOB_VIVANT(int a1) { - warning("TODO: BOB_VIVANT"); +void ObjectsManager::BOB_VIVANT(int idx) { + int v1; + int v2; + int v3; + int v4; + + v1 = 5 * idx; + v2 = READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); + v3 = READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 2); + v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); + if (READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { + if (!_vm->_globals.NO_OFFSET) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, + _vm->_graphicsManager.ofscroll + v2, v3, + *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); + if (_vm->_globals.NO_OFFSET) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, v2, v3, v4); + } } -void ObjectsManager::VBOB(byte *a1, int a2, int a3, int a4, int a5) { - warning("TODO: VBOB"); +void ObjectsManager::VBOB(byte *a1, int idx, int a3, int a4, int a5) { + if (idx > 29) + error("MAX_VBOB exceeded"); + + if (_vm->_globals.VBob[idx].field4 <= 1u) { + _vm->_globals.VBob[idx].field4 = 1; + _vm->_globals.VBob[idx].field6 = a3; + _vm->_globals.VBob[idx].field8 = a4; + _vm->_globals.VBob[idx].fieldA = a5; + _vm->_globals.VBob[idx].field14 = a3; + _vm->_globals.VBob[idx].field16 = a4; + _vm->_globals.VBob[idx].field18 = a5; + _vm->_globals.VBob[idx].field0 = a1; + _vm->_globals.VBob[idx].field1C = a1; + if (_vm->_globals.VBob[idx].field10 != PTRNUL) + _vm->_globals.VBob[idx].field10 = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + } + + int f4 = _vm->_globals.VBob[idx].field4; + if (f4 == 2 || f4 == 4) { + _vm->_globals.VBob[idx].field4 = 3; + _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; + _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; + _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; + _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; + _vm->_globals.VBob[idx].field6 = a3; + _vm->_globals.VBob[idx].field8 = a4; + _vm->_globals.VBob[idx].fieldA = a5; + _vm->_globals.VBob[idx].field0 = a1; + } } void ObjectsManager::VBOB_OFF(int idx) { - warning("TODO: VBOB_OFF"); + if (idx > 29) + error("MAX_VBOB exceeded"); + + if (_vm->_globals.VBob[idx].field4 <= 1) + _vm->_globals.VBob[idx].field4 = 0; + else + _vm->_globals.VBob[idx].field4 = 4; } void ObjectsManager::ACTION_DOS(int idx) { - warning("TODO: ACTION_DOS"); + if (_vm->_globals.GESTE_FLAG != 1) { + if (PTRNUL != _vm->_globals.GESTE) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 1; + + FileManager::CONSTRUIT_SYSTEM("DOS.SPR"); + _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + if (idx == 4) + ACTION( + _vm->_globals.GESTE, + "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", + 0, + 0, + 8, + 0); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "20,19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); } void ObjectsManager::ACTION_DROITE(int idx) { - warning("TODO: ACTION_DROITE"); + if (_vm->_globals.GESTE_FLAG != 3) { + if (_vm->_globals.GESTE != PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 3; + FileManager::CONSTRUIT_SYSTEM("PROFIL.SPR"); + _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, 0); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, 0); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, 0); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, 0); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); } void ObjectsManager::Q_DROITE(int idx) { - warning("TODO: Q_DROITE"); + if (_vm->_globals.GESTE_FLAG != 4) { + if (_vm->_globals.GESTE != PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 4; + FileManager::CONSTRUIT_SYSTEM("3Q.SPR"); + _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, 0); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, 0); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); } void ObjectsManager::ACTION_FACE(int idx) { - warning("TODO: ACTION_FACE"); + if (_vm->_globals.GESTE_FLAG != 2) { + if (_vm->_globals.GESTE != PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 2; + FileManager::CONSTRUIT_SYSTEM("FACE.SPR"); + _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); } void ObjectsManager::Q_GAUCHE(int idx) { - warning("TODO: Q_GAUCHE"); + if (_vm->_globals.GESTE_FLAG != 4) { + if (_vm->_globals.GESTE != PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 4; + FileManager::CONSTRUIT_SYSTEM("3Q.SPR"); + _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, 1); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, 1); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, 1); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 1); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); } void ObjectsManager::ACTION_GAUCHE(int idx) { - warning("TODO: ACTION_GAUCHE"); + if (_vm->_globals.GESTE_FLAG != 3) { + if (_vm->_globals.GESTE != PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 3; + FileManager::CONSTRUIT_SYSTEM("PROFIL.SPR"); + _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 1); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, 1); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, 1); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, 1); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, 1); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, 1); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); } void ObjectsManager::ZONE_ON(int idx) { - warning("TODO: ZONE_ON"); + if (_vm->_globals.BOBZONE[idx]) { + _vm->_globals.BOBZONE_FLAG[idx] = 1; + } else { + _vm->_globals.ZONEP[idx].field10 = 1; + } } void ObjectsManager::ZONE_OFF(int idx) { - warning("TODO: ZONE_OFF"); + if (_vm->_globals.BOBZONE[idx]) { + _vm->_globals.BOBZONE_FLAG[idx] = 0; + } else { + _vm->_globals.ZONEP[idx].field10 = 0; + } + } void ObjectsManager::OPTI_ONE(int a1, int a2, int a3, int a4) { warning("TODO: OPTI_ONE"); } -int ObjectsManager::BOBPOSI(int a1) { - warning("BOBPOSI"); - return 0; -} void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { SPEED_FLAG = true; @@ -5756,8 +6252,41 @@ void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { SPEED_IMAGE = img; } -void ObjectsManager::SET_BOBPOSI(int a1, int a2) { - warning("TODO: SET_BOBPOSI"); +int ObjectsManager::BOBPOSI(int idx) { + return _vm->_globals.Bob[idx].field10 / 5; +} + +void ObjectsManager::BOBANIM_ON(int idx) { + if (_vm->_globals.Bob[idx].field16) { + _vm->_globals.Bob[idx].field16 = 0; + _vm->_globals.Bob[idx].field10 = 5; + _vm->_globals.Bob[idx].fieldC = 250; + _vm->_globals.Bob[idx].field12 = 0; + _vm->_globals.Bob[idx].field14 = 0; + } +} + +void ObjectsManager::BOBANIM_OFF(int idx) { + _vm->_globals.Bob[idx].field16 = 1; + +} + +void ObjectsManager::SET_BOBPOSI(int idx, int a2) { + _vm->_globals.Bob[idx].field10 = 5 * a2; + _vm->_globals.Bob[idx].field12 = 0; + _vm->_globals.Bob[idx].field14 = 0; +} + +int ObjectsManager::BOBX(int idx) { + return _vm->_globals.Bob[idx].field8; +} + +int ObjectsManager::BOBY(int idx) { + return _vm->_globals.Bob[idx].fieldA; +} + +int ObjectsManager::BOBA(int idx) { + return _vm->_globals.Bob[idx].fieldC; } void ObjectsManager::INILINK(const Common::String &file) { @@ -5888,4 +6417,114 @@ int ObjectsManager::colision(int a1, int a2) { return -1; } +void ObjectsManager::ACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { + warning("TODO: ACTION"); +} + +void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { + warning("TODO: SPACTION"); +} + +void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { + warning("TODO: SPACTION1"); +} + +void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) { + signed int v6; + char v7; + + v6 = a1; + if (_vm->_globals.ECRAN == a1) { + if (a1 == 35) { + if (a6 > 2 || (v6 = 200, a6 > 2)) + v6 = 201; + } + if (_vm->_globals.ECRAN == 36) { + if (a6 > 2 || (v6 = 202, a6 > 2)) + v6 = 203; + } + if (_vm->_globals.ECRAN == 37) { + if (a6 > 2 || (v6 = 204, a6 > 2)) + v6 = 205; + } + if (_vm->_globals.ECRAN == 38) { + if (a6 > 2 || (v6 = 206, a6 > 2)) + v6 = 207; + } + if (_vm->_globals.ECRAN == 39) { + if (a6 > 2 || (v6 = 208, a6 > 2)) + v6 = 209; + } + if (_vm->_globals.ECRAN == 40) { + if (a6 > 2 || (v6 = 210, a6 > 2)) + v6 = 211; + } + if (_vm->_globals.ECRAN == 41) { + if (a6 > 2 || (v6 = 212, a6 > 2)) + v6 = 213; + } + v7 = _vm->_globals.SAUVEGARDE->data[v6]; + if (v7 != 2) { + if (v7) { + if (v7 == 1) { + if (a6 == 1 && BOBPOSI(1) == 26) { + VIRE_INVENT = 1; + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_globals.SAUVEGARDE->data[v6] = 4; + } + if (a6 == 2 && BOBPOSI(2) == 26) { + VIRE_INVENT = 1; + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_globals.SAUVEGARDE->data[v6] = 4; + } + if (a6 == 3 && BOBPOSI(3) == 27) { + VIRE_INVENT = 1; + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_globals.SAUVEGARDE->data[v6] = 4; + } + if (a6 == 4 && BOBPOSI(4) == 27) { + VIRE_INVENT = 1; + _vm->_soundManager.PLAY_SAMPLE2(1); + VIRE_INVENT = 1; + _vm->_globals.SAUVEGARDE->data[v6] = 4; + } + } + if (_vm->_globals.SAUVEGARDE->data[v6] == 4) { + if (a6 == 1 && (signed int)BOBPOSI(1) > 30) + _vm->_globals.SAUVEGARDE->data[v6] = 3; + if (a6 == 2 && (signed int)BOBPOSI(2) > 30) + _vm->_globals.SAUVEGARDE->data[v6] = 3; + if (a6 == 3 && (signed int)BOBPOSI(3) > 30) + _vm->_globals.SAUVEGARDE->data[v6] = 3; + if (a6 == 4 && (signed int)BOBPOSI(4) > 30) + _vm->_globals.SAUVEGARDE->data[v6] = 3; + } + if (_vm->_globals.SAUVEGARDE->data[v6] == 3) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_ANM("CREVE2.ANM", 100, 24, 500); + _vm->_globals.SORTIE = 150; + _vm->_graphicsManager.NOFADE = 1; + BOB_OFF(1); + BOB_OFF(2); + BOB_OFF(3); + BOB_OFF(4); + } + } else if (a2 < XSPR(0) + && a3 > XSPR(0) + && a4 < YSPR(0) + && a5 > YSPR(0)) { + if (a6 == 1) + _vm->_objectsManager.BOBANIM_ON(1); + if (a6 == 2) + _vm->_objectsManager.BOBANIM_ON(2); + if (a6 == 3) + _vm->_objectsManager.BOBANIM_ON(3); + if (a6 == 4) + _vm->_objectsManager.BOBANIM_ON(4); + _vm->_globals.SAUVEGARDE->data[v6] = 1; + } + } + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 1f79283215..705d90f73b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -202,13 +202,11 @@ public: void VERBEPLUS(); void BTDROITE(); int MZONE(); - void RESET_OBSTACLE(); - int ZONE_OBJET(int a1, int a2); void PARAMCADRE(int a1); void OBJETPLUS(int a1); void VALID_OBJET(int a1); void OPTI_OBJET(); - void SPECIAL_JEU(int a1); + void SPECIAL_JEU(); int Traduction(byte *a1); void BOB_VIVANT(int a1); void VBOB(byte *a1, int a2, int a3, int a4, int a5); @@ -223,9 +221,15 @@ public: void ZONE_ON(int idx); void ZONE_OFF(int idx); void OPTI_ONE(int a1, int a2, int a3, int a4); - int BOBPOSI(int a1); void AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img); - void SET_BOBPOSI(int a1, int a2); + int BOBPOSI(int idx); + void BOBANIM_ON(int idx); + void BOBANIM_OFF(int idx); + void SET_BOBPOSI(int idx, int a2); + int BOBX(int idx); + int BOBY(int idx); + int BOBA(int idx); + void INILINK(const Common::String &file); void OBJET_VIVANT(const Common::String &a2); void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); @@ -238,6 +242,11 @@ public: int CALC_PROPRE(int idx); int PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6); int colision(int a1, int a2); + + void ACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6); + void SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6); + void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); + void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 07b481f298..d57b8b938c 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -290,15 +290,15 @@ int TalkManager::DIALOGUE() { v0 = BUFFERPERSO; v1 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); if (v1) - _vm->_animationManager.BOBANIM_ON(v1); + _vm->_objectsManager.BOBANIM_ON(v1); if (READ_LE_UINT16((uint16 *)v0 + 48) != 1) - _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 49)); + _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 49)); if (READ_LE_UINT16((uint16 *)v0 + 48) != 2) - _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 50)); + _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 50)); if ( READ_LE_UINT16((uint16 *)v0 + 48) != 3) - _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 51)); + _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 51)); if (READ_LE_UINT16((uint16 *)v0 + 48) != 4) - _vm->_animationManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 52)); + _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 52)); } else { VISU_WAIT(); } @@ -363,19 +363,19 @@ int TalkManager::DIALOGUE() { v11 = BUFFERPERSO; v12 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); if (v12) - _vm->_animationManager.BOBANIM_OFF(v12); + _vm->_objectsManager.BOBANIM_OFF(v12); v13 = READ_LE_UINT16((uint16 *)v11 + 49); if (v13 != 1) - _vm->_animationManager.BOBANIM_OFF(v13); + _vm->_objectsManager.BOBANIM_OFF(v13); v14 = READ_LE_UINT16((uint16 *)v11 + 50); if (v14 != 2) - _vm->_animationManager.BOBANIM_OFF(v14); + _vm->_objectsManager.BOBANIM_OFF(v14); v15 = READ_LE_UINT16((uint16 *)v11 + 51); if (v15 != 3) - _vm->_animationManager.BOBANIM_OFF(v15); + _vm->_objectsManager.BOBANIM_OFF(v15); v16 = READ_LE_UINT16((uint16 *)v11 + 52); if (v16 != 4) - _vm->_animationManager.BOBANIM_OFF(v16); + _vm->_objectsManager.BOBANIM_OFF(v16); } else { FIN_VISU_WAIT(); } @@ -444,19 +444,19 @@ int TalkManager::DIALOGUE_REP(int idx) { v8 = BUFFERPERSO; v9 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); if (v9) - _vm->_animationManager.BOBANIM_ON(v9); + _vm->_objectsManager.BOBANIM_ON(v9); v10 = READ_LE_UINT16((uint16 *)v8 + 44); if (v10) - _vm->_animationManager.BOBANIM_ON(v10); + _vm->_objectsManager.BOBANIM_ON(v10); v11 = READ_LE_UINT16((uint16 *)v8 + 45); if (v11) - _vm->_animationManager.BOBANIM_ON(v11); + _vm->_objectsManager.BOBANIM_ON(v11); v12 = READ_LE_UINT16((uint16 *)v8 + 46); if (v12) - _vm->_animationManager.BOBANIM_ON(v12); + _vm->_objectsManager.BOBANIM_ON(v12); v13 = READ_LE_UINT16((uint16 *)v8 + 47); if (v13) - _vm->_animationManager.BOBANIM_ON(v13); + _vm->_objectsManager.BOBANIM_ON(v13); } else { VISU_PARLE(); } @@ -482,19 +482,19 @@ int TalkManager::DIALOGUE_REP(int idx) { v15 = BUFFERPERSO; v16 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); if (v16) - _vm->_animationManager.BOBANIM_OFF(v16); + _vm->_objectsManager.BOBANIM_OFF(v16); v17 = READ_LE_UINT16((uint16 *)v15 + 44); if (v17) - _vm->_animationManager.BOBANIM_OFF(v17); + _vm->_objectsManager.BOBANIM_OFF(v17); v18 = READ_LE_UINT16((uint16 *)v15 + 45); if (v18) - _vm->_animationManager.BOBANIM_OFF(v18); + _vm->_objectsManager.BOBANIM_OFF(v18); v19 = READ_LE_UINT16((uint16 *)v15 + 46); if (v19) - _vm->_animationManager.BOBANIM_OFF(v19); + _vm->_objectsManager.BOBANIM_OFF(v19); v20 = READ_LE_UINT16((uint16 *)v15 + 47); if (v20) - _vm->_animationManager.BOBANIM_OFF(v20); + _vm->_objectsManager.BOBANIM_OFF(v20); } else { FIN_VISU_PARLE(i); } -- cgit v1.2.3 From a404f86a384dd98881725617be87757920843b18 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Oct 2012 07:27:34 +1000 Subject: HOPKINS: Implemented more previously stubbed object manager methods --- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/objects.cpp | 1147 ++++++++++++++++++++++++++++++++++-------- engines/hopkins/objects.h | 11 +- engines/hopkins/talk.cpp | 389 +++++++++++++- engines/hopkins/talk.h | 3 +- 5 files changed, 1318 insertions(+), 234 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 38193e62c5..787400ae52 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2404,7 +2404,7 @@ void GraphicsManager::NB_SCREEN() { } void GraphicsManager::SHOW_PALETTE() { - warning("TODO: SHOW_PALETTE"); + setpal_vga256(Palette); } } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 76ac105f87..0a846f5302 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -46,7 +46,7 @@ ObjectsManager::ObjectsManager() { inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; - PERSO_ON = false; + _vm->_objectsManager.PERSO_ON = false; SL_FLAG = false; FLAG_VISIBLE = false; DESACTIVE_INVENT = false; @@ -331,7 +331,7 @@ void ObjectsManager::AFF_SPRITES() { ++v30; } while (v30 <= 10); - if (!PERSO_ON) { + if (!_vm->_objectsManager.PERSO_ON) { v31 = 0; do { v5 = v31; @@ -362,7 +362,7 @@ void ObjectsManager::AFF_SPRITES() { AFF_BOB_ANIM(); AFF_VBOB(); - if (!PERSO_ON) { + if (!_vm->_objectsManager.PERSO_ON) { v32 = 0; do { _vm->_globals.Liste[v32].field0 = 0; @@ -929,11 +929,11 @@ void ObjectsManager::VERIFCACHE() { v7 = _vm->_globals.Cache[v8].fieldA; v10 = 0; do { - if (_vm->_objectsManager.Sprite[v10].field0 == 1) { - if (_vm->_objectsManager.Sprite[v10].field10 != 250) { - v1 = _vm->_objectsManager.Sprite[v10].field2C; - v11 = _vm->_objectsManager.Sprite[v10].field30 + v1; - v2 = _vm->_objectsManager.Sprite[v10].field32 + _vm->_objectsManager.Sprite[v10].field2E; + if (Sprite[v10].field0 == 1) { + if (Sprite[v10].field10 != 250) { + v1 = Sprite[v10].field2C; + v11 = Sprite[v10].field30 + v1; + v2 = Sprite[v10].field32 + Sprite[v10].field2E; v6 = _vm->_globals.Cache[v8].field0; v3 = _vm->_globals.Cache[v8].field4; v9 = _vm->_globals.Cache[v8].field6 + v6; @@ -1276,7 +1276,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int idx = 0; do { ++idx; - if (idx <= 20 && PERSO_ON == 1) { + if (idx <= 20 && _vm->_objectsManager.PERSO_ON == 1) { _vm->_globals.Bob[idx].field1C = 0; continue; } @@ -1305,7 +1305,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if ( PERSO_ON == 1 && idx > 20 ) + if ( _vm->_objectsManager.PERSO_ON == 1 && idx > 20 ) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); @@ -1346,7 +1346,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if (PERSO_ON == 1 && idx > 20) + if (_vm->_objectsManager.PERSO_ON == 1 && idx > 20) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); @@ -1370,7 +1370,7 @@ LABEL_38: } } while (idx != 35); - if (!PERSO_ON && BOBTOUS == 1) { + if (!_vm->_objectsManager.PERSO_ON && BOBTOUS == 1) { v26 = 0; do { v13 = v26; @@ -1385,7 +1385,7 @@ LABEL_38: do { ++v27; - if (v27 > 20 || PERSO_ON != 1) { + if (v27 > 20 || _vm->_objectsManager.PERSO_ON != 1) { if (_vm->_globals.Bob[v27].field0 == 10) { if (_vm->_globals.Bob[v27].field1C == 1) { v14 = _vm->_globals.Bob[v27].field1E; @@ -1840,6 +1840,77 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { warning("CHARGE_ZONE"); } +void ObjectsManager::CARRE_ZONE() { + byte *v3; + int v4; + int v5; + byte *v6; + int v7; + int v8; + int v10; + int v11; + int v12; + int v13; + int v14; + + for (int idx = 0; idx < 100; ++idx) { + _vm->_globals.CarreZone[idx].field0 = 0; + _vm->_globals.CarreZone[idx].fieldE = 0; + _vm->_globals.CarreZone[idx].field2 = 1280; + _vm->_globals.CarreZone[idx].field4 = 0; + _vm->_globals.CarreZone[idx].field6 = 460; + _vm->_globals.CarreZone[idx].field8 = 0; + _vm->_globals.CarreZone[idx].fieldA = 401; + _vm->_globals.CarreZone[idx].fieldC = 0; + } + + for (int idx = 0; idx < 400; ++idx) { + v3 = _vm->_linesManager.LigneZone[idx].field4; + if (v3 != PTRNUL) { + v4 = _vm->_linesManager.LigneZone[idx].field2; + _vm->_globals.CarreZone[v4].field0 = 1; + if (_vm->_globals.CarreZone[v4].fieldC < idx) + _vm->_globals.CarreZone[v4].fieldC = idx; + if (_vm->_globals.CarreZone[v4].fieldA > idx) + _vm->_globals.CarreZone[v4].fieldA = idx; + + v13 = 0; + v12 = _vm->_linesManager.LigneZone[idx].field0; + if (v12 > 0) { + do { + v5 = READ_LE_UINT16(v3); + v6 = v3 + 2; + v11 = READ_LE_UINT16(v6); + v3 = v6 + 2; + if (_vm->_globals.CarreZone[v4].field2 >= v5) + _vm->_globals.CarreZone[v4].field2 = v5; + if (_vm->_globals.CarreZone[v4].field4 <= v5) + _vm->_globals.CarreZone[v4].field4 = v5; + if (_vm->_globals.CarreZone[v4].field6 >= v11) + _vm->_globals.CarreZone[v4].field6 = v11; + if (_vm->_globals.CarreZone[v4].field8 <= v11) + _vm->_globals.CarreZone[v4].field8 = v11; + ++v13; + } while (v13 < v12); + } + } + } + + v7 = 0; + do { + v8 = v7; + v10 = _vm->_globals.CarreZone[v8].field2 - _vm->_globals.CarreZone[v8].field4; + if (v10 < 0) + v10 = -v10; + v14 = _vm->_globals.CarreZone[v8].field6 - _vm->_globals.CarreZone[v8].field8; + if (v14 < 0) + v14 = -v14; + if (v10 == v14) + _vm->_globals.CarreZone[v8].fieldE = 1; + ++v7; + } while (v7 <= 99); +} + void ObjectsManager::PLAN_BETA() { int v1; int v2; @@ -2033,7 +2104,7 @@ void ObjectsManager::BTGAUCHE() { if (GOACTION != 1) goto LABEL_38; VERIFZONE(); - if (NUMZONE <= 0) + if (_vm->_objectsManager.NUMZONE <= 0) return; v2 = 0; v3 = _vm->_globals.essai2; @@ -2055,10 +2126,10 @@ void ObjectsManager::BTGAUCHE() { _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || _vm->_objectsManager.NUMZONE <= 0)) return; - if ((uint16)(NUMZONE + 1) > 1u) { - v6 = NUMZONE; + if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + v6 = _vm->_objectsManager.NUMZONE; v7 = _vm->_globals.ZONEP[v6].field0; if (v7) { v8 = _vm->_globals.ZONEP[v6].field2; @@ -2073,7 +2144,7 @@ LABEL_38: GOACTION = 0; v9 = _vm->_globals.chemin; _vm->_globals.chemin = PTRNUL; - if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { + if (_vm->_globals.FORET && ((uint16)(_vm->_objectsManager.NUMZONE - 20) <= 1u || (uint16)(_vm->_objectsManager.NUMZONE - 22) <= 1u)) { if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); v11 = YSPR(0); @@ -2125,24 +2196,24 @@ LABEL_65: _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0); } } - if ((uint16)(NUMZONE + 1) > 1u) { + if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) _vm->_globals.SAUVEGARDE->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == 1) _vm->_globals.SAUVEGARDE->data[svField1] = 6; - _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; + _vm->_globals.SAUVEGARDE->data[svField2] = _vm->_objectsManager.NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); ARRET_PERSO_FLAG = 0; - if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[NUMZONE]) { + if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]) { ARRET_PERSO_FLAG = 1; - ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; + ARRET_PERSO_NUM = _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && _vm->_objectsManager.NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { _vm->_globals.chemin = PTRNUL; XSPR(0); @@ -2164,7 +2235,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { + if (_vm->_globals.FORET != 1 || ((uint16)(_vm->_objectsManager.NUMZONE - 20) > 1u && (uint16)(_vm->_objectsManager.NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) @@ -2228,11 +2299,11 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } _vm->_eventsManager.CHANGE_MOUSE(4); - if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { - NUMZONE = -1; + if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field16) { + _vm->_objectsManager.NUMZONE = -1; FORCEZONE = 1; } - if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { + if (_vm->_objectsManager.NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u) { _vm->_eventsManager.btsouris = 4; CHANGEVERBE = 0; } else { @@ -2246,7 +2317,7 @@ LABEL_64: } if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - NUMZONE = 0; + _vm->_objectsManager.NUMZONE = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2256,8 +2327,8 @@ LABEL_64: } if (_vm->_globals.NOMARCHE == 1) { if (_vm->_eventsManager.btsouris == 4) { - result = NUMZONE + 1; - if ((uint16)(NUMZONE + 1) > 1u) + result = _vm->_objectsManager.NUMZONE + 1; + if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) BTDROITE(); } } @@ -2287,7 +2358,7 @@ void ObjectsManager::CLEAR_ECRAN() { } while (v1 <= 48); _vm->_eventsManager.btsouris = 4; verbe = 4; - NUMZONE = 0; + _vm->_objectsManager.NUMZONE = 0; Vold_taille = 0; SPEED_FLAG = 0; SPEED_PTR = PTRNUL; @@ -2382,8 +2453,8 @@ LABEL_7: FileManager::CONSTRUIT_SYSTEM("INVENT2.SPR"); inventaire2 = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); v19 = _vm->_graphicsManager.ofscroll + 152; - v18 = _vm->_objectsManager.Get_Largeur(_vm->_globals.Winventaire, 0); - v17 = _vm->_objectsManager.Get_Hauteur(_vm->_globals.Winventaire, 0); + v18 = Get_Largeur(_vm->_globals.Winventaire, 0); + v17 = Get_Hauteur(_vm->_globals.Winventaire, 0); inventairex = v19; inventairey = 114; inventairel = v18; @@ -2821,9 +2892,9 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v8 = 5; do { v62 = v8; - v9 = _vm->_linesManager.colision2_ligne(v75, v7, &v85, &v90, 0, _vm->_objectsManager.DERLIGNE); + v9 = _vm->_linesManager.colision2_ligne(v75, v7, &v85, &v90, 0, DERLIGNE); v8 = v62; - if (v9 == 1 && *(&v87 + v62) <= _vm->_objectsManager.DERLIGNE) + if (v9 == 1 && *(&v87 + v62) <= DERLIGNE) break; *(&v82 + v62) = 0; *(&v87 + v62) = -1; @@ -2838,9 +2909,9 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v12 = 1; do { v63 = v12; - v13 = _vm->_linesManager.colision2_ligne(v75, v11, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v13 = _vm->_linesManager.colision2_ligne(v75, v11, &v83, &v88, 0, DERLIGNE); v12 = v63; - if (v13 == 1 && *(&v87 + v63) <= _vm->_objectsManager.DERLIGNE) + if (v13 == 1 && *(&v87 + v63) <= DERLIGNE) break; *(&v82 + v63) = 0; *(&v87 + v63) = -1; @@ -2859,9 +2930,9 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v16 = 3; do { v64 = v16; - v17 = _vm->_linesManager.colision2_ligne(v15, v74, &v84, &v89, 0, _vm->_objectsManager.DERLIGNE); + v17 = _vm->_linesManager.colision2_ligne(v15, v74, &v84, &v89, 0, DERLIGNE); v16 = v64; - if (v17 == 1 && *(&v87 + v64) <= _vm->_objectsManager.DERLIGNE) + if (v17 == 1 && *(&v87 + v64) <= DERLIGNE) break; *(&v82 + v64) = 0; *(&v87 + v64) = -1; @@ -2882,9 +2953,9 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v20 = 7; do { v65 = v20; - v21 = _vm->_linesManager.colision2_ligne(v19, v74, &v86, &v91, 0, _vm->_objectsManager.DERLIGNE); + v21 = _vm->_linesManager.colision2_ligne(v19, v74, &v86, &v91, 0, DERLIGNE); v20 = v65; - if (v21 == 1 && *(&v87 + v65) <= _vm->_objectsManager.DERLIGNE) + if (v21 == 1 && *(&v87 + v65) <= DERLIGNE) break; *(&v82 + v65) = 0; *(&v87 + v65) = -1; @@ -2939,7 +3010,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v76[v25] = 1300; ++v24; } while (v24 <= 8); - v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, DERLIGNE); if (v26 == 1) { v69 = v88; v68 = v83; @@ -2953,7 +3024,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v66 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 4); v27 = v27 + 4; v30 = v27; - v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v83, &v88, 0, _vm->_objectsManager.DERLIGNE); + v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v83, &v88, 0, DERLIGNE); v27 = v30; if (v31) break; @@ -3322,7 +3393,7 @@ void ObjectsManager::BTDROITE() { VERBEPLUS(); if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - _vm->_objectsManager.verbe = _vm->_eventsManager.btsouris; + verbe = _vm->_eventsManager.btsouris; } } @@ -3754,17 +3825,17 @@ void ObjectsManager::SPECIAL_JEU() { if (_vm->_globals.ECRAN == 57) { _vm->_globals.DESACTIVE_INVENT = 1; if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { - _vm->_objectsManager.BOBANIM_OFF(5); + BOBANIM_OFF(5); SET_BOBPOSI(5, 0); - _vm->_objectsManager.BOBANIM_ON(6); + BOBANIM_ON(6); _vm->_globals.SAUVEGARDE->data[svField261] = 2; ZONE_OFF(15); _vm->_soundManager.PLAY_SOUND("SOUND75.WAV"); } if (_vm->_globals.SAUVEGARDE->data[svField261] == 2 && BOBPOSI(6) == 6) { - _vm->_objectsManager.BOBANIM_OFF(6); + BOBANIM_OFF(6); SET_BOBPOSI(6, 0); - _vm->_objectsManager.BOBANIM_ON(7); + BOBANIM_ON(7); ZONE_ON(14); _vm->_globals.SAUVEGARDE->data[svField261] = 3; } @@ -3777,7 +3848,7 @@ void ObjectsManager::SPECIAL_JEU() { while (BOBPOSI(8) != 3); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); - _vm->_objectsManager.BOBANIM_OFF(8); + BOBANIM_OFF(8); _vm->_globals.SAUVEGARDE->data[svField333] = 1; _vm->_globals.DESACTIVE_INVENT = 0; } @@ -3870,7 +3941,6 @@ int ObjectsManager::Traduction(byte *a1) { v70 = 0; if (*a1 != 'F' || *(a1 + 1) != 'C') return 0; - // TODO: Change to chars if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { v70 = *(a1 + 6); v2 = *(a1 + 7); @@ -3879,7 +3949,7 @@ int ObjectsManager::Traduction(byte *a1) { v65 = READ_LE_UINT16(a1 + 11); v3 = READ_LE_UINT16(a1 + 13); v1 = 1; - if (!_vm->_objectsManager.TRAVAILOBJET) { + if (!TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { if (v3 == 53) v3 = 644; @@ -3963,7 +4033,7 @@ int ObjectsManager::Traduction(byte *a1) { if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(v3, 4); } - if (_vm->_objectsManager.TRAVAILOBJET == 1) { + if (TRAVAILOBJET == 1) { if (_vm->_globals.SAUVEGARDE->data[svField356]) { _vm->_fontManager.DOS_TEXT(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); if (!_vm->_soundManager.TEXTOFF) @@ -3991,7 +4061,6 @@ LABEL_98: } } LABEL_104: - // TODO if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { if (DESACTIVE != 1) { v72 = *(a1 + 5); @@ -4028,36 +4097,36 @@ LABEL_1141: DEUXPERSO = 0; v5 = *(a1 + 5); v6 = *(a1 + 8); - _vm->_objectsManager.PERX = READ_LE_UINT16(a1 + 6); - _vm->_objectsManager.PERY = v6; - _vm->_objectsManager.PERI = v5; - if (_vm->_objectsManager.CH_TETE == 1) { + PERX = READ_LE_UINT16(a1 + 6); + PERY = v6; + PERI = v5; + if (CH_TETE == 1) { if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 && _vm->_globals.SAUVEGARDE->data[svField180] && _vm->_globals.SAUVEGARDE->data[svField181] && _vm->_globals.SAUVEGARDE->data[svField182] && _vm->_globals.SAUVEGARDE->data[svField183]) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField180]; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField181]; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField182]; + PERX = _vm->_globals.SAUVEGARDE->data[svField180]; + PERY = _vm->_globals.SAUVEGARDE->data[svField181]; + PERI = _vm->_globals.SAUVEGARDE->data[svField182]; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->data[svField190] && _vm->_globals.SAUVEGARDE->data[svField191] && _vm->_globals.SAUVEGARDE->data[svField192] && _vm->_globals.SAUVEGARDE->data[svField193]) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField190]; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField191]; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField192]; + PERX = _vm->_globals.SAUVEGARDE->data[svField190]; + PERY = _vm->_globals.SAUVEGARDE->data[svField191]; + PERI = _vm->_globals.SAUVEGARDE->data[svField192]; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 && _vm->_globals.SAUVEGARDE->data[svField185] && _vm->_globals.SAUVEGARDE->data[svField186] && _vm->_globals.SAUVEGARDE->data[svField187] && _vm->_globals.SAUVEGARDE->data[svField188]) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField185]; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField186]; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField187]; + PERX = _vm->_globals.SAUVEGARDE->data[svField185]; + PERY = _vm->_globals.SAUVEGARDE->data[svField186]; + PERI = _vm->_globals.SAUVEGARDE->data[svField187]; } } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { @@ -4092,7 +4161,7 @@ LABEL_1141: } } v1 = 1; - _vm->_objectsManager.CH_TETE = 0; + CH_TETE = 0; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { if (DESACTIVE != 1) { @@ -4350,9 +4419,9 @@ LABEL_1141: if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { v75 = READ_LE_UINT16(a1 + 5); if (v75 <= 100) - _vm->_objectsManager.BOBANIM_ON(v75); + BOBANIM_ON(v75); else - _vm->_objectsManager.BOBANIM_OFF(v75 - 100); + BOBANIM_OFF(v75 - 100); v1 = 1; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { @@ -4469,36 +4538,36 @@ LABEL_1141: _vm->_globals.NBBLOC = 0; } if (v76 == 608) { - _vm->_objectsManager.BOBANIM_OFF(2); - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_OFF(4); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_OFF(11); - _vm->_objectsManager.BOBANIM_OFF(10); + BOBANIM_OFF(2); + BOBANIM_OFF(3); + BOBANIM_OFF(4); + BOBANIM_OFF(6); + BOBANIM_OFF(11); + BOBANIM_OFF(10); } if (v76 == 609) { - _vm->_objectsManager.BOBANIM_ON(2); - _vm->_objectsManager.BOBANIM_ON(3); - _vm->_objectsManager.BOBANIM_ON(4); - _vm->_objectsManager.BOBANIM_ON(6); - _vm->_objectsManager.BOBANIM_ON(11); - _vm->_objectsManager.BOBANIM_ON(10); + BOBANIM_ON(2); + BOBANIM_ON(3); + BOBANIM_ON(4); + BOBANIM_ON(6); + BOBANIM_ON(11); + BOBANIM_ON(10); } if (v76 == 611) { - _vm->_objectsManager.BOBANIM_ON(5); - _vm->_objectsManager.BOBANIM_ON(7); - _vm->_objectsManager.BOBANIM_ON(8); - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(12); - _vm->_objectsManager.BOBANIM_ON(13); + BOBANIM_ON(5); + BOBANIM_ON(7); + BOBANIM_ON(8); + BOBANIM_ON(9); + BOBANIM_ON(12); + BOBANIM_ON(13); } if (v76 == 610) { - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.BOBANIM_OFF(8); - _vm->_objectsManager.BOBANIM_OFF(9); - _vm->_objectsManager.BOBANIM_OFF(12); - _vm->_objectsManager.BOBANIM_OFF(13); + BOBANIM_OFF(5); + BOBANIM_OFF(7); + BOBANIM_OFF(8); + BOBANIM_OFF(9); + BOBANIM_OFF(12); + BOBANIM_OFF(13); } if (v76 == 10) _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); @@ -4602,11 +4671,11 @@ LABEL_1141: } if (v76 == 29) { _vm->_globals.DESACTIVE_INVENT = 1; - OBJET_VIVANT("TELEP.pe2"); + _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); _vm->_globals.DESACTIVE_INVENT = 0; } if (v76 == 22) - OBJET_VIVANT("CADAVRE1.pe2"); + _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); if (v76 == 20) _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); if (v76 == 23) @@ -4682,8 +4751,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (BOBPOSI(9) != 36); SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(9); - _vm->_objectsManager.BOBANIM_OFF(10); + BOBANIM_OFF(9); + BOBANIM_OFF(10); _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); } @@ -4702,7 +4771,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != PTRNUL); SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(7); + BOBANIM_ON(7); SET_BOBPOSI(7, 0); v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); @@ -4720,15 +4789,15 @@ LABEL_1141: if (BOBPOSI(7) == 19) v18 = 0; if (BOBPOSI(7) == 19) - _vm->_objectsManager.BOBANIM_ON(3); + BOBANIM_ON(3); _vm->_eventsManager.VBL(); } while (BOBPOSI(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); SETANISPR(0, 62); SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_ON(6); - _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.BOBANIM_OFF(3); + BOBANIM_ON(6); + BOBANIM_OFF(7); + BOBANIM_OFF(3); } if (v76 == 50) { _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); @@ -4765,14 +4834,14 @@ LABEL_1141: } while (BOBPOSI(9) != v19); if (v19 == 12) { SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(9); + BOBANIM_OFF(9); } _vm->_globals.CACHE_ON(); } if (v76 == 80) { SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(12); - _vm->_objectsManager.BOBANIM_ON(13); + BOBANIM_ON(12); + BOBANIM_ON(13); SET_BOBPOSI(12, 0); SET_BOBPOSI(13, 0); v21 = 0; @@ -4792,16 +4861,16 @@ LABEL_1141: if (BOBPOSI(4) == 6) v21 = 0; if (BOBPOSI(13) == 8) { - _vm->_objectsManager.BOBANIM_OFF(13); - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_OFF(13); + BOBANIM_OFF(3); + BOBANIM_ON(4); SET_BOBPOSI(4, 0); SET_BOBPOSI(13, 0); } _vm->_eventsManager.VBL(); } while (BOBPOSI(4) != 16); - _vm->_objectsManager.BOBANIM_OFF(12); - _vm->_objectsManager.BOBANIM_OFF(4); + BOBANIM_OFF(12); + BOBANIM_OFF(4); SPRITE_ON(0); OBSSEUL = 1; INILINK("IM27a"); @@ -4822,8 +4891,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != PTRNUL); SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(11); - _vm->_objectsManager.BOBANIM_ON(8); + BOBANIM_ON(11); + BOBANIM_ON(8); SET_BOBPOSI(11, 0); SET_BOBPOSI(8, 0); _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); @@ -4847,25 +4916,25 @@ LABEL_1141: } while (BOBPOSI(8) != 32); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(11); - _vm->_objectsManager.BOBANIM_OFF(8); - _vm->_objectsManager.BOBANIM_ON(5); - _vm->_objectsManager.BOBANIM_ON(6); + BOBANIM_OFF(11); + BOBANIM_OFF(8); + BOBANIM_ON(5); + BOBANIM_ON(6); SET_BOBPOSI(5, 0); SET_BOBPOSI(6, 0); _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); while (BOBPOSI(5) != 74); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(7); + BOBANIM_OFF(5); + BOBANIM_OFF(6); + BOBANIM_ON(9); + BOBANIM_ON(7); } if (v76 == 95) { - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(10); - _vm->_objectsManager.BOBANIM_ON(12); + BOBANIM_ON(9); + BOBANIM_ON(10); + BOBANIM_ON(12); SET_BOBPOSI(9, 0); SET_BOBPOSI(10, 0); SET_BOBPOSI(12, 0); @@ -4873,26 +4942,26 @@ LABEL_1141: do _vm->_eventsManager.VBL(); while (BOBPOSI(9) != 15); - _vm->_objectsManager.BOBANIM_OFF(9); + BOBANIM_OFF(9); SPRITE_ON(0); _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); do _vm->_eventsManager.VBL(); while (BOBPOSI(12) != 117); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); - _vm->_objectsManager.BOBANIM_OFF(12); - _vm->_objectsManager.BOBANIM_OFF(10); - _vm->_objectsManager.BOBANIM_ON(11); + BOBANIM_OFF(12); + BOBANIM_OFF(10); + BOBANIM_ON(11); } if (v76 == 85) { - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_ON(5); + BOBANIM_OFF(3); + BOBANIM_ON(5); SET_BOBPOSI(5, 0); do _vm->_eventsManager.VBL(); while (BOBPOSI(5) != 6); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_ON(6); + BOBANIM_OFF(5); + BOBANIM_ON(6); OBSSEUL = 1; INILINK("IM24a"); OBSSEUL = 0; @@ -4901,8 +4970,8 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { SET_BOBPOSI(1, 0); SET_BOBPOSI(2, 0); - _vm->_objectsManager.BOBANIM_ON(1); - _vm->_objectsManager.BOBANIM_ON(2); + BOBANIM_ON(1); + BOBANIM_ON(2); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v25 = 0; do { @@ -4932,16 +5001,16 @@ LABEL_1141: v25 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(1) != 9); - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_OFF(2); + BOBANIM_OFF(1); + BOBANIM_OFF(2); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { SET_BOBPOSI(1, 0); SET_BOBPOSI(3, 0); - _vm->_objectsManager.BOBANIM_ON(1); - _vm->_objectsManager.BOBANIM_ON(3); + BOBANIM_ON(1); + BOBANIM_ON(3); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v26 = 0; do { @@ -4971,8 +5040,8 @@ LABEL_1141: v26 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(1) != 9); - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_OFF(3); + BOBANIM_OFF(1); + BOBANIM_OFF(3); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); _vm->_soundManager.DEL_SAMPLE(1); } @@ -5026,9 +5095,9 @@ LABEL_1141: } } if (v76 == 62) - OBJET_VIVANT("SBCADA.pe2"); + _vm->_talkManager.OBJET_VIVANT("SBCADA.pe2"); if (v76 == 65) - OBJET_VIVANT("ScCADA.pe2"); + _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); if (v76 == 105) { _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); @@ -5059,7 +5128,7 @@ LABEL_1141: SETANISPR(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_ON(4); v33 = 0; do { if (BOBPOSI(4) == 9 && !v33) { @@ -5082,10 +5151,10 @@ LABEL_1141: v33 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(4) != 72); - _vm->_objectsManager.BOBANIM_OFF(4); + BOBANIM_OFF(4); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - _vm->_objectsManager.BOBANIM_ON(6); + BOBANIM_ON(6); v34 = 0; do { if (BOBPOSI(6) == 9 && !v34) { @@ -5108,10 +5177,10 @@ LABEL_1141: v34 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(6) != 72); - _vm->_objectsManager.BOBANIM_OFF(6); + BOBANIM_OFF(6); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - _vm->_objectsManager.BOBANIM_ON(5); + BOBANIM_ON(5); v35 = 0; do { if (BOBPOSI(5) == 9 && !v35) { @@ -5134,7 +5203,7 @@ LABEL_1141: v35 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(5) != 72); - _vm->_objectsManager.BOBANIM_OFF(5); + BOBANIM_OFF(5); } SPRITE_ON(0); ACTION_DOS(1); @@ -5142,7 +5211,7 @@ LABEL_1141: } if (v76 == 106) { SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_ON(4); SET_BOBPOSI(4, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); @@ -5162,12 +5231,12 @@ LABEL_1141: do _vm->_eventsManager.VBL(); while (BOBPOSI(4) != 77); - _vm->_objectsManager.BOBANIM_OFF(4); + BOBANIM_OFF(4); SPRITE_ON(0); } if (v76 == 107) { SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(5); + BOBANIM_ON(5); SET_BOBPOSI(5, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); @@ -5187,7 +5256,7 @@ LABEL_1141: do _vm->_eventsManager.VBL(); while (BOBPOSI(5) != 53); - _vm->_objectsManager.BOBANIM_OFF(5); + BOBANIM_OFF(5); SPRITE_ON(0); } if (v76 == 210) { @@ -5196,7 +5265,7 @@ LABEL_1141: _vm->_soundManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); - _vm->_objectsManager.BOBANIM_ON(9); + BOBANIM_ON(9); OBSSEUL = 1; INILINK("IM73a"); OBSSEUL = 0; @@ -5231,7 +5300,7 @@ LABEL_1141: _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); } if (v76 == 207) - OBJET_VIVANT("PANNEAU.PE2"); + _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); if (v76 == 208) { _vm->_globals.DESACTIVE_INVENT = 1; if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { @@ -5260,12 +5329,12 @@ LABEL_1141: SET_BOBPOSI(1, 0); SET_BOBPOSI(2, 0); SETANISPR(0, 60); - _vm->_objectsManager.BOBANIM_OFF(4); - _vm->_objectsManager.BOBANIM_ON(1); + BOBANIM_OFF(4); + BOBANIM_ON(1); do _vm->_eventsManager.VBL(); while (BOBPOSI(1) != 9); - _vm->_objectsManager.BOBANIM_OFF(1); + BOBANIM_OFF(1); _vm->_globals.NO_VISU = 1; _vm->_globals.chemin = PTRNUL; _vm->_globals.NOT_VERIF = 1; @@ -5279,38 +5348,38 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != PTRNUL); SETANISPR(0, 64); - _vm->_objectsManager.BOBANIM_ON(2); + BOBANIM_ON(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); do _vm->_eventsManager.VBL(); while (BOBPOSI(2) != 10); - _vm->_objectsManager.BOBANIM_OFF(2); - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_OFF(2); + BOBANIM_ON(4); } if (v76 == 201) { - _vm->_objectsManager.BOBANIM_ON(3); + BOBANIM_ON(3); do _vm->_eventsManager.VBL(); while (BOBPOSI(3) != 18); - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_OFF(3); + BOBANIM_ON(4); } if (v76 == 203) { _vm->_globals.NO_VISU = 1; SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_ON(4); do { _vm->_eventsManager.VBL(); if (BOBPOSI(4) == 18) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); } while (BOBPOSI(4) != 26); - _vm->_objectsManager.BOBANIM_OFF(4); + BOBANIM_OFF(4); _vm->_globals.NO_VISU = 0; SPRITE_ON(0); } if (v76 == 204) { SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(3); + BOBANIM_ON(3); _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); v41 = 0; do { @@ -5322,12 +5391,12 @@ LABEL_1141: v41 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(3) != 50); - _vm->_objectsManager.BOBANIM_OFF(3); + BOBANIM_OFF(3); SPRITE_ON(0); } if (v76 == 205) { SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_ON(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); v42 = 0; do { @@ -5339,41 +5408,41 @@ LABEL_1141: v42 = 0; _vm->_eventsManager.VBL(); } while (BOBPOSI(4) != 24); - _vm->_objectsManager.BOBANIM_OFF(4); + BOBANIM_OFF(4); SPRITE_ON(0); } if (v76 == 175) { SETANISPR(0, 55); SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(10); + BOBANIM_ON(9); + BOBANIM_ON(10); BOB_OFFSET(10, 300); _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); do _vm->_eventsManager.VBL(); while (BOBPOSI(10) != 7); - _vm->_objectsManager.BOBANIM_ON(6); - _vm->_objectsManager.BOBANIM_OFF(3); + BOBANIM_ON(6); + BOBANIM_OFF(3); do _vm->_eventsManager.VBL(); while (BOBPOSI(6) != 10); _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); - _vm->_objectsManager.BOBANIM_ON(7); - _vm->_objectsManager.BOBANIM_OFF(4); + BOBANIM_ON(7); + BOBANIM_OFF(4); do _vm->_eventsManager.VBL(); while (BOBPOSI(7) != 15); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_ON(8); + BOBANIM_OFF(5); + BOBANIM_ON(8); _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); do _vm->_eventsManager.VBL(); while (BOBPOSI(8) != 76); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.BOBANIM_OFF(8); - _vm->_objectsManager.BOBANIM_OFF(9); - _vm->_objectsManager.BOBANIM_OFF(10); + BOBANIM_OFF(6); + BOBANIM_OFF(7); + BOBANIM_OFF(8); + BOBANIM_OFF(9); + BOBANIM_OFF(10); SPRITE_ON(0); } if (v76 == 229) { @@ -5403,7 +5472,7 @@ LABEL_1141: } while (_vm->_globals.chemin != PTRNUL); SPRITE_OFF(0); v45 = 0; - _vm->_objectsManager.BOBANIM_ON(7); + BOBANIM_ON(7); do { if (BOBPOSI(7) == 9 && !v45) { v45 = 1; @@ -5411,7 +5480,7 @@ LABEL_1141: } _vm->_eventsManager.VBL(); } while (BOBPOSI(7) != 15); - _vm->_objectsManager.BOBANIM_OFF(7); + BOBANIM_OFF(7); SETXSPR(0, 476); SETYSPR(0, 278); SPRITE_ON(0); @@ -5424,7 +5493,7 @@ LABEL_1141: if (v76 == 231) { _vm->_globals.CACHE_OFF(); SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(12); + BOBANIM_ON(12); do _vm->_eventsManager.VBL(); while (BOBPOSI(12) != 6); @@ -5435,22 +5504,22 @@ LABEL_1141: _vm->_eventsManager.VBL(); while (BOBPOSI(12) != 12); SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(12); + BOBANIM_OFF(12); _vm->_globals.CACHE_ON(); } if (v76 == 233) { _vm->_globals.CACHE_OFF(); SPRITE_OFF(0); - _vm->_objectsManager.BOBANIM_ON(11); + BOBANIM_ON(11); v46 = 0; do { _vm->_eventsManager.VBL(); if (BOBPOSI(11) == 10 && !v46) v46 = 1; } while (BOBPOSI(11) != 13); - _vm->_objectsManager.BOBANIM_OFF(11); + BOBANIM_OFF(11); _vm->_globals.CACHE_ON(); - _vm->_objectsManager.BOBANIM_ON(13); + BOBANIM_ON(13); do _vm->_eventsManager.VBL(); while (BOBPOSI(13) != 48); @@ -5458,7 +5527,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals.NOPARLE = 0; _vm->_graphicsManager.FADE_OUTW(); - _vm->_objectsManager.BOBANIM_OFF(13); + BOBANIM_OFF(13); _vm->_graphicsManager.NOFADE = 1; _vm->_globals.SORTIE = 94; } @@ -5563,7 +5632,7 @@ LABEL_1141: OPTI_ONE(16, 0, 10, 0); } if (v76 == 240) { - _vm->_objectsManager.BOBANIM_ON(1); + BOBANIM_ON(1); v50 = 0; do { _vm->_eventsManager.VBL(); @@ -5580,8 +5649,8 @@ LABEL_1141: if (BOBPOSI(1) == 25) v50 = 0; } while (BOBPOSI(1) != 32); - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_ON(2); + BOBANIM_OFF(1); + BOBANIM_ON(2); _vm->_fontManager.TEXTE_OFF(9); if (!_vm->_soundManager.TEXTOFF) { _vm->_fontManager.DOS_TEXT(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); @@ -5664,7 +5733,7 @@ LABEL_1141: } _vm->_eventsManager.VBL(); } while (BOBPOSI(12) != 34); - _vm->_objectsManager.BOBANIM_OFF(2); + BOBANIM_OFF(2); _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = 1; _vm->_globals.SORTIE = 20; @@ -5861,9 +5930,9 @@ LABEL_1141: _vm->_globals.SORTIE = 100; } if (v76 == 55) { - _vm->_objectsManager.BOBANIM_OFF(1); + BOBANIM_OFF(1); OPTI_ONE(15, 0, 12, 0); - _vm->_objectsManager.BOBANIM_OFF(15); + BOBANIM_OFF(15); OBSSEUL = 1; INILINK("IM19a"); OBSSEUL = 0; @@ -6239,16 +6308,35 @@ void ObjectsManager::ZONE_OFF(int idx) { } -void ObjectsManager::OPTI_ONE(int a1, int a2, int a3, int a4) { - warning("TODO: OPTI_ONE"); +void ObjectsManager::OPTI_ONE(int idx, int a2, int a3, int a4) { + if (a4 != 3) { + BOBANIM_ON(idx); + SET_BOBPOSI(idx, a2); + } + + do { + _vm->_eventsManager.VBL(); + } while (a3 != BOBPOSI(idx)); + + if (!a4) + BOBANIM_OFF(idx); + if (a4 == 4) { + _vm->_graphicsManager.AFFICHE_SPEED( + _vm->_globals.Bob[idx].field4, + _vm->_globals.Bob[idx].field3E, + _vm->_globals.Bob[idx].field40, + _vm->_globals.Bob[idx].fieldC); + BOBANIM_OFF(idx); + _vm->_eventsManager.VBL(); + } } void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { SPEED_FLAG = true; SPEED_PTR = speedData; - _vm->_objectsManager.SPEED_X = xp; - _vm->_objectsManager.SPEED_Y = yp; + SPEED_X = xp; + SPEED_Y = yp; SPEED_IMAGE = img; } @@ -6290,19 +6378,270 @@ int ObjectsManager::BOBA(int idx) { } void ObjectsManager::INILINK(const Common::String &file) { - warning("TODO: INILINK"); -} + int v1; + int v2; + int v8; + int v9; + int v10; + int v11; + int v12; + byte *v13; + int v14; + int v15; + byte *v16; + byte *v17; + int v18; + int v19; + int v20; + int v21; + byte *v22; + int v23; + int v24; + int v25; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36; + byte *v37; + int v40; + size_t v41; + size_t v42; + size_t nbytes; + byte *ptr; + Common::String filename, filename2; + Common::File f; + + v1 = 0; + v2 = 0; + + filename = file + ".LNK"; + ptr = FileManager::RECHERCHE_CAT(filename, 3); + nbytes = _vm->_globals.CAT_TAILLE; + if (ptr == PTRNUL) { + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); + + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + + nbytes = f.size(); + ptr = _vm->_globals.dos_malloc2(nbytes); + if (PTRNUL == ptr) + error("INILINK"); + FileManager::bload_it(f, ptr, nbytes); + f.close(); + } + if (!OBSSEUL) { + for (int idx = 0; idx < 500; ++idx) + _vm->_globals.STAILLE[idx] = READ_LE_UINT16((uint16 *)ptr + idx); + + _vm->_globals.RESET_CACHE(); + + filename2 = Common::String((const char *)ptr + 1000); + if (!filename2.empty()) { + _vm->_globals.CACHE_BANQUE[1] = FileManager::RECHERCHE_CAT(filename2, 8); + if (_vm->_globals.CACHE_BANQUE[1]) { + _vm->_globals.CAT_FLAG = 0; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); + } else { + _vm->_globals.CAT_FLAG = 1; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); + } + _vm->_globals.CACHE_BANQUE[1] = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.CAT_FLAG = 0; + v36 = 60; + v37 = ptr + 1000; + v40 = 0; + + do { + v8 = READ_LE_UINT16(v37 + 2 * v36); + v9 = READ_LE_UINT16(v37 + 2 * v36 + 2); + v10 = READ_LE_UINT16(v37 + 2 * v36 + 4); + v11 = v40; + + _vm->_globals.Cache[v11].field14 = READ_LE_UINT16(v37 + 2 * v36 + 8); + _vm->_globals.Cache[v11].field2 = v8; + _vm->_globals.Cache[v11].field0 = v9; + _vm->_globals.Cache[v11].field4 = v10; + _vm->_globals.Cache[v11].field12 = 1; + + if (_vm->_globals.CACHE_BANQUE[1]) { + _vm->_globals.Cache[v40].fieldA = 0; + } else { + v12 = v8; + v13 = _vm->_globals.CACHE_BANQUE[1]; + v14 = Get_Largeur(v13, v8); + v15 = Get_Hauteur(v13, v12); + _vm->_globals.Cache[v40].fieldC = v13; + _vm->_globals.Cache[v40].field6 = v14; + _vm->_globals.Cache[v40].field8 = v15; + _vm->_globals.Cache[v40].fieldA = 1; + } + if (!_vm->_globals.Cache[v40].field0 && !_vm->_globals.Cache[v40].field4 + && !_vm->_globals.Cache[v40].field2) + _vm->_globals.Cache[v40].fieldA = 0; + v36 += 5; + ++v40; + } while (v40 <= 21); + _vm->_globals.CACHE_ON(); + } + } -void ObjectsManager::OBJET_VIVANT(const Common::String &a2) { - warning("TODO: OBJET_VIVANT"); + _vm->_linesManager.RESET_OBSTACLE(); + v41 = 0; + if (nbytes) { + do { + if (*(ptr + v41) == 79 && *(ptr + v41 + 1) == 66 && *(ptr + v41 + 2) == 50) { + v16 = ptr + v41 + 4; + v32 = 0; + v34 = 0; + _vm->_linesManager.TOTAL_LIGNES = 0; + do { + v27 = READ_LE_UINT16(v16 + 2 * v32); + if (v27 != -1) { + _vm->_linesManager.AJOUTE_LIGNE( + v34, + v27, + READ_LE_UINT16(v16 + 2 * v32 + 2), + READ_LE_UINT16(v16 + 2 * v32 + 4), + READ_LE_UINT16(v16 + 2 * v32 + 6), + READ_LE_UINT16(v16 + 2 * v32 + 8), + 1); + ++_vm->_linesManager.TOTAL_LIGNES; + } + v32 += 5; + ++v34; + } while (v27 != -1); + _vm->_linesManager.INIPARCOURS(); + } + ++v41; + } while (nbytes > v41); + } + if (!OBSSEUL) { + v42 = 0; + if (nbytes) { + do { + if (*(ptr + v42) == 'Z' && *(ptr + v42 + 1) == 'O' && *(ptr + v42 + 2) == '2') { + v17 = ptr + v42 + 4; + v33 = 0; + v35 = 0; + v18 = 1; + do { + v19 = 20 * v18; + _vm->_globals.ZONEP[v19].field0 = 0; + _vm->_globals.ZONEP[v19].field2 = 0; + _vm->_globals.ZONEP[v19].field4 = 0; + _vm->_globals.ZONEP[v19].field6 = 0; + _vm->_globals.ZONEP[v19].field7 = 0; + _vm->_globals.ZONEP[v19].field8 = 0; + _vm->_globals.ZONEP[v19].field9 = 0; + _vm->_globals.ZONEP[v19].fieldA = 0; + _vm->_globals.ZONEP[v19].fieldB = 0; + _vm->_globals.ZONEP[v19].fieldC = 0; + _vm->_globals.ZONEP[v19].fieldD = 0; + _vm->_globals.ZONEP[v19].fieldE = 0; + _vm->_globals.ZONEP[v19].fieldF = 0; + _vm->_globals.ZONEP[v19].field12 = 0; + ++v18; + } while (v18 <= 100); + + v31 = 0; + do { + v28 = READ_LE_UINT16(v17 + 2 * v33); + if (v28 != -1) { + _vm->_linesManager.AJOUTE_LIGNE_ZONE( + v35, + READ_LE_UINT16(v17 + 2 * v33 + 2), + READ_LE_UINT16(v17 + 2 * v33 + 4), + READ_LE_UINT16(v17 + 2 * v33 + 6), + READ_LE_UINT16(v17 + 2 * v33 + 8), + v28); + _vm->_globals.ZONEP[v28].field10 = 1; + } + v33 += 5; + ++v35; + ++v31; + } while (v28 != -1); + v20 = 1; + do { + v21 = 20 * v20; + _vm->_globals.ZONEP[v21].field0 = READ_LE_UINT16(v17 + 2 * v33); + _vm->_globals.ZONEP[v21].field2 = READ_LE_UINT16(v17 + 2 * v33 + 2); + _vm->_globals.ZONEP[v21].field4 = READ_LE_UINT16(v17 + 2 * v33 + 4); + v33 += 3; + ++v20; + } while (v20 <= 100); + + v22 = ptr + v42 + (10 * v31 + 606) + 4; + v29 = 0; + v23 = 1; + do { + v24 = 20 * v23; + _vm->_globals.ZONEP[v24].field6 = *(v29 + v22); + _vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1); + _vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2); + _vm->_globals.ZONEP[v24].field9 = *(v22 + v29 + 3); + _vm->_globals.ZONEP[v24].fieldA = *(v22 + v29 + 4); + _vm->_globals.ZONEP[v24].fieldB = *(v22 + v29 + 5); + _vm->_globals.ZONEP[v24].fieldC = *(v22 + v29 + 6); + _vm->_globals.ZONEP[v24].fieldD = *(v22 + v29 + 7); + _vm->_globals.ZONEP[v24].fieldE = *(v22 + v29 + 8); + _vm->_globals.ZONEP[v24].fieldF = *(v22 + v29 + 9); + v29 += 10; + ++v23; + } while (v23 <= 100); + v30 = 0; + v25 = 1; + do + _vm->_globals.ZONEP[v25].field12 = READ_LE_UINT16(v22 + 1010 + 2 * v30++); + while (++v25 <= 100); + CARRE_ZONE(); + } + ++v42; + } while (nbytes > v42); + } + } + _vm->_globals.dos_free2(ptr); } void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { - warning("TODO: OPTI_BOBON"); + if (a1 != -1) + _vm->_objectsManager.BOBANIM_ON(a1); + if (a2 != -1) + _vm->_objectsManager.BOBANIM_ON(a2); + if (a3 != -1) + _vm->_objectsManager.BOBANIM_ON(a3); + if (!a7) { + if (a1 != -1) + SET_BOBPOSI(a1, a4); + if (a2 != -1) + SET_BOBPOSI(a2, a5); + if (a3 != -1) + SET_BOBPOSI(a3, a6); + } } void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { - warning("TODO: SCI_OPTI_ONE"); + _vm->_eventsManager.souris_bb = 0; + _vm->_eventsManager.souris_b = 0; + + if (a4 != 3) { + _vm->_objectsManager.BOBANIM_ON(a1); + SET_BOBPOSI(a1, a2); + } + + do { + _vm->_eventsManager.VBL(); + if (_vm->_eventsManager.souris_bb) + break; + } while (a3 != BOBPOSI(a1)); + if (!a4) + _vm->_objectsManager.BOBANIM_OFF(a1); } int ObjectsManager::Control_Goto(const byte *dataP) { @@ -6310,25 +6649,315 @@ int ObjectsManager::Control_Goto(const byte *dataP) { } int ObjectsManager::Control_If(const byte *dataP, int a2) { - warning("TODO: Control_If"); - return 0; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + const byte *v8; + int v9; + int v10; + int v11; + int v12; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + + v2 = a2; +LABEL_2: + v3 = v2; + do { + ++v3; + v4 = Traduction2(dataP + 20 * v3); + if (v3 > 400) { + v5 = v4; + error("Control if failed"); + v4 = v5; + } + } while (v4 != 4); + v20 = v3; + v6 = v2; + v7 = 0; + do { + ++v6; + if (Traduction2(dataP + 20 * v6) == 3) + v7 = 1; + if (v6 > 400) + error("Control if failed "); + if (v7 == 1) { + v2 = v20; + goto LABEL_2; + } + } while (v20 != v6); + v8 = dataP + 20 * a2; + v9 = *(v8 + 13); + v17 = *(v8 + 14); + v16 = *(v8 + 15); + v10 = READ_LE_UINT16(v8 + 5); + v11 = READ_LE_UINT16(v8 + 7); + v19 = READ_LE_UINT16(v8 + 9); + v18 = READ_LE_UINT16(v8 + 11); + v14 = 0; + v15 = 0; + if (v9 == 1 && _vm->_globals.SAUVEGARDE->data[v10] == v11) + v14 = 1; + if (v9 == 2 && _vm->_globals.SAUVEGARDE->data[v10] != v11) + v14 = 1; + if (v9 == 3 && _vm->_globals.SAUVEGARDE->data[v10] <= v11) + v14 = 1; + if (v9 == 4 && _vm->_globals.SAUVEGARDE->data[v10] >= v11) + v14 = 1; + if (v9 == 5 && _vm->_globals.SAUVEGARDE->data[v10] > v11) + v14 = 1; + if (v9 == 6 && _vm->_globals.SAUVEGARDE->data[v10] < v11) + v14 = 1; + if (v16 == 3) + goto LABEL_68; + if (v17 == 1 && v18 == _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 2 && v18 != _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 3 && v18 >= _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 4 && v18 <= _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 5 && v18 < _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 6 && v18 > _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v16 == 3) { +LABEL_68: + if (v14 == 1) { + v12 = a2; + return (v12 + 1); + } + if (!v14) { +LABEL_63: + v12 = v20; + return (v12 + 1); + } + } + if (v16 == 1) { + if (v14 == 1 && v15 == 1) { + v12 = a2; + return (v12 + 1); + } + goto LABEL_63; + } + if (v16 == 2) { + if (v14 == 1 || v15 == 1) { + v12 = a2; + return (v12 + 1); + } + goto LABEL_63; + } + return -1; } -void ObjectsManager::VERBE_OFF(int a1, int a2) { - warning("TODO: VERBE_OFF"); +int ObjectsManager::Traduction2(const byte *dataP) { + signed __int16 result; + + result = 0; + if (*dataP != 'F' || *(dataP + 1) != 'C') { + result = 0; + } else { + if (*(dataP + 'T') == 84 && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') + result = 1; + if (*(dataP + 2) == 'B') { + if (*(dataP + 3) == 'O' && *(dataP + 4) == 'B') + result = 1; + if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') + result = 1; + } + if (*(dataP + 2) == 'P' && *(dataP + 3) == 'E' && *(dataP + 4) == 'R') + result = 1; + if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'U') + result = 1; + if (*(dataP + 2) == 'M' && *(dataP + 3) == 'U' && *(dataP + 4) == 'S') + result = 1; + if (*(dataP + 2) == 'O') { + if (*(dataP + 3) == 'B' && *(dataP + 4) == 'P') + result = 1; + if (*(dataP + 2) == 'O' && *(dataP + 3) == 'B' && *(dataP + 4) == 'M') + result = 1; + } + if (*(dataP + 2) == 'G' && *(dataP + 3) == 'O' && *(dataP + 4) == 'T') + result = 2; + if (*(dataP + 2) == 'Z') { + if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') + result = 1; + if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') + result = 1; + } + if (*(dataP + 2) == 'E' && *(dataP + 3) == 'X' && *(dataP + 4) == 'I') + result = 5; + if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'R') + result = 5; + if (*(dataP + 2) == 'A' && *(dataP + 3) == 'N' && *(dataP + 4) == 'I') + result = 1; + if (*(dataP + 2) == 'S' && *(dataP + 3) == 'P' && *(dataP + 4) == 'E') + result = 1; + if (*(dataP + 2) == 'E' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') + result = 4; + if (*(dataP + 2) == 'V') { + if (*(dataP + 3) == 'A' && *(dataP + 4) == 'L') + result = 1; + if (*(dataP + 2) == 'V') { + if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') + result = 1; + if (*(dataP + 2) == 'V' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') + result = 1; + } + } + if (*(dataP + 2) == 'I' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') + result = 3; + if (*(dataP + 2) == 'J' && *(dataP + 3) == 'U' && *(dataP + 4) == 'M') + result = 6; + if (*(dataP + 2) == 'B') { + if (*(dataP + 3) == 'C' && *(dataP + 4) == 'A') + result = 1; + if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'S') + result = 1; + } + if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'C') { + if (*(dataP + 4) == 'H') + result = 1; + } + } + return result; } -void ObjectsManager::VERBE_ON(int a1, int a2) { - warning("TODO: VERBE_ON"); +void ObjectsManager::VERBE_OFF(int idx, int a2) { + if (a2 == 6) { + _vm->_globals.ZONEP[idx].field6 = 0; + } + if (a2 == 7) { + _vm->_globals.ZONEP[idx].field7 = 0; + } + if (a2 == 8) { + _vm->_globals.ZONEP[idx].field8 = 0; + } + if (a2 == 9) { + _vm->_globals.ZONEP[idx].field9 = 0; + } + if (a2 == 10) { + _vm->_globals.ZONEP[idx].fieldA = 0; + } + if (a2 == 11) { + _vm->_globals.ZONEP[idx].fieldB = 0; + } + if (a2 == 12) { + _vm->_globals.ZONEP[idx].fieldC = 0; + } + if (a2 == 13) { + _vm->_globals.ZONEP[idx].fieldD = 0; + } + if (a2 == 14 || a2 == 25) { + _vm->_globals.ZONEP[idx].fieldE = 0; + } + if (a2 == 15) { + _vm->_globals.ZONEP[idx].fieldF = 0; + } + if (a2 == 16) { + _vm->_globals.ZONEP[idx].field6 = 0; + } + if (a2 == 5) { + _vm->_globals.ZONEP[idx].field8 = 0; + } + if (a2 == 17) { + _vm->_globals.ZONEP[idx].field9 = 0; + } + if (a2 == 18) { + _vm->_globals.ZONEP[idx].fieldA = 0; + } + if (a2 == 19) { + _vm->_globals.ZONEP[idx].fieldB = 0; + } + if (a2 == 20) { + _vm->_globals.ZONEP[idx].fieldC = 0; + } + if (a2 == 22) { + _vm->_globals.ZONEP[idx].fieldD = 0; + } + if (a2 == 21) { + _vm->_globals.ZONEP[idx].fieldE = 0; + } + if (a2 == 24) { + _vm->_globals.ZONEP[idx].field9 = 0; + } + CHANGEVERBE = 1; } -int ObjectsManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { - warning("TODO: GENIAL"); - return 0; +void ObjectsManager::VERBE_ON(int idx, int a2) { + if (a2 == 6) { + _vm->_globals.ZONEP[idx].field6 = 1; + } + if (a2 == 7) { + _vm->_globals.ZONEP[idx].field7 = 1; + } + if (a2 == 8) { + _vm->_globals.ZONEP[idx].field8 = 1; + } + if (a2 == 9) { + _vm->_globals.ZONEP[idx].field9 = 1; + } + if (a2 == 10) { + _vm->_globals.ZONEP[idx].fieldA = 1; + } + if (a2 == 11) { + _vm->_globals.ZONEP[idx].fieldB = 1; + } + if (a2 == 12) { + _vm->_globals.ZONEP[idx].fieldC = 1; + } + if (a2 == 13) { + _vm->_globals.ZONEP[idx].fieldD = 1; + } + if (a2 == 14) { + _vm->_globals.ZONEP[idx].fieldD = 1; + } + if (a2 == 15) { + _vm->_globals.ZONEP[idx].fieldE = 1; + } + if (a2 == 16) { + _vm->_globals.ZONEP[idx].field6 = 2; + } + if (a2 == 5) { + _vm->_globals.ZONEP[idx].field8 = 2; + } + if (a2 == 17) { + _vm->_globals.ZONEP[idx].field9 = 2; + } + if (a2 == 18) { + _vm->_globals.ZONEP[idx].fieldA = 2; + } + if (a2 == 19) { + _vm->_globals.ZONEP[idx].fieldB = 2; + } + if (a2 == 20) { + _vm->_globals.ZONEP[idx].fieldC = 2; + } + if (a2 == 22) { + _vm->_globals.ZONEP[idx].fieldD = 2; + } + if (a2 == 21) { + _vm->_globals.ZONEP[idx].fieldE = 2; + } + if (a2 == 24) { + _vm->_globals.ZONEP[idx].field9 = 3; + } + if (a2 == 25) { + _vm->_globals.ZONEP[idx].fieldE = 2; + } } int ObjectsManager::CALC_PROPRE(int idx) { - signed int v1; + int v1; int v2; int v3; int v4; @@ -6417,8 +7046,78 @@ int ObjectsManager::colision(int a1, int a2) { return -1; } -void ObjectsManager::ACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { - warning("TODO: ACTION"); +void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6) { + int v6; + int v7; + char v8; + int v9; + int v10; + int v11; + int v13; + const byte *v14; + char v15; + int v16; + int v17; + int v18; + Common::String v19; + + v18 = 0; + v6 = 0; + v13 = 0; + v15 = a5; + v19 = " "; + if (_vm->_globals.vitesse == 2) + v15 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v15 = a5 / 3; + v14 = Sprite[0].spriteData; + v17 = Sprite[0].field10; + v16 = Sprite[0].fieldE; + Sprite[0].field12 += a3; + Sprite[0].field14 += a4; + Sprite[0].fieldE = a6; + + for (;;) { + v7 = 0; + v8 = a2[v18]; + if (v8 == ',') { + v9 = atoi(v19.c_str()); + v13 = v9; + v6 = 0; + v19 = " "; + v7 = 1; + } else { + v9 = v6; + v19 += v8; + v6 = v6 + 1; + } + ++v18; + if (v7 == 1) { + if (v13 == -1) { + Sprite[0].spriteData = v14; + Sprite[0].field10 = v17; + Sprite[0].field12 -= a3; + Sprite[0].field14 -= a4; + Sprite[0].fieldE = v16; + } else { + Sprite[0].spriteData = spriteData; + Sprite[0].field10 = v13; + } + v10 = 0; + v9 = v15; + if (v15 > 0) { + do { + v11 = v9; + _vm->_eventsManager.VBL(); + ++v10; + v9 = v11; + } while (v10 < v11); + } + if (v13 == -1) + break; + } + } + return; } void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { @@ -6514,17 +7213,23 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) && a4 < YSPR(0) && a5 > YSPR(0)) { if (a6 == 1) - _vm->_objectsManager.BOBANIM_ON(1); + BOBANIM_ON(1); if (a6 == 2) - _vm->_objectsManager.BOBANIM_ON(2); + BOBANIM_ON(2); if (a6 == 3) - _vm->_objectsManager.BOBANIM_ON(3); + BOBANIM_ON(3); if (a6 == 4) - _vm->_objectsManager.BOBANIM_ON(4); + BOBANIM_ON(4); _vm->_globals.SAUVEGARDE->data[v6] = 1; } } } } +void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { + _vm->_globals.BL_ANIM[idx].v1 = 1; + _vm->_globals.BL_ANIM[idx].v2 = a2; +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 705d90f73b..ad87291520 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -189,6 +189,7 @@ public: void CHARGE_OBSTACLE(const Common::String &file); void CHARGE_CACHE(const Common::String &file); void CHARGE_ZONE(const Common::String &file); + void CARRE_ZONE(); void PLAN_BETA(); void BTGAUCHE(); void PARADISE(); @@ -231,22 +232,22 @@ public: int BOBA(int idx); void INILINK(const Common::String &file); - void OBJET_VIVANT(const Common::String &a2); void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); void SCI_OPTI_ONE(int a1, int a2, int a3, int a4); int Control_Goto(const byte *dataP); int Control_If(const byte *dataP, int a2); - void VERBE_OFF(int a1, int a2); - void VERBE_ON(int a1, int a2); - int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); + int Traduction2(const byte *dataP); + void VERBE_OFF(int idx, int a2); + void VERBE_ON(int idx, int a2); int CALC_PROPRE(int idx); int PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6); int colision(int a1, int a2); - void ACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6); + void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); void SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6); void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); + void BLOQUE_ANIMX(int idx, int a2); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index d57b8b938c..13179c1a36 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -130,8 +130,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { CLEAR_ANIM_PERSO(); _vm->_globals.NOPARLE = 0; _vm->_globals.NECESSAIRE = 1; - BUFFERPERSO = FileManager::LIBERE_FICHIER(BUFFERPERSO); - PERSOSPR = FileManager::LIBERE_FICHIER(PERSOSPR); + BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); + PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; FileManager::CONSTRUIT_LINUX("TEMP.SCR"); @@ -496,7 +496,7 @@ int TalkManager::DIALOGUE_REP(int idx) { if (v20) _vm->_objectsManager.BOBANIM_OFF(v20); } else { - FIN_VISU_PARLE(i); + FIN_VISU_PARLE(); } v21 = 0; if (!PLIGNE1) @@ -584,7 +584,7 @@ void TalkManager::FIN_VISU_WAIT() { } } -void TalkManager::FIN_VISU_PARLE(int a1) { +void TalkManager::FIN_VISU_PARLE() { for (int idx = 21; idx <= 25; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) _vm->_objectsManager.BOB_OFF(idx); @@ -934,11 +934,388 @@ bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int } void TalkManager::REPONSE(int a1, int a2) { - warning("TODO: RESPONSE"); + byte v2; + byte v3; + byte *v5; + byte *v6; + uint16 v7; + byte *v8; + int v9; + int v10; + uint16 v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + byte *ptr; + + v2 = a1; + v3 = a2; +LABEL_2: + v15 = 0; + if (PTRNUL != _vm->_globals.COUCOU) { + v5 = _vm->_globals.COUCOU; + while (1) { + if (*v5 == 'C') { + if (*(v5 + 1) == 'O') { + if (*(v5 + 2) == 'D') { + if (*(v5 + 3) == v2) { + if (*(v5 + 4) == v3) + v15 = 1; + } + } + } + } + if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') + break; + if (!v15) + v5 = v5 + 1; + if (v15 == 1) { + v6 = v5 + 5; + ptr = _vm->_globals.dos_malloc2(0x26Cu); + if (PTRNUL == ptr) + error("TRADUC"); + memset(ptr, 0, 0x26Bu); + v7 = 0; + v12 = 0; + v14 = 0; + do { + v16 = 0; + if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'C') { + ++v12; + v8 = (ptr + 20 * v12); + v11 = 0; + do { + *(v11++ + v8) = *(v7++ + v6); + if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'F') { + v16 = 1; + v9 = v11; + *(v9 + v8) = 'F'; + *(v8 + v9 + 1) = 'F'; + ++v7; + } + } while (v16 != 1); + } + if (v16 != 1) { + if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'O' && *(v6 + v7 + 2) == 'D') + v14 = 1; + if (v16 != 1 && *(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'I' && *(v6 + v7 + 2) == 'N') + v14 = 1; + } + v6 += v7 + 1; + v7 = 0; + } while (v14 != 1); + v17 = 0; + v13 = 1; + do { + v10 = _vm->_objectsManager.Traduction(ptr + 20 * v13); + if (v10 == 2) + v13 = _vm->_objectsManager.Control_Goto(ptr + 20 * v13); + if (v10 == 3) + v13 = _vm->_objectsManager.Control_If(ptr, v13); + if (v13 == -1) + error("Invalid IFF function"); + if (v10 == 1 || v10 == 4) + ++v13; + if (!v10 || v10 == 5) + v17 = 1; + if (v10 == 6) { + _vm->_globals.dos_free2(ptr); + v2 = _vm->_objectsManager.NVZONE; + v3 = _vm->_objectsManager.NVVERBE; + goto LABEL_2; + } + } while (v17 != 1); + _vm->_globals.dos_free2(ptr); + _vm->_globals.SAUVEGARDE->data[svField2] = 0; + return; + } + } + } } void TalkManager::REPONSE2(int a1, int a2) { - warning("TODO: RESPONSE2"); + signed int v3; + __int16 v4; + __int16 v5; + __int16 v6; + __int16 v7; + __int16 v8; + __int16 v9; + __int16 v10; + __int16 v11; + + v3 = 0; + if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { + if ((uint16)(a1 - 22) <= 1u) { + _vm->_objectsManager.SETFLIPSPR(0, 0); + _vm->_objectsManager.SETANISPR(0, 62); + _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); + if (a1 == 22) { + v4 = _vm->_objectsManager.BOBX(3); + _vm->_objectsManager.BLOQUE_ANIMX(6, v4); + } + if (a1 == 23) { + v5 = _vm->_objectsManager.BOBX(4); + _vm->_objectsManager.BLOQUE_ANIMX(6, v5); + } + if (a1 == 22) { + v6 = _vm->_objectsManager.BOBX(3); + _vm->_objectsManager.BLOQUE_ANIMX(8, v6); + } + if (a1 == 23) { + v7 = _vm->_objectsManager.BOBX(4); + _vm->_objectsManager.BLOQUE_ANIMX(8, v7); + } + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(6) <= 12 && _vm->_objectsManager.BOBPOSI(6) != 12); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_ON(8); + if (_vm->_globals.ECRAN == 35) + v3 = 201; + if (_vm->_globals.ECRAN == 36) + v3 = 203; + if (_vm->_globals.ECRAN == 37) + v3 = 205; + if (_vm->_globals.ECRAN == 38) + v3 = 207; + if (_vm->_globals.ECRAN == 39) + v3 = 209; + if (_vm->_globals.ECRAN == 40) + v3 = 211; + if (_vm->_globals.ECRAN == 41) + v3 = 213; + _vm->_globals.SAUVEGARDE->data[v3] = 2; + _vm->_objectsManager.ZONE_OFF(22); + _vm->_objectsManager.ZONE_OFF(23); + } + if ((uint16)(a1 - 20) <= 1u) { + _vm->_objectsManager.SETFLIPSPR(0, 1); + _vm->_objectsManager.SETANISPR(0, 62); + _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); + if (a1 == 20) { + v8 = _vm->_objectsManager.BOBX(1); + _vm->_objectsManager.BLOQUE_ANIMX(5, v8); + } + if (a1 == 21) { + v9 = _vm->_objectsManager.BOBX(2); + _vm->_objectsManager.BLOQUE_ANIMX(5, v9); + } + if (a1 == 20) { + v10 = _vm->_objectsManager.BOBX(1); + _vm->_objectsManager.BLOQUE_ANIMX(7, v10); + } + if (a1 == 21) { + v11 = _vm->_objectsManager.BOBX(2); + _vm->_objectsManager.BLOQUE_ANIMX(7, v11); + } + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) <= 12 && _vm->_objectsManager.BOBPOSI(5) != 12); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_ON(7); + if (_vm->_globals.ECRAN == 35) + v3 = 200; + if (_vm->_globals.ECRAN == 36) + v3 = 202; + if (_vm->_globals.ECRAN == 37) + v3 = 204; + if (_vm->_globals.ECRAN == 38) + v3 = 206; + if (_vm->_globals.ECRAN == 39) + v3 = 208; + if (_vm->_globals.ECRAN == 40) + v3 = 210; + if (_vm->_globals.ECRAN == 41) + v3 = 212; + _vm->_globals.SAUVEGARDE->data[v3] = 2; + _vm->_objectsManager.ZONE_OFF(21); + _vm->_objectsManager.ZONE_OFF(20); + } + } +} + +void TalkManager::OBJET_VIVANT(const Common::String &a2) { + int v2; + Common::String v3; + const char *v4; + int v5; + bool v6; + int v10; + byte *v11; + int v12; + int v13; + byte *v14; + byte *v15; + byte *v16; + int v17; + Common::String s; + Common::String v20; + Common::String v22; + Common::String v23; + + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.no_scroll = 1; + _vm->_linesManager.CLEAR_ZONE(); + _vm->_linesManager.RESET_OBSTACLE(); + _vm->_globals.RESET_CACHE(); + v2 = 0; + do + _vm->_globals.BOBZONE[v2++] = 0; + while (v2 <= 44); + _vm->_objectsManager.NUMZONE = -1; + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(0); + BUFFERPERSO = FileManager::RECHERCHE_CAT(a2, 5); + TAILLEPERSO = _vm->_globals.CAT_TAILLE; + if (BUFFERPERSO == PTRNUL) { + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, a2); + BUFFERPERSO = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + TAILLEPERSO = FileManager::FLONG(_vm->_globals.NFICHIER); + } + RENVOIE_FICHIER(40, v23, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(0, v22, (const char *)BUFFERPERSO); + v3 = v20; + RENVOIE_FICHIER(20, v20, (const char *)BUFFERPERSO); + v4 = "NULL"; + v5 = 5; + + v6 = v3 != v4; + if (!v6) { + v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); + } + PERSOSPR = FileManager::RECHERCHE_CAT(v23, 7); + if (PERSOSPR) { + _vm->_globals.CAT_FLAG = 0; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v23); + } else { + _vm->_globals.CAT_FLAG = 1; + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); + } + PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_globals.CAT_FLAG = 0; + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) + _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager.NB_SCREEN(); + v10 = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_objectsManager.PERSO_ON = 1; + CHERCHE_PAL(v10, 1); + CHERCHE_ANIM0(v10, 0); + v11 = _vm->_globals.COUCOU; + _vm->_globals.COUCOU = PTRNUL; + _vm->_globals.NOMARCHE = 1; + _vm->_objectsManager.INILINK(v22); + _vm->_objectsManager.PERSO_ON = 1; + _vm->_globals.GOACTION = 0; + _vm->_objectsManager.NUMZONE = -1; + ANIM_PERSO_INIT(); + VISU_PARLE(); + VISU_WAIT(); + _vm->_graphicsManager.INI_ECRAN2(v22); + _vm->_globals.NOMARCHE = 1; + _vm->_objectsManager.FORCEZONE = 1; + _vm->_objectsManager.NUMZONE = -1; + do { + v12 = _vm->_eventsManager.BMOUSE(); + if (v12 == 1) { + _vm->_objectsManager.BTGAUCHE(); + v12 = 1; + } + if (v12 == 2) + _vm->_objectsManager.BTDROITE(); + _vm->_objectsManager.VERIFZONE(); + if (_vm->_globals.GOACTION == 1) + _vm->_objectsManager.PARADISE(); + _vm->_eventsManager.VBL(); + } while (!_vm->_globals.SORTIE); + FIN_VISU_PARLE(); + FIN_VISU_WAIT(); + CLEAR_ANIM_PERSO(); + CLEAR_ANIM_PERSO(); + _vm->_globals.NOPARLE = 0; + _vm->_globals.NECESSAIRE = 1; + BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); + PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); + _vm->_graphicsManager.NB_SCREEN(); + _vm->_globals.NECESSAIRE = 0; + _vm->_linesManager.CLEAR_ZONE(); + _vm->_linesManager.RESET_OBSTACLE(); + _vm->_globals.RESET_CACHE(); + v13 = 0; + do + _vm->_globals.BOBZONE[v13++] = 0; + while (v13 <= 44); + _vm->_globals.LIBERE_FICHIER(_vm->_globals.COUCOU); + _vm->_globals.COUCOU = v11; + _vm->_objectsManager.DESACTIVE = 1; + _vm->_objectsManager.INILINK(v20); + _vm->_graphicsManager.INI_ECRAN2(v20); + _vm->_objectsManager.DESACTIVE = 0; + _vm->_globals.NOMARCHE = 0; + if (_vm->_globals.SORTIE == 101) + _vm->_globals.SORTIE = 0; + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_objectsManager.PERSO_ON = 0; + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + v14 = _vm->_graphicsManager.VESA_BUFFER; + v15 = _vm->_graphicsManager.VESA_SCREEN; + memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); + v15 = v15 + 614396; + v14 = v14 + 614396; + WRITE_LE_UINT16(v14, READ_LE_UINT16(v15)); + v14 = v14 + 2; + *v14 = *(v15 + 2); + v16 = v14 + 1; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.DD_VBL(); + v17 = 0; + do { + _vm->_eventsManager.VBL(); + ++v17; + } while (v17 <= 4); + _vm->_graphicsManager.no_scroll = 0; } } // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 97795d8d1f..00d2c95a91 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -56,7 +56,7 @@ public: void CHERCHE_PAL(int a1, int a2); void VISU_WAIT(); void FIN_VISU_WAIT(); - void FIN_VISU_PARLE(int a1); + void FIN_VISU_PARLE(); int VERIF_BOITE(int a1, const Common::String &a2, int a3); void VISU_PARLE(); void BOB_VISU_PARLE(int idx); @@ -66,6 +66,7 @@ public: bool RECHERCHE_ANIM_PERSO(int a1, const byte *a2, int a3, int a4); void REPONSE(int a1, int a2); void REPONSE2(int a1, int a2); + void OBJET_VIVANT(const Common::String &a2); }; } // End of namespace Hopkins -- cgit v1.2.3 From 549e046f2731953c793f794d58d7bed3db8f13fe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Oct 2012 22:44:29 +1000 Subject: HOPKINS: Implemented PLAN_TEST and TEST_LIGNE methods --- engines/hopkins/lines.cpp | 302 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/lines.h | 2 + engines/hopkins/objects.cpp | 13 +- engines/hopkins/objects.h | 1 - 4 files changed, 308 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 55ad7761b6..99ef337d6c 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3572,4 +3572,306 @@ LABEL_85: return -1; } +int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + byte *v15; + int v16; + int v17; + int v18; + int v19; + byte *v20; + int v21; + int v22; + int v23; + byte *v25; + byte *v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33 = 0; + int v34 = 0; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49; + int v50; + int v51; + int v52; + int v53; + + v41 = a3; + v40 = TEST_LIGNE(a1, a2 - 2, &v42, &v50, &v46); + v39 = TEST_LIGNE(a1, a2 + 2, &v43, &v51, &v47); + v38 = TEST_LIGNE(a1 - 2, a2, &v44, &v52, &v48); + v6 = TEST_LIGNE(a1 + 2, a2, &v45, &v53, &v49); + v37 = v6; + if (v40 == -1 && v39 == -1 && v38 == -1 && v6 == -1) + return -1; + if (a4 == -1 || a5 == -1) { + v8 = 0; + if (v40 != -1) + v8 = 1; + if (v8) + goto LABEL_60; + if (v39 != -1) + v8 = 2; + if (v8) + goto LABEL_60; + if (v38 != -1) + v8 = 3; + if (v8) + goto LABEL_60; + if (v6 != -1) + v8 = 4; + goto LABEL_59; + } + v28 = 100; + v7 = 100; + v35 = 100; + v27 = 100; + v8 = 0; + v9 = a4 - a5; + if (a4 - a5 < 0) + v9 = -v9; + v36 = v9; + if (v40 != -1) { + v10 = v50 - a5; + if (v50 - a5 < 0) + v10 = -v10; + v28 = v10; + } + if (v39 != -1) { + v11 = v51 - a5; + if (v11 < 0) + v11 = -v11; + v7 = v11; + } + if (v38 != -1) { + v12 = v52 - a5; + if (v12 < 0) + v12 = -v12; + v35 = v12; + } + if (v37 != -1) { + v13 = v53 - a5; + if (v13 < 0) + v13 = -v13; + v27 = v13; + } + if (v28 < v36 && v28 <= v7 && v28 <= v35 && v28 <= v27) + v8 = 1; + if (v8) + goto LABEL_60; + if (v36 > v7 && v28 >= v7 && v35 >= v7 && v27 >= v7) + v8 = 2; + if (v8) + goto LABEL_60; + if (v35 < v36 && v35 <= v28 && v35 <= v7 && v35 <= v27) + v8 = 3; + if (v8) + goto LABEL_60; + if (v27 >= v36 || v27 > v28 || v27 > v7 || v27 > v35) { +LABEL_59: + if (v8) + goto LABEL_60; + return -1; + } + v8 = 4; +LABEL_60: + if (v8 == 1) { + v34 = v40; + v33 = v42; + NV_LIGNEDEP = v50; + NV_LIGNEOFS = v46; + } + if (v8 == 2) { + v34 = v39; + v33 = v43; + NV_LIGNEDEP = v51; + NV_LIGNEOFS = v47; + } + if (v8 == 3) { + v34 = v38; + v33 = v44; + NV_LIGNEDEP = v52; + NV_LIGNEOFS = v48; + } + if (v8 == 4) { + v34 = v37; + v33 = v45; + NV_LIGNEDEP = v53; + NV_LIGNEOFS = v49; + } + if (v33 == 1) { + v14 = 0; + if (Ligne[v34].field0 > 0) { + v32 = v34; + v25 = _vm->_globals.essai0; + do { + v15 = Ligne[v32].fieldC; + v16 = READ_LE_UINT16(v15 + 4 * v14); + v29 = READ_LE_UINT16(v15 + 4 * v14 + 2); + if (!a6) { + v17 = v41; + _vm->_globals.super_parcours[v17] = v16; + _vm->_globals.super_parcours[v17 + 1] = v29; + _vm->_globals.super_parcours[v17 + 2] = Ligne[v32].field6; + _vm->_globals.super_parcours[v17 + 3] = 0; + } + if (a6 == 1) { + v18 = v41; + WRITE_LE_UINT16(v25 + 2 * v18, v16); + WRITE_LE_UINT16(v25 + 2 * v18 + 2, v29); + WRITE_LE_UINT16(v25 + 2 * v18 + 4, Ligne[v32].field6); + WRITE_LE_UINT16(v25 + 2 * v18 + 6, 0); + } + v41 += 4; + ++v14; + } while (Ligne[v32].field0 > v14); + } + } + if (v33 == 2) { + v19 = Ligne[v34].field0 - 1; + if (v19 > -1) { + v31 = 16 * v34; + v26 = _vm->_globals.essai0; + do { + v20 = Ligne[v31].fieldC; + v21 = READ_LE_UINT16(v20 + 4 * v19); + v30 = READ_LE_UINT16(v20 + 4 * v19 + 2); + if (a6) { + v23 = v41; + WRITE_LE_UINT16(v26 + 2 * v23, v21); + WRITE_LE_UINT16(v26 + 2 * v23 + 2, v30); + WRITE_LE_UINT16(v26 + 2 * v23 + 4, Ligne[v31].field8); + WRITE_LE_UINT16(v26 + 2 * v23 + 6, 0); + } else { + v22 = v41; + _vm->_globals.super_parcours[v22] = v21; + _vm->_globals.super_parcours[v22 + 1] = v30; + _vm->_globals.super_parcours[v22 + 2] = Ligne[v31].field8; + _vm->_globals.super_parcours[v22 + 3] = 0; + } + v41 += 4; + --v19; + } while (v19 > -1); + } + } + NV_POSI = v41; + return 1; +} + +int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { + int i; + int v6; + byte *v7; + int v8; + int v9; + int v10; + int v11; + byte *v12; + int v13; + int v14; + int v15; + int v16; + byte *v17; + int v18; + int v19; + int v20; + int v21; + int result; + int v23; + int v24 = 0; + int v25; + int v26; + int v27; + int v28; + + v26 = 0; + v25 = _vm->_objectsManager.DERLIGNE + 1; + for (i = (int)(_vm->_objectsManager.DERLIGNE + 1); i < _vm->_linesManager.TOTAL_LIGNES + 1; i = v25) { + v6 = i; + v7 = Ligne[i].fieldC; + v8 = Ligne[v6].field0; + v23 = READ_LE_UINT16(v7 + 4 * v8 - 4); + v9 = READ_LE_UINT16(v7 + 4 * v8 - 2); + if (*v7 == a1 && a2 == READ_LE_UINT16(v7 + 2)) { + v24 = v25; + v26 = 1; + *a3 = 1; + } + if (v23 == a1 && a2 == v9) { + v24 = v25; + v26 = 1; + *a3 = 2; + } + if (v26 == 1) + goto LABEL_12; + ++v25; + } + if (v26 != 1) + goto LABEL_33; +LABEL_12: + if (*a3 == 1) { + v10 = v24; + v11 = Ligne[v10].field0; + v12 = Ligne[v10].fieldC; + v13 = READ_LE_UINT16(v12 + 4 * v11 - 4); + v14 = READ_LE_UINT16(v12 + 4 * v11 - 2); + v15 = Ligne[v10].field6; + if (v15 == 5 || v15 == 1) + v14 += 2; + v16 = 16 * v24; + if (Ligne[v16].field6 == 3 || Ligne[v16].field8 == 7) + v13 += 2; + if (!colision2_ligne(v13, v14, &v28, &v27, 0, _vm->_objectsManager.DERLIGNE)) + error("error"); + *a4 = v27; + *a5 = v28; + } + if (v26 == 1 && *a3 == 2) { + v17 = Ligne[v25].fieldC; + v18 = *v17; + v19 = READ_LE_UINT16(v17 + 2); + v20 = Ligne[v24].field6; + if (v20 == 5 || v20 == 1) + v19 -= 2; + v21 = 16 * v24; + if (Ligne[v21].field6 == 3 || Ligne[v21].field8 == 7) + v18 -= 2; + if (!colision2_ligne(v18, v19, &v28, &v27, 0, _vm->_objectsManager.DERLIGNE)) + error("erreure"); + *a4 = v27; + *a5 = v28; + } +LABEL_33: + if (v26) + result = v24; + else + result = -1; + return result; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 4baee6cb77..54a222698d 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -89,6 +89,8 @@ public: int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); int SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6); + int PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); + int TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0a846f5302..2c0a8d10a6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3068,8 +3068,8 @@ LABEL_90: v35 = v34; } for (j = v69 + 1; j < v73; ++j) { - if (PLAN_TEST( - _vm->_linesManager.Ligne[j].fieldC, + if (_vm->_linesManager.PLAN_TEST( + READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC), READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC + 2), v67, j, @@ -3115,8 +3115,8 @@ LABEL_88: } for (l = v69 - 1; l > v73; --l) { v48 = l; - if (PLAN_TEST( - _vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 4, + if (_vm->_linesManager.PLAN_TEST( + READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 4), READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 2), v67, l, @@ -6984,11 +6984,6 @@ int ObjectsManager::CALC_PROPRE(int idx) { return v1; } -int ObjectsManager::PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6) { - warning("TODO: PLAN_TEST"); - return 0; -} - int ObjectsManager::colision(int a1, int a2) { if (_vm->_globals.SegmentEnCours <= 0) return -1; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index ad87291520..56e78c5bd0 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -240,7 +240,6 @@ public: void VERBE_OFF(int idx, int a2); void VERBE_ON(int idx, int a2); int CALC_PROPRE(int idx); - int PLAN_TEST(byte *a1, int a2, int a3, int a4, int a5, int a6); int colision(int a1, int a2); void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); -- cgit v1.2.3 From 52166834d5e84c6a20e1782489d6ae0623ae5aaa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Oct 2012 00:55:25 +1000 Subject: HOPKINS: Implemented lots more of the remaining stubbed methods --- engines/hopkins/anim.cpp | 444 +++++++++++++++++++++++++++- engines/hopkins/anim.h | 2 +- engines/hopkins/globals.h | 5 + engines/hopkins/graphics.cpp | 4 + engines/hopkins/graphics.h | 1 + engines/hopkins/hopkins.cpp | 64 ++--- engines/hopkins/hopkins.h | 5 - engines/hopkins/menu.cpp | 197 +++++++++++++ engines/hopkins/menu.h | 3 + engines/hopkins/objects.cpp | 672 +++++++++++++++++++++++++++++++++++++------ engines/hopkins/objects.h | 9 + 11 files changed, 1266 insertions(+), 140 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 7733358a6f..97a0aad250 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -100,15 +100,15 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui if (_vm->_graphicsManager.Winbpp == 2) { if (doneFlag) - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(screenP, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (doneFlag) - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(screenP, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); @@ -169,7 +169,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui #endif _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); } while (_vm->_eventsManager.lItCounter < rate2 && !_vm->shouldQuit()); } @@ -194,7 +194,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); } } while (!doneFlag && !_vm->shouldQuit()); @@ -224,11 +224,11 @@ REDRAW_ANIM: #endif _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); } while (_vm->_eventsManager.lItCounter < rate3 && !_vm->shouldQuit()); _vm->_eventsManager.lItCounter = 0; - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); break; } @@ -285,8 +285,432 @@ FINISH: _vm->_graphicsManager.NOLOCK = false; } -void AnimationManager::PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4) { - warning("TODO: PLAY_ANM2"); +void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { + byte *v4; + int v5; + int v6; + int v8; + byte *ptr; + byte *ptra; + int v11; + byte *v12; + byte *v13; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + char v21; + size_t nbytes; + byte buf[6]; + char v25; + Common::File f; + + v8 = 0; + while (1) { + v17 = 0; + v16 = 0; + v19 = 0; + v18 = 0; + v20 = 1; + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (_vm->_graphicsManager.nbrligne == 1280) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) + _vm->_graphicsManager.ofscroll = 0; + v12 = _vm->_graphicsManager.VESA_SCREEN; + v13 = _vm->_globals.dos_malloc2(0x14u); + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); + + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s"); + + f.read(&buf, 6); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4); + nbytes = f.readUint32LE(); + v21 = f.readUint32LE(); + v20 = f.readUint16LE(); + v19 = f.readUint16LE(); + v18 = f.readUint16LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + + f.read(v12, nbytes); + + _vm->_graphicsManager.Cls_Pal(); + v11 = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.SCROLL_ECRAN(0); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + v8 = 1; + ptr = _vm->_globals.dos_malloc2(0x4B000u); + memcpy(ptr, v12, 0x4B000u); + } + if (_vm->_animationManager.NO_SEQ) { + if (v8 == 1) + memcpy(ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + _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 (v8) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (v8) + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 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) + break; + while (1) { + if (_vm->_eventsManager.ESC_KEY == 1) + goto LABEL_114; + if (REDRAW_ANIM() == 1) + break; + _vm->_eventsManager.CONTROLE_MES(); + if (_vm->_eventsManager.lItCounter >= a2) + goto LABEL_48; + } + if (_vm->_graphicsManager.NOLOCK == 1) + goto LABEL_114; + if (v8 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v13); + f.close(); + + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + v4 = &_vm->_graphicsManager.Palette[769]; + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) +LABEL_111: + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } +LABEL_112: + _vm->_graphicsManager.DD_Unlock(); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.FADE_INS(); + } +LABEL_48: + _vm->_eventsManager.lItCounter = 0; + v5 = 0; + v15 = 0; + while (1) { + ++v15; + _vm->_soundManager.PLAY_ANM_SOUND(v15); + memset(&buf, 0, 6u); + memset(v13, 0, 0x13u); + + if (f.read(v13, 0x10) != 0x10) + v5 = -1; + + v25 = 0; + if (strncmp((const char *)v13, "IMAGE=", 6)) + v5 = -1; + + if (v5) + goto LABEL_88; + f.read(v12, READ_LE_UINT32(v13 + 2)); + if (_vm->_globals.iRegul == 1) + break; +LABEL_77: + _vm->_eventsManager.lItCounter = 0; + _vm->_graphicsManager.DD_Lock(); + if (v8) { + if (*v12 != -4) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else if (*v12 != -4) { + if (_vm->_graphicsManager.Winbpp == 1) + _vm->_graphicsManager.Copy_Video_Vbe3(v12); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.Copy_Video_Vbe16(v12); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.VERIF_SOUND(); +LABEL_88: + if (v5 == -1) { + if (_vm->_globals.iRegul == 1) { + while (_vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) { + if (_vm->_graphicsManager.NOLOCK == 1) + goto LABEL_114; + if (v8 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v13); + f.close(); + + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + v4 = &_vm->_graphicsManager.Palette[769]; + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + goto LABEL_111; + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } + goto LABEL_112; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= a4) + goto LABEL_114; + } + } + goto LABEL_114; + } + } + while (_vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) { + if (_vm->_graphicsManager.NOLOCK == 1) + break; + if (v8 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v13); + f.close(); + + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + v4 = &_vm->_graphicsManager.Palette[769]; + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + goto LABEL_111; + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } + goto LABEL_112; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= a3) + goto LABEL_77; + } +LABEL_114: + _vm->_graphicsManager.NOLOCK = 0; + f.close(); + + if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { + ptra = _vm->_globals.dos_malloc2(0x4B000u); + + f.seek(0); + f.read(&buf, 6); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4u); + nbytes = f.readUint32LE(); + v21 = f.readUint32LE(); + v20 = f.readUint16LE(); + v19 = f.readUint16LE(); + v18 = f.readUint16LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + f.read(v12, nbytes); + memcpy(ptra, v12, 0x4B000u); + + v6 = 0; + do { + memset(&buf, 0, 6u); + memset(v13, 0, 0x13u); + if (f.read(v13, 16) != 16) + v6 = -1; + if (strncmp((const char *)v13, "IMAGE=", 7)) + v6 = -1; + + if (!v6) { + f.read(v12, READ_LE_UINT32(v13 + 8)); + if (*v12 != -4) + _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptra); + } + } while (v6 != -1); + _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); + ptr = _vm->_globals.dos_free2(ptra); + } + if (v8 == 1) { + if (_vm->_graphicsManager.FADE_LINUX == 2) + _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); + _vm->_globals.dos_free2(ptr); + } + _vm->_graphicsManager.FADE_LINUX = 0; + _vm->_globals.dos_free2(v13); + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.SCROLL = v11; + _vm->_graphicsManager.SCROLL_ECRAN(v11); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else { + _vm->_eventsManager.souris_max(); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.FADE_INS(); + _vm->_graphicsManager.DD_VBL(); } bool AnimationManager::REDRAW_ANIM() { diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 60eb71b940..1c4ecb296a 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -44,7 +44,7 @@ public: void setParent(HopkinsEngine *vm) { _vm = vm; } void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); - void PLAY_ANM2(const Common::String &filename, int a2, int a3, int a4); + void PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); bool REDRAW_ANIM(); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 3c81d6af19..61392e36fe 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -247,6 +247,9 @@ enum SauvegardeOffset { , svField231 , svField261 , svField270 + , svField300 + , svField318 + , svField320 , svField333 , svField338 , svField339 @@ -423,8 +426,10 @@ public: int Compteur; int ACTION_SENS; int SegmentEnCours; + int STOP_BUG; bool NO_OFFSET; + int MAX_COMPTE; int force_to_data_0; int oldzone_46; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 787400ae52..e4a5c1100d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2407,4 +2407,8 @@ void GraphicsManager::SHOW_PALETTE() { setpal_vga256(Palette); } +void GraphicsManager::videkey() { + // Empty in original +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index dc6ad04fba..0622e3678f 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -178,6 +178,7 @@ public: void OPTI_INI(const Common::String &file, int a2); void NB_SCREEN(); void SHOW_PALETTE(); + void videkey(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5d01582b26..a29253571f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -148,7 +148,7 @@ LABEL_13: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; - PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); } if (GLOBALS.SORTIE != 3) @@ -191,7 +191,7 @@ LABEL_13: _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; GLOBALS.NOSPRECRAN = 1; - PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); } if (GLOBALS.SORTIE != 4) @@ -211,9 +211,9 @@ LABEL_13: byte v1 = *((byte *)GLOBALS.SAUVEGARDE + 80); if (v1) { if (v1 == 1) - PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { - PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } GLOBALS.NOSPRECRAN = 0; @@ -226,7 +226,7 @@ LABEL_13: _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); } if (GLOBALS.SORTIE != 6) @@ -235,15 +235,15 @@ LABEL_13: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 460; - PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); } if (GLOBALS.SORTIE != 7) break; if (*((byte *)GLOBALS.SAUVEGARDE + 220)) - PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else - PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); } if (GLOBALS.SORTIE == 9) { @@ -254,11 +254,11 @@ LABEL_13: if (!*((byte *)GLOBALS.SAUVEGARDE + 225)) goto LABEL_109; - PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { if (GLOBALS.SORTIE == 10) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); goto LABEL_124; } @@ -268,7 +268,7 @@ LABEL_13: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); goto LABEL_124; } @@ -280,7 +280,7 @@ LABEL_13: _globals.Max_Perso_Y = 450; if (*((byte *)GLOBALS.SAUVEGARDE + 225)) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { LABEL_109: BOOM(); @@ -291,19 +291,19 @@ LABEL_109: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; default: if (GLOBALS.SORTIE == 15) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); goto LABEL_124; } if (GLOBALS.SORTIE == 16) { @@ -314,9 +314,9 @@ LABEL_109: byte v2 = *((byte *)GLOBALS.SAUVEGARDE + 113); if (v2 == 1) { - PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!v2) { - PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } } else { if (GLOBALS.SORTIE == 17) @@ -328,11 +328,11 @@ LABEL_109: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); } else { if (GLOBALS.SORTIE == 33) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); goto LABEL_124; } @@ -341,7 +341,7 @@ LABEL_109: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; - PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); } else { if (GLOBALS.SORTIE == 27) PASS(); @@ -364,13 +364,13 @@ LABEL_109: PASS(); if (GLOBALS.SORTIE == 111) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); goto LABEL_124; } if (GLOBALS.SORTIE == 112) { GLOBALS.NOSPRECRAN = 1; - PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); LABEL_124: GLOBALS.NOSPRECRAN = 0; } else if (GLOBALS.SORTIE == 113) { @@ -379,7 +379,7 @@ LABEL_124: *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)GLOBALS.SAUVEGARDE + 5) = 113; - COMPUT_HOPKINS(1); + _menuManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -396,7 +396,7 @@ LABEL_124: *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)GLOBALS.SAUVEGARDE + 5) = 114; - COMPUT_HOPKINS(2); + _menuManager.COMPUT_HOPKINS(2); goto LABEL_128; } if (GLOBALS.SORTIE == 115) { @@ -405,7 +405,7 @@ LABEL_124: *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)GLOBALS.SAUVEGARDE + 5) = 115; - COMPUT_HOPKINS(3); + _menuManager.COMPUT_HOPKINS(3); LABEL_128: _graphicsManager.DD_Lock(); @@ -910,16 +910,6 @@ void HopkinsEngine::BOOM() { _globals.SORTIE = 151; } -void HopkinsEngine::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v) { - warning("TODO: PERSONAGE2"); -} - -void HopkinsEngine::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v) { - warning("TODO: PERSONAGE2"); -} - void HopkinsEngine::REST_SYSTEM() { quitGame(); _eventsManager.CONTROLE_MES(); @@ -958,8 +948,4 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } -void HopkinsEngine::COMPUT_HOPKINS(int a1) { - warning("TODO: COMPUT_HOPKINS"); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 9453966ff7..0b1f97fb9c 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -83,12 +83,7 @@ private: void PASS(); void REST_SYSTEM(); - void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v); - void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v); void PUBQUIT(); - void COMPUT_HOPKINS(int a1); void ENDEMO(); void BOOM(); protected: diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 3fa7c55290..f692d4ee42 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -240,4 +240,201 @@ void MenuManager::SAUVE_PARTIE() { warning("SAUVE_PARTIE"); } +void MenuManager::COMPUT_HOPKINS(int idx) { + // This is a text mode display? + warning("TODO: COMPUT_HOPKINS"); + /* + int v2; + char *v3; + int v4; + char v5; + char *v6; + int v7; + char v8; + char *v9; + int v10; + char v11; + int v12; + Common::String s; + Common::String s2; + + _vm->_eventsManager.ESC_KEY = 0; + v2 = 0; + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + setvideomode(); + settextcolor(4); + _vm->_graphicsManager.videkey(); + settextposition(2, 4); + if (idx == 1) + outtext((const char *)&MenuText[10]); + if (idx == 2) + outtext((const char *)&MenuText[0xDE]); + if (idx == 3) + outtext((const char *)&MenuText[0x1B2]); + settextcolor(1); + if (idx == 3) { + settextposition(10, 8); + outtext((const char *)&MenuText[0x286]); + } + settextposition(12, 28); + outtext((const char *)&MenuText[0x35A]); + settextposition(14, 35); + v3 = &s; + memset(&s, 0, 8u); + TXT4(280, 224, 8); + s = Sup_string; + if (idx == 1) { + s2 = "HOPKINS"; + v4 = 8; + v5 = 1; + do { + if (!v4) + break; + v5 = *v3++ == *s2++; + --v4; + } while (v5); + if (v5) + v2 = 1; + } + if (idx == 2) { + v6 = &s; + s2 = "328MHZA"; + v7 = 8; + v8 = 1; + do { + if (!v7) + break; + v8 = *v6++ == *s2++; + --v7; + } while (v8); + if (v8) + v2 = 1; + } + if (idx == 3) { + v9 = &s; + s2 = "ALLFREE"; + v10 = 8; + v11 = 1; + do { + if (!v10) + break; + v11 = *v9++ == *s2++; + --v10; + } while (v11); + if (v11) + v2 = 1; + } + if (v2) { + while (1) { + ESC_KEY = 0; + _vm->_graphicsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + if (idx == 1) + outtext((const char *)&MenuText[10]); + if (idx == 2) + outtext((const char *)&MenuText[0xDE]); + if (idx == 3) + outtext((const char *)&MenuText[0x1B2]); + settextcolor(15); + settextposition(8, 25); + settextcolor(15); + outtext2((const char *)&MenuText[0x502]); + settextposition(20, 25); + outtext2((const char *)&MenuText[0x5D6]); + if (idx == 1) { + settextposition(10, 25); + outtext2((const char *)&MenuText[0x6AA]); + settextposition(12, 25); + outtext2((const char *)&MenuText[0x77E]); + settextposition(14, 25); + outtext2((const char *)&MenuText[0x852]); + settextposition(16, 25); + outtext2((const char *)&MenuText[0x926]); + } + if (idx == 2) { + _vm->_graphicsManager.videkey(); + settextposition(10, 25); + outtext2((const char *)&MenuText[0x95A]); + settextposition(12, 25); + outtext2((const char *)&MenuText[0xACE]); + settextposition(14, 25); + outtext2((const char *)&MenuText[0xBA2]); + settextposition(16, 25); + outtext2((const char *)&MenuText[0xC76]); + settextposition(18, 25); + outtext2((const char *)&MenuText[0xD4A]); + } + do { + v12 = (unsigned __int8)keywin(v2, s2); + v2 = 0; + if ((uint16)(v12 - 48) <= 8u) + v2 = 1; + } while (v2 != 1); + if (v12 == 48) + break; + if (v12 == 49) { + GAMES(s2); + } else if (idx == 1) { + _vm->_graphicsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext((const char *)&MenuText[10]); + settextcolor(15); + if (v12 == 50) + LIT_TEXTE(1); + if (v12 == 51) + LIT_TEXTE(2); + if (v12 == 52) + LIT_TEXTE(3); + if (v12 == 53) + LIT_TEXTE(4); + } else if (idx == 2) { + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext((const char *)&MenuText[0xDE]); + settextcolor(15); + if (v12 == 50) + LIT_TEXTE(6); + if (v12 == 51) + LIT_TEXTE(7); + if (v12 == 52) + LIT_TEXTE(8); + if (v12 == 53) + LIT_TEXTE(9); + if (v12 == 54) { + LIT_TEXTE(10); + _vm->_globals.SAUVEGARDE->data[svField270] = 4; + } + } + } + _vm->_graphicsManager.DD_Lock(); + Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + } else { + settextcolor(4); + settextposition(16, 25); + outtext((const char *)&MenuText[0x42E]); + _vm->_eventsManager.VBL(); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); + _vm->_graphicsManager.DD_Lock(); + Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + _vm->_eventsManager.MOUSE_OFF(); + } + if (idx == 1) + _vm->_globals.SORTIE = 13; + if ((uint16)(idx - 2) <= 1u) + _vm->_globals.SORTIE = 14; + return _vm->_graphicsManager.RESET_SEGMENT_VESA(); + */ +} + } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 1aca03663e..c8a1a4eec0 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -34,12 +34,15 @@ class HopkinsEngine; class MenuManager { private: HopkinsEngine *_vm; + + byte MenuTxt[10600]; public: void setParent(HopkinsEngine *vm); int MENU(); void CHARGE_PARTIE(); void SAUVE_PARTIE(); + void COMPUT_HOPKINS(int a1); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2c0a8d10a6..25d4cde43a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -46,7 +46,7 @@ ObjectsManager::ObjectsManager() { inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; - _vm->_objectsManager.PERSO_ON = false; + PERSO_ON = false; SL_FLAG = false; FLAG_VISIBLE = false; DESACTIVE_INVENT = false; @@ -331,7 +331,7 @@ void ObjectsManager::AFF_SPRITES() { ++v30; } while (v30 <= 10); - if (!_vm->_objectsManager.PERSO_ON) { + if (!PERSO_ON) { v31 = 0; do { v5 = v31; @@ -362,7 +362,7 @@ void ObjectsManager::AFF_SPRITES() { AFF_BOB_ANIM(); AFF_VBOB(); - if (!_vm->_objectsManager.PERSO_ON) { + if (!PERSO_ON) { v32 = 0; do { _vm->_globals.Liste[v32].field0 = 0; @@ -1276,7 +1276,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int idx = 0; do { ++idx; - if (idx <= 20 && _vm->_objectsManager.PERSO_ON == 1) { + if (idx <= 20 && PERSO_ON == 1) { _vm->_globals.Bob[idx].field1C = 0; continue; } @@ -1305,7 +1305,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if ( _vm->_objectsManager.PERSO_ON == 1 && idx > 20 ) + if ( PERSO_ON == 1 && idx > 20 ) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); @@ -1346,7 +1346,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; - if (_vm->_objectsManager.PERSO_ON == 1 && idx > 20) + if (PERSO_ON == 1 && idx > 20) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); @@ -1370,7 +1370,7 @@ LABEL_38: } } while (idx != 35); - if (!_vm->_objectsManager.PERSO_ON && BOBTOUS == 1) { + if (!PERSO_ON && BOBTOUS == 1) { v26 = 0; do { v13 = v26; @@ -1385,7 +1385,7 @@ LABEL_38: do { ++v27; - if (v27 > 20 || _vm->_objectsManager.PERSO_ON != 1) { + if (v27 > 20 || PERSO_ON != 1) { if (_vm->_globals.Bob[v27].field0 == 10) { if (_vm->_globals.Bob[v27].field1C == 1) { v14 = _vm->_globals.Bob[v27].field1E; @@ -1800,7 +1800,7 @@ LABEL_54: _vm->_eventsManager.CHANGE_MOUSE(4); } } - _vm->_objectsManager.NUMZONE = v4; + NUMZONE = v4; _vm->_globals.old_x_69 = v0; _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; @@ -2104,7 +2104,7 @@ void ObjectsManager::BTGAUCHE() { if (GOACTION != 1) goto LABEL_38; VERIFZONE(); - if (_vm->_objectsManager.NUMZONE <= 0) + if (NUMZONE <= 0) return; v2 = 0; v3 = _vm->_globals.essai2; @@ -2126,10 +2126,10 @@ void ObjectsManager::BTGAUCHE() { _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || _vm->_objectsManager.NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) return; - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { - v6 = _vm->_objectsManager.NUMZONE; + if ((uint16)(NUMZONE + 1) > 1u) { + v6 = NUMZONE; v7 = _vm->_globals.ZONEP[v6].field0; if (v7) { v8 = _vm->_globals.ZONEP[v6].field2; @@ -2144,7 +2144,7 @@ LABEL_38: GOACTION = 0; v9 = _vm->_globals.chemin; _vm->_globals.chemin = PTRNUL; - if (_vm->_globals.FORET && ((uint16)(_vm->_objectsManager.NUMZONE - 20) <= 1u || (uint16)(_vm->_objectsManager.NUMZONE - 22) <= 1u)) { + if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); v11 = YSPR(0); @@ -2196,24 +2196,24 @@ LABEL_65: _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0); } } - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + if ((uint16)(NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) _vm->_globals.SAUVEGARDE->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == 1) _vm->_globals.SAUVEGARDE->data[svField1] = 6; - _vm->_globals.SAUVEGARDE->data[svField2] = _vm->_objectsManager.NUMZONE; + _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); ARRET_PERSO_FLAG = 0; - if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]) { + if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[NUMZONE]) { ARRET_PERSO_FLAG = 1; - ARRET_PERSO_NUM = _vm->_globals.BOBZONE[_vm->_objectsManager.NUMZONE]; + ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && _vm->_objectsManager.NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { _vm->_globals.chemin = PTRNUL; XSPR(0); @@ -2235,7 +2235,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || ((uint16)(_vm->_objectsManager.NUMZONE - 20) > 1u && (uint16)(_vm->_objectsManager.NUMZONE - 22) > 1u)) { + if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) @@ -2299,11 +2299,11 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } _vm->_eventsManager.CHANGE_MOUSE(4); - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field16) { - _vm->_objectsManager.NUMZONE = -1; + if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { + NUMZONE = -1; FORCEZONE = 1; } - if (_vm->_objectsManager.NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager.btsouris = 4; CHANGEVERBE = 0; } else { @@ -2317,7 +2317,7 @@ LABEL_64: } if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2327,8 +2327,8 @@ LABEL_64: } if (_vm->_globals.NOMARCHE == 1) { if (_vm->_eventsManager.btsouris == 4) { - result = _vm->_objectsManager.NUMZONE + 1; - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) + result = NUMZONE + 1; + if ((uint16)(NUMZONE + 1) > 1u) BTDROITE(); } } @@ -2358,7 +2358,7 @@ void ObjectsManager::CLEAR_ECRAN() { } while (v1 <= 48); _vm->_eventsManager.btsouris = 4; verbe = 4; - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; Vold_taille = 0; SPEED_FLAG = 0; SPEED_PTR = PTRNUL; @@ -2394,6 +2394,20 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } +void ObjectsManager::TEST_INVENT() { + if (_vm->_globals.PLAN_FLAG) + KEY_INVENT = 0; + if (KEY_INVENT == 1) { + if (!INVENTFLAG) { + KEY_INVENT = 0; + INVENTFLAG = 1; + INVENT(); + INVENTFLAG = 0; + KEY_INVENT = 0; + } + } +} + void ObjectsManager::INVENT() { int v1; size_t filesize; @@ -3240,7 +3254,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager.btsouris = 4; LABEL_24: - if (_vm->_globals.NOMARCHE != 1 || (v = _vm->_objectsManager.NUMZONE + 1, (uint16)(_vm->_objectsManager.NUMZONE + 1) <= 1u)) { + if (_vm->_globals.NOMARCHE != 1 || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { if (_vm->_eventsManager.btsouris == 4) return; } else { @@ -3250,146 +3264,146 @@ LABEL_28: ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 6) { LABEL_29: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 7) { LABEL_31: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field7 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 8) { LABEL_33: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 9) { LABEL_35: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 10) { LABEL_37: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 11) { LABEL_39: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 12) { LABEL_41: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 13) { LABEL_43: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 14) { LABEL_45: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 15) { LABEL_47: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 1) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 16) { LABEL_49: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field6 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 17) { LABEL_51: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 18) { LABEL_53: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldA == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 19) { LABEL_55: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldB == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 20) { LABEL_57: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldC == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 21) { LABEL_59: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldF == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 22) { LABEL_61: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldD == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 23) { LABEL_63: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field8 == 2) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) return; } ++_vm->_eventsManager.btsouris; if (_vm->_eventsManager.btsouris == 24) { LABEL_65: - v = 5 * _vm->_objectsManager.NUMZONE; - if (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].field9 == 3) + v = 5 * NUMZONE; + if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) return; } v = _vm->_eventsManager.btsouris + 1; _vm->_eventsManager.btsouris = v; } while (v != 25); LABEL_67: - v = 5 * _vm->_objectsManager.NUMZONE; - } while (_vm->_globals.ZONEP[_vm->_objectsManager.NUMZONE].fieldE != 2); + v = 5 * NUMZONE; + } while (_vm->_globals.ZONEP[NUMZONE].fieldE != 2); } void ObjectsManager::BTDROITE() { - if ((uint16)(_vm->_objectsManager.NUMZONE + 1) > 1u) { + if ((uint16)(NUMZONE + 1) > 1u) { VERBEPLUS(); if (_vm->_eventsManager.btsouris != 23) _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); @@ -3773,7 +3787,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; - _vm->_objectsManager.PERSO_ON = 1; + PERSO_ON = 1; _vm->_animationManager.NO_SEQ = 1; _vm->_animationManager.CLS_ANM = 0; _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); @@ -3784,7 +3798,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NECESSAIRE = 0; FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); - _vm->_objectsManager.PERSO_ON = 0; + PERSO_ON = 0; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.dos_free2(v1); @@ -4694,7 +4708,7 @@ LABEL_1141: v13 = YSPR(0); v14 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5316,7 +5330,7 @@ LABEL_1141: v38 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5341,7 +5355,7 @@ LABEL_1141: v39 = YSPR(0); v40 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); - _vm->_objectsManager.NUMZONE = 0; + NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; do { GOHOME(); @@ -5919,14 +5933,14 @@ LABEL_1141: if (v76 == 246) { SPRITE_OFF(0); OPTI_ONE(6, 0, 15, 0); - _vm->_objectsManager.PERSO_ON = 1; + PERSO_ON = 1; _vm->_graphicsManager.NB_SCREEN(); _vm->_animationManager.NO_SEQ = 1; _vm->_soundManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = 0; _vm->_graphicsManager.NOFADE = 1; _vm->_graphicsManager.FADE_OUTW(); - _vm->_objectsManager.PERSO_ON = 0; + PERSO_ON = 0; _vm->_globals.SORTIE = 100; } if (v76 == 55) { @@ -5953,7 +5967,7 @@ LABEL_1141: v56 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5974,7 +5988,7 @@ LABEL_1141: v58 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; + NUMZONE = -1; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -6609,13 +6623,122 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.dos_free2(ptr); } +void ObjectsManager::SPECIAL_INI(const Common::String &a1) { + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + + if (_vm->_globals.ECRAN == 73 && !_vm->_globals.SAUVEGARDE->data[svField318]) { + _vm->_globals.CACHE_SUB(0); + _vm->_globals.CACHE_SUB(1); + } + if ((uint16)(_vm->_globals.ECRAN - 35) <= 6u) { + _vm->_globals.BOBZONE[20] = 1; + _vm->_globals.BOBZONE[21] = 2; + _vm->_globals.BOBZONE[22] = 3; + _vm->_globals.BOBZONE[23] = 4; + _vm->_globals.BOBZONE_FLAG[20] = 1; + _vm->_globals.BOBZONE_FLAG[21] = 1; + _vm->_globals.BOBZONE_FLAG[22] = 1; + _vm->_globals.BOBZONE_FLAG[23] = 1; + _vm->_objectsManager.VERBE_ON(20, 5); + _vm->_objectsManager.VERBE_ON(21, 5); + _vm->_objectsManager.VERBE_ON(22, 5); + _vm->_objectsManager.VERBE_ON(23, 5); + _vm->_globals.ZONEP[20].field12 = 30; + _vm->_globals.ZONEP[21].field12 = 30; + _vm->_globals.ZONEP[22].field12 = 30; + _vm->_globals.ZONEP[23].field12 = 30; + v2 = 200; + do { + if (_vm->_globals.SAUVEGARDE->data[v2] != 2) + _vm->_globals.SAUVEGARDE->data[v2] = 0; + ++v2; + } while (v2 <= 214); + } + if (_vm->_globals.ECRAN == 93) { + if (!_vm->_globals.SAUVEGARDE->data[svField333]) + _vm->_objectsManager.BOBANIM_ON(8); + } + if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { + _vm->_eventsManager.souris_n = 4; + _vm->_globals.BPP_NOAFF = 1; + v3 = 0; + do { + _vm->_eventsManager.VBL(); + ++v3; + } while (v3 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + _vm->_globals.iRegul = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_globals.BPP_NOAFF = 1; + v4 = 0; + do { + _vm->_eventsManager.VBL(); + ++v4; + } while (v4 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + SPRITE_ON(0); + v5 = 0; + do { + _vm->_eventsManager.VBL(); + ++v5; + } while (v5 <= 4); + VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); + _vm->_fontManager.TEXTE_OFF(9); + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(383, 4); + _vm->_globals.SAUVEGARDE->data[svField270] = 1; + _vm->_globals.SAUVEGARDE->data[svField300] = 1; + _vm->_globals.SAUVEGARDE->data[svField320] = 1; + if (_vm->_soundManager.VOICEOFF == 1) { + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 199); + } + _vm->_fontManager.TEXTE_OFF(9); + VBOB_OFF(5); + v7 = 0; + do { + _vm->_eventsManager.VBL(); + ++v7; + } while (v7 <= 3); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.DESACTIVE_INVENT = 0; + } +} + void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { if (a1 != -1) - _vm->_objectsManager.BOBANIM_ON(a1); + BOBANIM_ON(a1); if (a2 != -1) - _vm->_objectsManager.BOBANIM_ON(a2); + BOBANIM_ON(a2); if (a3 != -1) - _vm->_objectsManager.BOBANIM_ON(a3); + BOBANIM_ON(a3); if (!a7) { if (a1 != -1) SET_BOBPOSI(a1, a4); @@ -6631,7 +6754,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { _vm->_eventsManager.souris_b = 0; if (a4 != 3) { - _vm->_objectsManager.BOBANIM_ON(a1); + BOBANIM_ON(a1); SET_BOBPOSI(a1, a2); } @@ -6641,7 +6764,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { break; } while (a3 != BOBPOSI(a1)); if (!a4) - _vm->_objectsManager.BOBANIM_OFF(a1); + BOBANIM_OFF(a1); } int ObjectsManager::Control_Goto(const byte *dataP) { @@ -7116,11 +7239,129 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { - warning("TODO: SPACTION"); + int v6; + signed __int16 v7; + char v8; + __int32 v9; + signed __int16 v10; + __int32 v11; + __int16 v13; + char v14; + __int16 v15; + Common::String v16; + + v15 = 0; + v6 = 0; + v13 = 0; + v16 = " "; + v14 = a5; + if (_vm->_globals.vitesse == 2) + v14 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v14 = a5 / 3; + S_old_spr = Sprite[0].spriteData; + S_old_ani = Sprite[0].field10; + S_old_ret = Sprite[0].fieldE; + Sprite[0].field12 += a3; + Sprite[0].field14 += a4; + Sprite[0].fieldE = a6; + do { + do { + v7 = 0; + v8 = a2[v15]; + if (v8 == ',') { + v9 = atoi(v16.c_str()); + v13 = v9; + v6 = 0; + v16 = " "; + v7 = 1; + } else { + v9 = v6; + v16.setChar(v8, v6); + v6 = v6 + 1; + } + ++v15; + } while (v7 != 1); + if (v13 != -1) { + Sprite[0].spriteData = a1; + Sprite[0].field10 = v13; + } + v10 = 0; + v9 = v14; + if (v14 > 0) { + do { + v11 = v9; + _vm->_eventsManager.VBL(); + ++v10; + v9 = v11; + } while (v10 < v11); + } + } while (v13 != -1); } void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { - warning("TODO: SPACTION1"); + int v5; + int v6; + char v7; + int v8; + int v9; + int v10; + int v12; + int v13; + int v14; + Common::String v15; + int v16; + + v14 = 0; + v5 = 0; + v12 = 0; + v15 = " "; + v13 = a5; + if (_vm->_globals.vitesse == 2) + v13 = a5 / 2; + if (_vm->_globals.vitesse == 3) + v13 = a5 / 3; + while (1) { + v6 = 0; + v7 = a2[v14]; + if (v7 == 44) { + v8 = atoi(v15.c_str()); + v12 = v8; + v5 = 0; + v15 = " "; + v6 = 1; + } else { + v8 = v5; + v15.setChar(v7, v5); + v5 = v5 + 1; + } + ++v14; + if (v6 == 1) { + if (v12 == -1) { + Sprite[0].spriteData = S_old_spr; + Sprite[0].field10 = S_old_ani; + Sprite[0].field12 -= a3; + Sprite[0].field14 -= a4; + Sprite[0].fieldE = S_old_ret; + } else { + Sprite[0].spriteData = a1; + Sprite[0].field10 = v12; + } + + v9 = 0; + v16 = v13; + if (v13 > 0) { + do { + v10 = v8; + _vm->_eventsManager.VBL(); + ++v9; + v16 = v10; + } while (v9 < v10); + } + if (v12 == -1) + break; + } + } } void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) { @@ -7226,5 +7467,266 @@ void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { _vm->_globals.BL_ANIM[idx].v2 = a2; } +void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + int v5; + int v6; + int v7; + int v8; + int v9; + + v5 = 0; + INVENTFLAG = 0; + KEY_INVENT = 0; + VIRE_INVENT = 0; + _vm->_graphicsManager.ofscroll = 0; + _vm->_globals.PLAN_FLAG = 0; + _vm->_globals.iRegul = 1; + _vm->_soundManager.WSOUND(v); + _vm->_globals.chemin = PTRNUL; + _vm->_globals.NOMARCHE = 1; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + if (!s1.empty()) + _vm->_graphicsManager.LOAD_IMAGE(s1); + if (!s2.empty()) + INILINK(s2); + if (!s3.empty()) + _vm->_animationManager.CHARGE_ANIM(s3); + _vm->_graphicsManager.VISU_ALL(); + if (!s4.empty()) { + if (!_vm->_globals.NOSPRECRAN) + _vm->_graphicsManager.INI_ECRAN(s4); + if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + _vm->_graphicsManager.INI_ECRAN2(s4); + } + _vm->_eventsManager.MOUSE_ON(); + if (_vm->_globals.ECRAN == 61) { + SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); + SPRITE_ON(0); + _vm->_globals.chemin = PTRNUL; + VERIFTAILLE(); + } + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_globals.BPP_NOAFF = 1; + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_graphicsManager.FADE_INW(); + if (_vm->_globals.ECRAN == 61) { + _vm->_soundManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); + BOBANIM_OFF(3); + _vm->_globals.NOT_VERIF = 1; + g_old_x = XSPR(0); + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = PTRNUL; + v7 = YSPR(0); + v8 = XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); + _vm->_globals.NOT_VERIF = 1; + do { + GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != PTRNUL); + SETANISPR(0, 64); + } + do { + v9 = _vm->_eventsManager.BMOUSE(); + if (v9 == 1) { + BTGAUCHE(); + v9 = 1; + } + if (v9 == 2) + BTDROITE(); + TEST_INVENT(); + VERIFZONE(); + if (GOACTION == 1) + PARADISE(); + if (!_vm->_globals.SORTIE) { + _vm->_eventsManager.VBL(); + if (!_vm->_globals.SORTIE) + continue; + } + v5 = 1; + } while (v5 != 1); + _vm->_graphicsManager.FADE_OUTW(); + if (!s3.empty()) + _vm->_graphicsManager.FIN_VISU(); + if (_vm->_globals.ECRAN == 61) + SPRITE_OFF(0); + CLEAR_ECRAN(); + _vm->_globals.iRegul = 0; +} + +void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v) { + Common::String v5; + int v6; + int v7; + int v8; + int v10; + int v11; + int v12; + int v13; + int xp, yp; + + v5 = s2; + INVENTFLAG = 0; + KEY_INVENT = 0; + _vm->_objectsManager.verbe = 4; + _vm->_globals.MAX_COMPTE = 6; + _vm->_graphicsManager.ofscroll = 0; + VIRE_INVENT = 0; + v11 = 0; + v12 = 0; + _vm->_globals.PLAN_FLAG = 0; + _vm->_graphicsManager.NOFADE = 0; + _vm->_globals.NOMARCHE = 0; + _vm->_globals.SORTIE = 0; + _vm->_globals.AFFLI = 0; + _vm->_globals.AFFIVBL = 0; + _vm->_globals.NOT_VERIF = 1; + _vm->_soundManager.WSOUND(v); + _vm->_globals.iRegul = 1; + if (!s1.empty()) + _vm->_graphicsManager.LOAD_IMAGE(s1); + if (!s2.empty()) + _vm->_objectsManager.INILINK(s2); + if (!s3.empty()) { + _vm->_animationManager.CHARGE_ANIM(s3); + _vm->_graphicsManager.VISU_ALL(); + } + if (!s4.empty()) { + if (!_vm->_globals.NOSPRECRAN) + _vm->_graphicsManager.INI_ECRAN(s4); + if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + _vm->_graphicsManager.INI_ECRAN2(s4); + } + _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.btsouris = 4; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + if (!_vm->_globals.PERSO_TYPE) + goto LABEL_70; + if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + } + if (!_vm->_globals.PERSO_TYPE) { +LABEL_70: + if (_vm->_globals.SAUVEGARDE->data[svField122] == 1) { + FileManager::CONSTRUIT_SYSTEM("HOPFEM.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 1; + } + } + if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals.SAUVEGARDE->data[svField356] == 1) { + FileManager::CONSTRUIT_SYSTEM("PSAMAN.SPR"); + FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 2; + } + _vm->_globals.HOPKINS_DATA(); + if (!_vm->_globals.PERSO_TYPE) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 34, 190); + if (_vm->_globals.PERSO_TYPE == 1) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 28, 155); + if (_vm->_globals.PERSO_TYPE == 2) + SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 20, 127); + _vm->_eventsManager.souris_xy(_vm->_objectsManager.PERX, _vm->_objectsManager.PERY); + if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) + _vm->_graphicsManager.SCROLL = (signed __int16)XSPR(0) - 320; + _vm->_objectsManager.VERIFTAILLE(); + SPRITE_ON(0); + _vm->_globals.CACHE_ON(); + _vm->_globals.chemin = PTRNUL; + _vm->_objectsManager.VERIFTAILLE(); + SPECIAL_INI(s2); + _vm->_eventsManager.souris_n = 4; + g_old_x = _vm->_objectsManager.PERX; + g_old_y = _vm->_objectsManager.PERY; + g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.BPP_NOAFF = 1; + v6 = 0; + do { + _vm->_eventsManager.VBL(); + ++v6; + } while (v6 <= 4); + _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.iRegul = 1; + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.NOFADE = 0; + _vm->_eventsManager.CHANGE_MOUSE(4); + v13 = 0; + do { + v7 = _vm->_eventsManager.BMOUSE(); + v8 = v7; + if (v7) { + if (v7 == 1) { + if (_vm->_objectsManager.verbe == 16 && _vm->_eventsManager.btsouris == 16) { + xp = _vm->_eventsManager.XMOUSE(); + yp = _vm->_eventsManager.YMOUSE(); + v10 = yp; + if (v12 == xp) { + if (v11 == yp) { + _vm->_globals.chemin = PTRNUL; + _vm->_objectsManager.PARADISE(); + if (_vm->_globals.SORTIE) + v13 = 1; + } + } + v12 = xp; + v11 = v10; + } + _vm->_objectsManager.BTGAUCHE(); + } + if (v8 == 2) + _vm->_objectsManager.BTDROITE(); + } + if (!_vm->_globals.SORTIE) { + TEST_INVENT(); + _vm->_objectsManager.VERIFZONE(); + if (_vm->_globals.chemin == PTRNUL || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == PTRNUL)) { + if (_vm->_objectsManager.GOACTION == 1) + _vm->_objectsManager.PARADISE(); + } + SPECIAL_JEU(); + _vm->_eventsManager.VBL(); + if (!_vm->_globals.SORTIE) + continue; + } + v13 = 1; + } while (v13 != 1); + if (_vm->_globals.SORTIE != 8 || _vm->_globals.ECRAN != 5 || _vm->_globals.HELICO != 1) { + if (!_vm->_graphicsManager.NOFADE) + _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.NOFADE = 0; + SPRITE_OFF(0); + _vm->_globals.AFFLI = 0; + if (DEUXPERSO == 1) { + SPRITE_OFF(1); + DEUXPERSO = 0; + } + if (!s3.empty()) + _vm->_graphicsManager.FIN_VISU(); + CLEAR_ECRAN(); + } else { + _vm->_globals.HELICO = 0; + } + _vm->_globals.iRegul = 0; +} } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 56e78c5bd0..944f9b3380 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -75,6 +75,7 @@ public: byte *SL_SPR; byte *SL_SPR2; byte *sprite_ptr; + const byte *S_old_spr; bool PERSO_ON; bool SL_FLAG; bool FLAG_VISIBLE; @@ -121,6 +122,8 @@ public: int OBSSEUL; int NVVERBE; int NVZONE; + int S_old_ani; + int S_old_ret; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -195,6 +198,7 @@ public: void PARADISE(); void CLEAR_ECRAN(); + void TEST_INVENT(); void INVENT(); void CHANGE_TETE(int a1, int a2); void VERIFTAILLE(); @@ -232,6 +236,7 @@ public: int BOBA(int idx); void INILINK(const Common::String &file); + void SPECIAL_INI(const Common::String &a1); void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); void SCI_OPTI_ONE(int a1, int a2, int a3, int a4); int Control_Goto(const byte *dataP); @@ -247,6 +252,10 @@ public: void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); void BLOQUE_ANIMX(int idx, int a2); + void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v); + void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, + const Common::String &s4, int v); }; } // End of namespace Hopkins -- cgit v1.2.3 From 86bf409540a6a7767bd57f51c134bf1ff21ae1ab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Oct 2012 08:09:09 +1000 Subject: HOPKINS: Implemented sequence player --- engines/hopkins/anim.cpp | 171 +++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/anim.h | 3 + engines/hopkins/graphics.cpp | 102 ++++++++++++++++++++++++++ engines/hopkins/graphics.h | 3 + engines/hopkins/objects.cpp | 40 +++++----- engines/hopkins/sound.cpp | 8 -- engines/hopkins/sound.h | 2 - 7 files changed, 299 insertions(+), 30 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 97a0aad250..5273fcde1e 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -993,4 +993,175 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { } while (v21 <= nbytes && !doneFlag); } +void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { + int v5; + int v7; + byte *ptr; + byte *v9; + byte *v10; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + char v18; + size_t nbytes; + int buf; + char v22; + Common::File f; + + v7 = 0; + v14 = 0; + v13 = 0; + v16 = 0; + v15 = 0; + v17 = 1; + _vm->_eventsManager.souris_flag = 0; + if (!NO_COUL) { + _vm->_eventsManager.VBL(); + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) + _vm->_graphicsManager.ofscroll = 0; + } + v9 = _vm->_graphicsManager.VESA_SCREEN; + v10 = _vm->_globals.dos_malloc2(0x16u); + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a2); + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s", _vm->_globals.NFICHIER); + + f.read(&buf, 6u); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4u); + nbytes = f.readUint32LE(); + v18 = f.readUint32LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + v15 = f.readUint16LE(); + v14 = f.readUint16LE(); + v13 = f.readUint16LE(); + f.read(v9, nbytes); + + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + v7 = 1; + ptr = _vm->_globals.dos_malloc2(0x4B000u); + memcpy(ptr, v9, 0x4B000u); + } + if (_vm->_animationManager.NO_SEQ) { + if (v7 == 1) + memcpy(ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + } else { + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.Winbpp == 2) { + if (v7) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (v7) + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 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 == 1) { + if (!_vm->_eventsManager.NOESC) + goto LABEL_59; + _vm->_eventsManager.ESC_KEY = 0; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (_vm->_eventsManager.lItCounter < a3); + } + _vm->_eventsManager.lItCounter = 0; + v5 = 0; + v12 = 0; + do { + ++v12; + _vm->_soundManager.PLAY_ANM_SOUND(v12); + memset(&buf, 0, 6u); + memset(v10, 0, 0x13u); + if (f.read(v10, 16) != 16) + v5 = -1; + + if (strncmp((const char *)v10, "IMAGE=", 7)) + v5 = -1; + if (!v5) { + f.read(v9, READ_LE_UINT16(v10 + 8)); + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->_eventsManager.ESC_KEY == 1) { + if (!_vm->_eventsManager.NOESC) + goto LABEL_59; + _vm->_eventsManager.ESC_KEY = 0; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (_vm->_eventsManager.lItCounter < a4); + } + _vm->_eventsManager.lItCounter = 0; + _vm->_graphicsManager.DD_Lock(); + if (v7) { + if (*v9 != -4) { + _vm->_graphicsManager.Copy_WinScan_Vbe(v9, ptr); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else if (*v9 != -4) { + if (_vm->_graphicsManager.Winbpp == 1) + _vm->_graphicsManager.Copy_Video_Vbe(v9); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.Copy_Video_Vbe16a(v9); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.VERIF_SOUND(); + } + } while (v5 != -1); + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->_eventsManager.ESC_KEY == 1) { + if (!_vm->_eventsManager.NOESC) + goto LABEL_59; + _vm->_eventsManager.ESC_KEY = 0; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (_vm->_eventsManager.lItCounter < a5); + } + _vm->_eventsManager.lItCounter = 0; +LABEL_59: + _vm->_graphicsManager.NOLOCK = 0; + f.close(); + + if (!NO_COUL) { + FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_eventsManager.souris_flag = 1; + } + if (v7 == 1) + _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v10); +} + +void AnimationManager::PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4) { + warning("PLAY_SEQ2"); +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 1c4ecb296a..74b002c2dd 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -39,6 +39,7 @@ public: HopkinsEngine *_vm; bool CLS_ANM; bool NO_SEQ; + bool NO_COUL; public: AnimationManager(); void setParent(HopkinsEngine *vm) { _vm = vm; } @@ -49,6 +50,8 @@ public: void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); + void PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); + void PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4); }; } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index e4a5c1100d..f54649f976 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1258,6 +1258,39 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { } } +void GraphicsManager::Copy_Video_Vbe16a(const byte *surface) { + int v2; + const byte *v3; + unsigned __int8 v4; + + v2 = 0; + v3 = surface; + for (;;) { + v4 = *v3; + if (*v3 < 0xFCu) + goto Video_Cont_Vbe16a; + if (v4 == -4) + return; + if (v4 == -3) { + v2 += *(v3 + 1); + v4 = *(v3 + 2); + v3 += 2; + } else if (v4 == -2) { + v2 += READ_LE_UINT16(v3 + 1); + v4 = *(v3 + 3); + v3 += 3; + } else { + v2 += READ_LE_UINT32(v3 + 1); + v4 = *(v3 + 5); + v3 += 5; + } +Video_Cont_Vbe16a: + WRITE_LE_UINT16(v2 + v2 + VideoPtr, READ_LE_UINT16(PAL_PIXELS + 2 * v4)); + ++v3; + ++v2; + } +} + void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height) { const byte *srcP; byte *destP; @@ -2411,4 +2444,73 @@ void GraphicsManager::videkey() { // Empty in original } +void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { + int result; + int destOffset; + const byte *srcPtr; + byte byteVal; + + result = 0; + destOffset = 0; + srcPtr = src; + while (1) { + byteVal = *srcPtr; + if (*srcPtr < 0xFCu) + goto Video_Cont_wVbe; + if (byteVal == (byte)-4) + return; + if (byteVal == (byte)-3) { + destOffset += *(srcPtr + 1); + byteVal = *(srcPtr + 2); + srcPtr += 2; + } else if (byteVal == (byte)-2) { + destOffset += READ_LE_UINT16(srcPtr + 1); + byteVal = *(srcPtr + 3); + srcPtr += 3; + } else { + destOffset += READ_LE_UINT32(srcPtr + 1); + byteVal = *(srcPtr + 5); + srcPtr += 5; + } +Video_Cont_wVbe: + *(dest + destOffset) = byteVal; + ++srcPtr; + ++destOffset; + } +} + +void GraphicsManager::Copy_Video_Vbe(const byte *src) { + int destOffset; + const byte *srcP; + byte byteVal; + + assert(VideoPtr); + destOffset = 0; + srcP = src; + while (1) { + byteVal = *srcP; + if (*srcP < 0xFCu) + goto Video_Cont_Vbe; + if (byteVal == -4) + return; + if (byteVal == -3) { + destOffset += *(srcP + 1); + byteVal = *(srcP + 2); + srcP += 2; + } else if (byteVal == -2) { + destOffset += READ_LE_UINT16(srcP + 1); + byteVal = *(srcP + 3); + srcP += 3; + } else { + destOffset += READ_LE_UINT32(srcP + 1); + byteVal = *(srcP + 5); + srcP += 5; + } +Video_Cont_Vbe: + *((byte *)VideoPtr->pixels + destOffset) = byteVal; + ++srcP; + ++destOffset; + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 0622e3678f..59febac9f1 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -146,6 +146,7 @@ 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 Copy_Video_Vbe16a(const byte *surface); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height); /** @@ -179,6 +180,8 @@ public: void NB_SCREEN(); void SHOW_PALETTE(); void videkey(); + void Copy_WinScan_Vbe(const byte *srcP, byte *destP); + void Copy_Video_Vbe(const byte *src); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 25d4cde43a..b650c888a7 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4605,7 +4605,7 @@ LABEL_1141: CLEAR_ECRAN(); _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_soundManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); + _vm->_animationManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); _vm->_animationManager.CHARGE_ANIM("otage"); _vm->_graphicsManager.LOAD_IMAGE("IM05"); _vm->_graphicsManager.VISU_ALL(); @@ -4643,7 +4643,7 @@ LABEL_1141: _vm->_graphicsManager.FIN_VISU(); _vm->_soundManager.SPECIAL_SOUND = 14; _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_soundManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); + _vm->_animationManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_globals.DESACTIVE_INVENT = 0; _vm->_globals.HELICO = 1; @@ -4666,7 +4666,7 @@ LABEL_1141: } if (v76 == 37) { _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_soundManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); + _vm->_animationManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); _vm->_graphicsManager.NOFADE = 1; } if (v76 == 38) { @@ -4674,7 +4674,7 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); _vm->_soundManager.SPECIAL_SOUND = 17; - _vm->_soundManager.PLAY_SEQ(v1, "grenade.SEQ", 1, 32, 100); + _vm->_animationManager.PLAY_SEQ(v1, "grenade.SEQ", 1, 32, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.PLAY_ANM("CREVE17.ANM", 24, 24, 200); @@ -5063,11 +5063,11 @@ LABEL_1141: if (v76 == 90) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB5A.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB5C.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB5C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); } @@ -5075,11 +5075,11 @@ LABEL_1141: if (v76 == 91) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB5B.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB5D.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB5D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); } @@ -5087,11 +5087,11 @@ LABEL_1141: if (v76 == 92) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB6A.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB6C.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB6C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); } @@ -5099,11 +5099,11 @@ LABEL_1141: if (v76 == 93) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB6B.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_soundManager.PLAY_SEQ(v1, "CIB6D.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "CIB6D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); } @@ -5276,7 +5276,7 @@ LABEL_1141: if (v76 == 210) { _vm->_animationManager.NO_SEQ = 1; _vm->_soundManager.SPECIAL_SOUND = 210; - _vm->_soundManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); BOBANIM_ON(9); @@ -5298,7 +5298,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = 1; _vm->_globals.NO_VISU = 0; _vm->_soundManager.SPECIAL_SOUND = 211; - _vm->_soundManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); + _vm->_animationManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_animationManager.NO_SEQ = 0; _vm->_graphicsManager.NOFADE = 1; @@ -5320,7 +5320,7 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; _vm->_eventsManager.NOESC = true; - _vm->_soundManager.PLAY_SEQ(v1, "SORT.SEQ", 10, 4, 10); + _vm->_animationManager.PLAY_SEQ(v1, "SORT.SEQ", 10, 4, 10); _vm->_eventsManager.NOESC = false; _vm->_soundManager.SPECIAL_SOUND = 0; } @@ -5461,7 +5461,7 @@ LABEL_1141: } if (v76 == 229) { _vm->_soundManager.SPECIAL_SOUND = 229; - _vm->_soundManager.PLAY_SEQ(v1, "MUR.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ(v1, "MUR.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); } @@ -5891,7 +5891,7 @@ LABEL_1141: _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { _vm->_animationManager.NO_SEQ = 1; - _vm->_soundManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); + _vm->_animationManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); _vm->_animationManager.NO_SEQ = 0; } else { OPTI_ONE(7, 0, 14, 0); @@ -5900,7 +5900,7 @@ LABEL_1141: if (v76 == 242) { _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = 1; - _vm->_soundManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); + _vm->_animationManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = 0; v53 = &_vm->_globals.SAUVEGARDE->field380; v53->field0 = 404; @@ -5936,7 +5936,7 @@ LABEL_1141: PERSO_ON = 1; _vm->_graphicsManager.NB_SCREEN(); _vm->_animationManager.NO_SEQ = 1; - _vm->_soundManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); + _vm->_animationManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = 0; _vm->_graphicsManager.NOFADE = 1; _vm->_graphicsManager.FADE_OUTW(); @@ -7522,7 +7522,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.BPP_NOAFF = 0; _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.ECRAN == 61) { - _vm->_soundManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); + _vm->_animationManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); BOBANIM_OFF(3); _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index b138ee36ba..9b58f42d18 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -92,14 +92,6 @@ void SoundManager::PLAY_SAMPLE2(int idx) { warning("PLAY_SAMPLE2"); } -void SoundManager::PLAY_SEQ(int a1, const Common::String &a2, int a3, int a4, int a5) { - warning("PLAY_SEQ"); -} - -void SoundManager::PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4) { - warning("PLAY_SEQ2"); -} - void SoundManager::PLAY_WAV(int a1) { warning("PLAY_WAV"); } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index d962233f73..ea7151f564 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -64,8 +64,6 @@ public: void MODSetMusicVolume(int volume); void CHARGE_SAMPLE(int a1, const Common::String &file); void PLAY_SAMPLE2(int idx); - void PLAY_SEQ(int a1, const Common::String &a2, int a3, int a4, int a5); - void PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4); void PLAY_WAV(int a1); }; -- cgit v1.2.3 From 09601fab69cc6d7d979e89fed7b73fc32824a063 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Oct 2012 23:52:59 +1000 Subject: HOPKINS: Implemented PLAY_SEQ2 --- engines/hopkins/anim.cpp | 210 ++++++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/anim.h | 2 +- 2 files changed, 207 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 5273fcde1e..6e463a1781 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -996,7 +996,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { int v5; int v7; - byte *ptr; + byte *ptr = NULL; byte *v9; byte *v10; int v12; @@ -1008,7 +1008,6 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin char v18; size_t nbytes; int buf; - char v22; Common::File f; v7 = 0; @@ -1159,8 +1158,211 @@ LABEL_59: _vm->_globals.dos_free2(v10); } -void AnimationManager::PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4) { - warning("PLAY_SEQ2"); +void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4) { + int v4; + int v5; + int v7; + byte *ptr; + byte *ptra; + byte *v10; + byte *v11; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + char v19; + size_t nbytes; + byte buf[4]; + Common::File f; + + v7 = 0; + for (;;) { + v15 = 0; + v14 = 0; + v17 = 0; + v16 = 0; + v18 = 1; + _vm->_eventsManager.souris_flag = 0; + v10 = _vm->_graphicsManager.VESA_SCREEN; + v11 = _vm->_globals.dos_malloc2(0x16u); + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a1); + + if (!f.open(_vm->_globals.NFICHIER)) + error("File not found ", _vm->_globals.NFICHIER.c_str()); + + f.read(&buf, 6u); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4u); + nbytes = f.readUint32LE(); + v19 = f.readUint32LE(); + v18 = f.readUint16LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + v15 = f.readUint16LE(); + v14 = f.readUint16LE(); + f.read(v10, nbytes); + + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + v7 = 1; + ptr = _vm->_globals.dos_malloc2(0x4B000u); + memcpy((void *)ptr, v10, 0x4B000u); + } + if (_vm->_animationManager.NO_SEQ) { + if (v7 == 1) + memcpy((void *)ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + } else { + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + if (_vm->_graphicsManager.Winbpp == 2) { + if (v7) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + if (_vm->_graphicsManager.Winbpp == 1) { + if (v7) + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 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) + break; + while (1) { + if (_vm->_eventsManager.ESC_KEY == 1) + goto LABEL_54; + if (REDRAW_ANIM() == 1) + break; + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= a2) + goto LABEL_23; + } +LABEL_48: + if (_vm->_graphicsManager.NOLOCK == 1) + goto LABEL_54; + if (v7 == 1) + ptr = _vm->_globals.dos_free2(ptr); + _vm->_globals.dos_free2(v11); + f.close(); + } +LABEL_23: + _vm->_eventsManager.lItCounter = 0; + v4 = 0; + v13 = 0; + for (;;) { + _vm->_soundManager.PLAY_ANM_SOUND(v13++); + memset(&buf, 0, 6u); + memset(v11, 0, 0x13u); + if (f.read(v11, 0x10u) == -1) + v4 = -1; + + if (strncmp((const char *)v11, "IMAGE=", 7u)) + v4 = -1; + if (v4) + goto LABEL_44; + f.read(v10, READ_LE_UINT32(v11 + 8)); + if (_vm->_globals.iRegul == 1) + break; +LABEL_33: + _vm->_eventsManager.lItCounter = 0; + _vm->_graphicsManager.DD_Lock(); + if (v7) { + if (*v10 != -4) { + _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else if (*v10 != -4) { + if (_vm->_graphicsManager.Winbpp == 1) + _vm->_graphicsManager.Copy_Video_Vbe(v10); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.Copy_Video_Vbe16a(v10); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.VERIF_SOUND(); +LABEL_44: + if (v4 == -1) { + if (_vm->_globals.iRegul == 1) { + while (_vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) + goto LABEL_48; + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= a4) + goto LABEL_53; + } + } else { +LABEL_53: + _vm->_eventsManager.lItCounter = 0; + } + goto LABEL_54; + } + } + while (_vm->_eventsManager.ESC_KEY != 1) { + _vm->_eventsManager.CONTROLE_MES(); + if (REDRAW_ANIM() == 1) + goto LABEL_48; + if (_vm->_eventsManager.lItCounter >= a3) + goto LABEL_33; + } +LABEL_54: + if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) { + ptra = _vm->_globals.dos_malloc2(0x4B000u); + + f.seek(0); + f.read(&buf, 6u); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(&buf, 4u); + nbytes = f.readUint32LE(); + v19 = f.readUint32LE(); + v18 = f.readUint16LE(); + v17 = f.readUint16LE(); + v16 = f.readUint16LE(); + v15 = f.readUint16LE(); + v14 = f.readUint16LE(); + f.read(v10, nbytes); + + memcpy(ptra, v10, 0x4B000u); + v5 = 0; + do { + memset(&buf, 0, 6u); + memset(v11, 0, 0x13u); + if (f.read(v11, 0x10u) == -1) + v5 = -1; + + if (strncmp((const char *)v11, "IMAGE=", 7u)) + v5 = -1; + if (!v5) { + f.read(v10, READ_LE_UINT32(v11 + 8)); + if (*v10 != -4) + _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); + } + } while (v5 != -1); + _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); + ptr = _vm->_globals.dos_free2(ptra); + } + if (v7 == 1) { + if (_vm->_graphicsManager.FADE_LINUX == 2) + _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); + _vm->_globals.dos_free2(ptr); + } + _vm->_graphicsManager.FADE_LINUX = 0; + + f.close(); + _vm->_globals.dos_free2(v11); + _vm->_eventsManager.souris_flag = 1; } diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 74b002c2dd..66f623f257 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -51,7 +51,7 @@ public: void CLEAR_ANIM(); void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); void PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); - void PLAY_SEQ2(const Common::String &a1, int a2, int a3, int a4); + void PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4); }; } // End of namespace Hopkins -- cgit v1.2.3 From fc9fc47e5f12665e8e24b5f40a05a546ff3666fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Oct 2012 00:45:07 +1000 Subject: HOPKINS: Implemented stubbed menu methods --- engines/hopkins/globals.h | 5 +- engines/hopkins/graphics.cpp | 49 ++++++++ engines/hopkins/graphics.h | 2 + engines/hopkins/menu.cpp | 265 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/menu.h | 2 + engines/hopkins/objects.h | 1 + 6 files changed, 321 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 61392e36fe..3bbaa2c9f4 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -214,6 +214,7 @@ enum SauvegardeOffset { , svField6 , svField8 , svField9 + , svField10 , svField13 , svField80 , svField94 @@ -264,10 +265,12 @@ enum SauvegardeOffset { , svField357 , svField399 , svField401 + , svField1300 }; +// TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { - byte data[999]; // TODO: GET CORRECT SIZE + byte data[0x802]; Sauvegarde1 field360; Sauvegarde1 field370; Sauvegarde1 field380; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f54649f976..9a93b8eca9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2513,4 +2513,53 @@ Video_Cont_Vbe: } } +// TODO: Check that v9 doesn't get set anywhere (apart from the current init to zero) +void GraphicsManager::Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7) { + byte *v7; + byte *v8; + int v9 = 0; + int v10 = 0; + int v11; + int v12; + byte *v13; + int v14; + + v7 = a3 + nbrligne2 * a4 + a1; + v8 = a2; + Red = a7; + Largeur = a5; + Red_x = 0; + Red_y = 0; + if (a7 < 100) { + Reduc_Ecran_L = Asm_Reduc(a5, Red); + Reduc_Ecran_H = Asm_Reduc(v9, Red); + v11 = Red; + do { + v14 = v10; + v13 = v7; + Red_y += v11; + if ((uint16)Red_y < 0x64u) { + Red_x = 0; + v12 = Largeur; + do { + Red_x += v11; + if ((uint16)Red_x < 0x64u) { + *v8++ = *v7++; + } else { + Red_x = Red_x - 100; + ++v7; + } + --v12; + } while (v12); + v10 = v14; + v7 = nbrligne2 + v13; + } else { + Red_y = Red_y - 100; + v7 += nbrligne2; + } + --v10; + } while (v10); + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 59febac9f1..e41b37f187 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -99,6 +99,7 @@ public: int Compteur_y; int spec_largeur; bool NOFADE; + int Reduc_Ecran_L, Reduc_Ecran_H; public: GraphicsManager(); ~GraphicsManager(); @@ -182,6 +183,7 @@ public: void videkey(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); + void Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7); }; } // End of namespace Hopkins diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index f692d4ee42..66436a830f 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/file.h" #include "common/util.h" #include "hopkins/menu.h" #include "hopkins/dialogs.h" @@ -233,11 +234,132 @@ int MenuManager::MENU() { } void MenuManager::CHARGE_PARTIE() { - warning("CHARGE_PARTIE"); + int v1; + char v3; + byte *v4; + int v5; + Common::String s; + Common::String v8; + char v9; + char v10; + char v11; + Common::String v12; + char v13; + char v14; + char v15; + char v16; + char v17; + Common::File f; + + _vm->_eventsManager.VBL(); + LOAD_SAUVE(2); + do { + do { + v1 = CHERCHE_PARTIE(); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!v1); + _vm->_objectsManager.SL_FLAG = 0; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); + _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + if (v1 != 7) { + s = Common::String::format("%d", v1); + v8 = 80; + v9 = 65; + v10 = 82; + v11 = 84; + v12 = s; + v13 = 46; + v14 = 68; + v15 = 65; + v16 = 84; + v17 = 0; + FileManager::CONSTRUIT_LINUX(v8); + if (f.open(_vm->_globals.NFICHIER)) { + f.close(); + + v3 = _vm->_globals.SAUVEGARDE->data[svField10]; + FileManager::CONSTRUIT_LINUX(v8); + FileManager::bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); + + v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; + v5 = 0; + do { + _vm->_globals.INVENTAIRE[v5] = READ_LE_UINT16(v4 + 2 * v5); + ++v5; + } while (v5 <= 34); + + _vm->_globals.SAUVEGARDE->data[svField10] = v3; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; + _vm->_globals.SAUVEGARDE->data[svField6] = 0; + _vm->_globals.ECRAN = 0; + } + } + + _vm->_objectsManager.CHANGE_OBJET(14); } void MenuManager::SAUVE_PARTIE() { - warning("SAUVE_PARTIE"); + byte *v1; + int v2; + byte *v3; + int v4; + Common::String s; + Common::String v7; + char v12; + char v13; + char v14; + char v15; + char v16; + + _vm->_eventsManager.VBL(); + v1 = _vm->_globals.dos_malloc2(0x2DB4u); + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, SCREEN_WIDTH * 2, 440, 0x50u); + _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.Trans_bloc2(v1, _vm->_graphicsManager.TABLE_COUL, 11136); + LOAD_SAUVE(1); + do { + do { + v2 = CHERCHE_PARTIE(); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!v2); + _vm->_objectsManager.SL_FLAG = 0; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + if (v2 != 7) { + s = Common::String::format("%d", v2); + v7 = Common::String::format("PART%c.DAT", s[0]); + + _vm->_globals.SAUVEGARDE->data[svField10] = v2; + v3 = &_vm->_globals.SAUVEGARDE->data[svField1300]; + v4 = 0; + do { + WRITE_LE_UINT16(v3 + 2 * v4, _vm->_globals.INVENTAIRE[v4]); + ++v4; + } while (v4 <= 34); + + FileManager::CONSTRUIT_LINUX(v7); + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); + v12 = 46; + v13 = 69; + v14 = 67; + v15 = 82; + v16 = 0; + FileManager::CONSTRUIT_LINUX(v7); + FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); + } + _vm->_globals.dos_free2(v1); } void MenuManager::COMPUT_HOPKINS(int idx) { @@ -437,4 +559,143 @@ void MenuManager::COMPUT_HOPKINS(int idx) { */ } +void MenuManager::LOAD_SAUVE(int a1) { + int v1; + byte *v2; + byte *v3; + Common::String s; + char v5; + char v6; + char v7; + char v8; + char v9; + char v10; + char v11; + char v12; + char v13; + char v14; + Common::File f; + + if (_vm->_globals.FR == 1) + FileManager::CONSTRUIT_SYSTEM("SAVEFR.SPR"); + if (!_vm->_globals.FR) + FileManager::CONSTRUIT_SYSTEM("SAVEAN.SPR"); + if (_vm->_globals.FR == 2) + FileManager::CONSTRUIT_SYSTEM("SAVEES.SPR"); + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + FileManager::CONSTRUIT_SYSTEM("SAVE2.SPR"); + _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); + if (_vm->_globals.FR) { + if (a1 == 1) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 525, 375, 1); + if (a1 == 2) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 515, 375, 2); + } else { + if (a1 == 1) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 535, 372, 1); + if (a1 == 2) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); + } + v1 = 1; + do { + memset(&s, 0, 0x13u); + sprintf(&v14, "%d", v1); + s = 80; + v5 = 65; + v6 = 82; + v7 = 84; + v8 = v14; + v9 = 46; + v10 = 69; + v11 = 67; + v12 = 82; + v13 = 0; + FileManager::CONSTRUIT_LINUX(s); + if (f.exists(_vm->_globals.NFICHIER)) { + v2 = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + v3 = v2; + if (v1 == 1) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v2, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); + if (v1 == 2) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); + if (v1 == 3) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); + if (v1 == 4) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); + if (v1 == 5) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); + if (v1 == 6) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); + _vm->_globals.dos_free2(v3); + } + ++v1; + } while (v1 <= 6); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + _vm->_objectsManager.SL_FLAG = 1; + _vm->_objectsManager.SL_MODE = a1; + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; +} + +int MenuManager::CHERCHE_PARTIE() { + int v0; + int v1; + int v2; + + v0 = 0; + v1 = _vm->_eventsManager.XMOUSE(); + v2 = _vm->_eventsManager.YMOUSE(); + _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; + if ((uint16)(v2 - 112) <= 0x56u) { + if (v1 > _vm->_eventsManager.start_x + 189 && v1 < _vm->_eventsManager.start_x + 318) + v0 = 1; + if ((uint16)(v2 - 112) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 2; + } + if ((uint16)(v2 - 203) <= 0x56u) { + if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) + v0 = 3; + if ((uint16)(v2 - 203) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 4; + } + if ((uint16)(v2 - 294) <= 0x56u) { + if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) + v0 = 5; + if ((uint16)(v2 - 294) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 6; + } + if ((uint16)(v2 - 388) <= 0x10u && v1 > _vm->_graphicsManager.ofscroll + 273 && v1 < _vm->_graphicsManager.ofscroll + 355) + v0 = 7; + if (v0 == 1) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 111; + } + if (v0 == 2) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 111; + } + if (v0 == 3) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 202; + } + if (v0 == 4) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 202; + } + if (v0 == 5) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 293; + } + if (v0 == 6) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 293; + } + if (v0 == 7 || !v0) { + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + } + return v0; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index c8a1a4eec0..8b2812b476 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -43,6 +43,8 @@ public: void CHARGE_PARTIE(); void SAUVE_PARTIE(); void COMPUT_HOPKINS(int a1); + void LOAD_SAUVE(int a1); + int CHERCHE_PARTIE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 944f9b3380..075a9dfc88 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -78,6 +78,7 @@ public: const byte *S_old_spr; bool PERSO_ON; bool SL_FLAG; + int SL_MODE; bool FLAG_VISIBLE; bool DESACTIVE_INVENT; int DESACTIVE_CURSOR; -- cgit v1.2.3 From b718039a8a1041b70db56be5c76e876f8c130079 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Oct 2012 00:52:52 +1000 Subject: HOPKINS: Bugfixes for startup manager initialisations --- engines/hopkins/events.cpp | 6 +++--- engines/hopkins/graphics.cpp | 1 - engines/hopkins/objects.cpp | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index b1c70ff02b..b60562c92d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -36,7 +36,7 @@ EventsManager::EventsManager() { mouse_linux = false; souris_sizex = souris_sizey = 0; ofset_souris_x = ofset_souris_y = 0; - _vm->_eventsManager.start_x = start_y = 0; + start_x = start_y = 0; CASSE = false; souris_n = 0; souris_bb = 0; @@ -183,9 +183,9 @@ void EventsManager::CONTROLE_MES() { void EventsManager::checkForNextFrameCounter() { uint32 milli = g_system->getMillis(); - if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { + if ((milli - _priorFrameTime) >= 10) { _priorFrameTime = milli; - ++lItCounter; + lItCounter += 3; g_system->updateScreen(); } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9a93b8eca9..64013cd215 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -43,7 +43,6 @@ GraphicsManager::GraphicsManager() { nbrligne = 0; Linear = false; VideoPtr = NULL; - _vm->_eventsManager.start_x = 0; ofscroll = 0; SCROLL = 0; PCX_L = PCX_H = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b650c888a7..40689b11ee 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -42,7 +42,6 @@ ObjectsManager::ObjectsManager() { SL_X = SL_Y = 0; I_old_x = I_old_y = 0; FLAG_VISIBLE_EFFACE = 0; - _vm->_globals.Winventaire = PTRNUL; inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; -- cgit v1.2.3 From 575f179f0f3fc62d4173115c141c6641f794c9ab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Oct 2012 23:21:10 +1000 Subject: HOPKINS: Converted the file manager from static to a standard manager class --- engines/hopkins/anim.cpp | 154 +++++++++++++------------- engines/hopkins/dialogs.cpp | 8 +- engines/hopkins/events.cpp | 2 +- engines/hopkins/files.cpp | 117 ++++++++++---------- engines/hopkins/files.h | 41 ++++--- engines/hopkins/font.cpp | 2 +- engines/hopkins/globals.cpp | 12 +- engines/hopkins/graphics.cpp | 72 ++++++------ engines/hopkins/hopkins.cpp | 255 ++++++++++++++++++++++--------------------- engines/hopkins/hopkins.h | 2 + engines/hopkins/menu.cpp | 32 +++--- engines/hopkins/objects.cpp | 108 +++++++++--------- engines/hopkins/talk.cpp | 58 +++++----- 13 files changed, 440 insertions(+), 423 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 6e463a1781..3971300ff4 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -55,10 +55,10 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui v18 = 1; screenP = _vm->_graphicsManager.VESA_SCREEN; - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANM, filename); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); - if (!f.open(GLOBALS.NFICHIER)) - error("Not Found file %s", GLOBALS.NFICHIER.c_str()); + if (!f.open(_vm->_globals.NFICHIER)) + error("Not Found file %s", _vm->_globals.NFICHIER.c_str()); // TODO: Original above read seems to overlap the doneFlag f.skip(6); @@ -86,7 +86,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { doneFlag = 1; - screenCopy = GLOBALS.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT); + screenCopy = _vm->_globals.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT); memcpy(screenCopy, screenP, SCREEN_WIDTH * SCREEN_HEIGHT); } @@ -163,7 +163,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui if (doneFlag <= SCREEN_WIDTH) goto MAIN_LOOP; - screenCopy = GLOBALS.dos_free2(screenCopy); + screenCopy = _vm->_globals.dos_free2(screenCopy); goto MAIN_LOOP; } #endif @@ -218,7 +218,7 @@ REDRAW_ANIM: if (doneFlag != 1) goto MAIN_LOOP; - screenCopy = GLOBALS.dos_free2(screenCopy); + screenCopy = _vm->_globals.dos_free2(screenCopy); goto MAIN_LOOP; } #endif @@ -234,7 +234,7 @@ REDRAW_ANIM: FINISH: if (_vm->_graphicsManager.FADE_LINUX == 2 && !doneFlag) { - screenCopy = GLOBALS.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT); + screenCopy = _vm->_globals.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT); f.skip(6); f.read(_vm->_graphicsManager.Palette, PALETTE_EXT_BLOCK_SIZE); @@ -270,18 +270,18 @@ FINISH: } while (!doneFlag); _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); - screenCopy = GLOBALS.dos_free2(screenCopy); + screenCopy = _vm->_globals.dos_free2(screenCopy); } if (doneFlag == 1) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); - GLOBALS.dos_free2(screenCopy); + _vm->_globals.dos_free2(screenCopy); } _vm->_graphicsManager.FADE_LINUX = 0; f.close(); - GLOBALS.dos_free2(screenCopy); + _vm->_globals.dos_free2(screenCopy); _vm->_graphicsManager.NOLOCK = false; } @@ -315,16 +315,16 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint v18 = 0; v20 = 1; memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == 1280) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager.VESA_SCREEN; v13 = _vm->_globals.dos_malloc2(0x14u); - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s"); @@ -398,8 +398,8 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_globals.dos_free2(v13); f.close(); - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); @@ -503,8 +503,8 @@ LABEL_88: _vm->_globals.dos_free2(v13); f.close(); - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); @@ -567,8 +567,8 @@ LABEL_88: _vm->_globals.dos_free2(v13); f.close(); - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); @@ -664,8 +664,8 @@ LABEL_114: } _vm->_graphicsManager.FADE_LINUX = 0; _vm->_globals.dos_free2(v13); - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); @@ -730,11 +730,11 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { CLEAR_ANIM(); Common::String filename = animName + ".ANI"; - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, filename); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); Common::File f; - if (!f.open(GLOBALS.NFICHIER)) - error("Failed to open %s", GLOBALS.NFICHIER.c_str()); + if (!f.open(_vm->_globals.NFICHIER)) + error("Failed to open %s", _vm->_globals.NFICHIER.c_str()); int filesize = f.size(); int nbytes = filesize - 115; @@ -755,16 +755,16 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { for (int idx = 1; idx <= 6; ++idx) { if (files[idx - 1][0]) { - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, files[idx - 1]); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, files[idx - 1]); - if (!f.exists(GLOBALS.NFICHIER)) + if (!f.exists(_vm->_globals.NFICHIER)) error("File not found"); if (CHARGE_BANK_SPRITE1(idx, files[idx - 1])) error("File not compatible with this soft."); } } - byte *data = GLOBALS.dos_malloc2(nbytes + 1); + byte *data = _vm->_globals.dos_malloc2(nbytes + 1); f.read(data, nbytes); f.close(); @@ -772,23 +772,23 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { RECHERCHE_ANIM(data, idx, nbytes); } - GLOBALS.dos_free2(data); + _vm->_globals.dos_free2(data); } void AnimationManager::CLEAR_ANIM() { for (int idx = 0; idx < 35; ++idx) { - if (GLOBALS.Bqe_Anim[idx].data != PTRNUL) - GLOBALS.Bqe_Anim[idx].data = GLOBALS.dos_free2(GLOBALS.Bqe_Anim[idx].data); - GLOBALS.Bqe_Anim[idx].field4 = 0; + if (_vm->_globals.Bqe_Anim[idx].data != PTRNUL) + _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); + _vm->_globals.Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - if (GLOBALS.Bank[idx].data != PTRNUL) - GLOBALS.Bank[idx].data = GLOBALS.dos_free2(GLOBALS.Bank[idx].data); - GLOBALS.Bank[idx].field4 = 0; - GLOBALS.Bank[idx].filename1 = ""; - GLOBALS.Bank[idx].fileHeader = 0; - GLOBALS.Bank[idx].field1C = 0; + if (_vm->_globals.Bank[idx].data != PTRNUL) + _vm->_globals.Bank[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bank[idx].data); + _vm->_globals.Bank[idx].field4 = 0; + _vm->_globals.Bank[idx].filename1 = ""; + _vm->_globals.Bank[idx].fileHeader = 0; + _vm->_globals.Bank[idx].field1C = 0; } } @@ -807,23 +807,23 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam int v20; int v21; int result = 0; - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, filename); - GLOBALS.Bank[idx].field1C = FileManager::FLONG(GLOBALS.NFICHIER); - GLOBALS.Bank[idx].field4 = 1; - GLOBALS.Bank[idx].filename1 = filename; - GLOBALS.Bank[idx].filename2 = GLOBALS.REP_SPR; + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); + _vm->_globals.Bank[idx].field1C = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + _vm->_globals.Bank[idx].field4 = 1; + _vm->_globals.Bank[idx].filename1 = filename; + _vm->_globals.Bank[idx].filename2 = _vm->_globals.REP_SPR; - v3 = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + v3 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v4 = v3; - GLOBALS.Bank[idx].fileHeader = 0; + _vm->_globals.Bank[idx].fileHeader = 0; if (*(v3 + 1) == 'L' && *(v3 + 2) == 'E') - GLOBALS.Bank[idx].fileHeader = 1; + _vm->_globals.Bank[idx].fileHeader = 1; if (*(v3 + 1) == 'O' && *(v3 + 2) == 'R') - GLOBALS.Bank[184].fileHeader = 2; + _vm->_globals.Bank[184].fileHeader = 2; - if (GLOBALS.Bank[idx].fileHeader) { - GLOBALS.Bank[idx].data = v3; + if (_vm->_globals.Bank[idx].fileHeader) { + _vm->_globals.Bank[idx].data = v3; v7 = 0; v8 = 0; @@ -841,45 +841,45 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam } while (v7 != 1); if (v8 <= 249) { - GLOBALS.Bank[idx].field1A = v8; + _vm->_globals.Bank[idx].field1A = v8; - Common::String ofsFilename = GLOBALS.Bank[idx].filename1; + Common::String ofsFilename = _vm->_globals.Bank[idx].filename1; while (ofsFilename.lastChar() != '.') ofsFilename.deleteLastChar(); ofsFilename += ".OFS"; - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANIM, ofsFilename); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, ofsFilename); Common::File f; - if (!f.exists(GLOBALS.NFICHIER)) { - v19 = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + if (!f.exists(_vm->_globals.NFICHIER)) { + v19 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v13 = v19; - if (GLOBALS.Bank[idx].field1A > 0) { - for (int v14 = 0; v14 < GLOBALS.Bank[idx].field1A; ++v14) { + if (_vm->_globals.Bank[idx].field1A > 0) { + for (int v14 = 0; v14 < _vm->_globals.Bank[idx].field1A; ++v14) { v16 = READ_LE_UINT16(v13); v17 = READ_LE_UINT16(v13 + 2); v21 = READ_LE_UINT16(v13 + 4); v20 = READ_LE_UINT16(v13 + 6); v13 += 8; - _vm->_objectsManager.set_offsetxy(GLOBALS.Bank[idx].data, v14, v16, v17, 0); - if (GLOBALS.Bank[idx].fileHeader == 2) - _vm->_objectsManager.set_offsetxy(GLOBALS.Bank[idx].data, v14, v21, v20, 1); + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, v14, v16, v17, 0); + if (_vm->_globals.Bank[idx].fileHeader == 2) + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, v14, v21, v20, 1); } } - GLOBALS.dos_free2(v19); + _vm->_globals.dos_free2(v19); } result = 0; } else { - GLOBALS.dos_free2(ptr); - GLOBALS.Bank[idx].field4 = 0; + _vm->_globals.dos_free2(ptr); + _vm->_globals.Bank[idx].field4 = 0; result = -2; } } else { - GLOBALS.dos_free2(v3); - GLOBALS.Bank[idx].field4 = 0; + _vm->_globals.dos_free2(v3); + _vm->_globals.Bank[idx].field4 = 0; result = -1; } @@ -933,8 +933,8 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { breakFlag = true; if (nbytes < v6) { - GLOBALS.Bqe_Anim[idx].field4 = 0; - GLOBALS.Bqe_Anim[idx].data = PTRNUL; + _vm->_globals.Bqe_Anim[idx].field4 = 0; + _vm->_globals.Bqe_Anim[idx].data = PTRNUL; } ++v6; @@ -942,11 +942,11 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { ++v5; } while (!breakFlag); - GLOBALS.Bqe_Anim[idx].data = GLOBALS.dos_malloc2(v7 + 50); - GLOBALS.Bqe_Anim[idx].field4 = 1; - memcpy(GLOBALS.Bqe_Anim[idx].data, v21 + data + 5, 20); + _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_malloc2(v7 + 50); + _vm->_globals.Bqe_Anim[idx].field4 = 1; + memcpy(_vm->_globals.Bqe_Anim[idx].data, v21 + data + 5, 20); - byte *dataP = GLOBALS.Bqe_Anim[idx].data; + byte *dataP = _vm->_globals.Bqe_Anim[idx].data; v9 = dataP + 20; v23 = v21 + data + 25; @@ -1019,17 +1019,17 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin _vm->_eventsManager.souris_flag = 0; if (!NO_COUL) { _vm->_eventsManager.VBL(); - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager.VESA_SCREEN; v10 = _vm->_globals.dos_malloc2(0x16u); - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a2); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a2); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER); @@ -1149,8 +1149,8 @@ LABEL_59: f.close(); if (!NO_COUL) { - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); _vm->_eventsManager.souris_flag = 1; } if (v7 == 1) @@ -1187,7 +1187,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, _vm->_eventsManager.souris_flag = 0; v10 = _vm->_graphicsManager.VESA_SCREEN; v11 = _vm->_globals.dos_malloc2(0x16u); - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a1); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a1); if (!f.open(_vm->_globals.NFICHIER)) error("File not found ", _vm->_globals.NFICHIER.c_str()); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0cf1af84b5..4ed86cf7a6 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -40,13 +40,13 @@ void OptionsDialog::show(HopkinsEngine *vm) { vm->_eventsManager.CHANGE_MOUSE(0); vm->_eventsManager.VBL(); if (vm->_globals.FR == 1) - FileManager::CONSTRUIT_SYSTEM("OPTIFR.SPR"); + vm->_fileManager.CONSTRUIT_SYSTEM("OPTIFR.SPR"); if (!vm->_globals.FR) - FileManager::CONSTRUIT_SYSTEM("OPTIAN.SPR"); + vm->_fileManager.CONSTRUIT_SYSTEM("OPTIAN.SPR"); if (vm->_globals.FR == 2) - FileManager::CONSTRUIT_SYSTEM("OPTIES.SPR"); + vm->_fileManager.CONSTRUIT_SYSTEM("OPTIES.SPR"); - vm->_globals.OPTION_SPR = FileManager::CHARGE_FICHIER(vm->_globals.NFICHIER); + vm->_globals.OPTION_SPR = vm->_fileManager.CHARGE_FICHIER(vm->_globals.NFICHIER); vm->_globals.OPTION_FLAG = true; do { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index b60562c92d..aaac4574b6 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -264,7 +264,7 @@ void EventsManager::VBL() { m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); else m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); - FileManager::DMESS(); + _vm->_fileManager.DMESS(); --REDRAW; } DD_Unlock(); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 0708c1d178..a6a0d28cf3 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -31,6 +31,13 @@ namespace Hopkins { +FileManager::FileManager() { +} + +void FileManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + void FileManager::initSaves() { Common::String dataFilename = "HISCORE.DAT"; byte data[100]; @@ -107,7 +114,7 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { // Allocate space for the file contents size_t filesize = f.size(); - byte *data = GLOBALS.dos_malloc2(filesize); + byte *data = _vm->_globals.dos_malloc2(filesize); if (!data) error("Error allocating space for file being loaded - %s", file.c_str()); @@ -126,7 +133,7 @@ void FileManager::CHARGE_FICHIER2(const Common::String &file, byte *buf) { error("Error opening file - %s", file.c_str()); filesize = f.size(); - FileManager::bload_it(f, buf, filesize); + _vm->_fileManager.bload_it(f, buf, filesize); f.close(); } @@ -143,7 +150,7 @@ void FileManager::bload(const Common::String &file, byte *buf) { if (!f.open(file)) error("Error openinig file - %s", file.c_str()); int32 filesize = f.size(); - FileManager::bload_it(f, buf, filesize); + _vm->_fileManager.bload_it(f, buf, filesize); f.close(); } @@ -152,26 +159,26 @@ int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) } void FileManager::F_Censure() { - GLOBALS.CENSURE = false; + _vm->_globals.CENSURE = false; CONSTRUIT_SYSTEM("BLOOD.DAT"); - char *data = (char *)CHARGE_FICHIER(GLOBALS.NFICHIER); + char *data = (char *)CHARGE_FICHIER(_vm->_globals.NFICHIER); if (*(data + 6) == 'f' && *(data + 7) == 'r') - GLOBALS.CENSURE = false; + _vm->_globals.CENSURE = false; if (*(data + 6) == 'F' && *(data + 7) == 'R') - GLOBALS.CENSURE = false; + _vm->_globals.CENSURE = false; if (*(data + 6) == 'u' && *(data + 7) == 'k') - GLOBALS.CENSURE = true; + _vm->_globals.CENSURE = true; if (*(data + 6) == 'U' && *(data + 7) == 'K') - GLOBALS.CENSURE = true; + _vm->_globals.CENSURE = true; free(data); } int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) { - GLOBALS.NFICHIER = Common::String::format("system/%s", file.c_str()); - return GLOBALS.NFICHIER.size(); + _vm->_globals.NFICHIER = Common::String::format("system/%s", file.c_str()); + return _vm->_globals.NFICHIER.size(); } void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file) { @@ -182,7 +189,7 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::Str error("TODO: CONSTRUIT_FICHIER"); } - GLOBALS.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); + _vm->_globals.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); } byte *FileManager::LIBERE_FICHIER(byte *ptr) { @@ -196,91 +203,91 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { switch (a2) { case 1: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_INI.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_INI.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_INI.RES"); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_INI.RES"); break; case 2: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_REP.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_REP.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_REP.RES"); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_REP.RES"); break; case 3: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_LIN.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_LIN.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_LIN.RES"); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_LIN.RES"); break; case 4: - CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_ANI.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_ANI.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); - CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_ANI.RES"); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_ANI.RES"); break; case 5: - CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_PER.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_PER.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); - CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_PER.RES"); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_PER.RES"); break; case 6: - CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, "PIC.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, "PIC.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; case 7: - CONSTRUIT_FICHIER(GLOBALS.HOPANIM, "RES_SAN.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; case 8: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_SLI.CAT"); - if (!f.exists(GLOBALS.NFICHIER)) + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.CAT"); + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; case 9: - switch (GLOBALS.FR) { + switch (_vm->_globals.FR) { case 0: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_VAN.CAT"); + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_VAN.CAT"); break; case 1: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_VFR.CAT"); + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_VFR.CAT"); break; case 2: - CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "RES_VES.CAT"); + CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_VES.CAT"); break; } - if (!f.exists(GLOBALS.NFICHIER)) + if (!f.exists(_vm->_globals.NFICHIER)) return PTRNUL; - ptr = CHARGE_FICHIER(GLOBALS.NFICHIER); + ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; // Deliberate fall-through to default: @@ -298,33 +305,33 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { if (name == file) { // Found entry for file, so get it's details from the catalogue entry const byte *pData = ptr + offsetVal; - GLOBALS.CAT_POSI = READ_LE_UINT32(pData + 15); - GLOBALS.CAT_TAILLE = READ_LE_UINT32(pData + 19); + _vm->_globals.CAT_POSI = READ_LE_UINT32(pData + 15); + _vm->_globals.CAT_TAILLE = READ_LE_UINT32(pData + 19); matchFlag = true; } if (name == "FINIS") { - GLOBALS.dos_free2(ptr); + _vm->_globals.dos_free2(ptr); return false; } offsetVal += 23; } while (!matchFlag); - GLOBALS.dos_free2(ptr); + _vm->_globals.dos_free2(ptr); // TODO: Double check whether this really should be an unsigned int comparison if ((uint16)(a2 - 6) > 1 && (uint16)(a2 - 8) > 1) { - if (!f.open(GLOBALS.NFICHIER)) + if (!f.open(_vm->_globals.NFICHIER)) error("CHARGE_FICHIER"); - f.seek(GLOBALS.CAT_POSI); + f.seek(_vm->_globals.CAT_POSI); - byte *catData = GLOBALS.dos_malloc2(GLOBALS.CAT_TAILLE); + byte *catData = _vm->_globals.dos_malloc2(_vm->_globals.CAT_TAILLE); if (catData == PTRNUL) error("CHARGE_FICHIER"); - bload_it(f, catData, GLOBALS.CAT_TAILLE); + bload_it(f, catData, _vm->_globals.CAT_TAILLE); f.close(); result = catData; } else { diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 77361b2920..9aece5fba3 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -30,29 +30,36 @@ namespace Hopkins { +class HopkinsEngine; + class FileManager { public: - static void initSaves(); - static bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); - static bool bsave(const Common::String &file, const void *buf, size_t n); - static void Chage_Inifile(Common::StringMap &iniParams); - static byte *CHARGE_FICHIER(const Common::String &file); - static void CHARGE_FICHIER2(const Common::String &file, byte *a2); - static void DMESS(); - static void DMESS1(); - static void bload(const Common::String &file, byte *buf); - static int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); - static void F_Censure(); - 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 byte *RECHERCHE_CAT(const Common::String &file, int a2); - static Common::String CONSTRUIT_LINUX(const Common::String &file); + HopkinsEngine *_vm; +public: + FileManager(); + void setParent(HopkinsEngine *vm); + + void initSaves(); + bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); + bool bsave(const Common::String &file, const void *buf, size_t n); + void Chage_Inifile(Common::StringMap &iniParams); + byte *CHARGE_FICHIER(const Common::String &file); + void CHARGE_FICHIER2(const Common::String &file, byte *a2); + void DMESS(); + void DMESS1(); + void bload(const Common::String &file, byte *buf); + int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); + void F_Censure(); + int CONSTRUIT_SYSTEM(const Common::String &file); + void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file); + byte *LIBERE_FICHIER(byte *ptr); + byte *RECHERCHE_CAT(const Common::String &file, int a2); + Common::String CONSTRUIT_LINUX(const Common::String &file); /** * Returns the size of a file. Throws an error if the file can't be found */ - static uint32 FLONG(const Common::String &filename); + uint32 FLONG(const Common::String &filename); }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index fb938bfbf6..919d55a3d5 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -224,7 +224,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, while (v62 <= 19); &Txt[idx].field408 = 1; - FileManager::CONSTRUIT_FICHIER(HOPLINK, filename); + _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, filename); fname = _vm->_globals.NFICHIER; if (strncmp(fname.c_str(), oldname.c_str(), fname.size())) { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index b7f5b51b5d..899cc842f1 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -697,8 +697,8 @@ void Globals::CLEAR_VBOB() { } void Globals::CHARGE_OBJET() { - FileManager::CONSTRUIT_SYSTEM("OBJET.DAT"); - byte *data = FileManager::CHARGE_FICHIER(NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("OBJET.DAT"); + byte *data = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); byte *srcP = data; for (int idx = 0; idx < 300; ++idx) { @@ -790,14 +790,14 @@ void Globals::CHARGE_CACHE(const Common::String &file) { Common::File f; RESET_CACHE(); - FileManager::CONSTRUIT_FICHIER(HOPLINK, file); - ptr = FileManager::CHARGE_FICHIER(NFICHIER); + _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, file); + ptr = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); v16 = Common::String((const char *)ptr); - FileManager::CONSTRUIT_FICHIER(HOPLINK, v16); + _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, v16); if (!f.exists(NFICHIER)) { - spriteData = FileManager::CHARGE_FICHIER(NFICHIER); + spriteData = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); CACHE_BANQUE[1] = spriteData; v15 = 60; v14 = 0; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 64013cd215..851768a6b9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -79,8 +79,8 @@ GraphicsManager::GraphicsManager() { } GraphicsManager::~GraphicsManager() { - GLOBALS.dos_free2(VESA_SCREEN); - GLOBALS.dos_free2(VESA_BUFFER); + _vm->_globals.dos_free2(VESA_SCREEN); + _vm->_globals.dos_free2(VESA_BUFFER); } void GraphicsManager::setParent(HopkinsEngine *vm) { @@ -91,21 +91,21 @@ void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { SDL_ECHELLE = 0; - if (GLOBALS.XSETMODE == 1) + if (_vm->_globals.XSETMODE == 1) SDL_ECHELLE = 0; - if (GLOBALS.XSETMODE == 2) + if (_vm->_globals.XSETMODE == 2) SDL_ECHELLE = 25; - if (GLOBALS.XSETMODE == 3) + if (_vm->_globals.XSETMODE == 3) SDL_ECHELLE = 50; - if (GLOBALS.XSETMODE == 4) + if (_vm->_globals.XSETMODE == 4) SDL_ECHELLE = 75; - if (GLOBALS.XSETMODE == 5) - SDL_ECHELLE = GLOBALS.XZOOM; + if (_vm->_globals.XSETMODE == 5) + SDL_ECHELLE = _vm->_globals.XZOOM; int bpp = 8; - if (GLOBALS.XFORCE8 == 1) + if (_vm->_globals.XFORCE8 == 1) bpp = 8; - if (GLOBALS.XFORCE16 == 1) + if (_vm->_globals.XFORCE16 == 1) bpp = 16; if (SDL_ECHELLE) { @@ -122,8 +122,8 @@ void GraphicsManager::SET_MODE(int width, int height) { } // Init surfaces - VESA_SCREEN = GLOBALS.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); - VESA_BUFFER = GLOBALS.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + VESA_SCREEN = _vm->_globals.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + VESA_BUFFER = _vm->_globals.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); VideoPtr = NULL; XSCREEN = width; @@ -174,12 +174,12 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { bool flag; Common::File f; - FileManager::DMESS1(); + _vm->_fileManager.DMESS1(); flag = true; - if (FileManager::RECHERCHE_CAT(file, 6)) { - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, file); - if (!f.open(GLOBALS.NFICHIER)) + if (_vm->_fileManager.RECHERCHE_CAT(file, 6)) { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + if (!f.open(_vm->_globals.NFICHIER)) error("CHARGE_ECRAN - %s", file.c_str()); f.seek(0, SEEK_END); @@ -364,12 +364,12 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); if (typeFlag) { - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, "PIC.RES"); - if (!f.open(GLOBALS.NFICHIER)) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, "PIC.RES"); + if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); - f.seek(GLOBALS.CAT_POSI); + f.seek(_vm->_globals.CAT_POSI); - v7 = GLOBALS.CAT_TAILLE - 896; + v7 = _vm->_globals.CAT_TAILLE - 896; v8 = f.read(HEADER_PCX, 128); v6 = READ_LE_UINT16(&HEADER_PCX[8]) + 1; @@ -387,8 +387,8 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by if (v8 == -1) error("Erreur en cours de lecture."); } else { - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPIMAGE, file); - if (!f.open(GLOBALS.NFICHIER)) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); filesize = f.size(); @@ -411,7 +411,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by v7 = filesize - 896; } - ptr = GLOBALS.dos_malloc2(0xEE60u); + ptr = _vm->_globals.dos_malloc2(0xEE60u); if (v7 >= 60000) { v21 = v7 / 60000 + 1; v23 = 60000 * (v7 / 60000) - v7; @@ -470,7 +470,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by } while (v18 < v19 * v20); if (typeFlag) { - f.seek(GLOBALS.CAT_TAILLE + GLOBALS.CAT_POSI - 768); + f.seek(_vm->_globals.CAT_TAILLE + _vm->_globals.CAT_POSI - 768); } else { filesize = f.size(); f.seek(filesize - 768); @@ -480,7 +480,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by error("A_PCX640_480"); f.close(); - GLOBALS.dos_free2(ptr); + _vm->_globals.dos_free2(ptr); } void GraphicsManager::Cls_Pal() { @@ -2342,25 +2342,25 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { v9 = 0; v13 = file + ".ini"; - ptr = FileManager::RECHERCHE_CAT(v13, 1); + ptr = _vm->_fileManager.RECHERCHE_CAT(v13, 1); if (PTRNUL == ptr) { - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); - ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (!a2) { v13 = file + ".spr"; if (PTRNUL != _vm->_globals.SPRITE_ECRAN) - _vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); if (!_vm->_globals.NOSPRECRAN) { - _vm->_globals.SPRITE_ECRAN = FileManager::RECHERCHE_CAT(v13, 8); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.RECHERCHE_CAT(v13, 8); if (_vm->_globals.SPRITE_ECRAN) { _vm->_globals.CAT_FLAG = 0; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); } else { _vm->_globals.CAT_FLAG = 1; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); } - _vm->_globals.SPRITE_ECRAN = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; } } @@ -2388,11 +2388,11 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); v13 = file + ".rep"; - byte *dataP = FileManager::RECHERCHE_CAT(v13, 2); + byte *dataP = _vm->_fileManager.RECHERCHE_CAT(v13, 2); _vm->_globals.COUCOU = dataP; if (PTRNUL == dataP) { - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); - dataP = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + dataP = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_globals.COUCOU = dataP; } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a29253571f..0afc35c0b0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -40,6 +40,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe g_vm = this; _animationManager.setParent(this); _eventsManager.setParent(this); + _fileManager.setParent(this); _fontManager.setParent(this); _globals.setParent(this); _graphicsManager.setParent(this); @@ -52,23 +53,23 @@ HopkinsEngine::~HopkinsEngine() { } Common::Error HopkinsEngine::run() { - FileManager::initSaves(); + _fileManager.initSaves(); Common::StringMap iniParams; - FileManager::Chage_Inifile(iniParams); + _fileManager.Chage_Inifile(iniParams); processIniParams(iniParams); - GLOBALS.setConfig(); - FileManager::F_Censure(); + _globals.setConfig(); + _fileManager.F_Censure(); INIT_SYSTEM(); _soundManager.WSOUND_INIT(); - GLOBALS.CHARGE_OBJET(); + _globals.CHARGE_OBJET(); _objectsManager.CHANGE_OBJET(14); _objectsManager.AJOUTE_OBJET(14); - GLOBALS.HELICO = 0; + _globals.HELICO = 0; _eventsManager.MOUSE_OFF(); _graphicsManager.DD_Lock(); @@ -81,7 +82,7 @@ Common::Error HopkinsEngine::run() { _eventsManager.delay(1500); _graphicsManager.FADE_OUTW(); - if (!GLOBALS.internet) { + if (!_globals.internet) { _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); } @@ -95,22 +96,22 @@ Common::Error HopkinsEngine::run() { INTRORUN(); _globals.iRegul = 0; - FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); - GLOBALS.PERSO = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); - GLOBALS.PERSO_TYPE = 0; - GLOBALS.PLANX = GLOBALS.PLANY = 0; - memset(GLOBALS.SAUVEGARDE, 0, 2000); - GLOBALS.SORTIE = 0; - GLOBALS.PASSWORD = 1; + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.PLANX = _globals.PLANY = 0; + memset(_globals.SAUVEGARDE, 0, 2000); + _globals.SORTIE = 0; + _globals.PASSWORD = 1; LABEL_12: - if (GLOBALS.SORTIE == 300) + if (_globals.SORTIE == 300) LABEL_13: - GLOBALS.SORTIE = 0; + _globals.SORTIE = 0; - if (!GLOBALS.SORTIE) { - GLOBALS.SORTIE = _menuManager.MENU(); - if (GLOBALS.SORTIE == -1) { + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { if (!g_system->getEventManager()->shouldQuit()) PUBQUIT(); _globals.PERSO = _globals.dos_free2(_globals.PERSO); @@ -129,19 +130,19 @@ LABEL_13: if (g_system->getEventManager()->shouldQuit()) return Common::kNoError; - if (GLOBALS.SORTIE == 300) + if (_globals.SORTIE == 300) goto LABEL_13; - if (GLOBALS.SORTIE == 18) + if (_globals.SORTIE == 18) PASS(); - if (GLOBALS.SORTIE == 23) + if (_globals.SORTIE == 23) PASS(); - if (GLOBALS.SORTIE == 22) + if (_globals.SORTIE == 22) PASS(); - if (GLOBALS.SORTIE == 19) + if (_globals.SORTIE == 19) PASS(); - if (GLOBALS.SORTIE == 20) + if (_globals.SORTIE == 20) PASS(); - if (GLOBALS.SORTIE != 1) + if (_globals.SORTIE != 1) break; _globals.Max_Propre = 50; @@ -151,10 +152,10 @@ LABEL_13: _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); } - if (GLOBALS.SORTIE != 3) + if (_globals.SORTIE != 3) break; - if (!*((byte *)GLOBALS.SAUVEGARDE + 170)) { + if (!*((byte *)_globals.SAUVEGARDE + 170)) { _soundManager.WSOUND(3); if (_globals.FR == 1) _graphicsManager.LOAD_IMAGE("fond_globals.FR"); @@ -174,41 +175,41 @@ LABEL_13: _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - if (!GLOBALS.CENSURE) + if (!_globals.CENSURE) _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - if (GLOBALS.CENSURE == 1) + if (_globals.CENSURE == 1) _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - *((byte *)GLOBALS.SAUVEGARDE + 170) = 1; + *((byte *)_globals.SAUVEGARDE + 170) = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - GLOBALS.NOSPRECRAN = 1; + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); } - if (GLOBALS.SORTIE != 4) + if (_globals.SORTIE != 4) break; _globals.DESACTIVE_INVENT = true; _objectsManager.PLAN_BETA(); _globals.DESACTIVE_INVENT = false; } - if (GLOBALS.SORTIE != 5) + if (_globals.SORTIE != 5) break; _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; - GLOBALS.NOSPRECRAN = 1; - byte v1 = *((byte *)GLOBALS.SAUVEGARDE + 80); + _globals.NOSPRECRAN = 1; + byte v1 = *((byte *)_globals.SAUVEGARDE + 80); if (v1) { if (v1 == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); @@ -216,10 +217,10 @@ LABEL_13: _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } - GLOBALS.NOSPRECRAN = 0; + _globals.NOSPRECRAN = 0; } - if (GLOBALS.SORTIE != 8) + if (_globals.SORTIE != 8) break; _globals.Max_Propre = 15; @@ -229,7 +230,7 @@ LABEL_13: _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); } - if (GLOBALS.SORTIE != 6) + if (_globals.SORTIE != 6) break; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; @@ -238,32 +239,32 @@ LABEL_13: _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); } - if (GLOBALS.SORTIE != 7) + if (_globals.SORTIE != 7) break; - if (*((byte *)GLOBALS.SAUVEGARDE + 220)) + if (*((byte *)_globals.SAUVEGARDE + 220)) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); } - if (GLOBALS.SORTIE == 9) { + if (_globals.SORTIE == 9) { _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!*((byte *)GLOBALS.SAUVEGARDE + 225)) + if (!*((byte *)_globals.SAUVEGARDE + 225)) goto LABEL_109; _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { - if (GLOBALS.SORTIE == 10) { - GLOBALS.NOSPRECRAN = 1; + if (_globals.SORTIE == 10) { + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); goto LABEL_124; } - if (GLOBALS.SORTIE == 11) { - GLOBALS.NOSPRECRAN = 1; + if (_globals.SORTIE == 11) { + _globals.NOSPRECRAN = 1; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; @@ -272,14 +273,14 @@ LABEL_13: goto LABEL_124; } - switch (GLOBALS.SORTIE) { + switch (_globals.SORTIE) { case 12: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (*((byte *)GLOBALS.SAUVEGARDE + 225)) { - GLOBALS.NOSPRECRAN = 1; + if (*((byte *)_globals.SAUVEGARDE + 225)) { + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { LABEL_109: @@ -301,84 +302,84 @@ LABEL_109: _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; default: - if (GLOBALS.SORTIE == 15) { - GLOBALS.NOSPRECRAN = 1; + if (_globals.SORTIE == 15) { + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); goto LABEL_124; } - if (GLOBALS.SORTIE == 16) { + if (_globals.SORTIE == 16) { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - byte v2 = *((byte *)GLOBALS.SAUVEGARDE + 113); + byte v2 = *((byte *)_globals.SAUVEGARDE + 113); if (v2 == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!v2) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } } else { - if (GLOBALS.SORTIE == 17) + if (_globals.SORTIE == 17) PASS(); - if (GLOBALS.SORTIE == 24) + if (_globals.SORTIE == 24) PASS(); - if (GLOBALS.SORTIE == 25) { + if (_globals.SORTIE == 25) { _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); } else { - if (GLOBALS.SORTIE == 33) { - GLOBALS.NOSPRECRAN = 1; + if (_globals.SORTIE == 33) { + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); goto LABEL_124; } - if (GLOBALS.SORTIE == 26) { + if (_globals.SORTIE == 26) { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); } else { - if (GLOBALS.SORTIE == 27) + if (_globals.SORTIE == 27) PASS(); - if (GLOBALS.SORTIE == 28) + if (_globals.SORTIE == 28) PASS(); - if (GLOBALS.SORTIE == 29) + if (_globals.SORTIE == 29) PASS(); - if (GLOBALS.SORTIE == 30) + if (_globals.SORTIE == 30) PASS(); - if (GLOBALS.SORTIE == 31) + if (_globals.SORTIE == 31) PASS(); - if (GLOBALS.SORTIE == 35) + if (_globals.SORTIE == 35) ENDEMO(); - if (GLOBALS.SORTIE == 32) + if (_globals.SORTIE == 32) PASS(); - if (GLOBALS.SORTIE == 34) + if (_globals.SORTIE == 34) PASS(); - if ((uint16)(GLOBALS.SORTIE - 51) <= 38) + if ((uint16)(_globals.SORTIE - 51) <= 38) PASS(); - if (GLOBALS.SORTIE == 111) { - GLOBALS.NOSPRECRAN = 1; + if (_globals.SORTIE == 111) { + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); goto LABEL_124; } - if (GLOBALS.SORTIE == 112) { - GLOBALS.NOSPRECRAN = 1; + if (_globals.SORTIE == 112) { + _globals.NOSPRECRAN = 1; _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); LABEL_124: - GLOBALS.NOSPRECRAN = 0; - } else if (GLOBALS.SORTIE == 113) { - GLOBALS.SORTIE = 0; + _globals.NOSPRECRAN = 0; + } else if (_globals.SORTIE == 113) { + _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; - *((byte *)GLOBALS.SAUVEGARDE + 5) = 113; + *((byte *)_globals.SAUVEGARDE + 5) = 113; _menuManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); @@ -390,29 +391,29 @@ LABEL_124: _graphicsManager.Cls_Pal(); _graphicsManager.RESET_SEGMENT_VESA(); } else { - if (GLOBALS.SORTIE == 114) { - GLOBALS.SORTIE = 0; + if (_globals.SORTIE == 114) { + _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; - *((byte *)GLOBALS.SAUVEGARDE + 5) = 114; + *((byte *)_globals.SAUVEGARDE + 5) = 114; _menuManager.COMPUT_HOPKINS(2); goto LABEL_128; } - if (GLOBALS.SORTIE == 115) { - GLOBALS.SORTIE = 0; + if (_globals.SORTIE == 115) { + _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)GLOBALS.SAUVEGARDE + 6) = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; - *((byte *)GLOBALS.SAUVEGARDE + 5) = 115; + *((byte *)_globals.SAUVEGARDE + 5) = 115; _menuManager.COMPUT_HOPKINS(3); LABEL_128: _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); - } else if ((uint16)(GLOBALS.SORTIE - 194) > 5) { - if (GLOBALS.SORTIE == 151) { + } else if ((uint16)(_globals.SORTIE - 194) > 5) { + if (_globals.SORTIE == 151) { _soundManager.WSOUND(16); _globals.iRegul = 1; @@ -423,10 +424,10 @@ LABEL_128: _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; - GLOBALS.SORTIE = 300; + _globals.SORTIE = 300; } - if (GLOBALS.SORTIE == 150) { + if (_globals.SORTIE == 150) { _soundManager.WSOUND(16); _globals.iRegul = 1; @@ -437,10 +438,10 @@ LABEL_128: _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; - GLOBALS.SORTIE = 300; + _globals.SORTIE = 300; } - if (GLOBALS.SORTIE == 152) { + if (_globals.SORTIE == 152) { _soundManager.WSOUND(16); _globals.iRegul = 1; @@ -451,7 +452,7 @@ LABEL_128: _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; - GLOBALS.SORTIE = 300; + _globals.SORTIE = 300; } goto LABEL_12; } @@ -483,23 +484,23 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { } void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { - GLOBALS.XFULLSCREEN = iniParams["FULLSCREEN"] == "YES"; + _globals.XFULLSCREEN = iniParams["FULLSCREEN"] == "YES"; - GLOBALS.XSETMODE = 1; + _globals.XSETMODE = 1; if (iniParams.contains("SETMODE")) { int setMode = atoi(iniParams["SETMODE"].c_str()); - GLOBALS.XSETMODE = CLIP(setMode, 1, 5); + _globals.XSETMODE = CLIP(setMode, 1, 5); } - GLOBALS.XZOOM = 0; - if (GLOBALS.XSETMODE == 5 && iniParams.contains("ZOOM")) { + _globals.XZOOM = 0; + if (_globals.XSETMODE == 5 && iniParams.contains("ZOOM")) { int zoom = atoi(iniParams["ZOOM"].c_str()); - GLOBALS.XZOOM = CLIP(zoom, 25, 100); + _globals.XZOOM = CLIP(zoom, 25, 100); } - GLOBALS.XFORCE16 = iniParams["FORCE16BITS"] == "YES"; - GLOBALS.XFORCE8 = iniParams["FORCE8BITS"] == "YES"; - GLOBALS.CARD_SB = iniParams["SOUND"] == "YES"; + _globals.XFORCE16 = iniParams["FORCE16BITS"] == "YES"; + _globals.XFORCE8 = iniParams["FORCE8BITS"] == "YES"; + _globals.CARD_SB = iniParams["SOUND"] == "YES"; } void HopkinsEngine::INIT_SYSTEM() { @@ -511,15 +512,15 @@ void HopkinsEngine::INIT_SYSTEM() { switch (_globals.FR) { case 0: if (!_eventsManager.mouse_linux) - FileManager::CONSTRUIT_SYSTEM("SOUAN.SPR"); + _fileManager.CONSTRUIT_SYSTEM("SOUAN.SPR"); if (!_globals.FR && _eventsManager.mouse_linux) - FileManager::CONSTRUIT_SYSTEM("LSOUAN.SPR"); + _fileManager.CONSTRUIT_SYSTEM("LSOUAN.SPR"); break; case 1: - FileManager::CONSTRUIT_SYSTEM("LSOU_globals.FR.SPR"); + _fileManager.CONSTRUIT_SYSTEM("LSOU_globals.FR.SPR"); break; case 2: - FileManager::CONSTRUIT_SYSTEM("SOUES.SPR"); + _fileManager.CONSTRUIT_SYSTEM("SOUES.SPR"); break; } @@ -530,31 +531,31 @@ void HopkinsEngine::INIT_SYSTEM() { _eventsManager.souris_sizex = 34; _eventsManager.souris_sizey = 20; } - _eventsManager.pointeur_souris = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); - - GLOBALS.clearAll(); - - FileManager::CONSTRUIT_SYSTEM("FONTE3.SPR"); - GLOBALS.police = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); - GLOBALS.police_l = 12; - GLOBALS.police_h = 21; - FileManager::CONSTRUIT_SYSTEM("ICONE.SPR"); - GLOBALS.ICONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); - FileManager::CONSTRUIT_SYSTEM("TETE.SPR"); - GLOBALS.TETE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + _eventsManager.pointeur_souris = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + + _globals.clearAll(); + + _fileManager.CONSTRUIT_SYSTEM("FONTE3.SPR"); + _globals.police = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.police_l = 12; + _globals.police_h = 21; + _fileManager.CONSTRUIT_SYSTEM("ICONE.SPR"); + _globals.ICONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.CONSTRUIT_SYSTEM("TETE.SPR"); + _globals.TETE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); switch (_globals.FR) { case 0: - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEAN.TXT"); - GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "ZONEAN.TXT"); + _globals.BUF_ZONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); break; case 1: - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONE01.TXT"); - GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "ZONE01.TXT"); + _globals.BUF_ZONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); break; case 2: - FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPLINK, "ZONEES.TXT"); - GLOBALS.BUF_ZONE = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER); + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "ZONEES.TXT"); + _globals.BUF_ZONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); break; } @@ -563,12 +564,12 @@ void HopkinsEngine::INIT_SYSTEM() { _eventsManager.souris_flag = false; _eventsManager.souris_max(); - GLOBALS.HOPKINS_DATA(); + _globals.HOPKINS_DATA(); _eventsManager.ofset_souris_x = 0; _eventsManager.ofset_souris_y = 0; - GLOBALS.lItCounter = 0; - GLOBALS.lOldItCounter = 0; + _globals.lItCounter = 0; + _globals.lOldItCounter = 0; } void HopkinsEngine::INTRORUN() { diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 0b1f97fb9c..f58dfd7f14 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "hopkins/anim.h" #include "hopkins/events.h" +#include "hopkins/files.h" #include "hopkins/font.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" @@ -96,6 +97,7 @@ public: EventsManager _eventsManager; FontManager _fontManager; Globals _globals; + FileManager _fileManager; GraphicsManager _graphicsManager; LinesManager _linesManager; MenuManager _menuManager; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 66436a830f..23baec188e 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -81,11 +81,11 @@ int MenuManager::MENU() { _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.FR == 0) - FileManager::CONSTRUIT_SYSTEM("MENUAN.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("MENUAN.SPR"); if (_vm->_globals.FR == 1) - FileManager::CONSTRUIT_SYSTEM("MENUFR.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("MENUFR.SPR"); if (_vm->_globals.FR == 2) - FileManager::CONSTRUIT_SYSTEM("MENUES.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("MENUES.SPR"); spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.MOUSE_ON(); @@ -279,13 +279,13 @@ void MenuManager::CHARGE_PARTIE() { v15 = 65; v16 = 84; v17 = 0; - FileManager::CONSTRUIT_LINUX(v8); + _vm->_fileManager.CONSTRUIT_LINUX(v8); if (f.open(_vm->_globals.NFICHIER)) { f.close(); v3 = _vm->_globals.SAUVEGARDE->data[svField10]; - FileManager::CONSTRUIT_LINUX(v8); - FileManager::bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); + _vm->_fileManager.CONSTRUIT_LINUX(v8); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; v5 = 0; @@ -349,15 +349,15 @@ void MenuManager::SAUVE_PARTIE() { ++v4; } while (v4 <= 34); - FileManager::CONSTRUIT_LINUX(v7); - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); + _vm->_fileManager.CONSTRUIT_LINUX(v7); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); v12 = 46; v13 = 69; v14 = 67; v15 = 82; v16 = 0; - FileManager::CONSTRUIT_LINUX(v7); - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); + _vm->_fileManager.CONSTRUIT_LINUX(v7); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); } _vm->_globals.dos_free2(v1); } @@ -577,13 +577,13 @@ void MenuManager::LOAD_SAUVE(int a1) { Common::File f; if (_vm->_globals.FR == 1) - FileManager::CONSTRUIT_SYSTEM("SAVEFR.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEFR.SPR"); if (!_vm->_globals.FR) - FileManager::CONSTRUIT_SYSTEM("SAVEAN.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEAN.SPR"); if (_vm->_globals.FR == 2) - FileManager::CONSTRUIT_SYSTEM("SAVEES.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEES.SPR"); _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - FileManager::CONSTRUIT_SYSTEM("SAVE2.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVE2.SPR"); _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); if (_vm->_globals.FR) { @@ -611,9 +611,9 @@ void MenuManager::LOAD_SAUVE(int a1) { v11 = 67; v12 = 82; v13 = 0; - FileManager::CONSTRUIT_LINUX(s); + _vm->_fileManager.CONSTRUIT_LINUX(s); if (f.exists(_vm->_globals.NFICHIER)) { - v2 = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + v2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v3 = v2; if (v1 == 1) _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v2, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 40689b11ee..3d2f625679 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -78,7 +78,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { if (_vm->_globals.ADR_FICHIER_OBJ != PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { - FileManager::CONSTRUIT_SYSTEM("OBJET1.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("OBJET1.SPR"); _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::CHARGE_SPRITE(_vm->_globals.NFICHIER); } _vm->_globals.NUM_FICHIER_OBJ = val1; @@ -218,7 +218,7 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn byte *ObjectsManager::DEL_FICHIER_OBJ() { _vm->_globals.NUM_FICHIER_OBJ = 0; if (_vm->_globals.ADR_FICHIER_OBJ != PTRNUL) - _vm->_globals.ADR_FICHIER_OBJ = FileManager::LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); + _vm->_globals.ADR_FICHIER_OBJ = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); byte *result = PTRNUL; _vm->_globals.ADR_FICHIER_OBJ = PTRNUL; @@ -226,8 +226,8 @@ byte *ObjectsManager::DEL_FICHIER_OBJ() { } byte *ObjectsManager::CHARGE_SPRITE(const Common::String &file) { - FileManager::DMESS1(); - return FileManager::CHARGE_FICHIER(file); + _vm->_fileManager.DMESS1(); + return _vm->_fileManager.CHARGE_FICHIER(file); } int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { @@ -1939,8 +1939,8 @@ void ObjectsManager::PLAN_BETA() { CHARGE_OBSTACLE("PLAN.OB2"); CHARGE_CACHE("PLAN.CA2"); CHARGE_ZONE("PLAN.ZO2"); - FileManager::CONSTRUIT_SYSTEM("VOITURE.SPR"); - sprite_ptr = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("VOITURE.SPR"); + sprite_ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_animationManager.CHARGE_ANIM("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN"); @@ -2369,9 +2369,9 @@ void ObjectsManager::CLEAR_ECRAN() { DERLIGNE = 0; _vm->_globals.chemin = PTRNUL; if (_vm->_globals.COUCOU != PTRNUL) - _vm->_globals.COUCOU = FileManager::LIBERE_FICHIER(_vm->_globals.COUCOU); + _vm->_globals.COUCOU = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.COUCOU); if (PTRNUL != _vm->_globals.SPRITE_ECRAN) - _vm->_globals.SPRITE_ECRAN = FileManager::LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager.start_x = 0; _vm->_eventsManager.souris_n = 0; Vold_taille = 200; @@ -2449,22 +2449,22 @@ LABEL_7: _vm->_globals.DESACTIVE_INVENT = 1; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); if (_vm->_globals.FR == 1) - FileManager::CONSTRUIT_SYSTEM("INVENTFR.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); if (!_vm->_globals.FR) - FileManager::CONSTRUIT_SYSTEM("INVENTAN.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); if (_vm->_globals.FR == 2) - FileManager::CONSTRUIT_SYSTEM("INVENTES.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); filesize = f.size(); _vm->_globals.Winventaire = _vm->_globals.dos_malloc2(filesize); - FileManager::bload_it(f, _vm->_globals.Winventaire, filesize); + _vm->_fileManager.bload_it(f, _vm->_globals.Winventaire, filesize); f.close(); - FileManager::CONSTRUIT_SYSTEM("INVENT2.SPR"); - inventaire2 = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); + inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v19 = _vm->_graphicsManager.ofscroll + 152; v18 = Get_Largeur(_vm->_globals.Winventaire, 0); v17 = Get_Hauteur(_vm->_globals.Winventaire, 0); @@ -2622,8 +2622,8 @@ void ObjectsManager::CHANGE_TETE(int a1, int a2) { _vm->_globals.SAUVEGARDE->data[svField357] = 1; T_RECTIF = 0; v4 = &_vm->_globals.SAUVEGARDE->field370; - FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, v4->field0, v4->field1, 0, 64, v4->field4, 0, 34, 190); LABEL_9: @@ -2649,8 +2649,8 @@ LABEL_9: _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; v6 = &_vm->_globals.SAUVEGARDE->field380; - FileManager::CONSTRUIT_SYSTEM("PSAMAN.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 2; SPRITE(_vm->_globals.PERSO, v6->field0, v6->field1, 0, 64, v6->field4, 0, 20, 127); goto LABEL_9; @@ -3708,10 +3708,10 @@ void ObjectsManager::OPTI_OBJET() { int v7; file = "OBJET1.ini"; - data = FileManager::RECHERCHE_CAT(file, 1); + data = _vm->_fileManager.RECHERCHE_CAT(file, 1); if (data == PTRNUL) { - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); - data = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + data = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if ((data == PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { @@ -3780,8 +3780,8 @@ void ObjectsManager::SPECIAL_JEU() { if (!_vm->_globals.CENSURE) { v1 = _vm->_globals.dos_malloc2(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); - FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); @@ -3795,8 +3795,8 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NECESSAIRE = 1; _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; - FileManager::CONSTRUIT_LINUX("TEMP1.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); PERSO_ON = 0; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); @@ -5687,8 +5687,8 @@ LABEL_1141: _vm->_globals.SAUVEGARDE->data[svField354] = 1; } if (v76 == 56) { - FileManager::CONSTRUIT_SYSTEM("HOPFEM.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("HOPFEM.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 1; _vm->_globals.SAUVEGARDE->data[svField122] = 1; _vm->_globals.HOPKINS_DATA(); @@ -5697,8 +5697,8 @@ LABEL_1141: VERIFTAILLE(); } if (v76 == 57) { - FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 0; _vm->_globals.SAUVEGARDE->data[svField122] = 0; _vm->_globals.HOPKINS_DATA(); @@ -6135,8 +6135,8 @@ void ObjectsManager::ACTION_DOS(int idx) { _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 1; - FileManager::CONSTRUIT_SYSTEM("DOS.SPR"); - _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("DOS.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -6171,8 +6171,8 @@ void ObjectsManager::ACTION_DROITE(int idx) { if (_vm->_globals.GESTE != PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - FileManager::CONSTRUIT_SYSTEM("PROFIL.SPR"); - _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); @@ -6201,8 +6201,8 @@ void ObjectsManager::Q_DROITE(int idx) { if (_vm->_globals.GESTE != PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - FileManager::CONSTRUIT_SYSTEM("3Q.SPR"); - _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -6231,8 +6231,8 @@ void ObjectsManager::ACTION_FACE(int idx) { if (_vm->_globals.GESTE != PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; - FileManager::CONSTRUIT_SYSTEM("FACE.SPR"); - _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("FACE.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -6249,8 +6249,8 @@ void ObjectsManager::Q_GAUCHE(int idx) { if (_vm->_globals.GESTE != PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - FileManager::CONSTRUIT_SYSTEM("3Q.SPR"); - _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); @@ -6279,8 +6279,8 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { if (_vm->_globals.GESTE != PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - FileManager::CONSTRUIT_SYSTEM("PROFIL.SPR"); - _vm->_globals.GESTE = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 1); @@ -6434,10 +6434,10 @@ void ObjectsManager::INILINK(const Common::String &file) { v2 = 0; filename = file + ".LNK"; - ptr = FileManager::RECHERCHE_CAT(filename, 3); + ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 3); nbytes = _vm->_globals.CAT_TAILLE; if (ptr == PTRNUL) { - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -6446,7 +6446,7 @@ void ObjectsManager::INILINK(const Common::String &file) { ptr = _vm->_globals.dos_malloc2(nbytes); if (PTRNUL == ptr) error("INILINK"); - FileManager::bload_it(f, ptr, nbytes); + _vm->_fileManager.bload_it(f, ptr, nbytes); f.close(); } if (!OBSSEUL) { @@ -6457,15 +6457,15 @@ void ObjectsManager::INILINK(const Common::String &file) { filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { - _vm->_globals.CACHE_BANQUE[1] = FileManager::RECHERCHE_CAT(filename2, 8); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.RECHERCHE_CAT(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.CAT_FLAG = 0; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); } else { _vm->_globals.CAT_FLAG = 1; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); } - _vm->_globals.CACHE_BANQUE[1] = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; v36 = 60; v37 = ptr + 1000; @@ -7619,21 +7619,21 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & if (!_vm->_globals.PERSO_TYPE) goto LABEL_70; if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { - FileManager::CONSTRUIT_SYSTEM("PERSO.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 0; } if (!_vm->_globals.PERSO_TYPE) { LABEL_70: if (_vm->_globals.SAUVEGARDE->data[svField122] == 1) { - FileManager::CONSTRUIT_SYSTEM("HOPFEM.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("HOPFEM.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 1; } } if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals.SAUVEGARDE->data[svField356] == 1) { - FileManager::CONSTRUIT_SYSTEM("PSAMAN.SPR"); - FileManager::CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 2; } _vm->_globals.HOPKINS_DATA(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 13179c1a36..f792f4d898 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -60,12 +60,12 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.no_scroll = 1; v13 = _vm->_globals.DESACTIVE_INVENT; _vm->_globals.DESACTIVE_INVENT = 1; - BUFFERPERSO = FileManager::RECHERCHE_CAT(filename, 5); + BUFFERPERSO = _vm->_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->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); + BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; RENVOIE_FICHIER(40, v16, (const char *)BUFFERPERSO); @@ -81,21 +81,21 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v2 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); v3 = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PERSOSPR = FileManager::RECHERCHE_CAT(v16, 7); + PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v16, 7); if (PERSOSPR) { _vm->_globals.CAT_FLAG = 0; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v16); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v16); } else { _vm->_globals.CAT_FLAG = 1; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == 640) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == 1280) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); @@ -134,8 +134,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); _vm->_objectsManager.PERSO_ON = 0; _vm->_eventsManager.btsouris = v14; @@ -191,12 +191,12 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { STATI = 1; v7 = _vm->_objectsManager.DESACTIVE_INVENT; _vm->_objectsManager.DESACTIVE_INVENT = 1; - BUFFERPERSO = FileManager::RECHERCHE_CAT(filename, 5); + BUFFERPERSO = _vm->_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->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); + BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; @@ -621,7 +621,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v18 = 0; _vm->_globals.police_l = 11; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); filename = dest = _vm->_globals.NFICHIER; filename += "IND"; @@ -1181,12 +1181,12 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(0); - BUFFERPERSO = FileManager::RECHERCHE_CAT(a2, 5); + BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(a2, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == PTRNUL) { - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, a2); - BUFFERPERSO = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); - TAILLEPERSO = FileManager::FLONG(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, a2); + BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); } RENVOIE_FICHIER(40, v23, (const char *)BUFFERPERSO); RENVOIE_FICHIER(0, v22, (const char *)BUFFERPERSO); @@ -1199,21 +1199,21 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!v6) { v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); } - PERSOSPR = FileManager::RECHERCHE_CAT(v23, 7); + PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v23, 7); if (PERSOSPR) { _vm->_globals.CAT_FLAG = 0; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v23); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v23); } else { _vm->_globals.CAT_FLAG = 1; - FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - FileManager::SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); @@ -1276,8 +1276,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.NOMARCHE = 0; if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; - FileManager::CONSTRUIT_LINUX("TEMP.SCR"); - FileManager::bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); _vm->_objectsManager.PERSO_ON = 0; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(4); -- cgit v1.2.3 From cc8bfc8429d5ca34f34336616657f488bfa25517 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Oct 2012 23:36:13 +1000 Subject: HOPKINS: Added proper initialisation for line manager class --- engines/hopkins/lines.cpp | 20 ++++++++++++++++++++ engines/hopkins/lines.h | 1 + 2 files changed, 21 insertions(+) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 99ef337d6c..bfd47e9699 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -28,6 +28,26 @@ namespace Hopkins { +LinesManager::LinesManager() { + for (int i = 0; i < 400; ++i) { + Common::fill((byte *)&LigneZone[i], (byte *)&LigneZone[i] + sizeof(LigneZoneItem), 0); + Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0); + } + for (int i = 0; i < 4000; ++i) { + Common::fill((byte *)&SMOOTH[i], (byte *)&SMOOTH[i] + sizeof(SmoothItem), 0); + } + + next_ligne = 0; + TOTAL_LIGNES = 0; + NV_LIGNEDEP = 0; + NV_LIGNEOFS = 0; + NV_POSI = 0; + NVPX = 0; + NVPY = 0; + SMOOTH_SENS = 0; + SMOOTH_X = SMOOTH_Y = 0; +} + void LinesManager::setParent(HopkinsEngine *vm) { _vm = vm; } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 54a222698d..2d131c646c 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -68,6 +68,7 @@ public: int SMOOTH_SENS; int SMOOTH_X, SMOOTH_Y; public: + LinesManager(); void setParent(HopkinsEngine *vm); void CLEAR_ZONE(); -- cgit v1.2.3 From 2b592038df8c81e27ccca1bddca9c5dec1dd742c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Oct 2012 00:02:02 +1000 Subject: HOPKINS: Implemented further initialisation --- engines/hopkins/globals.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/globals.h | 40 ++++++++++++------------- engines/hopkins/objects.cpp | 51 ++++++++++++++++++++++++++++++++ engines/hopkins/objects.h | 2 +- 4 files changed, 144 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 899cc842f1..e973e5c2bd 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -31,6 +31,50 @@ namespace Hopkins { Globals::Globals() { + // Initialise array properties + for (int i = 0; i < 6; ++i) + CACHE_BANQUE[i] = PTRNUL; + for (int i = 0; i < 106; ++i) + Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0); + for (int i = 0; i < 100; ++i) + Common::fill((byte *)&CarreZone[i], (byte *)&CarreZone[i] + sizeof(CarreZoneItem), 0); + for (int i = 0; i < 35; ++i) + Common::fill((byte *)&Bqe_Anim[i], (byte *)&Bqe_Anim[i] + sizeof(BqeAnimItem), 0); + for (int i = 0; i < 8; ++i) + Common::fill((byte *)&Bank[i], (byte *)&Bank[i] + sizeof(BankItem), 0); + for (int i = 0; i < 36; ++i) + Common::fill((byte *)&Bob[i], (byte *)&Bob[i] + sizeof(BobItem), 0); + for (int i = 0; i < 6; ++i) + Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0); + for (int i = 0; i < 35; ++i) + Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(Liste2Item), 0); + for (int i = 0; i < 30; ++i) + Common::fill((byte *)&BL_ANIM[i], (byte *)&BL_ANIM[i] + sizeof(BlAnimItem), 0); + for (int i = 0; i < 35; ++i) + Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0); + for (int i = 0; i < 300; ++i) + Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0); + for (int i = 0; i < 250; ++i) + Common::fill((byte *)&BLOC[i], (byte *)&BLOC[i] + sizeof(BlocItem), 0); + for (int i = 0; i < 25; ++i) + Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0); + + for (int i = 0; i < 101; ++i) + Common::fill((byte *)&Segment[i], (byte *)&Segment[i] + sizeof(SegmentItem), 0); + for (int i = 0; i < 105; ++i) { + BOBZONE[i] = 0; + BOBZONE_FLAG[i] = 0; + } + for (int i = 0; i < 500; ++i) + STAILLE[i] = 0; + for (int i = 0; i < 32002; ++i) + super_parcours[i] = 0; + for (int i = 0; i < 2100; ++i) + Param[i] = 0; + for (int i = 0; i < 70; ++i) + Common::fill((byte *)&Hopkins[i], (byte *)&Hopkins[i] + sizeof(HopkinsItem), 0); + + // Initialise fields FR = 0; SVGA = 2; internet = 1; @@ -46,6 +90,7 @@ Globals::Globals() { lOldItCounter = 0; g_old_anim = 0; g_old_sens = 0; + g_old_sens2 = 0; police_l = police_h = 0; TETE = NULL; texte_long = 0; @@ -64,6 +109,7 @@ Globals::Globals() { iRegul = 0; SORTIE = 0; PLANX = PLANY = 0; + PLANI = 0; PERSO = 0; PASSWORD = 0; ECRAN = 0; @@ -83,7 +129,19 @@ Globals::Globals() { opt_txt = 0; opt_anm = 0; NBTRI = 0; + AFFLI = 0; + AFFIVBL = 0; + NOT_VERIF = 0; AFFINVEN = 0; + PERSO_TYPE = 0; + GOACTION = 0; + NECESSAIRE = 0; + Compteur = 0; + ACTION_SENS = 0; + ACTION_SENS = 0; + SegmentEnCours = 0; + STOP_BUG = 0; + MAX_COMPTE = 0; // Initialise pointers ICONE = NULL; @@ -135,6 +193,20 @@ Globals::Globals() { OPTION_FLAG = false; CACHEFLAG = false; NOPARLE = false; + + // Reset indexed variables + force_to_data_0 = 0; + oldzone_46 = 0; + old_x1_65 = 0; + old_y1_66 = 0; + old_x2_67 = 0; + old_y2_68 = 0; + old_zone_68 = 0; + old_z_69 = 0; + old_x_69 = 0; + old_y_70 = 0; + compteur_71 = 0; + zozo_73 = 0; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 3bbaa2c9f4..81cb05184f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -285,6 +285,26 @@ class Globals { private: HopkinsEngine *_vm; public: + byte *CACHE_BANQUE[6]; + ZonePItem ZONEP[106]; + CarreZoneItem CarreZone[101]; + BqeAnimItem Bqe_Anim[35]; + BankItem Bank[8]; + BobItem Bob[36]; + ListeItem Liste[6]; + Liste2Item Liste2[35]; + BlAnimItem BL_ANIM[30]; + VBobItem VBob[35]; + ObjetWItem ObjetW[300]; + BlocItem BLOC[250]; + CacheItem Cache[25]; + SegmentItem Segment[101]; + int BOBZONE[105]; + bool BOBZONE_FLAG[105]; + int STAILLE[500]; + int16 super_parcours[32002]; + int Param[2100]; + HopkinsItem Hopkins[70]; int FR; int SVGA; int internet; @@ -329,26 +349,6 @@ public: byte *TETE; byte *ICONE; byte *BUF_ZONE; - byte *CACHE_BANQUE[6]; - ZonePItem ZONEP[106]; - CarreZoneItem CarreZone[101]; - BqeAnimItem Bqe_Anim[35]; - BankItem Bank[8]; - BobItem Bob[36]; - ListeItem Liste[6]; - Liste2Item Liste2[35]; - BlAnimItem BL_ANIM[30]; - VBobItem VBob[35]; - ObjetWItem ObjetW[300]; - BlocItem BLOC[250]; - CacheItem Cache[25]; - SegmentItem Segment[101]; - int BOBZONE[105]; - bool BOBZONE_FLAG[105]; - int STAILLE[500]; - int16 super_parcours[32002]; - int Param[2100]; - HopkinsItem Hopkins[70]; byte *Winventaire; byte *texte_tmp; int texte_long; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3d2f625679..ab427fc2bc 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -34,6 +34,10 @@ namespace Hopkins { ObjectsManager::ObjectsManager() { + for (int i = 0; i < 6; ++i) { + Common::fill((byte *)&Sprite[i], (byte *)&Sprite[i] + sizeof(SpriteItem), 0); + } + PRIORITY = 0; inventairex = inventairey = 0; inventairel = inventaireh = 0; @@ -41,15 +45,62 @@ ObjectsManager::ObjectsManager() { cadx = cady = cadi = 0; SL_X = SL_Y = 0; I_old_x = I_old_y = 0; + g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; + Winventaire = NULL; inventaire2 = PTRNUL; SL_SPR = PTRNUL; SL_SPR2 = PTRNUL; + sprite_ptr = PTRNUL; + S_old_spr = PTRNUL; PERSO_ON = false; SL_FLAG = false; + SL_MODE = false; FLAG_VISIBLE = false; DESACTIVE_INVENT = false; + DESACTIVE_CURSOR = 0; BOBTOUS = false; + INVENTFLAG = false; + KEY_INVENT = 0; + my_anim = 0; + GOACTION = 0; + NUMZONE = 0; + ARRET_PERSO_FLAG = 0; + ARRET_PERSO_NUM = 0; + FORCEZONE = 0; + CHANGEVERBE = 0; + verbe = 0; + Vold_taille = 0; + SPEED_FLAG = false; + SPEED_X = SPEED_Y = 0; + SPEED_IMAGE = 0; + SPEED_PTR = PTRNUL; + DERLIGNE = 0; + g_old_sens = 0; + A_ANIM = 0; + MA_ANIM = 0; + MA_ANIM1 = 0; + A_DEPA = 0; + MAX_DEPA = 0; + MAX_DEPA1 = 0; + VIRE_INVENT = 0; + AFFINVEN = 0; + TRAVAILOBJET = 0; + CH_TETE = 0; + T_RECTIF = 0; + DESACTIVE = 0; + DEUXPERSO = 0; + PERX, PERY = 0; + PERI = 0; + RECALL = 0; + PTAILLE = 0; + PEROFX = 0; + PEROFY = 0; + OBSSEUL = 0; + NVVERBE = 0; + NVZONE = 0; + S_old_ani = 0; + S_old_ret = 0; } void ObjectsManager::setParent(HopkinsEngine *vm) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 075a9dfc88..e12949b2e2 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -61,6 +61,7 @@ private: HopkinsEngine *_vm; public: + SpriteItem Sprite[6]; int PRIORITY; int inventairex, inventairey; int inventairel, inventaireh; @@ -83,7 +84,6 @@ public: bool DESACTIVE_INVENT; int DESACTIVE_CURSOR; bool BOBTOUS; - SpriteItem Sprite[6]; bool INVENTFLAG; int KEY_INVENT; int my_anim; -- cgit v1.2.3 From 4e0738af23f2e83ee30777d22cf63a13ddf5f08e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 9 Oct 2012 00:21:03 +1100 Subject: HOPKINS: Bugfixes for INILINK initialisatoin --- engines/hopkins/files.cpp | 3 +++ engines/hopkins/globals.cpp | 2 +- engines/hopkins/hopkins.cpp | 1 + engines/hopkins/lines.h | 1 - engines/hopkins/objects.cpp | 18 ++++++++++-------- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index a6a0d28cf3..fec9d859ef 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -200,6 +200,9 @@ byte *FileManager::LIBERE_FICHIER(byte *ptr) { byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { byte *ptr = NULL; Common::File f; + + Common::String filename = file; + filename.toUppercase(); switch (a2) { case 1: diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e973e5c2bd..9d5de109d7 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -312,7 +312,7 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field4 = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; - _vm->_linesManager.Ligne[idx].field12 = PTRNUL; + _vm->_linesManager.Ligne[idx].fieldC = PTRNUL; _vm->_linesManager.LigneZone[idx].field0 = 0; _vm->_linesManager.LigneZone[idx].field2 = 0; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0afc35c0b0..2608da5dbc 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -44,6 +44,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _fontManager.setParent(this); _globals.setParent(this); _graphicsManager.setParent(this); + _linesManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); _soundManager.setParent(this); diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 2d131c646c..1ac44b8bb0 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -43,7 +43,6 @@ struct LigneItem { int field6; int field8; byte *fieldC; - byte *field12; }; struct SmoothItem { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ab427fc2bc..0d509b5b14 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -6462,8 +6462,8 @@ void ObjectsManager::INILINK(const Common::String &file) { int v23; int v24; int v25; - int v27; - int v28; + int16 v27; + int16 v28; int v29; int v30; int v31; @@ -6509,13 +6509,15 @@ void ObjectsManager::INILINK(const Common::String &file) { filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.RECHERCHE_CAT(filename2, 8); - if (_vm->_globals.CACHE_BANQUE[1]) { + + if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == PTRNUL) { _vm->_globals.CAT_FLAG = 0; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); } else { _vm->_globals.CAT_FLAG = 1; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); } + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; v36 = 60; @@ -6560,13 +6562,13 @@ void ObjectsManager::INILINK(const Common::String &file) { v41 = 0; if (nbytes) { do { - if (*(ptr + v41) == 79 && *(ptr + v41 + 1) == 66 && *(ptr + v41 + 2) == 50) { + if (*(ptr + v41) == 'O' && *(ptr + v41 + 1) == 'B' && *(ptr + v41 + 2) == '2') { v16 = ptr + v41 + 4; v32 = 0; v34 = 0; _vm->_linesManager.TOTAL_LIGNES = 0; do { - v27 = READ_LE_UINT16(v16 + 2 * v32); + v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { _vm->_linesManager.AJOUTE_LIGNE( v34, @@ -6616,7 +6618,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v31 = 0; do { - v28 = READ_LE_UINT16(v17 + 2 * v33); + v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); if (v28 != -1) { _vm->_linesManager.AJOUTE_LIGNE_ZONE( v35, @@ -6633,7 +6635,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } while (v28 != -1); v20 = 1; do { - v21 = 20 * v20; + v21 = v20; _vm->_globals.ZONEP[v21].field0 = READ_LE_UINT16(v17 + 2 * v33); _vm->_globals.ZONEP[v21].field2 = READ_LE_UINT16(v17 + 2 * v33 + 2); _vm->_globals.ZONEP[v21].field4 = READ_LE_UINT16(v17 + 2 * v33 + 4); @@ -6645,7 +6647,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v29 = 0; v23 = 1; do { - v24 = 20 * v23; + v24 = v23; _vm->_globals.ZONEP[v24].field6 = *(v29 + v22); _vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1); _vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2); -- cgit v1.2.3 From 22204ecc66e5da0f3432cc4f6c8748d9d3e3ee34 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 00:28:24 +1100 Subject: HOPKINS: Fixed loading in CHARGE_BANK_SPRITE1 --- engines/hopkins/anim.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 3971300ff4..4b16811d65 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -844,8 +844,11 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam _vm->_globals.Bank[idx].field1A = v8; Common::String ofsFilename = _vm->_globals.Bank[idx].filename1; - while (ofsFilename.lastChar() != '.') + char ch; + do { + ch = ofsFilename.lastChar(); ofsFilename.deleteLastChar(); + } while (ch != '.'); ofsFilename += ".OFS"; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, ofsFilename); -- cgit v1.2.3 From 02df605f797a4d553d594cb77014bf3ed5950e26 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 20:42:25 +1100 Subject: HOPKINS: Fix for filename case comparisons in LIBERE_FICHIER --- engines/hopkins/files.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index fec9d859ef..87c1490ea2 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -305,7 +305,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { do { Common::String name = (const char *)ptr + offsetVal; - if (name == file) { + if (name == filename) { // Found entry for file, so get it's details from the catalogue entry const byte *pData = ptr + offsetVal; _vm->_globals.CAT_POSI = READ_LE_UINT32(pData + 15); -- cgit v1.2.3 From 7ca9d2100f3fe0b9d23497bbd9c4885f9b3a92b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 21:03:29 +1100 Subject: HOPKINS: Changed PTRNUL from being 0 to an explicitly allocated pointer. Some of the methods explicitly differentiate between having a 0 result for invalid/abort versus PTRNUL return values --- engines/hopkins/anim.cpp | 6 +- engines/hopkins/files.cpp | 22 +++--- engines/hopkins/font.cpp | 16 ++-- engines/hopkins/globals.cpp | 125 ++++++++++++++++-------------- engines/hopkins/globals.h | 3 +- engines/hopkins/graphics.cpp | 8 +- engines/hopkins/lines.cpp | 42 +++++------ engines/hopkins/objects.cpp | 176 +++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 22 +++--- 9 files changed, 215 insertions(+), 205 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 4b16811d65..8950437998 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -777,13 +777,13 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { void AnimationManager::CLEAR_ANIM() { for (int idx = 0; idx < 35; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].data != PTRNUL) + if (_vm->_globals.Bqe_Anim[idx].data != g_PTRNUL) _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); _vm->_globals.Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - if (_vm->_globals.Bank[idx].data != PTRNUL) + if (_vm->_globals.Bank[idx].data != g_PTRNUL) _vm->_globals.Bank[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bank[idx].data); _vm->_globals.Bank[idx].field4 = 0; _vm->_globals.Bank[idx].filename1 = ""; @@ -937,7 +937,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { if (nbytes < v6) { _vm->_globals.Bqe_Anim[idx].field4 = 0; - _vm->_globals.Bqe_Anim[idx].data = PTRNUL; + _vm->_globals.Bqe_Anim[idx].data = g_PTRNUL; } ++v6; diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 87c1490ea2..de501d884c 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -194,7 +194,7 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::Str byte *FileManager::LIBERE_FICHIER(byte *ptr) { free(ptr); - return PTRNUL; + return g_PTRNUL; } byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { @@ -208,7 +208,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 1: CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_INI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_INI.RES"); @@ -217,7 +217,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 2: CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_REP.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_REP.RES"); @@ -226,7 +226,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 3: CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_LIN.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_LIN.RES"); @@ -235,7 +235,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 4: CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_ANI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_ANI.RES"); @@ -244,7 +244,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 5: CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_PER.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_PER.RES"); @@ -253,7 +253,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 6: CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, "PIC.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; @@ -261,7 +261,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 7: CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; @@ -269,7 +269,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { case 8: CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; @@ -288,7 +288,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { } if (!f.exists(_vm->_globals.NFICHIER)) - return PTRNUL; + return g_PTRNUL; ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); break; @@ -331,7 +331,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { f.seek(_vm->_globals.CAT_POSI); byte *catData = _vm->_globals.dos_malloc2(_vm->_globals.CAT_TAILLE); - if (catData == PTRNUL) + if (catData == g_PTRNUL) error("CHARGE_FICHIER"); bload_it(f, catData, _vm->_globals.CAT_TAILLE); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 919d55a3d5..f8d18a24c1 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -58,9 +58,9 @@ void FontManager::TEXTE_ON(int idx) { txt.field0 = 1; txt.field408 = 0; - if (txt.field400 != PTRNUL) { + if (txt.field400 != g_PTRNUL) { _vm->_globals.dos_free2(txt.field400); - txt.field400 = PTRNUL; + txt.field400 = g_PTRNUL; } } @@ -73,9 +73,9 @@ void FontManager::TEXTE_OFF(int idx) { txt.field0 = 0; txt.field408 = 0; - if (txt.field400 != PTRNUL) { + if (txt.field400 != g_PTRNUL) { _vm->_globals.dos_free2(txt.field400); - txt.field400 = PTRNUL; + txt.field400 = g_PTRNUL; } } @@ -250,7 +250,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, v69 = 2048; f.seek(Index[fileIndex]); texte_tmp = _vm->_globals.dos_malloc2(2058); - if (texte_tmp == PTRNUL) + if (texte_tmp == g_PTRNUL) error("temporary text"); f.read(texte_temp, 2048); @@ -475,7 +475,7 @@ LABEL_57: v49 = v51 * v53; ptrd = _vm->_globals.dos_malloc2(v51 * v53); - if (ptrd == PTRNUL) + if (ptrd == g_PTRNUL) error("Error allocating block (%d)", v49); } @@ -512,12 +512,12 @@ LABEL_57: if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { v33 = idx; - if (Txt[v33].field400 != PTRNUL) + if (Txt[v33].field400 != g_PTRNUL) Txt[v33].field400 = _vm->_globals.dos_free2(Txt[v33].field400); v50 = v52 * v54; ptre = dos_malloc2(v50 + 20); - if (ptre == PTRNUL) + if (ptre == g_PTRNUL) error("Error allocating block (%d)", v50); } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 9d5de109d7..a02e47dbf0 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -30,10 +30,16 @@ namespace Hopkins { +byte *g_PTRNUL; + Globals::Globals() { + // Set up the special g_PTRNUL variable + g_PTRNUL = (byte *)malloc(16); + strcpy((char *)g_PTRNUL, "POINTERNULL"); + // Initialise array properties for (int i = 0; i < 6; ++i) - CACHE_BANQUE[i] = PTRNUL; + CACHE_BANQUE[i] = g_PTRNUL; for (int i = 0; i < 106; ++i) Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0); for (int i = 0; i < 100; ++i) @@ -211,24 +217,26 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); - free(BUF_ZONE); - free(CACHE_BANQUE[6]); - free(Winventaire); - free(texte_tmp); - free(SPRITE_ECRAN); - free(SAUVEGARDE); - free(BUFFERTAPE); - free(Bufferobjet); - free(inventaire2); - free(GESTE); - free(INVENTAIRE_OBJET); - free(FORETSPR); - free(COUCOU); - free(chemin); - free(cache_souris); - free(Bufferdecor); - free(ADR_FICHIER_OBJ); - free(PERSO); + dos_free2(BUF_ZONE); + dos_free2(CACHE_BANQUE[6]); + dos_free2(Winventaire); + dos_free2(texte_tmp); + dos_free2(SPRITE_ECRAN); + dos_free2((byte *)SAUVEGARDE); + dos_free2(BUFFERTAPE); + dos_free2(Bufferobjet); + dos_free2(inventaire2); + dos_free2(GESTE); + dos_free2(INVENTAIRE_OBJET); + dos_free2(FORETSPR); + dos_free2(COUCOU); + dos_free2(chemin); + dos_free2(cache_souris); + dos_free2(Bufferdecor); + dos_free2(ADR_FICHIER_OBJ); + dos_free2(PERSO); + + free(g_PTRNUL); } void Globals::setParent(HopkinsEngine *vm) { @@ -267,14 +275,14 @@ void Globals::clearAll() { // to point to. For now, we're seeing if the NULL value will do as well for (int idx = 0; idx < 6; ++idx) - CACHE_BANQUE[idx] = PTRNUL; + CACHE_BANQUE[idx] = g_PTRNUL; nbrligne = 80; INIT_ANIM(); - texte_tmp = PTRNUL; + texte_tmp = g_PTRNUL; texte_long = 0; - police = PTRNUL; + police = g_PTRNUL; police_h = 0; police_l = 0; hauteur_boite = 0; @@ -283,15 +291,15 @@ void Globals::clearAll() { _vm->_fontManager.clearAll(); INIT_VBOB(); - ADR_FICHIER_OBJ = PTRNUL; + ADR_FICHIER_OBJ = g_PTRNUL; NUM_FICHIER_OBJ = 0; - Bufferdecor = PTRNUL; - Bufferobjet = PTRNUL; - Winventaire = PTRNUL; - inventaire2 = PTRNUL; - COUCOU = PTRNUL; - SPRITE_ECRAN = PTRNUL; - SAUVEGARDE = (Sauvegarde *)PTRNUL; + Bufferdecor = g_PTRNUL; + Bufferobjet = g_PTRNUL; + Winventaire = g_PTRNUL; + inventaire2 = g_PTRNUL; + COUCOU = g_PTRNUL; + SPRITE_ECRAN = g_PTRNUL; + SAUVEGARDE = (Sauvegarde *)g_PTRNUL; OBJET_EN_COURS = 0; for (int idx = 0; idx < 105; ++idx) { @@ -300,11 +308,11 @@ void Globals::clearAll() { ZONEP[idx].field4 = 0; } - essai0 = PTRNUL; - essai1 = PTRNUL; - essai2 = PTRNUL; - BufLig = PTRNUL; - chemin = PTRNUL; + essai0 = g_PTRNUL; + essai1 = g_PTRNUL; + essai2 = g_PTRNUL; + BufLig = g_PTRNUL; + chemin = g_PTRNUL; for (int idx = 0; idx < 400; ++idx) { _vm->_linesManager.Ligne[idx].field0 = 0; @@ -312,11 +320,11 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field4 = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; - _vm->_linesManager.Ligne[idx].fieldC = PTRNUL; + _vm->_linesManager.Ligne[idx].fieldC = g_PTRNUL; _vm->_linesManager.LigneZone[idx].field0 = 0; _vm->_linesManager.LigneZone[idx].field2 = 0; - _vm->_linesManager.LigneZone[idx].field4 = PTRNUL; + _vm->_linesManager.LigneZone[idx].field4 = g_PTRNUL; } for (int idx = 0; idx < 100; ++idx) { @@ -324,7 +332,7 @@ void Globals::clearAll() { } texte_long = 0; - texte_tmp = PTRNUL; + texte_tmp = g_PTRNUL; BUFFERTAPE = dos_malloc2(85000); SAUVEGARDE = (Sauvegarde *)malloc(sizeof(Sauvegarde)); @@ -340,12 +348,12 @@ void Globals::clearAll() { Bufferobjet = dos_malloc2(2500); INVENTAIRE_OBJET = dos_malloc2(2500); - ADR_FICHIER_OBJ = PTRNUL; - FORETSPR = PTRNUL; + ADR_FICHIER_OBJ = g_PTRNUL; + FORETSPR = g_PTRNUL; FORET = 0; cache_souris = dos_malloc2(2500); - GESTE = PTRNUL; + GESTE = g_PTRNUL; GESTE_FLAG = false; } @@ -728,12 +736,12 @@ void Globals::HOPKINS_DATA() { void Globals::INIT_ANIM() { for (int idx = 0; idx < 35; ++idx) { - Bqe_Anim[idx].data = PTRNUL; + Bqe_Anim[idx].data = g_PTRNUL; Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - Bank[idx].data = PTRNUL; + Bank[idx].data = g_PTRNUL; Bank[idx].field4 = 0; Bank[idx].filename1 = ""; Bank[idx].fileHeader = 0; @@ -749,9 +757,9 @@ void Globals::INIT_VBOB() { VBob[idx].field8 = 0; VBob[idx].fieldA = 0; VBob[idx].fieldC = 0; - VBob[idx].field10 = PTRNUL; - VBob[idx].field0 = PTRNUL; - VBob[idx].field1C = PTRNUL; + VBob[idx].field10 = g_PTRNUL; + VBob[idx].field0 = g_PTRNUL; + VBob[idx].field1C = g_PTRNUL; } } @@ -762,9 +770,9 @@ void Globals::CLEAR_VBOB() { VBob[idx].field8 = 0; VBob[idx].fieldA = 0; VBob[idx].fieldC = 0; - VBob[idx].field10 = PTRNUL; - VBob[idx].field0 = PTRNUL; - VBob[idx].field1C = PTRNUL; + VBob[idx].field10 = g_PTRNUL; + VBob[idx].field0 = g_PTRNUL; + VBob[idx].field1C = g_PTRNUL; } } @@ -790,18 +798,19 @@ void Globals::CHARGE_OBJET() { byte *Globals::dos_malloc2(int count) { byte *result = (byte *)malloc(count); if (!result) - result = PTRNUL; + result = g_PTRNUL; return result; } byte *Globals::dos_free2(byte *p) { - free(p); - return PTRNUL; + if (p != g_PTRNUL) + free(p); + return g_PTRNUL; } byte *Globals::LIBERE_FICHIER(byte *p) { dos_free2(p); - return PTRNUL; + return g_PTRNUL; } void Globals::RESET_CACHE() { @@ -809,13 +818,13 @@ void Globals::RESET_CACHE() { for (int idx = 1; idx <= 5; ++idx) { dataP = CACHE_BANQUE[idx]; - if (dataP != PTRNUL && dataP) + if (dataP != g_PTRNUL && dataP) CACHE_BANQUE[idx] = dos_free2(CACHE_BANQUE[idx]); - CACHE_BANQUE[idx] = PTRNUL; + CACHE_BANQUE[idx] = g_PTRNUL; } for (int idx = 0; idx <= 20; ++idx) { - Cache[idx].fieldC = PTRNUL; + Cache[idx].fieldC = g_PTRNUL; Cache[idx].field0 = 0; Cache[idx].field4 = 0; Cache[idx].field2 = 0; @@ -847,7 +856,7 @@ void Globals::CACHE_ADD(int idx) { } void Globals::CHARGE_CACHE(const Common::String &file) { - byte *v2 = PTRNUL; + byte *v2 = g_PTRNUL; int v4; int v5; int v6; @@ -883,7 +892,7 @@ void Globals::CHARGE_CACHE(const Common::String &file) { Cache[v6].field0 = v4; Cache[v6].field4 = v5; Cache[v6].field12 = 1; - if (spriteData == PTRNUL) { + if (spriteData == g_PTRNUL) { Cache[v14].fieldA = 0; } else { v8 = _vm->_objectsManager.Get_Largeur(spriteData, v11); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 81cb05184f..70b62a5d71 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -470,7 +470,8 @@ public: void B_CACHE_OFF(int idx); }; -#define PTRNUL (byte *)NULL +// Global null pointer +extern byte *g_PTRNUL; } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 851768a6b9..04c43c966b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2343,13 +2343,13 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { v13 = file + ".ini"; ptr = _vm->_fileManager.RECHERCHE_CAT(v13, 1); - if (PTRNUL == ptr) { + if (g_PTRNUL == ptr) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (!a2) { v13 = file + ".spr"; - if (PTRNUL != _vm->_globals.SPRITE_ECRAN) + if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); if (!_vm->_globals.NOSPRECRAN) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.RECHERCHE_CAT(v13, 8); @@ -2384,13 +2384,13 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { } _vm->_globals.dos_free2(ptr); if (a2 != 1) { - if (PTRNUL != _vm->_globals.COUCOU) + if (g_PTRNUL != _vm->_globals.COUCOU) _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); v13 = file + ".rep"; byte *dataP = _vm->_fileManager.RECHERCHE_CAT(v13, 2); _vm->_globals.COUCOU = dataP; - if (PTRNUL == dataP) { + if (g_PTRNUL == dataP) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); dataP = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_globals.COUCOU = dataP; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index bfd47e9699..6c499d0c37 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -130,10 +130,10 @@ int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { void LinesManager::RETIRE_LIGNE_ZONE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (_vm->_linesManager.LigneZone[idx].field4 != PTRNUL) + if (_vm->_linesManager.LigneZone[idx].field4 != g_PTRNUL) _vm->_globals.dos_free2(_vm->_linesManager.LigneZone[idx].field4); - _vm->_linesManager.LigneZone[idx].field4 = PTRNUL; + _vm->_linesManager.LigneZone[idx].field4 = g_PTRNUL; } @@ -160,7 +160,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); v7 = idx; - if (LigneZone[v7].field4 != PTRNUL) + if (LigneZone[v7].field4 != g_PTRNUL) LigneZone[v7].field4 = _vm->_globals.dos_free2(LigneZone[v7].field4); v8 = a2 - a4; if (a2 - a4 < 0) @@ -177,7 +177,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in v10 = _vm->_globals.dos_malloc2(4 * v20 + 8); v11 = idx; LigneZone[v11].field4 = v10; - if (PTRNUL == v10) + if (g_PTRNUL == v10) error("AJOUTE LIGNE ZONE"); v12 = LigneZone[v11].field4; @@ -221,16 +221,16 @@ void LinesManager::RESET_OBSTACLE() { for (int idx =0; idx < 400; ++idx) { RETIRE_LIGNE(idx); Ligne[idx].field0 = 0; - Ligne[idx].fieldC = PTRNUL; + Ligne[idx].fieldC = g_PTRNUL; } } void LinesManager::RETIRE_LIGNE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (Ligne[idx].fieldC != PTRNUL) + if (Ligne[idx].fieldC != g_PTRNUL) _vm->_globals.dos_free2(Ligne[idx].fieldC); - Ligne[idx].fieldC = PTRNUL; + Ligne[idx].fieldC = g_PTRNUL; } void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { @@ -262,7 +262,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (TOTAL_LIGNES < idx) TOTAL_LIGNES = idx; - if (Ligne[idx].fieldC != PTRNUL) + if (Ligne[idx].fieldC != g_PTRNUL) _vm->_globals.dos_free2(Ligne[idx].fieldC); v7 = a3 - a5; if (a3 - a5 < 0) @@ -277,7 +277,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v34 = v8; v10 = _vm->_globals.dos_malloc2(4 * v34 + 8); Ligne[idx].fieldC = v10; - if (v10 == PTRNUL) + if (v10 == g_PTRNUL) error("AJOUTE LIGNE OBSTACLE"); v32 = Ligne[idx].fieldC; v36 = 1000 * v8; @@ -412,7 +412,7 @@ LABEL_29: v19 = a2 - 4; while (1) { v7 = Ligne[v6].fieldC; - if (v7 != PTRNUL) { + if (v7 != g_PTRNUL) { v23 = 1; v8 = 2 * Ligne[v6].field0; v9 = READ_LE_UINT16(v7); @@ -503,7 +503,7 @@ LABEL_47: v19 = a2 - 10; while (1) { v7 = Ligne[v6].fieldC; - if (PTRNUL != v7) { + if (g_PTRNUL != v7) { v23 = 1; v8 = 2 * Ligne[v6].field0; v9 = READ_LE_UINT16(v7); @@ -1342,14 +1342,14 @@ LABEL_112: v86 = v92 - 1; v11 = 2 * Ligne[v92 - 1].field0; v12 = Ligne[v92 - 1].fieldC; - if (v12 == PTRNUL) + if (v12 == g_PTRNUL) break; while (READ_LE_UINT16(v12 + 2 * v11 - 4) != v98 || v97 != READ_LE_UINT16(v12 + 2 * v11 - 2)) { --v86; if (_vm->_objectsManager.DERLIGNE - 1 != v86) { v11 = 2 * Ligne[v86].field0; v12 = Ligne[v86].fieldC; - if (v12 != PTRNUL) + if (v12 != g_PTRNUL) continue; } goto LABEL_11; @@ -1368,7 +1368,7 @@ LABEL_11: v87 = v91 + 1; v15 = 2 * Ligne[v91 + 1].field0; v16 = Ligne[v91 + 1].fieldC; - if (PTRNUL == v16) + if (g_PTRNUL == v16) break; while (1) { v65 = v15; @@ -1381,7 +1381,7 @@ LABEL_11: if (v87 != TOTAL_LIGNES + 1) { v15 = 2 * Ligne[v87].field0; v16 = Ligne[v87].fieldC; - if (v16 != PTRNUL) + if (v16 != g_PTRNUL) continue; } goto LABEL_17; @@ -1454,7 +1454,7 @@ LABEL_17: for (i = v92; i < v91 + 1; ++i) { v27 = 2 * Ligne[i].field0; v28 = Ligne[i].fieldC; - if (PTRNUL == v28) + if (g_PTRNUL == v28) error("erreur dans da routine genial"); v29 = *(uint16 *)v28; v30 = READ_LE_UINT16(v28 + 2); @@ -1830,7 +1830,7 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v7 < 0) v7 = -v7; if (v7 <= 4) - return PTRNUL; + return g_PTRNUL; } } } @@ -1842,10 +1842,10 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v9 < 0) v9 = -v9; if (v9 <= 4) - return PTRNUL; + return g_PTRNUL; } if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) - return PTRNUL; + return g_PTRNUL; } _vm->_globals.NOT_VERIF = 0; _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; @@ -1871,7 +1871,7 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v11 < 0) v11 = -v11; if (v11 <= 3) - return PTRNUL; + return g_PTRNUL; } v12 = 0; error("TODO: Fix v141/v136 - they look like arrays, not a single int"); @@ -1987,7 +1987,7 @@ error("TODO: Fix v141/v136 - they look like arrays, not a single int"); if (v145 < 0) v135 = 1300; if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) - return PTRNUL; + return g_PTRNUL; v31 = 0; if (v144 != -1 && v132 >= v134 && v133 >= v134 && v135 >= v134) { v121 = v144; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0d509b5b14..617f9cb6e7 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -48,11 +48,11 @@ ObjectsManager::ObjectsManager() { g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; Winventaire = NULL; - inventaire2 = PTRNUL; - SL_SPR = PTRNUL; - SL_SPR2 = PTRNUL; - sprite_ptr = PTRNUL; - S_old_spr = PTRNUL; + inventaire2 = g_PTRNUL; + SL_SPR = g_PTRNUL; + SL_SPR2 = g_PTRNUL; + sprite_ptr = g_PTRNUL; + S_old_spr = g_PTRNUL; PERSO_ON = false; SL_FLAG = false; SL_MODE = false; @@ -74,7 +74,7 @@ ObjectsManager::ObjectsManager() { SPEED_FLAG = false; SPEED_X = SPEED_Y = 0; SPEED_IMAGE = 0; - SPEED_PTR = PTRNUL; + SPEED_PTR = g_PTRNUL; DERLIGNE = 0; g_old_sens = 0; A_ANIM = 0; @@ -126,7 +126,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { if (mode == 1) ++val2; if (val1 != _vm->_globals.NUM_FICHIER_OBJ) { - if (_vm->_globals.ADR_FICHIER_OBJ != PTRNUL) + if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { _vm->_fileManager.CONSTRUIT_SYSTEM("OBJET1.SPR"); @@ -143,7 +143,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { switch (mode) { case 0: dataP = _vm->_globals.dos_malloc2(height * width); - if (dataP == PTRNUL) + if (dataP == g_PTRNUL) error("CAPTURE_OBJET"); ObjectsManager::capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); @@ -268,11 +268,11 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn byte *ObjectsManager::DEL_FICHIER_OBJ() { _vm->_globals.NUM_FICHIER_OBJ = 0; - if (_vm->_globals.ADR_FICHIER_OBJ != PTRNUL) + if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) _vm->_globals.ADR_FICHIER_OBJ = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); - byte *result = PTRNUL; - _vm->_globals.ADR_FICHIER_OBJ = PTRNUL; + byte *result = g_PTRNUL; + _vm->_globals.ADR_FICHIER_OBJ = g_PTRNUL; return result; } @@ -594,7 +594,7 @@ void ObjectsManager::BOB_ZERO(int idx) { Liste2Item &item = _vm->_globals.Liste2[idx]; bob.field0 = 0; - bob.field4 = PTRNUL; + bob.field4 = g_PTRNUL; bob.field8 = 0; bob.fieldA = 0; bob.fieldC = 0; @@ -603,7 +603,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field12 = 0; bob.field14 = 0; bob.field16 = 0; - bob.field18 = PTRNUL; + bob.field18 = g_PTRNUL; bob.field1A = 0; bob.field1C = 0; bob.field1E = 0; @@ -614,7 +614,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field28 = 0; bob.field2A = 0; bob.field2C = 0; - bob.field30 = PTRNUL; + bob.field30 = g_PTRNUL; bob.field34 = 0; bob.field36 = 0; bob.field38 = 0; @@ -1336,7 +1336,7 @@ void ObjectsManager::AFF_BOB_ANIM() { v1 = _vm->_globals.Bob[idx].field20; if (v1 == -1) v1 = 50; - if (_vm->_globals.Bob[idx].field18 == PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) + if (_vm->_globals.Bob[idx].field18 == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) goto LABEL_38; v2 = _vm->_globals.Bob[idx].field14; @@ -1513,19 +1513,19 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx].field6 + width, height + _vm->_globals.VBob[idx].field8); - if (PTRNUL != _vm->_globals.VBob[idx].field10) + if (g_PTRNUL != _vm->_globals.VBob[idx].field10) _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); _vm->_globals.VBob[idx].field4 = 0; - _vm->_globals.VBob[idx].field10 = PTRNUL; - _vm->_globals.VBob[idx].field0 = PTRNUL; + _vm->_globals.VBob[idx].field10 = g_PTRNUL; + _vm->_globals.VBob[idx].field0 = g_PTRNUL; _vm->_globals.VBob[idx].field6 = 0; _vm->_globals.VBob[idx].field8 = 0; _vm->_globals.VBob[idx].field14 = 0; _vm->_globals.VBob[idx].field16 = 0; _vm->_globals.VBob[idx].fieldA = 0; _vm->_globals.VBob[idx].field18 = 0; - _vm->_globals.VBob[idx].field1C = PTRNUL; + _vm->_globals.VBob[idx].field1C = g_PTRNUL; } if (_vm->_globals.VBob[idx].field4 == 3) { @@ -1549,10 +1549,10 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx].field4 = 1; _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; - if (PTRNUL != _vm->_globals.VBob[idx].field10) + if (g_PTRNUL != _vm->_globals.VBob[idx].field10) _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); - _vm->_globals.VBob[idx].field10 = PTRNUL; + _vm->_globals.VBob[idx].field10 = g_PTRNUL; _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; @@ -1562,7 +1562,7 @@ void ObjectsManager::AFF_VBOB() { width = Get_Largeur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); height = Get_Hauteur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); - if (PTRNUL != _vm->_globals.VBob[idx].field10) + if (g_PTRNUL != _vm->_globals.VBob[idx].field10) _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); byte *surface = _vm->_globals.dos_malloc2(height * width); @@ -1624,8 +1624,8 @@ void ObjectsManager::CLEAR_SPR() { idx = 0; do { - Sprite[idx].field1C = PTRNUL; - Sprite[idx].spriteData = PTRNUL; + Sprite[idx].field1C = g_PTRNUL; + Sprite[idx].spriteData = g_PTRNUL; Sprite[idx].field0 = 0; ++idx; } while (idx <= 4); @@ -1659,7 +1659,7 @@ void ObjectsManager::SPRITE(const byte *spriteData, int a2, int a3, int idx, int Sprite[idx].fieldC = a6; Sprite[idx].field12 = a8; Sprite[idx].field14 = a9; - Sprite[idx].field1C = PTRNUL; + Sprite[idx].field1C = g_PTRNUL; Sprite[idx].field20 = 0; Sprite[idx].field24 = 0; Sprite[idx].field26 = 0; @@ -1698,9 +1698,9 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, void ObjectsManager::SPRITE_OFF(int idx) { Sprite[idx].field0 = 3; - if (Sprite[idx].field1C != PTRNUL) + if (Sprite[idx].field1C != g_PTRNUL) _vm->_globals.dos_free2(Sprite[idx].field1C); - Sprite[idx].field1C = PTRNUL; + Sprite[idx].field1C = g_PTRNUL; } void ObjectsManager::SPRITE_GEL(int idx) { @@ -1794,7 +1794,7 @@ void ObjectsManager::VERIFZONE() { v3 = _vm->_globals.compteur_71 + 1; _vm->_globals.compteur_71 = v3; if (v3 > 1u) { - if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == PTRNUL) || v3 > 4u) { + if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == g_PTRNUL) || v3 > 4u) { _vm->_globals.compteur_71 = 0; if (_vm->_globals.old_x_69 != v0 || _vm->_globals.old_y_70 != v2) { v4 = MZONE(); @@ -1916,7 +1916,7 @@ void ObjectsManager::CARRE_ZONE() { for (int idx = 0; idx < 400; ++idx) { v3 = _vm->_linesManager.LigneZone[idx].field4; - if (v3 != PTRNUL) { + if (v3 != g_PTRNUL) { v4 = _vm->_linesManager.LigneZone[idx].field2; _vm->_globals.CarreZone[v4].field0 = 1; if (_vm->_globals.CarreZone[v4].fieldC < idx) @@ -1979,7 +1979,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLAN_FLAG = 1; _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = 0; - sprite_ptr = PTRNUL; + sprite_ptr = g_PTRNUL; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; _vm->_globals.AFFIVBL = 0; @@ -2016,7 +2016,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.SCROLL_ECRAN(v3 - 320); _vm->_graphicsManager.ofscroll = XSPR(0) - 320; SPRITE_ON(0); - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -2060,7 +2060,7 @@ void ObjectsManager::PLAN_BETA() { VERIFZONE(); GOHOME2(); - if (_vm->_globals.chemin == PTRNUL && _vm->_globals.GOACTION == 1) + if (_vm->_globals.chemin == g_PTRNUL && _vm->_globals.GOACTION == 1) PARADISE(); _vm->_eventsManager.VBL(); @@ -2193,7 +2193,7 @@ LABEL_38: } GOACTION = 0; v9 = _vm->_globals.chemin; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); @@ -2201,22 +2201,22 @@ LABEL_38: v12 = XSPR(0); v13 = _vm->_linesManager.PARCOURS2(v12, v11, v10, 390); _vm->_globals.chemin = v13; - if (PTRNUL != v13) + if (g_PTRNUL != v13) PACOURS_PROPRE(v13); g_old_x = XSPR(0); g_old_y = YSPR(0); _vm->_globals.Compteur = 0; - if (PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) { + if (g_PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) { LABEL_64: _vm->_globals.g_old_sens = -1; goto LABEL_65; } goto LABEL_63; } - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; SETANISPR(0, _vm->_globals.g_old_sens2 + 59); _vm->_globals.ACTION_SENS = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; VERIFTAILLE(); SETFLIPSPR(0, 0); _vm->_globals.Compteur = 0; @@ -2229,12 +2229,12 @@ LABEL_64: v15 = XSPR(0); v16 = _vm->_linesManager.PARCOURS2(v15, v14, v19, v0); _vm->_globals.chemin = v16; - if (PTRNUL != v16) + if (g_PTRNUL != v16) PACOURS_PROPRE(v16); g_old_x = XSPR(0); g_old_y = YSPR(0); _vm->_globals.Compteur = 0; - if (PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) + if (g_PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) goto LABEL_64; LABEL_63: _vm->_globals.chemin = v9; @@ -2265,7 +2265,7 @@ LABEL_65: } if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; XSPR(0); YSPR(0); } @@ -2411,17 +2411,17 @@ void ObjectsManager::CLEAR_ECRAN() { NUMZONE = 0; Vold_taille = 0; SPEED_FLAG = 0; - SPEED_PTR = PTRNUL; + SPEED_PTR = g_PTRNUL; SPEED_X = 0; SPEED_Y = 0; SPEED_IMAGE = 0; FORCEZONE = 1; _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; - _vm->_globals.chemin = PTRNUL; - if (_vm->_globals.COUCOU != PTRNUL) + _vm->_globals.chemin = g_PTRNUL; + if (_vm->_globals.COUCOU != g_PTRNUL) _vm->_globals.COUCOU = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.COUCOU); - if (PTRNUL != _vm->_globals.SPRITE_ECRAN) + if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager.start_x = 0; _vm->_eventsManager.souris_n = 0; @@ -2432,7 +2432,7 @@ void ObjectsManager::CLEAR_ECRAN() { FORCEZONE = 1; CHANGEVERBE = 0; _vm->_globals.NOSPRECRAN = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; g_old_sens = -1; my_anim = 1; A_ANIM = 0; @@ -2493,7 +2493,7 @@ void ObjectsManager::INVENT() { _vm->_eventsManager.VBL(); ++v1; } while (v1 <= 1); - _vm->_globals.Winventaire = PTRNUL; + _vm->_globals.Winventaire = g_PTRNUL; LABEL_7: _vm->_eventsManager.souris_bb = 0; _vm->_eventsManager.souris_b = 0; @@ -2594,7 +2594,7 @@ LABEL_7: _vm->_globals.SORTIE = 0; if (v20 != 1) { inventaire2 = _vm->_globals.dos_free2(inventaire2); - if (PTRNUL != _vm->_globals.Winventaire) + if (g_PTRNUL != _vm->_globals.Winventaire) _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); goto LABEL_7; } @@ -2619,7 +2619,7 @@ LABEL_7: _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); BOBTOUS = 1; } - if (PTRNUL != _vm->_globals.Winventaire) + if (g_PTRNUL != _vm->_globals.Winventaire) _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); inventaire2 = _vm->_globals.dos_free2(inventaire2); if (_vm->_eventsManager.btsouris == 1) @@ -2653,7 +2653,7 @@ void ObjectsManager::CHANGE_TETE(int a1, int a2) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, 532, 25, 65, 40, _vm->_graphicsManager.VESA_BUFFER, 532, 25); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; if (a1 == 2) { if (!a2) { if (_vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { @@ -3246,7 +3246,7 @@ LABEL_88: _vm->_globals.super_parcours[v61 + 3] = -1; result = (byte *)&_vm->_globals.super_parcours[0]; } else { - result = PTRNUL; + result = g_PTRNUL; } return result; } @@ -3760,12 +3760,12 @@ void ObjectsManager::OPTI_OBJET() { file = "OBJET1.ini"; data = _vm->_fileManager.RECHERCHE_CAT(file, 1); - if (data == PTRNUL) { + if (data == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); data = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } - if ((data == PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { + if ((data == g_PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { error("Not an INI file"); } else { v7 = 0; @@ -4754,7 +4754,7 @@ LABEL_1141: } if (v76 == 46) { _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; v13 = YSPR(0); v14 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); @@ -4762,7 +4762,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SPRITE_OFF(0); _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); @@ -4825,7 +4825,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; v16 = YSPR(0); v17 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); @@ -4833,7 +4833,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SPRITE_OFF(0); BOBANIM_ON(7); SET_BOBPOSI(7, 0); @@ -4945,7 +4945,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; v22 = YSPR(0); v23 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); @@ -4953,7 +4953,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SPRITE_OFF(0); BOBANIM_ON(11); BOBANIM_ON(8); @@ -5167,7 +5167,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { v27 = YSPR(0); v28 = XSPR(0); @@ -5187,7 +5187,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SPRITE_OFF(0); SETANISPR(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); @@ -5375,7 +5375,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 0; } _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; v37 = YSPR(0); v38 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); @@ -5384,7 +5384,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SETANISPR(0, 64); _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; _vm->_globals.DESACTIVE_INVENT = 0; @@ -5400,7 +5400,7 @@ LABEL_1141: while (BOBPOSI(1) != 9); BOBANIM_OFF(1); _vm->_globals.NO_VISU = 1; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v39 = YSPR(0); v40 = XSPR(0); @@ -5410,7 +5410,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SETANISPR(0, 64); BOBANIM_ON(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); @@ -5524,7 +5524,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v43 = YSPR(0); v44 = XSPR(0); @@ -5533,7 +5533,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SPRITE_OFF(0); v45 = 0; BOBANIM_ON(7); @@ -6011,7 +6011,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v55 = YSPR(0); v56 = XSPR(0); @@ -6021,7 +6021,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); _vm->_globals.SORTIE = 59; } if (v76 == 173) { @@ -6032,7 +6032,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v57 = YSPR(0); v58 = XSPR(0); @@ -6042,7 +6042,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); _vm->_globals.SORTIE = 59; } if (v76 == 174) @@ -6152,7 +6152,7 @@ void ObjectsManager::VBOB(byte *a1, int idx, int a3, int a4, int a5) { _vm->_globals.VBob[idx].field18 = a5; _vm->_globals.VBob[idx].field0 = a1; _vm->_globals.VBob[idx].field1C = a1; - if (_vm->_globals.VBob[idx].field10 != PTRNUL) + if (_vm->_globals.VBob[idx].field10 != g_PTRNUL) _vm->_globals.VBob[idx].field10 = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); } @@ -6182,7 +6182,7 @@ void ObjectsManager::VBOB_OFF(int idx) { void ObjectsManager::ACTION_DOS(int idx) { if (_vm->_globals.GESTE_FLAG != 1) { - if (PTRNUL != _vm->_globals.GESTE) + if (g_PTRNUL != _vm->_globals.GESTE) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 1; @@ -6219,7 +6219,7 @@ void ObjectsManager::ACTION_DOS(int idx) { void ObjectsManager::ACTION_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { - if (_vm->_globals.GESTE != PTRNUL) + if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); @@ -6249,7 +6249,7 @@ void ObjectsManager::ACTION_DROITE(int idx) { void ObjectsManager::Q_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { - if (_vm->_globals.GESTE != PTRNUL) + if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); @@ -6279,7 +6279,7 @@ void ObjectsManager::Q_DROITE(int idx) { void ObjectsManager::ACTION_FACE(int idx) { if (_vm->_globals.GESTE_FLAG != 2) { - if (_vm->_globals.GESTE != PTRNUL) + if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; _vm->_fileManager.CONSTRUIT_SYSTEM("FACE.SPR"); @@ -6297,7 +6297,7 @@ void ObjectsManager::ACTION_FACE(int idx) { void ObjectsManager::Q_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { - if (_vm->_globals.GESTE != PTRNUL) + if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); @@ -6327,7 +6327,7 @@ void ObjectsManager::Q_GAUCHE(int idx) { void ObjectsManager::ACTION_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { - if (_vm->_globals.GESTE != PTRNUL) + if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); @@ -6487,7 +6487,7 @@ void ObjectsManager::INILINK(const Common::String &file) { filename = file + ".LNK"; ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 3); nbytes = _vm->_globals.CAT_TAILLE; - if (ptr == PTRNUL) { + if (ptr == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); if (!f.open(_vm->_globals.NFICHIER)) @@ -6495,7 +6495,7 @@ void ObjectsManager::INILINK(const Common::String &file) { nbytes = f.size(); ptr = _vm->_globals.dos_malloc2(nbytes); - if (PTRNUL == ptr) + if (g_PTRNUL == ptr) error("INILINK"); _vm->_fileManager.bload_it(f, ptr, nbytes); f.close(); @@ -6510,7 +6510,7 @@ void ObjectsManager::INILINK(const Common::String &file) { if (!filename2.empty()) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.RECHERCHE_CAT(filename2, 8); - if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == PTRNUL) { + if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { _vm->_globals.CAT_FLAG = 0; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); } else { @@ -7179,7 +7179,7 @@ int ObjectsManager::colision(int a1, int a2) { do { byte *srcP = _vm->_linesManager.LigneZone[v8].field4; - if (srcP != PTRNUL) { + if (srcP != g_PTRNUL) { bool flag = true; int v11 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2); int dataV2 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2 + 2); @@ -7535,7 +7535,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.PLAN_FLAG = 0; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_globals.NOMARCHE = 1; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; @@ -7557,7 +7557,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s if (_vm->_globals.ECRAN == 61) { SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); SPRITE_ON(0); - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; VERIFTAILLE(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -7580,7 +7580,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; v7 = YSPR(0); v8 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); @@ -7588,7 +7588,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != PTRNUL); + } while (_vm->_globals.chemin != g_PTRNUL); SETANISPR(0, 64); } do { @@ -7702,7 +7702,7 @@ LABEL_70: _vm->_objectsManager.VERIFTAILLE(); SPRITE_ON(0); _vm->_globals.CACHE_ON(); - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_objectsManager.VERIFTAILLE(); SPECIAL_INI(s2); _vm->_eventsManager.souris_n = 4; @@ -7734,7 +7734,7 @@ LABEL_70: v10 = yp; if (v12 == xp) { if (v11 == yp) { - _vm->_globals.chemin = PTRNUL; + _vm->_globals.chemin = g_PTRNUL; _vm->_objectsManager.PARADISE(); if (_vm->_globals.SORTIE) v13 = 1; @@ -7751,7 +7751,7 @@ LABEL_70: if (!_vm->_globals.SORTIE) { TEST_INVENT(); _vm->_objectsManager.VERIFZONE(); - if (_vm->_globals.chemin == PTRNUL || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == PTRNUL)) { + if (_vm->_globals.chemin == g_PTRNUL || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == g_PTRNUL)) { if (_vm->_objectsManager.GOACTION == 1) _vm->_objectsManager.PARADISE(); } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f792f4d898..589183157a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -62,7 +62,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_globals.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == PTRNUL) { + if (BUFFERPERSO == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); @@ -193,7 +193,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_objectsManager.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == PTRNUL) { + if (BUFFERPERSO == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); @@ -638,7 +638,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { f.seek(READ_LE_UINT32(&indexData[idx * 4])); ptr = _vm->_globals.dos_malloc2(2058); - if (ptr == PTRNUL) + if (ptr == g_PTRNUL) error("temporary TEXT"); f.read(ptr, 2048); f.close(); @@ -831,10 +831,10 @@ void TalkManager::ANIM_PERSO_INIT() { void TalkManager::CLEAR_ANIM_PERSO() { for (int idx = 21; idx <= 34; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].data != PTRNUL) + if (_vm->_globals.Bqe_Anim[idx].data != g_PTRNUL) _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); - _vm->_globals.Bqe_Anim[idx].data = PTRNUL; + _vm->_globals.Bqe_Anim[idx].data = g_PTRNUL; _vm->_globals.Bqe_Anim[idx].field4 = 0; } } @@ -879,8 +879,8 @@ bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int v7 = 1; if (v18 > a4) { _vm->_globals.Bqe_Anim[a1].field4 = 0; - result = PTRNUL; - _vm->_globals.Bqe_Anim[v20].data = PTRNUL; + result = g_PTRNUL; + _vm->_globals.Bqe_Anim[v20].data = g_PTRNUL; } ++v18; ++v6; @@ -955,7 +955,7 @@ void TalkManager::REPONSE(int a1, int a2) { v3 = a2; LABEL_2: v15 = 0; - if (PTRNUL != _vm->_globals.COUCOU) { + if (g_PTRNUL != _vm->_globals.COUCOU) { v5 = _vm->_globals.COUCOU; while (1) { if (*v5 == 'C') { @@ -975,7 +975,7 @@ LABEL_2: if (v15 == 1) { v6 = v5 + 5; ptr = _vm->_globals.dos_malloc2(0x26Cu); - if (PTRNUL == ptr) + if (g_PTRNUL == ptr) error("TRADUC"); memset(ptr, 0, 0x26Bu); v7 = 0; @@ -1183,7 +1183,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_eventsManager.CHANGE_MOUSE(0); BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(a2, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == PTRNUL) { + if (BUFFERPERSO == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, a2); BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); @@ -1224,7 +1224,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { CHERCHE_PAL(v10, 1); CHERCHE_ANIM0(v10, 0); v11 = _vm->_globals.COUCOU; - _vm->_globals.COUCOU = PTRNUL; + _vm->_globals.COUCOU = g_PTRNUL; _vm->_globals.NOMARCHE = 1; _vm->_objectsManager.INILINK(v22); _vm->_objectsManager.PERSO_ON = 1; -- cgit v1.2.3 From af126becb590d9cdc11e0d3f41f88ea38e6f06df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 22:13:27 +1100 Subject: HOPKINS: Changed some more constant values to character literals --- engines/hopkins/objects.cpp | 52 ++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 617f9cb6e7..908dc4ec95 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3979,9 +3979,6 @@ int ObjectsManager::Traduction(byte *a1) { int v58; int v59; int v60; - int v61; - int v62; - int v63; int v65; int v66; int v67; @@ -3994,12 +3991,8 @@ int ObjectsManager::Traduction(byte *a1) { int v74; int v75; int v76; - char v77[12]; + Common::String v77; Common::String s; - char v79; - char v80; - char v81; - char v82[16]; v1 = 0; v70 = 0; @@ -6054,65 +6047,48 @@ LABEL_1141: } v1 = 1; } - if (*(a1 + 2) == 69 && *(a1 + 3) == 73 && *(a1 + 4) == 70) + if (*(a1 + 2) == 'E' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') v1 = 4; - if (*(a1 + 2) == 86 && *(a1 + 3) == 65 && *(a1 + 4) == 76) { + if (*(a1 + 2) == 'V' && *(a1 + 3) == 'A' && *(a1 + 4) == 'L') { v1 = 1; _vm->_globals.SAUVEGARDE->data[READ_LE_UINT16(a1 + 5)] = READ_LE_UINT16(a1 + 7); } - if (*(a1 + 2) == 65 && *(a1 + 3) == 68 && *(a1 + 4) == 68) { + if (*(a1 + 2) == 'A' && *(a1 + 3) == 'D' && *(a1 + 4) == 'D') { v1 = 1; _vm->_globals.SAUVEGARDE->data[READ_LE_UINT16(a1 + 5)] += *(a1 + 7); } - if (*(a1 + 2) == 66 && *(a1 + 3) == 79 && *(a1 + 4) == 83) { + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'S') { v1 = 1; BOB_OFFSET(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); } - if (*(a1 + 2) == 86 && *(a1 + 3) == 79 && *(a1 + 4) == 78) { + if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'N') { VERBE_ON(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); v1 = 1; } - if (*(a1 + 2) == 90 && *(a1 + 3) == 67 && *(a1 + 4) == 72) { + if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'C' && *(a1 + 4) == 'H') { _vm->_globals.ZONEP[READ_LE_UINT16(a1 + 5)].field12 = READ_LE_UINT16(a1 + 7); v1 = 1; } - if (*(a1 + 2) == 74 && *(a1 + 3) == 85 && *(a1 + 4) == 77) { + if (*(a1 + 2) == 'J' && *(a1 + 3) == 'U' && *(a1 + 4) == 'M') { v59 = READ_LE_UINT16(a1 + 7); NVZONE = READ_LE_UINT16(a1 + 5); NVVERBE = v59; v1 = 6; } - if (*(a1 + 2) == 83 && *(a1 + 3) == 79 && *(a1 + 4) == 85) { + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { v60 = READ_LE_UINT16(a1 + 5); memset(&s, 0, 0x13u); - memset(v77, 0, 5u); - sprintf(v77, "%d", v60); - s = 83; - v79 = 79; - v80 = 85; - v81 = 78; - v82[0] = 68; - v61 = 5; - v62 = 0; - do - *(&s + v61++) = v77[v62++]; - while (v77[v62]); - v63 = v61; - *(&s + v63) = 46; - *(&v79 + v63) = 87; - *(&v80 + v63) = 65; - *(&v81 + v63) = 86; - v82[v63] = 0; + + v77 = Common::String::format("SOUND%d.WAV", v60); _vm->_soundManager.PLAY_SOUND(s); v1 = 1; } - if (*(a1 + 2) == 86 && *(a1 + 3) == 79 && *(a1 + 4) == 70) { + if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { VERBE_OFF(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); v1 = 1; } - if (*(a1 + 2) == 73 && *(a1 + 3) == 73) { - if (*(a1 + 4) == 70) - v1 = 3; + if (*(a1 + 2) == 'I' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') { + v1 = 3; } return v1; -- cgit v1.2.3 From 971f51ce01ea7afcb43c9eef3a7941449319cd63 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 22:16:45 +1100 Subject: HOPKINS: Add missing constant values for SauvegardeOffset enumeration --- engines/hopkins/globals.h | 120 +++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 70b62a5d71..29324e63c0 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -206,66 +206,66 @@ struct Sauvegarde1 { }; enum SauvegardeOffset { - svField1 - , svField2 - , svField3 - , svField4 - , svField5 - , svField6 - , svField8 - , svField9 - , svField10 - , svField13 - , svField80 - , svField94 - , svField95 - , svField121 - , svField122 - , svField132 - , svField133 - , svField170 - , svField171 - , svField172 - , svField173 - , svField176 - , svField180 - , svField181 - , svField182 - , svField183 - , svField184 - , svField185 - , svField186 - , svField187 - , svField188 - , svField189 - , svField190 - , svField191 - , svField192 - , svField193 - , svField194 - , svField228 - , svField253 - , svField231 - , svField261 - , svField270 - , svField300 - , svField318 - , svField320 - , svField333 - , svField338 - , svField339 - , svField340 - , svField341 - , svField349 - , svField352 - , svField353 - , svField354 - , svField355 - , svField356 - , svField357 - , svField399 - , svField401 - , svField1300 + svField1 = 1 + , svField2 = 2 + , svField3 = 3 + , svField4 = 4 + , svField5 = 5 + , svField6 = 6 + , svField8 = 8 + , svField9 = 9 + , svField10 = 10 + , svField13 = 13 + , svField80 = 80 + , svField94 = 94 + , svField95 = 95 + , svField121 = 121 + , svField122 = 122 + , svField132 = 132 + , svField133 = 133 + , svField170 = 170 + , svField171 = 171 + , svField172 = 172 + , svField173 = 173 + , svField176 = 176 + , svField180 = 180 + , svField181 = 181 + , svField182 = 182 + , svField183 = 183 + , svField184 = 184 + , svField185 = 185 + , svField186 = 186 + , svField187 = 187 + , svField188 = 188 + , svField189 = 189 + , svField190 = 190 + , svField191 = 191 + , svField192 = 192 + , svField193 = 193 + , svField194 = 194 + , svField228 = 228 + , svField231 = 231 + , svField253 = 253 + , svField261 = 261 + , svField270 = 270 + , svField300 = 300 + , svField318 = 318 + , svField320 = 320 + , svField333 = 333 + , svField338 = 338 + , svField339 = 339 + , svField340 = 340 + , svField341 = 341 + , svField349 = 349 + , svField352 = 352 + , svField353 = 353 + , svField354 = 354 + , svField355 = 355 + , svField356 = 356 + , svField357 = 357 + , svField399 = 399 + , svField401 = 401 + , svField1300 = 1300 }; // TODO: Sauvegrade1 fields should really be mapped into data array -- cgit v1.2.3 From d0487f5d9f8cc481ac6a8d1e1752fbb112cdffc6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 22:33:44 +1100 Subject: HOPKINS: Bugfix to not call core setPalette in 16-bit mode --- engines/hopkins/graphics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 04c43c966b..0761c45149 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1011,7 +1011,9 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { cmap[v8 + 2] = bv; WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); - g_system->getPaletteManager()->setPalette(cmap, palIndex, 1); + + if (Winbpp == 1) + g_system->getPaletteManager()->setPalette(cmap, palIndex, 1); } void GraphicsManager::CHANGE_PALETTE(const byte *palette) { @@ -2343,7 +2345,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { v13 = file + ".ini"; ptr = _vm->_fileManager.RECHERCHE_CAT(v13, 1); - if (g_PTRNUL == ptr) { + if (ptr == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } -- cgit v1.2.3 From 089ca4782be7ed80cdadaa2b3df2f95c6b2e860d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Oct 2012 23:45:40 +1100 Subject: HOPKINS: Renamed fields of ListeTxtItem class --- engines/hopkins/font.cpp | 14 ++++---- engines/hopkins/font.h | 22 ++++++------ engines/hopkins/objects.cpp | 86 ++++++++++++++++++++++----------------------- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index f8d18a24c1..9049f82eee 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -42,11 +42,11 @@ void FontManager::clearAll() { Txt[idx].field3FC = 0; Txt[idx].field3FE = 0; Txt[idx].field400 = 0; - Txt[idx].field404 = 0; - Txt[idx].field406 = 0; + Txt[idx].width = 0; + Txt[idx].height = 0; Txt[idx].field408 = 0; - ListeTxt[idx].field0 = 0; + ListeTxt[idx].enabled = false; } } @@ -90,15 +90,15 @@ void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { COUL_TXT(idx4, 253); } -void FontManager::DOS_TEXT(int idx, int a2, const Common::String &filename, int a4, int a5, int a6, int a7, int a8, int a9, int a10) { +void FontManager::DOS_TEXT(int idx, int a2, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10) { if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); TxtItem &txt = Txt[idx - 5]; txt.field0 = 0; - txt.field4 = filename; - txt.field8 = a4; - txt.fieldA = a5; + txt.filename = filename; + txt.xp = xp; + txt.yp = yp; txt.fieldC = a2; txt.fieldE = a6; txt.field10 = a7; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 89f74ca673..653757a9e1 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -33,9 +33,9 @@ class HopkinsEngine; struct TxtItem { int field0; int field2; - Common::String field4; - int field8; - int fieldA; + Common::String filename; + int16 xp; + int16 yp; int fieldC; int fieldE; int field10; @@ -44,18 +44,18 @@ struct TxtItem { int field3FC; int field3FE; byte *field400; - int field404; - int field406; + int16 width; + int16 height; int field408; int field40A; }; struct ListeTxtItem { - int field0; - int x1; - int y1; - int x2; - int y2; + bool enabled; + int16 xp; + int16 yp; + int16 width; + int16 height; }; @@ -78,7 +78,7 @@ public: void TEXTE_OFF(int idx); void COUL_TXT(int idx, byte colByte); void OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4); - void DOS_TEXT(int idx, int a2, const Common::String &filename, int a4, int a5, int a6, int a7, int a8, int a9, int a10); + void DOS_TEXT(int idx, int a2, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10); void BOITE(int idx, int a2, const Common::String &filename, int xp, int yp); void TEXT_NOW1(int xp, int yp, const Common::String &message, int transColour); }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 908dc4ec95..d76352ac0e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -332,13 +332,13 @@ void ObjectsManager::AFF_SPRITES() { int v19; int v20; int v21; - int v23; - int v24; + int y1_1; + int y1_2; int v25; int v26; int v27; - int v28; - int v29; + int x1_1; + int x1_2; int v30; int v31; int v32; @@ -354,17 +354,17 @@ void ObjectsManager::AFF_SPRITES() { v30 = 0; do { v0 = v30; - if (_vm->_fontManager.ListeTxt[v0].field0 && _vm->_fontManager.Txt[v30].field3FC != 2) { - v1 = _vm->_fontManager.ListeTxt[v30].x1; - v28 = v1 - 2; + if (_vm->_fontManager.ListeTxt[v0].enabled && _vm->_fontManager.Txt[v30].field3FC != 2) { + v1 = _vm->_fontManager.ListeTxt[v30].xp; + x1_1 = v1 - 2; if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) - v28 = _vm->_graphicsManager.min_x; - v2 = _vm->_fontManager.ListeTxt[v30].y1; - v23 = v2 - 2; + x1_1 = _vm->_graphicsManager.min_x; + v2 = _vm->_fontManager.ListeTxt[v30].yp; + y1_1 = v2 - 2; if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) - v23 = _vm->_graphicsManager.min_y; + y1_1 = _vm->_graphicsManager.min_y; destX = v1 - 2; if (destX < _vm->_graphicsManager.min_x) destX = _vm->_graphicsManager.min_x; @@ -372,11 +372,11 @@ void ObjectsManager::AFF_SPRITES() { if (destY < _vm->_graphicsManager.min_y) destY = _vm->_graphicsManager.min_y; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v28, v23, - _vm->_fontManager.ListeTxt[v30].x2 + 4, _vm->_fontManager.ListeTxt[destX].y2 + 4, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_1, y1_1, + _vm->_fontManager.ListeTxt[v30].width + 4, _vm->_fontManager.ListeTxt[destX].height + 4, _vm->_graphicsManager.VESA_BUFFER, destX, destY); - _vm->_fontManager.ListeTxt[v0].field0 = 0; + _vm->_fontManager.ListeTxt[v0].enabled = false; } ++v30; } while (v30 <= 10); @@ -387,13 +387,13 @@ void ObjectsManager::AFF_SPRITES() { v5 = v31; if (_vm->_globals.Liste[v5].field0) { v6 = _vm->_globals.Liste[v5].field2; - v29 = v6 - 2; + x1_2 = v6 - 2; if ((int16)(v6 - 2) < _vm->_graphicsManager.min_x) - v29 = _vm->_graphicsManager.min_x; + x1_2 = _vm->_graphicsManager.min_x; v7 = _vm->_globals.Liste[v31].field4; - v24 = v7 - 2; + y1_2 = v7 - 2; if ((int16)(v7 - 2) < _vm->_graphicsManager.min_y) - v24 = _vm->_graphicsManager.min_y; + y1_2 = _vm->_graphicsManager.min_y; v8 = v6 - 2; if (v8 < _vm->_graphicsManager.min_x) v8 = _vm->_graphicsManager.min_x; @@ -401,7 +401,7 @@ void ObjectsManager::AFF_SPRITES() { if (v9 < _vm->_graphicsManager.min_y) v9 = _vm->_graphicsManager.min_y; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v29, v24, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_2, y1_2, _vm->_globals.Liste[v31].width + 4, _vm->_globals.Liste[v31].height + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); _vm->_globals.Liste[v5].field0 = 0; @@ -541,41 +541,41 @@ void ObjectsManager::AFF_SPRITES() { if (_vm->_fontManager.Txt[v16].field0 == 1) { if ((uint16)(_vm->_fontManager.Txt[v16].field3FC - 2) > 1) _vm->_fontManager.BOITE(v38, - _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].field4, - _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].field8, _vm->_fontManager.Txt[v16].fieldA); + _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].filename, + _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].xp, _vm->_fontManager.Txt[v16].yp); else _vm->_fontManager.BOITE( v38, _vm->_fontManager.Txt[v16].fieldC, - _vm->_fontManager.Txt[v16].field4, - _vm->_fontManager.Txt[v16].field8, - _vm->_fontManager.Txt[v16].fieldA); - _vm->_fontManager.ListeTxt[v38].field0 = 1; + _vm->_fontManager.Txt[v16].filename, + _vm->_fontManager.Txt[v16].xp, + _vm->_fontManager.Txt[v16].yp); + _vm->_fontManager.ListeTxt[v38].enabled = true; v17 = v38; if ((uint16)(_vm->_fontManager.Txt[v17].field3FC - 2) > 1) - _vm->_fontManager.ListeTxt[v38].x1 = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].field8; + _vm->_fontManager.ListeTxt[v38].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].xp; else - _vm->_fontManager.ListeTxt[v38].x1 = _vm->_fontManager.Txt[v17].field8; + _vm->_fontManager.ListeTxt[v38].xp = _vm->_fontManager.Txt[v17].xp; v18 = v38; v19 = v38; - _vm->_fontManager.ListeTxt[v18].y1 = _vm->_fontManager.Txt[v19].fieldA; - _vm->_fontManager.ListeTxt[v18].x2 = _vm->_fontManager.Txt[v19].field404; - _vm->_fontManager.ListeTxt[v18].y2 = _vm->_fontManager.Txt[v19].field406; - - if (_vm->_fontManager.ListeTxt[v38].x1 < _vm->_graphicsManager.min_x) - _vm->_fontManager.ListeTxt[v38].x1 = _vm->_graphicsManager.min_x - 1; - if (_vm->_fontManager.ListeTxt[v38].y1 < _vm->_graphicsManager.min_y) - _vm->_fontManager.ListeTxt[v38].y1 = _vm->_graphicsManager.min_y - 1; - v20 = _vm->_fontManager.ListeTxt[v38].x1; - if (_vm->_fontManager.ListeTxt[v38].x2 + v20 > _vm->_graphicsManager.max_x) - _vm->_fontManager.ListeTxt[v38].x2 = _vm->_graphicsManager.max_x - v20; - v21 = _vm->_fontManager.ListeTxt[v38].y1; - if (_vm->_fontManager.ListeTxt[v38].y2 + v21 > _vm->_graphicsManager.max_y) - _vm->_fontManager.ListeTxt[v38].y2 = _vm->_graphicsManager.max_y - v21; - if (_vm->_fontManager.ListeTxt[v38].x2 <= 0 || _vm->_fontManager.ListeTxt[v38].y2 <= 0) - _vm->_fontManager.ListeTxt[v18].field0 = 0; + _vm->_fontManager.ListeTxt[v18].yp = _vm->_fontManager.Txt[v19].yp; + _vm->_fontManager.ListeTxt[v18].width = _vm->_fontManager.Txt[v19].width; + _vm->_fontManager.ListeTxt[v18].height = _vm->_fontManager.Txt[v19].height; + + if (_vm->_fontManager.ListeTxt[v38].xp < _vm->_graphicsManager.min_x) + _vm->_fontManager.ListeTxt[v38].xp = _vm->_graphicsManager.min_x - 1; + if (_vm->_fontManager.ListeTxt[v38].yp < _vm->_graphicsManager.min_y) + _vm->_fontManager.ListeTxt[v38].yp = _vm->_graphicsManager.min_y - 1; + v20 = _vm->_fontManager.ListeTxt[v38].xp; + if (_vm->_fontManager.ListeTxt[v38].width + v20 > _vm->_graphicsManager.max_x) + _vm->_fontManager.ListeTxt[v38].width = _vm->_graphicsManager.max_x - v20; + v21 = _vm->_fontManager.ListeTxt[v38].yp; + if (_vm->_fontManager.ListeTxt[v38].height + v21 > _vm->_graphicsManager.max_y) + _vm->_fontManager.ListeTxt[v38].height = _vm->_graphicsManager.max_y - v21; + if (_vm->_fontManager.ListeTxt[v38].width <= 0 || _vm->_fontManager.ListeTxt[v38].height <= 0) + _vm->_fontManager.ListeTxt[v18].enabled = false; } ++v38; } while (v38 <= 10); -- cgit v1.2.3 From d8dd04130a3ea4018f26467f86a9e0bebe24bf5c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 11 Oct 2012 22:53:59 +1100 Subject: HOPKINS: Implemented missing BOITE function in the font manager --- engines/hopkins/font.cpp | 367 +++++++++++++++++++------------------------ engines/hopkins/graphics.cpp | 18 +++ engines/hopkins/graphics.h | 2 + 3 files changed, 178 insertions(+), 209 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 9049f82eee..aa0c1741a7 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/file.h" #include "common/textconsole.h" #include "hopkins/font.h" #include "hopkins/files.h" @@ -108,91 +109,80 @@ void FontManager::DOS_TEXT(int idx, int a2, const Common::String &filename, int } void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int xp, int yp) { - /* There's something seriously wrong with the automatic disassembly.. it seems to have - * an extra code end block. I'll likely need to manually disassemble the method - - byte *v5; - int v6; - int v7; - int v8; + int filesize; byte *v9; - const byte *v10; + const byte *v10; int v11; - int v12; - char v13; - char v14; - int v15; + char v13; + char v14; + int v15; char v16; int v17; - int v18; - int v19; + int v18; + int v19; int v20; int v21; int v22; - int v23; + int v23; char v24; int v25; int v26; int v27; int v28; int v29; - int v30; + int v30; int v31; int v32; - int v33; + int v33; int v34; int v35; int v36; - int v37; - int v38; - int v39; + int v37; + int v38; int v40; - int ptr; - char *ptra; - int ptrb; + int ptrb; int ptrc; - void *ptrd; - void *ptre; - int s; + byte *ptrd; + byte *ptre; + Common::String s; int v49; int v50; - int v51; - int v52; - int v53; + int v51; + int v52; + int v53; int v54; int v55; int v56; int v57; int v58; - void *v59; - void *v60; - void *v61; + byte *v59; + byte *v60; + byte *v61; int v62; int v63; int v64; int v65; int v66; - int v67; + int v67; int v68; - int v69; - int v70; - int v71; - int v72; - int v73; + int v69; + int v70; + int v71; + int v72; + int v73; int i; int v75; - Common::String fname; + Common::String file; + Common::File f; v73 = xp; v70 = yp; v58 = 0; if (idx < 0) error("Bad number for text"); - _vm->_globals.police_l = 11; - v5 = idx; - largeur_boite = 11 * Txt[idx].field3FE; + _vm->_globals.largeur_boite = 11 * Txt[idx].field3FE; if (Txt[idx].field408) { v34 = Txt[idx].field3FC; if (v34 != 6 && v34 != 1 && v34 != 3 && v34 != 5) { @@ -202,81 +192,76 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, do { v40 = idx; TEXT_NOW1(xp + 5, v72, Txt[idx].field14[v38], Txt[idx].field40A); - v5 = police_h + v72 + 1; - v72 += police_h + 1; + v72 += _vm->_globals.police_h + 1; ++v38; idx = v40; } while (Txt[v40].field12 > v38); } } else { v35 = idx; - v36 = *(_WORD *)&Txt[v35 + 1030]; - v37 = *(_WORD *)&Txt[v35 + 1028]; - - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, - Txt[v35].field400, xp, yp, Txt[v35].field404, Txt[v35].field406); - v5 = _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); + v36 = Txt[v35].height; + v37 = Txt[v35].width; + _vm->_graphicsManager.Restore_Mem( + _vm->_graphicsManager.VESA_BUFFER, + Txt[v35].field400, + xp, + yp, + Txt[v35].width, + Txt[v35].height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); } } else { v62 = 0; do { TRIER_TEXT[v62++] = 0; - while (v62 <= 19); - - &Txt[idx].field408 = 1; - _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, filename); - fname = _vm->_globals.NFICHIER; - - if (strncmp(fname.c_str(), oldname.c_str(), fname.size())) { - oldname = fname; - nom_indexoldname = fname; - - // *(int *)((char *)&dword_80AE4DC + strlen(nom_index) + 1) = dword_807C98D; - Common::File f; + } while (v62 <= 19); + Txt[idx].field408 = 1; + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); + + file = _vm->_globals.NFICHIER; + if (strncmp(file.c_str(), oldname.c_str(), strlen(file.c_str()))) { + oldname = file; + nom_index = file; + + //*(int *)((char *)&dword_80AE4DC + strlen(nom_index) + 1) = dword_807C98D; if (!f.open(nom_index)) - error("error opening file - %s", nom_index.c_str()); - - int fileSize = f.size(); - for (int i = 0; i < (fileSize / 4); ++i) + error("Error opening file - %s", nom_index.c_str()); + filesize = f.size(); + for (int i = 0; i < (filesize / 4); ++i) Index[i] = f.readUint32LE(); f.close(); } - - if (fname[0] != 'Z' || fname[1] != 'O') { - Common::File f; - if (!f.open(fname)) - error("error opening file - %s", fname.c_str()); + if (filename[0] != 'Z' || filename[1] != 'O') { + if (!f.open(file)) + error("Error opening file - %s", nom_index.c_str()); v69 = 2048; f.seek(Index[fileIndex]); - texte_tmp = _vm->_globals.dos_malloc2(2058); + + texte_tmp = _vm->_globals.dos_malloc2(0x80Au); if (texte_tmp == g_PTRNUL) - error("temporary text"); - - f.read(texte_temp, 2048); + error("Error allocating text"); + + f.read(texte_tmp, 0x800u); f.close(); - texte_long = 2048; + _vm->_globals.texte_long = 2048; } else { v69 = 100; - texte_long = 100; - v9 = _vm->_globals.dos_malloc2(110); + _vm->_globals.texte_long = 100; + v9 = _vm->_globals.dos_malloc2(0x6Eu); texte_tmp = v9; - v10 = BUF_ZONE + Index[fileIndex]; - memcpy(v9, v10, 96); - + v10 = _vm->_globals.BUF_ZONE + Index[fileIndex]; + memcpy(v9, v10, 0x60u); v11 = 0; - WRITE_LE_UINT16((uint16 *)v9 + 48, READ_LE_UINT16((uint16 *)v10 + 48)); + WRITE_LE_UINT16((uint16 *)v9 + 48, READ_LE_UINT16(v10 + 96)); } - v59 = texte_tmp; v63 = 0; - if (!v69) goto LABEL_43; - do { - v13 = v59; - if ((unsigned __int8)(*v59 + 46) > 0x1Bu) { + v13 = *v59; + if ((byte)(*v59 + 46) > 0x1Bu) { if ((unsigned __int8)(v13 + 80) > 0x1Bu) { if ((unsigned __int8)(v13 - 65) <= 0x19u || (unsigned __int8)(v13 - 97) <= 0x19u) v13 = 32; @@ -286,89 +271,74 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, } else { v13 += 111; } - *v59 = v13; v59 = v59 + 1; ++v63; } while (v63 < v69); - v60 = texte_tmp; v64 = 0; if (v69) { - ptr = idx; - - for (;;) { + while (1) { v14 = *(v60 + v64); if (v14 == 10 || v14 == 13) { *(v60 + v64) = 0; - v11 = &Txt[0]; - if (!Txt[ptr].field3FE) +// v11 = (int)Txt; + if (!Txt[idx].field3FE) break; } - ++v64; if (v69 <= v64) goto LABEL_43; } - - Txt[ptr].field3FE = v64; - largeur_boite = 0; - + Txt[idx].field3FE = v64; + _vm->_globals.largeur_boite = 0; + v15 = 0; if (v64 + 1 > 0) { do { v16 = *(v60 + v15); if ((unsigned __int8)v16 <= 0x1Fu) v16 = 32; - largeur_boite += _vm->_objectManager.Get_Largeur(police, (unsigned __int8)v16 - 32); + _vm->_globals.largeur_boite += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v16 - 32); ++v15; } while (v15 < v64 + 1); } - - largeur_boite += 2; - v17 = largeur_boite / 2; + _vm->_globals.largeur_boite += 2; + v17 = _vm->_globals.largeur_boite / 2; if (v17 < 0) v17 = -v17; - *Txt[idx].field8 = 320 - v17; + Txt[idx].xp = 320 - v17; v73 = _vm->_eventsManager.start_x + 320 - v17; v58 = 1; v18 = 0; - if (v64 + 1 > 0) { - ptra = Txt[ptr]; - do { - ptra.field14[v18].field0 = *(v60 + v18); + Txt[idx].field14[v18] = *(v60 + v18); ++v18; } while (v18 < v64 + 1); } } else { LABEL_43: - - if (!largeur_boite) - largeur_boite = 240; + if (!_vm->_globals.largeur_boite) + _vm->_globals.largeur_boite = 240; v65 = 0; v61 = texte_tmp; - do { v19 = 0; - ptrb = largeur_boite - 4; - - for (;;) { + ptrb = _vm->_globals.largeur_boite - 4; + while (1) { v57 = v19; - do { + do v11 = *(v61 + v65 + v19++); - } while (v11 != 32 && v11 != 37); - - if (v19 >= ptrb / police_l) + while (v11 != 32 && v11 != 37); + if (v19 >= ptrb / _vm->_globals.police_l) break; if (v11 == 37) { - if (v19 < ptrb / police_l) + if (v19 < ptrb / _vm->_globals.police_l) goto LABEL_55; break; } } - if (v11 != 37) goto LABEL_57; v11 = 32; @@ -378,15 +348,12 @@ LABEL_55: LABEL_57: v20 = v58; v21 = v11; - - Txt[idx].field14[v20] = (const char *)v61 + v65; - //strncpy((char *)(v20 + 1036 * idx + 134911728), (const char *)v61 + v65, v57); + Txt[idx].field14[v20] = Common::String((const char *)v61 + v65, v57); TRIER_TEXT[v58++] = v57; - + v65 += v57; v11 = v21; - } while ((byte)v21 != 37); - + } while (v21 != 37); v66 = 0; do { v22 = TRIER_TEXT[v66]; @@ -397,20 +364,17 @@ LABEL_57: v23 = 0; if (v22 - 1 > 0) { do { - v24 = *(&Txt[1036 * idx + 20] + 100 * v66 + v23); - if ((unsigned __int8)v24 <= 0x1Fu) + v24 = Txt[idx].field14[v66][v23]; + if ((byte)v24 <= 0x1Fu) v24 = 32; - - ptrc += _vm->_objectManager.Get_Largeur(police, (unsigned __int8)v24 - 32); + ptrc += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v24 - 32); ++v23; } while (v23 < TRIER_TEXT[v66] - 1); } - TRIER_TEXT[v66] = ptrc; } ++v66; } while (v66 <= 19); - v67 = 0; do { v25 = v67; @@ -420,116 +384,101 @@ LABEL_57: v25 = 0; if (TRIER_TEXT[v67] < TRIER_TEXT[v25]) TRIER_TEXT[v67] = 0; - } while (v25 != v67); + } while (v25 != (signed __int16)v67); ++v67; } while (v67 <= 19); - v68 = 0; do { if (TRIER_TEXT[v68]) - largeur_boite = TRIER_TEXT[v68]; + _vm->_globals.largeur_boite = TRIER_TEXT[v68]; ++v68; } while (v68 <= 19); - - if ((Txt[idx].field3FC - 2) > 1u) { - for (i = xp - _vm->_eventsManager.start_x; largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC]; i -= 2) + + if ((unsigned __int16)(Txt[idx].field3FC - 2) > 1u) { + for (i = xp - _vm->_eventsManager.start_x; _vm->_globals.largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC; i -= 2) ; - Txt[idx].field8 = i; + Txt[idx].xp = i; v73 = _vm->_eventsManager.start_x + i; } else { - if (nbrligne == 639) { - while (largeur_boite + v73 > 638 && v73 > -2) + if (_vm->_globals.nbrligne == (SCREEN_WIDTH - 1)) { + while (_vm->_globals.largeur_boite + v73 > 638 && v73 > -2) v73 -= 2; } - if (nbrligne == (SCREEN_WIDTH * 2)) { - while (largeur_boite + v73 > 1278 && v73 > -2) + if (_vm->_globals.nbrligne == (SCREEN_WIDTH * 2)) { + while (_vm->_globals.largeur_boite + v73 > 1278 && v73 > -2) v73 -= 2; } - Txt[idx].field8 = v73; + Txt[idx].xp = v73; } } - - hauteur_boite = (police_h + 1) * v58 + 2; + _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * v58 + 2; v56 = v73; v55 = yp; - v53 = largeur_boite + 10; - v51 = (police_h + 1) * v58 + 12; - - v26 = idx; + v53 = _vm->_globals.largeur_boite + 10; + v51 = (_vm->_globals.police_h + 1) * v58 + 12; + v26 = 1036 * idx; if (Txt[idx].field3FC == 6) { v27 = v53 / 2; if (v27 < 0) v27 = -v27; - - Txt[v26].field8 = 315 - v27; + Txt[v26].xp = 315 - v27; v28 = _vm->_eventsManager.start_x + 315 - v27; v73 = _vm->_eventsManager.start_x + 315 - v27; - Txt[v26].fieldA = 50; + Txt[v26].yp = 50; v70 = 50; v55 = 50; v56 = v28; } - v29 = Txt[idx].field3FC; - if (v29 == 1 || v29 == 3 || (uint16)(v29 - 5) <= 1u) { + if (v29 == 1 || v29 == 3 || (unsigned __int16)(v29 - 5) <= 1u) { v49 = v51 * v53; ptrd = _vm->_globals.dos_malloc2(v51 * v53); + if (ptrd == g_PTRNUL) { + error("Cutting a block for text box (%d)", v49); + } + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); + _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager.TABLE_COUL, v49); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); + _vm->_globals.dos_free2(ptrd); - if (ptrd == g_PTRNUL) - error("Error allocating block (%d)", v49); + _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, (byte)-2); + _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v51 + v55, v53, (byte)-2); + _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); + _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); } - - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); - _vm->_graphicsManager.Trans_bloc2(ptrd, TABLE_COUL, v49); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); - _vm->_globals.dos_free2(ptrd); - - _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, -2); - _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, (v51 + v55), v53, -2); - _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, -2); - _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, (v53 + v56), v70, v51, -2); - } - - Txt[idx].field12 = v58; - v75 = v73 + 5; - v71 = v70 + 5; - v30 = 0; - - if (v58 > 0) { - do { - TEXT_NOW1(v75, v71, Txt[idx].field14[v30], Txt[idx].field40A); - v71 += police_h + 1; - ++v30; - } while ( v58 > v30 ); - } - - v54 = v53 + 1; - v52 = v51 + 1; - v31 = 1036 * idx; - Txt[v31].field404 = v54; - Txt[v31].field406 = v52; - v32 = Txt[v31].field3FC; - - if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { - v33 = idx; - if (Txt[v33].field400 != g_PTRNUL) - Txt[v33].field400 = _vm->_globals.dos_free2(Txt[v33].field400); - - v50 = v52 * v54; - ptre = dos_malloc2(v50 + 20); - if (ptre == g_PTRNUL) - error("Error allocating block (%d)", v50); - } - - Txt[v33].field400 = ptre; - Txt[v33].field404 = v54; - Txt[v33].field406 = v52; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, Txt[v33].field400, v56, v55, - Txt[v33].field404, v52); + Txt[idx].field12 = v58; + v75 = v73 + 5; + v71 = v70 + 5; + v30 = 0; + if (v58 > 0) { + do { + TEXT_NOW1(v75, v71, Txt[idx].field14[v30], Txt[idx].field40A); + v71 += _vm->_globals.police_h + 1; + ++v30; + } while (v58 > v30); + } + v54 = v53 + 1; + v52 = v51 + 1; + v31 = idx; + Txt[v31].width = v54; + Txt[v31].height = v52; + v32 = Txt[v31].field3FC; + if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { + v33 = idx; + if (Txt[v33].field400 != g_PTRNUL) + Txt[v33].field400 = _vm->_globals.dos_free2(Txt[v33].field400); + v50 = v52 * v54; + ptre = _vm->_globals.dos_malloc2(v50 + 20); + if (ptre == g_PTRNUL) + error("Cutting a block for text box (%d)", v50); + + Txt[v33].field400 = ptre; + Txt[v33].width = v54; + Txt[v33].height = v52; + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, Txt[v33].field400, v56, v55, Txt[v33].width, v52); + } + texte_tmp = _vm->_globals.dos_free2(texte_tmp); } - - texte_tmp = _vm->_globals.dos_free2(texte_tmp); - */ } void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int transColour) { diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0761c45149..9fda73fc95 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2563,4 +2563,22 @@ void GraphicsManager::Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, in } } +void GraphicsManager::Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col) { + memset(surface + xp + nbrligne2 * yp, col, width); +} + +void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, char col) { + byte *v5; + int v6; + + v5 = surface + xp + nbrligne2 * yp; + v6 = height; + do { + *v5 = col; + v5 += nbrligne2; + --v6; + } while (v6); +} + + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e41b37f187..f92e367a2c 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -184,6 +184,8 @@ public: void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7); + void Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col); + void Plot_Vline(byte *surface, int xp, int yp, int height, char col); }; } // End of namespace Hopkins -- cgit v1.2.3 From 721b619398af28037cc595300052af430b9b31a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 11 Oct 2012 22:58:04 +1100 Subject: HOPKINS: Added explicit int16 cast to all READ_LE_UINT16 accesses. I've already previously fixed two initialisatoin errors for data reading that expected int's to be 16 bits and signed, so adding the explicit cast everywhere will likely fix other similiar issues. --- engines/hopkins/anim.cpp | 30 +++--- engines/hopkins/font.cpp | 2 +- engines/hopkins/globals.cpp | 8 +- engines/hopkins/graphics.cpp | 38 +++---- engines/hopkins/lines.cpp | 250 +++++++++++++++++++++---------------------- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 244 ++++++++++++++++++++--------------------- engines/hopkins/talk.cpp | 134 +++++++++++------------ 8 files changed, 354 insertions(+), 354 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 8950437998..0c0924ef67 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -859,10 +859,10 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam if (_vm->_globals.Bank[idx].field1A > 0) { for (int v14 = 0; v14 < _vm->_globals.Bank[idx].field1A; ++v14) { - v16 = READ_LE_UINT16(v13); - v17 = READ_LE_UINT16(v13 + 2); - v21 = READ_LE_UINT16(v13 + 4); - v20 = READ_LE_UINT16(v13 + 6); + v16 = (int16)READ_LE_UINT16(v13); + v17 = (int16)READ_LE_UINT16(v13 + 2); + v21 = (int16)READ_LE_UINT16(v13 + 4); + v20 = (int16)READ_LE_UINT16(v13 + 6); v13 += 8; _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, v14, v16, v17, 0); @@ -953,11 +953,11 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { v9 = dataP + 20; v23 = v21 + data + 25; - v10 = READ_LE_UINT16(v21 + data + 25); - v11 = READ_LE_UINT16(v21 + data + 27); - v22 = READ_LE_UINT16(v21 + data + 29); - v12 = READ_LE_UINT16(v21 + data + 31); - v13 = READ_LE_UINT16(v21 + data + 33); + v10 = (int16)READ_LE_UINT16(v21 + data + 25); + v11 = (int16)READ_LE_UINT16(v21 + data + 27); + v22 = (int16)READ_LE_UINT16(v21 + data + 29); + v12 = (int16)READ_LE_UINT16(v21 + data + 31); + v13 = (int16)READ_LE_UINT16(v21 + data + 33); *(dataP + 29) = *(v21 + data + 34); WRITE_LE_UINT16(dataP + 20, v10); WRITE_LE_UINT16(dataP + 22, v11); @@ -972,11 +972,11 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { if (!v22) break; - v24 = READ_LE_UINT16(v23); - v15 = READ_LE_UINT16(v23 + 2); - v22 = READ_LE_UINT16(v23 + 4); - v16 = READ_LE_UINT16(v23 + 6); - v17 = READ_LE_UINT16(v23 + 8); + v24 = (int16)READ_LE_UINT16(v23); + v15 = (int16)READ_LE_UINT16(v23 + 2); + v22 = (int16)READ_LE_UINT16(v23 + 4); + v16 = (int16)READ_LE_UINT16(v23 + 6); + v17 = (int16)READ_LE_UINT16(v23 + 8); *(v9 + 9) = *(v23 + 9); WRITE_LE_UINT16(v9, v24); WRITE_LE_UINT16(v9 + 2, v15); @@ -1102,7 +1102,7 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin if (strncmp((const char *)v10, "IMAGE=", 7)) v5 = -1; if (!v5) { - f.read(v9, READ_LE_UINT16(v10 + 8)); + f.read(v9, (int16)READ_LE_UINT16(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager.ESC_KEY == 1) { diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index aa0c1741a7..6f0f22bcd4 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -253,7 +253,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, v10 = _vm->_globals.BUF_ZONE + Index[fileIndex]; memcpy(v9, v10, 0x60u); v11 = 0; - WRITE_LE_UINT16((uint16 *)v9 + 48, READ_LE_UINT16(v10 + 96)); + WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } v59 = texte_tmp; v63 = 0; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a02e47dbf0..0441806231 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -883,11 +883,11 @@ void Globals::CHARGE_CACHE(const Common::String &file) { v15 = 60; v14 = 0; do { - v11 = READ_LE_UINT16((uint16 *)ptr + v15); - v4 = READ_LE_UINT16((uint16 *)ptr + v15 + 1); - v5 = READ_LE_UINT16((uint16 *)ptr + v15 + 2); + v11 = (int16)READ_LE_UINT16((uint16 *)ptr + v15); + v4 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); + v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); v6 = v14; - Cache[v6].field14 = READ_LE_UINT16((uint16 *)ptr + v15 + 4); + Cache[v6].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); Cache[v6].field2 = v11; Cache[v6].field0 = v4; Cache[v6].field4 = v5; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9fda73fc95..4912849344 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -372,9 +372,9 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by v7 = _vm->_globals.CAT_TAILLE - 896; v8 = f.read(HEADER_PCX, 128); - v6 = READ_LE_UINT16(&HEADER_PCX[8]) + 1; - v20 = READ_LE_UINT16(&HEADER_PCX[10]) + 1; - if ((READ_LE_UINT16(&HEADER_PCX[8]) + 1) <= SCREEN_WIDTH) { + v6 = (int16)READ_LE_UINT16(&HEADER_PCX[8]) + 1; + v20 = (int16)READ_LE_UINT16(&HEADER_PCX[10]) + 1; + if (((int16)READ_LE_UINT16(&HEADER_PCX[8]) + 1) <= SCREEN_WIDTH) { DOUBLE_ECRAN = false; } else { v6 = SCREEN_WIDTH * 2; @@ -396,8 +396,8 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by if (bytesRead < 128) error("Erreur en cours de lecture."); - v6 = READ_LE_UINT16(&HEADER_PCX[8]) + 1; - v20 = READ_LE_UINT16(&HEADER_PCX[10]) + 1; + v6 = (int16)READ_LE_UINT16(&HEADER_PCX[8]) + 1; + v20 = (int16)READ_LE_UINT16(&HEADER_PCX[10]) + 1; if (v6 <= SCREEN_WIDTH) { DOUBLE_ECRAN = false; } else { @@ -1091,7 +1091,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSur v6 = *(v5 + 2); v5 += 2; } else if (v6 == 254) { - v3 += READ_LE_UINT16(v5 + 1); + v3 += (int16)READ_LE_UINT16(v5 + 1); v6 = *(v5 + 3); v5 += 3; } else { @@ -1162,7 +1162,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { v5 = *(v4 + 2); v4 += 2; } else if (v5 == (byte)-2) { - v2 += READ_LE_UINT16(v4 + 1); + v2 += (int16)READ_LE_UINT16(v4 + 1); v5 = *(v4 + 3); v4 += 3; } else { @@ -1217,7 +1217,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { srcByte = *(const byte *)(srcP + 2); srcP += 2; } else if (srcByte == 254) { - destOffset += READ_LE_UINT16(srcP + 1); + destOffset += (int16)READ_LE_UINT16(srcP + 1); srcByte = *(const byte *)(srcP + 3); srcP += 3; } else { @@ -1277,7 +1277,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *surface) { v4 = *(v3 + 2); v3 += 2; } else if (v4 == -2) { - v2 += READ_LE_UINT16(v3 + 1); + v2 += (int16)READ_LE_UINT16(v3 + 1); v4 = *(v3 + 3); v3 += 3; } else { @@ -1286,7 +1286,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *surface) { v3 += 5; } Video_Cont_Vbe16a: - WRITE_LE_UINT16(v2 + v2 + VideoPtr, READ_LE_UINT16(PAL_PIXELS + 2 * v4)); + WRITE_LE_UINT16(v2 + v2 + VideoPtr, (int16)READ_LE_UINT16(PAL_PIXELS + 2 * v4)); ++v3; ++v2; } @@ -1336,9 +1336,9 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, clip_flag = false; spriteP += 4; - int width = READ_LE_UINT16(spriteP); + int width = (int16)READ_LE_UINT16(spriteP); spriteP += 2; - int height = READ_LE_UINT16(spriteP); + int height = (int16)READ_LE_UINT16(spriteP); // Clip X clip_x1 = width; @@ -1386,7 +1386,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Set up source spriteP += 6; - int srcOffset = READ_LE_UINT16(spriteP); + int srcOffset = (int16)READ_LE_UINT16(spriteP); spriteP += 4; const byte *srcP = spriteP; spriteP += srcOffset; @@ -1404,7 +1404,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, while ((byteVal = *srcP) != 253) { ++srcP; - width = READ_LE_UINT16(srcP); + width = (int16)READ_LE_UINT16(srcP); srcP += 2; if (byteVal == 254) { @@ -1432,7 +1432,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, while ((byteVal = *srcP) != 253) { ++srcP; - width = READ_LE_UINT16(srcP); + width = (int16)READ_LE_UINT16(srcP); srcP += 2; if (byteVal == 254) { @@ -2294,9 +2294,9 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x v9 = 0; v10 = 0; v8 = v6 + 4; - v9 = READ_LE_UINT16(v8); + v9 = (int16)READ_LE_UINT16(v8); v8 += 2; - v10 = READ_LE_UINT16(v8); + v10 = (int16)READ_LE_UINT16(v8); v11 = v8 + 10; destP = surface + xp + nbrligne2 * yp; Largeur = v9; @@ -2465,7 +2465,7 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { byteVal = *(srcPtr + 2); srcPtr += 2; } else if (byteVal == (byte)-2) { - destOffset += READ_LE_UINT16(srcPtr + 1); + destOffset += (int16)READ_LE_UINT16(srcPtr + 1); byteVal = *(srcPtr + 3); srcPtr += 3; } else { @@ -2499,7 +2499,7 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { byteVal = *(srcP + 2); srcP += 2; } else if (byteVal == -2) { - destOffset += READ_LE_UINT16(srcP + 1); + destOffset += (int16)READ_LE_UINT16(srcP + 1); byteVal = *(srcP + 3); srcP += 3; } else { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 6c499d0c37..26cef1d7d9 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -415,11 +415,11 @@ LABEL_29: if (v7 != g_PTRNUL) { v23 = 1; v8 = 2 * Ligne[v6].field0; - v9 = READ_LE_UINT16(v7); - v16 = READ_LE_UINT16(v7 + 2); - v10 = READ_LE_UINT16(v7 + 2 * v8 - 4); - v18 = READ_LE_UINT16(v7 + 2 * v8 - 2); - if (READ_LE_UINT16(v7) >= v10) + v9 = (int16)READ_LE_UINT16(v7); + v16 = (int16)READ_LE_UINT16(v7 + 2); + v10 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 4); + v18 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 2); + if ((int16)READ_LE_UINT16(v7) >= v10) goto LABEL_32; if (v22 < v9 || v21 > v10) v23 = 0; @@ -451,9 +451,9 @@ LABEL_28: goto LABEL_29; } while (1) { - v12 = READ_LE_UINT16(v7); + v12 = (int16)READ_LE_UINT16(v7); v13 = v7 + 2; - v14 = READ_LE_UINT16(v13); + v14 = (int16)READ_LE_UINT16(v13); v7 = v13 + 2; if (a1 == v12 || a1 + 1 == v12) { if (a2 == v14 || a2 + 1 == v14) @@ -506,11 +506,11 @@ LABEL_47: if (g_PTRNUL != v7) { v23 = 1; v8 = 2 * Ligne[v6].field0; - v9 = READ_LE_UINT16(v7); - v15 = READ_LE_UINT16(v7 + 2); - v10 = READ_LE_UINT16(v7 + 2 * v8 - 4); - v17 = READ_LE_UINT16(v7 + 2 * v8 - 2); - if (READ_LE_UINT16(v7) >= v10) + v9 = (int16)READ_LE_UINT16(v7); + v15 = (int16)READ_LE_UINT16(v7 + 2); + v10 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 4); + v17 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 2); + if ((int16)READ_LE_UINT16(v7) >= v10) goto LABEL_50; if (v22 < v9 || v21 > v10) v23 = 0; @@ -542,9 +542,9 @@ LABEL_46: goto LABEL_47; } while (1) { - v12 = READ_LE_UINT16(v7); + v12 = (int16)READ_LE_UINT16(v7); v13 = v7 + 2; - v16 = READ_LE_UINT16(v13); + v16 = (int16)READ_LE_UINT16(v13); v7 = v13 + 2; if (a1 == v12 || v12 == a1 + 1 @@ -598,16 +598,16 @@ void LinesManager::INIPARCOURS() { int v14; int v15; - v15 = READ_LE_UINT16(Ligne[0].fieldC); - v14 = READ_LE_UINT16(Ligne[0].fieldC + 2); + v15 = (int16)READ_LE_UINT16(Ligne[0].fieldC); + v14 = (int16)READ_LE_UINT16(Ligne[0].fieldC + 2); v0 = 1; v1 = 0; do { v2 = Ligne[v0].field0; v3 = Ligne[v0].fieldC; - v4 = READ_LE_UINT16(v3 + 4 * v2 - 4); - v5 = READ_LE_UINT16(v3 + 4 * v2 - 2); + v4 = (int16)READ_LE_UINT16(v3 + 4 * v2 - 4); + v5 = (int16)READ_LE_UINT16(v3 + 4 * v2 - 2); if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 || _vm->_graphicsManager.min_y == v5) v1 = 1; @@ -619,7 +619,7 @@ void LinesManager::INIPARCOURS() { v1 = v6; } v7 = Ligne[v0 + 1].fieldC; - if (READ_LE_UINT16(v7) != v4 && READ_LE_UINT16(v7 + 2) != v5) + if ((int16)READ_LE_UINT16(v7) != v4 && (int16)READ_LE_UINT16(v7 + 2) != v5) v1 = 1; if (!v1) ++v0; @@ -680,8 +680,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in if (a1 < a4) { for (i = a2; Ligne[a1].field0 > i; ++i) { v10 = Ligne[a1].fieldC; - v11 = READ_LE_UINT16(v10 + 4 * i); - v50 = READ_LE_UINT16(v10 + 4 * i + 2); + v11 = (int16)READ_LE_UINT16(v10 + 4 * i); + v50 = (int16)READ_LE_UINT16(v10 + 4 * i + 2); v12 = v8; WRITE_LE_UINT16(a6 + 2 * v12, v11); WRITE_LE_UINT16(a6 + 2 * v12 + 2, v50); @@ -695,8 +695,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in if (Ligne[v34].field0 > 0) { do { v14 = Ligne[v34].fieldC; - v15 = READ_LE_UINT16(v14 + 4 * v13); - v50 = READ_LE_UINT16(v14 + 4 * v13 + 2); + v15 = (int16)READ_LE_UINT16(v14 + 4 * v13); + v50 = (int16)READ_LE_UINT16(v14 + 4 * v13 + 2); v16 = v8; WRITE_LE_UINT16(a6 + 2 * v16, v15); WRITE_LE_UINT16(a6 + 2 * v16 + 2, v50); @@ -714,8 +714,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in if (v36 > a4) { for (j = v7; j > 0; --j) { v18 = Ligne[v36].fieldC; - v19 = READ_LE_UINT16(v18 + 4 * j); - v50 = READ_LE_UINT16(v18 + 4 * j + 2); + v19 = (int16)READ_LE_UINT16(v18 + 4 * j); + v50 = (int16)READ_LE_UINT16(v18 + 4 * j + 2); v20 = v8; WRITE_LE_UINT16(a6 + 2 * v20, v19); WRITE_LE_UINT16(a6 + 2 * v20 + 2, v50); @@ -727,8 +727,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in do { for (k = Ligne[v35].field0 - 1; k > 0; --k) { v22 = Ligne[v35].fieldC; - v23 = READ_LE_UINT16(v22 + 4 * k); - v50 = READ_LE_UINT16(v22 + 4 * k + 2); + v23 = (int16)READ_LE_UINT16(v22 + 4 * k); + v50 = (int16)READ_LE_UINT16(v22 + 4 * k + 2); v24 = v8; WRITE_LE_UINT16(a6 + 2 * v24, v23); WRITE_LE_UINT16(a6 + 2 * v24 + 2, v50); @@ -747,8 +747,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v29 = v7; do { v30 = Ligne[a4].fieldC; - v31 = READ_LE_UINT16(v30 + 4 * v29); - v50 = READ_LE_UINT16(v30 + 4 * v29 + 2); + v31 = (int16)READ_LE_UINT16(v30 + 4 * v29); + v50 = (int16)READ_LE_UINT16(v30 + 4 * v29 + 2); v32 = v8; WRITE_LE_UINT16(a6 + 2 * v32, v31); WRITE_LE_UINT16(a6 + 2 * v32 + 2, v50); @@ -761,8 +761,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v25 = v7; do { v26 = Ligne[a4].fieldC; - v27 = READ_LE_UINT16(v26 + 4 * v25); - v50 = READ_LE_UINT16(v26 + 4 * v25 + 2); + v27 = (int16)READ_LE_UINT16(v26 + 4 * v25); + v50 = (int16)READ_LE_UINT16(v26 + 4 * v25 + 2); v28 = v8; WRITE_LE_UINT16(a6 + 2 * v28, v27); WRITE_LE_UINT16(a6 + 2 * v28 + 2, v50); @@ -815,8 +815,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i if (a4 < a1) { for (i = a2; Ligne[a1].field0 > i; ++i) { v12 = Ligne[a1].fieldC; - v13 = READ_LE_UINT16(v12 + 4 * i); - v50 = READ_LE_UINT16(v12 + 4 * i + 2); + v13 = (int16)READ_LE_UINT16(v12 + 4 * i); + v50 = (int16)READ_LE_UINT16(v12 + 4 * i + 2); v14 = v40; WRITE_LE_UINT16(a6 + 2 * v14, v13); WRITE_LE_UINT16(a6 + 2 * v14 + 2, v50); @@ -831,8 +831,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i if (Ligne[v15].field0 > 0) { do { v17 = Ligne[v15].fieldC; - v18 = READ_LE_UINT16(v17 + 4 * v16); - v50 = READ_LE_UINT16(v17 + 4 * v16 + 2); + v18 = (int16)READ_LE_UINT16(v17 + 4 * v16); + v50 = (int16)READ_LE_UINT16(v17 + 4 * v16 + 2); v19 = v40; WRITE_LE_UINT16(a6 + 2 * v19, v18); WRITE_LE_UINT16(a6 + 2 * v19 + 2, v50); @@ -851,8 +851,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i if (a4 > v9) { for (j = v10; j > 0; --j) { v21 = Ligne[v9].fieldC;; - v22 = READ_LE_UINT16(v21 + 4 * j); - v50 = READ_LE_UINT16(v21 + 4 * j + 2); + v22 = (int16)READ_LE_UINT16(v21 + 4 * j); + v50 = (int16)READ_LE_UINT16(v21 + 4 * j + 2); v23 = v40; WRITE_LE_UINT16(a6 + 2 * v23, v22); WRITE_LE_UINT16(a6 + 2 * v23 + 2, v50); @@ -865,8 +865,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i while (a4 != v24) { for (k = Ligne[v24].field0 - 1; k > 0; --k) { v26 = Ligne[v24].fieldC; - v27 = READ_LE_UINT16(v26 + 4 * k); - v50 = READ_LE_UINT16(v26 + 4 * k + 2); + v27 = (int16)READ_LE_UINT16(v26 + 4 * k); + v50 = (int16)READ_LE_UINT16(v26 + 4 * k + 2); v28 = v40; WRITE_LE_UINT16(a6 + 2 * v28, v27); WRITE_LE_UINT16(a6 + 2 * v28 + 2, v50); @@ -887,8 +887,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v39 = a4; do { v34 = Ligne[v39].fieldC; - v35 = READ_LE_UINT16(v34 + 4 * v33); - v50 = READ_LE_UINT16(v34 + 4 * v33 + 2); + v35 = (int16)READ_LE_UINT16(v34 + 4 * v33); + v50 = (int16)READ_LE_UINT16(v34 + 4 * v33 + 2); v36 = v40; WRITE_LE_UINT16(a6 + 2 * v36, v35); WRITE_LE_UINT16(a6 + 2 * v36 + 2, v50); @@ -902,8 +902,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v38 = a4; do { v30 = Ligne[v38].fieldC; - v31 = READ_LE_UINT16(v30 + 4 * v29); - v50 = READ_LE_UINT16(v30 + 4 * v29 + 2); + v31 = (int16)READ_LE_UINT16(v30 + 4 * v29); + v50 = (int16)READ_LE_UINT16(v30 + 4 * v29 + 2); v32 = v40; WRITE_LE_UINT16(a6 + 2 * v32, v31); WRITE_LE_UINT16(a6 + 2 * v32 + 2, v50); @@ -1334,8 +1334,8 @@ LABEL_112: return -1; } v10 = Ligne[a1].fieldC; - v98 = READ_LE_UINT16(v10); - v97 = READ_LE_UINT16(v10 + 2); + v98 = (int16)READ_LE_UINT16(v10); + v97 = (int16)READ_LE_UINT16(v10 + 2); v92 = a1; while (1) { @@ -1344,7 +1344,7 @@ LABEL_112: v12 = Ligne[v92 - 1].fieldC; if (v12 == g_PTRNUL) break; - while (READ_LE_UINT16(v12 + 2 * v11 - 4) != v98 || v97 != READ_LE_UINT16(v12 + 2 * v11 - 2)) { + while ((int16)READ_LE_UINT16(v12 + 2 * v11 - 4) != v98 || v97 != (int16)READ_LE_UINT16(v12 + 2 * v11 - 2)) { --v86; if (_vm->_objectsManager.DERLIGNE - 1 != v86) { v11 = 2 * Ligne[v86].field0; @@ -1355,14 +1355,14 @@ LABEL_112: goto LABEL_11; } v92 = v86; - v98 = READ_LE_UINT16(v12); - v97 = READ_LE_UINT16(v12 + 2); + v98 = (int16)READ_LE_UINT16(v12); + v97 = (int16)READ_LE_UINT16(v12 + 2); } LABEL_11: v13 = Ligne[a1].fieldC; v14 = 2 * Ligne[a1].field0; - v95 = READ_LE_UINT16(v13 + 2 * v14 - 4); - v93 = READ_LE_UINT16(v13 + 2 * v14 - 2); + v95 = (int16)READ_LE_UINT16(v13 + 2 * v14 - 4); + v93 = (int16)READ_LE_UINT16(v13 + 2 * v14 - 2); v91 = a1; while (1) { v87 = v91 + 1; @@ -1372,9 +1372,9 @@ LABEL_11: break; while (1) { v65 = v15; - v17 = READ_LE_UINT16(v16 + 2 * v15 - 4); - if (READ_LE_UINT16(v16) == v95) { - if (v93 == READ_LE_UINT16(v16 + 2)) + v17 = (int16)READ_LE_UINT16(v16 + 2 * v15 - 4); + if ((int16)READ_LE_UINT16(v16) == v95) { + if (v93 == (int16)READ_LE_UINT16(v16 + 2)) break; } ++v87; @@ -1388,7 +1388,7 @@ LABEL_11: } v91 = v87; v95 = v17; - v93 = READ_LE_UINT16(v16 + 2 * v65 - 2); + v93 = (int16)READ_LE_UINT16(v16 + 2 * v65 - 2); } LABEL_17: v18 = a3 - a5; @@ -1436,8 +1436,8 @@ LABEL_17: v89 = v85 + 1; if ((int)(v85 + 1) > 0) { do { - v96 = READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25); - v94 = READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25 + 1); + v96 = (int16)READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25); + v94 = (int16)READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25 + 1); if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { v80 = v100; v77 = v101; @@ -1457,11 +1457,11 @@ LABEL_17: if (g_PTRNUL == v28) error("erreur dans da routine genial"); v29 = *(uint16 *)v28; - v30 = READ_LE_UINT16(v28 + 2); - v59 = READ_LE_UINT16(v28 + 2); + v30 = (int16)READ_LE_UINT16(v28 + 2); + v59 = (int16)READ_LE_UINT16(v28 + 2); v31 = v27; - v32 = READ_LE_UINT16(v28 + 2 * v27 - 4); - v33 = READ_LE_UINT16(v28 + 2 * v31 - 2); + v32 = (int16)READ_LE_UINT16(v28 + 2 * v27 - 4); + v33 = (int16)READ_LE_UINT16(v28 + 2 * v31 - 2); if (i == v92) { v72 = v33; if (v30 <= v33) @@ -2264,8 +2264,8 @@ LABEL_234: if (v115 < v121) { for (i = v114; Ligne[v115].field0 > i; ++i) { v70 = Ligne[v115].fieldC; - v119 = READ_LE_UINT16(v70 + 4 * i); - v118 = READ_LE_UINT16(v70 + 4 * i + 2); + v119 = (int16)READ_LE_UINT16(v70 + 4 * i); + v118 = (int16)READ_LE_UINT16(v70 + 4 * i + 2); v71 = v112; _vm->_globals.super_parcours[v71] = v119; _vm->_globals.super_parcours[v71 + 1] = v118; @@ -2280,8 +2280,8 @@ LABEL_234: v110 = v116; for (j = v116; Ligne[j].field0 > v72; j = v116) { v74 = Ligne[v110].fieldC; - v119 = READ_LE_UINT16(v74 + 4 * v72); - v118 = READ_LE_UINT16(v74 + 4 * v72 + 2); + v119 = (int16)READ_LE_UINT16(v74 + 4 * v72); + v118 = (int16)READ_LE_UINT16(v74 + 4 * v72 + 2); v75 = v112; _vm->_globals.super_parcours[v75] = v119; _vm->_globals.super_parcours[v75 + 1] = v118; @@ -2330,8 +2330,8 @@ LABEL_200: v98 = 16 * v115; do { v81 = Ligne[v98].fieldC; - v119 = READ_LE_UINT16(v81 + 4 * v80); - v118 = READ_LE_UINT16(v81 + 4 * v80 + 2); + v119 = (int16)READ_LE_UINT16(v81 + 4 * v80); + v118 = (int16)READ_LE_UINT16(v81 + 4 * v80 + 2); v82 = v112; _vm->_globals.super_parcours[v82] = v119; _vm->_globals.super_parcours[v82 + 1] = v118; @@ -2349,8 +2349,8 @@ LABEL_200: v109 = 16 * v117; do { v84 = Ligne[v109].fieldC; - v119 = READ_LE_UINT16(v84 + 4 * v83); - v118 = READ_LE_UINT16(v84 + 4 * v83 + 2); + v119 = (int16)READ_LE_UINT16(v84 + 4 * v83); + v118 = (int16)READ_LE_UINT16(v84 + 4 * v83 + 2); v85 = v112; _vm->_globals.super_parcours[v85] = v119; _vm->_globals.super_parcours[v85 + 1] = v118; @@ -2395,9 +2395,9 @@ LABEL_200: v100 = 16 * v121; do { v95 = Ligne[v100].fieldC;; - v96 = READ_LE_UINT16(v95 + 4 * v94 + 2); + v96 = (int16)READ_LE_UINT16(v95 + 4 * v94 + 2); v97 = v112; - _vm->_globals.super_parcours[v97] = READ_LE_UINT16(v95 + 4 * v94); + _vm->_globals.super_parcours[v97] = (int16)READ_LE_UINT16(v95 + 4 * v94); _vm->_globals.super_parcours[v97 + 1] = v96; _vm->_globals.super_parcours[v97 + 2] = Ligne[v100].field6; _vm->_globals.super_parcours[v97 + 3] = 0; @@ -2410,9 +2410,9 @@ LABEL_200: v99 = 16 * v121; do { v91 = Ligne[v99].fieldC; - v92 = READ_LE_UINT16(v91 + 4 * v90 + 2); + v92 = (int16)READ_LE_UINT16(v91 + 4 * v90 + 2); v93 = v112; - _vm->_globals.super_parcours[v93] = READ_LE_UINT16(v91 + 4 * v90); + _vm->_globals.super_parcours[v93] = (int16)READ_LE_UINT16(v91 + 4 * v90); _vm->_globals.super_parcours[v93 + 1] = v92; _vm->_globals.super_parcours[v93 + 2] = Ligne[v99].field8; _vm->_globals.super_parcours[v93 + 3] = 0; @@ -2640,14 +2640,14 @@ LABEL_150: v29 = _vm->_globals.essai0; do { v30 = v137; - _vm->_globals.super_parcours[v30] = READ_LE_UINT16(v29 + 2 * v116); - _vm->_globals.super_parcours[v30 + 1] = READ_LE_UINT16(v29 + 2 * v116 + 2); - _vm->_globals.super_parcours[v30 + 2] = READ_LE_UINT16(v29 + 2 * v116 + 4); + _vm->_globals.super_parcours[v30] = (int16)READ_LE_UINT16(v29 + 2 * v116); + _vm->_globals.super_parcours[v30 + 1] = (int16)READ_LE_UINT16(v29 + 2 * v116 + 2); + _vm->_globals.super_parcours[v30 + 2] = (int16)READ_LE_UINT16(v29 + 2 * v116 + 4); _vm->_globals.super_parcours[v30 + 3] = 0; v116 += 3; v137 += 4; - if (READ_LE_UINT16(v29 + 2 * v116) == -1) { - if (READ_LE_UINT16(v29 + 2 * v116 + 2) == -1) + if ((int16)READ_LE_UINT16(v29 + 2 * v116) == -1) { + if ((int16)READ_LE_UINT16(v29 + 2 * v116 + 2) == -1) v127 = 1; } } while (v127 != 1); @@ -2925,13 +2925,13 @@ LABEL_195: v50 = _vm->_globals.essai1; do { v51 = v137; - _vm->_globals.super_parcours[v51] = READ_LE_UINT16(v50 + 2 * v118); - _vm->_globals.super_parcours[v51 + 1] = READ_LE_UINT16(v50 + 2 * v118 + 2); - _vm->_globals.super_parcours[v51 + 2] = READ_LE_UINT16(v50 + 2 * v118 + 4); + _vm->_globals.super_parcours[v51] = (int16)READ_LE_UINT16(v50 + 2 * v118); + _vm->_globals.super_parcours[v51 + 1] = (int16)READ_LE_UINT16(v50 + 2 * v118 + 2); + _vm->_globals.super_parcours[v51 + 2] = (int16)READ_LE_UINT16(v50 + 2 * v118 + 4); _vm->_globals.super_parcours[v51 + 3] = 0; v118 += 3; v137 += 4; - if (READ_LE_UINT16(v50 + 2 * v118) == -1 && READ_LE_UINT16(v50 + 2 * v118 + 2) == -1) + if ((int16)READ_LE_UINT16(v50 + 2 * v118) == -1 && (int16)READ_LE_UINT16(v50 + 2 * v118 + 2) == -1) v128 = 1; } while (v128 != 1); } @@ -3038,7 +3038,7 @@ LABEL_249: WRITE_LE_UINT16(v77 + 2 * v76 + 4, (uint16)-1); if (v136 != 1) { if (a6 > v144) { - if (READ_LE_UINT16(_vm->_globals.essai0) != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai0) != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v130 = 0; @@ -3046,13 +3046,13 @@ LABEL_249: v78 = _vm->_globals.essai0; do { v79 = v137; - _vm->_globals.super_parcours[v79] = READ_LE_UINT16(v78 + 2 * v120); - _vm->_globals.super_parcours[v79 + 1] = READ_LE_UINT16(v78 + 2 * v120 + 2); - _vm->_globals.super_parcours[v79 + 2] = READ_LE_UINT16(v78 + 2 * v120 + 4); + _vm->_globals.super_parcours[v79] = (int16)READ_LE_UINT16(v78 + 2 * v120); + _vm->_globals.super_parcours[v79 + 1] = (int16)READ_LE_UINT16(v78 + 2 * v120 + 2); + _vm->_globals.super_parcours[v79 + 2] = (int16)READ_LE_UINT16(v78 + 2 * v120 + 4); _vm->_globals.super_parcours[v79 + 3] = 0; v120 += 3; v137 += 4; - if (READ_LE_UINT16(v78 + 2 * v120) == -1 && READ_LE_UINT16(v78 + 2 * v120 + 2) == -1) + if ((int16)READ_LE_UINT16(v78 + 2 * v120) == -1 && (int16)READ_LE_UINT16(v78 + 2 * v120 + 2) == -1) v130 = 1; } while (v130 != 1); LABEL_323: @@ -3060,20 +3060,20 @@ LABEL_323: return 2; } v80 = _vm->_globals.essai1; - if (READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v131 = 0; v121 = 0; do { v81 = v137; - _vm->_globals.super_parcours[v81] = READ_LE_UINT16(v80 + 2 * v121); - _vm->_globals.super_parcours[v81 + 1] = READ_LE_UINT16(v80 + 2 * v121 + 2); - _vm->_globals.super_parcours[v81 + 2] = READ_LE_UINT16(v80 + 2 * v121 + 4); + _vm->_globals.super_parcours[v81] = (int16)READ_LE_UINT16(v80 + 2 * v121); + _vm->_globals.super_parcours[v81 + 1] = (int16)READ_LE_UINT16(v80 + 2 * v121 + 2); + _vm->_globals.super_parcours[v81 + 2] = (int16)READ_LE_UINT16(v80 + 2 * v121 + 4); _vm->_globals.super_parcours[v81 + 3] = 0; v121 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) + if ((int16)(int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)(int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) v131 = 1; } while (v131 != 1); LABEL_301: @@ -3081,7 +3081,7 @@ LABEL_301: return 2; } v82 = _vm->_globals.essai2; - if (READ_LE_UINT16(_vm->_globals.essai2) != -1) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1) { if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; @@ -3089,13 +3089,13 @@ LABEL_301: v122 = 0; do { v83 = v137; - _vm->_globals.super_parcours[v83] = READ_LE_UINT16(v82 + 2 * v122); - _vm->_globals.super_parcours[v83 + 1] = READ_LE_UINT16(v82 + 2 * v122 + 2); - _vm->_globals.super_parcours[v83 + 2] = READ_LE_UINT16(v82 + 2 * v122 + 4); + _vm->_globals.super_parcours[v83] = (int16)READ_LE_UINT16(v82 + 2 * v122); + _vm->_globals.super_parcours[v83 + 1] = (int16)READ_LE_UINT16(v82 + 2 * v122 + 2); + _vm->_globals.super_parcours[v83 + 2] = (int16)READ_LE_UINT16(v82 + 2 * v122 + 4); _vm->_globals.super_parcours[v83 + 3] = 0; v122 += 3; v137 += 4; - if (READ_LE_UINT16(v82 + 2 * v122) == -1 && READ_LE_UINT16(v82 + 2 * v122 + 2) == -1) + if ((int16)READ_LE_UINT16(v82 + 2 * v122) == -1 && (int16)READ_LE_UINT16(v82 + 2 * v122 + 2) == -1) v132 = 1; } while (v132 != 1); LABEL_312: @@ -3111,7 +3111,7 @@ LABEL_312: v142 = 1300; if (v138 == -1) v142 = 1300; - if (READ_LE_UINT16(_vm->_globals.essai1) != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v133 = 0; @@ -3119,37 +3119,37 @@ LABEL_312: v84 = _vm->_globals.essai1; do { v85 = v137; - _vm->_globals.super_parcours[v85] = READ_LE_UINT16(v84 + 2 * v123); - _vm->_globals.super_parcours[v85 + 1] = READ_LE_UINT16(v84 + 2 * v123 + 2); - _vm->_globals.super_parcours[v85 + 2] = READ_LE_UINT16(v84 + 2 * v123 + 4); + _vm->_globals.super_parcours[v85] = (int16)READ_LE_UINT16(v84 + 2 * v123); + _vm->_globals.super_parcours[v85 + 1] = (int16)READ_LE_UINT16(v84 + 2 * v123 + 2); + _vm->_globals.super_parcours[v85 + 2] = (int16)READ_LE_UINT16(v84 + 2 * v123 + 4); _vm->_globals.super_parcours[v85 + 3] = 0; v123 += 3; v137 += 4; - if (READ_LE_UINT16(v84 + 2 * v123) == -1 && READ_LE_UINT16(v84 + 2 * v123 + 2) == -1) + if ((int16)READ_LE_UINT16(v84 + 2 * v123) == -1 && (int16)READ_LE_UINT16(v84 + 2 * v123 + 2) == -1) v133 = 1; } while (v133 != 1); goto LABEL_301; } v86 = _vm->_globals.essai2; - if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { + if ((int16)(int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; v134 = 0; v124 = 0; do { v87 = v137; - _vm->_globals.super_parcours[v87] = READ_LE_UINT16(v86 + 2 * v124); - _vm->_globals.super_parcours[v87 + 1] = READ_LE_UINT16(v86 + 2 * v124 + 2); - _vm->_globals.super_parcours[v87 + 2] = READ_LE_UINT16(v86 + 2 * v124 + 4); + _vm->_globals.super_parcours[v87] = (int16)READ_LE_UINT16(v86 + 2 * v124); + _vm->_globals.super_parcours[v87 + 1] = (int16)READ_LE_UINT16(v86 + 2 * v124 + 2); + _vm->_globals.super_parcours[v87 + 2] = (int16)READ_LE_UINT16(v86 + 2 * v124 + 4); _vm->_globals.super_parcours[v87 + 3] = 0; v124 += 3; v137 += 4; - if (READ_LE_UINT16(v86 + 2 * v124) == -1 && READ_LE_UINT16(v86 + 2 * v124 + 2) == -1) + if ((int16)READ_LE_UINT16(v86 + 2 * v124) == -1 && (int16)READ_LE_UINT16(v86 + 2 * v124 + 2) == -1) v134 = 1; } while (v134 != 1); goto LABEL_312; } - if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { + if ((int16)(int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v135 = 0; @@ -3157,13 +3157,13 @@ LABEL_312: v88 = _vm->_globals.essai0; do { v89 = v137; - _vm->_globals.super_parcours[v89] = READ_LE_UINT16(v88 + 2 * v125); - _vm->_globals.super_parcours[v89 + 1] = READ_LE_UINT16(v88 + 2 * v125 + 2); - _vm->_globals.super_parcours[v89 + 2] = READ_LE_UINT16(v88 + 2 * v125 + 4); + _vm->_globals.super_parcours[v89] = (int16)READ_LE_UINT16(v88 + 2 * v125); + _vm->_globals.super_parcours[v89 + 1] = (int16)READ_LE_UINT16(v88 + 2 * v125 + 2); + _vm->_globals.super_parcours[v89 + 2] = (int16)READ_LE_UINT16(v88 + 2 * v125 + 4); _vm->_globals.super_parcours[v89 + 3] = 0; v125 += 3; v137 += 4; - if (READ_LE_UINT16(v88 + 2 * v125) == -1 && READ_LE_UINT16(v88 + 2 * v125 + 2) == -1) + if ((int16)READ_LE_UINT16(v88 + 2 * v125) == -1 && (int16)READ_LE_UINT16(v88 + 2 * v125 + 2) == -1) v135 = 1; } while (v135 != 1); goto LABEL_323; @@ -3250,13 +3250,13 @@ LABEL_242: v72 = _vm->_globals.essai2; do { v73 = v137; - _vm->_globals.super_parcours[v73] = READ_LE_UINT16(v72 + 2 * v119); - _vm->_globals.super_parcours[v73 + 1] = READ_LE_UINT16(v72 + 2 * v119 + 2); - _vm->_globals.super_parcours[v73 + 2] = READ_LE_UINT16(v72 + 2 * v119 + 4); + _vm->_globals.super_parcours[v73] = (int16)READ_LE_UINT16(v72 + 2 * v119); + _vm->_globals.super_parcours[v73 + 1] = (int16)READ_LE_UINT16(v72 + 2 * v119 + 2); + _vm->_globals.super_parcours[v73 + 2] = (int16)READ_LE_UINT16(v72 + 2 * v119 + 4); _vm->_globals.super_parcours[v73 + 3] = 0; v119 += 3; v137 += 4; - if (READ_LE_UINT16(v72 + 2 * v119) == -1 && READ_LE_UINT16(v72 + 2 * v119 + 2) == -1) + if ((int16)READ_LE_UINT16(v72 + 2 * v119) == -1 && (int16)READ_LE_UINT16(v72 + 2 * v119 + 2) == -1) v129 = 1; } while (v129 != 1); } @@ -3751,8 +3751,8 @@ LABEL_60: v25 = _vm->_globals.essai0; do { v15 = Ligne[v32].fieldC; - v16 = READ_LE_UINT16(v15 + 4 * v14); - v29 = READ_LE_UINT16(v15 + 4 * v14 + 2); + v16 = (int16)READ_LE_UINT16(v15 + 4 * v14); + v29 = (int16)READ_LE_UINT16(v15 + 4 * v14 + 2); if (!a6) { v17 = v41; _vm->_globals.super_parcours[v17] = v16; @@ -3779,8 +3779,8 @@ LABEL_60: v26 = _vm->_globals.essai0; do { v20 = Ligne[v31].fieldC; - v21 = READ_LE_UINT16(v20 + 4 * v19); - v30 = READ_LE_UINT16(v20 + 4 * v19 + 2); + v21 = (int16)READ_LE_UINT16(v20 + 4 * v19); + v30 = (int16)READ_LE_UINT16(v20 + 4 * v19 + 2); if (a6) { v23 = v41; WRITE_LE_UINT16(v26 + 2 * v23, v21); @@ -3835,9 +3835,9 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { v6 = i; v7 = Ligne[i].fieldC; v8 = Ligne[v6].field0; - v23 = READ_LE_UINT16(v7 + 4 * v8 - 4); - v9 = READ_LE_UINT16(v7 + 4 * v8 - 2); - if (*v7 == a1 && a2 == READ_LE_UINT16(v7 + 2)) { + v23 = (int16)READ_LE_UINT16(v7 + 4 * v8 - 4); + v9 = (int16)READ_LE_UINT16(v7 + 4 * v8 - 2); + if (*v7 == a1 && a2 == (int16)READ_LE_UINT16(v7 + 2)) { v24 = v25; v26 = 1; *a3 = 1; @@ -3858,8 +3858,8 @@ LABEL_12: v10 = v24; v11 = Ligne[v10].field0; v12 = Ligne[v10].fieldC; - v13 = READ_LE_UINT16(v12 + 4 * v11 - 4); - v14 = READ_LE_UINT16(v12 + 4 * v11 - 2); + v13 = (int16)READ_LE_UINT16(v12 + 4 * v11 - 4); + v14 = (int16)READ_LE_UINT16(v12 + 4 * v11 - 2); v15 = Ligne[v10].field6; if (v15 == 5 || v15 == 1) v14 += 2; @@ -3874,7 +3874,7 @@ LABEL_12: if (v26 == 1 && *a3 == 2) { v17 = Ligne[v25].fieldC; v18 = *v17; - v19 = READ_LE_UINT16(v17 + 2); + v19 = (int16)READ_LE_UINT16(v17 + 2); v20 = Ligne[v24].field6; if (v20 == 5 || v20 == 1) v19 -= 2; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 23baec188e..fcebb2ce8b 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -290,7 +290,7 @@ void MenuManager::CHARGE_PARTIE() { v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; v5 = 0; do { - _vm->_globals.INVENTAIRE[v5] = READ_LE_UINT16(v4 + 2 * v5); + _vm->_globals.INVENTAIRE[v5] = (int16)READ_LE_UINT16(v4 + 2 * v5); ++v5; } while (v5 <= 34); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d76352ac0e..559eb6558c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -214,12 +214,12 @@ void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSi int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool isSize) { const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) - v3 += READ_LE_UINT16(v3) + 16; + v3 += (int16)READ_LE_UINT16(v3) + 16; const byte *v5 = v3 + 8; - int result = READ_LE_UINT16(v5); + int result = (int16)READ_LE_UINT16(v5); if (isSize) - result = READ_LE_UINT16(v5 + 4); + result = (int16)READ_LE_UINT16(v5 + 4); return result; } @@ -227,12 +227,12 @@ int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool is int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool isSize) { const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) - v3 += READ_LE_UINT16(v3) + 16; + v3 += (int16)READ_LE_UINT16(v3) + 16; const byte *v5 = v3 + 10; - int result = READ_LE_UINT16(v5); + int result = (int16)READ_LE_UINT16(v5); if (isSize) - result = READ_LE_UINT16(v5 + 4); + result = (int16)READ_LE_UINT16(v5 + 4); return result; } @@ -242,7 +242,7 @@ int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)READ_LE_UINT16(rectP + 4); + return (int16)(int16)READ_LE_UINT16(rectP + 4); } int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { @@ -250,7 +250,7 @@ int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)READ_LE_UINT16(rectP + 6); + return (int16)(int16)READ_LE_UINT16(rectP + 6); } int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { @@ -260,7 +260,7 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn } objP += 4; - int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); + int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); memcpy(sprite + 3, objP - 4, result + 16); return result; @@ -288,7 +288,7 @@ int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int } objP += 4; - int result = READ_LE_UINT16(objP) * READ_LE_UINT16(objP + 2); + int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); memcpy(sprite, objP + 12, result); return result; @@ -712,19 +712,19 @@ void ObjectsManager::BOB_VISU(int idx) { BOB_ZERO(idx); data = _vm->_globals.Bqe_Anim[idx].data; - v1 = READ_LE_UINT16(data); - v9 = READ_LE_UINT16(data + 2); - v8 = READ_LE_UINT16(data + 4); - v7 = READ_LE_UINT16(data + 6); - v6 = READ_LE_UINT16(data + 8); - if (READ_LE_UINT16(data)) { + v1 = (int16)READ_LE_UINT16(data); + v9 = (int16)READ_LE_UINT16(data + 2); + v8 = (int16)READ_LE_UINT16(data + 4); + v7 = (int16)READ_LE_UINT16(data + 6); + v6 = (int16)READ_LE_UINT16(data + 8); + if ((int16)READ_LE_UINT16(data)) { if (_vm->_globals.Bank[idx].field4) { if (!v9) v9 = 1; if (!v6) v6 = -1; - if (READ_LE_UINT16(data + 24)) { + if ((int16)READ_LE_UINT16(data + 24)) { _vm->_globals.Bob[idx].field3A = 0; if (_vm->_globals.Bank[idx].fileHeader == 1) { @@ -1352,15 +1352,15 @@ void ObjectsManager::AFF_BOB_ANIM() { v20 = _vm->_globals.Bob[idx].field18 + 20; v24 = _vm->_globals.Bob[idx].field10; - _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v20 + 2 * v24); + _vm->_globals.Bob[idx].field8 = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == 1 && idx > 20 ) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; - _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v20 + 2 * v24 + 2); - _vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v20 + 2 * v24 + 4); - _vm->_globals.Bob[idx].field36 = READ_LE_UINT16(v20 + 2 * v24 + 6); + _vm->_globals.Bob[idx].fieldA = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); + _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); + _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); _vm->_globals.Bob[idx].fieldC = *(v20 + 2 * v24 + 8); _vm->_globals.Bob[idx].field38 = *(v20 + 2 * v24 + 9); _vm->_globals.Bob[idx].field10 += 5; @@ -1392,16 +1392,16 @@ LABEL_38: } else { _vm->_globals.Bob[idx].field10 = 0; v21 = _vm->_globals.Bob[idx].field18 + 20; - _vm->_globals.Bob[idx].field8 = READ_LE_UINT16(v21); + _vm->_globals.Bob[idx].field8 = (int16)READ_LE_UINT16(v21); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == 1 && idx > 20) _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; - _vm->_globals.Bob[idx].fieldA = READ_LE_UINT16(v21 + 2); - _vm->_globals.Bob[idx].field12 = READ_LE_UINT16(v21 + 4); - _vm->_globals.Bob[idx].field36 = READ_LE_UINT16(v21 + 6); + _vm->_globals.Bob[idx].fieldA = (int16)READ_LE_UINT16(v21 + 2); + _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); + _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); _vm->_globals.Bob[idx].fieldC = *(v21 + 8); _vm->_globals.Bob[idx].field38 = *(v21 + 9); _vm->_globals.Bob[idx].field10 += 5; @@ -1928,9 +1928,9 @@ void ObjectsManager::CARRE_ZONE() { v12 = _vm->_linesManager.LigneZone[idx].field0; if (v12 > 0) { do { - v5 = READ_LE_UINT16(v3); + v5 = (int16)READ_LE_UINT16(v3); v6 = v3 + 2; - v11 = READ_LE_UINT16(v6); + v11 = (int16)READ_LE_UINT16(v6); v3 = v6 + 2; if (_vm->_globals.CarreZone[v4].field2 >= v5) _vm->_globals.CarreZone[v4].field2 = v5; @@ -2160,9 +2160,9 @@ void ObjectsManager::BTGAUCHE() { v3 = _vm->_globals.essai2; v4 = _vm->_globals.chemin; do { - WRITE_LE_UINT16(v3 + 2 * v2, READ_LE_UINT16(v4 + 2 * v2)); + WRITE_LE_UINT16(v3 + 2 * v2, (int16)READ_LE_UINT16(v4 + 2 * v2)); ++v2; - } while ((int16)READ_LE_UINT16(v4 + 2 * v2) != -1); + } while ((int16)(int16)READ_LE_UINT16(v4 + 2 * v2) != -1); v5 = _vm->_globals.essai2; WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v2, (uint16)-1); WRITE_LE_UINT16(v5 + 2 * v2 + 2, (uint16)-1); @@ -2793,29 +2793,29 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { v1 = 0; v13 = 0; v14 = -1; - v2 = READ_LE_UINT16(a1 + 2); - v15 = READ_LE_UINT16(a1 + 4); - if ((int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { + v2 = (int16)READ_LE_UINT16(a1 + 2); + v15 = (int16)READ_LE_UINT16(a1 + 4); + if ((int16)(int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { while (1) { if (v14 != -1 && v15 != v14) { v11 = v1; v12 = 0; v10 = CALC_PROPRE(v2); - v4 = READ_LE_UINT16(a1 + 2 * v1); - v9 = READ_LE_UINT16(a1 + 2 * v1); - v5 = READ_LE_UINT16(a1 + 2 * v1 + 2); + v4 = (int16)READ_LE_UINT16(a1 + 2 * v1); + v9 = (int16)READ_LE_UINT16(a1 + 2 * v1); + v5 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 2); v6 = 0; while (v4 != -1 || v5 != -1) { int idx = v1; v1 += 4; ++v12; - if (READ_LE_UINT16(a1 + 2 * idx + 4) != v15) + if ((int16)READ_LE_UINT16(a1 + 2 * idx + 4) != v15) v6 = 1; if (v6 == 1) break; - v4 = READ_LE_UINT16(a1 + 2 * v1); - v9 = READ_LE_UINT16(a1 + 2 * v1); - v5 = READ_LE_UINT16(a1 + 2 * v1 + 2); + v4 = (int16)READ_LE_UINT16(a1 + 2 * v1); + v9 = (int16)READ_LE_UINT16(a1 + 2 * v1); + v5 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 2); } if (v12 < v10) { v7 = v11; @@ -2837,9 +2837,9 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { if (v13 == 1) break; v14 = v15; - v2 = READ_LE_UINT16(a1 + 2 * v1 + 2); - v15 = READ_LE_UINT16(a1 + 2 * v1 + 4); - if (READ_LE_UINT16(a1 + 2 * v1) == -1) { + v2 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 2); + v15 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 4); + if ((int16)READ_LE_UINT16(a1 + 2 * v1) == -1) { if (v2 == -1) break; } @@ -3083,9 +3083,9 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { if (_vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { v27 = 0; while (1) { - v28 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27); - v29 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 2); - v66 = READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 4); + v28 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27); + v29 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 2); + v66 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 4); v27 = v27 + 4; v30 = v27; v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v83, &v88, 0, DERLIGNE); @@ -3120,8 +3120,8 @@ LABEL_90: v35 = v68; for (i = _vm->_linesManager.Ligne[v69].field0; v35 < (i - 2); i = _vm->_linesManager.Ligne[v69].field0) { v37 = _vm->_linesManager.Ligne[v69].fieldC; - v38 = READ_LE_UINT16(v37 + 4 * v35); - int v37_2 = READ_LE_UINT16(v37 + 4 * v35 + 2); + v38 = (int16)READ_LE_UINT16(v37 + 4 * v35); + int v37_2 = (int16)READ_LE_UINT16(v37 + 4 * v35 + 2); v39 = v67; _vm->_globals.super_parcours[v39] = v38; _vm->_globals.super_parcours[v39 + 1] = v37_2; @@ -3133,8 +3133,8 @@ LABEL_90: } for (j = v69 + 1; j < v73; ++j) { if (_vm->_linesManager.PLAN_TEST( - READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC), - READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC + 2), + (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC), + (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC + 2), v67, j, v73, @@ -3150,8 +3150,8 @@ LABEL_88: if (_vm->_linesManager.Ligne[j].field0 - 2 > 0) { do { v41 = _vm->_linesManager.Ligne[j].fieldC; - v42 = READ_LE_UINT16(v41 + 4 * v40); - int v41_2 = READ_LE_UINT16(v41 + 4 * v40 + 2); + v42 = (int16)READ_LE_UINT16(v41 + 4 * v40); + int v41_2 = (int16)READ_LE_UINT16(v41 + 4 * v40 + 2); v43 = v67; _vm->_globals.super_parcours[v43] = v42; _vm->_globals.super_parcours[v43 + 1] = v41_2; @@ -3168,8 +3168,8 @@ LABEL_88: if (v69 > v73) { for (k = v68; k > 0; --k) { v45 = _vm->_linesManager.Ligne[v69].fieldC; - v46 = READ_LE_UINT16(v45 + 4 * k); - int v45_2 = READ_LE_UINT16(v45 + 4 * k + 2); + v46 = (int16)READ_LE_UINT16(v45 + 4 * k); + int v45_2 = (int16)READ_LE_UINT16(v45 + 4 * k + 2); v47 = v67; _vm->_globals.super_parcours[v47] = v46; _vm->_globals.super_parcours[v47 + 1] = v45_2; @@ -3180,8 +3180,8 @@ LABEL_88: for (l = v69 - 1; l > v73; --l) { v48 = l; if (_vm->_linesManager.PLAN_TEST( - READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 4), - READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 2), + (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 4), + (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 2), v67, l, v73, @@ -3191,8 +3191,8 @@ LABEL_88: if ((_vm->_linesManager.Ligne[v48].field0 - 2) > 0) { do { v50 = _vm->_linesManager.Ligne[l].fieldC; - v51 = READ_LE_UINT16(v50 + 4 * v49); - int v50_2 = READ_LE_UINT16(v50 + 4 * v49 + 2); + v51 = (int16)READ_LE_UINT16(v50 + 4 * v49); + int v50_2 = (int16)READ_LE_UINT16(v50 + 4 * v49 + 2); v52 = v67; _vm->_globals.super_parcours[v52] = v51; _vm->_globals.super_parcours[v52 + 1] = v50_2; @@ -3212,8 +3212,8 @@ LABEL_88: v57 = v68; do { v58 = _vm->_linesManager.Ligne[v73].fieldC; - v59 = READ_LE_UINT16(v58 + 4 * v57); - int v58_2 = READ_LE_UINT16(v58 + 4 * v57 + 2); + v59 = (int16)READ_LE_UINT16(v58 + 4 * v57); + int v58_2 = (int16)READ_LE_UINT16(v58 + 4 * v57 + 2); v60 = v67; _vm->_globals.super_parcours[v60] = v59; _vm->_globals.super_parcours[v60 + 1] = v58_2; @@ -3227,8 +3227,8 @@ LABEL_88: v53 = v68; do { v54 = _vm->_linesManager.Ligne[v73].fieldC; - v55 = READ_LE_UINT16(v54 + 4 * v53); - int v54_2 = READ_LE_UINT16(v54 + 4 * v53 + 2); + v55 = (int16)READ_LE_UINT16(v54 + 4 * v53); + int v54_2 = (int16)READ_LE_UINT16(v54 + 4 * v53 + 2); v56 = v67; _vm->_globals.super_parcours[2 * v56] = v55; _vm->_globals.super_parcours[2 * v56 + 1] = v54_2; @@ -4002,9 +4002,9 @@ int ObjectsManager::Traduction(byte *a1) { v70 = *(a1 + 6); v2 = *(a1 + 7); v69 = *(a1 + 8); - v67 = READ_LE_UINT16(a1 + 9); - v65 = READ_LE_UINT16(a1 + 11); - v3 = READ_LE_UINT16(a1 + 13); + v67 = (int16)READ_LE_UINT16(a1 + 9); + v65 = (int16)READ_LE_UINT16(a1 + 11); + v3 = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { @@ -4123,10 +4123,10 @@ LABEL_104: v72 = *(a1 + 5); v70 = *(a1 + 6); v4 = *(a1 + 7); - v68 = READ_LE_UINT16(a1 + 8); - v66 = READ_LE_UINT16(a1 + 10); + v68 = (int16)READ_LE_UINT16(a1 + 8); + v66 = (int16)READ_LE_UINT16(a1 + 10); if (v72 == 52) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, READ_LE_UINT16(a1 + 10), v70); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(a1 + 10), v70); } else if (v72 == 51) { BOB_VIVANT(v70); } else { @@ -4154,7 +4154,7 @@ LABEL_1141: DEUXPERSO = 0; v5 = *(a1 + 5); v6 = *(a1 + 8); - PERX = READ_LE_UINT16(a1 + 6); + PERX = (int16)READ_LE_UINT16(a1 + 6); PERY = v6; PERI = v5; if (CH_TETE == 1) { @@ -4240,14 +4240,14 @@ LABEL_1141: } if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { if (DESACTIVE != 1) - VBOB_OFF(READ_LE_UINT16(a1 + 5)); + VBOB_OFF((int16)READ_LE_UINT16(a1 + 5)); v1 = 1; } if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { - v73 = READ_LE_UINT16(a1 + 5); + v73 = (int16)READ_LE_UINT16(a1 + 5); if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { v70 = 0; - if (READ_LE_UINT16(a1 + 5) == 14) + if ((int16)READ_LE_UINT16(a1 + 5) == 14) v73 = 1; if (v73 == 17) v73 = 7; @@ -4429,7 +4429,7 @@ LABEL_1141: if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') v1 = 1; if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; v10 = 0; @@ -4444,37 +4444,37 @@ LABEL_1141: if (*(a1 + 2) == 'O') { if (*(a1 + 3) == 'B' && *(a1 + 4) == 'P') { v1 = 1; - AJOUTE_OBJET(READ_LE_UINT16(a1 + 5)); + AJOUTE_OBJET((int16)READ_LE_UINT16(a1 + 5)); } if (*(a1 + 2) == 'O' && *(a1 + 3) == 'B' && *(a1 + 4) == 'M') { v1 = 1; - DELETE_OBJET(READ_LE_UINT16(a1 + 5)); + DELETE_OBJET((int16)READ_LE_UINT16(a1 + 5)); } } if (*(a1 + 2) == 'G' && *(a1 + 3) == 'O' && *(a1 + 4) == 'T') v1 = 2; if (*(a1 + 2) == 'Z') { if (*(a1 + 3) == 'O' && *(a1 + 4) == 'N') { - ZONE_ON(READ_LE_UINT16(a1 + 5)); + ZONE_ON((int16)READ_LE_UINT16(a1 + 5)); v1 = 1; } if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - ZONE_OFF(READ_LE_UINT16(a1 + 5)); + ZONE_OFF((int16)READ_LE_UINT16(a1 + 5)); v1 = 1; } } if (*(a1 + 2) == 'E' && *(a1 + 3) == 'X' && *(a1 + 4) == 'I') v1 = 5; if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'R') { - _vm->_globals.SORTIE = READ_LE_UINT16(a1 + 5); + _vm->_globals.SORTIE = (int16)READ_LE_UINT16(a1 + 5); v1 = 5; } if (*(a1 + 2) == 'B' && *(a1 + 3) == 'C' && *(a1 + 4) == 'A') { - _vm->_globals.CACHE_OFF(READ_LE_UINT16(a1 + 5)); + _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(a1 + 5)); v1 = 1; } if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { - v75 = READ_LE_UINT16(a1 + 5); + v75 = (int16)READ_LE_UINT16(a1 + 5); if (v75 <= 100) BOBANIM_ON(v75); else @@ -4482,7 +4482,7 @@ LABEL_1141: v1 = 1; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { - v76 = READ_LE_UINT16(a1 + 5); + v76 = (int16)READ_LE_UINT16(a1 + 5); if (v76 == 7) _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); if (v76 == 8) @@ -6051,32 +6051,32 @@ LABEL_1141: v1 = 4; if (*(a1 + 2) == 'V' && *(a1 + 3) == 'A' && *(a1 + 4) == 'L') { v1 = 1; - _vm->_globals.SAUVEGARDE->data[READ_LE_UINT16(a1 + 5)] = READ_LE_UINT16(a1 + 7); + _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] = (int16)READ_LE_UINT16(a1 + 7); } if (*(a1 + 2) == 'A' && *(a1 + 3) == 'D' && *(a1 + 4) == 'D') { v1 = 1; - _vm->_globals.SAUVEGARDE->data[READ_LE_UINT16(a1 + 5)] += *(a1 + 7); + _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] += *(a1 + 7); } if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'S') { v1 = 1; - BOB_OFFSET(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); + BOB_OFFSET((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); } if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'N') { - VERBE_ON(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); + VERBE_ON((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); v1 = 1; } if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'C' && *(a1 + 4) == 'H') { - _vm->_globals.ZONEP[READ_LE_UINT16(a1 + 5)].field12 = READ_LE_UINT16(a1 + 7); + _vm->_globals.ZONEP[(int16)READ_LE_UINT16(a1 + 5)].field12 = (int16)READ_LE_UINT16(a1 + 7); v1 = 1; } if (*(a1 + 2) == 'J' && *(a1 + 3) == 'U' && *(a1 + 4) == 'M') { - v59 = READ_LE_UINT16(a1 + 7); - NVZONE = READ_LE_UINT16(a1 + 5); + v59 = (int16)READ_LE_UINT16(a1 + 7); + NVZONE = (int16)READ_LE_UINT16(a1 + 5); NVVERBE = v59; v1 = 6; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { - v60 = READ_LE_UINT16(a1 + 5); + v60 = (int16)READ_LE_UINT16(a1 + 5); memset(&s, 0, 0x13u); v77 = Common::String::format("SOUND%d.WAV", v60); @@ -6084,7 +6084,7 @@ LABEL_1141: v1 = 1; } if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - VERBE_OFF(READ_LE_UINT16(a1 + 5), READ_LE_UINT16(a1 + 7)); + VERBE_OFF((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); v1 = 1; } if (*(a1 + 2) == 'I' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') { @@ -6101,10 +6101,10 @@ void ObjectsManager::BOB_VIVANT(int idx) { int v4; v1 = 5 * idx; - v2 = READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); - v3 = READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 2); + v2 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); + v3 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 2); v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); - if (READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { + if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { if (!_vm->_globals.NO_OFFSET) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, _vm->_graphicsManager.ofscroll + v2, v3, @@ -6478,7 +6478,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } if (!OBSSEUL) { for (int idx = 0; idx < 500; ++idx) - _vm->_globals.STAILLE[idx] = READ_LE_UINT16((uint16 *)ptr + idx); + _vm->_globals.STAILLE[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx); _vm->_globals.RESET_CACHE(); @@ -6501,12 +6501,12 @@ void ObjectsManager::INILINK(const Common::String &file) { v40 = 0; do { - v8 = READ_LE_UINT16(v37 + 2 * v36); - v9 = READ_LE_UINT16(v37 + 2 * v36 + 2); - v10 = READ_LE_UINT16(v37 + 2 * v36 + 4); + v8 = (int16)READ_LE_UINT16(v37 + 2 * v36); + v9 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 2); + v10 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 4); v11 = v40; - _vm->_globals.Cache[v11].field14 = READ_LE_UINT16(v37 + 2 * v36 + 8); + _vm->_globals.Cache[v11].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); _vm->_globals.Cache[v11].field2 = v8; _vm->_globals.Cache[v11].field0 = v9; _vm->_globals.Cache[v11].field4 = v10; @@ -6544,15 +6544,15 @@ void ObjectsManager::INILINK(const Common::String &file) { v34 = 0; _vm->_linesManager.TOTAL_LIGNES = 0; do { - v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); + v27 = (int16)(int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { _vm->_linesManager.AJOUTE_LIGNE( v34, v27, - READ_LE_UINT16(v16 + 2 * v32 + 2), - READ_LE_UINT16(v16 + 2 * v32 + 4), - READ_LE_UINT16(v16 + 2 * v32 + 6), - READ_LE_UINT16(v16 + 2 * v32 + 8), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 2), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 4), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 6), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 8), 1); ++_vm->_linesManager.TOTAL_LIGNES; } @@ -6594,14 +6594,14 @@ void ObjectsManager::INILINK(const Common::String &file) { v31 = 0; do { - v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); + v28 = (int16)(int16)READ_LE_UINT16(v17 + 2 * v33); if (v28 != -1) { _vm->_linesManager.AJOUTE_LIGNE_ZONE( v35, - READ_LE_UINT16(v17 + 2 * v33 + 2), - READ_LE_UINT16(v17 + 2 * v33 + 4), - READ_LE_UINT16(v17 + 2 * v33 + 6), - READ_LE_UINT16(v17 + 2 * v33 + 8), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 2), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 4), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 6), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 8), v28); _vm->_globals.ZONEP[v28].field10 = 1; } @@ -6612,9 +6612,9 @@ void ObjectsManager::INILINK(const Common::String &file) { v20 = 1; do { v21 = v20; - _vm->_globals.ZONEP[v21].field0 = READ_LE_UINT16(v17 + 2 * v33); - _vm->_globals.ZONEP[v21].field2 = READ_LE_UINT16(v17 + 2 * v33 + 2); - _vm->_globals.ZONEP[v21].field4 = READ_LE_UINT16(v17 + 2 * v33 + 4); + _vm->_globals.ZONEP[v21].field0 = (int16)READ_LE_UINT16(v17 + 2 * v33); + _vm->_globals.ZONEP[v21].field2 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); + _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; ++v20; } while (v20 <= 100); @@ -6640,7 +6640,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v30 = 0; v25 = 1; do - _vm->_globals.ZONEP[v25].field12 = READ_LE_UINT16(v22 + 1010 + 2 * v30++); + _vm->_globals.ZONEP[v25].field12 = (int16)READ_LE_UINT16(v22 + 1010 + 2 * v30++); while (++v25 <= 100); CARRE_ZONE(); } @@ -6796,7 +6796,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { } int ObjectsManager::Control_Goto(const byte *dataP) { - return READ_LE_UINT16(dataP + 5); + return (int16)READ_LE_UINT16(dataP + 5); } int ObjectsManager::Control_If(const byte *dataP, int a2) { @@ -6849,10 +6849,10 @@ LABEL_2: v9 = *(v8 + 13); v17 = *(v8 + 14); v16 = *(v8 + 15); - v10 = READ_LE_UINT16(v8 + 5); - v11 = READ_LE_UINT16(v8 + 7); - v19 = READ_LE_UINT16(v8 + 9); - v18 = READ_LE_UINT16(v8 + 11); + v10 = (int16)READ_LE_UINT16(v8 + 5); + v11 = (int16)READ_LE_UINT16(v8 + 7); + v19 = (int16)READ_LE_UINT16(v8 + 9); + v18 = (int16)READ_LE_UINT16(v8 + 11); v14 = 0; v15 = 0; if (v9 == 1 && _vm->_globals.SAUVEGARDE->data[v10] == v11) @@ -7157,10 +7157,10 @@ int ObjectsManager::colision(int a1, int a2) { byte *srcP = _vm->_linesManager.LigneZone[v8].field4; if (srcP != g_PTRNUL) { bool flag = true; - int v11 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2); - int dataV2 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2 + 2); - int v12 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 4); - int v13 = READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 2); + int v11 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2); + int dataV2 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2 + 2); + int v12 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 4); + int v13 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 2); int v10 = v13; if (v11 < v12 && v4 >= v11 && v5 > v13) @@ -7176,8 +7176,8 @@ int ObjectsManager::colision(int a1, int a2) { if (!flag) { if (v11 < _vm->_linesManager.LigneZone[v8].field0) { for (; v11 < _vm->_linesManager.LigneZone[v8].field0; ++idx) { - int v11 = READ_LE_UINT16(srcP); - int v12 = READ_LE_UINT16(srcP + 2); + int v11 = (int16)READ_LE_UINT16(srcP); + int v12 = (int16)READ_LE_UINT16(srcP + 2); srcP += 4; if ((v2 == v11 || v9 == v11) && a2 == v12) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 589183157a..dc2f8d045c 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -78,9 +78,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } else if (_vm->_globals.FR == 2) { FREPON = FQUEST = "RUEES.TXT"; } - v2 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); - v3 = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); + v3 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v16, 7); if (PERSOSPR) { _vm->_globals.CAT_FLAG = 0; @@ -218,8 +218,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { break; } - v1 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); - PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; CHERCHE_PAL(PCHERCHE, 0); PLIGNE1 = v1; PLIGNE2 = v1 + 1; @@ -288,17 +288,17 @@ int TalkManager::DIALOGUE() { if (STATI) { v0 = BUFFERPERSO; - v1 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); if (v1) _vm->_objectsManager.BOBANIM_ON(v1); - if (READ_LE_UINT16((uint16 *)v0 + 48) != 1) - _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 49)); - if (READ_LE_UINT16((uint16 *)v0 + 48) != 2) - _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 50)); - if ( READ_LE_UINT16((uint16 *)v0 + 48) != 3) - _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 51)); - if (READ_LE_UINT16((uint16 *)v0 + 48) != 4) - _vm->_objectsManager.BOBANIM_ON(READ_LE_UINT16((uint16 *)v0 + 52)); + if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 1) + _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 49)); + if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 2) + _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 50)); + if ( (int16)READ_LE_UINT16((uint16 *)v0 + 48) != 3) + _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 51)); + if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 4) + _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 52)); } else { VISU_WAIT(); } @@ -361,19 +361,19 @@ int TalkManager::DIALOGUE() { if (STATI) { v11 = BUFFERPERSO; - v12 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + v12 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); if (v12) _vm->_objectsManager.BOBANIM_OFF(v12); - v13 = READ_LE_UINT16((uint16 *)v11 + 49); + v13 = (int16)READ_LE_UINT16((uint16 *)v11 + 49); if (v13 != 1) _vm->_objectsManager.BOBANIM_OFF(v13); - v14 = READ_LE_UINT16((uint16 *)v11 + 50); + v14 = (int16)READ_LE_UINT16((uint16 *)v11 + 50); if (v14 != 2) _vm->_objectsManager.BOBANIM_OFF(v14); - v15 = READ_LE_UINT16((uint16 *)v11 + 51); + v15 = (int16)READ_LE_UINT16((uint16 *)v11 + 51); if (v15 != 3) _vm->_objectsManager.BOBANIM_OFF(v15); - v16 = READ_LE_UINT16((uint16 *)v11 + 52); + v16 = (int16)READ_LE_UINT16((uint16 *)v11 + 52); if (v16 != 4) _vm->_objectsManager.BOBANIM_OFF(v16); } else { @@ -413,9 +413,9 @@ int TalkManager::DIALOGUE_REP(int idx) { v1 = 0; v2 = 0; v3 = BUFFERPERSO + 110; - for (i = idx; READ_LE_UINT16(v3) != idx; v3 = BUFFERPERSO + 20 * v1 + 110) { + for (i = idx; (int16)READ_LE_UINT16(v3) != idx; v3 = BUFFERPERSO + 20 * v1 + 110) { ++v1; - if (READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) < v1) + if ((int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) < v1) v2 = 1; if (v2 == 1) return -1; @@ -424,16 +424,16 @@ int TalkManager::DIALOGUE_REP(int idx) { if (v2 == 1) return -1; - v22 = READ_LE_UINT16((uint16 *)v3 + 1); - v25 = READ_LE_UINT16((uint16 *)v3 + 2); - v24 = READ_LE_UINT16((uint16 *)v3 + 3); - i = READ_LE_UINT16((uint16 *)v3 + 4); - v23 = READ_LE_UINT16((uint16 *)v3 + 4); - PLIGNE1 = READ_LE_UINT16((uint16 *)v3 + 5); - PLIGNE2 = READ_LE_UINT16((uint16 *)v3 + 6); - PLIGNE3 = READ_LE_UINT16((uint16 *)v3 + 7); - v6 = READ_LE_UINT16((uint16 *)v3 + 8); - v7 = READ_LE_UINT16((uint16 *)v3 + 9); + v22 = (int16)READ_LE_UINT16((uint16 *)v3 + 1); + v25 = (int16)READ_LE_UINT16((uint16 *)v3 + 2); + v24 = (int16)READ_LE_UINT16((uint16 *)v3 + 3); + i = (int16)READ_LE_UINT16((uint16 *)v3 + 4); + v23 = (int16)READ_LE_UINT16((uint16 *)v3 + 4); + PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)v3 + 5); + PLIGNE2 = (int16)READ_LE_UINT16((uint16 *)v3 + 6); + PLIGNE3 = (int16)READ_LE_UINT16((uint16 *)v3 + 7); + v6 = (int16)READ_LE_UINT16((uint16 *)v3 + 8); + v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9); if (v7) _vm->_globals.SAUVEGARDE->data[svField4] = v7; @@ -442,19 +442,19 @@ int TalkManager::DIALOGUE_REP(int idx) { v6 = 10; if (STATI) { v8 = BUFFERPERSO; - v9 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v9 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); if (v9) _vm->_objectsManager.BOBANIM_ON(v9); - v10 = READ_LE_UINT16((uint16 *)v8 + 44); + v10 = (int16)READ_LE_UINT16((uint16 *)v8 + 44); if (v10) _vm->_objectsManager.BOBANIM_ON(v10); - v11 = READ_LE_UINT16((uint16 *)v8 + 45); + v11 = (int16)READ_LE_UINT16((uint16 *)v8 + 45); if (v11) _vm->_objectsManager.BOBANIM_ON(v11); - v12 = READ_LE_UINT16((uint16 *)v8 + 46); + v12 = (int16)READ_LE_UINT16((uint16 *)v8 + 46); if (v12) _vm->_objectsManager.BOBANIM_ON(v12); - v13 = READ_LE_UINT16((uint16 *)v8 + 47); + v13 = (int16)READ_LE_UINT16((uint16 *)v8 + 47); if (v13) _vm->_objectsManager.BOBANIM_ON(v13); } else { @@ -480,19 +480,19 @@ int TalkManager::DIALOGUE_REP(int idx) { _vm->_fontManager.TEXTE_OFF(9); if (STATI) { v15 = BUFFERPERSO; - v16 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v16 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); if (v16) _vm->_objectsManager.BOBANIM_OFF(v16); - v17 = READ_LE_UINT16((uint16 *)v15 + 44); + v17 = (int16)READ_LE_UINT16((uint16 *)v15 + 44); if (v17) _vm->_objectsManager.BOBANIM_OFF(v17); - v18 = READ_LE_UINT16((uint16 *)v15 + 45); + v18 = (int16)READ_LE_UINT16((uint16 *)v15 + 45); if (v18) _vm->_objectsManager.BOBANIM_OFF(v18); - v19 = READ_LE_UINT16((uint16 *)v15 + 46); + v19 = (int16)READ_LE_UINT16((uint16 *)v15 + 46); if (v19) _vm->_objectsManager.BOBANIM_OFF(v19); - v20 = READ_LE_UINT16((uint16 *)v15 + 47); + v20 = (int16)READ_LE_UINT16((uint16 *)v15 + 47); if (v20) _vm->_objectsManager.BOBANIM_OFF(v20); } else { @@ -718,10 +718,10 @@ void TalkManager::BOB_VISU_PARLE(int idx) { if (!_vm->_globals.Bob[idx].field0) { _vm->_objectsManager.BOB_ZERO(idx); v5 = _vm->_globals.Bqe_Anim[idx].data; - v4 = READ_LE_UINT16(v5 + 2); + v4 = (int16)READ_LE_UINT16(v5 + 2); if (!v4) v4 = 1; - if (READ_LE_UINT16(v5 + 24)) { + if ((int16)READ_LE_UINT16(v5 + 24)) { _vm->_globals.Bob[idx].field3A = 1; _vm->_globals.Bob[idx].field36 = 0; _vm->_globals.Bob[idx].field38 = 0; @@ -772,10 +772,10 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { if (!a2) { v6 = 0; do { - v7 = READ_LE_UINT16(&v8[2 * v6 + 4]); + v7 = (int16)READ_LE_UINT16(&v8[2 * v6 + 4]); if (v7 && _vm->_globals.vitesse != 501) - _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager.start_x + READ_LE_UINT16(&v8[2 * v6]), - READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); + _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager.start_x + (int16)READ_LE_UINT16(&v8[2 * v6]), + (int16)READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); v6 += 5; } while (_vm->_globals.vitesse != 501 && v7); } @@ -797,34 +797,34 @@ void TalkManager::ANIM_PERSO_INIT() { v0 = BUFFERPERSO; v1 = BUFFERPERSO + 110; - v2 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); if (v2) RECHERCHE_ANIM_PERSO(21, (BUFFERPERSO + 110), v2, TAILLEPERSO); - v4 = READ_LE_UINT16((uint16 *)v0 + 44); + v4 = (int16)READ_LE_UINT16((uint16 *)v0 + 44); if (v4) RECHERCHE_ANIM_PERSO(22, v1, v4, TAILLEPERSO); - v5 = READ_LE_UINT16((uint16 *)v0 + 45); + v5 = (int16)READ_LE_UINT16((uint16 *)v0 + 45); if (v5) RECHERCHE_ANIM_PERSO(23, v1, v5, TAILLEPERSO); - v6 = READ_LE_UINT16((uint16 *)v0 + 46); + v6 = (int16)READ_LE_UINT16((uint16 *)v0 + 46); if (v6) RECHERCHE_ANIM_PERSO(24, v1, v6, TAILLEPERSO); - v7 = READ_LE_UINT16((uint16 *)v0 + 47); + v7 = (int16)READ_LE_UINT16((uint16 *)v0 + 47); if (v7) RECHERCHE_ANIM_PERSO(25, v1, v7, TAILLEPERSO); - v8 = READ_LE_UINT16((uint16 *)v0 + 48); + v8 = (int16)READ_LE_UINT16((uint16 *)v0 + 48); if (v8) RECHERCHE_ANIM_PERSO(26, v1, v8, TAILLEPERSO); - v9 = READ_LE_UINT16((uint16 *)v0 + 49); + v9 = (int16)READ_LE_UINT16((uint16 *)v0 + 49); if (v9) RECHERCHE_ANIM_PERSO(27, v1, v9, TAILLEPERSO); - v10 = READ_LE_UINT16((uint16 *)v0 + 50); + v10 = (int16)READ_LE_UINT16((uint16 *)v0 + 50); if (v10) RECHERCHE_ANIM_PERSO(28, v1, v10, TAILLEPERSO); - v11 = READ_LE_UINT16((uint16 *)v0 + 51); + v11 = (int16)READ_LE_UINT16((uint16 *)v0 + 51); if (v11) RECHERCHE_ANIM_PERSO(29, v1, v11, TAILLEPERSO); - v12 = READ_LE_UINT16((uint16 *)v0 + 52); + v12 = (int16)READ_LE_UINT16((uint16 *)v0 + 52); if (v12) RECHERCHE_ANIM_PERSO(30, v1, v12, TAILLEPERSO); } @@ -893,10 +893,10 @@ bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int v9 = v8 + 20; v24 = v22 + bufPerso + 25; - v10 = READ_LE_UINT16(v22 + bufPerso + 25); - v11 = READ_LE_UINT16(v22 + bufPerso + 27); - v23 = READ_LE_UINT16(v22 + bufPerso + 29); - v12 = READ_LE_UINT16(v22 + bufPerso + 31); + v10 = (int16)READ_LE_UINT16(v22 + bufPerso + 25); + v11 = (int16)READ_LE_UINT16(v22 + bufPerso + 27); + v23 = (int16)READ_LE_UINT16(v22 + bufPerso + 29); + v12 = (int16)READ_LE_UINT16(v22 + bufPerso + 31); v13 = *(v22 + bufPerso + 33); *(v8 + 29) = *(v22 + bufPerso + 34); WRITE_LE_UINT16(v8 + 20, v10); @@ -910,10 +910,10 @@ bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int v24 += 10; if (!v23) break; - v14 = READ_LE_UINT16(v24); - v15 = READ_LE_UINT16(v24 + 2); - v23 = READ_LE_UINT16(v24 + 4); - v16 = READ_LE_UINT16(v24 + 6); + v14 = (int16)READ_LE_UINT16(v24); + v15 = (int16)READ_LE_UINT16(v24 + 2); + v23 = (int16)READ_LE_UINT16(v24 + 4); + v16 = (int16)READ_LE_UINT16(v24 + 6); v17 = *(v24 + 8); *(v9 + 9) = *(v24 + 9); WRITE_LE_UINT16(v9, v14); @@ -1217,8 +1217,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); - v10 = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + v10 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = 1; CHERCHE_PAL(v10, 1); @@ -1304,7 +1304,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); v15 = v15 + 614396; v14 = v14 + 614396; - WRITE_LE_UINT16(v14, READ_LE_UINT16(v15)); + WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15)); v14 = v14 + 2; *v14 = *(v15 + 2); v16 = v14 + 1; -- cgit v1.2.3 From e0221cc58e2148fc34644427bb9682b6dfa33127 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 12 Oct 2012 22:42:56 +1100 Subject: HOPKINS: Some field renaming and fix loading of sprite positions --- engines/hopkins/objects.cpp | 23 +++++++++++------------ engines/hopkins/objects.h | 6 +++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 559eb6558c..423a1e6014 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -90,7 +90,7 @@ ObjectsManager::ObjectsManager() { T_RECTIF = 0; DESACTIVE = 0; DEUXPERSO = 0; - PERX, PERY = 0; + PERX = PERY = 0; PERI = 0; RECALL = 0; PTAILLE = 0; @@ -1181,7 +1181,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int v17; int v22; - Sprite[idx + 42].field2A = 0; + Sprite[idx].field2A = 0; int v0 = Sprite[idx].field10; if (v0 != 250) { if (Sprite[idx].fieldE) { @@ -1256,8 +1256,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } } - v15 = Sprite[idx].field8 - v22; - v16 = Sprite[idx].fieldA - v7; + v15 = Sprite[idx].spritePos.x - v22; + v16 = Sprite[idx].spritePos.y - v7; Sprite[idx].field2C = v15; Sprite[idx].field2E = v16; Sprite[idx].field2A = 1; @@ -1606,13 +1606,13 @@ void ObjectsManager::AFF_VBOB() { int ObjectsManager::XSPR(int idx) { if (idx > 5) error("request of the Coord. x a sprite > MAX_SPRITE."); - return Sprite[idx].field8; + return Sprite[idx].spritePos.x; } int ObjectsManager::YSPR(int idx) { if (idx > 5) error("request of the Coord. y a sprite > MAX_SPRITE."); - return Sprite[idx].fieldA; + return Sprite[idx].spritePos.y; } void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { @@ -1649,12 +1649,11 @@ void ObjectsManager::SPRITE_ON(int idx) { Sprite[idx].field0 = 1; } -void ObjectsManager::SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9) { +void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9) { if (idx > 5) error("Tentative d'affichage d'un sprite > MAX_SPRITE."); Sprite[idx].spriteData = spriteData; - Sprite[idx].field8 = a2; - Sprite[idx].fieldA = a3; + Sprite[idx].spritePos = Common::Point(xp, yp); Sprite[idx].field10 = a5; Sprite[idx].fieldC = a6; Sprite[idx].field12 = a8; @@ -1732,7 +1731,7 @@ void ObjectsManager::SETPOSISPR(int idx, int a2) { void ObjectsManager::SETXSPR(int idx, int xp) { if (idx > 5) error("Set the Coord. x a sprite> MAX_SPRITE."); - Sprite[idx].field8 = xp; + Sprite[idx].spritePos.x = xp; } void ObjectsManager::SETANISPR(int idx, int a2) { @@ -1745,7 +1744,7 @@ void ObjectsManager::SETANISPR(int idx, int a2) { void ObjectsManager::SETYSPR(int idx, int yp) { if ( idx > 5 ) error("Set the Coord. y a sprite> MAX_SPRITE."); - Sprite[idx].fieldA = yp; + Sprite[idx].spritePos.y = yp; } void ObjectsManager::SETTAILLESPR(int idx, int a2) { @@ -4153,7 +4152,7 @@ LABEL_1141: if (DESACTIVE != 1) { DEUXPERSO = 0; v5 = *(a1 + 5); - v6 = *(a1 + 8); + v6 = (int16)READ_LE_UINT16(a1 + 8); PERX = (int16)READ_LE_UINT16(a1 + 6); PERY = v6; PERI = v5; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index e12949b2e2..219607c93b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -32,8 +32,8 @@ namespace Hopkins { struct SpriteItem { int field0; const byte *spriteData; - int field8; - int fieldA; + Common::Point spritePos; + int spriteY; int fieldC; int fieldE; int field10; @@ -173,7 +173,7 @@ public: void CLEAR_SPR(); void SPRITE_ON(int idx); - void SPRITE(const byte *spriteData, int a2, int a3, int idx, int a5, int a6, int a7, int a8, int a9); + void SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9); void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5); void SPRITE_OFF(int idx); void SPRITE_GEL(int idx); -- cgit v1.2.3 From 9bf3e363e0f85b23d7ec59333a45db8354cbea66 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 10:23:33 +1100 Subject: HOPKINS: Fixed problems in Affiche_Perfect --- engines/hopkins/graphics.cpp | 767 ++++++++++++++++++++----------------------- engines/hopkins/graphics.h | 2 +- 2 files changed, 357 insertions(+), 412 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 4912849344..4b4b7f1d58 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1724,25 +1724,25 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { return v; } -void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8) { +void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int spriteIndex, int a6, int a7, int a8) { const byte *v8; int i; - const byte *v10; + const byte *v10; int v11; int v12; const byte *v13; byte *v14; - int v15; + int v15; byte *v16; - int v17; + int v17; int v18; - int v19; - int v20; - int v21 = 0; - int v22; + int v19; + int v20; + int v21 = 0; + int v22; int v23; - int v24; - int v25; + int v24; + int v25; int v26; int v27; int v28; @@ -1752,448 +1752,393 @@ void GraphicsManager::Affiche_Perfect(byte *destSurface, const byte *srcData, in int v32; int v33; int v34; - int v35; - int v36 = 0; + int v35; + int v36; int v37; int v38; - int v39; + uint16 v39; byte *v40; int v41; - int v42; - const byte *v43; - const byte *v44; - const byte *v45; - const byte *v46; - byte *v47; - byte *v48; + uint16 v42; + const byte *v43; + const byte *v44; + const byte *v45; + const byte *v46; + byte *v47; + byte *v48; int v49; int v50; byte *v51; - unsigned int v52; - byte *v53; - byte *v54; - byte *v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v61; - int v62; - int v63; - int v64; - int v65; + int v52; + byte *v53; + byte *v54; + byte *v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; + int v63; + int v64; + int v65; v8 = srcData + 3; - for (i = a5; i; --i) + for (i = spriteIndex; i; --i) v8 += READ_LE_UINT32(v8) + 16; - + v11 = 0; v12 = 0; v10 = v8 + 4; - v11 = *(uint16 *)v10; + v11 = (int16)READ_LE_UINT16(v10); v10 += 2; - v12 = *(uint16 *)v10; + v12 = v36 = (int16)READ_LE_UINT16(v10); v13 = v10 + 10; - clip_x = clip_y = 0; - clip_x1 = clip_y1 = 0; - - if (a3 > min_x) { - if ((uint)a3 < (uint)(min_x + 300)) - clip_x = min_x + 300 - a3; - if (a4 > min_y) { - if ((uint)a4 < (uint)(min_y + 300)) - clip_y = min_y + 300 - a4; - if ((uint)a3 < (uint)(max_x + 300)) { - clip_x1 = max_x + 300 - a3; - if ((uint)a4 < (uint)(max_y + 300)) { - clip_y1 = max_y + 300 - a4; - v14 = a3 + nbrligne2 * (a4 - 300) - 300 + destSurface; - - if ((uint16)a7) { - Compteur_y = 0; - Agr_x = 0; - Agr_y = 0; - Agr_Flag_y = 0; - Agr_Flag_x = 0; - Largeur = v11; - v20 = Asm_Zoom(v11, a7); - v22 = Asm_Zoom(v21, a7); - - if (a8) { - v29 = v20 + v14; - if (clip_y) { - if (clip_y >= v22) - return; - v61 = v22; - v52 = v20; - v30 = 0; - v31 = (uint)clip_y; - - while (Asm_Zoom(v30 + 1, a7) < v31) - ; - v20 = v52; - v13 += Largeur * v30; - v29 += nbrligne2 * (uint)clip_y; - v22 = v61 - (uint)clip_y; - } - - if (v22 > clip_y1) - v22 = clip_y1; - if (clip_x) { - if (clip_x >= v20) - return; - v20 -= (uint)clip_x; - } - - if (v20 > clip_x1) { - v32 = v20 - clip_x1; - v29 -= v32; - v62 = v22; - v33 = 0; - - while (Asm_Zoom(v33 + 1, a7) < v32) - ; - v34 = v33; - v22 = v62; - v13 += v34; - v20 = (uint)clip_x1; - } - - do { - for (;;) { - v63 = v22; - v53 = v29; - v46 = v13; - Agr_Flag_x = 0; - Agr_x = 0; - v35 = v20; - - do { - for (;;) { - if (*v13) - *v29 = *v13; - --v29; - ++v13; - if (!Agr_Flag_x) - Agr_x = a7 + Agr_x; - - if ((uint)Agr_x < 100) - break; - - Agr_x = Agr_x - 100; - --v13; - Agr_Flag_x = 1; - --v35; - if (!v35) - goto R_Aff_Zoom_Larg_Cont1; - } - - Agr_Flag_x = 0; - --v35; - } while (v35); - -R_Aff_Zoom_Larg_Cont1: - v13 = Largeur + v46; - v29 = nbrligne2 + v53; - ++Compteur_y; - if (!(uint16)Agr_Flag_y) - Agr_y = a7 + Agr_y; - - if ((uint)Agr_y < 100) - break; - - Agr_y = Agr_y - 100; - v13 = v46; - Agr_Flag_y = 1; - v22 = v63 - 1; - if (v63 == 1) + clip_x = 0; + clip_y = 0; + clip_x1 = 0; + clip_y1 = 0; + if ((unsigned __int16)xp300 > min_x) { + if ((unsigned __int16)xp300 < (unsigned __int16)(min_x + 300)) + clip_x = min_x + 300 - xp300; + if ((unsigned __int16)yp300 > min_y) { + if ((unsigned __int16)yp300 < (unsigned __int16)(min_y + 300)) + clip_y = min_y + 300 - yp300; + if ((unsigned __int16)xp300 < (unsigned __int16)(max_x + 300)) { + clip_x1 = max_x + 300 - xp300; + if ((unsigned __int16)yp300 < (unsigned __int16)(max_y + 300)) { + clip_y1 = max_y + 300 - yp300; + v14 = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; + if (a7) { + Compteur_y = 0; + Agr_x = 0; + Agr_y = 0; + Agr_Flag_y = 0; + Agr_Flag_x = 0; + Largeur = v11; + v20 = Asm_Zoom(v11, a7); + v22 = Asm_Zoom(v21, a7); + if (a8) { + v29 = v20 + v14; + if (clip_y) { + if ((unsigned __int16)clip_y >= v22) return; + v61 = v22; + v52 = v20; + v30 = 0; + v31 = (unsigned __int16)clip_y; + while (Asm_Zoom(v30 + 1, a7) < v31) + ; + v20 = v52; + v13 += Largeur * v30; + v29 += nbrligne2 * (unsigned __int16)clip_y; + v22 = v61 - (unsigned __int16)clip_y; } - - Agr_Flag_y = 0; - v22 = v63 - 1; - } while (v63 != 1); - } else { - if (clip_y) { - if (clip_y >= v22) - return; - v58 = v22; - v49 = v20; - v23 = 0; - v24 = (uint)clip_y; - - while (Asm_Zoom(v23 + 1, a7) < v24) - ; - v20 = v49; - v13 += Largeur * v23; - v14 += nbrligne2 * (uint)clip_y; - v22 = v58 - (uint)clip_y; - } - - if (v22 > clip_y1) - v22 = clip_y1; - - if (clip_x) { - if (clip_x >= v20) - return; - v59 = v22; - v50 = v20; - v25 = (uint)clip_x; - v26 = 0; - - while (Asm_Zoom(v26 + 1, a7) < v25) - ; - v27 = v26; - v22 = v59; - v13 += v27; - v14 += (uint)clip_x; - v20 = v50 - (uint)clip_x; - } - - if (v20 > clip_x1) - v20 = clip_x1; - - do { - for (;;) { - v60 = v22; - v51 = v14; - v45 = v13; - v28 = v20; - Agr_Flag_x = 0; - Agr_x = 0; - - do { - for (;;) { - if (*v13) - *v14 = *v13; - ++v14; - ++v13; - - if (!Agr_Flag_x) - Agr_x = a7 + Agr_x; - if ((uint)Agr_x < 100) - break; - - Agr_x = Agr_x - 100; - --v13; - Agr_Flag_x = 1; - --v28; - - if (!v28) - goto Aff_Zoom_Larg_Cont1; - } - - Agr_Flag_x = 0; - --v28; - } - while (v28); - -Aff_Zoom_Larg_Cont1: - v13 = Largeur + v45; - v14 = nbrligne2 + v51; - if (!(uint16)Agr_Flag_y) - Agr_y = a7 + Agr_y; - - if ((uint)Agr_y < 100) - break; - - Agr_y = Agr_y - 100; - v13 = v45; - Agr_Flag_y = 1; - v22 = v60 - 1; - - if (v60 == 1) + if (v22 > (unsigned __int16)clip_y1) + v22 = (unsigned __int16)clip_y1; + if (clip_x) { + if ((unsigned __int16)clip_x >= v20) return; + v20 -= (unsigned __int16)clip_x; + } + if (v20 > (unsigned __int16)clip_x1) { + v32 = v20 - (unsigned __int16)clip_x1; + v29 -= v32; + v62 = v22; + v33 = 0; + while (Asm_Zoom(v33 + 1, a7) < v32) + ; + v34 = v33; + v22 = v62; + v13 += v34; + v20 = (unsigned __int16)clip_x1; } - - Agr_Flag_y = 0; - v22 = v60 - 1; - } while (v60 != 1); - } - } else if ((uint16)a6) { - Compteur_y = 0; - Red_x = 0; - Red_y = 0; - Largeur = v11; - Red = a6; - - if ((uint)a6 < 100) { - v37 = Asm_Reduc(v11, Red); - if (a8) { - v40 = v37 + v14; - do { - v65 = v36; - v55 = v40; - Red_y = Red + Red_y; - - if ((uint)Red_y < 100) { - Red_x = 0; - v41 = Largeur; - v42 = v37; - + while (1) { + v63 = v22; + v53 = v29; + v46 = v13; + Agr_Flag_x = 0; + Agr_x = 0; + v35 = v20; do { - Red_x = Red + Red_x; - if (Red_x < 100) { - if (v42 >= clip_x && v42 < clip_x1 && *v13) - *v40 = *v13; - --v40; - ++v13; - --v42; - } else { - Red_x = Red_x - 100; + while (1) { + if (*v13) + *v29 = *v13; + --v29; ++v13; + if (!Agr_Flag_x) + Agr_x = a7 + Agr_x; + if ((unsigned __int16)Agr_x < 0x64u) + break; + Agr_x = Agr_x - 100; + --v13; + Agr_Flag_x = 1; + --v35; + if (!v35) + goto R_Aff_Zoom_Larg_Cont1; } - --v41; - } while (v41); - - v36 = v65; - v40 = nbrligne2 + v55; - } else { - Red_y = Red_y - 100; - v13 += Largeur; + Agr_Flag_x = 0; + --v35; + } while (v35); +R_Aff_Zoom_Larg_Cont1: + v13 = Largeur + v46; + v29 = nbrligne2 + v53; + ++Compteur_y; + if (!Agr_Flag_y) + Agr_y = a7 + Agr_y; + if ((unsigned __int16)Agr_y < 0x64u) + break; + Agr_y = Agr_y - 100; + v13 = v46; + Agr_Flag_y = 1; + v22 = v63 - 1; + if (v63 == 1) + return; } - - --v36; - } while ( v36 ); + Agr_Flag_y = 0; + v22 = v63 - 1; + } while (v63 != 1); } else { + if (clip_y) { + if ((unsigned __int16)clip_y >= v22) + return; + v58 = v22; + v49 = v20; + v23 = 0; + v24 = (unsigned __int16)clip_y; + while (Asm_Zoom(v23 + 1, a7) < v24) + ; + v20 = v49; + v13 += Largeur * v23; + v14 += nbrligne2 * (unsigned __int16)clip_y; + v22 = v58 - (unsigned __int16)clip_y; + } + if (v22 > (unsigned __int16)clip_y1) + v22 = (unsigned __int16)clip_y1; + if (clip_x) { + if ((unsigned __int16)clip_x >= v20) + return; + v59 = v22; + v50 = v20; + v25 = (unsigned __int16)clip_x; + v26 = 0; + while (Asm_Zoom(v26 + 1, a7) < v25) + ; + v27 = v26; + v22 = v59; + v13 += v27; + v14 += (unsigned __int16)clip_x; + v20 = v50 - (unsigned __int16)clip_x; + } + if (v20 > (unsigned __int16)clip_x1) + v20 = (unsigned __int16)clip_x1; do { - v64 = v36; - v54 = v14; - Red_y = Red + Red_y; - - if ((uint)Red_y < 100) { - Red_x = 0; - v38 = Largeur; - v39 = 0; - + while (1) { + v60 = v22; + v51 = v14; + v45 = v13; + v28 = v20; + Agr_Flag_x = 0; + Agr_x = 0; do { - Red_x = Red + Red_x; - if ((uint)Red_x < 100) { - if (v39 >= clip_x && v39 < clip_x1 && *v13) + while (1) { + if (*v13) *v14 = *v13; ++v14; ++v13; - ++v39; - } else { - Red_x = Red_x - 100; - ++v13; + if (!Agr_Flag_x) + Agr_x = a7 + Agr_x; + if ((unsigned __int16)Agr_x < 0x64u) + break; + Agr_x = Agr_x - 100; + --v13; + Agr_Flag_x = 1; + --v28; + if (!v28) + goto Aff_Zoom_Larg_Cont1; } - - --v38; - } while ( v38 ); - - v36 = v64; - v14 = nbrligne2 + v54; - } else { - Red_y = Red_y - 100; - v13 += Largeur; + Agr_Flag_x = 0; + --v28; + } while (v28); +Aff_Zoom_Larg_Cont1: + v13 = Largeur + v45; + v14 = nbrligne2 + v51; + if (!Agr_Flag_y) + Agr_y = a7 + Agr_y; + if ((unsigned __int16)Agr_y < 0x64u) + break; + Agr_y = Agr_y - 100; + v13 = v45; + Agr_Flag_y = 1; + v22 = v60 - 1; + if (v60 == 1) + return; } - - --v36; - } while (v36); - } - } - } else { - Largeur = v11; - Compteur_y = 0; - if (a8) { - v16 = v11 + v14; - spec_largeur = v11; - if (clip_y) { - if ((uint)clip_y >= (unsigned int)v12) - return; - v13 += v11 * (uint)clip_y; - v16 += nbrligne2 * (uint)clip_y; - v12 -= (uint)clip_y; - } - - v17 = (uint)clip_y1; - if (v12 > clip_y1) - v12 = clip_y1; - - v17 = clip_x; - if (clip_x) { - if (v17 >= v11) - return; - v11 -= v17; + Agr_Flag_y = 0; + v22 = v60 - 1; + } while (v60 != 1); } - - if (v11 > clip_x1) { - v18 = v11 - clip_x1; - v13 += v18; - v16 -= v18; - v11 = (uint)clip_x1; + } else if (a6) { + Compteur_y = 0; + Red_x = 0; + Red_y = 0; + Largeur = v11; + Red = a6; + if (a6 < 100) { + v37 = Asm_Reduc(v11, Red); + if (a8) { + v40 = v37 + v14; + do { + v65 = v36; + v55 = v40; + Red_y = Red + Red_y; + if ((unsigned __int16)Red_y < 0x64u) { + Red_x = 0; + v41 = Largeur; + v42 = v37; + do { + Red_x = Red + Red_x; + if ((unsigned __int16)Red_x < 0x64u) { + if (v42 >= clip_x && v42 < clip_x1 && *v13) + *v40 = *v13; + --v40; + ++v13; + --v42; + } else { + Red_x = Red_x - 100; + ++v13; + } + --v41; + } while (v41); + v36 = v65; + v40 = nbrligne2 + v55; + } else { + Red_y = Red_y - 100; + v13 += Largeur; + } + --v36; + } while (v36); + } else { + do { + v64 = v36; + v54 = v14; + Red_y = Red + Red_y; + if ((unsigned __int16)Red_y < 0x64u) { + Red_x = 0; + v38 = Largeur; + v39 = 0; + do { + Red_x = Red + Red_x; + if ((unsigned __int16)Red_x < 0x64u) { + if (v39 >= clip_x && v39 < clip_x1 && *v13) + *v14 = *v13; + ++v14; + ++v13; + ++v39; + } else { + Red_x = Red_x - 100; + ++v13; + } + --v38; + } while (v38); + v36 = v64; + v14 = nbrligne2 + v54; + } else { + Red_y = Red_y - 100; + v13 += Largeur; + } + --v36; + } while (v36); + } } - - do { - v57 = v12; - v48 = v16; - v44 = v13; - v19 = v11; - - do { - if (*v13) - *v16 = *v13; - ++v13; - --v16; - --v19; - } while (v19); - - v13 = spec_largeur + v44; - v16 = nbrligne2 + v48; - v12 = v57 - 1; - } while (v57 != 1); } else { - spec_largeur = v11; - if (clip_y) { - if ((uint)clip_y >= (unsigned int)v12) - return; - - v13 += v11 * (uint)clip_y; - v14 += nbrligne2 * (uint)clip_y; - v12 -= (uint)clip_y; - } - - if (v12 > clip_y1) - v12 = clip_y1; - if (clip_x) { - if (clip_x >= v11) - return; - - v13 += (uint)clip_x; - v14 += (uint)clip_x; - v11 -= (uint)clip_x; - } - - if (v11 > clip_x1) - v11 = clip_x1; - - do { - v56 = v12; - v47 = v14; - v43 = v13; - v15 = v11; - + Largeur = v11; + Compteur_y = 0; + if (a8) { + v16 = v11 + v14; + spec_largeur = v11; + if (clip_y) { + if ((unsigned __int16)clip_y >= (unsigned int)v12) + return; + v13 += v11 * (unsigned __int16)clip_y; + v16 += nbrligne2 * (unsigned __int16)clip_y; + v12 -= (unsigned __int16)clip_y; + } + v17 = (unsigned __int16)clip_y1; + if (v12 > clip_y1) + v12 = clip_y1; + v17 = clip_x; + if (clip_x) { + if (v17 >= v11) + return; + v11 -= v17; + } + if (v11 > (unsigned __int16)clip_x1) { + v18 = v11 - (unsigned __int16)clip_x1; + v13 += v18; + v16 -= v18; + v11 = (unsigned __int16)clip_x1; + } do { - if (*v13) - *v14 = *v13; - ++v14; - ++v13; - --v15; - } while (v15); - - v13 = spec_largeur + v43; - v14 = nbrligne2 + v47; - v12 = v56 - 1; - } while (v56 != 1); + v57 = v12; + v48 = v16; + v44 = v13; + v19 = v11; + do { + if (*v13) + *v16 = *v13; + ++v13; + --v16; + --v19; + } while (v19); + v13 = spec_largeur + v44; + v16 = nbrligne2 + v48; + v12 = v57 - 1; + } while (v57 != 1); + } else { + spec_largeur = v11; + if (clip_y) { + if ((unsigned __int16)clip_y >= (unsigned int)v12) + return; + v13 += v11 * (unsigned __int16)clip_y; + v14 += nbrligne2 * (unsigned __int16)clip_y; + v12 -= (unsigned __int16)clip_y; + } + if (v12 > clip_y1) + v12 = clip_y1; + if (clip_x) { + if ((unsigned __int16)clip_x >= v11) + return; + v13 += (unsigned __int16)clip_x; + v14 += (unsigned __int16)clip_x; + v11 -= (unsigned __int16)clip_x; + } + if (v11 > (unsigned __int16)clip_x1) + v11 = (unsigned __int16)clip_x1; + do { + v56 = v12; + v47 = v14; + v43 = v13; + v15 = v11; + do { + if (*v13) + *v14 = *v13; + ++v14; + ++v13; + --v15; + } while (v15); + v13 = spec_largeur + v43; + v14 = nbrligne2 + v47; + v12 = v56 - 1; + } while (v56 != 1); + } } } } } } - } } void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index f92e367a2c..1e380e62d7 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -170,7 +170,7 @@ public: void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); - void Affiche_Perfect(byte *destSurface, const byte *srcData, int a3, int a4, int a5, int a6, int a7, int a8); + void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int a5, int a6, int a7, int a8); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); -- cgit v1.2.3 From 4c456f799994b50aeee9a7d04912b2cd7892c93d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 11:03:06 +1100 Subject: HOPKINS: Cleaned up the PERSONAGE2 event loop method --- engines/hopkins/events.cpp | 8 ++++--- engines/hopkins/events.h | 2 +- engines/hopkins/objects.cpp | 57 +++++++++++++++++++++------------------------ 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index aaac4574b6..0b5bdb1e7f 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -98,7 +98,7 @@ int EventsManager::YMOUSE() { return souris_y + ofset_souris_y; } -bool EventsManager::BMOUSE() { +int EventsManager::BMOUSE() { CONTROLE_MES(); return souris_bb; } @@ -215,12 +215,14 @@ void EventsManager::pollEvents() { return; case Common::EVENT_LBUTTONDOWN: + souris_b = 1; + break; case Common::EVENT_RBUTTONDOWN: - souris_b = true; + souris_b = 2; break; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: - souris_b = false; + souris_b = 0; return; default: diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 0ab4ea36a1..a4b5bd9afd 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -67,7 +67,7 @@ public: void souris_max(); int XMOUSE(); int YMOUSE(); - bool BMOUSE(); + int BMOUSE(); void MOUSE_ON(); void MOUSE_OFF(); void CHANGE_MOUSE(int id); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 423a1e6014..449fa3d2e4 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -7596,25 +7596,16 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, const Common::String &s4, int v) { - Common::String v5; - int v6; - int v7; - int v8; - int v10; - int v11; - int v12; - int v13; + int mouseButtons; + bool breakFlag; int xp, yp; - v5 = s2; INVENTFLAG = 0; KEY_INVENT = 0; _vm->_objectsManager.verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; VIRE_INVENT = 0; - v11 = 0; - v12 = 0; _vm->_globals.PLAN_FLAG = 0; _vm->_graphicsManager.NOFADE = 0; _vm->_globals.NOMARCHE = 0; @@ -7686,42 +7677,45 @@ LABEL_70: g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.BPP_NOAFF = 1; - v6 = 0; - do { + + for (int idx = 0; idx < 5; ++idx) { _vm->_eventsManager.VBL(); - ++v6; - } while (v6 <= 4); + } + _vm->_globals.BPP_NOAFF = 0; _vm->_globals.iRegul = 1; if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_INW(); _vm->_graphicsManager.NOFADE = 0; _vm->_eventsManager.CHANGE_MOUSE(4); - v13 = 0; - do { - v7 = _vm->_eventsManager.BMOUSE(); - v8 = v7; - if (v7) { - if (v7 == 1) { + + int xCheck = 0; + int yCheck = 0; + + breakFlag = false; + while (!_vm->shouldQuit() && !breakFlag) { + mouseButtons = _vm->_eventsManager.BMOUSE(); + if (mouseButtons) { + if (mouseButtons == 1) { if (_vm->_objectsManager.verbe == 16 && _vm->_eventsManager.btsouris == 16) { xp = _vm->_eventsManager.XMOUSE(); yp = _vm->_eventsManager.YMOUSE(); - v10 = yp; - if (v12 == xp) { - if (v11 == yp) { + + if (xCheck == xp) { + if (yCheck == yp) { _vm->_globals.chemin = g_PTRNUL; _vm->_objectsManager.PARADISE(); if (_vm->_globals.SORTIE) - v13 = 1; + breakFlag = true; } } - v12 = xp; - v11 = v10; + xCheck = xp; + yCheck = yp; } _vm->_objectsManager.BTGAUCHE(); - } - if (v8 == 2) + } else if (mouseButtons == 2) { _vm->_objectsManager.BTDROITE(); + } } if (!_vm->_globals.SORTIE) { TEST_INVENT(); @@ -7735,8 +7729,9 @@ LABEL_70: if (!_vm->_globals.SORTIE) continue; } - v13 = 1; - } while (v13 != 1); + breakFlag = true; + } + if (_vm->_globals.SORTIE != 8 || _vm->_globals.ECRAN != 5 || _vm->_globals.HELICO != 1) { if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_OUTW(); -- cgit v1.2.3 From 4ec8e71997ef028c3f3601d8d741360ceba4a744 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 13:04:05 +1100 Subject: HOPKINS: Correct video decompression methods --- engines/hopkins/graphics.cpp | 30 +++++++++++++++--------------- engines/hopkins/graphics.h | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 4b4b7f1d58..94dee59aac 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1129,7 +1129,7 @@ Video_Cont3_wVbe: } } -void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { +void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { int result; int v2; int v3; @@ -1146,7 +1146,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { result = 0; v2 = 0; v3 = 0; - v4 = surface; + v4 = srcData; for (;;) { v5 = *v4; if (*v4 < 222) @@ -1162,7 +1162,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) { v5 = *(v4 + 2); v4 += 2; } else if (v5 == (byte)-2) { - v2 += (int16)READ_LE_UINT16(v4 + 1); + v2 += READ_LE_UINT16(v4 + 1); v5 = *(v4 + 3); v4 += 3; } else { @@ -1199,8 +1199,8 @@ Video_Cont3_Vbe: } } -void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { - const byte *srcP = surface; +void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { + const byte *srcP = srcData; int destOffset = 0; assert(VideoPtr); @@ -1217,7 +1217,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { srcByte = *(const byte *)(srcP + 2); srcP += 2; } else if (srcByte == 254) { - destOffset += (int16)READ_LE_UINT16(srcP + 1); + destOffset += READ_LE_UINT16(srcP + 1); srcByte = *(const byte *)(srcP + 3); srcP += 3; } else { @@ -1259,13 +1259,13 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { } } -void GraphicsManager::Copy_Video_Vbe16a(const byte *surface) { +void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { int v2; const byte *v3; unsigned __int8 v4; v2 = 0; - v3 = surface; + v3 = srcData; for (;;) { v4 = *v3; if (*v3 < 0xFCu) @@ -1277,7 +1277,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *surface) { v4 = *(v3 + 2); v3 += 2; } else if (v4 == -2) { - v2 += (int16)READ_LE_UINT16(v3 + 1); + v2 += READ_LE_UINT16(v3 + 1); v4 = *(v3 + 3); v3 += 3; } else { @@ -1286,7 +1286,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *surface) { v3 += 5; } Video_Cont_Vbe16a: - WRITE_LE_UINT16(v2 + v2 + VideoPtr, (int16)READ_LE_UINT16(PAL_PIXELS + 2 * v4)); + WRITE_LE_UINT16(v2 + v2 + VideoPtr, READ_LE_UINT16(PAL_PIXELS + 2 * v4)); ++v3; ++v2; } @@ -1336,9 +1336,9 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, clip_flag = false; spriteP += 4; - int width = (int16)READ_LE_UINT16(spriteP); + int width = READ_LE_UINT16(spriteP); spriteP += 2; - int height = (int16)READ_LE_UINT16(spriteP); + int height = READ_LE_UINT16(spriteP); // Clip X clip_x1 = width; @@ -1386,7 +1386,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Set up source spriteP += 6; - int srcOffset = (int16)READ_LE_UINT16(spriteP); + int srcOffset = READ_LE_UINT16(spriteP); spriteP += 4; const byte *srcP = spriteP; spriteP += srcOffset; @@ -1404,7 +1404,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, while ((byteVal = *srcP) != 253) { ++srcP; - width = (int16)READ_LE_UINT16(srcP); + width = READ_LE_UINT16(srcP); srcP += 2; if (byteVal == 254) { @@ -1432,7 +1432,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, while ((byteVal = *srcP) != 253) { ++srcP; - width = (int16)READ_LE_UINT16(srcP); + width = READ_LE_UINT16(srcP); srcP += 2; if (byteVal == 254) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 1e380e62d7..5be407ce46 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -145,9 +145,9 @@ public: uint16 MapRGB(byte r, byte g, byte b); void DD_VBL(); void Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface); - void Copy_Video_Vbe3(const byte *surface); - void Copy_Video_Vbe16(const byte *surface); - void Copy_Video_Vbe16a(const byte *surface); + void Copy_Video_Vbe3(const byte *srcData); + void Copy_Video_Vbe16(const byte *srcData); + void Copy_Video_Vbe16a(const byte *srcData); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height); /** -- cgit v1.2.3 From ba6d36a02350dfe679c4225562d4128cf2586e89 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 15:19:54 +1100 Subject: HOPKINS: Added missing GOHOME/GOHOME2 methods --- engines/hopkins/globals.cpp | 2 + engines/hopkins/globals.h | 2 + engines/hopkins/objects.cpp | 737 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.h | 4 +- 4 files changed, 736 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0441806231..be70087cf7 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -97,6 +97,7 @@ Globals::Globals() { g_old_anim = 0; g_old_sens = 0; g_old_sens2 = 0; + last_sens = 0; police_l = police_h = 0; TETE = NULL; texte_long = 0; @@ -213,6 +214,7 @@ Globals::Globals() { old_y_70 = 0; compteur_71 = 0; zozo_73 = 0; + j_104 = 0; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 29324e63c0..5b54c1d90a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -342,6 +342,7 @@ public: int lOldItCounter; int g_old_anim; int g_old_sens, g_old_sens2; + int last_sens; int HopkinsArr[140]; byte *police; int police_l; @@ -445,6 +446,7 @@ public: int zozo_73; int old_y2_68; int old_z_69; + int j_104; Globals(); ~Globals(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 449fa3d2e4..80fb61b692 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -101,6 +101,9 @@ ObjectsManager::ObjectsManager() { NVZONE = 0; S_old_ani = 0; S_old_ret = 0; + nouveau_x = nouveau_y = 0; + nouveau_sens = 0; + nouveau_anim = 0; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -1870,23 +1873,741 @@ LABEL_54: } void ObjectsManager::GOHOME() { - warning("GOHOME"); + __int16 v0; + __int16 v1; + __int16 v3; + __int16 v4; + unsigned int v5; + unsigned int v6; + unsigned int v7; + unsigned int v8; + __int16 v9; + __int16 v10; + unsigned int v11; + unsigned int v12; + unsigned int v13; + unsigned int v14; + int v15; + __int16 v16; + unsigned int v17; + unsigned int v18; + int v19; + __int16 v20; + unsigned int v21; + unsigned int v22; + __int16 v23; + __int16 v24; + unsigned int v25; + unsigned int v26; + unsigned int v27; + unsigned int v28; + __int16 v29; + __int16 v30; + unsigned int v31; + unsigned int v32; + unsigned int v33; + unsigned int v34; + __int16 v35; + __int16 v36; + unsigned int v37; + unsigned int v38; + unsigned int v39; + unsigned int v40; + __int16 v41; + __int16 v42; + unsigned int v43; + unsigned int v44; + unsigned int v45; + unsigned int v46; + signed __int16 v47; + __int16 v48; + __int16 v49; + int v50; + __int16 v51; + __int16 v52; + __int16 v53; + __int16 v54; + int v55; + __int16 v56; + __int16 v57; + __int16 v58; + + v0 = 0; + v58 = 0; + v1 = 0; + + if (_vm->_globals.chemin == g_PTRNUL) + return; + if (_vm->_globals.Compteur > 1) { + --_vm->_globals.Compteur; + return; + } + _vm->_globals.Compteur = 0; + if (g_old_sens == -1) { + VERIFTAILLE(); + nouveau_x = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + v53 = (int16)READ_LE_UINT16(_vm->_globals.chemin); + nouveau_y = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + nouveau_sens = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + nouveau_anim = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + if (nouveau_x != -1 || v53 != -1) { + _vm->_globals.g_old_sens = nouveau_sens; + _vm->_globals.g_old_sens2 = nouveau_sens; + _vm->_globals.g_old_anim = 0; + g_old_x = nouveau_x; + g_old_y = nouveau_y; + } else { + SETANISPR(0, _vm->_globals.g_old_sens + 59); + _vm->_globals.ACTION_SENS = 0; + if (GOACTION == 1) + v54 = _vm->_globals.SAUVEGARDE->data[svField2]; + else + v54 = NUMZONE; + _vm->_globals.chemin = g_PTRNUL; + VERIFTAILLE(); + SETFLIPSPR(0, 0); + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.g_old_sens = -1; + if (v54 > 0) { + v55 = v54; + if (_vm->_globals.ZONEP[v55].field0) { + v56 = _vm->_globals.ZONEP[v55].field2; + if (v56) { + if (v56 != 31) { + v57 = _vm->_globals.ZONEP[v55].field4; + if (v57 == -1) { + _vm->_globals.ZONEP[v55].field0 = 0; + _vm->_globals.ZONEP[v55].field2 = 0; + _vm->_globals.ZONEP[v55].field4 = 0; + } else { + SETANISPR(0, v57); + _vm->_globals.ACTION_SENS = _vm->_globals.ZONEP[v55].field4 - 59; + } + } + } + } + } + } +LABEL_241: + _vm->_globals.Compteur = 0; + return; + } + if (_vm->_globals.g_old_sens == 3) { + if ((unsigned __int16)(_vm->_globals.g_old_anim - 24) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v5 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v5 = -_vm->_objectsManager.Sprite[0].fieldC; + v3 = _vm->_graphicsManager.Reel_Reduc(v3, v5); + v6 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v6 = -_vm->_objectsManager.Sprite[0].fieldC; + v4 = _vm->_graphicsManager.Reel_Reduc(v4, v6); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v7 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v7 = -_vm->_objectsManager.Sprite[0].fieldC; + v3 = _vm->_graphicsManager.Reel_Zoom(v3, v7); + v8 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v8 = -_vm->_objectsManager.Sprite[0].fieldC; + v4 = _vm->_graphicsManager.Reel_Zoom(v4, v8); + } + v0 = v3 + g_old_x; + v58 = g_old_y + v4; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 35) + goto LABEL_23; + } + v1 = 24; +LABEL_23: + _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + } + if (_vm->_globals.g_old_sens != 7) + goto LABEL_43; + if ((unsigned __int16)(_vm->_globals.g_old_anim - 24) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v11 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v11 = -_vm->_objectsManager.Sprite[0].fieldC; + v9 = _vm->_graphicsManager.Reel_Reduc(v9, v11); + v12 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v12 = -_vm->_objectsManager.Sprite[0].fieldC; + v10 = _vm->_graphicsManager.Reel_Reduc(v10, v12); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v13 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v13 = -_vm->_objectsManager.Sprite[0].fieldC; + v9 = _vm->_graphicsManager.Reel_Zoom(v9, v13); + v14 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v14 = -_vm->_objectsManager.Sprite[0].fieldC; + v10 = _vm->_graphicsManager.Reel_Zoom(v10, v14); + } + v0 = g_old_x - v9; + v58 = g_old_y - v10; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 35) + goto LABEL_42; + } + v1 = 24; +LABEL_42: + _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; +LABEL_43: + if (_vm->_globals.g_old_sens != 1) + goto LABEL_60; + if (_vm->_globals.g_old_anim > 11) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v15 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (v15 < 0) + v15 = -v15; + v16 = v15; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v17 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v17 = -_vm->_objectsManager.Sprite[0].fieldC; + v16 = _vm->_graphicsManager.Reel_Reduc(v16, v17); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v18 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v18 = -_vm->_objectsManager.Sprite[0].fieldC; + v16 = _vm->_graphicsManager.Reel_Zoom(v16, v18); + } + v0 = g_old_x; + v58 = g_old_y - v16; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 11) + goto LABEL_59; + } + v1 = 0; +LABEL_59: + _vm->_globals.Compteur = 4 / _vm->_globals.vitesse; +LABEL_60: + if (_vm->_globals.g_old_sens != 5) + goto LABEL_77; + if ((unsigned __int16)(_vm->_globals.g_old_anim - 48) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v19 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (v19 < 0) + v19 = -v19; + v20 = v19; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v21 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v21 = -_vm->_objectsManager.Sprite[0].fieldC; + v20 = _vm->_graphicsManager.Reel_Reduc(v20, v21); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v22 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v22 = -_vm->_objectsManager.Sprite[0].fieldC; + v20 = _vm->_graphicsManager.Reel_Zoom(v20, v22); + } + v0 = g_old_x; + v58 = v20 + g_old_y; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 59) + goto LABEL_76; + } + v1 = 48; +LABEL_76: + _vm->_globals.Compteur = 4 / _vm->_globals.vitesse; +LABEL_77: + if (_vm->_globals.g_old_sens != 2) + goto LABEL_96; + if ((unsigned __int16)(_vm->_globals.g_old_anim - 12) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v25 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v25 = -_vm->_objectsManager.Sprite[0].fieldC; + v23 = _vm->_graphicsManager.Reel_Reduc(v23, v25); + v26 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v26 = -_vm->_objectsManager.Sprite[0].fieldC; + v24 = _vm->_graphicsManager.Reel_Reduc(v24, v26); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v27 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v27 = -_vm->_objectsManager.Sprite[0].fieldC; + v23 = _vm->_graphicsManager.Reel_Zoom(v23, v27); + v28 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v28 = -_vm->_objectsManager.Sprite[0].fieldC; + v24 = _vm->_graphicsManager.Reel_Zoom(v24, v28); + } + v0 = v23 + g_old_x; + v58 = g_old_y + v24; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 23) + goto LABEL_95; + } + v1 = 12; +LABEL_95: + _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; +LABEL_96: + if (_vm->_globals.g_old_sens != 8) + goto LABEL_115; + if ((unsigned __int16)(_vm->_globals.g_old_anim - 12) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v31 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v31 = -_vm->_objectsManager.Sprite[0].fieldC; + v29 = _vm->_graphicsManager.Reel_Reduc(v29, v31); + v32 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v32 = -_vm->_objectsManager.Sprite[0].fieldC; + v30 = _vm->_graphicsManager.Reel_Reduc(v30, v32); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v33 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v33 = -_vm->_objectsManager.Sprite[0].fieldC; + v29 = _vm->_graphicsManager.Reel_Zoom(v29, v33); + v34 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v34 = -_vm->_objectsManager.Sprite[0].fieldC; + v30 = _vm->_graphicsManager.Reel_Zoom(v30, v34); + } + v0 = g_old_x - v29; + v58 = g_old_y + v30; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 23) + goto LABEL_114; + } + v1 = 12; +LABEL_114: + _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; +LABEL_115: + if (_vm->_globals.g_old_sens != 4) + goto LABEL_134; + if ((unsigned __int16)(_vm->_globals.g_old_anim - 36) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v37 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v37 = -_vm->_objectsManager.Sprite[0].fieldC; + v35 = _vm->_graphicsManager.Reel_Reduc(v35, v37); + v38 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v38 = -_vm->_objectsManager.Sprite[0].fieldC; + v36 = _vm->_graphicsManager.Reel_Reduc(v36, v38); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v39 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v39 = -_vm->_objectsManager.Sprite[0].fieldC; + v35 = _vm->_graphicsManager.Reel_Zoom(v35, v39); + v40 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v40 = -_vm->_objectsManager.Sprite[0].fieldC; + v36 = _vm->_graphicsManager.Reel_Zoom(v36, v40); + } + v0 = v35 + g_old_x; + v58 = g_old_y + v36; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 47) + goto LABEL_133; + } + v1 = 36; +LABEL_133: + _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; +LABEL_134: + if (_vm->_globals.g_old_sens != 6) + goto LABEL_153; + if ((unsigned __int16)(_vm->_globals.g_old_anim - 36) > 0xBu) { + v0 = g_old_x; + v58 = g_old_y; + } else { + v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) { + v43 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v43 = -_vm->_objectsManager.Sprite[0].fieldC; + v41 = _vm->_graphicsManager.Reel_Reduc(v41, v43); + v44 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v44 = -_vm->_objectsManager.Sprite[0].fieldC; + v42 = _vm->_graphicsManager.Reel_Reduc(v42, v44); + } + if (_vm->_objectsManager.Sprite[0].fieldC > 0) { + v45 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v45 = -_vm->_objectsManager.Sprite[0].fieldC; + v41 = _vm->_graphicsManager.Reel_Zoom(v41, v45); + v46 = _vm->_objectsManager.Sprite[0].fieldC; + if (_vm->_objectsManager.Sprite[0].fieldC < 0) + v46 = -_vm->_objectsManager.Sprite[0].fieldC; + v42 = _vm->_graphicsManager.Reel_Zoom(v42, v46); + } + v0 = g_old_x - v41; + v58 = g_old_y + v42; + v1 = _vm->_globals.g_old_anim + 1; + if (_vm->_globals.g_old_anim != 47) + goto LABEL_152; + } + v1 = 36; +LABEL_152: + _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; +LABEL_153: + v47 = 0; + do { + nouveau_x = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + v48 = (int16)READ_LE_UINT16(_vm->_globals.chemin); + nouveau_y = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + nouveau_sens = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + nouveau_anim = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + if (nouveau_x == -1 && v48 == -1) { + if (GOACTION == 1) + v49 = _vm->_globals.SAUVEGARDE->data[svField2]; + else + v49 = NUMZONE; + SETANISPR(0, _vm->_globals.g_old_sens + 59); + _vm->_globals.ACTION_SENS = 0; + _vm->_globals.chemin = g_PTRNUL; + VERIFTAILLE(); + SETFLIPSPR(0, 0); + _vm->_globals.Compteur = 0; + _vm->_globals.g_old_sens = -1; + g_old_x = XSPR(0); + g_old_y = YSPR(0); + + if (v49 > 0) { + v50 = v49; + if (_vm->_globals.ZONEP[v50].field0) { + v51 = _vm->_globals.ZONEP[v50].field2;; + if (v51) { + if (v51 != 31) { + v52 = _vm->_globals.ZONEP[v50].field4; + if (v52 == -1) { + _vm->_globals.ZONEP[v50].field0 = 0; + _vm->_globals.ZONEP[v50].field2 = 0; + _vm->_globals.ZONEP[v50].field4 = 0; + } else { + SETANISPR(0, v52); + _vm->_globals.ACTION_SENS = _vm->_globals.ZONEP[v50].field4 - 59; + } + } + } + } + } + goto LABEL_241; + } + if (_vm->_globals.g_old_sens != nouveau_sens) + break; + if (nouveau_sens == 3 && nouveau_x >= v0) + v47 = 1; + if (_vm->_globals.g_old_sens == 7 && nouveau_x <= v0) + v47 = 1; + if (_vm->_globals.g_old_sens == 1 && nouveau_y <= v58) + v47 = 1; + if (_vm->_globals.g_old_sens == 5 && nouveau_y >= v58) + v47 = 1; + if (_vm->_globals.g_old_sens == 2 && nouveau_x >= v0) + v47 = 1; + if (_vm->_globals.g_old_sens == 8 && nouveau_x <= v0) + v47 = 1; + if (_vm->_globals.g_old_sens == 4 && nouveau_x >= v0) + v47 = 1; + if (_vm->_globals.g_old_sens == 6 && nouveau_x <= v0) + v47 = 1; + } while (v47 != 1); + if (v47 == 1) { + VERIFTAILLE(); + if (_vm->_globals.g_old_sens == 7) + SETFLIPSPR(0, 1); + if (_vm->_globals.g_old_sens == 3) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 1) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 5) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 2) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 8) + SETFLIPSPR(0, 1); + if (_vm->_globals.g_old_sens == 4) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 6) + SETFLIPSPR(0, 1); + SETXSPR(0, nouveau_x); + SETYSPR(0, nouveau_y); + SETANISPR(0, v1); + } else { + if (_vm->_globals.g_old_sens == 7) + SETFLIPSPR(0, 1); + if (_vm->_globals.g_old_sens == 3) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 1) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 5) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 2) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 8) + SETFLIPSPR(0, 1); + if (_vm->_globals.g_old_sens == 4) + SETFLIPSPR(0, 0); + if (_vm->_globals.g_old_sens == 6) + SETFLIPSPR(0, 1); + _vm->_globals.Compteur = 0; + } + _vm->_globals.g_old_sens = nouveau_sens; + _vm->_globals.g_old_sens2 = nouveau_sens; + _vm->_globals.g_old_anim = v1; + g_old_x = nouveau_x; + g_old_y = nouveau_y; } void ObjectsManager::GOHOME2() { - warning("GOHOME2"); + signed int v0; + __int16 v2; + + v0 = 2; + if (_vm->_globals.chemin != g_PTRNUL) { + if (_vm->_globals.vitesse == 2) + v0 = 4; + if (_vm->_globals.vitesse == 3) + v0 = 6; + _vm->_globals.j_104 = 0; + if (v0) { + while (1) { + nouveau_x = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + v2 = (int16)READ_LE_UINT16(_vm->_globals.chemin); + nouveau_y = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + nouveau_sens = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + nouveau_anim = (int16)READ_LE_UINT16(_vm->_globals.chemin); + _vm->_globals.chemin += 2; + + if (nouveau_x == -1) { + if (v2 == -1) + break; + } + ++_vm->_globals.j_104; + if (_vm->_globals.j_104 >= v0) + goto LABEL_19; + } + if (_vm->_globals.last_sens == 1) + SETANISPR(0, 0); + if (_vm->_globals.last_sens == 3) + SETANISPR(0, 1); + if (_vm->_globals.last_sens == 5) + SETANISPR(0, 2); + if (_vm->_globals.last_sens == 7) + SETANISPR(0, 3); + + _vm->_globals.chemin = g_PTRNUL; + my_anim = 0; + A_ANIM = 0; + A_DEPA = 0; + } else { +LABEL_19: + _vm->_globals.last_sens = nouveau_sens; + SETXSPR(0, nouveau_x); + SETYSPR(0, nouveau_y); + if (_vm->_globals.last_sens == 1) + SETANISPR(0, 4); + if (_vm->_globals.last_sens == 3) + SETANISPR(0, 5); + if (_vm->_globals.last_sens == 5) + SETANISPR(0, 6); + if (_vm->_globals.last_sens == 7) + SETANISPR(0, 7); + + if (my_anim++ > 1) + my_anim = 0; + } + } } void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { - warning("CHARGE_OBSTACLE"); -} + __int16 v1; + byte *ptr; + __int16 v4; + __int16 v5; -void ObjectsManager::CHARGE_CACHE(const Common::String &file) { - warning("CHARGE_CACHE"); + _vm->_linesManager.RESET_OBSTACLE(); + _vm->_linesManager.TOTAL_LIGNES = 0; + _vm->_objectsManager.DERLIGNE = 0; + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v4 = 0; + v5 = 0; + do { + v1 = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + if (v1 != -1) { + _vm->_linesManager.AJOUTE_LIGNE( + v5, + v1, + (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1), + (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2), + (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 3), + (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 4), + 1); + ++_vm->_linesManager.TOTAL_LIGNES; + } + v4 += 5; + ++v5; + } while (v1 != -1); + _vm->_linesManager.INIPARCOURS(); + _vm->_globals.dos_free2(ptr); } void ObjectsManager::CHARGE_ZONE(const Common::String &file) { - warning("CHARGE_ZONE"); + signed int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v8; + byte *v9; + int v10; + signed int v11; + int v12; + byte *v13; + int v14; + signed int v15; + __int16 v17; + __int16 v18; + byte *ptr; + + v1 = 1; + do { + v2 = v1; + _vm->_globals.ZONEP[v2].field0 = 0; + _vm->_globals.ZONEP[v2].field2 = 0; + _vm->_globals.ZONEP[v2].field4 = 0; + _vm->_globals.ZONEP[v2].field6 = 0; + _vm->_globals.ZONEP[v2].field7 = 0; + _vm->_globals.ZONEP[v2].field8 = 0; + _vm->_globals.ZONEP[v2].field9 = 0; + _vm->_globals.ZONEP[v2].fieldA = 0; + _vm->_globals.ZONEP[v2].fieldB = 0; + _vm->_globals.ZONEP[v2].fieldC = 0; + _vm->_globals.ZONEP[v2].fieldD = 0; + _vm->_globals.ZONEP[v2].fieldE = 0; + _vm->_globals.ZONEP[v2].fieldF = 0; + _vm->_globals.ZONEP[v2].field12 = 0; + _vm->_globals.ZONEP[v2].field10 = 0; + ++v1; + } while (v1 <= 100); + + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + + Common::File f; + if (!f.exists(_vm->_globals.NFICHIER)) + error("File not found : %s", _vm->_globals.NFICHIER.c_str()); + + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v4 = 0; + v18 = 0; + v17 = 0; + do { + v3 = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + if (v3 != -1) { + v5 = v3; + v6 = v3; + _vm->_linesManager.AJOUTE_LIGNE_ZONE( + v18, + READ_LE_UINT16((uint16 *)ptr + v4 + 1), + READ_LE_UINT16((uint16 *)ptr + v4 + 2), + READ_LE_UINT16((uint16 *)ptr + v4 + 3), + READ_LE_UINT16((uint16 *)ptr + v4 + 4), + v3); + _vm->_globals.ZONEP[v5].field10 = 1; + v3 = v6; + } + v4 += 5; + ++v18; + ++v17; + } while (v3 != -1); + v7 = 1; + do { + v8 = v7; + _vm->_globals.ZONEP[v8].field0 = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + _vm->_globals.ZONEP[v8].field2 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); + _vm->_globals.ZONEP[v8].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); + v4 += 3; + ++v7; + } while (v7 <= 100); + + v9 = (ptr + 10 * v17 + 606); + v10 = 0; + v11 = 1; + do { + v12 = v11; + + _vm->_globals.ZONEP[v12].field6 = *(v10 + v9); + _vm->_globals.ZONEP[v12].field7 = *(v9 + v10 + 1); + _vm->_globals.ZONEP[v12].field8 = *(v9 + v10 + 2); + _vm->_globals.ZONEP[v12].field9 = *(v9 + v10 + 3); + _vm->_globals.ZONEP[v12].fieldA = *(v9 + v10 + 4); + _vm->_globals.ZONEP[v12].fieldB = *(v9 + v10 + 5); + _vm->_globals.ZONEP[v12].fieldC = *(v9 + v10 + 6); + _vm->_globals.ZONEP[v12].fieldD = *(v9 + v10 + 7); + _vm->_globals.ZONEP[v12].fieldE = *(v9 + v10 + 8); + _vm->_globals.ZONEP[v12].fieldF = *(v9 + v10 + 9); + + v10 += 10; + ++v11; + } while (v11 <= 100); + v13 = v9 + 1010; + v14 = 0; + v15 = 1; + do + _vm->_globals.ZONEP[v15++].field12 = READ_LE_UINT16(v13 + 2 * v14++); + while (v15 <= 100); + + _vm->_globals.dos_free2(ptr); + _vm->_objectsManager.CARRE_ZONE(); } void ObjectsManager::CARRE_ZONE() { @@ -1987,7 +2708,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.iRegul = 1; _vm->_graphicsManager.LOAD_IMAGE("PLAN"); CHARGE_OBSTACLE("PLAN.OB2"); - CHARGE_CACHE("PLAN.CA2"); + _vm->_globals.CHARGE_CACHE("PLAN.CA2"); CHARGE_ZONE("PLAN.ZO2"); _vm->_fileManager.CONSTRUIT_SYSTEM("VOITURE.SPR"); sprite_ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 219607c93b..6209fcdbb1 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -125,6 +125,9 @@ public: int NVZONE; int S_old_ani; int S_old_ret; + int nouveau_x, nouveau_y; + int nouveau_sens; + int nouveau_anim; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -191,7 +194,6 @@ public: void GOHOME(); void GOHOME2(); void CHARGE_OBSTACLE(const Common::String &file); - void CHARGE_CACHE(const Common::String &file); void CHARGE_ZONE(const Common::String &file); void CARRE_ZONE(); void PLAN_BETA(); -- cgit v1.2.3 From f2556a4caa517849e66e0f42f2da081d485a5f9b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 15:23:29 +1100 Subject: HOPKINS: Corrected some file exists calls --- engines/hopkins/anim.cpp | 2 +- engines/hopkins/globals.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 0c0924ef67..a7f63b6a19 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -853,7 +853,7 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, ofsFilename); Common::File f; - if (!f.exists(_vm->_globals.NFICHIER)) { + if (f.exists(_vm->_globals.NFICHIER)) { v19 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v13 = v19; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index be70087cf7..0185b2bf1a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -879,7 +879,7 @@ void Globals::CHARGE_CACHE(const Common::String &file) { _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, v16); - if (!f.exists(NFICHIER)) { + if (f.exists(NFICHIER)) { spriteData = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); CACHE_BANQUE[1] = spriteData; v15 = 60; -- cgit v1.2.3 From cde057a5828ed0e4136436dd2c8628c2141e173f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 16:41:51 +1100 Subject: HOPKINS: Some cleanup to the video frame display and fading methods --- engines/hopkins/graphics.cpp | 21 +++++++++++---------- engines/hopkins/graphics.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 94dee59aac..c19ad05540 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1051,15 +1051,17 @@ void GraphicsManager::DD_VBL() { } void GraphicsManager::FADE_OUTW_LINUX(const byte *surface) { + assert(surface); fade_out(Palette, FADESPD, surface); } void GraphicsManager::FADE_INW_LINUX(const byte *surface) { - return fade_in(Palette, FADESPD, surface); + assert(surface); + fade_in(Palette, FADESPD, surface); } -void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface) { - int result; +void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { + byte v; int v3; int v4; const byte *v5; @@ -1071,10 +1073,9 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSur unsigned int v11; byte *v12; - result = 0; v3 = 0; v4 = 0; - v5 = sourceSurface; + v5 = srcData; for (;;) { v6 = *v5; if (*v5 < 222) @@ -1091,7 +1092,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSur v6 = *(v5 + 2); v5 += 2; } else if (v6 == 254) { - v3 += (int16)READ_LE_UINT16(v5 + 1); + v3 += READ_LE_UINT16(v5 + 1); v6 = *(v5 + 3); v5 += 3; } else { @@ -1105,19 +1106,19 @@ Video_Cont3_wVbe: if (v6 == 211) { v7 = v4; v8 = *(v5 + 1); - result = *(v5 + 2); + v = *(v5 + 2); v9 = v3 + destSurface; v3 += v8; - memset(v9, result, v8); + memset(v9, v, v8); v5 += 3; v4 = v7; } else { v10 = v4; v11 = *v5 + 45; - result = *(v5 + 1); + v = *(v5 + 1); v12 = v3 + destSurface; v3 += v11; - memset(v12, result, v11); + memset(v12, v, v11); v5 += 2; v4 = v10; } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 5be407ce46..b826058af4 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -144,7 +144,7 @@ public: void CHANGE_PALETTE(const byte *palette); uint16 MapRGB(byte r, byte g, byte b); void DD_VBL(); - void Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface); + void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); void Copy_Video_Vbe3(const byte *srcData); void Copy_Video_Vbe16(const byte *srcData); void Copy_Video_Vbe16a(const byte *srcData); -- cgit v1.2.3 From ba4be24b187e17966c5ef9f731c9baa23bf918a0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 16:42:07 +1100 Subject: HOPKINS: Reimplemented animation player method --- engines/hopkins/anim.cpp | 320 ++++++++++++++++++++--------------------------- 1 file changed, 137 insertions(+), 183 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a7f63b6a19..247f267027 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -39,250 +39,204 @@ AnimationManager::AnimationManager() { } 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; + signed __int16 v4; + signed __int16 v5; + bool hasScreenCopy; + byte *screenCopy = NULL; + byte *v10 = NULL; + int v13; + byte *ptr = NULL; size_t nbytes; - byte *screenP; Common::File f; - char strBuffer[20]; - int idx = 0; - doneFlag = 0; - for (;;) { -//MAIN_LOOP: - v14 = v15 = v16 = v17 = 0; - v18 = 1; - screenP = _vm->_graphicsManager.VESA_SCREEN; + hasScreenCopy = false; + while (!_vm->shouldQuit()) { +LABEL_2: + v10 = _vm->_graphicsManager.VESA_SCREEN; + ptr = _vm->_globals.dos_malloc2(0x14u); _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); - if (!f.open(_vm->_globals.NFICHIER)) - error("Not Found file %s", _vm->_globals.NFICHIER.c_str()); + error("File not found - %s", _vm->_globals.NFICHIER.c_str()); - // TODO: Original above read seems to overlap the doneFlag f.skip(6); - //buf = read(4); doneFlag = f.readUint16LE() != 0; - f.read(_vm->_graphicsManager.Palette, PALETTE_EXT_BLOCK_SIZE); + f.read(_vm->_graphicsManager.Palette, 0x320u); f.skip(4); nbytes = f.readUint32LE(); + f.skip(14); + f.read(v10, nbytes); - // 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(); - v16 = f.readUint16LE(); - v15 = f.readUint16LE(); - v14 = f.readUint16LE(); - - f.read(screenP, nbytes); - - if (CLS_ANM) { + if (CLS_ANM == 1) { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); } - - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { - doneFlag = 1; - screenCopy = _vm->_globals.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT); - memcpy(screenCopy, screenP, SCREEN_WIDTH * SCREEN_HEIGHT); + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > 640) { + hasScreenCopy = true; + screenCopy = _vm->_globals.dos_malloc2(0x4B000u); + memcpy(screenCopy, v10, 0x4B000u); } - if (NO_SEQ) { - if (doneFlag == 1) - memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, SCREEN_WIDTH * SCREEN_HEIGHT); + if (hasScreenCopy) + memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); _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, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (hasScreenCopy) + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); else - _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(v10, 0, 0, 640, 480, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { - if (doneFlag) - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (hasScreenCopy) + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); else - _vm->_graphicsManager.m_scroll2(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(v10, 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; - -// 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); + if (_vm->_globals.iRegul != 1) + break; + while (!_vm->shouldQuit()) { + if (_vm->_eventsManager.ESC_KEY == 1) + goto LABEL_58; + if (REDRAW_ANIM() == 1) + break; + _vm->_eventsManager.CONTROLE_MES(); + if (_vm->_eventsManager.lItCounter >= rate1) + goto LABEL_25; } +LABEL_53: + if (_vm->_graphicsManager.NOLOCK == 1) + goto LABEL_58; + _vm->_globals.dos_free2(ptr); + f.close(); - _vm->_eventsManager.lItCounter = 0; - doneFlag = false; - idx = 0; - do { - _vm->_soundManager.PLAY_ANM_SOUND(idx); - - // Get in string - Common::fill(&strBuffer[0], &strBuffer[20], 0); - if (f.read(strBuffer, 16) != 16) - doneFlag = true; - - if (strncmp(strBuffer, "IMAGE=", 6) != 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; - -// TODO: Original REDRAW_ANIM always returns false, so this isn't needed? -#if 0 - if (REDRAW_ANIM()) { - if (_vm->_graphicsManager.NOLOCK == 1) - goto FINISH; + if (hasScreenCopy == 1) +LABEL_55: + screenCopy = _vm->_globals.dos_free2(screenCopy); + } +LABEL_25: + _vm->_eventsManager.lItCounter = 0; + v4 = 0; + v13 = 0; + while (!_vm->shouldQuit()) { + ++v13; + _vm->_soundManager.PLAY_ANM_SOUND(v13); - f.close(); - if (doneFlag <= SCREEN_WIDTH) - goto MAIN_LOOP; + if (f.read(ptr, 16) != 16) + v4 = -1; - screenCopy = _vm->_globals.dos_free2(screenCopy); - goto MAIN_LOOP; - } -#endif + if (strncmp((char *)ptr, "IMAGE=", 6)) + v4 = -1; + if (v4) + goto LABEL_49; - _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate2 && !_vm->shouldQuit()); + f.read(v10, READ_LE_UINT32(ptr + 8)); + if (_vm->_globals.iRegul == 1) + break; +LABEL_38: + _vm->_eventsManager.lItCounter = 0; + _vm->_graphicsManager.DD_Lock(); + if (hasScreenCopy) { + if (*v10 != (byte)-4) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); + else + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); + } + } else if (*v10 != (byte)-4) { + if (_vm->_graphicsManager.Winbpp == 1) + _vm->_graphicsManager.Copy_Video_Vbe3(v10); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.Copy_Video_Vbe16(v10); + } + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.VERIF_SOUND(); +LABEL_49: + if (v4 == -1) { + if (_vm->_globals.iRegul == 1) { + while (_vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) + goto LABEL_53; + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= rate3) + goto LABEL_57; } - + } else { +LABEL_57: _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._vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.VERIF_SOUND(); } - } while (!doneFlag && !_vm->shouldQuit()); - - if (_vm->_globals.iRegul != 1) { - _vm->_eventsManager.lItCounter = 0; - goto FINISH; + goto LABEL_58; } - - do { - 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) - goto FINISH; - - f.close(); - if (doneFlag != 1) - goto MAIN_LOOP; - - screenCopy = _vm->_globals.dos_free2(screenCopy); - goto MAIN_LOOP; - } -#endif - - _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate3 && !_vm->shouldQuit()); - - _vm->_eventsManager.lItCounter = 0; - _vm->_soundManager._vm->_soundManager.VERIF_SOUND(); - break; } + while (!_vm->shouldQuit() && _vm->_eventsManager.ESC_KEY != 1) { + if (REDRAW_ANIM() == 1) { + if (_vm->_graphicsManager.NOLOCK == 1) + break; + _vm->_globals.dos_free2(ptr); + f.close(); -FINISH: - if (_vm->_graphicsManager.FADE_LINUX == 2 && !doneFlag) { - screenCopy = _vm->_globals.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT); + if (1 /*hasScreenCopy <= 640 */) + goto LABEL_2; + goto LABEL_55; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + if (_vm->_eventsManager.lItCounter >= rate2) + goto LABEL_38; + } +LABEL_58: + if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { + screenCopy = _vm->_globals.dos_malloc2(0x4B000u); + f.seek(0); f.skip(6); - f.read(_vm->_graphicsManager.Palette, PALETTE_EXT_BLOCK_SIZE); + f.read(_vm->_graphicsManager.Palette, 0x320u); 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); + f.skip(14); + f.read(v10, nbytes); + + memcpy(screenCopy, v10, 0x4B000u); - idx = 0; - doneFlag = false; + v5 = 0; 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)); + memset(ptr, 0, 0x13u); + if (f.read(ptr, 16) != 16) + v5 = -1; - if (*screenP != 252) - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + if (strncmp((char *)ptr, "IMAGE=", 6)) + v5 = -1; + if (!v5) { + f.read(v10, READ_LE_UINT32(ptr + 8)); + if (*v10 != (byte)-4) + _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); } - } while (!doneFlag); - + } while (v5 != -1); _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); screenCopy = _vm->_globals.dos_free2(screenCopy); } - - if (doneFlag == 1) { + if (hasScreenCopy == 1) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); _vm->_globals.dos_free2(screenCopy); } - + _vm->_graphicsManager.FADE_LINUX = 0; f.close(); - _vm->_globals.dos_free2(screenCopy); - _vm->_graphicsManager.NOLOCK = false; + _vm->_globals.dos_free2(ptr); + _vm->_graphicsManager.NOLOCK = 0; } void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { -- cgit v1.2.3 From 1ee3c572f2920c2d334424a68ba1122b4eda3145 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 16:51:44 +1100 Subject: HOPKINS: Fixed Copy_WinScan_Vbe3 method --- engines/hopkins/graphics.cpp | 46 +++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c19ad05540..a5086201a8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1061,37 +1061,37 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { } void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { - byte v; - int v3; - int v4; - const byte *v5; - uint8 v6; - int v7; - unsigned int v8; - byte *v9; + int v; + int v3; + int v4; + const byte *v5; + byte v6; + int v7; + byte v8; + byte *v9; int v10; - unsigned int v11; - byte *v12; + byte v11; + byte *v12; + v = 0; v3 = 0; v4 = 0; v5 = srcData; for (;;) { v6 = *v5; - if (*v5 < 222) + if (*v5 < 0xDEu) goto Video_Cont3_wVbe; - - if (v6 == 252) + if (v6 == (byte)-4) return; - - if (v6 < 251) { - v3 += *v5 + 35; + + if (v6 < 0xFBu) { + v3 += (byte)(*v5 + 35); v6 = *(v5++ + 1); - } else if (v6 == 253) { + } else if (v6 == (byte)-3) { v3 += *(v5 + 1); v6 = *(v5 + 2); v5 += 2; - } else if (v6 == 254) { + } else if (v6 == (byte)-2) { v3 += READ_LE_UINT16(v5 + 1); v6 = *(v5 + 3); v5 += 3; @@ -1100,10 +1100,9 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) v6 = *(v5 + 5); v5 += 5; } - Video_Cont3_wVbe: - if (v6 > 210) { - if (v6 == 211) { + if (v6 > 0xD2u) { + if (v6 == (byte)-45) { v7 = v4; v8 = *(v5 + 1); v = *(v5 + 2); @@ -1114,7 +1113,7 @@ Video_Cont3_wVbe: v4 = v7; } else { v10 = v4; - v11 = *v5 + 45; + v11 = (byte)(*v5 + 45); v = *(v5 + 1); v12 = v3 + destSurface; v3 += v11; @@ -1127,8 +1126,7 @@ Video_Cont3_wVbe: ++v5; ++v3; } - } -} + }} void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { int result; -- cgit v1.2.3 From 756dc956b54ac645feee3427d129789b7b3a3aa5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 18:27:14 +1100 Subject: HOPKINS: Finally implemented VBL cursor method properly --- engines/hopkins/events.cpp | 306 +++++++++++++++++++------------------------ engines/hopkins/events.h | 1 + engines/hopkins/graphics.cpp | 46 +++++-- 3 files changed, 171 insertions(+), 182 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 0b5bdb1e7f..bdea8af67d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -44,8 +44,10 @@ EventsManager::EventsManager() { pointeur_souris = NULL; lItCounter = 0; ESC_KEY = false; - _priorFrameTime = 0; btsouris = 0; + + _priorCounterTime = 0; + _priorFrameTime = 0; } void EventsManager::setParent(HopkinsEngine *vm) { @@ -182,11 +184,16 @@ void EventsManager::CONTROLE_MES() { } void EventsManager::checkForNextFrameCounter() { + // Check for whether to increment the game counter uint32 milli = g_system->getMillis(); - if ((milli - _priorFrameTime) >= 10) { - _priorFrameTime = milli; + while ((milli - _priorCounterTime) >= 10) { + _priorCounterTime += 10; lItCounter += 3; + } + // Check for next game frame + if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { + _priorFrameTime = milli; g_system->updateScreen(); } } @@ -232,256 +239,213 @@ void EventsManager::pollEvents() { } void EventsManager::VBL() { - // Bulk of method currently disabled - - // Move any button press status into the active button status state - souris_bb = souris_b; - souris_b = false; - - if (!_vm->_globals.PUBEXIT) - _vm->_objectsManager.AFF_SPRITES(); -/* - int a1 = 0; - signed int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - signed int v7; - int v10; + signed __int16 v1; + int v2; + int v3; + int v4; + int v5; + int v6; + signed __int16 v7; + int v10; signed int v11 = 0; signed int v12 = 0; int v13 = 0; - unsigned int v14 = 0; - int v15 = 0; - - if (REDRAW) { - DD_Lock(); - if (_vm->_eventsManager.CASSE) { - CopyAsm(VESA_BUFFER); - REDRAW = 0; + unsigned int v14 = 0; + int v15 = 0; + int yp = 0; + + if (_vm->_graphicsManager.REDRAW) { + _vm->_graphicsManager.DD_Lock(); + if (CASSE) { + _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.REDRAW = 0; } else { if (_vm->_globals.iRegul == 3) - m_scroll(VESA_BUFFER, ofscroll, 50, SCREEN_WIDTH, 340, 0, 50); + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 50, 0x280u, 340, 0, 50); else - m_scroll(VESA_BUFFER, ofscroll, 20, SCREEN_WIDTH, 440, 0, 20); + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 20, 0x280u, 440, 0, 20); _vm->_fileManager.DMESS(); - --REDRAW; + --_vm->_graphicsManager.REDRAW; } - DD_Unlock(); + _vm->_graphicsManager.DD_Unlock(); } - - if (_vm->_eventsManager.souris_flag) { + if (souris_flag == 1) { v1 = 20; - if (!_vm->_eventsManager.mouse_linux) + if (!mouse_linux) v1 = 10; v2 = 20; - if (!_vm->_eventsManager.mouse_linux) + if (!mouse_linux) v2 = 15; - - v15 = _vm->_eventsManager.souris_x - v1; - a1 = _vm->_eventsManager.souris_y; - v14 = _vm->_eventsManager.souris_sizex; - v13 = _vm->_eventsManager.souris_sizey; - if (_vm->_eventsManager.btsouris == 23) { + v15 = souris_x - v1; + yp = souris_y; + v14 = souris_sizex; + v13 = souris_sizey; + if (btsouris == 23) { v14 = _vm->_globals.OBJL; v13 = _vm->_globals.OBJH; goto LABEL_35; } - - if (_vm->_eventsManager.CASSE) { - if (v15 < min_x) - v15 = min_x; - if (_vm->_eventsManager.souris_y < min_y) - a1 = min_y; - - if (_vm->_eventsManager.souris_sizex + v15 >= max_x) - v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x); - if (a1 + _vm->_eventsManager.souris_sizey < max_y) + if (CASSE) { + if (v15 < _vm->_graphicsManager.min_x) + v15 = _vm->_graphicsManager.min_x; + if (souris_y < _vm->_graphicsManager.min_y) + yp = _vm->_graphicsManager.min_y; + if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) + v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x); + if (yp + souris_sizey < _vm->_graphicsManager.max_y) goto LABEL_34; - - v3 = a1 + _vm->_eventsManager.souris_sizey - max_y; + v3 = yp + souris_sizey - _vm->_graphicsManager.max_y; } else { - if (v15 < min_x) - v15 = min_x - v1; - //v2 = v2; - if (_vm->_eventsManager.souris_y < min_y - v2) - a1 = min_y - v2; - if (_vm->_eventsManager.souris_sizex + v15 >= max_x) - v14 = _vm->_eventsManager.souris_sizex - (_vm->_eventsManager.souris_sizex + v15 - max_x - v1); - if (a1 + _vm->_eventsManager.souris_sizey < v2 + max_y) + if (v15 < _vm->_graphicsManager.min_x) + v15 = _vm->_graphicsManager.min_x - v1; + v2 = (signed __int16)v2; + if (souris_y < _vm->_graphicsManager.min_y - (signed __int16)v2) + yp = _vm->_graphicsManager.min_y - (signed __int16)v2; + if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) + v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x - v1); + if (yp + souris_sizey < v2 + _vm->_graphicsManager.max_y) goto LABEL_34; - - v3 = v2 + a1 + _vm->_eventsManager.souris_sizey - max_y; + v3 = v2 + yp + souris_sizey - _vm->_graphicsManager.max_y; } - - v13 = _vm->_eventsManager.souris_sizey - v3; + v13 = souris_sizey - v3; LABEL_34: v12 = v14 + v15; - v11 = a1 + v13; + v11 = yp + v13; } LABEL_35: - if (!_vm->_globals.PUBEXIT) - AFF_SPRITES(); - if (_vm->_eventsManager.souris_flag != 1) + _vm->_objectsManager.AFF_SPRITES(); + if (souris_flag != 1) goto LABEL_54; - if (_vm->_eventsManager.btsouris == 23) + if (btsouris == 23) goto LABEL_45; - - if (a1 >= max_y || v15 >= max_x || (signed int)v14 <= 1 || v13 <= 1) { - if (_vm->_eventsManager.btsouris != 23) + if (yp >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || v14 <= 1 || v13 <= 1) { + if (btsouris != 23) goto LABEL_54; - LABEL_45: - if (a1 < max_y && v15 < max_x) { - if ((signed int)(v14 + v15) > max_x) - v14 -= v14 + v15 - max_x; - if (a1 + v13 > max_y) - v13 -= a1 + v13 - max_y; - - if ((signed int)v14 > 1 && v13 > 1) { - Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Affiche_Perfect(VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, a1 + 300, 0, 0, 0, 0); - Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x) { + if ((signed int)(v14 + v15) > _vm->_graphicsManager.max_x) + v14 -= v14 + v15 - _vm->_graphicsManager.max_x; + if (yp + v13 > _vm->_graphicsManager.max_y) + v13 -= yp + v13 - _vm->_graphicsManager.max_y; + if (v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, yp + 300, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); } } goto LABEL_54; } - - Capture_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Sprite_Vesa(VESA_BUFFER, _vm->_eventsManager.pointeur_souris, v15 + 300, a1 + 300, _vm->_eventsManager.souris_n); - Ajoute_Segment_Vesa(v15, a1, v12, v11); - + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, yp + 300, souris_n); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); LABEL_54: _vm->_globals.vitesse = 2; - do { - for (;;) { - // TODO: Figure out the purpose of this loop waiting on lItCounter.. - // maybe it's for cursor animatoin? - _vm->_eventsManager.delay(10); + while (!_vm->shouldQuit()) { + checkForNextFrameCounter(); - while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { - if (_vm->_eventsManager.CASSE != 1) + while (CASSE || _vm->_globals.iRegul != 1) { + if (CASSE != 1) goto LABEL_63; - - if (_vm->_eventsManager.lItCounter > 1) + if (lItCounter > 1) goto LABEL_65; } - if (_vm->_globals.vitesse != 2) break; - - if (_vm->_eventsManager.lItCounter > 9) + if (lItCounter > 9) goto LABEL_65; } LABEL_63: ; - } while (_vm->_globals.iRegul == 3 && _vm->_eventsManager.lItCounter <= 15); - + } while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && lItCounter <= 15); LABEL_65: _vm->_globals.vitesse = 2; - _vm->_eventsManager.lItCounter = 0; - - if (DOUBLE_ECRAN != 1 || no_scroll == 1) { - Affiche_Segment_Vesa(); + lItCounter = 0; + if (_vm->_graphicsManager.DOUBLE_ECRAN != 1 || _vm->_graphicsManager.no_scroll == 1) { + _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { - if (no_scroll != 2) { - if (_vm->_eventsManager.XMOUSE() > SCROLL + 620) - SCROLL += SPEED_SCROLL; - - if (_vm->_eventsManager.XMOUSE() < SCROLL + 10) - SCROLL -= SPEED_SCROLL; + if (_vm->_graphicsManager.no_scroll != 2) { + if (XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; + if (XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; } - - SCROLL = CLIP(SCROLL, 0, SCREEN_WIDTH); - - if (SDL_ECHELLE) - v4 = Magic_Number(SCROLL); + if (_vm->_graphicsManager.SCROLL < 0) + _vm->_graphicsManager.SCROLL = 0; + if (_vm->_graphicsManager.SCROLL > 640) + _vm->_graphicsManager.SCROLL = 640; + if (_vm->_graphicsManager.SDL_ECHELLE) + v4 = _vm->_graphicsManager.Magic_Number(_vm->_graphicsManager.SCROLL); else - v4 = SCROLL; - - if (OLD_SCROLL == v4) { - Affiche_Segment_Vesa(); + v4 = _vm->_graphicsManager.SCROLL; + if (_vm->_graphicsManager.OLD_SCROLL == v4) { + _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { _vm->_fontManager.TEXTE_OFF(9); - DD_Lock(); - if (SDL_ECHELLE) { - if (Winbpp == 2) { - v5 = Reel_Zoom(20, SDL_ECHELLE); - m_scroll16A(VESA_BUFFER, v4, 20, 640, 440, 0, v5); + _vm->_graphicsManager.DD_Lock(); + if (_vm->_graphicsManager.SDL_ECHELLE) { + if (_vm->_graphicsManager.Winbpp == 2) { + v5 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v5); } else { - v6 = Reel_Zoom(20, SDL_ECHELLE); - m_scroll2A(VESA_BUFFER, v4, 20, 640, 440, 0, v6); + v6 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v6); } - - DD_Unlock(); - dstrect[0].left = Reel_Zoom(0, SDL_ECHELLE); - dstrect[0].top = Reel_Zoom(20, SDL_ECHELLE); - dstrect[0].setWidth(Reel_Zoom(SCREEN_WIDTH, SDL_ECHELLE)); - dstrect[0].setHeight(Reel_Zoom(440, SDL_ECHELLE)); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.Reel_Zoom(0, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.Reel_Zoom(0x280u, _vm->_graphicsManager.SDL_ECHELLE)); + _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.Reel_Zoom(0x1B8u, _vm->_graphicsManager.SDL_ECHELLE)); } else { - if (Winbpp == 2) - m_scroll16(VESA_BUFFER, v4, 20, 640, 440, 0, 20); + if (_vm->_graphicsManager.Winbpp == 2) + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); else - m_scroll2(VESA_BUFFER, v4, 20, 640, 440, 0, 20); - - DD_Unlock(); - dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, 640, 460); } - if (!_vm->_globals.BPP_NOAFF) { - // TODO: Useful for future dirty rect processing? // SDL_UpdateRects(LinuxScr, 1, dstrect); } if (_vm->_globals.NBBLOC) { v7 = 1; v10 = _vm->_globals.NBBLOC + 1; - do { if (_vm->_globals.BLOC[v7].field0 == 1) _vm->_globals.BLOC[v7].field0 = 0; ++v7; } while (v10 != v7); } - _vm->_globals.NBBLOC = 0; - _vm->_eventsManager.start_x = v4; - ofscroll = v4; - SCROLL = v4; + start_x = v4; + _vm->_graphicsManager.ofscroll = v4; + _vm->_graphicsManager.SCROLL = v4; } - - OLD_SCROLL = v4; - _vm->_eventsManager.start_x = v4; - ofscroll = v4; + _vm->_graphicsManager.OLD_SCROLL = v4; + start_x = v4; + _vm->_graphicsManager.ofscroll = v4; } - - _vm->_eventsManager.souris_bb = _vm->_eventsManager.souris_b; - _vm->_eventsManager.souris_b = 0; - if (_vm->_eventsManager.souris_flag == 1) { - if (_vm->_eventsManager.btsouris != 23) { - if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { - Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Ajoute_Segment_Vesa(v15, a1, v12, v11); + souris_bb = souris_b; + souris_b = 0; + if (souris_flag == 1) { + if (btsouris != 23) { + if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); goto LABEL_113; } - - if (_vm->_eventsManager.btsouris != 23) + if (btsouris != 23) goto LABEL_113; } - - if (a1 < max_y && v15 < max_x && v14 > 1 && v13 > 1) { - Restore_Mem(VESA_BUFFER, _vm->_globals.cache_souris, v15, a1, v14, v13); - Ajoute_Segment_Vesa(v15, a1, v14 + v15, a1 + v13); + if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); } } - LABEL_113: - */ _vm->_soundManager.VERIF_SOUND(); - return _vm->_eventsManager.CONTROLE_MES(); + CONTROLE_MES(); } } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index a4b5bd9afd..835a9d95c3 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -53,6 +53,7 @@ public: int souris_b; byte *pointeur_souris; uint32 lItCounter; + uint32 _priorCounterTime; uint32 _priorFrameTime; bool ESC_KEY; bool NOESC; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a5086201a8..4e240902d2 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1294,16 +1294,16 @@ Video_Cont_Vbe16a: void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height) { const byte *srcP; byte *destP; - int yCtr; + int rowCount; unsigned int i; - int yTemp; + int rowCount2; - srcP = srcSurface + xs + nbrligne2 * ys; + assert(xs <= SCREEN_WIDTH && ys <= SCREEN_HEIGHT); + srcP = xs + nbrligne2 * ys + srcSurface; destP = destSurface; - - yCtr = height; + rowCount = height; do { - yTemp = yCtr; + rowCount2 = rowCount; if (width & 1) { memcpy(destP, srcP, width); srcP += width; @@ -1312,16 +1312,16 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int for (i = width >> 1; i; --i) { *(uint16 *)destP = *(uint16 *)srcP; srcP += 2; - destP = (byte *)destP + 2; + destP += 2; } } else { memcpy(destP, srcP, 4 * (width >> 2)); srcP += 4 * (width >> 2); - destP = (byte *)destP + 4 * (width >> 2); + destP += 4 * (width >> 2); } srcP = nbrligne2 + srcP - width; - yCtr = yTemp - 1; - } while (yTemp != 1); + rowCount = rowCount2 - 1; + } while (rowCount2 != 1); } void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex) { @@ -1528,6 +1528,7 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { } if (v10 == 1) { + assert(_vm->_globals.NBBLOC < 50); BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; bloc.field0 = 1; @@ -1556,6 +1557,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { return; SDL_NBLOCS = _vm->_globals.NBBLOC; + DD_Lock(); for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { BlocItem &bloc = _vm->_globals.BLOC[idx]; @@ -1580,7 +1582,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (bloc.x2 > (_vm->_eventsManager.start_x + SCREEN_WIDTH)) bloc.x2 = _vm->_eventsManager.start_x + SCREEN_WIDTH; - if (!SDL_ECHELLE) { + if (SDL_ECHELLE) { // Calculate the bounds int xp = Magic_Number(bloc.x1) - 4; if (xp < _vm->_eventsManager.start_x) @@ -1600,6 +1602,9 @@ void GraphicsManager::Affiche_Segment_Vesa() { if ((height - yp) > (SCREEN_HEIGHT - 40)) yp -= 4; + // WORKAROUND: Original didn't lock the screen for access + DD_Lock(); + if (Winbpp == 2) { m_scroll16A(VESA_BUFFER, xp, yp, width, height, Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); @@ -1608,11 +1613,16 @@ void GraphicsManager::Affiche_Segment_Vesa() { Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } + DD_Unlock(); + dstRect.left = Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE); dstRect.top = Reel_Zoom(yp, SDL_ECHELLE); dstRect.setWidth(Reel_Zoom(width, SDL_ECHELLE)); dstRect.setHeight(Reel_Zoom(height, SDL_ECHELLE)); } else { + // WORKAROUND: Original didn't lock the screen for access + DD_Lock(); + if (Winbpp == 2) { m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1 - _vm->_eventsManager.start_x, bloc.y1); @@ -1620,11 +1630,25 @@ void GraphicsManager::Affiche_Segment_Vesa() { m_scroll(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1 - _vm->_eventsManager.start_x, bloc.y1); } + + dstRect.left = bloc.x1 - _vm->_eventsManager.start_x; + dstRect.top = bloc.y1; + dstRect.setWidth(bloc.x2 - bloc.x1); + dstRect.setHeight(bloc.y2 - bloc.y1); + + DD_Unlock(); } } _vm->_globals.BLOC[idx].field0 = 0; } + + _vm->_globals.NBBLOC = 0; + DD_Unlock(); + if (!_vm->_globals.BPP_NOAFF) { +// SDL_UpdateRects(LinuxScr, SDL_NBLOCS, dstrect); + } + SDL_NBLOCS = 0; } void GraphicsManager::CopyAsm(const byte *surface) { -- cgit v1.2.3 From 4ed054e18054f93f5640e2559fd0d834720c7861 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 18:40:26 +1100 Subject: HOPKINS: Fix to show the ScummVM cursor at the correct position --- engines/hopkins/events.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index bdea8af67d..6ed5a9c37e 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -167,10 +167,13 @@ void EventsManager::CHANGE_MOUSE(int id) { destP += _vm->_globals.OBJL; } + // Calculate the X offset within the pointer image to the actual cursor data + int xOffset = !mouse_linux ? 10 : 20; + // Set the ScummVM cursor from the surface Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); g_system->setMouseCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, - 0, 0, 0, true, &pixelFormat); + xOffset, 0, 0, true, &pixelFormat); // Delete the cursor surface delete[] cursorPixels; -- cgit v1.2.3 From da339dc822325115a36eef6a4c3629b7ac3e7b6b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 18:41:55 +1100 Subject: HOPKINS: Comment out original code that draws the cursor on the screen. This is redundant, given we're relying on core ScummVM to draw the cursor. --- engines/hopkins/events.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 6ed5a9c37e..fa45b506a6 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -332,15 +332,20 @@ LABEL_45: if (yp + v13 > _vm->_graphicsManager.max_y) v13 -= yp + v13 - _vm->_graphicsManager.max_y; if (v14 > 1 && v13 > 1) { +/* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); +*/ _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, yp + 300, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); } } goto LABEL_54; } + +/* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, yp + 300, souris_n); +*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); LABEL_54: _vm->_globals.vitesse = 2; @@ -434,7 +439,9 @@ LABEL_65: if (souris_flag == 1) { if (btsouris != 23) { if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { +/* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); +*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); goto LABEL_113; } @@ -442,7 +449,9 @@ LABEL_65: goto LABEL_113; } if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { +/* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); +*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); } } -- cgit v1.2.3 From 193686770ce53890807660a35880480b54d9df90 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 19:38:53 +1100 Subject: HOPKINS: Put a TODO in Capture_Mem to clip reading to within the passed surface --- engines/hopkins/graphics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 4e240902d2..b1bce4840f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1298,7 +1298,8 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int unsigned int i; int rowCount2; - assert(xs <= SCREEN_WIDTH && ys <= SCREEN_HEIGHT); + // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within + // the screen, and so thus can read areas outside of the allocated surface buffer srcP = xs + nbrligne2 * ys + srcSurface; destP = destSurface; rowCount = height; -- cgit v1.2.3 From 1d2c34193389ce526013e5465bbaab411ebe8d29 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Oct 2012 21:14:18 +1100 Subject: HOPKINS: Cleanup and bugfixes for BOBZONE array initialisation --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/lines.cpp | 46 +++++++++--------- engines/hopkins/lines.h | 4 +- engines/hopkins/objects.cpp | 114 ++++++++++++++++++++------------------------ 4 files changed, 78 insertions(+), 90 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0185b2bf1a..30f25ce222 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -324,9 +324,9 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field8 = 0; _vm->_linesManager.Ligne[idx].fieldC = g_PTRNUL; - _vm->_linesManager.LigneZone[idx].field0 = 0; + _vm->_linesManager.LigneZone[idx].count = 0; _vm->_linesManager.LigneZone[idx].field2 = 0; - _vm->_linesManager.LigneZone[idx].field4 = g_PTRNUL; + _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; } for (int idx = 0; idx < 100; ++idx) { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 26cef1d7d9..7b6e895715 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -130,23 +130,21 @@ int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { void LinesManager::RETIRE_LIGNE_ZONE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (_vm->_linesManager.LigneZone[idx].field4 != g_PTRNUL) - _vm->_globals.dos_free2(_vm->_linesManager.LigneZone[idx].field4); + if (_vm->_linesManager.LigneZone[idx].zoneData != (int16 *)g_PTRNUL) + _vm->_globals.dos_free2((byte *)_vm->_linesManager.LigneZone[idx].zoneData); - _vm->_linesManager.LigneZone[idx].field4 = g_PTRNUL; + _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; } void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { - int v7; int v8; int v9; - byte *v10; + int16 *zoneData; + int16 *dataP; int v11; - byte *v12; int v13; int v14; - byte *v15; int v16; int v17; int v18; @@ -159,9 +157,9 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (a2 != a3 || a3 != a4 || a3 != a5) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - v7 = idx; - if (LigneZone[v7].field4 != g_PTRNUL) - LigneZone[v7].field4 = _vm->_globals.dos_free2(LigneZone[v7].field4); + + if (LigneZone[idx].zoneData != (int16 *)g_PTRNUL) + LigneZone[idx].zoneData = (int16 *)_vm->_globals.dos_free2((byte *)LigneZone[idx].zoneData); v8 = a2 - a4; if (a2 - a4 < 0) v8 = -v8; @@ -170,17 +168,18 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (a3 - a5 < 0) v9 = -v9; v18 = v9; - if (v19 <= (int)v9) + if (v19 <= v9) v20 = v9 + 1; else v20 = v19 + 1; - v10 = _vm->_globals.dos_malloc2(4 * v20 + 8); + + zoneData = (int16 *)_vm->_globals.dos_malloc2(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); v11 = idx; - LigneZone[v11].field4 = v10; - if (g_PTRNUL == v10) + LigneZone[v11].zoneData = zoneData; + if (zoneData == (int16 *)g_PTRNUL) error("AJOUTE LIGNE ZONE"); - v12 = LigneZone[v11].field4; + dataP = zoneData; v23 = 1000 * v19 / v20; v22 = 1000 * v18 / v20; if (a4 < a2) @@ -194,10 +193,9 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in v14 = 0; if (v20 > 0) { do { - WRITE_LE_UINT16(v12, v17); - v15 = v12 + 2; - WRITE_LE_UINT16(v15, v21); - v12 = v15 + 2; + *dataP++ = v17; + *dataP++ = v21; + v13 += v23; v16 += v22; v17 = v13 / 1000; @@ -205,14 +203,14 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in ++v14; } while (v20 > v14); } - WRITE_LE_UINT16(v12, (uint16)-1); - WRITE_LE_UINT16(v12 + 2, (uint16)-1); + *dataP++ = -1; + *dataP++ = -1; - LigneZone[idx].field0 = v20; + LigneZone[idx].count = v20; LigneZone[idx].field2 = a6; } else { - _vm->_globals.BOBZONE_FLAG[idx] = 1; - _vm->_globals.BOBZONE[idx] = a3; + _vm->_globals.BOBZONE_FLAG[a6] = 1; + _vm->_globals.BOBZONE[a6] = a3; } } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 1ac44b8bb0..cded40646e 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -31,9 +31,9 @@ namespace Hopkins { class HopkinsEngine; struct LigneZoneItem { - int field0; + int count; int field2; - byte *field4; + int16 *zoneData; }; struct LigneItem { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 80fb61b692..ce8e870936 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -329,10 +329,7 @@ void ObjectsManager::AFF_SPRITES() { int v13; int v14; int v15; - int v16; int v17; - int v18; - int v19; int v20; int v21; int y1_1; @@ -350,7 +347,6 @@ void ObjectsManager::AFF_SPRITES() { int v35; int v36; int v37; - int v38; uint16 arr[50]; _vm->_globals.NBTRI = 0; @@ -538,50 +534,46 @@ void ObjectsManager::AFF_SPRITES() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 164, 107, _vm->_eventsManager.start_x + 498, 320); } - v38 = 0; - do { - v16 = v38; - if (_vm->_fontManager.Txt[v16].field0 == 1) { - if ((uint16)(_vm->_fontManager.Txt[v16].field3FC - 2) > 1) - _vm->_fontManager.BOITE(v38, - _vm->_fontManager.Txt[v16].fieldC, _vm->_fontManager.Txt[v16].filename, - _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v16].xp, _vm->_fontManager.Txt[v16].yp); + for (int idx = 0; idx <= 10; ++idx) { + if (_vm->_fontManager.Txt[idx].field0 == 1) { + if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) + _vm->_fontManager.BOITE(idx, + _vm->_fontManager.Txt[idx].fieldC, _vm->_fontManager.Txt[idx].filename, + _vm->_eventsManager.start_x + _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); else _vm->_fontManager.BOITE( - v38, - _vm->_fontManager.Txt[v16].fieldC, - _vm->_fontManager.Txt[v16].filename, - _vm->_fontManager.Txt[v16].xp, - _vm->_fontManager.Txt[v16].yp); - _vm->_fontManager.ListeTxt[v38].enabled = true; + idx, + _vm->_fontManager.Txt[idx].fieldC, + _vm->_fontManager.Txt[idx].filename, + _vm->_fontManager.Txt[idx].xp, + _vm->_fontManager.Txt[idx].yp); + _vm->_fontManager.ListeTxt[idx].enabled = true; - v17 = v38; + v17 = idx; if ((uint16)(_vm->_fontManager.Txt[v17].field3FC - 2) > 1) - _vm->_fontManager.ListeTxt[v38].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].xp; + _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].xp; else - _vm->_fontManager.ListeTxt[v38].xp = _vm->_fontManager.Txt[v17].xp; + _vm->_fontManager.ListeTxt[idx].xp = _vm->_fontManager.Txt[v17].xp; - v18 = v38; - v19 = v38; - _vm->_fontManager.ListeTxt[v18].yp = _vm->_fontManager.Txt[v19].yp; - _vm->_fontManager.ListeTxt[v18].width = _vm->_fontManager.Txt[v19].width; - _vm->_fontManager.ListeTxt[v18].height = _vm->_fontManager.Txt[v19].height; - - if (_vm->_fontManager.ListeTxt[v38].xp < _vm->_graphicsManager.min_x) - _vm->_fontManager.ListeTxt[v38].xp = _vm->_graphicsManager.min_x - 1; - if (_vm->_fontManager.ListeTxt[v38].yp < _vm->_graphicsManager.min_y) - _vm->_fontManager.ListeTxt[v38].yp = _vm->_graphicsManager.min_y - 1; - v20 = _vm->_fontManager.ListeTxt[v38].xp; - if (_vm->_fontManager.ListeTxt[v38].width + v20 > _vm->_graphicsManager.max_x) - _vm->_fontManager.ListeTxt[v38].width = _vm->_graphicsManager.max_x - v20; - v21 = _vm->_fontManager.ListeTxt[v38].yp; - if (_vm->_fontManager.ListeTxt[v38].height + v21 > _vm->_graphicsManager.max_y) - _vm->_fontManager.ListeTxt[v38].height = _vm->_graphicsManager.max_y - v21; - if (_vm->_fontManager.ListeTxt[v38].width <= 0 || _vm->_fontManager.ListeTxt[v38].height <= 0) - _vm->_fontManager.ListeTxt[v18].enabled = false; - } - ++v38; - } while (v38 <= 10); + _vm->_fontManager.ListeTxt[idx].yp = _vm->_fontManager.Txt[idx].yp; + _vm->_fontManager.ListeTxt[idx].width = _vm->_fontManager.Txt[idx].width; + _vm->_fontManager.ListeTxt[idx].height = _vm->_fontManager.Txt[idx].height; + + if (_vm->_fontManager.ListeTxt[idx].xp < _vm->_graphicsManager.min_x) + _vm->_fontManager.ListeTxt[idx].xp = _vm->_graphicsManager.min_x - 1; + if (_vm->_fontManager.ListeTxt[idx].yp < _vm->_graphicsManager.min_y) + _vm->_fontManager.ListeTxt[idx].yp = _vm->_graphicsManager.min_y - 1; + + v20 = _vm->_fontManager.ListeTxt[idx].xp; + if (_vm->_fontManager.ListeTxt[idx].width + v20 > _vm->_graphicsManager.max_x) + _vm->_fontManager.ListeTxt[idx].width = _vm->_graphicsManager.max_x - v20; + v21 = _vm->_fontManager.ListeTxt[idx].yp; + if (_vm->_fontManager.ListeTxt[idx].height + v21 > _vm->_graphicsManager.max_y) + _vm->_fontManager.ListeTxt[idx].height = _vm->_graphicsManager.max_y - v21; + if (_vm->_fontManager.ListeTxt[idx].width <= 0 || _vm->_fontManager.ListeTxt[idx].height <= 0) + _vm->_fontManager.ListeTxt[idx].enabled = false; + } + } INVENT_ANIM(); } @@ -2611,10 +2603,9 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { } void ObjectsManager::CARRE_ZONE() { - byte *v3; + int16 *dataP; int v4; int v5; - byte *v6; int v7; int v8; int v10; @@ -2635,8 +2626,8 @@ void ObjectsManager::CARRE_ZONE() { } for (int idx = 0; idx < 400; ++idx) { - v3 = _vm->_linesManager.LigneZone[idx].field4; - if (v3 != g_PTRNUL) { + dataP = _vm->_linesManager.LigneZone[idx].zoneData; + if (dataP != (int16 *)g_PTRNUL) { v4 = _vm->_linesManager.LigneZone[idx].field2; _vm->_globals.CarreZone[v4].field0 = 1; if (_vm->_globals.CarreZone[v4].fieldC < idx) @@ -2645,13 +2636,12 @@ void ObjectsManager::CARRE_ZONE() { _vm->_globals.CarreZone[v4].fieldA = idx; v13 = 0; - v12 = _vm->_linesManager.LigneZone[idx].field0; + v12 = _vm->_linesManager.LigneZone[idx].count; if (v12 > 0) { do { - v5 = (int16)READ_LE_UINT16(v3); - v6 = v3 + 2; - v11 = (int16)READ_LE_UINT16(v6); - v3 = v6 + 2; + v5 = *dataP++; + v11 = *dataP++; + if (_vm->_globals.CarreZone[v4].field2 >= v5) _vm->_globals.CarreZone[v4].field2 = v5; if (_vm->_globals.CarreZone[v4].field4 <= v5) @@ -7874,13 +7864,13 @@ int ObjectsManager::colision(int a1, int a2) { int v9 = v3 + 1; do { - byte *srcP = _vm->_linesManager.LigneZone[v8].field4; - if (srcP != g_PTRNUL) { + int16 *srcP = _vm->_linesManager.LigneZone[v8].zoneData; + if (srcP != (int16 *)g_PTRNUL) { bool flag = true; - int v11 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2); - int dataV2 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 2 + 2); - int v12 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 4); - int v13 = (int16)READ_LE_UINT16(srcP + _vm->_linesManager.LigneZone[v8].field0 * 4 - 2); + int v11 = *(srcP + _vm->_linesManager.LigneZone[v8].count); + int dataV2 = *(srcP + _vm->_linesManager.LigneZone[v8].count + 1); + int v12 = *(srcP + _vm->_linesManager.LigneZone[v8].count * 2 - 2); + int v13 = *(srcP + _vm->_linesManager.LigneZone[v8].count * 2 - 1); int v10 = v13; if (v11 < v12 && v4 >= v11 && v5 > v13) @@ -7894,11 +7884,11 @@ int ObjectsManager::colision(int a1, int a2) { if (!flag) { - if (v11 < _vm->_linesManager.LigneZone[v8].field0) { - for (; v11 < _vm->_linesManager.LigneZone[v8].field0; ++idx) { - int v11 = (int16)READ_LE_UINT16(srcP); - int v12 = (int16)READ_LE_UINT16(srcP + 2); - srcP += 4; + if (v11 < _vm->_linesManager.LigneZone[v8].count) { + for (; v11 < _vm->_linesManager.LigneZone[v8].count; ++idx) { + int v11 = *srcP; + int v12 = *(srcP + 1); + srcP += 2; if ((v2 == v11 || v9 == v11) && a2 == v12) return _vm->_linesManager.LigneZone[v8].field2; -- cgit v1.2.3 From 5f10d80f9e652ee2676a79170b4165843eaed49b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 10:17:03 +1100 Subject: HOPKINS: Removed some redundant references --- engines/hopkins/events.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index fa45b506a6..6c2cadf257 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -87,14 +87,14 @@ void EventsManager::souris_max() { } int EventsManager::XMOUSE() { - souris_x = _vm->_eventsManager.start_x + g_system->getEventManager()->getMousePos().x; + 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 = _vm->_eventsManager.start_x + g_system->getEventManager()->getMousePos().x; + souris_x = start_x + g_system->getEventManager()->getMousePos().x; souris_y = g_system->getEventManager()->getMousePos().y; return souris_y + ofset_souris_y; -- cgit v1.2.3 From af8023c3b71246c33a61aa4308cddb67bd8b0760 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 10:20:10 +1100 Subject: HOPKINS: Rewrote the collision detection --- engines/hopkins/objects.cpp | 107 +++++++++++++++++++++----------------------- engines/hopkins/objects.h | 2 +- 2 files changed, 52 insertions(+), 57 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ce8e870936..f128742eef 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4182,25 +4182,25 @@ int ObjectsManager::MZONE() { __int16 v7; int v8; int v9; - __int16 i; + __int16 yCurrent; __int16 v11; __int16 j; __int16 k; - __int16 l; + __int16 xCurrent; int v15; __int16 v16; __int16 v17; __int16 v18; __int16 v19; - __int16 v20; - __int16 v21; + __int16 yp; + __int16 xp; v19 = 0; v18 = 0; v17 = 0; v16 = 0; - v21 = _vm->_eventsManager.souris_x + _vm->_eventsManager.ofset_souris_x; - v20 = _vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y; + xp = _vm->_eventsManager.souris_x + _vm->_eventsManager.ofset_souris_x; + yp = _vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y; if ((_vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y) > 19) { v1 = 0; do { @@ -4213,11 +4213,11 @@ int ObjectsManager::MZONE() { if (_vm->_globals.Bob[v3].fieldC != 250) { if (!_vm->_globals.Bob[v3].field16) { v4 = _vm->_globals.Bob[v3].field3E; - if (v21 > v4) { - if (v21 < _vm->_globals.Bob[v3].field42 + v4) { + if (xp > v4) { + if (xp < _vm->_globals.Bob[v3].field42 + v4) { v5 = _vm->_globals.Bob[v3].field40; - if (v20 > v5) { - if (v20 < _vm->_globals.Bob[v3].field44 + v5) { + if (yp > v5) { + if (yp < _vm->_globals.Bob[v3].field44 + v5) { v6 = v1; if (_vm->_globals.ZONEP[v1].field4 == -1) { _vm->_globals.ZONEP[v6].field0 = 0; @@ -4248,10 +4248,10 @@ int ObjectsManager::MZONE() { if (_vm->_globals.ZONEP[v7].field10 == 1) { v8 = v7; if (_vm->_globals.CarreZone[v8].field0 == 1) { - if (_vm->_globals.CarreZone[v7].field2 <= v21 - && _vm->_globals.CarreZone[v7].field4 >= v21 - && _vm->_globals.CarreZone[v7].field6 <= v20 - && _vm->_globals.CarreZone[v7].field8 >= v20) { + if (_vm->_globals.CarreZone[v7].field2 <= xp + && _vm->_globals.CarreZone[v7].field4 >= xp + && _vm->_globals.CarreZone[v7].field6 <= yp + && _vm->_globals.CarreZone[v7].field8 >= yp) { if (_vm->_globals.CarreZone[v7].fieldE == 1) { _vm->_globals.oldzone_46 = _vm->_linesManager.LigneZone[_vm->_globals.CarreZone[v7].fieldA].field2; return _vm->_globals.oldzone_46; @@ -4267,30 +4267,32 @@ int ObjectsManager::MZONE() { } while (v7 <= 99); if (!_vm->_globals.SegmentEnCours) goto LABEL_58; - for (i = v20; i >= 0; --i) { - v11 = colision(v21, i); + + for (yCurrent = yp; yCurrent >= 0; --yCurrent) { + v11 = colision(xp, yCurrent); v19 = v11; if (v11 != -1 && _vm->_globals.ZONEP[v11].field10 == 1) break; } if (v19 == -1) goto LABEL_58; - for (j = v20; _vm->_graphicsManager.max_y > j; ++j) { - v18 = colision(v21, j); + for (j = yp; _vm->_graphicsManager.max_y > j; ++j) { + v18 = colision(xp, j); if (v18 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) break; } if (v18 == -1) goto LABEL_58; - for (k = v21; k >= 0; --k) { - v16 = colision(k, v20); + for (k = xp; k >= 0; --k) { + v16 = colision(k, yp); if (v16 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) break; } if (v16 == -1) goto LABEL_58; - for (l = v21; _vm->_graphicsManager.max_x > l; ++l) { - v17 = colision(l, v20); + + for (xCurrent = xp; _vm->_graphicsManager.max_x > xCurrent; ++xCurrent) { + v17 = colision(xCurrent, yp); if (v17 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) break; } @@ -7845,58 +7847,51 @@ int ObjectsManager::CALC_PROPRE(int idx) { return v1; } -int ObjectsManager::colision(int a1, int a2) { +int ObjectsManager::colision(int xp, int yp) { if (_vm->_globals.SegmentEnCours <= 0) return -1; - int v2 = a1; - int v3 = v2; - int v4 = v2 + 4; - int v5 = v2 - 4; + int xMax = xp + 4; + int xMin = xp - 4; for (int idx = 0; idx <= _vm->_globals.SegmentEnCours; ++idx) { - int v8 = _vm->_globals.Segment[idx].field2; - if (v8 < _vm->_globals.Segment[idx].field4) + int field2 = _vm->_globals.Segment[idx].field2; + if (_vm->_globals.Segment[idx].field4 < field2) continue; - - int v6 = a2 + 4; - int v7 = a2 - 4; - int v9 = v3 + 1; + + int yMax = yp + 4; + int yMin = yp - 4; do { - int16 *srcP = _vm->_linesManager.LigneZone[v8].zoneData; - if (srcP != (int16 *)g_PTRNUL) { - bool flag = true; - int v11 = *(srcP + _vm->_linesManager.LigneZone[v8].count); - int dataV2 = *(srcP + _vm->_linesManager.LigneZone[v8].count + 1); - int v12 = *(srcP + _vm->_linesManager.LigneZone[v8].count * 2 - 2); - int v13 = *(srcP + _vm->_linesManager.LigneZone[v8].count * 2 - 1); - int v10 = v13; + int16 *dataP = _vm->_linesManager.LigneZone[field2].zoneData; + if (dataP != (int16 *)g_PTRNUL) { + int count = _vm->_linesManager.LigneZone[field2].count; + int v1 = *dataP; + int v2 = *(dataP + 1); + int v3 = *(dataP + count * 2 - 2); + int v4 = *(dataP + count * 2 - 1); - if (v11 < v12 && v4 >= v11 && v5 > v13) + bool flag = true; + if (v1 < v3 && (xMax < v1 || xMin > v3)) flag = false; - if (v11 >= v12 && v5 <= v13 && v4 < v13) + if (v1 >= v3 && (xMin > v1 || xMax < v3)) flag = false; - if (dataV2 < v10 && v6 >= dataV2 && v7 > v10) + if (v2 < v4 && (v2 < yMax || yMin > v4)) flag = false; - if (dataV2 >= v10 && v7 <= dataV2 && v6 < v10) + if (v2 >= v4 && (yMin > v2 || yMax < v4)) flag = false; + if (flag && _vm->_linesManager.LigneZone[field2].count > 0) { + for (int v5 = 0; v5 < count; ++v5) { + int xCheck = *dataP++; + int yCheck = *dataP++; - if (!flag) { - if (v11 < _vm->_linesManager.LigneZone[v8].count) { - for (; v11 < _vm->_linesManager.LigneZone[v8].count; ++idx) { - int v11 = *srcP; - int v12 = *(srcP + 1); - srcP += 2; - - if ((v2 == v11 || v9 == v11) && a2 == v12) - return _vm->_linesManager.LigneZone[v8].field2; - } + if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) + return _vm->_linesManager.LigneZone[field2].field2; } } } - } while (++v8 < _vm->_globals.Segment[idx].field0); + } while (++field2 < _vm->_globals.Segment[idx].field4); } return -1; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 6209fcdbb1..f3b41bc8d0 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -248,7 +248,7 @@ public: void VERBE_OFF(int idx, int a2); void VERBE_ON(int idx, int a2); int CALC_PROPRE(int idx); - int colision(int a1, int a2); + int colision(int xp, int yp); void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); void SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6); -- cgit v1.2.3 From e23f91472e6694087e3aee13139b84d227f7f7f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 13:00:21 +1100 Subject: HOPKINS: Bugfix for loading game text indexes --- engines/hopkins/font.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 6f0f22bcd4..5f930063fe 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -219,11 +219,12 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); file = _vm->_globals.NFICHIER; - if (strncmp(file.c_str(), oldname.c_str(), strlen(file.c_str()))) { + if (strncmp(file.c_str(), oldname.c_str(), strlen(file.c_str())) != 0) { + // Starting to access a new file, so read in the index file for the file oldname = file; - nom_index = file; + nom_index = Common::String(file.c_str(), file.size() - 3); + nom_index += "IND"; - //*(int *)((char *)&dword_80AE4DC + strlen(nom_index) + 1) = dword_807C98D; if (!f.open(nom_index)) error("Error opening file - %s", nom_index.c_str()); filesize = f.size(); -- cgit v1.2.3 From af2824da8247c699c29a566bce1facb76d4b5877 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 13:43:29 +1100 Subject: HOPKINS: Added debugger skeleton --- engines/hopkins/debugger.cpp | 38 +++++++++++++++++++++++++++++++++++++ engines/hopkins/debugger.h | 45 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/events.cpp | 10 ++++++++++ engines/hopkins/hopkins.cpp | 1 + engines/hopkins/hopkins.h | 2 ++ engines/hopkins/module.mk | 1 + 6 files changed, 97 insertions(+) create mode 100644 engines/hopkins/debugger.cpp create mode 100644 engines/hopkins/debugger.h diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp new file mode 100644 index 0000000000..fc70e93102 --- /dev/null +++ b/engines/hopkins/debugger.cpp @@ -0,0 +1,38 @@ +/* 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 "hopkins/debugger.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" + +namespace Hopkins { + +Debugger::Debugger() : GUI::Debugger() { + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); +} + +void Debugger::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +} // End of namespace Tony diff --git a/engines/hopkins/debugger.h b/engines/hopkins/debugger.h new file mode 100644 index 0000000000..7a2f44aafe --- /dev/null +++ b/engines/hopkins/debugger.h @@ -0,0 +1,45 @@ +/* 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_DEBUGGER_H +#define HOPKINS_DEBUGGER_H + +#include "common/scummsys.h" +#include "gui/debugger.h" + +namespace Hopkins { + +class HopkinsEngine; + +class Debugger : public GUI::Debugger { +private: + HopkinsEngine *_vm; + +public: + Debugger(); + virtual ~Debugger() {} + void setParent(HopkinsEngine *vm); +}; + +} // End of namespace Hopkins + +#endif diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 6c2cadf257..8f4d5eee5c 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -198,6 +198,9 @@ void EventsManager::checkForNextFrameCounter() { if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { _priorFrameTime = milli; g_system->updateScreen(); + + // Signal the ScummVM debugger + _vm->_debugger.onFrame(); } } @@ -222,6 +225,13 @@ void EventsManager::pollEvents() { case Common::EVENT_KEYDOWN: ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE; + + // Check for debugger + if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _vm->_debugger.attach(); + _vm->_debugger.onFrame(); + } return; case Common::EVENT_LBUTTONDOWN: diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2608da5dbc..84836e2510 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -38,6 +38,7 @@ HopkinsEngine *g_vm; HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() { g_vm = this; + _debugger.setParent(this); _animationManager.setParent(this); _eventsManager.setParent(this); _fileManager.setParent(this); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index f58dfd7f14..06b87bdacb 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -32,6 +32,7 @@ #include "engines/engine.h" #include "graphics/surface.h" #include "hopkins/anim.h" +#include "hopkins/debugger.h" #include "hopkins/events.h" #include "hopkins/files.h" #include "hopkins/font.h" @@ -93,6 +94,7 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: + Debugger _debugger; AnimationManager _animationManager; EventsManager _eventsManager; FontManager _fontManager; diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 7fc92c5ea1..ff74626ea6 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -2,6 +2,7 @@ MODULE := engines/hopkins MODULE_OBJS := \ anim.o \ + debugger.o \ detection.o \ dialogs.o \ events.o \ -- cgit v1.2.3 From 4e16b2e81d2f36eb76bba27dfbfff031e8e46813 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 19:41:22 +1100 Subject: HOPKINS: Minor bugfix for colision method --- engines/hopkins/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index f128742eef..3578df160a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4276,7 +4276,7 @@ int ObjectsManager::MZONE() { } if (v19 == -1) goto LABEL_58; - for (j = yp; _vm->_graphicsManager.max_y > j; ++j) { + for (j = yp; j < _vm->_graphicsManager.max_y; ++j) { v18 = colision(xp, j); if (v18 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) break; @@ -7876,7 +7876,7 @@ int ObjectsManager::colision(int xp, int yp) { flag = false; if (v1 >= v3 && (xMin > v1 || xMax < v3)) flag = false; - if (v2 < v4 && (v2 < yMax || yMin > v4)) + if (v2 < v4 && (yMax < v2 || yMin > v4)) flag = false; if (v2 >= v4 && (yMin > v2 || yMax < v4)) flag = false; -- cgit v1.2.3 From 137c17e78c90b2c4fb3d5ef67d5a0986e13e5814 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 20:54:55 +1100 Subject: HOPKINS: Further bugfix to collision method --- engines/hopkins/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3578df160a..68e9969d23 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -7891,7 +7891,7 @@ int ObjectsManager::colision(int xp, int yp) { } } } - } while (++field2 < _vm->_globals.Segment[idx].field4); + } while (++field2 <= _vm->_globals.Segment[idx].field4); } return -1; -- cgit v1.2.3 From 481e58142235106e251c59d3774262a9ed57f0ef Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Oct 2012 22:58:26 +1100 Subject: HOPKINS: Some renaming and bugfixes to BOITE method --- engines/hopkins/font.cpp | 62 +++++++++++++++++++++--------------------------- engines/hopkins/font.h | 2 +- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 5f930063fe..dd01b11907 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -126,11 +126,9 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int v23; char v24; int v25; - int v26; int v27; int v28; int v29; - int v30; int v31; int v32; int v33; @@ -153,8 +151,8 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int v54; int v55; int v56; - int v57; - int v58; + int lineSize; + int lineCount; byte *v59; byte *v60; byte *v61; @@ -177,7 +175,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, v73 = xp; v70 = yp; - v58 = 0; + lineCount = 0; if (idx < 0) error("Bad number for text"); _vm->_globals.police_l = 11; @@ -191,7 +189,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, if (Txt[idx].field12 > 0) { do { v40 = idx; - TEXT_NOW1(xp + 5, v72, Txt[idx].field14[v38], Txt[idx].field40A); + TEXT_NOW1(xp + 5, v72, Txt[idx].lines[v38], Txt[idx].field40A); v72 += _vm->_globals.police_h + 1; ++v38; idx = v40; @@ -281,9 +279,8 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, if (v69) { while (1) { v14 = *(v60 + v64); - if (v14 == 10 || v14 == 13) { + if (v14 == '\r' || v14 == '\n') { *(v60 + v64) = 0; -// v11 = (int)Txt; if (!Txt[idx].field3FE) break; } @@ -310,13 +307,10 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, v17 = -v17; Txt[idx].xp = 320 - v17; v73 = _vm->_eventsManager.start_x + 320 - v17; - v58 = 1; + lineCount = 1; v18 = 0; if (v64 + 1 > 0) { - do { - Txt[idx].field14[v18] = *(v60 + v18); - ++v18; - } while (v18 < v64 + 1); + Txt[idx].lines[0] = Common::String((const char *)v60, v64); } } else { LABEL_43: @@ -328,31 +322,31 @@ LABEL_43: v19 = 0; ptrb = _vm->_globals.largeur_boite - 4; while (1) { - v57 = v19; + lineSize = v19; do v11 = *(v61 + v65 + v19++); while (v11 != 32 && v11 != 37); if (v19 >= ptrb / _vm->_globals.police_l) break; - if (v11 == 37) { + if (v11 == '%') { if (v19 < ptrb / _vm->_globals.police_l) goto LABEL_55; break; } } - if (v11 != 37) + if (v11 != '%') goto LABEL_57; v11 = 32; LABEL_55: - if (v11 == 37) - v57 = v19; + if (v11 == '%') + lineSize = v19; LABEL_57: - v20 = v58; + v20 = lineCount; v21 = v11; - Txt[idx].field14[v20] = Common::String((const char *)v61 + v65, v57); - TRIER_TEXT[v58++] = v57; + Txt[idx].lines[v20] = Common::String((const char *)v61 + v65, lineSize); + TRIER_TEXT[lineCount++] = lineSize; - v65 += v57; + v65 += lineSize; v11 = v21; } while (v21 != 37); v66 = 0; @@ -365,7 +359,7 @@ LABEL_57: v23 = 0; if (v22 - 1 > 0) { do { - v24 = Txt[idx].field14[v66][v23]; + v24 = Txt[idx].lines[v66][v23]; if ((byte)v24 <= 0x1Fu) v24 = 32; ptrc += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v24 - 32); @@ -412,20 +406,19 @@ LABEL_57: Txt[idx].xp = v73; } } - _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * v58 + 2; + _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; v56 = v73; v55 = yp; v53 = _vm->_globals.largeur_boite + 10; - v51 = (_vm->_globals.police_h + 1) * v58 + 12; - v26 = 1036 * idx; + v51 = (_vm->_globals.police_h + 1) * lineCount + 12; if (Txt[idx].field3FC == 6) { v27 = v53 / 2; if (v27 < 0) v27 = -v27; - Txt[v26].xp = 315 - v27; + Txt[idx].xp = 315 - v27; v28 = _vm->_eventsManager.start_x + 315 - v27; v73 = _vm->_eventsManager.start_x + 315 - v27; - Txt[v26].yp = 50; + Txt[idx].yp = 50; v70 = 50; v55 = 50; v56 = v28; @@ -447,16 +440,15 @@ LABEL_57: _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); } - Txt[idx].field12 = v58; + Txt[idx].field12 = lineCount; v75 = v73 + 5; v71 = v70 + 5; - v30 = 0; - if (v58 > 0) { - do { - TEXT_NOW1(v75, v71, Txt[idx].field14[v30], Txt[idx].field40A); + + if (lineCount > 0) { + for (int lineNum = 0; lineNum < lineCount; ++lineNum) { + TEXT_NOW1(v75, v71, Txt[idx].lines[lineNum], Txt[idx].field40A); v71 += _vm->_globals.police_h + 1; - ++v30; - } while (v58 > v30); + } } v54 = v53 + 1; v52 = v51 + 1; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 653757a9e1..58d8ff9f2e 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -40,7 +40,7 @@ struct TxtItem { int fieldE; int field10; int field12; - Common::String field14[10]; + Common::String lines[10]; int field3FC; int field3FE; byte *field400; -- cgit v1.2.3 From 36e3fe49a62a66d98a6751efcd95d01894f8f816 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 15 Oct 2012 20:48:54 +1100 Subject: HOPKINS: Partial clean-up of AFF_SPRITES to fix Options dialog display --- engines/hopkins/objects.cpp | 59 +++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 68e9969d23..29a9c2eb00 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -318,18 +318,15 @@ void ObjectsManager::AFF_SPRITES() { int v2; int destX; int destY; - int v5; int v6; int v7; int v8; int v9; - int v10; int v11; uint16 *v12; int v13; int v14; int v15; - int v17; int v20; int v21; int y1_1; @@ -340,8 +337,6 @@ void ObjectsManager::AFF_SPRITES() { int x1_1; int x1_2; int v30; - int v31; - int v32; int v33; int v34; int v35; @@ -381,15 +376,13 @@ void ObjectsManager::AFF_SPRITES() { } while (v30 <= 10); if (!PERSO_ON) { - v31 = 0; - do { - v5 = v31; - if (_vm->_globals.Liste[v5].field0) { - v6 = _vm->_globals.Liste[v5].field2; + for (int idx = 0; idx < 5; ++idx) { + if (_vm->_globals.Liste[idx].field0) { + v6 = _vm->_globals.Liste[idx].field2; x1_2 = v6 - 2; if ((int16)(v6 - 2) < _vm->_graphicsManager.min_x) x1_2 = _vm->_graphicsManager.min_x; - v7 = _vm->_globals.Liste[v31].field4; + v7 = _vm->_globals.Liste[idx].field4; y1_2 = v7 - 2; if ((int16)(v7 - 2) < _vm->_graphicsManager.min_y) y1_2 = _vm->_graphicsManager.min_y; @@ -401,28 +394,25 @@ void ObjectsManager::AFF_SPRITES() { v9 = _vm->_graphicsManager.min_y; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_2, y1_2, - _vm->_globals.Liste[v31].width + 4, _vm->_globals.Liste[v31].height + 4, + _vm->_globals.Liste[idx].width + 4, _vm->_globals.Liste[idx].height + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); - _vm->_globals.Liste[v5].field0 = 0; + _vm->_globals.Liste[idx].field0 = 0; } - ++v31; - } while (v31 <= 4); + } } AFF_BOB_ANIM(); AFF_VBOB(); if (!PERSO_ON) { - v32 = 0; - do { - _vm->_globals.Liste[v32].field0 = 0; - v10 = v32; - if (Sprite[v10].field0 == 1) { - CALCUL_SPRITE(v32); - if (Sprite[v10].field2A == 1) - AvantTri(2, v32, Sprite[v10].field32 + Sprite[v10].field2E); - } - ++v32; - } while (v32 <= 4); + for (int idx = 0; idx < 5; ++idx) { + _vm->_globals.Liste[idx].field0 = 0; + idx = idx; + if (Sprite[idx].field0 == 1) { + CALCUL_SPRITE(idx); + if (Sprite[idx].field2A == 1) + AvantTri(2, idx, Sprite[idx].field32 + Sprite[idx].field2E); + } + } if (_vm->_globals.CACHEFLAG) VERIFCACHE(); @@ -513,7 +503,8 @@ void ObjectsManager::AFF_SPRITES() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); } - + + // If the Options dialog is activated, draw the elements if (_vm->_globals.OPTION_FLAG) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager.start_x + 464, 407, 0); @@ -534,26 +525,26 @@ void ObjectsManager::AFF_SPRITES() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 164, 107, _vm->_eventsManager.start_x + 498, 320); } + // Loop to draw any on-screen text for (int idx = 0; idx <= 10; ++idx) { - if (_vm->_fontManager.Txt[idx].field0 == 1) { + if (_vm->_fontManager.Txt[idx].textOn) { if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) _vm->_fontManager.BOITE(idx, - _vm->_fontManager.Txt[idx].fieldC, _vm->_fontManager.Txt[idx].filename, + _vm->_fontManager.Txt[idx].messageId, _vm->_fontManager.Txt[idx].filename, _vm->_eventsManager.start_x + _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); else _vm->_fontManager.BOITE( idx, - _vm->_fontManager.Txt[idx].fieldC, + _vm->_fontManager.Txt[idx].messageId, _vm->_fontManager.Txt[idx].filename, _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); _vm->_fontManager.ListeTxt[idx].enabled = true; - v17 = idx; - if ((uint16)(_vm->_fontManager.Txt[v17].field3FC - 2) > 1) - _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[v17].xp; + if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) + _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[idx].xp; else - _vm->_fontManager.ListeTxt[idx].xp = _vm->_fontManager.Txt[v17].xp; + _vm->_fontManager.ListeTxt[idx].xp = _vm->_fontManager.Txt[idx].xp; _vm->_fontManager.ListeTxt[idx].yp = _vm->_fontManager.Txt[idx].yp; _vm->_fontManager.ListeTxt[idx].width = _vm->_fontManager.Txt[idx].width; -- cgit v1.2.3 From d3945702131bd8e7a36eb9a39ede90819f9acc79 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 15 Oct 2012 20:49:17 +1100 Subject: HOPKINS: Some renaming and cleanup of font structures --- engines/hopkins/dialogs.cpp | 24 +++----- engines/hopkins/font.cpp | 127 ++++++++++++++++++++----------------------- engines/hopkins/font.h | 18 +++--- engines/hopkins/graphics.cpp | 4 +- engines/hopkins/graphics.h | 2 +- 5 files changed, 77 insertions(+), 98 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 4ed86cf7a6..f4855ff798 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -152,7 +152,7 @@ void OptionsDialog::show(HopkinsEngine *vm) { doneFlag = true; } if (mousePos.x >= vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) - doneFlag = 1; + doneFlag = true; if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { switch (vm->_graphicsManager.SPEED_SCROLL) { case 1: @@ -209,22 +209,12 @@ void OptionsDialog::show(HopkinsEngine *vm) { vm->_globals.opt_vitesse = 5; if (vm->_globals.vitesse == 3) vm->_globals.opt_vitesse = 4; - if (!vm->_soundManager.TEXTOFF) - vm->_globals.opt_txt = 7; - if (vm->_soundManager.TEXTOFF == 1) - vm->_globals.opt_txt = 8; - if (!vm->_soundManager.VOICEOFF) - vm->_globals.opt_voice = 7; - if (vm->_soundManager.VOICEOFF == 1) - vm->_globals.opt_voice = 8; - if (!vm->_soundManager.SOUNDOFF) - vm->_globals.opt_sound = 7; - if (vm->_soundManager.SOUNDOFF == 1) - vm->_globals.opt_sound = 8; - if (!vm->_soundManager.MUSICOFF) - vm->_globals.opt_music = 7; - if (vm->_soundManager.MUSICOFF == 1) - vm->_globals.opt_music = 8; + + vm->_globals.opt_txt = !vm->_soundManager.TEXTOFF ? 7 : 8; + vm->_globals.opt_voice = !vm->_soundManager.VOICEOFF ? 7 : 8; + vm->_globals.opt_sound = !vm->_soundManager.SOUNDOFF ? 7 : 8; + vm->_globals.opt_music = !vm->_soundManager.MUSICOFF ? 7 : 8; + if (vm->_globals.SVGA == 1) vm->_globals.opt_anm = 10; if (vm->_globals.SVGA == 2) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index dd01b11907..a2c3713d87 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -38,14 +38,14 @@ void FontManager::setParent(HopkinsEngine *vm) { void FontManager::clearAll() { for (int idx = 0; idx < 11; ++idx) { - Txt[idx].field0 = 0; - Txt[idx].field12 = 0; + Txt[idx].textOn = false; + Txt[idx].lineCount = 0; Txt[idx].field3FC = 0; Txt[idx].field3FE = 0; - Txt[idx].field400 = 0; + Txt[idx].textBlock = NULL; Txt[idx].width = 0; Txt[idx].height = 0; - Txt[idx].field408 = 0; + Txt[idx].textLoaded = false; ListeTxt[idx].enabled = false; } @@ -56,12 +56,12 @@ void FontManager::TEXTE_ON(int idx) { error("Attempted to display text > MAX_TEXT."); TxtItem &txt = Txt[idx - 5]; - txt.field0 = 1; - txt.field408 = 0; + txt.textOn = true; + txt.textLoaded = false; - if (txt.field400 != g_PTRNUL) { - _vm->_globals.dos_free2(txt.field400); - txt.field400 = g_PTRNUL; + if (txt.textBlock != g_PTRNUL) { + _vm->_globals.dos_free2(txt.textBlock); + txt.textBlock = g_PTRNUL; } } @@ -71,17 +71,17 @@ void FontManager::TEXTE_OFF(int idx) { error("Attempted to display text > MAX_TEXT."); TxtItem &txt = Txt[idx - 5]; - txt.field0 = 0; - txt.field408 = 0; + txt.textOn = false; + txt.textLoaded = false; - if (txt.field400 != g_PTRNUL) { - _vm->_globals.dos_free2(txt.field400); - txt.field400 = g_PTRNUL; + if (txt.textBlock != g_PTRNUL) { + _vm->_globals.dos_free2(txt.textBlock); + txt.textBlock = g_PTRNUL; } } void FontManager::COUL_TXT(int idx, byte colByte) { - Txt[idx - 5].field40A = colByte; + Txt[idx - 5].colour = colByte; } void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { @@ -91,24 +91,24 @@ void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { COUL_TXT(idx4, 253); } -void FontManager::DOS_TEXT(int idx, int a2, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10) { +void FontManager::DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int colour) { if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); TxtItem &txt = Txt[idx - 5]; - txt.field0 = 0; + txt.textOn = false; txt.filename = filename; txt.xp = xp; txt.yp = yp; - txt.fieldC = a2; + txt.messageId = messageId; txt.fieldE = a6; txt.field10 = a7; txt.field3FC = a8; txt.field3FE = a9; - txt.field40A = a10; + txt.colour = colour; } -void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int xp, int yp) { +void FontManager::BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp) { int filesize; byte *v9; const byte *v10; @@ -129,26 +129,21 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int v27; int v28; int v29; - int v31; int v32; - int v33; int v34; - int v35; int v36; int v37; - int v38; - int v40; int ptrb; int ptrc; byte *ptrd; byte *ptre; Common::String s; int v49; - int v50; + int blockSize; int v51; - int v52; + int blockHeight; int v53; - int v54; + int blockWidth; int v55; int v56; int lineSize; @@ -166,7 +161,6 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, int v69; int v70; int v71; - int v72; int v73; int i; int v75; @@ -181,31 +175,26 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, _vm->_globals.police_l = 11; _vm->_globals.largeur_boite = 11 * Txt[idx].field3FE; - if (Txt[idx].field408) { + if (Txt[idx].textLoaded) { v34 = Txt[idx].field3FC; if (v34 != 6 && v34 != 1 && v34 != 3 && v34 != 5) { - v72 = yp + 5; - v38 = 0; - if (Txt[idx].field12 > 0) { - do { - v40 = idx; - TEXT_NOW1(xp + 5, v72, Txt[idx].lines[v38], Txt[idx].field40A); - v72 += _vm->_globals.police_h + 1; - ++v38; - idx = v40; - } while (Txt[v40].field12 > v38); + int yCurrent = yp + 5; + if (Txt[idx].lineCount > 0) { + for (int lineNum = 0; lineNum < Txt[idx].lineCount; ++lineNum) { + TEXT_NOW1(xp + 5, yCurrent, Txt[idx].lines[lineNum], Txt[idx].colour); + yCurrent += _vm->_globals.police_h + 1; + } } } else { - v35 = idx; - v36 = Txt[v35].height; - v37 = Txt[v35].width; + v36 = Txt[idx].height; + v37 = Txt[idx].width; _vm->_graphicsManager.Restore_Mem( _vm->_graphicsManager.VESA_BUFFER, - Txt[v35].field400, + Txt[idx].textBlock, xp, yp, - Txt[v35].width, - Txt[v35].height); + Txt[idx].width, + Txt[idx].height); _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); } } else { @@ -213,7 +202,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, do { TRIER_TEXT[v62++] = 0; } while (v62 <= 19); - Txt[idx].field408 = 1; + Txt[idx].textLoaded = true; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); file = _vm->_globals.NFICHIER; @@ -235,7 +224,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, error("Error opening file - %s", nom_index.c_str()); v69 = 2048; - f.seek(Index[fileIndex]); + f.seek(Index[messageId]); texte_tmp = _vm->_globals.dos_malloc2(0x80Au); if (texte_tmp == g_PTRNUL) @@ -249,7 +238,7 @@ void FontManager::BOITE(int idx, int fileIndex, const Common::String &filename, _vm->_globals.texte_long = 100; v9 = _vm->_globals.dos_malloc2(0x6Eu); texte_tmp = v9; - v10 = _vm->_globals.BUF_ZONE + Index[fileIndex]; + v10 = _vm->_globals.BUF_ZONE + Index[messageId]; memcpy(v9, v10, 0x60u); v11 = 0; WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); @@ -440,48 +429,48 @@ LABEL_57: _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); } - Txt[idx].field12 = lineCount; + Txt[idx].lineCount = lineCount; v75 = v73 + 5; v71 = v70 + 5; if (lineCount > 0) { for (int lineNum = 0; lineNum < lineCount; ++lineNum) { - TEXT_NOW1(v75, v71, Txt[idx].lines[lineNum], Txt[idx].field40A); + TEXT_NOW1(v75, v71, Txt[idx].lines[lineNum], Txt[idx].colour); v71 += _vm->_globals.police_h + 1; } } - v54 = v53 + 1; - v52 = v51 + 1; - v31 = idx; - Txt[v31].width = v54; - Txt[v31].height = v52; - v32 = Txt[v31].field3FC; + + blockWidth = v53 + 1; + blockHeight = v51 + 1; + + Txt[idx].width = blockWidth; + Txt[idx].height = blockHeight; + v32 = Txt[idx].field3FC; if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { - v33 = idx; - if (Txt[v33].field400 != g_PTRNUL) - Txt[v33].field400 = _vm->_globals.dos_free2(Txt[v33].field400); - v50 = v52 * v54; - ptre = _vm->_globals.dos_malloc2(v50 + 20); + if (Txt[idx].textBlock != g_PTRNUL) + Txt[idx].textBlock = _vm->_globals.dos_free2(Txt[idx].textBlock); + blockSize = blockHeight * blockWidth; + ptre = _vm->_globals.dos_malloc2(blockSize + 20); if (ptre == g_PTRNUL) - error("Cutting a block for text box (%d)", v50); + error("Cutting a block for text box (%d)", blockSize); - Txt[v33].field400 = ptre; - Txt[v33].width = v54; - Txt[v33].height = v52; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, Txt[v33].field400, v56, v55, Txt[v33].width, v52); + Txt[idx].textBlock = ptre; + Txt[idx].width = blockWidth; + Txt[idx].height = blockHeight; + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, Txt[idx].textBlock, v56, v55, Txt[idx].width, blockHeight); } texte_tmp = _vm->_globals.dos_free2(texte_tmp); } } -void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int transColour) { +void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int colour) { for (uint idx = 0; idx < message.size(); ++idx) { char currentChar = message[idx]; if (currentChar > 31) { int characterIndex = currentChar - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, - xp, yp, characterIndex, transColour); + xp, yp, characterIndex, colour); xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, characterIndex); } } diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 58d8ff9f2e..90201902a6 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -31,23 +31,23 @@ namespace Hopkins { class HopkinsEngine; struct TxtItem { - int field0; + bool textOn; int field2; Common::String filename; int16 xp; int16 yp; - int fieldC; + int messageId; int fieldE; int field10; - int field12; + int lineCount; Common::String lines[10]; int field3FC; int field3FE; - byte *field400; + byte *textBlock; int16 width; int16 height; - int field408; - int field40A; + bool textLoaded; + int colour; }; struct ListeTxtItem { @@ -78,9 +78,9 @@ public: void TEXTE_OFF(int idx); void COUL_TXT(int idx, byte colByte); void OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4); - void DOS_TEXT(int idx, int a2, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10); - void BOITE(int idx, int a2, const Common::String &filename, int xp, int yp); - void TEXT_NOW1(int xp, int yp, const Common::String &message, int transColour); + void DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10); + void BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp); + void TEXT_NOW1(int xp, int yp, const Common::String &message, int colour); }; } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b1bce4840f..3798711a49 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2243,7 +2243,7 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned } void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, - int characterIndex, int transColour) { + int characterIndex, int colour) { const byte *v6; int i; const byte *v8; @@ -2278,7 +2278,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x v14 = *v11; if (*v11) { if (v14 == (byte)-4) - v14 = transColour; + v14 = colour; *destP = v14; } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index b826058af4..7b8a5f5151 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -174,7 +174,7 @@ public: void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); - void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int transColour); + void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); void INI_ECRAN(const Common::String &file); void INI_ECRAN2(const Common::String &file); void OPTI_INI(const Common::String &file, int a2); -- cgit v1.2.3 From f74ad01185fbf8ed3fbe30d8bbf8e7385af2aa0d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 16 Oct 2012 08:51:31 +1100 Subject: HOPKINS: Bugfixes for scene animations initialisation --- engines/hopkins/anim.cpp | 107 ++++++++++++++++++++------------------------ engines/hopkins/anim.h | 2 +- engines/hopkins/events.cpp | 4 +- engines/hopkins/globals.h | 1 - engines/hopkins/lines.cpp | 6 +-- engines/hopkins/objects.cpp | 15 +++---- 6 files changed, 61 insertions(+), 74 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 247f267027..42aef7dd1d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -843,111 +843,100 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } -void AnimationManager::RECHERCHE_ANIM(const byte *data, int idx, int nbytes) { - int v4; +void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count) { + int v3; const byte *v5; int v6; int v7; + int v8; byte *v9; int v10; int v11; int v12; - char v13; - signed int v14; - int v15; - int v16; - char v17; + int v13; + int v14; + int v15; + int v16; + int v17; int v19; - char v20; + int v20; int v21; int v22; - const byte *v23; - int v24; - - bool doneFlag = false; - bool breakFlag; + const byte *v23; + int v; v21 = 0; - v4 = 8 * idx; - v19 = 8 * idx; - + v3 = 0; + v19 = animIndex; do { v20 = *(v21 + data); - if (*(data + v20) == 'A' && *(data + v20 + 1) == 'N' && *(data + v20 + 2) == 'I' - && *(data + v20 + 3) == 'M') { - v4 = *(data + v21 + 4); - if (idx == v4) { + if (v20 == 'A' && *(data + v21 + 1) == 'N' && *(data + v21 + 2) == 'I' && *(data + v21 + 3) == 'M') { + int entryIndex = *(data + v21 + 4); + if (animIndex == entryIndex) { v5 = v21 + data + 5; v6 = v21 + 5; v7 = 0; - breakFlag = false; - + v8 = 0; do { if (*v5 == 'A' && *(v5 + 1) == 'N' && *(v5 + 2) == 'I' && *(v5 + 3) == 'M') - breakFlag = true; - + v8 = 1; if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') - breakFlag = true; - - if (nbytes < v6) { - _vm->_globals.Bqe_Anim[idx].field4 = 0; - _vm->_globals.Bqe_Anim[idx].data = g_PTRNUL; + v8 = 1; + if (count < v6) { + _vm->_globals.Bqe_Anim[animIndex].field4 = 0; + _vm->_globals.Bqe_Anim[v19].data = g_PTRNUL; + return; } - ++v6; ++v7; ++v5; - } while (!breakFlag); - - _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_malloc2(v7 + 50); - _vm->_globals.Bqe_Anim[idx].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[idx].data, v21 + data + 5, 20); - - byte *dataP = _vm->_globals.Bqe_Anim[idx].data; + } while (v8 != 1); + _vm->_globals.Bqe_Anim[v19].data = _vm->_globals.dos_malloc2(v7 + 50); + _vm->_globals.Bqe_Anim[animIndex].field4 = 1; + memcpy(_vm->_globals.Bqe_Anim[v19].data, v21 + data + 5, 0x14u); + byte *dataP = _vm->_globals.Bqe_Anim[v19].data; v9 = dataP + 20; v23 = v21 + data + 25; - v10 = (int16)READ_LE_UINT16(v21 + data + 25); - v11 = (int16)READ_LE_UINT16(v21 + data + 27); - v22 = (int16)READ_LE_UINT16(v21 + data + 29); - v12 = (int16)READ_LE_UINT16(v21 + data + 31); - v13 = (int16)READ_LE_UINT16(v21 + data + 33); + v10 = READ_LE_UINT16(v21 + data + 25); + v11 = READ_LE_UINT16(v21 + data + 27); + v22 = READ_LE_UINT16(v21 + data + 29); + v12 = READ_LE_UINT16(v21 + data + 31); + v13 = *(v21 + data + 33); *(dataP + 29) = *(v21 + data + 34); WRITE_LE_UINT16(dataP + 20, v10); WRITE_LE_UINT16(dataP + 22, v11); WRITE_LE_UINT16(dataP + 24, v22); WRITE_LE_UINT16(dataP + 26, v12); - WRITE_LE_UINT16(dataP + 28, v13); + *(dataP + 28) = v13; + v14 = 1; - do { v9 += 10; v23 += 10; if (!v22) break; - - v24 = (int16)READ_LE_UINT16(v23); - v15 = (int16)READ_LE_UINT16(v23 + 2); - v22 = (int16)READ_LE_UINT16(v23 + 4); - v16 = (int16)READ_LE_UINT16(v23 + 6); - v17 = (int16)READ_LE_UINT16(v23 + 8); + + v = READ_LE_UINT16(v23); + v15 = READ_LE_UINT16(v23 + 2); + v22 = READ_LE_UINT16(v23 + 4); + v16 = READ_LE_UINT16(v23 + 6); + v17 = *(v23 + 8); *(v9 + 9) = *(v23 + 9); - WRITE_LE_UINT16(v9, v24); + WRITE_LE_UINT16(v9, v); WRITE_LE_UINT16(v9 + 2, v15); WRITE_LE_UINT16(v9 + 4, v22); - WRITE_LE_UINT16(v9 + 6, v16); - WRITE_LE_UINT16(v9 + 8, v17); + WRITE_LE_UINT16(v9 + 6, v16); + *(v9 + 8) = v17; ++v14; } while (v14 <= 4999); - - doneFlag = 1; + v3 = 1; } } - - if (*(data + v20) == 'F' && *(data + v21 + 1) == 'I' && *(data + v21 + 2) == 'N') - doneFlag = 1; + if (v20 == 'F' && *(data + v21 + 1) == 'I' && *(data + v21 + 2) == 'N') + v3 = 1; ++v21; - } while (v21 <= nbytes && !doneFlag); + } while (v21 <= count && v3 != 1); } void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 66f623f257..339355ef75 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -49,7 +49,7 @@ public: bool REDRAW_ANIM(); void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); - void RECHERCHE_ANIM(const byte *data, int idx, int nbytes); + void RECHERCHE_ANIM(const byte *data, int animIndex, int count); void PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); void PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4); }; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 8f4d5eee5c..030e321316 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -451,8 +451,8 @@ LABEL_65: if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { /* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); -*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); +*/ goto LABEL_113; } if (btsouris != 23) @@ -461,8 +461,8 @@ LABEL_65: if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { /* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); -*/ _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); +*/ } } LABEL_113: diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5b54c1d90a..324e134c4f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -102,7 +102,6 @@ struct BobItem { int field14; int field16; byte *field18; - int field1A; int field1C; int field1E; int field20; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 7b6e895715..eda1b3efd3 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3071,7 +3071,7 @@ LABEL_323: _vm->_globals.super_parcours[v81 + 3] = 0; v121 += 3; v137 += 4; - if ((int16)(int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)(int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) + if ((int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) v131 = 1; } while (v131 != 1); LABEL_301: @@ -3129,7 +3129,7 @@ LABEL_312: goto LABEL_301; } v86 = _vm->_globals.essai2; - if ((int16)(int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; v134 = 0; @@ -3147,7 +3147,7 @@ LABEL_312: } while (v134 != 1); goto LABEL_312; } - if ((int16)(int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { + if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v135 = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 29a9c2eb00..19636839ff 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -245,7 +245,7 @@ int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)(int16)READ_LE_UINT16(rectP + 4); + return (int16)READ_LE_UINT16(rectP + 4); } int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { @@ -253,7 +253,7 @@ int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)(int16)READ_LE_UINT16(rectP + 6); + return (int16)READ_LE_UINT16(rectP + 6); } int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { @@ -590,7 +590,6 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field14 = 0; bob.field16 = 0; bob.field18 = g_PTRNUL; - bob.field1A = 0; bob.field1C = 0; bob.field1E = 0; bob.field20 = 0; @@ -2863,7 +2862,7 @@ void ObjectsManager::BTGAUCHE() { do { WRITE_LE_UINT16(v3 + 2 * v2, (int16)READ_LE_UINT16(v4 + 2 * v2)); ++v2; - } while ((int16)(int16)READ_LE_UINT16(v4 + 2 * v2) != -1); + } while ((int16)READ_LE_UINT16(v4 + 2 * v2) != -1); v5 = _vm->_globals.essai2; WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v2, (uint16)-1); WRITE_LE_UINT16(v5 + 2 * v2 + 2, (uint16)-1); @@ -3496,7 +3495,7 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { v14 = -1; v2 = (int16)READ_LE_UINT16(a1 + 2); v15 = (int16)READ_LE_UINT16(a1 + 4); - if ((int16)(int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { + if ((int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { while (1) { if (v14 != -1 && v15 != v14) { v11 = v1; @@ -7247,7 +7246,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v34 = 0; _vm->_linesManager.TOTAL_LIGNES = 0; do { - v27 = (int16)(int16)READ_LE_UINT16(v16 + 2 * v32); + v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { _vm->_linesManager.AJOUTE_LIGNE( v34, @@ -7277,7 +7276,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v35 = 0; v18 = 1; do { - v19 = 20 * v18; + v19 = v18; _vm->_globals.ZONEP[v19].field0 = 0; _vm->_globals.ZONEP[v19].field2 = 0; _vm->_globals.ZONEP[v19].field4 = 0; @@ -7297,7 +7296,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v31 = 0; do { - v28 = (int16)(int16)READ_LE_UINT16(v17 + 2 * v33); + v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); if (v28 != -1) { _vm->_linesManager.AJOUTE_LIGNE_ZONE( v35, -- cgit v1.2.3 From c266abd0f59500ed3a95be260b4d2a216fea5a8f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 16 Oct 2012 22:40:40 +1100 Subject: HOPKINS: Some field renaming and field fixes in AFF_SPRITES --- engines/hopkins/globals.h | 4 ++-- engines/hopkins/objects.cpp | 49 ++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 324e134c4f..1b26e2ff2c 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -84,8 +84,8 @@ struct ListeItem { struct Liste2Item { int field0; - int field2; - int field4; + int xp; + int yp; int width; int height; }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 19636839ff..39021a89e9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -606,8 +606,8 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field46 = 0; item.field0 = 0; - item.field2 = 0; - item.field4 = 0; + item.xp = 0; + item.yp = 0; item.width = 0; item.height = 0; } @@ -642,31 +642,31 @@ void ObjectsManager::DEF_BOB(int idx) { v3 = idx; _vm->_globals.Liste2[v3].field0 = 1; - _vm->_globals.Liste2[v3].field2 = v12; - _vm->_globals.Liste2[v3].field4 = v13; + _vm->_globals.Liste2[v3].xp = v12; + _vm->_globals.Liste2[v3].yp = v13; v4 = idx; - _vm->_globals.Liste2[v3].width = _vm->_globals.Bob[v4].field46; - _vm->_globals.Liste2[v3].height = _vm->_globals.Bob[v4].field48; - v5 = _vm->_globals.Liste2[v3].field2; - + _vm->_globals.Liste2[v3].width = _vm->_globals.Bob[v4].field42; + _vm->_globals.Liste2[v3].height = _vm->_globals.Bob[v4].field44; + + v5 = _vm->_globals.Liste2[v3].xp; v6 = _vm->_graphicsManager.min_x; if (v5 < _vm->_graphicsManager.min_x) { _vm->_globals.Liste2[v3].width -= _vm->_graphicsManager.min_x - v5; - _vm->_globals.Liste2[v3].field2 = v6; + _vm->_globals.Liste2[v3].xp = v6; } - v7 = _vm->_globals.Liste2[v3].field4; + v7 = _vm->_globals.Liste2[v3].yp; v8 = _vm->_graphicsManager.min_y; if (v7 < _vm->_graphicsManager.min_y) { _vm->_globals.Liste2[v3].height -= _vm->_graphicsManager.min_y - v7; - _vm->_globals.Liste2[v3].field4 = v8; + _vm->_globals.Liste2[v3].yp = v8; } - v9 = _vm->_globals.Liste2[v3].field2; + v9 = _vm->_globals.Liste2[v3].xp; if (_vm->_globals.Liste2[v3].width + v9 > _vm->_graphicsManager.max_x) _vm->_globals.Liste2[v3].width = _vm->_graphicsManager.max_x - v9; - v10 = _vm->_globals.Liste2[v3].field4; + v10 = _vm->_globals.Liste2[v3].yp; if (_vm->_globals.Liste2[v3].height + v10 > _vm->_graphicsManager.max_y) _vm->_globals.Liste2[v3].height = _vm->_graphicsManager.max_y - v10; @@ -676,10 +676,10 @@ void ObjectsManager::DEF_BOB(int idx) { v11 = idx; if (_vm->_globals.Liste2[v11].field0 == 1) _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.Liste2[v11].field2, - _vm->_globals.Liste2[v11].field4, - _vm->_globals.Liste2[v11].field2 + _vm->_globals.Liste2[v11].width, - _vm->_globals.Liste2[v11].field4 + _vm->_globals.Liste2[v11].height); + _vm->_globals.Liste2[v11].xp, + _vm->_globals.Liste2[v11].yp, + _vm->_globals.Liste2[v11].xp + _vm->_globals.Liste2[v11].width, + _vm->_globals.Liste2[v11].yp + _vm->_globals.Liste2[v11].height); } } @@ -913,7 +913,6 @@ void ObjectsManager::CALCUL_BOB(int idx) { } } - idx = idx; v13 = _vm->_globals.Bob[idx].field8 - v22; v14 = _vm->_globals.Bob[idx].fieldA - v17; _vm->_globals.Bob[idx].field3C = 1; @@ -923,8 +922,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Bob[idx].field4A = v20; _vm->_globals.Liste2[idx].field0 = 1; - _vm->_globals.Liste2[idx].field2 = v13; - _vm->_globals.Liste2[idx].field4 = v14; + _vm->_globals.Liste2[idx].xp = v13; + _vm->_globals.Liste2[idx].yp = v14; int width = Get_Largeur(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC); int height = Get_Hauteur(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC); @@ -1429,10 +1428,10 @@ LABEL_38: if (v14 != 4) { if (_vm->_globals.Liste2[v27].field0) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4, + _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp, _vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height, - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].field2, - _vm->_globals.Liste2[v27].field4); + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].xp, + _vm->_globals.Liste2[v27].yp); _vm->_globals.Liste2[v27].field0 = 0; } } @@ -1444,10 +1443,10 @@ LABEL_38: if (_vm->_globals.Bob[v22].field0 == 11) { if (_vm->_globals.Liste2[v27].field0) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4, + _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp, _vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height, _vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.Liste2[v27].field2, _vm->_globals.Liste2[v27].field4); + _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp); _vm->_globals.Liste2[v27].field0 = 0; } -- cgit v1.2.3 From 59dc49f22db1e199c7a17e4a27279863ab245787 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 17 Oct 2012 21:08:19 +1100 Subject: HOPKINS: Some corrections to incorrectly declared fields --- engines/hopkins/lines.cpp | 305 +++++++++++++++++++++----------------------- engines/hopkins/objects.cpp | 6 +- 2 files changed, 147 insertions(+), 164 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index eda1b3efd3..e189141e88 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1622,28 +1622,28 @@ LABEL_17: do { v64 = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); if (v64 == 1) { - v50 = 16 * v100; - if (*(uint16 *)&Ligne[v50 + 4] == 1) + v50 = v100; + if (Ligne[v50].field4 == 1) --NVPY; - if (*(uint16 *)&Ligne[v50 + 4] == 2) { + if (Ligne[v50].field4 == 2) { --NVPY; ++NVPX; } - if (*(uint16 *)&Ligne[v50 + 4] == 3) + if (Ligne[v50].field4 == 3) ++NVPX; - if (*(uint16 *)&Ligne[v50 + 4] == 4) { + if (Ligne[v50].field4 == 4) { ++NVPY; ++NVPX; } - if (*(uint16 *)&Ligne[v50 + 4] == 5) + if (Ligne[v50].field4 == 5) ++NVPY; - if (*(uint16 *)&Ligne[v50 + 4] == 6) { + if (Ligne[v50].field4 == 6) { ++NVPY; --NVPX; } - if (*(uint16 *)&Ligne[v50 + 4] == 7) + if (Ligne[v50].field4 == 7) --NVPX; - if (*(uint16 *)&Ligne[v50 + 4] == 8) { + if (Ligne[v50].field4 == 8) { --NVPY; --NVPX; } @@ -1668,7 +1668,6 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v10; int v11; int v12; - int v13; int v14; int v15; int v16; @@ -1780,27 +1779,11 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v123; int v124; int v125; - int v126; - int v127 = 0; - int v128 = 0; - int v129 = 0; - int v130 = 0; - int v131; - int v132; - int v133; - int v134; - int v135; - int v136; - int v137 = 0; - int v138 = 0; - int v139 = 0; - int v140 = 0; - int v141; - int v142 = 0; - int v143 = 0; - int v144 = 0; - int v145 = 0; - + int v126[10]; + int v131[10]; + int v136[10]; + int v141[10]; + v123 = a3; v122 = a4; v121 = 0; @@ -1871,16 +1854,15 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v11 <= 3) return g_PTRNUL; } - v12 = 0; -error("TODO: Fix v141/v136 - they look like arrays, not a single int"); - do { - v13 = v12; - *(&v141 + v13) = -1; - *(&v136 + v13) = 0; - *(&v131 + v13) = 1300; - *(&v126 + v13) = 1300; + + for (v12 = 0; v12 <= 8; ++v12) { + v141[v12] = -1; + v136[v12] = 0; + v131[v12] = 1300; + v126[v12] = 1300; ++v12; - } while (v12 <= 8); + } + if (PARC_PERS(a1, a2, v123, v122, -1, -1, 0) != 1) { v14 = 0; v15 = v122; @@ -1888,268 +1870,269 @@ error("TODO: Fix v141/v136 - they look like arrays, not a single int"); v16 = 5; do { v101 = v16; - v17 = colision2_ligne(v123, v15, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); + v17 = colision2_ligne(v123, v15, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v16 = v101; - if (v17 == 1 && *(&v141 + v101) <= _vm->_objectsManager.DERLIGNE) + if (v17 == 1 && v141[v101] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v101) = 0; - *(&v141 + v101) = -1; + v136[v101] = 0; + v141[v101] = -1; ++v14; ++v15; } while (_vm->_graphicsManager.max_y > v15); } - v134 = v14; + v131[3] = v14; v18 = 0; v19 = v122; if (_vm->_graphicsManager.min_y < v122) { v20 = 1; do { v102 = v20; - v21 = colision2_ligne(v123, v19, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); + v21 = colision2_ligne(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE); v20 = v102; - if (v21 == 1 && *(&v141 + v102) <= _vm->_objectsManager.DERLIGNE) + if (v21 == 1 && v141[v102] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v102) = 0; - *(&v141 + v102) = -1; - if (v134 < v18) { - if (v144 != -1) + v136[v102] = 0; + v141[v102] = -1; + if (v131[3] < v18) { + if (v141[3] != -1) break; } ++v18; --v19; } while (_vm->_graphicsManager.min_y < v19); } - v132 = v18; + v131[1] = v18; v22 = 0; v23 = v123; if (_vm->_graphicsManager.max_x > v123) { v24 = 3; do { v103 = v24; - v25 = colision2_ligne(v23, v122, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); + v25 = colision2_ligne(v23, v122, &v136[2], &v141[2], 0, _vm->_objectsManager.DERLIGNE); v24 = v103; - if (v25 == 1 && *(&v141 + v103) <= _vm->_objectsManager.DERLIGNE) + if (v25 == 1 && v141[v103] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v103) = 0; - *(&v141 + v103) = -1; + v136[v103] = 0; + v141[v103] = -1; ++v22; - if (v132 < v22) { - if (v142 != -1) + if (v131[1] < v22) { + if (v141[1] != -1) break; } - if (v134 < v22 && v144 != -1) + if (v131[3] < v22 && v141[3] != -1) break; ++v23; } while (_vm->_graphicsManager.max_x > v23); } - v133 = v22; + v131[2] = v22; v26 = 0; v27 = v123; if (_vm->_graphicsManager.min_x < v123) { v28 = 7; do { v104 = v28; - v29 = colision2_ligne(v27, v122, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); + v29 = colision2_ligne(v27, v122, &v136[4], &v141[4], 0, _vm->_objectsManager.DERLIGNE); v28 = v104; - if (v29 == 1 && *(&v141 + v104) <= _vm->_objectsManager.DERLIGNE) + if (v29 == 1 && v141[v104] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v104) = 0; - *(&v141 + v104) = -1; + v136[v104] = 0; + v141[v104] = -1; ++v26; - if (v132 < v26) { - if (v142 != -1) + if (v131[1] < v26) { + if (v141[1] != -1) break; } - if (v134 < v26 && v144 != -1) + if (v131[3] < v26 && v141[3] != -1) break; - if (v133 < v26 && v143 != -1) + if (v131[2] < v26 && v141[2] != -1) break; --v27; } while (_vm->_graphicsManager.min_x < v27); } - v135 = v26; - if (v142 < 0 || _vm->_objectsManager.DERLIGNE < v142) - v142 = -1; - if (v143 < 0 || _vm->_objectsManager.DERLIGNE < v143) - v143 = -1; - if (v144 < 0 || _vm->_objectsManager.DERLIGNE < v144) - v144 = -1; - if (v145 < 0 || _vm->_objectsManager.DERLIGNE < v145) - v145 = -1; - if (v142 < 0) - v132 = 1300; - if (v143 < 0) - v133 = 1300; - if (v144 < 0) - v134 = 1300; - if (v145 < 0) - v135 = 1300; - if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) + v131[4] = v26; + if (v141[1] < 0 || _vm->_objectsManager.DERLIGNE < v141[1]) + v141[1] = -1; + if (v141[2] < 0 || _vm->_objectsManager.DERLIGNE < v141[2]) + v141[2] = -1; + if (v141[3] < 0 || _vm->_objectsManager.DERLIGNE < v141[3]) + v141[3] = -1; + if (v141[4] < 0 || _vm->_objectsManager.DERLIGNE < v141[4]) + v141[4] = -1; + if (v141[1] < 0) + v131[1] = 1300; + if (v141[2] < 0) + v131[2] = 1300; + if (v141[3] < 0) + v131[3] = 1300; + if (v141[4] < 0) + v131[4] = 1300; + if (v141[1] == -1 && v141[2] == -1 && v141[3] == -1 && v141[4] == -1) return g_PTRNUL; v31 = 0; - if (v144 != -1 && v132 >= v134 && v133 >= v134 && v135 >= v134) { - v121 = v144; - v120 = v139; + if (v141[3] != -1 && v131[1] >= v131[3] && v131[2] >= v131[3] && v131[4] >= v131[3]) { + v121 = v141[3]; + v120 = v136[3]; v31 = 1; } - if (v142 != -1 && !v31 && v134 >= v132 && v133 >= v132 && v135 >= v132) { - v121 = v142; - v120 = v137; + if (v141[1] != -1 && !v31 && v131[3] >= v131[1] && v131[2] >= v131[1] && v131[4] >= v131[1]) { + v121 = v141[1]; + v120 = v136[1]; v31 = 1; } - if (v143 != -1 && !v31 && v132 >= v133 && v134 >= v133 && v135 >= v133) { - v121 = v143; - v120 = v138; + if (v141[2] != -1 && !v31 && v131[1] >= v131[2] && v131[3] >= v131[2] && v131[4] >= v131[2]) { + v121 = v141[2]; + v120 = v136[2]; v31 = 1; } - if (v145 != -1 && !v31 && v134 >= v135 && v133 >= v135 && v132 >= v135) { - v121 = v145; - v120 = v140; + if (v141[4] != -1 && !v31 && v131[3] >= v131[4] && v131[2] >= v131[4] && v131[1] >= v131[4]) { + v121 = v141[4]; + v120 = v136[4]; } v32 = 0; do { v33 = v32; - *(&v141 + v33) = -1; - *(&v136 + v33) = 0; - *(&v131 + v33) = 1300; - *(&v126 + v33) = 1300; + v141[v33] = -1; + v136[v33] = 0; + v131[v33] = 1300; + v126[v33] = 1300; ++v32; } while (v32 <= 8); + v34 = 0; v35 = a2; if (_vm->_graphicsManager.max_y > a2) { v36 = 5; do { v105 = v36; - v37 = colision2_ligne(a1, v35, &v139, &v144, 0, _vm->_objectsManager.DERLIGNE); + v37 = colision2_ligne(a1, v35, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v36 = v105; - if (v37 == 1 && *(&v141 + v105) <= _vm->_objectsManager.DERLIGNE) + if (v37 == 1 && v141[v105] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v105) = 0; - *(&v141 + v105) = -1; + v136[v105] = 0; + v141[v105] = -1; ++v34; ++v35; } while (_vm->_graphicsManager.max_y > v35); } - v134 = v34 + 1; + v131[3] = v34 + 1; v38 = 0; v39 = a2; if (_vm->_graphicsManager.min_y < a2) { v40 = 1; do { v106 = v40; - v41 = colision2_ligne(a1, v39, &v137, &v142, 0, _vm->_objectsManager.DERLIGNE); + v41 = colision2_ligne(a1, v39, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE); v40 = v106; - if (v41 == 1 && *(&v141 + v106) <= _vm->_objectsManager.DERLIGNE) + if (v41 == 1 && v141[v106] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v106) = 0; - *(&v141 + v106) = -1; + v136[v106] = 0; + v141[v106] = -1; ++v38; - if (v144 != -1) { + if (v141[3] != -1) { if (v38 > 80) break; } --v39; } while (_vm->_graphicsManager.min_y < v39); } - v132 = v38 + 1; + v131[1] = v38 + 1; v42 = 0; v43 = a1; if (_vm->_graphicsManager.max_x > a1) { v44 = 3; do { v107 = v44; - v45 = colision2_ligne(v43, a2, &v138, &v143, 0, _vm->_objectsManager.DERLIGNE); + v45 = colision2_ligne(v43, a2, &v136[2], &v141[2], 0, _vm->_objectsManager.DERLIGNE); v44 = v107; - if (v45 == 1 && *(&v141 + v107) <= _vm->_objectsManager.DERLIGNE) + if (v45 == 1 && v141[v107] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v107) = 0; - *(&v141 + v107) = -1; + v136[v107] = 0; + v141[v107] = -1; ++v42; - if (v144 != -1 || v142 != -1) { + if (v141[3] != -1 || v141[1] != -1) { if (v42 > 100) break; } ++v43; } while (_vm->_graphicsManager.max_x > v43); } - v133 = v42 + 1; + v131[2] = v42 + 1; v46 = 0; v47 = a1; if (_vm->_graphicsManager.min_x < a1) { v48 = 7; do { v108 = v48; - v49 = colision2_ligne(v47, a2, &v140, &v145, 0, _vm->_objectsManager.DERLIGNE); + v49 = colision2_ligne(v47, a2, &v136[4], &v141[4], 0, _vm->_objectsManager.DERLIGNE); v48 = v108; - if (v49 == 1 && *(&v141 + v108) <= _vm->_objectsManager.DERLIGNE) + if (v49 == 1 && v141[v108] <= _vm->_objectsManager.DERLIGNE) break; - *(&v136 + v108) = 0; - *(&v141 + v108) = -1; + v136[v108] = 0; + v141[v108] = -1; ++v46; - if (v144 != -1 || v142 != -1 || v143 != -1) { + if (v141[3] != -1 || v141[1] != -1 || v141[2] != -1) { if (v46 > 100) break; } --v47; } while (_vm->_graphicsManager.min_x < v47); } - v135 = v46 + 1; - if (v142 != -1) { - v50 = v142 - v121; + v131[4] = v46 + 1; + if (v141[1] != -1) { + v50 = v141[1] - v121; if (v50 < 0) v50 = -v50; - v127 = v50; + v126[1] = v50; } - if (v143 != -1) { - v51 = v143 - v121; + if (v141[2] != -1) { + v51 = v141[2] - v121; if (v51 < 0) v51 = -v51; - v128 = v51; + v126[2] = v51; } - if (v144 != -1) { - v52 = v144 - v121; + if (v141[3] != -1) { + v52 = v141[3] - v121; if (v52 < 0) v52 = -v52; - v129 = v52; + v126[3] = v52; } - if (v145 != -1) { - v53 = v145 - v121; + if (v141[4] != -1) { + v53 = v141[4] - v121; if (v53 < 0) v53 = -v53; - v130 = v53; + v126[4] = v53; } - if (v142 == -1 && v143 == -1 && v144 == -1 && v145 == -1) + if (v141[1] == -1 && v141[2] == -1 && v141[3] == -1 && v141[4] == -1) error("ERREUR POINT PLUS PROCHE Du perso NON TROUVE"); v54 = 0; - if (v142 != -1 && v128 >= v127 && v129 >= v127 && v130 >= v127) { + if (v141[1] != -1 && v126[2] >= v126[1] && v126[3] >= v126[1] && v126[4] >= v126[1]) { v54 = 1; - v115 = v142; - v111 = v132; + v115 = v141[1]; + v111 = v131[1]; v113 = 1; - v114 = v137; + v114 = v136[1]; } if (!v54) { - if (v144 != -1 && v128 >= v129 && v127 >= v129 && v130 >= v129) { + if (v141[3] != -1 && v126[2] >= v126[3] && v126[1] >= v126[3] && v126[4] >= v126[3]) { v54 = 1; - v115 = v144; - v111 = v134; + v115 = v141[3]; + v111 = v131[3]; v113 = 5; - v114 = v139; + v114 = v136[3]; } if (!v54) { - if (v143 != -1 && v127 >= v128 && v129 >= v128 && v130 >= v128) { + if (v141[2] != -1 && v126[1] >= v126[2] && v126[3] >= v126[2] && v126[4] >= v126[2]) { v54 = 1; - v115 = v143; - v111 = v133; + v115 = v141[2]; + v111 = v131[2]; v113 = 3; - v114 = v138; + v114 = v136[2]; } - if (!v54 && v145 != -1 && v127 >= v130 && v129 >= v130 && v128 >= v130) { - v115 = v145; - v111 = v135; + if (!v54 && v141[4] != -1 && v126[1] >= v126[4] && v126[3] >= v126[4] && v126[2] >= v126[4]) { + v115 = v141[4]; + v111 = v131[4]; v113 = 7; - v114 = v140; + v114 = v136[4]; } } } @@ -2325,7 +2308,7 @@ LABEL_200: if (v115 > v121) { v80 = v114; if (v114 > 0) { - v98 = 16 * v115; + v98 = v115; do { v81 = Ligne[v98].fieldC; v119 = (int16)READ_LE_UINT16(v81 + 4 * v80); @@ -2344,7 +2327,7 @@ LABEL_200: do { v83 = Ligne[v117].field0 - 1; if (v83 > -1) { - v109 = 16 * v117; + v109 = v117; do { v84 = Ligne[v109].fieldC; v119 = (int16)READ_LE_UINT16(v84 + 4 * v83); @@ -2390,7 +2373,7 @@ LABEL_200: if (v114 <= v120) { if (v114 < v120) { v94 = v114; - v100 = 16 * v121; + v100 = v121; do { v95 = Ligne[v100].fieldC;; v96 = (int16)READ_LE_UINT16(v95 + 4 * v94 + 2); @@ -2405,7 +2388,7 @@ LABEL_200: } } else { v90 = v114; - v99 = 16 * v121; + v99 = v121; do { v91 = Ligne[v99].fieldC; v92 = (int16)READ_LE_UINT16(v91 + 4 * v90 + 2); @@ -3773,7 +3756,7 @@ LABEL_60: if (v33 == 2) { v19 = Ligne[v34].field0 - 1; if (v19 > -1) { - v31 = 16 * v34; + v31 = v34; v26 = _vm->_globals.essai0; do { v20 = Ligne[v31].fieldC; @@ -3861,7 +3844,7 @@ LABEL_12: v15 = Ligne[v10].field6; if (v15 == 5 || v15 == 1) v14 += 2; - v16 = 16 * v24; + v16 = v24; if (Ligne[v16].field6 == 3 || Ligne[v16].field8 == 7) v13 += 2; if (!colision2_ligne(v13, v14, &v28, &v27, 0, _vm->_objectsManager.DERLIGNE)) @@ -3876,7 +3859,7 @@ LABEL_12: v20 = Ligne[v24].field6; if (v20 == 5 || v20 == 1) v19 -= 2; - v21 = 16 * v24; + v21 = v24; if (Ligne[v21].field6 == 3 || Ligne[v21].field8 == 7) v18 -= 2; if (!colision2_ligne(v18, v19, &v28, &v27, 0, _vm->_objectsManager.DERLIGNE)) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 39021a89e9..63238844c6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -703,7 +703,7 @@ void ObjectsManager::BOB_VISU(int idx) { v7 = (int16)READ_LE_UINT16(data + 6); v6 = (int16)READ_LE_UINT16(data + 8); if ((int16)READ_LE_UINT16(data)) { - if (_vm->_globals.Bank[idx].field4) { + if (_vm->_globals.Bank[v1].field4) { if (!v9) v9 = 1; if (!v6) @@ -712,7 +712,7 @@ void ObjectsManager::BOB_VISU(int idx) { if ((int16)READ_LE_UINT16(data + 24)) { _vm->_globals.Bob[idx].field3A = 0; - if (_vm->_globals.Bank[idx].fileHeader == 1) { + if (_vm->_globals.Bank[v1].fileHeader == 1) { _vm->_globals.Bob[idx].field3A = 1; _vm->_globals.Bob[idx].field36 = 0; _vm->_globals.Bob[idx].field38 = 0; @@ -720,7 +720,7 @@ void ObjectsManager::BOB_VISU(int idx) { _vm->_globals.Bob[idx].field18 = _vm->_globals.Bqe_Anim[idx].data; _vm->_globals.Bob[idx].field0 = 10; - _vm->_globals.Bob[idx].field4 = _vm->_globals.Bank[idx].data; + _vm->_globals.Bob[idx].field4 = _vm->_globals.Bank[v1].data; _vm->_globals.Bob[idx].field1E = v9; _vm->_globals.Bob[idx].field20 = v6; -- cgit v1.2.3 From 3f9172c7ecaf69665009b9239708c339b11d9c92 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 17 Oct 2012 08:00:37 +0200 Subject: HOPKINS: Add detection for OS/2 and Win95 full versions --- common/platform.cpp | 1 + common/platform.h | 1 + engines/hopkins/detection_tables.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/common/platform.cpp b/common/platform.cpp index 9986048b48..d34803d15e 100644 --- a/common/platform.cpp +++ b/common/platform.cpp @@ -50,6 +50,7 @@ const PlatformDescription g_platforms[] = { { "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX }, { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi }, { "ios", "ios", "ios", "Apple iOS", kPlatformIOS }, + { "os2", "os2", "os2", "OS/2", kPlatformOS2 }, { 0, 0, 0, "Default", kPlatformUnknown } }; diff --git a/common/platform.h b/common/platform.h index 1891c7096d..9595083207 100644 --- a/common/platform.h +++ b/common/platform.h @@ -55,6 +55,7 @@ enum Platform { kPlatformPSX, kPlatformCDi, kPlatformIOS, + kPlatformOS2, kPlatformUnknown = -1 }; diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 38548e1eda..0781a530e8 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -55,6 +55,36 @@ static const HopkinsGameDescription gameDescriptions[] = { }, }, + { + // Hopkins FBI OS/2, provided by Strangerke + { + "hopkins", + 0, + { + {"Hopkins.exe", 0, "63d45f882278e5a9fa1027066223e5d9", 292864}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformOS2, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { + // Hopkins FBI Win95, provided by Strangerke + { + "hopkins", + 0, + { + {"Hopkins.exe", 0, "277a5c144bf9ec7d8450ae37afb85090", 419281}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From 66329a6b4acaccbad85b801d7af8395011475b93 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 19 Oct 2012 07:15:17 +1100 Subject: HOPKINS: Cleaned up initialisation of Hopkins array. --- engines/hopkins/globals.cpp | 406 ++++---------------------------------------- engines/hopkins/globals.h | 1 - 2 files changed, 36 insertions(+), 371 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 30f25ce222..b7e13011c0 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -30,8 +30,36 @@ namespace Hopkins { +// Global null pointer. This is needed by the engine to recognise NULL pointers, since +// there are places that differentiate between it and a 0 'error' value byte *g_PTRNUL; +// Default data for the Hopkins array + +const int HOPKINS_PERSO_0[] = { + 0, -2, 0, -3, 0, -6, 0, -1, 0, -3, 0, -3, 0, -5, 0, -3, 0, -6, 0, -3, 0, -3, 0, -3, + 9, -4, 8, -4, 6, -2, 9, -2, 9, -3, 9, -3, 9, -4, 9, -2, 9, -2, 8, -2, 9, -3, 9, -2, + 13, 0, 13, 0, 13, 0, 13, 0, 14, 0, 13, 0, 13, 0, 12, 0, 12, 0, 14, 0, 13, 0, 14, 0, + 10, 3, 9, 3, 10, 4, 8, 2, 7, 1, 10, 2, 9, 2, 7, 4, 7, 3, 8, 0, 9, 1, 9, 1, 0, 4, 0, + 4, 0, 6, 0, 3, 0, 4, 0, 3, 0, 4, 0, 4, 0, 6, 0, 3, 0, 3, 0, 3 +}; + +const int HOPKINS_PERSO_1[] = { + 0, -2, 0, -2, 0, -5, 0, -1, 0, -2, 0, -2, 0, -4, 0, -2, 0, -5, 0, -2, 0, -2, 0, -2, + 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, + 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, + 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, + 0, 3, 0, 3, 0, 5, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 5, 0, 3, 0, 3, 0, 3 +}; + +const int HOPKINS_PERSO_2[] = { + 0, -2, 0, 0, 0, -3, 0, -2, 0, -2, 0, -1, 0, -2, 0, -1, 0, -3, 0, -2, 0, -2, 0, -2, + 8, 0, 9, 0, 5, 0, 9, 0, 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 8, 0, 9, 0, + 5, 0, 9, 0, 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 8, 0, 9, 0, 5, 0, 9, 0, + 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 2, + 0, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 2 +}; + Globals::Globals() { // Set up the special g_PTRNUL variable g_PTRNUL = (byte *)malloc(16); @@ -360,376 +388,14 @@ void Globals::clearAll() { } void Globals::HOPKINS_DATA() { - // TODO: Replace all the '/ 2' with constant values - switch (PERSO_TYPE) { - case 0: - HopkinsArr[0 / 2] = 0; - HopkinsArr[2 / 2] = -2; - HopkinsArr[4 / 2] = 0; - HopkinsArr[6 / 2] = -3; - HopkinsArr[8 / 2] = 0; - HopkinsArr[10 / 2] = -6; - HopkinsArr[12 / 2] = 0; - HopkinsArr[14 / 2] = -1; - HopkinsArr[16 / 2] = 0; - HopkinsArr[18 / 2] = -3; - HopkinsArr[20 / 2] = 0; - HopkinsArr[22 / 2] = -3; - HopkinsArr[24 / 2] = 0; - HopkinsArr[26 / 2] = -5; - HopkinsArr[28 / 2] = 0; - HopkinsArr[30 / 2] = -3; - HopkinsArr[32 / 2] = 0; - HopkinsArr[34 / 2] = -6; - HopkinsArr[36 / 2] = 0; - HopkinsArr[38 / 2] = -3; - HopkinsArr[40 / 2] = 0; - HopkinsArr[42 / 2] = -3; - HopkinsArr[44 / 2] = 0; - HopkinsArr[46 / 2] = -3; - HopkinsArr[48 / 2] = 9; - HopkinsArr[50 / 2] = -4; - HopkinsArr[52 / 2] = 8; - HopkinsArr[54 / 2] = -4; - HopkinsArr[56 / 2] = 6; - HopkinsArr[58 / 2] = -2; - HopkinsArr[60 / 2] = 9; - HopkinsArr[62 / 2] = -2; - HopkinsArr[64 / 2] = 9; - HopkinsArr[66 / 2] = -3; - HopkinsArr[68 / 2] = 9; - HopkinsArr[70 / 2] = -3; - HopkinsArr[72 / 2] = 9; - HopkinsArr[74 / 2] = -4; - HopkinsArr[76 / 2] = 9; - HopkinsArr[78 / 2] = -2; - HopkinsArr[80 / 2] = 9; - HopkinsArr[82 / 2] = -2; - HopkinsArr[84 / 2] = 8; - HopkinsArr[86 / 2] = -2; - HopkinsArr[88 / 2] = 9; - HopkinsArr[90 / 2] = -3; - HopkinsArr[92 / 2] = 9; - HopkinsArr[94 / 2] = -2; - HopkinsArr[96 / 2] = 13; - HopkinsArr[98 / 2] = 0; - HopkinsArr[100 / 2] = 13; - HopkinsArr[102 / 2] = 0; - HopkinsArr[104 / 2] = 13; - HopkinsArr[106 / 2] = 0; - HopkinsArr[108 / 2] = 13; - HopkinsArr[110 / 2] = 0; - HopkinsArr[112 / 2] = 14; - HopkinsArr[114 / 2] = 0; - HopkinsArr[116 / 2] = 13; - HopkinsArr[118 / 2] = 0; - HopkinsArr[120 / 2] = 13; - HopkinsArr[122 / 2] = 0; - HopkinsArr[124 / 2] = 12; - HopkinsArr[126 / 2] = 0; - HopkinsArr[128 / 2] = 12; - HopkinsArr[130 / 2] = 0; - HopkinsArr[132 / 2] = 14; - HopkinsArr[134 / 2] = 0; - HopkinsArr[136 / 2] = 13; - HopkinsArr[138 / 2] = 0; - HopkinsArr[140 / 2] = 14; - HopkinsArr[142 / 2] = 0; - HopkinsArr[144 / 2] = 10; - HopkinsArr[146 / 2] = 3; - HopkinsArr[148 / 2] = 9; - HopkinsArr[150 / 2] = 3; - HopkinsArr[152 / 2] = 10; - HopkinsArr[154 / 2] = 4; - HopkinsArr[156 / 2] = 8; - HopkinsArr[158 / 2] = 2; - HopkinsArr[160 / 2] = 7; - HopkinsArr[162 / 2] = 1; - HopkinsArr[164 / 2] = 10; - HopkinsArr[166 / 2] = 2; - HopkinsArr[168 / 2] = 9; - HopkinsArr[170 / 2] = 2; - HopkinsArr[172 / 2] = 7; - HopkinsArr[174 / 2] = 4; - HopkinsArr[176 / 2] = 7; - HopkinsArr[178 / 2] = 3; - HopkinsArr[180 / 2] = 8; - HopkinsArr[182 / 2] = 0; - HopkinsArr[184 / 2] = 9; - HopkinsArr[186 / 2] = 1; - HopkinsArr[188 / 2] = 9; - HopkinsArr[190 / 2] = 1; - HopkinsArr[192 / 2] = 0; - HopkinsArr[194 / 2] = 4; - HopkinsArr[196 / 2] = 0; - HopkinsArr[198 / 2] = 4; - HopkinsArr[200 / 2] = 0; - HopkinsArr[202 / 2] = 6; - HopkinsArr[204 / 2] = 0; - HopkinsArr[206 / 2] = 3; - HopkinsArr[208 / 2] = 0; - HopkinsArr[210 / 2] = 4; - HopkinsArr[212 / 2] = 0; - HopkinsArr[214 / 2] = 3; - HopkinsArr[216 / 2] = 0; - HopkinsArr[218 / 2] = 4; - HopkinsArr[220 / 2] = 0; - HopkinsArr[222 / 2] = 4; - HopkinsArr[224 / 2] = 0; - HopkinsArr[226 / 2] = 6; - HopkinsArr[228 / 2] = 0; - HopkinsArr[230 / 2] = 3; - HopkinsArr[232 / 2] = 0; - HopkinsArr[234 / 2] = 3; - HopkinsArr[236 / 2] = 0; - HopkinsArr[238 / 2] = 3; - break; - case 1: - HopkinsArr[0] = 0; - HopkinsArr[2 / 2] = -2; - HopkinsArr[4 / 2] = 0; - HopkinsArr[6 / 2] = -2; - HopkinsArr[8 / 2] = 0; - HopkinsArr[10 / 2] = -5; - HopkinsArr[12 / 2] = 0; - HopkinsArr[14 / 2] = -1; - HopkinsArr[16 / 2] = 0; - HopkinsArr[18 / 2] = -2; - HopkinsArr[20 / 2] = 0; - HopkinsArr[22 / 2] = -2; - HopkinsArr[24 / 2] = 0; - HopkinsArr[26 / 2] = -4; - HopkinsArr[28 / 2] = 0; - HopkinsArr[30 / 2] = -2; - HopkinsArr[32 / 2] = 0; - HopkinsArr[34 / 2] = -5; - HopkinsArr[36 / 2] = 0; - HopkinsArr[38 / 2] = -2; - HopkinsArr[40 / 2] = 0; - HopkinsArr[42 / 2] = -2; - HopkinsArr[44 / 2] = 0; - HopkinsArr[46 / 2] = -2; - HopkinsArr[48 / 2] = 11; - HopkinsArr[50 / 2] = 0; - HopkinsArr[52 / 2] = 10; - HopkinsArr[54 / 2] = 0; - HopkinsArr[56 / 2] = 11; - HopkinsArr[58 / 2] = 0; - HopkinsArr[60 / 2] = 11; - HopkinsArr[62 / 2] = 0; - HopkinsArr[64 / 2] = 11; - HopkinsArr[66 / 2] = 0; - HopkinsArr[68 / 2] = 11; - HopkinsArr[70 / 2] = 0; - HopkinsArr[72 / 2] = 12; - HopkinsArr[74 / 2] = 0; - HopkinsArr[76 / 2] = 11; - HopkinsArr[78 / 2] = 0; - HopkinsArr[80 / 2] = 9; - HopkinsArr[82 / 2] = 0; - HopkinsArr[84 / 2] = 10; - HopkinsArr[86 / 2] = 0; - HopkinsArr[88 / 2] = 11; - HopkinsArr[90 / 2] = 0; - HopkinsArr[92 / 2] = 11; - HopkinsArr[94 / 2] = 0; - HopkinsArr[96 / 2] = 11; - HopkinsArr[98 / 2] = 0; - HopkinsArr[100 / 2] = 10; - HopkinsArr[102 / 2] = 0; - HopkinsArr[104 / 2] = 11; - HopkinsArr[106 / 2] = 0; - HopkinsArr[108 / 2] = 11; - HopkinsArr[110 / 2] = 0; - HopkinsArr[112 / 2] = 11; - HopkinsArr[114 / 2] = 0; - HopkinsArr[116 / 2] = 11; - HopkinsArr[118 / 2] = 0; - HopkinsArr[120 / 2] = 12; - HopkinsArr[122 / 2] = 0; - HopkinsArr[124 / 2] = 11; - HopkinsArr[126 / 2] = 0; - HopkinsArr[128 / 2] = 9; - HopkinsArr[130 / 2] = 0; - HopkinsArr[132 / 2] = 10; - HopkinsArr[134 / 2] = 0; - HopkinsArr[136 / 2] = 11; - HopkinsArr[138 / 2] = 0; - HopkinsArr[140 / 2] = 11; - HopkinsArr[142 / 2] = 0; - HopkinsArr[144 / 2] = 11; - HopkinsArr[146 / 2] = 0; - HopkinsArr[148 / 2] = 10; - HopkinsArr[150 / 2] = 0; - HopkinsArr[152 / 2] = 11; - HopkinsArr[154 / 2] = 0; - HopkinsArr[156 / 2] = 11; - HopkinsArr[158 / 2] = 0; - HopkinsArr[160 / 2] = 11; - HopkinsArr[162 / 2] = 0; - HopkinsArr[164 / 2] = 11; - HopkinsArr[166 / 2] = 0; - HopkinsArr[168 / 2] = 12; - HopkinsArr[170 / 2] = 0; - HopkinsArr[172 / 2] = 11; - HopkinsArr[174 / 2] = 0; - HopkinsArr[176 / 2] = 9; - HopkinsArr[178 / 2] = 0; - HopkinsArr[180 / 2] = 10; - HopkinsArr[182 / 2] = 0; - HopkinsArr[184 / 2] = 11; - HopkinsArr[186 / 2] = 0; - HopkinsArr[188 / 2] = 11; - HopkinsArr[190 / 2] = 0; - HopkinsArr[192 / 2] = 0; - HopkinsArr[194 / 2] = 3; - HopkinsArr[196 / 2] = 0; - HopkinsArr[198 / 2] = 3; - HopkinsArr[200 / 2] = 0; - HopkinsArr[202 / 2] = 5; - HopkinsArr[204 / 2] = 0; - HopkinsArr[206 / 2] = 3; - HopkinsArr[208 / 2] = 0; - HopkinsArr[210 / 2] = 3; - HopkinsArr[212 / 2] = 0; - HopkinsArr[214 / 2] = 3; - HopkinsArr[216 / 2] = 0; - HopkinsArr[218 / 2] = 3; - HopkinsArr[220 / 2] = 0; - HopkinsArr[222 / 2] = 3; - HopkinsArr[224 / 2] = 0; - HopkinsArr[226 / 2] = 5; - HopkinsArr[228 / 2] = 0; - HopkinsArr[230 / 2] = 3; - HopkinsArr[232 / 2] = 0; - HopkinsArr[234 / 2] = 3; - HopkinsArr[236 / 2] = 0; - HopkinsArr[238 / 2] = 3; - break; - case 2: - HopkinsArr[0] = 0; - HopkinsArr[2 / 2] = -2; - HopkinsArr[4 / 2] = 0; - HopkinsArr[6 / 2] = 0; - HopkinsArr[8 / 2] = 0; - HopkinsArr[10 / 2] = -3; - HopkinsArr[12 / 2] = 0; - HopkinsArr[14 / 2] = -2; - HopkinsArr[16 / 2] = 0; - HopkinsArr[18 / 2] = -2; - HopkinsArr[20 / 2] = 0; - HopkinsArr[22 / 2] = -1; - HopkinsArr[24 / 2] = 0; - HopkinsArr[26 / 2] = -2; - HopkinsArr[28 / 2] = 0; - HopkinsArr[30 / 2] = -1; - HopkinsArr[32 / 2] = 0; - HopkinsArr[34 / 2] = -3; - HopkinsArr[36 / 2] = 0; - HopkinsArr[38 / 2] = -2; - HopkinsArr[40 / 2] = 0; - HopkinsArr[42 / 2] = -2; - HopkinsArr[44 / 2] = 0; - HopkinsArr[46 / 2] = -2; - HopkinsArr[48 / 2] = 8; - HopkinsArr[50 / 2] = 0; - HopkinsArr[52 / 2] = 9; - HopkinsArr[54 / 2] = 0; - HopkinsArr[56 / 2] = 5; - HopkinsArr[58 / 2] = 0; - HopkinsArr[60 / 2] = 9; - HopkinsArr[62 / 2] = 0; - HopkinsArr[64 / 2] = 7; - HopkinsArr[66 / 2] = 0; - HopkinsArr[68 / 2] = 7; - HopkinsArr[70 / 2] = 0; - HopkinsArr[72 / 2] = 7; - HopkinsArr[74 / 2] = 0; - HopkinsArr[76 / 2] = 7; - HopkinsArr[78 / 2] = 0; - HopkinsArr[80 / 2] = 6; - HopkinsArr[82 / 2] = 0; - HopkinsArr[84 / 2] = 7; - HopkinsArr[86 / 2] = 0; - HopkinsArr[88 / 2] = 6; - HopkinsArr[90 / 2] = 0; - HopkinsArr[92 / 2] = 9; - HopkinsArr[94 / 2] = 0; - HopkinsArr[96 / 2] = 8; - HopkinsArr[98 / 2] = 0; - HopkinsArr[100 / 2] = 9; - HopkinsArr[102 / 2] = 0; - HopkinsArr[104 / 2] = 5; - HopkinsArr[106 / 2] = 0; - HopkinsArr[108 / 2] = 9; - HopkinsArr[110 / 2] = 0; - HopkinsArr[112 / 2] = 7; - HopkinsArr[114 / 2] = 0; - HopkinsArr[116 / 2] = 7; - HopkinsArr[118 / 2] = 0; - HopkinsArr[120 / 2] = 7; - HopkinsArr[122 / 2] = 0; - HopkinsArr[124 / 2] = 7; - HopkinsArr[126 / 2] = 0; - HopkinsArr[128 / 2] = 6; - HopkinsArr[130 / 2] = 0; - HopkinsArr[132 / 2] = 7; - HopkinsArr[134 / 2] = 0; - HopkinsArr[136 / 2] = 6; - HopkinsArr[138 / 2] = 0; - HopkinsArr[140 / 2] = 9; - HopkinsArr[142 / 2] = 0; - HopkinsArr[144 / 2] = 8; - HopkinsArr[146 / 2] = 0; - HopkinsArr[148 / 2] = 9; - HopkinsArr[150 / 2] = 0; - HopkinsArr[152 / 2] = 5; - HopkinsArr[154 / 2] = 0; - HopkinsArr[156 / 2] = 9; - HopkinsArr[158 / 2] = 0; - HopkinsArr[160 / 2] = 7; - HopkinsArr[162 / 2] = 0; - HopkinsArr[164 / 2] = 7; - HopkinsArr[166 / 2] = 0; - HopkinsArr[168 / 2] = 7; - HopkinsArr[170 / 2] = 0; - HopkinsArr[172 / 2] = 7; - HopkinsArr[174 / 2] = 0; - HopkinsArr[176 / 2] = 6; - HopkinsArr[178 / 2] = 0; - HopkinsArr[180 / 2] = 7; - HopkinsArr[182 / 2] = 0; - HopkinsArr[184 / 2] = 6; - HopkinsArr[186 / 2] = 0; - HopkinsArr[188 / 2] = 9; - HopkinsArr[190 / 2] = 0; - HopkinsArr[192 / 2] = 0; - HopkinsArr[194 / 2] = 2; - HopkinsArr[196 / 2] = 0; - HopkinsArr[198 / 2] = 0; - HopkinsArr[200 / 2] = 0; - HopkinsArr[202 / 2] = 2; - HopkinsArr[204 / 2] = 0; - HopkinsArr[206 / 2] = 1; - HopkinsArr[208 / 2] = 0; - HopkinsArr[210 / 2] = 2; - HopkinsArr[212 / 2] = 0; - HopkinsArr[214 / 2] = 2; - HopkinsArr[216 / 2] = 0; - HopkinsArr[218 / 2] = 2; - HopkinsArr[220 / 2] = 0; - HopkinsArr[222 / 2] = 2; - HopkinsArr[224 / 2] = 0; - HopkinsArr[226 / 2] = 2; - HopkinsArr[228 / 2] = 0; - HopkinsArr[230 / 2] = 1; - HopkinsArr[232 / 2] = 0; - HopkinsArr[234 / 2] = 2; - HopkinsArr[236 / 2] = 0; - HopkinsArr[238 / 2] = 2; - break; - default: - break; + assert(PERSO_TYPE >= 0 && PERSO_TYPE <= 2); + + const int *srcList[] = { HOPKINS_PERSO_0, HOPKINS_PERSO_1, HOPKINS_PERSO_2 }; + const int *srcP = srcList[PERSO_TYPE]; + + for (int idx = 0; idx < 240 / 4; ++idx) { + Hopkins[idx].field0 = *srcP++; + Hopkins[idx].field2 = *srcP++; } g_old_anim = -1; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 1b26e2ff2c..fad08c9e0f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -342,7 +342,6 @@ public: int g_old_anim; int g_old_sens, g_old_sens2; int last_sens; - int HopkinsArr[140]; byte *police; int police_l; int police_h; -- cgit v1.2.3 From ffe4f9cef515ab6ebc96182767aff920e20e0694 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 19 Oct 2012 22:19:50 +1100 Subject: HOPKINS: Converted essai buffers to int16 arrays --- engines/hopkins/globals.cpp | 12 +- engines/hopkins/globals.h | 6 +- engines/hopkins/lines.cpp | 344 +++++++++++++++++++++++--------------------- engines/hopkins/lines.h | 6 +- engines/hopkins/objects.cpp | 26 ++-- 5 files changed, 203 insertions(+), 191 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index b7e13011c0..8253593e99 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -338,9 +338,9 @@ void Globals::clearAll() { ZONEP[idx].field4 = 0; } - essai0 = g_PTRNUL; - essai1 = g_PTRNUL; - essai2 = g_PTRNUL; + essai0 = (int16 *)g_PTRNUL; + essai1 = (int16 *)g_PTRNUL; + essai2 = (int16 *)g_PTRNUL; BufLig = g_PTRNUL; chemin = g_PTRNUL; @@ -368,9 +368,9 @@ void Globals::clearAll() { SAUVEGARDE = (Sauvegarde *)malloc(sizeof(Sauvegarde)); memset(SAUVEGARDE, 0, sizeof(Sauvegarde)); - essai0 = BUFFERTAPE; - essai1 = BUFFERTAPE + 25000; - essai2 = BUFFERTAPE + 50000; + essai0 = (int16 *)BUFFERTAPE; + essai1 = (int16 *)(BUFFERTAPE + 25000); + essai2 = (int16 *)(BUFFERTAPE + 50000); BufLig = (BUFFERTAPE + 75000); largeur_boite = 240; TEXTE_FORMATE = 300; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index fad08c9e0f..a3b9347de5 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -355,9 +355,9 @@ public: byte *SPRITE_ECRAN; Sauvegarde *SAUVEGARDE; byte *BUFFERTAPE; - byte *essai0; - byte *essai1; - byte *essai2; + int16 *essai0; + int16 *essai1; + int16 *essai2; byte *Bufferobjet; int INVENTAIRE[36]; TriItem Tri[51]; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index e189141e88..8fbee5c32f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -640,7 +640,7 @@ void LinesManager::INIPARCOURS() { } while (v8 != 400); } -int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7) { +int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7) { int v7; int v8; int i; @@ -681,9 +681,9 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v11 = (int16)READ_LE_UINT16(v10 + 4 * i); v50 = (int16)READ_LE_UINT16(v10 + 4 * i + 2); v12 = v8; - WRITE_LE_UINT16(a6 + 2 * v12, v11); - WRITE_LE_UINT16(a6 + 2 * v12 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v12 + 4, Ligne[a1].field6); + a6[v12] = v11; + a6[v12 + 1] = v50; + a6[v12 + 2] = Ligne[a1].field6; v8 += a7; } v34 = a1 + 1; @@ -696,9 +696,10 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v15 = (int16)READ_LE_UINT16(v14 + 4 * v13); v50 = (int16)READ_LE_UINT16(v14 + 4 * v13 + 2); v16 = v8; - WRITE_LE_UINT16(a6 + 2 * v16, v15); - WRITE_LE_UINT16(a6 + 2 * v16 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v16 + 4, Ligne[v34].field6); + + a6[v16] = v15; + a6[v16 + 1] = v50; + a6[v16 + 2] = Ligne[v34].field6; v8 += a7; ++v13; } while (Ligne[v34].field0 > v13); @@ -715,9 +716,9 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v19 = (int16)READ_LE_UINT16(v18 + 4 * j); v50 = (int16)READ_LE_UINT16(v18 + 4 * j + 2); v20 = v8; - WRITE_LE_UINT16(a6 + 2 * v20, v19); - WRITE_LE_UINT16(a6 + 2 * v20 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v20 + 4, Ligne[v36].field8); + a6[v20] = v19; + a6[v20 + 1] = v50; + a6[v20 + 2] = Ligne[v36].field8; v8 += a7; } v35 = v36 - 1; @@ -728,9 +729,9 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v23 = (int16)READ_LE_UINT16(v22 + 4 * k); v50 = (int16)READ_LE_UINT16(v22 + 4 * k + 2); v24 = v8; - WRITE_LE_UINT16(a6 + 2 * v24, v23); - WRITE_LE_UINT16(a6 + 2 * v24 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v24 + 4, Ligne[v35].field8); + a6[v24] = v23; + a6[v24 + 1] = v50; + a6[v24 + 2] = Ligne[v35].field8; v8 += a7; } --v35; @@ -748,9 +749,9 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v31 = (int16)READ_LE_UINT16(v30 + 4 * v29); v50 = (int16)READ_LE_UINT16(v30 + 4 * v29 + 2); v32 = v8; - WRITE_LE_UINT16(a6 + 2 * v32, v31); - WRITE_LE_UINT16(a6 + 2 * v32 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v32 + 4, Ligne[a4].field6); + a6[v32] = v31; + a6[v32 + 1] = v50; + a6[v32 + 2] = Ligne[a4].field6; v8 += a7; ++v29; } while (a5 > v29); @@ -762,9 +763,9 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in v27 = (int16)READ_LE_UINT16(v26 + 4 * v25); v50 = (int16)READ_LE_UINT16(v26 + 4 * v25 + 2); v28 = v8; - WRITE_LE_UINT16(a6 + 2 * v28, v27); - WRITE_LE_UINT16(a6 + 2 * v28 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v28 + 4, Ligne[a4].field8); + a6[v28] = v27; + a6[v28 + 1] = v50; + a6[v28 + 2] = Ligne[a4].field8; v8 += a7; --v25; } while (a5 < v25); @@ -773,7 +774,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, in return v8; } -int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7, int a8, int a9) { +int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9) { int v9; int v10; int i; @@ -816,9 +817,10 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v13 = (int16)READ_LE_UINT16(v12 + 4 * i); v50 = (int16)READ_LE_UINT16(v12 + 4 * i + 2); v14 = v40; - WRITE_LE_UINT16(a6 + 2 * v14, v13); - WRITE_LE_UINT16(a6 + 2 * v14 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v14 + 4, Ligne[a1].field6); + + a6[v14] = v13; + a6[v14 + 1] = v50; + a6[v14 + 2] = Ligne[a1].field6; v40 += a7; } v15 = a1 + 1; @@ -832,9 +834,9 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v18 = (int16)READ_LE_UINT16(v17 + 4 * v16); v50 = (int16)READ_LE_UINT16(v17 + 4 * v16 + 2); v19 = v40; - WRITE_LE_UINT16(a6 + 2 * v19, v18); - WRITE_LE_UINT16(a6 + 2 * v19 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v19 + 4, Ligne[v15].field6); + a6[v19] = v18; + a6[v19 + 1] = v50; + a6[v19 + 2] = Ligne[v15].field6; v40 += a7; ++v16; } while (Ligne[v15].field0 > v16); @@ -848,13 +850,14 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i } if (a4 > v9) { for (j = v10; j > 0; --j) { - v21 = Ligne[v9].fieldC;; + v21 = Ligne[v9].fieldC; v22 = (int16)READ_LE_UINT16(v21 + 4 * j); v50 = (int16)READ_LE_UINT16(v21 + 4 * j + 2); v23 = v40; - WRITE_LE_UINT16(a6 + 2 * v23, v22); - WRITE_LE_UINT16(a6 + 2 * v23 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v23 + 4, Ligne[v9].field8); + + a6[v23] = v22; + a6[v23 + 1] = v50; + a6[v23 + 2] = Ligne[v9].field8; v40 += a7; } v24 = v9 - 1; @@ -866,9 +869,9 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v27 = (int16)READ_LE_UINT16(v26 + 4 * k); v50 = (int16)READ_LE_UINT16(v26 + 4 * k + 2); v28 = v40; - WRITE_LE_UINT16(a6 + 2 * v28, v27); - WRITE_LE_UINT16(a6 + 2 * v28 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v28 + 4, Ligne[v24].field8); + a6[v28] = v27; + a6[v28 + 1] = v50; + a6[v28 + 2] = Ligne[v24].field8; v40 += a7; } --v24; @@ -888,9 +891,10 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v35 = (int16)READ_LE_UINT16(v34 + 4 * v33); v50 = (int16)READ_LE_UINT16(v34 + 4 * v33 + 2); v36 = v40; - WRITE_LE_UINT16(a6 + 2 * v36, v35); - WRITE_LE_UINT16(a6 + 2 * v36 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v36 + 4, Ligne[v39].field6); + + a6[v36] = v35; + a6[v36 + 1] = v50; + a6[v36 + 2] = Ligne[v39].field6; v40 += a7; ++v33; } while (a5 > v33); @@ -903,9 +907,9 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, i v31 = (int16)READ_LE_UINT16(v30 + 4 * v29); v50 = (int16)READ_LE_UINT16(v30 + 4 * v29 + 2); v32 = v40; - WRITE_LE_UINT16(a6 + 2 * v32, v31); - WRITE_LE_UINT16(a6 + 2 * v32 + 2, v50); - WRITE_LE_UINT16(a6 + 2 * v32 + 4, Ligne[v38].field8); + a6[v32] = v31; + a6[v32 + 1] = v50; + a6[v32 + 2] = Ligne[v38].field8; v40 += a7; --v29; } while (a5 < v29); @@ -1127,7 +1131,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { do { if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { - v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); if (v23 == -1) return 0; v7 = v23; @@ -1155,7 +1159,7 @@ LABEL_186: do { if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { - v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); if (v26 == -1) return 0; v7 = v26; @@ -1179,7 +1183,7 @@ LABEL_186: do { if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { - v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v29 == -1) return 0; v7 = v29; @@ -1203,7 +1207,7 @@ LABEL_186: do { if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { - v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, (byte *)&_vm->_globals.super_parcours[0], 4); + v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v32 == -1) return 0; v7 = v32; @@ -1226,7 +1230,7 @@ LABEL_186: return 0; } -int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, byte *a8, int a9) { +int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { int v9; byte *v10; int v11; @@ -1326,9 +1330,9 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, if (_vm->_globals.STOP_BUG > 10) { v9 = a7; LABEL_112: - WRITE_LE_UINT16(a8 + 2 * v9, (uint16)-1); - WRITE_LE_UINT16(a8 + 2 * v9 + 2, (uint16)-1); - WRITE_LE_UINT16(a8 + 2 * v9 + 4, (uint16)-1); + a8[v9] = -1; + a8[v9 + 1] = -1; + a8[v9 + 2] = -1; return -1; } v10 = Ligne[a1].fieldC; @@ -2151,7 +2155,7 @@ LABEL_201: if ((uint16)colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, &_vm->_globals.super_parcours[0], 4); if (v58 == -1) goto LABEL_282; v112 = v58; @@ -2175,7 +2179,7 @@ LABEL_201: if ((uint16)colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) goto LABEL_282; v112 = v61; @@ -2199,7 +2203,7 @@ LABEL_201: if ((uint16)colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, &_vm->_globals.super_parcours[0], 4); if (v64 == -1) goto LABEL_282; v112 = v64; @@ -2223,7 +2227,7 @@ LABEL_201: if ((uint16)colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, (byte *)&_vm->_globals.super_parcours[0], 4); + v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, &_vm->_globals.super_parcours[0], 4); if (v67 == -1) goto LABEL_282; v112 = v67; @@ -2434,7 +2438,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v14; int v15; int v16; - byte *v17; + int16 *v17; int v18; int v19; int v20; @@ -2443,68 +2447,68 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v23; int v24; int v25; - byte *v26; + int16 *v26; int v27; - byte *v28; - byte *v29; + int16 *v28; + int16 *v29; int v30; int v31; - byte *v32; + int16 *v32; int v33; int v34; - byte *v35; + int16 *v35; int v36; int v37; - byte *v38; + int16 *v38; int v39; int v40; int v41; - byte *v42; + int16 *v42; int v43; int v44; int v45; int v46; - byte *v47; + int16 *v47; int v48; - byte *v49; - byte *v50; + int16 *v49; + int16 *v50; int v51; int v52; - byte *v53; + int16 *v53; int v54; int v55; int v56; - byte *v57; + int16 *v57; int v58; int v59; - byte *v60; + int16 *v60; int v61; int v62; int v63; - byte *v64; + int16 *v64; int v65; int v66; int v67; int v68; - byte *v69; + int16 *v69; int v70; - byte *v71; - byte *v72; + int16 *v71; + int16 *v72; int v73; int v74; int v76; - byte *v77; - byte *v78; + int16 *v77; + int16 *v78; int v79; - byte *v80; + int16 *v80; int v81; - byte *v82; + int16 *v82; int v83; - byte *v84; + int16 *v84; int v85; - byte *v86; + int16 *v86; int v87; - byte *v88; + int16 *v88; int v89; int v90; int v91; @@ -2611,9 +2615,10 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int LABEL_149: v27 = v115; v28 = _vm->_globals.essai0; - WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v27, (uint16)-1); - WRITE_LE_UINT16(v28 + 2 * v27 + 2, (uint16)-1); - WRITE_LE_UINT16(v28 + 2 * v27 + 4, (uint16)-1); + v28[v27] = -1; + v28[v27 + 1] = -1; + v28[v27 + 2] = -1; + LABEL_150: if (v115) { v127 = 0; @@ -2621,14 +2626,15 @@ LABEL_150: v29 = _vm->_globals.essai0; do { v30 = v137; - _vm->_globals.super_parcours[v30] = (int16)READ_LE_UINT16(v29 + 2 * v116); - _vm->_globals.super_parcours[v30 + 1] = (int16)READ_LE_UINT16(v29 + 2 * v116 + 2); - _vm->_globals.super_parcours[v30 + 2] = (int16)READ_LE_UINT16(v29 + 2 * v116 + 4); + _vm->_globals.super_parcours[v30] = v29[v116]; + _vm->_globals.super_parcours[v30 + 1] = v29[v116 + 1]; + _vm->_globals.super_parcours[v30 + 2] = v29[v116 + 2]; _vm->_globals.super_parcours[v30 + 3] = 0; v116 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v29 + 2 * v116) == -1) { - if ((int16)READ_LE_UINT16(v29 + 2 * v116 + 2) == -1) + + if (v29[v116] == -1) { + if (v29[v116 + 1] == -1) v127 = 1; } } while (v127 != 1); @@ -2775,9 +2781,9 @@ LABEL_103: while (colision2_ligne(v104, v103, &v143, &v142, 0, TOTAL_LIGNES) != 1) { v25 = v115; v26 = _vm->_globals.essai0; - WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v25, v104); - WRITE_LE_UINT16(v26 + 2 * v25 + 2, v103); - WRITE_LE_UINT16(v26 + 2 * v25 + 4, v91); + v26[v25] = v104; + v26[v25 + 1] = v103; + v26[v25 + 2] = v91; v106 += v102; v105 += v100; v104 = v106 / 1000; @@ -2814,8 +2820,9 @@ LABEL_67: if (colision2_ligne(v15, v110, &v143, &v142, 0, TOTAL_LIGNES) == 1) break; v16 = v115; + v17 = _vm->_globals.essai0; - WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v16, v112); + v17[v16] = v112; WRITE_LE_UINT16(v17 + 2 * v16 + 2, v110); WRITE_LE_UINT16(v17 + 2 * v16 + 4, v91); v115 += 3; @@ -2833,9 +2840,10 @@ LABEL_70: LABEL_157: v31 = v115; v32 = _vm->_globals.essai0; - WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v31, (uint16)-1); - WRITE_LE_UINT16(v32 + 2 * v31 + 2, (uint16)-1); - WRITE_LE_UINT16(v32 + 2 * v31 + 4, (uint16)-1); + v32[v31] = -1; + v32[v31 + 1] = -1; + v32[v31 + 2] = -1; + v117 = 0; v33 = v98; v92 = v97; @@ -2850,9 +2858,9 @@ LABEL_165: while (colision2_ligne(v36, v92, &v141, &v140, 0, TOTAL_LIGNES) != 1) { v37 = v117; v38 = _vm->_globals.essai1; - WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v37, v36); - WRITE_LE_UINT16(v38 + 2 * v37 + 2, v92); - WRITE_LE_UINT16(v38 + 2 * v37 + 4, 7); + v38[v37] = v36; + v38[v37 + 1] = v92; + v38[v37 + 2] = 7; v117 += 3; --v36; if (a3 >= v36) @@ -2886,9 +2894,9 @@ LABEL_181: } v46 = v117; v47 = _vm->_globals.essai1; - WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v46, a3); - WRITE_LE_UINT16(v47 + 2 * v46 + 2, v43); - WRITE_LE_UINT16(v47 + 2 * v46 + 4, 1); + v47[v46] = a3; + v47[v46 + 1] = v43; + v47[v46 + 2] = 1; v117 += 3; --v43; } while (a4 < v43); @@ -2896,9 +2904,9 @@ LABEL_181: LABEL_194: v48 = v117; v49 = _vm->_globals.essai1; - WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v48, (uint16)-1); - WRITE_LE_UINT16(v49 + 2 * v48 + 2, (uint16)-1); - WRITE_LE_UINT16(v49 + 2 * v48 + 4, (uint16)-1); + v49[v48] = -1; + v49[v48 + 1] = -1; + v49[v48 + 2] = -1; LABEL_195: if (v117) { v128 = 0; @@ -2906,13 +2914,13 @@ LABEL_195: v50 = _vm->_globals.essai1; do { v51 = v137; - _vm->_globals.super_parcours[v51] = (int16)READ_LE_UINT16(v50 + 2 * v118); - _vm->_globals.super_parcours[v51 + 1] = (int16)READ_LE_UINT16(v50 + 2 * v118 + 2); - _vm->_globals.super_parcours[v51 + 2] = (int16)READ_LE_UINT16(v50 + 2 * v118 + 4); + _vm->_globals.super_parcours[v51] = v50[v118]; + _vm->_globals.super_parcours[v51 + 1] = v50[v118 + 1]; + _vm->_globals.super_parcours[v51 + 2] = v50[v118 + 2]; _vm->_globals.super_parcours[v51 + 3] = 0; v118 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v50 + 2 * v118) == -1 && (int16)READ_LE_UINT16(v50 + 2 * v118 + 2) == -1) + if (v50[v118] == -1 && v50[v118 + 1] == -1) v128 = 1; } while (v128 != 1); } @@ -2942,10 +2950,11 @@ LABEL_189: goto LABEL_202; } v41 = v117; + v42 = _vm->_globals.essai1; - WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v41, a3); - WRITE_LE_UINT16(v42 + 2 * v41 + 2, v39); - WRITE_LE_UINT16(v42 + 2 * v41 + 4, 5); + v42[v41] = a3; + v42[v41 + 1] = v39; + v42[v41 + 2] = 5; v117 += 3; ++v39; if (a4 <= v39) @@ -2955,9 +2964,9 @@ LABEL_189: while (colision2_ligne(v33, v92, &v141, &v140, 0, TOTAL_LIGNES) != 1) { v34 = v117; v35 = _vm->_globals.essai1; - WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v34,v33); - WRITE_LE_UINT16(v35 + 2 * v34 + 2, v92); - WRITE_LE_UINT16(v35 + 2 * v34 + 4, 3); + v35[v34] = v33; + v35[v34 + 1] = v92; + v35[v34 + 2] = 3; v117 += 3; ++v33; if (a3 <= v33) @@ -2969,9 +2978,9 @@ LABEL_168: LABEL_202: v52 = v117; v53 = _vm->_globals.essai1; - WRITE_LE_UINT16(_vm->_globals.essai1 + 2 * v52, (uint16)-1); - WRITE_LE_UINT16(v53 + 2 * v52 + 2, (uint16)-1); - WRITE_LE_UINT16(v53 + 2 * v52 + 4, (uint16)-1); + v53[v52] = -1; + v53[v52 + 1] = -1; + v53[v52 + 2] = -1; v117 = 0; v54 = v98; v93 = v97; @@ -2984,9 +2993,9 @@ LABEL_203: while (colision2_ligne(v114, v55, &v139, &v138, 0, TOTAL_LIGNES) != 1) { v56 = v117; v57 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v56, v114); - WRITE_LE_UINT16(v57 + 2 * v56 + 2, v55); - WRITE_LE_UINT16(v57 + 2 * v56 + 4, 5); + v57[v56] = v114; + v57[v56 + 1] = v55; + v57[v56 + 2] = 5; v117 += 3; ++v55; if (a4 <= v55) @@ -3019,7 +3028,7 @@ LABEL_249: WRITE_LE_UINT16(v77 + 2 * v76 + 4, (uint16)-1); if (v136 != 1) { if (a6 > v144) { - if ((int16)READ_LE_UINT16(_vm->_globals.essai0) != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { + if (_vm->_globals.essai0[0] != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v130 = 0; @@ -3027,13 +3036,13 @@ LABEL_249: v78 = _vm->_globals.essai0; do { v79 = v137; - _vm->_globals.super_parcours[v79] = (int16)READ_LE_UINT16(v78 + 2 * v120); - _vm->_globals.super_parcours[v79 + 1] = (int16)READ_LE_UINT16(v78 + 2 * v120 + 2); - _vm->_globals.super_parcours[v79 + 2] = (int16)READ_LE_UINT16(v78 + 2 * v120 + 4); + _vm->_globals.super_parcours[v79] = v78[v120]; + _vm->_globals.super_parcours[v79 + 1] = v78[v120 + 1]; + _vm->_globals.super_parcours[v79 + 2] = v78[v120 + 2]; _vm->_globals.super_parcours[v79 + 3] = 0; v120 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v78 + 2 * v120) == -1 && (int16)READ_LE_UINT16(v78 + 2 * v120 + 2) == -1) + if (v78[v120] == -1 && v78[v120 + 1] == -1) v130 = 1; } while (v130 != 1); LABEL_323: @@ -3048,13 +3057,13 @@ LABEL_323: v121 = 0; do { v81 = v137; - _vm->_globals.super_parcours[v81] = (int16)READ_LE_UINT16(v80 + 2 * v121); - _vm->_globals.super_parcours[v81 + 1] = (int16)READ_LE_UINT16(v80 + 2 * v121 + 2); - _vm->_globals.super_parcours[v81 + 2] = (int16)READ_LE_UINT16(v80 + 2 * v121 + 4); + _vm->_globals.super_parcours[v81] = v80[v121]; + _vm->_globals.super_parcours[v81 + 1] = v80[v121 + 1]; + _vm->_globals.super_parcours[v81 + 2] = v80[v121 + 2]; _vm->_globals.super_parcours[v81 + 3] = 0; v121 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v80 + 2 * v121) == -1 && (int16)READ_LE_UINT16(v80 + 2 * v121 + 2) == -1) + if (v80[v121] == -1 && v80[v121 + 1] == -1) v131 = 1; } while (v131 != 1); LABEL_301: @@ -3070,13 +3079,13 @@ LABEL_301: v122 = 0; do { v83 = v137; - _vm->_globals.super_parcours[v83] = (int16)READ_LE_UINT16(v82 + 2 * v122); - _vm->_globals.super_parcours[v83 + 1] = (int16)READ_LE_UINT16(v82 + 2 * v122 + 2); - _vm->_globals.super_parcours[v83 + 2] = (int16)READ_LE_UINT16(v82 + 2 * v122 + 4); + _vm->_globals.super_parcours[v83] = v82[v122]; + _vm->_globals.super_parcours[v83 + 1] = v82[v122 + 1]; + _vm->_globals.super_parcours[v83 + 2] = v82[v122 + 2]; _vm->_globals.super_parcours[v83 + 3] = 0; v122 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v82 + 2 * v122) == -1 && (int16)READ_LE_UINT16(v82 + 2 * v122 + 2) == -1) + if (v82[v122] == -1 && v82[v122 + 1] == -1) v132 = 1; } while (v132 != 1); LABEL_312: @@ -3092,7 +3101,7 @@ LABEL_312: v142 = 1300; if (v138 == -1) v142 = 1300; - if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { + if (_vm->_globals.essai1[0] != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v133 = 0; @@ -3100,37 +3109,37 @@ LABEL_312: v84 = _vm->_globals.essai1; do { v85 = v137; - _vm->_globals.super_parcours[v85] = (int16)READ_LE_UINT16(v84 + 2 * v123); - _vm->_globals.super_parcours[v85 + 1] = (int16)READ_LE_UINT16(v84 + 2 * v123 + 2); - _vm->_globals.super_parcours[v85 + 2] = (int16)READ_LE_UINT16(v84 + 2 * v123 + 4); + _vm->_globals.super_parcours[v85] = v84[v123]; + _vm->_globals.super_parcours[v85 + 1] = v84[v123 + 1]; + _vm->_globals.super_parcours[v85 + 2] = v84[v123 + 2]; _vm->_globals.super_parcours[v85 + 3] = 0; v123 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v84 + 2 * v123) == -1 && (int16)READ_LE_UINT16(v84 + 2 * v123 + 2) == -1) + if (v84[v123] == -1 && v84[v123 + 1] == -1) v133 = 1; } while (v133 != 1); goto LABEL_301; } v86 = _vm->_globals.essai2; - if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { + if (_vm->_globals.essai2[0] != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; v134 = 0; v124 = 0; do { v87 = v137; - _vm->_globals.super_parcours[v87] = (int16)READ_LE_UINT16(v86 + 2 * v124); - _vm->_globals.super_parcours[v87 + 1] = (int16)READ_LE_UINT16(v86 + 2 * v124 + 2); - _vm->_globals.super_parcours[v87 + 2] = (int16)READ_LE_UINT16(v86 + 2 * v124 + 4); + _vm->_globals.super_parcours[v87] = v86[v124]; + _vm->_globals.super_parcours[v87 + 1] = v86[v124 + 1]; + _vm->_globals.super_parcours[v87 + 2] = v86[v124 + 2]; _vm->_globals.super_parcours[v87 + 3] = 0; v124 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v86 + 2 * v124) == -1 && (int16)READ_LE_UINT16(v86 + 2 * v124 + 2) == -1) + if (v86[v124] == -1 && v86[v124 + 1] == -1) v134 = 1; } while (v134 != 1); goto LABEL_312; } - if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { + if (_vm->_globals.essai1[0] != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v135 = 0; @@ -3138,13 +3147,13 @@ LABEL_312: v88 = _vm->_globals.essai0; do { v89 = v137; - _vm->_globals.super_parcours[v89] = (int16)READ_LE_UINT16(v88 + 2 * v125); - _vm->_globals.super_parcours[v89 + 1] = (int16)READ_LE_UINT16(v88 + 2 * v125 + 2); - _vm->_globals.super_parcours[v89 + 2] = (int16)READ_LE_UINT16(v88 + 2 * v125 + 4); + _vm->_globals.super_parcours[v89] = v88[v125]; + _vm->_globals.super_parcours[v89 + 1] = v88[v125 + 1]; + _vm->_globals.super_parcours[v89 + 2] = v88[v125 + 2]; _vm->_globals.super_parcours[v89 + 3] = 0; v125 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v88 + 2 * v125) == -1 && (int16)READ_LE_UINT16(v88 + 2 * v125 + 2) == -1) + if (v88[v125] == -1 && v88[v125 + 1] == -1) v135 = 1; } while (v135 != 1); goto LABEL_323; @@ -3179,10 +3188,11 @@ LABEL_235: goto LABEL_249; } v63 = v117; + v64 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v63, v61); - WRITE_LE_UINT16(v64 + 2 * v63 + 2, a4); - WRITE_LE_UINT16(v64 + 2 * v63 + 4, 3); + v64[v63] = v61; + v64[v63 + 1] = a4; + v64[v63 + 2] = 3; v117 += 3; ++v61; } while (a3 > v61); @@ -3210,9 +3220,9 @@ LABEL_235: } v68 = v117; v69 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v68, v65); - WRITE_LE_UINT16(v69 + 2 * v68 + 2, a4); - WRITE_LE_UINT16(v69 + 2 * v68 + 4, 7); + v69[v68] = v65; + v69[v68 + 1] = a4; + v69[v68 + 2] = 7; v117 += 3; --v65; } while (a3 < v65); @@ -3221,9 +3231,9 @@ LABEL_235: LABEL_241: v70 = v117; v71 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v70, (uint16)-1); - WRITE_LE_UINT16(v71 + 2 * v70 + 2, (uint16)-1); - WRITE_LE_UINT16(v71 + 2 * v70 + 4, (uint16)-1); + v71[v70] = -1; + v71[v70 + 1] = -1; + v71[v70 + 2] = -1; LABEL_242: if (v117) { v129 = 0; @@ -3231,13 +3241,13 @@ LABEL_242: v72 = _vm->_globals.essai2; do { v73 = v137; - _vm->_globals.super_parcours[v73] = (int16)READ_LE_UINT16(v72 + 2 * v119); - _vm->_globals.super_parcours[v73 + 1] = (int16)READ_LE_UINT16(v72 + 2 * v119 + 2); - _vm->_globals.super_parcours[v73 + 2] = (int16)READ_LE_UINT16(v72 + 2 * v119 + 4); + _vm->_globals.super_parcours[v73] = v72[v119]; + _vm->_globals.super_parcours[v73 + 1] = v72[v119 + 1]; + _vm->_globals.super_parcours[v73 + 2] = v72[v119 + 2]; _vm->_globals.super_parcours[v73 + 3] = 0; v119 += 3; v137 += 4; - if ((int16)READ_LE_UINT16(v72 + 2 * v119) == -1 && (int16)READ_LE_UINT16(v72 + 2 * v119 + 2) == -1) + if (v72[v119] == -1 && v72[v119 + 1] == -1) v129 = 1; } while (v129 != 1); } @@ -3592,8 +3602,8 @@ int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { int v21; int v22; int v23; - byte *v25; - byte *v26; + int16 *v25; + int16 *v26; int v27; int v28; int v29; @@ -3743,10 +3753,10 @@ LABEL_60: } if (a6 == 1) { v18 = v41; - WRITE_LE_UINT16(v25 + 2 * v18, v16); - WRITE_LE_UINT16(v25 + 2 * v18 + 2, v29); - WRITE_LE_UINT16(v25 + 2 * v18 + 4, Ligne[v32].field6); - WRITE_LE_UINT16(v25 + 2 * v18 + 6, 0); + v25[v18] = v16; + v25[v18 + 1] = v29; + v25[v18 + 2] = Ligne[v32].field6; + v25[v18 + 3] = 0; } v41 += 4; ++v14; @@ -3764,10 +3774,10 @@ LABEL_60: v30 = (int16)READ_LE_UINT16(v20 + 4 * v19 + 2); if (a6) { v23 = v41; - WRITE_LE_UINT16(v26 + 2 * v23, v21); - WRITE_LE_UINT16(v26 + 2 * v23 + 2, v30); - WRITE_LE_UINT16(v26 + 2 * v23 + 4, Ligne[v31].field8); - WRITE_LE_UINT16(v26 + 2 * v23 + 6, 0); + v26[v23] = v21; + v26[v23 + 1] = v30; + v26[v23 + 2] = Ligne[v31].field8; + v26[v23 + 3] = 0; } else { v22 = v41; _vm->_globals.super_parcours[v22] = v21; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index cded40646e..da9c897c28 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -81,10 +81,10 @@ public: int colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); int Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); void INIPARCOURS(); - int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7, int a8, int a9); - int CONTOURNE(int a1, int a2, int a3, int a4, int a5, byte *a6, int a7); + int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); + int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); int MIRACLE(int a1, int a2, int a3, int a4, int a5); - int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, byte *a8, int a9); + int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); byte *PARCOURS2(int a1, int a2, int a3, int a4); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 63238844c6..f7e72b0cef 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2786,9 +2786,9 @@ void ObjectsManager::BTGAUCHE() { int v0; int v1; int v2; - byte *v3; + int16 *v3; byte *v4; - byte *v5; + int16 *v5; int v6; int v7; int v8; @@ -2859,14 +2859,15 @@ void ObjectsManager::BTGAUCHE() { v3 = _vm->_globals.essai2; v4 = _vm->_globals.chemin; do { - WRITE_LE_UINT16(v3 + 2 * v2, (int16)READ_LE_UINT16(v4 + 2 * v2)); + v3[v2] = READ_LE_UINT16(v4 + 2 * v2); ++v2; } while ((int16)READ_LE_UINT16(v4 + 2 * v2) != -1); + v5 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v2, (uint16)-1); - WRITE_LE_UINT16(v5 + 2 * v2 + 2, (uint16)-1); - WRITE_LE_UINT16(v5 + 2 * v2 + 4, (uint16)-1); - WRITE_LE_UINT16(v5 + 2 * v2 + 6, (uint16)-1); + v5[v2] = -1; + v5[v2 + 1] = -1; + v5[v2 + 2] = -1; + v5[v2 + 3] = -1; } if (GOACTION == 1) { VERIFZONE(); @@ -3576,7 +3577,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v30; int v31; int v32; - byte *v33; + int16 *v33; int v34; int v35; int i; @@ -3796,11 +3797,12 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { _vm->_globals.super_parcours[v32 + 1] = v29; _vm->_globals.super_parcours[v32 + 2] = v66; _vm->_globals.super_parcours[v32 + 3] = 0; + v33 = _vm->_globals.essai0; - WRITE_LE_UINT16(_vm->_globals.essai0 + 2 * v32, v28); - WRITE_LE_UINT16(v33 + 2 * v32 + 2, v29); - WRITE_LE_UINT16(v33 + 2 * v32 + 4, v66); - WRITE_LE_UINT16(v33 + 2 * v32 + 6, 0); + v33[v32] = v28; + v33[v32 + 1] = v29; + v33[v32 + 2] = v66; + v33[v32 + 3] = 0; v67 += 4; if (v28 == -1) goto LABEL_90; -- cgit v1.2.3 From 5d0c5753eb835817951beb95be1a01dbcb95c212 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Oct 2012 09:16:25 +1100 Subject: HOPKINS: Converted the LigneItem data block to an int16 array --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/lines.cpp | 392 +++++++++++++++++++++++--------------------- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 56 +++---- 4 files changed, 237 insertions(+), 215 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 8253593e99..35d1e61115 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -350,7 +350,7 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field4 = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; - _vm->_linesManager.Ligne[idx].fieldC = g_PTRNUL; + _vm->_linesManager.Ligne[idx].lineData = (int16 *)g_PTRNUL; _vm->_linesManager.LigneZone[idx].count = 0; _vm->_linesManager.LigneZone[idx].field2 = 0; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 8fbee5c32f..968bfe8e64 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -219,16 +219,16 @@ void LinesManager::RESET_OBSTACLE() { for (int idx =0; idx < 400; ++idx) { RETIRE_LIGNE(idx); Ligne[idx].field0 = 0; - Ligne[idx].fieldC = g_PTRNUL; + Ligne[idx].lineData = (int16 *)g_PTRNUL; } } void LinesManager::RETIRE_LIGNE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (Ligne[idx].fieldC != g_PTRNUL) - _vm->_globals.dos_free2(Ligne[idx].fieldC); - Ligne[idx].fieldC = g_PTRNUL; + if (Ligne[idx].lineData != (int16 *)g_PTRNUL) + _vm->_globals.dos_free2((byte *)Ligne[idx].lineData); + Ligne[idx].lineData = (int16 *)g_PTRNUL; } void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { @@ -242,10 +242,10 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int v24; int v25; int v26; - byte *v27; + int16 *v27; int v30; int v31; - byte *v32; + int16 *v32; int v33; int v34; int v35; @@ -260,8 +260,8 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (TOTAL_LIGNES < idx) TOTAL_LIGNES = idx; - if (Ligne[idx].fieldC != g_PTRNUL) - _vm->_globals.dos_free2(Ligne[idx].fieldC); + if (Ligne[idx].lineData != (int16 *)g_PTRNUL) + _vm->_globals.dos_free2((byte *)Ligne[idx].lineData); v7 = a3 - a5; if (a3 - a5 < 0) v7 = -v7; @@ -273,11 +273,13 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v33 = v9 + 1; if (v8 > (int)(v9 + 1)) v34 = v8; + v10 = _vm->_globals.dos_malloc2(4 * v34 + 8); - Ligne[idx].fieldC = v10; if (v10 == g_PTRNUL) error("AJOUTE LIGNE OBSTACLE"); - v32 = Ligne[idx].fieldC; + Ligne[idx].lineData = (int16 *)v10; + + v32 = Ligne[idx].lineData; v36 = 1000 * v8; v39 = 1000 * v8 / (v34 - 1); v37 = 1000 * v33 / (v34 - 1); @@ -356,9 +358,10 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v26 = 0; if (v35 > 0) { do { - WRITE_LE_UINT16(v32, v31); - WRITE_LE_UINT16(v32 + 2, v30); - v32 += 4; + v32[0] = v31; + v32[1] = v30; + v32 += 2; + v24 += v40; v25 += v38; v31 = v24 / 1000; @@ -366,11 +369,12 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, ++v26; } while (v35 > v26); } - WRITE_LE_UINT16(v32, a5); - WRITE_LE_UINT16(v32 + 2, a6); - v27 = v32 + 4; - WRITE_LE_UINT16(v27, (uint16)-1); - WRITE_LE_UINT16(v27 + 2, (uint16)-1); + v32[0] = a5; + v32[1] = a6; + + v27 = v32 + 2; + v27[0] = -1; + v27[1] = -1; Ligne[idx].field0 = v35 + 1; Ligne[idx].field2 = a7; @@ -379,13 +383,13 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { int v6; - byte *v7; + int16 *v7; int v8; int v9; int v10; int v11; int v12; - byte *v13; + int16 *v13; int v14; int result; int v16; @@ -409,15 +413,16 @@ LABEL_29: v20 = a2 + 4; v19 = a2 - 4; while (1) { - v7 = Ligne[v6].fieldC; - if (v7 != g_PTRNUL) { + v7 = Ligne[v6].lineData; + + if (v7 != (int16 *)g_PTRNUL) { v23 = 1; v8 = 2 * Ligne[v6].field0; - v9 = (int16)READ_LE_UINT16(v7); - v16 = (int16)READ_LE_UINT16(v7 + 2); - v10 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 4); - v18 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 2); - if ((int16)READ_LE_UINT16(v7) >= v10) + v9 = v7[0]; + v16 = v7[1]; + v10 = v7[v8 - 2]; + v18 = v7[v8 - 1]; + if (v7[0] >= v10) goto LABEL_32; if (v22 < v9 || v21 > v10) v23 = 0; @@ -449,10 +454,12 @@ LABEL_28: goto LABEL_29; } while (1) { - v12 = (int16)READ_LE_UINT16(v7); - v13 = v7 + 2; - v14 = (int16)READ_LE_UINT16(v13); - v7 = v13 + 2; + v12 = v7[0]; + + v13 = v7 + 1; + v14 = v13[0]; + v7 = v13 + 1; + if (a1 == v12 || a1 + 1 == v12) { if (a2 == v14 || a2 + 1 == v14) break; @@ -470,13 +477,13 @@ LABEL_28: int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { int v6; - byte *v7; + int16 *v7; int v8; int v9; int v10; int v11; int v12; - byte *v13; + int16 *v13; int result; int v15; int v16; @@ -499,16 +506,17 @@ LABEL_47: v21 = a1 - 10; v20 = a2 + 10; v19 = a2 - 10; - while (1) { - v7 = Ligne[v6].fieldC; - if (g_PTRNUL != v7) { + for (;;) { + v7 = Ligne[v6].lineData; + + if (v7 != (int16 *)g_PTRNUL) { v23 = 1; v8 = 2 * Ligne[v6].field0; - v9 = (int16)READ_LE_UINT16(v7); - v15 = (int16)READ_LE_UINT16(v7 + 2); - v10 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 4); - v17 = (int16)READ_LE_UINT16(v7 + 2 * v8 - 2); - if ((int16)READ_LE_UINT16(v7) >= v10) + v9 = v7[0]; + v15 = v7[1]; + v10 = v7[v8 - 2]; + v17 = v7[v8 - 1]; + if (v7[0] >= v10) goto LABEL_50; if (v22 < v9 || v21 > v10) v23 = 0; @@ -540,10 +548,10 @@ LABEL_46: goto LABEL_47; } while (1) { - v12 = (int16)READ_LE_UINT16(v7); - v13 = v7 + 2; - v16 = (int16)READ_LE_UINT16(v13); - v7 = v13 + 2; + v12 = v7[0]; + v13 = v7 + 1; + v16 = v13[0]; + v7 = v13 + 1; if (a1 == v12 || v12 == a1 + 1 || v12 == a1 + 2 @@ -583,11 +591,11 @@ void LinesManager::INIPARCOURS() { int v0; int v1; int v2; - byte *v3; + int16 *v3; int v4; int v5; int v6; - byte *v7; + int16 *v7; int v8; int v9; int v11; @@ -596,16 +604,17 @@ void LinesManager::INIPARCOURS() { int v14; int v15; - v15 = (int16)READ_LE_UINT16(Ligne[0].fieldC); - v14 = (int16)READ_LE_UINT16(Ligne[0].fieldC + 2); + v15 = Ligne[0].lineData[0]; + v14 = Ligne[0].lineData[1]; v0 = 1; v1 = 0; do { v2 = Ligne[v0].field0; - v3 = Ligne[v0].fieldC; - v4 = (int16)READ_LE_UINT16(v3 + 4 * v2 - 4); - v5 = (int16)READ_LE_UINT16(v3 + 4 * v2 - 2); + v3 = Ligne[v0].lineData; + + v4 = v3[2 * v2 - 2]; + v5 = v3[2 * v2 - 1]; if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 || _vm->_graphicsManager.min_y == v5) v1 = 1; @@ -616,8 +625,8 @@ void LinesManager::INIPARCOURS() { error("ERROR - LAST LINE NOT FOUND"); v1 = v6; } - v7 = Ligne[v0 + 1].fieldC; - if ((int16)READ_LE_UINT16(v7) != v4 && (int16)READ_LE_UINT16(v7 + 2) != v5) + v7 = Ligne[v0 + 1].lineData; + if (v7[0] != v4 && v7[1] != v5) v1 = 1; if (!v1) ++v0; @@ -644,27 +653,27 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i int v7; int v8; int i; - byte *v10; + int16 *v10; int v11; int v12; int v13; - byte *v14; + int16 *v14; int v15; int v16; int j; - byte *v18; + int16 *v18; int v19; int v20; int k; - byte *v22; + int16 *v22; int v23; int v24; int v25; - byte *v26; + int16 *v26; int v27; int v28; int v29; - byte *v30; + int16 *v30; int v31; int v32; int v34; @@ -677,9 +686,10 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i v8 = a3; if (a1 < a4) { for (i = a2; Ligne[a1].field0 > i; ++i) { - v10 = Ligne[a1].fieldC; - v11 = (int16)READ_LE_UINT16(v10 + 4 * i); - v50 = (int16)READ_LE_UINT16(v10 + 4 * i + 2); + v10 = Ligne[a1].lineData; + v11 = v10[2 * i]; + v50 = v10[2 * i + 1]; + v12 = v8; a6[v12] = v11; a6[v12 + 1] = v50; @@ -692,9 +702,9 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i v13 = 0; if (Ligne[v34].field0 > 0) { do { - v14 = Ligne[v34].fieldC; - v15 = (int16)READ_LE_UINT16(v14 + 4 * v13); - v50 = (int16)READ_LE_UINT16(v14 + 4 * v13 + 2); + v14 = Ligne[v34].lineData; + v15 = v14[2 * v13]; + v50 = v14[2 * v13 + 1]; v16 = v8; a6[v16] = v15; @@ -712,9 +722,10 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if (v36 > a4) { for (j = v7; j > 0; --j) { - v18 = Ligne[v36].fieldC; - v19 = (int16)READ_LE_UINT16(v18 + 4 * j); - v50 = (int16)READ_LE_UINT16(v18 + 4 * j + 2); + v18 = Ligne[v36].lineData; + v19 = v18[2 * j]; + v50 = v18[2 * j + 1]; + v20 = v8; a6[v20] = v19; a6[v20 + 1] = v50; @@ -725,9 +736,10 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i if ((int)(v36 - 1) > a4) { do { for (k = Ligne[v35].field0 - 1; k > 0; --k) { - v22 = Ligne[v35].fieldC; - v23 = (int16)READ_LE_UINT16(v22 + 4 * k); - v50 = (int16)READ_LE_UINT16(v22 + 4 * k + 2); + v22 = Ligne[v35].lineData; + v23 = v22[2 * k]; + v50 = v22[2 * k + 1]; + v24 = v8; a6[v24] = v23; a6[v24 + 1] = v50; @@ -745,9 +757,10 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i if (a5 > v7) { v29 = v7; do { - v30 = Ligne[a4].fieldC; - v31 = (int16)READ_LE_UINT16(v30 + 4 * v29); - v50 = (int16)READ_LE_UINT16(v30 + 4 * v29 + 2); + v30 = Ligne[a4].lineData; + v31 = v30[2 * v29]; + v50 = v30[2 * v29 + 1]; + v32 = v8; a6[v32] = v31; a6[v32 + 1] = v50; @@ -759,9 +772,10 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } else { v25 = v7; do { - v26 = Ligne[a4].fieldC; - v27 = (int16)READ_LE_UINT16(v26 + 4 * v25); - v50 = (int16)READ_LE_UINT16(v26 + 4 * v25 + 2); + v26 = Ligne[a4].lineData; + v27 = v26[2 * v25]; + v50 = v26[2 * v25 + 1]; + v28 = v8; a6[v28] = v27; a6[v28 + 1] = v50; @@ -778,29 +792,29 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int v9; int v10; int i; - byte *v12; + int16 *v12; int v13; int v14; int v15; int v16; - byte *v17; + int16 *v17; int v18; int v19; int j; - byte *v21; + int16 *v21; int v22; int v23; int v24; int k; - byte *v26; + int16 *v26; int v27; int v28; int v29; - byte *v30; + int16 *v30; int v31; int v32; int v33; - byte *v34; + int16 *v34; int v35; int v36; int v38; @@ -813,11 +827,11 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v40 = a3; if (a4 < a1) { for (i = a2; Ligne[a1].field0 > i; ++i) { - v12 = Ligne[a1].fieldC; - v13 = (int16)READ_LE_UINT16(v12 + 4 * i); - v50 = (int16)READ_LE_UINT16(v12 + 4 * i + 2); + v12 = Ligne[a1].lineData; + v13 = v12[2 * i]; + v50 = v12[2 * i + 1]; + v14 = v40; - a6[v14] = v13; a6[v14 + 1] = v50; a6[v14 + 2] = Ligne[a1].field6; @@ -830,9 +844,10 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v16 = 0; if (Ligne[v15].field0 > 0) { do { - v17 = Ligne[v15].fieldC; - v18 = (int16)READ_LE_UINT16(v17 + 4 * v16); - v50 = (int16)READ_LE_UINT16(v17 + 4 * v16 + 2); + v17 = Ligne[v15].lineData; + v18 = v17[2 * v16]; + v50 = v17[2 * v16 + 1]; + v19 = v40; a6[v19] = v18; a6[v19 + 1] = v50; @@ -850,11 +865,11 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, } if (a4 > v9) { for (j = v10; j > 0; --j) { - v21 = Ligne[v9].fieldC; - v22 = (int16)READ_LE_UINT16(v21 + 4 * j); - v50 = (int16)READ_LE_UINT16(v21 + 4 * j + 2); + v21 = Ligne[v9].lineData; + v22 = v21[2 * j]; + v50 = v21[2 * j + 1]; + v23 = v40; - a6[v23] = v22; a6[v23 + 1] = v50; a6[v23 + 2] = Ligne[v9].field8; @@ -865,9 +880,10 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v24 = a9; while (a4 != v24) { for (k = Ligne[v24].field0 - 1; k > 0; --k) { - v26 = Ligne[v24].fieldC; - v27 = (int16)READ_LE_UINT16(v26 + 4 * k); - v50 = (int16)READ_LE_UINT16(v26 + 4 * k + 2); + v26 = Ligne[v24].lineData; + v27 = v26[2 * k]; + v50 = v26[2 * k + 1]; + v28 = v40; a6[v28] = v27; a6[v28 + 1] = v50; @@ -887,11 +903,11 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v33 = v10; v39 = a4; do { - v34 = Ligne[v39].fieldC; - v35 = (int16)READ_LE_UINT16(v34 + 4 * v33); - v50 = (int16)READ_LE_UINT16(v34 + 4 * v33 + 2); - v36 = v40; + v34 = Ligne[v39].lineData; + v35 = v34[2 * v33]; + v50 = v34[2 * v33 + 1]; + v36 = v40; a6[v36] = v35; a6[v36 + 1] = v50; a6[v36 + 2] = Ligne[v39].field6; @@ -903,9 +919,10 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v29 = v10; v38 = a4; do { - v30 = Ligne[v38].fieldC; - v31 = (int16)READ_LE_UINT16(v30 + 4 * v29); - v50 = (int16)READ_LE_UINT16(v30 + 4 * v29 + 2); + v30 = Ligne[v38].lineData; + v31 = v30[2 * v29]; + v50 = v30[2 * v29 + 1]; + v32 = v40; a6[v32] = v31; a6[v32 + 1] = v50; @@ -1232,13 +1249,13 @@ LABEL_186: int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { int v9; - byte *v10; + int16 *v10; int v11; - byte *v12; - byte *v13; + int16 *v12; + int16 *v13; int v14; int v15; - byte *v16; + int16 *v16; int v17; int v18; int v19; @@ -1250,7 +1267,7 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int v25; int v26; int v27; - byte *v28; + int16 *v28; int v29; int v30; int v31; @@ -1335,62 +1352,65 @@ LABEL_112: a8[v9 + 2] = -1; return -1; } - v10 = Ligne[a1].fieldC; - v98 = (int16)READ_LE_UINT16(v10); - v97 = (int16)READ_LE_UINT16(v10 + 2); + v10 = Ligne[a1].lineData; + v98 = v10[0]; + v97 = v10[1]; v92 = a1; while (1) { v86 = v92 - 1; v11 = 2 * Ligne[v92 - 1].field0; - v12 = Ligne[v92 - 1].fieldC; - if (v12 == g_PTRNUL) + + v12 = Ligne[v92 - 1].lineData; + if (v12 == (int16 *)g_PTRNUL) break; - while ((int16)READ_LE_UINT16(v12 + 2 * v11 - 4) != v98 || v97 != (int16)READ_LE_UINT16(v12 + 2 * v11 - 2)) { + while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) { --v86; if (_vm->_objectsManager.DERLIGNE - 1 != v86) { v11 = 2 * Ligne[v86].field0; - v12 = Ligne[v86].fieldC; - if (v12 != g_PTRNUL) + v12 = Ligne[v86].lineData; + if (v12 != (int16 *)g_PTRNUL) continue; } goto LABEL_11; } + v92 = v86; - v98 = (int16)READ_LE_UINT16(v12); - v97 = (int16)READ_LE_UINT16(v12 + 2); + v98 = v12[0]; + v97 = v12[1]; } LABEL_11: - v13 = Ligne[a1].fieldC; + v13 = Ligne[a1].lineData; v14 = 2 * Ligne[a1].field0; - v95 = (int16)READ_LE_UINT16(v13 + 2 * v14 - 4); - v93 = (int16)READ_LE_UINT16(v13 + 2 * v14 - 2); + v95 = v13[v14 - 2]; + v93 = v13[v14 - 1]; v91 = a1; - while (1) { + + for (;;) { v87 = v91 + 1; v15 = 2 * Ligne[v91 + 1].field0; - v16 = Ligne[v91 + 1].fieldC; - if (g_PTRNUL == v16) + v16 = Ligne[v91 + 1].lineData; + if (v16 == (int16 *)g_PTRNUL) break; while (1) { v65 = v15; - v17 = (int16)READ_LE_UINT16(v16 + 2 * v15 - 4); - if ((int16)READ_LE_UINT16(v16) == v95) { - if (v93 == (int16)READ_LE_UINT16(v16 + 2)) + v17 = v16[v15 - 2]; + if (v16[0] == v95) { + if (v93 == v16[1]) break; } ++v87; if (v87 != TOTAL_LIGNES + 1) { v15 = 2 * Ligne[v87].field0; - v16 = Ligne[v87].fieldC; - if (v16 != g_PTRNUL) + v16 = Ligne[v87].lineData; + if (v16 != (int16 *)g_PTRNUL) continue; } goto LABEL_17; } v91 = v87; v95 = v17; - v93 = (int16)READ_LE_UINT16(v16 + 2 * v65 - 2); + v93 = v16[v65 - 1]; } LABEL_17: v18 = a3 - a5; @@ -1422,6 +1442,7 @@ LABEL_17: if (v85 + 1 > 0) { v51 = _vm->_globals.BufLig; do { +error("v51 is an array, not an int"); v24 = v23; *((uint16 *)v51 + v24) = v82; *((uint16 *)v51 + v24 + 1) = v81; @@ -1455,15 +1476,15 @@ LABEL_17: } for (i = v92; i < v91 + 1; ++i) { v27 = 2 * Ligne[i].field0; - v28 = Ligne[i].fieldC; - if (g_PTRNUL == v28) - error("erreur dans da routine genial"); - v29 = *(uint16 *)v28; - v30 = (int16)READ_LE_UINT16(v28 + 2); - v59 = (int16)READ_LE_UINT16(v28 + 2); + v28 = Ligne[i].lineData; + if (v28 == (int16 *)g_PTRNUL) + error("error in genial routine"); + v29 = v28[0]; + v30 = v28[1]; + v59 = v28[1]; v31 = v27; - v32 = (int16)READ_LE_UINT16(v28 + 2 * v27 - 4); - v33 = (int16)READ_LE_UINT16(v28 + 2 * v31 - 2); + v32 = v28[v27 - 2]; + v33 = v28[v31 - 1]; if (i == v92) { v72 = v33; if (v30 <= v33) @@ -1727,32 +1748,32 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v67; int v68; int i; - byte *v70; + int16 *v70; int v71; int v72; int j; - byte *v74; + int16 *v74; int v75; int v76; int v77; int v78; int v79; int v80; - byte *v81; + int16 *v81; int v82; int v83; - byte *v84; + int16 *v84; int v85; int v86; int v87; int v88; int v89; int v90; - byte *v91; + int16 *v91; int v92; int v93; int v94; - byte *v95; + int16 *v95; int v96; int v97; int v98; @@ -2248,9 +2269,9 @@ LABEL_201: LABEL_234: if (v115 < v121) { for (i = v114; Ligne[v115].field0 > i; ++i) { - v70 = Ligne[v115].fieldC; - v119 = (int16)READ_LE_UINT16(v70 + 4 * i); - v118 = (int16)READ_LE_UINT16(v70 + 4 * i + 2); + v70 = Ligne[v115].lineData; + v119 = v70[2 * i]; + v118 = v70[2 * i + 1]; v71 = v112; _vm->_globals.super_parcours[v71] = v119; _vm->_globals.super_parcours[v71 + 1] = v118; @@ -2264,9 +2285,9 @@ LABEL_234: v72 = 0; v110 = v116; for (j = v116; Ligne[j].field0 > v72; j = v116) { - v74 = Ligne[v110].fieldC; - v119 = (int16)READ_LE_UINT16(v74 + 4 * v72); - v118 = (int16)READ_LE_UINT16(v74 + 4 * v72 + 2); + v74 = Ligne[v110].lineData; + v119 = v74[2 * v72]; + v118 = v74[2 * v72 + 1]; v75 = v112; _vm->_globals.super_parcours[v75] = v119; _vm->_globals.super_parcours[v75 + 1] = v118; @@ -2314,9 +2335,10 @@ LABEL_200: if (v114 > 0) { v98 = v115; do { - v81 = Ligne[v98].fieldC; - v119 = (int16)READ_LE_UINT16(v81 + 4 * v80); - v118 = (int16)READ_LE_UINT16(v81 + 4 * v80 + 2); + v81 = Ligne[v98].lineData; + v119 = v81[2 * v80]; + v118 = v81[2 * v80 + 1]; + v82 = v112; _vm->_globals.super_parcours[v82] = v119; _vm->_globals.super_parcours[v82 + 1] = v118; @@ -2333,9 +2355,9 @@ LABEL_200: if (v83 > -1) { v109 = v117; do { - v84 = Ligne[v109].fieldC; - v119 = (int16)READ_LE_UINT16(v84 + 4 * v83); - v118 = (int16)READ_LE_UINT16(v84 + 4 * v83 + 2); + v84 = Ligne[v109].lineData; + v119 = v84[2 * v83]; + v118 = v84[2 * v83 + 1]; v85 = v112; _vm->_globals.super_parcours[v85] = v119; _vm->_globals.super_parcours[v85 + 1] = v118; @@ -2379,10 +2401,10 @@ LABEL_200: v94 = v114; v100 = v121; do { - v95 = Ligne[v100].fieldC;; - v96 = (int16)READ_LE_UINT16(v95 + 4 * v94 + 2); + v95 = Ligne[v100].lineData; + v96 = v95[2 * v94 + 1]; v97 = v112; - _vm->_globals.super_parcours[v97] = (int16)READ_LE_UINT16(v95 + 4 * v94); + _vm->_globals.super_parcours[v97] = v95[2 * v94]; _vm->_globals.super_parcours[v97 + 1] = v96; _vm->_globals.super_parcours[v97 + 2] = Ligne[v100].field6; _vm->_globals.super_parcours[v97 + 3] = 0; @@ -2394,10 +2416,10 @@ LABEL_200: v90 = v114; v99 = v121; do { - v91 = Ligne[v99].fieldC; - v92 = (int16)READ_LE_UINT16(v91 + 4 * v90 + 2); + v91 = Ligne[v99].lineData; + v92 = v91[2 * v90 + 1]; v93 = v112; - _vm->_globals.super_parcours[v93] = (int16)READ_LE_UINT16(v91 + 4 * v90); + _vm->_globals.super_parcours[v93] = v91[2 * v90]; _vm->_globals.super_parcours[v93 + 1] = v92; _vm->_globals.super_parcours[v93 + 2] = Ligne[v99].field8; _vm->_globals.super_parcours[v93 + 3] = 0; @@ -3593,12 +3615,12 @@ int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { int v12; int v13; int v14; - byte *v15; + int16 *v15; int v16; int v17; int v18; int v19; - byte *v20; + int16 *v20; int v21; int v22; int v23; @@ -3741,9 +3763,9 @@ LABEL_60: v32 = v34; v25 = _vm->_globals.essai0; do { - v15 = Ligne[v32].fieldC; - v16 = (int16)READ_LE_UINT16(v15 + 4 * v14); - v29 = (int16)READ_LE_UINT16(v15 + 4 * v14 + 2); + v15 = Ligne[v32].lineData; + v16 = v15[2 * v14]; + v29 = v15[2 * v14 + 1]; if (!a6) { v17 = v41; _vm->_globals.super_parcours[v17] = v16; @@ -3769,9 +3791,9 @@ LABEL_60: v31 = v34; v26 = _vm->_globals.essai0; do { - v20 = Ligne[v31].fieldC; - v21 = (int16)READ_LE_UINT16(v20 + 4 * v19); - v30 = (int16)READ_LE_UINT16(v20 + 4 * v19 + 2); + v20 = Ligne[v31].lineData; + v21 = v20[2 * v19]; + v30 = v20[2 * v19 + 1]; if (a6) { v23 = v41; v26[v23] = v21; @@ -3797,17 +3819,17 @@ LABEL_60: int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { int i; int v6; - byte *v7; + int16 *v7; int v8; int v9; int v10; int v11; - byte *v12; + int16 *v12; int v13; int v14; int v15; int v16; - byte *v17; + int16 *v17; int v18; int v19; int v20; @@ -3824,11 +3846,11 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { v25 = _vm->_objectsManager.DERLIGNE + 1; for (i = (int)(_vm->_objectsManager.DERLIGNE + 1); i < _vm->_linesManager.TOTAL_LIGNES + 1; i = v25) { v6 = i; - v7 = Ligne[i].fieldC; + v7 = Ligne[i].lineData; v8 = Ligne[v6].field0; - v23 = (int16)READ_LE_UINT16(v7 + 4 * v8 - 4); - v9 = (int16)READ_LE_UINT16(v7 + 4 * v8 - 2); - if (*v7 == a1 && a2 == (int16)READ_LE_UINT16(v7 + 2)) { + v23 = v7[2 * v8 - 2]; + v9 = v7[2 * v8 - 1]; + if (v7[0] == a1 && a2 == v7[1]) { v24 = v25; v26 = 1; *a3 = 1; @@ -3848,9 +3870,9 @@ LABEL_12: if (*a3 == 1) { v10 = v24; v11 = Ligne[v10].field0; - v12 = Ligne[v10].fieldC; - v13 = (int16)READ_LE_UINT16(v12 + 4 * v11 - 4); - v14 = (int16)READ_LE_UINT16(v12 + 4 * v11 - 2); + v12 = Ligne[v10].lineData; + v13 = v12[2 * v11 - 2]; + v14 = v12[2 * v11 - 1]; v15 = Ligne[v10].field6; if (v15 == 5 || v15 == 1) v14 += 2; @@ -3863,9 +3885,9 @@ LABEL_12: *a5 = v28; } if (v26 == 1 && *a3 == 2) { - v17 = Ligne[v25].fieldC; - v18 = *v17; - v19 = (int16)READ_LE_UINT16(v17 + 2); + v17 = Ligne[v25].lineData; + v18 = v17[0]; + v19 = v17[1]; v20 = Ligne[v24].field6; if (v20 == 5 || v20 == 1) v19 -= 2; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index da9c897c28..f02cc4c427 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -42,7 +42,7 @@ struct LigneItem { int field4; int field6; int field8; - byte *fieldC; + int16 *lineData; }; struct SmoothItem { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index f7e72b0cef..100f836542 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3581,28 +3581,28 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v34; int v35; int i; - byte *v37; + int16 *v37; int v38; int v39; int v40; - byte *v41; + int16 *v41; int v42; int v43; int k; - byte *v45; + int16 *v45; int v46; int v47; int v48; int v49; - byte *v50; + int16 *v50; int v51; int v52; int v53; - byte *v54; + int16 *v54; int v55; int v56; int v57; - byte *v58; + int16 *v58; int v59; int v60; int v61; @@ -3820,9 +3820,9 @@ LABEL_90: v34 = v68; v35 = v68; for (i = _vm->_linesManager.Ligne[v69].field0; v35 < (i - 2); i = _vm->_linesManager.Ligne[v69].field0) { - v37 = _vm->_linesManager.Ligne[v69].fieldC; - v38 = (int16)READ_LE_UINT16(v37 + 4 * v35); - int v37_2 = (int16)READ_LE_UINT16(v37 + 4 * v35 + 2); + v37 = _vm->_linesManager.Ligne[v69].lineData; + v38 = v37[2 * v35]; + int v37_2 = v37[2 * v35 + 1]; v39 = v67; _vm->_globals.super_parcours[v39] = v38; _vm->_globals.super_parcours[v39 + 1] = v37_2; @@ -3834,8 +3834,8 @@ LABEL_90: } for (j = v69 + 1; j < v73; ++j) { if (_vm->_linesManager.PLAN_TEST( - (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC), - (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[j].fieldC + 2), + _vm->_linesManager.Ligne[j].lineData[0], + _vm->_linesManager.Ligne[j].lineData[1], v67, j, v73, @@ -3850,9 +3850,9 @@ LABEL_88: v40 = 0; if (_vm->_linesManager.Ligne[j].field0 - 2 > 0) { do { - v41 = _vm->_linesManager.Ligne[j].fieldC; - v42 = (int16)READ_LE_UINT16(v41 + 4 * v40); - int v41_2 = (int16)READ_LE_UINT16(v41 + 4 * v40 + 2); + v41 = _vm->_linesManager.Ligne[j].lineData; + v42 = v41[2 * v40]; + int v41_2 = v41[2 * v40 + 1]; v43 = v67; _vm->_globals.super_parcours[v43] = v42; _vm->_globals.super_parcours[v43 + 1] = v41_2; @@ -3868,9 +3868,9 @@ LABEL_88: } if (v69 > v73) { for (k = v68; k > 0; --k) { - v45 = _vm->_linesManager.Ligne[v69].fieldC; - v46 = (int16)READ_LE_UINT16(v45 + 4 * k); - int v45_2 = (int16)READ_LE_UINT16(v45 + 4 * k + 2); + v45 = _vm->_linesManager.Ligne[v69].lineData; + v46 = v45[2 * k]; + int v45_2 = v45[2 * k + 1]; v47 = v67; _vm->_globals.super_parcours[v47] = v46; _vm->_globals.super_parcours[v47 + 1] = v45_2; @@ -3881,8 +3881,8 @@ LABEL_88: for (l = v69 - 1; l > v73; --l) { v48 = l; if (_vm->_linesManager.PLAN_TEST( - (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 4), - (int16)READ_LE_UINT16(_vm->_linesManager.Ligne[l].fieldC + 4 * _vm->_linesManager.Ligne[v48].field0 - 2), + _vm->_linesManager.Ligne[l].lineData[2 * _vm->_linesManager.Ligne[v48].field0 - 2], + _vm->_linesManager.Ligne[l].lineData[2 * _vm->_linesManager.Ligne[v48].field0 - 1], v67, l, v73, @@ -3891,9 +3891,9 @@ LABEL_88: v49 = _vm->_linesManager.Ligne[v48].field0 - 2; if ((_vm->_linesManager.Ligne[v48].field0 - 2) > 0) { do { - v50 = _vm->_linesManager.Ligne[l].fieldC; - v51 = (int16)READ_LE_UINT16(v50 + 4 * v49); - int v50_2 = (int16)READ_LE_UINT16(v50 + 4 * v49 + 2); + v50 = _vm->_linesManager.Ligne[l].lineData; + v51 = v50[2 * v49]; + int v50_2 = v50[2 * v49 + 1]; v52 = v67; _vm->_globals.super_parcours[v52] = v51; _vm->_globals.super_parcours[v52 + 1] = v50_2; @@ -3912,9 +3912,9 @@ LABEL_88: if (v68 < v72) { v57 = v68; do { - v58 = _vm->_linesManager.Ligne[v73].fieldC; - v59 = (int16)READ_LE_UINT16(v58 + 4 * v57); - int v58_2 = (int16)READ_LE_UINT16(v58 + 4 * v57 + 2); + v58 = _vm->_linesManager.Ligne[v73].lineData; + v59 = v58[2 * v57]; + int v58_2 = v58[2 * v57 + 1]; v60 = v67; _vm->_globals.super_parcours[v60] = v59; _vm->_globals.super_parcours[v60 + 1] = v58_2; @@ -3927,9 +3927,9 @@ LABEL_88: } else { v53 = v68; do { - v54 = _vm->_linesManager.Ligne[v73].fieldC; - v55 = (int16)READ_LE_UINT16(v54 + 4 * v53); - int v54_2 = (int16)READ_LE_UINT16(v54 + 4 * v53 + 2); + v54 = _vm->_linesManager.Ligne[v73].lineData; + v55 = v54[2 * v53]; + int v54_2 = v54[2 * v53 + 1]; v56 = v67; _vm->_globals.super_parcours[2 * v56] = v55; _vm->_globals.super_parcours[2 * v56 + 1] = v54_2; -- cgit v1.2.3 From 3e2063c65fb2903fd033730afa65b01ce0d9f5e6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Oct 2012 17:06:57 +1100 Subject: HOPKINS: Converted BufLig buffer to int16 array --- engines/hopkins/globals.cpp | 4 ++-- engines/hopkins/globals.h | 2 +- engines/hopkins/lines.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 35d1e61115..61a3bc9594 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -341,7 +341,7 @@ void Globals::clearAll() { essai0 = (int16 *)g_PTRNUL; essai1 = (int16 *)g_PTRNUL; essai2 = (int16 *)g_PTRNUL; - BufLig = g_PTRNUL; + BufLig = (int16 *)g_PTRNUL; chemin = g_PTRNUL; for (int idx = 0; idx < 400; ++idx) { @@ -371,7 +371,7 @@ void Globals::clearAll() { essai0 = (int16 *)BUFFERTAPE; essai1 = (int16 *)(BUFFERTAPE + 25000); essai2 = (int16 *)(BUFFERTAPE + 50000); - BufLig = (BUFFERTAPE + 75000); + BufLig = (int16 *)(BUFFERTAPE + 75000); largeur_boite = 240; TEXTE_FORMATE = 300; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a3b9347de5..cd9f4ac265 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -375,7 +375,7 @@ public: byte *COUCOU; byte *chemin; byte *cache_souris; - byte *BufLig; + int16 *BufLig; byte *Bufferdecor; byte *ADR_FICHIER_OBJ; byte *PERSO; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 968bfe8e64..9ff0710541 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1289,7 +1289,7 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int v48 = 0; int v49 = 0; int v50; - void *v51; + int16 *v51; int v52; int v53; int v54; @@ -1436,16 +1436,16 @@ LABEL_17: v83 = -v83; if (v85 > 800) v85 = 800; - memset(_vm->_globals.BufLig, 0, 0x7D0u); + + Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0); v23 = 0; v88 = 0; if (v85 + 1 > 0) { v51 = _vm->_globals.BufLig; do { -error("v51 is an array, not an int"); v24 = v23; - *((uint16 *)v51 + v24) = v82; - *((uint16 *)v51 + v24 + 1) = v81; + v51[v24] = v82; + v51[v24 + 1] = v81; v21 += v84; v22 += v83; v82 = v21 / 1000; @@ -1459,8 +1459,8 @@ error("v51 is an array, not an int"); v89 = v85 + 1; if ((int)(v85 + 1) > 0) { do { - v96 = (int16)READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25); - v94 = (int16)READ_LE_UINT16((uint16 *)_vm->_globals.BufLig + v25 + 1); + v96 = _vm->_globals.BufLig[v25]; + v94 = _vm->_globals.BufLig[v25 + 1]; if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { v80 = v100; v77 = v101; -- cgit v1.2.3 From 6aa3201fdd600d79ec876adda5b7293be660efb0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Oct 2012 17:47:57 +1100 Subject: HOPKINS: Converted the chemin data block to an int16 array --- engines/hopkins/globals.cpp | 3 +- engines/hopkins/globals.h | 2 +- engines/hopkins/lines.cpp | 28 +++--- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 206 +++++++++++++++++++++++--------------------- engines/hopkins/objects.h | 4 +- 6 files changed, 127 insertions(+), 118 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 61a3bc9594..46b7eb3756 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -260,7 +260,6 @@ Globals::~Globals() { dos_free2(INVENTAIRE_OBJET); dos_free2(FORETSPR); dos_free2(COUCOU); - dos_free2(chemin); dos_free2(cache_souris); dos_free2(Bufferdecor); dos_free2(ADR_FICHIER_OBJ); @@ -342,7 +341,7 @@ void Globals::clearAll() { essai1 = (int16 *)g_PTRNUL; essai2 = (int16 *)g_PTRNUL; BufLig = (int16 *)g_PTRNUL; - chemin = g_PTRNUL; + chemin = (int16 *)g_PTRNUL; for (int idx = 0; idx < 400; ++idx) { _vm->_linesManager.Ligne[idx].field0 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index cd9f4ac265..263baafc19 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -373,7 +373,7 @@ public: byte *FORETSPR; int FORET; byte *COUCOU; - byte *chemin; + int16 *chemin; byte *cache_souris; int16 *BufLig; byte *Bufferdecor; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 9ff0710541..550cabd168 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1683,7 +1683,7 @@ LABEL_17: // TODO: method casting int arrays as byte pointers. Double-check later whether // we can convert the return to a uint16 * -byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { +int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v4; int v5; int v6; @@ -1836,7 +1836,7 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v7 < 0) v7 = -v7; if (v7 <= 4) - return g_PTRNUL; + return (int16 *)g_PTRNUL; } } } @@ -1848,10 +1848,10 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v9 < 0) v9 = -v9; if (v9 <= 4) - return g_PTRNUL; + return (int16 *)g_PTRNUL; } if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) - return g_PTRNUL; + return (int16 *)g_PTRNUL; } _vm->_globals.NOT_VERIF = 0; _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; @@ -1877,7 +1877,7 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v11 < 0) v11 = -v11; if (v11 <= 3) - return g_PTRNUL; + return (int16 *)g_PTRNUL; } for (v12 = 0; v12 <= 8; ++v12) { @@ -1992,7 +1992,7 @@ byte *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v141[4] < 0) v131[4] = 1300; if (v141[1] == -1 && v141[2] == -1 && v141[3] == -1 && v141[4] == -1) - return g_PTRNUL; + return (int16 *)g_PTRNUL; v31 = 0; if (v141[3] != -1 && v131[1] >= v131[3] && v131[2] >= v131[3] && v131[4] >= v131[3]) { v121 = v141[3]; @@ -2302,7 +2302,7 @@ LABEL_234: if (v72 == v77) { v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); if (v78 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; + return &_vm->_globals.super_parcours[0]; if (v78 == 2) goto LABEL_200; if (MIRACLE(v119, v118, v110, v121, v112) == 1) @@ -2314,7 +2314,7 @@ LABEL_234: } v79 = PARC_PERS(v119, v118, v123, v122, v116, v121, v112); if (v79 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; + return &_vm->_globals.super_parcours[0]; if (v79 == 2) { LABEL_200: v115 = NV_LIGNEDEP; @@ -2372,7 +2372,7 @@ LABEL_200: if (v83 == v87) { v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); if (v88 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; + return &_vm->_globals.super_parcours[0]; if (v88 == 2) goto LABEL_200; if (MIRACLE(v119, v118, v117, v121, v112) == 1) @@ -2384,7 +2384,7 @@ LABEL_200: } v89 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); if (v89 == 1) - return (byte *)&_vm->_globals.super_parcours[0]; + return &_vm->_globals.super_parcours[0]; if (v89 == 2) goto LABEL_200; if (MIRACLE(v119, v118, v117, v121, v112) == 1) @@ -2443,10 +2443,10 @@ LABEL_282: _vm->_globals.super_parcours[v57 + 2] = -1; _vm->_globals.super_parcours[v57 + 3] = -1; } - return (byte *)&_vm->_globals.super_parcours[0]; + return &_vm->_globals.super_parcours[0]; } } - return (byte *)&_vm->_globals.super_parcours[0]; + return &_vm->_globals.super_parcours[0]; } int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { @@ -3072,7 +3072,7 @@ LABEL_323: return 2; } v80 = _vm->_globals.essai1; - if ((int16)READ_LE_UINT16(_vm->_globals.essai1) != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { + if (_vm->_globals.essai1[0] != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v131 = 0; @@ -3093,7 +3093,7 @@ LABEL_301: return 2; } v82 = _vm->_globals.essai2; - if ((int16)READ_LE_UINT16(_vm->_globals.essai2) != -1) { + if (_vm->_globals.essai2[0] != -1) { if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index f02cc4c427..5da48bc1c4 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -85,7 +85,7 @@ public: int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); int MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); - byte *PARCOURS2(int a1, int a2, int a3, int a4); + int16 *PARCOURS2(int a1, int a2, int a3, int a4); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); int SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 100f836542..d53e302488 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1777,7 +1777,7 @@ void ObjectsManager::VERIFZONE() { v3 = _vm->_globals.compteur_71 + 1; _vm->_globals.compteur_71 = v3; if (v3 > 1u) { - if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == g_PTRNUL) || v3 > 4u) { + if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || v3 > 4u) { _vm->_globals.compteur_71 = 0; if (_vm->_globals.old_x_69 != v0 || _vm->_globals.old_y_70 != v2) { v4 = MZONE(); @@ -1917,7 +1917,7 @@ void ObjectsManager::GOHOME() { v58 = 0; v1 = 0; - if (_vm->_globals.chemin == g_PTRNUL) + if (_vm->_globals.chemin == (int16 *)g_PTRNUL) return; if (_vm->_globals.Compteur > 1) { --_vm->_globals.Compteur; @@ -1926,15 +1926,19 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (g_old_sens == -1) { VERIFTAILLE(); - nouveau_x = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - v53 = (int16)READ_LE_UINT16(_vm->_globals.chemin); - nouveau_y = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - nouveau_sens = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - nouveau_anim = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; + nouveau_x = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + v53 = *_vm->_globals.chemin; + nouveau_y = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_sens = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_anim = *_vm->_globals.chemin; + _vm->_globals.chemin++; + if (nouveau_x != -1 || v53 != -1) { _vm->_globals.g_old_sens = nouveau_sens; _vm->_globals.g_old_sens2 = nouveau_sens; @@ -1948,11 +1952,11 @@ void ObjectsManager::GOHOME() { v54 = _vm->_globals.SAUVEGARDE->data[svField2]; else v54 = NUMZONE; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); SETFLIPSPR(0, 0); _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.g_old_sens = -1; if (v54 > 0) { v55 = v54; @@ -2272,15 +2276,18 @@ LABEL_152: LABEL_153: v47 = 0; do { - nouveau_x = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - v48 = (int16)READ_LE_UINT16(_vm->_globals.chemin); - nouveau_y = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - nouveau_sens = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - nouveau_anim = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; + nouveau_x = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + v48 = *_vm->_globals.chemin; + nouveau_y = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_sens = *_vm->_globals.chemin; + _vm->_globals.chemin++; + nouveau_anim = *_vm->_globals.chemin; + _vm->_globals.chemin++; + if (nouveau_x == -1 && v48 == -1) { if (GOACTION == 1) v49 = _vm->_globals.SAUVEGARDE->data[svField2]; @@ -2288,7 +2295,7 @@ LABEL_153: v49 = NUMZONE; SETANISPR(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); SETFLIPSPR(0, 0); _vm->_globals.Compteur = 0; @@ -2388,7 +2395,7 @@ void ObjectsManager::GOHOME2() { __int16 v2; v0 = 2; - if (_vm->_globals.chemin != g_PTRNUL) { + if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { if (_vm->_globals.vitesse == 2) v0 = 4; if (_vm->_globals.vitesse == 3) @@ -2396,15 +2403,17 @@ void ObjectsManager::GOHOME2() { _vm->_globals.j_104 = 0; if (v0) { while (1) { - nouveau_x = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - v2 = (int16)READ_LE_UINT16(_vm->_globals.chemin); - nouveau_y = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - nouveau_sens = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; - nouveau_anim = (int16)READ_LE_UINT16(_vm->_globals.chemin); - _vm->_globals.chemin += 2; + nouveau_x = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + v2 = *_vm->_globals.chemin; + nouveau_y = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_sens = *_vm->_globals.chemin; + _vm->_globals.chemin++; + nouveau_anim = *_vm->_globals.chemin; + _vm->_globals.chemin++; if (nouveau_x == -1) { if (v2 == -1) @@ -2423,7 +2432,7 @@ void ObjectsManager::GOHOME2() { if (_vm->_globals.last_sens == 7) SETANISPR(0, 3); - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; my_anim = 0; A_ANIM = 0; A_DEPA = 0; @@ -2715,7 +2724,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.SCROLL_ECRAN(v3 - 320); _vm->_graphicsManager.ofscroll = XSPR(0) - 320; SPRITE_ON(0); - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -2759,7 +2768,7 @@ void ObjectsManager::PLAN_BETA() { VERIFZONE(); GOHOME2(); - if (_vm->_globals.chemin == g_PTRNUL && _vm->_globals.GOACTION == 1) + if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION == 1) PARADISE(); _vm->_eventsManager.VBL(); @@ -2787,19 +2796,19 @@ void ObjectsManager::BTGAUCHE() { int v1; int v2; int16 *v3; - byte *v4; + int16 *v4; int16 *v5; int v6; int v7; int v8; - byte *v9; + int16 *v9; int v10; int v11; int v12; - byte *v13; + int16 *v13; int v14; int v15; - byte *v16; + int16 *v16; int v17; int v18; int v19; @@ -2859,9 +2868,9 @@ void ObjectsManager::BTGAUCHE() { v3 = _vm->_globals.essai2; v4 = _vm->_globals.chemin; do { - v3[v2] = READ_LE_UINT16(v4 + 2 * v2); + v3[v2] = v4[v2]; ++v2; - } while ((int16)READ_LE_UINT16(v4 + 2 * v2) != -1); + } while (v4[v2] != -1); v5 = _vm->_globals.essai2; v5[v2] = -1; @@ -2893,7 +2902,7 @@ LABEL_38: } GOACTION = 0; v9 = _vm->_globals.chemin; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (YSPR(0) <= 374 || YSPR(0) > 410) { v10 = XSPR(0); @@ -2901,22 +2910,22 @@ LABEL_38: v12 = XSPR(0); v13 = _vm->_linesManager.PARCOURS2(v12, v11, v10, 390); _vm->_globals.chemin = v13; - if (g_PTRNUL != v13) + if (v13 != (int16 *)g_PTRNUL) PACOURS_PROPRE(v13); g_old_x = XSPR(0); g_old_y = YSPR(0); _vm->_globals.Compteur = 0; - if (g_PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) { + if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) { LABEL_64: _vm->_globals.g_old_sens = -1; goto LABEL_65; } goto LABEL_63; } - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; SETANISPR(0, _vm->_globals.g_old_sens2 + 59); _vm->_globals.ACTION_SENS = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); SETFLIPSPR(0, 0); _vm->_globals.Compteur = 0; @@ -2929,12 +2938,12 @@ LABEL_64: v15 = XSPR(0); v16 = _vm->_linesManager.PARCOURS2(v15, v14, v19, v0); _vm->_globals.chemin = v16; - if (g_PTRNUL != v16) + if (v16 != (int16 *)g_PTRNUL) PACOURS_PROPRE(v16); g_old_x = XSPR(0); g_old_y = YSPR(0); _vm->_globals.Compteur = 0; - if (g_PTRNUL != _vm->_globals.chemin || v9 == _vm->_globals.chemin) + if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) goto LABEL_64; LABEL_63: _vm->_globals.chemin = v9; @@ -2965,7 +2974,7 @@ LABEL_65: } if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; XSPR(0); YSPR(0); } @@ -3118,7 +3127,7 @@ void ObjectsManager::CLEAR_ECRAN() { FORCEZONE = 1; _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.COUCOU != g_PTRNUL) _vm->_globals.COUCOU = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.COUCOU); if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) @@ -3132,7 +3141,7 @@ void ObjectsManager::CLEAR_ECRAN() { FORCEZONE = 1; CHANGEVERBE = 0; _vm->_globals.NOSPRECRAN = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; g_old_sens = -1; my_anim = 1; A_ANIM = 0; @@ -3353,7 +3362,7 @@ void ObjectsManager::CHANGE_TETE(int a1, int a2) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, 532, 25, 65, 40, _vm->_graphicsManager.VESA_BUFFER, 532, 25); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; if (a1 == 2) { if (!a2) { if (_vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { @@ -3474,7 +3483,7 @@ void ObjectsManager::VERIFTAILLE() { SETTAILLESPR(0, v0); } -void ObjectsManager::PACOURS_PROPRE(byte *a1) { +void ObjectsManager::PACOURS_PROPRE(int16 *a1) { int v1; int v2; int v4; @@ -3493,36 +3502,36 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { v1 = 0; v13 = 0; v14 = -1; - v2 = (int16)READ_LE_UINT16(a1 + 2); - v15 = (int16)READ_LE_UINT16(a1 + 4); - if ((int16)READ_LE_UINT16(a1) != -1 || v2 != -1) { - while (1) { + v2 = a1[1]; + v15 = a1[2]; + if (a1[0] != -1 || v2 != -1) { + for (;;) { if (v14 != -1 && v15 != v14) { v11 = v1; v12 = 0; v10 = CALC_PROPRE(v2); - v4 = (int16)READ_LE_UINT16(a1 + 2 * v1); - v9 = (int16)READ_LE_UINT16(a1 + 2 * v1); - v5 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 2); + v4 = a1[v1]; + v9 = a1[v1]; + v5 = a1[v1 + 1]; v6 = 0; while (v4 != -1 || v5 != -1) { int idx = v1; v1 += 4; ++v12; - if ((int16)READ_LE_UINT16(a1 + 2 * idx + 4) != v15) + if (a1[idx + 2] != v15) v6 = 1; if (v6 == 1) break; - v4 = (int16)READ_LE_UINT16(a1 + 2 * v1); - v9 = (int16)READ_LE_UINT16(a1 + 2 * v1); - v5 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 2); + v4 = a1[v1]; + v9 = a1[v1]; + v5 = a1[v1 + 1]; } if (v12 < v10) { v7 = v11; v8 = 0; if (v12 > 0) { do { - WRITE_LE_UINT16(a1 + 2 * v7 + 4, v14); + a1[v7 + 2] = v14; v7 += 4; ++v8; } while (v12 > v8); @@ -3537,9 +3546,9 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { if (v13 == 1) break; v14 = v15; - v2 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 2); - v15 = (int16)READ_LE_UINT16(a1 + 2 * v1 + 4); - if ((int16)READ_LE_UINT16(a1 + 2 * v1) == -1) { + v2 = a1[v1 + 1]; + v15 = a1[v1 + 2]; + if (a1[v1] == -1) { if (v2 == -1) break; } @@ -3547,7 +3556,7 @@ void ObjectsManager::PACOURS_PROPRE(byte *a1) { } } -byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { +int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v4; int v5; int v6; @@ -3566,7 +3575,7 @@ byte *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v19; int v20; int v21; - byte *result; + int16 *result; int v23; int v24; int v25; @@ -3945,9 +3954,9 @@ LABEL_88: _vm->_globals.super_parcours[v61 + 1] = -1; _vm->_globals.super_parcours[v61 + 2] = -1; _vm->_globals.super_parcours[v61 + 3] = -1; - result = (byte *)&_vm->_globals.super_parcours[0]; + result = &_vm->_globals.super_parcours[0]; } else { - result = g_PTRNUL; + result = (int16 *)g_PTRNUL; } return result; } @@ -5450,7 +5459,7 @@ LABEL_1141: } if (v76 == 46) { _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; v13 = YSPR(0); v14 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); @@ -5458,7 +5467,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SPRITE_OFF(0); _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); @@ -5521,7 +5530,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; v16 = YSPR(0); v17 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); @@ -5529,7 +5538,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SPRITE_OFF(0); BOBANIM_ON(7); SET_BOBPOSI(7, 0); @@ -5641,7 +5650,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; v22 = YSPR(0); v23 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); @@ -5649,7 +5658,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SPRITE_OFF(0); BOBANIM_ON(11); BOBANIM_ON(8); @@ -5863,7 +5872,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { v27 = YSPR(0); v28 = XSPR(0); @@ -5883,7 +5892,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SPRITE_OFF(0); SETANISPR(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); @@ -6071,7 +6080,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 0; } _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; v37 = YSPR(0); v38 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); @@ -6080,7 +6089,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SETANISPR(0, 64); _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; _vm->_globals.DESACTIVE_INVENT = 0; @@ -6096,7 +6105,7 @@ LABEL_1141: while (BOBPOSI(1) != 9); BOBANIM_OFF(1); _vm->_globals.NO_VISU = 1; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v39 = YSPR(0); v40 = XSPR(0); @@ -6106,7 +6115,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SETANISPR(0, 64); BOBANIM_ON(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); @@ -6220,7 +6229,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v43 = YSPR(0); v44 = XSPR(0); @@ -6229,7 +6238,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SPRITE_OFF(0); v45 = 0; BOBANIM_ON(7); @@ -6707,7 +6716,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v55 = YSPR(0); v56 = XSPR(0); @@ -6717,7 +6726,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_globals.SORTIE = 59; } if (v76 == 173) { @@ -6728,7 +6737,7 @@ LABEL_1141: g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v57 = YSPR(0); v58 = XSPR(0); @@ -6738,7 +6747,7 @@ LABEL_1141: do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_globals.SORTIE = 59; } if (v76 == 174) @@ -8207,7 +8216,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.PLAN_FLAG = 0; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = 1; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; @@ -8229,7 +8238,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s if (_vm->_globals.ECRAN == 61) { SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); SPRITE_ON(0); - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -8252,7 +8261,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s g_old_x = XSPR(0); g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; v7 = YSPR(0); v8 = XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); @@ -8260,7 +8269,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != g_PTRNUL); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); SETANISPR(0, 64); } do { @@ -8365,7 +8374,7 @@ LABEL_70: _vm->_objectsManager.VERIFTAILLE(); SPRITE_ON(0); _vm->_globals.CACHE_ON(); - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_objectsManager.VERIFTAILLE(); SPECIAL_INI(s2); _vm->_eventsManager.souris_n = 4; @@ -8400,7 +8409,7 @@ LABEL_70: if (xCheck == xp) { if (yCheck == yp) { - _vm->_globals.chemin = g_PTRNUL; + _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_objectsManager.PARADISE(); if (_vm->_globals.SORTIE) breakFlag = true; @@ -8417,7 +8426,8 @@ LABEL_70: if (!_vm->_globals.SORTIE) { TEST_INVENT(); _vm->_objectsManager.VERIFZONE(); - if (_vm->_globals.chemin == g_PTRNUL || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == g_PTRNUL)) { + if (_vm->_globals.chemin == (int16 *)g_PTRNUL + || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { if (_vm->_objectsManager.GOACTION == 1) _vm->_objectsManager.PARADISE(); } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index f3b41bc8d0..fd1523b37b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -205,8 +205,8 @@ public: void INVENT(); void CHANGE_TETE(int a1, int a2); void VERIFTAILLE(); - void PACOURS_PROPRE(byte *a1); - byte *PARC_VOITURE(int a1, int a2, int a3, int a4); + void PACOURS_PROPRE(int16 *a1); + int16 *PARC_VOITURE(int a1, int a2, int a3, int a4); void VERBEPLUS(); void BTDROITE(); int MZONE(); -- cgit v1.2.3 From b4247f6265e980b65aeb3c97f3c8875892cb8e92 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Oct 2012 18:59:06 +0200 Subject: HOPKINS: Add some translated comments to function names --- engines/hopkins/anim.cpp | 5 +++++ engines/hopkins/events.cpp | 11 +++++++++++ engines/hopkins/files.cpp | 13 +++++++++++++ engines/hopkins/font.cpp | 7 ++++++- engines/hopkins/globals.cpp | 5 +++++ engines/hopkins/graphics.cpp | 13 +++++++++++++ engines/hopkins/lines.cpp | 12 +++++++++++- engines/hopkins/menu.cpp | 4 ++++ engines/hopkins/objects.cpp | 19 +++++++++++++++++++ 9 files changed, 87 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 42aef7dd1d..c01ac7409a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -38,6 +38,7 @@ AnimationManager::AnimationManager() { NO_SEQ = false; } +// Play Anim void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { signed __int16 v4; signed __int16 v5; @@ -239,6 +240,7 @@ LABEL_58: _vm->_graphicsManager.NOLOCK = 0; } +// Play Anim 2 void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { byte *v4; int v5; @@ -671,6 +673,7 @@ bool AnimationManager::REDRAW_ANIM() { return false; } +// Load Anim void AnimationManager::CHARGE_ANIM(const Common::String &animName) { byte v20[15]; char header[10]; @@ -746,6 +749,7 @@ void AnimationManager::CLEAR_ANIM() { } } +// Load Sprite Bank 1 int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filename) { byte *v3; byte *v4; @@ -843,6 +847,7 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } +// Search Anim void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count) { int v3; const byte *v5; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 030e321316..1504a85fe2 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -54,10 +54,12 @@ void EventsManager::setParent(HopkinsEngine *vm) { _vm = vm; } +// Install Mouse void EventsManager::INSTALL_SOURIS() { // No implementation in original } +// Mouse On void EventsManager::souris_on() { souris_flag = true; @@ -78,14 +80,17 @@ void EventsManager::souris_on() { souris_xy(150, 100); } +// Set Mouse position void EventsManager::souris_xy(int xp, int yp) { g_system->warpMouse(xp, yp); } +// Mouse Max void EventsManager::souris_max() { // No implementation in original } +// Get Mouse X int EventsManager::XMOUSE() { souris_x = start_x + g_system->getEventManager()->getMousePos().x; souris_y = g_system->getEventManager()->getMousePos().y; @@ -93,6 +98,7 @@ int EventsManager::XMOUSE() { return souris_x + ofset_souris_x; } +// Get Mouse Y int EventsManager::YMOUSE() { souris_x = start_x + g_system->getEventManager()->getMousePos().x; souris_y = g_system->getEventManager()->getMousePos().y; @@ -100,22 +106,26 @@ int EventsManager::YMOUSE() { return souris_y + ofset_souris_y; } +// Get Mouse Button int EventsManager::BMOUSE() { CONTROLE_MES(); return souris_bb; } +// Mouse Off void EventsManager::MOUSE_OFF() { souris_flag = false; g_system->showMouse(false); } +// Mouse On void EventsManager::MOUSE_ON() { souris_on(); souris_flag = true; g_system->showMouse(true); } +// Change Mouse Cursor void EventsManager::CHANGE_MOUSE(int id) { int cursorId = id; @@ -182,6 +192,7 @@ void EventsManager::CHANGE_MOUSE(int id) { } } +// Check Events void EventsManager::CONTROLE_MES() { pollEvents(); } diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index de501d884c..1fe4eba2ac 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -46,6 +46,7 @@ void FileManager::initSaves() { SAUVE_FICHIER(dataFilename, data, 100); } +// Save File bool FileManager::SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n) { return bsave(file, buf, n); } @@ -63,6 +64,7 @@ bool FileManager::bsave(const Common::String &file, const void *buf, size_t n) { return false; } +// Load INI File void FileManager::Chage_Inifile(Common::StringMap &iniParams) { char *iniData = (char *)CHARGE_FICHIER("config.ini"); char *ptr = iniData; @@ -105,6 +107,7 @@ void FileManager::Chage_Inifile(Common::StringMap &iniParams) { free(iniData); } +// Load File byte *FileManager::CHARGE_FICHIER(const Common::String &file) { DMESS1(); @@ -124,6 +127,7 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { return data; } +// Load File 2 void FileManager::CHARGE_FICHIER2(const Common::String &file, byte *buf) { Common::File f; size_t filesize; @@ -137,10 +141,12 @@ void FileManager::CHARGE_FICHIER2(const Common::String &file, byte *buf) { f.close(); } +// Guess: Debug Message void FileManager::DMESS() { // No implementation in original } +// Guess: Debug Message 1 void FileManager::DMESS1() { // No implementation in original } @@ -158,6 +164,7 @@ int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) return stream.read(buf, nbytes); } +// Censorship void FileManager::F_Censure() { _vm->_globals.CENSURE = false; @@ -176,11 +183,13 @@ void FileManager::F_Censure() { free(data); } +// Build System int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) { _vm->_globals.NFICHIER = Common::String::format("system/%s", file.c_str()); return _vm->_globals.NFICHIER.size(); } +// Build File void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file) { // At this point, the original program did a big switch statement to determine // whether to preprend the CD or installed directory path into REPJEU @@ -192,11 +201,13 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::Str _vm->_globals.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); } +// Free File byte *FileManager::LIBERE_FICHIER(byte *ptr) { free(ptr); return g_PTRNUL; } +// Search Cat byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { byte *ptr = NULL; Common::File f; @@ -344,6 +355,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { return result; } +// File Size uint32 FileManager::FLONG(const Common::String &filename) { Common::File f; uint32 size; @@ -357,6 +369,7 @@ uint32 FileManager::FLONG(const Common::String &filename) { return size; } +// Build Linux Common::String FileManager::CONSTRUIT_LINUX(const Common::String &file) { return file; } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index a2c3713d87..fdcf86ea1b 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -51,6 +51,7 @@ void FontManager::clearAll() { } } +// Text On void FontManager::TEXTE_ON(int idx) { if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); @@ -65,7 +66,7 @@ void FontManager::TEXTE_ON(int idx) { } } - +// Text Off void FontManager::TEXTE_OFF(int idx) { if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); @@ -80,10 +81,12 @@ void FontManager::TEXTE_OFF(int idx) { } } +// Text Color void FontManager::COUL_TXT(int idx, byte colByte) { Txt[idx - 5].colour = colByte; } +// Text Optimal Color void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { COUL_TXT(idx1, 255); COUL_TXT(idx2, 255); @@ -91,6 +94,7 @@ void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { COUL_TXT(idx4, 253); } +// void FontManager::DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int colour) { if ((idx - 5) > 11) error("Attempted to display text > MAX_TEXT."); @@ -108,6 +112,7 @@ void FontManager::DOS_TEXT(int idx, int messageId, const Common::String &filenam txt.colour = colour; } +// Box void FontManager::BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp) { int filesize; byte *v9; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 46b7eb3756..bd95ade47f 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -443,6 +443,7 @@ void Globals::CLEAR_VBOB() { } } +// Load Object void Globals::CHARGE_OBJET() { _vm->_fileManager.CONSTRUIT_SYSTEM("OBJET.DAT"); byte *data = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); @@ -475,11 +476,13 @@ byte *Globals::dos_free2(byte *p) { return g_PTRNUL; } +// Free File byte *Globals::LIBERE_FICHIER(byte *p) { dos_free2(p); return g_PTRNUL; } +// Reset Cache void Globals::RESET_CACHE() { byte *dataP; @@ -509,6 +512,7 @@ void Globals::RESET_CACHE() { void Globals::CACHE_ON() { CACHEFLAG = 1; } + // TODO: Find why some calls have a parameter value void Globals::CACHE_OFF(int v1) { CACHEFLAG = 0; @@ -522,6 +526,7 @@ void Globals::CACHE_ADD(int idx) { Cache[idx].fieldA = 1; } +// Load Cache void Globals::CHARGE_CACHE(const Common::String &file) { byte *v2 = g_PTRNUL; int v4; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3798711a49..c42ea8cfa0 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -158,6 +158,7 @@ void GraphicsManager::DD_Unlock() { } } +// Clear Screen void GraphicsManager::Cls_Video() { assert(VideoPtr); @@ -170,6 +171,7 @@ void GraphicsManager::LOAD_IMAGE(const Common::String &file) { INIT_TABLE(165, 170, Palette); } +// Load Screen void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { bool flag; Common::File f; @@ -259,6 +261,7 @@ void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) { TABLE_COUL[0] = 1; } +// Scroll Screen int GraphicsManager::SCROLL_ECRAN(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); _vm->_eventsManager.start_x = result; @@ -483,6 +486,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by _vm->_globals.dos_free2(ptr); } +// Clear Palette void GraphicsManager::Cls_Pal() { Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); SD_PIXELS[0] = 0; @@ -492,6 +496,7 @@ void GraphicsManager::Cls_Pal() { } } +// TODO: Check if it's normal it's defined two times (also in events). void GraphicsManager::souris_max() { // Original has no implementation } @@ -1495,6 +1500,7 @@ void GraphicsManager::RESET_SEGMENT_VESA() { } } +// Add VESA Segment void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { int v4; int v5; @@ -1553,6 +1559,7 @@ int GraphicsManager::Magic_Number(signed int v) { return result; } +// Display VESA Segment void GraphicsManager::Affiche_Segment_Vesa() { if (_vm->_globals.NBBLOC == 0) return; @@ -1748,6 +1755,7 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { return v; } +// Display 'Perfect?' void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int spriteIndex, int a6, int a7, int a8) { const byte *v8; int i; @@ -2165,6 +2173,7 @@ Aff_Zoom_Larg_Cont1: } } +// Display Speed void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { int width, height; @@ -2242,6 +2251,7 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned } while (yCurrent != 1); } +// Display Font void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour) { const byte *v6; @@ -2291,10 +2301,12 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x } while (v16 != 1); } +// Init Screen void GraphicsManager::INI_ECRAN(const Common::String &file) { OPTI_INI(file, 0); } +// Init Screen 2 void GraphicsManager::INI_ECRAN2(const Common::String &file) { OPTI_INI(file, 2); } @@ -2483,6 +2495,7 @@ Video_Cont_Vbe: } } +// Reduce Screen // TODO: Check that v9 doesn't get set anywhere (apart from the current init to zero) void GraphicsManager::Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7) { byte *v7; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 550cabd168..e307a0ee2f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -59,6 +59,7 @@ void LinesManager::CLEAR_ZONE() { next_ligne = 0; } +// Object Zone int LinesManager::ZONE_OBJET(int a1, int a2) { int v2; @@ -127,6 +128,7 @@ int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { return v3; } +// Remove Line Zone void LinesManager::RETIRE_LIGNE_ZONE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); @@ -136,7 +138,7 @@ void LinesManager::RETIRE_LIGNE_ZONE(int idx) { _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; } - +// Add Line Zone void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { int v8; int v9; @@ -223,6 +225,7 @@ void LinesManager::RESET_OBSTACLE() { } } +// Remove Line void LinesManager::RETIRE_LIGNE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); @@ -231,6 +234,7 @@ void LinesManager::RETIRE_LIGNE(int idx) { Ligne[idx].lineData = (int16 *)g_PTRNUL; } +// Add Line void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { int v7; int v8; @@ -381,6 +385,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, Ligne[idx].field4 = a2; } +// Line Collision 2 int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { int v6; int16 *v7; @@ -587,6 +592,7 @@ LABEL_46: return result; } +// Init route void LinesManager::INIPARCOURS() { int v0; int v1; @@ -649,6 +655,7 @@ void LinesManager::INIPARCOURS() { } while (v8 != 400); } +// Avoid int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7) { int v7; int v8; @@ -788,6 +795,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i return v8; } +// Avoid 1 int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9) { int v9; int v10; @@ -1681,6 +1689,7 @@ LABEL_17: return v99; } +// Avoid 2 // TODO: method casting int arrays as byte pointers. Double-check later whether // we can convert the return to a uint16 * int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { @@ -3816,6 +3825,7 @@ LABEL_60: return 1; } +// Test line int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { int i; int v6; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index fcebb2ce8b..a4bd9c13c9 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -233,6 +233,7 @@ int MenuManager::MENU() { return v6; } +// Load Game void MenuManager::CHARGE_PARTIE() { int v1; char v3; @@ -304,6 +305,7 @@ void MenuManager::CHARGE_PARTIE() { _vm->_objectsManager.CHANGE_OBJET(14); } +// Save Game void MenuManager::SAUVE_PARTIE() { byte *v1; int v2; @@ -559,6 +561,7 @@ void MenuManager::COMPUT_HOPKINS(int idx) { */ } +// Load Save void MenuManager::LOAD_SAUVE(int a1) { int v1; byte *v2; @@ -638,6 +641,7 @@ void MenuManager::LOAD_SAUVE(int a1) { _vm->_objectsManager.SL_Y = 0; } +// Search Game int MenuManager::CHERCHE_PARTIE() { int v0; int v1; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d53e302488..04b5bd610d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -110,6 +110,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { _vm = vm; } +// Change Object byte *ObjectsManager::CHANGE_OBJET(int objIndex) { byte *result = ObjectsManager::CAPTURE_OBJET(objIndex, 1); _vm->_globals.Bufferobjet = result; @@ -170,6 +171,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { return result; } +// Delete Object void ObjectsManager::DELETE_OBJET(int objIndex) { int v1; int v2; @@ -240,6 +242,7 @@ int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool is return result; } +// Get Width int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) @@ -248,6 +251,7 @@ int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { return (int16)READ_LE_UINT16(rectP + 4); } +// Get height int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) @@ -279,6 +283,7 @@ byte *ObjectsManager::DEL_FICHIER_OBJ() { return result; } +// Load Sprite byte *ObjectsManager::CHARGE_SPRITE(const Common::String &file) { _vm->_fileManager.DMESS1(); return _vm->_fileManager.CHARGE_FICHIER(file); @@ -297,6 +302,7 @@ int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int return result; } +// Add Object int ObjectsManager::AJOUTE_OBJET(int objIndex) { bool flag = false; int arrIndex = 0; @@ -312,6 +318,7 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } +// Display Sprite void ObjectsManager::AFF_SPRITES() { int v0; int v1; @@ -1147,6 +1154,7 @@ void ObjectsManager::DEF_CACHE(int idx) { _vm->_globals.Cache[idx].field4 + _vm->_globals.Cache[idx].field8); } +// Compute Sprite void ObjectsManager::CALCUL_SPRITE(int idx) { int width, height; int v3; @@ -1270,6 +1278,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } } +// Before Sort int ObjectsManager::AvantTri(int a1, int a2, int a3) { int result; @@ -1285,6 +1294,7 @@ int ObjectsManager::AvantTri(int a1, int a2, int a3) { return result; } +// Display BOB Anim void ObjectsManager::AFF_BOB_ANIM() { int v1; int v2; @@ -1473,6 +1483,7 @@ LABEL_38: } while (v28 != 35); } +// Display VBOB void ObjectsManager::AFF_VBOB() { int width, height; @@ -1731,6 +1742,7 @@ void ObjectsManager::SETYSPR(int idx, int yp) { Sprite[idx].spritePos.y = yp; } +// Set Sprite Size void ObjectsManager::SETTAILLESPR(int idx, int a2) { if (idx > 5) error("Set the Coord. there a sprite> MAX_SPRITE."); @@ -2456,6 +2468,7 @@ LABEL_19: } } +// Load Obstacle void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { __int16 v1; byte *ptr; @@ -2489,6 +2502,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_globals.dos_free2(ptr); } +// Load Zone void ObjectsManager::CHARGE_ZONE(const Common::String &file) { signed int v1; int v2; @@ -2600,6 +2614,7 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { _vm->_objectsManager.CARRE_ZONE(); } +// Square Zone void ObjectsManager::CARRE_ZONE() { int16 *dataP; int v4; @@ -2791,6 +2806,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLAN_FLAG = 0; } +// Left Button void ObjectsManager::BTGAUCHE() { int v0; int v1; @@ -3094,6 +3110,7 @@ LABEL_64: GOACTION = 0; } +// Clear Screen void ObjectsManager::CLEAR_ECRAN() { int v1; int v2; @@ -3348,6 +3365,7 @@ LABEL_7: } } +// Change Face/Head void ObjectsManager::CHANGE_TETE(int a1, int a2) { int v2; Sauvegarde1 *v3; @@ -3462,6 +3480,7 @@ LABEL_9: } } +// Check Size void ObjectsManager::VERIFTAILLE() { int v0; int v1; -- cgit v1.2.3 From 762b11aece04df992d4d4c16ceaf6a9a70e8bb1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Oct 2012 16:06:55 +1100 Subject: HOPKINS: Fixed implementation of DEF_BOB Animations now work correctly. --- engines/hopkins/objects.cpp | 82 ++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d53e302488..9ce0b3b6cd 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -613,73 +613,65 @@ void ObjectsManager::BOB_ZERO(int idx) { } void ObjectsManager::DEF_BOB(int idx) { - int v2; - int v3; - int v4; int v5; int v6; int v7; int v8; int v9; int v10; - int v11; - int v12; - int v13; - - v2 = idx; - if (_vm->_globals.Bob[v2].field40) { - v12 = _vm->_globals.Bob[v2].field42; - v13 = _vm->_globals.Bob[v2].field44; - if (_vm->_globals.Bob[v2].field3E) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[v2].field4, - v12 + 300, v13 + 300, _vm->_globals.Bob[v2].fieldC); + int xp; + int yp; + + if (_vm->_globals.Bob[idx].field3C) { + xp = _vm->_globals.Bob[idx].field3E; + yp = _vm->_globals.Bob[idx].field40; + if (_vm->_globals.Bob[idx].field3A) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].field4, + xp + 300, yp + 300, _vm->_globals.Bob[idx].fieldC); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.Bob[v2].field4, v12 + 300, - _vm->_globals.Bob[v2].field44 + 300, _vm->_globals.Bob[v2].fieldC, - _vm->_globals.Bob[v2].field4A, _vm->_globals.Bob[v2].field48, - _vm->_globals.Bob[v2].field38); + _vm->_globals.Bob[idx].field4, xp + 300, + _vm->_globals.Bob[idx].field40 + 300, _vm->_globals.Bob[idx].fieldC, + _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx].field48, + _vm->_globals.Bob[idx].field38); - v3 = idx; - _vm->_globals.Liste2[v3].field0 = 1; - _vm->_globals.Liste2[v3].xp = v12; - _vm->_globals.Liste2[v3].yp = v13; + _vm->_globals.Liste2[idx].field0 = 1; + _vm->_globals.Liste2[idx].xp = xp; + _vm->_globals.Liste2[idx].yp = yp; - v4 = idx; - _vm->_globals.Liste2[v3].width = _vm->_globals.Bob[v4].field42; - _vm->_globals.Liste2[v3].height = _vm->_globals.Bob[v4].field44; + _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].field42; + _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].field44; - v5 = _vm->_globals.Liste2[v3].xp; + v5 = _vm->_globals.Liste2[idx].xp; v6 = _vm->_graphicsManager.min_x; if (v5 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste2[v3].width -= _vm->_graphicsManager.min_x - v5; - _vm->_globals.Liste2[v3].xp = v6; + _vm->_globals.Liste2[idx].width -= _vm->_graphicsManager.min_x - v5; + _vm->_globals.Liste2[idx].xp = v6; } - v7 = _vm->_globals.Liste2[v3].yp; + v7 = _vm->_globals.Liste2[idx].yp; v8 = _vm->_graphicsManager.min_y; if (v7 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste2[v3].height -= _vm->_graphicsManager.min_y - v7; - _vm->_globals.Liste2[v3].yp = v8; + _vm->_globals.Liste2[idx].height -= _vm->_graphicsManager.min_y - v7; + _vm->_globals.Liste2[idx].yp = v8; } - v9 = _vm->_globals.Liste2[v3].xp; - if (_vm->_globals.Liste2[v3].width + v9 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste2[v3].width = _vm->_graphicsManager.max_x - v9; - v10 = _vm->_globals.Liste2[v3].yp; - if (_vm->_globals.Liste2[v3].height + v10 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste2[v3].height = _vm->_graphicsManager.max_y - v10; + v9 = _vm->_globals.Liste2[idx].xp; + if (_vm->_globals.Liste2[idx].width + v9 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste2[idx].width = _vm->_graphicsManager.max_x - v9; + v10 = _vm->_globals.Liste2[idx].yp; + if (_vm->_globals.Liste2[idx].height + v10 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste2[idx].height = _vm->_graphicsManager.max_y - v10; - if (_vm->_globals.Liste2[v3].width <= 0 || _vm->_globals.Liste2[v3].height <= 0) - _vm->_globals.Liste2[v3].field0 = 0; + if (_vm->_globals.Liste2[idx].width <= 0 || _vm->_globals.Liste2[idx].height <= 0) + _vm->_globals.Liste2[idx].field0 = 0; - v11 = idx; - if (_vm->_globals.Liste2[v11].field0 == 1) + if (_vm->_globals.Liste2[idx].field0 == 1) _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.Liste2[v11].xp, - _vm->_globals.Liste2[v11].yp, - _vm->_globals.Liste2[v11].xp + _vm->_globals.Liste2[v11].width, - _vm->_globals.Liste2[v11].yp + _vm->_globals.Liste2[v11].height); + _vm->_globals.Liste2[idx].xp, + _vm->_globals.Liste2[idx].yp, + _vm->_globals.Liste2[idx].xp + _vm->_globals.Liste2[idx].width, + _vm->_globals.Liste2[idx].yp + _vm->_globals.Liste2[idx].height); } } -- cgit v1.2.3 From 247f1616d870e152f75471529bef12ab5ad562b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Oct 2012 18:48:03 +1100 Subject: HOPKINS: Fix the display of on-screen text --- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/objects.cpp | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c42ea8cfa0..691781383d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -61,7 +61,7 @@ GraphicsManager::GraphicsManager() { min_x = 0; min_y = 20; max_x = SCREEN_WIDTH * 2; - max_y = SCREEN_HEIGHT - 20 * 2; + max_y = SCREEN_HEIGHT - 20; clip_x = clip_y = 0; clip_x1 = clip_y1 = 0; clip_flag = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 102ad21ee8..a156171f1a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -320,7 +320,6 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { // Display Sprite void ObjectsManager::AFF_SPRITES() { - int v0; int v1; int v2; int destX; @@ -343,7 +342,6 @@ void ObjectsManager::AFF_SPRITES() { int v27; int x1_1; int x1_2; - int v30; int v33; int v34; int v35; @@ -351,17 +349,16 @@ void ObjectsManager::AFF_SPRITES() { int v37; uint16 arr[50]; + // Handle drawing any on-screen text _vm->_globals.NBTRI = 0; - v30 = 0; - do { - v0 = v30; - if (_vm->_fontManager.ListeTxt[v0].enabled && _vm->_fontManager.Txt[v30].field3FC != 2) { - v1 = _vm->_fontManager.ListeTxt[v30].xp; + for (int idx = 0; idx <= 10; ++idx) { + if (_vm->_fontManager.ListeTxt[idx].enabled && _vm->_fontManager.Txt[idx].field3FC != 2) { + v1 = _vm->_fontManager.ListeTxt[idx].xp; x1_1 = v1 - 2; if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) x1_1 = _vm->_graphicsManager.min_x; - v2 = _vm->_fontManager.ListeTxt[v30].yp; + v2 = _vm->_fontManager.ListeTxt[idx].yp; y1_1 = v2 - 2; if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) @@ -374,13 +371,12 @@ void ObjectsManager::AFF_SPRITES() { destY = _vm->_graphicsManager.min_y; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_1, y1_1, - _vm->_fontManager.ListeTxt[v30].width + 4, _vm->_fontManager.ListeTxt[destX].height + 4, + _vm->_fontManager.ListeTxt[idx].width + 4, _vm->_fontManager.ListeTxt[idx].height + 4, _vm->_graphicsManager.VESA_BUFFER, destX, destY); - _vm->_fontManager.ListeTxt[v0].enabled = false; + _vm->_fontManager.ListeTxt[idx].enabled = false; } - ++v30; - } while (v30 <= 10); + } if (!PERSO_ON) { for (int idx = 0; idx < 5; ++idx) { @@ -632,6 +628,7 @@ void ObjectsManager::DEF_BOB(int idx) { if (_vm->_globals.Bob[idx].field3C) { xp = _vm->_globals.Bob[idx].field3E; yp = _vm->_globals.Bob[idx].field40; + if (_vm->_globals.Bob[idx].field3A) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].field4, xp + 300, yp + 300, _vm->_globals.Bob[idx].fieldC); @@ -641,7 +638,7 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Bob[idx].field40 + 300, _vm->_globals.Bob[idx].fieldC, _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx].field48, _vm->_globals.Bob[idx].field38); - + _vm->_globals.Liste2[idx].field0 = 1; _vm->_globals.Liste2[idx].xp = xp; _vm->_globals.Liste2[idx].yp = yp; -- cgit v1.2.3 From 54581d86904b68f20db93761e08d0dea9e74482e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Oct 2012 19:03:47 +1100 Subject: HOPKINS: Corrected some comments and error messages --- engines/hopkins/objects.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a156171f1a..8c2e0fce60 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -349,7 +349,7 @@ void ObjectsManager::AFF_SPRITES() { int v37; uint16 arr[50]; - // Handle drawing any on-screen text + // Handle copying any background areas that text are going to be drawn on _vm->_globals.NBTRI = 0; for (int idx = 0; idx <= 10; ++idx) { if (_vm->_fontManager.ListeTxt[idx].enabled && _vm->_fontManager.Txt[idx].field3FC != 2) { @@ -406,7 +406,9 @@ void ObjectsManager::AFF_SPRITES() { AFF_BOB_ANIM(); AFF_VBOB(); + if (!PERSO_ON) { + // Handle drawing characters on the screen for (int idx = 0; idx < 5; ++idx) { _vm->_globals.Liste[idx].field0 = 0; idx = idx; @@ -1273,7 +1275,7 @@ int ObjectsManager::AvantTri(int a1, int a2, int a3) { ++_vm->_globals.NBTRI; if (_vm->_globals.NBTRI > 48) - error("NBTRI TROP GRAND"); + error("NBTRI too high"); result = _vm->_globals.NBTRI; _vm->_globals.Tri[result].field0 = a1; @@ -1628,14 +1630,14 @@ void ObjectsManager::CLEAR_SPR() { void ObjectsManager::SPRITE_ON(int idx) { if (idx > 5) - error("Tentative d'affichage d'un sprite > MAX_SPRITE."); + error("Attempt to display a sprite > MAX_SPRITE."); Sprite[idx].field0 = 1; } void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9) { if (idx > 5) - error("Tentative d'affichage d'un sprite > MAX_SPRITE."); + error("Attempt to display a sprite > MAX_SPRITE."); Sprite[idx].spriteData = spriteData; Sprite[idx].spritePos = Common::Point(xp, yp); Sprite[idx].field10 = a5; -- cgit v1.2.3 From 6716cddc768889c9a2a3af43567bd37a114d376c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Oct 2012 22:24:11 +1100 Subject: HOPKINS: Some cleanup and renaming of the Tri structure --- engines/hopkins/globals.h | 12 +++++-- engines/hopkins/objects.cpp | 82 ++++++++++++++++++++++++--------------------- engines/hopkins/objects.h | 3 +- 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 263baafc19..4b77c2c4b2 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -165,9 +165,17 @@ struct BlocItem { int y2; }; +/** + * Mode for TriItem records + */ +enum TriMode { TRI_NONE = 0, TRI_BOB = 1, TRI_SPRITE = 2, TRI_CACHE = 3 }; + +/** + * Structure to represent a pending display of either a Bob, Sprite, or Cache Item. + */ struct TriItem { - int field0; - int field2; + TriMode triMode; + int index; int field4; int field6; }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8c2e0fce60..0b33102b42 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -331,8 +331,6 @@ void ObjectsManager::AFF_SPRITES() { int v11; uint16 *v12; int v13; - int v14; - int v15; int v20; int v21; int y1_1; @@ -345,8 +343,6 @@ void ObjectsManager::AFF_SPRITES() { int v33; int v34; int v35; - int v36; - int v37; uint16 arr[50]; // Handle copying any background areas that text are going to be drawn on @@ -411,11 +407,10 @@ void ObjectsManager::AFF_SPRITES() { // Handle drawing characters on the screen for (int idx = 0; idx < 5; ++idx) { _vm->_globals.Liste[idx].field0 = 0; - idx = idx; if (Sprite[idx].field0 == 1) { CALCUL_SPRITE(idx); if (Sprite[idx].field2A == 1) - AvantTri(2, idx, Sprite[idx].field32 + Sprite[idx].field2E); + AvantTri(TRI_SPRITE, idx, Sprite[idx].field32 + Sprite[idx].field2E); } } @@ -454,42 +449,51 @@ void ObjectsManager::AFF_SPRITES() { if (_vm->_globals.NBTRI + 1 > 1) { do { v13 = arr[v35]; - if (_vm->_globals.Tri[v13].field0 == 1) - DEF_BOB(_vm->_globals.Tri[v13].field2); - if (_vm->_globals.Tri[v13].field0 == 2) - DEF_SPRITE(_vm->_globals.Tri[v13].field2); - if (_vm->_globals.Tri[v13].field0 == 3) - DEF_CACHE(_vm->_globals.Tri[v13].field2); - _vm->_globals.Tri[v13].field0 = 0; + switch (_vm->_globals.Tri[v13].triMode) { + case TRI_BOB: + DEF_BOB(_vm->_globals.Tri[v13].index); + break; + case TRI_SPRITE: + DEF_SPRITE(_vm->_globals.Tri[v13].index); + break; + case TRI_CACHE: + DEF_CACHE(_vm->_globals.Tri[v13].index); + break; + default: + break; + } + _vm->_globals.Tri[v13].triMode = TRI_NONE; ++v35; } while (v35 < _vm->_globals.NBTRI + 1); } } else { - v36 = 1; if (_vm->_globals.NBTRI + 1 > 1) { - do { - v14 = v36; - if (_vm->_globals.Tri[v14].field0 == 1) - DEF_BOB(_vm->_globals.Tri[v14].field2); - if (_vm->_globals.Tri[v14].field0 == 2) - DEF_SPRITE(_vm->_globals.Tri[v14].field2); - if (_vm->_globals.Tri[v14].field0 == 3) - DEF_CACHE(_vm->_globals.Tri[v14].field2); - _vm->_globals.Tri[v14].field0 = 0; - ++v36; - } while (v36 < _vm->_globals.NBTRI + 1); + for (int idx = 1; idx < (_vm->_globals.NBTRI + 1); ++idx) { + switch (_vm->_globals.Tri[idx].triMode) { + case TRI_BOB: + DEF_BOB(_vm->_globals.Tri[idx].index); + break; + case TRI_SPRITE: + DEF_SPRITE(_vm->_globals.Tri[idx].index); + break; + case TRI_CACHE: + DEF_CACHE(_vm->_globals.Tri[idx].index); + break; + default: + break; + } + _vm->_globals.Tri[idx].triMode = TRI_NONE; + } } } - v37 = 0; - do { - v15 = v37; - _vm->_globals.Tri[v15].field0 = 0; - _vm->_globals.Tri[v15].field4 = 0; - _vm->_globals.Tri[v15].field2 = 0; - _vm->_globals.Tri[v15].field6 = 0; - ++v37; - } while (v37 <= 49); + // Reset the Tri array + for (int idx = 0; idx < 50; ++idx) { + _vm->_globals.Tri[idx].triMode = TRI_NONE; + _vm->_globals.Tri[idx].index = 0; + _vm->_globals.Tri[idx].field4 = 0; + _vm->_globals.Tri[idx].field6 = 0; + } _vm->_globals.NBTRI = 0; if (_vm->_globals.AFFINVEN == 1) { @@ -1017,7 +1021,7 @@ void ObjectsManager::VERIFCACHE() { if (v5 > 440) v5 = 500; - AvantTri(3, v8, v5); + AvantTri(TRI_CACHE, v8, v5); _vm->_globals.Cache[v8].fieldA = 1; _vm->_globals.Cache[v8].field10 = 1; } @@ -1270,7 +1274,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } // Before Sort -int ObjectsManager::AvantTri(int a1, int a2, int a3) { +int ObjectsManager::AvantTri(TriMode triMode, int index, int a3) { int result; ++_vm->_globals.NBTRI; @@ -1278,8 +1282,8 @@ int ObjectsManager::AvantTri(int a1, int a2, int a3) { error("NBTRI too high"); result = _vm->_globals.NBTRI; - _vm->_globals.Tri[result].field0 = a1; - _vm->_globals.Tri[result].field2 = a2; + _vm->_globals.Tri[result].triMode = triMode; + _vm->_globals.Tri[result].index = index; _vm->_globals.Tri[result].field4 = a3; return result; @@ -1469,7 +1473,7 @@ LABEL_38: if (v19 > 450) v19 = 600; if (_vm->_globals.Bob[v18].field3C == 1) - AvantTri(1, v28, v19); + AvantTri(TRI_BOB, v28, v19); } } while (v28 != 35); } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index fd1523b37b..9f36b753de 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/endian.h" #include "common/str.h" +#include "hopkins/globals.h" namespace Hopkins { @@ -166,7 +167,7 @@ public: void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void CALCUL_SPRITE(int idx); - int AvantTri(int a1, int a2, int a3); + int AvantTri(TriMode triMode, int index, int a3); void AFF_BOB_ANIM(); void AFF_VBOB(); -- cgit v1.2.3 From 079591fad6aec4c37d5e5a761c8e581f9836991f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Oct 2012 22:25:05 +1100 Subject: HOPKINS: Bugfix for super_parcours array usage in PARCOURS2 method --- engines/hopkins/lines.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index e307a0ee2f..67ce626e0e 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2439,8 +2439,8 @@ LABEL_200: } v57 = v112; if (PARC_PERS( - _vm->_globals.Param[v112 + 4192 / 2], - _vm->_globals.Param[v112 + 4194 / 2], + _vm->_globals.super_parcours[v112 - 4], + _vm->_globals.super_parcours[v112 - 3], v123, v122, -1, @@ -2639,7 +2639,8 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int v142 = -1; v140 = -1; v138 = -1; - while (1) { + + for (;;) { v111 = v7; v109 = v90; if (a3 >= v7 - 2 && a3 <= v7 + 2 && a4 >= v90 - 2 && a4 <= v90 + 2) { -- cgit v1.2.3 From 7fec14d97f06eb49cf4c59fceae47e3e5edf4096 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Oct 2012 23:42:56 +1100 Subject: HOPKINS: Bugfixes to the execution of walking paths --- engines/hopkins/objects.cpp | 25 +++++++++++-------------- engines/hopkins/objects.h | 1 - 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0b33102b42..7f6acf0bad 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -76,7 +76,6 @@ ObjectsManager::ObjectsManager() { SPEED_IMAGE = 0; SPEED_PTR = g_PTRNUL; DERLIGNE = 0; - g_old_sens = 0; A_ANIM = 0; MA_ANIM = 0; MA_ANIM1 = 0; @@ -1913,7 +1912,6 @@ void ObjectsManager::GOHOME() { int v50; __int16 v51; __int16 v52; - __int16 v53; __int16 v54; int v55; __int16 v56; @@ -1931,12 +1929,11 @@ void ObjectsManager::GOHOME() { return; } _vm->_globals.Compteur = 0; - if (g_old_sens == -1) { + if (_vm->_globals.g_old_sens == -1) { VERIFTAILLE(); nouveau_x = *_vm->_globals.chemin; _vm->_globals.chemin++; - v53 = *_vm->_globals.chemin; nouveau_y = *_vm->_globals.chemin; _vm->_globals.chemin++; @@ -1946,7 +1943,7 @@ void ObjectsManager::GOHOME() { nouveau_anim = *_vm->_globals.chemin; _vm->_globals.chemin++; - if (nouveau_x != -1 || v53 != -1) { + if (nouveau_x != -1 || nouveau_y != -1) { _vm->_globals.g_old_sens = nouveau_sens; _vm->_globals.g_old_sens2 = nouveau_sens; _vm->_globals.g_old_anim = 0; @@ -3154,7 +3151,7 @@ void ObjectsManager::CLEAR_ECRAN() { CHANGEVERBE = 0; _vm->_globals.NOSPRECRAN = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; my_anim = 1; A_ANIM = 0; MA_ANIM = 0; @@ -5542,7 +5539,7 @@ LABEL_1141: if (v76 == 59) { _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; v16 = YSPR(0); @@ -5662,7 +5659,7 @@ LABEL_1141: if (v76 == 81) { _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; v22 = YSPR(0); @@ -5884,7 +5881,7 @@ LABEL_1141: if (v76 == 105) { _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { @@ -6241,7 +6238,7 @@ LABEL_1141: _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; @@ -6728,7 +6725,7 @@ LABEL_1141: _vm->_globals.NOPARLE = 0; _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; @@ -6749,7 +6746,7 @@ LABEL_1141: _vm->_globals.NOPARLE = 0; _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; @@ -8273,7 +8270,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s BOBANIM_OFF(3); _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; v7 = YSPR(0); @@ -8394,7 +8391,7 @@ LABEL_70: _vm->_eventsManager.souris_n = 4; g_old_x = _vm->_objectsManager.PERX; g_old_y = _vm->_objectsManager.PERY; - g_old_sens = -1; + _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.BPP_NOAFF = 1; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 9f36b753de..e835afe80e 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -101,7 +101,6 @@ public: int SPEED_IMAGE; byte *SPEED_PTR; int DERLIGNE; - int g_old_sens; int A_ANIM; int MA_ANIM; int MA_ANIM1; -- cgit v1.2.3 From 71268b44184cfb9525186f008789cd5e5e2ae298 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 22:31:46 +1100 Subject: HOPKINS: Furhter bugfixes for pathfinding and walking --- engines/hopkins/graphics.cpp | 4 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/lines.cpp | 100 ++++++++++++++++----------------- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 130 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 6 +- 6 files changed, 120 insertions(+), 124 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 691781383d..feecff9c2c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1756,7 +1756,7 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { } // Display 'Perfect?' -void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int spriteIndex, int a6, int a7, int a8) { +void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8) { const byte *v8; int i; const byte *v10; @@ -1817,7 +1817,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v65; v8 = srcData + 3; - for (i = spriteIndex; i; --i) + for (i = frameIndex; i; --i) v8 += READ_LE_UINT32(v8) + 16; v11 = 0; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 7b8a5f5151..8a337e0104 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -170,7 +170,7 @@ public: void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); - void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int a5, int a6, int a7, int a8); + void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 67ce626e0e..500a7e590b 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1690,9 +1690,7 @@ LABEL_17: } // Avoid 2 -// TODO: method casting int arrays as byte pointers. Double-check later whether -// we can convert the return to a uint16 * -int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { +int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { int v4; int v5; int v6; @@ -1818,15 +1816,15 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { int v136[10]; int v141[10]; - v123 = a3; - v122 = a4; + v123 = destX; + v122 = destY; v121 = 0; v120 = 0; v115 = 0; v114 = 0; v113 = 0; v111 = 0; - if (a4 <= 24) + if (destY <= 24) v122 = 25; if (!_vm->_globals.NOT_VERIF) { v4 = a1 - _vm->_globals.old_x1_65; @@ -1837,7 +1835,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { if (v5 < 0) v5 = -v5; if (v5 <= 4) { - v6 = _vm->_globals.old_x2_67 - a3; + v6 = _vm->_globals.old_x2_67 - destX; if (v6 < 0) v6 = -v6; if (v6 <= 4) { @@ -1849,7 +1847,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { } } } - v8 = a1 - a3; + v8 = a1 - destX; if (v8 < 0) v8 = -v8; if (v8 <= 4) { @@ -1865,12 +1863,12 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int a3, int a4) { _vm->_globals.NOT_VERIF = 0; _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; _vm->_globals.old_x1_65 = a1; - _vm->_globals.old_x2_67 = a3; + _vm->_globals.old_x2_67 = destX; _vm->_globals.old_y1_66 = a2; _vm->_globals.old_y2_68 = v122; _vm->_globals.STOP_BUG = 0; v112 = 0; - if (a3 <= 19) + if (destX <= 19) v123 = 20; if (v122 <= 19) v122 = 20; @@ -2715,7 +2713,7 @@ LABEL_150: } if (v94 == -1 && (unsigned int)(v101 + 150) <= 0x96) v91 = 1; - if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(0, a3, v7, v109, a3, a4) != -1) + if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(v7, v109, a3, a4) != -1) break; LABEL_72: v19 = v111 - a3; @@ -2855,8 +2853,8 @@ LABEL_67: v17 = _vm->_globals.essai0; v17[v16] = v112; - WRITE_LE_UINT16(v17 + 2 * v16 + 2, v110); - WRITE_LE_UINT16(v17 + 2 * v16 + 4, v91); + v17[v16 + 1] = v110; + v17[v16 + 2] = v91; v115 += 3; ++v14; LABEL_70: @@ -3347,7 +3345,7 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { return 0; } -int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { +int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v6; int v7; int v8; @@ -3404,10 +3402,10 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { int v60; int v61; int v62; + int v63; - warning("TODO: SMOOTH_MOVE - a1 = a4 doesn't look like that in the IDB, need to double-check"); v62 = a3; - a1 = a4; + v63 = a4; if (a3 >= a5 || a6 >= a4) { if (a3 <= a5 || a6 >= a4) { if (a3 >= a5 || a6 <= a4) { @@ -3418,20 +3416,20 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { do { v25 = _vm->_globals.Hopkins[v53].field0; v40 = _vm->_globals.Hopkins[v53].field2; - v26 = _vm->_globals.STAILLE[a1]; + v26 = _vm->_globals.STAILLE[v63]; if (v26 < 0) { v27 = v26; v28 = v26; if (v26 < 0) v28 = -v26; - v48 = _vm->_globals.STAILLE[a1]; - v45 = a1; + v48 = _vm->_globals.STAILLE[v63]; + v45 = v63; v25 = _vm->_graphicsManager.Reel_Reduc(v25, v28); v29 = v27; if ((v27 & 0x80000000u) != 0) v29 = -v27; v40 = _vm->_graphicsManager.Reel_Reduc(v40, v29); - a1 = v45; + v63 = v45; v26 = v48; } if (v26 > 0) { @@ -3439,23 +3437,23 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { v31 = v26; if (v26 < 0) v31 = -v26; - v46 = a1; + v46 = v63; v25 = _vm->_graphicsManager.Reel_Zoom(v25, v31); v32 = v30; if ((v30 & 0x80000000u) != 0) v32 = -v30; v40 = _vm->_graphicsManager.Reel_Zoom(v40, v32); - a1 = v46; + v63 = v46; } - v33 = a1 + v40; + v33 = v63 + v40; v34 = 0; if (v25 > 0) { do { --v62; SMOOTH[v61].field0 = v62; - if (a1 != v33) - a1 = a1 + 1; - SMOOTH[v61++].field2 = a1; + if (v63 != v33) + v63 = v63 + 1; + SMOOTH[v61++].field2 = v63; ++v34; } while (v34 < v25); } @@ -3463,7 +3461,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { if (v53 == 48) v53 = 36; ++v57; - if (v62 <= a5 || a6 <= a1) + if (v62 <= a5 || a6 <= v63) v49 = 1; } while (v49 != 1); if (v57 > 5) { @@ -3481,20 +3479,20 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { do { v14 = _vm->_globals.Hopkins[v52].field0; v39 = _vm->_globals.Hopkins[v52].field2; - v15 = _vm->_globals.STAILLE[a1]; + v15 = _vm->_globals.STAILLE[v63]; if (v15 < 0) { v16 = v15; v17 = v15; if (v15 < 0) v17 = -v15; - v47 = _vm->_globals.STAILLE[a1]; - v43 = a1; + v47 = _vm->_globals.STAILLE[v63]; + v43 = v63; v14 = _vm->_graphicsManager.Reel_Reduc(v14, v17); v18 = v16; if ((v16 & 0x80000000u) != 0) v18 = -v16; v39 = _vm->_graphicsManager.Reel_Reduc(v39, v18); - a1 = v43; + v63 = v43; v15 = v47; } if (v15 > 0) { @@ -3502,23 +3500,23 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { v20 = v15; if (v15 < 0) v20 = -v15; - v44 = a1; + v44 = v63; v14 = _vm->_graphicsManager.Reel_Zoom(v14, v20); v21 = v19; if ((v19 & 0x80000000u) != 0) v21 = -v19; v39 = _vm->_graphicsManager.Reel_Zoom(v39, v21); - a1 = v44; + v63 = v44; } - v22 = a1 + v39; + v22 = v63 + v39; v23 = 0; if (v14 > 0) { do { ++v62; SMOOTH[v60].field0 = v62; - if (a1 != v22) - a1 = a1 + 1; - SMOOTH[v60++].field2 = a1; + if (v63 != v22) + v63 = v63 + 1; + SMOOTH[v60++].field2 = v63; ++v23; } while (v23 < v14); } @@ -3526,7 +3524,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { if (v52 == 48) v52 = 36; ++v56; - if (v62 >= a5 || a6 <= (int)a1) + if (v62 >= a5 || a6 <= (int)v63) v49 = 1; } while (v49 != 1); if (v56 > 5) { @@ -3543,18 +3541,18 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { v55 = 0; do { v10 = _vm->_globals.Hopkins[v51].field2; - v42 = a1; + v42 = v63; v11 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v51].field0, 0x19u); v38 = _vm->_graphicsManager.Reel_Reduc(v10, 0x19u); - a1 = v42; + v63 = v42; v12 = 0; if (v11 > 0) { do { --v62; SMOOTH[v59].field0 = v62; - if ((uint16)a1 != (uint16)v42 + v38) - a1 = a1 - 1; - SMOOTH[v59++].field2 = a1; + if ((uint16)v63 != (uint16)v42 + v38) + v63 = v63 - 1; + SMOOTH[v59++].field2 = v63; ++v12; } while (v12 < v11); } @@ -3562,7 +3560,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { if (v51 == 24) v51 = 12; ++v55; - if (v62 <= a5 || a6 >= (int)a1) + if (v62 <= a5 || a6 >= (int)v63) v49 = 1; } while (v49 != 1); if (v55 > 5) { @@ -3579,18 +3577,18 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { v54 = 0; do { v6 = _vm->_globals.Hopkins[v50].field2; - v41 = a1; + v41 = v63; v7 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v50].field0, 0x19u); v37 = _vm->_graphicsManager.Reel_Reduc(v6, 0x19u); - a1 = v41; + v63 = v41; v8 = 0; if (v7 > 0) { do { ++v62; SMOOTH[v58].field0 = v62; - if ((uint16)a1 != (uint16)v41 + v37) - a1 = a1 - 1; - SMOOTH[v58++].field2 = a1; + if ((uint16)v63 != (uint16)v41 + v37) + v63 = v63 - 1; + SMOOTH[v58++].field2 = v63; ++v8; } while (v8 < v7); } @@ -3598,7 +3596,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { if (v50 == 24) v50 = 12; ++v54; - if (v62 >= a5 || a6 >= (int)a1) + if (v62 >= a5 || a6 >= (int)v63) v49 = 1; } while (v49 != 1); if (v54 > 5) { @@ -3608,7 +3606,7 @@ int LinesManager::SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6) { _vm->_linesManager.SMOOTH_SENS = 2; LABEL_85: SMOOTH_X = v62; - SMOOTH_Y = a1; + SMOOTH_Y = v63; return 0; } } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 5da48bc1c4..20a1bccb65 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -88,7 +88,7 @@ public: int16 *PARCOURS2(int a1, int a2, int a3, int a4); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); - int SMOOTH_MOVE(int a1, int a2, int a3, int a4, int a5, int a6); + int SMOOTH_MOVE(int a3, int a4, int a5, int a6); int PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); int TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5); }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7f6acf0bad..d6089c2ad6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -965,7 +965,7 @@ void ObjectsManager::VERIFCACHE() { v10 = 0; do { if (Sprite[v10].field0 == 1) { - if (Sprite[v10].field10 != 250) { + if (Sprite[v10].spriteIndex != 250) { v1 = Sprite[v10].field2C; v11 = Sprite[v10].field30 + v1; v2 = Sprite[v10].field32 + Sprite[v10].field2E; @@ -1095,10 +1095,10 @@ void ObjectsManager::DEF_SPRITE(int idx) { v4 = Sprite[v2].field2E; if (Sprite[v2].field28) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, - v3 + 300, v4 + 300, Sprite[v2].field10); + v3 + 300, v4 + 300, Sprite[v2].spriteIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, - v3 + 300, v4 + 300, Sprite[v2].field10, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); + v3 + 300, v4 + 300, Sprite[v2].spriteIndex, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); v5 = idx; v6 = idx; @@ -1168,18 +1168,18 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int v22; Sprite[idx].field2A = 0; - int v0 = Sprite[idx].field10; - if (v0 != 250) { + int spriteIndex = Sprite[idx].spriteIndex; + if (spriteIndex != 250) { if (Sprite[idx].fieldE) { - v5 = get_offsetx(Sprite[idx].spriteData, v0, 1); + v5 = get_offsetx(Sprite[idx].spriteData, spriteIndex, 1); v22 = Sprite[idx].field12 + v5; v4 = Sprite[idx].field12 + v5; - v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].field10, 1); + v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 1); } else { - v3 = get_offsetx(Sprite[idx].spriteData, v0, 0); + v3 = get_offsetx(Sprite[idx].spriteData, spriteIndex, 0); v22 = Sprite[idx].field12 + v3; v4 = Sprite[idx].field12 + v3; - v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].field10, 0); + v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 0); } v9 = Sprite[idx].field14 + v6; @@ -1254,8 +1254,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { _vm->_globals.Liste[v17].field0 = 1; _vm->_globals.Liste[v17].field2 = v15; _vm->_globals.Liste[v17].field4 = v16; - width = Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10); - height = Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10); + width = Get_Largeur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + height = Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); if (zoomPercent) { width = _vm->_graphicsManager.Reel_Zoom(width, zoomPercent); @@ -1638,12 +1638,12 @@ void ObjectsManager::SPRITE_ON(int idx) { Sprite[idx].field0 = 1; } -void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9) { +void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { if (idx > 5) error("Attempt to display a sprite > MAX_SPRITE."); Sprite[idx].spriteData = spriteData; Sprite[idx].spritePos = Common::Point(xp, yp); - Sprite[idx].field10 = a5; + Sprite[idx].spriteIndex = spriteIndex; Sprite[idx].fieldC = a6; Sprite[idx].field12 = a8; Sprite[idx].field14 = a9; @@ -1698,13 +1698,13 @@ void ObjectsManager::SPRITE_GEL(int idx) { int ObjectsManager::SXSPR(int idx) { if (idx > 5) error("request of the size of a sprite x > MAX_SPRITE."); - return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].field10); + return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); } int ObjectsManager::SYSPR(int idx) { if (idx > 5) error("request of the size of a sprite y > MAX_SPRITE."); - return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].field10); + return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); } int ObjectsManager::POSISPR(int idx) { @@ -1723,11 +1723,11 @@ void ObjectsManager::SETXSPR(int idx, int xp) { Sprite[idx].spritePos.x = xp; } -void ObjectsManager::SETANISPR(int idx, int a2) { +void ObjectsManager::SETANISPR(int idx, int spriteIndex) { if (idx > 5) error("Set the Coord. x a sprite> MAX_SPRITE."); - Sprite[idx].field10 = a2; + Sprite[idx].spriteIndex = spriteIndex; } void ObjectsManager::SETYSPR(int idx, int yp) { @@ -2800,31 +2800,30 @@ void ObjectsManager::PLAN_BETA() { // Left Button void ObjectsManager::BTGAUCHE() { - int v0; + int srcX, srcY; + int destX, destY; int v1; int v2; int16 *v3; int16 *v4; int16 *v5; - int v6; - int v7; - int v8; + int zoneCount; + int zoneX; + int zoneY; int16 *v9; int v10; int v11; int v12; int16 *v13; - int v14; - int v15; int16 *v16; int v17; int v18; - int v19; _vm->_fontManager.TEXTE_OFF(9); - v19 = _vm->_eventsManager.XMOUSE(); - v0 = _vm->_eventsManager.YMOUSE(); - if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && v19 > _vm->_graphicsManager.ofscroll - 30 && v19 < _vm->_graphicsManager.ofscroll + 50 && (uint16)(v0 + 29) <= 0x4Eu) { + destX = _vm->_eventsManager.XMOUSE(); + destY = _vm->_eventsManager.YMOUSE(); + + if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { v1 = _vm->_eventsManager.btsouris; INVENTFLAG = 1; INVENT(); @@ -2838,30 +2837,30 @@ void ObjectsManager::BTGAUCHE() { } if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(v19 - 533) <= 0x1Au - && (uint16)(v0 - 26) <= 0x21u) { + && (uint16)(destX - 533) <= 0x1Au + && (uint16)(destY - 26) <= 0x21u) { CHANGE_TETE(1, 0); return; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(v19 - 533) <= 0x1Au - && (uint16)(v0 - 26) <= 0x21u) { + && (uint16)(destX - 533) <= 0x1Au + && (uint16)(destY - 26) <= 0x21u) { CHANGE_TETE(2, 0); return; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { if (_vm->_globals.SAUVEGARDE->data[svField353] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(v19 - 533) <= 0x1Au - && (uint16)(v0 - 26) <= 0x21u) { + && (uint16)(destX - 533) <= 0x1Au + && (uint16)(destY - 26) <= 0x21u) { CHANGE_TETE(0, 1); return; } if (_vm->_globals.SAUVEGARDE->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(v19 - 567) <= 0x1Au - && (uint16)(v0 - 26) <= 0x21u) { + && (uint16)(destX - 567) <= 0x1Au + && (uint16)(destY - 26) <= 0x21u) { CHANGE_TETE(0, 2); return; } @@ -2896,14 +2895,14 @@ LABEL_38: if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) return; if ((uint16)(NUMZONE + 1) > 1u) { - v6 = NUMZONE; - v7 = _vm->_globals.ZONEP[v6].field0; - if (v7) { - v8 = _vm->_globals.ZONEP[v6].field2; - if (v8) { - if (v8 != 31) { - v19 = v7; - v0 = v8; + zoneCount = NUMZONE; + zoneX = _vm->_globals.ZONEP[zoneCount].field0; + if (zoneX) { + zoneY = _vm->_globals.ZONEP[zoneCount].field2; + if (zoneY) { + if (zoneY != 31) { + destX = zoneX; + destY = zoneY; } } } @@ -2942,9 +2941,9 @@ LABEL_64: } if (!_vm->_globals.NOMARCHE) { if (!_vm->_globals.PLAN_FLAG) { - v14 = YSPR(0); - v15 = XSPR(0); - v16 = _vm->_linesManager.PARCOURS2(v15, v14, v19, v0); + srcY = YSPR(0); + srcX = XSPR(0); + v16 = _vm->_linesManager.PARCOURS2(srcX, srcY, destX, destY); _vm->_globals.chemin = v16; if (v16 != (int16 *)g_PTRNUL) PACOURS_PROPRE(v16); @@ -2960,7 +2959,7 @@ LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == 1) { v17 = YSPR(0); v18 = XSPR(0); - _vm->_globals.chemin = PARC_VOITURE(v18, v17, v19, v0); + _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); } } if ((uint16)(NUMZONE + 1) > 1u) { @@ -7919,7 +7918,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in const byte *v14; char v15; int v16; - int v17; + int spriteIndex; int v18; Common::String v19; @@ -7933,7 +7932,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in if (_vm->_globals.vitesse == 3) v15 = a5 / 3; v14 = Sprite[0].spriteData; - v17 = Sprite[0].field10; + spriteIndex = Sprite[0].spriteIndex; v16 = Sprite[0].fieldE; Sprite[0].field12 += a3; Sprite[0].field14 += a4; @@ -7957,13 +7956,13 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in if (v7 == 1) { if (v13 == -1) { Sprite[0].spriteData = v14; - Sprite[0].field10 = v17; + Sprite[0].spriteIndex = spriteIndex; Sprite[0].field12 -= a3; Sprite[0].field14 -= a4; Sprite[0].fieldE = v16; } else { Sprite[0].spriteData = spriteData; - Sprite[0].field10 = v13; + Sprite[0].spriteIndex = v13; } v10 = 0; v9 = v15; @@ -7979,7 +7978,6 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in break; } } - return; } void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { @@ -7989,14 +7987,14 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 __int32 v9; signed __int16 v10; __int32 v11; - __int16 v13; + int spriteIndex; char v14; __int16 v15; Common::String v16; v15 = 0; v6 = 0; - v13 = 0; + spriteIndex = 0; v16 = " "; v14 = a5; if (_vm->_globals.vitesse == 2) @@ -8004,7 +8002,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 if (_vm->_globals.vitesse == 3) v14 = a5 / 3; S_old_spr = Sprite[0].spriteData; - S_old_ani = Sprite[0].field10; + S_old_ani = Sprite[0].spriteIndex; S_old_ret = Sprite[0].fieldE; Sprite[0].field12 += a3; Sprite[0].field14 += a4; @@ -8015,7 +8013,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 v8 = a2[v15]; if (v8 == ',') { v9 = atoi(v16.c_str()); - v13 = v9; + spriteIndex = v9; v6 = 0; v16 = " "; v7 = 1; @@ -8026,9 +8024,9 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 } ++v15; } while (v7 != 1); - if (v13 != -1) { + if (spriteIndex != -1) { Sprite[0].spriteData = a1; - Sprite[0].field10 = v13; + Sprite[0].spriteIndex = spriteIndex; } v10 = 0; v9 = v14; @@ -8040,7 +8038,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 v9 = v11; } while (v10 < v11); } - } while (v13 != -1); + } while (spriteIndex != -1); } void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { @@ -8050,7 +8048,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a int v8; int v9; int v10; - int v12; + int spriteIndex; int v13; int v14; Common::String v15; @@ -8058,7 +8056,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a v14 = 0; v5 = 0; - v12 = 0; + spriteIndex = 0; v15 = " "; v13 = a5; if (_vm->_globals.vitesse == 2) @@ -8070,7 +8068,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a v7 = a2[v14]; if (v7 == 44) { v8 = atoi(v15.c_str()); - v12 = v8; + spriteIndex = v8; v5 = 0; v15 = " "; v6 = 1; @@ -8081,15 +8079,15 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a } ++v14; if (v6 == 1) { - if (v12 == -1) { + if (spriteIndex == -1) { Sprite[0].spriteData = S_old_spr; - Sprite[0].field10 = S_old_ani; + Sprite[0].spriteIndex = S_old_ani; Sprite[0].field12 -= a3; Sprite[0].field14 -= a4; Sprite[0].fieldE = S_old_ret; } else { Sprite[0].spriteData = a1; - Sprite[0].field10 = v12; + Sprite[0].spriteIndex = spriteIndex; } v9 = 0; @@ -8102,7 +8100,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a v16 = v10; } while (v9 < v10); } - if (v12 == -1) + if (spriteIndex == -1) break; } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index e835afe80e..61483a0e88 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -37,7 +37,7 @@ struct SpriteItem { int spriteY; int fieldC; int fieldE; - int field10; + int spriteIndex; int field12; int field14; byte *field1C; @@ -176,7 +176,7 @@ public: void CLEAR_SPR(); void SPRITE_ON(int idx); - void SPRITE(const byte *spriteData, int xp, int yp, int idx, int a5, int a6, int a7, int a8, int a9); + void SPRITE(const byte *spriteData, int xp, int yp, int idx, int spriteIndex, int a6, int a7, int a8, int a9); void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5); void SPRITE_OFF(int idx); void SPRITE_GEL(int idx); @@ -185,7 +185,7 @@ public: int POSISPR(int idx); void SETPOSISPR(int idx, int a2); void SETXSPR(int idx, int xp); - void SETANISPR(int idx, int a2); + void SETANISPR(int idx, int spriteIndex); void SETYSPR(int idx, int yp); void SETTAILLESPR(int idx, int a2); void SETFLIPSPR(int idx, int a2); -- cgit v1.2.3 From d2baad9965d16125eb9b4c3b97ea434cd9d6d8ef Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 22:39:04 +1100 Subject: HOPKINS: Renamed identified Zone destination fields --- engines/hopkins/globals.cpp | 4 ++-- engines/hopkins/globals.h | 4 ++-- engines/hopkins/objects.cpp | 50 ++++++++++++++++++++++----------------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index bd95ade47f..349210063e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -332,8 +332,8 @@ void Globals::clearAll() { OBJET_EN_COURS = 0; for (int idx = 0; idx < 105; ++idx) { - ZONEP[idx].field0 = 0; - ZONEP[idx].field2 = 0; + ZONEP[idx].destX = 0; + ZONEP[idx].destY = 0; ZONEP[idx].field4 = 0; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 4b77c2c4b2..e2bf5660e8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -29,8 +29,8 @@ namespace Hopkins { struct ZonePItem { - int field0; - int field2; + int destX; + int destY; int field4; int field6; int field7; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d6089c2ad6..12e5bf6e7c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1964,14 +1964,14 @@ void ObjectsManager::GOHOME() { _vm->_globals.g_old_sens = -1; if (v54 > 0) { v55 = v54; - if (_vm->_globals.ZONEP[v55].field0) { - v56 = _vm->_globals.ZONEP[v55].field2; + if (_vm->_globals.ZONEP[v55].destX) { + v56 = _vm->_globals.ZONEP[v55].destY; if (v56) { if (v56 != 31) { v57 = _vm->_globals.ZONEP[v55].field4; if (v57 == -1) { - _vm->_globals.ZONEP[v55].field0 = 0; - _vm->_globals.ZONEP[v55].field2 = 0; + _vm->_globals.ZONEP[v55].destX = 0; + _vm->_globals.ZONEP[v55].destY = 0; _vm->_globals.ZONEP[v55].field4 = 0; } else { SETANISPR(0, v57); @@ -2309,14 +2309,14 @@ LABEL_153: if (v49 > 0) { v50 = v49; - if (_vm->_globals.ZONEP[v50].field0) { - v51 = _vm->_globals.ZONEP[v50].field2;; + if (_vm->_globals.ZONEP[v50].destX) { + v51 = _vm->_globals.ZONEP[v50].destY; if (v51) { if (v51 != 31) { v52 = _vm->_globals.ZONEP[v50].field4; if (v52 == -1) { - _vm->_globals.ZONEP[v50].field0 = 0; - _vm->_globals.ZONEP[v50].field2 = 0; + _vm->_globals.ZONEP[v50].destX = 0; + _vm->_globals.ZONEP[v50].destY = 0; _vm->_globals.ZONEP[v50].field4 = 0; } else { SETANISPR(0, v52); @@ -2518,8 +2518,8 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { v1 = 1; do { v2 = v1; - _vm->_globals.ZONEP[v2].field0 = 0; - _vm->_globals.ZONEP[v2].field2 = 0; + _vm->_globals.ZONEP[v2].destX = 0; + _vm->_globals.ZONEP[v2].destY = 0; _vm->_globals.ZONEP[v2].field4 = 0; _vm->_globals.ZONEP[v2].field6 = 0; _vm->_globals.ZONEP[v2].field7 = 0; @@ -2568,8 +2568,8 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { v7 = 1; do { v8 = v7; - _vm->_globals.ZONEP[v8].field0 = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - _vm->_globals.ZONEP[v8].field2 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); + _vm->_globals.ZONEP[v8].destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + _vm->_globals.ZONEP[v8].destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); _vm->_globals.ZONEP[v8].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); v4 += 3; ++v7; @@ -2896,9 +2896,9 @@ LABEL_38: return; if ((uint16)(NUMZONE + 1) > 1u) { zoneCount = NUMZONE; - zoneX = _vm->_globals.ZONEP[zoneCount].field0; + zoneX = _vm->_globals.ZONEP[zoneCount].destX; if (zoneX) { - zoneY = _vm->_globals.ZONEP[zoneCount].field2; + zoneY = _vm->_globals.ZONEP[zoneCount].destY; if (zoneY) { if (zoneY != 31) { destX = zoneX; @@ -4230,13 +4230,13 @@ int ObjectsManager::MZONE() { if (yp < _vm->_globals.Bob[v3].field44 + v5) { v6 = v1; if (_vm->_globals.ZONEP[v1].field4 == -1) { - _vm->_globals.ZONEP[v6].field0 = 0; - _vm->_globals.ZONEP[v1].field2 = 0; + _vm->_globals.ZONEP[v6].destX = 0; + _vm->_globals.ZONEP[v1].destY = 0; } - if (!_vm->_globals.ZONEP[v6].field0) { - if (!_vm->_globals.ZONEP[v1].field2) { - _vm->_globals.ZONEP[v6].field0 = _vm->_globals.Bob[v15].field42 + _vm->_globals.Bob[v15].field3E; - _vm->_globals.ZONEP[v1].field2 = _vm->_globals.Bob[v15].field44 + _vm->_globals.Bob[v15].field40 + 6; + if (!_vm->_globals.ZONEP[v6].destX) { + if (!_vm->_globals.ZONEP[v1].destY) { + _vm->_globals.ZONEP[v6].destX = _vm->_globals.Bob[v15].field42 + _vm->_globals.Bob[v15].field3E; + _vm->_globals.ZONEP[v1].destY = _vm->_globals.Bob[v15].field44 + _vm->_globals.Bob[v15].field40 + 6; _vm->_globals.ZONEP[v1].field4 = -1; } } @@ -6690,7 +6690,7 @@ LABEL_1141: if (v76 == 245) { _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); OPTI_ONE(5, 0, 6, 0); - _vm->_globals.ZONEP[4].field0 = 276; + _vm->_globals.ZONEP[4].destX = 276; VERBE_ON(4, 19); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals.SAUVEGARDE->data[svField399] = 1; @@ -7297,8 +7297,8 @@ void ObjectsManager::INILINK(const Common::String &file) { v18 = 1; do { v19 = v18; - _vm->_globals.ZONEP[v19].field0 = 0; - _vm->_globals.ZONEP[v19].field2 = 0; + _vm->_globals.ZONEP[v19].destX = 0; + _vm->_globals.ZONEP[v19].destY = 0; _vm->_globals.ZONEP[v19].field4 = 0; _vm->_globals.ZONEP[v19].field6 = 0; _vm->_globals.ZONEP[v19].field7 = 0; @@ -7334,8 +7334,8 @@ void ObjectsManager::INILINK(const Common::String &file) { v20 = 1; do { v21 = v20; - _vm->_globals.ZONEP[v21].field0 = (int16)READ_LE_UINT16(v17 + 2 * v33); - _vm->_globals.ZONEP[v21].field2 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); + _vm->_globals.ZONEP[v21].destX = (int16)READ_LE_UINT16(v17 + 2 * v33); + _vm->_globals.ZONEP[v21].destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; ++v20; -- cgit v1.2.3 From f5473de64946b383498a964ed261aa401ac252ad Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:15:24 +1100 Subject: HOPKINS: Fix gcc identified warnings --- engines/hopkins/anim.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index c01ac7409a..128abff389 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -40,8 +40,8 @@ AnimationManager::AnimationManager() { // Play Anim void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { - signed __int16 v4; - signed __int16 v5; + int v4; + int v5; bool hasScreenCopy; byte *screenCopy = NULL; byte *v10 = NULL; @@ -283,7 +283,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s"); + error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); f.read(&buf, 6); f.read(_vm->_graphicsManager.Palette, 0x320u); @@ -431,14 +431,14 @@ LABEL_77: _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v8) { - if (*v12 != -4) { + if (*v12 != (byte)-4) { _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v12 != -4) { + } else if (*v12 != (byte)-4) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe3(v12); if (_vm->_graphicsManager.Winbpp == 2) @@ -606,7 +606,7 @@ LABEL_114: if (!v6) { f.read(v12, READ_LE_UINT32(v13 + 8)); - if (*v12 != -4) + if (*v12 != (byte)-4) _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptra); } } while (v6 != -1); @@ -982,7 +982,7 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin v10 = _vm->_globals.dos_malloc2(0x16u); _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a2); if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER); + error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); f.read(&buf, 6u); f.read(_vm->_graphicsManager.Palette, 0x320u); @@ -1065,14 +1065,14 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v7) { - if (*v9 != -4) { + if (*v9 != (byte)-4) { _vm->_graphicsManager.Copy_WinScan_Vbe(v9, ptr); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v9 != -4) { + } else if (*v9 != (byte)-4) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe(v9); if (_vm->_graphicsManager.Winbpp == 2) @@ -1213,7 +1213,7 @@ LABEL_23: _vm->_soundManager.PLAY_ANM_SOUND(v13++); memset(&buf, 0, 6u); memset(v11, 0, 0x13u); - if (f.read(v11, 0x10u) == -1) + if (f.read(v11, 16) != 16) v4 = -1; if (strncmp((const char *)v11, "IMAGE=", 7u)) @@ -1227,14 +1227,14 @@ LABEL_33: _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v7) { - if (*v10 != -4) { + if (*v10 != (byte)-4) { _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v10 != -4) { + } else if (*v10 != (byte)-4) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe(v10); if (_vm->_graphicsManager.Winbpp == 2) @@ -1290,14 +1290,14 @@ LABEL_54: do { memset(&buf, 0, 6u); memset(v11, 0, 0x13u); - if (f.read(v11, 0x10u) == -1) + if (f.read(v11, 16) != 16) v5 = -1; if (strncmp((const char *)v11, "IMAGE=", 7u)) v5 = -1; if (!v5) { f.read(v10, READ_LE_UINT32(v11 + 8)); - if (*v10 != -4) + if (*v10 != (byte)-4) _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); } } while (v5 != -1); @@ -1316,5 +1316,4 @@ LABEL_54: _vm->_eventsManager.souris_flag = 1; } - } // End of namespace Hopkins -- cgit v1.2.3 From ece18540de490b88f83e91f296c085164c42f3a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:18:10 +1100 Subject: HOPKINS: Fix gcc compiler warnings in events.cpp --- engines/hopkins/events.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 1504a85fe2..94810e5c4c 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -263,13 +263,13 @@ void EventsManager::pollEvents() { } void EventsManager::VBL() { - signed __int16 v1; + int v1; int v2; int v3; int v4; int v5; int v6; - signed __int16 v7; + int v7; int v10; signed int v11 = 0; signed int v12 = 0; @@ -322,9 +322,9 @@ void EventsManager::VBL() { } else { if (v15 < _vm->_graphicsManager.min_x) v15 = _vm->_graphicsManager.min_x - v1; - v2 = (signed __int16)v2; - if (souris_y < _vm->_graphicsManager.min_y - (signed __int16)v2) - yp = _vm->_graphicsManager.min_y - (signed __int16)v2; + v2 = (int16)v2; + if (souris_y < _vm->_graphicsManager.min_y - (int16)v2) + yp = _vm->_graphicsManager.min_y - (int16)v2; if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x - v1); if (yp + souris_sizey < v2 + _vm->_graphicsManager.max_y) -- cgit v1.2.3 From 9e1d5ffba20be8ed359888fe02f981f3e45b5047 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:23:17 +1100 Subject: HOPKINS: Fix gcc identified warnings in font.cpp --- engines/hopkins/font.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index fdcf86ea1b..7612c9cb04 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -220,7 +220,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, if (!f.open(nom_index)) error("Error opening file - %s", nom_index.c_str()); filesize = f.size(); - for (int i = 0; i < (filesize / 4); ++i) + for (i = 0; i < (filesize / 4); ++i) Index[i] = f.readUint32LE(); f.close(); } @@ -255,8 +255,8 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, do { v13 = *v59; if ((byte)(*v59 + 46) > 0x1Bu) { - if ((unsigned __int8)(v13 + 80) > 0x1Bu) { - if ((unsigned __int8)(v13 - 65) <= 0x19u || (unsigned __int8)(v13 - 97) <= 0x19u) + if ((byte)(v13 + 80) > 0x1Bu) { + if ((byte)(v13 - 65) <= 0x19u || (byte)(v13 - 97) <= 0x19u) v13 = 32; } else { v13 -= 79; @@ -289,7 +289,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, if (v64 + 1 > 0) { do { v16 = *(v60 + v15); - if ((unsigned __int8)v16 <= 0x1Fu) + if ((byte)v16 <= 0x1Fu) v16 = 32; _vm->_globals.largeur_boite += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v16 - 32); ++v15; @@ -373,7 +373,7 @@ LABEL_57: v25 = 0; if (TRIER_TEXT[v67] < TRIER_TEXT[v25]) TRIER_TEXT[v67] = 0; - } while (v25 != (signed __int16)v67); + } while (v25 != (int16)v67); ++v67; } while (v67 <= 19); v68 = 0; @@ -383,7 +383,7 @@ LABEL_57: ++v68; } while (v68 <= 19); - if ((unsigned __int16)(Txt[idx].field3FC - 2) > 1u) { + if ((uint16)(Txt[idx].field3FC - 2) > 1u) { for (i = xp - _vm->_eventsManager.start_x; _vm->_globals.largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC; i -= 2) ; Txt[idx].xp = i; @@ -418,7 +418,7 @@ LABEL_57: v56 = v28; } v29 = Txt[idx].field3FC; - if (v29 == 1 || v29 == 3 || (unsigned __int16)(v29 - 5) <= 1u) { + if (v29 == 1 || v29 == 3 || (uint16)(v29 - 5) <= 1u) { v49 = v51 * v53; ptrd = _vm->_globals.dos_malloc2(v51 * v53); if (ptrd == g_PTRNUL) { -- cgit v1.2.3 From dc358dab61b726e74818f15e9e3f2b04974487d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:26:40 +1100 Subject: HOPKINS: Fix gcc identified warnings in graphics.cpp --- engines/hopkins/graphics.cpp | 112 +++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index feecff9c2c..17cf8714cc 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1266,7 +1266,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { int v2; const byte *v3; - unsigned __int8 v4; + byte v4; v2 = 0; v3 = srcData; @@ -1831,15 +1831,15 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp clip_y = 0; clip_x1 = 0; clip_y1 = 0; - if ((unsigned __int16)xp300 > min_x) { - if ((unsigned __int16)xp300 < (unsigned __int16)(min_x + 300)) + if ((uint16)xp300 > min_x) { + if ((uint16)xp300 < (uint16)(min_x + 300)) clip_x = min_x + 300 - xp300; - if ((unsigned __int16)yp300 > min_y) { - if ((unsigned __int16)yp300 < (unsigned __int16)(min_y + 300)) + if ((uint16)yp300 > min_y) { + if ((uint16)yp300 < (uint16)(min_y + 300)) clip_y = min_y + 300 - yp300; - if ((unsigned __int16)xp300 < (unsigned __int16)(max_x + 300)) { + if ((uint16)xp300 < (uint16)(max_x + 300)) { clip_x1 = max_x + 300 - xp300; - if ((unsigned __int16)yp300 < (unsigned __int16)(max_y + 300)) { + if ((uint16)yp300 < (uint16)(max_y + 300)) { clip_y1 = max_y + 300 - yp300; v14 = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; if (a7) { @@ -1854,28 +1854,28 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if (a8) { v29 = v20 + v14; if (clip_y) { - if ((unsigned __int16)clip_y >= v22) + if ((uint16)clip_y >= v22) return; v61 = v22; v52 = v20; v30 = 0; - v31 = (unsigned __int16)clip_y; + v31 = (uint16)clip_y; while (Asm_Zoom(v30 + 1, a7) < v31) ; v20 = v52; v13 += Largeur * v30; - v29 += nbrligne2 * (unsigned __int16)clip_y; - v22 = v61 - (unsigned __int16)clip_y; + v29 += nbrligne2 * (uint16)clip_y; + v22 = v61 - (uint16)clip_y; } - if (v22 > (unsigned __int16)clip_y1) - v22 = (unsigned __int16)clip_y1; + if (v22 > (uint16)clip_y1) + v22 = (uint16)clip_y1; if (clip_x) { - if ((unsigned __int16)clip_x >= v20) + if ((uint16)clip_x >= v20) return; - v20 -= (unsigned __int16)clip_x; + v20 -= (uint16)clip_x; } - if (v20 > (unsigned __int16)clip_x1) { - v32 = v20 - (unsigned __int16)clip_x1; + if (v20 > (uint16)clip_x1) { + v32 = v20 - (uint16)clip_x1; v29 -= v32; v62 = v22; v33 = 0; @@ -1884,7 +1884,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v34 = v33; v22 = v62; v13 += v34; - v20 = (unsigned __int16)clip_x1; + v20 = (uint16)clip_x1; } do { while (1) { @@ -1902,7 +1902,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++v13; if (!Agr_Flag_x) Agr_x = a7 + Agr_x; - if ((unsigned __int16)Agr_x < 0x64u) + if ((uint16)Agr_x < 0x64u) break; Agr_x = Agr_x - 100; --v13; @@ -1920,7 +1920,7 @@ R_Aff_Zoom_Larg_Cont1: ++Compteur_y; if (!Agr_Flag_y) Agr_y = a7 + Agr_y; - if ((unsigned __int16)Agr_y < 0x64u) + if ((uint16)Agr_y < 0x64u) break; Agr_y = Agr_y - 100; v13 = v46; @@ -1934,38 +1934,38 @@ R_Aff_Zoom_Larg_Cont1: } while (v63 != 1); } else { if (clip_y) { - if ((unsigned __int16)clip_y >= v22) + if ((uint16)clip_y >= v22) return; v58 = v22; v49 = v20; v23 = 0; - v24 = (unsigned __int16)clip_y; + v24 = (uint16)clip_y; while (Asm_Zoom(v23 + 1, a7) < v24) ; v20 = v49; v13 += Largeur * v23; - v14 += nbrligne2 * (unsigned __int16)clip_y; - v22 = v58 - (unsigned __int16)clip_y; + v14 += nbrligne2 * (uint16)clip_y; + v22 = v58 - (uint16)clip_y; } - if (v22 > (unsigned __int16)clip_y1) - v22 = (unsigned __int16)clip_y1; + if (v22 > (uint16)clip_y1) + v22 = (uint16)clip_y1; if (clip_x) { - if ((unsigned __int16)clip_x >= v20) + if ((uint16)clip_x >= v20) return; v59 = v22; v50 = v20; - v25 = (unsigned __int16)clip_x; + v25 = (uint16)clip_x; v26 = 0; while (Asm_Zoom(v26 + 1, a7) < v25) ; v27 = v26; v22 = v59; v13 += v27; - v14 += (unsigned __int16)clip_x; - v20 = v50 - (unsigned __int16)clip_x; + v14 += (uint16)clip_x; + v20 = v50 - (uint16)clip_x; } - if (v20 > (unsigned __int16)clip_x1) - v20 = (unsigned __int16)clip_x1; + if (v20 > (uint16)clip_x1) + v20 = (uint16)clip_x1; do { while (1) { v60 = v22; @@ -1982,7 +1982,7 @@ R_Aff_Zoom_Larg_Cont1: ++v13; if (!Agr_Flag_x) Agr_x = a7 + Agr_x; - if ((unsigned __int16)Agr_x < 0x64u) + if ((uint16)Agr_x < 0x64u) break; Agr_x = Agr_x - 100; --v13; @@ -1999,7 +1999,7 @@ Aff_Zoom_Larg_Cont1: v14 = nbrligne2 + v51; if (!Agr_Flag_y) Agr_y = a7 + Agr_y; - if ((unsigned __int16)Agr_y < 0x64u) + if ((uint16)Agr_y < 0x64u) break; Agr_y = Agr_y - 100; v13 = v45; @@ -2026,13 +2026,13 @@ Aff_Zoom_Larg_Cont1: v65 = v36; v55 = v40; Red_y = Red + Red_y; - if ((unsigned __int16)Red_y < 0x64u) { + if ((uint16)Red_y < 0x64u) { Red_x = 0; v41 = Largeur; v42 = v37; do { Red_x = Red + Red_x; - if ((unsigned __int16)Red_x < 0x64u) { + if ((uint16)Red_x < 0x64u) { if (v42 >= clip_x && v42 < clip_x1 && *v13) *v40 = *v13; --v40; @@ -2057,13 +2057,13 @@ Aff_Zoom_Larg_Cont1: v64 = v36; v54 = v14; Red_y = Red + Red_y; - if ((unsigned __int16)Red_y < 0x64u) { + if ((uint16)Red_y < 0x64u) { Red_x = 0; v38 = Largeur; v39 = 0; do { Red_x = Red + Red_x; - if ((unsigned __int16)Red_x < 0x64u) { + if ((uint16)Red_x < 0x64u) { if (v39 >= clip_x && v39 < clip_x1 && *v13) *v14 = *v13; ++v14; @@ -2092,13 +2092,13 @@ Aff_Zoom_Larg_Cont1: v16 = v11 + v14; spec_largeur = v11; if (clip_y) { - if ((unsigned __int16)clip_y >= (unsigned int)v12) + if ((uint16)clip_y >= (unsigned int)v12) return; - v13 += v11 * (unsigned __int16)clip_y; - v16 += nbrligne2 * (unsigned __int16)clip_y; - v12 -= (unsigned __int16)clip_y; + v13 += v11 * (uint16)clip_y; + v16 += nbrligne2 * (uint16)clip_y; + v12 -= (uint16)clip_y; } - v17 = (unsigned __int16)clip_y1; + v17 = (uint16)clip_y1; if (v12 > clip_y1) v12 = clip_y1; v17 = clip_x; @@ -2107,11 +2107,11 @@ Aff_Zoom_Larg_Cont1: return; v11 -= v17; } - if (v11 > (unsigned __int16)clip_x1) { - v18 = v11 - (unsigned __int16)clip_x1; + if (v11 > (uint16)clip_x1) { + v18 = v11 - (uint16)clip_x1; v13 += v18; v16 -= v18; - v11 = (unsigned __int16)clip_x1; + v11 = (uint16)clip_x1; } do { v57 = v12; @@ -2132,23 +2132,23 @@ Aff_Zoom_Larg_Cont1: } else { spec_largeur = v11; if (clip_y) { - if ((unsigned __int16)clip_y >= (unsigned int)v12) + if ((uint16)clip_y >= (unsigned int)v12) return; - v13 += v11 * (unsigned __int16)clip_y; - v14 += nbrligne2 * (unsigned __int16)clip_y; - v12 -= (unsigned __int16)clip_y; + v13 += v11 * (uint16)clip_y; + v14 += nbrligne2 * (uint16)clip_y; + v12 -= (uint16)clip_y; } if (v12 > clip_y1) v12 = clip_y1; if (clip_x) { - if ((unsigned __int16)clip_x >= v11) + if ((uint16)clip_x >= v11) return; - v13 += (unsigned __int16)clip_x; - v14 += (unsigned __int16)clip_x; - v11 -= (unsigned __int16)clip_x; + v13 += (uint16)clip_x; + v14 += (uint16)clip_x; + v11 -= (uint16)clip_x; } - if (v11 > (unsigned __int16)clip_x1) - v11 = (unsigned __int16)clip_x1; + if (v11 > (uint16)clip_x1) + v11 = (uint16)clip_x1; do { v56 = v12; v47 = v14; -- cgit v1.2.3 From 434d946849e2bb559fe9e391859348affa6618f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:28:54 +1100 Subject: HOPKINS: Fix gcc identified warnings in lines.cpp --- engines/hopkins/graphics.cpp | 12 ++++++------ engines/hopkins/lines.cpp | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 17cf8714cc..2ec58a0899 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1274,13 +1274,13 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { v4 = *v3; if (*v3 < 0xFCu) goto Video_Cont_Vbe16a; - if (v4 == -4) + if (v4 == (byte)-4) return; - if (v4 == -3) { + if (v4 == (byte)-3) { v2 += *(v3 + 1); v4 = *(v3 + 2); v3 += 2; - } else if (v4 == -2) { + } else if (v4 == (byte)-2) { v2 += READ_LE_UINT16(v3 + 1); v4 = *(v3 + 3); v3 += 3; @@ -2473,13 +2473,13 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { byteVal = *srcP; if (*srcP < 0xFCu) goto Video_Cont_Vbe; - if (byteVal == -4) + if (byteVal == (byte)-4) return; - if (byteVal == -3) { + if (byteVal == (byte)-3) { destOffset += *(srcP + 1); byteVal = *(srcP + 2); srcP += 2; - } else if (byteVal == -2) { + } else if (byteVal == (byte)-2) { destOffset += (int16)READ_LE_UINT16(srcP + 1); byteVal = *(srcP + 3); srcP += 3; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 500a7e590b..5e4e2a5b93 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2679,19 +2679,19 @@ LABEL_150: if (v90 - a4 < 0) v11 = -v11; v107 = v11 + 1; - if (v10 > (signed __int16)(v11 + 1)) + if (v10 > (int16)(v11 + 1)) v107 = v10; v12 = v107 - 1; v101 = 1000 * v10 / v12; - v99 = 1000 * (signed __int16)(v11 + 1) / v12; + v99 = 1000 * (int16)(v11 + 1) / v12; if (a3 < v7) v101 = -v101; if (a4 < v90) v99 = -v99; - v13 = (signed __int16)v101 / 1000; - v94 = (signed __int16)v99 / 1000; + v13 = (int16)v101 / 1000; + v94 = (int16)v99 / 1000; v91 = -1; - if ((signed __int16)v99 / 1000 == -1 && (unsigned int)v101 <= 0x96) + if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 0x96) v91 = 1; if (v13 == 1) { if ((unsigned int)(v99 + 1) <= 0x97) @@ -2724,24 +2724,24 @@ LABEL_72: if (v95 < 0) v95 = -(v109 - a4); v108 = v95 + 1; - if (v20 > (signed __int16)(v95 + 1)) + if (v20 > (int16)(v95 + 1)) v108 = v20; if (v108 <= 10) goto LABEL_149; v21 = v108 - 1; v102 = 1000 * v20 / v21; - v100 = 1000 * (signed __int16)(v95 + 1) / v21; + v100 = 1000 * (int16)(v95 + 1) / v21; if (a3 < v111) v102 = -v102; if (a4 < v109) v100 = -v100; - v22 = (signed __int16)v102 / 1000; - v96 = (signed __int16)v100 / 1000; + v22 = (int16)v102 / 1000; + v96 = (int16)v100 / 1000; v106 = 1000 * v111; v105 = 1000 * v109; v104 = 1000 * v111 / 1000; v103 = v105 / 1000; - if (!((signed __int16)v102 / 1000) && v96 == -1) + if (!((int16)v102 / 1000) && v96 == -1) v91 = 1; if (v22 == 1) { if (v96 == -1) -- cgit v1.2.3 From 577a25c79359f26429fb2b8a1946d9aa2053b0a0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:32:29 +1100 Subject: HOPKINS: Fix type warnings identified by gcc --- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 126 ++++++++++++++++++++++---------------------- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index a4bd9c13c9..100b77c388 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -491,7 +491,7 @@ void MenuManager::COMPUT_HOPKINS(int idx) { outtext2((const char *)&MenuText[0xD4A]); } do { - v12 = (unsigned __int8)keywin(v2, s2); + v12 = (byte)keywin(v2, s2); v2 = 0; if ((uint16)(v12 - 48) <= 8u) v2 = 1; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 12e5bf6e7c..384b3af5e5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1860,63 +1860,63 @@ LABEL_54: } void ObjectsManager::GOHOME() { - __int16 v0; - __int16 v1; - __int16 v3; - __int16 v4; + int16 v0; + int16 v1; + int16 v3; + int16 v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; - __int16 v9; - __int16 v10; + int16 v9; + int16 v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; int v15; - __int16 v16; + int16 v16; unsigned int v17; unsigned int v18; int v19; - __int16 v20; + int16 v20; unsigned int v21; unsigned int v22; - __int16 v23; - __int16 v24; + int16 v23; + int16 v24; unsigned int v25; unsigned int v26; unsigned int v27; unsigned int v28; - __int16 v29; - __int16 v30; + int16 v29; + int16 v30; unsigned int v31; unsigned int v32; unsigned int v33; unsigned int v34; - __int16 v35; - __int16 v36; + int16 v35; + int16 v36; unsigned int v37; unsigned int v38; unsigned int v39; unsigned int v40; - __int16 v41; - __int16 v42; + int16 v41; + int16 v42; unsigned int v43; unsigned int v44; unsigned int v45; unsigned int v46; - signed __int16 v47; - __int16 v48; - __int16 v49; + int16 v47; + int16 v48; + int16 v49; int v50; - __int16 v51; - __int16 v52; - __int16 v54; + int16 v51; + int16 v52; + int16 v54; int v55; - __int16 v56; - __int16 v57; - __int16 v58; + int16 v56; + int16 v57; + int16 v58; v0 = 0; v58 = 0; @@ -1987,7 +1987,7 @@ LABEL_241: return; } if (_vm->_globals.g_old_sens == 3) { - if ((unsigned __int16)(_vm->_globals.g_old_anim - 24) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 24) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2026,7 +2026,7 @@ LABEL_23: } if (_vm->_globals.g_old_sens != 7) goto LABEL_43; - if ((unsigned __int16)(_vm->_globals.g_old_anim - 24) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 24) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2096,7 +2096,7 @@ LABEL_59: LABEL_60: if (_vm->_globals.g_old_sens != 5) goto LABEL_77; - if ((unsigned __int16)(_vm->_globals.g_old_anim - 48) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 48) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2128,7 +2128,7 @@ LABEL_76: LABEL_77: if (_vm->_globals.g_old_sens != 2) goto LABEL_96; - if ((unsigned __int16)(_vm->_globals.g_old_anim - 12) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 12) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2166,7 +2166,7 @@ LABEL_95: LABEL_96: if (_vm->_globals.g_old_sens != 8) goto LABEL_115; - if ((unsigned __int16)(_vm->_globals.g_old_anim - 12) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 12) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2204,7 +2204,7 @@ LABEL_114: LABEL_115: if (_vm->_globals.g_old_sens != 4) goto LABEL_134; - if ((unsigned __int16)(_vm->_globals.g_old_anim - 36) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 36) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2242,7 +2242,7 @@ LABEL_133: LABEL_134: if (_vm->_globals.g_old_sens != 6) goto LABEL_153; - if ((unsigned __int16)(_vm->_globals.g_old_anim - 36) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 36) > 0xBu) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2396,7 +2396,7 @@ LABEL_153: void ObjectsManager::GOHOME2() { signed int v0; - __int16 v2; + int16 v2; v0 = 2; if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { @@ -2462,10 +2462,10 @@ LABEL_19: // Load Obstacle void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { - __int16 v1; + int16 v1; byte *ptr; - __int16 v4; - __int16 v5; + int16 v4; + int16 v5; _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager.TOTAL_LIGNES = 0; @@ -2502,7 +2502,7 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { int v4; int v5; int v6; - signed __int16 v7; + int16 v7; int v8; byte *v9; int v10; @@ -2511,8 +2511,8 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { byte *v13; int v14; signed int v15; - __int16 v17; - __int16 v18; + int16 v17; + int16 v18; byte *ptr; v1 = 1; @@ -3802,9 +3802,9 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { if (_vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { v27 = 0; while (1) { - v28 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27); - v29 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 2); - v66 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (signed __int16)v27 + 4); + v28 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (int16)v27); + v29 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (int16)v27 + 2); + v66 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (int16)v27 + 4); v27 = v27 + 4; v30 = v27; v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v83, &v88, 0, DERLIGNE); @@ -4183,27 +4183,27 @@ void ObjectsManager::BTDROITE() { int ObjectsManager::MZONE() { signed int result; - __int16 v1; - __int16 v2; + int16 v1; + int16 v2; int v3; - __int16 v4; - __int16 v5; + int16 v4; + int16 v5; int v6; - __int16 v7; + int16 v7; int v8; int v9; - __int16 yCurrent; - __int16 v11; - __int16 j; - __int16 k; - __int16 xCurrent; + int16 yCurrent; + int16 v11; + int16 j; + int16 k; + int16 xCurrent; int v15; - __int16 v16; - __int16 v17; - __int16 v18; - __int16 v19; - __int16 yp; - __int16 xp; + int16 v16; + int16 v17; + int16 v18; + int16 v19; + int16 yp; + int16 xp; v19 = 0; v18 = 0; @@ -7633,7 +7633,7 @@ LABEL_63: } int ObjectsManager::Traduction2(const byte *dataP) { - signed __int16 result; + int16 result; result = 0; if (*dataP != 'F' || *(dataP + 1) != 'C') { @@ -7982,14 +7982,14 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { int v6; - signed __int16 v7; + int16 v7; char v8; __int32 v9; - signed __int16 v10; + int16 v10; __int32 v11; int spriteIndex; char v14; - __int16 v15; + int16 v15; Common::String v16; v15 = 0; @@ -8379,7 +8379,7 @@ LABEL_70: SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 20, 127); _vm->_eventsManager.souris_xy(_vm->_objectsManager.PERX, _vm->_objectsManager.PERY); if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) - _vm->_graphicsManager.SCROLL = (signed __int16)XSPR(0) - 320; + _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; _vm->_objectsManager.VERIFTAILLE(); SPRITE_ON(0); _vm->_globals.CACHE_ON(); -- cgit v1.2.3 From 35136d637739617d2034fcfac6f948d25ddb1088 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:34:27 +1100 Subject: HOPKINS: Fixed further int types --- engines/hopkins/objects.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 384b3af5e5..81e847be71 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -6840,7 +6840,7 @@ void ObjectsManager::VBOB(byte *a1, int idx, int a3, int a4, int a5) { if (idx > 29) error("MAX_VBOB exceeded"); - if (_vm->_globals.VBob[idx].field4 <= 1u) { + if (_vm->_globals.VBob[idx].field4 <= 1) { _vm->_globals.VBob[idx].field4 = 1; _vm->_globals.VBob[idx].field6 = a3; _vm->_globals.VBob[idx].field8 = a4; @@ -7984,9 +7984,9 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 int v6; int16 v7; char v8; - __int32 v9; + int v9; int16 v10; - __int32 v11; + int v11; int spriteIndex; char v14; int16 v15; -- cgit v1.2.3 From 46a21087bd64b997ab833c83872c51eb84288876 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Oct 2012 23:35:51 +1100 Subject: HOPKINS: Fix gcc identified warnings in talk.cpp --- engines/hopkins/talk.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index dc2f8d045c..2ddb74ff09 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1038,14 +1038,14 @@ LABEL_2: void TalkManager::REPONSE2(int a1, int a2) { signed int v3; - __int16 v4; - __int16 v5; - __int16 v6; - __int16 v7; - __int16 v8; - __int16 v9; - __int16 v10; - __int16 v11; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; v3 = 0; if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { -- cgit v1.2.3 From 99e4dbe2a3bb7358f8df07cb444d417bcf247eba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 00:02:07 +1100 Subject: HOPKINS: Corrected incorrect name for Hopkins engine --- engines/engines.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/engines.mk b/engines/engines.mk index 8a08d93996..6022a05f8a 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -76,7 +76,7 @@ endif endif ifdef ENABLE_HOPKINS -DEFINES += -DENABLE_HUGO=$(ENABLE_HOPKINS) +DEFINES += -DENABLE_HOPKINS=$(ENABLE_HOPKINS) MODULES += engines/hopkins endif -- cgit v1.2.3 From 95b2fe37300672313e758d5e8f4e12a89e8fa0e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 00:02:34 +1100 Subject: HOPKINS: Minor string and comment fix --- engines/hopkins/anim.cpp | 2 +- engines/hopkins/debugger.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 128abff389..afaf37253c 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -1141,7 +1141,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a1); if (!f.open(_vm->_globals.NFICHIER)) - error("File not found ", _vm->_globals.NFICHIER.c_str()); + error("File not found - %s", _vm->_globals.NFICHIER.c_str()); f.read(&buf, 6u); f.read(_vm->_graphicsManager.Palette, 0x320u); diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp index fc70e93102..a332d2160e 100644 --- a/engines/hopkins/debugger.cpp +++ b/engines/hopkins/debugger.cpp @@ -35,4 +35,4 @@ void Debugger::setParent(HopkinsEngine *vm) { _vm = vm; } -} // End of namespace Tony +} // End of namespace Hopkins -- cgit v1.2.3 From 1ab3d755b990cbcff7f818f88a19bb1e0aaf90e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 08:57:16 +1100 Subject: HOPKINS: Fix some uniinitialised data identified by Valgrind --- engines/hopkins/globals.cpp | 5 +++++ engines/hopkins/globals.h | 4 ++-- engines/hopkins/graphics.cpp | 11 ++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 349210063e..78cbf31919 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -108,6 +108,11 @@ Globals::Globals() { for (int i = 0; i < 70; ++i) Common::fill((byte *)&Hopkins[i], (byte *)&Hopkins[i] + sizeof(HopkinsItem), 0); + for (int i = 0; i < 36; ++i) + INVENTAIRE[i] = 0; + for (int i = 0; i < 51; ++i) + Common::fill((byte *)&Tri[i], (byte *)&Tri[i] + sizeof(TriItem), 0); + // Initialise fields FR = 0; SVGA = 2; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e2bf5660e8..3b2ef8efa5 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -312,6 +312,8 @@ public: int16 super_parcours[32002]; int Param[2100]; HopkinsItem Hopkins[70]; + int INVENTAIRE[36]; + TriItem Tri[51]; int FR; int SVGA; int internet; @@ -367,8 +369,6 @@ public: int16 *essai1; int16 *essai2; byte *Bufferobjet; - int INVENTAIRE[36]; - TriItem Tri[51]; byte *inventaire2; byte *GESTE; int OBJET_EN_COURS; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 2ec58a0899..f68ac8ce2f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -75,7 +75,8 @@ GraphicsManager::GraphicsManager() { Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); - Common::fill(&Palette[0], &Palette[PALETTE_BLOCK_SIZE], 0); + Common::fill(&Palette[0], &Palette[PALETTE_EXT_BLOCK_SIZE], 0); + Common::fill(&OLD_PAL[0], &OLD_PAL[PALETTE_EXT_BLOCK_SIZE], 0); } GraphicsManager::~GraphicsManager() { @@ -800,9 +801,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface setpal_vga256(palData2); // Loop through fading in the palette - uint16 *pTemp1 = &palData1[2]; + uint16 *pTemp1 = &palData1[1]; for (int fadeIndex = 0; fadeIndex < FADESPD; ++fadeIndex) { - uint16 *pTemp2 = &palData1[4]; + uint16 *pTemp2 = &palData1[2]; for (int palOffset = 0; palOffset < PALETTE_BLOCK_SIZE; palOffset += 3) { if (palData2[palOffset] < palette[palOffset]) { @@ -818,11 +819,11 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface palData2[palOffset + 1] = (v >> 8) & 0xff; } - if (palData2[palOffset + 1] < palette[palOffset + 1]) { + if (palData2[palOffset + 2] < palette[palOffset + 2]) { uint16 *pDest = &pTemp2[palOffset]; uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; *pDest = v; - palData2[palOffset + 1] = (v >> 8) & 0xff; + palData2[palOffset + 2] = (v >> 8) & 0xff; } } -- cgit v1.2.3 From 289ca6e50d32d3bfb71f7ba07973622752354017 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 09:07:19 +1100 Subject: HOPKINS: Fix some more uninitialised variables --- engines/hopkins/events.cpp | 1 + engines/hopkins/hopkins.cpp | 1 + engines/hopkins/talk.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 94810e5c4c..8a1ebdfd7c 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -45,6 +45,7 @@ EventsManager::EventsManager() { lItCounter = 0; ESC_KEY = false; btsouris = 0; + OLD_ICONE = 0; _priorCounterTime = 0; _priorFrameTime = 0; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 84836e2510..cf2b869bfa 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -49,6 +49,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _menuManager.setParent(this); _objectsManager.setParent(this); _soundManager.setParent(this); + _talkManager.setParent(this); } HopkinsEngine::~HopkinsEngine() { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2ddb74ff09..608d74b006 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -955,7 +955,7 @@ void TalkManager::REPONSE(int a1, int a2) { v3 = a2; LABEL_2: v15 = 0; - if (g_PTRNUL != _vm->_globals.COUCOU) { + if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; while (1) { if (*v5 == 'C') { -- cgit v1.2.3 From 37dcdbf52767563c79c476315b39b055b7cf088f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 09:16:15 +1100 Subject: HOPKINS: Fix decoding error in REPONSE --- engines/hopkins/talk.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 608d74b006..0aea2310f4 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -974,10 +974,10 @@ LABEL_2: v5 = v5 + 1; if (v15 == 1) { v6 = v5 + 5; - ptr = _vm->_globals.dos_malloc2(0x26Cu); + ptr = _vm->_globals.dos_malloc2(620); if (g_PTRNUL == ptr) error("TRADUC"); - memset(ptr, 0, 0x26Bu); + memset(ptr, 0, 620); v7 = 0; v12 = 0; v14 = 0; @@ -985,9 +985,12 @@ LABEL_2: v16 = 0; if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'C') { ++v12; + assert(v12 < (620 / 20)); + v8 = (ptr + 20 * v12); v11 = 0; do { + assert(v11 < 20); *(v11++ + v8) = *(v7++ + v6); if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'F') { v16 = 1; @@ -999,7 +1002,7 @@ LABEL_2: } while (v16 != 1); } if (v16 != 1) { - if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'O' && *(v6 + v7 + 2) == 'D') + if (*(v7 + v6) == 'C' && *(v6 + v7 + 1) == 'O' && *(v6 + v7 + 2) == 'D') v14 = 1; if (v16 != 1 && *(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'I' && *(v6 + v7 + 2) == 'N') v14 = 1; -- cgit v1.2.3 From c593f752968a0ceaa7bd7f70244c26caa2ab2efb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 20:07:19 +1100 Subject: HOPKINS: Replaced loading configuration from .ini file to use hard-coded array --- engines/hopkins/files.cpp | 49 ++++++++++------------------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 1fe4eba2ac..151a9a84f8 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -66,45 +66,16 @@ bool FileManager::bsave(const Common::String &file, const void *buf, size_t n) { // Load INI File void FileManager::Chage_Inifile(Common::StringMap &iniParams) { - char *iniData = (char *)CHARGE_FICHIER("config.ini"); - char *ptr = iniData; - - bool endOfFile = false; - while (!endOfFile) { - if (*ptr == '%') { - if (*(ptr + 1) == '%') { - endOfFile = true; - } else { - ++ptr; - - // Get the parameter name - Common::String paramName; - while (*ptr == ' ') - ++ptr; - while (*ptr != '=') { - paramName += toupper(*ptr++); - } - while (paramName.lastChar() == ' ') - paramName.deleteLastChar(); - - // Get the parameter value - Common::String paramValue; - while (*++ptr == ' ') - ; - while (*ptr != ';') { - paramValue += toupper(*ptr++); - } - while (paramValue.lastChar() == ' ') - paramValue.deleteLastChar(); - - iniParams[paramName] = paramValue; - } - } - - ++ptr; - } - - free(iniData); + // TODO: Review whether we can do something cleaner with ScummVM initialisation than + // just initialising the INI array as if it had read in the INI file + + iniParams["FULLSCREEN"] = "NO"; + iniParams["SETMODE"] = "1"; // 640x480 + iniParams["ZOOM"] = "100"; // No zooming + iniParams["VIDEOMEM"] = "YES"; + iniParams["FORCE8BITS"] = "NO"; + iniParams["FORCE16BITS"] = "YES"; + iniParams["SOUND"] = "YES"; } // Load File -- cgit v1.2.3 From bf0290f6a43f7310a2bcb5c4ee032c83006865fe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 20:40:19 +1100 Subject: HOPKINS: Moved the script execution code to it's own file --- engines/hopkins/graphics.cpp | 6 +- engines/hopkins/hopkins.cpp | 1 + engines/hopkins/hopkins.h | 2 + engines/hopkins/module.mk | 1 + engines/hopkins/objects.cpp | 2690 +++--------------------------------------- engines/hopkins/objects.h | 5 - engines/hopkins/script.cpp | 2410 +++++++++++++++++++++++++++++++++++++ engines/hopkins/script.h | 50 + engines/hopkins/talk.cpp | 6 +- 9 files changed, 2633 insertions(+), 2538 deletions(-) create mode 100644 engines/hopkins/script.cpp create mode 100644 engines/hopkins/script.h diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f68ac8ce2f..31c0cee4a2 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2353,11 +2353,11 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { } else { v11 = 0; do { - v6 = _vm->_objectsManager.Traduction(ptr + 20 * v2); + v6 = _vm->_scriptManager.Traduction(ptr + 20 * v2); if (v6 == 2) - v2 = _vm->_objectsManager.Control_Goto((ptr + 20 * v2)); + v2 = _vm->_scriptManager.Control_Goto((ptr + 20 * v2)); if (v6 == 3) - v2 = _vm->_objectsManager.Control_If(ptr, v2); + v2 = _vm->_scriptManager.Control_If(ptr, v2); if (v2 == -1) error("Error, defective IFF"); if (v6 == 1 || v6 == 4) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index cf2b869bfa..dc2cc4969c 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -48,6 +48,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _linesManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); + _scriptManager.setParent(this); _soundManager.setParent(this); _talkManager.setParent(this); } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 06b87bdacb..3564e1f4fe 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -41,6 +41,7 @@ #include "hopkins/lines.h" #include "hopkins/menu.h" #include "hopkins/objects.h" +#include "hopkins/script.h" #include "hopkins/sound.h" #include "hopkins/talk.h" @@ -104,6 +105,7 @@ public: LinesManager _linesManager; MenuManager _menuManager; ObjectsManager _objectsManager; + ScriptManager _scriptManager; SoundManager _soundManager; TalkManager _talkManager; public: diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index ff74626ea6..dbed88c668 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \ lines.o \ menu.o \ objects.o \ + script.o \ sound.o \ talk.o diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 81e847be71..42647f338c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -84,7 +84,6 @@ ObjectsManager::ObjectsManager() { MAX_DEPA1 = 0; VIRE_INVENT = 0; AFFINVEN = 0; - TRAVAILOBJET = 0; CH_TETE = 0; T_RECTIF = 0; DESACTIVE = 0; @@ -3293,12 +3292,13 @@ LABEL_7: if (_vm->_eventsManager.btsouris == 8) v20 = 1; if (v20 != 1) { - TRAVAILOBJET = 1; + _vm->_scriptManager.TRAVAILOBJET = 1; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; OPTI_OBJET(); - TRAVAILOBJET = 0; + _vm->_scriptManager.TRAVAILOBJET = 0; + if (_vm->_soundManager.VOICEOFF == 1) { do _vm->_eventsManager.VBL(); @@ -4492,11 +4492,11 @@ void ObjectsManager::OPTI_OBJET() { } else { v7 = 0; do { - v5 = Traduction(data + 20 * v0); + v5 = _vm->_scriptManager.Traduction(data + 20 * v0); if (v5 == 2) - v0 = Control_Goto(data + 20 * v0); + v0 = _vm->_scriptManager.Control_Goto(data + 20 * v0); if (v5 == 3) - v0 = Control_If(data, v0); + v0 = _vm->_scriptManager.Control_If(data, v0); if (v0 == -1) error("defective IFF function"); if (v5 == 1 || v5 == 4) @@ -4640,2348 +4640,172 @@ void ObjectsManager::SPECIAL_JEU() { } } -int ObjectsManager::Traduction(byte *a1) { - int v1; - int v2; +void ObjectsManager::BOB_VIVANT(int idx) { + int v1; + int v2; int v3; int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int v28; - int v29; - int v30; - int v31; - int v32; - int v33; - int v34; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v43; - int v44; - int v45; - int v46; - char v47; - char v48; - char v49; - int v50; - Sauvegarde1 *v51; - int v52; - Sauvegarde1 *v53; - int v54; - int v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v65; - int v66; - int v67; - int v68; - int v69; - int v70; - int v71; - int v72; - int v73; - int v74; - int v75; - int v76; - Common::String v77; - Common::String s; - v1 = 0; - v70 = 0; - if (*a1 != 'F' || *(a1 + 1) != 'C') - return 0; - if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { - v70 = *(a1 + 6); - v2 = *(a1 + 7); - v69 = *(a1 + 8); - v67 = (int16)READ_LE_UINT16(a1 + 9); - v65 = (int16)READ_LE_UINT16(a1 + 11); - v3 = (int16)READ_LE_UINT16(a1 + 13); - v1 = 1; - if (!TRAVAILOBJET) { - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { - if (v3 == 53) - v3 = 644; - if (v3 == 624) - v3 = 639; - if (v3 == 627) - v3 = 630; - if (v3 == 625) - v3 = 639; - if (v3 == 8) - v3 = 637; - if (v3 == 53) - v3 = 644; - if (v3 == 557) - v3 = 636; - if (v3 == 51) - v3 = 644; - if (v3 == 287) - v3 = 636; - if (v3 == 619) - v3 = 633; - if (v3 == 620) - v3 = 634; - if (v3 == 622) - v3 = 644; - if (v3 == 297) - v3 = 636; - if (v3 == 612) - v3 = 636; - if ((uint16)(v3 - 613) <= 1u || v3 == 134) - v3 = 636; - if (v3 == 615) - v3 = 635; - if (v3 == 618) - v3 = 632; - if (v3 == 611) - v3 = 642; - if (v3 == 610) - v3 = 641; - if (v3 == 18) - v3 = 643; - if (v3 == 602) - v3 = 645; - if (v3 == 603) - v3 = 646; - if (v3 == 604) - v3 = 647; - if (v3 == 51) - v3 = 644; - if (v3 == 607) - v3 = 650; - if (v3 == 605) - v3 = 648; - if (v3 == 606) - v3 = 649; - if (v3 == 601) - v3 = 652; - if (v3 == 37) - v3 = 636; - if (v3 == 595) - v3 = 633; - if (v3 == 596) - v3 = 634; - if (v3 == 532) - v3 = 636; - if (v3 == 599) - v3 = 636; - if (v3 == 363) - v3 = 636; - } - if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { - do - _vm->_eventsManager.VBL(); - while (_vm->_soundManager.SOUND_FLAG); - } - if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.DOS_TEXT(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); - if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); - } - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(v3, 4); - } - if (TRAVAILOBJET == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField356]) { - _vm->_fontManager.DOS_TEXT(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); - if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(635, 4); - goto LABEL_104; - } - if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.DOS_TEXT(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.DOS_TEXT(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - if (_vm->_globals.FR == 2) { - if (_vm->_soundManager.TEXTOFF) { -LABEL_98: - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(v3, 5); - goto LABEL_104; - } - _vm->_fontManager.DOS_TEXT(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - } - if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); - goto LABEL_98; - } + v1 = 5 * idx; + v2 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); + v3 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 2); + v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); + if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { + if (!_vm->_globals.NO_OFFSET) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, + _vm->_graphicsManager.ofscroll + v2, v3, + *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); + if (_vm->_globals.NO_OFFSET) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, v2, v3, v4); } -LABEL_104: - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { - if (DESACTIVE != 1) { - v72 = *(a1 + 5); - v70 = *(a1 + 6); - v4 = *(a1 + 7); - v68 = (int16)READ_LE_UINT16(a1 + 8); - v66 = (int16)READ_LE_UINT16(a1 + 10); - if (v72 == 52) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(a1 + 10), v70); - } else if (v72 == 51) { - BOB_VIVANT(v70); - } else { - if (v72 == 50) - goto LABEL_1141; - VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); - if (v4) - v4 /= _vm->_globals.vitesse; - if (v4 > 1) { - do { - --v4; - _vm->_eventsManager.VBL(); - } while (v4); - } - if (v72 == 50) -LABEL_1141: - AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); - } - } - v1 = 1; - } - if (*(a1 + 2) == 'S') { - if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { - if (DESACTIVE != 1) { - DEUXPERSO = 0; - v5 = *(a1 + 5); - v6 = (int16)READ_LE_UINT16(a1 + 8); - PERX = (int16)READ_LE_UINT16(a1 + 6); - PERY = v6; - PERI = v5; - if (CH_TETE == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 - && _vm->_globals.SAUVEGARDE->data[svField180] - && _vm->_globals.SAUVEGARDE->data[svField181] - && _vm->_globals.SAUVEGARDE->data[svField182] - && _vm->_globals.SAUVEGARDE->data[svField183]) { - PERX = _vm->_globals.SAUVEGARDE->data[svField180]; - PERY = _vm->_globals.SAUVEGARDE->data[svField181]; - PERI = _vm->_globals.SAUVEGARDE->data[svField182]; - } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->data[svField190] - && _vm->_globals.SAUVEGARDE->data[svField191] - && _vm->_globals.SAUVEGARDE->data[svField192] - && _vm->_globals.SAUVEGARDE->data[svField193]) { - PERX = _vm->_globals.SAUVEGARDE->data[svField190]; - PERY = _vm->_globals.SAUVEGARDE->data[svField191]; - PERI = _vm->_globals.SAUVEGARDE->data[svField192]; - } - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->data[svField185] - && _vm->_globals.SAUVEGARDE->data[svField186] - && _vm->_globals.SAUVEGARDE->data[svField187] - && _vm->_globals.SAUVEGARDE->data[svField188]) { - PERX = _vm->_globals.SAUVEGARDE->data[svField185]; - PERY = _vm->_globals.SAUVEGARDE->data[svField186]; - PERI = _vm->_globals.SAUVEGARDE->data[svField187]; - } - } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { - SPRITE( - _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->data[svField185], - _vm->_globals.SAUVEGARDE->data[svField186], - 1, - 2, - _vm->_globals.SAUVEGARDE->data[svField189], - 0, - 34, - 190); - SPRITE_ON(1); - DEUXPERSO = 1; - } - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->data[svField355] == 1 - && _vm->_globals.SAUVEGARDE->data[svField193] == _vm->_globals.ECRAN) { - SPRITE( - _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->data[svField190], - _vm->_globals.SAUVEGARDE->data[svField191], - 1, - 3, - _vm->_globals.SAUVEGARDE->data[svField194], - 0, - 20, - 127); - SPRITE_ON(1); - DEUXPERSO = 1; - } - } - v1 = 1; - CH_TETE = 0; - } - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { - if (DESACTIVE != 1) { - v7 = *(a1 + 5); - v70 = *(a1 + 6); - v8 = *(a1 + 7); - v9 = *(a1 + 8); - RECALL = 0; - _vm->_globals.OLD_ECRAN = _vm->_globals.ECRAN; - _vm->_globals.SAUVEGARDE->data[svField6] = _vm->_globals.ECRAN; - _vm->_globals.ECRAN = v7; - _vm->_globals.SAUVEGARDE->data[svField5] = v7; - PTAILLE = v70; - PEROFX = v8; - PEROFY = v9; - } - v1 = 1; - } +} + +void ObjectsManager::VBOB(byte *a1, int idx, int a3, int a4, int a5) { + if (idx > 29) + error("MAX_VBOB exceeded"); + + if (_vm->_globals.VBob[idx].field4 <= 1) { + _vm->_globals.VBob[idx].field4 = 1; + _vm->_globals.VBob[idx].field6 = a3; + _vm->_globals.VBob[idx].field8 = a4; + _vm->_globals.VBob[idx].fieldA = a5; + _vm->_globals.VBob[idx].field14 = a3; + _vm->_globals.VBob[idx].field16 = a4; + _vm->_globals.VBob[idx].field18 = a5; + _vm->_globals.VBob[idx].field0 = a1; + _vm->_globals.VBob[idx].field1C = a1; + if (_vm->_globals.VBob[idx].field10 != g_PTRNUL) + _vm->_globals.VBob[idx].field10 = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); } - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - if (DESACTIVE != 1) - VBOB_OFF((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { - v73 = (int16)READ_LE_UINT16(a1 + 5); - if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { - v70 = 0; - if ((int16)READ_LE_UINT16(a1 + 5) == 14) - v73 = 1; - if (v73 == 17) - v73 = 7; - if (v73 == 18) - v73 = 8; - if (v73 == 19) - v73 = 4; - if (v73 == 15) - v73 = 11; - if (v73 == 16) - v73 = 12; - if (v73 == 1) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(4); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(4); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(4); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(4); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(4); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(4); - } - if (v73 == 2) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(7); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(7); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(7); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(7); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(7); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(7); - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(8); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(8); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(8); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(8); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(8); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(8); - } - if (v73 == 4) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(1); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(1); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(1); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(1); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(1); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(1); - } - if (v73 == 5) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(5); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(5); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(5); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(5); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(5); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(5); - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(6); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(6); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(6); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(6); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(6); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(6); - } - if (v73 == 7) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(2); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(2); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(2); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(2); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(2); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(2); - } - if (v73 == 8) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(3); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(3); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(3); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(3); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(3); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(3); - } - if (v73 == 9) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(5); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(5); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(5); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(5); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(5); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(5); - } - if (v73 == 10) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(6); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(6); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(6); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(6); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(6); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(6); - } - if (v73 == 11) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(7); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(7); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(7); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(7); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(7); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(7); - } - if (v73 == 12) { - if (_vm->_globals.ACTION_SENS == 1) - ACTION_DOS(8); - if (_vm->_globals.ACTION_SENS == 3) - ACTION_DROITE(8); - if (_vm->_globals.ACTION_SENS == 2) - Q_DROITE(8); - if (_vm->_globals.ACTION_SENS == 5) - ACTION_FACE(8); - if (_vm->_globals.ACTION_SENS == 8) - Q_GAUCHE(8); - if (_vm->_globals.ACTION_SENS == 7) - ACTION_GAUCHE(8); - } - } - v1 = 1; - } - if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') - v1 = 1; - if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; - if (!v74) - v74 = 1; - v10 = 0; - if (v74 + 1 > 0) { - do { - _vm->_eventsManager.VBL(); - ++v10; - } while (v10 < v74 + 1); - } - v1 = 1; + + int f4 = _vm->_globals.VBob[idx].field4; + if (f4 == 2 || f4 == 4) { + _vm->_globals.VBob[idx].field4 = 3; + _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; + _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; + _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; + _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; + _vm->_globals.VBob[idx].field6 = a3; + _vm->_globals.VBob[idx].field8 = a4; + _vm->_globals.VBob[idx].fieldA = a5; + _vm->_globals.VBob[idx].field0 = a1; } - if (*(a1 + 2) == 'O') { - if (*(a1 + 3) == 'B' && *(a1 + 4) == 'P') { - v1 = 1; - AJOUTE_OBJET((int16)READ_LE_UINT16(a1 + 5)); - } - if (*(a1 + 2) == 'O' && *(a1 + 3) == 'B' && *(a1 + 4) == 'M') { - v1 = 1; - DELETE_OBJET((int16)READ_LE_UINT16(a1 + 5)); - } +} + +void ObjectsManager::VBOB_OFF(int idx) { + if (idx > 29) + error("MAX_VBOB exceeded"); + + if (_vm->_globals.VBob[idx].field4 <= 1) + _vm->_globals.VBob[idx].field4 = 0; + else + _vm->_globals.VBob[idx].field4 = 4; +} + +void ObjectsManager::ACTION_DOS(int idx) { + if (_vm->_globals.GESTE_FLAG != 1) { + if (g_PTRNUL != _vm->_globals.GESTE) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 1; + + _vm->_fileManager.CONSTRUIT_SYSTEM("DOS.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } - if (*(a1 + 2) == 'G' && *(a1 + 3) == 'O' && *(a1 + 4) == 'T') - v1 = 2; - if (*(a1 + 2) == 'Z') { - if (*(a1 + 3) == 'O' && *(a1 + 4) == 'N') { - ZONE_ON((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - ZONE_OFF((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } + if (idx == 1) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + if (idx == 4) + ACTION( + _vm->_globals.GESTE, + "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", + 0, + 0, + 8, + 0); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "20,19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); +} + +void ObjectsManager::ACTION_DROITE(int idx) { + if (_vm->_globals.GESTE_FLAG != 3) { + if (_vm->_globals.GESTE != g_PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 3; + _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } - if (*(a1 + 2) == 'E' && *(a1 + 3) == 'X' && *(a1 + 4) == 'I') - v1 = 5; - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'R') { - _vm->_globals.SORTIE = (int16)READ_LE_UINT16(a1 + 5); - v1 = 5; + if (idx == 1) + ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, 0); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, 0); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, 0); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, 0); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); +} + +void ObjectsManager::Q_DROITE(int idx) { + if (_vm->_globals.GESTE_FLAG != 4) { + if (_vm->_globals.GESTE != g_PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 4; + _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'C' && *(a1 + 4) == 'A') { - _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { - v75 = (int16)READ_LE_UINT16(a1 + 5); - if (v75 <= 100) - BOBANIM_ON(v75); - else - BOBANIM_OFF(v75 - 100); - v1 = 1; - } - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { - v76 = (int16)READ_LE_UINT16(a1 + 5); - if (v76 == 7) - _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); - if (v76 == 8) - _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); - if (v76 == 6) { - SPRITE_OFF(0); - OPTI_ONE(20, 0, 14, 4); - } - if (v76 == 12) { - _vm->_fontManager.TEXTE_OFF(9); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); - } - if (v76 == 600) { - if (!_vm->_globals.internet) { - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_graphicsManager.FADESPD = 1; - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE1A.ANM", 100, 18, 100); - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE1.ANM", 100, 18, 100); - } - _vm->_graphicsManager.LOAD_IMAGE("BOMBEB"); - _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.OPTI_INI("BOMBE", 2); - _vm->_graphicsManager.FADE_INS(); - } - if (v76 == 601) { - _vm->_globals.NO_VISU = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; - OPTI_ONE(2, 0, 16, 4); - } - if (v76 == 602) { - _vm->_globals.NO_VISU = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; - OPTI_ONE(4, 0, 16, 4); - } - if (v76 == 603) { - _vm->_globals.NO_VISU = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; - OPTI_ONE(3, 0, 16, 4); - _vm->_soundManager.SPECIAL_SOUND = 199; - _vm->_graphicsManager.FADE_LINUX = 2; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); - _vm->_graphicsManager.NOFADE = 1; - _vm->_globals.SORTIE = 151; - } - if (v76 == 604) { - _vm->_globals.NO_VISU = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; - OPTI_ONE(1, 0, 16, 4); - _vm->_soundManager.SPECIAL_SOUND = 199; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = 1; - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); - _vm->_globals.SORTIE = 151; - } - if (v76 == 605) { - _vm->_globals.NO_VISU = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; - OPTI_ONE(5, 0, 16, 4); - _vm->_graphicsManager.FADE_OUTS(); - _vm->_soundManager.SPECIAL_SOUND = 199; - _vm->_graphicsManager.FADE_LINUX = 2; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = 1; - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); - _vm->_globals.SORTIE = 151; - } - if (v76 == 606) { - _vm->_globals.NO_VISU = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; - OPTI_ONE(6, 0, 16, 4); - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); - _vm->_globals.SORTIE = 6; - } - if (v76 == 607) { - if (!_vm->_globals.internet) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); - v1 = _vm->_graphicsManager.OLD_PAL[769]; - _vm->_animationManager.PLAY_ANM2("plan.ANm", 50, 10, 800); - } - _vm->_globals.NBBLOC = 0; - } - if (v76 == 608) { - BOBANIM_OFF(2); - BOBANIM_OFF(3); - BOBANIM_OFF(4); - BOBANIM_OFF(6); - BOBANIM_OFF(11); - BOBANIM_OFF(10); - } - if (v76 == 609) { - BOBANIM_ON(2); - BOBANIM_ON(3); - BOBANIM_ON(4); - BOBANIM_ON(6); - BOBANIM_ON(11); - BOBANIM_ON(10); - } - if (v76 == 611) { - BOBANIM_ON(5); - BOBANIM_ON(7); - BOBANIM_ON(8); - BOBANIM_ON(9); - BOBANIM_ON(12); - BOBANIM_ON(13); - } - if (v76 == 610) { - BOBANIM_OFF(5); - BOBANIM_OFF(7); - BOBANIM_OFF(8); - BOBANIM_OFF(9); - BOBANIM_OFF(12); - BOBANIM_OFF(13); - } - if (v76 == 10) - _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); - if (v76 == 11) - _vm->_talkManager.PARLER_PERSO("bqeflic2.pe2"); - if (v76 == 16) - _vm->_talkManager.PARLER_PERSO("ftoubib.pe2"); - if (v76 == 17) - _vm->_talkManager.PARLER_PERSO("flic2b.pe2"); - if (v76 == 18) - _vm->_talkManager.PARLER_PERSO("fjour.pe2"); - if (v76 == 13) { - _vm->_eventsManager.souris_b = _vm->_eventsManager.souris_bb; - _vm->_globals.DESACTIVE_INVENT = 1; - _vm->_graphicsManager.FADE_OUTW(); - _vm->_globals.CACHE_OFF(); - SPRITE_OFF(0); - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); - _vm->_graphicsManager.FIN_VISU(); - CLEAR_ECRAN(); - _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); - _vm->_animationManager.CHARGE_ANIM("otage"); - _vm->_graphicsManager.LOAD_IMAGE("IM05"); - _vm->_graphicsManager.VISU_ALL(); - v11 = 0; - do { - _vm->_eventsManager.VBL(); - ++v11; - } while (v11 <= 4); - _vm->_eventsManager.MOUSE_OFF(); - _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(3) != 100); - _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); - _vm->_graphicsManager.FIN_VISU(); - if (!_vm->_globals.CENSURE) { - _vm->_soundManager.SPECIAL_SOUND = 16; - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_ANM("EGORGE.ANM", 50, 28, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - } - _vm->_animationManager.CHARGE_ANIM("ASCEN"); - _vm->_eventsManager.MOUSE_OFF(); - _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); - _vm->_graphicsManager.VISU_ALL(); - v12 = 0; - do { - _vm->_eventsManager.VBL(); - ++v12; - } while (v12 <= 4); - _vm->_eventsManager.MOUSE_OFF(); - _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); - SCI_OPTI_ONE(1, 0, 17, 3); - _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); - _vm->_graphicsManager.FIN_VISU(); - _vm->_soundManager.SPECIAL_SOUND = 14; - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_globals.DESACTIVE_INVENT = 0; - _vm->_globals.HELICO = 1; - } - if (v76 == 36) { - if (_vm->_globals.SAUVEGARDE->data[svField270] == 2 && _vm->_globals.SAUVEGARDE->data[svField94] == 1 && _vm->_globals.SAUVEGARDE->data[svField95] == 1) - _vm->_globals.SAUVEGARDE->data[svField270] = 3; - if (!_vm->_globals.SAUVEGARDE->data[svField270]) - _vm->_talkManager.PARLER_PERSO2("PATRON0.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] == 1) - _vm->_talkManager.PARLER_PERSO2("PATRON1.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] == 2) - _vm->_talkManager.PARLER_PERSO2("PATRON2.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] == 3) - _vm->_talkManager.PARLER_PERSO2("PATRON3.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] > 3) { - _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); - _vm->_globals.SAUVEGARDE->data[svField270] = 5; - } - } - if (v76 == 37) { - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); - _vm->_graphicsManager.NOFADE = 1; - } - if (v76 == 38) { - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); - _vm->_soundManager.SPECIAL_SOUND = 17; - _vm->_animationManager.PLAY_SEQ(v1, "grenade.SEQ", 1, 32, 100); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_ANM("CREVE17.ANM", 24, 24, 200); - _vm->_soundManager.DEL_SAMPLE(1); - _vm->_soundManager.DEL_SAMPLE(2); - _vm->_soundManager.DEL_SAMPLE(3); - _vm->_graphicsManager.NOFADE = 1; - } - if (v76 == 29) { - _vm->_globals.DESACTIVE_INVENT = 1; - _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); - _vm->_globals.DESACTIVE_INVENT = 0; - } - if (v76 == 22) - _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); - if (v76 == 20) - _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); - if (v76 == 23) - _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); - if (v76 == 35) { - if (!_vm->_soundManager.SOUNDOFF) { - do - _vm->_eventsManager.VBL(); - while (_vm->_soundManager.SOUND_FLAG); - } - _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); - } - if (v76 == 46) { - _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - v13 = YSPR(0); - v14 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); - NUMZONE = -1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SPRITE_OFF(0); - _vm->_globals.NOT_VERIF = 1; - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); - OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - v15 = 0; - do { - if (BOBPOSI(9) == 4 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v15 = 1; - } - if (BOBPOSI(9) == 5) - v15 = 0; - if (BOBPOSI(9) == 16 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v15 = 1; - } - if (BOBPOSI(9) == 17) - v15 = 0; - if (BOBPOSI(9) == 28 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v15 = 1; - } - if (BOBPOSI(9) == 29) - v15 = 0; - if (BOBPOSI(10) == 10 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(2); - v15 = 1; - } - if (BOBPOSI(10) == 11) - v15 = 0; - if (BOBPOSI(10) == 22 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(2); - v15 = 1; - } - if (BOBPOSI(10) == 23) - v15 = 0; - if (BOBPOSI(10) == 33 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(2); - v15 = 1; - } - if (BOBPOSI(10) == 34) - v15 = 0; - if (BOBPOSI(10) == 12) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); - if (BOBPOSI(10) == 23) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); - if (BOBPOSI(10) == 34) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); - _vm->_eventsManager.VBL(); - } while (BOBPOSI(9) != 36); - SPRITE_ON(0); - BOBANIM_OFF(9); - BOBANIM_OFF(10); - _vm->_soundManager.DEL_SAMPLE(1); - _vm->_soundManager.DEL_SAMPLE(2); - } - if (v76 == 59) { - _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - v16 = YSPR(0); - v17 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); - _vm->_globals.NOT_VERIF = 1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SPRITE_OFF(0); - BOBANIM_ON(7); - SET_BOBPOSI(7, 0); - v18 = 0; - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - do { - if (BOBPOSI(7) == 10 && !v18) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v18 = 1; - } - if (BOBPOSI(7) == 11) - v18 = 0; - if (BOBPOSI(7) == 18 && !v18) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v18 = 1; - } - if (BOBPOSI(7) == 19) - v18 = 0; - if (BOBPOSI(7) == 19) - BOBANIM_ON(3); - _vm->_eventsManager.VBL(); - } while (BOBPOSI(3) != 48); - _vm->_soundManager.DEL_SAMPLE(1); - SETANISPR(0, 62); - SPRITE_ON(0); - BOBANIM_ON(6); - BOBANIM_OFF(7); - BOBANIM_OFF(3); - } - if (v76 == 50) { - _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); - OPTI_ONE(11, 0, 23, 0); - } - if (v76 == 49) { - _vm->_globals.CACHE_OFF(); - SPRITE_OFF(0); - OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - v19 = 12; - if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) - v19 = 41; - v20 = 0; - do { - if (BOBPOSI(9) == 4 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); - v20 = 1; - } - if (BOBPOSI(9) == 5) - v20 = 0; - if (BOBPOSI(9) == 18 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); - v20 = 1; - } - if (BOBPOSI(9) == 19) - v20 = 0; - if (BOBPOSI(10) == 11 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); - v20 = 1; - } - if (BOBPOSI(10) == 12) - v20 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(9) != v19); - if (v19 == 12) { - SPRITE_ON(0); - BOBANIM_OFF(9); - } - _vm->_globals.CACHE_ON(); - } - if (v76 == 80) { - SPRITE_OFF(0); - BOBANIM_ON(12); - BOBANIM_ON(13); - SET_BOBPOSI(12, 0); - SET_BOBPOSI(13, 0); - v21 = 0; - _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); - do { - if (BOBPOSI(12) == 4 && !v21) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); - v21 = 1; - } - if (BOBPOSI(12) == 5) - v21 = 0; - if (BOBPOSI(4) == 5 && !v21) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); - v21 = 1; - } - if (BOBPOSI(4) == 6) - v21 = 0; - if (BOBPOSI(13) == 8) { - BOBANIM_OFF(13); - BOBANIM_OFF(3); - BOBANIM_ON(4); - SET_BOBPOSI(4, 0); - SET_BOBPOSI(13, 0); - } - _vm->_eventsManager.VBL(); - } while (BOBPOSI(4) != 16); - BOBANIM_OFF(12); - BOBANIM_OFF(4); - SPRITE_ON(0); - OBSSEUL = 1; - INILINK("IM27a"); - OBSSEUL = 0; - } - if (v76 == 81) { - _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - v22 = YSPR(0); - v23 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); - _vm->_globals.NOT_VERIF = 1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SPRITE_OFF(0); - BOBANIM_ON(11); - BOBANIM_ON(8); - SET_BOBPOSI(11, 0); - SET_BOBPOSI(8, 0); - _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND48.WAV", 2); - _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); - v24 = 0; - do { - if (BOBPOSI(11) == 4 && !v24) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); - v24 = 1; - } - if (BOBPOSI(11) == 5) - v24 = 0; - if (BOBPOSI(8) == 11 && !v24) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); - v24 = 1; - } - if (BOBPOSI(8) == 12) - v24 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(8) != 32); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); - SPRITE_ON(0); - BOBANIM_OFF(11); - BOBANIM_OFF(8); - BOBANIM_ON(5); - BOBANIM_ON(6); - SET_BOBPOSI(5, 0); - SET_BOBPOSI(6, 0); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(5) != 74); - BOBANIM_OFF(5); - BOBANIM_OFF(6); - BOBANIM_ON(9); - BOBANIM_ON(7); - } - if (v76 == 95) { - BOBANIM_ON(9); - BOBANIM_ON(10); - BOBANIM_ON(12); - SET_BOBPOSI(9, 0); - SET_BOBPOSI(10, 0); - SET_BOBPOSI(12, 0); - SPRITE_OFF(0); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(9) != 15); - BOBANIM_OFF(9); - SPRITE_ON(0); - _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(12) != 117); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); - BOBANIM_OFF(12); - BOBANIM_OFF(10); - BOBANIM_ON(11); - } - if (v76 == 85) { - BOBANIM_OFF(3); - BOBANIM_ON(5); - SET_BOBPOSI(5, 0); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(5) != 6); - BOBANIM_OFF(5); - BOBANIM_ON(6); - OBSSEUL = 1; - INILINK("IM24a"); - OBSSEUL = 0; - } - if (v76 == 88) { - if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { - SET_BOBPOSI(1, 0); - SET_BOBPOSI(2, 0); - BOBANIM_ON(1); - BOBANIM_ON(2); - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - v25 = 0; - do { - if (BOBPOSI(1) == 1 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v25 = 1; - } - if (BOBPOSI(1) == 2) - v25 = 0; - if (BOBPOSI(1) == 3 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v25 = 1; - } - if (BOBPOSI(1) == 4) - v25 = 0; - if (BOBPOSI(1) == 5 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v25 = 1; - } - if (BOBPOSI(1) == 6) - v25 = 0; - if (BOBPOSI(1) == 7 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v25 = 1; - } - if (BOBPOSI(1) == 8) - v25 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(1) != 9); - BOBANIM_OFF(1); - BOBANIM_OFF(2); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); - _vm->_soundManager.DEL_SAMPLE(1); - } - if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { - SET_BOBPOSI(1, 0); - SET_BOBPOSI(3, 0); - BOBANIM_ON(1); - BOBANIM_ON(3); - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - v26 = 0; - do { - if (BOBPOSI(1) == 1 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v26 = 1; - } - if (BOBPOSI(1) == 2) - v26 = 0; - if (BOBPOSI(1) == 3 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v26 = 1; - } - if (BOBPOSI(1) == 4) - v26 = 0; - if (BOBPOSI(1) == 5 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v26 = 1; - } - if (BOBPOSI(1) == 6) - v26 = 0; - if (BOBPOSI(1) == 7 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v26 = 1; - } - if (BOBPOSI(1) == 8) - v26 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(1) != 9); - BOBANIM_OFF(1); - BOBANIM_OFF(3); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); - _vm->_soundManager.DEL_SAMPLE(1); - } - } - if (v76 == 90) { - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5A.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); - } - if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5C.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); - } - } - if (v76 == 91) { - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5B.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); - } - if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5D.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); - } - } - if (v76 == 92) { - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6A.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); - } - if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6C.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); - } - } - if (v76 == 93) { - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6B.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); - } - if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6D.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); - } - } - if (v76 == 62) - _vm->_talkManager.OBJET_VIVANT("SBCADA.pe2"); - if (v76 == 65) - _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); - if (v76 == 105) { - _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - v27 = YSPR(0); - v28 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); - } - if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - v29 = YSPR(0); - v30 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); - } - if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - v31 = YSPR(0); - v32 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); - } - _vm->_globals.NOT_VERIF = 1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SPRITE_OFF(0); - SETANISPR(0, 60); - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); - if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - BOBANIM_ON(4); - v33 = 0; - do { - if (BOBPOSI(4) == 9 && !v33) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v33 = 1; - } - if (BOBPOSI(4) == 10) - v33 = 0; - if (BOBPOSI(4) == 32 && !v33) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v33 = 1; - } - if (BOBPOSI(4) == 33) - v33 = 0; - if (BOBPOSI(4) == 55 && !v33) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v33 = 1; - } - if (BOBPOSI(4) == 56) - v33 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(4) != 72); - BOBANIM_OFF(4); - } - if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - BOBANIM_ON(6); - v34 = 0; - do { - if (BOBPOSI(6) == 9 && !v34) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v34 = 1; - } - if (BOBPOSI(6) == 10) - v34 = 0; - if (BOBPOSI(6) == 32 && !v34) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v34 = 1; - } - if (BOBPOSI(6) == 33) - v34 = 0; - if (BOBPOSI(6) == 55 && !v34) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v34 = 1; - } - if (BOBPOSI(6) == 56) - v34 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(6) != 72); - BOBANIM_OFF(6); - } - if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - BOBANIM_ON(5); - v35 = 0; - do { - if (BOBPOSI(5) == 9 && !v35) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v35 = 1; - } - if (BOBPOSI(5) == 10) - v35 = 0; - if (BOBPOSI(5) == 32 && !v35) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v35 = 1; - } - if (BOBPOSI(5) == 33) - v35 = 0; - if (BOBPOSI(5) == 55 && !v35) { - _vm->_soundManager.PLAY_SAMPLE2(1); - v35 = 1; - } - if (BOBPOSI(5) == 56) - v35 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(5) != 72); - BOBANIM_OFF(5); - } - SPRITE_ON(0); - ACTION_DOS(1); - _vm->_soundManager.DEL_SAMPLE(1); - } - if (v76 == 106) { - SPRITE_OFF(0); - BOBANIM_ON(4); - SET_BOBPOSI(4, 0); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(4) != 10); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(4) != 18); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(4) != 62); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(4) != 77); - BOBANIM_OFF(4); - SPRITE_ON(0); - } - if (v76 == 107) { - SPRITE_OFF(0); - BOBANIM_ON(5); - SET_BOBPOSI(5, 0); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(5) != 10); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(5) != 18); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(5) != 38); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(5) != 53); - BOBANIM_OFF(5); - SPRITE_ON(0); - } - if (v76 == 210) { - _vm->_animationManager.NO_SEQ = 1; - _vm->_soundManager.SPECIAL_SOUND = 210; - _vm->_animationManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); - BOBANIM_ON(9); - OBSSEUL = 1; - INILINK("IM73a"); - OBSSEUL = 0; - _vm->_globals.CACHE_ON(); - _vm->_animationManager.NO_SEQ = 0; - _vm->_globals.CACHE_ADD(0); - _vm->_globals.CACHE_ADD(1); - _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); - } - if (v76 == 211) { - SPRITE_OFF(0); - _vm->_globals.CACHE_OFF(); - _vm->_animationManager.NO_SEQ = 1; - _vm->_globals.NO_VISU = 0; - _vm->_soundManager.SPECIAL_SOUND = 211; - _vm->_animationManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_animationManager.NO_SEQ = 0; - _vm->_graphicsManager.NOFADE = 1; - _vm->_graphicsManager.FADE_OUTW(); - v36 = 1; - do { - _vm->_eventsManager.VBL(); - ++v36; - } while (v36 <= 39); - _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); - } - if (v76 == 207) - _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); - if (v76 == 208) { - _vm->_globals.DESACTIVE_INVENT = 1; - if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { - _vm->_soundManager.SPECIAL_SOUND = 208; - _vm->_eventsManager.NOESC = true; - _vm->_animationManager.PLAY_SEQ(v1, "SORT.SEQ", 10, 4, 10); - _vm->_eventsManager.NOESC = false; - _vm->_soundManager.SPECIAL_SOUND = 0; - } - _vm->_globals.NOT_VERIF = 1; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - v37 = YSPR(0); - v38 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); - _vm->_globals.NOT_VERIF = 1; - NUMZONE = 0; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SETANISPR(0, 64); - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; - _vm->_globals.DESACTIVE_INVENT = 0; - } - if (v76 == 209) { - SET_BOBPOSI(1, 0); - SET_BOBPOSI(2, 0); - SETANISPR(0, 60); - BOBANIM_OFF(4); - BOBANIM_ON(1); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(1) != 9); - BOBANIM_OFF(1); - _vm->_globals.NO_VISU = 1; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; - v39 = YSPR(0); - v40 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); - NUMZONE = 0; - _vm->_globals.NOT_VERIF = 1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SETANISPR(0, 64); - BOBANIM_ON(2); - _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(2) != 10); - BOBANIM_OFF(2); - BOBANIM_ON(4); - } - if (v76 == 201) { - BOBANIM_ON(3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(3) != 18); - BOBANIM_OFF(3); - BOBANIM_ON(4); - } - if (v76 == 203) { - _vm->_globals.NO_VISU = 1; - SPRITE_OFF(0); - BOBANIM_ON(4); - do { - _vm->_eventsManager.VBL(); - if (BOBPOSI(4) == 18) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); - } while (BOBPOSI(4) != 26); - BOBANIM_OFF(4); - _vm->_globals.NO_VISU = 0; - SPRITE_ON(0); - } - if (v76 == 204) { - SPRITE_OFF(0); - BOBANIM_ON(3); - _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); - v41 = 0; - do { - if (BOBPOSI(3) == 10 && !v41) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); - v41 = 1; - } - if (BOBPOSI(3) == 11) - v41 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(3) != 50); - BOBANIM_OFF(3); - SPRITE_ON(0); - } - if (v76 == 205) { - SPRITE_OFF(0); - BOBANIM_ON(4); - _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); - v42 = 0; - do { - if (BOBPOSI(4) == 10 && !v42) { - _vm->_soundManager.PLAY_WAV(1); - v42 = 1; - } - if (BOBPOSI(4) == 11) - v42 = 0; - _vm->_eventsManager.VBL(); - } while (BOBPOSI(4) != 24); - BOBANIM_OFF(4); - SPRITE_ON(0); - } - if (v76 == 175) { - SETANISPR(0, 55); - SPRITE_OFF(0); - BOBANIM_ON(9); - BOBANIM_ON(10); - BOB_OFFSET(10, 300); - _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(10) != 7); - BOBANIM_ON(6); - BOBANIM_OFF(3); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(6) != 10); - _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); - BOBANIM_ON(7); - BOBANIM_OFF(4); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(7) != 15); - BOBANIM_OFF(5); - BOBANIM_ON(8); - _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(8) != 76); - BOBANIM_OFF(6); - BOBANIM_OFF(7); - BOBANIM_OFF(8); - BOBANIM_OFF(9); - BOBANIM_OFF(10); - SPRITE_ON(0); - } - if (v76 == 229) { - _vm->_soundManager.SPECIAL_SOUND = 229; - _vm->_animationManager.PLAY_SEQ(v1, "MUR.SEQ", 1, 12, 1); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); - } - if (v76 == 230) { - OBSSEUL = 1; - INILINK("IM93a"); - OBSSEUL = 0; - _vm->_globals.CACHE_ON(); - _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; - v43 = YSPR(0); - v44 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); - _vm->_globals.NOT_VERIF = 1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SPRITE_OFF(0); - v45 = 0; - BOBANIM_ON(7); - do { - if (BOBPOSI(7) == 9 && !v45) { - v45 = 1; - _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); - } - _vm->_eventsManager.VBL(); - } while (BOBPOSI(7) != 15); - BOBANIM_OFF(7); - SETXSPR(0, 476); - SETYSPR(0, 278); - SPRITE_ON(0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); - OBSSEUL = 1; - INILINK("IM93c"); - OBSSEUL = 0; - _vm->_globals.CACHE_ON(); - } - if (v76 == 231) { - _vm->_globals.CACHE_OFF(); - SPRITE_OFF(0); - BOBANIM_ON(12); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(12) != 6); - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); - _vm->_globals.NOPARLE = 0; - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(12) != 12); - SPRITE_ON(0); - BOBANIM_OFF(12); - _vm->_globals.CACHE_ON(); - } - if (v76 == 233) { - _vm->_globals.CACHE_OFF(); - SPRITE_OFF(0); - BOBANIM_ON(11); - v46 = 0; - do { - _vm->_eventsManager.VBL(); - if (BOBPOSI(11) == 10 && !v46) - v46 = 1; - } while (BOBPOSI(11) != 13); - BOBANIM_OFF(11); - _vm->_globals.CACHE_ON(); - BOBANIM_ON(13); - do - _vm->_eventsManager.VBL(); - while (BOBPOSI(13) != 48); - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); - _vm->_globals.NOPARLE = 0; - _vm->_graphicsManager.FADE_OUTW(); - BOBANIM_OFF(13); - _vm->_graphicsManager.NOFADE = 1; - _vm->_globals.SORTIE = 94; - } - if (v76 == 52) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 53) - _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); - if (v76 == 54) - _vm->_talkManager.PARLER_PERSO("GARDE2.pe2"); - if (v76 == 40) - _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); - if (v76 == 236) { - v47 = _vm->_globals.SAUVEGARDE->data[svField341]; - if (v47) { - if (v47 == 2) - v70 = 5; - if (v47 == 3) - v70 = 4; - if (v47 == 1) - v70 = 6; - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); - OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_globals.SAUVEGARDE->data[svField338] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_globals.SAUVEGARDE->data[svField339] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_globals.SAUVEGARDE->data[svField340] = 0; - } - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); - OPTI_ONE(6, 0, 23, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); - } - if (v76 == 237) { - v48 = _vm->_globals.SAUVEGARDE->data[svField341]; - if (v48) { - if (v48 == 2) - v70 = 5; - if (v48 == 3) - v70 = 4; - if (v48 == 1) - v70 = 6; - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); - OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_globals.SAUVEGARDE->data[svField338] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_globals.SAUVEGARDE->data[svField339] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_globals.SAUVEGARDE->data[svField340] = 0; - } - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); - OPTI_ONE(5, 0, 23, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); - } - if (v76 == 238) { - v49 = _vm->_globals.SAUVEGARDE->data[svField341]; - if (v49) { - if (v49 == 2) - v70 = 5; - if (v49 == 3) - v70 = 4; - if (v49 == 1) - v70 = 6; - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); - OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_globals.SAUVEGARDE->data[svField338] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_globals.SAUVEGARDE->data[svField339] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_globals.SAUVEGARDE->data[svField340] = 0; - } - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); - OPTI_ONE(4, 0, 23, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); - } - if (v76 == 239) { - SPRITE_OFF(0); - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); - OPTI_ONE(16, 0, 10, 0); - } - if (v76 == 240) { - BOBANIM_ON(1); - v50 = 0; - do { - _vm->_eventsManager.VBL(); - if (BOBPOSI(1) == 12 && !v50) { - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); - v50 = 1; - } - if (BOBPOSI(1) == 13) - v50 = 0; - if (BOBPOSI(1) == 25 && !v50) { - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); - v50 = 1; - } - if (BOBPOSI(1) == 25) - v50 = 0; - } while (BOBPOSI(1) != 32); - BOBANIM_OFF(1); - BOBANIM_ON(2); - _vm->_fontManager.TEXTE_OFF(9); - if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.DOS_TEXT(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); - _vm->_fontManager.TEXTE_ON(9); - } - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(617, 4); - v71 = 0; - do { - _vm->_eventsManager.VBL(); - ++v71; - } while (v71 <= 29); - v51 = &_vm->_globals.SAUVEGARDE->field370; - v51->field0 = XSPR(0); - v51->field1 = YSPR(0); - v51->field2 = 57; - v51->field3 = 97; - _vm->_globals.SAUVEGARDE->data[svField121] = 1; - _vm->_globals.SAUVEGARDE->data[svField352] = 1; - _vm->_globals.SAUVEGARDE->data[svField353] = 1; - _vm->_globals.SAUVEGARDE->data[svField354] = 1; - } - if (v76 == 56) { - _vm->_fileManager.CONSTRUIT_SYSTEM("HOPFEM.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); - _vm->_globals.PERSO_TYPE = 1; - _vm->_globals.SAUVEGARDE->data[svField122] = 1; - _vm->_globals.HOPKINS_DATA(); - Sprite[18].field0 = 28; - Sprite[20].field0 = 155; - VERIFTAILLE(); - } - if (v76 == 57) { - _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); - _vm->_globals.PERSO_TYPE = 0; - _vm->_globals.SAUVEGARDE->data[svField122] = 0; - _vm->_globals.HOPKINS_DATA(); - Sprite[18].field0 = 34; - Sprite[20].field0 = 190; - VERIFTAILLE(); - } - if (v76 == 25) - _vm->_talkManager.PARLER_PERSO("AGENT1.pe2"); - if (v76 == 26) - _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); - if (v76 == 87) { - if (_vm->_globals.SAUVEGARDE->data[svField188]) - _vm->_talkManager.PARLER_PERSO("stand2.pe2"); - else - _vm->_talkManager.PARLER_PERSO("stand1.pe2"); - } - if (v76 == 86) { - if (_vm->_globals.SAUVEGARDE->data[svField231] == 1) { - _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); - } else { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); - _vm->_globals.NOPARLE = 0; - } - } - if (v76 == 51) { - _vm->_graphicsManager.FADE_OUTW(); - _vm->_globals.CACHE_OFF(); - SPRITE_OFF(0); - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); - _vm->_graphicsManager.FIN_VISU(); - _vm->_graphicsManager.LOAD_IMAGE("IM20f"); - _vm->_animationManager.CHARGE_ANIM("ANIM20f"); - _vm->_graphicsManager.VISU_ALL(); - _vm->_eventsManager.MOUSE_OFF(); - _vm->_graphicsManager.FADE_INW(); - v52 = 0; - _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); - do { - if (BOBPOSI(12) == 5 && !v52) { - _vm->_soundManager.PLAY_WAV(1); - v52 = 1; - } - _vm->_eventsManager.VBL(); - } while (BOBPOSI(12) != 34); - BOBANIM_OFF(2); - _vm->_graphicsManager.FADE_OUTW(); - _vm->_graphicsManager.NOFADE = 1; - _vm->_globals.SORTIE = 20; - } - if (v76 == 41) - _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); - if (v76 == 44) - _vm->_talkManager.PARLER_PERSO("MORT3A.pe2"); - if (v76 == 42) - _vm->_talkManager.PARLER_PERSO("MORT2.pe2"); - if (v76 == 43) - _vm->_talkManager.PARLER_PERSO("MORT1.pe2"); - if (v76 == 47) - _vm->_talkManager.PARLER_PERSO("BARMAN.pe2"); - if (v76 == 45) - _vm->_talkManager.PARLER_PERSO("FEM3.pe2"); - if (v76 == 48) - _vm->_talkManager.PARLER_PERSO("SAMAN2.pe2"); - if (v76 == 21) - _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); - if (v76 == 94) { - if (!_vm->_globals.SAUVEGARDE->data[svField228]) - _vm->_talkManager.PARLER_PERSO("flicn.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField228] == 1) - _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); - } - if (v76 == 27) { - if (_vm->_globals.SAUVEGARDE->data[svField94] != 1 || _vm->_globals.SAUVEGARDE->data[svField95] != 1) - _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); - else - _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); - } - if (v76 == 58) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); - _vm->_globals.SAUVEGARDE->data[svField176] = 1; - _vm->_globals.SAUVEGARDE->data[svField270] = 2; - _vm->_globals.NOPARLE = 0; - } - if (v76 == 200) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 84) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 98) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 83) - _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); - if (v76 == 32) - _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); - if (v76 == 215) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("aviat.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 216) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 170) - _vm->_talkManager.PARLER_PERSO("GRED.pe2"); - if (v76 == 172) - _vm->_talkManager.PARLER_PERSO("GBLEU.pe2"); - if (v76 == 100) - _vm->_talkManager.PARLER_PERSO("tourist.pe2"); - if (v76 == 103) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); - _vm->_globals.NOPARLE = 0; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM2("T421.ANM", 100, 14, 500); - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM2("T421a.ANM", 100, 14, 500); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 104) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 108) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("peche1.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 109) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("peche2.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 110) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("peche3.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 111) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("peche4.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 112) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("teint1.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 176) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("gred2.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 177) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); - _vm->_globals.NOPARLE = 0; - } - if (v76 == 113) - _vm->_talkManager.PARLER_PERSO("teint.pe2"); - if (v76 == 114) - _vm->_talkManager.PARLER_PERSO("tahibar.pe2"); - if (v76 == 115) - _vm->_talkManager.PARLER_PERSO("ilebar.pe2"); - if (v76 == 116) - _vm->_talkManager.PARLER_PERSO("Profred.pe2"); - if (v76 == 101) - _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); - if (v76 == 243) { - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { - _vm->_animationManager.NO_SEQ = 1; - _vm->_animationManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); - _vm->_animationManager.NO_SEQ = 0; - } else { - OPTI_ONE(7, 0, 14, 0); - } - } - if (v76 == 242) { - _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); - _vm->_animationManager.NO_SEQ = 1; - _vm->_animationManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); - _vm->_animationManager.NO_SEQ = 0; - v53 = &_vm->_globals.SAUVEGARDE->field380; - v53->field0 = 404; - v53->field1 = 395; - v53->field2 = 64; - v53->field3 = _vm->_globals.ECRAN; - - v54 = _vm->_globals.STAILLE[790 / 2]; - if (_vm->_globals.STAILLE[790 / 2] < 0) - v54 = -_vm->_globals.STAILLE[790 / 2]; - v76 = -(100 * (67 - (100 - v54)) / 67); - v53->field4 = v76; - _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField355] = 1; - DEUXPERSO = 1; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - SPRITE(_vm->_globals.TETE, v53->field0, v53->field1, 1, 3, v53->field4, 0, 20, 127); - SPRITE_ON(1); - } - if (v76 == 245) { - _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); - OPTI_ONE(5, 0, 6, 0); - _vm->_globals.ZONEP[4].destX = 276; - VERBE_ON(4, 19); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); - _vm->_globals.SAUVEGARDE->data[svField399] = 1; - } - if (v76 == 246) { - SPRITE_OFF(0); - OPTI_ONE(6, 0, 15, 0); - PERSO_ON = 1; - _vm->_graphicsManager.NB_SCREEN(); - _vm->_animationManager.NO_SEQ = 1; - _vm->_animationManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); - _vm->_animationManager.NO_SEQ = 0; - _vm->_graphicsManager.NOFADE = 1; - _vm->_graphicsManager.FADE_OUTW(); - PERSO_ON = 0; - _vm->_globals.SORTIE = 100; - } - if (v76 == 55) { - BOBANIM_OFF(1); - OPTI_ONE(15, 0, 12, 0); - BOBANIM_OFF(15); - OBSSEUL = 1; - INILINK("IM19a"); - OBSSEUL = 0; - } - if (v76 == 241) - _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); - if (v76 == 171) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("gred1.pe2"); - _vm->_globals.NOPARLE = 0; - _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; - v55 = YSPR(0); - v56 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); - _vm->_globals.NOT_VERIF = 1; - NUMZONE = -1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_globals.SORTIE = 59; - } - if (v76 == 173) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); - _vm->_globals.NOPARLE = 0; - _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; - v57 = YSPR(0); - v58 = XSPR(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); - _vm->_globals.NOT_VERIF = 1; - NUMZONE = -1; - do { - GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_globals.SORTIE = 59; - } - if (v76 == 174) - _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); - if (v76 == 202) { - _vm->_globals.NOPARLE = 1; - _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); - _vm->_globals.NOPARLE = 0; - } - v1 = 1; - } - if (*(a1 + 2) == 'E' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') - v1 = 4; - if (*(a1 + 2) == 'V' && *(a1 + 3) == 'A' && *(a1 + 4) == 'L') { - v1 = 1; - _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] = (int16)READ_LE_UINT16(a1 + 7); - } - if (*(a1 + 2) == 'A' && *(a1 + 3) == 'D' && *(a1 + 4) == 'D') { - v1 = 1; - _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] += *(a1 + 7); - } - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'S') { - v1 = 1; - BOB_OFFSET((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); - } - if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'N') { - VERBE_ON((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); - v1 = 1; - } - if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'C' && *(a1 + 4) == 'H') { - _vm->_globals.ZONEP[(int16)READ_LE_UINT16(a1 + 5)].field12 = (int16)READ_LE_UINT16(a1 + 7); - v1 = 1; - } - if (*(a1 + 2) == 'J' && *(a1 + 3) == 'U' && *(a1 + 4) == 'M') { - v59 = (int16)READ_LE_UINT16(a1 + 7); - NVZONE = (int16)READ_LE_UINT16(a1 + 5); - NVVERBE = v59; - v1 = 6; - } - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { - v60 = (int16)READ_LE_UINT16(a1 + 5); - memset(&s, 0, 0x13u); - - v77 = Common::String::format("SOUND%d.WAV", v60); - _vm->_soundManager.PLAY_SOUND(s); - v1 = 1; - } - if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - VERBE_OFF((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); - v1 = 1; - } - if (*(a1 + 2) == 'I' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') { - v1 = 3; - } - - return v1; -} - -void ObjectsManager::BOB_VIVANT(int idx) { - int v1; - int v2; - int v3; - int v4; - - v1 = 5 * idx; - v2 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); - v3 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 2); - v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); - if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { - if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, - _vm->_graphicsManager.ofscroll + v2, v3, - *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); - if (_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, v2, v3, v4); - } -} - -void ObjectsManager::VBOB(byte *a1, int idx, int a3, int a4, int a5) { - if (idx > 29) - error("MAX_VBOB exceeded"); - - if (_vm->_globals.VBob[idx].field4 <= 1) { - _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx].field6 = a3; - _vm->_globals.VBob[idx].field8 = a4; - _vm->_globals.VBob[idx].fieldA = a5; - _vm->_globals.VBob[idx].field14 = a3; - _vm->_globals.VBob[idx].field16 = a4; - _vm->_globals.VBob[idx].field18 = a5; - _vm->_globals.VBob[idx].field0 = a1; - _vm->_globals.VBob[idx].field1C = a1; - if (_vm->_globals.VBob[idx].field10 != g_PTRNUL) - _vm->_globals.VBob[idx].field10 = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); - } - - int f4 = _vm->_globals.VBob[idx].field4; - if (f4 == 2 || f4 == 4) { - _vm->_globals.VBob[idx].field4 = 3; - _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; - _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; - _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; - _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; - _vm->_globals.VBob[idx].field6 = a3; - _vm->_globals.VBob[idx].field8 = a4; - _vm->_globals.VBob[idx].fieldA = a5; - _vm->_globals.VBob[idx].field0 = a1; - } -} - -void ObjectsManager::VBOB_OFF(int idx) { - if (idx > 29) - error("MAX_VBOB exceeded"); - - if (_vm->_globals.VBob[idx].field4 <= 1) - _vm->_globals.VBob[idx].field4 = 0; - else - _vm->_globals.VBob[idx].field4 = 4; -} - -void ObjectsManager::ACTION_DOS(int idx) { - if (_vm->_globals.GESTE_FLAG != 1) { - if (g_PTRNUL != _vm->_globals.GESTE) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 1; - - _vm->_fileManager.CONSTRUIT_SYSTEM("DOS.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - } - if (idx == 1) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); - if (idx == 2) - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, 0); - if (idx == 3) - SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); - if (idx == 4) - ACTION( - _vm->_globals.GESTE, - "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", - 0, - 0, - 8, - 0); - if (idx == 5) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); - if (idx == 6) - SPACTION1(_vm->_globals.GESTE, "20,19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 7) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); - if (idx == 8) - SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 9) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); - if (idx == 10) - SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); -} - -void ObjectsManager::ACTION_DROITE(int idx) { - if (_vm->_globals.GESTE_FLAG != 3) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - } - if (idx == 1) - ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); - if (idx == 2) - SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, 0); - if (idx == 3) - SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); - if (idx == 4) - ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, 0); - if (idx == 5) - SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, 0); - if (idx == 6) - SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); - if (idx == 7) - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, 0); - if (idx == 8) - SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); - if (idx == 9) - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, 0); - if (idx == 10) - SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); -} - -void ObjectsManager::Q_DROITE(int idx) { - if (_vm->_globals.GESTE_FLAG != 4) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - } - if (idx == 1) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); - if (idx == 2) - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, 0); - if (idx == 3) - SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); - if (idx == 4) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); - if (idx == 5) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, 0); - if (idx == 6) - SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); - if (idx == 7) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, 0); - if (idx == 8) - SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 9) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); - if (idx == 10) - SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); -} - -void ObjectsManager::ACTION_FACE(int idx) { - if (_vm->_globals.GESTE_FLAG != 2) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 2; - _vm->_fileManager.CONSTRUIT_SYSTEM("FACE.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + if (idx == 1) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 2) + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, 0); + if (idx == 3) + SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + if (idx == 4) + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + if (idx == 5) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, 0); + if (idx == 6) + SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); + if (idx == 7) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, 0); + if (idx == 8) + SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); + if (idx == 9) + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); + if (idx == 10) + SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); +} + +void ObjectsManager::ACTION_FACE(int idx) { + if (_vm->_globals.GESTE_FLAG != 2) { + if (_vm->_globals.GESTE != g_PTRNUL) + _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE_FLAG = 2; + _vm->_fileManager.CONSTRUIT_SYSTEM("FACE.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -7517,194 +5341,6 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { BOBANIM_OFF(a1); } -int ObjectsManager::Control_Goto(const byte *dataP) { - return (int16)READ_LE_UINT16(dataP + 5); -} - -int ObjectsManager::Control_If(const byte *dataP, int a2) { - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - const byte *v8; - int v9; - int v10; - int v11; - int v12; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - - v2 = a2; -LABEL_2: - v3 = v2; - do { - ++v3; - v4 = Traduction2(dataP + 20 * v3); - if (v3 > 400) { - v5 = v4; - error("Control if failed"); - v4 = v5; - } - } while (v4 != 4); - v20 = v3; - v6 = v2; - v7 = 0; - do { - ++v6; - if (Traduction2(dataP + 20 * v6) == 3) - v7 = 1; - if (v6 > 400) - error("Control if failed "); - if (v7 == 1) { - v2 = v20; - goto LABEL_2; - } - } while (v20 != v6); - v8 = dataP + 20 * a2; - v9 = *(v8 + 13); - v17 = *(v8 + 14); - v16 = *(v8 + 15); - v10 = (int16)READ_LE_UINT16(v8 + 5); - v11 = (int16)READ_LE_UINT16(v8 + 7); - v19 = (int16)READ_LE_UINT16(v8 + 9); - v18 = (int16)READ_LE_UINT16(v8 + 11); - v14 = 0; - v15 = 0; - if (v9 == 1 && _vm->_globals.SAUVEGARDE->data[v10] == v11) - v14 = 1; - if (v9 == 2 && _vm->_globals.SAUVEGARDE->data[v10] != v11) - v14 = 1; - if (v9 == 3 && _vm->_globals.SAUVEGARDE->data[v10] <= v11) - v14 = 1; - if (v9 == 4 && _vm->_globals.SAUVEGARDE->data[v10] >= v11) - v14 = 1; - if (v9 == 5 && _vm->_globals.SAUVEGARDE->data[v10] > v11) - v14 = 1; - if (v9 == 6 && _vm->_globals.SAUVEGARDE->data[v10] < v11) - v14 = 1; - if (v16 == 3) - goto LABEL_68; - if (v17 == 1 && v18 == _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 2 && v18 != _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 3 && v18 >= _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 4 && v18 <= _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 5 && v18 < _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 6 && v18 > _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v16 == 3) { -LABEL_68: - if (v14 == 1) { - v12 = a2; - return (v12 + 1); - } - if (!v14) { -LABEL_63: - v12 = v20; - return (v12 + 1); - } - } - if (v16 == 1) { - if (v14 == 1 && v15 == 1) { - v12 = a2; - return (v12 + 1); - } - goto LABEL_63; - } - if (v16 == 2) { - if (v14 == 1 || v15 == 1) { - v12 = a2; - return (v12 + 1); - } - goto LABEL_63; - } - return -1; -} - -int ObjectsManager::Traduction2(const byte *dataP) { - int16 result; - - result = 0; - if (*dataP != 'F' || *(dataP + 1) != 'C') { - result = 0; - } else { - if (*(dataP + 'T') == 84 && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') - result = 1; - if (*(dataP + 2) == 'B') { - if (*(dataP + 3) == 'O' && *(dataP + 4) == 'B') - result = 1; - if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') - result = 1; - } - if (*(dataP + 2) == 'P' && *(dataP + 3) == 'E' && *(dataP + 4) == 'R') - result = 1; - if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'U') - result = 1; - if (*(dataP + 2) == 'M' && *(dataP + 3) == 'U' && *(dataP + 4) == 'S') - result = 1; - if (*(dataP + 2) == 'O') { - if (*(dataP + 3) == 'B' && *(dataP + 4) == 'P') - result = 1; - if (*(dataP + 2) == 'O' && *(dataP + 3) == 'B' && *(dataP + 4) == 'M') - result = 1; - } - if (*(dataP + 2) == 'G' && *(dataP + 3) == 'O' && *(dataP + 4) == 'T') - result = 2; - if (*(dataP + 2) == 'Z') { - if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') - result = 1; - if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') - result = 1; - } - if (*(dataP + 2) == 'E' && *(dataP + 3) == 'X' && *(dataP + 4) == 'I') - result = 5; - if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'R') - result = 5; - if (*(dataP + 2) == 'A' && *(dataP + 3) == 'N' && *(dataP + 4) == 'I') - result = 1; - if (*(dataP + 2) == 'S' && *(dataP + 3) == 'P' && *(dataP + 4) == 'E') - result = 1; - if (*(dataP + 2) == 'E' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') - result = 4; - if (*(dataP + 2) == 'V') { - if (*(dataP + 3) == 'A' && *(dataP + 4) == 'L') - result = 1; - if (*(dataP + 2) == 'V') { - if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') - result = 1; - if (*(dataP + 2) == 'V' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') - result = 1; - } - } - if (*(dataP + 2) == 'I' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') - result = 3; - if (*(dataP + 2) == 'J' && *(dataP + 3) == 'U' && *(dataP + 4) == 'M') - result = 6; - if (*(dataP + 2) == 'B') { - if (*(dataP + 3) == 'C' && *(dataP + 4) == 'A') - result = 1; - if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'S') - result = 1; - } - if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'C') { - if (*(dataP + 4) == 'H') - result = 1; - } - } - return result; -} - void ObjectsManager::VERBE_OFF(int idx, int a2) { if (a2 == 6) { _vm->_globals.ZONEP[idx].field6 = 0; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 61483a0e88..9757d08612 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -109,7 +109,6 @@ public: int MAX_DEPA1; int VIRE_INVENT; int AFFINVEN; - int TRAVAILOBJET; int CH_TETE; int T_RECTIF; int DESACTIVE; @@ -215,7 +214,6 @@ public: void VALID_OBJET(int a1); void OPTI_OBJET(); void SPECIAL_JEU(); - int Traduction(byte *a1); void BOB_VIVANT(int a1); void VBOB(byte *a1, int a2, int a3, int a4, int a5); void VBOB_OFF(int idx); @@ -242,9 +240,6 @@ public: void SPECIAL_INI(const Common::String &a1); void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); void SCI_OPTI_ONE(int a1, int a2, int a3, int a4); - int Control_Goto(const byte *dataP); - int Control_If(const byte *dataP, int a2); - int Traduction2(const byte *dataP); void VERBE_OFF(int idx, int a2); void VERBE_ON(int idx, int a2); int CALC_PROPRE(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp new file mode 100644 index 0000000000..49d78424eb --- /dev/null +++ b/engines/hopkins/script.cpp @@ -0,0 +1,2410 @@ +/* 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/objects.h" +#include "hopkins/dialogs.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/sound.h" +#include "hopkins/hopkins.h" + +namespace Hopkins { + +ScriptManager::ScriptManager() { + TRAVAILOBJET = 0; +} + +void ScriptManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +int ScriptManager::Traduction(byte *a1) { + int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + int v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33; + int v34; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + char v47; + char v48; + char v49; + int v50; + Sauvegarde1 *v51; + int v52; + Sauvegarde1 *v53; + int v54; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v65; + int v66; + int v67; + int v68; + int v69; + int v70; + int v71; + int v72; + int v73; + int v74; + int v75; + int v76; + Common::String v77; + Common::String s; + + v1 = 0; + v70 = 0; + if (*a1 != 'F' || *(a1 + 1) != 'C') + return 0; + if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { + v70 = *(a1 + 6); + v2 = *(a1 + 7); + v69 = *(a1 + 8); + v67 = (int16)READ_LE_UINT16(a1 + 9); + v65 = (int16)READ_LE_UINT16(a1 + 11); + v3 = (int16)READ_LE_UINT16(a1 + 13); + v1 = 1; + if (!TRAVAILOBJET) { + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { + if (v3 == 53) + v3 = 644; + if (v3 == 624) + v3 = 639; + if (v3 == 627) + v3 = 630; + if (v3 == 625) + v3 = 639; + if (v3 == 8) + v3 = 637; + if (v3 == 53) + v3 = 644; + if (v3 == 557) + v3 = 636; + if (v3 == 51) + v3 = 644; + if (v3 == 287) + v3 = 636; + if (v3 == 619) + v3 = 633; + if (v3 == 620) + v3 = 634; + if (v3 == 622) + v3 = 644; + if (v3 == 297) + v3 = 636; + if (v3 == 612) + v3 = 636; + if ((uint16)(v3 - 613) <= 1u || v3 == 134) + v3 = 636; + if (v3 == 615) + v3 = 635; + if (v3 == 618) + v3 = 632; + if (v3 == 611) + v3 = 642; + if (v3 == 610) + v3 = 641; + if (v3 == 18) + v3 = 643; + if (v3 == 602) + v3 = 645; + if (v3 == 603) + v3 = 646; + if (v3 == 604) + v3 = 647; + if (v3 == 51) + v3 = 644; + if (v3 == 607) + v3 = 650; + if (v3 == 605) + v3 = 648; + if (v3 == 606) + v3 = 649; + if (v3 == 601) + v3 = 652; + if (v3 == 37) + v3 = 636; + if (v3 == 595) + v3 = 633; + if (v3 == 596) + v3 = 634; + if (v3 == 532) + v3 = 636; + if (v3 == 599) + v3 = 636; + if (v3 == 363) + v3 = 636; + } + if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { + do + _vm->_eventsManager.VBL(); + while (_vm->_soundManager.SOUND_FLAG); + } + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(v3, 4); + } + if (TRAVAILOBJET == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField356]) { + _vm->_fontManager.DOS_TEXT(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(635, 4); + goto LABEL_104; + } + if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) + _vm->_fontManager.DOS_TEXT(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) + _vm->_fontManager.DOS_TEXT(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + if (_vm->_globals.FR == 2) { + if (_vm->_soundManager.TEXTOFF) { +LABEL_98: + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(v3, 5); + goto LABEL_104; + } + _vm->_fontManager.DOS_TEXT(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + } + if (!_vm->_soundManager.TEXTOFF) + _vm->_fontManager.TEXTE_ON(9); + goto LABEL_98; + } + } +LABEL_104: + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { + if (_vm->_objectsManager.DESACTIVE != 1) { + v72 = *(a1 + 5); + v70 = *(a1 + 6); + v4 = *(a1 + 7); + v68 = (int16)READ_LE_UINT16(a1 + 8); + v66 = (int16)READ_LE_UINT16(a1 + 10); + if (v72 == 52) { + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(a1 + 10), v70); + } else if (v72 == 51) { + _vm->_objectsManager.BOB_VIVANT(v70); + } else { + if (v72 == 50) + goto LABEL_1141; + _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); + if (v4) + v4 /= _vm->_globals.vitesse; + if (v4 > 1) { + do { + --v4; + _vm->_eventsManager.VBL(); + } while (v4); + } + if (v72 == 50) +LABEL_1141: + _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); + } + } + v1 = 1; + } + if (*(a1 + 2) == 'S') { + if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { + if (_vm->_objectsManager.DESACTIVE != 1) { + _vm->_objectsManager.DEUXPERSO = 0; + v5 = *(a1 + 5); + v6 = (int16)READ_LE_UINT16(a1 + 8); + _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(a1 + 6); + _vm->_objectsManager.PERY = v6; + _vm->_objectsManager.PERI = v5; + if (_vm->_objectsManager.CH_TETE == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 + && _vm->_globals.SAUVEGARDE->data[svField180] + && _vm->_globals.SAUVEGARDE->data[svField181] + && _vm->_globals.SAUVEGARDE->data[svField182] + && _vm->_globals.SAUVEGARDE->data[svField183]) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField180]; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField181]; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField182]; + } + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 + && _vm->_globals.SAUVEGARDE->data[svField190] + && _vm->_globals.SAUVEGARDE->data[svField191] + && _vm->_globals.SAUVEGARDE->data[svField192] + && _vm->_globals.SAUVEGARDE->data[svField193]) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField190]; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField191]; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField192]; + } + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 + && _vm->_globals.SAUVEGARDE->data[svField185] + && _vm->_globals.SAUVEGARDE->data[svField186] + && _vm->_globals.SAUVEGARDE->data[svField187] + && _vm->_globals.SAUVEGARDE->data[svField188]) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField185]; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField186]; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField187]; + } + } + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { + _vm->_objectsManager.SPRITE( + _vm->_globals.TETE, + _vm->_globals.SAUVEGARDE->data[svField185], + _vm->_globals.SAUVEGARDE->data[svField186], + 1, + 2, + _vm->_globals.SAUVEGARDE->data[svField189], + 0, + 34, + 190); + _vm->_objectsManager.SPRITE_ON(1); + _vm->_objectsManager.DEUXPERSO = 1; + } + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 + && _vm->_globals.SAUVEGARDE->data[svField355] == 1 + && _vm->_globals.SAUVEGARDE->data[svField193] == _vm->_globals.ECRAN) { + _vm->_objectsManager.SPRITE( + _vm->_globals.TETE, + _vm->_globals.SAUVEGARDE->data[svField190], + _vm->_globals.SAUVEGARDE->data[svField191], + 1, + 3, + _vm->_globals.SAUVEGARDE->data[svField194], + 0, + 20, + 127); + _vm->_objectsManager.SPRITE_ON(1); + _vm->_objectsManager.DEUXPERSO = 1; + } + } + v1 = 1; + _vm->_objectsManager.CH_TETE = 0; + } + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { + if (_vm->_objectsManager.DESACTIVE != 1) { + v7 = *(a1 + 5); + v70 = *(a1 + 6); + v8 = *(a1 + 7); + v9 = *(a1 + 8); + _vm->_objectsManager.RECALL = 0; + _vm->_globals.OLD_ECRAN = _vm->_globals.ECRAN; + _vm->_globals.SAUVEGARDE->data[svField6] = _vm->_globals.ECRAN; + _vm->_globals.ECRAN = v7; + _vm->_globals.SAUVEGARDE->data[svField5] = v7; + _vm->_objectsManager.PTAILLE = v70; + _vm->_objectsManager.PEROFX = v8; + _vm->_objectsManager.PEROFY = v9; + } + v1 = 1; + } + } + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { + if (_vm->_objectsManager.DESACTIVE != 1) + _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { + v73 = (int16)READ_LE_UINT16(a1 + 5); + if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + v70 = 0; + if ((int16)READ_LE_UINT16(a1 + 5) == 14) + v73 = 1; + if (v73 == 17) + v73 = 7; + if (v73 == 18) + v73 = 8; + if (v73 == 19) + v73 = 4; + if (v73 == 15) + v73 = 11; + if (v73 == 16) + v73 = 12; + if (v73 == 1) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(4); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(4); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(4); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(4); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(4); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(4); + } + if (v73 == 2) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(7); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(7); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(7); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(7); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(7); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(7); + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(8); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(8); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(8); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(8); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(8); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(8); + } + if (v73 == 4) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(1); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(1); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(1); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(1); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(1); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(1); + } + if (v73 == 5) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(5); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(5); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(5); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(5); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(5); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(5); + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(6); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(6); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(6); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(6); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(6); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(6); + } + if (v73 == 7) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(2); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(2); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(2); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(2); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(2); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(2); + } + if (v73 == 8) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(3); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(3); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(3); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(3); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(3); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(3); + } + if (v73 == 9) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(5); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(5); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(5); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(5); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(5); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(5); + } + if (v73 == 10) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(6); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(6); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(6); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(6); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(6); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(6); + } + if (v73 == 11) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(7); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(7); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(7); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(7); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(7); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(7); + } + if (v73 == 12) { + if (_vm->_globals.ACTION_SENS == 1) + _vm->_objectsManager.ACTION_DOS(8); + if (_vm->_globals.ACTION_SENS == 3) + _vm->_objectsManager.ACTION_DROITE(8); + if (_vm->_globals.ACTION_SENS == 2) + _vm->_objectsManager.Q_DROITE(8); + if (_vm->_globals.ACTION_SENS == 5) + _vm->_objectsManager.ACTION_FACE(8); + if (_vm->_globals.ACTION_SENS == 8) + _vm->_objectsManager.Q_GAUCHE(8); + if (_vm->_globals.ACTION_SENS == 7) + _vm->_objectsManager.ACTION_GAUCHE(8); + } + } + v1 = 1; + } + if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') + v1 = 1; + if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { + v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + if (!v74) + v74 = 1; + v10 = 0; + if (v74 + 1 > 0) { + do { + _vm->_eventsManager.VBL(); + ++v10; + } while (v10 < v74 + 1); + } + v1 = 1; + } + if (*(a1 + 2) == 'O') { + if (*(a1 + 3) == 'B' && *(a1 + 4) == 'P') { + v1 = 1; + _vm->_objectsManager.AJOUTE_OBJET((int16)READ_LE_UINT16(a1 + 5)); + } + if (*(a1 + 2) == 'O' && *(a1 + 3) == 'B' && *(a1 + 4) == 'M') { + v1 = 1; + _vm->_objectsManager.DELETE_OBJET((int16)READ_LE_UINT16(a1 + 5)); + } + } + if (*(a1 + 2) == 'G' && *(a1 + 3) == 'O' && *(a1 + 4) == 'T') + v1 = 2; + if (*(a1 + 2) == 'Z') { + if (*(a1 + 3) == 'O' && *(a1 + 4) == 'N') { + _vm->_objectsManager.ZONE_ON((int16)READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { + _vm->_objectsManager.ZONE_OFF((int16)READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + } + if (*(a1 + 2) == 'E' && *(a1 + 3) == 'X' && *(a1 + 4) == 'I') + v1 = 5; + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'R') { + _vm->_globals.SORTIE = (int16)READ_LE_UINT16(a1 + 5); + v1 = 5; + } + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'C' && *(a1 + 4) == 'A') { + _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(a1 + 5)); + v1 = 1; + } + if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { + v75 = (int16)READ_LE_UINT16(a1 + 5); + if (v75 <= 100) + _vm->_objectsManager.BOBANIM_ON(v75); + else + _vm->_objectsManager.BOBANIM_OFF(v75 - 100); + v1 = 1; + } + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { + v76 = (int16)READ_LE_UINT16(a1 + 5); + if (v76 == 7) + _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); + if (v76 == 8) + _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); + if (v76 == 6) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.OPTI_ONE(20, 0, 14, 4); + } + if (v76 == 12) { + _vm->_fontManager.TEXTE_OFF(9); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); + } + if (v76 == 600) { + if (!_vm->_globals.internet) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_graphicsManager.FADESPD = 1; + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE1A.ANM", 100, 18, 100); + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE1.ANM", 100, 18, 100); + } + _vm->_graphicsManager.LOAD_IMAGE("BOMBEB"); + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_graphicsManager.OPTI_INI("BOMBE", 2); + _vm->_graphicsManager.FADE_INS(); + } + if (v76 == 601) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.OPTI_ONE(2, 0, 16, 4); + } + if (v76 == 602) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.OPTI_ONE(4, 0, 16, 4); + } + if (v76 == 603) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); + _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_graphicsManager.FADE_LINUX = 2; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.SORTIE = 151; + } + if (v76 == 604) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); + _vm->_soundManager.SPECIAL_SOUND = 199; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.NOFADE = 1; + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_globals.SORTIE = 151; + } + if (v76 == 605) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); + _vm->_graphicsManager.FADE_OUTS(); + _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_graphicsManager.FADE_LINUX = 2; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.NOFADE = 1; + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_globals.SORTIE = 151; + } + if (v76 == 606) { + _vm->_globals.NO_VISU = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + _vm->_globals.SORTIE = 6; + } + if (v76 == 607) { + if (!_vm->_globals.internet) { + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + v1 = _vm->_graphicsManager.OLD_PAL[769]; + _vm->_animationManager.PLAY_ANM2("plan.ANm", 50, 10, 800); + } + _vm->_globals.NBBLOC = 0; + } + if (v76 == 608) { + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_OFF(11); + _vm->_objectsManager.BOBANIM_OFF(10); + } + if (v76 == 609) { + _vm->_objectsManager.BOBANIM_ON(2); + _vm->_objectsManager.BOBANIM_ON(3); + _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_ON(11); + _vm->_objectsManager.BOBANIM_ON(10); + } + if (v76 == 611) { + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.BOBANIM_ON(8); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.BOBANIM_ON(13); + } + if (v76 == 610) { + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(13); + } + if (v76 == 10) + _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); + if (v76 == 11) + _vm->_talkManager.PARLER_PERSO("bqeflic2.pe2"); + if (v76 == 16) + _vm->_talkManager.PARLER_PERSO("ftoubib.pe2"); + if (v76 == 17) + _vm->_talkManager.PARLER_PERSO("flic2b.pe2"); + if (v76 == 18) + _vm->_talkManager.PARLER_PERSO("fjour.pe2"); + if (v76 == 13) { + _vm->_eventsManager.souris_b = _vm->_eventsManager.souris_bb; + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_graphicsManager.FIN_VISU(); + _vm->_objectsManager.CLEAR_ECRAN(); + _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); + _vm->_animationManager.CHARGE_ANIM("otage"); + _vm->_graphicsManager.LOAD_IMAGE("IM05"); + _vm->_graphicsManager.VISU_ALL(); + v11 = 0; + do { + _vm->_eventsManager.VBL(); + ++v11; + } while (v11 <= 4); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(3) != 100); + _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FIN_VISU(); + if (!_vm->_globals.CENSURE) { + _vm->_soundManager.SPECIAL_SOUND = 16; + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_ANM("EGORGE.ANM", 50, 28, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + } + _vm->_animationManager.CHARGE_ANIM("ASCEN"); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); + _vm->_graphicsManager.VISU_ALL(); + v12 = 0; + do { + _vm->_eventsManager.VBL(); + ++v12; + } while (v12 <= 4); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); + _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FIN_VISU(); + _vm->_soundManager.SPECIAL_SOUND = 14; + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.HELICO = 1; + } + if (v76 == 36) { + if (_vm->_globals.SAUVEGARDE->data[svField270] == 2 && _vm->_globals.SAUVEGARDE->data[svField94] == 1 && _vm->_globals.SAUVEGARDE->data[svField95] == 1) + _vm->_globals.SAUVEGARDE->data[svField270] = 3; + if (!_vm->_globals.SAUVEGARDE->data[svField270]) + _vm->_talkManager.PARLER_PERSO2("PATRON0.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] == 1) + _vm->_talkManager.PARLER_PERSO2("PATRON1.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] == 2) + _vm->_talkManager.PARLER_PERSO2("PATRON2.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] == 3) + _vm->_talkManager.PARLER_PERSO2("PATRON3.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField270] > 3) { + _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); + _vm->_globals.SAUVEGARDE->data[svField270] = 5; + } + } + if (v76 == 37) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); + _vm->_graphicsManager.NOFADE = 1; + } + if (v76 == 38) { + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); + _vm->_soundManager.SPECIAL_SOUND = 17; + _vm->_animationManager.PLAY_SEQ(v1, "grenade.SEQ", 1, 32, 100); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_ANM("CREVE17.ANM", 24, 24, 200); + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.DEL_SAMPLE(2); + _vm->_soundManager.DEL_SAMPLE(3); + _vm->_graphicsManager.NOFADE = 1; + } + if (v76 == 29) { + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (v76 == 22) + _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); + if (v76 == 20) + _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); + if (v76 == 23) + _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); + if (v76 == 35) { + if (!_vm->_soundManager.SOUNDOFF) { + do + _vm->_eventsManager.VBL(); + while (_vm->_soundManager.SOUND_FLAG); + } + _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); + } + if (v76 == 46) { + _vm->_globals.NOT_VERIF = 1; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + v13 = _vm->_objectsManager.YSPR(0); + v14 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); + _vm->_objectsManager.NUMZONE = -1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_globals.NOT_VERIF = 1; + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); + _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + v15 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v15 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 5) + v15 = 0; + if (_vm->_objectsManager.BOBPOSI(9) == 16 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v15 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 17) + v15 = 0; + if (_vm->_objectsManager.BOBPOSI(9) == 28 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v15 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 29) + v15 = 0; + if (_vm->_objectsManager.BOBPOSI(10) == 10 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(2); + v15 = 1; + } + if (_vm->_objectsManager.BOBPOSI(10) == 11) + v15 = 0; + if (_vm->_objectsManager.BOBPOSI(10) == 22 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(2); + v15 = 1; + } + if (_vm->_objectsManager.BOBPOSI(10) == 23) + v15 = 0; + if (_vm->_objectsManager.BOBPOSI(10) == 33 && !v15) { + _vm->_soundManager.PLAY_SAMPLE2(2); + v15 = 1; + } + if (_vm->_objectsManager.BOBPOSI(10) == 34) + v15 = 0; + if (_vm->_objectsManager.BOBPOSI(10) == 12) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); + if (_vm->_objectsManager.BOBPOSI(10) == 23) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); + if (_vm->_objectsManager.BOBPOSI(10) == 34) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(9) != 36); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.DEL_SAMPLE(2); + } + if (v76 == 59) { + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + v16 = _vm->_objectsManager.YSPR(0); + v17 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); + _vm->_globals.NOT_VERIF = 1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.SET_BOBPOSI(7, 0); + v18 = 0; + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + do { + if (_vm->_objectsManager.BOBPOSI(7) == 10 && !v18) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v18 = 1; + } + if (_vm->_objectsManager.BOBPOSI(7) == 11) + v18 = 0; + if (_vm->_objectsManager.BOBPOSI(7) == 18 && !v18) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v18 = 1; + } + if (_vm->_objectsManager.BOBPOSI(7) == 19) + v18 = 0; + if (_vm->_objectsManager.BOBPOSI(7) == 19) + _vm->_objectsManager.BOBANIM_ON(3); + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(3) != 48); + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_objectsManager.SETANISPR(0, 62); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.BOBANIM_OFF(3); + } + if (v76 == 50) { + _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); + _vm->_objectsManager.OPTI_ONE(11, 0, 23, 0); + } + if (v76 == 49) { + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + v19 = 12; + if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) + v19 = 41; + v20 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); + v20 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 5) + v20 = 0; + if (_vm->_objectsManager.BOBPOSI(9) == 18 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); + v20 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 19) + v20 = 0; + if (_vm->_objectsManager.BOBPOSI(10) == 11 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); + v20 = 1; + } + if (_vm->_objectsManager.BOBPOSI(10) == 12) + v20 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(9) != v19); + if (v19 == 12) { + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.BOBANIM_OFF(9); + } + _vm->_globals.CACHE_ON(); + } + if (v76 == 80) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.BOBANIM_ON(13); + _vm->_objectsManager.SET_BOBPOSI(12, 0); + _vm->_objectsManager.SET_BOBPOSI(13, 0); + v21 = 0; + _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); + do { + if (_vm->_objectsManager.BOBPOSI(12) == 4 && !v21) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + v21 = 1; + } + if (_vm->_objectsManager.BOBPOSI(12) == 5) + v21 = 0; + if (_vm->_objectsManager.BOBPOSI(4) == 5 && !v21) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + v21 = 1; + } + if (_vm->_objectsManager.BOBPOSI(4) == 6) + v21 = 0; + if (_vm->_objectsManager.BOBPOSI(13) == 8) { + _vm->_objectsManager.BOBANIM_OFF(13); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.SET_BOBPOSI(4, 0); + _vm->_objectsManager.SET_BOBPOSI(13, 0); + } + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(4) != 16); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM27a"); + _vm->_objectsManager.OBSSEUL = 0; + } + if (v76 == 81) { + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + v22 = _vm->_objectsManager.YSPR(0); + v23 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); + _vm->_globals.NOT_VERIF = 1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(11); + _vm->_objectsManager.BOBANIM_ON(8); + _vm->_objectsManager.SET_BOBPOSI(11, 0); + _vm->_objectsManager.SET_BOBPOSI(8, 0); + _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND48.WAV", 2); + _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); + v24 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(11) == 4 && !v24) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + v24 = 1; + } + if (_vm->_objectsManager.BOBPOSI(11) == 5) + v24 = 0; + if (_vm->_objectsManager.BOBPOSI(8) == 11 && !v24) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + v24 = 1; + } + if (_vm->_objectsManager.BOBPOSI(8) == 12) + v24 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(8) != 32); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.BOBANIM_OFF(11); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.SET_BOBPOSI(5, 0); + _vm->_objectsManager.SET_BOBPOSI(6, 0); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) != 74); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(7); + } + if (v76 == 95) { + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(10); + _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.SET_BOBPOSI(9, 0); + _vm->_objectsManager.SET_BOBPOSI(10, 0); + _vm->_objectsManager.SET_BOBPOSI(12, 0); + _vm->_objectsManager.SPRITE_OFF(0); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(9) != 15); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(12) != 117); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_objectsManager.BOBANIM_ON(11); + } + if (v76 == 85) { + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.SET_BOBPOSI(5, 0); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) != 6); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM24a"); + _vm->_objectsManager.OBSSEUL = 0; + } + if (v76 == 88) { + if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { + _vm->_objectsManager.SET_BOBPOSI(1, 0); + _vm->_objectsManager.SET_BOBPOSI(2, 0); + _vm->_objectsManager.BOBANIM_ON(1); + _vm->_objectsManager.BOBANIM_ON(2); + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + v25 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(1) == 1 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 2) + v25 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 3 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 4) + v25 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 5 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 6) + v25 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 7 && !v25) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v25 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 8) + v25 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(1) != 9); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); + _vm->_soundManager.DEL_SAMPLE(1); + } + if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { + _vm->_objectsManager.SET_BOBPOSI(1, 0); + _vm->_objectsManager.SET_BOBPOSI(3, 0); + _vm->_objectsManager.BOBANIM_ON(1); + _vm->_objectsManager.BOBANIM_ON(3); + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + v26 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(1) == 1 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 2) + v26 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 3 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 4) + v26 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 5 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 6) + v26 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 7 && !v26) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v26 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 8) + v26 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(1) != 9); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); + _vm->_soundManager.DEL_SAMPLE(1); + } + } + if (v76 == 90) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField186]) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB5A.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + } + if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB5C.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); + } + } + if (v76 == 91) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField186]) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB5B.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + } + if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB5D.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); + } + } + if (v76 == 92) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField184]) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB6A.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + } + if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB6C.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); + } + } + if (v76 == 93) { + _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + if (!_vm->_globals.SAUVEGARDE->data[svField184]) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB6B.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + } + if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { + _vm->_animationManager.PLAY_SEQ(v1, "CIB6D.SEQ", 1, 12, 1); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); + } + } + if (v76 == 62) + _vm->_talkManager.OBJET_VIVANT("SBCADA.pe2"); + if (v76 == 65) + _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); + if (v76 == 105) { + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { + v27 = _vm->_objectsManager.YSPR(0); + v28 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { + v29 = _vm->_objectsManager.YSPR(0); + v30 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { + v31 = _vm->_objectsManager.YSPR(0); + v32 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); + } + _vm->_globals.NOT_VERIF = 1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.SETANISPR(0, 60); + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); + if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { + _vm->_objectsManager.BOBANIM_ON(4); + v33 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(4) == 9 && !v33) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v33 = 1; + } + if (_vm->_objectsManager.BOBPOSI(4) == 10) + v33 = 0; + if (_vm->_objectsManager.BOBPOSI(4) == 32 && !v33) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v33 = 1; + } + if (_vm->_objectsManager.BOBPOSI(4) == 33) + v33 = 0; + if (_vm->_objectsManager.BOBPOSI(4) == 55 && !v33) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v33 = 1; + } + if (_vm->_objectsManager.BOBPOSI(4) == 56) + v33 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(4) != 72); + _vm->_objectsManager.BOBANIM_OFF(4); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { + _vm->_objectsManager.BOBANIM_ON(6); + v34 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(6) == 9 && !v34) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v34 = 1; + } + if (_vm->_objectsManager.BOBPOSI(6) == 10) + v34 = 0; + if (_vm->_objectsManager.BOBPOSI(6) == 32 && !v34) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v34 = 1; + } + if (_vm->_objectsManager.BOBPOSI(6) == 33) + v34 = 0; + if (_vm->_objectsManager.BOBPOSI(6) == 55 && !v34) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v34 = 1; + } + if (_vm->_objectsManager.BOBPOSI(6) == 56) + v34 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(6) != 72); + _vm->_objectsManager.BOBANIM_OFF(6); + } + if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { + _vm->_objectsManager.BOBANIM_ON(5); + v35 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(5) == 9 && !v35) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v35 = 1; + } + if (_vm->_objectsManager.BOBPOSI(5) == 10) + v35 = 0; + if (_vm->_objectsManager.BOBPOSI(5) == 32 && !v35) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v35 = 1; + } + if (_vm->_objectsManager.BOBPOSI(5) == 33) + v35 = 0; + if (_vm->_objectsManager.BOBPOSI(5) == 55 && !v35) { + _vm->_soundManager.PLAY_SAMPLE2(1); + v35 = 1; + } + if (_vm->_objectsManager.BOBPOSI(5) == 56) + v35 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(5) != 72); + _vm->_objectsManager.BOBANIM_OFF(5); + } + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.ACTION_DOS(1); + _vm->_soundManager.DEL_SAMPLE(1); + } + if (v76 == 106) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.SET_BOBPOSI(4, 0); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(4) != 10); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(4) != 18); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(4) != 62); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(4) != 77); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.SPRITE_ON(0); + } + if (v76 == 107) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.SET_BOBPOSI(5, 0); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); + _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); + _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) != 10); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) != 18); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) != 38); + _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) != 53); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.SPRITE_ON(0); + } + if (v76 == 210) { + _vm->_animationManager.NO_SEQ = 1; + _vm->_soundManager.SPECIAL_SOUND = 210; + _vm->_animationManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM73a"); + _vm->_objectsManager.OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + _vm->_animationManager.NO_SEQ = 0; + _vm->_globals.CACHE_ADD(0); + _vm->_globals.CACHE_ADD(1); + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); + } + if (v76 == 211) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_globals.CACHE_OFF(); + _vm->_animationManager.NO_SEQ = 1; + _vm->_globals.NO_VISU = 0; + _vm->_soundManager.SPECIAL_SOUND = 211; + _vm->_animationManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_animationManager.NO_SEQ = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.FADE_OUTW(); + v36 = 1; + do { + _vm->_eventsManager.VBL(); + ++v36; + } while (v36 <= 39); + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); + } + if (v76 == 207) + _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); + if (v76 == 208) { + _vm->_globals.DESACTIVE_INVENT = 1; + if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { + _vm->_soundManager.SPECIAL_SOUND = 208; + _vm->_eventsManager.NOESC = true; + _vm->_animationManager.PLAY_SEQ(v1, "SORT.SEQ", 10, 4, 10); + _vm->_eventsManager.NOESC = false; + _vm->_soundManager.SPECIAL_SOUND = 0; + } + _vm->_globals.NOT_VERIF = 1; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + v37 = _vm->_objectsManager.YSPR(0); + v38 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = 0; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SETANISPR(0, 64); + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; + _vm->_globals.DESACTIVE_INVENT = 0; + } + if (v76 == 209) { + _vm->_objectsManager.SET_BOBPOSI(1, 0); + _vm->_objectsManager.SET_BOBPOSI(2, 0); + _vm->_objectsManager.SETANISPR(0, 60); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.BOBANIM_ON(1); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(1) != 9); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_globals.NO_VISU = 1; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v39 = _vm->_objectsManager.YSPR(0); + v40 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); + _vm->_objectsManager.NUMZONE = 0; + _vm->_globals.NOT_VERIF = 1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SETANISPR(0, 64); + _vm->_objectsManager.BOBANIM_ON(2); + _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(2) != 10); + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.BOBANIM_ON(4); + } + if (v76 == 201) { + _vm->_objectsManager.BOBANIM_ON(3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(3) != 18); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.BOBANIM_ON(4); + } + if (v76 == 203) { + _vm->_globals.NO_VISU = 1; + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(4); + do { + _vm->_eventsManager.VBL(); + if (_vm->_objectsManager.BOBPOSI(4) == 18) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); + } while (_vm->_objectsManager.BOBPOSI(4) != 26); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_globals.NO_VISU = 0; + _vm->_objectsManager.SPRITE_ON(0); + } + if (v76 == 204) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(3); + _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); + v41 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { + _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + v41 = 1; + } + if (_vm->_objectsManager.BOBPOSI(3) == 11) + v41 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(3) != 50); + _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.SPRITE_ON(0); + } + if (v76 == 205) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(4); + _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); + v42 = 0; + do { + if (_vm->_objectsManager.BOBPOSI(4) == 10 && !v42) { + _vm->_soundManager.PLAY_WAV(1); + v42 = 1; + } + if (_vm->_objectsManager.BOBPOSI(4) == 11) + v42 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(4) != 24); + _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.SPRITE_ON(0); + } + if (v76 == 175) { + _vm->_objectsManager.SETANISPR(0, 55); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.BOBANIM_ON(10); + _vm->_objectsManager.BOB_OFFSET(10, 300); + _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(10) != 7); + _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.BOBANIM_OFF(3); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(6) != 10); + _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); + _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.BOBANIM_OFF(4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(7) != 15); + _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.BOBANIM_ON(8); + _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(8) != 76); + _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.BOBANIM_OFF(8); + _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_objectsManager.SPRITE_ON(0); + } + if (v76 == 229) { + _vm->_soundManager.SPECIAL_SOUND = 229; + _vm->_animationManager.PLAY_SEQ(v1, "MUR.SEQ", 1, 12, 1); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); + } + if (v76 == 230) { + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM93a"); + _vm->_objectsManager.OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v43 = _vm->_objectsManager.YSPR(0); + v44 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); + _vm->_globals.NOT_VERIF = 1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.SPRITE_OFF(0); + v45 = 0; + _vm->_objectsManager.BOBANIM_ON(7); + do { + if (_vm->_objectsManager.BOBPOSI(7) == 9 && !v45) { + v45 = 1; + _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); + } + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(7) != 15); + _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.SETXSPR(0, 476); + _vm->_objectsManager.SETYSPR(0, 278); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM93c"); + _vm->_objectsManager.OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + } + if (v76 == 231) { + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(12); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(12) != 6); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); + _vm->_globals.NOPARLE = 0; + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(12) != 12); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_globals.CACHE_ON(); + } + if (v76 == 233) { + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.BOBANIM_ON(11); + v46 = 0; + do { + _vm->_eventsManager.VBL(); + if (_vm->_objectsManager.BOBPOSI(11) == 10 && !v46) + v46 = 1; + } while (_vm->_objectsManager.BOBPOSI(11) != 13); + _vm->_objectsManager.BOBANIM_OFF(11); + _vm->_globals.CACHE_ON(); + _vm->_objectsManager.BOBANIM_ON(13); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(13) != 48); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); + _vm->_globals.NOPARLE = 0; + _vm->_graphicsManager.FADE_OUTW(); + _vm->_objectsManager.BOBANIM_OFF(13); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.SORTIE = 94; + } + if (v76 == 52) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 53) + _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); + if (v76 == 54) + _vm->_talkManager.PARLER_PERSO("GARDE2.pe2"); + if (v76 == 40) + _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); + if (v76 == 236) { + v47 = _vm->_globals.SAUVEGARDE->data[svField341]; + if (v47) { + if (v47 == 2) + v70 = 5; + if (v47 == 3) + v70 = 4; + if (v47 == 1) + v70 = 6; + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_globals.SAUVEGARDE->data[svField338] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_globals.SAUVEGARDE->data[svField339] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_globals.SAUVEGARDE->data[svField340] = 0; + } + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); + } + if (v76 == 237) { + v48 = _vm->_globals.SAUVEGARDE->data[svField341]; + if (v48) { + if (v48 == 2) + v70 = 5; + if (v48 == 3) + v70 = 4; + if (v48 == 1) + v70 = 6; + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_globals.SAUVEGARDE->data[svField338] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_globals.SAUVEGARDE->data[svField339] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_globals.SAUVEGARDE->data[svField340] = 0; + } + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); + } + if (v76 == 238) { + v49 = _vm->_globals.SAUVEGARDE->data[svField341]; + if (v49) { + if (v49 == 2) + v70 = 5; + if (v49 == 3) + v70 = 4; + if (v49 == 1) + v70 = 6; + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + _vm->_globals.SAUVEGARDE->data[svField338] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + _vm->_globals.SAUVEGARDE->data[svField339] = 0; + if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + _vm->_globals.SAUVEGARDE->data[svField340] = 0; + } + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); + } + if (v76 == 239) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); + _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); + } + if (v76 == 240) { + _vm->_objectsManager.BOBANIM_ON(1); + v50 = 0; + do { + _vm->_eventsManager.VBL(); + if (_vm->_objectsManager.BOBPOSI(1) == 12 && !v50) { + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); + v50 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 13) + v50 = 0; + if (_vm->_objectsManager.BOBPOSI(1) == 25 && !v50) { + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); + v50 = 1; + } + if (_vm->_objectsManager.BOBPOSI(1) == 25) + v50 = 0; + } while (_vm->_objectsManager.BOBPOSI(1) != 32); + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.BOBANIM_ON(2); + _vm->_fontManager.TEXTE_OFF(9); + if (!_vm->_soundManager.TEXTOFF) { + _vm->_fontManager.DOS_TEXT(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); + _vm->_fontManager.TEXTE_ON(9); + } + if (!_vm->_soundManager.VOICEOFF) + _vm->_soundManager.VOICE_MIX(617, 4); + v71 = 0; + do { + _vm->_eventsManager.VBL(); + ++v71; + } while (v71 <= 29); + v51 = &_vm->_globals.SAUVEGARDE->field370; + v51->field0 = _vm->_objectsManager.XSPR(0); + v51->field1 = _vm->_objectsManager.YSPR(0); + v51->field2 = 57; + v51->field3 = 97; + _vm->_globals.SAUVEGARDE->data[svField121] = 1; + _vm->_globals.SAUVEGARDE->data[svField352] = 1; + _vm->_globals.SAUVEGARDE->data[svField353] = 1; + _vm->_globals.SAUVEGARDE->data[svField354] = 1; + } + if (v76 == 56) { + _vm->_fileManager.CONSTRUIT_SYSTEM("HOPFEM.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 1; + _vm->_globals.SAUVEGARDE->data[svField122] = 1; + _vm->_globals.HOPKINS_DATA(); + _vm->_objectsManager.Sprite[0].field12 = 28; + _vm->_objectsManager.Sprite[0].field14 = 155; + _vm->_objectsManager.VERIFTAILLE(); + } + if (v76 == 57) { + _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + _vm->_globals.SAUVEGARDE->data[svField122] = 0; + _vm->_globals.HOPKINS_DATA(); + _vm->_objectsManager.Sprite[0].field12 = 34; + _vm->_objectsManager.Sprite[0].field14 = 190; + _vm->_objectsManager.VERIFTAILLE(); + } + if (v76 == 25) + _vm->_talkManager.PARLER_PERSO("AGENT1.pe2"); + if (v76 == 26) + _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); + if (v76 == 87) { + if (_vm->_globals.SAUVEGARDE->data[svField188]) + _vm->_talkManager.PARLER_PERSO("stand2.pe2"); + else + _vm->_talkManager.PARLER_PERSO("stand1.pe2"); + } + if (v76 == 86) { + if (_vm->_globals.SAUVEGARDE->data[svField231] == 1) { + _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); + } else { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); + _vm->_globals.NOPARLE = 0; + } + } + if (v76 == 51) { + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.TEXTE_OFF(9); + _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.LOAD_IMAGE("IM20f"); + _vm->_animationManager.CHARGE_ANIM("ANIM20f"); + _vm->_graphicsManager.VISU_ALL(); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_INW(); + v52 = 0; + _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); + do { + if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { + _vm->_soundManager.PLAY_WAV(1); + v52 = 1; + } + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(12) != 34); + _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.NOFADE = 1; + _vm->_globals.SORTIE = 20; + } + if (v76 == 41) + _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); + if (v76 == 44) + _vm->_talkManager.PARLER_PERSO("MORT3A.pe2"); + if (v76 == 42) + _vm->_talkManager.PARLER_PERSO("MORT2.pe2"); + if (v76 == 43) + _vm->_talkManager.PARLER_PERSO("MORT1.pe2"); + if (v76 == 47) + _vm->_talkManager.PARLER_PERSO("BARMAN.pe2"); + if (v76 == 45) + _vm->_talkManager.PARLER_PERSO("FEM3.pe2"); + if (v76 == 48) + _vm->_talkManager.PARLER_PERSO("SAMAN2.pe2"); + if (v76 == 21) + _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); + if (v76 == 94) { + if (!_vm->_globals.SAUVEGARDE->data[svField228]) + _vm->_talkManager.PARLER_PERSO("flicn.pe2"); + if (_vm->_globals.SAUVEGARDE->data[svField228] == 1) + _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); + } + if (v76 == 27) { + if (_vm->_globals.SAUVEGARDE->data[svField94] != 1 || _vm->_globals.SAUVEGARDE->data[svField95] != 1) + _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); + else + _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); + } + if (v76 == 58) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); + _vm->_globals.SAUVEGARDE->data[svField176] = 1; + _vm->_globals.SAUVEGARDE->data[svField270] = 2; + _vm->_globals.NOPARLE = 0; + } + if (v76 == 200) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 84) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 98) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 83) + _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); + if (v76 == 32) + _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); + if (v76 == 215) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("aviat.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 216) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 170) + _vm->_talkManager.PARLER_PERSO("GRED.pe2"); + if (v76 == 172) + _vm->_talkManager.PARLER_PERSO("GBLEU.pe2"); + if (v76 == 100) + _vm->_talkManager.PARLER_PERSO("tourist.pe2"); + if (v76 == 103) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); + _vm->_globals.NOPARLE = 0; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM2("T421.ANM", 100, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM2("T421a.ANM", 100, 14, 500); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 104) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 108) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche1.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 109) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 110) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche3.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 111) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("peche4.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 112) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("teint1.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 176) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gred2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 177) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); + _vm->_globals.NOPARLE = 0; + } + if (v76 == 113) + _vm->_talkManager.PARLER_PERSO("teint.pe2"); + if (v76 == 114) + _vm->_talkManager.PARLER_PERSO("tahibar.pe2"); + if (v76 == 115) + _vm->_talkManager.PARLER_PERSO("ilebar.pe2"); + if (v76 == 116) + _vm->_talkManager.PARLER_PERSO("Profred.pe2"); + if (v76 == 101) + _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); + if (v76 == 243) { + _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); + if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { + _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); + _vm->_animationManager.NO_SEQ = 0; + } else { + _vm->_objectsManager.OPTI_ONE(7, 0, 14, 0); + } + } + if (v76 == 242) { + _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); + _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); + _vm->_animationManager.NO_SEQ = 0; + v53 = &_vm->_globals.SAUVEGARDE->field380; + v53->field0 = 404; + v53->field1 = 395; + v53->field2 = 64; + v53->field3 = _vm->_globals.ECRAN; + + v54 = _vm->_globals.STAILLE[790 / 2]; + if (_vm->_globals.STAILLE[790 / 2] < 0) + v54 = -_vm->_globals.STAILLE[790 / 2]; + v76 = -(100 * (67 - (100 - v54)) / 67); + v53->field4 = v76; + _vm->_globals.SAUVEGARDE->data[svField357] = 1; + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField355] = 1; + _vm->_objectsManager.DEUXPERSO = 1; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); + _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->field0, v53->field1, 1, 3, v53->field4, 0, 20, 127); + _vm->_objectsManager.SPRITE_ON(1); + } + if (v76 == 245) { + _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); + _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); + _vm->_globals.ZONEP[4].destX = 276; + _vm->_objectsManager.VERBE_ON(4, 19); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); + _vm->_globals.SAUVEGARDE->data[svField399] = 1; + } + if (v76 == 246) { + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.OPTI_ONE(6, 0, 15, 0); + _vm->_objectsManager.PERSO_ON = 1; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); + _vm->_animationManager.NO_SEQ = 0; + _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.FADE_OUTW(); + _vm->_objectsManager.PERSO_ON = 0; + _vm->_globals.SORTIE = 100; + } + if (v76 == 55) { + _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.OPTI_ONE(15, 0, 12, 0); + _vm->_objectsManager.BOBANIM_OFF(15); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM19a"); + _vm->_objectsManager.OBSSEUL = 0; + } + if (v76 == 241) + _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); + if (v76 == 171) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gred1.pe2"); + _vm->_globals.NOPARLE = 0; + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v55 = _vm->_objectsManager.YSPR(0); + v56 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = -1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_globals.SORTIE = 59; + } + if (v76 == 173) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); + _vm->_globals.NOPARLE = 0; + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.NOT_VERIF = 1; + v57 = _vm->_objectsManager.YSPR(0); + v58 = _vm->_objectsManager.XSPR(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = -1; + do { + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_globals.SORTIE = 59; + } + if (v76 == 174) + _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); + if (v76 == 202) { + _vm->_globals.NOPARLE = 1; + _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); + _vm->_globals.NOPARLE = 0; + } + v1 = 1; + } + if (*(a1 + 2) == 'E' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') + v1 = 4; + if (*(a1 + 2) == 'V' && *(a1 + 3) == 'A' && *(a1 + 4) == 'L') { + v1 = 1; + _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] = (int16)READ_LE_UINT16(a1 + 7); + } + if (*(a1 + 2) == 'A' && *(a1 + 3) == 'D' && *(a1 + 4) == 'D') { + v1 = 1; + _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] += *(a1 + 7); + } + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'S') { + v1 = 1; + _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); + } + if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'N') { + _vm->_objectsManager.VERBE_ON((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); + v1 = 1; + } + if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'C' && *(a1 + 4) == 'H') { + _vm->_globals.ZONEP[(int16)READ_LE_UINT16(a1 + 5)].field12 = (int16)READ_LE_UINT16(a1 + 7); + v1 = 1; + } + if (*(a1 + 2) == 'J' && *(a1 + 3) == 'U' && *(a1 + 4) == 'M') { + v59 = (int16)READ_LE_UINT16(a1 + 7); + _vm->_objectsManager.NVZONE = (int16)READ_LE_UINT16(a1 + 5); + _vm->_objectsManager.NVVERBE = v59; + v1 = 6; + } + if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { + v60 = (int16)READ_LE_UINT16(a1 + 5); + memset(&s, 0, 0x13u); + + v77 = Common::String::format("SOUND%d.WAV", v60); + _vm->_soundManager.PLAY_SOUND(s); + v1 = 1; + } + if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { + _vm->_objectsManager.VERBE_OFF((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); + v1 = 1; + } + if (*(a1 + 2) == 'I' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') { + v1 = 3; + } + + return v1; +} + + +int ScriptManager::Control_Goto(const byte *dataP) { + return (int16)READ_LE_UINT16(dataP + 5); +} + +int ScriptManager::Control_If(const byte *dataP, int a2) { + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + const byte *v8; + int v9; + int v10; + int v11; + int v12; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + + v2 = a2; +LABEL_2: + v3 = v2; + do { + ++v3; + v4 = Traduction2(dataP + 20 * v3); + if (v3 > 400) { + v5 = v4; + error("Control if failed"); + v4 = v5; + } + } while (v4 != 4); + v20 = v3; + v6 = v2; + v7 = 0; + do { + ++v6; + if (Traduction2(dataP + 20 * v6) == 3) + v7 = 1; + if (v6 > 400) + error("Control if failed "); + if (v7 == 1) { + v2 = v20; + goto LABEL_2; + } + } while (v20 != v6); + v8 = dataP + 20 * a2; + v9 = *(v8 + 13); + v17 = *(v8 + 14); + v16 = *(v8 + 15); + v10 = (int16)READ_LE_UINT16(v8 + 5); + v11 = (int16)READ_LE_UINT16(v8 + 7); + v19 = (int16)READ_LE_UINT16(v8 + 9); + v18 = (int16)READ_LE_UINT16(v8 + 11); + v14 = 0; + v15 = 0; + if (v9 == 1 && _vm->_globals.SAUVEGARDE->data[v10] == v11) + v14 = 1; + if (v9 == 2 && _vm->_globals.SAUVEGARDE->data[v10] != v11) + v14 = 1; + if (v9 == 3 && _vm->_globals.SAUVEGARDE->data[v10] <= v11) + v14 = 1; + if (v9 == 4 && _vm->_globals.SAUVEGARDE->data[v10] >= v11) + v14 = 1; + if (v9 == 5 && _vm->_globals.SAUVEGARDE->data[v10] > v11) + v14 = 1; + if (v9 == 6 && _vm->_globals.SAUVEGARDE->data[v10] < v11) + v14 = 1; + if (v16 == 3) + goto LABEL_68; + if (v17 == 1 && v18 == _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 2 && v18 != _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 3 && v18 >= _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 4 && v18 <= _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 5 && v18 < _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v17 == 6 && v18 > _vm->_globals.SAUVEGARDE->data[v19]) + v15 = 1; + if (v16 == 3) { +LABEL_68: + if (v14 == 1) { + v12 = a2; + return (v12 + 1); + } + if (!v14) { +LABEL_63: + v12 = v20; + return (v12 + 1); + } + } + if (v16 == 1) { + if (v14 == 1 && v15 == 1) { + v12 = a2; + return (v12 + 1); + } + goto LABEL_63; + } + if (v16 == 2) { + if (v14 == 1 || v15 == 1) { + v12 = a2; + return (v12 + 1); + } + goto LABEL_63; + } + return -1; +} + +int ScriptManager::Traduction2(const byte *dataP) { + int16 result; + + result = 0; + if (*dataP != 'F' || *(dataP + 1) != 'C') { + result = 0; + } else { + if (*(dataP + 'T') == 84 && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') + result = 1; + if (*(dataP + 2) == 'B') { + if (*(dataP + 3) == 'O' && *(dataP + 4) == 'B') + result = 1; + if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') + result = 1; + } + if (*(dataP + 2) == 'P' && *(dataP + 3) == 'E' && *(dataP + 4) == 'R') + result = 1; + if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'U') + result = 1; + if (*(dataP + 2) == 'M' && *(dataP + 3) == 'U' && *(dataP + 4) == 'S') + result = 1; + if (*(dataP + 2) == 'O') { + if (*(dataP + 3) == 'B' && *(dataP + 4) == 'P') + result = 1; + if (*(dataP + 2) == 'O' && *(dataP + 3) == 'B' && *(dataP + 4) == 'M') + result = 1; + } + if (*(dataP + 2) == 'G' && *(dataP + 3) == 'O' && *(dataP + 4) == 'T') + result = 2; + if (*(dataP + 2) == 'Z') { + if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') + result = 1; + if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') + result = 1; + } + if (*(dataP + 2) == 'E' && *(dataP + 3) == 'X' && *(dataP + 4) == 'I') + result = 5; + if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'R') + result = 5; + if (*(dataP + 2) == 'A' && *(dataP + 3) == 'N' && *(dataP + 4) == 'I') + result = 1; + if (*(dataP + 2) == 'S' && *(dataP + 3) == 'P' && *(dataP + 4) == 'E') + result = 1; + if (*(dataP + 2) == 'E' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') + result = 4; + if (*(dataP + 2) == 'V') { + if (*(dataP + 3) == 'A' && *(dataP + 4) == 'L') + result = 1; + if (*(dataP + 2) == 'V') { + if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') + result = 1; + if (*(dataP + 2) == 'V' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') + result = 1; + } + } + if (*(dataP + 2) == 'I' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') + result = 3; + if (*(dataP + 2) == 'J' && *(dataP + 3) == 'U' && *(dataP + 4) == 'M') + result = 6; + if (*(dataP + 2) == 'B') { + if (*(dataP + 3) == 'C' && *(dataP + 4) == 'A') + result = 1; + if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'S') + result = 1; + } + if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'C') { + if (*(dataP + 4) == 'H') + result = 1; + } + } + return result; +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h new file mode 100644 index 0000000000..27f167ae1b --- /dev/null +++ b/engines/hopkins/script.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_SCRIPT_H +#define HOPKINS_SCRIPT_H + +#include "common/scummsys.h" +#include "common/endian.h" +#include "common/str.h" +#include "hopkins/globals.h" + +namespace Hopkins { + +class ScriptManager { +private: + HopkinsEngine *_vm; +public: + int TRAVAILOBJET; +public: + ScriptManager(); + void setParent(HopkinsEngine *vm); + + int Traduction(byte *a1); + int Traduction2(const byte *dataP); + int Control_Goto(const byte *dataP); + int Control_If(const byte *dataP, int a2); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_SCRIPT_H */ diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0aea2310f4..5a6031d203 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1013,11 +1013,11 @@ LABEL_2: v17 = 0; v13 = 1; do { - v10 = _vm->_objectsManager.Traduction(ptr + 20 * v13); + v10 = _vm->_scriptManager.Traduction(ptr + 20 * v13); if (v10 == 2) - v13 = _vm->_objectsManager.Control_Goto(ptr + 20 * v13); + v13 = _vm->_scriptManager.Control_Goto(ptr + 20 * v13); if (v10 == 3) - v13 = _vm->_objectsManager.Control_If(ptr, v13); + v13 = _vm->_scriptManager.Control_If(ptr, v13); if (v13 == -1) error("Invalid IFF function"); if (v10 == 1 || v10 == 4) -- cgit v1.2.3 From 2bf5306353081ffaeba085e95cada37b8ecdfcb3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 20:49:22 +1100 Subject: HOPKINS: fix SoundManager initialisation and some references --- engines/hopkins/script.cpp | 44 ++++++++++++++++++++++---------------------- engines/hopkins/sound.cpp | 15 +++++++++++++++ engines/hopkins/sound.h | 5 +++-- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 49d78424eb..7d0ddd5d73 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1030,13 +1030,13 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); do { if (_vm->_objectsManager.BOBPOSI(12) == 4 && !v21) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.PLAY_WAV(1); v21 = 1; } if (_vm->_objectsManager.BOBPOSI(12) == 5) v21 = 0; if (_vm->_objectsManager.BOBPOSI(4) == 5 && !v21) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.PLAY_WAV(2); v21 = 1; } if (_vm->_objectsManager.BOBPOSI(4) == 6) @@ -1082,13 +1082,13 @@ LABEL_1141: v24 = 0; do { if (_vm->_objectsManager.BOBPOSI(11) == 4 && !v24) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.PLAY_WAV(1); v24 = 1; } if (_vm->_objectsManager.BOBPOSI(11) == 5) v24 = 0; if (_vm->_objectsManager.BOBPOSI(8) == 11 && !v24) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.PLAY_WAV(2); v24 = 1; } if (_vm->_objectsManager.BOBPOSI(8) == 12) @@ -1103,7 +1103,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(6); _vm->_objectsManager.SET_BOBPOSI(5, 0); _vm->_objectsManager.SET_BOBPOSI(6, 0); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + _vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) != 74); @@ -1400,15 +1400,15 @@ LABEL_1141: do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(4) != 10); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.PLAY_WAV(1); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(4) != 18); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.PLAY_WAV(2); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(4) != 62); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + _vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(4) != 77); @@ -1425,15 +1425,15 @@ LABEL_1141: do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) != 10); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.PLAY_WAV(1); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) != 18); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.PLAY_WAV(2); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) != 38); - _vm->_soundManager._vm->_soundManager.PLAY_WAV(3); + _vm->_soundManager.PLAY_WAV(3); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) != 53); @@ -1565,7 +1565,7 @@ LABEL_1141: v41 = 0; do { if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { - _vm->_soundManager._vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.PLAY_WAV(1); v41 = 1; } if (_vm->_objectsManager.BOBPOSI(3) == 11) @@ -1732,7 +1732,7 @@ LABEL_1141: v70 = 4; if (v47 == 1) v70 = 6; - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -1747,7 +1747,7 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) _vm->_globals.SAUVEGARDE->data[svField340] = 0; } - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); } @@ -1760,7 +1760,7 @@ LABEL_1141: v70 = 4; if (v48 == 1) v70 = 6; - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -1775,7 +1775,7 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) _vm->_globals.SAUVEGARDE->data[svField340] = 0; } - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); } @@ -1788,7 +1788,7 @@ LABEL_1141: v70 = 4; if (v49 == 1) v70 = 6; - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -1803,13 +1803,13 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) _vm->_globals.SAUVEGARDE->data[svField340] = 0; } - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); } if (v76 == 239) { _vm->_objectsManager.SPRITE_OFF(0); - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); } if (v76 == 240) { @@ -1818,13 +1818,13 @@ LABEL_1141: do { _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(1) == 12 && !v50) { - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); v50 = 1; } if (_vm->_objectsManager.BOBPOSI(1) == 13) v50 = 0; if (_vm->_objectsManager.BOBPOSI(1) == 25 && !v50) { - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); v50 = 1; } if (_vm->_objectsManager.BOBPOSI(1) == 25) @@ -2055,7 +2055,7 @@ LABEL_1141: if (v76 == 101) _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); if (v76 == 243) { - _vm->_soundManager._vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); + _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { _vm->_animationManager.NO_SEQ = 1; _vm->_animationManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 9b58f42d18..b81cc63191 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -26,6 +26,21 @@ namespace Hopkins { +SoundManager::SoundManager() { + SPECIAL_SOUND; + SOUNDVOL = 0; + VOICEVOL = 0; + MUSICVOL = 0; + OLD_SOUNDVOL = 0; + OLD_MUSICVOL = 0; + OLD_VOICEVOL = 0; + SOUNDOFF = true; + MUSICOFF = true; + VOICEOFF = true; + TEXTOFF = false; + SOUND_FLAG = false; +} + void SoundManager::setParent(HopkinsEngine *vm) { _vm = vm; SPECIAL_SOUND = 0; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index ea7151f564..2dfdac7749 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -31,9 +31,9 @@ namespace Hopkins { class HopkinsEngine; class SoundManager { -public: +private: HopkinsEngine *_vm; - +public: int SPECIAL_SOUND; int SOUNDVOL; int VOICEVOL; @@ -47,6 +47,7 @@ public: bool TEXTOFF; bool SOUND_FLAG; public: + SoundManager(); void setParent(HopkinsEngine *vm); void WSOUND_INIT(); -- cgit v1.2.3 From 450114802a4a5bbb4f51a0e623e22b3abd498940 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Oct 2012 22:20:52 +1100 Subject: HOPKINS: Add workaround to fix issue with text display showing one character too many. --- engines/hopkins/font.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 7612c9cb04..75354031c4 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -268,6 +268,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v59 = v59 + 1; ++v63; } while (v63 < v69); + v60 = texte_tmp; v64 = 0; if (v69) { @@ -337,8 +338,16 @@ LABEL_55: LABEL_57: v20 = lineCount; v21 = v11; - Txt[idx].lines[v20] = Common::String((const char *)v61 + v65, lineSize); - TRIER_TEXT[lineCount++] = lineSize; + + // WORKAROUND: Perhaps due to the usage of ScummVM strings here, recalculate what the + // actual length of the line to be copied will be. Otherwise, you can see artifacts, + // such as a single character beyond the end of string NULL. + int actualSize = 0; + while (actualSize < lineSize && *(v61 + v65 + actualSize)) + ++actualSize; + + Txt[idx].lines[v20] = Common::String((const char *)v61 + v65, actualSize); + TRIER_TEXT[lineCount++] = actualSize; v65 += lineSize; v11 = v21; -- cgit v1.2.3 From 6d2b43ce9c110cbc8db9bd250b846dfe69143ae2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 07:09:12 +1100 Subject: HOPKINS: Fix initialisation of TABLE_COUL data. This fixes the background of message dialogs. --- engines/hopkins/graphics.cpp | 75 ++++++++++++++------------------------------ engines/hopkins/graphics.h | 4 +-- 2 files changed, 26 insertions(+), 53 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 31c0cee4a2..4495698321 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -73,7 +73,7 @@ GraphicsManager::GraphicsManager() { spec_largeur = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); - Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); + Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_EXT_BLOCK_SIZE], 0); Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); Common::fill(&Palette[0], &Palette[PALETTE_EXT_BLOCK_SIZE], 0); Common::fill(&OLD_PAL[0], &OLD_PAL[PALETTE_EXT_BLOCK_SIZE], 0); @@ -271,61 +271,34 @@ int GraphicsManager::SCROLL_ECRAN(int amount) { return result; } -void GraphicsManager::Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2) { - byte *v5; - int v6; - int v7; - int v8; - unsigned int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - unsigned int v18; - char v19; - int v20; - bool breakFlag; +void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold) { + byte *destPosP; + int palIndex; + int srcOffset; + int col1, col2; - v5 = destP; - v6 = count - 1; - do { - breakFlag = v6; - v7 = *(byte *)v5++; - v8 = (unsigned int)(3 * v7); + destPosP = destP; + for (int idx = 0; idx < count; ++idx) { + palIndex = *(byte *)destPosP++; + srcOffset = 3 * palIndex; + col1 = *(srcP + srcOffset) + *(srcP + srcOffset + 1) + *(srcP + srcOffset + 2); - // TODO: Ensure this is the right calculation - v11 = *(byte *)(v8 + srcP) + *(byte *)(v8 + srcP + 1) - + *(byte *)(v8 + srcP + 2); + for (int idx2 = 0; idx2 < 38; ++idx2) { + srcOffset = 3 * idx2; + col2 = *(srcP + srcOffset) + *(srcP + srcOffset + 1) + *(srcP + srcOffset + 2); - v12 = 0; - for (;;) { - v13 = v12 + 1; - if ( v13 == 38 ) - break; + col2 += minThreshold; + if (col2 < col1) + continue; + + col2 -= maxThreshold; + if (col2 > col1) + continue; - v20 = v13; - v8 = 3 * v8; - v14 = *(byte *)(v8 + srcP); - v15 = v14; - v14 = *(byte *)(v8 + srcP + 1); - v16 = v14 + v15; - v14 = *(byte *)(v8 + srcP + 2); - v17 = v14 + v16; - v12 = v20; - v18 = param1 + v17; - if (v18 >= v11 && (unsigned int)(v18 - param2) <= v11) { - v19 = v20; - if (!v20) - v19 = 1; - *(byte *)(v5 - 1) = v19; - break; - } + *(destPosP - 1) = (idx2 == 0) ? 1 : idx2; + break; } - - v6 = breakFlag - 1; - } while ( !breakFlag); + } } void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 8a337e0104..ff589b9061 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -61,7 +61,7 @@ public: byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; int nbrligne; - byte TABLE_COUL[PALETTE_SIZE]; + byte TABLE_COUL[PALETTE_EXT_BLOCK_SIZE]; byte cmap[PALETTE_BLOCK_SIZE]; byte Palette[PALETTE_EXT_BLOCK_SIZE]; byte OLD_PAL[PALETTE_EXT_BLOCK_SIZE]; @@ -114,7 +114,7 @@ public: void LOAD_IMAGE(const Common::String &file); void INIT_TABLE(int a1, int a2, byte *a3); int SCROLL_ECRAN(int amount); - void Trans_bloc(byte *destP, byte *srcP, int count, int param1, int param2); + void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); void Cls_Pal(); -- cgit v1.2.3 From 603fdbc46243ee9b7e630ffca579968fe80c4a5e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 19:55:43 +1100 Subject: HOPKINS: Bugfixes to show inventory dialog correctly --- engines/hopkins/events.cpp | 24 +++++++++----- engines/hopkins/events.h | 3 ++ engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/objects.cpp | 81 +++++++++++++++++++++++++-------------------- engines/hopkins/objects.h | 3 +- 6 files changed, 65 insertions(+), 48 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 8a1ebdfd7c..9bcdeda735 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -21,7 +21,6 @@ */ #include "common/system.h" -#include "common/events.h" #include "common/textconsole.h" #include "hopkins/events.h" #include "hopkins/files.h" @@ -44,6 +43,7 @@ EventsManager::EventsManager() { pointeur_souris = NULL; lItCounter = 0; ESC_KEY = false; + KEY_INVENT = false; btsouris = 0; OLD_ICONE = 0; @@ -236,14 +236,7 @@ void EventsManager::pollEvents() { return; case Common::EVENT_KEYDOWN: - ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE; - - // Check for debugger - if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { - // Attach to the debugger - _vm->_debugger.attach(); - _vm->_debugger.onFrame(); - } + handleKey(event); return; case Common::EVENT_LBUTTONDOWN: @@ -263,6 +256,19 @@ void EventsManager::pollEvents() { } } +void EventsManager::handleKey(Common::Event &event) { + ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE; + KEY_INVENT = event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB; + + // Check for debugger + if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _vm->_debugger.attach(); + _vm->_debugger.onFrame(); + } + +} + void EventsManager::VBL() { int v1; int v2; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 835a9d95c3..3181b77d5f 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -24,6 +24,7 @@ #define HOPKINS_EVENTS_H #include "common/scummsys.h" +#include "common/events.h" #include "common/str.h" namespace Hopkins { @@ -38,6 +39,7 @@ private: HopkinsEngine *_vm; void pollEvents(); + void handleKey(Common::Event &event); void checkForNextFrameCounter(); public: bool souris_flag; @@ -57,6 +59,7 @@ public: uint32 _priorFrameTime; bool ESC_KEY; bool NOESC; + bool KEY_INVENT; int btsouris; public: EventsManager(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 78cbf31919..1123b7eb34 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -172,7 +172,6 @@ Globals::Globals() { AFFLI = 0; AFFIVBL = 0; NOT_VERIF = 0; - AFFINVEN = 0; PERSO_TYPE = 0; GOACTION = 0; NECESSAIRE = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 3b2ef8efa5..193807d0d4 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -428,7 +428,6 @@ public: int AFFIVBL; int NOT_VERIF; bool CACHEFLAG; - int AFFINVEN; bool NOPARLE; bool PLAN_FLAG; int GOACTION; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 42647f338c..9ddb4f3693 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -61,7 +61,7 @@ ObjectsManager::ObjectsManager() { DESACTIVE_CURSOR = 0; BOBTOUS = false; INVENTFLAG = false; - KEY_INVENT = 0; + AFFINVEN = false; my_anim = 0; GOACTION = 0; NUMZONE = 0; @@ -83,7 +83,6 @@ ObjectsManager::ObjectsManager() { MAX_DEPA = 0; MAX_DEPA1 = 0; VIRE_INVENT = 0; - AFFINVEN = 0; CH_TETE = 0; T_RECTIF = 0; DESACTIVE = 0; @@ -110,7 +109,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { // Change Object byte *ObjectsManager::CHANGE_OBJET(int objIndex) { - byte *result = ObjectsManager::CAPTURE_OBJET(objIndex, 1); + byte *result = CAPTURE_OBJET(objIndex, 1); _vm->_globals.Bufferobjet = result; _vm->_globals.Nouv_objet = 1; _vm->_globals.OBJET_EN_COURS = objIndex; @@ -118,7 +117,6 @@ byte *ObjectsManager::CHANGE_OBJET(int objIndex) { } byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { - byte *result = NULL; byte *dataP; dataP = 0; @@ -148,25 +146,24 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { if (dataP == g_PTRNUL) error("CAPTURE_OBJET"); - ObjectsManager::capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); + capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); break; case 1: - ObjectsManager::sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.Bufferobjet, val2); - result = _vm->_globals.Bufferobjet; + sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.Bufferobjet, val2); + dataP = _vm->_globals.Bufferobjet; break; case 3: - ObjectsManager::capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.INVENTAIRE_OBJET, val2); - result = _vm->_globals.INVENTAIRE_OBJET; + capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.INVENTAIRE_OBJET, val2); + dataP = _vm->_globals.INVENTAIRE_OBJET; break; default: - result = dataP; break; } - return result; + return dataP; } // Delete Object @@ -494,7 +491,7 @@ void ObjectsManager::AFF_SPRITES() { } _vm->_globals.NBTRI = 0; - if (_vm->_globals.AFFINVEN == 1) { + if (_vm->_objectsManager.AFFINVEN) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); if (old_cadx && old_cady) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); @@ -2684,7 +2681,7 @@ void ObjectsManager::PLAN_BETA() { v1 = 0; INVENTFLAG = false; - KEY_INVENT = 0; + _vm->_eventsManager.KEY_INVENT = 0; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; _vm->_globals.Max_Propre_Gen = 1; @@ -2827,7 +2824,7 @@ void ObjectsManager::BTGAUCHE() { INVENTFLAG = 1; INVENT(); INVENTFLAG = 0; - KEY_INVENT = 0; + _vm->_eventsManager.KEY_INVENT = 0; if (!_vm->_globals.SORTIE) { INVENTFLAG = 0; _vm->_eventsManager.btsouris = v1; @@ -3162,14 +3159,14 @@ void ObjectsManager::CLEAR_ECRAN() { void ObjectsManager::TEST_INVENT() { if (_vm->_globals.PLAN_FLAG) - KEY_INVENT = 0; - if (KEY_INVENT == 1) { + _vm->_eventsManager.KEY_INVENT = 0; + if (_vm->_eventsManager.KEY_INVENT == 1) { if (!INVENTFLAG) { - KEY_INVENT = 0; + _vm->_eventsManager.KEY_INVENT = 0; INVENTFLAG = 1; INVENT(); INVENTFLAG = 0; - KEY_INVENT = 0; + _vm->_eventsManager.KEY_INVENT = 0; } } } @@ -3197,7 +3194,7 @@ void ObjectsManager::INVENT() { Common::File f; v13 = 0; - if (VIRE_INVENT != 1 && AFFINVEN != 1 && _vm->_globals.DESACTIVE_INVENT != 1) { + if (VIRE_INVENT != 1 && !AFFINVEN && _vm->_globals.DESACTIVE_INVENT != 1) { _vm->_graphicsManager.no_scroll = 1; FLAG_VISIBLE_EFFACE = 4; FLAG_VISIBLE = 0; @@ -3210,17 +3207,24 @@ void ObjectsManager::INVENT() { ++v1; } while (v1 <= 1); _vm->_globals.Winventaire = g_PTRNUL; + LABEL_7: _vm->_eventsManager.souris_bb = 0; _vm->_eventsManager.souris_b = 0; _vm->_globals.DESACTIVE_INVENT = 1; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); - if (!_vm->_globals.FR) - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); - if (_vm->_globals.FR == 2) - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); + + switch (_vm->_globals.FR) { + case 0: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); + break; + case 1: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); + break; + case 2: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); + break; + } if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -3239,7 +3243,8 @@ LABEL_7: inventairey = 114; inventairel = v18; inventaireh = v17; - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, v19 + 300, 414, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, + v19 + 300, 414, 0, 0, 0, 0); v15 = 0; v4 = 0; v14 = 1; @@ -3251,7 +3256,8 @@ LABEL_7: v6 = _vm->_globals.INVENTAIRE[v4]; if (v6 && v4 <= 29) { v7 = CAPTURE_OBJET(v6, 0); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, + v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); _vm->_globals.dos_free2(v7); } v16 += 54; @@ -3263,8 +3269,12 @@ LABEL_7: _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); _vm->_eventsManager.souris_bb = 0; v20 = 0; - while (1) { - AFFINVEN = 1; + + // Main loop to select an inventory item + while (!_vm->shouldQuit()) { + // Turn on drawing the inventory dialog in the event manager + AFFINVEN = true; + v8 = _vm->_eventsManager.XMOUSE(); v9 = _vm->_eventsManager.YMOUSE(); v12 = _vm->_eventsManager.BMOUSE(); @@ -3316,7 +3326,7 @@ LABEL_7: goto LABEL_7; } } else if (v20 != 1) { - AFFINVEN = 1; + AFFINVEN = true; } } } @@ -3329,16 +3339,17 @@ LABEL_7: SPECIAL_JEU(); } _vm->_fontManager.TEXTE_OFF(9); - if (AFFINVEN == 1) { - AFFINVEN = 0; + if (AFFINVEN) { + AFFINVEN = false; v9 = 114; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); BOBTOUS = 1; } - if (g_PTRNUL != _vm->_globals.Winventaire) + if (_vm->_globals.Winventaire != g_PTRNUL) _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); inventaire2 = _vm->_globals.dos_free2(inventaire2); + if (_vm->_eventsManager.btsouris == 1) OptionsDialog::show(_vm); if (_vm->_eventsManager.btsouris == 3) @@ -5855,7 +5866,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s v5 = 0; INVENTFLAG = 0; - KEY_INVENT = 0; + _vm->_eventsManager.KEY_INVENT = 0; VIRE_INVENT = 0; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = 0; @@ -5952,7 +5963,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & int xp, yp; INVENTFLAG = 0; - KEY_INVENT = 0; + _vm->_eventsManager.KEY_INVENT = 0; _vm->_objectsManager.verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 9757d08612..abc0e97d8d 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -86,7 +86,7 @@ public: int DESACTIVE_CURSOR; bool BOBTOUS; bool INVENTFLAG; - int KEY_INVENT; + bool AFFINVEN; int my_anim; int GOACTION; int NUMZONE; @@ -108,7 +108,6 @@ public: int MAX_DEPA; int MAX_DEPA1; int VIRE_INVENT; - int AFFINVEN; int CH_TETE; int T_RECTIF; int DESACTIVE; -- cgit v1.2.3 From 39bc683a18837ab60f456d3e9711d966bc417567 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 20:37:42 +1100 Subject: HOPKINS: Merged inventory dialog and OptionsDialog class into a DialogsManager class --- engines/hopkins/dialogs.cpp | 576 ++++++++++++++++++++++++++++++++------------ engines/hopkins/dialogs.h | 25 +- engines/hopkins/globals.cpp | 6 +- engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 1 + engines/hopkins/hopkins.h | 2 + engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 560 ++++++++++++------------------------------ engines/hopkins/objects.h | 11 - engines/hopkins/talk.cpp | 6 +- 10 files changed, 605 insertions(+), 585 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index f4855ff798..a77c919c8f 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/file.h" #include "common/util.h" #include "hopkins/dialogs.h" #include "hopkins/events.h" @@ -33,229 +34,504 @@ namespace Hopkins { -void OptionsDialog::show(HopkinsEngine *vm) { +DialogsManager::DialogsManager() { + DESACTIVE_INVENT = false; + INVENTFLAG = false; + AFFINVEN = false; + VIRE_INVENT = false; + inventairex = inventairey = 0; + inventairel = inventaireh = 0; + Winventaire = NULL; + inventaire2 = g_PTRNUL; +} + +DialogsManager::~DialogsManager() { + _vm->_globals.dos_free2(Winventaire); +} + +void DialogsManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void DialogsManager::showOptionsDialog() { bool doneFlag; doneFlag = false; - vm->_eventsManager.CHANGE_MOUSE(0); - vm->_eventsManager.VBL(); - if (vm->_globals.FR == 1) - vm->_fileManager.CONSTRUIT_SYSTEM("OPTIFR.SPR"); - if (!vm->_globals.FR) - vm->_fileManager.CONSTRUIT_SYSTEM("OPTIAN.SPR"); - if (vm->_globals.FR == 2) - vm->_fileManager.CONSTRUIT_SYSTEM("OPTIES.SPR"); + _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.VBL(); + if (_vm->_globals.FR == 1) + _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIFR.SPR"); + if (!_vm->_globals.FR) + _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIAN.SPR"); + if (_vm->_globals.FR == 2) + _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIES.SPR"); - vm->_globals.OPTION_SPR = vm->_fileManager.CHARGE_FICHIER(vm->_globals.NFICHIER); - vm->_globals.OPTION_FLAG = true; + _vm->_globals.OPTION_SPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.OPTION_FLAG = true; do { - if (vm->_eventsManager.BMOUSE()) { - Common::Point mousePos(vm->_eventsManager.XMOUSE(), vm->_eventsManager.YMOUSE()); - mousePos.x = vm->_eventsManager.XMOUSE(); - mousePos.y = vm->_eventsManager.YMOUSE(); + if (_vm->_eventsManager.BMOUSE()) { + Common::Point mousePos(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); + mousePos.x = _vm->_eventsManager.XMOUSE(); + mousePos.y = _vm->_eventsManager.YMOUSE(); - if (!vm->_soundManager.MUSICOFF) { - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { - ++vm->_soundManager.MUSICVOL; - vm->_soundManager.OLD_MUSICVOL = vm->_soundManager.MUSICVOL; + if (!_vm->_soundManager.MUSICOFF) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { + ++_vm->_soundManager.MUSICVOL; + _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; - if (vm->_soundManager.MUSICVOL <= 12) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (_vm->_soundManager.MUSICVOL <= 12) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.MUSICVOL = 12; - vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + _vm->_soundManager.MUSICVOL = 12; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } - if (!vm->_soundManager.MUSICOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { - --vm->_soundManager.MUSICVOL; - if (vm->_soundManager.MUSICVOL >= 0) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.MUSICOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + --_vm->_soundManager.MUSICVOL; + if (_vm->_soundManager.MUSICVOL >= 0) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.MUSICVOL = 0; + _vm->_soundManager.MUSICVOL = 0; - vm->_soundManager.OLD_MUSICVOL = vm->_soundManager.MUSICVOL; - vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } } - if (!vm->_soundManager.SOUNDOFF) { - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { - ++vm->_soundManager.SOUNDVOL; - if (vm->_soundManager.SOUNDVOL <= 16) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.SOUNDOFF) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { + ++_vm->_soundManager.SOUNDVOL; + if (_vm->_soundManager.SOUNDVOL <= 16) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.SOUNDVOL = 16; - vm->_soundManager.OLD_SOUNDVOL = vm->_soundManager.SOUNDVOL; - vm->_soundManager.MODSetSampleVolume(); + _vm->_soundManager.SOUNDVOL = 16; + _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; + _vm->_soundManager.MODSetSampleVolume(); } - if (!vm->_soundManager.SOUNDOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { - --vm->_soundManager.SOUNDVOL; - if (vm->_soundManager.SOUNDVOL >= 0) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.SOUNDOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { + --_vm->_soundManager.SOUNDVOL; + if (_vm->_soundManager.SOUNDVOL >= 0) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.SOUNDVOL = 0; - vm->_soundManager.OLD_SOUNDVOL = vm->_soundManager.SOUNDVOL; - vm->_soundManager.MODSetSampleVolume(); + _vm->_soundManager.SOUNDVOL = 0; + _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; + _vm->_soundManager.MODSetSampleVolume(); } } - if (!vm->_soundManager.VOICEOFF) { - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { - ++vm->_soundManager.VOICEVOL; + if (!_vm->_soundManager.VOICEOFF) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { + ++_vm->_soundManager.VOICEVOL; - if (vm->_soundManager.VOICEVOL <= 16) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (_vm->_soundManager.VOICEVOL <= 16) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.VOICEVOL = 16; - vm->_soundManager.OLD_VOICEVOL = vm->_soundManager.VOICEVOL; - vm->_soundManager.MODSetVoiceVolume(); + _vm->_soundManager.VOICEVOL = 16; + _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; + _vm->_soundManager.MODSetVoiceVolume(); } - if (!vm->_soundManager.VOICEOFF && mousePos.x >= vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { - --vm->_soundManager.VOICEVOL; - if (vm->_soundManager.VOICEVOL >= 0) - vm->_soundManager.PLAY_SOUND("bruit2.wav"); + if (!_vm->_soundManager.VOICEOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + --_vm->_soundManager.VOICEVOL; + if (_vm->_soundManager.VOICEVOL >= 0) + _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else - vm->_soundManager.VOICEVOL = 0; - vm->_soundManager.OLD_VOICEVOL = vm->_soundManager.VOICEVOL; - vm->_soundManager.MODSetVoiceVolume(); + _vm->_soundManager.VOICEVOL = 0; + _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; + _vm->_soundManager.MODSetVoiceVolume(); } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 194 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) - vm->_soundManager.TEXTOFF = vm->_soundManager.TEXTOFF != 1; - - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 167 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) - vm->_soundManager.VOICEOFF = vm->_soundManager.VOICEOFF != 1; - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 113 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { - if (vm->_soundManager.MUSICOFF == 1) { - vm->_soundManager.MUSICOFF = 0; - vm->_soundManager.MODSetMusicVolume(vm->_soundManager.MUSICVOL); + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) + _vm->_soundManager.TEXTOFF = _vm->_soundManager.TEXTOFF != 1; + + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) + _vm->_soundManager.VOICEOFF = _vm->_soundManager.VOICEOFF != 1; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { + if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { + if (_vm->_soundManager.MUSICOFF == 1) { + _vm->_soundManager.MUSICOFF = 0; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } else { - vm->_soundManager.MUSICOFF = 1; - vm->_soundManager.MODSetMusicVolume(0); + _vm->_soundManager.MUSICOFF = 1; + _vm->_soundManager.MODSetMusicVolume(0); } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) - vm->_soundManager.SOUNDOFF = vm->_soundManager.SOUNDOFF != 1; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) + _vm->_soundManager.SOUNDOFF = _vm->_soundManager.SOUNDOFF != 1; } } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { - vm->_globals.SORTIE = 300; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { + _vm->_globals.SORTIE = 300; doneFlag = true; } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) doneFlag = true; - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { - switch (vm->_graphicsManager.SPEED_SCROLL) { + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { + switch (_vm->_graphicsManager.SPEED_SCROLL) { case 1: - vm->_graphicsManager.SPEED_SCROLL = 2; + _vm->_graphicsManager.SPEED_SCROLL = 2; break; case 2: - vm->_graphicsManager.SPEED_SCROLL = 4; + _vm->_graphicsManager.SPEED_SCROLL = 4; break; case 4: - vm->_graphicsManager.SPEED_SCROLL = 8; + _vm->_graphicsManager.SPEED_SCROLL = 8; break; case 8: - vm->_graphicsManager.SPEED_SCROLL = 16; + _vm->_graphicsManager.SPEED_SCROLL = 16; break; case 16: - vm->_graphicsManager.SPEED_SCROLL = 32; + _vm->_graphicsManager.SPEED_SCROLL = 32; break; case 32: - vm->_graphicsManager.SPEED_SCROLL = 48; + _vm->_graphicsManager.SPEED_SCROLL = 48; break; case 48: - vm->_graphicsManager.SPEED_SCROLL = 64; + _vm->_graphicsManager.SPEED_SCROLL = 64; break; case 64: - vm->_graphicsManager.SPEED_SCROLL = 128; + _vm->_graphicsManager.SPEED_SCROLL = 128; break; case 128: - vm->_graphicsManager.SPEED_SCROLL = 160; + _vm->_graphicsManager.SPEED_SCROLL = 160; break; case 160: - vm->_graphicsManager.SPEED_SCROLL = 320; + _vm->_graphicsManager.SPEED_SCROLL = 320; break; case 320: - vm->_graphicsManager.SPEED_SCROLL = 1; + _vm->_graphicsManager.SPEED_SCROLL = 1; break; } } - if (mousePos.x >= vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) - vm->_globals.vitesse = 2; - if (mousePos.x >= vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) - vm->_globals.SVGA = 2; - if (mousePos.x < vm->_graphicsManager.ofscroll + 165 || mousePos.x > vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 0xD3u) + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) + _vm->_globals.vitesse = 2; + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) + _vm->_globals.SVGA = 2; + if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 0xD3u) doneFlag = true; } - if (!vm->_graphicsManager.MANU_SCROLL) - vm->_globals.opt_scrtype = 2; - if (vm->_graphicsManager.MANU_SCROLL == 1) - vm->_globals.opt_scrtype = 1; - if (vm->_globals.vitesse == 1) - vm->_globals.opt_vitesse = 6; - if (vm->_globals.vitesse == 2) - vm->_globals.opt_vitesse = 5; - if (vm->_globals.vitesse == 3) - vm->_globals.opt_vitesse = 4; - - vm->_globals.opt_txt = !vm->_soundManager.TEXTOFF ? 7 : 8; - vm->_globals.opt_voice = !vm->_soundManager.VOICEOFF ? 7 : 8; - vm->_globals.opt_sound = !vm->_soundManager.SOUNDOFF ? 7 : 8; - vm->_globals.opt_music = !vm->_soundManager.MUSICOFF ? 7 : 8; + if (!_vm->_graphicsManager.MANU_SCROLL) + _vm->_globals.opt_scrtype = 2; + if (_vm->_graphicsManager.MANU_SCROLL == 1) + _vm->_globals.opt_scrtype = 1; + if (_vm->_globals.vitesse == 1) + _vm->_globals.opt_vitesse = 6; + if (_vm->_globals.vitesse == 2) + _vm->_globals.opt_vitesse = 5; + if (_vm->_globals.vitesse == 3) + _vm->_globals.opt_vitesse = 4; + + _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; + _vm->_globals.opt_voice = !_vm->_soundManager.VOICEOFF ? 7 : 8; + _vm->_globals.opt_sound = !_vm->_soundManager.SOUNDOFF ? 7 : 8; + _vm->_globals.opt_music = !_vm->_soundManager.MUSICOFF ? 7 : 8; - if (vm->_globals.SVGA == 1) - vm->_globals.opt_anm = 10; - if (vm->_globals.SVGA == 2) - vm->_globals.opt_anm = 9; - if (vm->_globals.SVGA == 3) - vm->_globals.opt_anm = 11; - if (vm->_graphicsManager.SPEED_SCROLL == 1) - vm->_globals.opt_scrspeed = 12; - if (vm->_graphicsManager.SPEED_SCROLL == 2) - vm->_globals.opt_scrspeed = 13; - if (vm->_graphicsManager.SPEED_SCROLL == 4) - vm->_globals.opt_scrspeed = 14; - if (vm->_graphicsManager.SPEED_SCROLL == 8) - vm->_globals.opt_scrspeed = 15; - if (vm->_graphicsManager.SPEED_SCROLL == 16) - vm->_globals.opt_scrspeed = 16; - if (vm->_graphicsManager.SPEED_SCROLL == 32) - vm->_globals.opt_scrspeed = 17; - if (vm->_graphicsManager.SPEED_SCROLL == 48) - vm->_globals.opt_scrspeed = 18; - if (vm->_graphicsManager.SPEED_SCROLL == 64) - vm->_globals.opt_scrspeed = 19; - if (vm->_graphicsManager.SPEED_SCROLL == 128) - vm->_globals.opt_scrspeed = 20; - if (vm->_graphicsManager.SPEED_SCROLL == 160) - vm->_globals.opt_scrspeed = 21; - if (vm->_graphicsManager.SPEED_SCROLL == 320) - vm->_globals.opt_scrspeed = 22; - if (vm->_graphicsManager.SPEED_SCROLL == 640) - vm->_globals.opt_scrspeed = 23; - - vm->_eventsManager.VBL(); + if (_vm->_globals.SVGA == 1) + _vm->_globals.opt_anm = 10; + if (_vm->_globals.SVGA == 2) + _vm->_globals.opt_anm = 9; + if (_vm->_globals.SVGA == 3) + _vm->_globals.opt_anm = 11; + if (_vm->_graphicsManager.SPEED_SCROLL == 1) + _vm->_globals.opt_scrspeed = 12; + if (_vm->_graphicsManager.SPEED_SCROLL == 2) + _vm->_globals.opt_scrspeed = 13; + if (_vm->_graphicsManager.SPEED_SCROLL == 4) + _vm->_globals.opt_scrspeed = 14; + if (_vm->_graphicsManager.SPEED_SCROLL == 8) + _vm->_globals.opt_scrspeed = 15; + if (_vm->_graphicsManager.SPEED_SCROLL == 16) + _vm->_globals.opt_scrspeed = 16; + if (_vm->_graphicsManager.SPEED_SCROLL == 32) + _vm->_globals.opt_scrspeed = 17; + if (_vm->_graphicsManager.SPEED_SCROLL == 48) + _vm->_globals.opt_scrspeed = 18; + if (_vm->_graphicsManager.SPEED_SCROLL == 64) + _vm->_globals.opt_scrspeed = 19; + if (_vm->_graphicsManager.SPEED_SCROLL == 128) + _vm->_globals.opt_scrspeed = 20; + if (_vm->_graphicsManager.SPEED_SCROLL == 160) + _vm->_globals.opt_scrspeed = 21; + if (_vm->_graphicsManager.SPEED_SCROLL == 320) + _vm->_globals.opt_scrspeed = 22; + if (_vm->_graphicsManager.SPEED_SCROLL == 640) + _vm->_globals.opt_scrspeed = 23; + + _vm->_eventsManager.VBL(); } while (!doneFlag); - vm->_graphicsManager.SCOPY(vm->_graphicsManager.VESA_SCREEN, vm->_graphicsManager.ofscroll + 164, - 107, 335, 215, vm->_graphicsManager.VESA_BUFFER, vm->_graphicsManager.ofscroll + 164, 107); - vm->_graphicsManager.Ajoute_Segment_Vesa(vm->_graphicsManager.ofscroll + 164, 107, - vm->_graphicsManager.ofscroll + 498, 320); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_graphicsManager.ofscroll + 164, + 107, 335, 215, _vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll + 164, 107); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, + _vm->_graphicsManager.ofscroll + 498, 320); + + _vm->_globals.OPTION_SPR = _vm->_globals.dos_free2(_vm->_globals.OPTION_SPR); + _vm->_globals.OPTION_FLAG = false; +} + +void DialogsManager::showInventory() { + int v1; + size_t filesize; + int v4; + int v5; + int v6; + byte *v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; + Common::File f; - vm->_globals.OPTION_SPR = vm->_globals.dos_free2(vm->_globals.OPTION_SPR); - vm->_globals.OPTION_FLAG = false; + v13 = 0; + if (!VIRE_INVENT && !AFFINVEN && !_vm->_globals.DESACTIVE_INVENT) { + _vm->_graphicsManager.no_scroll = 1; + _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; + _vm->_objectsManager.FLAG_VISIBLE = 0; + v1 = 0; + do { + INVENT_ANIM(); + _vm->_eventsManager.XMOUSE(); + _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.VBL(); + ++v1; + } while (v1 <= 1); + _vm->_dialogsManager.Winventaire = g_PTRNUL; + +LABEL_7: + _vm->_eventsManager.souris_bb = 0; + _vm->_eventsManager.souris_b = 0; + _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + + switch (_vm->_globals.FR) { + case 0: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); + break; + case 1: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); + break; + case 2: + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); + break; + } + + if (!f.open(_vm->_globals.NFICHIER)) + error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + + filesize = f.size(); + _vm->_dialogsManager.Winventaire = _vm->_globals.dos_malloc2(filesize); + _vm->_fileManager.bload_it(f, _vm->_dialogsManager.Winventaire, filesize); + f.close(); + + _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); + inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v19 = _vm->_graphicsManager.ofscroll + 152; + v18 = _vm->_objectsManager.Get_Largeur(_vm->_dialogsManager.Winventaire, 0); + v17 = _vm->_objectsManager.Get_Hauteur(_vm->_dialogsManager.Winventaire, 0); + inventairex = v19; + inventairey = 114; + inventairel = v18; + inventaireh = v17; + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, + v19 + 300, 414, 0, 0, 0, 0); + v15 = 0; + v4 = 0; + v14 = 1; + do { + v16 = 0; + v5 = 1; + do { + ++v4; + v6 = _vm->_globals.INVENTAIRE[v4]; + if (v6 && v4 <= 29) { + v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, + v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); + _vm->_globals.dos_free2(v7); + } + v16 += 54; + ++v5; + } while (v5 <= 6); + v15 += 38; + ++v14; + } while (v14 <= 5); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, inventairex, inventairey, inventairel, inventaireh); + _vm->_eventsManager.souris_bb = 0; + v20 = 0; + + // Main loop to select an inventory item + while (!_vm->shouldQuit()) { + // Turn on drawing the inventory dialog in the event manager + AFFINVEN = true; + + v8 = _vm->_eventsManager.XMOUSE(); + v9 = _vm->_eventsManager.YMOUSE(); + v12 = _vm->_eventsManager.BMOUSE(); + v10 = v13; + v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); + v13 = v11; + if (v11 != v10) + _vm->_objectsManager.PARAMCADRE(v11); + if (_vm->_eventsManager.btsouris != 16) { + if ((uint16)(_vm->_eventsManager.btsouris - 1) > 1u) { + if (_vm->_eventsManager.btsouris != 3) { + if (v12 == 2) { + _vm->_objectsManager.OBJETPLUS(v13); + if (_vm->_eventsManager.btsouris != 23) + _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + } + } + } + } + if (v12 == 1) { + if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (uint16)(_vm->_eventsManager.btsouris - 2) <= 1u) + break; + v9 = v13; + _vm->_objectsManager.VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); + if (_vm->_eventsManager.btsouris == 8) + v20 = 1; + if (v20 != 1) { + _vm->_scriptManager.TRAVAILOBJET = 1; + _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; + _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; + _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; + _vm->_objectsManager.OPTI_OBJET(); + _vm->_scriptManager.TRAVAILOBJET = 0; + + if (_vm->_soundManager.VOICEOFF == 1) { + do + _vm->_eventsManager.VBL(); + while (!_vm->_globals.SORTIE && _vm->_eventsManager.BMOUSE() != 1); + _vm->_fontManager.TEXTE_OFF(9); + } + if (_vm->_globals.SORTIE) { + if (_vm->_globals.SORTIE == 2) + v20 = 1; + _vm->_globals.SORTIE = 0; + if (v20 != 1) { + inventaire2 = _vm->_globals.dos_free2(inventaire2); + if (g_PTRNUL != _vm->_dialogsManager.Winventaire) + _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); + goto LABEL_7; + } + } else if (v20 != 1) { + AFFINVEN = true; + } + } + } + if (VIRE_INVENT == 1) + v20 = 1; + if (v20 == 1) + break; + _vm->_eventsManager.VBL(); + if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) + _vm->_objectsManager.SPECIAL_JEU(); + } + _vm->_fontManager.TEXTE_OFF(9); + if (AFFINVEN) { + AFFINVEN = false; + v9 = 114; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); + _vm->_objectsManager.BOBTOUS = 1; + } + if (_vm->_dialogsManager.Winventaire != g_PTRNUL) + _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); + inventaire2 = _vm->_globals.dos_free2(inventaire2); + + if (_vm->_eventsManager.btsouris == 1) + showOptionsDialog(); + if (_vm->_eventsManager.btsouris == 3) + _vm->_menuManager.CHARGE_PARTIE(); + if (_vm->_eventsManager.btsouris == 2) + _vm->_menuManager.SAUVE_PARTIE(); + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_objectsManager.old_cady = 0; + _vm->_objectsManager.cady = 0; + _vm->_objectsManager.old_cadx = 0; + _vm->_objectsManager.cadx = 0; + _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_graphicsManager.no_scroll = 0; + } +} + +void DialogsManager::INVENT_ANIM() { + int v0; + int v1; + + if (!DESACTIVE_INVENT) { + if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; + } + + if (_vm->_objectsManager.FLAG_VISIBLE) { + if (_vm->_objectsManager.I_old_x <= 1) + _vm->_objectsManager.I_old_x = 2; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + v0 = _vm->_graphicsManager.ofscroll + 2; + v1 = _vm->_graphicsManager.ofscroll + 2; + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); + _vm->_objectsManager.I_old_x = v0; + } + + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { + if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); + } + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } + + if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } + } +} + +void DialogsManager::TEST_INVENT() { + if (_vm->_globals.PLAN_FLAG) + _vm->_eventsManager.KEY_INVENT = 0; + if (_vm->_eventsManager.KEY_INVENT == 1) { + if (!INVENTFLAG) { + _vm->_eventsManager.KEY_INVENT = 0; + INVENTFLAG = 1; + _vm->_dialogsManager.showInventory(); + INVENTFLAG = 0; + _vm->_eventsManager.KEY_INVENT = 0; + } + } } } // End of namespace Hopkins diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index caaa9f5575..ddec3fb4a1 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -32,11 +32,30 @@ namespace Hopkins { class HopkinsEngine; /** - * Class for showing the options dialog + * Class for manging game dialogs */ -class OptionsDialog { +class DialogsManager { +private: + HopkinsEngine *_vm; public: - static void show(HopkinsEngine *vm); + bool DESACTIVE_INVENT; + bool INVENTFLAG; + bool AFFINVEN; + bool VIRE_INVENT; + int inventairex, inventairey; + int inventairel, inventaireh; + byte *Winventaire; + byte *inventaire2; +public: + DialogsManager(); + ~DialogsManager(); + void setParent(HopkinsEngine *vm); + + void showOptionsDialog(); + void showInventory(); + + void INVENT_ANIM(); + void TEST_INVENT(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1123b7eb34..0ae9d1f6be 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -186,7 +186,6 @@ Globals::Globals() { ICONE = NULL; BUF_ZONE = NULL; CACHE_BANQUE[6] = NULL; - Winventaire = NULL; texte_tmp = NULL; SPRITE_ECRAN = NULL; SAUVEGARDE = NULL; @@ -253,7 +252,6 @@ Globals::~Globals() { free(ICONE); dos_free2(BUF_ZONE); dos_free2(CACHE_BANQUE[6]); - dos_free2(Winventaire); dos_free2(texte_tmp); dos_free2(SPRITE_ECRAN); dos_free2((byte *)SAUVEGARDE); @@ -328,8 +326,8 @@ void Globals::clearAll() { NUM_FICHIER_OBJ = 0; Bufferdecor = g_PTRNUL; Bufferobjet = g_PTRNUL; - Winventaire = g_PTRNUL; - inventaire2 = g_PTRNUL; + _vm->_dialogsManager.Winventaire = g_PTRNUL; + _vm->_dialogsManager.inventaire2 = g_PTRNUL; COUCOU = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; SAUVEGARDE = (Sauvegarde *)g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 193807d0d4..15c44f74d7 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -358,7 +358,6 @@ public: byte *TETE; byte *ICONE; byte *BUF_ZONE; - byte *Winventaire; byte *texte_tmp; int texte_long; int TEXTE_FORMATE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dc2cc4969c..08f4b9f874 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -40,6 +40,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe g_vm = this; _debugger.setParent(this); _animationManager.setParent(this); + _dialogsManager.setParent(this); _eventsManager.setParent(this); _fileManager.setParent(this); _fontManager.setParent(this); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 3564e1f4fe..0b6818d8cd 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -33,6 +33,7 @@ #include "graphics/surface.h" #include "hopkins/anim.h" #include "hopkins/debugger.h" +#include "hopkins/dialogs.h" #include "hopkins/events.h" #include "hopkins/files.h" #include "hopkins/font.h" @@ -97,6 +98,7 @@ protected: public: Debugger _debugger; AnimationManager _animationManager; + DialogsManager _dialogsManager; EventsManager _eventsManager; FontManager _fontManager; Globals _globals; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 100b77c388..8b3010fc02 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -207,7 +207,7 @@ int MenuManager::MENU() { _vm->_eventsManager.delay(200); // Show the options dialog - OptionsDialog::show(_vm); + _vm->_dialogsManager.showOptionsDialog(); } if (menuIndex == INTRODUCTION) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9ddb4f3693..c94544f5ae 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -39,16 +39,12 @@ ObjectsManager::ObjectsManager() { } PRIORITY = 0; - inventairex = inventairey = 0; - inventairel = inventaireh = 0; old_cadx = old_cady = old_cadi = 0; cadx = cady = cadi = 0; SL_X = SL_Y = 0; I_old_x = I_old_y = 0; g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; - Winventaire = NULL; - inventaire2 = g_PTRNUL; SL_SPR = g_PTRNUL; SL_SPR2 = g_PTRNUL; sprite_ptr = g_PTRNUL; @@ -57,11 +53,8 @@ ObjectsManager::ObjectsManager() { SL_FLAG = false; SL_MODE = false; FLAG_VISIBLE = false; - DESACTIVE_INVENT = false; DESACTIVE_CURSOR = 0; BOBTOUS = false; - INVENTFLAG = false; - AFFINVEN = false; my_anim = 0; GOACTION = 0; NUMZONE = 0; @@ -82,7 +75,6 @@ ObjectsManager::ObjectsManager() { A_DEPA = 0; MAX_DEPA = 0; MAX_DEPA1 = 0; - VIRE_INVENT = 0; CH_TETE = 0; T_RECTIF = 0; DESACTIVE = 0; @@ -491,13 +483,13 @@ void ObjectsManager::AFF_SPRITES() { } _vm->_globals.NBTRI = 0; - if (_vm->_objectsManager.AFFINVEN) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); + if (_vm->_dialogsManager.AFFINVEN) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventaireh); if (old_cadx && old_cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); if (cadx && cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, inventaire2, cadx + 300, cady + 300, cadi); - _vm->_graphicsManager.Ajoute_Segment_Vesa(inventairex, inventairey, inventairex + inventairel, inventairey + inventaireh); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, cadx + 300, cady + 300, cadi); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairex + _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventairey + _vm->_dialogsManager.inventaireh); } if (SL_FLAG == 1) { @@ -570,7 +562,7 @@ void ObjectsManager::AFF_SPRITES() { } } - INVENT_ANIM(); + _vm->_dialogsManager.INVENT_ANIM(); } void ObjectsManager::INIT_BOB() { @@ -1025,52 +1017,6 @@ void ObjectsManager::VERIFCACHE() { } while (v8 <= 19); } -void ObjectsManager::INVENT_ANIM() { - int v0; - int v1; - - if (!DESACTIVE_INVENT) { - if (FLAG_VISIBLE_EFFACE && !FLAG_VISIBLE) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, I_old_x, 27, 48, 38, - _vm->_graphicsManager.VESA_BUFFER, I_old_x, 27); - _vm->_graphicsManager.Ajoute_Segment_Vesa(I_old_x, 27, I_old_x + 48, 65); - --FLAG_VISIBLE_EFFACE; - } - - if (FLAG_VISIBLE) { - if (I_old_x <= 1) - I_old_x = 2; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, I_old_x, 27, 48, 38, - _vm->_graphicsManager.VESA_BUFFER, I_old_x, 27); - - _vm->_graphicsManager.Ajoute_Segment_Vesa(I_old_x, 27, I_old_x + 48, 65); - v0 = _vm->_graphicsManager.ofscroll + 2; - v1 = _vm->_graphicsManager.ofscroll + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); - I_old_x = v0; - } - - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); - } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - } - - if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - } - } -} - void ObjectsManager::DEF_SPRITE(int idx) { int v2; int v3; @@ -1990,24 +1936,24 @@ LABEL_241: v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v5 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v5 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v5 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v5 = -Sprite[0].fieldC; v3 = _vm->_graphicsManager.Reel_Reduc(v3, v5); - v6 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v6 = -_vm->_objectsManager.Sprite[0].fieldC; + v6 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v6 = -Sprite[0].fieldC; v4 = _vm->_graphicsManager.Reel_Reduc(v4, v6); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v7 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v7 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v7 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v7 = -Sprite[0].fieldC; v3 = _vm->_graphicsManager.Reel_Zoom(v3, v7); - v8 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v8 = -_vm->_objectsManager.Sprite[0].fieldC; + v8 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v8 = -Sprite[0].fieldC; v4 = _vm->_graphicsManager.Reel_Zoom(v4, v8); } v0 = v3 + g_old_x; @@ -2028,24 +1974,24 @@ LABEL_23: } else { v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v11 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v11 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v11 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v11 = -Sprite[0].fieldC; v9 = _vm->_graphicsManager.Reel_Reduc(v9, v11); - v12 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v12 = -_vm->_objectsManager.Sprite[0].fieldC; + v12 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v12 = -Sprite[0].fieldC; v10 = _vm->_graphicsManager.Reel_Reduc(v10, v12); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v13 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v13 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v13 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v13 = -Sprite[0].fieldC; v9 = _vm->_graphicsManager.Reel_Zoom(v9, v13); - v14 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v14 = -_vm->_objectsManager.Sprite[0].fieldC; + v14 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v14 = -Sprite[0].fieldC; v10 = _vm->_graphicsManager.Reel_Zoom(v10, v14); } v0 = g_old_x - v9; @@ -2068,16 +2014,16 @@ LABEL_43: if (v15 < 0) v15 = -v15; v16 = v15; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v17 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v17 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v17 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v17 = -Sprite[0].fieldC; v16 = _vm->_graphicsManager.Reel_Reduc(v16, v17); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v18 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v18 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v18 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v18 = -Sprite[0].fieldC; v16 = _vm->_graphicsManager.Reel_Zoom(v16, v18); } v0 = g_old_x; @@ -2100,16 +2046,16 @@ LABEL_60: if (v19 < 0) v19 = -v19; v20 = v19; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v21 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v21 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v21 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v21 = -Sprite[0].fieldC; v20 = _vm->_graphicsManager.Reel_Reduc(v20, v21); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v22 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v22 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v22 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v22 = -Sprite[0].fieldC; v20 = _vm->_graphicsManager.Reel_Zoom(v20, v22); } v0 = g_old_x; @@ -2130,24 +2076,24 @@ LABEL_77: } else { v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v25 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v25 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v25 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v25 = -Sprite[0].fieldC; v23 = _vm->_graphicsManager.Reel_Reduc(v23, v25); - v26 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v26 = -_vm->_objectsManager.Sprite[0].fieldC; + v26 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v26 = -Sprite[0].fieldC; v24 = _vm->_graphicsManager.Reel_Reduc(v24, v26); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v27 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v27 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v27 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v27 = -Sprite[0].fieldC; v23 = _vm->_graphicsManager.Reel_Zoom(v23, v27); - v28 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v28 = -_vm->_objectsManager.Sprite[0].fieldC; + v28 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v28 = -Sprite[0].fieldC; v24 = _vm->_graphicsManager.Reel_Zoom(v24, v28); } v0 = v23 + g_old_x; @@ -2168,24 +2114,24 @@ LABEL_96: } else { v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v31 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v31 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v31 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v31 = -Sprite[0].fieldC; v29 = _vm->_graphicsManager.Reel_Reduc(v29, v31); - v32 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v32 = -_vm->_objectsManager.Sprite[0].fieldC; + v32 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v32 = -Sprite[0].fieldC; v30 = _vm->_graphicsManager.Reel_Reduc(v30, v32); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v33 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v33 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v33 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v33 = -Sprite[0].fieldC; v29 = _vm->_graphicsManager.Reel_Zoom(v29, v33); - v34 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v34 = -_vm->_objectsManager.Sprite[0].fieldC; + v34 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v34 = -Sprite[0].fieldC; v30 = _vm->_graphicsManager.Reel_Zoom(v30, v34); } v0 = g_old_x - v29; @@ -2206,24 +2152,24 @@ LABEL_115: } else { v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v37 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v37 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v37 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v37 = -Sprite[0].fieldC; v35 = _vm->_graphicsManager.Reel_Reduc(v35, v37); - v38 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v38 = -_vm->_objectsManager.Sprite[0].fieldC; + v38 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v38 = -Sprite[0].fieldC; v36 = _vm->_graphicsManager.Reel_Reduc(v36, v38); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v39 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v39 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v39 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v39 = -Sprite[0].fieldC; v35 = _vm->_graphicsManager.Reel_Zoom(v35, v39); - v40 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v40 = -_vm->_objectsManager.Sprite[0].fieldC; + v40 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v40 = -Sprite[0].fieldC; v36 = _vm->_graphicsManager.Reel_Zoom(v36, v40); } v0 = v35 + g_old_x; @@ -2244,24 +2190,24 @@ LABEL_134: } else { v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) { - v43 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v43 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) { + v43 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v43 = -Sprite[0].fieldC; v41 = _vm->_graphicsManager.Reel_Reduc(v41, v43); - v44 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v44 = -_vm->_objectsManager.Sprite[0].fieldC; + v44 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v44 = -Sprite[0].fieldC; v42 = _vm->_graphicsManager.Reel_Reduc(v42, v44); } - if (_vm->_objectsManager.Sprite[0].fieldC > 0) { - v45 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v45 = -_vm->_objectsManager.Sprite[0].fieldC; + if (Sprite[0].fieldC > 0) { + v45 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v45 = -Sprite[0].fieldC; v41 = _vm->_graphicsManager.Reel_Zoom(v41, v45); - v46 = _vm->_objectsManager.Sprite[0].fieldC; - if (_vm->_objectsManager.Sprite[0].fieldC < 0) - v46 = -_vm->_objectsManager.Sprite[0].fieldC; + v46 = Sprite[0].fieldC; + if (Sprite[0].fieldC < 0) + v46 = -Sprite[0].fieldC; v42 = _vm->_graphicsManager.Reel_Zoom(v42, v46); } v0 = g_old_x - v41; @@ -2465,7 +2411,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager.TOTAL_LIGNES = 0; - _vm->_objectsManager.DERLIGNE = 0; + DERLIGNE = 0; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v4 = 0; @@ -2599,7 +2545,7 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { while (v15 <= 100); _vm->_globals.dos_free2(ptr); - _vm->_objectsManager.CARRE_ZONE(); + CARRE_ZONE(); } // Square Zone @@ -2680,7 +2626,7 @@ void ObjectsManager::PLAN_BETA() { int v5; v1 = 0; - INVENTFLAG = false; + _vm->_dialogsManager.INVENTFLAG = false; _vm->_eventsManager.KEY_INVENT = 0; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; @@ -2819,14 +2765,14 @@ void ObjectsManager::BTGAUCHE() { destX = _vm->_eventsManager.XMOUSE(); destY = _vm->_eventsManager.YMOUSE(); - if (!INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { + if (!_vm->_dialogsManager.INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { v1 = _vm->_eventsManager.btsouris; - INVENTFLAG = 1; - INVENT(); - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 1; + _vm->_dialogsManager.showInventory(); + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.KEY_INVENT = 0; if (!_vm->_globals.SORTIE) { - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.btsouris = v1; } return; @@ -3157,216 +3103,6 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } -void ObjectsManager::TEST_INVENT() { - if (_vm->_globals.PLAN_FLAG) - _vm->_eventsManager.KEY_INVENT = 0; - if (_vm->_eventsManager.KEY_INVENT == 1) { - if (!INVENTFLAG) { - _vm->_eventsManager.KEY_INVENT = 0; - INVENTFLAG = 1; - INVENT(); - INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; - } - } -} - -void ObjectsManager::INVENT() { - int v1; - size_t filesize; - int v4; - int v5; - int v6; - byte *v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - Common::File f; - - v13 = 0; - if (VIRE_INVENT != 1 && !AFFINVEN && _vm->_globals.DESACTIVE_INVENT != 1) { - _vm->_graphicsManager.no_scroll = 1; - FLAG_VISIBLE_EFFACE = 4; - FLAG_VISIBLE = 0; - v1 = 0; - do { - INVENT_ANIM(); - _vm->_eventsManager.XMOUSE(); - _vm->_eventsManager.YMOUSE(); - _vm->_eventsManager.VBL(); - ++v1; - } while (v1 <= 1); - _vm->_globals.Winventaire = g_PTRNUL; - -LABEL_7: - _vm->_eventsManager.souris_bb = 0; - _vm->_eventsManager.souris_b = 0; - _vm->_globals.DESACTIVE_INVENT = 1; - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - - switch (_vm->_globals.FR) { - case 0: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); - break; - case 1: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); - break; - case 2: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); - break; - } - - if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); - - filesize = f.size(); - _vm->_globals.Winventaire = _vm->_globals.dos_malloc2(filesize); - _vm->_fileManager.bload_it(f, _vm->_globals.Winventaire, filesize); - f.close(); - - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); - inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v19 = _vm->_graphicsManager.ofscroll + 152; - v18 = Get_Largeur(_vm->_globals.Winventaire, 0); - v17 = Get_Hauteur(_vm->_globals.Winventaire, 0); - inventairex = v19; - inventairey = 114; - inventairel = v18; - inventaireh = v17; - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, - v19 + 300, 414, 0, 0, 0, 0); - v15 = 0; - v4 = 0; - v14 = 1; - do { - v16 = 0; - v5 = 1; - do { - ++v4; - v6 = _vm->_globals.INVENTAIRE[v4]; - if (v6 && v4 <= 29) { - v7 = CAPTURE_OBJET(v6, 0); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, - v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); - _vm->_globals.dos_free2(v7); - } - v16 += 54; - ++v5; - } while (v5 <= 6); - v15 += 38; - ++v14; - } while (v14 <= 5); - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Winventaire, inventairex, inventairey, inventairel, inventaireh); - _vm->_eventsManager.souris_bb = 0; - v20 = 0; - - // Main loop to select an inventory item - while (!_vm->shouldQuit()) { - // Turn on drawing the inventory dialog in the event manager - AFFINVEN = true; - - v8 = _vm->_eventsManager.XMOUSE(); - v9 = _vm->_eventsManager.YMOUSE(); - v12 = _vm->_eventsManager.BMOUSE(); - v10 = v13; - v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); - v13 = v11; - if (v11 != v10) - PARAMCADRE(v11); - if (_vm->_eventsManager.btsouris != 16) { - if ((uint16)(_vm->_eventsManager.btsouris - 1) > 1u) { - if (_vm->_eventsManager.btsouris != 3) { - if (v12 == 2) { - OBJETPLUS(v13); - if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - } - } - } - } - if (v12 == 1) { - if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (uint16)(_vm->_eventsManager.btsouris - 2) <= 1u) - break; - v9 = v13; - VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); - if (_vm->_eventsManager.btsouris == 8) - v20 = 1; - if (v20 != 1) { - _vm->_scriptManager.TRAVAILOBJET = 1; - _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; - _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; - _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; - OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = 0; - - if (_vm->_soundManager.VOICEOFF == 1) { - do - _vm->_eventsManager.VBL(); - while (!_vm->_globals.SORTIE && _vm->_eventsManager.BMOUSE() != 1); - _vm->_fontManager.TEXTE_OFF(9); - } - if (_vm->_globals.SORTIE) { - if (_vm->_globals.SORTIE == 2) - v20 = 1; - _vm->_globals.SORTIE = 0; - if (v20 != 1) { - inventaire2 = _vm->_globals.dos_free2(inventaire2); - if (g_PTRNUL != _vm->_globals.Winventaire) - _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); - goto LABEL_7; - } - } else if (v20 != 1) { - AFFINVEN = true; - } - } - } - if (VIRE_INVENT == 1) - v20 = 1; - if (v20 == 1) - break; - _vm->_eventsManager.VBL(); - if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) - SPECIAL_JEU(); - } - _vm->_fontManager.TEXTE_OFF(9); - if (AFFINVEN) { - AFFINVEN = false; - v9 = 114; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); - BOBTOUS = 1; - } - if (_vm->_globals.Winventaire != g_PTRNUL) - _vm->_globals.Winventaire = _vm->_globals.dos_free2(_vm->_globals.Winventaire); - inventaire2 = _vm->_globals.dos_free2(inventaire2); - - if (_vm->_eventsManager.btsouris == 1) - OptionsDialog::show(_vm); - if (_vm->_eventsManager.btsouris == 3) - _vm->_menuManager.CHARGE_PARTIE();//v9); - if (_vm->_eventsManager.btsouris == 2) - _vm->_menuManager.SAUVE_PARTIE();//v9); - _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(4); - old_cady = 0; - cady = 0; - old_cadx = 0; - cadx = 0; - _vm->_globals.DESACTIVE_INVENT = 0; - _vm->_graphicsManager.no_scroll = 0; - } -} - // Change Face/Head void ObjectsManager::CHANGE_TETE(int a1, int a2) { int v2; @@ -5229,10 +4965,10 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.BOBZONE_FLAG[21] = 1; _vm->_globals.BOBZONE_FLAG[22] = 1; _vm->_globals.BOBZONE_FLAG[23] = 1; - _vm->_objectsManager.VERBE_ON(20, 5); - _vm->_objectsManager.VERBE_ON(21, 5); - _vm->_objectsManager.VERBE_ON(22, 5); - _vm->_objectsManager.VERBE_ON(23, 5); + VERBE_ON(20, 5); + VERBE_ON(21, 5); + VERBE_ON(22, 5); + VERBE_ON(23, 5); _vm->_globals.ZONEP[20].field12 = 30; _vm->_globals.ZONEP[21].field12 = 30; _vm->_globals.ZONEP[22].field12 = 30; @@ -5246,7 +4982,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { } if (_vm->_globals.ECRAN == 93) { if (!_vm->_globals.SAUVEGARDE->data[svField333]) - _vm->_objectsManager.BOBANIM_ON(8); + BOBANIM_ON(8); } if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { _vm->_eventsManager.souris_n = 4; @@ -5792,24 +5528,24 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) if (v7) { if (v7 == 1) { if (a6 == 1 && BOBPOSI(1) == 26) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 2 && BOBPOSI(2) == 26) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 3 && BOBPOSI(3) == 27) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 4 && BOBPOSI(4) == 27) { - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_soundManager.PLAY_SAMPLE2(1); - VIRE_INVENT = 1; + _vm->_dialogsManager.VIRE_INVENT = true; _vm->_globals.SAUVEGARDE->data[v6] = 4; } } @@ -5865,9 +5601,9 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s int v9; v5 = 0; - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.KEY_INVENT = 0; - VIRE_INVENT = 0; + _vm->_dialogsManager.VIRE_INVENT = false; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = 0; _vm->_globals.iRegul = 1; @@ -5936,7 +5672,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s } if (v9 == 2) BTDROITE(); - TEST_INVENT(); + _vm->_dialogsManager.TEST_INVENT(); VERIFZONE(); if (GOACTION == 1) PARADISE(); @@ -5962,12 +5698,12 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & bool breakFlag; int xp, yp; - INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.KEY_INVENT = 0; - _vm->_objectsManager.verbe = 4; + verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; - VIRE_INVENT = 0; + _vm->_dialogsManager.VIRE_INVENT = false; _vm->_globals.PLAN_FLAG = 0; _vm->_graphicsManager.NOFADE = 0; _vm->_globals.NOMARCHE = 0; @@ -5980,7 +5716,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & if (!s1.empty()) _vm->_graphicsManager.LOAD_IMAGE(s1); if (!s2.empty()) - _vm->_objectsManager.INILINK(s2); + INILINK(s2); if (!s3.empty()) { _vm->_animationManager.CHARGE_ANIM(s3); _vm->_graphicsManager.VISU_ALL(); @@ -6019,23 +5755,23 @@ LABEL_70: } _vm->_globals.HOPKINS_DATA(); if (!_vm->_globals.PERSO_TYPE) - SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 34, 190); + SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 34, 190); if (_vm->_globals.PERSO_TYPE == 1) - SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 28, 155); + SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 28, 155); if (_vm->_globals.PERSO_TYPE == 2) - SPRITE(_vm->_globals.PERSO, _vm->_objectsManager.PERX, _vm->_objectsManager.PERY, 0, _vm->_objectsManager.PERI, 0, 0, 20, 127); - _vm->_eventsManager.souris_xy(_vm->_objectsManager.PERX, _vm->_objectsManager.PERY); + SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 20, 127); + _vm->_eventsManager.souris_xy(PERX, PERY); if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; - _vm->_objectsManager.VERIFTAILLE(); + VERIFTAILLE(); SPRITE_ON(0); _vm->_globals.CACHE_ON(); _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_objectsManager.VERIFTAILLE(); + VERIFTAILLE(); SPECIAL_INI(s2); _vm->_eventsManager.souris_n = 4; - g_old_x = _vm->_objectsManager.PERX; - g_old_y = _vm->_objectsManager.PERY; + g_old_x = PERX; + g_old_y = PERY; _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.BPP_NOAFF = 1; @@ -6059,14 +5795,14 @@ LABEL_70: mouseButtons = _vm->_eventsManager.BMOUSE(); if (mouseButtons) { if (mouseButtons == 1) { - if (_vm->_objectsManager.verbe == 16 && _vm->_eventsManager.btsouris == 16) { + if (verbe == 16 && _vm->_eventsManager.btsouris == 16) { xp = _vm->_eventsManager.XMOUSE(); yp = _vm->_eventsManager.YMOUSE(); if (xCheck == xp) { if (yCheck == yp) { _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_objectsManager.PARADISE(); + PARADISE(); if (_vm->_globals.SORTIE) breakFlag = true; } @@ -6074,18 +5810,18 @@ LABEL_70: xCheck = xp; yCheck = yp; } - _vm->_objectsManager.BTGAUCHE(); + BTGAUCHE(); } else if (mouseButtons == 2) { - _vm->_objectsManager.BTDROITE(); + BTDROITE(); } } if (!_vm->_globals.SORTIE) { - TEST_INVENT(); - _vm->_objectsManager.VERIFZONE(); + _vm->_dialogsManager.TEST_INVENT(); + VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL - || (_vm->_objectsManager.GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { - if (_vm->_objectsManager.GOACTION == 1) - _vm->_objectsManager.PARADISE(); + || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { + if (GOACTION == 1) + PARADISE(); } SPECIAL_JEU(); _vm->_eventsManager.VBL(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index abc0e97d8d..331245215d 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -64,16 +64,12 @@ private: public: SpriteItem Sprite[6]; int PRIORITY; - int inventairex, inventairey; - int inventairel, inventaireh; int old_cadx, old_cady, old_cadi; int cadx, cady, cadi; int SL_X, SL_Y; int I_old_x, I_old_y; int g_old_x, g_old_y; int FLAG_VISIBLE_EFFACE; - byte *Winventaire; - byte *inventaire2; byte *SL_SPR; byte *SL_SPR2; byte *sprite_ptr; @@ -82,11 +78,8 @@ public: bool SL_FLAG; int SL_MODE; bool FLAG_VISIBLE; - bool DESACTIVE_INVENT; int DESACTIVE_CURSOR; bool BOBTOUS; - bool INVENTFLAG; - bool AFFINVEN; int my_anim; int GOACTION; int NUMZONE; @@ -107,7 +100,6 @@ public: int A_DEPA; int MAX_DEPA; int MAX_DEPA1; - int VIRE_INVENT; int CH_TETE; int T_RECTIF; int DESACTIVE; @@ -160,7 +152,6 @@ public: void CALCUL_BOB(int idx); void VERIFCACHE(); - void INVENT_ANIM(); void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void CALCUL_SPRITE(int idx); @@ -199,8 +190,6 @@ public: void PARADISE(); void CLEAR_ECRAN(); - void TEST_INVENT(); - void INVENT(); void CHANGE_TETE(int a1, int a2); void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 5a6031d203..b010afd6eb 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -189,8 +189,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { v9 = 0; _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; - v7 = _vm->_objectsManager.DESACTIVE_INVENT; - _vm->_objectsManager.DESACTIVE_INVENT = 1; + v7 = _vm->_dialogsManager.DESACTIVE_INVENT; + _vm->_dialogsManager.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -255,7 +255,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _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; + _vm->_dialogsManager.DESACTIVE_INVENT = v7; STATI = 0; } -- cgit v1.2.3 From 9d93fca8d32c5b96e251380babb9af5bf5301d99 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 21:54:54 +1100 Subject: HOPKINS: Manually implemented Reduc_Ecran --- engines/hopkins/graphics.cpp | 64 +++++++++++++++++--------------------------- engines/hopkins/graphics.h | 2 +- engines/hopkins/menu.cpp | 5 ++-- 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 4495698321..64af872727 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2470,52 +2470,38 @@ Video_Cont_Vbe: } // Reduce Screen -// TODO: Check that v9 doesn't get set anywhere (apart from the current init to zero) -void GraphicsManager::Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7) { - byte *v7; - byte *v8; - int v9 = 0; - int v10 = 0; - int v11; - int v12; - byte *v13; - int v14; +void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) { + const byte *srcP; + byte *destP; + const byte *lineSrcP; - v7 = a3 + nbrligne2 * a4 + a1; - v8 = a2; - Red = a7; - Largeur = a5; + srcP = xp + nbrligne2 * yp + srcSurface; + destP = destSurface; + Red = zoom; + Largeur = width; Red_x = 0; Red_y = 0; - if (a7 < 100) { - Reduc_Ecran_L = Asm_Reduc(a5, Red); - Reduc_Ecran_H = Asm_Reduc(v9, Red); - v11 = Red; - do { - v14 = v10; - v13 = v7; - Red_y += v11; - if ((uint16)Red_y < 0x64u) { + if (zoom < 100) { + Reduc_Ecran_L = Asm_Reduc(width, Red); + Reduc_Ecran_H = Asm_Reduc(height, Red); + + for (int yCtr = 0; yCtr < Reduc_Ecran_H; ++yCtr, Red_y -= 100, srcP += nbrligne2) { + Red_y += Red; + if (Red_y < 100) { Red_x = 0; - v12 = Largeur; - do { - Red_x += v11; - if ((uint16)Red_x < 0x64u) { - *v8++ = *v7++; + lineSrcP = srcP; + + for (int xCtr = 0; xCtr < Largeur; ++xCtr) { + Red_x += Red; + if (Red_x < 100) { + *destP++ = *lineSrcP++; } else { - Red_x = Red_x - 100; - ++v7; + Red_x -= 100; + ++lineSrcP; } - --v12; - } while (v12); - v10 = v14; - v7 = nbrligne2 + v13; - } else { - Red_y = Red_y - 100; - v7 += nbrligne2; + } } - --v10; - } while (v10); + } } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index ff589b9061..18f600a184 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -183,7 +183,7 @@ public: void videkey(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); - void Reduc_Ecran(byte *a1, byte *a2, int a3, int a4, int a5, int a6, int a7); + void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col); void Plot_Vline(byte *surface, int xp, int yp, int height, char col); }; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 8b3010fc02..a6460f0b5a 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -321,7 +321,8 @@ void MenuManager::SAUVE_PARTIE() { _vm->_eventsManager.VBL(); v1 = _vm->_globals.dos_malloc2(0x2DB4u); - _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, SCREEN_WIDTH * 2, 440, 0x50u); + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, + SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); _vm->_graphicsManager.Trans_bloc2(v1, _vm->_graphicsManager.TABLE_COUL, 11136); LOAD_SAUVE(1); @@ -529,7 +530,7 @@ void MenuManager::COMPUT_HOPKINS(int idx) { LIT_TEXTE(8); if (v12 == 53) LIT_TEXTE(9); - if (v12 == 54) { + if (v12ii == 54) { LIT_TEXTE(10); _vm->_globals.SAUVEGARDE->data[svField270] = 4; } -- cgit v1.2.3 From 9827c4023c252272afb8497dd1b16c897fef4e0c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 22:04:56 +1100 Subject: HOPKINS: Comment out original thumbnail code that will need to be refactored --- engines/hopkins/menu.cpp | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index a6460f0b5a..58616e59d8 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -565,31 +565,28 @@ void MenuManager::COMPUT_HOPKINS(int idx) { // Load Save void MenuManager::LOAD_SAUVE(int a1) { int v1; - byte *v2; - byte *v3; +// byte *v2; +// byte *v3; Common::String s; - char v5; - char v6; - char v7; - char v8; - char v9; - char v10; - char v11; - char v12; - char v13; - char v14; Common::File f; - if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEFR.SPR"); - if (!_vm->_globals.FR) + switch (_vm->_globals.FR) { + case 0: _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEAN.SPR"); - if (_vm->_globals.FR == 2) + break; + case 1: + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEFR.SPR"); + break; + case 2: _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEES.SPR"); + break; + } + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_fileManager.CONSTRUIT_SYSTEM("SAVE2.SPR"); _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); + if (_vm->_globals.FR) { if (a1 == 1) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 525, 375, 1); @@ -601,21 +598,13 @@ void MenuManager::LOAD_SAUVE(int a1) { if (a1 == 2) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); } + v1 = 1; do { - memset(&s, 0, 0x13u); - sprintf(&v14, "%d", v1); - s = 80; - v5 = 65; - v6 = 82; - v7 = 84; - v8 = v14; - v9 = 46; - v10 = 69; - v11 = 67; - v12 = 82; - v13 = 0; + s = Common::String::format("ART%d.ECR", v1); + _vm->_fileManager.CONSTRUIT_LINUX(s); +/* TODO: Get from save file manager as part of save files if (f.exists(_vm->_globals.NFICHIER)) { v2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); v3 = v2; @@ -633,6 +622,7 @@ void MenuManager::LOAD_SAUVE(int a1) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); _vm->_globals.dos_free2(v3); } +*/ ++v1; } while (v1 <= 6); _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); -- cgit v1.2.3 From 38b5cf1efe0ab75c7100714fb886a704a4661fda Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 22:49:32 +1100 Subject: HOPKINS: Created new SaveFileManager class to handle save file related code --- engines/hopkins/anim.cpp | 8 +++--- engines/hopkins/files.cpp | 27 +------------------- engines/hopkins/files.h | 3 --- engines/hopkins/hopkins.cpp | 4 ++- engines/hopkins/hopkins.h | 2 ++ engines/hopkins/menu.cpp | 4 +-- engines/hopkins/module.mk | 1 + engines/hopkins/objects.cpp | 2 +- engines/hopkins/saveload.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/saveload.h | 46 +++++++++++++++++++++++++++++++++ engines/hopkins/talk.cpp | 14 +++++----- 11 files changed, 129 insertions(+), 43 deletions(-) create mode 100644 engines/hopkins/saveload.cpp create mode 100644 engines/hopkins/saveload.h diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index afaf37253c..7622302fc3 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -273,9 +273,9 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == 1280) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager.VESA_SCREEN; @@ -972,9 +972,9 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin _vm->_eventsManager.VBL(); _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; } diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 151a9a84f8..79b672ca33 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -38,32 +38,6 @@ void FileManager::setParent(HopkinsEngine *vm) { _vm = vm; } -void FileManager::initSaves() { - Common::String dataFilename = "HISCORE.DAT"; - byte data[100]; - Common::fill(&data[0], &data[100], 0); - - SAUVE_FICHIER(dataFilename, data, 100); -} - -// Save File -bool FileManager::SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n) { - return bsave(file, buf, n); -} - -bool FileManager::bsave(const Common::String &file, const void *buf, size_t n) { - Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file); - - if (f) { - size_t bytesWritten = f->write(buf, n); - f->finalize(); - delete f; - - return bytesWritten == n; - } else - return false; -} - // Load INI File void FileManager::Chage_Inifile(Common::StringMap &iniParams) { // TODO: Review whether we can do something cleaner with ScummVM initialisation than @@ -342,6 +316,7 @@ uint32 FileManager::FLONG(const Common::String &filename) { // Build Linux Common::String FileManager::CONSTRUIT_LINUX(const Common::String &file) { + _vm->_globals.NFICHIER = file; return file; } diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 9aece5fba3..d9df4341ca 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -39,9 +39,6 @@ public: FileManager(); void setParent(HopkinsEngine *vm); - void initSaves(); - bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); - bool bsave(const Common::String &file, const void *buf, size_t n); void Chage_Inifile(Common::StringMap &iniParams); byte *CHARGE_FICHIER(const Common::String &file); void CHARGE_FICHIER2(const Common::String &file, byte *a2); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 08f4b9f874..97271313f6 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -28,6 +28,7 @@ #include "hopkins/graphics.h" #include "hopkins/hopkins.h" #include "hopkins/files.h" +#include "hopkins/saveload.h" #include "hopkins/sound.h" #include "hopkins/talk.h" @@ -49,6 +50,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _linesManager.setParent(this); _menuManager.setParent(this); _objectsManager.setParent(this); + _saveLoadManager.setParent(this); _scriptManager.setParent(this); _soundManager.setParent(this); _talkManager.setParent(this); @@ -58,7 +60,7 @@ HopkinsEngine::~HopkinsEngine() { } Common::Error HopkinsEngine::run() { - _fileManager.initSaves(); + _saveLoadManager.initSaves(); Common::StringMap iniParams; _fileManager.Chage_Inifile(iniParams); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 0b6818d8cd..6a0eb2e5cd 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -42,6 +42,7 @@ #include "hopkins/lines.h" #include "hopkins/menu.h" #include "hopkins/objects.h" +#include "hopkins/saveload.h" #include "hopkins/script.h" #include "hopkins/sound.h" #include "hopkins/talk.h" @@ -107,6 +108,7 @@ public: LinesManager _linesManager; MenuManager _menuManager; ObjectsManager _objectsManager; + SaveLoadManager _saveLoadManager; ScriptManager _scriptManager; SoundManager _soundManager; TalkManager _talkManager; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 58616e59d8..1de66a103c 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -353,14 +353,14 @@ void MenuManager::SAUVE_PARTIE() { } while (v4 <= 34); _vm->_fileManager.CONSTRUIT_LINUX(v7); - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); v12 = 46; v13 = 69; v14 = 67; v15 = 82; v16 = 0; _vm->_fileManager.CONSTRUIT_LINUX(v7); - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); } _vm->_globals.dos_free2(v1); } diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index dbed88c668..109104f229 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \ lines.o \ menu.o \ objects.o \ + saveload.o \ script.o \ sound.o \ talk.o diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c94544f5ae..e60d72ba68 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4301,7 +4301,7 @@ void ObjectsManager::SPECIAL_JEU() { v1 = _vm->_globals.dos_malloc2(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp new file mode 100644 index 0000000000..ed4e3f1596 --- /dev/null +++ b/engines/hopkins/saveload.cpp @@ -0,0 +1,61 @@ +/* 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/savefile.h" +#include "hopkins/saveload.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" + +namespace Hopkins { + +void SaveLoadManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +bool SaveLoadManager::bsave(const Common::String &file, const void *buf, size_t n) { + Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file); + + if (f) { + size_t bytesWritten = f->write(buf, n); + f->finalize(); + delete f; + + return bytesWritten == n; + } else + return false; +} + +// Save File +bool SaveLoadManager::SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n) { + return bsave(file, buf, n); +} + +void SaveLoadManager::initSaves() { + Common::String dataFilename = "HISCORE.DAT"; + byte data[100]; + Common::fill(&data[0], &data[100], 0); + + SAUVE_FICHIER(dataFilename, data, 100); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h new file mode 100644 index 0000000000..d35d529749 --- /dev/null +++ b/engines/hopkins/saveload.h @@ -0,0 +1,46 @@ +/* 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_SAVELOAD_H +#define HOPKINS_SAVELOAD_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +class SaveLoadManager { +private: + HopkinsEngine *_vm; +public: + void setParent(HopkinsEngine *vm); + + void initSaves(); + bool bsave(const Common::String &file, const void *buf, size_t n); + bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_SAVELOAD_H */ diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index b010afd6eb..1630ce6013 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -91,11 +91,13 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == 640) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); - if (_vm->_graphicsManager.nbrligne == 1280) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); @@ -1214,9 +1216,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.CAT_FLAG = 0; _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - _vm->_fileManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); -- cgit v1.2.3 From 7441e0e8d78edd8cb8af051fd773b0f998bd9520 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 23:20:26 +1100 Subject: HOPKINS: bugfixes to conversation code --- engines/hopkins/saveload.cpp | 10 ++++++++++ engines/hopkins/saveload.h | 1 + engines/hopkins/talk.cpp | 15 +++++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index ed4e3f1596..1c29eca36f 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -58,4 +58,14 @@ void SaveLoadManager::initSaves() { SAUVE_FICHIER(dataFilename, data, 100); } +void SaveLoadManager::bload(const Common::String &file, byte *buf) { + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(file); + if (f == NULL) + error("Error openinig file - %s", file.c_str()); + + int32 filesize = f->size(); + f->read(buf, filesize); + delete f; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index d35d529749..4777f33148 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -39,6 +39,7 @@ public: void initSaves(); bool bsave(const Common::String &file, const void *buf, size_t n); bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); + void bload(const Common::String &file, byte *buf); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 1630ce6013..ac49d2a683 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -136,8 +136,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_objectsManager.PERSO_ON = 0; _vm->_eventsManager.btsouris = v14; @@ -615,7 +617,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { int v17; int v18; byte *v19; - byte indexData[16188]; + uint32 indexData[4047]; Common::String filename; Common::String dest; Common::File f; @@ -624,7 +626,11 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v18 = 0; _vm->_globals.police_l = 11; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + + // Build up the filename filename = dest = _vm->_globals.NFICHIER; + while (filename.lastChar() != '.') + filename.deleteLastChar(); filename += "IND"; if (!f.open(filename)) @@ -632,13 +638,14 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { filesize = f.size(); assert(filesize < 16188); - f.read(indexData, filesize); + for (int i = 0; i < (filesize / 4); ++i) + indexData[i] = f.readUint32LE(); f.close(); if (!f.open(dest)) error("Error opening file - %s", dest.c_str()); - f.seek(READ_LE_UINT32(&indexData[idx * 4])); + f.seek(indexData[idx]); ptr = _vm->_globals.dos_malloc2(2058); if (ptr == g_PTRNUL) error("temporary TEXT"); -- cgit v1.2.3 From afadf60ffc1a25b11bc348fb6bfe49ad10a0264a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Oct 2012 23:40:16 +1100 Subject: HOPKINS: Added explicit clearing of allocated buffers in BOITE --- engines/hopkins/font.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 75354031c4..e70983dd04 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -118,10 +118,10 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, byte *v9; const byte *v10; int v11; - char v13; - char v14; + byte v13; + byte v14; int v15; - char v16; + byte v16; int v17; int v18; int v19; @@ -129,7 +129,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, int v21; int v22; int v23; - char v24; + byte v24; int v25; int v27; int v28; @@ -235,6 +235,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, if (texte_tmp == g_PTRNUL) error("Error allocating text"); + Common::fill(&texte_tmp[0], &texte_tmp[0x80a], 0); f.read(texte_tmp, 0x800u); f.close(); _vm->_globals.texte_long = 2048; @@ -242,6 +243,8 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v69 = 100; _vm->_globals.texte_long = 100; v9 = _vm->_globals.dos_malloc2(0x6Eu); + Common::fill(&v9[0], &v9[0x6e], 0); + texte_tmp = v9; v10 = _vm->_globals.BUF_ZONE + Index[messageId]; memcpy(v9, v10, 0x60u); -- cgit v1.2.3 From ff1659ec7e2e38063179f0703e653ae979452be9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 08:08:00 +1100 Subject: HOPKINS: Fix missing assignment in sound manager initialisation --- engines/hopkins/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index b81cc63191..42eb98ec63 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -27,7 +27,7 @@ namespace Hopkins { SoundManager::SoundManager() { - SPECIAL_SOUND; + SPECIAL_SOUND = 0; SOUNDVOL = 0; VOICEVOL = 0; MUSICVOL = 0; -- cgit v1.2.3 From 5f56afdef469d5f02ad26d56f017dd788ece169c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 08:09:28 +1100 Subject: HOPKINS: Fix text display to have trailing spaces like the original. This improves the display of text boxes, giving extra padding on the right hand side. --- engines/hopkins/font.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index e70983dd04..651d0d40f5 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -350,7 +350,7 @@ LABEL_57: ++actualSize; Txt[idx].lines[v20] = Common::String((const char *)v61 + v65, actualSize); - TRIER_TEXT[lineCount++] = actualSize; + TRIER_TEXT[lineCount++] = lineSize; v65 += lineSize; v11 = v21; @@ -365,7 +365,8 @@ LABEL_57: v23 = 0; if (v22 - 1 > 0) { do { - v24 = Txt[idx].lines[v66][v23]; + Common::String &line = Txt[idx].lines[v66]; + v24 = (v23 >= (int)line.size()) ? '\0' : line[v23]; if ((byte)v24 <= 0x1Fu) v24 = 32; ptrc += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v24 - 32); -- cgit v1.2.3 From aeb7794a74e6c6c6254d2712b701d7ed6b01b167 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 08:34:37 +1100 Subject: HOPKINS: Add TalkManager constructor to initialise it's fields --- engines/hopkins/talk.cpp | 12 ++++++++++++ engines/hopkins/talk.h | 1 + 2 files changed, 13 insertions(+) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ac49d2a683..f3b420a829 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -33,6 +33,18 @@ namespace Hopkins { +TalkManager::TalkManager() { + BUFFERPERSO = NULL; + PALPERSO = NULL; + PERSOSPR = NULL; + ADR_ANIM = NULL; + TAILLEPERSO = 0; + STATI = 0; + PLIGNE1 = PLIGNE2 = 0; + PLIGNE3 = PLIGNE4 = 0; + PCHERCHE = 0; +} + void TalkManager::setParent(HopkinsEngine *vm) { _vm = vm; } diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 00d2c95a91..3c13bf81d4 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -46,6 +46,7 @@ public: int PLIGNE3, PLIGNE4; int PCHERCHE; public: + TalkManager(); void setParent(HopkinsEngine *vm); void PARLER_PERSO2(const Common::String &filename); -- cgit v1.2.3 From 0e153feefc1312c3cb6371a144458ceb7c8e3d94 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 09:13:31 +1100 Subject: HOPKINS: Added initialisation of allocated lineData blocks --- engines/hopkins/lines.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 5e4e2a5b93..6289e10f8a 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -281,6 +281,8 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v10 = _vm->_globals.dos_malloc2(4 * v34 + 8); if (v10 == g_PTRNUL) error("AJOUTE LIGNE OBSTACLE"); + + Common::fill(v10, v10 + 4 * v34 + 8, 0); Ligne[idx].lineData = (int16 *)v10; v32 = Ligne[idx].lineData; -- cgit v1.2.3 From 39c856e70c26765fc03aa42c40b1688e21a00ece Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 09:29:57 +1100 Subject: HOPKINS: Cleaned up int assignments to BOBZONE_FLAG array to be bools --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/lines.cpp | 2 +- engines/hopkins/objects.cpp | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0ae9d1f6be..df6bd6798e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -97,7 +97,7 @@ Globals::Globals() { Common::fill((byte *)&Segment[i], (byte *)&Segment[i] + sizeof(SegmentItem), 0); for (int i = 0; i < 105; ++i) { BOBZONE[i] = 0; - BOBZONE_FLAG[i] = 0; + BOBZONE_FLAG[i] = false; } for (int i = 0; i < 500; ++i) STAILLE[i] = 0; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 6289e10f8a..7f0d6ad109 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -211,7 +211,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in LigneZone[idx].count = v20; LigneZone[idx].field2 = a6; } else { - _vm->_globals.BOBZONE_FLAG[a6] = 1; + _vm->_globals.BOBZONE_FLAG[a6] = true; _vm->_globals.BOBZONE[a6] = a3; } } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e60d72ba68..8857e8eacc 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3062,7 +3062,7 @@ void ObjectsManager::CLEAR_ECRAN() { do { v2 = v1; _vm->_globals.BOBZONE[v2] = 0; - _vm->_globals.BOBZONE_FLAG[v2] = 0; + _vm->_globals.BOBZONE_FLAG[v2] = false; ++v1; } while (v1 <= 48); _vm->_eventsManager.btsouris = 4; @@ -3963,7 +3963,7 @@ int ObjectsManager::MZONE() { do { v2 = _vm->_globals.BOBZONE[v1]; if (v2) { - if (_vm->_globals.BOBZONE_FLAG[v1] == 1) { + if (_vm->_globals.BOBZONE_FLAG[v1]) { v3 = v2; v15 = v3; if (_vm->_globals.Bob[v3].field0) { @@ -4626,7 +4626,7 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { void ObjectsManager::ZONE_ON(int idx) { if (_vm->_globals.BOBZONE[idx]) { - _vm->_globals.BOBZONE_FLAG[idx] = 1; + _vm->_globals.BOBZONE_FLAG[idx] = true; } else { _vm->_globals.ZONEP[idx].field10 = 1; } @@ -4634,7 +4634,7 @@ void ObjectsManager::ZONE_ON(int idx) { void ObjectsManager::ZONE_OFF(int idx) { if (_vm->_globals.BOBZONE[idx]) { - _vm->_globals.BOBZONE_FLAG[idx] = 0; + _vm->_globals.BOBZONE_FLAG[idx] = false; } else { _vm->_globals.ZONEP[idx].field10 = 0; } @@ -4961,10 +4961,10 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.BOBZONE[21] = 2; _vm->_globals.BOBZONE[22] = 3; _vm->_globals.BOBZONE[23] = 4; - _vm->_globals.BOBZONE_FLAG[20] = 1; - _vm->_globals.BOBZONE_FLAG[21] = 1; - _vm->_globals.BOBZONE_FLAG[22] = 1; - _vm->_globals.BOBZONE_FLAG[23] = 1; + _vm->_globals.BOBZONE_FLAG[20] = true; + _vm->_globals.BOBZONE_FLAG[21] = true; + _vm->_globals.BOBZONE_FLAG[22] = true; + _vm->_globals.BOBZONE_FLAG[23] = true; VERBE_ON(20, 5); VERBE_ON(21, 5); VERBE_ON(22, 5); -- cgit v1.2.3 From c78a92682b9502c8719ce946c3906de2d5d4bf60 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 10:43:31 +1100 Subject: HOPKINS: Renamed fields of VBobItem class --- engines/hopkins/globals.cpp | 24 +++---- engines/hopkins/globals.h | 18 ++--- engines/hopkins/graphics.cpp | 42 ++++++------ engines/hopkins/graphics.h | 2 +- engines/hopkins/objects.cpp | 154 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 2 +- 6 files changed, 119 insertions(+), 123 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index df6bd6798e..d6a2f328d9 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -422,26 +422,26 @@ void Globals::INIT_ANIM() { void Globals::INIT_VBOB() { for (int idx = 0; idx < 30; ++idx) { VBob[idx].field4 = 0; - VBob[idx].field6 = 0; - VBob[idx].field8 = 0; - VBob[idx].fieldA = 0; + VBob[idx].xp = 0; + VBob[idx].yp = 0; + VBob[idx].frameIndex = 0; VBob[idx].fieldC = 0; - VBob[idx].field10 = g_PTRNUL; - VBob[idx].field0 = g_PTRNUL; - VBob[idx].field1C = g_PTRNUL; + VBob[idx].surface = g_PTRNUL; + VBob[idx].spriteData = g_PTRNUL; + VBob[idx].oldSpriteData = g_PTRNUL; } } void Globals::CLEAR_VBOB() { for (int idx = 0; idx < 30; ++idx) { VBob[idx].field4 = 0; - VBob[idx].field6 = 0; - VBob[idx].field8 = 0; - VBob[idx].fieldA = 0; + VBob[idx].xp = 0; + VBob[idx].yp = 0; + VBob[idx].frameIndex = 0; VBob[idx].fieldC = 0; - VBob[idx].field10 = g_PTRNUL; - VBob[idx].field0 = g_PTRNUL; - VBob[idx].field1C = g_PTRNUL; + VBob[idx].surface = g_PTRNUL; + VBob[idx].spriteData = g_PTRNUL; + VBob[idx].oldSpriteData = g_PTRNUL; } } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 15c44f74d7..841972084c 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -132,18 +132,18 @@ struct BlAnimItem { }; struct VBobItem { - byte *field0; + byte *spriteData; int field4; - int field6; - int field8; - int fieldA; + int xp; + int yp; + int frameIndex; int fieldC; int fieldE; - byte *field10; - int field14; - int field16; - int field18; - byte *field1C; + byte *surface; + int oldX; + int oldY; + int oldFrameIndex; + byte *oldSpriteData; }; struct ObjetWItem { diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 64af872727..d603c63546 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1675,36 +1675,36 @@ void GraphicsManager::CopyAsm(const byte *surface) { } while (v4); } -void GraphicsManager::Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6) { +void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { byte *v6; int v7; - const byte *v8; + const byte *srcP; unsigned int i; - int v10; + int yCtr; - v6 = a3 + nbrligne2 * a4 + a1; - v7 = a6; - v8 = a2; + v6 = xp + nbrligne2 * yp + destSurface; + v7 = height; + srcP = src; do { - v10 = v7; - if (a5 & 1) { - memcpy(v6, v8, a5); - v8 += a5; - v6 += a5; - } else if (a5 & 2) { - for (i = a5 >> 1; i; --i) { - *(uint16 *)v6 = *(uint16 *)v8; - v8 += 2; + yCtr = v7; + if (width & 1) { + memcpy(v6, srcP, width); + srcP += width; + v6 += width; + } else if (width & 2) { + for (i = width >> 1; i; --i) { + *(uint16 *)v6 = *(uint16 *)srcP; + srcP += 2; v6 += 2; } } else { - memcpy(v6, v8, 4 * (a5 >> 2)); - v8 += 4 * (a5 >> 2); - v6 += 4 * (a5 >> 2); + memcpy(v6, srcP, 4 * (width >> 2)); + srcP += 4 * (width >> 2); + v6 += 4 * (width >> 2); } - v6 = nbrligne2 + v6 - a5; - v7 = v10 - 1; - } while (v10 != 1); + v6 = nbrligne2 + v6 - width; + v7 = yCtr - 1; + } while (yCtr != 1); } int GraphicsManager::Reel_Zoom(int v, int percentage) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 18f600a184..affbe01b77 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -167,7 +167,7 @@ public: int Magic_Number(int v); void Affiche_Segment_Vesa(); void CopyAsm(const byte *surface); - void Restore_Mem(byte *a1, const byte *a2, int a3, int a4, unsigned int a5, int a6); + void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8857e8eacc..bc82807c17 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1426,108 +1426,104 @@ void ObjectsManager::AFF_VBOB() { int idx = 0; do { if (_vm->_globals.VBob[idx].field4 == 4) { - width = Get_Largeur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); - height = Get_Hauteur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); + width = Get_Largeur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + height = Get_Hauteur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.VBob[idx].field10, _vm->_globals.VBob[idx].field6, - _vm->_globals.VBob[idx].field8, - width, height); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, + _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].xp, + _vm->_globals.VBob[idx].yp, width, height); _vm->_graphicsManager.Restore_Mem( - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].field10, - _vm->_globals.VBob[idx].field6, _vm->_globals.VBob[idx].field8, + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].surface, + _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, width, height); _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.VBob[idx].field6, _vm->_globals.VBob[idx].field8, - _vm->_globals.VBob[idx].field6 + width, - height + _vm->_globals.VBob[idx].field8); + _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, + _vm->_globals.VBob[idx].xp + width, height + _vm->_globals.VBob[idx].yp); - if (g_PTRNUL != _vm->_globals.VBob[idx].field10) - _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + if (_vm->_globals.VBob[idx].surface != g_PTRNUL) + _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); _vm->_globals.VBob[idx].field4 = 0; - _vm->_globals.VBob[idx].field10 = g_PTRNUL; - _vm->_globals.VBob[idx].field0 = g_PTRNUL; - _vm->_globals.VBob[idx].field6 = 0; - _vm->_globals.VBob[idx].field8 = 0; - _vm->_globals.VBob[idx].field14 = 0; - _vm->_globals.VBob[idx].field16 = 0; - _vm->_globals.VBob[idx].fieldA = 0; - _vm->_globals.VBob[idx].field18 = 0; - _vm->_globals.VBob[idx].field1C = g_PTRNUL; + _vm->_globals.VBob[idx].surface = g_PTRNUL; + _vm->_globals.VBob[idx].spriteData = g_PTRNUL; + _vm->_globals.VBob[idx].xp = 0; + _vm->_globals.VBob[idx].yp = 0; + _vm->_globals.VBob[idx].oldX = 0; + _vm->_globals.VBob[idx].oldY = 0; + _vm->_globals.VBob[idx].frameIndex = 0; + _vm->_globals.VBob[idx].oldFrameIndex = 0; + _vm->_globals.VBob[idx].oldSpriteData = g_PTRNUL; } if (_vm->_globals.VBob[idx].field4 == 3) { - width = Get_Largeur(_vm->_globals.VBob[idx].field1C, _vm->_globals.VBob[idx].field18); - height = Get_Hauteur(_vm->_globals.VBob[idx].field1C, _vm->_globals.VBob[idx].field18); + width = Get_Largeur(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); + height = Get_Hauteur(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.VBob[idx].field10, _vm->_globals.VBob[idx].field14, - _vm->_globals.VBob[idx].field16, + _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, + _vm->_globals.VBob[idx].oldY, width, height); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.VBob[idx].field10, _vm->_globals.VBob[idx].field14, - _vm->_globals.VBob[idx].field16, - width, height); + _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, + _vm->_globals.VBob[idx].oldY, width, height); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].field14, - _vm->_globals.VBob[idx].field16, _vm->_globals.VBob[idx].field14 + width, - _vm->_globals.VBob[idx].field16 + height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].oldX, + _vm->_globals.VBob[idx].oldY, _vm->_globals.VBob[idx].oldX + width, + _vm->_globals.VBob[idx].oldY + height); _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; + _vm->_globals.VBob[idx].oldSpriteData = _vm->_globals.VBob[idx].spriteData; - if (g_PTRNUL != _vm->_globals.VBob[idx].field10) - _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + if (_vm->_globals.VBob[idx].surface != g_PTRNUL) + _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); - _vm->_globals.VBob[idx].field10 = g_PTRNUL; - _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; - _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; - _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; + _vm->_globals.VBob[idx].surface = g_PTRNUL; + _vm->_globals.VBob[idx].oldX = _vm->_globals.VBob[idx].xp; + _vm->_globals.VBob[idx].oldY = _vm->_globals.VBob[idx].yp; + _vm->_globals.VBob[idx].oldFrameIndex = _vm->_globals.VBob[idx].frameIndex; } if (_vm->_globals.VBob[idx].field4 == 1) { - width = Get_Largeur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); - height = Get_Hauteur(_vm->_globals.VBob[idx].field0, _vm->_globals.VBob[idx].fieldA); + width = Get_Largeur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + height = Get_Hauteur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - if (g_PTRNUL != _vm->_globals.VBob[idx].field10) - _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + if (_vm->_globals.VBob[idx].surface != g_PTRNUL) + _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); byte *surface = _vm->_globals.dos_malloc2(height * width); - _vm->_globals.VBob[idx].field10 = surface; + _vm->_globals.VBob[idx].surface = surface; _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, - _vm->_globals.VBob[idx].field6, _vm->_globals.VBob[idx].field8, width, height); + _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, width, height); - byte *v10 = _vm->_globals.VBob[idx].field0; + byte *v10 = _vm->_globals.VBob[idx].spriteData; if (*v10 == 78) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_SCREEN, v10, - _vm->_globals.VBob[idx].field6 + 300, - _vm->_globals.VBob[idx].field8 + 300, - _vm->_globals.VBob[idx].fieldA, + _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, + _vm->_globals.VBob[idx].frameIndex, 0, 0, 0); _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.VBob[idx].field0, - _vm->_globals.VBob[idx].field6 + 300, _vm->_globals.VBob[idx].field8 + 300, - _vm->_globals.VBob[idx].fieldA, + _vm->_globals.VBob[idx].spriteData, + _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, + _vm->_globals.VBob[idx].frameIndex, 0, 0, 0); } else { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, - v10, _vm->_globals.VBob[idx].field6 + 300, _vm->_globals.VBob[idx].field8 + 300, - _vm->_globals.VBob[idx].fieldA); + v10, _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, + _vm->_globals.VBob[idx].frameIndex); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].field0, - _vm->_globals.VBob[idx].field6 + 300, _vm->_globals.VBob[idx].field8 + 300, - _vm->_globals.VBob[idx].fieldA); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].spriteData, + _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, + _vm->_globals.VBob[idx].frameIndex); } - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].field6, - _vm->_globals.VBob[idx].field8, _vm->_globals.VBob[idx].field6 + width, - _vm->_globals.VBob[idx].field8 + height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].xp, + _vm->_globals.VBob[idx].yp , _vm->_globals.VBob[idx].xp + width, + _vm->_globals.VBob[idx].yp + height); _vm->_globals.VBob[idx].field4 = 2; } ++idx; @@ -4407,35 +4403,35 @@ void ObjectsManager::BOB_VIVANT(int idx) { } } -void ObjectsManager::VBOB(byte *a1, int idx, int a3, int a4, int a5) { +void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { if (idx > 29) error("MAX_VBOB exceeded"); if (_vm->_globals.VBob[idx].field4 <= 1) { _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx].field6 = a3; - _vm->_globals.VBob[idx].field8 = a4; - _vm->_globals.VBob[idx].fieldA = a5; - _vm->_globals.VBob[idx].field14 = a3; - _vm->_globals.VBob[idx].field16 = a4; - _vm->_globals.VBob[idx].field18 = a5; - _vm->_globals.VBob[idx].field0 = a1; - _vm->_globals.VBob[idx].field1C = a1; - if (_vm->_globals.VBob[idx].field10 != g_PTRNUL) - _vm->_globals.VBob[idx].field10 = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].field10); + _vm->_globals.VBob[idx].xp = xp; + _vm->_globals.VBob[idx].yp = yp; + _vm->_globals.VBob[idx].frameIndex = frameIndex; + _vm->_globals.VBob[idx].oldX = xp; + _vm->_globals.VBob[idx].oldY = yp; + _vm->_globals.VBob[idx].oldFrameIndex = frameIndex; + _vm->_globals.VBob[idx].spriteData = src; + _vm->_globals.VBob[idx].oldSpriteData = src; + if (_vm->_globals.VBob[idx].surface != g_PTRNUL) + _vm->_globals.VBob[idx].surface = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); } int f4 = _vm->_globals.VBob[idx].field4; if (f4 == 2 || f4 == 4) { _vm->_globals.VBob[idx].field4 = 3; - _vm->_globals.VBob[idx].field14 = _vm->_globals.VBob[idx].field6; - _vm->_globals.VBob[idx].field16 = _vm->_globals.VBob[idx].field8; - _vm->_globals.VBob[idx].field1C = _vm->_globals.VBob[idx].field0; - _vm->_globals.VBob[idx].field18 = _vm->_globals.VBob[idx].fieldA; - _vm->_globals.VBob[idx].field6 = a3; - _vm->_globals.VBob[idx].field8 = a4; - _vm->_globals.VBob[idx].fieldA = a5; - _vm->_globals.VBob[idx].field0 = a1; + _vm->_globals.VBob[idx].oldX = _vm->_globals.VBob[idx].xp; + _vm->_globals.VBob[idx].oldY = _vm->_globals.VBob[idx].yp; + _vm->_globals.VBob[idx].oldSpriteData = _vm->_globals.VBob[idx].spriteData; + _vm->_globals.VBob[idx].oldFrameIndex = _vm->_globals.VBob[idx].frameIndex; + _vm->_globals.VBob[idx].xp = xp; + _vm->_globals.VBob[idx].yp = yp; + _vm->_globals.VBob[idx].frameIndex = frameIndex; + _vm->_globals.VBob[idx].spriteData = src; } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 331245215d..d9f15abdea 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -203,7 +203,7 @@ public: void OPTI_OBJET(); void SPECIAL_JEU(); void BOB_VIVANT(int a1); - void VBOB(byte *a1, int a2, int a3, int a4, int a5); + void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); void ACTION_DOS(int idx); void ACTION_DROITE(int idx); -- cgit v1.2.3 From a0b540108d74aa2e8138116adb9614b025183e36 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 11:22:30 +1100 Subject: HOPKINS: Renamed some of the fields of BobItem class --- engines/hopkins/globals.h | 28 ++++---- engines/hopkins/objects.cpp | 165 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 8 +-- 3 files changed, 99 insertions(+), 102 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 841972084c..293336fc09 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -92,21 +92,21 @@ struct Liste2Item { struct BobItem { int field0; - byte *field4; - int field8; - int fieldA; - int fieldC; + byte *spriteData; + int xp; + int yp; + int frameIndex; int fieldE; int field10; int field12; int field14; int field16; - byte *field18; + byte *animData; int field1C; int field1E; int field20; int field22; - int field24; + int offsetY; int field26; int field28; int field2A; @@ -115,14 +115,14 @@ struct BobItem { int field34; int field36; int field38; - int field3A; - int field3C; - int field3E; - int field40; - int field42; - int field44; - int field46; - int field48; + bool isSprite; + bool isActive; + int oldX; + int oldY; + int oldWidth; + int oldHeight; + int oldX2; + int oldY2; int field4A; }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bc82807c17..a09d4c5d70 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -576,21 +576,21 @@ void ObjectsManager::BOB_ZERO(int idx) { Liste2Item &item = _vm->_globals.Liste2[idx]; bob.field0 = 0; - bob.field4 = g_PTRNUL; - bob.field8 = 0; - bob.fieldA = 0; - bob.fieldC = 0; + bob.spriteData = g_PTRNUL; + bob.xp = 0; + bob.yp = 0; + bob.frameIndex = 0; bob.fieldE = 0; bob.field10 = 0; bob.field12 = 0; bob.field14 = 0; bob.field16 = 0; - bob.field18 = g_PTRNUL; + bob.animData = g_PTRNUL; bob.field1C = 0; bob.field1E = 0; bob.field20 = 0; bob.field22 = 0; - bob.field24 = 0; + bob.offsetY = 0; bob.field26 = 0; bob.field28 = 0; bob.field2A = 0; @@ -599,7 +599,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field34 = 0; bob.field36 = 0; bob.field38 = 0; - bob.field46 = 0; + bob.oldX2 = 0; item.field0 = 0; item.xp = 0; @@ -618,26 +618,25 @@ void ObjectsManager::DEF_BOB(int idx) { int xp; int yp; - if (_vm->_globals.Bob[idx].field3C) { - xp = _vm->_globals.Bob[idx].field3E; - yp = _vm->_globals.Bob[idx].field40; + if (_vm->_globals.Bob[idx].isActive) { + xp = _vm->_globals.Bob[idx].oldX; + yp = _vm->_globals.Bob[idx].oldY; - if (_vm->_globals.Bob[idx].field3A) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].field4, - xp + 300, yp + 300, _vm->_globals.Bob[idx].fieldC); + if (_vm->_globals.Bob[idx].isSprite) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, + xp + 300, yp + 300, _vm->_globals.Bob[idx].frameIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.Bob[idx].field4, xp + 300, - _vm->_globals.Bob[idx].field40 + 300, _vm->_globals.Bob[idx].fieldC, - _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx].field48, + _vm->_globals.Bob[idx].spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx].frameIndex, + _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx].oldY2, _vm->_globals.Bob[idx].field38); _vm->_globals.Liste2[idx].field0 = 1; _vm->_globals.Liste2[idx].xp = xp; _vm->_globals.Liste2[idx].yp = yp; - _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].field42; - _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].field44; + _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].oldWidth; + _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].oldHeight; v5 = _vm->_globals.Liste2[idx].xp; v6 = _vm->_graphicsManager.min_x; @@ -676,7 +675,7 @@ void ObjectsManager::BOB_VISU(int idx) { int v1; const byte *data; int16 v6; - int16 v7; + int16 offsetY; int16 v8; int16 v9; @@ -689,7 +688,7 @@ void ObjectsManager::BOB_VISU(int idx) { v1 = (int16)READ_LE_UINT16(data); v9 = (int16)READ_LE_UINT16(data + 2); v8 = (int16)READ_LE_UINT16(data + 4); - v7 = (int16)READ_LE_UINT16(data + 6); + offsetY = (int16)READ_LE_UINT16(data + 6); v6 = (int16)READ_LE_UINT16(data + 8); if ((int16)READ_LE_UINT16(data)) { if (_vm->_globals.Bank[v1].field4) { @@ -699,22 +698,22 @@ void ObjectsManager::BOB_VISU(int idx) { v6 = -1; if ((int16)READ_LE_UINT16(data + 24)) { - _vm->_globals.Bob[idx].field3A = 0; + _vm->_globals.Bob[idx].isSprite = false; if (_vm->_globals.Bank[v1].fileHeader == 1) { - _vm->_globals.Bob[idx].field3A = 1; + _vm->_globals.Bob[idx].isSprite = true; _vm->_globals.Bob[idx].field36 = 0; _vm->_globals.Bob[idx].field38 = 0; } - _vm->_globals.Bob[idx].field18 = _vm->_globals.Bqe_Anim[idx].data; + _vm->_globals.Bob[idx].animData = _vm->_globals.Bqe_Anim[idx].data; _vm->_globals.Bob[idx].field0 = 10; - _vm->_globals.Bob[idx].field4 = _vm->_globals.Bank[v1].data; + _vm->_globals.Bob[idx].spriteData = _vm->_globals.Bank[v1].data; _vm->_globals.Bob[idx].field1E = v9; _vm->_globals.Bob[idx].field20 = v6; _vm->_globals.Bob[idx].field22 = v8; - _vm->_globals.Bob[idx].field24 = v7; + _vm->_globals.Bob[idx].offsetY = offsetY; } } } @@ -729,15 +728,15 @@ void ObjectsManager::BOB_OFF(int idx) { } void ObjectsManager::BOB_OFFSET(int idx, int v) { - _vm->_globals.Bob[idx].field46 = v; + _vm->_globals.Bob[idx].oldX2 = v; } void ObjectsManager::BOB_ADJUST(int idx, int v) { - _vm->_globals.Bob[idx].field46 = v; + _vm->_globals.Bob[idx].oldX2 = v; } void ObjectsManager::BOB_OFFSETY(int idx, int v) { - _vm->_globals.Bob[idx].field24 = v; + _vm->_globals.Bob[idx].offsetY = v; } void ObjectsManager::SCBOB(int idx) { @@ -758,12 +757,12 @@ void ObjectsManager::SCBOB(int idx) { if (_vm->_globals.Bob[v1].field0) { if (!_vm->_globals.Bob[v8].field16) { if (!_vm->_globals.Bob[v8].field34) { - if ( _vm->_globals.Bob[v8].fieldC != 250) { - v2 = _vm->_globals.Bob[v8].field42;; - v9 = _vm->_globals.Bob[v8].field46 + _vm->_globals.Bob[v8].field42; - v6 = _vm->_globals.Bob[v8].field48 + _vm->_globals.Bob[v8].field44; + if ( _vm->_globals.Bob[v8].frameIndex != 250) { + v2 = _vm->_globals.Bob[v8].oldWidth; + v9 = _vm->_globals.Bob[v8].oldX2 + _vm->_globals.Bob[v8].oldWidth; + v6 = _vm->_globals.Bob[v8].oldY2 + _vm->_globals.Bob[v8].oldHeight; v3 =_vm->_globals.Cache[idx].field0; - v4 =_vm->_globals.Cache[idx].field4;; + v4 =_vm->_globals.Cache[idx].field4; v7 =_vm->_globals.Cache[idx].field6 + v3; v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; @@ -825,24 +824,24 @@ void ObjectsManager::CALCUL_BOB(int idx) { int v21; int v22; - _vm->_globals.Bob[idx].field3C = 0; - if (_vm->_globals.Bob[idx].field3A == 1) { + _vm->_globals.Bob[idx].isActive = false; + if (_vm->_globals.Bob[idx].isSprite) { _vm->_globals.Bob[idx].field38 = 0; _vm->_globals.Bob[idx].field36 = 0; } - result = _vm->_globals.Bob[idx].fieldC; + result = _vm->_globals.Bob[idx].frameIndex; if (result != 250) { if (_vm->_globals.Bob[idx].field38) { - v4 = get_offsetx(_vm->_globals.Bob[idx].field4, result, 1); + v4 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 1); v22 = v4; v15 = v4; - v5 = get_offsety(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC, 1); + v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 1); } else { - v3 = get_offsetx(_vm->_globals.Bob[idx].field4, result, 0); + v3 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 0); v22 = v3; v15 = v3; - v5 = get_offsety(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC, 0); + v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 0); } v17 = v5; @@ -902,20 +901,20 @@ void ObjectsManager::CALCUL_BOB(int idx) { } } - v13 = _vm->_globals.Bob[idx].field8 - v22; - v14 = _vm->_globals.Bob[idx].fieldA - v17; - _vm->_globals.Bob[idx].field3C = 1; - _vm->_globals.Bob[idx].field3E = v13; - _vm->_globals.Bob[idx].field40 = v14; - _vm->_globals.Bob[idx].field48 = v21; + v13 = _vm->_globals.Bob[idx].xp - v22; + v14 = _vm->_globals.Bob[idx].yp - v17; + _vm->_globals.Bob[idx].isActive = true; + _vm->_globals.Bob[idx].oldX = v13; + _vm->_globals.Bob[idx].oldY = v14; + _vm->_globals.Bob[idx].oldY2 = v21; _vm->_globals.Bob[idx].field4A = v20; _vm->_globals.Liste2[idx].field0 = 1; _vm->_globals.Liste2[idx].xp = v13; _vm->_globals.Liste2[idx].yp = v14; - int width = Get_Largeur(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC); - int height = Get_Hauteur(_vm->_globals.Bob[idx].field4, _vm->_globals.Bob[idx].fieldC); + int width = Get_Largeur(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); + int height = Get_Hauteur(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); if (v21) { width = _vm->_graphicsManager.Reel_Zoom(width, v21); @@ -928,8 +927,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Liste2[idx].width = width; _vm->_globals.Liste2[idx].height = height; - _vm->_globals.Bob[idx].field42 = width; - _vm->_globals.Bob[idx].field44 = height; + _vm->_globals.Bob[idx].oldWidth = width; + _vm->_globals.Bob[idx].oldHeight = height; } } @@ -1266,7 +1265,7 @@ void ObjectsManager::AFF_BOB_ANIM() { v1 = _vm->_globals.Bob[idx].field20; if (v1 == -1) v1 = 50; - if (_vm->_globals.Bob[idx].field18 == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) + if (_vm->_globals.Bob[idx].animData == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) goto LABEL_38; v2 = _vm->_globals.Bob[idx].field14; @@ -1280,18 +1279,18 @@ void ObjectsManager::AFF_BOB_ANIM() { if (_vm->_globals.Bob[idx].field1C != 1) goto LABEL_38; - v20 = _vm->_globals.Bob[idx].field18 + 20; + v20 = _vm->_globals.Bob[idx].animData + 20; v24 = _vm->_globals.Bob[idx].field10; - _vm->_globals.Bob[idx].field8 = (int16)READ_LE_UINT16(v20 + 2 * v24); + _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; + _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == 1 && idx > 20 ) - _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; + _vm->_globals.Bob[idx].xp += _vm->_eventsManager.start_x; - _vm->_globals.Bob[idx].fieldA = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); + _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); - _vm->_globals.Bob[idx].fieldC = *(v20 + 2 * v24 + 8); + _vm->_globals.Bob[idx].frameIndex = *(v20 + 2 * v24 + 8); _vm->_globals.Bob[idx].field38 = *(v20 + 2 * v24 + 9); _vm->_globals.Bob[idx].field10 += 5; v5 = _vm->_globals.Bob[idx].field12; @@ -1321,18 +1320,18 @@ LABEL_38: _vm->_globals.Bob[idx].field0 = 11; } else { _vm->_globals.Bob[idx].field10 = 0; - v21 = _vm->_globals.Bob[idx].field18 + 20; - _vm->_globals.Bob[idx].field8 = (int16)READ_LE_UINT16(v21); + v21 = _vm->_globals.Bob[idx].animData + 20; + _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v21); if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals.Bob[idx].field8 = _vm->_globals.BL_ANIM[idx].v2; + _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == 1 && idx > 20) - _vm->_globals.Bob[idx].field8 += _vm->_eventsManager.start_x; + _vm->_globals.Bob[idx].xp += _vm->_eventsManager.start_x; - _vm->_globals.Bob[idx].fieldA = (int16)READ_LE_UINT16(v21 + 2); + _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v21 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); - _vm->_globals.Bob[idx].fieldC = *(v21 + 8); + _vm->_globals.Bob[idx].frameIndex = *(v21 + 8); _vm->_globals.Bob[idx].field38 = *(v21 + 9); _vm->_globals.Bob[idx].field10 += 5; v10 = _vm->_globals.Bob[idx].field12; @@ -1405,16 +1404,17 @@ LABEL_38: do { ++v28; v18 = v28; - _vm->_globals.Bob[v18].field40 = 0; + _vm->_globals.Bob[v18].oldY = 0; if (_vm->_globals.Bob[v18].field0 == 10 && !_vm->_globals.Bob[v18].field16 && _vm->_globals.Bob[v18].field1C == 1) { CALCUL_BOB(v28); - int v = _vm->_globals.Bob[v18].field44 + _vm->_globals.Bob[v18].field40; - v19 = _vm->_globals.Bob[v18].field46 + v; + int v = _vm->_globals.Bob[v18].oldHeight + _vm->_globals.Bob[v18].oldY; + v19 = _vm->_globals.Bob[v18].oldX2 + v; if (v19 > 450) v19 = 600; - if (_vm->_globals.Bob[v18].field3C == 1) - AvantTri(TRI_BOB, v28, v19); + + if (_vm->_globals.Bob[v18].isActive) + AvantTri(TRI_BOB, v28, v19); } } while (v28 != 35); } @@ -3963,14 +3963,14 @@ int ObjectsManager::MZONE() { v3 = v2; v15 = v3; if (_vm->_globals.Bob[v3].field0) { - if (_vm->_globals.Bob[v3].fieldC != 250) { + if (_vm->_globals.Bob[v3].frameIndex != 250) { if (!_vm->_globals.Bob[v3].field16) { - v4 = _vm->_globals.Bob[v3].field3E; + v4 = _vm->_globals.Bob[v3].oldX; if (xp > v4) { - if (xp < _vm->_globals.Bob[v3].field42 + v4) { - v5 = _vm->_globals.Bob[v3].field40; + if (xp < _vm->_globals.Bob[v3].oldWidth + v4) { + v5 = _vm->_globals.Bob[v3].oldY; if (yp > v5) { - if (yp < _vm->_globals.Bob[v3].field44 + v5) { + if (yp < _vm->_globals.Bob[v3].oldHeight + v5) { v6 = v1; if (_vm->_globals.ZONEP[v1].field4 == -1) { _vm->_globals.ZONEP[v6].destX = 0; @@ -3978,8 +3978,8 @@ int ObjectsManager::MZONE() { } if (!_vm->_globals.ZONEP[v6].destX) { if (!_vm->_globals.ZONEP[v1].destY) { - _vm->_globals.ZONEP[v6].destX = _vm->_globals.Bob[v15].field42 + _vm->_globals.Bob[v15].field3E; - _vm->_globals.ZONEP[v1].destY = _vm->_globals.Bob[v15].field44 + _vm->_globals.Bob[v15].field40 + 6; + _vm->_globals.ZONEP[v6].destX = _vm->_globals.Bob[v15].oldWidth + _vm->_globals.Bob[v15].oldX; + _vm->_globals.ZONEP[v1].destY = _vm->_globals.Bob[v15].oldHeight + _vm->_globals.Bob[v15].oldY + 6; _vm->_globals.ZONEP[v1].field4 = -1; } } @@ -4650,11 +4650,8 @@ void ObjectsManager::OPTI_ONE(int idx, int a2, int a3, int a4) { if (!a4) BOBANIM_OFF(idx); if (a4 == 4) { - _vm->_graphicsManager.AFFICHE_SPEED( - _vm->_globals.Bob[idx].field4, - _vm->_globals.Bob[idx].field3E, - _vm->_globals.Bob[idx].field40, - _vm->_globals.Bob[idx].fieldC); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.Bob[idx].spriteData, + _vm->_globals.Bob[idx].oldX, _vm->_globals.Bob[idx].oldY, _vm->_globals.Bob[idx].frameIndex); BOBANIM_OFF(idx); _vm->_eventsManager.VBL(); } @@ -4677,7 +4674,7 @@ void ObjectsManager::BOBANIM_ON(int idx) { if (_vm->_globals.Bob[idx].field16) { _vm->_globals.Bob[idx].field16 = 0; _vm->_globals.Bob[idx].field10 = 5; - _vm->_globals.Bob[idx].fieldC = 250; + _vm->_globals.Bob[idx].frameIndex = 250; _vm->_globals.Bob[idx].field12 = 0; _vm->_globals.Bob[idx].field14 = 0; } @@ -4695,15 +4692,15 @@ void ObjectsManager::SET_BOBPOSI(int idx, int a2) { } int ObjectsManager::BOBX(int idx) { - return _vm->_globals.Bob[idx].field8; + return _vm->_globals.Bob[idx].xp; } int ObjectsManager::BOBY(int idx) { - return _vm->_globals.Bob[idx].fieldA; + return _vm->_globals.Bob[idx].yp; } int ObjectsManager::BOBA(int idx) { - return _vm->_globals.Bob[idx].fieldC; + return _vm->_globals.Bob[idx].frameIndex; } void ObjectsManager::INILINK(const Common::String &file) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f3b420a829..f8dbe848f8 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -743,17 +743,17 @@ void TalkManager::BOB_VISU_PARLE(int idx) { if (!v4) v4 = 1; if ((int16)READ_LE_UINT16(v5 + 24)) { - _vm->_globals.Bob[idx].field3A = 1; + _vm->_globals.Bob[idx].isSprite = true; _vm->_globals.Bob[idx].field36 = 0; _vm->_globals.Bob[idx].field38 = 0; - _vm->_globals.Bob[idx].field18 = _vm->_globals.Bqe_Anim[idx].data; + _vm->_globals.Bob[idx].animData = _vm->_globals.Bqe_Anim[idx].data; _vm->_globals.Bob[idx].field0 = 10; v5 = PERSOSPR; - _vm->_globals.Bob[idx].field4 = PERSOSPR; + _vm->_globals.Bob[idx].spriteData = PERSOSPR; _vm->_globals.Bob[idx].field1E = v4; _vm->_globals.Bob[idx].field20 = -1; _vm->_globals.Bob[idx].field22 = 0; - _vm->_globals.Bob[idx].field24 = 0; + _vm->_globals.Bob[idx].offsetY = 0; } } } -- cgit v1.2.3 From 5445866fb52a963a3ac52ab629e802f119f18649 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 12:43:14 +1100 Subject: HOPKINS: Bugfix to properly initialise Cache array. This corrects 'foreground' sprite drawing that draws over the player. --- engines/hopkins/objects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a09d4c5d70..62432c8e2f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4798,7 +4798,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.Cache[v11].field4 = v10; _vm->_globals.Cache[v11].field12 = 1; - if (_vm->_globals.CACHE_BANQUE[1]) { + if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[v40].fieldA = 0; } else { v12 = v8; @@ -4813,6 +4813,7 @@ void ObjectsManager::INILINK(const Common::String &file) { if (!_vm->_globals.Cache[v40].field0 && !_vm->_globals.Cache[v40].field4 && !_vm->_globals.Cache[v40].field2) _vm->_globals.Cache[v40].fieldA = 0; + v36 += 5; ++v40; } while (v40 <= 21); -- cgit v1.2.3 From ea2d59fa0712c112636b1d5e20fd8fba1a433cb2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Oct 2012 13:32:25 +1100 Subject: HOPKINS: Fix pathfinding when the SMOOTH_MOVE method is used. --- engines/hopkins/lines.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 7f0d6ad109..2ba89962d7 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3041,9 +3041,9 @@ LABEL_211: while (colision2_ligne(v114, v58, &v139, &v138, 0, TOTAL_LIGNES) != 1) { v59 = v117; v60 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v59, v114); - WRITE_LE_UINT16(v60 + 2 * v59 + 2, v58); - WRITE_LE_UINT16(v60 + 2 * v59 + 4, 1); + v60[v59] = v114; + v60[v59 + 1] = v58; + v60[v59 + 2] = 1; v117 += 3; --v58; if (a4 >= v58) @@ -3055,9 +3055,10 @@ LABEL_214: LABEL_249: v76 = v117; v77 = _vm->_globals.essai2; - WRITE_LE_UINT16(_vm->_globals.essai2 + 2 * v76, (uint16)-1); - WRITE_LE_UINT16(v77 + 2 * v76 + 2, (uint16)-1); - WRITE_LE_UINT16(v77 + 2 * v76 + 4, (uint16)-1); + v77[v76] = -1; + v77[v76 + 1] = -1; + v77[v76 + 2] = -1; + if (v136 != 1) { if (a6 > v144) { if (_vm->_globals.essai0[0] != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { @@ -3088,6 +3089,7 @@ LABEL_323: v131 = 0; v121 = 0; do { + assert(137 <= 32000); v81 = v137; _vm->_globals.super_parcours[v81] = v80[v121]; _vm->_globals.super_parcours[v81 + 1] = v80[v121 + 1]; @@ -3110,6 +3112,7 @@ LABEL_301: v132 = 0; v122 = 0; do { + assert(v137 <= 32000); v83 = v137; _vm->_globals.super_parcours[v83] = v82[v122]; _vm->_globals.super_parcours[v83 + 1] = v82[v122 + 1]; @@ -3140,6 +3143,7 @@ LABEL_312: v123 = 0; v84 = _vm->_globals.essai1; do { + assert(137 <= 32000); v85 = v137; _vm->_globals.super_parcours[v85] = v84[v123]; _vm->_globals.super_parcours[v85 + 1] = v84[v123 + 1]; @@ -3159,6 +3163,7 @@ LABEL_312: v134 = 0; v124 = 0; do { + assert(137 <= 32000); v87 = v137; _vm->_globals.super_parcours[v87] = v86[v124]; _vm->_globals.super_parcours[v87 + 1] = v86[v124 + 1]; @@ -3178,6 +3183,7 @@ LABEL_312: v125 = 0; v88 = _vm->_globals.essai0; do { + assert(137 <= 32000); v89 = v137; _vm->_globals.super_parcours[v89] = v88[v125]; _vm->_globals.super_parcours[v89 + 1] = v88[v125 + 1]; -- cgit v1.2.3 From 9b00ee5c8c8683640e31738663224386e6e5ae78 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Oct 2012 19:14:10 +1100 Subject: HOPKINS: Corrected the size of the VBob array --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index d6a2f328d9..a25f962949 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -84,7 +84,7 @@ Globals::Globals() { Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(Liste2Item), 0); for (int i = 0; i < 30; ++i) Common::fill((byte *)&BL_ANIM[i], (byte *)&BL_ANIM[i] + sizeof(BlAnimItem), 0); - for (int i = 0; i < 35; ++i) + for (int i = 0; i < 30; ++i) Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0); for (int i = 0; i < 300; ++i) Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 293336fc09..f2b5d263be 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -301,7 +301,7 @@ public: ListeItem Liste[6]; Liste2Item Liste2[35]; BlAnimItem BL_ANIM[30]; - VBobItem VBob[35]; + VBobItem VBob[30]; ObjetWItem ObjetW[300]; BlocItem BLOC[250]; CacheItem Cache[25]; -- cgit v1.2.3 From 1651bb07d9d3dedb643eb2ac2cb4070980f33ba5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Oct 2012 20:19:21 +1100 Subject: HOPKINS: Move Save/Load dialog code from menu.cpp to dialogs.cpp --- engines/hopkins/dialogs.cpp | 270 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/dialogs.h | 4 + engines/hopkins/events.cpp | 2 + engines/hopkins/events.h | 1 + engines/hopkins/menu.cpp | 264 +----------------------------------------- engines/hopkins/menu.h | 4 - engines/hopkins/saveload.cpp | 69 +++++++++++ engines/hopkins/saveload.h | 17 +++ 8 files changed, 362 insertions(+), 269 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index a77c919c8f..f979caa4b6 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -460,9 +460,10 @@ LABEL_7: if (_vm->_eventsManager.btsouris == 1) showOptionsDialog(); if (_vm->_eventsManager.btsouris == 3) - _vm->_menuManager.CHARGE_PARTIE(); + _vm->_dialogsManager.CHARGE_PARTIE(); if (_vm->_eventsManager.btsouris == 2) - _vm->_menuManager.SAUVE_PARTIE(); + _vm->_dialogsManager.SAUVE_PARTIE(); + _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(4); _vm->_objectsManager.old_cady = 0; @@ -534,4 +535,269 @@ void DialogsManager::TEST_INVENT() { } } +// Load Game +void DialogsManager::CHARGE_PARTIE() { + int v1; + char v3; + byte *v4; + int v5; + Common::String s; + Common::String v8; + char v9; + char v10; + char v11; + Common::String v12; + char v13; + char v14; + char v15; + char v16; + char v17; + Common::File f; + + _vm->_eventsManager.VBL(); + LOAD_SAUVE(2); + do { + do { + v1 = CHERCHE_PARTIE(); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!v1); + _vm->_objectsManager.SL_FLAG = 0; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); + _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + if (v1 != 7) { + s = Common::String::format("%d", v1); + v8 = 80; + v9 = 65; + v10 = 82; + v11 = 84; + v12 = s; + v13 = 46; + v14 = 68; + v15 = 65; + v16 = 84; + v17 = 0; + _vm->_fileManager.CONSTRUIT_LINUX(v8); + if (f.open(_vm->_globals.NFICHIER)) { + f.close(); + + v3 = _vm->_globals.SAUVEGARDE->data[svField10]; + _vm->_fileManager.CONSTRUIT_LINUX(v8); + _vm->_fileManager.bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); + + v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; + v5 = 0; + do { + _vm->_globals.INVENTAIRE[v5] = (int16)READ_LE_UINT16(v4 + 2 * v5); + ++v5; + } while (v5 <= 34); + + _vm->_globals.SAUVEGARDE->data[svField10] = v3; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; + _vm->_globals.SAUVEGARDE->data[svField6] = 0; + _vm->_globals.ECRAN = 0; + } + } + + _vm->_objectsManager.CHANGE_OBJET(14); +} + +// Save Game +void DialogsManager::SAUVE_PARTIE() { + byte *v1; + int slotNumber; + byte *invItemP; + int v4; + Common::String s; + Common::String v7; + char v12; + char v13; + char v14; + char v15; + char v16; + + _vm->_eventsManager.VBL(); + v1 = _vm->_globals.dos_malloc2(0x2DB4u); + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, + SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); + _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.Trans_bloc2(v1, _vm->_graphicsManager.TABLE_COUL, 11136); + LOAD_SAUVE(1); + do { + do { + slotNumber = CHERCHE_PARTIE(); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!slotNumber); + _vm->_objectsManager.SL_FLAG = 0; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + + if (slotNumber != 7) { + // Set the selected slot number + _vm->_globals.SAUVEGARDE->data[svField10] = slotNumber; + + // Set up the inventory + invItemP = &_vm->_globals.SAUVEGARDE->data[svField1300]; + v4 = 0; + do { + WRITE_LE_UINT16(invItemP + 2 * v4, _vm->_globals.INVENTAIRE[v4]); + ++v4; + } while (v4 <= 34); + + _vm->_fileManager.CONSTRUIT_LINUX(v7); +// SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); + v12 = 46; + v13 = 69; + v14 = 67; + v15 = 82; + v16 = 0; + _vm->_fileManager.CONSTRUIT_LINUX(v7); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); + } + _vm->_globals.dos_free2(v1); +} + + +// Load Save +void DialogsManager::LOAD_SAUVE(int a1) { + int v1; +// byte *v2; +// byte *v3; + Common::String s; + Common::File f; + + switch (_vm->_globals.FR) { + case 0: + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEAN.SPR"); + break; + case 1: + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEFR.SPR"); + break; + case 2: + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEES.SPR"); + break; + } + + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_fileManager.CONSTRUIT_SYSTEM("SAVE2.SPR"); + _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); + + if (_vm->_globals.FR) { + if (a1 == 1) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 525, 375, 1); + if (a1 == 2) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 515, 375, 2); + } else { + if (a1 == 1) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 535, 372, 1); + if (a1 == 2) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); + } + + v1 = 1; + do { + s = Common::String::format("ART%d.ECR", v1); + + _vm->_fileManager.CONSTRUIT_LINUX(s); +/* TODO: Get from save file manager as part of save files + if (f.exists(_vm->_globals.NFICHIER)) { + v2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v3 = v2; + if (v1 == 1) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v2, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); + if (v1 == 2) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); + if (v1 == 3) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); + if (v1 == 4) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); + if (v1 == 5) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); + if (v1 == 6) + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); + _vm->_globals.dos_free2(v3); + } +*/ + ++v1; + } while (v1 <= 6); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + _vm->_objectsManager.SL_FLAG = 1; + _vm->_objectsManager.SL_MODE = a1; + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; +} + +// Search Game +int DialogsManager::CHERCHE_PARTIE() { + int v0; + int v1; + int v2; + + v0 = 0; + v1 = _vm->_eventsManager.XMOUSE(); + v2 = _vm->_eventsManager.YMOUSE(); + _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; + if ((uint16)(v2 - 112) <= 0x56u) { + if (v1 > _vm->_eventsManager.start_x + 189 && v1 < _vm->_eventsManager.start_x + 318) + v0 = 1; + if ((uint16)(v2 - 112) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 2; + } + if ((uint16)(v2 - 203) <= 0x56u) { + if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) + v0 = 3; + if ((uint16)(v2 - 203) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 4; + } + if ((uint16)(v2 - 294) <= 0x56u) { + if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) + v0 = 5; + if ((uint16)(v2 - 294) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) + v0 = 6; + } + if ((uint16)(v2 - 388) <= 0x10u && v1 > _vm->_graphicsManager.ofscroll + 273 && v1 < _vm->_graphicsManager.ofscroll + 355) + v0 = 7; + if (v0 == 1) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 111; + } + if (v0 == 2) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 111; + } + if (v0 == 3) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 202; + } + if (v0 == 4) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 202; + } + if (v0 == 5) { + _vm->_objectsManager.SL_X = 189; + _vm->_objectsManager.SL_Y = 293; + } + if (v0 == 6) { + _vm->_objectsManager.SL_X = 322; + _vm->_objectsManager.SL_Y = 293; + } + if (v0 == 7 || !v0) { + _vm->_objectsManager.SL_X = 0; + _vm->_objectsManager.SL_Y = 0; + } + return v0; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index ddec3fb4a1..7e049bf717 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -56,6 +56,10 @@ public: void INVENT_ANIM(); void TEST_INVENT(); + void CHARGE_PARTIE(); + void SAUVE_PARTIE(); + void LOAD_SAUVE(int a1); + int CHERCHE_PARTIE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 9bcdeda735..0eb65c8f01 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -41,6 +41,7 @@ EventsManager::EventsManager() { souris_bb = 0; souris_b = 0; pointeur_souris = NULL; + _gameCounter = 0; lItCounter = 0; ESC_KEY = false; KEY_INVENT = false; @@ -204,6 +205,7 @@ void EventsManager::checkForNextFrameCounter() { while ((milli - _priorCounterTime) >= 10) { _priorCounterTime += 10; lItCounter += 3; + ++_gameCounter; } // Check for next game frame diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 3181b77d5f..8aa87e0cdc 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -54,6 +54,7 @@ public: int souris_bb; int souris_b; byte *pointeur_souris; + uint32 _gameCounter; uint32 lItCounter; uint32 _priorCounterTime; uint32 _priorFrameTime; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 1de66a103c..cfa9ed2c0f 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -189,7 +189,7 @@ int MenuManager::MENU() { _vm->_eventsManager.delay(200); _vm->_globals.SORTIE = -1; - CHARGE_PARTIE(); + _vm->_dialogsManager.CHARGE_PARTIE(); if (_vm->_globals.SORTIE != -1) { v6 = _vm->_globals.SORTIE; @@ -233,138 +233,6 @@ int MenuManager::MENU() { return v6; } -// Load Game -void MenuManager::CHARGE_PARTIE() { - int v1; - char v3; - byte *v4; - int v5; - Common::String s; - Common::String v8; - char v9; - char v10; - char v11; - Common::String v12; - char v13; - char v14; - char v15; - char v16; - char v17; - Common::File f; - - _vm->_eventsManager.VBL(); - LOAD_SAUVE(2); - do { - do { - v1 = CHERCHE_PARTIE(); - _vm->_eventsManager.VBL(); - } while (_vm->_eventsManager.BMOUSE() != 1); - } while (!v1); - _vm->_objectsManager.SL_FLAG = 0; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); - _vm->_objectsManager.BOBTOUS = 1; - _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); - _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; - if (v1 != 7) { - s = Common::String::format("%d", v1); - v8 = 80; - v9 = 65; - v10 = 82; - v11 = 84; - v12 = s; - v13 = 46; - v14 = 68; - v15 = 65; - v16 = 84; - v17 = 0; - _vm->_fileManager.CONSTRUIT_LINUX(v8); - if (f.open(_vm->_globals.NFICHIER)) { - f.close(); - - v3 = _vm->_globals.SAUVEGARDE->data[svField10]; - _vm->_fileManager.CONSTRUIT_LINUX(v8); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); - - v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; - v5 = 0; - do { - _vm->_globals.INVENTAIRE[v5] = (int16)READ_LE_UINT16(v4 + 2 * v5); - ++v5; - } while (v5 <= 34); - - _vm->_globals.SAUVEGARDE->data[svField10] = v3; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; - _vm->_globals.SAUVEGARDE->data[svField6] = 0; - _vm->_globals.ECRAN = 0; - } - } - - _vm->_objectsManager.CHANGE_OBJET(14); -} - -// Save Game -void MenuManager::SAUVE_PARTIE() { - byte *v1; - int v2; - byte *v3; - int v4; - Common::String s; - Common::String v7; - char v12; - char v13; - char v14; - char v15; - char v16; - - _vm->_eventsManager.VBL(); - v1 = _vm->_globals.dos_malloc2(0x2DB4u); - _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, - SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); - _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); - _vm->_graphicsManager.Trans_bloc2(v1, _vm->_graphicsManager.TABLE_COUL, 11136); - LOAD_SAUVE(1); - do { - do { - v2 = CHERCHE_PARTIE(); - _vm->_eventsManager.VBL(); - } while (_vm->_eventsManager.BMOUSE() != 1); - } while (!v2); - _vm->_objectsManager.SL_FLAG = 0; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); - _vm->_objectsManager.BOBTOUS = 1; - _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); - _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; - if (v2 != 7) { - s = Common::String::format("%d", v2); - v7 = Common::String::format("PART%c.DAT", s[0]); - - _vm->_globals.SAUVEGARDE->data[svField10] = v2; - v3 = &_vm->_globals.SAUVEGARDE->data[svField1300]; - v4 = 0; - do { - WRITE_LE_UINT16(v3 + 2 * v4, _vm->_globals.INVENTAIRE[v4]); - ++v4; - } while (v4 <= 34); - - _vm->_fileManager.CONSTRUIT_LINUX(v7); - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); - v12 = 46; - v13 = 69; - v14 = 67; - v15 = 82; - v16 = 0; - _vm->_fileManager.CONSTRUIT_LINUX(v7); - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); - } - _vm->_globals.dos_free2(v1); -} - void MenuManager::COMPUT_HOPKINS(int idx) { // This is a text mode display? warning("TODO: COMPUT_HOPKINS"); @@ -562,135 +430,5 @@ void MenuManager::COMPUT_HOPKINS(int idx) { */ } -// Load Save -void MenuManager::LOAD_SAUVE(int a1) { - int v1; -// byte *v2; -// byte *v3; - Common::String s; - Common::File f; - - switch (_vm->_globals.FR) { - case 0: - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEAN.SPR"); - break; - case 1: - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEFR.SPR"); - break; - case 2: - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEES.SPR"); - break; - } - - _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVE2.SPR"); - _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); - - if (_vm->_globals.FR) { - if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 525, 375, 1); - if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 515, 375, 2); - } else { - if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 535, 372, 1); - if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); - } - - v1 = 1; - do { - s = Common::String::format("ART%d.ECR", v1); - - _vm->_fileManager.CONSTRUIT_LINUX(s); -/* TODO: Get from save file manager as part of save files - if (f.exists(_vm->_globals.NFICHIER)) { - v2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v3 = v2; - if (v1 == 1) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v2, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); - if (v1 == 2) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); - if (v1 == 3) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); - if (v1 == 4) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); - if (v1 == 5) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); - if (v1 == 6) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); - _vm->_globals.dos_free2(v3); - } -*/ - ++v1; - } while (v1 <= 6); - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); - _vm->_objectsManager.SL_FLAG = 1; - _vm->_objectsManager.SL_MODE = a1; - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; -} - -// Search Game -int MenuManager::CHERCHE_PARTIE() { - int v0; - int v1; - int v2; - - v0 = 0; - v1 = _vm->_eventsManager.XMOUSE(); - v2 = _vm->_eventsManager.YMOUSE(); - _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; - if ((uint16)(v2 - 112) <= 0x56u) { - if (v1 > _vm->_eventsManager.start_x + 189 && v1 < _vm->_eventsManager.start_x + 318) - v0 = 1; - if ((uint16)(v2 - 112) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) - v0 = 2; - } - if ((uint16)(v2 - 203) <= 0x56u) { - if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) - v0 = 3; - if ((uint16)(v2 - 203) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) - v0 = 4; - } - if ((uint16)(v2 - 294) <= 0x56u) { - if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) - v0 = 5; - if ((uint16)(v2 - 294) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) - v0 = 6; - } - if ((uint16)(v2 - 388) <= 0x10u && v1 > _vm->_graphicsManager.ofscroll + 273 && v1 < _vm->_graphicsManager.ofscroll + 355) - v0 = 7; - if (v0 == 1) { - _vm->_objectsManager.SL_X = 189; - _vm->_objectsManager.SL_Y = 111; - } - if (v0 == 2) { - _vm->_objectsManager.SL_X = 322; - _vm->_objectsManager.SL_Y = 111; - } - if (v0 == 3) { - _vm->_objectsManager.SL_X = 189; - _vm->_objectsManager.SL_Y = 202; - } - if (v0 == 4) { - _vm->_objectsManager.SL_X = 322; - _vm->_objectsManager.SL_Y = 202; - } - if (v0 == 5) { - _vm->_objectsManager.SL_X = 189; - _vm->_objectsManager.SL_Y = 293; - } - if (v0 == 6) { - _vm->_objectsManager.SL_X = 322; - _vm->_objectsManager.SL_Y = 293; - } - if (v0 == 7 || !v0) { - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; - } - return v0; -} } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 8b2812b476..58788fca46 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -40,11 +40,7 @@ public: void setParent(HopkinsEngine *vm); int MENU(); - void CHARGE_PARTIE(); - void SAUVE_PARTIE(); void COMPUT_HOPKINS(int a1); - void LOAD_SAUVE(int a1); - int CHERCHE_PARTIE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 1c29eca36f..364a02ae67 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -22,12 +22,20 @@ #include "common/system.h" #include "common/savefile.h" +#include "graphics/surface.h" +#include "graphics/scaler.h" +#include "graphics/thumbnail.h" #include "hopkins/saveload.h" #include "hopkins/files.h" #include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" namespace Hopkins { +const char *SAVEGAME_STR = "HOPKINS"; +#define SAVEGAME_STR_SIZE 13 + void SaveLoadManager::setParent(HopkinsEngine *vm) { _vm = vm; } @@ -68,4 +76,65 @@ void SaveLoadManager::bload(const Common::String &file, byte *buf) { delete f; } +bool SaveLoadManager::readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header) { + char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; + header.thumbnail = NULL; + + // Validate the header Id + in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); + if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) + return false; + + header.version = in->readByte(); + if (header.version > HOPKINS_SAVEGAME_VERSION) + return false; + + // Read in the string + header.saveName.clear(); + char ch; + while ((ch = (char)in->readByte()) != '\0') header.saveName += ch; + + // Get the thumbnail + header.thumbnail = Graphics::loadThumbnail(*in); + if (!header.thumbnail) + return false; + + // Read in save date/time + header.saveYear = in->readSint16LE(); + header.saveMonth = in->readSint16LE(); + header.saveDay = in->readSint16LE(); + header.saveHour = in->readSint16LE(); + header.saveMinutes = in->readSint16LE(); + header.totalFrames = in->readUint32LE(); + + return true; +} + +void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header) { + // Write out a savegame header + out->write(SAVEGAME_STR, SAVEGAME_STR_SIZE + 1); + + out->writeByte(HOPKINS_SAVEGAME_VERSION); + + // Write savegame name + out->write(header.saveName.c_str(), header.saveName.size() + 1); + + // Create a thumbnail and save it + Graphics::Surface *thumb = new Graphics::Surface(); +// ::createThumbnail(thumb, _vm->_graphicsManager.VESA_SCREEN, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); + Graphics::saveThumbnail(*out, *thumb); + thumb->free(); + delete thumb; + + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + out->writeSint16LE(td.tm_year + 1900); + out->writeSint16LE(td.tm_mon + 1); + out->writeSint16LE(td.tm_mday); + out->writeSint16LE(td.tm_hour); + out->writeSint16LE(td.tm_min); + out->writeUint32LE(_vm->_eventsManager._gameCounter); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 4777f33148..a1aa71532a 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -24,12 +24,24 @@ #define HOPKINS_SAVELOAD_H #include "common/scummsys.h" +#include "common/savefile.h" #include "common/str.h" namespace Hopkins { class HopkinsEngine; +#define HOPKINS_SAVEGAME_VERSION 1 + +struct hopkinsSavegameHeader { + uint8 version; + Common::String saveName; + Graphics::Surface *thumbnail; + int saveYear, saveMonth, saveDay; + int saveHour, saveMinutes; + int totalFrames; +}; + class SaveLoadManager { private: HopkinsEngine *_vm; @@ -40,6 +52,11 @@ public: bool bsave(const Common::String &file, const void *buf, size_t n); bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); void bload(const Common::String &file, byte *buf); + + static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header); + void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header); + Common::Error save(int slot, const Common::String &saveName); + Common::Error restore(int slot); }; } // End of namespace Hopkins -- cgit v1.2.3 From ec0a33b9493e88a759870c9c998b1e32660dcfbb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Oct 2012 22:16:54 +1100 Subject: HOPKINS: Beginnings of save/load implementation --- engines/hopkins/dialogs.cpp | 189 +++++++++++++++++++------------------------ engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 4 + engines/hopkins/hopkins.h | 1 + engines/hopkins/saveload.cpp | 98 +++++++++++++++++++++- engines/hopkins/saveload.h | 7 ++ 6 files changed, 193 insertions(+), 108 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index f979caa4b6..503c35832d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -538,9 +538,7 @@ void DialogsManager::TEST_INVENT() { // Load Game void DialogsManager::CHARGE_PARTIE() { int v1; - char v3; - byte *v4; - int v5; + char slotNumber; Common::String s; Common::String v8; char v9; @@ -586,18 +584,15 @@ void DialogsManager::CHARGE_PARTIE() { if (f.open(_vm->_globals.NFICHIER)) { f.close(); - v3 = _vm->_globals.SAUVEGARDE->data[svField10]; + slotNumber = _vm->_globals.SAUVEGARDE->data[svField10]; _vm->_fileManager.CONSTRUIT_LINUX(v8); _vm->_fileManager.bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); - v4 = &_vm->_globals.SAUVEGARDE->data[svField1300]; - v5 = 0; - do { - _vm->_globals.INVENTAIRE[v5] = (int16)READ_LE_UINT16(v4 + 2 * v5); - ++v5; - } while (v5 <= 34); + // Load the inventory + for (int i = 0; i < 35; ++i) + _vm->_globals.INVENTAIRE[i] = _vm->_globals.SAUVEGARDE->inventory[i]; - _vm->_globals.SAUVEGARDE->data[svField10] = v3; + _vm->_globals.SAUVEGARDE->data[svField10] = slotNumber; _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; _vm->_globals.SAUVEGARDE->data[svField6] = 0; _vm->_globals.ECRAN = 0; @@ -609,31 +604,19 @@ void DialogsManager::CHARGE_PARTIE() { // Save Game void DialogsManager::SAUVE_PARTIE() { - byte *v1; int slotNumber; - byte *invItemP; - int v4; - Common::String s; - Common::String v7; - char v12; - char v13; - char v14; - char v15; - char v16; + Common::String saveName; _vm->_eventsManager.VBL(); - v1 = _vm->_globals.dos_malloc2(0x2DB4u); - _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, v1, _vm->_eventsManager.start_x, 20, - SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); - _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); - _vm->_graphicsManager.Trans_bloc2(v1, _vm->_graphicsManager.TABLE_COUL, 11136); + LOAD_SAUVE(1); do { do { slotNumber = CHERCHE_PARTIE(); _vm->_eventsManager.VBL(); - } while (_vm->_eventsManager.BMOUSE() != 1); - } while (!slotNumber); + } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); + } while (!_vm->shouldQuit() && !slotNumber); + _vm->_objectsManager.SL_FLAG = 0; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); @@ -648,34 +631,24 @@ void DialogsManager::SAUVE_PARTIE() { _vm->_globals.SAUVEGARDE->data[svField10] = slotNumber; // Set up the inventory - invItemP = &_vm->_globals.SAUVEGARDE->data[svField1300]; - v4 = 0; - do { - WRITE_LE_UINT16(invItemP + 2 * v4, _vm->_globals.INVENTAIRE[v4]); - ++v4; - } while (v4 <= 34); - - _vm->_fileManager.CONSTRUIT_LINUX(v7); -// SAUVE_FICHIER(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0], 0x7D0u); - v12 = 46; - v13 = 69; - v14 = 67; - v15 = 82; - v16 = 0; - _vm->_fileManager.CONSTRUIT_LINUX(v7); - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, v1, 0x2B80u); + for (int i = 0; i < 35; ++i) + _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals.INVENTAIRE[i]; + + // Since the original GUI doesn't support save names, use a default name + saveName = Common::String::format("Save #%d", slotNumber); + + // Save the game + _vm->_saveLoadManager.save(slotNumber, saveName); } - _vm->_globals.dos_free2(v1); } // Load Save void DialogsManager::LOAD_SAUVE(int a1) { - int v1; -// byte *v2; -// byte *v3; - Common::String s; - Common::File f; + int slotNumber; + hopkinsSavegameHeader header; + Common::InSaveFile *in; + byte *thumb; switch (_vm->_globals.FR) { case 0: @@ -706,32 +679,35 @@ void DialogsManager::LOAD_SAUVE(int a1) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); } - v1 = 1; - do { - s = Common::String::format("ART%d.ECR", v1); - - _vm->_fileManager.CONSTRUIT_LINUX(s); -/* TODO: Get from save file manager as part of save files - if (f.exists(_vm->_globals.NFICHIER)) { - v2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v3 = v2; - if (v1 == 1) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v2, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); - if (v1 == 2) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); - if (v1 == 3) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); - if (v1 == 4) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); - if (v1 == 5) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); - if (v1 == 6) - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v3, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); - _vm->_globals.dos_free2(v3); + for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { + if (_vm->_saveLoadManager.readSavegameHeader(slotNumber, header)) { + thumb = (byte *)header.thumbnail->pixels; + + switch (slotNumber) { + case 1: + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); + break; + case 2: + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); + break; + case 3: + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); + break; + case 4: + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); + break; + case 5: + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); + break; + case 6: + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); + break; + } + + delete header.thumbnail; } -*/ - ++v1; - } while (v1 <= 6); + } + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); _vm->_objectsManager.SL_FLAG = 1; _vm->_objectsManager.SL_MODE = a1; @@ -741,63 +717,64 @@ void DialogsManager::LOAD_SAUVE(int a1) { // Search Game int DialogsManager::CHERCHE_PARTIE() { - int v0; - int v1; - int v2; + int slotNumber; + int xp; + int yp; + + slotNumber = 0; + xp = _vm->_eventsManager.XMOUSE(); + yp = _vm->_eventsManager.YMOUSE(); - v0 = 0; - v1 = _vm->_eventsManager.XMOUSE(); - v2 = _vm->_eventsManager.YMOUSE(); _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; - if ((uint16)(v2 - 112) <= 0x56u) { - if (v1 > _vm->_eventsManager.start_x + 189 && v1 < _vm->_eventsManager.start_x + 318) - v0 = 1; - if ((uint16)(v2 - 112) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) - v0 = 2; + if ((uint16)(yp - 112) <= 0x56u) { + if (xp > _vm->_eventsManager.start_x + 189 && xp < _vm->_eventsManager.start_x + 318) + slotNumber = 1; + if ((uint16)(yp - 112) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + slotNumber = 2; } - if ((uint16)(v2 - 203) <= 0x56u) { - if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) - v0 = 3; - if ((uint16)(v2 - 203) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) - v0 = 4; + if ((uint16)(yp - 203) <= 0x56u) { + if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) + slotNumber = 3; + if ((uint16)(yp - 203) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + slotNumber = 4; } - if ((uint16)(v2 - 294) <= 0x56u) { - if (v1 > _vm->_graphicsManager.ofscroll + 189 && v1 < _vm->_graphicsManager.ofscroll + 318) - v0 = 5; - if ((uint16)(v2 - 294) <= 0x56u && v1 > _vm->_graphicsManager.ofscroll + 322 && v1 < _vm->_graphicsManager.ofscroll + 452) - v0 = 6; + if ((uint16)(yp - 294) <= 0x56u) { + if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) + slotNumber = 5; + if ((uint16)(yp - 294) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + slotNumber = 6; } - if ((uint16)(v2 - 388) <= 0x10u && v1 > _vm->_graphicsManager.ofscroll + 273 && v1 < _vm->_graphicsManager.ofscroll + 355) - v0 = 7; - if (v0 == 1) { + if ((uint16)(yp - 388) <= 0x10u && xp > _vm->_graphicsManager.ofscroll + 273 && xp < _vm->_graphicsManager.ofscroll + 355) + slotNumber = 7; + if (slotNumber == 1) { _vm->_objectsManager.SL_X = 189; _vm->_objectsManager.SL_Y = 111; } - if (v0 == 2) { + if (slotNumber == 2) { _vm->_objectsManager.SL_X = 322; _vm->_objectsManager.SL_Y = 111; } - if (v0 == 3) { + if (slotNumber == 3) { _vm->_objectsManager.SL_X = 189; _vm->_objectsManager.SL_Y = 202; } - if (v0 == 4) { + if (slotNumber == 4) { _vm->_objectsManager.SL_X = 322; _vm->_objectsManager.SL_Y = 202; } - if (v0 == 5) { + if (slotNumber == 5) { _vm->_objectsManager.SL_X = 189; _vm->_objectsManager.SL_Y = 293; } - if (v0 == 6) { + if (slotNumber == 6) { _vm->_objectsManager.SL_X = 322; _vm->_objectsManager.SL_Y = 293; } - if (v0 == 7 || !v0) { + if (slotNumber == 7 || !slotNumber) { _vm->_objectsManager.SL_X = 0; _vm->_objectsManager.SL_Y = 0; } - return v0; + return slotNumber; } } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f2b5d263be..5bfbd49958 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -272,7 +272,6 @@ enum SauvegardeOffset { , svField357 = 357 , svField399 = 399 , svField401 = 401 - , svField1300 = 1300 }; // TODO: Sauvegrade1 fields should really be mapped into data array @@ -281,6 +280,7 @@ struct Sauvegarde { Sauvegarde1 field360; Sauvegarde1 field370; Sauvegarde1 field380; + int16 inventory[35]; // Originally at offset 1300 of data array }; class HopkinsEngine; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 97271313f6..dbdb067950 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -956,4 +956,8 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } +Common::String HopkinsEngine::generateSaveName(int slot) { + return Common::String::format("%s.%03d", _targetName.c_str(), slot); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 6a0eb2e5cd..8b601dc356 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -124,6 +124,7 @@ public: bool shouldQuit() const; int getRandomNumber(int maxNumber); + Common::String generateSaveName(int slotNumber); /** * Run the introduction sequence diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 364a02ae67..427e2d9fce 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -121,7 +121,7 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); -// ::createThumbnail(thumb, _vm->_graphicsManager.VESA_SCREEN, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); + createThumbnail(thumb); Graphics::saveThumbnail(*out, *thumb); thumb->free(); delete thumb; @@ -137,4 +137,100 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg out->writeUint32LE(_vm->_eventsManager._gameCounter); } +Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { + // Try and create the save file + Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( + _vm->generateSaveName(slot)); + if (!saveFile) + return Common::kCreatingFileFailed; + + // Set up the serializer + Common::Serializer serializer(NULL, saveFile); + + // Write out the savegame header + hopkinsSavegameHeader header; + header.saveName = saveName; + header.version = HOPKINS_SAVEGAME_VERSION; + writeSavegameHeader(saveFile, header); + + // Write out the savegame data + syncSavegameData(serializer); + + // Save file complete + saveFile->finalize(); + delete saveFile; + + return Common::kNoError; +} + +Common::Error SaveLoadManager::restore(int slot) { + // Try and open the save file for reading + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + _vm->generateSaveName(slot)); + if (!saveFile) + return Common::kReadingFailed; + + // Set up the serializer + Common::Serializer serializer(saveFile, NULL); + + // Read in the savegame header + hopkinsSavegameHeader header; + readSavegameHeader(saveFile, header); + if (header.thumbnail) + header.thumbnail->free(); + delete header.thumbnail; + + // Read in the savegame data + syncSavegameData(serializer); + + // Loading save file complete + delete saveFile; + + return Common::kNoError; +} + +bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header) { + // Try and open the save file for reading + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + g_vm->generateSaveName(slot)); + if (!saveFile) + return false; + + bool result = readSavegameHeader(saveFile, header); + delete saveFile; + return result; +} + +#define REDUCE_AMOUNT 80 + +void SaveLoadManager::createThumbnail(Graphics::Surface *s) { + int w = _vm->_graphicsManager.Reel_Reduc(SCREEN_WIDTH, REDUCE_AMOUNT); + int h = _vm->_graphicsManager.Reel_Reduc(SCREEN_HEIGHT - 40, REDUCE_AMOUNT); + + s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)s->pixels, + _vm->_eventsManager.start_x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); + _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.Trans_bloc2((byte *)s->pixels, _vm->_graphicsManager.TABLE_COUL, 11136); +} + +void SaveLoadManager::syncSavegameData(Common::Serializer &s) { + s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 0x802); + syncSauvegarde1(s, _vm->_globals.SAUVEGARDE->field360); + syncSauvegarde1(s, _vm->_globals.SAUVEGARDE->field370); + syncSauvegarde1(s, _vm->_globals.SAUVEGARDE->field380); + + for (int i = 0; i < 35; ++i) + s.syncAsSint16LE(_vm->_globals.SAUVEGARDE->inventory[i]); +} + +void SaveLoadManager::syncSauvegarde1(Common::Serializer &s, Sauvegarde1 &item) { + s.syncAsSint16LE(item.field0); + s.syncAsSint16LE(item.field1); + s.syncAsSint16LE(item.field2); + s.syncAsSint16LE(item.field3); + s.syncAsSint16LE(item.field4); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index a1aa71532a..647c64d2e7 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -25,7 +25,9 @@ #include "common/scummsys.h" #include "common/savefile.h" +#include "common/serializer.h" #include "common/str.h" +#include "hopkins/globals.h" namespace Hopkins { @@ -45,6 +47,10 @@ struct hopkinsSavegameHeader { class SaveLoadManager { private: HopkinsEngine *_vm; + + void createThumbnail(Graphics::Surface *s); + void syncSavegameData(Common::Serializer &s); + void syncSauvegarde1(Common::Serializer &s, Sauvegarde1 &item); public: void setParent(HopkinsEngine *vm); @@ -55,6 +61,7 @@ public: static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header); void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header); + static bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); Common::Error save(int slot, const Common::String &saveName); Common::Error restore(int slot); }; -- cgit v1.2.3 From 46b44b923bca221fbd7f95d8c55c34d658fa31d1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 27 Oct 2012 19:08:53 +0200 Subject: HOPKINS: Use platform detection in order to properly initialize the mouse cursor Also fix mass-renaming error in header --- engines/hopkins/detection.cpp | 4 ++++ engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/hopkins.cpp | 11 +++++++---- engines/hopkins/hopkins.h | 1 + engines/hopkins/menu.cpp | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index ffbf243122..0be4337862 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -47,6 +47,10 @@ Common::Language HopkinsEngine::getLanguage() const { return _gameDescription->desc.language; } +Common::Platform HopkinsEngine::getPlatform() const { + return _gameDescription->desc.platform; +} + bool HopkinsEngine::getIsDemo() const { return _gameDescription->desc.flags & ADGF_DEMO; } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 503c35832d..feeb8843d8 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the _globals.FRee Software - * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dbdb067950..6143219283 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the _globals.FRee Software - * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -514,8 +514,11 @@ void HopkinsEngine::INIT_SYSTEM() { // Set graphics mode _graphicsManager.SET_MODE(640, 480); - _eventsManager.mouse_linux = true; - + if (getPlatform() == Common::kPlatformLinux) + _eventsManager.mouse_linux = true; + else + _eventsManager.mouse_linux = false; + switch (_globals.FR) { case 0: if (!_eventsManager.mouse_linux) @@ -524,7 +527,7 @@ void HopkinsEngine::INIT_SYSTEM() { _fileManager.CONSTRUIT_SYSTEM("LSOUAN.SPR"); break; case 1: - _fileManager.CONSTRUIT_SYSTEM("LSOU_globals.FR.SPR"); + _fileManager.CONSTRUIT_SYSTEM("LSOUFR.SPR"); break; case 2: _fileManager.CONSTRUIT_SYSTEM("SOUES.SPR"); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 8b601dc356..82bc3317b0 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -119,6 +119,7 @@ public: uint32 getFeatures() const; Common::Language getLanguage() const; + Common::Platform HopkinsEngine::getPlatform() const; uint16 getVersion() const; bool getIsDemo() const; bool shouldQuit() const; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index cfa9ed2c0f..8722b9e5d8 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the _globals.FRee Software - * Foundation, Inc., 51 _globals.FRanklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -- cgit v1.2.3 From 2888a3863c5a67b251bedef1f5984dabd2e7e044 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 27 Oct 2012 19:09:28 +0200 Subject: HOPKINS: Add detection for Win95 demo --- engines/hopkins/detection_tables.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 0781a530e8..9e1d329f39 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -70,6 +70,21 @@ static const HopkinsGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { + // Hopkins FBI Win95 Demo, provided by Strangerke + { + "hopkins", + 0, + { + {"Hopkins.exe", 0, "0c9ebfe371f4dcf84a49f333f04839a0", 376897}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_DEMO, + GUIO1(GUIO_NONE) + }, + }, { // Hopkins FBI Win95, provided by Strangerke { -- cgit v1.2.3 From 68495604f2241e941a1be5637bca30f4855708df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 10:43:08 +1100 Subject: HOPKINS: Fixed Reduc_Ecran method --- engines/hopkins/graphics.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index d603c63546..f9505d0372 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2485,7 +2485,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Reduc_Ecran_L = Asm_Reduc(width, Red); Reduc_Ecran_H = Asm_Reduc(height, Red); - for (int yCtr = 0; yCtr < Reduc_Ecran_H; ++yCtr, Red_y -= 100, srcP += nbrligne2) { + for (int yCtr = 0; yCtr < height; ++yCtr, srcP += nbrligne2) { Red_y += Red; if (Red_y < 100) { Red_x = 0; @@ -2500,6 +2500,8 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int ++lineSrcP; } } + } else { + Red_y -= 100; } } } -- cgit v1.2.3 From 13709b30088198b4192591c18004a586de0fd099 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 10:44:06 +1100 Subject: HOPKINS: Corrected issues in PARC_VOITURE --- engines/hopkins/objects.cpp | 235 +++++++++++++++++++------------------------- 1 file changed, 102 insertions(+), 133 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 62432c8e2f..f8e229290b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2719,7 +2719,7 @@ void ObjectsManager::PLAN_BETA() { if (_vm->_globals.SORTIE) v1 = 1; - } while (v1 != 1); + } while (!_vm->shouldQuit() && v1 != 1); if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_OUTW(); @@ -3312,10 +3312,10 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v4; int v5; - int v6; - int v7; + int v6; + int v7; int v8; - int v9; + int v9; int v10; int v11; int v12; @@ -3328,8 +3328,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v19; int v20; int v21; - int16 *result; - int v23; + int16 *result; + int v23; int v24; int v25; int v26; @@ -3337,45 +3337,39 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v28; int v29; int v30; - int v31; + int v31; int v32; - int16 *v33; + int16 *v33; int v34; int v35; int i; - int16 *v37; - int v38; + int16 *v37; int v39; int v40; int16 *v41; - int v42; int v43; int k; int16 *v45; - int v46; int v47; int v48; int v49; int16 *v50; - int v51; int v52; int v53; int16 *v54; - int v55; int v56; int v57; int16 *v58; - int v59; int v60; int v61; - int v62; - int v63; - int v64; - int v65; + int v62; + int v63; + int v64; + int v65; int v66; int v67; - int v68; - int v69; + int v68; + int v69; int j; int l; int v72; @@ -3383,21 +3377,9 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v74; int v75; int v76[10]; - int v77; - int v78; - int v79; - int v80; - int v81; - int v82; - int v83 = 0; - int v84 = 0; - int v85 = 0; - int v86 = 0; - int v87; - int v88 = 0; - int v89 = 0; - int v90 = 0; - int v91 = 0; + int v77[10]; + int v82[10]; + int v87[10]; v4 = a3; v5 = a4; @@ -3418,139 +3400,139 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v8 = 5; do { v62 = v8; - v9 = _vm->_linesManager.colision2_ligne(v75, v7, &v85, &v90, 0, DERLIGNE); + v9 = _vm->_linesManager.colision2_ligne(v75, v7, &v82[5], &v87[5], 0, DERLIGNE); v8 = v62; - if (v9 == 1 && *(&v87 + v62) <= DERLIGNE) + if (v9 == 1 && v87[v62] <= DERLIGNE) break; - *(&v82 + v62) = 0; - *(&v87 + v62) = -1; + v82[v62] = 0; + v87[v62] = -1; ++v6; ++v7; } while (_vm->_graphicsManager.max_y > v7); } - v80 = v6; + v77[5] = v6; v10 = 0; v11 = v74; if (_vm->_graphicsManager.min_y < v74) { v12 = 1; do { v63 = v12; - v13 = _vm->_linesManager.colision2_ligne(v75, v11, &v83, &v88, 0, DERLIGNE); + v13 = _vm->_linesManager.colision2_ligne(v75, v11, &v82[1], &v87[1], 0, DERLIGNE); v12 = v63; - if (v13 == 1 && *(&v87 + v63) <= DERLIGNE) + if (v13 == 1 && v87[v63] <= DERLIGNE) break; - *(&v82 + v63) = 0; - *(&v87 + v63) = -1; - if (v80 < v10) { - if (v90 != -1) + v82[v63] = 0; + v87[v63] = -1; + if (v77[5] < v10) { + if (v87[5] != -1) break; } ++v10; --v11; } while (_vm->_graphicsManager.min_y < v11); } - v78 = v10; + v77[1] = v10; v14 = 0; v15 = v75; if (_vm->_graphicsManager.max_x > v75) { v16 = 3; do { v64 = v16; - v17 = _vm->_linesManager.colision2_ligne(v15, v74, &v84, &v89, 0, DERLIGNE); + v17 = _vm->_linesManager.colision2_ligne(v15, v74, &v82[3], &v87[3], 0, DERLIGNE); v16 = v64; - if (v17 == 1 && *(&v87 + v64) <= DERLIGNE) + if (v17 == 1 && v87[v64] <= DERLIGNE) break; - *(&v82 + v64) = 0; - *(&v87 + v64) = -1; + v82[v64] = 0; + v87[v64] = -1; ++v14; - if (v78 < v14) { - if (v88 != -1) + if (v77[1] < v14) { + if (v87[1] != -1) break; } - if (v80 < v14 && v90 != -1) + if (v77[5] < v14 && v87[5] != -1) break; ++v15; } while (_vm->_graphicsManager.max_x > v15); } - v79 = v14; + v77[3] = v14; v18 = 0; v19 = v75; if (_vm->_graphicsManager.min_x < v75) { v20 = 7; do { v65 = v20; - v21 = _vm->_linesManager.colision2_ligne(v19, v74, &v86, &v91, 0, DERLIGNE); + v21 = _vm->_linesManager.colision2_ligne(v19, v74, &v82[7], &v87[7], 0, DERLIGNE); v20 = v65; - if (v21 == 1 && *(&v87 + v65) <= DERLIGNE) + if (v21 == 1 && v87[v65] <= DERLIGNE) break; - *(&v82 + v65) = 0; - *(&v87 + v65) = -1; + v82[v65] = 0; + v87[v65] = -1; ++v18; - if (v78 < v18) { - if (v88 != -1) + if (v77[1] < v18) { + if (v87[1] != -1) break; } - if (v80 < v18 && v90 != -1) + if (v77[5] < v18 && v87[5] != -1) break; - if (v79 < v18 && v89 != -1) + if (v77[3] < v18 && v87[3] != -1) break; --v19; } while (_vm->_graphicsManager.min_x < v19); } - v81 = v18; - if (v88 == -1) - v78 = 1300; - if (v89 == -1) - v79 = 1300; - if (v90 == -1) - v80 = 1300; - if (v91 == -1) - v81 = 1300; - if (v88 != -1 || v89 != -1 || v90 != -1 || v91 != -1) { + v77[7] = v18; + if (v87[1] == -1) + v77[1] = 1300; + if (v87[3] == -1) + v77[3] = 1300; + if (v87[5] == -1) + v77[5] = 1300; + if (v87[7] == -1) + v77[7] = 1300; + if (v87[1] != -1 || v87[3] != -1 || v87[5] != -1 || v87[7] != -1) { v23 = 0; - if (v90 != -1 && v78 >= v80 && v79 >= v80 && v81 >= v80) { - v73 = v90; - v72 = v85; + if (v87[5] != -1 && v77[1] >= v77[5] && v77[3] >= v77[5] && v77[7] >= v77[5]) { + v73 = v87[5]; + v72 = v82[5]; v23 = 1; } - if (v88 != -1 && !v23 && v80 >= v78 && v79 >= v78 && v81 >= v78) { - v73 = v88; - v72 = v83; + if (v87[1] != -1 && !v23 && v77[5] >= v77[1] && v77[3] >= v77[1] && v77[7] >= v77[1]) { + v73 = v87[1]; + v72 = v82[1]; v23 = 1; } - if (v89 != -1 && !v23 && v78 >= v79 && v80 >= v79 && v81 >= v79) { - v73 = v89; - v72 = v84; + if (v87[3] != -1 && !v23 && v77[1] >= v77[3] && v77[5] >= v77[3] && v77[7] >= v77[3]) { + v73 = v87[3]; + v72 = v82[3]; v23 = 1; } - if (v91 != -1 && !v23 && v80 >= v81 && v79 >= v81 && v78 >= v81) { - v73 = v91; - v72 = v86; + if (v87[7] != -1 && !v23 && v77[5] >= v77[7] && v77[3] >= v77[7] && v77[1] >= v77[7]) { + v73 = v87[7]; + v72 = v82[7]; } v24 = 0; do { v25 = v24; - *(&v87 + v25) = -1; - *(&v82 + v25) = 0; - *(&v77 + v25) = 1300; + v87[v25] = -1; + v82[v25] = 0; + v77[v25] = 1300; v76[v25] = 1300; ++v24; } while (v24 <= 8); - v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, DERLIGNE); + v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, DERLIGNE); if (v26 == 1) { - v69 = v88; - v68 = v83; + v69 = v87[1]; + v68 = v82[1]; } if (!v26) { - if (_vm->_linesManager.colision2_ligne(a1, a2, &v83, &v88, 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { + if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { v27 = 0; - while (1) { - v28 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (int16)v27); - v29 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (int16)v27 + 2); - v66 = (int16)READ_LE_UINT16(_vm->_globals.essai2 + 2 * (int16)v27 + 4); + for (;;) { + v28 = _vm->_globals.essai2[v27]; + v29 = _vm->_globals.essai2[v27 + 1]; + v66 = _vm->_globals.essai2[v27 + 2]; v27 = v27 + 4; v30 = v27; - v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v83, &v88, 0, DERLIGNE); + v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, DERLIGNE); v27 = v30; if (v31) break; @@ -3561,7 +3543,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { _vm->_globals.super_parcours[v32 + 3] = 0; v33 = _vm->_globals.essai0; - v33[v32] = v28; + _vm->_globals.essai0[v32] = v28; v33[v32 + 1] = v29; v33[v32 + 2] = v66; v33[v32 + 3] = 0; @@ -3569,8 +3551,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { if (v28 == -1) goto LABEL_90; } - v69 = v88; - v68 = v83; + v69 = v87[1]; + v68 = v82[1]; } else { v69 = 1; v68 = 1; @@ -3581,13 +3563,11 @@ LABEL_90: if (v69 < v73) { v34 = v68; v35 = v68; - for (i = _vm->_linesManager.Ligne[v69].field0; v35 < (i - 2); i = _vm->_linesManager.Ligne[v69].field0) { + for (i = _vm->_linesManager.Ligne[v69].field0; v35 < i - 2; i = _vm->_linesManager.Ligne[v69].field0) { v37 = _vm->_linesManager.Ligne[v69].lineData; - v38 = v37[2 * v35]; - int v37_2 = v37[2 * v35 + 1]; v39 = v67; - _vm->_globals.super_parcours[v39] = v38; - _vm->_globals.super_parcours[v39 + 1] = v37_2; + _vm->_globals.super_parcours[v39] = v37[2 * v35]; + _vm->_globals.super_parcours[v39 + 1] = v37[2 * v35 + 1]; _vm->_globals.super_parcours[v39 + 2] = _vm->_linesManager.Ligne[v69].field6; _vm->_globals.super_parcours[v39 + 3] = 0; v67 += 4; @@ -3603,21 +3583,18 @@ LABEL_90: v73, 0) == 1) { LABEL_88: - v69 = _vm->_linesManager.NV_LIGNEDEP; - v68 = _vm->_linesManager.NV_LIGNEOFS; - v67 = _vm->_linesManager.NV_POSI; - goto LABEL_90; + v69 = _vm->_linesManager.NV_LIGNEDEP; + v68 = _vm->_linesManager.NV_LIGNEOFS; + v67 = _vm->_linesManager.NV_POSI; + goto LABEL_90; } - v40 = 0; if (_vm->_linesManager.Ligne[j].field0 - 2 > 0) { do { v41 = _vm->_linesManager.Ligne[j].lineData; - v42 = v41[2 * v40]; - int v41_2 = v41[2 * v40 + 1]; v43 = v67; - _vm->_globals.super_parcours[v43] = v42; - _vm->_globals.super_parcours[v43 + 1] = v41_2; + _vm->_globals.super_parcours[v43] = v41[2 * v40]; + _vm->_globals.super_parcours[v43 + 1] = v41[2 * v40 + 1]; _vm->_globals.super_parcours[v43 + 2] = _vm->_linesManager.Ligne[j].field6; _vm->_globals.super_parcours[v43 + 3] = 0; v67 += 4; @@ -3631,11 +3608,9 @@ LABEL_88: if (v69 > v73) { for (k = v68; k > 0; --k) { v45 = _vm->_linesManager.Ligne[v69].lineData; - v46 = v45[2 * k]; - int v45_2 = v45[2 * k + 1]; v47 = v67; - _vm->_globals.super_parcours[v47] = v46; - _vm->_globals.super_parcours[v47 + 1] = v45_2; + _vm->_globals.super_parcours[v47] = v45[2 * k]; + _vm->_globals.super_parcours[v47 + 1] = v45[2 * k + 1]; _vm->_globals.super_parcours[v47 + 2] = _vm->_linesManager.Ligne[v69].field8; _vm->_globals.super_parcours[v47 + 3] = 0; v67 += 4; @@ -3654,11 +3629,9 @@ LABEL_88: if ((_vm->_linesManager.Ligne[v48].field0 - 2) > 0) { do { v50 = _vm->_linesManager.Ligne[l].lineData; - v51 = v50[2 * v49]; - int v50_2 = v50[2 * v49 + 1]; v52 = v67; - _vm->_globals.super_parcours[v52] = v51; - _vm->_globals.super_parcours[v52 + 1] = v50_2; + _vm->_globals.super_parcours[v52] = v50[2 * v49]; + _vm->_globals.super_parcours[v52 + 1] = v50[2 * v49 + 1]; _vm->_globals.super_parcours[v52 + 2] = _vm->_linesManager.Ligne[l].field8; _vm->_globals.super_parcours[v52 + 3] = 0; v67 += 4; @@ -3675,11 +3648,9 @@ LABEL_88: v57 = v68; do { v58 = _vm->_linesManager.Ligne[v73].lineData; - v59 = v58[2 * v57]; - int v58_2 = v58[2 * v57 + 1]; v60 = v67; - _vm->_globals.super_parcours[v60] = v59; - _vm->_globals.super_parcours[v60 + 1] = v58_2; + _vm->_globals.super_parcours[v60] = v58[2 * v57]; + _vm->_globals.super_parcours[v60 + 1] = v58[2 * v57 + 1]; _vm->_globals.super_parcours[v60 + 2] = _vm->_linesManager.Ligne[v73].field6; _vm->_globals.super_parcours[v60 + 3] = 0; v67 += 4; @@ -3690,13 +3661,11 @@ LABEL_88: v53 = v68; do { v54 = _vm->_linesManager.Ligne[v73].lineData; - v55 = v54[2 * v53]; - int v54_2 = v54[2 * v53 + 1]; v56 = v67; - _vm->_globals.super_parcours[2 * v56] = v55; - _vm->_globals.super_parcours[2 * v56 + 1] = v54_2; - _vm->_globals.super_parcours[2 * v56 + 2] = _vm->_linesManager.Ligne[v73].field8; - _vm->_globals.super_parcours[2 * v56 + 3] = 0; + _vm->_globals.super_parcours[v56] = v54[2 * v53]; + _vm->_globals.super_parcours[v56 + 1] = v54[2 * v53 + 1]; + _vm->_globals.super_parcours[v56 + 2] = _vm->_linesManager.Ligne[v73].field8; + _vm->_globals.super_parcours[v56 + 3] = 0; v67 += 4; --v53; } while (v72 < v53); -- cgit v1.2.3 From d7277c3a307a24fb557cfe412d60a0a5cd723785 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 10:45:54 +1100 Subject: HOPKINS: Disable greyscaling of savegame thumbnails --- engines/hopkins/saveload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 427e2d9fce..04cb2b3169 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -212,7 +212,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)s->pixels, _vm->_eventsManager.start_x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); - _vm->_graphicsManager.Trans_bloc2((byte *)s->pixels, _vm->_graphicsManager.TABLE_COUL, 11136); +// _vm->_graphicsManager.Trans_bloc2((byte *)s->pixels, _vm->_graphicsManager.TABLE_COUL, 11136); } void SaveLoadManager::syncSavegameData(Common::Serializer &s) { -- cgit v1.2.3 From 7a5a60028c041deed49bb2005c4cec39672d9091 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 10:48:31 +1100 Subject: HOPKINS: Fix compiler warning --- engines/hopkins/dialogs.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index feeb8843d8..5e6452214e 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -647,7 +647,6 @@ void DialogsManager::SAUVE_PARTIE() { void DialogsManager::LOAD_SAUVE(int a1) { int slotNumber; hopkinsSavegameHeader header; - Common::InSaveFile *in; byte *thumb; switch (_vm->_globals.FR) { -- cgit v1.2.3 From 0930151e21b8fadb98569c17dee4615007618772 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 11:01:30 +1100 Subject: HOPKINS: Implemented save restore functionality --- engines/hopkins/dialogs.cpp | 51 ++++++-------------------------------------- engines/hopkins/saveload.cpp | 10 +++++++++ 2 files changed, 16 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 5e6452214e..7e4dc16d11 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -537,29 +537,16 @@ void DialogsManager::TEST_INVENT() { // Load Game void DialogsManager::CHARGE_PARTIE() { - int v1; - char slotNumber; - Common::String s; - Common::String v8; - char v9; - char v10; - char v11; - Common::String v12; - char v13; - char v14; - char v15; - char v16; - char v17; - Common::File f; + int slotNumber; _vm->_eventsManager.VBL(); LOAD_SAUVE(2); do { do { - v1 = CHERCHE_PARTIE(); + slotNumber = CHERCHE_PARTIE(); _vm->_eventsManager.VBL(); } while (_vm->_eventsManager.BMOUSE() != 1); - } while (!v1); + } while (!slotNumber); _vm->_objectsManager.SL_FLAG = 0; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); @@ -568,35 +555,9 @@ void DialogsManager::CHARGE_PARTIE() { _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); _vm->_objectsManager.SL_X = 0; _vm->_objectsManager.SL_Y = 0; - if (v1 != 7) { - s = Common::String::format("%d", v1); - v8 = 80; - v9 = 65; - v10 = 82; - v11 = 84; - v12 = s; - v13 = 46; - v14 = 68; - v15 = 65; - v16 = 84; - v17 = 0; - _vm->_fileManager.CONSTRUIT_LINUX(v8); - if (f.open(_vm->_globals.NFICHIER)) { - f.close(); - - slotNumber = _vm->_globals.SAUVEGARDE->data[svField10]; - _vm->_fileManager.CONSTRUIT_LINUX(v8); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, &_vm->_globals.SAUVEGARDE->data[0]); - - // Load the inventory - for (int i = 0; i < 35; ++i) - _vm->_globals.INVENTAIRE[i] = _vm->_globals.SAUVEGARDE->inventory[i]; - - _vm->_globals.SAUVEGARDE->data[svField10] = slotNumber; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; - _vm->_globals.SAUVEGARDE->data[svField6] = 0; - _vm->_globals.ECRAN = 0; - } + + if (slotNumber != 7) { + _vm->_saveLoadManager.restore(slotNumber); } _vm->_objectsManager.CHANGE_OBJET(14); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 04cb2b3169..023257ede0 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -186,6 +186,16 @@ Common::Error SaveLoadManager::restore(int slot) { // Loading save file complete delete saveFile; + // Unpack the inventory + for (int i = 0; i < 35; ++i) + _vm->_globals.INVENTAIRE[i] = _vm->_globals.SAUVEGARDE->inventory[i]; + + // Set variables from loaded data as necessary + _vm->_globals.SAUVEGARDE->data[svField10] = slot; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; + _vm->_globals.SAUVEGARDE->data[svField6] = 0; + _vm->_globals.ECRAN = 0; + return Common::kNoError; } -- cgit v1.2.3 From 40748dabc7298575a11ee9e3b8b1102bd5d96214 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 14:26:07 +1100 Subject: HOPKINS: Added shortcut keys for the Save, Load, and Options dialogs --- engines/hopkins/dialogs.cpp | 31 +++++++++++++++++++++++++------ engines/hopkins/dialogs.h | 2 +- engines/hopkins/events.cpp | 12 ++++++++++-- engines/hopkins/events.h | 4 +++- engines/hopkins/objects.cpp | 12 ++++++------ 5 files changed, 45 insertions(+), 16 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7e4dc16d11..5e157ff66e 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -521,16 +521,35 @@ void DialogsManager::INVENT_ANIM() { } } -void DialogsManager::TEST_INVENT() { +void DialogsManager::TestForDialogOpening() { if (_vm->_globals.PLAN_FLAG) - _vm->_eventsManager.KEY_INVENT = 0; - if (_vm->_eventsManager.KEY_INVENT == 1) { + _vm->_eventsManager.GAME_KEY = KEY_NONE; + + if (_vm->_eventsManager.GAME_KEY != KEY_NONE) { if (!INVENTFLAG) { - _vm->_eventsManager.KEY_INVENT = 0; + GAME_KEY key = _vm->_eventsManager.GAME_KEY; + _vm->_eventsManager.GAME_KEY = KEY_NONE; INVENTFLAG = 1; - _vm->_dialogsManager.showInventory(); + + switch (key) { + case KEY_INVENTORY: + _vm->_dialogsManager.showInventory(); + break; + case KEY_OPTIONS: + _vm->_dialogsManager.showOptionsDialog(); + break; + case KEY_LOAD: + _vm->_dialogsManager.CHARGE_PARTIE(); + break; + case KEY_SAVE: + _vm->_dialogsManager.SAUVE_PARTIE(); + break; + default: + break; + } + INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; } } } diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index 7e049bf717..3f4cdfadbb 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -55,7 +55,7 @@ public: void showInventory(); void INVENT_ANIM(); - void TEST_INVENT(); + void TestForDialogOpening(); void CHARGE_PARTIE(); void SAUVE_PARTIE(); void LOAD_SAUVE(int a1); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 0eb65c8f01..ea88e1de5a 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -44,7 +44,7 @@ EventsManager::EventsManager() { _gameCounter = 0; lItCounter = 0; ESC_KEY = false; - KEY_INVENT = false; + GAME_KEY = KEY_NONE; btsouris = 0; OLD_ICONE = 0; @@ -260,7 +260,15 @@ void EventsManager::pollEvents() { void EventsManager::handleKey(Common::Event &event) { ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE; - KEY_INVENT = event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB; + + if (event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB) + GAME_KEY = KEY_INVENTORY; + else if (event.kbd.keycode == Common::KEYCODE_F5) + GAME_KEY = KEY_SAVE; + else if (event.kbd.keycode == Common::KEYCODE_F7) + GAME_KEY = KEY_LOAD; + else if (event.kbd.keycode == Common::KEYCODE_F1 || event.kbd.keycode == Common::KEYCODE_o) + GAME_KEY = KEY_OPTIONS; // Check for debugger if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 8aa87e0cdc..7979115a0f 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -34,6 +34,8 @@ namespace Hopkins { class HopkinsEngine; +enum GAME_KEY { KEY_NONE = 0, KEY_INVENTORY = 1, KEY_OPTIONS = 2, KEY_SAVE = 3, KEY_LOAD = 4 }; + class EventsManager { private: HopkinsEngine *_vm; @@ -60,7 +62,7 @@ public: uint32 _priorFrameTime; bool ESC_KEY; bool NOESC; - bool KEY_INVENT; + GAME_KEY GAME_KEY; int btsouris; public: EventsManager(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index f8e229290b..11aaf579e5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2623,7 +2623,7 @@ void ObjectsManager::PLAN_BETA() { v1 = 0; _vm->_dialogsManager.INVENTFLAG = false; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; _vm->_globals.Max_Propre_Gen = 1; @@ -2766,7 +2766,7 @@ void ObjectsManager::BTGAUCHE() { _vm->_dialogsManager.INVENTFLAG = 1; _vm->_dialogsManager.showInventory(); _vm->_dialogsManager.INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; if (!_vm->_globals.SORTIE) { _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.btsouris = v1; @@ -5565,7 +5565,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s v5 = 0; _vm->_dialogsManager.INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_dialogsManager.VIRE_INVENT = false; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = 0; @@ -5635,7 +5635,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s } if (v9 == 2) BTDROITE(); - _vm->_dialogsManager.TEST_INVENT(); + _vm->_dialogsManager.TestForDialogOpening(); VERIFZONE(); if (GOACTION == 1) PARADISE(); @@ -5662,7 +5662,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & int xp, yp; _vm->_dialogsManager.INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; @@ -5779,7 +5779,7 @@ LABEL_70: } } if (!_vm->_globals.SORTIE) { - _vm->_dialogsManager.TEST_INVENT(); + _vm->_dialogsManager.TestForDialogOpening(); VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { -- cgit v1.2.3 From b005f9dad0322a2c4ec46b471fa070444d1a2245 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 14:51:17 +1100 Subject: HOPKINS: Work on hooking save/loading into the ScummVM framework --- engines/hopkins/detection.cpp | 52 +++++++++++++++++++++++++++++++++++++------ engines/hopkins/events.cpp | 2 +- engines/hopkins/hopkins.cpp | 36 ++++++++++++++++++++++++++---- engines/hopkins/hopkins.h | 4 ++++ 4 files changed, 82 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 0be4337862..8724802552 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -33,6 +33,8 @@ #include "hopkins/hopkins.h" +#define MAX_SAVES 99 + namespace Hopkins { struct HopkinsGameDescription { @@ -113,29 +115,65 @@ SaveStateList HopkinsMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray filenames; Common::String saveDesc; - Common::String pattern = "hopkins.0??"; + Common::String pattern = Common::String::format("%s.0??", target); filenames = saveFileMan->listSavefiles(pattern); - sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + sort(filenames.begin(), filenames.end()); // Sort to get the files in numerical order + + Hopkins::hopkinsSavegameHeader header; SaveStateList saveList; - // TODO + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + const char *ext = strrchr(file->c_str(), '.'); + int slot = ext ? atoi(ext + 1) : -1; + + if (slot >= 0 && slot < MAX_SAVES) { + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); + + if (in) { + if (Hopkins::SaveLoadManager::readSavegameHeader(in, header)) { + saveList.push_back(SaveStateDescriptor(slot, header.saveName)); + + header.thumbnail->free(); + delete header.thumbnail; + } + + delete in; + } + } + } return saveList; } int HopkinsMetaEngine::getMaximumSaveSlot() const { - return 99; + return MAX_SAVES; } void HopkinsMetaEngine::removeSaveState(const char *target, int slot) const { - Common::String filename = "todo"; - + Common::String filename = Common::String::format("%s.%03d", target, slot); g_system->getSavefileManager()->removeSavefile(filename); } SaveStateDescriptor HopkinsMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - // TODO + Common::String filename = Common::String::format("%s.%03d", target, slot); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename); + + if (f) { + Hopkins::hopkinsSavegameHeader header; + Hopkins::SaveLoadManager::readSavegameHeader(f, header); + delete f; + + // Create the return descriptor + SaveStateDescriptor desc(slot, header.saveName); + desc.setThumbnail(header.thumbnail); + desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay); + desc.setSaveTime(header.saveHour, header.saveMinutes); + desc.setPlayTime(header.totalFrames * GAME_FRAME_TIME); + + return desc; + } + return SaveStateDescriptor(); } diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index ea88e1de5a..dbdd0fce81 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -205,11 +205,11 @@ void EventsManager::checkForNextFrameCounter() { while ((milli - _priorCounterTime) >= 10) { _priorCounterTime += 10; lItCounter += 3; - ++_gameCounter; } // Check for next game frame if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { + ++_gameCounter; _priorFrameTime = milli; g_system->updateScreen(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 6143219283..32108fb846 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -59,6 +59,38 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe HopkinsEngine::~HopkinsEngine() { } +Common::String HopkinsEngine::generateSaveName(int slot) { + return Common::String::format("%s.%03d", _targetName.c_str(), slot); +} + +/** + * Returns true if it is currently okay to restore a game + */ +bool HopkinsEngine::canLoadGameStateCurrently() { + return !_globals.SORTIE && !_globals.PLAN_FLAG; +} + +/** + * Returns true if it is currently okay to save the game + */ +bool HopkinsEngine::canSaveGameStateCurrently() { + return !_globals.SORTIE && !_globals.PLAN_FLAG; +} + +/** + * Load the savegame at the specified slot index + */ +Common::Error HopkinsEngine::loadGameState(int slot) { + return _saveLoadManager.restore(slot); +} + +/** + * Save the game to the given slot index, and with the given name + */ +Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc) { + return _saveLoadManager.save(slot, desc); +} + Common::Error HopkinsEngine::run() { _saveLoadManager.initSaves(); @@ -959,8 +991,4 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } -Common::String HopkinsEngine::generateSaveName(int slot) { - return Common::String::format("%s.%03d", _targetName.c_str(), slot); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 82bc3317b0..706a4efda7 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -126,6 +126,10 @@ public: int getRandomNumber(int maxNumber); Common::String generateSaveName(int slotNumber); + virtual bool canLoadGameStateCurrently(); + virtual bool canSaveGameStateCurrently(); + virtual Common::Error loadGameState(int slot); + virtual Common::Error saveGameState(int slot, const Common::String &desc); /** * Run the introduction sequence -- cgit v1.2.3 From 367f0aac7ed8c205deb6294ceb8b2367118fbc04 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 15:46:52 +1100 Subject: HOPKINS: Remove duplicate GOACTION variable. This fixes arriving at destinations from the map view. --- engines/hopkins/dialogs.cpp | 7 ------- engines/hopkins/objects.cpp | 23 +++++++++++------------ engines/hopkins/objects.h | 1 - engines/hopkins/saveload.cpp | 10 +++++++++- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 5e157ff66e..742946e2cb 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -607,13 +607,6 @@ void DialogsManager::SAUVE_PARTIE() { _vm->_objectsManager.SL_Y = 0; if (slotNumber != 7) { - // Set the selected slot number - _vm->_globals.SAUVEGARDE->data[svField10] = slotNumber; - - // Set up the inventory - for (int i = 0; i < 35; ++i) - _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals.INVENTAIRE[i]; - // Since the original GUI doesn't support save names, use a default name saveName = Common::String::format("Save #%d", slotNumber); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 11aaf579e5..008ef7a9e3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -56,7 +56,6 @@ ObjectsManager::ObjectsManager() { DESACTIVE_CURSOR = 0; BOBTOUS = false; my_anim = 0; - GOACTION = 0; NUMZONE = 0; ARRET_PERSO_FLAG = 0; ARRET_PERSO_NUM = 0; @@ -1890,7 +1889,7 @@ void ObjectsManager::GOHOME() { } else { SETANISPR(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) v54 = _vm->_globals.SAUVEGARDE->data[svField2]; else v54 = NUMZONE; @@ -2231,7 +2230,7 @@ LABEL_153: _vm->_globals.chemin++; if (nouveau_x == -1 && v48 == -1) { - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) v49 = _vm->_globals.SAUVEGARDE->data[svField2]; else v49 = NUMZONE; @@ -2804,7 +2803,7 @@ void ObjectsManager::BTGAUCHE() { } } if (_vm->_globals.PLAN_FLAG == 1) { - if (GOACTION != 1) + if (_vm->_globals.GOACTION != 1) goto LABEL_38; VERIFZONE(); if (NUMZONE <= 0) @@ -2823,9 +2822,9 @@ void ObjectsManager::BTGAUCHE() { v5[v2 + 2] = -1; v5[v2 + 3] = -1; } - if (GOACTION == 1) { + if (_vm->_globals.GOACTION == 1) { VERIFZONE(); - GOACTION = 0; + _vm->_globals.GOACTION = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2845,7 +2844,7 @@ LABEL_38: } } } - GOACTION = 0; + _vm->_globals.GOACTION = 0; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { @@ -2908,7 +2907,7 @@ LABEL_65: _vm->_globals.SAUVEGARDE->data[svField1] = 6; _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; - GOACTION = 1; + _vm->_globals.GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -3036,7 +3035,7 @@ LABEL_64: BTDROITE(); } } - GOACTION = 0; + _vm->_globals.GOACTION = 0; } // Clear Screen @@ -3083,7 +3082,7 @@ void ObjectsManager::CLEAR_ECRAN() { Vold_taille = 200; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; - GOACTION = 0; + _vm->_globals.GOACTION = 0; FORCEZONE = 1; CHANGEVERBE = 0; _vm->_globals.NOSPRECRAN = 0; @@ -5637,7 +5636,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s BTDROITE(); _vm->_dialogsManager.TestForDialogOpening(); VERIFZONE(); - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) PARADISE(); if (!_vm->_globals.SORTIE) { _vm->_eventsManager.VBL(); @@ -5783,7 +5782,7 @@ LABEL_70: VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) PARADISE(); } SPECIAL_JEU(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d9f15abdea..3140674e5c 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -81,7 +81,6 @@ public: int DESACTIVE_CURSOR; bool BOBTOUS; int my_anim; - int GOACTION; int NUMZONE; int ARRET_PERSO_FLAG; int ARRET_PERSO_NUM; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 023257ede0..cd7c32c345 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -138,7 +138,15 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg } Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { - // Try and create the save file + /* Pack any necessary data into the savegame data structure */ + // Set the selected slot number + _vm->_globals.SAUVEGARDE->data[svField10] = slot; + + // Set up the inventory + for (int i = 0; i < 35; ++i) + _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals.INVENTAIRE[i]; + + /* Create the savegame */ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( _vm->generateSaveName(slot)); if (!saveFile) -- cgit v1.2.3 From 1dff18f4b9fd77d5aaf90c37eca0f22e4368eb26 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 17:54:34 +1100 Subject: HOPKINS: Fix crash when returning from conversation cut-scene in scene 5 --- engines/hopkins/objects.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 008ef7a9e3..d63ee39f40 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4264,8 +4264,10 @@ void ObjectsManager::SPECIAL_JEU() { if (!_vm->_globals.CENSURE) { v1 = _vm->_globals.dos_malloc2(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); @@ -4279,8 +4281,10 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NECESSAIRE = 1; _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; + _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + PERSO_ON = 0; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); -- cgit v1.2.3 From a8e217a7b8296d40f658583579edc68d86f1dd3f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 18:04:06 +1100 Subject: HOPKINS: Added code to delete saved temporary screen .SCR files --- engines/hopkins/anim.cpp | 29 +++++++++++++++++++---------- engines/hopkins/objects.cpp | 7 +++---- engines/hopkins/talk.cpp | 12 ++++++++---- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 7622302fc3..400d695637 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -271,6 +271,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint v18 = 0; v20 = 1; memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); @@ -278,6 +279,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; + v12 = _vm->_graphicsManager.VESA_SCREEN; v13 = _vm->_globals.dos_malloc2(0x14u); _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); @@ -354,8 +356,9 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_globals.dos_free2(v13); f.close(); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); @@ -459,8 +462,9 @@ LABEL_88: _vm->_globals.dos_free2(v13); f.close(); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); @@ -523,8 +527,9 @@ LABEL_88: _vm->_globals.dos_free2(v13); f.close(); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); @@ -620,8 +625,10 @@ LABEL_114: } _vm->_graphicsManager.FADE_LINUX = 0; _vm->_globals.dos_free2(v13); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + + _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); @@ -970,6 +977,7 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin _vm->_eventsManager.souris_flag = 0; if (!NO_COUL) { _vm->_eventsManager.VBL(); + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); @@ -1100,8 +1108,9 @@ LABEL_59: f.close(); if (!NO_COUL) { - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); + _vm->_eventsManager.souris_flag = 1; } if (v7 == 1) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d63ee39f40..2913a69866 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4265,8 +4265,7 @@ void ObjectsManager::SPECIAL_JEU() { v1 = _vm->_globals.dos_malloc2(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; @@ -4282,8 +4281,8 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; - _vm->_fileManager.CONSTRUIT_LINUX("TEMP1.SCR"); - _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); PERSO_ON = 0; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f8dbe848f8..756effbfaf 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -149,8 +149,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = 0; - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = 0; _vm->_eventsManager.btsouris = v14; @@ -1233,11 +1233,13 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = 0; + _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); @@ -1300,8 +1302,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.NOMARCHE = 0; if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); - _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN); + + _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); + _vm->_objectsManager.PERSO_ON = 0; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(4); -- cgit v1.2.3 From 54b6f47ad9f22529abd29c08abf217a1e4e70118 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 18:49:41 +1100 Subject: HOPKINS: Bugfix to Copy_Video_Vbe16a --- engines/hopkins/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f9505d0372..ae26c40209 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1264,7 +1264,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { v3 += 5; } Video_Cont_Vbe16a: - WRITE_LE_UINT16(v2 + v2 + VideoPtr, READ_LE_UINT16(PAL_PIXELS + 2 * v4)); + WRITE_LE_UINT16((byte *)VideoPtr->pixels + v2 * 2, READ_LE_UINT16(PAL_PIXELS + 2 * v4)); ++v3; ++v2; } -- cgit v1.2.3 From 1faeb6e136ff9fddd16340c072122f75c8fff29a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 21:49:41 +1100 Subject: HOPKINS: Some cleanup of field types and comparisons in PLAY_SEQ/PLAY_SEQ2 --- engines/hopkins/anim.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 400d695637..8eaf8bd5be 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -606,7 +606,7 @@ LABEL_114: memset(v13, 0, 0x13u); if (f.read(v13, 16) != 16) v6 = -1; - if (strncmp((const char *)v13, "IMAGE=", 7)) + if (strncmp((const char *)v13, "IMAGE=", 6)) v6 = -1; if (!v6) { @@ -1055,7 +1055,7 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin if (f.read(v10, 16) != 16) v5 = -1; - if (strncmp((const char *)v10, "IMAGE=", 7)) + if (strncmp((const char *)v10, "IMAGE=", 6)) v5 = -1; if (!v5) { f.read(v9, (int16)READ_LE_UINT16(v10 + 8)); @@ -1119,8 +1119,8 @@ LABEL_59: } void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4) { - int v4; - int v5; + bool v4; + bool v5; int v7; byte *ptr; byte *ptra; @@ -1138,7 +1138,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, Common::File f; v7 = 0; - for (;;) { + while (!_vm->shouldQuit()) { v15 = 0; v14 = 0; v17 = 0; @@ -1196,7 +1196,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; - while (1) { + while (!_vm->shouldQuit()) { if (_vm->_eventsManager.ESC_KEY == 1) goto LABEL_54; if (REDRAW_ANIM() == 1) @@ -1216,17 +1216,18 @@ LABEL_48: } LABEL_23: _vm->_eventsManager.lItCounter = 0; - v4 = 0; + v4 = false; v13 = 0; - for (;;) { + while (!_vm->shouldQuit()) { _vm->_soundManager.PLAY_ANM_SOUND(v13++); + memset(&buf, 0, 6u); memset(v11, 0, 0x13u); if (f.read(v11, 16) != 16) - v4 = -1; + v4 = true; - if (strncmp((const char *)v11, "IMAGE=", 7u)) - v4 = -1; + if (strncmp((const char *)v11, "IMAGE=", 6)) + v4 = true; if (v4) goto LABEL_44; f.read(v10, READ_LE_UINT32(v11 + 8)); @@ -1253,7 +1254,7 @@ LABEL_33: _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); LABEL_44: - if (v4 == -1) { + if (v4) { if (_vm->_globals.iRegul == 1) { while (_vm->_eventsManager.ESC_KEY != 1) { if (REDRAW_ANIM() == 1) @@ -1295,21 +1296,21 @@ LABEL_54: f.read(v10, nbytes); memcpy(ptra, v10, 0x4B000u); - v5 = 0; + v5 = false; do { memset(&buf, 0, 6u); memset(v11, 0, 0x13u); if (f.read(v11, 16) != 16) - v5 = -1; + v5 = true; - if (strncmp((const char *)v11, "IMAGE=", 7u)) - v5 = -1; + if (strncmp((const char *)v11, "IMAGE=", 6)) + v5 = true; if (!v5) { f.read(v10, READ_LE_UINT32(v11 + 8)); if (*v10 != (byte)-4) _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); } - } while (v5 != -1); + } while (!v5); _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); ptr = _vm->_globals.dos_free2(ptra); } -- cgit v1.2.3 From 58ac9c83ec4ecbaa724eab80ac72e62ec35955c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 22:10:14 +1100 Subject: HOPKINS: Fixed the type casting in copy video methods --- engines/hopkins/graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ae26c40209..ea1d44f442 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2420,7 +2420,7 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { byteVal = *(srcPtr + 2); srcPtr += 2; } else if (byteVal == (byte)-2) { - destOffset += (int16)READ_LE_UINT16(srcPtr + 1); + destOffset += READ_LE_UINT16(srcPtr + 1); byteVal = *(srcPtr + 3); srcPtr += 3; } else { @@ -2454,7 +2454,7 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { byteVal = *(srcP + 2); srcP += 2; } else if (byteVal == (byte)-2) { - destOffset += (int16)READ_LE_UINT16(srcP + 1); + destOffset += READ_LE_UINT16(srcP + 1); byteVal = *(srcP + 3); srcP += 3; } else { -- cgit v1.2.3 From e999d9743b944783c7859ba066e65ad00c298a61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 22:17:55 +1100 Subject: HOPKINS: Fix gcc compiler warnings --- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/events.h | 4 ++-- engines/hopkins/hopkins.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 742946e2cb..9285ae6a81 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -527,7 +527,7 @@ void DialogsManager::TestForDialogOpening() { if (_vm->_eventsManager.GAME_KEY != KEY_NONE) { if (!INVENTFLAG) { - GAME_KEY key = _vm->_eventsManager.GAME_KEY; + DIALOG_KEY key = _vm->_eventsManager.GAME_KEY; _vm->_eventsManager.GAME_KEY = KEY_NONE; INVENTFLAG = 1; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 7979115a0f..364a74fcf8 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -34,7 +34,7 @@ namespace Hopkins { class HopkinsEngine; -enum GAME_KEY { KEY_NONE = 0, KEY_INVENTORY = 1, KEY_OPTIONS = 2, KEY_SAVE = 3, KEY_LOAD = 4 }; +enum DIALOG_KEY { KEY_NONE = 0, KEY_INVENTORY = 1, KEY_OPTIONS = 2, KEY_SAVE = 3, KEY_LOAD = 4 }; class EventsManager { private: @@ -62,7 +62,7 @@ public: uint32 _priorFrameTime; bool ESC_KEY; bool NOESC; - GAME_KEY GAME_KEY; + DIALOG_KEY GAME_KEY; int btsouris; public: EventsManager(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 706a4efda7..1399a80498 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -119,7 +119,7 @@ public: uint32 getFeatures() const; Common::Language getLanguage() const; - Common::Platform HopkinsEngine::getPlatform() const; + Common::Platform getPlatform() const; uint16 getVersion() const; bool getIsDemo() const; bool shouldQuit() const; -- cgit v1.2.3 From a0c26cde210479807f89e0678342e117e52edbd1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 22:31:12 +1100 Subject: HOPKINS: Added extra shouldQuit checks to introduction sequence --- engines/hopkins/hopkins.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 32108fb846..2929161c68 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -695,10 +695,13 @@ void HopkinsEngine::INTRORUN() { _eventsManager.souris_xy(_eventsManager.souris_x + 4, v4); } _eventsManager.VBL(); - } while (v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); + } while (!shouldQuit() && v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); _eventsManager.VBL(); _graphicsManager.no_scroll = 0; + + if (shouldQuit()) + return; } _soundManager.VOICE_MIX(4, 3); @@ -740,9 +743,16 @@ void HopkinsEngine::INTRORUN() { v7 = (int)&v23; _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); _graphicsManager.FIN_VISU(); + + if (shouldQuit()) + return; + _soundManager.SPECIAL_SOUND = 5; _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("ELEC.ANM", 10, 26, 200); + if (shouldQuit()) + return; + _soundManager.SPECIAL_SOUND = 0; if (!_eventsManager.ESC_KEY) { @@ -772,7 +782,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); v9 = 0; - while (!_eventsManager.ESC_KEY) { + while (!shouldQuit() && !_eventsManager.ESC_KEY) { if (v9 == 12) { _objectsManager.BOBANIM_ON(3); _eventsManager.VBL(); @@ -849,13 +859,21 @@ void HopkinsEngine::INTRORUN() { _soundManager.WSOUND(3); _soundManager.SPECIAL_SOUND = 1; _animationManager.PLAY_ANM("INTRO1.anm", 10, 24, 18); + if (shouldQuit()) + return; + _soundManager.SPECIAL_SOUND = 0; if (!_eventsManager.ESC_KEY) { _animationManager.PLAY_ANM("INTRO2.anm", 10, 24, 18); + if (shouldQuit()) + return; if (!_eventsManager.ESC_KEY) { _animationManager.PLAY_ANM("INTRO3.anm", 10, 24, 200); + if (shouldQuit()) + return; + if (!_eventsManager.ESC_KEY) { _animationManager.CLS_ANM = 0; _graphicsManager.FADE_LINUX = 2; -- cgit v1.2.3 From f1cace39e8fa7def5cc82c6e65ace366101bbf83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 22:38:19 +1100 Subject: HOPKINS: Fix to allow quitting when a conversation is active --- engines/hopkins/talk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 756effbfaf..6dcebecde2 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -367,7 +367,7 @@ int TalkManager::DIALOGUE() { v6 = 1; if (v5 == -1) v6 = 0; - } while (v6 != 1); + } while (!_vm->shouldQuit() && v6 != 1); _vm->_soundManager.VOICE_MIX(v5, 1); _vm->_fontManager.TEXTE_OFF(5); -- cgit v1.2.3 From f7770dce2d0e999a41cea2df5e3b33c18200ebbc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 23:21:33 +1100 Subject: HOPKINS: Fix calculating offsets in get_offsetx/y --- engines/hopkins/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2913a69866..df0b311ef1 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -205,7 +205,7 @@ void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSi int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool isSize) { const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) - v3 += (int16)READ_LE_UINT16(v3) + 16; + v3 += READ_LE_UINT32(v3) + 16; const byte *v5 = v3 + 8; int result = (int16)READ_LE_UINT16(v5); @@ -218,7 +218,7 @@ int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool is int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool isSize) { const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) - v3 += (int16)READ_LE_UINT16(v3) + 16; + v3 += READ_LE_UINT32(v3) + 16; const byte *v5 = v3 + 10; int result = (int16)READ_LE_UINT16(v5); -- cgit v1.2.3 From 2ec42212faa45ea8f12cbebda87f2ccb51fd2d49 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 23:36:57 +1100 Subject: HOPKINS: Fix buffer overruns in the PLAY_SEQ2 method --- engines/hopkins/anim.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 8eaf8bd5be..1d4e867af5 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -1122,10 +1122,10 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, bool v4; bool v5; int v7; - byte *ptr; + byte *ptr = NULL; byte *ptra; byte *v10; - byte *v11; + byte *v11 = NULL; int v13; int v14; int v15; @@ -1134,11 +1134,13 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, int v18; char v19; size_t nbytes; - byte buf[4]; Common::File f; v7 = 0; - while (!_vm->shouldQuit()) { + for (;;) { + if (_vm->shouldQuit()) + return; + v15 = 0; v14 = 0; v17 = 0; @@ -1152,9 +1154,9 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, if (!f.open(_vm->_globals.NFICHIER)) error("File not found - %s", _vm->_globals.NFICHIER.c_str()); - f.read(&buf, 6u); + f.skip(6); f.read(_vm->_graphicsManager.Palette, 0x320u); - f.read(&buf, 4u); + f.skip(4); nbytes = f.readUint32LE(); v19 = f.readUint32LE(); v18 = f.readUint16LE(); @@ -1170,8 +1172,10 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, memcpy((void *)ptr, v10, 0x4B000u); } if (_vm->_animationManager.NO_SEQ) { - if (v7 == 1) + if (v7 == 1) { + assert(ptr != NULL); memcpy((void *)ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + } _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.DD_Lock(); @@ -1221,7 +1225,6 @@ LABEL_23: while (!_vm->shouldQuit()) { _vm->_soundManager.PLAY_ANM_SOUND(v13++); - memset(&buf, 0, 6u); memset(v11, 0, 0x13u); if (f.read(v11, 16) != 16) v4 = true; @@ -1283,9 +1286,9 @@ LABEL_54: ptra = _vm->_globals.dos_malloc2(0x4B000u); f.seek(0); - f.read(&buf, 6u); + f.skip(6); f.read(_vm->_graphicsManager.Palette, 0x320u); - f.read(&buf, 4u); + f.skip(4); nbytes = f.readUint32LE(); v19 = f.readUint32LE(); v18 = f.readUint16LE(); @@ -1298,7 +1301,6 @@ LABEL_54: memcpy(ptra, v10, 0x4B000u); v5 = false; do { - memset(&buf, 0, 6u); memset(v11, 0, 0x13u); if (f.read(v11, 16) != 16) v5 = true; -- cgit v1.2.3 From e99a5c02b59784efc659f5ef77292909f7daf6b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Oct 2012 00:00:18 +1100 Subject: HOPKINS: Added lots of shouldQuit() checks to the loops in the script code --- engines/hopkins/anim.cpp | 11 +- engines/hopkins/graphics.cpp | 5 +- engines/hopkins/objects.cpp | 3 + engines/hopkins/script.cpp | 276 +++++++++++++++++++++++++++++++++++-------- engines/hopkins/talk.cpp | 3 + 5 files changed, 246 insertions(+), 52 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 1d4e867af5..2a85257d6a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -50,6 +50,9 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui size_t nbytes; Common::File f; + if (_vm->shouldQuit()) + return; + hasScreenCopy = false; while (!_vm->shouldQuit()) { LABEL_2: @@ -263,8 +266,11 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint char v25; Common::File f; + if (_vm->shouldQuit()) + return; + v8 = 0; - while (1) { + while (!_vm->shouldQuit()) { v17 = 0; v16 = 0; v19 = 0; @@ -968,6 +974,9 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin int buf; Common::File f; + if (_vm->shouldQuit()) + return; + v7 = 0; v14 = 0; v13 = 0; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ea1d44f442..519c193235 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2326,7 +2326,10 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { } else { v11 = 0; do { - v6 = _vm->_scriptManager.Traduction(ptr + 20 * v2); + v6 = _vm->_scriptManager.Traduction(ptr + 20 * v2); + if (_vm->shouldQuit()) + return; + if (v6 == 2) v2 = _vm->_scriptManager.Control_Goto((ptr + 20 * v2)); if (v6 == 3) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index df0b311ef1..436996c1e0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4204,6 +4204,9 @@ void ObjectsManager::OPTI_OBJET() { v7 = 0; do { v5 = _vm->_scriptManager.Traduction(data + 20 * v0); + if (_vm->shouldQuit()) + return; + if (v5 == 2) v0 = _vm->_scriptManager.Control_Goto(data + 20 * v0); if (v5 == 3) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 7d0ddd5d73..c103261129 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -202,9 +202,11 @@ int ScriptManager::Traduction(byte *a1) { v3 = 636; } if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game _vm->_eventsManager.VBL(); - while (_vm->_soundManager.SOUND_FLAG); + } while (_vm->_soundManager.SOUND_FLAG); } if (!_vm->_soundManager.TEXTOFF) { _vm->_fontManager.DOS_TEXT(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); @@ -261,6 +263,9 @@ LABEL_104: v4 /= _vm->_globals.vitesse; if (v4 > 1) { do { + if (_vm->shouldQuit()) + return -1; // Exiting game + --v4; _vm->_eventsManager.VBL(); } while (v4); @@ -559,6 +564,9 @@ LABEL_1141: v10 = 0; if (v74 + 1 > 0) { do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); ++v10; } while (v10 < v74 + 1); @@ -778,14 +786,20 @@ LABEL_1141: _vm->_graphicsManager.VISU_ALL(); v11 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); ++v11; } while (v11 <= 4); _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(3) != 100); + } while (_vm->_objectsManager.BOBPOSI(3) != 100); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.FIN_VISU(); if (!_vm->_globals.CENSURE) { @@ -800,6 +814,9 @@ LABEL_1141: _vm->_graphicsManager.VISU_ALL(); v12 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); ++v12; } while (v12 <= 4); @@ -863,9 +880,12 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); if (v76 == 35) { if (!_vm->_soundManager.SOUNDOFF) { - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_soundManager.SOUND_FLAG); + } while (_vm->_soundManager.SOUND_FLAG); } _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); } @@ -877,6 +897,9 @@ LABEL_1141: _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); _vm->_objectsManager.NUMZONE = -1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -887,6 +910,9 @@ LABEL_1141: _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); v15 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = 1; @@ -948,6 +974,9 @@ LABEL_1141: _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); _vm->_globals.NOT_VERIF = 1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -957,6 +986,9 @@ LABEL_1141: v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(7) == 10 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; @@ -993,6 +1025,9 @@ LABEL_1141: v19 = 41; v20 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); v20 = 1; @@ -1029,6 +1064,9 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(12) == 4 && !v21) { _vm->_soundManager.PLAY_WAV(1); v21 = 1; @@ -1068,6 +1106,9 @@ LABEL_1141: _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); _vm->_globals.NOT_VERIF = 1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -1081,6 +1122,9 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); v24 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(11) == 4 && !v24) { _vm->_soundManager.PLAY_WAV(1); v24 = 1; @@ -1104,9 +1148,12 @@ LABEL_1141: _vm->_objectsManager.SET_BOBPOSI(5, 0); _vm->_objectsManager.SET_BOBPOSI(6, 0); _vm->_soundManager.PLAY_WAV(3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) != 74); + } while (_vm->_objectsManager.BOBPOSI(5) != 74); _vm->_objectsManager.BOBANIM_OFF(5); _vm->_objectsManager.BOBANIM_OFF(6); _vm->_objectsManager.BOBANIM_ON(9); @@ -1120,15 +1167,21 @@ LABEL_1141: _vm->_objectsManager.SET_BOBPOSI(10, 0); _vm->_objectsManager.SET_BOBPOSI(12, 0); _vm->_objectsManager.SPRITE_OFF(0); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(9) != 15); + } while (_vm->_objectsManager.BOBPOSI(9) != 15); _vm->_objectsManager.BOBANIM_OFF(9); _vm->_objectsManager.SPRITE_ON(0); _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(12) != 117); + } while (_vm->_objectsManager.BOBPOSI(12) != 117); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); _vm->_objectsManager.BOBANIM_OFF(12); _vm->_objectsManager.BOBANIM_OFF(10); @@ -1138,9 +1191,12 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_OFF(3); _vm->_objectsManager.BOBANIM_ON(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) != 6); + } while (_vm->_objectsManager.BOBPOSI(5) != 6); _vm->_objectsManager.BOBANIM_OFF(5); _vm->_objectsManager.BOBANIM_ON(6); _vm->_objectsManager.OBSSEUL = 1; @@ -1156,6 +1212,9 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v25 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(1) == 1 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; @@ -1195,6 +1254,9 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); v26 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(1) == 1 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; @@ -1302,6 +1364,9 @@ LABEL_1141: } _vm->_globals.NOT_VERIF = 1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -1312,6 +1377,9 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(4); v33 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(4) == 9 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; @@ -1338,6 +1406,9 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(6); v34 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(6) == 9 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; @@ -1364,6 +1435,9 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(5); v35 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(5) == 9 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; @@ -1397,21 +1471,33 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(4) != 10); + } while (_vm->_objectsManager.BOBPOSI(4) != 10); _vm->_soundManager.PLAY_WAV(1); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(4) != 18); + } while (_vm->_objectsManager.BOBPOSI(4) != 18); _vm->_soundManager.PLAY_WAV(2); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(4) != 62); + } while (_vm->_objectsManager.BOBPOSI(4) != 62); _vm->_soundManager.PLAY_WAV(3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(4) != 77); + } while (_vm->_objectsManager.BOBPOSI(4) != 77); _vm->_objectsManager.BOBANIM_OFF(4); _vm->_objectsManager.SPRITE_ON(0); } @@ -1422,21 +1508,33 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) != 10); + } while (_vm->_objectsManager.BOBPOSI(5) != 10); _vm->_soundManager.PLAY_WAV(1); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) != 18); + } while (_vm->_objectsManager.BOBPOSI(5) != 18); _vm->_soundManager.PLAY_WAV(2); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) != 38); + } while (_vm->_objectsManager.BOBPOSI(5) != 38); _vm->_soundManager.PLAY_WAV(3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) != 53); + } while (_vm->_objectsManager.BOBPOSI(5) != 53); _vm->_objectsManager.BOBANIM_OFF(5); _vm->_objectsManager.SPRITE_ON(0); } @@ -1472,6 +1570,9 @@ LABEL_1141: _vm->_graphicsManager.FADE_OUTW(); v36 = 1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); ++v36; } while (v36 <= 39); @@ -1499,6 +1600,9 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -1512,9 +1616,12 @@ LABEL_1141: _vm->_objectsManager.SETANISPR(0, 60); _vm->_objectsManager.BOBANIM_OFF(4); _vm->_objectsManager.BOBANIM_ON(1); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(1) != 9); + } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.BOBANIM_OFF(1); _vm->_globals.NO_VISU = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -1525,23 +1632,32 @@ LABEL_1141: _vm->_objectsManager.NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.SETANISPR(0, 64); _vm->_objectsManager.BOBANIM_ON(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(2) != 10); + } while (_vm->_objectsManager.BOBPOSI(2) != 10); _vm->_objectsManager.BOBANIM_OFF(2); _vm->_objectsManager.BOBANIM_ON(4); } if (v76 == 201) { _vm->_objectsManager.BOBANIM_ON(3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(3) != 18); + } while (_vm->_objectsManager.BOBPOSI(3) != 18); _vm->_objectsManager.BOBANIM_OFF(3); _vm->_objectsManager.BOBANIM_ON(4); } @@ -1550,6 +1666,9 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(4); do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(4) == 18) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); @@ -1564,6 +1683,9 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); v41 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { _vm->_soundManager.PLAY_WAV(1); v41 = 1; @@ -1581,6 +1703,9 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); v42 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(4) == 10 && !v42) { _vm->_soundManager.PLAY_WAV(1); v42 = 1; @@ -1599,26 +1724,38 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(10); _vm->_objectsManager.BOB_OFFSET(10, 300); _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(10) != 7); + } while (_vm->_objectsManager.BOBPOSI(10) != 7); _vm->_objectsManager.BOBANIM_ON(6); _vm->_objectsManager.BOBANIM_OFF(3); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(6) != 10); + } while (_vm->_objectsManager.BOBPOSI(6) != 10); _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); _vm->_objectsManager.BOBANIM_ON(7); _vm->_objectsManager.BOBANIM_OFF(4); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(7) != 15); + } while (_vm->_objectsManager.BOBPOSI(7) != 15); _vm->_objectsManager.BOBANIM_OFF(5); _vm->_objectsManager.BOBANIM_ON(8); _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(8) != 76); + } while (_vm->_objectsManager.BOBPOSI(8) != 76); _vm->_objectsManager.BOBANIM_OFF(6); _vm->_objectsManager.BOBANIM_OFF(7); _vm->_objectsManager.BOBANIM_OFF(8); @@ -1648,6 +1785,9 @@ LABEL_1141: _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); _vm->_globals.NOT_VERIF = 1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -1655,6 +1795,9 @@ LABEL_1141: v45 = 0; _vm->_objectsManager.BOBANIM_ON(7); do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(7) == 9 && !v45) { v45 = 1; _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); @@ -1675,15 +1818,21 @@ LABEL_1141: _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(12); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(12) != 6); + } while (_vm->_objectsManager.BOBPOSI(12) != 6); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); _vm->_globals.NOPARLE = 0; - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(12) != 12); + } while (_vm->_objectsManager.BOBPOSI(12) != 12); _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.BOBANIM_OFF(12); _vm->_globals.CACHE_ON(); @@ -1694,6 +1843,9 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(11); v46 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(11) == 10 && !v46) v46 = 1; @@ -1701,9 +1853,12 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_OFF(11); _vm->_globals.CACHE_ON(); _vm->_objectsManager.BOBANIM_ON(13); - do + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(13) != 48); + } while (_vm->_objectsManager.BOBPOSI(13) != 48); _vm->_globals.NOPARLE = 1; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals.NOPARLE = 0; @@ -1816,6 +1971,9 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(1); v50 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(1) == 12 && !v50) { _vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); @@ -1841,6 +1999,9 @@ LABEL_1141: _vm->_soundManager.VOICE_MIX(617, 4); v71 = 0; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_eventsManager.VBL(); ++v71; } while (v71 <= 29); @@ -1908,6 +2069,9 @@ LABEL_1141: v52 = 0; _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); do { + if (_vm->shouldQuit()) + return -1; // Exiting game + if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { _vm->_soundManager.PLAY_WAV(1); v52 = 1; @@ -2136,6 +2300,9 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -2157,6 +2324,9 @@ LABEL_1141: _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; do { + if (_vm->shouldQuit()) + return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); @@ -2247,6 +2417,9 @@ int ScriptManager::Control_If(const byte *dataP, int a2) { LABEL_2: v3 = v2; do { + if (_vm->shouldQuit()) + return 0; // Exiting game + ++v3; v4 = Traduction2(dataP + 20 * v3); if (v3 > 400) { @@ -2259,6 +2432,9 @@ LABEL_2: v6 = v2; v7 = 0; do { + if (_vm->shouldQuit()) + return 0; // Exiting game + ++v6; if (Traduction2(dataP + 20 * v6) == 3) v7 = 1; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 6dcebecde2..6b00c12ca1 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1035,6 +1035,9 @@ LABEL_2: v13 = 1; do { v10 = _vm->_scriptManager.Traduction(ptr + 20 * v13); + if (_vm->shouldQuit()) + return; + if (v10 == 2) v13 = _vm->_scriptManager.Control_Goto(ptr + 20 * v13); if (v10 == 3) -- cgit v1.2.3 From c9f9527ad9b08682ec32496b213e47759eaa83f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Oct 2012 00:05:56 +1100 Subject: HOPKINS: Another shouldQuit() check in PERSONAGE --- engines/hopkins/objects.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 436996c1e0..0b3fe161c0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -5650,7 +5650,10 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s continue; } v5 = 1; - } while (v5 != 1); + } while (!_vm->shouldQuit() && v5 != 1); + if (_vm->shouldQuit()) + return; + _vm->_graphicsManager.FADE_OUTW(); if (!s3.empty()) _vm->_graphicsManager.FIN_VISU(); -- cgit v1.2.3 From 5faf827f151e714a885b756ff20a8b6e9818b104 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Oct 2012 00:28:25 +1100 Subject: HOPKINS: Fix for restoring screen when returning from close-ups --- engines/hopkins/talk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 6b00c12ca1..a6c7445f0a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1306,7 +1306,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; - _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = 0; -- cgit v1.2.3 From 9d18e3fa59658a58e46deba75a0a231389ffd2f6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 28 Oct 2012 22:38:34 +0100 Subject: HOPKINS: Replace some 0/1 by false/true for boolean variables --- engines/hopkins/anim.cpp | 18 +++--- engines/hopkins/dialogs.cpp | 4 +- engines/hopkins/events.cpp | 8 +-- engines/hopkins/globals.cpp | 6 +- engines/hopkins/graphics.cpp | 12 ++-- engines/hopkins/hopkins.cpp | 27 +++++---- engines/hopkins/menu.cpp | 10 ++-- engines/hopkins/objects.cpp | 84 +++++++++++++------------- engines/hopkins/script.cpp | 136 +++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 33 +++++------ 10 files changed, 170 insertions(+), 168 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 2a85257d6a..661c1762c1 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -103,14 +103,14 @@ LABEL_2: _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; while (!_vm->shouldQuit()) { - if (_vm->_eventsManager.ESC_KEY == 1) + if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_58; - if (REDRAW_ANIM() == 1) + if (REDRAW_ANIM() == true) break; _vm->_eventsManager.CONTROLE_MES(); if (_vm->_eventsManager.lItCounter >= rate1) @@ -168,8 +168,8 @@ LABEL_38: LABEL_49: if (v4 == -1) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager.ESC_KEY != 1) { - if (REDRAW_ANIM() == 1) + while (_vm->_eventsManager.ESC_KEY != true) { + if (REDRAW_ANIM() == true) goto LABEL_53; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -983,7 +983,7 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin v16 = 0; v15 = 0; v17 = 1; - _vm->_eventsManager.souris_flag = 0; + _vm->_eventsManager.souris_flag = false; if (!NO_COUL) { _vm->_eventsManager.VBL(); @@ -1120,7 +1120,7 @@ LABEL_59: _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - _vm->_eventsManager.souris_flag = 1; + _vm->_eventsManager.souris_flag = true; } if (v7 == 1) _vm->_globals.dos_free2(ptr); @@ -1155,7 +1155,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, v17 = 0; v16 = 0; v18 = 1; - _vm->_eventsManager.souris_flag = 0; + _vm->_eventsManager.souris_flag = false; v10 = _vm->_graphicsManager.VESA_SCREEN; v11 = _vm->_globals.dos_malloc2(0x16u); _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a1); @@ -1334,7 +1334,7 @@ LABEL_54: f.close(); _vm->_globals.dos_free2(v11); - _vm->_eventsManager.souris_flag = 1; + _vm->_eventsManager.souris_flag = true; } } // End of namespace Hopkins diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 9285ae6a81..28baa319e7 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -318,7 +318,7 @@ void DialogsManager::showInventory() { LABEL_7: _vm->_eventsManager.souris_bb = 0; _vm->_eventsManager.souris_b = 0; - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); switch (_vm->_globals.FR) { @@ -470,7 +470,7 @@ LABEL_7: _vm->_objectsManager.cady = 0; _vm->_objectsManager.old_cadx = 0; _vm->_objectsManager.cadx = 0; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; _vm->_graphicsManager.no_scroll = 0; } } diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index dbdd0fce81..dc667d5d28 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -310,7 +310,7 @@ void EventsManager::VBL() { } _vm->_graphicsManager.DD_Unlock(); } - if (souris_flag == 1) { + if (souris_flag == true) { v1 = 20; if (!mouse_linux) v1 = 10; @@ -356,7 +356,7 @@ LABEL_34: LABEL_35: if (!_vm->_globals.PUBEXIT) _vm->_objectsManager.AFF_SPRITES(); - if (souris_flag != 1) + if (souris_flag != true) goto LABEL_54; if (btsouris == 23) goto LABEL_45; @@ -392,7 +392,7 @@ LABEL_54: checkForNextFrameCounter(); while (CASSE || _vm->_globals.iRegul != 1) { - if (CASSE != 1) + if (CASSE != true) goto LABEL_63; if (lItCounter > 1) goto LABEL_65; @@ -474,7 +474,7 @@ LABEL_65: } souris_bb = souris_b; souris_b = 0; - if (souris_flag == 1) { + if (souris_flag == true) { if (btsouris != 23) { if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { /* Commented out in favour of using ScummVM cursor display diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a25f962949..6809faa0d6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -508,16 +508,16 @@ void Globals::RESET_CACHE() { Cache[idx].field14 = 0; } - CACHEFLAG = 0; + CACHEFLAG = false; } void Globals::CACHE_ON() { - CACHEFLAG = 1; + CACHEFLAG = true; } // TODO: Find why some calls have a parameter value void Globals::CACHE_OFF(int v1) { - CACHEFLAG = 0; + CACHEFLAG = false; } void Globals::CACHE_SUB(int idx) { diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 519c193235..f24955b9ec 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -104,9 +104,9 @@ void GraphicsManager::SET_MODE(int width, int height) { SDL_ECHELLE = _vm->_globals.XZOOM; int bpp = 8; - if (_vm->_globals.XFORCE8 == 1) + if (_vm->_globals.XFORCE8 == true) bpp = 8; - if (_vm->_globals.XFORCE16 == 1) + if (_vm->_globals.XFORCE16 == true) bpp = 16; if (SDL_ECHELLE) { @@ -1547,7 +1547,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (bloc.field0 != 1) continue; - if (_vm->_eventsManager.CASSE != 0) { + if (_vm->_eventsManager.CASSE != false) { if (Winbpp == 1) { Copy_Vga(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); } else if (Winbpp == 2) { @@ -2311,14 +2311,14 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { if (!_vm->_globals.NOSPRECRAN) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.RECHERCHE_CAT(v13, 8); if (_vm->_globals.SPRITE_ECRAN) { - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); } else { - _vm->_globals.CAT_FLAG = 1; + _vm->_globals.CAT_FLAG = true; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); } _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; } } if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2929161c68..e3fe6e99c5 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -555,11 +555,14 @@ void HopkinsEngine::INIT_SYSTEM() { case 0: if (!_eventsManager.mouse_linux) _fileManager.CONSTRUIT_SYSTEM("SOUAN.SPR"); - if (!_globals.FR && _eventsManager.mouse_linux) + else _fileManager.CONSTRUIT_SYSTEM("LSOUAN.SPR"); break; case 1: - _fileManager.CONSTRUIT_SYSTEM("LSOUFR.SPR"); + if (!_eventsManager.mouse_linux) + _fileManager.CONSTRUIT_SYSTEM("SOUFR.SPR"); + else + _fileManager.CONSTRUIT_SYSTEM("LSOUFR.SPR"); break; case 2: _fileManager.CONSTRUIT_SYSTEM("SOUES.SPR"); @@ -639,7 +642,7 @@ void HopkinsEngine::INTRORUN() { memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE); _eventsManager.VBL(); - _eventsManager.souris_flag = 0; + _eventsManager.souris_flag = false; _globals.iRegul = 1; _eventsManager.VBL(); _soundManager.WSOUND(16); @@ -668,14 +671,14 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _globals.BPP_NOAFF = 1; + _globals.BPP_NOAFF = true; v2 = 0; do { _eventsManager.VBL(); ++v2; } while (v2 <= 4); - _globals.BPP_NOAFF = 0; + _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); if (_graphicsManager.DOUBLE_ECRAN == 1) { @@ -719,7 +722,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _globals.BPP_NOAFF = 1; + _globals.BPP_NOAFF = true; v5 = 0; do { @@ -727,7 +730,7 @@ void HopkinsEngine::INTRORUN() { ++v5; } while (v5 <= 4); - _globals.BPP_NOAFF = 0; + _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); for (i = 0; i < 200 / _globals.vitesse; ++i) @@ -769,7 +772,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _globals.BPP_NOAFF = 1; + _globals.BPP_NOAFF = true; v8 = 0; do { @@ -777,7 +780,7 @@ void HopkinsEngine::INTRORUN() { ++v8; } while (v8 <= 3); - _globals.BPP_NOAFF = 0; + _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); v9 = 0; @@ -942,13 +945,13 @@ void HopkinsEngine::BOOM() { _animationManager.CHARGE_ANIM("ANIM15"); _graphicsManager.VISU_ALL(); _objectsManager.BOBANIM_OFF(7); - _globals.BPP_NOAFF = 1; + _globals.BPP_NOAFF = true; for (int idx = 0; idx < 5; ++idx) { _eventsManager.VBL(); } - _globals.BPP_NOAFF = 0; + _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _eventsManager.MOUSE_OFF(); @@ -980,7 +983,7 @@ void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = 1; _graphicsManager.RESET_SEGMENT_VESA(); _globals.FORET = 0; - _eventsManager.CASSE = 0; + _eventsManager.CASSE = false; _globals.DESACTIVE_INVENT = true; _globals.FLAG_VISIBLE = false; _graphicsManager.LOAD_IMAGE("BOX"); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 8722b9e5d8..b657d83fc5 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -55,9 +55,9 @@ int MenuManager::MENU() { v6 = 0; while (!g_system->getEventManager()->shouldQuit()) { _vm->_globals.FORET = 0; - _vm->_eventsManager.CASSE = 0; - _vm->_globals.DESACTIVE_INVENT = 1; - _vm->_globals.FLAG_VISIBLE = 0; + _vm->_eventsManager.CASSE = false; + _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals.FLAG_VISIBLE = false; _vm->_globals.SORTIE = 0; for (int idx = 0; idx < 31; ++idx) @@ -227,8 +227,8 @@ int MenuManager::MENU() { } _vm->_globals.LIBERE_FICHIER(spriteData); - _vm->_globals.DESACTIVE_INVENT = 0; - _vm->_globals.FLAG_VISIBLE = 0; + _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals.FLAG_VISIBLE = false; _vm->_graphicsManager.FADE_OUTW(); return v6; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0b3fe161c0..a611517d1f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1780,14 +1780,14 @@ LABEL_54: _vm->_globals.old_x_69 = v0; _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; - if (_vm->_globals.NOMARCHE == 1) { + if (_vm->_globals.NOMARCHE == true) { if (_vm->_eventsManager.btsouris == 4) { v1 = v4 + 1; if ((uint16)(v4 + 1) > 1u) BTDROITE(); } } - if ((_vm->_globals.PLAN_FLAG == 1 && v4 == -1) || !v4) { + if ((_vm->_globals.PLAN_FLAG == true && v4 == -1) || !v4) { verbe = 0; _vm->_eventsManager.btsouris = 0; _vm->_eventsManager.CHANGE_MOUSE(0); @@ -2628,9 +2628,9 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.Max_Propre_Gen = 1; _vm->_globals.Max_Perso_Y = 440; _vm->_globals.NOSPRECRAN = 1; - _vm->_globals.PLAN_FLAG = 1; + _vm->_globals.PLAN_FLAG = true; _vm->_graphicsManager.NOFADE = false; - _vm->_globals.NOMARCHE = 0; + _vm->_globals.NOMARCHE = false; sprite_ptr = g_PTRNUL; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; @@ -2673,7 +2673,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_globals.BPP_NOAFF = 1; + _vm->_globals.BPP_NOAFF = true; v4 = 0; do { @@ -2681,7 +2681,7 @@ void ObjectsManager::PLAN_BETA() { ++v4; } while (v4 <= 4); - _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; _vm->_graphicsManager.FADE_INW(); _vm->_eventsManager.CHANGE_MOUSE(4); @@ -2699,9 +2699,9 @@ void ObjectsManager::PLAN_BETA() { } if (_vm->_globals.SAUVEGARDE->data[svField180] == 1 && !_vm->_globals.SAUVEGARDE->data[svField172]) { _vm->_globals.SAUVEGARDE->data[svField172] = 1; - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; v5 = 0; _vm->_eventsManager.souris_bb = false; } @@ -2732,7 +2732,7 @@ void ObjectsManager::PLAN_BETA() { sprite_ptr = _vm->_globals.LIBERE_FICHIER(sprite_ptr); CLEAR_ECRAN(); _vm->_globals.NOSPRECRAN = 0; - _vm->_globals.PLAN_FLAG = 0; + _vm->_globals.PLAN_FLAG = false; } // Left Button @@ -2802,7 +2802,7 @@ void ObjectsManager::BTGAUCHE() { return; } } - if (_vm->_globals.PLAN_FLAG == 1) { + if (_vm->_globals.PLAN_FLAG == true) { if (_vm->_globals.GOACTION != 1) goto LABEL_38; VERIFZONE(); @@ -2829,7 +2829,7 @@ void ObjectsManager::BTGAUCHE() { _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == 1 && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG == true && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) return; if ((uint16)(NUMZONE + 1) > 1u) { zoneCount = NUMZONE; @@ -2893,7 +2893,7 @@ LABEL_63: _vm->_globals.chemin = v9; } LABEL_65: - if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == 1) { + if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == true) { v17 = YSPR(0); v18 = XSPR(0); _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); @@ -2903,7 +2903,7 @@ LABEL_65: // TODO: Reformat the weird if statement generated by the decompiler if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) _vm->_globals.SAUVEGARDE->data[svField1] = 5; - if (_vm->_globals.PLAN_FLAG == 1) + if (_vm->_globals.PLAN_FLAG == true) _vm->_globals.SAUVEGARDE->data[svField1] = 6; _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; @@ -3024,11 +3024,11 @@ LABEL_64: _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } - if (_vm->_globals.PLAN_FLAG == 1) { + if (_vm->_globals.PLAN_FLAG == true) { _vm->_eventsManager.btsouris = 0; _vm->_eventsManager.CHANGE_MOUSE(0); } - if (_vm->_globals.NOMARCHE == 1) { + if (_vm->_globals.NOMARCHE == true) { if (_vm->_eventsManager.btsouris == 4) { result = NUMZONE + 1; if ((uint16)(NUMZONE + 1) > 1u) @@ -4261,9 +4261,9 @@ void ObjectsManager::SPECIAL_JEU() { if (YSPR(0) <= 399) { if (!_vm->_globals.SAUVEGARDE->data[svField173]) { _vm->_globals.SAUVEGARDE->data[svField173] = 1; - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; if (!_vm->_globals.CENSURE) { v1 = _vm->_globals.dos_malloc2(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); @@ -4326,7 +4326,7 @@ void ObjectsManager::SPECIAL_JEU() { && YSPR(0) > 372 && YSPR(0) <= 398; if (_vm->_globals.ECRAN == 57) { - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { BOBANIM_OFF(5); SET_BOBPOSI(5, 0); @@ -4342,18 +4342,18 @@ void ObjectsManager::SPECIAL_JEU() { ZONE_ON(14); _vm->_globals.SAUVEGARDE->data[svField261] = 3; } - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; } if (_vm->_globals.ECRAN == 93 && !_vm->_globals.SAUVEGARDE->data[svField333]) { - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; do _vm->_eventsManager.VBL(); while (BOBPOSI(8) != 3); - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); BOBANIM_OFF(8); _vm->_globals.SAUVEGARDE->data[svField333] = 1; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; } } @@ -4747,15 +4747,15 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.RECHERCHE_CAT(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); } else { - _vm->_globals.CAT_FLAG = 1; + _vm->_globals.CAT_FLAG = true; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); } _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; v36 = 60; v37 = ptr + 1000; v40 = 0; @@ -4954,35 +4954,35 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { } if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { _vm->_eventsManager.souris_n = 4; - _vm->_globals.BPP_NOAFF = 1; + _vm->_globals.BPP_NOAFF = true; v3 = 0; do { _vm->_eventsManager.VBL(); ++v3; } while (v3 <= 4); - _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); _vm->_globals.iRegul = 1; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; _vm->_graphicsManager.NOFADE = 1; - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); _vm->_graphicsManager.NOFADE = 1; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; } if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_globals.BPP_NOAFF = 1; + _vm->_globals.BPP_NOAFF = true; v4 = 0; do { _vm->_eventsManager.VBL(); ++v4; } while (v4 <= 4); - _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); SPRITE_ON(0); v5 = 0; @@ -5017,7 +5017,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { ++v7; } while (v7 <= 3); _vm->_graphicsManager.NOFADE = 1; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; } } @@ -5573,11 +5573,11 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_dialogsManager.VIRE_INVENT = false; _vm->_graphicsManager.ofscroll = 0; - _vm->_globals.PLAN_FLAG = 0; + _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOMARCHE = 1; + _vm->_globals.NOMARCHE = true; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; _vm->_globals.AFFIVBL = 0; @@ -5606,13 +5606,13 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_eventsManager.CHANGE_MOUSE(4); - _vm->_globals.BPP_NOAFF = 1; + _vm->_globals.BPP_NOAFF = true; v6 = 0; do { _vm->_eventsManager.VBL(); ++v6; } while (v6 <= 4); - _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.ECRAN == 61) { _vm->_animationManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); @@ -5675,9 +5675,9 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; _vm->_dialogsManager.VIRE_INVENT = false; - _vm->_globals.PLAN_FLAG = 0; + _vm->_globals.PLAN_FLAG = false; _vm->_graphicsManager.NOFADE = 0; - _vm->_globals.NOMARCHE = 0; + _vm->_globals.NOMARCHE = false; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; _vm->_globals.AFFIVBL = 0; @@ -5745,13 +5745,13 @@ LABEL_70: g_old_y = PERY; _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.BPP_NOAFF = 1; + _vm->_globals.BPP_NOAFF = true; for (int idx = 0; idx < 5; ++idx) { _vm->_eventsManager.VBL(); } - _vm->_globals.BPP_NOAFF = 0; + _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_INW(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c103261129..822165f4ce 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -647,21 +647,21 @@ LABEL_1141: _vm->_graphicsManager.FADE_INS(); } if (v76 == 601) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(2, 0, 16, 4); } if (v76 == 602) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(4, 0, 16, 4); } if (v76 == 603) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; @@ -675,9 +675,9 @@ LABEL_1141: _vm->_globals.SORTIE = 151; } if (v76 == 604) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; if (_vm->_globals.SVGA == 1) @@ -690,9 +690,9 @@ LABEL_1141: _vm->_globals.SORTIE = 151; } if (v76 == 605) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); _vm->_graphicsManager.FADE_OUTS(); _vm->_soundManager.SPECIAL_SOUND = 199; @@ -707,9 +707,9 @@ LABEL_1141: _vm->_globals.SORTIE = 151; } if (v76 == 606) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); @@ -770,7 +770,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("fjour.pe2"); if (v76 == 13) { _vm->_eventsManager.souris_b = _vm->_eventsManager.souris_bb; - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); @@ -829,7 +829,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; _vm->_globals.HELICO = 1; } if (v76 == 36) { @@ -868,9 +868,9 @@ LABEL_1141: _vm->_graphicsManager.NOFADE = 1; } if (v76 == 29) { - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; } if (v76 == 22) _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); @@ -1561,7 +1561,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_globals.CACHE_OFF(); _vm->_animationManager.NO_SEQ = 1; - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_soundManager.SPECIAL_SOUND = 211; _vm->_animationManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; @@ -1584,7 +1584,7 @@ LABEL_1141: if (v76 == 207) _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); if (v76 == 208) { - _vm->_globals.DESACTIVE_INVENT = 1; + _vm->_globals.DESACTIVE_INVENT = true; if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; _vm->_eventsManager.NOESC = true; @@ -1608,7 +1608,7 @@ LABEL_1141: } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.SETANISPR(0, 64); _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; } if (v76 == 209) { _vm->_objectsManager.SET_BOBPOSI(1, 0); @@ -1623,7 +1623,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; v39 = _vm->_objectsManager.YSPR(0); @@ -1662,7 +1662,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(4); } if (v76 == 203) { - _vm->_globals.NO_VISU = 1; + _vm->_globals.NO_VISU = true; _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(4); do { @@ -1674,7 +1674,7 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); } while (_vm->_objectsManager.BOBPOSI(4) != 26); _vm->_objectsManager.BOBANIM_OFF(4); - _vm->_globals.NO_VISU = 0; + _vm->_globals.NO_VISU = false; _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 204) { @@ -1824,9 +1824,9 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 6); - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1859,18 +1859,18 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(13) != 48); - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.BOBANIM_OFF(13); _vm->_graphicsManager.NOFADE = 1; _vm->_globals.SORTIE = 94; } if (v76 == 52) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 53) _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); @@ -2049,9 +2049,9 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField231] == 1) { _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); } else { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } } if (v76 == 51) { @@ -2112,40 +2112,40 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); } if (v76 == 58) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); _vm->_globals.SAUVEGARDE->data[svField176] = 1; _vm->_globals.SAUVEGARDE->data[svField270] = 2; - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 200) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 84) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 98) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 83) _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); if (v76 == 32) _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); if (v76 == 215) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("aviat.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 216) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 170) _vm->_talkManager.PARLER_PERSO("GRED.pe2"); @@ -2154,9 +2154,9 @@ LABEL_1141: if (v76 == 100) _vm->_talkManager.PARLER_PERSO("tourist.pe2"); if (v76 == 103) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM2("T421.ANM", 100, 14, 500); if (_vm->_globals.SVGA == 2) @@ -2164,49 +2164,49 @@ LABEL_1141: _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 104) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 108) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("peche1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 109) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("peche2.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 110) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("peche3.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 111) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("peche4.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 112) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("teint1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 176) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("gred2.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 177) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } if (v76 == 113) _vm->_talkManager.PARLER_PERSO("teint.pe2"); @@ -2285,9 +2285,9 @@ LABEL_1141: if (v76 == 241) _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); if (v76 == 171) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("gred1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); _vm->_globals.g_old_sens = -1; @@ -2309,9 +2309,9 @@ LABEL_1141: _vm->_globals.SORTIE = 59; } if (v76 == 173) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); _vm->_globals.g_old_sens = -1; @@ -2335,9 +2335,9 @@ LABEL_1141: if (v76 == 174) _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); if (v76 == 202) { - _vm->_globals.NOPARLE = 1; + _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; } v1 = 1; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index a6c7445f0a..525e2892ce 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -60,7 +60,6 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { byte *v9; byte *v10; int v11; - byte v13; int v14; int v15; Common::String v16; @@ -70,8 +69,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_fontManager.TEXTE_OFF(9); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 1; - v13 = _vm->_globals.DESACTIVE_INVENT; - _vm->_globals.DESACTIVE_INVENT = 1; + bool old_DESACTIVE_INVENT = _vm->_globals.DESACTIVE_INVENT; + _vm->_globals.DESACTIVE_INVENT = true; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -95,14 +94,14 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v16, 7); if (PERSOSPR) { - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v16); } else { - _vm->_globals.CAT_FLAG = 1; + _vm->_globals.CAT_FLAG = true; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) @@ -135,14 +134,14 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_eventsManager.VBL(); } while (v5 != v4); } - if (_vm->_globals.NOPARLE == 1) { + if (_vm->_globals.NOPARLE == true) { v6 = 1; do v7 = DIALOGUE_REP(v6++); while (v7 != -1); } CLEAR_ANIM_PERSO(); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = 1; BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); @@ -182,7 +181,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v8 = v8 + 2; *v8 = *(v9 + 2); v10 = v8 + 1; - _vm->_globals.DESACTIVE_INVENT = v13; + _vm->_globals.DESACTIVE_INVENT = old_DESACTIVE_INVENT; _vm->_graphicsManager.DD_VBL(); v11 = 0; do { @@ -1228,14 +1227,14 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { } PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v23, 7); if (PERSOSPR) { - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v23); } else { - _vm->_globals.CAT_FLAG = 1; + _vm->_globals.CAT_FLAG = true; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = 0; + _vm->_globals.CAT_FLAG = false; _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) @@ -1254,7 +1253,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { CHERCHE_ANIM0(v10, 0); v11 = _vm->_globals.COUCOU; _vm->_globals.COUCOU = g_PTRNUL; - _vm->_globals.NOMARCHE = 1; + _vm->_globals.NOMARCHE = true; _vm->_objectsManager.INILINK(v22); _vm->_objectsManager.PERSO_ON = 1; _vm->_globals.GOACTION = 0; @@ -1263,7 +1262,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { VISU_PARLE(); VISU_WAIT(); _vm->_graphicsManager.INI_ECRAN2(v22); - _vm->_globals.NOMARCHE = 1; + _vm->_globals.NOMARCHE = true; _vm->_objectsManager.FORCEZONE = 1; _vm->_objectsManager.NUMZONE = -1; do { @@ -1283,7 +1282,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { FIN_VISU_WAIT(); CLEAR_ANIM_PERSO(); CLEAR_ANIM_PERSO(); - _vm->_globals.NOPARLE = 0; + _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = 1; BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); @@ -1302,7 +1301,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.INILINK(v20); _vm->_graphicsManager.INI_ECRAN2(v20); _vm->_objectsManager.DESACTIVE = 0; - _vm->_globals.NOMARCHE = 0; + _vm->_globals.NOMARCHE = false; if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; @@ -1339,7 +1338,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { v14 = v14 + 2; *v14 = *(v15 + 2); v16 = v14 + 1; - _vm->_globals.DESACTIVE_INVENT = 0; + _vm->_globals.DESACTIVE_INVENT = false; _vm->_graphicsManager.DD_VBL(); v17 = 0; do { -- cgit v1.2.3 From 60699f1af70ed6368c74822b41e0e55f6d2d24dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Oct 2012 09:03:11 +1100 Subject: HOPKINS: Fixed NULL case in OBJET_VIVANT --- engines/hopkins/talk.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index a6c7445f0a..64a29736d5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1177,7 +1177,6 @@ void TalkManager::REPONSE2(int a1, int a2) { void TalkManager::OBJET_VIVANT(const Common::String &a2) { int v2; - Common::String v3; const char *v4; int v5; bool v6; @@ -1217,12 +1216,11 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { } RENVOIE_FICHIER(40, v23, (const char *)BUFFERPERSO); RENVOIE_FICHIER(0, v22, (const char *)BUFFERPERSO); - v3 = v20; RENVOIE_FICHIER(20, v20, (const char *)BUFFERPERSO); v4 = "NULL"; v5 = 5; - v6 = v3 != v4; + v6 = v20 != v4; if (!v6) { v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); } -- cgit v1.2.3 From 4e4507331ddb28d3fd6c89c7c7d799b9fa5bf53d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Oct 2012 22:30:08 +1100 Subject: HOPKINS: Fix SCBOB method. This fixes cropping issues with sprites moving into areas they are supposed to be behind. --- engines/hopkins/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a611517d1f..1896aa7f3f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -758,8 +758,8 @@ void ObjectsManager::SCBOB(int idx) { if (!_vm->_globals.Bob[v8].field34) { if ( _vm->_globals.Bob[v8].frameIndex != 250) { v2 = _vm->_globals.Bob[v8].oldWidth; - v9 = _vm->_globals.Bob[v8].oldX2 + _vm->_globals.Bob[v8].oldWidth; - v6 = _vm->_globals.Bob[v8].oldY2 + _vm->_globals.Bob[v8].oldHeight; + v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; + v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; v3 =_vm->_globals.Cache[idx].field0; v4 =_vm->_globals.Cache[idx].field4; v7 =_vm->_globals.Cache[idx].field6 + v3; -- cgit v1.2.3 From c078f3d3a74f2ce26e129a225a07713614a70bf0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Oct 2012 22:41:06 +1100 Subject: HOPKINS: Locals renaming in menu.cpp --- engines/hopkins/menu.cpp | 102 +++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b657d83fc5..fc88bd7e4c 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -45,14 +45,14 @@ int MenuManager::MENU() { byte *spriteData = NULL; MenuSelection menuIndex; Common::Point mousePos; - signed int v6; - int v7; - int v8; - int v9; - int v10; - int v11; + signed int result; + int frame5Index; + int frame4Index; + int frame3Index; + int frame2Index; + int frame1Index; - v6 = 0; + result = 0; while (!g_system->getEventManager()->shouldQuit()) { _vm->_globals.FORET = 0; _vm->_eventsManager.CASSE = false; @@ -65,11 +65,11 @@ int MenuManager::MENU() { memset(_vm->_globals.SAUVEGARDE, 0, 2000); _vm->_objectsManager.AJOUTE_OBJET(14); - v7 = 0; - v8 = 0; - v9 = 0; - v10 = 0; - v11 = 0; + frame5Index = 0; + frame4Index = 0; + frame3Index = 0; + frame2Index = 0; + frame1Index = 0; if (_vm->_globals.FR == 0) @@ -122,53 +122,53 @@ int MenuManager::MENU() { switch (menuIndex) { case MENU_NONE: - v11 = 0; - v10 = 0; - v9 = 0; - v8 = 0; - v7 = 0; + frame1Index = 0; + frame2Index = 0; + frame3Index = 0; + frame4Index = 0; + frame5Index = 0; break; case PLAY_GAME: - v11 = 1; - v10 = 0; - v9 = 0; - v8 = 0; - v7 = 0; + frame1Index = 1; + frame2Index = 0; + frame3Index = 0; + frame4Index = 0; + frame5Index = 0; break; case LOAD_GAME: - v11 = 0; - v10 = 1; - v9 = 0; - v8 = 0; - v7 = 0; + frame1Index = 0; + frame2Index = 1; + frame3Index = 0; + frame4Index = 0; + frame5Index = 0; break; case OPTIONS: - v11 = 0; - v10 = 0; - v9 = 1; - v8 = 0; - v7 = 0; + frame1Index = 0; + frame2Index = 0; + frame3Index = 1; + frame4Index = 0; + frame5Index = 0; break; case INTRODUCTION: - v11 = 0; - v10 = 0; - v9 = 0; - v8 = 1; - v7 = 0; + frame1Index = 0; + frame2Index = 0; + frame3Index = 0; + frame4Index = 1; + frame5Index = 0; break; case QUIT: - v11 = 0; - v10 = 0; - v9 = 0; - v8 = 0; - v7 = 1; + frame1Index = 0; + frame2Index = 0; + frame3Index = 0; + frame4Index = 0; + frame5Index = 1; } - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, v11); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, v10 + 2); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, v9 + 4); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, v8 + 6); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, frame1Index); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, frame2Index + 2); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, frame3Index + 4); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, frame4Index + 6); + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, frame5Index + 8); _vm->_eventsManager.VBL(); if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex != MENU_NONE) @@ -179,7 +179,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - v6 = 1; + result = 1; } if (menuIndex != LOAD_GAME) break; @@ -192,7 +192,7 @@ int MenuManager::MENU() { _vm->_dialogsManager.CHARGE_PARTIE(); if (_vm->_globals.SORTIE != -1) { - v6 = _vm->_globals.SORTIE; + result = _vm->_globals.SORTIE; break; } _vm->_globals.SORTIE = 0; @@ -221,7 +221,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - v6 = -1; + result = -1; } break; } @@ -230,7 +230,7 @@ int MenuManager::MENU() { _vm->_globals.DESACTIVE_INVENT = false; _vm->_globals.FLAG_VISIBLE = false; _vm->_graphicsManager.FADE_OUTW(); - return v6; + return result; } void MenuManager::COMPUT_HOPKINS(int idx) { -- cgit v1.2.3 From a79cf7fa4fdc1c2cf087e1ab3054a36d04d3787e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 29 Oct 2012 22:54:35 +0100 Subject: HOPKINS: Replace some more boolean values --- engines/hopkins/anim.cpp | 74 ++++++++++++++++++++++----------------------- engines/hopkins/dialogs.cpp | 6 ++-- engines/hopkins/events.cpp | 2 +- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 8 ++--- engines/hopkins/objects.cpp | 36 +++++++++++----------- engines/hopkins/script.cpp | 38 +++++++++++------------ 8 files changed, 82 insertions(+), 84 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 661c1762c1..5102a883a6 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -70,7 +70,7 @@ LABEL_2: f.skip(14); f.read(v10, nbytes); - if (CLS_ANM == 1) { + if (CLS_ANM == true) { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); @@ -117,7 +117,7 @@ LABEL_2: goto LABEL_25; } LABEL_53: - if (_vm->_graphicsManager.NOLOCK == 1) + if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_58; _vm->_globals.dos_free2(ptr); f.close(); @@ -184,9 +184,9 @@ LABEL_57: goto LABEL_58; } } - while (!_vm->shouldQuit() && _vm->_eventsManager.ESC_KEY != 1) { - if (REDRAW_ANIM() == 1) { - if (_vm->_graphicsManager.NOLOCK == 1) + while (!_vm->shouldQuit() && _vm->_eventsManager.ESC_KEY != true) { + if (REDRAW_ANIM() == true) { + if (_vm->_graphicsManager.NOLOCK == true) break; _vm->_globals.dos_free2(ptr); f.close(); @@ -240,7 +240,7 @@ LABEL_58: _vm->_graphicsManager.FADE_LINUX = 0; f.close(); _vm->_globals.dos_free2(ptr); - _vm->_graphicsManager.NOLOCK = 0; + _vm->_graphicsManager.NOLOCK = false; } // Play Anim 2 @@ -342,20 +342,20 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; while (1) { - if (_vm->_eventsManager.ESC_KEY == 1) + if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_114; - if (REDRAW_ANIM() == 1) + if (REDRAW_ANIM() == true) break; _vm->_eventsManager.CONTROLE_MES(); if (_vm->_eventsManager.lItCounter >= a2) goto LABEL_48; } - if (_vm->_graphicsManager.NOLOCK == 1) + if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_114; if (v8 == 1) ptr = _vm->_globals.dos_free2(ptr); @@ -373,7 +373,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); @@ -459,9 +459,9 @@ LABEL_77: LABEL_88: if (v5 == -1) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager.ESC_KEY != 1) { - if (REDRAW_ANIM() == 1) { - if (_vm->_graphicsManager.NOLOCK == 1) + while (_vm->_eventsManager.ESC_KEY != true) { + if (REDRAW_ANIM() == true) { + if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_114; if (v8 == 1) ptr = _vm->_globals.dos_free2(ptr); @@ -479,7 +479,7 @@ LABEL_88: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); @@ -524,9 +524,9 @@ LABEL_88: goto LABEL_114; } } - while (_vm->_eventsManager.ESC_KEY != 1) { - if (REDRAW_ANIM() == 1) { - if (_vm->_graphicsManager.NOLOCK == 1) + while (_vm->_eventsManager.ESC_KEY != true) { + if (REDRAW_ANIM() == true) { + if (_vm->_graphicsManager.NOLOCK == true) break; if (v8 == 1) ptr = _vm->_globals.dos_free2(ptr); @@ -544,7 +544,7 @@ LABEL_88: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); @@ -586,7 +586,7 @@ LABEL_88: goto LABEL_77; } LABEL_114: - _vm->_graphicsManager.NOLOCK = 0; + _vm->_graphicsManager.NOLOCK = false; f.close(); if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { @@ -642,7 +642,7 @@ LABEL_114: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); @@ -1040,14 +1040,14 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY == 1) { + if (_vm->_eventsManager.ESC_KEY == true) { if (!_vm->_eventsManager.NOESC) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1070,10 +1070,10 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin f.read(v9, (int16)READ_LE_UINT16(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY == 1) { + if (_vm->_eventsManager.ESC_KEY == true) { if (!_vm->_eventsManager.NOESC) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1102,10 +1102,10 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin } while (v5 != -1); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY == 1) { + if (_vm->_eventsManager.ESC_KEY == true) { if (!_vm->_eventsManager.NOESC) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1113,7 +1113,7 @@ void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uin } _vm->_eventsManager.lItCounter = 0; LABEL_59: - _vm->_graphicsManager.NOLOCK = 0; + _vm->_graphicsManager.NOLOCK = false; f.close(); if (!NO_COUL) { @@ -1205,14 +1205,14 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; while (!_vm->shouldQuit()) { - if (_vm->_eventsManager.ESC_KEY == 1) + if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_54; - if (REDRAW_ANIM() == 1) + if (REDRAW_ANIM() == true) break; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1220,7 +1220,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, goto LABEL_23; } LABEL_48: - if (_vm->_graphicsManager.NOLOCK == 1) + if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_54; if (v7 == 1) ptr = _vm->_globals.dos_free2(ptr); @@ -1268,8 +1268,8 @@ LABEL_33: LABEL_44: if (v4) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager.ESC_KEY != 1) { - if (REDRAW_ANIM() == 1) + while (_vm->_eventsManager.ESC_KEY != true) { + if (REDRAW_ANIM() == true) goto LABEL_48; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1283,9 +1283,9 @@ LABEL_53: goto LABEL_54; } } - while (_vm->_eventsManager.ESC_KEY != 1) { + while (_vm->_eventsManager.ESC_KEY != true) { _vm->_eventsManager.CONTROLE_MES(); - if (REDRAW_ANIM() == 1) + if (REDRAW_ANIM() == true) goto LABEL_48; if (_vm->_eventsManager.lItCounter >= a3) goto LABEL_33; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 28baa319e7..d7b2c9d4d6 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -437,7 +437,7 @@ LABEL_7: } } } - if (VIRE_INVENT == 1) + if (VIRE_INVENT == true) v20 = 1; if (v20 == 1) break; @@ -529,7 +529,7 @@ void DialogsManager::TestForDialogOpening() { if (!INVENTFLAG) { DIALOG_KEY key = _vm->_eventsManager.GAME_KEY; _vm->_eventsManager.GAME_KEY = KEY_NONE; - INVENTFLAG = 1; + INVENTFLAG = true; switch (key) { case KEY_INVENTORY: @@ -548,7 +548,7 @@ void DialogsManager::TestForDialogOpening() { break; } - INVENTFLAG = 0; + INVENTFLAG = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; } } diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index dc667d5d28..0b3d252f57 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -408,7 +408,7 @@ LABEL_63: LABEL_65: _vm->_globals.vitesse = 2; lItCounter = 0; - if (_vm->_graphicsManager.DOUBLE_ECRAN != 1 || _vm->_graphicsManager.no_scroll == 1) { + if (_vm->_graphicsManager.DOUBLE_ECRAN != true || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { if (_vm->_graphicsManager.no_scroll != 2) { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 6809faa0d6..0dd8caec9f 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -221,7 +221,6 @@ Globals::Globals() { VOICEOFF = false; CENSURE = false; GESTE_FLAG = false; - redraw = false; BPP_NOAFF = false; DESACTIVE_INVENT = false; FLAG_VISIBLE = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5bfbd49958..e03bd6e362 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -386,7 +386,6 @@ public: byte *Bufferdecor; byte *ADR_FICHIER_OBJ; byte *PERSO; - bool redraw; int OBJL, OBJH; int Nouv_objet; int HELICO; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index e3fe6e99c5..b935cb4d09 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -646,7 +646,7 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _eventsManager.VBL(); _soundManager.WSOUND(16); - _animationManager.CLS_ANM = 1; + _animationManager.CLS_ANM = true; _animationManager.PLAY_ANM("J1.anm", 12, 12, 50); if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(1, 3); @@ -681,7 +681,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - if (_graphicsManager.DOUBLE_ECRAN == 1) { + if (_graphicsManager.DOUBLE_ECRAN == true) { _graphicsManager.no_scroll = 2; v3 = 0; _graphicsManager.SCROLL = 0; @@ -858,7 +858,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - _animationManager.CLS_ANM = 1; + _animationManager.CLS_ANM = true; _soundManager.WSOUND(3); _soundManager.SPECIAL_SOUND = 1; _animationManager.PLAY_ANM("INTRO1.anm", 10, 24, 18); @@ -878,7 +878,7 @@ void HopkinsEngine::INTRORUN() { return; if (!_eventsManager.ESC_KEY) { - _animationManager.CLS_ANM = 0; + _animationManager.CLS_ANM = false; _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("J4.anm", 12, 12, 1000); } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 1896aa7f3f..ef32ac4fd5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2762,12 +2762,12 @@ void ObjectsManager::BTGAUCHE() { if (!_vm->_dialogsManager.INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { v1 = _vm->_eventsManager.btsouris; - _vm->_dialogsManager.INVENTFLAG = 1; + _vm->_dialogsManager.INVENTFLAG = true; _vm->_dialogsManager.showInventory(); - _vm->_dialogsManager.INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; if (!_vm->_globals.SORTIE) { - _vm->_dialogsManager.INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = false; _vm->_eventsManager.btsouris = v1; } return; @@ -2939,7 +2939,7 @@ void ObjectsManager::PARADISE() { if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { - if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) { + if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) goto LABEL_64; @@ -3735,7 +3735,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager.btsouris = 4; LABEL_24: - if (_vm->_globals.NOMARCHE != 1 || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { + if (_vm->_globals.NOMARCHE != true || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { if (_vm->_eventsManager.btsouris == 4) return; } else { @@ -4275,10 +4275,10 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; PERSO_ON = 1; - _vm->_animationManager.NO_SEQ = 1; - _vm->_animationManager.CLS_ANM = 0; + _vm->_animationManager.NO_SEQ = true; + _vm->_animationManager.CLS_ANM = false; _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); - _vm->_animationManager.NO_SEQ = 0; + _vm->_animationManager.NO_SEQ = false; _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_globals.NECESSAIRE = 1; _vm->_graphicsManager.NB_SCREEN(); @@ -4964,10 +4964,10 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_graphicsManager.FADE_INW(); _vm->_globals.iRegul = 1; _vm->_globals.DESACTIVE_INVENT = false; - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; _vm->_globals.DESACTIVE_INVENT = false; } if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { @@ -5016,7 +5016,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_eventsManager.VBL(); ++v7; } while (v7 <= 3); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; _vm->_globals.DESACTIVE_INVENT = false; } } @@ -5531,7 +5531,7 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.PLAY_ANM("CREVE2.ANM", 100, 24, 500); _vm->_globals.SORTIE = 150; - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; BOB_OFF(1); BOB_OFF(2); BOB_OFF(3); @@ -5569,7 +5569,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s int v9; v5 = 0; - _vm->_dialogsManager.INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_dialogsManager.VIRE_INVENT = false; _vm->_graphicsManager.ofscroll = 0; @@ -5669,14 +5669,14 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & bool breakFlag; int xp, yp; - _vm->_dialogsManager.INVENTFLAG = 0; + _vm->_dialogsManager.INVENTFLAG = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; _vm->_dialogsManager.VIRE_INVENT = false; _vm->_globals.PLAN_FLAG = false; - _vm->_graphicsManager.NOFADE = 0; + _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = 0; @@ -5732,7 +5732,7 @@ LABEL_70: if (_vm->_globals.PERSO_TYPE == 2) SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 20, 127); _vm->_eventsManager.souris_xy(PERX, PERY); - if (_vm->_graphicsManager.DOUBLE_ECRAN == 1) + if (_vm->_graphicsManager.DOUBLE_ECRAN == true) _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; VERIFTAILLE(); SPRITE_ON(0); @@ -5755,7 +5755,7 @@ LABEL_70: _vm->_globals.iRegul = 1; if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_INW(); - _vm->_graphicsManager.NOFADE = 0; + _vm->_graphicsManager.NOFADE = false; _vm->_eventsManager.CHANGE_MOUSE(4); int xCheck = 0; @@ -5805,7 +5805,7 @@ LABEL_70: if (_vm->_globals.SORTIE != 8 || _vm->_globals.ECRAN != 5 || _vm->_globals.HELICO != 1) { if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_OUTW(); - _vm->_graphicsManager.NOFADE = 0; + _vm->_graphicsManager.NOFADE = false; SPRITE_OFF(0); _vm->_globals.AFFLI = 0; if (DEUXPERSO == 1) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 822165f4ce..43b0eafc86 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -671,7 +671,7 @@ LABEL_1141: _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 151; } if (v76 == 604) { @@ -685,7 +685,7 @@ LABEL_1141: if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); _vm->_globals.SORTIE = 151; } @@ -702,7 +702,7 @@ LABEL_1141: if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); _vm->_globals.SORTIE = 151; } @@ -851,7 +851,7 @@ LABEL_1141: if (v76 == 37) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; } if (v76 == 38) { _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); @@ -865,7 +865,7 @@ LABEL_1141: _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; } if (v76 == 29) { _vm->_globals.DESACTIVE_INVENT = true; @@ -1539,7 +1539,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 210) { - _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.NO_SEQ = true; _vm->_soundManager.SPECIAL_SOUND = 210; _vm->_animationManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; @@ -1549,7 +1549,7 @@ LABEL_1141: _vm->_objectsManager.INILINK("IM73a"); _vm->_objectsManager.OBSSEUL = 0; _vm->_globals.CACHE_ON(); - _vm->_animationManager.NO_SEQ = 0; + _vm->_animationManager.NO_SEQ = false; _vm->_globals.CACHE_ADD(0); _vm->_globals.CACHE_ADD(1); _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); @@ -1560,13 +1560,13 @@ LABEL_1141: if (v76 == 211) { _vm->_objectsManager.SPRITE_OFF(0); _vm->_globals.CACHE_OFF(); - _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.NO_SEQ = true; _vm->_globals.NO_VISU = false; _vm->_soundManager.SPECIAL_SOUND = 211; _vm->_animationManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_animationManager.NO_SEQ = 0; - _vm->_graphicsManager.NOFADE = 1; + _vm->_animationManager.NO_SEQ = false; + _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); v36 = 1; do { @@ -1864,7 +1864,7 @@ LABEL_1141: _vm->_globals.NOPARLE = false; _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.BOBANIM_OFF(13); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 94; } if (v76 == 52) { @@ -2080,7 +2080,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(12) != 34); _vm->_objectsManager.BOBANIM_OFF(2); _vm->_graphicsManager.FADE_OUTW(); - _vm->_graphicsManager.NOFADE = 1; + _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 20; } if (v76 == 41) @@ -2221,18 +2221,18 @@ LABEL_1141: if (v76 == 243) { _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { - _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); - _vm->_animationManager.NO_SEQ = 0; + _vm->_animationManager.NO_SEQ = false; } else { _vm->_objectsManager.OPTI_ONE(7, 0, 14, 0); } } if (v76 == 242) { _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); - _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); - _vm->_animationManager.NO_SEQ = 0; + _vm->_animationManager.NO_SEQ = false; v53 = &_vm->_globals.SAUVEGARDE->field380; v53->field0 = 404; v53->field1 = 395; @@ -2266,10 +2266,10 @@ LABEL_1141: _vm->_objectsManager.OPTI_ONE(6, 0, 15, 0); _vm->_objectsManager.PERSO_ON = 1; _vm->_graphicsManager.NB_SCREEN(); - _vm->_animationManager.NO_SEQ = 1; + _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); - _vm->_animationManager.NO_SEQ = 0; - _vm->_graphicsManager.NOFADE = 1; + _vm->_animationManager.NO_SEQ = false; + _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.PERSO_ON = 0; _vm->_globals.SORTIE = 100; -- cgit v1.2.3 From db12a8fb6ed9e8a7760e6d588e4f9b1d06228c46 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Oct 2012 08:57:47 +1100 Subject: HOPKINS: Renamed fields of Tri structure --- engines/hopkins/globals.h | 4 ++-- engines/hopkins/objects.cpp | 10 +++++----- engines/hopkins/objects.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5bfbd49958..a88139dc5a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -176,8 +176,8 @@ enum TriMode { TRI_NONE = 0, TRI_BOB = 1, TRI_SPRITE = 2, TRI_CACHE = 3 }; struct TriItem { TriMode triMode; int index; - int field4; - int field6; + int priority; + int unused; }; struct CacheItem { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 1896aa7f3f..acbc4acfe3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -421,7 +421,7 @@ void ObjectsManager::AFF_SPRITES() { do { v11 = arr[v34]; v12 = &arr[v34 + 1]; - if (_vm->_globals.Tri[arr[v34]].field4 > _vm->_globals.Tri[*v12].field4) { + if (_vm->_globals.Tri[arr[v34]].priority > _vm->_globals.Tri[*v12].priority) { arr[v34] = *v12; *v12 = v11; ++v27; @@ -477,8 +477,8 @@ void ObjectsManager::AFF_SPRITES() { for (int idx = 0; idx < 50; ++idx) { _vm->_globals.Tri[idx].triMode = TRI_NONE; _vm->_globals.Tri[idx].index = 0; - _vm->_globals.Tri[idx].field4 = 0; - _vm->_globals.Tri[idx].field6 = 0; + _vm->_globals.Tri[idx].priority = 0; + _vm->_globals.Tri[idx].unused = 0; } _vm->_globals.NBTRI = 0; @@ -1213,7 +1213,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } // Before Sort -int ObjectsManager::AvantTri(TriMode triMode, int index, int a3) { +int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { int result; ++_vm->_globals.NBTRI; @@ -1223,7 +1223,7 @@ int ObjectsManager::AvantTri(TriMode triMode, int index, int a3) { result = _vm->_globals.NBTRI; _vm->_globals.Tri[result].triMode = triMode; _vm->_globals.Tri[result].index = index; - _vm->_globals.Tri[result].field4 = a3; + _vm->_globals.Tri[result].priority = priority; return result; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 3140674e5c..17b41c4b0b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -154,7 +154,7 @@ public: void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void CALCUL_SPRITE(int idx); - int AvantTri(TriMode triMode, int index, int a3); + int AvantTri(TriMode triMode, int index, int priority); void AFF_BOB_ANIM(); void AFF_VBOB(); -- cgit v1.2.3 From 39d2ead935ad81052e0a68daafcaa04021caf305 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Oct 2012 09:08:25 +1100 Subject: HOPKINS: Method parameter renames in GraphicsManager class --- engines/hopkins/graphics.cpp | 14 +++++++------- engines/hopkins/graphics.h | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f24955b9ec..bf6a900804 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -245,11 +245,11 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { memcpy(VESA_BUFFER, VESA_SCREEN, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); } -void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) { +void GraphicsManager::INIT_TABLE(int minIndex, int maxIndex, byte *palette) { for (int idx = 0; idx < 256; ++idx) TABLE_COUL[idx] = idx; - Trans_bloc(TABLE_COUL, palette, 256, a1, a2); + Trans_bloc(TABLE_COUL, palette, 256, minIndex, maxIndex); for (int idx = 0; idx < 256; ++idx) { byte v = TABLE_COUL[idx]; @@ -1270,7 +1270,7 @@ Video_Cont_Vbe16a: } } -void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height) { +void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height) { const byte *srcP; byte *destP; int rowCount; @@ -2285,7 +2285,7 @@ void GraphicsManager::INI_ECRAN2(const Common::String &file) { OPTI_INI(file, 2); } -void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { +void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { int v2; unsigned int v3; int v6; @@ -2304,7 +2304,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } - if (!a2) { + if (!mode) { v13 = file + ".spr"; if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); @@ -2343,7 +2343,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int a2) { } while (v11 != 1); } _vm->_globals.dos_free2(ptr); - if (a2 != 1) { + if (mode != 1) { if (g_PTRNUL != _vm->_globals.COUCOU) _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); @@ -2514,7 +2514,7 @@ void GraphicsManager::Plot_Hline(byte *surface, int xp, int yp, unsigned int wid memset(surface + xp + nbrligne2 * yp, col, width); } -void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, char col) { +void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, byte col) { byte *v5; int v6; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index affbe01b77..510450795f 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -112,7 +112,7 @@ public: void DD_UNLOCK() { DD_Unlock(); } void Cls_Video(); void LOAD_IMAGE(const Common::String &file); - void INIT_TABLE(int a1, int a2, byte *a3); + void INIT_TABLE(int minIndex, int maxIndex, byte *palette); int SCROLL_ECRAN(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); @@ -148,7 +148,7 @@ public: void Copy_Video_Vbe3(const byte *srcData); void Copy_Video_Vbe16(const byte *srcData); void Copy_Video_Vbe16a(const byte *srcData); - void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, unsigned int width, int height); + void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height); /** * Draws a sprite onto the screen @@ -177,7 +177,7 @@ public: void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); void INI_ECRAN(const Common::String &file); void INI_ECRAN2(const Common::String &file); - void OPTI_INI(const Common::String &file, int a2); + void OPTI_INI(const Common::String &file, int mode); void NB_SCREEN(); void SHOW_PALETTE(); void videkey(); @@ -185,7 +185,7 @@ public: void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col); - void Plot_Vline(byte *surface, int xp, int yp, int height, char col); + void Plot_Vline(byte *surface, int xp, int yp, int height, byte col); }; } // End of namespace Hopkins -- cgit v1.2.3 From e3f62f5336c6a2f3b751826fcfd13393d864b705 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 29 Oct 2012 23:08:23 +0100 Subject: HOPKINS: More work on booleans --- engines/hopkins/dialogs.cpp | 14 +++++++------- engines/hopkins/objects.cpp | 34 +++++++++++++++++----------------- engines/hopkins/objects.h | 4 ++-- engines/hopkins/script.cpp | 20 ++++++++++---------- engines/hopkins/talk.cpp | 14 +++++++------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index d7b2c9d4d6..95f5f7ac6d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -304,7 +304,7 @@ void DialogsManager::showInventory() { if (!VIRE_INVENT && !AFFINVEN && !_vm->_globals.DESACTIVE_INVENT) { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; - _vm->_objectsManager.FLAG_VISIBLE = 0; + _vm->_objectsManager.FLAG_VISIBLE = false; v1 = 0; do { INVENT_ANIM(); @@ -451,7 +451,7 @@ LABEL_7: v9 = 114; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); - _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.BOBTOUS = true; } if (_vm->_dialogsManager.Winventaire != g_PTRNUL) _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); @@ -566,10 +566,10 @@ void DialogsManager::CHARGE_PARTIE() { _vm->_eventsManager.VBL(); } while (_vm->_eventsManager.BMOUSE() != 1); } while (!slotNumber); - _vm->_objectsManager.SL_FLAG = 0; + _vm->_objectsManager.SL_FLAG = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); - _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); _vm->_objectsManager.SL_X = 0; @@ -597,10 +597,10 @@ void DialogsManager::SAUVE_PARTIE() { } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); } while (!_vm->shouldQuit() && !slotNumber); - _vm->_objectsManager.SL_FLAG = 0; + _vm->_objectsManager.SL_FLAG = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); - _vm->_objectsManager.BOBTOUS = 1; + _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); _vm->_objectsManager.SL_X = 0; @@ -681,7 +681,7 @@ void DialogsManager::LOAD_SAUVE(int a1) { } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); - _vm->_objectsManager.SL_FLAG = 1; + _vm->_objectsManager.SL_FLAG = true; _vm->_objectsManager.SL_MODE = a1; _vm->_objectsManager.SL_X = 0; _vm->_objectsManager.SL_Y = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ab86e20c37..bc592b34ce 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -76,8 +76,8 @@ ObjectsManager::ObjectsManager() { MAX_DEPA1 = 0; CH_TETE = 0; T_RECTIF = 0; - DESACTIVE = 0; - DEUXPERSO = 0; + DESACTIVE = false; + DEUXPERSO = false; PERX = PERY = 0; PERI = 0; RECALL = 0; @@ -491,7 +491,7 @@ void ObjectsManager::AFF_SPRITES() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairex + _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventairey + _vm->_dialogsManager.inventaireh); } - if (SL_FLAG == 1) { + if (SL_FLAG == true) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); if (SL_X && SL_Y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager.start_x + 300, SL_Y + 300, 0); @@ -1254,7 +1254,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int idx = 0; do { ++idx; - if (idx <= 20 && PERSO_ON == 1) { + if (idx <= 20 && PERSO_ON == true) { _vm->_globals.Bob[idx].field1C = 0; continue; } @@ -1283,7 +1283,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; - if ( PERSO_ON == 1 && idx > 20 ) + if ( PERSO_ON == true && idx > 20 ) _vm->_globals.Bob[idx].xp += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); @@ -1324,7 +1324,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; - if (PERSO_ON == 1 && idx > 20) + if (PERSO_ON == true && idx > 20) _vm->_globals.Bob[idx].xp += _vm->_eventsManager.start_x; _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v21 + 2); @@ -1348,7 +1348,7 @@ LABEL_38: } } while (idx != 35); - if (!PERSO_ON && BOBTOUS == 1) { + if (!PERSO_ON && BOBTOUS == true) { v26 = 0; do { v13 = v26; @@ -1358,12 +1358,12 @@ LABEL_38: } while (v26 != 35); } - BOBTOUS = 0; + BOBTOUS = false; v27 = 0; do { ++v27; - if (v27 > 20 || PERSO_ON != 1) { + if (v27 > 20 || PERSO_ON != true) { if (_vm->_globals.Bob[v27].field0 == 10) { if (_vm->_globals.Bob[v27].field1C == 1) { v14 = _vm->_globals.Bob[v27].field1E; @@ -1704,11 +1704,11 @@ void ObjectsManager::VERIFZONE() { || _vm->_eventsManager.start_x >= v0 || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) || (v1 = v2 - 1, (uint16)(v2 - 1) > 0x3Bu)) { - if (FLAG_VISIBLE == 1) + if (FLAG_VISIBLE == true) FLAG_VISIBLE_EFFACE = 4; - FLAG_VISIBLE = 0; + FLAG_VISIBLE = false; } else { - FLAG_VISIBLE = 1; + FLAG_VISIBLE = true; } if (FORCEZONE == 1) { _vm->_globals.compteur_71 = 100; @@ -3064,7 +3064,7 @@ void ObjectsManager::CLEAR_ECRAN() { verbe = 4; NUMZONE = 0; Vold_taille = 0; - SPEED_FLAG = 0; + SPEED_FLAG = false; SPEED_PTR = g_PTRNUL; SPEED_X = 0; SPEED_Y = 0; @@ -4274,7 +4274,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; - PERSO_ON = 1; + PERSO_ON = true; _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.CLS_ANM = false; _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); @@ -4287,7 +4287,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); - PERSO_ON = 0; + PERSO_ON = false; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.dos_free2(v1); @@ -5808,9 +5808,9 @@ LABEL_70: _vm->_graphicsManager.NOFADE = false; SPRITE_OFF(0); _vm->_globals.AFFLI = 0; - if (DEUXPERSO == 1) { + if (DEUXPERSO == true) { SPRITE_OFF(1); - DEUXPERSO = 0; + DEUXPERSO = false; } if (!s3.empty()) _vm->_graphicsManager.FIN_VISU(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 17b41c4b0b..60ace316da 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -101,8 +101,8 @@ public: int MAX_DEPA1; int CH_TETE; int T_RECTIF; - int DESACTIVE; - int DEUXPERSO; + bool DESACTIVE; + bool DEUXPERSO; int PERX, PERY; int PERI; int RECALL; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 43b0eafc86..57b691a129 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -245,7 +245,7 @@ LABEL_98: } LABEL_104: if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { - if (_vm->_objectsManager.DESACTIVE != 1) { + if (_vm->_objectsManager.DESACTIVE != true) { v72 = *(a1 + 5); v70 = *(a1 + 6); v4 = *(a1 + 7); @@ -279,8 +279,8 @@ LABEL_1141: } if (*(a1 + 2) == 'S') { if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { - if (_vm->_objectsManager.DESACTIVE != 1) { - _vm->_objectsManager.DEUXPERSO = 0; + if (_vm->_objectsManager.DESACTIVE != true) { + _vm->_objectsManager.DEUXPERSO = false; v5 = *(a1 + 5); v6 = (int16)READ_LE_UINT16(a1 + 8); _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(a1 + 6); @@ -327,7 +327,7 @@ LABEL_1141: 34, 190); _vm->_objectsManager.SPRITE_ON(1); - _vm->_objectsManager.DEUXPERSO = 1; + _vm->_objectsManager.DEUXPERSO = true; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 && _vm->_globals.SAUVEGARDE->data[svField355] == 1 @@ -343,14 +343,14 @@ LABEL_1141: 20, 127); _vm->_objectsManager.SPRITE_ON(1); - _vm->_objectsManager.DEUXPERSO = 1; + _vm->_objectsManager.DEUXPERSO = true; } } v1 = 1; _vm->_objectsManager.CH_TETE = 0; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { - if (_vm->_objectsManager.DESACTIVE != 1) { + if (_vm->_objectsManager.DESACTIVE != true) { v7 = *(a1 + 5); v70 = *(a1 + 6); v8 = *(a1 + 7); @@ -368,7 +368,7 @@ LABEL_1141: } } if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - if (_vm->_objectsManager.DESACTIVE != 1) + if (_vm->_objectsManager.DESACTIVE != true) _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(a1 + 5)); v1 = 1; } @@ -2248,7 +2248,7 @@ LABEL_1141: _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField355] = 1; - _vm->_objectsManager.DEUXPERSO = 1; + _vm->_objectsManager.DEUXPERSO = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->field0, v53->field1, 1, 3, v53->field4, 0, 20, 127); _vm->_objectsManager.SPRITE_ON(1); @@ -2264,14 +2264,14 @@ LABEL_1141: if (v76 == 246) { _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.OPTI_ONE(6, 0, 15, 0); - _vm->_objectsManager.PERSO_ON = 1; + _vm->_objectsManager.PERSO_ON = true; _vm->_graphicsManager.NB_SCREEN(); _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); - _vm->_objectsManager.PERSO_ON = 0; + _vm->_objectsManager.PERSO_ON = false; _vm->_globals.SORTIE = 100; } if (v76 == 55) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2e4438e6d7..3dc883c871 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -112,7 +112,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); - _vm->_objectsManager.PERSO_ON = 1; + _vm->_objectsManager.PERSO_ON = true; CHERCHE_PAL(v3, 0); CHERCHE_ANIM0(v3, 0); ANIM_PERSO_INIT(); @@ -151,7 +151,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - _vm->_objectsManager.PERSO_ON = 0; + _vm->_objectsManager.PERSO_ON = false; _vm->_eventsManager.btsouris = v14; _vm->_eventsManager.CHANGE_MOUSE(v14); @@ -1246,14 +1246,14 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { v10 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); - _vm->_objectsManager.PERSO_ON = 1; + _vm->_objectsManager.PERSO_ON = true; CHERCHE_PAL(v10, 1); CHERCHE_ANIM0(v10, 0); v11 = _vm->_globals.COUCOU; _vm->_globals.COUCOU = g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_objectsManager.INILINK(v22); - _vm->_objectsManager.PERSO_ON = 1; + _vm->_objectsManager.PERSO_ON = true; _vm->_globals.GOACTION = 0; _vm->_objectsManager.NUMZONE = -1; ANIM_PERSO_INIT(); @@ -1295,10 +1295,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { while (v13 <= 44); _vm->_globals.LIBERE_FICHIER(_vm->_globals.COUCOU); _vm->_globals.COUCOU = v11; - _vm->_objectsManager.DESACTIVE = 1; + _vm->_objectsManager.DESACTIVE = true; _vm->_objectsManager.INILINK(v20); _vm->_graphicsManager.INI_ECRAN2(v20); - _vm->_objectsManager.DESACTIVE = 0; + _vm->_objectsManager.DESACTIVE = false; _vm->_globals.NOMARCHE = false; if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; @@ -1306,7 +1306,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - _vm->_objectsManager.PERSO_ON = 0; + _vm->_objectsManager.PERSO_ON = false; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(4); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); -- cgit v1.2.3 From 3f0b6efe0e6085ab3de5c6658e4c6157bca75797 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Oct 2012 09:10:42 +1100 Subject: HOPKINS: Removed duplicate souris_max method --- engines/hopkins/graphics.cpp | 7 +------ engines/hopkins/graphics.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index bf6a900804..01d61d51e9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -198,7 +198,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { Cls_Pal(); if (!DOUBLE_ECRAN) { - souris_max(); + _vm->_eventsManager.souris_max(); SCANLINE(SCREEN_WIDTH); max_x = SCREEN_WIDTH; DD_Lock(); @@ -470,11 +470,6 @@ void GraphicsManager::Cls_Pal() { } } -// TODO: Check if it's normal it's defined two times (also in events). -void GraphicsManager::souris_max() { - // Original has no implementation -} - void GraphicsManager::SCANLINE(int pitch) { nbrligne = nbrligne2 = pitch; } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 510450795f..8b93efcbc6 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -118,7 +118,6 @@ public: void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); void Cls_Pal(); - void souris_max(); void SCANLINE(int pitch); void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); -- cgit v1.2.3 From 1ce4ccc42b2817185b619540f551368a6d098bf4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 29 Oct 2012 23:38:31 +0100 Subject: HOPKINS: Fix more mass renaming issues --- engines/hopkins/dialogs.cpp | 6 +++--- engines/hopkins/hopkins.cpp | 8 ++++---- engines/hopkins/menu.cpp | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 95f5f7ac6d..28207bf6c7 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -4,9 +4,9 @@ * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * - * This program is _globals.FRee software; you can redistribute it and/or + * 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 _globals.FRee Software Foundation; either version 2 + * 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, @@ -15,7 +15,7 @@ * 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 _globals.FRee Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b935cb4d09..ba3c1da752 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4,9 +4,9 @@ * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * - * This program is _globals.FRee software; you can redistribute it and/or + * 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 _globals.FRee Software Foundation; either version 2 + * 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, @@ -15,7 +15,7 @@ * 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 _globals.FRee Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -197,7 +197,7 @@ LABEL_13: if (!*((byte *)_globals.SAUVEGARDE + 170)) { _soundManager.WSOUND(3); if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fond_globals.FR"); + _graphicsManager.LOAD_IMAGE("fondfr"); if (!_globals.FR) _graphicsManager.LOAD_IMAGE("fondan"); if (_globals.FR == 2) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index fc88bd7e4c..56b73c1fa1 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -4,9 +4,9 @@ * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * - * This program is _globals.FRee software; you can redistribute it and/or + * 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 _globals.FRee Software Foundation; either version 2 + * 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, @@ -15,7 +15,7 @@ * 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 _globals.FRee Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -- cgit v1.2.3 From 32afe8d7bacc50887d4b6e4006aa164b2e67a4a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Oct 2012 22:48:41 +1100 Subject: HOPKINS: Renaming local variables in graphics.cpp --- engines/hopkins/graphics.cpp | 933 +++++++++++++++++++++---------------------- 1 file changed, 457 insertions(+), 476 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 01d61d51e9..d0ec1d6545 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -475,88 +475,88 @@ void GraphicsManager::SCANLINE(int pitch) { } void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *v7; - byte *v8; - int v9; - int v10; - byte *v11; - const byte *v12; - unsigned int v13; + const byte *srcP; + byte *destP; + int yNext; + int yCtr; + byte *dest2P; + const byte *src2P; + unsigned int widthRemaining; assert(VideoPtr); - v7 = xs + nbrligne2 * ys + surface; - v8 = destX + WinScan * destY + (byte *)VideoPtr->pixels; - v9 = height; + srcP = xs + nbrligne2 * ys + surface; + destP = destX + WinScan * destY + (byte *)VideoPtr->pixels; + yNext = height; do { - v10 = v9; - memcpy((byte *)v8, (const byte *)v7, 4 * (width >> 2)); - v12 = (const byte *)(v7 + 4 * (width >> 2)); - v11 = (byte *)(v8 + 4 * (width >> 2)); - v13 = width - 4 * (width >> 2); - memcpy(v11, v12, v13); - v8 = v11 + v13 + WinScan - width; - v7 = v12 + v13 + nbrligne2 - width; - v9 = v10 - 1; - } while (v10 != 1); + yCtr = yNext; + memcpy((byte *)destP, (const byte *)srcP, 4 * (width >> 2)); + src2P = (const byte *)(srcP + 4 * (width >> 2)); + dest2P = (byte *)(destP + 4 * (width >> 2)); + widthRemaining = width - 4 * (width >> 2); + memcpy(dest2P, src2P, widthRemaining); + destP = dest2P + widthRemaining + WinScan - width; + srcP = src2P + widthRemaining + nbrligne2 - width; + yNext = yCtr - 1; + } while (yCtr != 1); } void GraphicsManager::m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *v7; - byte *v8; - int v9; - int v10; - int v11; + const byte *srcP; + byte *destP; + int destPitch; + int srcPitch; + int yCtr; assert(VideoPtr); - v7 = xs + nbrligne2 * ys + surface; - v8 = destX + WinScan * destY + (byte *)VideoPtr->pixels; - v9 = WinScan - SCREEN_WIDTH; - v10 = nbrligne2 - SCREEN_WIDTH; - v11 = height; + srcP = xs + nbrligne2 * ys + surface; + destP = destX + WinScan * destY + (byte *)VideoPtr->pixels; + destPitch = WinScan - SCREEN_WIDTH; + srcPitch = nbrligne2 - SCREEN_WIDTH; + yCtr = height; do { - memcpy(v8, v7, SCREEN_WIDTH); - v8 = v8 + v9 + SCREEN_WIDTH; - v7 = v7 + v10 + SCREEN_WIDTH; - --v11; - } while (v11); + memcpy(destP, srcP, SCREEN_WIDTH); + destP = destP + destPitch + SCREEN_WIDTH; + srcP = srcP + srcPitch + SCREEN_WIDTH; + --yCtr; + } while (yCtr); } void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *v7; - byte *v8; - int v9; - int v10; - byte v11; - const byte *v12; - byte *v13; + const byte *srcP; + byte *destP; + int yCtr; + int xCtr; + byte srcByte; + const byte *srcCopyP; + byte *destCopyP; assert(VideoPtr); - v7 = xs + nbrligne2 * ys + surface; - v8 = destX + WinScan * destY + (byte *)VideoPtr->pixels; - v9 = height; + srcP = xs + nbrligne2 * ys + surface; + destP = destX + WinScan * destY + (byte *)VideoPtr->pixels; + yCtr = height; Agr_x = 0; Agr_y = 0; Agr_Flag_y = 0; do { for (;;) { - v13 = v8; - v12 = v7; - v10 = width; + destCopyP = destP; + srcCopyP = srcP; + xCtr = width; Agr_x = 0; do { - v11 = *v7; - *v8++ = *v7++; + srcByte = *srcP; + *destP++ = *srcP++; Agr_x += SDL_ECHELLE; if ((unsigned int)Agr_x >= 100) { Agr_x -= 100; - *v8++ = v11; + *destP++ = srcByte; } - --v10; - } while ( v10 ); + --xCtr; + } while ( xCtr ); - v7 = v12; - v8 = WinScan + v13; + srcP = srcCopyP; + destP = WinScan + destCopyP; if (Agr_Flag_y) break; @@ -569,9 +569,9 @@ void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, } Agr_Flag_y = 0; - v7 = nbrligne2 + v12; - --v9; - } while (v9); + srcP = nbrligne2 + srcCopyP; + --yCtr; + } while (yCtr); } /** @@ -600,52 +600,53 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, DD_Unlock(); } +// TODO: See if PAL_PIXELS can be converted to a uint16 array void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *v7; - const byte *v8; - int v9; - int v10; - const byte *v11; - int v12; - int v13; - const byte *v14; - const byte *v15; + const byte *srcP; + const byte *destP; + int yNext; + int xCtr; + const byte *palette; + int pixelWord; + int yCtr; + const byte *srcCopyP; + const byte *destCopyP; assert(VideoPtr); - v7 = xs + nbrligne2 * ys + surface; - v8 = destX + destX + WinScan * destY + (byte *)VideoPtr->pixels; - v9 = height; + srcP = xs + nbrligne2 * ys + surface; + destP = destX + destX + WinScan * destY + (byte *)VideoPtr->pixels; + yNext = height; Agr_x = 0; Agr_y = 0; Agr_Flag_y = 0; do { for (;;) { - v15 = v8; - v14 = v7; - v10 = width; - v13 = v9; - v11 = PAL_PIXELS; + destCopyP = destP; + srcCopyP = srcP; + xCtr = width; + yCtr = yNext; + palette = PAL_PIXELS; Agr_x = 0; do { - v12 = *(uint16 *)(v11 + 2 * *v7); - *(uint16 *)v8 = v12; - ++v7; - v8 += 2; + pixelWord = *(uint16 *)(palette + 2 * *srcP); + *(uint16 *)destP = pixelWord; + ++srcP; + destP += 2; Agr_x += SDL_ECHELLE; if ((unsigned int)Agr_x >= 100) { Agr_x -= 100; - *(uint16 *)v8 = v12; - v8 += 2; + *(uint16 *)destP = pixelWord; + destP += 2; } - --v10; - } while (v10); + --xCtr; + } while (xCtr); - v9 = v13; - v7 = v14; - v8 = WinScan + v15; + yNext = yCtr; + srcP = srcCopyP; + destP = WinScan + destCopyP; if (Agr_Flag_y == 1) break; @@ -659,102 +660,102 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } Agr_Flag_y = 0; - v7 = nbrligne2 + v14; - v9 = v13 - 1; - } while (v13 != 1); + srcP = nbrligne2 + srcCopyP; + yNext = yCtr - 1; + } while (yCtr != 1); } void GraphicsManager::Copy_Vga(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - const byte *v7; - byte *v8; - int v9; - int v10; - byte v11; - byte *v12; - byte *v13; - byte *v14; - byte *v15; - const byte *v16; - int v17; + const byte *srcP; + byte *destP; + int yCount; + int xCount; + byte srcByte; + byte *loopDestP; + byte *loopSrcP; + byte *loopSrc2P; + byte *tempDestP; + const byte *tempSrcP; + int yCtr; assert(VideoPtr); - v7 = xp + 320 * yp + surface; - v8 = 30 * WinScan + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels; - v9 = height; + srcP = xp + 320 * yp + surface; + destP = 30 * WinScan + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels; + yCount = height; do { - v17 = v9; - v10 = width; - v16 = v7; - v15 = v8; + yCtr = yCount; + xCount = width; + tempSrcP = srcP; + tempDestP = destP; do { - v11 = *v7; - *v8 = *v7; - v12 = WinScan + v8; - *v12 = v11; - v13 = v12 - WinScan + 1; - *v13 = v11; - v14 = WinScan + v13; - *v14 = v11; - ++v7; - v8 = v14 - WinScan + 1; - --v10; - } while (v10); + srcByte = *srcP; + *destP = *srcP; + loopDestP = WinScan + destP; + *loopDestP = srcByte; + loopSrcP = loopDestP - WinScan + 1; + *loopSrcP = srcByte; + loopSrc2P = WinScan + loopSrcP; + *loopSrc2P = srcByte; + ++srcP; + destP = loopSrc2P - WinScan + 1; + --xCount; + } while (xCount); - v8 = WinScan + WinScan + v15; - v7 = v16 + 320; - v9 = v17 - 1; - } while (v17 != 1); + destP = WinScan + WinScan + tempDestP; + srcP = tempSrcP + 320; + yCount = yCtr - 1; + } while (yCtr != 1); } void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - const byte *v7; - uint16 *v8; - int v9; - int v10; - int v11; - const byte *v12; - uint16 *v13; - uint16 v14; - uint16 *v15; - int v16; - uint16 *v17; - const byte *v18; - int v19; + const byte *srcP; + uint16 *destP; + int yCount; + int xCount; + int xCtr; + const byte *palette; + uint16 *tempSrcP; + uint16 srcByte; + uint16 *tempDestP; + int savedXCount; + uint16 *loopDestP; + const byte *loopSrcP; + int yCtr; assert(VideoPtr); - v7 = xp + 320 * yp + surface; - v8 = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels); - v9 = height; - v10 = width; + srcP = xp + 320 * yp + surface; + destP = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels); + yCount = height; + xCount = width; do { - v19 = v9; - v11 = v10; - v18 = v7; - v17 = v8; - v16 = v10; - v12 = PAL_PIXELS; + yCtr = yCount; + xCtr = xCount; + loopSrcP = srcP; + loopDestP = destP; + savedXCount = xCount; + palette = PAL_PIXELS; do { - v13 = (uint16 *)(v12 + 2 * *v7); - v14 = *v13; - *v8 = *v13; - *(v8 + 1) = v14; + tempSrcP = (uint16 *)(palette + 2 * *srcP); + srcByte = *tempSrcP; + *destP = *tempSrcP; + *(destP + 1) = srcByte; - v15 = (uint16 *)((byte *)v8 + WinScan); - *v15 = v14; - *(v15 + 1) = v14; - ++v7; - v8 = (uint16 *)((byte *)v15 - WinScan + 4); - --v11; - } while (v11); + tempDestP = (uint16 *)((byte *)destP + WinScan); + *tempDestP = srcByte; + *(tempDestP + 1) = srcByte; + ++srcP; + destP = (uint16 *)((byte *)tempDestP - WinScan + 4); + --xCtr; + } while (xCtr); - v10 = v16; - v8 = (uint16 *)((byte *)v17 + WinScan * 2); - v7 = v18 + 320; - v9 = v19 - 1; - } while (v19 != 1); + xCount = savedXCount; + destP = (uint16 *)((byte *)loopDestP + WinScan * 2); + srcP = loopSrcP + 320; + yCount = yCtr - 1; + } while (yCtr != 1); } void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface) { @@ -819,29 +820,29 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface } void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v12; - uint16 v13; + int palByte; + int palIndex; + int palDataIndex; + int palCtr3; + int palCtr4; + int palCtr5; + int palValue; + int palCtr2; + int palCtr1; + uint16 palMax; byte palData[PALETTE_BLOCK_SIZE]; - int v15[PALETTE_BLOCK_SIZE]; + int tempPalette[PALETTE_BLOCK_SIZE]; - v13 = v3 = FADESPD; + palMax = palByte = FADESPD; if (palette) { - v4 = 0; + palIndex = 0; do { - v5 = v4; - v3 = *(v4 + palette); - v3 <<= 8; - v15[v5] = v3; - palData[v5] = *(v4++ + palette); - } while (v4 < PALETTE_BLOCK_SIZE); + palDataIndex = palIndex; + palByte = *(palIndex + palette); + palByte <<= 8; + tempPalette[palDataIndex] = palByte; + palData[palDataIndex] = *(palIndex++ + palette); + } while (palIndex < PALETTE_BLOCK_SIZE); setpal_vga256(palData); if (Winbpp == 2) { @@ -852,17 +853,17 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac DD_VBL(); } - v6 = 0; - if ((int)v13 > 0) { + palCtr3 = 0; + if (palMax > 0) { do { - v7 = 0; + palCtr4 = 0; do { - v8 = v7; - v9 = v15[v7] - (*(v7 + palette) << 8) / v13; - v15[v8] = v9; - palData[v8] = (v9 >> 8) & 0xff; - ++v7; - } while (v7 < (PALETTE_BLOCK_SIZE)); + palCtr5 = palCtr4; + palValue = tempPalette[palCtr4] - (*(palCtr4 + palette) << 8) / palMax; + tempPalette[palCtr5] = palValue; + palData[palCtr5] = (palValue >> 8) & 0xff; + ++palCtr4; + } while (palCtr4 < (PALETTE_BLOCK_SIZE)); setpal_vga256(palData); if (Winbpp == 2) { @@ -873,14 +874,14 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac DD_VBL(); } - ++v6; - } while ((int)v13 > v6); + ++palCtr3; + } while (palMax > palCtr3); } - v10 = 0; + palCtr2 = 0; do { - palData[v10++] = 0; - } while (v10 < (PALETTE_BLOCK_SIZE)); + palData[palCtr2++] = 0; + } while (palCtr2 < (PALETTE_BLOCK_SIZE)); setpal_vga256(palData); @@ -892,10 +893,10 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac goto LABEL_28; } } else { - v12 = 0; + palCtr1 = 0; do { - palData[v12++] = 0; - } while (v12 < (PALETTE_BLOCK_SIZE)); + palData[palCtr1++] = 0; + } while (palCtr1 < (PALETTE_BLOCK_SIZE)); setpal_vga256(palData); if (Winbpp == 2) { @@ -1035,139 +1036,123 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { } void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { - int v; - int v3; - int v4; - const byte *v5; - byte v6; - int v7; - byte v8; - byte *v9; - int v10; - byte v11; - byte *v12; - - v = 0; - v3 = 0; - v4 = 0; - v5 = srcData; + int rleValue; + int destOffset; + const byte *srcP; + byte srcByte; + byte destLen1; + byte *destSlice1P; + byte destLen2; + byte *destSlice2P; + + rleValue = 0; + destOffset = 0; + srcP = srcData; for (;;) { - v6 = *v5; - if (*v5 < 0xDEu) + srcByte = *srcP; + if (*srcP < 0xDEu) goto Video_Cont3_wVbe; - if (v6 == (byte)-4) + if (srcByte == (byte)-4) return; - if (v6 < 0xFBu) { - v3 += (byte)(*v5 + 35); - v6 = *(v5++ + 1); - } else if (v6 == (byte)-3) { - v3 += *(v5 + 1); - v6 = *(v5 + 2); - v5 += 2; - } else if (v6 == (byte)-2) { - v3 += READ_LE_UINT16(v5 + 1); - v6 = *(v5 + 3); - v5 += 3; + if (srcByte < 0xFBu) { + destOffset += (byte)(*srcP + 35); + srcByte = *(srcP++ + 1); + } else if (srcByte == (byte)-3) { + destOffset += *(srcP + 1); + srcByte = *(srcP + 2); + srcP += 2; + } else if (srcByte == (byte)-2) { + destOffset += READ_LE_UINT16(srcP + 1); + srcByte = *(srcP + 3); + srcP += 3; } else { - v3 += READ_LE_UINT32(v5 + 1); - v6 = *(v5 + 5); - v5 += 5; + destOffset += READ_LE_UINT32(srcP + 1); + srcByte = *(srcP + 5); + srcP += 5; } Video_Cont3_wVbe: - if (v6 > 0xD2u) { - if (v6 == (byte)-45) { - v7 = v4; - v8 = *(v5 + 1); - v = *(v5 + 2); - v9 = v3 + destSurface; - v3 += v8; - memset(v9, v, v8); - v5 += 3; - v4 = v7; + if (srcByte > 0xD2u) { + if (srcByte == (byte)-45) { + destLen1 = *(srcP + 1); + rleValue = *(srcP + 2); + destSlice1P = destOffset + destSurface; + destOffset += destLen1; + memset(destSlice1P, rleValue, destLen1); + srcP += 3; } else { - v10 = v4; - v11 = (byte)(*v5 + 45); - v = *(v5 + 1); - v12 = v3 + destSurface; - v3 += v11; - memset(v12, v, v11); - v5 += 2; - v4 = v10; + destLen2 = (byte)(*srcP + 45); + rleValue = *(srcP + 1); + destSlice2P = destOffset + destSurface; + destOffset += destLen2; + memset(destSlice2P, rleValue, destLen2); + srcP += 2; } } else { - *(v3 + destSurface) = v6; - ++v5; - ++v3; + *(destOffset + destSurface) = srcByte; + ++srcP; + ++destOffset; } }} void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { - int result; - int v2; - int v3; - const byte *v4; - uint8 v5; - int v6; - unsigned int v7; - byte *v8; - int v9; - unsigned int v10; - byte *v11; + int rleValue; + int destOffset; + const byte *srcP; + uint8 srcByte; + int destLen1; + byte *destSlice1P; + int destLen2; + byte *destSlice2P; assert(VideoPtr); - result = 0; - v2 = 0; - v3 = 0; - v4 = srcData; + rleValue = 0; + destOffset = 0; + srcP = srcData; for (;;) { - v5 = *v4; - if (*v4 < 222) + srcByte = *srcP; + if (*srcP < 222) goto Video_Cont3_Vbe; - if (v5 == 252) + if (srcByte == 252) return; - if (v5 < 251) { - v2 += *v4 + 35; - v5 = *(v4++ + 1); - } else if (v5 == (byte)-3) { - v2 += *(v4 + 1); - v5 = *(v4 + 2); - v4 += 2; - } else if (v5 == (byte)-2) { - v2 += READ_LE_UINT16(v4 + 1); - v5 = *(v4 + 3); - v4 += 3; + if (srcByte < 251) { + destOffset += *srcP + 35; + srcByte = *(srcP++ + 1); + } else if (srcByte == (byte)-3) { + destOffset += *(srcP + 1); + srcByte = *(srcP + 2); + srcP += 2; + } else if (srcByte == (byte)-2) { + destOffset += READ_LE_UINT16(srcP + 1); + srcByte = *(srcP + 3); + srcP += 3; } else { - v2 += READ_LE_UINT32(v4 + 1); - v5 = *(v4 + 5); - v4 += 5; + destOffset += READ_LE_UINT32(srcP + 1); + srcByte = *(srcP + 5); + srcP += 5; } Video_Cont3_Vbe: - if (v5 > 210) { - if (v5 == 211) { - v6 = v3; - v7 = *(v4 + 1); - result = *(v4 + 2); - v8 = v2 + (byte *)VideoPtr->pixels; - v2 += v7; - memset(v8, result, v7); - v4 += 3; - v3 = v6; + if (srcByte > 210) { + if (srcByte == 211) { + destLen1 = *(srcP + 1); + rleValue = *(srcP + 2); + destSlice1P = destOffset + (byte *)VideoPtr->pixels; + destOffset += destLen1; + memset(destSlice1P, rleValue, destLen1); + srcP += 3; } else { - v9 = v3; - v10 = (byte)(*v4 + 45); - result = *(v4 + 1); - v11 = (byte *)(v2 + (byte *)VideoPtr->pixels); - v2 += v10; - memset(v11, result, v10); - v4 += 2; - v3 = v9; + destLen2 = (byte)(*srcP + 45); + rleValue = *(srcP + 1); + destSlice2P = (byte *)(destOffset + (byte *)VideoPtr->pixels); + destOffset += destLen2; + memset(destSlice2P, rleValue, destLen2); + srcP += 2; } } else { - *(v2 + (byte *)VideoPtr->pixels) = v5; - ++v4; - ++v2; + *(destOffset + (byte *)VideoPtr->pixels) = srcByte; + ++srcP; + ++destOffset; } } } @@ -1233,35 +1218,35 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { - int v2; - const byte *v3; - byte v4; + int destOffset; + const byte *srcP; + byte pixelIndex; - v2 = 0; - v3 = srcData; + destOffset = 0; + srcP = srcData; for (;;) { - v4 = *v3; - if (*v3 < 0xFCu) + pixelIndex = *srcP; + if (*srcP < 0xFCu) goto Video_Cont_Vbe16a; - if (v4 == (byte)-4) + if (pixelIndex == (byte)-4) return; - if (v4 == (byte)-3) { - v2 += *(v3 + 1); - v4 = *(v3 + 2); - v3 += 2; - } else if (v4 == (byte)-2) { - v2 += READ_LE_UINT16(v3 + 1); - v4 = *(v3 + 3); - v3 += 3; + if (pixelIndex == (byte)-3) { + destOffset += *(srcP + 1); + pixelIndex = *(srcP + 2); + srcP += 2; + } else if (pixelIndex == (byte)-2) { + destOffset += READ_LE_UINT16(srcP + 1); + pixelIndex = *(srcP + 3); + srcP += 3; } else { - v2 += READ_LE_UINT32(v3 + 1); - v4 = *(v3 + 5); - v3 += 5; + destOffset += READ_LE_UINT32(srcP + 1); + pixelIndex = *(srcP + 5); + srcP += 5; } Video_Cont_Vbe16a: - WRITE_LE_UINT16((byte *)VideoPtr->pixels + v2 * 2, READ_LE_UINT16(PAL_PIXELS + 2 * v4)); - ++v3; - ++v2; + WRITE_LE_UINT16((byte *)VideoPtr->pixels + destOffset * 2, READ_LE_UINT16(PAL_PIXELS + 2 * pixelIndex)); + ++srcP; + ++destOffset; } } @@ -1269,7 +1254,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int const byte *srcP; byte *destP; int rowCount; - unsigned int i; + int i; int rowCount2; // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within @@ -1455,15 +1440,15 @@ void GraphicsManager::VISU_ALL() { } void GraphicsManager::RESET_SEGMENT_VESA() { - int v1; - int v2; + int idx; + int blocCount; if (_vm->_globals.NBBLOC > 0) { - v1 = 0; - v2 = _vm->_globals.NBBLOC; + idx = 0; + blocCount = _vm->_globals.NBBLOC; do { - _vm->_globals.BLOC[v1++].field0 = 0; - } while (v1 != v2); + _vm->_globals.BLOC[idx++].field0 = 0; + } while (idx != blocCount); _vm->_globals.NBBLOC = 0; } @@ -1471,44 +1456,44 @@ void GraphicsManager::RESET_SEGMENT_VESA() { // Add VESA Segment void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { - int v4; - int v5; - int16 v6; - int16 v10; + int tempX; + int blocCount; + int16 blocIndex; + bool addFlag; - v4 = x1; - v10 = 1; + tempX = x1; + addFlag = true; if (x2 > max_x) x2 = max_x; if (y2 > max_y) y2 = max_y; if (x1 < min_x) - v4 = min_x; + tempX = min_x; if (y1 < min_y) y1 = min_y; - v5 = _vm->_globals.NBBLOC; + blocCount = _vm->_globals.NBBLOC; if (_vm->_globals.NBBLOC > 1) { - v6 = 0; + blocIndex = 0; do { - BlocItem &bloc = _vm->_globals.BLOC[v6]; + BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; if (bloc.field0 == 1 - && v4 >= bloc.x1 && x2 <= bloc.x2 + && tempX >= bloc.x1 && x2 <= bloc.x2 && y1 >= bloc.y1 && y2 <= bloc.y2) - v10 = 0; - ++v6; - v5 = v6; - } while (_vm->_globals.NBBLOC + 1 != v6); + addFlag = false; + ++blocIndex; + blocCount = blocIndex; + } while (_vm->_globals.NBBLOC + 1 != blocIndex); } - if (v10 == 1) { + if (addFlag) { assert(_vm->_globals.NBBLOC < 50); BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; bloc.field0 = 1; - bloc.x1 = v4; + bloc.x1 = tempX; bloc.x2 = x2; bloc.y1 = y1; bloc.y2 = y2; @@ -1629,76 +1614,76 @@ void GraphicsManager::Affiche_Segment_Vesa() { } void GraphicsManager::CopyAsm(const byte *surface) { - const byte *v1; + const byte *srcP; byte srcByte; - byte *v3; - signed int v4; - signed int v5; - byte *v6; - byte *v7; - byte *v8; - byte *v9; - const byte *v10; + byte *destP; + int yCtr; + int xCtr; + byte *dest1P; + byte *dest2P; + byte *dest3P; + byte *destPitch; + const byte *srcPitch; assert(VideoPtr); - v1 = surface; + srcP = surface; srcByte = 30 * WinScan; - v3 = (byte *)VideoPtr->pixels + 30 * WinScan; - v4 = 200; + destP = (byte *)VideoPtr->pixels + 30 * WinScan; + yCtr = 200; do { - v10 = v1; - v9 = v3; - v5 = 320; + srcPitch = srcP; + destPitch = destP; + xCtr = 320; do { - srcByte = *v1; - *v3 = *v1; - v6 = WinScan + v3; - *v6 = srcByte; - v7 = v6 - WinScan + 1; - *v7 = srcByte; - v8 = WinScan + v7; - *v8 = srcByte; - v3 = v8 - WinScan + 1; - ++v1; - --v5; - } while (v5); + srcByte = *srcP; + *destP = *srcP; + dest1P = WinScan + destP; + *dest1P = srcByte; + dest2P = dest1P - WinScan + 1; + *dest2P = srcByte; + dest3P = WinScan + dest2P; + *dest3P = srcByte; + destP = dest3P - WinScan + 1; + ++srcP; + --xCtr; + } while (xCtr); - v1 = v10 + 320; - v3 = WinScan + WinScan + v9; - --v4; - } while (v4); + srcP = srcPitch + 320; + destP = WinScan + WinScan + destPitch; + --yCtr; + } while (yCtr); } void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { - byte *v6; - int v7; + byte *destP; + int yNext; const byte *srcP; - unsigned int i; + int i; int yCtr; - v6 = xp + nbrligne2 * yp + destSurface; - v7 = height; + destP = xp + nbrligne2 * yp + destSurface; + yNext = height; srcP = src; do { - yCtr = v7; + yCtr = yNext; if (width & 1) { - memcpy(v6, srcP, width); + memcpy(destP, srcP, width); srcP += width; - v6 += width; + destP += width; } else if (width & 2) { for (i = width >> 1; i; --i) { - *(uint16 *)v6 = *(uint16 *)srcP; + *(uint16 *)destP = *(uint16 *)srcP; srcP += 2; - v6 += 2; + destP += 2; } } else { - memcpy(v6, srcP, 4 * (width >> 2)); + memcpy(destP, srcP, 4 * (width >> 2)); srcP += 4 * (width >> 2); - v6 += 4 * (width >> 2); + destP += 4 * (width >> 2); } - v6 = nbrligne2 + v6 - width; - v7 = yCtr - 1; + destP = nbrligne2 + destP - width; + yNext = yCtr - 1; } while (yCtr != 1); } @@ -2163,7 +2148,7 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int int top; int croppedWidth; int croppedHeight; - int v11; + int xRight; int height2; int top2; int left; @@ -2184,8 +2169,8 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int top2 = top; if (top + croppedHeight > max_y) croppedHeight = max_y - top; - v11 = left + croppedWidth; - if (v11 > max_x) + xRight = left + croppedWidth; + if (xRight > max_x) croppedWidth = max_x - left; if (croppedWidth > 0 && croppedHeight > 0) { @@ -2223,51 +2208,51 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned // Display Font void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour) { - const byte *v6; + const byte *spriteDataP; int i; - const byte *v8; - int v9; - int v10; - const byte *v11; + const byte *spriteSizeP; + int spriteWidth; + int spriteHeight; + const byte *spritePixelsP; byte *destP; - int v13; - byte v14; + int xCtr; + byte destByte; byte *destLineP; - int v16; + int yCtr; - v6 = spriteData + 3; + spriteDataP = spriteData + 3; for (i = characterIndex; i; --i) - v6 += READ_LE_UINT32(v6) + 16; - - v9 = 0; - v10 = 0; - v8 = v6 + 4; - v9 = (int16)READ_LE_UINT16(v8); - v8 += 2; - v10 = (int16)READ_LE_UINT16(v8); - v11 = v8 + 10; + spriteDataP += READ_LE_UINT32(spriteDataP) + 16; + + spriteWidth = 0; + spriteHeight = 0; + spriteSizeP = spriteDataP + 4; + spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); + spriteSizeP += 2; + spriteHeight = (int16)READ_LE_UINT16(spriteSizeP); + spritePixelsP = spriteSizeP + 10; destP = surface + xp + nbrligne2 * yp; - Largeur = v9; + Largeur = spriteWidth; do { - v16 = v10; + yCtr = spriteHeight; destLineP = destP; - v13 = v9; + xCtr = spriteWidth; do { - v14 = *v11; - if (*v11) { - if (v14 == (byte)-4) - v14 = colour; - *destP = v14; + destByte = *spritePixelsP; + if (*spritePixelsP) { + if (destByte == (byte)-4) + destByte = colour; + *destP = destByte; } ++destP; - ++v11; - --v13; - } while (v13); + ++spritePixelsP; + --xCtr; + } while (xCtr); destP = nbrligne2 + destLineP; - v10 = v16 - 1; - } while (v16 != 1); + spriteHeight = yCtr - 1; + } while (yCtr != 1); } // Init Screen @@ -2281,33 +2266,29 @@ void GraphicsManager::INI_ECRAN2(const Common::String &file) { } void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { - int v2; - unsigned int v3; - int v6; - unsigned int v9; - signed int v11; + int dataOffset; + int dataVal1; + bool doneFlag; byte *ptr; - Common::String v13; + Common::String filename; - v2 = 1; - v3 = 0; - v9 = 0; + dataOffset = 1; - v13 = file + ".ini"; - ptr = _vm->_fileManager.RECHERCHE_CAT(v13, 1); + filename = file + ".ini"; + ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); if (ptr == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); } if (!mode) { - v13 = file + ".spr"; + filename = file + ".spr"; if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); if (!_vm->_globals.NOSPRECRAN) { - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.RECHERCHE_CAT(v13, 8); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.RECHERCHE_CAT(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); } else { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); @@ -2319,34 +2300,34 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { error("Error, file not ini"); } else { - v11 = 0; + doneFlag = false; do { - v6 = _vm->_scriptManager.Traduction(ptr + 20 * v2); + dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); if (_vm->shouldQuit()) return; - if (v6 == 2) - v2 = _vm->_scriptManager.Control_Goto((ptr + 20 * v2)); - if (v6 == 3) - v2 = _vm->_scriptManager.Control_If(ptr, v2); - if (v2 == -1) + if (dataVal1 == 2) + dataOffset = _vm->_scriptManager.Control_Goto((ptr + 20 * dataOffset)); + if (dataVal1 == 3) + dataOffset = _vm->_scriptManager.Control_If(ptr, dataOffset); + if (dataOffset == -1) error("Error, defective IFF"); - if (v6 == 1 || v6 == 4) - ++v2; - if (!v6 || v6 == 5) - v11 = 1; - } while (v11 != 1); + if (dataVal1 == 1 || dataVal1 == 4) + ++dataOffset; + if (!dataVal1 || dataVal1 == 5) + doneFlag = true; + } while (!doneFlag); } _vm->_globals.dos_free2(ptr); if (mode != 1) { if (g_PTRNUL != _vm->_globals.COUCOU) _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); - v13 = file + ".rep"; - byte *dataP = _vm->_fileManager.RECHERCHE_CAT(v13, 2); + filename = file + ".rep"; + byte *dataP = _vm->_fileManager.RECHERCHE_CAT(filename, 2); _vm->_globals.COUCOU = dataP; if (g_PTRNUL == dataP) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, v13); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); dataP = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_globals.COUCOU = dataP; } @@ -2356,8 +2337,8 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { } void GraphicsManager::NB_SCREEN() { - byte *v0; - const byte *v1; + byte *destP; + const byte *srcP; if (!_vm->_globals.NECESSAIRE) INIT_TABLE(50, 65, Palette); @@ -2380,13 +2361,13 @@ void GraphicsManager::NB_SCREEN() { } _vm->_graphicsManager.DD_Unlock(); - v0 = VESA_SCREEN; - v1 = VESA_BUFFER; + destP = VESA_SCREEN; + srcP = VESA_BUFFER; memcpy(VESA_SCREEN, VESA_BUFFER, 0x95FFCu); - v1 = v1 + 614396; - v0 = v0 + 614396; - *v0 = *v1; - *(v0 + 2) = *(v1 + 2); + srcP = srcP + 614396; + destP = destP + 614396; + *destP = *srcP; + *(destP + 2) = *(srcP + 2); DD_VBL(); } @@ -2510,16 +2491,16 @@ void GraphicsManager::Plot_Hline(byte *surface, int xp, int yp, unsigned int wid } void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, byte col) { - byte *v5; - int v6; + byte *destP; + int yCtr; - v5 = surface + xp + nbrligne2 * yp; - v6 = height; + destP = surface + xp + nbrligne2 * yp; + yCtr = height; do { - *v5 = col; - v5 += nbrligne2; - --v6; - } while (v6); + *destP = col; + destP += nbrligne2; + --yCtr; + } while (yCtr); } -- cgit v1.2.3 From ef663f95a516d8fe47a245653d418c047361281a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 31 Oct 2012 09:04:29 +1100 Subject: HOPKINS: Variable renaming in Affiche_Perfect --- engines/hopkins/graphics.cpp | 276 +++++++++++++++++++++---------------------- 1 file changed, 138 insertions(+), 138 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index d0ec1d6545..718a428ba6 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1711,18 +1711,18 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { // Display 'Perfect?' void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8) { - const byte *v8; + const byte *spriteStartP; int i; - const byte *v10; - int v11; - int v12; - const byte *v13; - byte *v14; - int v15; - byte *v16; - int v17; - int v18; - int v19; + const byte *spriteSizeP; + int spriteWidth; + int spriteHeight1; + const byte *spritePixelsP; + byte *dest1P; + int xCtr1; + byte *dest2P; + int xLeft; + int clippedWidth; + int xCtr2; int v20; int v21 = 0; int v22; @@ -1739,19 +1739,19 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v33; int v34; int v35; - int v36; + int spriteHeight2; int v37; int v38; uint16 v39; byte *v40; int v41; uint16 v42; - const byte *v43; - const byte *v44; + const byte *spritePixelsCopyP; + const byte *spritePixelsCopy2P; const byte *v45; const byte *v46; - byte *v47; - byte *v48; + byte *dest1CopyP; + byte *destCopy2P; int v49; int v50; byte *v51; @@ -1759,8 +1759,8 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp byte *v53; byte *v54; byte *v55; - int v56; - int v57; + int yCtr1; + int yCtr2; int v58; int v59; int v60; @@ -1770,17 +1770,17 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v64; int v65; - v8 = srcData + 3; + spriteStartP = srcData + 3; for (i = frameIndex; i; --i) - v8 += READ_LE_UINT32(v8) + 16; - - v11 = 0; - v12 = 0; - v10 = v8 + 4; - v11 = (int16)READ_LE_UINT16(v10); - v10 += 2; - v12 = v36 = (int16)READ_LE_UINT16(v10); - v13 = v10 + 10; + spriteStartP += READ_LE_UINT32(spriteStartP) + 16; + + spriteWidth = 0; + spriteHeight1 = 0; + spriteSizeP = spriteStartP + 4; + spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); + spriteSizeP += 2; + spriteHeight1 = spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); + spritePixelsP = spriteSizeP + 10; clip_x = 0; clip_y = 0; clip_x1 = 0; @@ -1795,18 +1795,18 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp clip_x1 = max_x + 300 - xp300; if ((uint16)yp300 < (uint16)(max_y + 300)) { clip_y1 = max_y + 300 - yp300; - v14 = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; + dest1P = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; if (a7) { Compteur_y = 0; Agr_x = 0; Agr_y = 0; Agr_Flag_y = 0; Agr_Flag_x = 0; - Largeur = v11; - v20 = Asm_Zoom(v11, a7); + Largeur = spriteWidth; + v20 = Asm_Zoom(spriteWidth, a7); v22 = Asm_Zoom(v21, a7); if (a8) { - v29 = v20 + v14; + v29 = v20 + dest1P; if (clip_y) { if ((uint16)clip_y >= v22) return; @@ -1817,7 +1817,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp while (Asm_Zoom(v30 + 1, a7) < v31) ; v20 = v52; - v13 += Largeur * v30; + spritePixelsP += Largeur * v30; v29 += nbrligne2 * (uint16)clip_y; v22 = v61 - (uint16)clip_y; } @@ -1837,29 +1837,29 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ; v34 = v33; v22 = v62; - v13 += v34; + spritePixelsP += v34; v20 = (uint16)clip_x1; } do { while (1) { v63 = v22; v53 = v29; - v46 = v13; + v46 = spritePixelsP; Agr_Flag_x = 0; Agr_x = 0; v35 = v20; do { while (1) { - if (*v13) - *v29 = *v13; + if (*spritePixelsP) + *v29 = *spritePixelsP; --v29; - ++v13; + ++spritePixelsP; if (!Agr_Flag_x) Agr_x = a7 + Agr_x; if ((uint16)Agr_x < 0x64u) break; Agr_x = Agr_x - 100; - --v13; + --spritePixelsP; Agr_Flag_x = 1; --v35; if (!v35) @@ -1869,7 +1869,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp --v35; } while (v35); R_Aff_Zoom_Larg_Cont1: - v13 = Largeur + v46; + spritePixelsP = Largeur + v46; v29 = nbrligne2 + v53; ++Compteur_y; if (!Agr_Flag_y) @@ -1877,7 +1877,7 @@ R_Aff_Zoom_Larg_Cont1: if ((uint16)Agr_y < 0x64u) break; Agr_y = Agr_y - 100; - v13 = v46; + spritePixelsP = v46; Agr_Flag_y = 1; v22 = v63 - 1; if (v63 == 1) @@ -1897,8 +1897,8 @@ R_Aff_Zoom_Larg_Cont1: while (Asm_Zoom(v23 + 1, a7) < v24) ; v20 = v49; - v13 += Largeur * v23; - v14 += nbrligne2 * (uint16)clip_y; + spritePixelsP += Largeur * v23; + dest1P += nbrligne2 * (uint16)clip_y; v22 = v58 - (uint16)clip_y; } if (v22 > (uint16)clip_y1) @@ -1914,8 +1914,8 @@ R_Aff_Zoom_Larg_Cont1: ; v27 = v26; v22 = v59; - v13 += v27; - v14 += (uint16)clip_x; + spritePixelsP += v27; + dest1P += (uint16)clip_x; v20 = v50 - (uint16)clip_x; } if (v20 > (uint16)clip_x1) @@ -1923,23 +1923,23 @@ R_Aff_Zoom_Larg_Cont1: do { while (1) { v60 = v22; - v51 = v14; - v45 = v13; + v51 = dest1P; + v45 = spritePixelsP; v28 = v20; Agr_Flag_x = 0; Agr_x = 0; do { while (1) { - if (*v13) - *v14 = *v13; - ++v14; - ++v13; + if (*spritePixelsP) + *dest1P = *spritePixelsP; + ++dest1P; + ++spritePixelsP; if (!Agr_Flag_x) Agr_x = a7 + Agr_x; if ((uint16)Agr_x < 0x64u) break; Agr_x = Agr_x - 100; - --v13; + --spritePixelsP; Agr_Flag_x = 1; --v28; if (!v28) @@ -1949,14 +1949,14 @@ R_Aff_Zoom_Larg_Cont1: --v28; } while (v28); Aff_Zoom_Larg_Cont1: - v13 = Largeur + v45; - v14 = nbrligne2 + v51; + spritePixelsP = Largeur + v45; + dest1P = nbrligne2 + v51; if (!Agr_Flag_y) Agr_y = a7 + Agr_y; if ((uint16)Agr_y < 0x64u) break; Agr_y = Agr_y - 100; - v13 = v45; + spritePixelsP = v45; Agr_Flag_y = 1; v22 = v60 - 1; if (v60 == 1) @@ -1970,14 +1970,14 @@ Aff_Zoom_Larg_Cont1: Compteur_y = 0; Red_x = 0; Red_y = 0; - Largeur = v11; + Largeur = spriteWidth; Red = a6; if (a6 < 100) { - v37 = Asm_Reduc(v11, Red); + v37 = Asm_Reduc(spriteWidth, Red); if (a8) { - v40 = v37 + v14; + v40 = v37 + dest1P; do { - v65 = v36; + v65 = spriteHeight2; v55 = v40; Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { @@ -1987,29 +1987,29 @@ Aff_Zoom_Larg_Cont1: do { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { - if (v42 >= clip_x && v42 < clip_x1 && *v13) - *v40 = *v13; + if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) + *v40 = *spritePixelsP; --v40; - ++v13; + ++spritePixelsP; --v42; } else { Red_x = Red_x - 100; - ++v13; + ++spritePixelsP; } --v41; } while (v41); - v36 = v65; + spriteHeight2 = v65; v40 = nbrligne2 + v55; } else { Red_y = Red_y - 100; - v13 += Largeur; + spritePixelsP += Largeur; } - --v36; - } while (v36); + --spriteHeight2; + } while (spriteHeight2); } else { do { - v64 = v36; - v54 = v14; + v64 = spriteHeight2; + v54 = dest1P; Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; @@ -2018,107 +2018,107 @@ Aff_Zoom_Larg_Cont1: do { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { - if (v39 >= clip_x && v39 < clip_x1 && *v13) - *v14 = *v13; - ++v14; - ++v13; + if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) + *dest1P = *spritePixelsP; + ++dest1P; + ++spritePixelsP; ++v39; } else { Red_x = Red_x - 100; - ++v13; + ++spritePixelsP; } --v38; } while (v38); - v36 = v64; - v14 = nbrligne2 + v54; + spriteHeight2 = v64; + dest1P = nbrligne2 + v54; } else { Red_y = Red_y - 100; - v13 += Largeur; + spritePixelsP += Largeur; } - --v36; - } while (v36); + --spriteHeight2; + } while (spriteHeight2); } } } else { - Largeur = v11; + Largeur = spriteWidth; Compteur_y = 0; if (a8) { - v16 = v11 + v14; - spec_largeur = v11; + dest2P = spriteWidth + dest1P; + spec_largeur = spriteWidth; if (clip_y) { - if ((uint16)clip_y >= (unsigned int)v12) + if ((uint16)clip_y >= (unsigned int)spriteHeight1) return; - v13 += v11 * (uint16)clip_y; - v16 += nbrligne2 * (uint16)clip_y; - v12 -= (uint16)clip_y; + spritePixelsP += spriteWidth * (uint16)clip_y; + dest2P += nbrligne2 * (uint16)clip_y; + spriteHeight1 -= (uint16)clip_y; } - v17 = (uint16)clip_y1; - if (v12 > clip_y1) - v12 = clip_y1; - v17 = clip_x; + xLeft = (uint16)clip_y1; + if (spriteHeight1 > clip_y1) + spriteHeight1 = clip_y1; + xLeft = clip_x; if (clip_x) { - if (v17 >= v11) + if (xLeft >= spriteWidth) return; - v11 -= v17; + spriteWidth -= xLeft; } - if (v11 > (uint16)clip_x1) { - v18 = v11 - (uint16)clip_x1; - v13 += v18; - v16 -= v18; - v11 = (uint16)clip_x1; + if (spriteWidth > (uint16)clip_x1) { + clippedWidth = spriteWidth - (uint16)clip_x1; + spritePixelsP += clippedWidth; + dest2P -= clippedWidth; + spriteWidth = (uint16)clip_x1; } do { - v57 = v12; - v48 = v16; - v44 = v13; - v19 = v11; + yCtr2 = spriteHeight1; + destCopy2P = dest2P; + spritePixelsCopy2P = spritePixelsP; + xCtr2 = spriteWidth; do { - if (*v13) - *v16 = *v13; - ++v13; - --v16; - --v19; - } while (v19); - v13 = spec_largeur + v44; - v16 = nbrligne2 + v48; - v12 = v57 - 1; - } while (v57 != 1); + if (*spritePixelsP) + *dest2P = *spritePixelsP; + ++spritePixelsP; + --dest2P; + --xCtr2; + } while (xCtr2); + spritePixelsP = spec_largeur + spritePixelsCopy2P; + dest2P = nbrligne2 + destCopy2P; + spriteHeight1 = yCtr2 - 1; + } while (yCtr2 != 1); } else { - spec_largeur = v11; + spec_largeur = spriteWidth; if (clip_y) { - if ((uint16)clip_y >= (unsigned int)v12) + if ((uint16)clip_y >= (unsigned int)spriteHeight1) return; - v13 += v11 * (uint16)clip_y; - v14 += nbrligne2 * (uint16)clip_y; - v12 -= (uint16)clip_y; + spritePixelsP += spriteWidth * (uint16)clip_y; + dest1P += nbrligne2 * (uint16)clip_y; + spriteHeight1 -= (uint16)clip_y; } - if (v12 > clip_y1) - v12 = clip_y1; + if (spriteHeight1 > clip_y1) + spriteHeight1 = clip_y1; if (clip_x) { - if ((uint16)clip_x >= v11) + if ((uint16)clip_x >= spriteWidth) return; - v13 += (uint16)clip_x; - v14 += (uint16)clip_x; - v11 -= (uint16)clip_x; + spritePixelsP += (uint16)clip_x; + dest1P += (uint16)clip_x; + spriteWidth -= (uint16)clip_x; } - if (v11 > (uint16)clip_x1) - v11 = (uint16)clip_x1; + if (spriteWidth > (uint16)clip_x1) + spriteWidth = (uint16)clip_x1; do { - v56 = v12; - v47 = v14; - v43 = v13; - v15 = v11; + yCtr1 = spriteHeight1; + dest1CopyP = dest1P; + spritePixelsCopyP = spritePixelsP; + xCtr1 = spriteWidth; do { - if (*v13) - *v14 = *v13; - ++v14; - ++v13; - --v15; - } while (v15); - v13 = spec_largeur + v43; - v14 = nbrligne2 + v47; - v12 = v56 - 1; - } while (v56 != 1); + if (*spritePixelsP) + *dest1P = *spritePixelsP; + ++dest1P; + ++spritePixelsP; + --xCtr1; + } while (xCtr1); + spritePixelsP = spec_largeur + spritePixelsCopyP; + dest1P = nbrligne2 + dest1CopyP; + spriteHeight1 = yCtr1 - 1; + } while (yCtr1 != 1); } } } -- cgit v1.2.3 From bf3f30bc140e87a933f929986f4ec500a8b7abf4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 31 Oct 2012 22:15:09 +0100 Subject: HOPKINS: Add code specific to full linux version in PARLER_PERSO Also change another variable type --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 4 ++-- engines/hopkins/talk.cpp | 12 ++++++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0dd8caec9f..1ed40701e1 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -174,7 +174,7 @@ Globals::Globals() { NOT_VERIF = 0; PERSO_TYPE = 0; GOACTION = 0; - NECESSAIRE = 0; + NECESSAIRE = false; Compteur = 0; ACTION_SENS = 0; ACTION_SENS = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 26d219a816..0110e674e8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -428,8 +428,8 @@ public: bool CACHEFLAG; bool NOPARLE; bool PLAN_FLAG; + bool NECESSAIRE; int GOACTION; - int NECESSAIRE; int Compteur; int ACTION_SENS; int SegmentEnCours; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bc592b34ce..60e64c2b23 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4280,9 +4280,9 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); _vm->_animationManager.NO_SEQ = false; _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_globals.NECESSAIRE = 1; + _vm->_globals.NECESSAIRE = true; _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = 0; + _vm->_globals.NECESSAIRE = false; _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 3dc883c871..44f7e704f5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -142,11 +142,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } CLEAR_ANIM_PERSO(); _vm->_globals.NOPARLE = false; - _vm->_globals.NECESSAIRE = 1; + _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = 0; + _vm->_globals.NECESSAIRE = false; _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); @@ -156,6 +156,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_eventsManager.CHANGE_MOUSE(v14); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + + if (_vm->getIsDemo() == false) + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_LOCK(); @@ -1281,11 +1285,11 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { CLEAR_ANIM_PERSO(); CLEAR_ANIM_PERSO(); _vm->_globals.NOPARLE = false; - _vm->_globals.NECESSAIRE = 1; + _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = 0; + _vm->_globals.NECESSAIRE = false; _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); -- cgit v1.2.3 From e9c9b8b428b66968bd8e88eb718061b1c8fd041d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 Nov 2012 22:35:33 +1100 Subject: HOPKINS: Refactoring to show the selected inventory item using ScummVM cursor manager --- engines/hopkins/events.cpp | 118 +++++++++++++++++++++++++------------------ engines/hopkins/events.h | 3 ++ engines/hopkins/globals.cpp | 6 +-- engines/hopkins/globals.h | 1 - engines/hopkins/graphics.cpp | 36 ++++++------- engines/hopkins/graphics.h | 2 +- engines/hopkins/objects.cpp | 6 +-- 7 files changed, 95 insertions(+), 77 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 0b3d252f57..a65e27e186 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -47,11 +47,16 @@ EventsManager::EventsManager() { GAME_KEY = KEY_NONE; btsouris = 0; OLD_ICONE = 0; + Bufferobjet = NULL; _priorCounterTime = 0; _priorFrameTime = 0; } +EventsManager::~EventsManager() { + _vm->_globals.dos_free2(Bufferobjet); +} + void EventsManager::setParent(HopkinsEngine *vm) { _vm = vm; } @@ -141,55 +146,7 @@ void EventsManager::CHANGE_MOUSE(int id) { OLD_ICONE = cursorId; souris_n = cursorId; - // Backup the current sprite clipping bounds and reset them - Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, - _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); - _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = _vm->_globals.OBJL; - _vm->_graphicsManager.max_y = _vm->_globals.OBJH; - int pitch = _vm->_graphicsManager.nbrligne2; - _vm->_graphicsManager.nbrligne2 = _vm->_globals.OBJL; - - // Draw the cursor onto a temporary surface - byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL]; - Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0); - _vm->_graphicsManager.Sprite_Vesa(cursorSurface, pointeur_souris, 300, 300, cursorId); - - // Reset the clipping bounds - _vm->_graphicsManager.min_x = clipBounds.left; - _vm->_graphicsManager.min_y = clipBounds.top; - _vm->_graphicsManager.max_x = clipBounds.right; - _vm->_graphicsManager.max_y = clipBounds.bottom; - _vm->_graphicsManager.nbrligne2 = pitch; - - // Convert the cursor to the pixel format. At the moment, it's hardcoded - // to expect the game to be in 16-bit mode - uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL]; - const byte *srcP = cursorSurface; - uint16 *destP = cursorPixels; - - for (int yp = 0; yp < _vm->_globals.OBJH; ++yp) { - const byte *lineSrcP = srcP; - uint16 *lineDestP = destP; - - for (int xp = 0; xp < _vm->_globals.OBJL; ++xp) - *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; - - srcP += _vm->_globals.OBJL; - destP += _vm->_globals.OBJL; - } - - // Calculate the X offset within the pointer image to the actual cursor data - int xOffset = !mouse_linux ? 10 : 20; - - // Set the ScummVM cursor from the surface - Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - g_system->setMouseCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, - xOffset, 0, 0, true, &pixelFormat); - - // Delete the cursor surface - delete[] cursorPixels; - delete[] cursorSurface; + updateCursor(); } } } @@ -370,11 +327,13 @@ LABEL_45: if (yp + v13 > _vm->_graphicsManager.max_y) v13 -= yp + v13 - _vm->_graphicsManager.max_y; if (v14 > 1 && v13 > 1) { + _vm->_eventsManager.updateCursor(); /* Commented out in favour of using ScummVM cursor display _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); -*/ + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, yp + 300, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); +*/ } } goto LABEL_54; @@ -498,4 +457,63 @@ LABEL_113: CONTROLE_MES(); } +void EventsManager::updateCursor() { + // Backup the current sprite clipping bounds and reset them + Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, + _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); + _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; + _vm->_graphicsManager.max_x = _vm->_globals.OBJL; + _vm->_graphicsManager.max_y = _vm->_globals.OBJH; + int pitch = _vm->_graphicsManager.nbrligne2; + _vm->_graphicsManager.nbrligne2 = _vm->_globals.OBJL; + + // Create the temporary cursor surface + byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL]; + Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0); + + if (btsouris != 23) { + // Draw standard cursor + _vm->_graphicsManager.Sprite_Vesa(cursorSurface, pointeur_souris, 300, 300, souris_n); + } else { + // Draw the active inventory object + _vm->_graphicsManager.Affiche_Perfect(cursorSurface, Bufferobjet, 300, 300, 0, 0, 0, 0); + } + + // Reset the clipping bounds + _vm->_graphicsManager.min_x = clipBounds.left; + _vm->_graphicsManager.min_y = clipBounds.top; + _vm->_graphicsManager.max_x = clipBounds.right; + _vm->_graphicsManager.max_y = clipBounds.bottom; + _vm->_graphicsManager.nbrligne2 = pitch; + + // Convert the cursor to the pixel format. At the moment, it's hardcoded + // to expect the game to be in 16-bit mode + uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL]; + const byte *srcP = cursorSurface; + uint16 *destP = cursorPixels; + + for (int yp = 0; yp < _vm->_globals.OBJH; ++yp) { + const byte *lineSrcP = srcP; + uint16 *lineDestP = destP; + + for (int xp = 0; xp < _vm->_globals.OBJL; ++xp) + *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; + + srcP += _vm->_globals.OBJL; + destP += _vm->_globals.OBJL; + } + + // Calculate the X offset within the pointer image to the actual cursor data + int xOffset = !mouse_linux ? 10 : 20; + + // Set the ScummVM cursor from the surface + Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); + g_system->setMouseCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, + xOffset, 0, 0, true, &pixelFormat); + + // Delete the cursor surface + delete[] cursorPixels; + delete[] cursorSurface; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 364a74fcf8..158e08c8de 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -43,6 +43,7 @@ private: void pollEvents(); void handleKey(Common::Event &event); void checkForNextFrameCounter(); + void updateCursor(); public: bool souris_flag; bool mouse_linux; @@ -64,8 +65,10 @@ public: bool NOESC; DIALOG_KEY GAME_KEY; int btsouris; + byte *Bufferobjet; public: EventsManager(); + ~EventsManager(); void setParent(HopkinsEngine *vm); void INSTALL_SOURIS(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1ed40701e1..1717ea8110 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -193,7 +193,6 @@ Globals::Globals() { essai0 = NULL; essai1 = NULL; essai2 = NULL; - Bufferobjet = NULL; inventaire2 = NULL; GESTE = NULL; INVENTAIRE_OBJET = NULL; @@ -255,7 +254,6 @@ Globals::~Globals() { dos_free2(SPRITE_ECRAN); dos_free2((byte *)SAUVEGARDE); dos_free2(BUFFERTAPE); - dos_free2(Bufferobjet); dos_free2(inventaire2); dos_free2(GESTE); dos_free2(INVENTAIRE_OBJET); @@ -324,7 +322,7 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; NUM_FICHIER_OBJ = 0; Bufferdecor = g_PTRNUL; - Bufferobjet = g_PTRNUL; + _vm->_eventsManager.Bufferobjet = g_PTRNUL; _vm->_dialogsManager.Winventaire = g_PTRNUL; _vm->_dialogsManager.inventaire2 = g_PTRNUL; COUCOU = g_PTRNUL; @@ -375,7 +373,7 @@ void Globals::clearAll() { largeur_boite = 240; TEXTE_FORMATE = 300; - Bufferobjet = dos_malloc2(2500); + _vm->_eventsManager.Bufferobjet = dos_malloc2(2500); INVENTAIRE_OBJET = dos_malloc2(2500); ADR_FICHIER_OBJ = g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 0110e674e8..204c05e4ed 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -367,7 +367,6 @@ public: int16 *essai0; int16 *essai1; int16 *essai2; - byte *Bufferobjet; byte *inventaire2; byte *GESTE; int OBJET_EN_COURS; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 718a428ba6..72c01c2c37 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1710,7 +1710,7 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { } // Display 'Perfect?' -void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8) { +void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag) { const byte *spriteStartP; int i; const byte *spriteSizeP; @@ -1796,16 +1796,16 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if ((uint16)yp300 < (uint16)(max_y + 300)) { clip_y1 = max_y + 300 - yp300; dest1P = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; - if (a7) { + if (zoom2) { Compteur_y = 0; Agr_x = 0; Agr_y = 0; Agr_Flag_y = 0; Agr_Flag_x = 0; Largeur = spriteWidth; - v20 = Asm_Zoom(spriteWidth, a7); - v22 = Asm_Zoom(v21, a7); - if (a8) { + v20 = Asm_Zoom(spriteWidth, zoom2); + v22 = Asm_Zoom(v21, zoom2); + if (modeFlag) { v29 = v20 + dest1P; if (clip_y) { if ((uint16)clip_y >= v22) @@ -1814,7 +1814,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v52 = v20; v30 = 0; v31 = (uint16)clip_y; - while (Asm_Zoom(v30 + 1, a7) < v31) + while (Asm_Zoom(v30 + 1, zoom2) < v31) ; v20 = v52; spritePixelsP += Largeur * v30; @@ -1833,7 +1833,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v29 -= v32; v62 = v22; v33 = 0; - while (Asm_Zoom(v33 + 1, a7) < v32) + while (Asm_Zoom(v33 + 1, zoom2) < v32) ; v34 = v33; v22 = v62; @@ -1855,7 +1855,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp --v29; ++spritePixelsP; if (!Agr_Flag_x) - Agr_x = a7 + Agr_x; + Agr_x = zoom2 + Agr_x; if ((uint16)Agr_x < 0x64u) break; Agr_x = Agr_x - 100; @@ -1873,7 +1873,7 @@ R_Aff_Zoom_Larg_Cont1: v29 = nbrligne2 + v53; ++Compteur_y; if (!Agr_Flag_y) - Agr_y = a7 + Agr_y; + Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 0x64u) break; Agr_y = Agr_y - 100; @@ -1894,7 +1894,7 @@ R_Aff_Zoom_Larg_Cont1: v49 = v20; v23 = 0; v24 = (uint16)clip_y; - while (Asm_Zoom(v23 + 1, a7) < v24) + while (Asm_Zoom(v23 + 1, zoom2) < v24) ; v20 = v49; spritePixelsP += Largeur * v23; @@ -1910,7 +1910,7 @@ R_Aff_Zoom_Larg_Cont1: v50 = v20; v25 = (uint16)clip_x; v26 = 0; - while (Asm_Zoom(v26 + 1, a7) < v25) + while (Asm_Zoom(v26 + 1, zoom2) < v25) ; v27 = v26; v22 = v59; @@ -1935,7 +1935,7 @@ R_Aff_Zoom_Larg_Cont1: ++dest1P; ++spritePixelsP; if (!Agr_Flag_x) - Agr_x = a7 + Agr_x; + Agr_x = zoom2 + Agr_x; if ((uint16)Agr_x < 0x64u) break; Agr_x = Agr_x - 100; @@ -1952,7 +1952,7 @@ Aff_Zoom_Larg_Cont1: spritePixelsP = Largeur + v45; dest1P = nbrligne2 + v51; if (!Agr_Flag_y) - Agr_y = a7 + Agr_y; + Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 0x64u) break; Agr_y = Agr_y - 100; @@ -1966,15 +1966,15 @@ Aff_Zoom_Larg_Cont1: v22 = v60 - 1; } while (v60 != 1); } - } else if (a6) { + } else if (zoom1) { Compteur_y = 0; Red_x = 0; Red_y = 0; Largeur = spriteWidth; - Red = a6; - if (a6 < 100) { + Red = zoom1; + if (zoom1 < 100) { v37 = Asm_Reduc(spriteWidth, Red); - if (a8) { + if (modeFlag) { v40 = v37 + dest1P; do { v65 = spriteHeight2; @@ -2042,7 +2042,7 @@ Aff_Zoom_Larg_Cont1: } else { Largeur = spriteWidth; Compteur_y = 0; - if (a8) { + if (modeFlag) { dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; if (clip_y) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 8b93efcbc6..5112672848 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -169,7 +169,7 @@ public: void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); - void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int a6, int a7, int a8); + void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 60e64c2b23..e2ad687bf9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -101,7 +101,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { // Change Object byte *ObjectsManager::CHANGE_OBJET(int objIndex) { byte *result = CAPTURE_OBJET(objIndex, 1); - _vm->_globals.Bufferobjet = result; + _vm->_eventsManager.Bufferobjet = result; _vm->_globals.Nouv_objet = 1; _vm->_globals.OBJET_EN_COURS = objIndex; return result; @@ -141,8 +141,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { break; case 1: - sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.Bufferobjet, val2); - dataP = _vm->_globals.Bufferobjet; + sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_eventsManager.Bufferobjet, val2); + dataP = _vm->_eventsManager.Bufferobjet; break; case 3: -- cgit v1.2.3 From 96ca3ba91806929ca880cea25e535d70244f3f3e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Nov 2012 22:49:13 +0100 Subject: HOPKINS: Initialize FR variable (language) based on detected language. Could be improved, to be checked with a German version. --- engines/hopkins/globals.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1717ea8110..ee2ae86926 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -282,6 +282,22 @@ void Globals::setConfig() { HOPANM = "ANM"; HOPSEQ = "SEQ"; + // CHECKME: Should be in Globals() but it doesn't work + switch (_vm->getLanguage()) { + case Common::EN_ANY: + FR = 0; + break; + case Common::FR_FRA: + FR = 1; + break; + case Common::ES_ESP: + FR = 2; + break; + default: + warning("Language initialization to be verified"); + break; + } + switch (FR) { case 0: FICH_ZONE = "ZONEAN.TXT"; -- cgit v1.2.3 From c2a5b4b33962bb60954dba086ebafcc5464359a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 8 Nov 2012 08:29:26 +0100 Subject: HOPKINS: More full version initialization, change 2 variables to boolean --- engines/hopkins/globals.cpp | 11 +++++++++-- engines/hopkins/globals.h | 4 ++-- engines/hopkins/graphics.cpp | 10 ++++++++-- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/script.cpp | 2 +- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ee2ae86926..8e9d1bccba 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -116,8 +116,9 @@ Globals::Globals() { // Initialise fields FR = 0; SVGA = 2; - internet = 1; - PUBEXIT = 0; + internet = true; + + PUBEXIT = false; vitesse = 1; INSTALL_TYPE = 1; MUSICVOL = 6; @@ -298,6 +299,12 @@ void Globals::setConfig() { break; } + if (_vm->getIsDemo()) + internet = true; + else + internet = false; + // End of CHECKME + switch (FR) { case 0: FICH_ZONE = "ZONEAN.TXT"; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 204c05e4ed..607330ece3 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -316,8 +316,8 @@ public: TriItem Tri[51]; int FR; int SVGA; - int internet; - int PUBEXIT; + bool internet; + bool PUBEXIT; bool XFULLSCREEN; int XSETMODE; int XZOOM; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 72c01c2c37..3088953315 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -48,8 +48,14 @@ GraphicsManager::GraphicsManager() { PCX_L = PCX_H = 0; DOUBLE_ECRAN = false; OLD_SCROLL = 0; - MANU_SCROLL = 1; - SPEED_SCROLL = 16; + if (_vm->getIsDemo()) { + // CHECKME: Should be 0? + MANU_SCROLL = 1; + SPEED_SCROLL = 16; + } else { + MANU_SCROLL = 0; + SPEED_SCROLL = 32; + } nbrligne2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ba3c1da752..ca3c683732 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -980,7 +980,7 @@ void HopkinsEngine::REST_SYSTEM() { } void HopkinsEngine::PUBQUIT() { - _globals.PUBEXIT = 1; + _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); _globals.FORET = 0; _eventsManager.CASSE = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 57b691a129..a26ae0c7d3 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -722,7 +722,7 @@ LABEL_1141: if (!_vm->_globals.internet) { memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); v1 = _vm->_graphicsManager.OLD_PAL[769]; - _vm->_animationManager.PLAY_ANM2("plan.ANm", 50, 10, 800); + _vm->_animationManager.PLAY_ANM2("PLAN.ANM", 50, 10, 800); } _vm->_globals.NBBLOC = 0; } -- cgit v1.2.3 From d27056e5eaf7db33ac06b7043212cf2016e8c72c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 8 Nov 2012 20:28:07 +1100 Subject: HOPKINS: Fix crash in GraphicsManager constructor --- engines/hopkins/graphics.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3088953315..2dc4a23a67 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -48,14 +48,7 @@ GraphicsManager::GraphicsManager() { PCX_L = PCX_H = 0; DOUBLE_ECRAN = false; OLD_SCROLL = 0; - if (_vm->getIsDemo()) { - // CHECKME: Should be 0? - MANU_SCROLL = 1; - SPEED_SCROLL = 16; - } else { - MANU_SCROLL = 0; - SPEED_SCROLL = 32; - } + nbrligne2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; @@ -92,6 +85,15 @@ GraphicsManager::~GraphicsManager() { void GraphicsManager::setParent(HopkinsEngine *vm) { _vm = vm; + + if (_vm->getIsDemo()) { + // CHECKME: Should be 0? + MANU_SCROLL = 1; + SPEED_SCROLL = 16; + } else { + MANU_SCROLL = 0; + SPEED_SCROLL = 32; + } } void GraphicsManager::SET_MODE(int width, int height) { -- cgit v1.2.3 From 704fea1bcf0c4d7595a076802a654caa9c1f9f0b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Nov 2012 01:18:14 +0100 Subject: HOPKINS: The Linux game (full) now starts --- engines/hopkins/hopkins.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ca3c683732..456dee0639 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -104,6 +104,9 @@ Common::Error HopkinsEngine::run() { _soundManager.WSOUND_INIT(); + if (!getIsDemo()) + _soundManager.WSOUND(16); + _globals.CHARGE_OBJET(); _objectsManager.CHANGE_OBJET(14); _objectsManager.AJOUTE_OBJET(14); @@ -118,19 +121,28 @@ Common::Error HopkinsEngine::run() { _graphicsManager.LOAD_IMAGE("LINUX"); _graphicsManager.FADE_INW(); - _eventsManager.delay(1500); - _graphicsManager.FADE_OUTW(); - - if (!_globals.internet) { + if (getIsDemo()) + _eventsManager.delay(1500); + else { + _eventsManager.delay(500); + _globals.vitesse = 2; + _globals.iRegul = 1; _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); } - - _graphicsManager.LOAD_IMAGE("H2"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); + if (getIsDemo()) { + if (!_globals.internet) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); + } + + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + } + if (!_eventsManager.ESC_KEY) INTRORUN(); -- cgit v1.2.3 From 0942e16f65a069110115f3fddc4b1c1997b6c74e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 9 Nov 2012 22:11:38 +1100 Subject: HOPKINS: Bugfixes for cursor disappearing after using GMM. --- engines/hopkins/events.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index a65e27e186..48aea154a1 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -22,6 +22,7 @@ #include "common/system.h" #include "common/textconsole.h" +#include "graphics/cursorman.h" #include "hopkins/events.h" #include "hopkins/files.h" #include "hopkins/globals.h" @@ -122,14 +123,14 @@ int EventsManager::BMOUSE() { // Mouse Off void EventsManager::MOUSE_OFF() { souris_flag = false; - g_system->showMouse(false); + CursorMan.showMouse(false); } // Mouse On void EventsManager::MOUSE_ON() { souris_on(); souris_flag = true; - g_system->showMouse(true); + CursorMan.showMouse(true); } // Change Mouse Cursor @@ -508,7 +509,7 @@ void EventsManager::updateCursor() { // Set the ScummVM cursor from the surface Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - g_system->setMouseCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, + CursorMan.replaceCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, xOffset, 0, 0, true, &pixelFormat); // Delete the cursor surface -- cgit v1.2.3 From 0b72c77d28c4b294b95370ac0ba2c508181bec26 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Nov 2012 19:22:29 +0100 Subject: HOPKINS: Fix first displayed screen in full linux version --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 8e9d1bccba..e0bd0a4a3c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -152,7 +152,7 @@ Globals::Globals() { PLANX = PLANY = 0; PLANI = 0; PERSO = 0; - PASSWORD = 0; + PASSWORD = false; ECRAN = 0; NOSPRECRAN = 0; OLD_ECRAN = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 607330ece3..95f8bdf641 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -396,7 +396,7 @@ public: int SORTIE; int PLANX, PLANY; int PLANI; - int PASSWORD; + bool PASSWORD; // CHECKME: Useless variable? int NOSPRECRAN; int ECRAN; int OLD_ECRAN; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 456dee0639..a66012ae9f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -118,7 +118,10 @@ Common::Error HopkinsEngine::run() { _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); - _graphicsManager.LOAD_IMAGE("LINUX"); + if (getIsDemo()) + _graphicsManager.LOAD_IMAGE("LINUX"); + else + _graphicsManager.LOAD_IMAGE("H2"); _graphicsManager.FADE_INW(); if (getIsDemo()) @@ -153,7 +156,10 @@ Common::Error HopkinsEngine::run() { _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 2000); _globals.SORTIE = 0; - _globals.PASSWORD = 1; + if (getIsDemo()) + _globals.PASSWORD = true; + else + _globals.PASSWORD = false; LABEL_12: if (_globals.SORTIE == 300) -- cgit v1.2.3 From 11d73dfc8d383e1fe8084aafdcb5a5be83de09cb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 10 Nov 2012 23:32:06 +1100 Subject: HOPKINS: Beginnings of implementation of sound code --- engines/hopkins/sound.cpp | 249 +++++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/sound.h | 54 +++++++++- 2 files changed, 298 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 42eb98ec63..e43f66fd4a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -21,8 +21,11 @@ */ #include "common/system.h" +#include "common/file.h" #include "common/textconsole.h" #include "hopkins/sound.h" +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" namespace Hopkins { @@ -39,6 +42,15 @@ SoundManager::SoundManager() { VOICEOFF = true; TEXTOFF = false; SOUND_FLAG = false; + VBL_MERDE = false; + CARD_SB = false; + + for (int i = 0; i < VOICE_COUNT; ++i) + Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); + for (int i = 0; i < SWAV_COUNT; ++i) + Common::fill((byte *)&Swav[i], (byte *)&Swav[i] + sizeof(SwavItem), 0); + for (int i = 0; i < 2; ++i) + Common::fill((byte *)&Music[i], (byte *)&Music[i] + sizeof(MusicItem), 0); } void SoundManager::setParent(HopkinsEngine *vm) { @@ -63,16 +75,174 @@ void SoundManager::LOAD_WAV(const Common::String &file, int a2) { } void SoundManager::PLAY_ANM_SOUND(int soundNumber) { - warning("TODO: PLAAY_ANIM_SOUND"); + if (!_vm->_globals.CENSURE && SPECIAL_SOUND == 2) { + if (soundNumber == 20) + PLAY_SAMPLE2(5); + if (soundNumber == 57) + PLAY_SAMPLE2(1); + if (soundNumber == 63) + PLAY_SAMPLE2(1); + if (soundNumber == 69) + PLAY_SAMPLE2(1); + if (soundNumber == 75) + PLAY_SAMPLE2(2); + if (soundNumber == 109) + PLAY_SAMPLE2(3); + if (soundNumber == 122) + PLAY_SAMPLE2(4); + } + if (SPECIAL_SOUND == 1 && soundNumber == 17) + PLAY_SOUND("SOUND42.WAV"); + if (SPECIAL_SOUND == 199 && soundNumber == 72) + PLAY_WAV(1); + if (SPECIAL_SOUND == 198 && soundNumber == 15) + PLAY_WAV(1); + if (SPECIAL_SOUND == 16 && soundNumber == 25) + PLAY_WAV(1); + if (SPECIAL_SOUND == 14 && soundNumber == 625) + PLAY_WAV(1); + if (SPECIAL_SOUND == 208 && soundNumber == 40) + PLAY_WAV(1); + if (SPECIAL_SOUND == 210 && soundNumber == 2) + PLAY_WAV(1); + if (SPECIAL_SOUND == 211 && soundNumber == 22) + PLAY_WAV(1); + if (SPECIAL_SOUND == 5 && soundNumber == 19) + PLAY_WAV(1); + if (SPECIAL_SOUND == 17) { + if (soundNumber == 6) + PLAY_SAMPLE2(1); + if (soundNumber == 14) + PLAY_SAMPLE2(2); + if (soundNumber == 67) + PLAY_SAMPLE2(3); + } + if (SPECIAL_SOUND == 229) { + if (soundNumber == 15) + PLAY_WAV(1); + if (soundNumber == 91) + PLAY_WAV(2); + } } void SoundManager::WSOUND(int soundNumber) { warning("TODO: WSOUND"); } -bool SoundManager::VOICE_MIX(int a1, int a2) { - warning("TODO: VOICE_MIX"); - return false; +bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { + int fileNumber; + int oldMusicVol; + bool breakFlag; + Common::String prefix; + Common::String filename; + Common::File f; + int catPos; + + fileNumber = voiceId; + if (!CARD_SB || VOICEOFF == 1) + return false; + + if ((unsigned int)(voiceMode - 1) <= 1 + && (voiceId == 4 + || voiceId == 16 + || voiceId == 121 + || voiceId == 142 + || voiceId == 182 + || voiceId == 191 + || voiceId == 212 + || voiceId == 225 + || voiceId == 239 + || voiceId == 245 + || voiceId == 297 + || voiceId == 308 + || voiceId == 333 + || voiceId == 348 + || voiceId == 352 + || voiceId == 358 + || voiceId == 364 + || voiceId == 371 + || voiceId == 394 + || voiceId == 414 + || voiceId == 429 + || voiceId == 442 + || voiceId == 446 + || voiceId == 461 + || voiceId == 468 + || voiceId == 476 + || voiceId == 484 + || voiceId == 491 + || voiceId == 497 + || voiceId == 501 + || voiceId == 511 + || voiceId == 520 + || voiceId == 536 + || voiceId == 554 + || voiceId == 566 + || voiceId == 573 + || voiceId == 632 + || voiceId == 645)) + fileNumber = 684; + + if ((unsigned int)(voiceMode - 1) <= 1) { + prefix = "DF"; + } + if (voiceMode == 3) { + prefix = "IF"; + } + if (voiceMode == 4) { + prefix = "TF"; + } + if (voiceMode == 5) { + prefix = "OF"; + } + + filename = Common::String::format("%s%d.WAV", prefix.c_str(), fileNumber); + + if (!_vm->_fileManager.RECHERCHE_CAT(filename, 9)) { + if (_vm->_globals.FR == 1) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VFR.RES"); + if (!_vm->_globals.FR) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VAN.RES"); + if (_vm->_globals.FR == 2) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VES.RES"); + + catPos = _vm->_globals.CAT_POSI; + } else { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename); + + if (!f.exists(_vm->_globals.NFICHIER)) + return false; + + catPos = 0; + } + + SDL_LVOICE(catPos); + oldMusicVol = MUSICVOL; + if (!MUSICOFF && MUSICVOL > 2) + MUSICVOL = (signed int)((long double)MUSICVOL - (long double)MUSICVOL / 100.0 * 45.0); + + PLAY_VOICE_SDL(); + + breakFlag = 0; + do { + if (SPECIAL_SOUND != 4 && !VBL_MERDE) + _vm->_eventsManager.VBL(); + if (_vm->_eventsManager.BMOUSE()) + break; + _vm->_eventsManager.CONTROLE_MES(); + if (_vm->_eventsManager.ESC_KEY) + break; + if (!VOICE_STAT(2)) + breakFlag = true; + } while (!_vm->shouldQuit() && !breakFlag); + + + STOP_VOICE(2); + DEL_SAMPLE_SDL(20); + MUSICVOL = oldMusicVol; + _vm->_eventsManager.ESC_KEY = false; + VBL_MERDE = 0; + return true; } void SoundManager::DEL_SAMPLE(int soundNumber) { @@ -111,4 +281,75 @@ void SoundManager::PLAY_WAV(int a1) { warning("PLAY_WAV"); } +bool SoundManager::VOICE_STAT(int voiceIndex) { + return Voice[voiceIndex].active; +} + +void SoundManager::STOP_VOICE(int voiceIndex) { + int wavIndex; + + if (Voice[voiceIndex].active) { + Voice[voiceIndex].active = false; + wavIndex = Voice[voiceIndex].wavIndex; + if (Swav[wavIndex].active) { + if (Swav[wavIndex].field24 == 1) + DEL_SAMPLE_SDL(wavIndex); + } + } + Voice[voiceIndex].audioLen = 0; + Voice[voiceIndex].fieldC = 0; + Voice[voiceIndex].audioBuf = NULL; + Voice[voiceIndex].active = false; + Voice[voiceIndex].field14 = 0; + Voice[voiceIndex].audioStream = NULL; +} + +void SoundManager::SDL_LVOICE(int catPos) { + if (!SDL_LoadVoice(_vm->_globals.NFICHIER, catPos, Swav[20])) + error("Couldn't load the sample %s", _vm->_globals.NFICHIER.c_str()); + + Swav[20].active = true; +} + +void SoundManager::PLAY_VOICE_SDL() { + if (!Swav[20].active) + error("Bad handle"); + + if (!Voice[2].active) { + int wavIndex = Voice[2].wavIndex; + if (Swav[wavIndex].active && Swav[wavIndex].field24 == 1) + DEL_SAMPLE_SDL(wavIndex); + } + + Voice[2].audioLen = Swav[20].audioLen; + Voice[2].fieldC = 0; + Voice[2].audioBuf = Swav[20].audioBuf; + Voice[2].active = true; + Voice[2].field14 = 4; + Voice[2].audioStream = Swav[20].audioStream; +} + +bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { + if (Swav[wavIndex].active) { + Swav[wavIndex].active = false; + free(Swav[wavIndex].audioBuf); + delete Swav[wavIndex].audioStream; + return true; + } else { + return false; + } +} + +bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffset, SwavItem &item) { + Common::File f; + if (!f.open(filename)) + error("Could not open %s for reading", filename.c_str()); + + f.seek(fileOffset); + item.audioStream = Audio::makeWAVStream(&f, DisposeAfterUse::NO); + f.close(); + + return true; +} + } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 2dfdac7749..fc4c0f5231 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -25,14 +25,61 @@ #include "common/scummsys.h" #include "common/str.h" +#include "audio/audiostream.h" +#include "audio/decoders/wave.h" namespace Hopkins { +class VoiceItem { +public: + bool active; + int wavIndex; + Audio::RewindableAudioStream *audioStream; + + // Decprecated fields + int audioLen; + int fieldC; + byte *audioBuf; + + int field14; +}; + +class SwavItem { +public: + bool active; + Audio::RewindableAudioStream *audioStream; + + // Deprecated fields + int audioSpec; + byte *audioBuf; + int audioLen; + + int field24; +}; + +class MusicItem { +public: + byte field0; + byte field1; + int field16[50]; +}; + +#define VOICE_COUNT 3 +#define SWAV_COUNT 50 + class HopkinsEngine; class SoundManager { private: HopkinsEngine *_vm; + + bool VOICE_STAT(int voiceIndex); + void STOP_VOICE(int voiceIndex); + void SDL_LVOICE(int catPos); + void PLAY_VOICE_SDL(); + bool DEL_SAMPLE_SDL(int wavIndex); + bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, SwavItem &item); + public: int SPECIAL_SOUND; int SOUNDVOL; @@ -46,6 +93,11 @@ public: bool VOICEOFF; bool TEXTOFF; bool SOUND_FLAG; + bool VBL_MERDE; + bool CARD_SB; + VoiceItem Voice[VOICE_COUNT]; + SwavItem Swav[SWAV_COUNT]; + MusicItem Music[2]; public: SoundManager(); void setParent(HopkinsEngine *vm); @@ -56,7 +108,7 @@ public: void LOAD_WAV(const Common::String &file, int a2); void PLAY_ANM_SOUND(int soundNumber); void WSOUND(int soundNumber); - bool VOICE_MIX(int a1, int a2); + bool VOICE_MIX(int voiceId, int voiceMode); void DEL_SAMPLE(int soundNumber); void PLAY_SOUND(const Common::String &file); void PLAY_SOUND2(const Common::String &file2); -- cgit v1.2.3 From 8290b04018080e9f0698e6f53a92e677a76460db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Nov 2012 23:52:49 +0100 Subject: HOPKINS: Split run() in two in order to prepare future diffing between versions --- engines/hopkins/hopkins.cpp | 466 ++++++++++++++++++++++++++++++++++++++++---- engines/hopkins/hopkins.h | 4 + 2 files changed, 435 insertions(+), 35 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a66012ae9f..a6ebfb6097 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -104,9 +104,31 @@ Common::Error HopkinsEngine::run() { _soundManager.WSOUND_INIT(); - if (!getIsDemo()) - _soundManager.WSOUND(16); + bool retVal; + if (getPlatform() == Common::kPlatformLinux) { + if (getIsDemo()) + retVal = runLinuxDemo(); + else + retVal = runLinuxFull(); + } else { + warning("Unhandled version, switching to linux demo"); + retVal = runLinuxDemo(); + } + + if (!retVal) + return Common::kNoError; + + // Stub event loop + Common::Event evt; + while (!g_system->getEventManager()->shouldQuit()) { + while (g_system->getEventManager()->pollEvent(evt)) + g_system->updateScreen(); + } + + return Common::kNoError; +} +bool HopkinsEngine::runLinuxDemo() { _globals.CHARGE_OBJET(); _objectsManager.CHANGE_OBJET(14); _objectsManager.AJOUTE_OBJET(14); @@ -118,33 +140,418 @@ Common::Error HopkinsEngine::run() { _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); - if (getIsDemo()) - _graphicsManager.LOAD_IMAGE("LINUX"); - else - _graphicsManager.LOAD_IMAGE("H2"); - + _graphicsManager.LOAD_IMAGE("LINUX"); _graphicsManager.FADE_INW(); - if (getIsDemo()) - _eventsManager.delay(1500); - else { - _eventsManager.delay(500); - _globals.vitesse = 2; - _globals.iRegul = 1; + _eventsManager.delay(1500); + _graphicsManager.FADE_OUTW(); + + if (!_globals.internet) { _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); } + + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); - if (getIsDemo()) { - if (!_globals.internet) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); + if (!_eventsManager.ESC_KEY) + INTRORUN(); + + _globals.iRegul = 0; + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.PLANX = _globals.PLANY = 0; + memset(_globals.SAUVEGARDE, 0, 2000); + _globals.SORTIE = 0; + _globals.PASSWORD = true; + +LABEL_12: + if (_globals.SORTIE == 300) +LABEL_13: + _globals.SORTIE = 0; + + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + if (!g_system->getEventManager()->shouldQuit()) + PUBQUIT(); + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); } + } + + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + if (g_system->getEventManager()->shouldQuit()) + return false; + + if (_globals.SORTIE == 300) + goto LABEL_13; + if (_globals.SORTIE == 18) + PASS(); + if (_globals.SORTIE == 23) + PASS(); + if (_globals.SORTIE == 22) + PASS(); + if (_globals.SORTIE == 19) + PASS(); + if (_globals.SORTIE == 20) + PASS(); + if (_globals.SORTIE != 1) + break; + + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + } + + if (_globals.SORTIE != 3) + break; + + if (!*((byte *)_globals.SAUVEGARDE + 170)) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + if (_globals.FR == 2) + _graphicsManager.LOAD_IMAGE("fondes"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + if (_globals.CENSURE == 1) + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + *((byte *)_globals.SAUVEGARDE + 170) = 1; + } + + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + } + + if (_globals.SORTIE != 4) + break; + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + } + + if (_globals.SORTIE != 5) + break; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 455; + _globals.NOSPRECRAN = 1; + byte v1 = *((byte *)_globals.SAUVEGARDE + 80); + if (v1) { + if (v1 == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + _globals.NOSPRECRAN = 0; + } + + if (_globals.SORTIE != 8) + break; + + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + } + + if (_globals.SORTIE != 6) + break; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + } + + if (_globals.SORTIE != 7) + break; + if (*((byte *)_globals.SAUVEGARDE + 220)) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + } + + if (_globals.SORTIE == 9) { + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + + if (!*((byte *)_globals.SAUVEGARDE + 225)) + goto LABEL_109; + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + } else { + if (_globals.SORTIE == 10) { + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + goto LABEL_124; + } + + if (_globals.SORTIE == 11) { + _globals.NOSPRECRAN = 1; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + goto LABEL_124; + } + + switch (_globals.SORTIE) { + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (*((byte *)_globals.SAUVEGARDE + 225)) { + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { +LABEL_109: + BOOM(); + } + break; + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + default: + if (_globals.SORTIE == 15) { + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + goto LABEL_124; + } + if (_globals.SORTIE == 16) { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; - _graphicsManager.LOAD_IMAGE("H2"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + byte v2 = *((byte *)_globals.SAUVEGARDE + 113); + if (v2 == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!v2) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + } else { + if (_globals.SORTIE == 17) + PASS(); + if (_globals.SORTIE == 24) + PASS(); + if (_globals.SORTIE == 25) { + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + } else { + if (_globals.SORTIE == 33) { + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + goto LABEL_124; + } + + if (_globals.SORTIE == 26) { + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + } else { + if (_globals.SORTIE == 27) + PASS(); + if (_globals.SORTIE == 28) + PASS(); + if (_globals.SORTIE == 29) + PASS(); + if (_globals.SORTIE == 30) + PASS(); + if (_globals.SORTIE == 31) + PASS(); + if (_globals.SORTIE == 35) + ENDEMO(); + if (_globals.SORTIE == 32) + PASS(); + if (_globals.SORTIE == 34) + PASS(); + + if ((uint16)(_globals.SORTIE - 51) <= 38) + PASS(); + if (_globals.SORTIE == 111) { + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + goto LABEL_124; + } + + if (_globals.SORTIE == 112) { + _globals.NOSPRECRAN = 1; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); +LABEL_124: + _globals.NOSPRECRAN = 0; + } else if (_globals.SORTIE == 113) { + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 113; + *((byte *)_globals.SAUVEGARDE + 5) = 113; + _menuManager.COMPUT_HOPKINS(1); + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); + memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + _graphicsManager.Cls_Pal(); + _graphicsManager.RESET_SEGMENT_VESA(); + } else { + if (_globals.SORTIE == 114) { + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 114; + *((byte *)_globals.SAUVEGARDE + 5) = 114; + _menuManager.COMPUT_HOPKINS(2); + goto LABEL_128; + } + if (_globals.SORTIE == 115) { + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 115; + *((byte *)_globals.SAUVEGARDE + 5) = 115; + _menuManager.COMPUT_HOPKINS(3); + +LABEL_128: + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + } else if ((uint16)(_globals.SORTIE - 194) > 5) { + if (_globals.SORTIE == 151) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + + if (_globals.SORTIE == 150) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + + if (_globals.SORTIE == 152) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + goto LABEL_12; + } + } + } + } + } + break; + } + } } + return true; +} + +bool HopkinsEngine::runLinuxFull() { + _soundManager.WSOUND(16); + + _globals.CHARGE_OBJET(); + _objectsManager.CHANGE_OBJET(14); + _objectsManager.AJOUTE_OBJET(14); + + _globals.HELICO = 0; + _eventsManager.MOUSE_OFF(); + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + + _globals.vitesse = 2; + _globals.iRegul = 1; + _graphicsManager.FADE_LINUX = 2; + _graphicsManager.FADE_OUTW(); if (!_eventsManager.ESC_KEY) INTRORUN(); @@ -156,10 +563,7 @@ Common::Error HopkinsEngine::run() { _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 2000); _globals.SORTIE = 0; - if (getIsDemo()) - _globals.PASSWORD = true; - else - _globals.PASSWORD = false; + _globals.PASSWORD = false; LABEL_12: if (_globals.SORTIE == 300) @@ -185,7 +589,7 @@ LABEL_13: for (;;) { for (;;) { if (g_system->getEventManager()->shouldQuit()) - return Common::kNoError; + return false; if (_globals.SORTIE == 300) goto LABEL_13; @@ -521,15 +925,7 @@ LABEL_128: } } } - - // Stub event loop - Common::Event evt; - while (!g_system->getEventManager()->shouldQuit()) { - while (g_system->getEventManager()->pollEvent(evt)) - g_system->updateScreen(); - } - - return Common::kNoError; + return true; } bool HopkinsEngine::shouldQuit() const { diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 1399a80498..b2ae4d940d 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -91,6 +91,10 @@ private: void PUBQUIT(); void ENDEMO(); void BOOM(); + + bool runLinuxDemo(); + bool runLinuxFull(); + protected: // Engine APIs virtual Common::Error run(); -- cgit v1.2.3 From ebb1b80a71d11b087a6448d6117fd04fddbc1da9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 15:21:30 +1100 Subject: HOPKINS: Basic voice playback now working --- engines/hopkins/dialogs.cpp | 26 +++- engines/hopkins/hopkins.cpp | 11 +- engines/hopkins/hopkins.h | 6 + engines/hopkins/sound.cpp | 302 ++++++++++++++++++++++++++++++++++++++------ engines/hopkins/sound.h | 47 ++++--- 5 files changed, 332 insertions(+), 60 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 28207bf6c7..4013afd775 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -21,6 +21,7 @@ */ #include "common/scummsys.h" +#include "common/config-manager.h" #include "common/events.h" #include "common/file.h" #include "common/util.h" @@ -77,6 +78,7 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_soundManager.MUSICOFF) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { + // Change the music volume ++_vm->_soundManager.MUSICVOL; _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; @@ -85,6 +87,8 @@ void DialogsManager::showOptionsDialog() { else _vm->_soundManager.MUSICVOL = 12; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); + + _vm->_soundManager.updateScummVMSoundSettings(); } if (!_vm->_soundManager.MUSICOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { @@ -96,6 +100,8 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); + + _vm->_soundManager.updateScummVMSoundSettings(); } } if (!_vm->_soundManager.SOUNDOFF) { @@ -107,6 +113,8 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.SOUNDVOL = 16; _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; _vm->_soundManager.MODSetSampleVolume(); + + _vm->_soundManager.updateScummVMSoundSettings(); } if (!_vm->_soundManager.SOUNDOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { @@ -117,6 +125,8 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.SOUNDVOL = 0; _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; _vm->_soundManager.MODSetSampleVolume(); + + _vm->_soundManager.updateScummVMSoundSettings(); } } @@ -130,6 +140,8 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.VOICEVOL = 16; _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; _vm->_soundManager.MODSetVoiceVolume(); + + _vm->_soundManager.updateScummVMSoundSettings(); } if (!_vm->_soundManager.VOICEOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { @@ -140,6 +152,8 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.VOICEVOL = 0; _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; _vm->_soundManager.MODSetVoiceVolume(); + + _vm->_soundManager.updateScummVMSoundSettings(); } } @@ -148,8 +162,11 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.TEXTOFF = _vm->_soundManager.TEXTOFF != 1; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) + if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) { _vm->_soundManager.VOICEOFF = _vm->_soundManager.VOICEOFF != 1; + + _vm->_soundManager.updateScummVMSoundSettings(); + } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { if (_vm->_soundManager.MUSICOFF == 1) { @@ -159,10 +176,15 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.MUSICOFF = 1; _vm->_soundManager.MODSetMusicVolume(0); } + + _vm->_soundManager.updateScummVMSoundSettings(); } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) { _vm->_soundManager.SOUNDOFF = _vm->_soundManager.SOUNDOFF != 1; + + _vm->_soundManager.updateScummVMSoundSettings(); + } } } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a6ebfb6097..d75a29e324 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -959,7 +959,10 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { void HopkinsEngine::INIT_SYSTEM() { // Set graphics mode _graphicsManager.SET_MODE(640, 480); - + + // Synchronise the sound settings from ScummVM + _soundManager.syncSoundSettings(); + if (getPlatform() == Common::kPlatformLinux) _eventsManager.mouse_linux = true; else @@ -1426,4 +1429,10 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } +void HopkinsEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + _soundManager.syncSoundSettings(); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index b2ae4d940d..944c7c963e 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -116,6 +116,7 @@ public: ScriptManager _scriptManager; SoundManager _soundManager; TalkManager _talkManager; + public: HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc); virtual ~HopkinsEngine(); @@ -139,6 +140,11 @@ public: * Run the introduction sequence */ void INTRORUN(); + + /** + * Synchronises the sound settings from ScummVM into the engine + */ + virtual void syncSoundSettings(); }; // Global reference to the HopkinsEngine object diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e43f66fd4a..c3f9f86b7b 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/config-manager.h" #include "common/file.h" #include "common/textconsole.h" #include "hopkins/sound.h" @@ -43,7 +44,8 @@ SoundManager::SoundManager() { TEXTOFF = false; SOUND_FLAG = false; VBL_MERDE = false; - CARD_SB = false; + CARD_SB = true; + SOUND_NUM = 0; for (int i = 0; i < VOICE_COUNT; ++i) Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); @@ -51,6 +53,8 @@ SoundManager::SoundManager() { Common::fill((byte *)&Swav[i], (byte *)&Swav[i] + sizeof(SwavItem), 0); for (int i = 0; i < 2; ++i) Common::fill((byte *)&Music[i], (byte *)&Music[i] + sizeof(MusicItem), 0); + for (int i = 0; i < SOUND_COUNT; ++i) + Common::fill((byte *)&SOUND[i], (byte *)&SOUND[i] + sizeof(SoundItem), 0); } void SoundManager::setParent(HopkinsEngine *vm) { @@ -63,15 +67,44 @@ void SoundManager::WSOUND_INIT() { } void SoundManager::VERIF_SOUND() { -// warning("TODO: VERIF_SOUND"); + if (CARD_SB && !SOUNDOFF && SOUND_FLAG) { + if (!VOICE_STAT(1)) { + STOP_VOICE(1); + DEL_NWAV(SOUND_NUM); + } + } } void SoundManager::LOAD_ANM_SOUND() { - warning("TODO: LOAD_ANIM_SOUND"); -} - -void SoundManager::LOAD_WAV(const Common::String &file, int a2) { - warning("TODO: LOAD_WAV"); + if (SPECIAL_SOUND == 200) + VOICE_MIX(682, 1); + if (SPECIAL_SOUND == 199) + LOAD_WAV("SOUND22.WAV", 1); + if (SPECIAL_SOUND == 198) + LOAD_WAV("SOUND3.WAV", 1); + if (SPECIAL_SOUND == 16) + LOAD_WAV("SOUND16.WAV", 1); + if (SPECIAL_SOUND == 14) + LOAD_WAV("SOUND14.WAV", 1); + if (SPECIAL_SOUND == 208) + LOAD_WAV("SOUND77.WAV", 1); + if (SPECIAL_SOUND == 210) + LOAD_WAV("SOUND78.WAV", 1); + if (SPECIAL_SOUND == 211) + LOAD_WAV("SOUND78.WAV", 1); + if (SPECIAL_SOUND == 5) + LOAD_WAV("CRIE.WAV", 1); + if (SPECIAL_SOUND == 2) { + CHARGE_SAMPLE(5, "mitra1.wav"); + CHARGE_SAMPLE(1, "tir2.wav"); + CHARGE_SAMPLE(2, "sound6.wav"); + CHARGE_SAMPLE(3, "sound5.WAV"); + CHARGE_SAMPLE(4, "sound4.WAV"); + } + if (SPECIAL_SOUND == 229) { + LOAD_WAV("SOUND80.WAV", 1); + LOAD_WAV("SOUND82.WAV", 2); + } } void SoundManager::PLAY_ANM_SOUND(int soundNumber) { @@ -127,6 +160,75 @@ void SoundManager::PLAY_ANM_SOUND(int soundNumber) { void SoundManager::WSOUND(int soundNumber) { warning("TODO: WSOUND"); +/* + if (CARD_SB && (old_music != a1 || !MOD_FLAG)) { + if (MOD_FLAG == 1) + result = WSOUND_OFF(); + if (a1 == 1) + result = PLAY_MOD("appar"); + if (a1 == 2) + result = PLAY_MOD("ville"); + if (a1 == 3) + result = PLAY_MOD("Rock"); + if (a1 == 4) + result = PLAY_MOD("polic"); + if (a1 == 5) + result = PLAY_MOD("deep"); + if (a1 == 6) + result = PLAY_MOD("purga"); + if (a1 == 12) + result = PLAY_MOD("purg2"); + if (a1 == 7) + result = PLAY_MOD("rivie"); + if (a1 == 8) + result = PLAY_MOD("SUSPE"); + if (a1 == 9) + result = PLAY_MOD("labo"); + if (a1 == 10) + result = PLAY_MOD("cadav"); + if (a1 == 11) + result = PLAY_MOD("caban"); + if (a1 == 13) + result = PLAY_MOD("foret"); + if (a1 == 14) + result = PLAY_MOD("ile"); + if (a1 == 15) + result = PLAY_MOD("ile2"); + if (a1 == 16) + result = PLAY_MOD("hopki"); + if (a1 == 17) + result = PLAY_MOD("peur"); + if (a1 == 18) + result = PLAY_MOD("peur"); + if (a1 == 19) + result = PLAY_MOD("BASE"); + if (a1 == 20) + result = PLAY_MOD("cada2"); + if (a1 == 21) + result = PLAY_MOD("usine"); + if (a1 == 22) + result = PLAY_MOD("chien"); + if (a1 == 23) + result = PLAY_MOD("coeur"); + if (a1 == 24) + result = PLAY_MOD("stand"); + if (a1 == 25) + result = PLAY_MOD("ocean"); + if (a1 == 26) + result = PLAY_MOD("base3"); + if (a1 == 27) + result = PLAY_MOD("gloop"); + if (a1 == 28) + result = PLAY_MOD("cant"); + if (a1 == 29) + result = PLAY_MOD("feel"); + if (a1 == 30) + result = PLAY_MOD("lost"); + if (a1 == 31) + result = PLAY_MOD("tobac"); + old_music = a1; + } +*/ } bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { @@ -136,7 +238,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { Common::String prefix; Common::String filename; Common::File f; - int catPos; + size_t catPos, catLen; fileNumber = voiceId; if (!CARD_SB || VOICEOFF == 1) @@ -207,6 +309,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals.CAT_POSI; + catLen = _vm->_globals.CAT_TAILLE; } else { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename); @@ -214,15 +317,17 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { return false; catPos = 0; + catLen = 0; } - SDL_LVOICE(catPos); + SDL_LVOICE(catPos, catLen); oldMusicVol = MUSICVOL; if (!MUSICOFF && MUSICVOL > 2) MUSICVOL = (signed int)((long double)MUSICVOL - (long double)MUSICVOL / 100.0 * 45.0); PLAY_VOICE_SDL(); + // Loop for playing voice breakFlag = 0; do { if (SPECIAL_SOUND != 4 && !VBL_MERDE) @@ -245,16 +350,35 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { return true; } -void SoundManager::DEL_SAMPLE(int soundNumber) { - warning("TODO: DEL_SAMPLE"); +void SoundManager::DEL_SAMPLE(int soundIndex) { + if (CARD_SB) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + if (VOICE_STAT(2) == 2) + STOP_VOICE(2); + if (VOICE_STAT(3) == 3) + STOP_VOICE(3); + DEL_SAMPLE_SDL(soundIndex); + SOUND[soundIndex].active = false; + } } void SoundManager::PLAY_SOUND(const Common::String &file) { - warning("TODO: PLAY_SOUND"); + if (CARD_SB && !SOUNDOFF) { + if (SOUND_FLAG) + DEL_NWAV(SOUND_NUM); + LOAD_NWAV(file, 1); + PLAY_NWAV(1); + } } void SoundManager::PLAY_SOUND2(const Common::String &file) { - warning("TODO: PLAY_SOUND2"); + if (CARD_SB) { + if (!SOUNDOFF) { + LOAD_NWAV(file, 1); + PLAY_NWAV(1); + } + } } void SoundManager::MODSetSampleVolume() { @@ -269,43 +393,62 @@ void SoundManager::MODSetMusicVolume(int volume) { warning("TODO MODSetMusicVolume"); } -void SoundManager::CHARGE_SAMPLE(int a1, const Common::String &file) { - warning("TODO: CHARGE_SAMPLE"); +void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { + if (CARD_SB) { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); + LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); + SOUND[wavIndex].active = true; + } } void SoundManager::PLAY_SAMPLE2(int idx) { - warning("PLAY_SAMPLE2"); + if (CARD_SB && !SOUNDOFF && SOUND[idx].active) { + if (SOUND_FLAG) + DEL_NWAV(SOUND_NUM); + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(1, idx); + } +} + +void SoundManager::LOAD_WAV(const Common::String &file, int wavIndex) { + if (CARD_SB) + LOAD_NWAV(file, wavIndex); } -void SoundManager::PLAY_WAV(int a1) { - warning("PLAY_WAV"); +void SoundManager::PLAY_WAV(int wavIndex) { + if (CARD_SB) + PLAY_NWAV(wavIndex); } -bool SoundManager::VOICE_STAT(int voiceIndex) { - return Voice[voiceIndex].active; +int SoundManager::VOICE_STAT(int voiceIndex) { + if (Voice[voiceIndex].status) { + if (Voice[voiceIndex].audioStream->endOfStream()) + STOP_VOICE(voiceIndex); + } + + return Voice[voiceIndex].status; } void SoundManager::STOP_VOICE(int voiceIndex) { int wavIndex; - if (Voice[voiceIndex].active) { - Voice[voiceIndex].active = false; + if (Voice[voiceIndex].status) { + Voice[voiceIndex].status = 0; wavIndex = Voice[voiceIndex].wavIndex; if (Swav[wavIndex].active) { if (Swav[wavIndex].field24 == 1) DEL_SAMPLE_SDL(wavIndex); } } - Voice[voiceIndex].audioLen = 0; Voice[voiceIndex].fieldC = 0; - Voice[voiceIndex].audioBuf = NULL; - Voice[voiceIndex].active = false; + Voice[voiceIndex].status = 0; Voice[voiceIndex].field14 = 0; Voice[voiceIndex].audioStream = NULL; } -void SoundManager::SDL_LVOICE(int catPos) { - if (!SDL_LoadVoice(_vm->_globals.NFICHIER, catPos, Swav[20])) +void SoundManager::SDL_LVOICE(size_t filePosition, size_t entryLength) { + if (!SDL_LoadVoice(_vm->_globals.NFICHIER, filePosition, entryLength, Swav[20])) error("Couldn't load the sample %s", _vm->_globals.NFICHIER.c_str()); Swav[20].active = true; @@ -315,24 +458,20 @@ void SoundManager::PLAY_VOICE_SDL() { if (!Swav[20].active) error("Bad handle"); - if (!Voice[2].active) { + if (!Voice[2].status) { int wavIndex = Voice[2].wavIndex; if (Swav[wavIndex].active && Swav[wavIndex].field24 == 1) DEL_SAMPLE_SDL(wavIndex); } - Voice[2].audioLen = Swav[20].audioLen; - Voice[2].fieldC = 0; - Voice[2].audioBuf = Swav[20].audioBuf; - Voice[2].active = true; - Voice[2].field14 = 4; - Voice[2].audioStream = Swav[20].audioStream; + PLAY_SAMPLE_SDL(2, 20); } bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { if (Swav[wavIndex].active) { Swav[wavIndex].active = false; - free(Swav[wavIndex].audioBuf); + + _vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle); delete Swav[wavIndex].audioStream; return true; } else { @@ -340,16 +479,105 @@ bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { } } -bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffset, SwavItem &item) { +bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item) { Common::File f; if (!f.open(filename)) error("Could not open %s for reading", filename.c_str()); f.seek(fileOffset); - item.audioStream = Audio::makeWAVStream(&f, DisposeAfterUse::NO); + item.audioStream = Audio::makeWAVStream(f.readStream((entryLength == 0) ? f.size() : entryLength), + DisposeAfterUse::YES); f.close(); return true; } +void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, int field24) { + if (Swav[wavIndex].active) + DEL_SAMPLE_SDL(wavIndex); + + SDL_LoadVoice(filename, 0, 0, Swav[wavIndex]); + Swav[wavIndex].active = true; + Swav[wavIndex].field24 = field24; +} + +void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { + if (CARD_SB) { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); + LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 1); + } +} + +void SoundManager::PLAY_NWAV(int wavIndex) { + if (CARD_SB && !SOUND_FLAG && !SOUNDOFF) { + SOUND_FLAG = true; + SOUND_NUM = wavIndex; + PLAY_SAMPLE_SDL(1, wavIndex); + } +} + +void SoundManager::DEL_NWAV(int wavIndex) { + if (CARD_SB) { + if (DEL_SAMPLE_SDL(wavIndex)) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + + SOUND_NUM = 0; + SOUND_FLAG = false; + } + } +} + +void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { + if (!Swav[wavIndex].active) + warning("Bad handle"); + + if (Voice[voiceIndex].status == 1 && Swav[wavIndex].active && Swav[wavIndex].field24 == 1) + DEL_SAMPLE_SDL(wavIndex); + + Voice[voiceIndex].fieldC = 0; + Voice[voiceIndex].audioStream = Swav[wavIndex].audioStream; + Voice[voiceIndex].status = 1; + Voice[voiceIndex].field14 = 4; + + int volume = (voiceIndex == 2) ? VOICEVOL * 255 / 16 : SOUNDVOL * 255 / 16; + + // Start the voice playing + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, + Swav[wavIndex].audioStream, -1, volume, 0, DisposeAfterUse::NO); +} + +void SoundManager::syncSoundSettings() { + bool muteAll = false; + if (ConfMan.hasKey("mute")) + muteAll = ConfMan.getBool("mute"); + + // Update the mute settings + MUSICOFF = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); + SOUNDOFF = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); + VOICEOFF = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); + + // Update the volume levels + MUSICVOL = MIN(255, ConfMan.getInt("music_volume")) * 16 / 255; + SOUNDVOL = MIN(255, ConfMan.getInt("sfx_volume")) * 16 / 255; + VOICEVOL = MIN(255, ConfMan.getInt("speech_volume")) * 16 / 255; + + // + for (int idx = 0; idx < SWAV_COUNT; ++idx) { + if (Swav[idx].active) { + } + } +} + +void SoundManager::updateScummVMSoundSettings() { + ConfMan.setBool("mute", MUSICOFF && SOUNDOFF && VOICEOFF); + ConfMan.setBool("music_mute", MUSICOFF); + ConfMan.setBool("sfx_mute", SOUNDOFF); + ConfMan.setBool("speech_mute", VOICEOFF); + + ConfMan.setInt("music_volume", MUSICVOL * 255 / 16); + ConfMan.setInt("sfx_volume", SOUNDVOL * 255 / 16); + ConfMan.setInt("speech_volume", VOICEVOL * 255 / 16); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index fc4c0f5231..4f3e065521 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -27,20 +27,16 @@ #include "common/str.h" #include "audio/audiostream.h" #include "audio/decoders/wave.h" +#include "audio/mixer.h" namespace Hopkins { class VoiceItem { public: - bool active; + int status; int wavIndex; Audio::RewindableAudioStream *audioStream; - - // Decprecated fields - int audioLen; int fieldC; - byte *audioBuf; - int field14; }; @@ -48,12 +44,7 @@ class SwavItem { public: bool active; Audio::RewindableAudioStream *audioStream; - - // Deprecated fields - int audioSpec; - byte *audioBuf; - int audioLen; - + Audio::SoundHandle _soundHandle; int field24; }; @@ -64,8 +55,15 @@ public: int field16[50]; }; +class SoundItem { +public: + bool active; + +}; + #define VOICE_COUNT 3 #define SWAV_COUNT 50 +#define SOUND_COUNT 10 class HopkinsEngine; @@ -73,13 +71,17 @@ class SoundManager { private: HopkinsEngine *_vm; - bool VOICE_STAT(int voiceIndex); + int VOICE_STAT(int voiceIndex); void STOP_VOICE(int voiceIndex); - void SDL_LVOICE(int catPos); + void SDL_LVOICE(size_t filePosition, size_t entryLength); void PLAY_VOICE_SDL(); bool DEL_SAMPLE_SDL(int wavIndex); - bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, SwavItem &item); - + bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); + void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, int field24); + void LOAD_NWAV(const Common::String &file, int wavIndex); + void PLAY_NWAV(int wavIndex); + void DEL_NWAV(int wavIndex); + void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); public: int SPECIAL_SOUND; int SOUNDVOL; @@ -95,9 +97,11 @@ public: bool SOUND_FLAG; bool VBL_MERDE; bool CARD_SB; + int SOUND_NUM; VoiceItem Voice[VOICE_COUNT]; SwavItem Swav[SWAV_COUNT]; MusicItem Music[2]; + SoundItem SOUND[SOUND_COUNT]; public: SoundManager(); void setParent(HopkinsEngine *vm); @@ -105,19 +109,22 @@ public: void WSOUND_INIT(); void VERIF_SOUND(); void LOAD_ANM_SOUND(); - void LOAD_WAV(const Common::String &file, int a2); void PLAY_ANM_SOUND(int soundNumber); + void LOAD_WAV(const Common::String &file, int wavIndex); void WSOUND(int soundNumber); bool VOICE_MIX(int voiceId, int voiceMode); - void DEL_SAMPLE(int soundNumber); + void DEL_SAMPLE(int soundIndex); void PLAY_SOUND(const Common::String &file); void PLAY_SOUND2(const Common::String &file2); void MODSetSampleVolume(); void MODSetVoiceVolume(); void MODSetMusicVolume(int volume); - void CHARGE_SAMPLE(int a1, const Common::String &file); + void CHARGE_SAMPLE(int wavIndex, const Common::String &file); void PLAY_SAMPLE2(int idx); - void PLAY_WAV(int a1); + void PLAY_WAV(int wavIndex); + + void syncSoundSettings(); + void updateScummVMSoundSettings(); }; } // End of namespace Hopkins -- cgit v1.2.3 From 7884c017de554f844f32d8ca4f2eff68ae6dfc27 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 15:32:42 +1100 Subject: HOPKINS: Bugfix for voice when looking at objects in-game --- engines/hopkins/script.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a26ae0c7d3..6b0aabf26c 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -115,8 +115,7 @@ int ScriptManager::Traduction(byte *a1) { int v74; int v75; int v76; - Common::String v77; - Common::String s; + Common::String file; v1 = 0; v70 = 0; @@ -2371,10 +2370,9 @@ LABEL_1141: } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { v60 = (int16)READ_LE_UINT16(a1 + 5); - memset(&s, 0, 0x13u); - v77 = Common::String::format("SOUND%d.WAV", v60); - _vm->_soundManager.PLAY_SOUND(s); + file = Common::String::format("SOUND%d.WAV", v60); + _vm->_soundManager.PLAY_SOUND(file); v1 = 1; } if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { -- cgit v1.2.3 From 3f86ca2c7947b983c911080e6aeba7f3fdd37fb4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 18:58:45 +1100 Subject: HOPKINS: Music playback is now working --- engines/hopkins/events.cpp | 2 + engines/hopkins/sound.cpp | 364 ++++++++++++++++++++++++++++++++------------- engines/hopkins/sound.h | 55 +++++-- 3 files changed, 307 insertions(+), 114 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 48aea154a1..3a54e8788d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -154,6 +154,8 @@ void EventsManager::CHANGE_MOUSE(int id) { // Check Events void EventsManager::CONTROLE_MES() { + _vm->_soundManager.checkMusic(); + pollEvents(); } diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index c3f9f86b7b..4fc20540f5 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -44,17 +44,21 @@ SoundManager::SoundManager() { TEXTOFF = false; SOUND_FLAG = false; VBL_MERDE = false; - CARD_SB = true; SOUND_NUM = 0; + old_music = 0; + MOD_FLAG = false; + + CARD_SB = true; for (int i = 0; i < VOICE_COUNT; ++i) Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); for (int i = 0; i < SWAV_COUNT; ++i) Common::fill((byte *)&Swav[i], (byte *)&Swav[i] + sizeof(SwavItem), 0); - for (int i = 0; i < 2; ++i) - Common::fill((byte *)&Music[i], (byte *)&Music[i] + sizeof(MusicItem), 0); + for (int i = 0; i < MWAV_COUNT; ++i) + Common::fill((byte *)&Mwav[i], (byte *)&Mwav[i] + sizeof(MwavItem), 0); for (int i = 0; i < SOUND_COUNT; ++i) Common::fill((byte *)&SOUND[i], (byte *)&SOUND[i] + sizeof(SoundItem), 0); + Common::fill((byte *)&Music, (byte *)&Music + sizeof(MusicItem), 0); } void SoundManager::setParent(HopkinsEngine *vm) { @@ -159,76 +163,230 @@ void SoundManager::PLAY_ANM_SOUND(int soundNumber) { } void SoundManager::WSOUND(int soundNumber) { - warning("TODO: WSOUND"); -/* - if (CARD_SB && (old_music != a1 || !MOD_FLAG)) { + if (CARD_SB && (old_music != soundNumber || !MOD_FLAG)) { if (MOD_FLAG == 1) - result = WSOUND_OFF(); - if (a1 == 1) - result = PLAY_MOD("appar"); - if (a1 == 2) - result = PLAY_MOD("ville"); - if (a1 == 3) - result = PLAY_MOD("Rock"); - if (a1 == 4) - result = PLAY_MOD("polic"); - if (a1 == 5) - result = PLAY_MOD("deep"); - if (a1 == 6) - result = PLAY_MOD("purga"); - if (a1 == 12) - result = PLAY_MOD("purg2"); - if (a1 == 7) - result = PLAY_MOD("rivie"); - if (a1 == 8) - result = PLAY_MOD("SUSPE"); - if (a1 == 9) - result = PLAY_MOD("labo"); - if (a1 == 10) - result = PLAY_MOD("cadav"); - if (a1 == 11) - result = PLAY_MOD("caban"); - if (a1 == 13) - result = PLAY_MOD("foret"); - if (a1 == 14) - result = PLAY_MOD("ile"); - if (a1 == 15) - result = PLAY_MOD("ile2"); - if (a1 == 16) - result = PLAY_MOD("hopki"); - if (a1 == 17) - result = PLAY_MOD("peur"); - if (a1 == 18) - result = PLAY_MOD("peur"); - if (a1 == 19) - result = PLAY_MOD("BASE"); - if (a1 == 20) - result = PLAY_MOD("cada2"); - if (a1 == 21) - result = PLAY_MOD("usine"); - if (a1 == 22) - result = PLAY_MOD("chien"); - if (a1 == 23) - result = PLAY_MOD("coeur"); - if (a1 == 24) - result = PLAY_MOD("stand"); - if (a1 == 25) - result = PLAY_MOD("ocean"); - if (a1 == 26) - result = PLAY_MOD("base3"); - if (a1 == 27) - result = PLAY_MOD("gloop"); - if (a1 == 28) - result = PLAY_MOD("cant"); - if (a1 == 29) - result = PLAY_MOD("feel"); - if (a1 == 30) - result = PLAY_MOD("lost"); - if (a1 == 31) - result = PLAY_MOD("tobac"); - old_music = a1; + WSOUND_OFF(); + if (soundNumber == 1) + PLAY_MOD("appar"); + if (soundNumber == 2) + PLAY_MOD("ville"); + if (soundNumber == 3) + PLAY_MOD("Rock"); + if (soundNumber == 4) + PLAY_MOD("polic"); + if (soundNumber == 5) + PLAY_MOD("deep"); + if (soundNumber == 6) + PLAY_MOD("purga"); + if (soundNumber == 12) + PLAY_MOD("purg2"); + if (soundNumber == 7) + PLAY_MOD("rivie"); + if (soundNumber == 8) + PLAY_MOD("SUSPE"); + if (soundNumber == 9) + PLAY_MOD("labo"); + if (soundNumber == 10) + PLAY_MOD("cadav"); + if (soundNumber == 11) + PLAY_MOD("caban"); + if (soundNumber == 13) + PLAY_MOD("foret"); + if (soundNumber == 14) + PLAY_MOD("ile"); + if (soundNumber == 15) + PLAY_MOD("ile2"); + if (soundNumber == 16) + PLAY_MOD("hopki"); + if (soundNumber == 17) + PLAY_MOD("peur"); + if (soundNumber == 18) + PLAY_MOD("peur"); + if (soundNumber == 19) + PLAY_MOD("BASE"); + if (soundNumber == 20) + PLAY_MOD("cada2"); + if (soundNumber == 21) + PLAY_MOD("usine"); + if (soundNumber == 22) + PLAY_MOD("chien"); + if (soundNumber == 23) + PLAY_MOD("coeur"); + if (soundNumber == 24) + PLAY_MOD("stand"); + if (soundNumber == 25) + PLAY_MOD("ocean"); + if (soundNumber == 26) + PLAY_MOD("base3"); + if (soundNumber == 27) + PLAY_MOD("gloop"); + if (soundNumber == 28) + PLAY_MOD("cant"); + if (soundNumber == 29) + PLAY_MOD("feel"); + if (soundNumber == 30) + PLAY_MOD("lost"); + if (soundNumber == 31) + PLAY_MOD("tobac"); + old_music = soundNumber; + } +} + +void SoundManager::WSOUND_OFF() { + if (CARD_SB) { + STOP_VOICE(0); + STOP_VOICE(1); + STOP_VOICE(2); + if (_vm->_soundManager.SOUND_FLAG) + DEL_NWAV(SOUND_NUM); + + for (int i = 1; i <= 48; ++i) + DEL_SAMPLE_SDL(i); + + if (MOD_FLAG) { + STOP_MUSIC(); + DEL_MUSIC(); + MOD_FLAG = false; + } + } +} + +void SoundManager::PLAY_MOD(const Common::String &file) { + if (CARD_SB) { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPMUSIC, file); + if (MOD_FLAG) { + STOP_MUSIC(); + DEL_MUSIC(); + MOD_FLAG = false; + } + + LOAD_MUSIC(_vm->_globals.NFICHIER); + PLAY_MUSIC(); + MOD_FLAG = true; + } +} + +void SoundManager::LOAD_MUSIC(const Common::String &file) { + if (Music._active) + DEL_MUSIC(); + + Common::File f; + Common::String filename = Common::String::format("%s.TWA", file.c_str()); + + if (!f.open(filename)) + error("Error opening file %s", filename.c_str()); + + char s[8]; + int destIndex = 0; + int mwavIndex; + + bool breakFlag = false; + do { + f.read(&s[0], 3); + + if (s[0] == 'x') { + // End of list reached + Music._mwavIndexes[destIndex] = -1; + breakFlag = true; + } else { + // Convert two digits to a number + s[2] = '\0'; + mwavIndex = atol(&s[0]); + + Common::String filename = Common::String::format("%s_%s.WAV", file.c_str(), &s[0]); + LOAD_MSAMPLE(mwavIndex, filename); + + Music._mwavIndexes[destIndex++] = mwavIndex; + } + } while (!breakFlag); + + f.close(); + + Music._active = true; + Music._isPlaying = false; + Music._currentIndex = -1; + Music.fieldE0 = 0; + Music.fieldE4 = 0; + Music.fieldE8 = 0; + Music.fieldF0 = 3; +} + +void SoundManager::PLAY_MUSIC() { + if (Music._active) + Music._isPlaying = true; +} + +void SoundManager::STOP_MUSIC() { + if (Music._active) + Music._isPlaying = false; +} + +void SoundManager::DEL_MUSIC() { + if (Music._active) { + for (int i = 0; i < 50; ++i) { + DEL_MSAMPLE(i); + } + } + + Music._active = false; + Music._isPlaying = false; + Music._string = " "; + Music._currentIndex = -1; + Music.fieldE0 = 0; + Music.fieldE4 = 0; + Music.fieldE8 = 0; + Music.fieldF0 = 0; +} + +void SoundManager::checkMusic() { + if (Music._active && Music._isPlaying) { + int mwavIndex = Music._mwavIndexes[Music._currentIndex]; + if (mwavIndex == -1) + return; + + if (Music._currentIndex >= 0 && Music._currentIndex < MWAV_COUNT) { + if (mwavIndex != -1 && !Mwav[mwavIndex]._audioStream->endOfStream()) + // Currently playing wav has not finished, so exit + return; + + _vm->_mixer->stopHandle(Mwav[mwavIndex]._soundHandle); + } + + // Time to move to the next index + if (++Music._currentIndex >= MWAV_COUNT) + return; + + mwavIndex = Music._mwavIndexes[Music._currentIndex]; + if (mwavIndex != -1) { + int volume = MUSICVOL * 255 / 16; + + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, + Mwav[mwavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); + } + } +} + +void SoundManager::LOAD_MSAMPLE(int mwavIndex, const Common::String &file) { + if (!Mwav[mwavIndex]._active) { + Common::File f; + if (!f.open(file)) + error("Could not open %s for reading", file.c_str()); + + Mwav[mwavIndex]._audioStream = Audio::makeWAVStream(f.readStream(f.size()), DisposeAfterUse::YES); + Mwav[mwavIndex]._active = true; + + f.close(); + } +} + +void SoundManager::DEL_MSAMPLE(int mwavIndex) { + if (Mwav[mwavIndex]._active) { + Mwav[mwavIndex]._active = false; + _vm->_mixer->stopHandle(Mwav[mwavIndex]._soundHandle); + + delete Mwav[mwavIndex]._audioStream; + Mwav[mwavIndex]._audioStream = NULL; } -*/ } bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { @@ -359,7 +517,7 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { if (VOICE_STAT(3) == 3) STOP_VOICE(3); DEL_SAMPLE_SDL(soundIndex); - SOUND[soundIndex].active = false; + SOUND[soundIndex]._active = false; } } @@ -382,27 +540,27 @@ void SoundManager::PLAY_SOUND2(const Common::String &file) { } void SoundManager::MODSetSampleVolume() { - warning("TODO MODSetSampleVolume"); + // No implementatoin needed } void SoundManager::MODSetVoiceVolume() { - warning("TODO MODSetVoiceVolume"); + // No implementatoin needed } void SoundManager::MODSetMusicVolume(int volume) { - warning("TODO MODSetMusicVolume"); + // No implementatoin needed } void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { if (CARD_SB) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); - SOUND[wavIndex].active = true; + SOUND[wavIndex]._active = true; } } void SoundManager::PLAY_SAMPLE2(int idx) { - if (CARD_SB && !SOUNDOFF && SOUND[idx].active) { + if (CARD_SB && !SOUNDOFF && SOUND[idx]._active) { if (SOUND_FLAG) DEL_NWAV(SOUND_NUM); if (VOICE_STAT(1) == 1) @@ -422,45 +580,45 @@ void SoundManager::PLAY_WAV(int wavIndex) { } int SoundManager::VOICE_STAT(int voiceIndex) { - if (Voice[voiceIndex].status) { - if (Voice[voiceIndex].audioStream->endOfStream()) + if (Voice[voiceIndex]._status) { + if (Voice[voiceIndex]._audioStream->endOfStream()) STOP_VOICE(voiceIndex); } - return Voice[voiceIndex].status; + return Voice[voiceIndex]._status; } void SoundManager::STOP_VOICE(int voiceIndex) { int wavIndex; - if (Voice[voiceIndex].status) { - Voice[voiceIndex].status = 0; - wavIndex = Voice[voiceIndex].wavIndex; - if (Swav[wavIndex].active) { + if (Voice[voiceIndex]._status) { + Voice[voiceIndex]._status = 0; + wavIndex = Voice[voiceIndex]._wavIndex; + if (Swav[wavIndex]._active) { if (Swav[wavIndex].field24 == 1) DEL_SAMPLE_SDL(wavIndex); } } Voice[voiceIndex].fieldC = 0; - Voice[voiceIndex].status = 0; + Voice[voiceIndex]._status = 0; Voice[voiceIndex].field14 = 0; - Voice[voiceIndex].audioStream = NULL; + Voice[voiceIndex]._audioStream = NULL; } void SoundManager::SDL_LVOICE(size_t filePosition, size_t entryLength) { if (!SDL_LoadVoice(_vm->_globals.NFICHIER, filePosition, entryLength, Swav[20])) error("Couldn't load the sample %s", _vm->_globals.NFICHIER.c_str()); - Swav[20].active = true; + Swav[20]._active = true; } void SoundManager::PLAY_VOICE_SDL() { - if (!Swav[20].active) + if (!Swav[20]._active) error("Bad handle"); - if (!Voice[2].status) { - int wavIndex = Voice[2].wavIndex; - if (Swav[wavIndex].active && Swav[wavIndex].field24 == 1) + if (!Voice[2]._status) { + int wavIndex = Voice[2]._wavIndex; + if (Swav[wavIndex]._active && Swav[wavIndex].field24 == 1) DEL_SAMPLE_SDL(wavIndex); } @@ -468,11 +626,11 @@ void SoundManager::PLAY_VOICE_SDL() { } bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { - if (Swav[wavIndex].active) { - Swav[wavIndex].active = false; + if (Swav[wavIndex]._active) { + Swav[wavIndex]._active = false; _vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle); - delete Swav[wavIndex].audioStream; + delete Swav[wavIndex]._audioStream; return true; } else { return false; @@ -485,7 +643,7 @@ bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffs error("Could not open %s for reading", filename.c_str()); f.seek(fileOffset); - item.audioStream = Audio::makeWAVStream(f.readStream((entryLength == 0) ? f.size() : entryLength), + item._audioStream = Audio::makeWAVStream(f.readStream((entryLength == 0) ? f.size() : entryLength), DisposeAfterUse::YES); f.close(); @@ -493,11 +651,11 @@ bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffs } void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, int field24) { - if (Swav[wavIndex].active) + if (Swav[wavIndex]._active) DEL_SAMPLE_SDL(wavIndex); SDL_LoadVoice(filename, 0, 0, Swav[wavIndex]); - Swav[wavIndex].active = true; + Swav[wavIndex]._active = true; Swav[wavIndex].field24 = field24; } @@ -529,22 +687,22 @@ void SoundManager::DEL_NWAV(int wavIndex) { } void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { - if (!Swav[wavIndex].active) + if (!Swav[wavIndex]._active) warning("Bad handle"); - if (Voice[voiceIndex].status == 1 && Swav[wavIndex].active && Swav[wavIndex].field24 == 1) + if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex].field24 == 1) DEL_SAMPLE_SDL(wavIndex); Voice[voiceIndex].fieldC = 0; - Voice[voiceIndex].audioStream = Swav[wavIndex].audioStream; - Voice[voiceIndex].status = 1; + Voice[voiceIndex]._audioStream = Swav[wavIndex]._audioStream; + Voice[voiceIndex]._status = 1; Voice[voiceIndex].field14 = 4; int volume = (voiceIndex == 2) ? VOICEVOL * 255 / 16 : SOUNDVOL * 255 / 16; // Start the voice playing _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, - Swav[wavIndex].audioStream, -1, volume, 0, DisposeAfterUse::NO); + Swav[wavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); } void SoundManager::syncSoundSettings() { @@ -564,7 +722,7 @@ void SoundManager::syncSoundSettings() { // for (int idx = 0; idx < SWAV_COUNT; ++idx) { - if (Swav[idx].active) { + if (Swav[idx]._active) { } } } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 4f3e065521..1e3b9925a6 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -33,36 +33,50 @@ namespace Hopkins { class VoiceItem { public: - int status; - int wavIndex; - Audio::RewindableAudioStream *audioStream; + int _status; + int _wavIndex; + Audio::RewindableAudioStream *_audioStream; int fieldC; int field14; }; class SwavItem { public: - bool active; - Audio::RewindableAudioStream *audioStream; + bool _active; + Audio::RewindableAudioStream *_audioStream; Audio::SoundHandle _soundHandle; int field24; }; +class MwavItem { +public: + bool _active; + Audio::RewindableAudioStream *_audioStream; + Audio::SoundHandle _soundHandle; +}; + class MusicItem { public: - byte field0; - byte field1; - int field16[50]; + bool _active; + bool _isPlaying; + Common::String _string; + int _mwavIndexes[50]; + byte unused_mb[100]; + int _currentIndex; + int fieldE0; + int fieldE4; + int fieldE8; + int fieldF0; }; class SoundItem { public: - bool active; - + bool _active; }; #define VOICE_COUNT 3 #define SWAV_COUNT 50 +#define MWAV_COUNT 50 #define SOUND_COUNT 10 class HopkinsEngine; @@ -82,6 +96,8 @@ private: void PLAY_NWAV(int wavIndex); void DEL_NWAV(int wavIndex); void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); + void LOAD_MSAMPLE(int mwavIndex, const Common::String &file); + void DEL_MSAMPLE(int mwavIndex); public: int SPECIAL_SOUND; int SOUNDVOL; @@ -98,10 +114,14 @@ public: bool VBL_MERDE; bool CARD_SB; int SOUND_NUM; + bool MOD_FLAG; + int old_music; + VoiceItem Voice[VOICE_COUNT]; SwavItem Swav[SWAV_COUNT]; - MusicItem Music[2]; + MwavItem Mwav[MWAV_COUNT]; SoundItem SOUND[SOUND_COUNT]; + MusicItem Music; public: SoundManager(); void setParent(HopkinsEngine *vm); @@ -112,6 +132,19 @@ public: void PLAY_ANM_SOUND(int soundNumber); void LOAD_WAV(const Common::String &file, int wavIndex); void WSOUND(int soundNumber); + void WSOUND_OFF(); + void PLAY_MOD(const Common::String &file); + void LOAD_MUSIC(const Common::String &file); + void PLAY_MUSIC(); + void STOP_MUSIC(); + void DEL_MUSIC(); + + /** + * Checks the music structure to see if music playback is active, and whether + * it needs to move to the next WAV file + */ + void checkMusic(); + bool VOICE_MIX(int voiceId, int voiceMode); void DEL_SAMPLE(int soundIndex); void PLAY_SOUND(const Common::String &file); -- cgit v1.2.3 From 29a8d2aa95b2c3c137e313cf2d8efd2cfa685c08 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 19:28:28 +1100 Subject: HOPKINS: Bugfix to make music playback loop --- engines/hopkins/sound.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 4fc20540f5..ffb19a9aa2 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -357,12 +357,16 @@ void SoundManager::checkMusic() { return; mwavIndex = Music._mwavIndexes[Music._currentIndex]; - if (mwavIndex != -1) { - int volume = MUSICVOL * 255 / 16; + if (mwavIndex == -1) { + Music._currentIndex = 0; + mwavIndex = Music._mwavIndexes[Music._currentIndex]; + } - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, - Mwav[mwavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); - } + int volume = MUSICVOL * 255 / 16; + + Mwav[mwavIndex]._audioStream->rewind(); + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, + Mwav[mwavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); } } -- cgit v1.2.3 From 0ef8703833c556ab8ace5db7abf7c7087a299587 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 19:40:05 +1100 Subject: HOPKINS: Fix to not play music if it is muted --- engines/hopkins/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index ffb19a9aa2..00da0ffb64 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -252,7 +252,7 @@ void SoundManager::WSOUND_OFF() { } void SoundManager::PLAY_MOD(const Common::String &file) { - if (CARD_SB) { + if (CARD_SB && !MUSICOFF) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPMUSIC, file); if (MOD_FLAG) { STOP_MUSIC(); -- cgit v1.2.3 From 1844e4faa24bd31da89db49751ee80b201d061e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 19:54:48 +1100 Subject: HOPKINS: Clean up of un-needed sound structure fields --- engines/hopkins/sound.cpp | 19 ++++++------------- engines/hopkins/sound.h | 12 +++++------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 00da0ffb64..7aaa373d45 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -296,6 +296,7 @@ void SoundManager::LOAD_MUSIC(const Common::String &file) { Common::String filename = Common::String::format("%s_%s.WAV", file.c_str(), &s[0]); LOAD_MSAMPLE(mwavIndex, filename); + assert(destIndex < MUSIC_WAVE_COUNT); Music._mwavIndexes[destIndex++] = mwavIndex; } } while (!breakFlag); @@ -305,10 +306,6 @@ void SoundManager::LOAD_MUSIC(const Common::String &file) { Music._active = true; Music._isPlaying = false; Music._currentIndex = -1; - Music.fieldE0 = 0; - Music.fieldE4 = 0; - Music.fieldE8 = 0; - Music.fieldF0 = 3; } void SoundManager::PLAY_MUSIC() { @@ -332,10 +329,6 @@ void SoundManager::DEL_MUSIC() { Music._isPlaying = false; Music._string = " "; Music._currentIndex = -1; - Music.fieldE0 = 0; - Music.fieldE4 = 0; - Music.fieldE8 = 0; - Music.fieldF0 = 0; } void SoundManager::checkMusic() { @@ -599,7 +592,7 @@ void SoundManager::STOP_VOICE(int voiceIndex) { Voice[voiceIndex]._status = 0; wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { - if (Swav[wavIndex].field24 == 1) + if (Swav[wavIndex].freeSample) DEL_SAMPLE_SDL(wavIndex); } } @@ -622,7 +615,7 @@ void SoundManager::PLAY_VOICE_SDL() { if (!Voice[2]._status) { int wavIndex = Voice[2]._wavIndex; - if (Swav[wavIndex]._active && Swav[wavIndex].field24 == 1) + if (Swav[wavIndex]._active && Swav[wavIndex].freeSample) DEL_SAMPLE_SDL(wavIndex); } @@ -654,13 +647,13 @@ bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffs return true; } -void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, int field24) { +void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample) { if (Swav[wavIndex]._active) DEL_SAMPLE_SDL(wavIndex); SDL_LoadVoice(filename, 0, 0, Swav[wavIndex]); Swav[wavIndex]._active = true; - Swav[wavIndex].field24 = field24; + Swav[wavIndex].freeSample = freeSample; } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { @@ -694,7 +687,7 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { if (!Swav[wavIndex]._active) warning("Bad handle"); - if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex].field24 == 1) + if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex].freeSample) DEL_SAMPLE_SDL(wavIndex); Voice[voiceIndex].fieldC = 0; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 1e3b9925a6..88cecbbea7 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -45,7 +45,7 @@ public: bool _active; Audio::RewindableAudioStream *_audioStream; Audio::SoundHandle _soundHandle; - int field24; + bool freeSample; }; class MwavItem { @@ -55,18 +55,16 @@ public: Audio::SoundHandle _soundHandle; }; +#define MUSIC_WAVE_COUNT 50 + class MusicItem { public: bool _active; bool _isPlaying; Common::String _string; - int _mwavIndexes[50]; + int _mwavIndexes[MUSIC_WAVE_COUNT]; byte unused_mb[100]; int _currentIndex; - int fieldE0; - int fieldE4; - int fieldE8; - int fieldF0; }; class SoundItem { @@ -91,7 +89,7 @@ private: void PLAY_VOICE_SDL(); bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); - void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, int field24); + void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); void LOAD_NWAV(const Common::String &file, int wavIndex); void PLAY_NWAV(int wavIndex); void DEL_NWAV(int wavIndex); -- cgit v1.2.3 From 4def58832ddde8e6ec73c2174754019e1b5da0d2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 20:00:57 +1100 Subject: HOPKINS: Added missing flush of changed sound settings to disk --- engines/hopkins/sound.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 7aaa373d45..819877bc20 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -733,6 +733,8 @@ void SoundManager::updateScummVMSoundSettings() { ConfMan.setInt("music_volume", MUSICVOL * 255 / 16); ConfMan.setInt("sfx_volume", SOUNDVOL * 255 / 16); ConfMan.setInt("speech_volume", VOICEVOL * 255 / 16); + + ConfMan.flushToDisk(); } } // End of namespace Hopkins -- cgit v1.2.3 From 9fd36c32f27dd203529ebc597e4f44ec85d80253 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 20:58:33 +1100 Subject: HOPKINS: Update playing sounds when the volumes are changed in the GMM --- engines/hopkins/sound.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 819877bc20..e23c7e525f 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -717,9 +717,16 @@ void SoundManager::syncSoundSettings() { SOUNDVOL = MIN(255, ConfMan.getInt("sfx_volume")) * 16 / 255; VOICEVOL = MIN(255, ConfMan.getInt("speech_volume")) * 16 / 255; - // + // Update any active sounds for (int idx = 0; idx < SWAV_COUNT; ++idx) { if (Swav[idx]._active) { + int volume = (idx == 20) ? (VOICEVOL * 255 / 16) : (SOUNDVOL * 255 / 16); + _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); + } + } + for (int idx = 0; idx < MWAV_COUNT; ++idx) { + if (Mwav[idx]._active) { + _vm->_mixer->setChannelVolume(Mwav[idx]._soundHandle, MUSICVOL * 255 / 16); } } } -- cgit v1.2.3 From 75eaa297c61553abf8a855c1168bb6b56d47f7bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Nov 2012 21:33:17 +1100 Subject: HOPKINS: Refactored the PCX decoder to use the existing ScummVM decoder --- engines/hopkins/graphics.cpp | 139 ++++++------------------------------------- 1 file changed, 18 insertions(+), 121 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 2dc4a23a67..132e8d88ab 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -22,6 +22,7 @@ #include "common/system.h" #include "graphics/palette.h" +#include "graphics/decoders/pcx.h" #include "common/file.h" #include "common/rect.h" #include "engines/util.h" @@ -325,147 +326,43 @@ void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { // TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { - int filesize; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - byte v12; - int v13; - int v14; - char v15; - int v18; - int v19; - int v20; - unsigned int v21; - int v22; - int32 v23; - byte *ptr; Common::File f; + Graphics::PCXDecoder pcxDecoder; // Clear the passed surface memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); if (typeFlag) { + // Load PCX from within the PIC resource _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, "PIC.RES"); if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); f.seek(_vm->_globals.CAT_POSI); - v7 = _vm->_globals.CAT_TAILLE - 896; - v8 = f.read(HEADER_PCX, 128); - - v6 = (int16)READ_LE_UINT16(&HEADER_PCX[8]) + 1; - v20 = (int16)READ_LE_UINT16(&HEADER_PCX[10]) + 1; - if (((int16)READ_LE_UINT16(&HEADER_PCX[8]) + 1) <= SCREEN_WIDTH) { - DOUBLE_ECRAN = false; - } else { - v6 = SCREEN_WIDTH * 2; - DOUBLE_ECRAN = true; - } - if (v20 > SCREEN_HEIGHT) - v20 = SCREEN_HEIGHT; - PCX_L = v6; - PCX_H = v20; - if (v8 == -1) - error("Erreur en cours de lecture."); } else { + // Load stand alone PCX file _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); - - filesize = f.size(); - int bytesRead = f.read(HEADER_PCX, 128); - if (bytesRead < 128) - error("Erreur en cours de lecture."); - - v6 = (int16)READ_LE_UINT16(&HEADER_PCX[8]) + 1; - v20 = (int16)READ_LE_UINT16(&HEADER_PCX[10]) + 1; - if (v6 <= SCREEN_WIDTH) { - DOUBLE_ECRAN = false; - } else { - v6 = SCREEN_WIDTH * 2; - DOUBLE_ECRAN = true; - } - if (v20 > SCREEN_HEIGHT) - v20 = SCREEN_HEIGHT; - PCX_L = v6; - PCX_H = v20; - v7 = filesize - 896; } - ptr = _vm->_globals.dos_malloc2(0xEE60u); - if (v7 >= 60000) { - v21 = v7 / 60000 + 1; - v23 = 60000 * (v7 / 60000) - v7; - - if (((uint32)v23 & 0x80000000u) != 0) - v23 = -v23; - f.read(ptr, 60000); - v7 = 60000; - } else { - v21 = 1; - v23 = v7; - f.read(ptr, v7); - } - v22 = v21 - 1; - v18 = 0; - v9 = 0; - v10 = 0; - v19 = v6; - - do { - if (v9 == v7) { - v9 = 0; - --v22; - v7 = 60000; - if ( !v22 ) - v7 = v23; - v11 = v10; - f.read(ptr, v7); - v10 = v11; - } + // Decode the PCX + if (!pcxDecoder.loadStream(f)) + error("Error decoding PCX"); - v12 = *((byte *)ptr + v9++); - if (v12 > 0xC0u) { - v13 = v12 - 192; - if (v9 == v7) { - v9 = 0; - --v22; - v7 = 60000; - if ( v22 == 1 ) - v7 = v23; - v14 = v10; - f.read(ptr, v7); - v10 = v14; - } - v15 = *((byte *)ptr + v9++); - - do { - *((byte *)surface + v10++) = v15; - ++v18; - --v13; - } while (v13); - } else { - *((byte *)surface + v10++) = v12; - ++v18; - } - } while (v18 < v19 * v20); - - if (typeFlag) { - f.seek(_vm->_globals.CAT_TAILLE + _vm->_globals.CAT_POSI - 768); - } else { - filesize = f.size(); - f.seek(filesize - 768); - } - - if (f.read(palette, PALETTE_BLOCK_SIZE) != (PALETTE_BLOCK_SIZE)) - error("A_PCX640_480"); + const Graphics::Surface *s = pcxDecoder.getSurface(); + + // Copy out the dimensions and pixels of the decoded surface + DOUBLE_ECRAN = s->w > SCREEN_WIDTH; + PCX_L = s->w; + PCX_H = s->h; + Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface); + + // Copy out the palette + const byte *palSrc = pcxDecoder.getPalette(); + Common::copy((byte *)palSrc, (byte *)palSrc + PALETTE_BLOCK_SIZE, palette); f.close(); - _vm->_globals.dos_free2(ptr); } // Clear Palette -- cgit v1.2.3 From 0a01d4993ec2c59c496c0c5d45aac912d19fac6b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 14:22:58 +0100 Subject: HOPKINS: Implement RunLinuxFull, stub some new functions Change one more variable to use boolean --- engines/hopkins/globals.cpp | 3 +- engines/hopkins/globals.h | 3 +- engines/hopkins/hopkins.cpp | 870 ++++++++++++++++++++++++++++++++++---------- engines/hopkins/hopkins.h | 7 + engines/hopkins/objects.cpp | 10 +- 5 files changed, 691 insertions(+), 202 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e0bd0a4a3c..3d417b61be 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -154,12 +154,13 @@ Globals::Globals() { PERSO = 0; PASSWORD = false; ECRAN = 0; - NOSPRECRAN = 0; + NOSPRECRAN = false; OLD_ECRAN = 0; Max_Propre_Gen = 0; Max_Ligne_Long = 0; Max_Perso_Y = 0; Max_Propre = 0; + fmusic = 0; NBBLOC = 0; opt_scrtype = 0; opt_scrspeed = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 95f8bdf641..c8f725cc84 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -397,9 +397,10 @@ public: int PLANX, PLANY; int PLANI; bool PASSWORD; // CHECKME: Useless variable? - int NOSPRECRAN; + bool NOSPRECRAN; int ECRAN; int OLD_ECRAN; + int fmusic; int Max_Propre; int Max_Propre_Gen; int Max_Ligne_Long; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d75a29e324..15c7f0dd3e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -254,7 +254,7 @@ LABEL_13: _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); } @@ -271,7 +271,7 @@ LABEL_13: _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; byte v1 = *((byte *)_globals.SAUVEGARDE + 80); if (v1) { if (v1 == 1) @@ -280,7 +280,7 @@ LABEL_13: _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } - _globals.NOSPRECRAN = 0; + _globals.NOSPRECRAN = false; } if (_globals.SORTIE != 8) @@ -321,13 +321,13 @@ LABEL_13: _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { if (_globals.SORTIE == 10) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); goto LABEL_124; } if (_globals.SORTIE == 11) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; @@ -343,7 +343,7 @@ LABEL_13: _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; if (*((byte *)_globals.SAUVEGARDE + 225)) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { LABEL_109: @@ -366,7 +366,7 @@ LABEL_109: break; default: if (_globals.SORTIE == 15) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); goto LABEL_124; } @@ -395,7 +395,7 @@ LABEL_109: _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); } else { if (_globals.SORTIE == 33) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); goto LABEL_124; } @@ -427,16 +427,16 @@ LABEL_109: if ((uint16)(_globals.SORTIE - 51) <= 38) PASS(); if (_globals.SORTIE == 111) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); goto LABEL_124; } if (_globals.SORTIE == 112) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); LABEL_124: - _globals.NOSPRECRAN = 0; + _globals.NOSPRECRAN = false; } else if (_globals.SORTIE == 113) { _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; @@ -565,21 +565,17 @@ bool HopkinsEngine::runLinuxFull() { _globals.SORTIE = 0; _globals.PASSWORD = false; -LABEL_12: +LABEL_10: if (_globals.SORTIE == 300) -LABEL_13: +LABEL_11: _globals.SORTIE = 0; - if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { - if (!g_system->getEventManager()->shouldQuit()) - PUBQUIT(); _globals.PERSO = _globals.dos_free2(_globals.PERSO); REST_SYSTEM(); } } - for (;;) { for (;;) { for (;;) { @@ -588,34 +584,83 @@ LABEL_13: for (;;) { for (;;) { for (;;) { - if (g_system->getEventManager()->shouldQuit()) - return false; - - if (_globals.SORTIE == 300) - goto LABEL_13; - if (_globals.SORTIE == 18) - PASS(); - if (_globals.SORTIE == 23) - PASS(); - if (_globals.SORTIE == 22) - PASS(); - if (_globals.SORTIE == 19) - PASS(); - if (_globals.SORTIE == 20) - PASS(); + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + if (_globals.SORTIE == 300) + goto LABEL_11; + if (_globals.SORTIE != 18) + break; + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); + } + if (_globals.SORTIE != 23) + break; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + } + if (_globals.SORTIE != 22) + break; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + } + if (_globals.SORTIE != 19) + break; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (*((byte *)_globals.SAUVEGARDE + 123)) + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + else + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + } + if (_globals.SORTIE != 20) + break; + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 8; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + if (_globals.SORTIE == 17) { + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(6); + _graphicsManager.FADE_LINUX = 2; + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); + if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); +LABEL_231: + _globals.iRegul = 0; + } + } if (_globals.SORTIE != 1) break; - _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); } - if (_globals.SORTIE != 3) break; - if (!*((byte *)_globals.SAUVEGARDE + 170)) { _soundManager.WSOUND(3); if (_globals.FR == 1) @@ -629,16 +674,14 @@ LABEL_13: _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - if (!_globals.CENSURE) _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - if (_globals.CENSURE == 1) + if (_globals.CENSURE) _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); @@ -647,50 +690,43 @@ LABEL_13: _soundManager.DEL_SAMPLE(4); *((byte *)_globals.SAUVEGARDE + 170) = 1; } - _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); } - if (_globals.SORTIE != 4) break; _globals.DESACTIVE_INVENT = true; _objectsManager.PLAN_BETA(); _globals.DESACTIVE_INVENT = false; } - if (_globals.SORTIE != 5) break; _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = 1; - byte v1 = *((byte *)_globals.SAUVEGARDE + 80); - if (v1) { - if (v1 == 1) + _globals.NOSPRECRAN = true; + byte v2 = *((byte *)_globals.SAUVEGARDE + 80); + if (v2) { + if (v2 == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } - - _globals.NOSPRECRAN = 0; + _globals.NOSPRECRAN = false; } - if (_globals.SORTIE != 8) break; - _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); } - if (_globals.SORTIE != 6) break; _globals.Max_Propre = 15; @@ -699,7 +735,6 @@ LABEL_13: _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); } - if (_globals.SORTIE != 7) break; if (*((byte *)_globals.SAUVEGARDE + 220)) @@ -707,33 +742,29 @@ LABEL_13: else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); } - if (_globals.SORTIE == 9) { _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!*((byte *)_globals.SAUVEGARDE + 225)) - goto LABEL_109; + goto LABEL_140; _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { if (_globals.SORTIE == 10) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - goto LABEL_124; + goto LABEL_239; } - if (_globals.SORTIE == 11) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - goto LABEL_124; + goto LABEL_239; } - switch (_globals.SORTIE) { case 12: _globals.Max_Propre = 15; @@ -741,10 +772,10 @@ LABEL_13: _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; if (*((byte *)_globals.SAUVEGARDE + 225)) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { -LABEL_109: +LABEL_140: BOOM(); } break; @@ -764,162 +795,582 @@ LABEL_109: break; default: if (_globals.SORTIE == 15) { - _globals.NOSPRECRAN = 1; + _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - goto LABEL_124; + goto LABEL_239; } - if (_globals.SORTIE == 16) { + switch (_globals.SORTIE) { + case 16: { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - - byte v2 = *((byte *)_globals.SAUVEGARDE + 113); - if (v2 == 1) { + byte v3 = *((byte *)_globals.SAUVEGARDE + 113); + if (v3 == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!v2) { + } else if (!v3) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } - } else { - if (_globals.SORTIE == 17) - PASS(); - if (_globals.SORTIE == 24) - PASS(); - if (_globals.SORTIE == 25) { - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + } + case 17: { + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + byte v4 = *((byte *)_globals.SAUVEGARDE + 117); + if (v4 == 1) { + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + } else if (!v4) { + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + } + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(29); + _graphicsManager.FADE_LINUX = 2; + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + goto LABEL_231; + } + break; + } + case 24: { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + byte v5 = *((byte *)_globals.SAUVEGARDE + 181); + if (v5) { + if (v5 == 1) + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); } else { - if (_globals.SORTIE == 33) { - _globals.NOSPRECRAN = 1; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - goto LABEL_124; + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + } + break; + } + case 25: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + default: + if (_globals.SORTIE == 33) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + goto LABEL_239; + } + switch (_globals.SORTIE) { + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + break; + case 27: { + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + byte v6 = *((byte *)_globals.SAUVEGARDE + 177); + if (v6 == 1) { + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + } else if (!v6) { + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); } - - if (_globals.SORTIE == 26) { + break; + } + case 28: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + if (*((byte *)_globals.SAUVEGARDE + 166) != 1 || *((byte *)_globals.SAUVEGARDE + 167) != 1) + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + else + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + break; + case 29: + _globals.Max_Propre = 60; + _globals.Max_Ligne_Long = 50; + _globals.Max_Propre_Gen = 50; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + break; + default: + if (_globals.SORTIE == 30) { + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + goto LABEL_239; + } + if (_globals.SORTIE == 31) { + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + } else if ((unsigned __int16)(_globals.SORTIE - 35) <= 6u) { + _globals.fmusic = 13; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _globals.DESACTIVE_INVENT = false; + _globals.FORET = 1; + _globals.NOSPRECRAN = true; + Common::String im = "IM" + _globals.SORTIE; + _soundManager.WSOUND(13); + if (_globals.FORETSPR == g_PTRNUL) { + _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); + _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + } + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); + _globals.NOSPRECRAN = false; + if (_globals.SORTIE - 35 > 14) { + _globals.dos_free2(_globals.FORETSPR); + _globals.FORETSPR = g_PTRNUL; + _globals.FORET = 0; + _soundManager.DEL_SAMPLE(1); + } + } else if (_globals.SORTIE == 32) { + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); } else { - if (_globals.SORTIE == 27) - PASS(); - if (_globals.SORTIE == 28) - PASS(); - if (_globals.SORTIE == 29) - PASS(); - if (_globals.SORTIE == 30) - PASS(); - if (_globals.SORTIE == 31) - PASS(); - if (_globals.SORTIE == 35) - ENDEMO(); - if (_globals.SORTIE == 32) - PASS(); - if (_globals.SORTIE == 34) - PASS(); - - if ((uint16)(_globals.SORTIE - 51) <= 38) - PASS(); - if (_globals.SORTIE == 111) { - _globals.NOSPRECRAN = 1; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - goto LABEL_124; + if (_globals.SORTIE == 34) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); + goto LABEL_239; } - - if (_globals.SORTIE == 112) { - _globals.NOSPRECRAN = 1; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); -LABEL_124: - _globals.NOSPRECRAN = 0; - } else if (_globals.SORTIE == 113) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; - _globals.ECRAN = 113; - *((byte *)_globals.SAUVEGARDE + 5) = 113; - _menuManager.COMPUT_HOPKINS(1); - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); - memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); - _graphicsManager.Cls_Pal(); - _graphicsManager.RESET_SEGMENT_VESA(); - } else { - if (_globals.SORTIE == 114) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; - _globals.ECRAN = 114; - *((byte *)_globals.SAUVEGARDE + 5) = 114; - _menuManager.COMPUT_HOPKINS(2); - goto LABEL_128; + switch (_globals.SORTIE) { + case 51: + _globals.Max_Propre = 20; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + break; + case 52: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + break; + case 54: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + break; + case 55: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 460; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + break; + case 56: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + break; + case 58: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + break; + case 57: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + break; + default: + if (_globals.SORTIE == 59) { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); + goto LABEL_239; } - if (_globals.SORTIE == 115) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; - _globals.ECRAN = 115; - *((byte *)_globals.SAUVEGARDE + 5) = 115; - _menuManager.COMPUT_HOPKINS(3); - -LABEL_128: - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - } else if ((uint16)(_globals.SORTIE - 194) > 5) { - if (_globals.SORTIE == 151) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; + if (_globals.SORTIE == 60) { + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 61) { + if (*((byte *)_globals.SAUVEGARDE + 311) == 1 && !*((byte *)_globals.SAUVEGARDE + 312)) + INCENDIE(); + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + } else { + if (_globals.SORTIE == 63) { + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); + goto LABEL_239; } - - if (_globals.SORTIE == 150) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; + if (_globals.SORTIE == 64) { + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + } else { + if (_globals.SORTIE == 65) { + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 66) { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 69) { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 62) { + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 68) { + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + } else { + if (_globals.SORTIE == 67) { + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 70) { + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); + goto LABEL_239; + } + if (_globals.SORTIE == 71) { + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); + goto LABEL_239; + } + switch (_globals.SORTIE) { + case 73: { + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + byte v7 = *((byte *)_globals.SAUVEGARDE + 318); + if (v7 == 1) { + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + } else if (!v7) { + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + } + break; + } + case 75: + BASE(); + break; + case 93: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + if (*((byte *)_globals.SAUVEGARDE + 330)) + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); + break; + case 94: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + break; + case 95: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + break; + case 97: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + goto LABEL_231; + } + break; + case 98: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + break; + case 99: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + break; + case 96: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + break; + case 77: + OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + break; + case 78: + OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + break; + case 79: + OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + break; + case 80: + OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + break; + case 81: + OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + break; + case 82: + OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + break; + case 83: + OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + break; + case 84: + OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + break; + case 85: + OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + break; + case 86: + OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + break; + case 87: + OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + break; + case 88: + OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + break; + case 89: + OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + break; + case 91: + OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + break; + case 90: + BASED(); + break; + default: + if (_globals.SORTIE == 111) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + goto LABEL_239; + } + if (_globals.SORTIE == 112) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); +LABEL_239: + _globals.NOSPRECRAN = false; + } else if (_globals.SORTIE == 113) { + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 113; + *((byte *)_globals.SAUVEGARDE + 5) = 113; + _menuManager.COMPUT_HOPKINS(1); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); + memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + _graphicsManager.Cls_Pal(); + _graphicsManager.RESET_SEGMENT_VESA(); + } else { + if (_globals.SORTIE == 114) { + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 114; + *((byte *)_globals.SAUVEGARDE + 5) = 114; + _menuManager.COMPUT_HOPKINS(2); + goto LABEL_243; + } + switch (_globals.SORTIE) { + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.ECRAN = 115; + *((byte *)_globals.SAUVEGARDE + 5) = 115; + _menuManager.COMPUT_HOPKINS(3); +LABEL_243: + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + case 100: + JOUE_FIN(); + break; + case 50: + AVION(); + _globals.SORTIE = 51; + break; + default: + if ((unsigned __int16)(_globals.SORTIE - 194) > 5u) { + if (_globals.SORTIE == 151) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + if (_globals.SORTIE == 150) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + if (_globals.SORTIE == 152) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + goto LABEL_10; + } + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.iRegul = 1; + _soundManager.WSOUND(23); + _globals.SORTIE = PWBASE(); + _soundManager.WSOUND_OFF(); + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; + _graphicsManager.nbrligne = 640; + break; + } + } + break; + } + } } - - if (_globals.SORTIE == 152) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - goto LABEL_12; } + break; } } + break; } + break; } break; } @@ -1429,6 +1880,35 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } +void HopkinsEngine::INCENDIE() { + warning("STUB - INCENDIE()"); +} + +void HopkinsEngine::BASE() { + warning("STUB - BASE()"); +} + +void HopkinsEngine::BASED() { + warning("STUB - BASED()"); +} + +void HopkinsEngine::JOUE_FIN() { + warning("STUB - JOUE_FIN()"); +} + +void HopkinsEngine::AVION() { + warning("STUB - AVION()"); +} + +int HopkinsEngine::PWBASE() { + warning("STUB - PWBASE()"); + return 0; +} + +void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { + warning("STUB - OCEAN()"); +} + void HopkinsEngine::syncSoundSettings() { Engine::syncSoundSettings(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 944c7c963e..919b39e418 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -91,6 +91,13 @@ private: void PUBQUIT(); void ENDEMO(); void BOOM(); + void INCENDIE(); + void BASE(); + void BASED(); + void JOUE_FIN(); + void AVION(); + int PWBASE(); + void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9); bool runLinuxDemo(); bool runLinuxFull(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e2ad687bf9..e05b55f5e6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2627,7 +2627,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.Max_Ligne_Long = 1; _vm->_globals.Max_Propre_Gen = 1; _vm->_globals.Max_Perso_Y = 440; - _vm->_globals.NOSPRECRAN = 1; + _vm->_globals.NOSPRECRAN = true; _vm->_globals.PLAN_FLAG = true; _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; @@ -2731,7 +2731,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.AFFLI = 0; sprite_ptr = _vm->_globals.LIBERE_FICHIER(sprite_ptr); CLEAR_ECRAN(); - _vm->_globals.NOSPRECRAN = 0; + _vm->_globals.NOSPRECRAN = false; _vm->_globals.PLAN_FLAG = false; } @@ -3085,7 +3085,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.GOACTION = 0; FORCEZONE = 1; CHANGEVERBE = 0; - _vm->_globals.NOSPRECRAN = 0; + _vm->_globals.NOSPRECRAN = false; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.g_old_sens = -1; my_anim = 1; @@ -5591,7 +5591,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s if (!s4.empty()) { if (!_vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN(s4); - if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + if (!s4.empty() && _vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN2(s4); } _vm->_eventsManager.MOUSE_ON(); @@ -5695,7 +5695,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & if (!s4.empty()) { if (!_vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN(s4); - if (!s4.empty() && _vm->_globals.NOSPRECRAN == 1) + if (!s4.empty() && _vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN2(s4); } _vm->_eventsManager.MOUSE_ON(); -- cgit v1.2.3 From 99cc57ff8dc34b082d00231e750cd7348d8fcb5e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 15:11:31 +0100 Subject: HOPKINS: Implement PWBASE() --- engines/hopkins/globals.cpp | 1 + engines/hopkins/globals.h | 1 + engines/hopkins/hopkins.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 3d417b61be..ae39e8bb60 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -231,6 +231,7 @@ Globals::Globals() { OPTION_FLAG = false; CACHEFLAG = false; NOPARLE = false; + couleur_40 = 50; // Reset indexed variables force_to_data_0 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c8f725cc84..04c8f3170d 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -433,6 +433,7 @@ public: int Compteur; int ACTION_SENS; int SegmentEnCours; + int couleur_40; int STOP_BUG; bool NO_OFFSET; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 15c7f0dd3e..21bc2ac6b7 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1901,8 +1901,84 @@ void HopkinsEngine::AVION() { } int HopkinsEngine::PWBASE() { - warning("STUB - PWBASE()"); - return 0; + warning("PWBASE()"); + + int v0; // edi@1 + int result; // eax@30 + + _globals.DESACTIVE_INVENT = true; + _graphicsManager.LOAD_IMAGE("PBASE"); + _graphicsManager.SETCOLOR3(252, 100, 100, 100); + _graphicsManager.SETCOLOR3(253, 100, 100, 100); + _graphicsManager.SETCOLOR3(251, 100, 100, 100); + _graphicsManager.SETCOLOR3(254, 0, 0, 0); + _eventsManager.CHANGE_MOUSE(0); + _graphicsManager.FADE_INW(); + v0 = 0; + int zone; + do { + int mouseButton = _eventsManager.BMOUSE(); + int posX = _eventsManager.XMOUSE(); + int posY = _eventsManager.YMOUSE(); + zone = 0; + if ((posX - 181 <= 16) && (posY - 66 <= 22) && + (posX - 181 >= 0) && (posY - 66 >= 0)) + zone = 1; + if ((posX - 353 <= 22) && (posY - 116 <= 19) && + (posX - 353 >= 0) && (posY - 116 >= 0)) + zone = 2; + if ((posX - 483 <= 20) && (posY - 250 <= 25) && + (posX - 483 >= 0) && (posY - 250 >= 0)) + zone = 3; + if ((posX - 471 <= 27) && (posY - 326 <= 20) && + (posX - 471 >= 0) && (posY - 326 >= 0)) + zone = 4; + if ((posX - 162 <= 21) && (posY - 365 <= 23) && + (posX - 162 >= 0) && (posY - 365 >= 0)) + zone = 5; + if ((posX - 106 <= 20) && (posY - 267 <= 26) && + (posX - 106 >= 0) && (posY - 267 >= 0)) + zone = 6; + if (zone) { + _eventsManager.CHANGE_MOUSE(4); + _globals.couleur_40 += 25; + if (_globals.couleur_40 > 100) + _globals.couleur_40 = 0; + _graphicsManager.SETCOLOR4(251, _globals.couleur_40, _globals.couleur_40, _globals.couleur_40); + } else { + _eventsManager.CHANGE_MOUSE(0); + _graphicsManager.SETCOLOR4(251, 100, 100, 100); + } + _eventsManager.VBL(); + if ((mouseButton == 1) && zone) + v0 = 1; + } while (v0 != 1); + _globals.DESACTIVE_INVENT = false; + _graphicsManager.FADE_OUTW(); + switch (zone) { + case 1: + result = 94; + break; + case 2: + result = 95; + break; + case 3: + result = 96; + break; + case 4: + result = 97; + break; + case 5: + result = 98; + break; + case 6: + result = 99; + break; + default: + result = 0; + break; + } + return result; } void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { -- cgit v1.2.3 From 9b9b761e710e9000e75b7565344b1bef86cd2a15 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 15:15:59 +0100 Subject: HOPKINS: Little cleanup of previous commit --- engines/hopkins/hopkins.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 21bc2ac6b7..ec9f872755 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1903,9 +1903,6 @@ void HopkinsEngine::AVION() { int HopkinsEngine::PWBASE() { warning("PWBASE()"); - int v0; // edi@1 - int result; // eax@30 - _globals.DESACTIVE_INVENT = true; _graphicsManager.LOAD_IMAGE("PBASE"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -1914,7 +1911,7 @@ int HopkinsEngine::PWBASE() { _graphicsManager.SETCOLOR3(254, 0, 0, 0); _eventsManager.CHANGE_MOUSE(0); _graphicsManager.FADE_INW(); - v0 = 0; + bool loopCond = false; int zone; do { int mouseButton = _eventsManager.BMOUSE(); @@ -1951,10 +1948,12 @@ int HopkinsEngine::PWBASE() { } _eventsManager.VBL(); if ((mouseButton == 1) && zone) - v0 = 1; - } while (v0 != 1); + loopCond = true; + } while (!loopCond); _globals.DESACTIVE_INVENT = false; _graphicsManager.FADE_OUTW(); + + int result; switch (zone) { case 1: result = 94; -- cgit v1.2.3 From 3e4c99fce71a6e92a848351427d1926ba5f2285e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 15:50:22 +0100 Subject: HOPKINS: Implement AVION() --- engines/hopkins/hopkins.cpp | 81 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ec9f872755..795226bd3a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1897,7 +1897,85 @@ void HopkinsEngine::JOUE_FIN() { } void HopkinsEngine::AVION() { - warning("STUB - AVION()"); + warning("AVION()"); + + _soundManager.WSOUND(28); + _globals.iRegul = 1; + _globals.nbrligne = 640; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + + _animationManager.CLS_ANM = false; + if (_globals.SVGA == 1) { + _animationManager.PLAY_ANM("aerop00.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop10.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop20.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop30.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop40.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop50.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop60.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop70.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans00.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans10.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans15.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans20.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans30.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans40.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("PARA00.anm", 9, 9, 9); + } + } else if (_globals.SVGA == 2) { + _animationManager.PLAY_ANM("aerop00a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("serop10a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop20a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop30a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop40a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop50a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop60a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("aerop70a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans00a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans10a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans15a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans20a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans30a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("trans40a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("PARA00a.anm", 9, 9, 9); + } + } + + _eventsManager.ESC_KEY = 0; + _animationManager.CLS_ANM = 0; } int HopkinsEngine::PWBASE() { @@ -1950,6 +2028,7 @@ int HopkinsEngine::PWBASE() { if ((mouseButton == 1) && zone) loopCond = true; } while (!loopCond); + _globals.DESACTIVE_INVENT = false; _graphicsManager.FADE_OUTW(); -- cgit v1.2.3 From 0e11fbbe537ccd3e4bd778a81966f60b25971780 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 16:43:18 +0100 Subject: HOPKINS: Implement JOUE_FIN() Change two more variables to boolean --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 162 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 1 + engines/hopkins/objects.cpp | 16 ++--- 5 files changed, 174 insertions(+), 13 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ae39e8bb60..ae2c1d6d7e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -171,8 +171,8 @@ Globals::Globals() { opt_txt = 0; opt_anm = 0; NBTRI = 0; - AFFLI = 0; - AFFIVBL = 0; + AFFLI = false; + AFFIVBL = false; NOT_VERIF = 0; PERSO_TYPE = 0; GOACTION = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 04c8f3170d..06ddfc4ea5 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -422,8 +422,8 @@ public: int opt_music; int opt_txt; int NBTRI; - int AFFLI; - int AFFIVBL; + bool AFFLI; // CHECKME: Useless variable? + bool AFFIVBL; // CHECKME: Useless variable? int NOT_VERIF; bool CACHEFLAG; bool NOPARLE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 795226bd3a..826cd23ffb 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1893,7 +1893,163 @@ void HopkinsEngine::BASED() { } void HopkinsEngine::JOUE_FIN() { - warning("STUB - JOUE_FIN()"); + warning("JOUE_FIN()"); + + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _dialogsManager.VIRE_INVENT = true; + _globals.DESACTIVE_INVENT = true; + _graphicsManager.ofscroll = 0; + _globals.PLAN_FLAG = false; + _globals.iRegul = 1; + _soundManager.WSOUND(26); + _globals.chemin = (int16 *)g_PTRNUL; + _globals.NOMARCHE = true; + _globals.SORTIE = 0; + _globals.AFFLI = false; + _globals.AFFIVBL = false; + _soundManager.CHARGE_SAMPLE(1, "SOUND90.WAV"); + _graphicsManager.LOAD_IMAGE("IM100"); + _animationManager.CHARGE_ANIM("ANIM100"); + _graphicsManager.VISU_ALL(); + _eventsManager.MOUSE_ON(); + _objectsManager.BOBANIM_OFF(7); + _objectsManager.BOBANIM_OFF(8); + _objectsManager.BOBANIM_OFF(9); + _graphicsManager.SETCOLOR3(252, 100, 100, 100); + _graphicsManager.SETCOLOR3(253, 100, 100, 100); + _graphicsManager.SETCOLOR3(251, 100, 100, 100); + _graphicsManager.SETCOLOR3(254, 0, 0, 0); + _eventsManager.CHANGE_MOUSE(0); + _globals.BPP_NOAFF = true; + + int cpt = 0; + do { + _eventsManager.VBL(); + ++cpt; + } while (cpt <= 4); + + _globals.BPP_NOAFF = false; + _graphicsManager.FADE_INW(); + _globals.iRegul = 1; + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(6) != 54); + + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO("GM4.PE2"); + _globals.DESACTIVE_INVENT = true; + _objectsManager.BOBANIM_OFF(6); + _objectsManager.BOBANIM_OFF(10); + _objectsManager.BOBANIM_ON(9); + _objectsManager.BOBANIM_ON(7); + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(7) != 54); + + _soundManager.PLAY_SAMPLE2(1); + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(7) != 65); + + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO("DUELB4.PE2"); + _eventsManager.MOUSE_OFF(); + _globals.DESACTIVE_INVENT = true; + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(7) != 72); + + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO("DUELH1.PE2"); + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(7) != 81); + + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO("DUELB5.PE2"); + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(7) != 120); + + _objectsManager.BOBANIM_OFF(7); + if (*((byte *)_globals.SAUVEGARDE + 135) == 1) { + _soundManager.SPECIAL_SOUND = 200; + _soundManager.VBL_MERDE = true; + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("BERM.ANM", 100, 24, 300); + _graphicsManager.FIN_VISU(); + _soundManager.DEL_SAMPLE(1); + _graphicsManager.LOAD_IMAGE("PLAN3"); + _graphicsManager.FADE_INW(); + _globals.lItCounter = 0; + if (!_eventsManager.ESC_KEY) { + do + _eventsManager.CONTROLE_MES(); + while (_globals.lItCounter < 2000 / _globals.vitesse && !_eventsManager.ESC_KEY); + } + _eventsManager.ESC_KEY = false; + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 0; + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR2A.anm", 12, 12, 1000); + _soundManager.WSOUND(11); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("FF1a.anm", 18, 18, 9); + _animationManager.PLAY_ANM("FF1a.anm", 9, 18, 9); + _animationManager.PLAY_ANM("FF1a.anm", 9, 18, 18); + _animationManager.PLAY_ANM("FF1a.anm", 9, 18, 9); + _animationManager.PLAY_ANM("FF2a.anm", 24, 24, 100); + Credits(); + _globals.iRegul = 0; + _globals.SORTIE = 300; + _dialogsManager.VIRE_INVENT = false; + _globals.DESACTIVE_INVENT = false; + } else { + _soundManager.SPECIAL_SOUND = 200; + _soundManager.VBL_MERDE = true; + _animationManager.PLAY_ANM2("BERM.ANM", 100, 24, 300); + _objectsManager.BOBANIM_OFF(7); + _objectsManager.BOBANIM_ON(8); + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO("GM5.PE2"); + _globals.DESACTIVE_INVENT = true; + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(8) != 5); + + _soundManager.PLAY_SOUND2("SOUND41.WAV"); + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(8) != 21); + + _graphicsManager.FADE_OUTW(); + _graphicsManager.FIN_VISU(); + _soundManager.DEL_SAMPLE(1); + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 0; + _dialogsManager.VIRE_INVENT = false; + _globals.DESACTIVE_INVENT = false; + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 1000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; } void HopkinsEngine::AVION() { @@ -2059,6 +2215,10 @@ int HopkinsEngine::PWBASE() { return result; } +void HopkinsEngine::Credits() { + warning("STUB - Credits()"); +} + void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { warning("STUB - OCEAN()"); } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 919b39e418..b6434cadc9 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -98,6 +98,7 @@ private: void AVION(); int PWBASE(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9); + void Credits(); bool runLinuxDemo(); bool runLinuxFull(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e05b55f5e6..e2f0685d79 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2633,8 +2633,8 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.NOMARCHE = false; sprite_ptr = g_PTRNUL; _vm->_globals.SORTIE = 0; - _vm->_globals.AFFLI = 0; - _vm->_globals.AFFIVBL = 0; + _vm->_globals.AFFLI = false; + _vm->_globals.AFFIVBL = false; _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.WSOUND(31); _vm->_globals.iRegul = 1; @@ -2728,7 +2728,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANY = YSPR(0); _vm->_globals.PLANI = 1; SPRITE_OFF(0); - _vm->_globals.AFFLI = 0; + _vm->_globals.AFFLI = false; sprite_ptr = _vm->_globals.LIBERE_FICHIER(sprite_ptr); CLEAR_ECRAN(); _vm->_globals.NOSPRECRAN = false; @@ -5579,8 +5579,8 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals.SORTIE = 0; - _vm->_globals.AFFLI = 0; - _vm->_globals.AFFIVBL = 0; + _vm->_globals.AFFLI = false; + _vm->_globals.AFFIVBL = false; if (!s1.empty()) _vm->_graphicsManager.LOAD_IMAGE(s1); if (!s2.empty()) @@ -5679,8 +5679,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; _vm->_globals.SORTIE = 0; - _vm->_globals.AFFLI = 0; - _vm->_globals.AFFIVBL = 0; + _vm->_globals.AFFLI = false; + _vm->_globals.AFFIVBL = false; _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.WSOUND(v); _vm->_globals.iRegul = 1; @@ -5807,7 +5807,7 @@ LABEL_70: _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = false; SPRITE_OFF(0); - _vm->_globals.AFFLI = 0; + _vm->_globals.AFFLI = false; if (DEUXPERSO == true) { SPRITE_OFF(1); DEUXPERSO = false; -- cgit v1.2.3 From 49c20931d9230c0b3b4fdd0d03288e798f9e8cf7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 17:59:29 +0100 Subject: HOPKINS: Implement Credits() --- engines/hopkins/globals.cpp | 9 ++++++ engines/hopkins/globals.h | 9 ++++++ engines/hopkins/hopkins.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 2 ++ 4 files changed, 90 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ae2c1d6d7e..75b3bbabca 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -184,6 +184,15 @@ Globals::Globals() { STOP_BUG = 0; MAX_COMPTE = 0; + Credit_bx = -1; + Credit_bx1 = -1; + Credit_by = -1; + Credit_by1 = -1; + Credit_y = 0; + Credit_lignes = 0; + memset(Credit, 0, 12000); + Credit_step = 0; + // Initialise pointers ICONE = NULL; BUF_ZONE = NULL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 06ddfc4ea5..2c04c9fcc2 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -452,6 +452,15 @@ public: int old_z_69; int j_104; + int Credit_bx; + int Credit_bx1; + int Credit_by; + int Credit_by1; + int Credit_y; + int Credit_lignes; + char Credit[12000]; + int Credit_step; + Globals(); ~Globals(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 826cd23ffb..fa319a84b7 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2215,8 +2215,77 @@ int HopkinsEngine::PWBASE() { return result; } +void HopkinsEngine::Charge_Credits() { + warning("STUB - Charge_Credits()"); +} + +void HopkinsEngine::CREDIT_AFFICHE(int a1, int a2, char a3) { + warning("STUB - CREDIT_AFFICHE"); +} + void HopkinsEngine::Credits() { - warning("STUB - Credits()"); + warning("Credits()"); + + Charge_Credits(); + _globals.Credit_y = 436; + _graphicsManager.LOAD_IMAGE("GENERIC"); + _graphicsManager.FADE_INW(); + _soundManager.WSOUND(28); + _eventsManager.souris_flag = false; + _globals.iRegul = 3; + _globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1; + int soundId = 28; + do { + for (int i = 0; i < _globals.Credit_lignes; ++i) { + if (_globals.Credit[60 * i] == 1) { + int nextY = _globals.Credit_y + i * _globals.Credit_step; +// *(_DWORD *)&Credit[60 * i + 4] = nextY; + _globals.Credit[60 * i + 4] = nextY & 0xFF; + _globals.Credit[60 * i + 5] = (nextY >> 8) & 0xFF; + _globals.Credit[60 * i + 6] = (nextY >> 16) & 0xFF; + _globals.Credit[60 * i + 7] = (nextY >> 24) & 0xFF; + + if ((nextY - 21 >= 0) && (nextY - 21 <= 418)) { + char tmpVal = _globals.Credit[60 * i + 1]; + int a1 = 0; + if (tmpVal == 49) + a1 = 163; + if (tmpVal == 50) + a1 = 161; + if (tmpVal == 51) + a1 = 162; +// if (*(_WORD *)&Credit[60 * i + 8] != -1) + if ((_globals.Credit[60 * i + 8] != 0xFF) && _globals.Credit[60 * i + 9] != 0xFF) + CREDIT_AFFICHE(nextY, 60 * i + 8, a1); + } + } + } + --_globals.Credit_y; + if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) { + _eventsManager.VBL(); + _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 60, 50, 520, 380, _graphicsManager.VESA_BUFFER, 60, 50); + } else { + _eventsManager.VBL(); + } +// if (*(_DWORD *)&Credit[20 * (3 * Credit_lignes - 3) + 4] <= 39) { + if ( _globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] + + (_globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] << 8) + + (_globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] << 16) + + (_globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] << 24) <= 39) { + _globals.Credit_y = 440; + ++soundId; + if (soundId > 31) + soundId = 28; + _soundManager.WSOUND(soundId); + } + _globals.Credit_bx = -1; + _globals.Credit_bx1 = -1; + _globals.Credit_by = -1; + _globals.Credit_by1 = -1; + } while (_eventsManager.BMOUSE() != 1); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _eventsManager.souris_flag = true; } void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index b6434cadc9..62f3ee6765 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -98,6 +98,8 @@ private: void AVION(); int PWBASE(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9); + void Charge_Credits(); + void CREDIT_AFFICHE(int a1, int a2, char a3); void Credits(); bool runLinuxDemo(); -- cgit v1.2.3 From e0f06d7f96e49b60e16e829099bd2b8b9a748da9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 18:13:01 +0100 Subject: HOPKINS: Implement INCENDIE() --- engines/hopkins/hopkins.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index fa319a84b7..378c5026f0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1881,7 +1881,49 @@ void HopkinsEngine::PUBQUIT() { } void HopkinsEngine::INCENDIE() { - warning("STUB - INCENDIE()"); + warning("INCENDIE()"); + + _globals.DESACTIVE_INVENT = true; + _globals.iRegul = 1; + _graphicsManager.LOAD_IMAGE("IM71"); + _animationManager.CHARGE_ANIM("ANIM71"); + _graphicsManager.SETCOLOR3(252, 100, 100, 100); + _graphicsManager.SETCOLOR3(253, 100, 100, 100); + _graphicsManager.SETCOLOR3(251, 100, 100, 100); + _graphicsManager.SETCOLOR3(254, 0, 0, 0); + _graphicsManager.VISU_ALL(); + _globals.BPP_NOAFF = true; + + int cpt = 0; + do { + _eventsManager.VBL(); + ++cpt; + } while (cpt <= 4); + + _globals.BPP_NOAFF = false; + _graphicsManager.FADE_INW(); + _globals.iRegul = 1; + + cpt = 0; + do { + _eventsManager.VBL(); + ++cpt; + } while (cpt <= 249); + + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO("SVGARD1.pe2"); + _globals.NOPARLE = false; + + cpt = 0; + do { + _eventsManager.VBL(); + ++cpt; + } while (cpt <= 49); + + _graphicsManager.FADE_OUTW(); + _graphicsManager.FIN_VISU(); + *((byte *)_globals.SAUVEGARDE + 312) = 1; + _globals.DESACTIVE_INVENT = false; } void HopkinsEngine::BASE() { -- cgit v1.2.3 From 678f13397752e93494b2d1ca069beadf0d688c64 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 18:52:43 +0100 Subject: HOPKINS: Implement BASED(), remove a parameter to PLAY_SEQ() --- engines/hopkins/anim.cpp | 2 +- engines/hopkins/anim.h | 2 +- engines/hopkins/hopkins.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- engines/hopkins/objects.cpp | 2 +- engines/hopkins/script.cpp | 28 ++++++++++++++-------------- 5 files changed, 57 insertions(+), 18 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 5102a883a6..0296b9ec3b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -957,7 +957,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count } while (v21 <= count && v3 != 1); } -void AnimationManager::PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { +void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { int v5; int v7; byte *ptr = NULL; diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 339355ef75..66afcfcc5e 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -50,7 +50,7 @@ public: void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); void RECHERCHE_ANIM(const byte *data, int animIndex, int count); - void PLAY_SEQ(int a1, const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); + void PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); void PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4); }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 378c5026f0..a95d7b3523 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1931,7 +1931,46 @@ void HopkinsEngine::BASE() { } void HopkinsEngine::BASED() { - warning("STUB - BASED()"); + warning("BASED()"); + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _animationManager.NO_SEQ = false; + _soundManager.WSOUND(26); + _globals.iRegul = 1; + _globals.DESACTIVE_INVENT = true; + _animationManager.NO_COUL = true; + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_SEQ("abase.seq", 50, 15, 50); + _animationManager.NO_COUL = false; + _graphicsManager.LOAD_IMAGE("IM92"); + _animationManager.CHARGE_ANIM("ANIM92"); + _graphicsManager.VISU_ALL(); + _objectsManager.INILINK("IM92"); + _globals.BPP_NOAFF = true; + + int cpt = 0; + do { + _eventsManager.VBL(); + ++cpt; + } while (cpt <= 4); + + _globals.BPP_NOAFF = false; + _graphicsManager.FADE_INW(); + _globals.CACHE_ON(); + + do + _eventsManager.VBL(); + while (_objectsManager.BOBPOSI(8) != 22); + + _graphicsManager.FADE_OUTW(); + _graphicsManager.FIN_VISU(); + _globals.RESET_CACHE(); + _globals.DESACTIVE_INVENT = false; + _globals.SORTIE = 93; + _globals.iRegul = 0; } void HopkinsEngine::JOUE_FIN() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e2f0685d79..dd1f9cdd1d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -5615,7 +5615,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.ECRAN == 61) { - _vm->_animationManager.PLAY_SEQ(0, "OUVRE.SEQ", 10, 4, 10); + _vm->_animationManager.PLAY_SEQ("OUVRE.SEQ", 10, 4, 10); BOBANIM_OFF(3); _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 6b0aabf26c..ba0d81b8bf 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -857,7 +857,7 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); _vm->_soundManager.SPECIAL_SOUND = 17; - _vm->_animationManager.PLAY_SEQ(v1, "grenade.SEQ", 1, 32, 100); + _vm->_animationManager.PLAY_SEQ("grenade.SEQ", 1, 32, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.PLAY_ANM("CREVE17.ANM", 24, 24, 200); @@ -1291,11 +1291,11 @@ LABEL_1141: if (v76 == 90) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5A.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5C.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB5C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); } @@ -1303,11 +1303,11 @@ LABEL_1141: if (v76 == 91) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5B.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB5D.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB5D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); } @@ -1315,11 +1315,11 @@ LABEL_1141: if (v76 == 92) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6A.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6C.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB6C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); } @@ -1327,11 +1327,11 @@ LABEL_1141: if (v76 == 93) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6B.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_animationManager.PLAY_SEQ(v1, "CIB6D.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("CIB6D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); } @@ -1562,7 +1562,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_globals.NO_VISU = false; _vm->_soundManager.SPECIAL_SOUND = 211; - _vm->_animationManager.PLAY_SEQ(v1, "SECRET2.SEQ", 1, 12, 100); + _vm->_animationManager.PLAY_SEQ("SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager.NOFADE = true; @@ -1587,7 +1587,7 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; _vm->_eventsManager.NOESC = true; - _vm->_animationManager.PLAY_SEQ(v1, "SORT.SEQ", 10, 4, 10); + _vm->_animationManager.PLAY_SEQ("SORT.SEQ", 10, 4, 10); _vm->_eventsManager.NOESC = false; _vm->_soundManager.SPECIAL_SOUND = 0; } @@ -1764,7 +1764,7 @@ LABEL_1141: } if (v76 == 229) { _vm->_soundManager.SPECIAL_SOUND = 229; - _vm->_animationManager.PLAY_SEQ(v1, "MUR.SEQ", 1, 12, 1); + _vm->_animationManager.PLAY_SEQ("MUR.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); } @@ -2221,7 +2221,7 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.PLAY_SEQ(v1, "RESU.SEQ", 2, 24, 2); + _vm->_animationManager.PLAY_SEQ("RESU.SEQ", 2, 24, 2); _vm->_animationManager.NO_SEQ = false; } else { _vm->_objectsManager.OPTI_ONE(7, 0, 14, 0); @@ -2230,7 +2230,7 @@ LABEL_1141: if (v76 == 242) { _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.PLAY_SEQ(v1, "RESUF.SEQ", 1, 24, 1); + _vm->_animationManager.PLAY_SEQ("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; v53 = &_vm->_globals.SAUVEGARDE->field380; v53->field0 = 404; -- cgit v1.2.3 From 29d54519156912a8692f88e4e3bf802718465d02 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 20:26:45 +0100 Subject: HOPKINS: Implement BASE() --- engines/hopkins/hopkins.cpp | 89 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a95d7b3523..5fd8164bf8 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1927,7 +1927,94 @@ void HopkinsEngine::INCENDIE() { } void HopkinsEngine::BASE() { - warning("STUB - BASE()"); + warning("BASE()"); + + _globals.iRegul = 1; + _graphicsManager.nbrligne = 640; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _animationManager.CLS_ANM = true; + _soundManager.WSOUND(25); + if (_globals.SVGA == 1) { + _animationManager.PLAY_ANM("base00.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("base05.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("base10.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("base20.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("base30.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("base40.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("base50.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("OC00.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("OC05.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("OC10.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _animationManager.PLAY_ANM("OC20.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) + goto LABEL_27; + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("OC30.anm", 10, 18, 18); + } + if (_globals.SVGA == 2) { + _animationManager.PLAY_ANM("base00a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("base05a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("base10a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("base20a.anm", 10, 18, 18); + if (_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("base30a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("base40a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("base50a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("OC00a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("OC05a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("OC10a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("OC20a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("OC30a.anm", 10, 18, 18); + } + } + } + } + } + } + } + } + } + } + } + } +LABEL_27: + _eventsManager.ESC_KEY = false; + _animationManager.CLS_ANM = false; + _globals.SORTIE = 85; } void HopkinsEngine::BASED() { -- cgit v1.2.3 From ec012d7242c6ab54c1fd04fb269807b6c148a71a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 20:47:08 +0100 Subject: HOPKINS: Rework a bit BASE() code --- engines/hopkins/hopkins.cpp | 115 ++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 67 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5fd8164bf8..cd6ee1d5bd 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1939,79 +1939,60 @@ void HopkinsEngine::BASE() { _soundManager.WSOUND(25); if (_globals.SVGA == 1) { _animationManager.PLAY_ANM("base00.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("base05.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("base10.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("base20.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("base30.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("base40.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("base50.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("OC00.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("OC05.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("OC10.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _animationManager.PLAY_ANM("OC20.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) - goto LABEL_27; - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("OC30.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base05.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base10.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base20.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base30.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base40.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base50.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC00.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC05.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC10.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC20.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("OC30.anm", 10, 18, 18); + } } if (_globals.SVGA == 2) { _animationManager.PLAY_ANM("base00a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager.ESC_KEY) _animationManager.PLAY_ANM("base05a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("base10a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("base20a.anm", 10, 18, 18); - if (_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("base30a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("base40a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("base50a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("OC00a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("OC05a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("OC10a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("OC20a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("OC30a.anm", 10, 18, 18); - } - } - } - } - } - } - } - } - } - } + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base10a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base20a.anm", 10, 18, 18); + // CHECKME: The original code was doing the opposite test, which looks like a bug. + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base30a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base40a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("base50a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC00a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC05a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC10a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) + _animationManager.PLAY_ANM("OC20a.anm", 10, 18, 18); + if (!_eventsManager.ESC_KEY) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("OC30a.anm", 10, 18, 18); } } -LABEL_27: + _eventsManager.ESC_KEY = false; _animationManager.CLS_ANM = false; _globals.SORTIE = 85; -- cgit v1.2.3 From cab8c1da606b9aaacdf77d62b27f1564b9a95413 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 21:37:04 +0100 Subject: HOPKINS: Implement OCEAN() --- engines/hopkins/globals.cpp | 2 + engines/hopkins/globals.h | 2 + engines/hopkins/hopkins.cpp | 108 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 2 + 4 files changed, 113 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 75b3bbabca..8cfa830c4d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -193,6 +193,8 @@ Globals::Globals() { memset(Credit, 0, 12000); Credit_step = 0; + OCEAN_SENS = 0; + // Initialise pointers ICONE = NULL; BUF_ZONE = NULL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 2c04c9fcc2..17c78ca883 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -461,6 +461,8 @@ public: char Credit[12000]; int Credit_step; + int OCEAN_SENS; + Globals(); ~Globals(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index cd6ee1d5bd..a901484290 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2437,8 +2437,114 @@ void HopkinsEngine::Credits() { _eventsManager.souris_flag = true; } +void HopkinsEngine::BTOCEAN() { + warning("STUB - BTOCEAN()"); +} + +void HopkinsEngine::OCEAN_HOME() { + warning("STUB - OCEAN_HOME()"); +} + void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { - warning("STUB - OCEAN()"); + warning("OCEAN()"); + + _globals.PLAN_FLAG = false; + _graphicsManager.NOFADE = false; + _globals.NOMARCHE = false; + _globals.SORTIE = 0; + _globals.AFFLI = false; + _globals.AFFIVBL = true; + _globals.DESACTIVE_INVENT = true; + _soundManager.WSOUND(a9); + _fileManager.CONSTRUIT_SYSTEM("VAISSEAU.SPR"); + _fileManager.CHARGE_FICHIER2(_globals.NFICHIER, _globals.PERSO); + if (a2.size()) + _graphicsManager.LOAD_IMAGE(a2); + if (a1 == 77) + goto LABEL_53; + if (a1 != 84 && a1 != 91) + _objectsManager.INILINK("ocean"); + if (a1 == 77) +LABEL_53: + _objectsManager.INILINK("IM77"); + if (a1 == 84) + _objectsManager.INILINK("IM84"); + if (a1 == 91) + _objectsManager.INILINK("IM91"); + if (!a5) + _objectsManager.ZONE_OFF(1); + if (!a6) + _objectsManager.ZONE_OFF(2); + if (!a7) + _objectsManager.ZONE_OFF(3); + if (!a8) + _objectsManager.ZONE_OFF(4); + if (!_globals.OCEAN_SENS) + _globals.OCEAN_SENS = a4; + if (_globals.OCEAN_SENS == 5) { + _objectsManager.PERX = 236; + _objectsManager.PERI = 9; + } + if (_globals.OCEAN_SENS == 1) { + _objectsManager.PERX = 236; + _objectsManager.PERI = 27; + } + if (_globals.OCEAN_SENS == 7) { + _objectsManager.PERX = 415; + _objectsManager.PERI = 18; + } + if (_globals.OCEAN_SENS == 3) { + _objectsManager.PERX = -20; + _objectsManager.PERI = 0; + } + _objectsManager.SPRITE(_globals.PERSO, _objectsManager.PERX, 110, 0, _objectsManager.PERI, 0, 0, 0, 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); + _objectsManager.SPRITE_ON(0); + _globals.chemin = (int16 *)g_PTRNUL; + _eventsManager.MOUSE_ON(); + _eventsManager.CHANGE_MOUSE(4); + + int cpt = 0; + do { + _eventsManager.VBL(); + ++cpt; + } while (cpt <= 4); + + if (!_graphicsManager.NOFADE) + _graphicsManager.FADE_INW(); + _graphicsManager.NOFADE = false; + _globals.iRegul = 1; + + bool loopCond = false; + do { + int mouseButton = _eventsManager.BMOUSE(); + if (mouseButton && mouseButton == 1) + BTOCEAN(); + _objectsManager.VERIFZONE(); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_globals.SORTIE) + loopCond = true; + } while (!loopCond); + + if (_globals.SORTIE == 1) + _globals.SORTIE = a5; + if (_globals.SORTIE == 2) + _globals.SORTIE = a6; + if (_globals.SORTIE == 3) + _globals.SORTIE = a7; + if (_globals.SORTIE == 4) + _globals.SORTIE = a8; + _graphicsManager.FADE_OUTW(); + _objectsManager.SPRITE_OFF(0); + _globals.AFFLI = false; + _objectsManager.CLEAR_ECRAN(); + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _fileManager.CHARGE_FICHIER2(_globals.NFICHIER, _globals.PERSO); + _globals.PERSO_TYPE = 0; } void HopkinsEngine::syncSoundSettings() { diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 62f3ee6765..1042c4d22a 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -97,6 +97,8 @@ private: void JOUE_FIN(); void AVION(); int PWBASE(); + void BTOCEAN(); + void OCEAN_HOME(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9); void Charge_Credits(); void CREDIT_AFFICHE(int a1, int a2, char a3); -- cgit v1.2.3 From 338294852da94dd240e1b3df64e1bd02ff483159 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 21:41:26 +0100 Subject: HOPKINS: Remove a goto in OCEAN() --- engines/hopkins/hopkins.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a901484290..b89b239cdf 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2460,17 +2460,16 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _fileManager.CHARGE_FICHIER2(_globals.NFICHIER, _globals.PERSO); if (a2.size()) _graphicsManager.LOAD_IMAGE(a2); - if (a1 == 77) - goto LABEL_53; - if (a1 != 84 && a1 != 91) + + if ((a1 != 77) && (a1 != 84) && (a1 != 91)) _objectsManager.INILINK("ocean"); - if (a1 == 77) -LABEL_53: + else if (a1 == 77) _objectsManager.INILINK("IM77"); - if (a1 == 84) + else if (a1 == 84) _objectsManager.INILINK("IM84"); - if (a1 == 91) + else if (a1 == 91) _objectsManager.INILINK("IM91"); + if (!a5) _objectsManager.ZONE_OFF(1); if (!a6) -- cgit v1.2.3 From a1d0d2f7db6c67e4c1dd72200d81b79aa4735f96 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 21:49:35 +0100 Subject: HOPKINS: Implement OCEAN_HOME() --- engines/hopkins/hopkins.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b89b239cdf..ddad2d5bd3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2442,7 +2442,16 @@ void HopkinsEngine::BTOCEAN() { } void HopkinsEngine::OCEAN_HOME() { - warning("STUB - OCEAN_HOME()"); + warning("OCEAN_HOME()"); + + if (_globals.OCEAN_SENS == 3) + _objectsManager.SETANISPR(0, 0); + if (_globals.OCEAN_SENS == 7) + _objectsManager.SETANISPR(0, 18); + if (_globals.OCEAN_SENS == 1) + _objectsManager.SETANISPR(0, 27); + if (_globals.OCEAN_SENS == 5) + _objectsManager.SETANISPR(0, 9); } void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { -- cgit v1.2.3 From 8521e614a9dd6d7817d7582645785bbf818ddbfd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Nov 2012 23:03:14 +0100 Subject: HOPKINS: Implement BTOCEAN() --- engines/hopkins/hopkins.cpp | 188 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ddad2d5bd3..e95ecba330 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2438,7 +2438,193 @@ void HopkinsEngine::Credits() { } void HopkinsEngine::BTOCEAN() { - warning("STUB - BTOCEAN()"); + warning("BTOCEAN()"); + + _fontManager.TEXTE_OFF(9); + if (_eventsManager.btsouris == 16) { + _eventsManager.XMOUSE(); + if (_objectsManager.NUMZONE > 0) { + int oldPosX = _eventsManager.XMOUSE(); + int oldPosY = _eventsManager.YMOUSE(); + bool displAnim = false; + if (_objectsManager.NUMZONE == 1) { + if (_globals.OCEAN_SENS == 3) + _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, 0); + if (_globals.OCEAN_SENS == 1) + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, 0); + if (_globals.OCEAN_SENS == 5) + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, 0); + _globals.OCEAN_SENS = 7; + _globals.SORTIE = 1; + int oldX = _objectsManager.XSPR(0); + while (1) { + if (_globals.vitesse == 1) + oldX -= 2; + if (_globals.vitesse == 2) + oldX -= 4; + if (_globals.vitesse == 3) + oldX -= 6; + _objectsManager.SETXSPR(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.BMOUSE() == 1) { + if (oldPosX == _eventsManager.XMOUSE()) { + if (_eventsManager.YMOUSE() == oldPosY) + break; + } + } + if (oldX <= -100) + goto LABEL_22; + } + displAnim = true; + } +LABEL_22: + if (_objectsManager.NUMZONE == 2) { + if (_globals.OCEAN_SENS == 7) + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); + if (_globals.OCEAN_SENS == 1) + _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); + if (_globals.OCEAN_SENS == 5) + _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, 0); + _globals.OCEAN_SENS = 3; + _globals.SORTIE = 2; + int oldX = _objectsManager.XSPR(0); + while (1) { + if (_globals.vitesse == 1) + oldX += 2; + if (_globals.vitesse == 2) + oldX += 4; + if (_globals.vitesse == 3) + oldX += 6; + _objectsManager.SETXSPR(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.BMOUSE() == 1) { + if (oldPosX == _eventsManager.XMOUSE()) { + if (_eventsManager.YMOUSE() == oldPosY) + break; + } + } + if (oldX > 499) + goto LABEL_41; + } + displAnim = true; + } +LABEL_41: + if (_objectsManager.NUMZONE == 3) { + if (_globals.OCEAN_SENS == 3) { + int oldX = _objectsManager.XSPR(0); + do { + if (_globals.vitesse == 1) + oldX += 2; + if (_globals.vitesse == 2) + oldX += 4; + if (_globals.vitesse == 3) + oldX += 6; + _objectsManager.SETXSPR(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.BMOUSE() == 1) { + if (oldPosX == _eventsManager.XMOUSE()) { + if (_eventsManager.YMOUSE() == oldPosY) { + displAnim = true; + goto LABEL_57; + } + } + } + } while (oldX <= 235); + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, 0); + } +LABEL_57: + if (_globals.OCEAN_SENS == 7) { + int oldX = _objectsManager.XSPR(0); + do { + if (_globals.vitesse == 1) + oldX -= 2; + if (_globals.vitesse == 2) + oldX -= 4; + if (_globals.vitesse == 3) + oldX -= 6; + _objectsManager.SETXSPR(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.BMOUSE() == 1) { + if (oldPosX == _eventsManager.XMOUSE()) { + if (_eventsManager.YMOUSE() == oldPosY) { + displAnim = true; + goto LABEL_72; + } + } + } + } while (oldX > 236); + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); + } +LABEL_72: + if (_globals.OCEAN_SENS == 5) + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); + _globals.OCEAN_SENS = 1; + _globals.SORTIE = 3; + } + if (_objectsManager.NUMZONE == 4) { + if (_globals.OCEAN_SENS == 3) { + int oldX = _objectsManager.XSPR(0); + do { + if (_globals.vitesse == 1) + oldX += 2; + if (_globals.vitesse == 2) + oldX += 4; + if (_globals.vitesse == 3) + oldX += 6; + _objectsManager.SETXSPR(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.BMOUSE() == 1) { + if (oldPosX == _eventsManager.XMOUSE()) { + if (_eventsManager.YMOUSE() == oldPosY) { + displAnim = true; + goto LABEL_91; + } + } + } + } while (oldX <= 235); + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, 0); + } +LABEL_91: + if (_globals.OCEAN_SENS == 7) { + int oldX = _objectsManager.XSPR(0); + while (1) { + if (_globals.vitesse == 1) + oldX -= 2; + if (_globals.vitesse == 2) + oldX -= 4; + if (_globals.vitesse == 3) + oldX -= 6; + _objectsManager.SETXSPR(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.BMOUSE() == 1) { + if (oldPosX == _eventsManager.XMOUSE()) { + if (_eventsManager.YMOUSE() == oldPosY) + break; + } + } + if (oldX <= 236) { + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, 0); + break; + } + } + } + if (_globals.OCEAN_SENS == 1) + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, 0); + _globals.OCEAN_SENS = 5; + _globals.SORTIE = 4; + } + } + } } void HopkinsEngine::OCEAN_HOME() { -- cgit v1.2.3 From edb264ae1290d6658ce5738bc8035ac8ff66b2ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Nov 2012 00:01:08 +0100 Subject: HOPKINS: Implement CREDIT_AFFICHE() --- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++--- engines/hopkins/hopkins.h | 2 +- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 17c78ca883..c9cda8fbcb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -458,7 +458,7 @@ public: int Credit_by1; int Credit_y; int Credit_lignes; - char Credit[12000]; + byte Credit[12000]; int Credit_step; int OCEAN_SENS; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index e95ecba330..c6ee0ac530 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2368,8 +2368,47 @@ void HopkinsEngine::Charge_Credits() { warning("STUB - Charge_Credits()"); } -void HopkinsEngine::CREDIT_AFFICHE(int a1, int a2, char a3) { - warning("STUB - CREDIT_AFFICHE"); +void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { + warning("CREDIT_AFFICHE"); + + byte *v3 = buffer; + byte *v4 = buffer; + int strWidth = 0; + byte curChar; + while (1) { + curChar = *v4++; + if (!curChar) + break; + if (curChar > 31) + strWidth += _objectsManager.Get_Largeur(_globals.police, curChar - 32); + } + int startPosX = 320 - strWidth / 2; + int endPosX = strWidth + startPosX; + int endPosY = startPosY + 12; + if ((_globals.Credit_bx == -1) && (_globals.Credit_bx1 == -1) && (_globals.Credit_by == -1) && (_globals.Credit_by1 == -1)) { + _globals.Credit_bx = startPosX; + _globals.Credit_bx1 = endPosX; + _globals.Credit_by = startPosY; + _globals.Credit_by1 = endPosY; + } + if (startPosX < _globals.Credit_bx) + _globals.Credit_bx = startPosX; + if (endPosX > _globals.Credit_bx1) + _globals.Credit_bx1 = endPosX; + if (_globals.Credit_by > startPosY) + _globals.Credit_by = startPosY; + if (endPosY > _globals.Credit_by1) + _globals.Credit_by1 = endPosY; + + while (1) { + curChar = *v3++; + if (!curChar) + break; + if (curChar > 31) { + _graphicsManager.Affiche_Fonte(_graphicsManager.VESA_BUFFER, _globals.police, startPosX, startPosY, curChar - 32, colour); + startPosX += _objectsManager.Get_Largeur(_globals.police, curChar - 32); + } + } } void HopkinsEngine::Credits() { @@ -2405,7 +2444,7 @@ void HopkinsEngine::Credits() { a1 = 162; // if (*(_WORD *)&Credit[60 * i + 8] != -1) if ((_globals.Credit[60 * i + 8] != 0xFF) && _globals.Credit[60 * i + 9] != 0xFF) - CREDIT_AFFICHE(nextY, 60 * i + 8, a1); + CREDIT_AFFICHE(nextY, _globals.Credit + (60 * i + 8), a1); } } } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 1042c4d22a..6b210fffed 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -101,7 +101,7 @@ private: void OCEAN_HOME(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9); void Charge_Credits(); - void CREDIT_AFFICHE(int a1, int a2, char a3); + void CREDIT_AFFICHE(int startPosY, byte *buffer, char colour); void Credits(); bool runLinuxDemo(); -- cgit v1.2.3 From 66ef127280debf3586ee1074b50fa193eb03d81e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Nov 2012 00:28:01 +0100 Subject: HOPKINS: Implement Charge_Credits() --- engines/hopkins/globals.cpp | 2 ++ engines/hopkins/globals.h | 2 ++ engines/hopkins/hopkins.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 8cfa830c4d..ef400b7865 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -192,6 +192,8 @@ Globals::Globals() { Credit_lignes = 0; memset(Credit, 0, 12000); Credit_step = 0; + Credit_l = 0; + Credit_h = 0; OCEAN_SENS = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c9cda8fbcb..6a8deecffb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -460,6 +460,8 @@ public: int Credit_lignes; byte Credit[12000]; int Credit_step; + int Credit_l; + int Credit_h; int OCEAN_SENS; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c6ee0ac530..19c59fd24e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2365,7 +2365,71 @@ int HopkinsEngine::PWBASE() { } void HopkinsEngine::Charge_Credits() { - warning("STUB - Charge_Credits()"); + warning("Charge_Credits()"); + + char v0; // al@3 + int v1; // edx@5 + __int16 v2; // cx@5 + byte *v3; // ebx@5 + char v4; // al@6 + __int16 v5; // cx@14 + __int16 v7; // [sp+10h] [bp-10h]@1 + char v8; // [sp+14h] [bp-Ch]@1 + byte *v9; // [sp+18h] [bp-8h]@1 + byte *ptr; // [sp+1Ch] [bp-4h]@1 + + _globals.Credit_y = 440; + _globals.Credit_l = 10; + _globals.Credit_h = 40; + _globals.Credit_step = 45; + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREAN.TXT"); + ptr = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + v9 = ptr; + v7 = 0; + v8 = 0; + do { + if (*v9 == 37) { + v0 = *(v9 + 1); + if (v0 == 37) { + v8 = 1; + goto LABEL_13; + } + v1 = 60 * v7; + _globals.Credit[v1 + 1] = v0; + _globals.Credit[v1] = 1; +// *(_DWORD *)(v1 + _globals.Credit[4]) = _globals.Credit_y + v7 * _globals.Credit_step; + _globals.Credit[4 + v1] = _globals.Credit_y + v7 * _globals.Credit_step & 0xFF; + _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 8 & 0xFF; + _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 16 & 0xFF; + _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 24 & 0xFF; + v2 = 0; + v3 = &_globals.Credit[v1]; + while (1) { + v4 = *(v9 + v2 + 3); + if (v4 == 37 || v4 == 10) + break; + v3[v2++ + 10] = v4; + if (v2 > 49) + goto LABEL_11; + } + v3[v2 + 10] = 0; +// *(_WORD *)&_globals.Credit[60 * v7 + 8] = v2 - 1; + _globals.Credit[60 * v7 + 8] = (v2 - 1) & 0xFF; + _globals.Credit[60 * v7 + 9] = ((v2 - 1) >> 8) & 0xFF; +LABEL_11: + ++v7; + } + _globals.Credit_lignes = v7; +LABEL_13: + v9 = v9 + 1; + } while (v8 != 1); + v5 = 0; + if (_globals.Credit_lignes > 0) { + do + ++v5; + while (v5 < _globals.Credit_lignes); + } + _globals.dos_free2(ptr); } void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { -- cgit v1.2.3 From ff9dc4ab248e47c15076dd822b635927f7b27161 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 12 Nov 2012 20:09:29 +1100 Subject: HOPKINS: Bugfix for freeze when looking at the cat when voices are turned on. --- engines/hopkins/events.cpp | 2 +- engines/hopkins/sound.cpp | 25 ++++++++++++++++++++++--- engines/hopkins/sound.h | 19 +++++++++++++------ 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 3a54e8788d..81ca05b236 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -154,7 +154,7 @@ void EventsManager::CHANGE_MOUSE(int id) { // Check Events void EventsManager::CONTROLE_MES() { - _vm->_soundManager.checkMusic(); + _vm->_soundManager.checkSounds(); pollEvents(); } diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e23c7e525f..9cbfa39f71 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -331,6 +331,11 @@ void SoundManager::DEL_MUSIC() { Music._currentIndex = -1; } +void SoundManager::checkSounds() { + checkMusic(); + checkVoices(); +} + void SoundManager::checkMusic() { if (Music._active && Music._isPlaying) { int mwavIndex = Music._mwavIndexes[Music._currentIndex]; @@ -363,6 +368,20 @@ void SoundManager::checkMusic() { } } +void SoundManager::checkVoices() { + // Check the status of each voice. + bool hasActiveVoice = false; + for (int i = 0; i < VOICE_COUNT; ++i) { + VOICE_STAT(i); + hasActiveVoice |= Voice[i]._status != 0; + } + + if (!hasActiveVoice && SOUND_FLAG) { + SOUND_FLAG = false; + SOUND_NUM = 0; + } +} + void SoundManager::LOAD_MSAMPLE(int mwavIndex, const Common::String &file) { if (!Mwav[mwavIndex]._active) { Common::File f; @@ -578,7 +597,8 @@ void SoundManager::PLAY_WAV(int wavIndex) { int SoundManager::VOICE_STAT(int voiceIndex) { if (Voice[voiceIndex]._status) { - if (Voice[voiceIndex]._audioStream->endOfStream()) + int wavIndex = Voice[voiceIndex]._wavIndex; + if (Swav[wavIndex]._audioStream->endOfStream()) STOP_VOICE(voiceIndex); } @@ -599,7 +619,6 @@ void SoundManager::STOP_VOICE(int voiceIndex) { Voice[voiceIndex].fieldC = 0; Voice[voiceIndex]._status = 0; Voice[voiceIndex].field14 = 0; - Voice[voiceIndex]._audioStream = NULL; } void SoundManager::SDL_LVOICE(size_t filePosition, size_t entryLength) { @@ -691,9 +710,9 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { DEL_SAMPLE_SDL(wavIndex); Voice[voiceIndex].fieldC = 0; - Voice[voiceIndex]._audioStream = Swav[wavIndex]._audioStream; Voice[voiceIndex]._status = 1; Voice[voiceIndex].field14 = 4; + Voice[voiceIndex]._wavIndex = wavIndex; int volume = (voiceIndex == 2) ? VOICEVOL * 255 / 16 : SOUNDVOL * 255 / 16; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 88cecbbea7..36184715ba 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -35,7 +35,6 @@ class VoiceItem { public: int _status; int _wavIndex; - Audio::RewindableAudioStream *_audioStream; int fieldC; int field14; }; @@ -96,6 +95,18 @@ private: void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); void LOAD_MSAMPLE(int mwavIndex, const Common::String &file); void DEL_MSAMPLE(int mwavIndex); + + /** + * Checks the music structure to see if music playback is active, and whether + * it needs to move to the next WAV file + */ + void checkMusic(); + + /** + * Checks voices to see if they're finished + */ + void checkVoices(); + public: int SPECIAL_SOUND; int SOUNDVOL; @@ -137,11 +148,6 @@ public: void STOP_MUSIC(); void DEL_MUSIC(); - /** - * Checks the music structure to see if music playback is active, and whether - * it needs to move to the next WAV file - */ - void checkMusic(); bool VOICE_MIX(int voiceId, int voiceMode); void DEL_SAMPLE(int soundIndex); @@ -156,6 +162,7 @@ public: void syncSoundSettings(); void updateScummVMSoundSettings(); + void checkSounds(); }; } // End of namespace Hopkins -- cgit v1.2.3 From db091123ee8f53b0a9cb4ce63f5fee3fc91100fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 13 Nov 2012 20:25:55 +1100 Subject: HOPKINS: Compilation fixes under gcc --- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/hopkins.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 132e8d88ab..a455d35f40 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -360,7 +360,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by // Copy out the palette const byte *palSrc = pcxDecoder.getPalette(); - Common::copy((byte *)palSrc, (byte *)palSrc + PALETTE_BLOCK_SIZE, palette); + Common::copy((const byte *)palSrc, (const byte *)palSrc + PALETTE_BLOCK_SIZE, palette); f.close(); } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 19c59fd24e..13cb092561 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -919,7 +919,7 @@ LABEL_140: } if (_globals.SORTIE == 31) { _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); - } else if ((unsigned __int16)(_globals.SORTIE - 35) <= 6u) { + } else if ((uint16)(_globals.SORTIE - 35) <= 6u) { _globals.fmusic = 13; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; @@ -1308,7 +1308,7 @@ LABEL_243: _globals.SORTIE = 51; break; default: - if ((unsigned __int16)(_globals.SORTIE - 194) > 5u) { + if ((uint16)(_globals.SORTIE - 194) > 5u) { if (_globals.SORTIE == 151) { _soundManager.WSOUND(16); _globals.iRegul = 1; @@ -2369,11 +2369,11 @@ void HopkinsEngine::Charge_Credits() { char v0; // al@3 int v1; // edx@5 - __int16 v2; // cx@5 + int v2; // cx@5 byte *v3; // ebx@5 char v4; // al@6 - __int16 v5; // cx@14 - __int16 v7; // [sp+10h] [bp-10h]@1 + int v5; // cx@14 + int v7; // [sp+10h] [bp-10h]@1 char v8; // [sp+14h] [bp-Ch]@1 byte *v9; // [sp+18h] [bp-8h]@1 byte *ptr; // [sp+1Ch] [bp-4h]@1 -- cgit v1.2.3 From 5f21d3d00a4b1f821d8fc98e37a31a872d835d08 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 13 Nov 2012 20:40:24 +1100 Subject: HOPKINS: Fix gcc warning about shadowed variable --- engines/hopkins/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 9cbfa39f71..13979c5cd8 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -293,7 +293,7 @@ void SoundManager::LOAD_MUSIC(const Common::String &file) { s[2] = '\0'; mwavIndex = atol(&s[0]); - Common::String filename = Common::String::format("%s_%s.WAV", file.c_str(), &s[0]); + filename = Common::String::format("%s_%s.WAV", file.c_str(), &s[0]); LOAD_MSAMPLE(mwavIndex, filename); assert(destIndex < MUSIC_WAVE_COUNT); -- cgit v1.2.3 From 322e0278740b0bf4df9b5c737066d9c08eb1b4b9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Nov 2012 18:56:23 +0100 Subject: HOPKINS: Re-add detection for Full Linux --- engines/hopkins/detection_tables.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 9e1d329f39..873dc956ea 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -100,6 +100,21 @@ static const HopkinsGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { + // Hopkins FBI Linux, provided by Strangerke + { + "hopkins", + 0, + { + {"Hopkins.bin", 0, "71611380cb31744bf909b8319a65e6e6", 275844}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformLinux, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From 467963f8caf32ab2d1a0b4150e2431d9865cc7f4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Nov 2012 19:15:32 +0100 Subject: HOPKINS: Add some descriptions in detection entries --- engines/hopkins/detection_tables.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 873dc956ea..58fa088b94 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -27,7 +27,7 @@ static const HopkinsGameDescription gameDescriptions[] = { // Hopkins FBI Linux Demo 1.00 { "hopkins", - 0, + "Linux Demo v1.00", { {"Hopkins-PDemo.bin", 0, "88b4d6e14b9b1407083cb3d1213c0fa7", 272027}, AD_LISTEND @@ -43,7 +43,7 @@ static const HopkinsGameDescription gameDescriptions[] = { // Hopkins FBI Linux Demo 1.02 { "hopkins", - 0, + "Linux Demo v1.02", { {"Hopkins-PDemo.bin", 0, "f82f4e698f3a189419351be0de2b2f8e", 273760}, AD_LISTEND @@ -74,7 +74,7 @@ static const HopkinsGameDescription gameDescriptions[] = { // Hopkins FBI Win95 Demo, provided by Strangerke { "hopkins", - 0, + "Win95 Demo", { {"Hopkins.exe", 0, "0c9ebfe371f4dcf84a49f333f04839a0", 376897}, AD_LISTEND -- cgit v1.2.3 From cc7d7fc2cdcbc7a7033a78c132154969d6ee8bc3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Nov 2012 07:55:15 +0100 Subject: HOPKINS: Rework Credits (WIP) --- engines/hopkins/globals.h | 10 +++- engines/hopkins/hopkins.cpp | 111 +++++++++++++++++++++++--------------------- 2 files changed, 67 insertions(+), 54 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 6a8deecffb..a9fc30ff9c 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -283,6 +283,14 @@ struct Sauvegarde { int16 inventory[35]; // Originally at offset 1300 of data array }; +struct CreditItem { + bool _actvFl; + int _colour; + int _linePosY; + int _lineSize; + byte _line[49]; +}; + class HopkinsEngine; /** @@ -458,7 +466,7 @@ public: int Credit_by1; int Credit_y; int Credit_lignes; - byte Credit[12000]; + CreditItem Credit[200]; int Credit_step; int Credit_l; int Credit_h; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 13cb092561..9ee216cebd 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -104,6 +104,8 @@ Common::Error HopkinsEngine::run() { _soundManager.WSOUND_INIT(); + Credits(); + bool retVal; if (getPlatform() == Common::kPlatformLinux) { if (getIsDemo()) @@ -2367,13 +2369,8 @@ int HopkinsEngine::PWBASE() { void HopkinsEngine::Charge_Credits() { warning("Charge_Credits()"); - char v0; // al@3 - int v1; // edx@5 - int v2; // cx@5 - byte *v3; // ebx@5 + CreditItem v3; // ebx@5 char v4; // al@6 - int v5; // cx@14 - int v7; // [sp+10h] [bp-10h]@1 char v8; // [sp+14h] [bp-Ch]@1 byte *v9; // [sp+18h] [bp-8h]@1 byte *ptr; // [sp+1Ch] [bp-4h]@1 @@ -2382,53 +2379,63 @@ void HopkinsEngine::Charge_Credits() { _globals.Credit_l = 10; _globals.Credit_h = 40; _globals.Credit_step = 45; - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREAN.TXT"); + switch (_globals.FR) { + case 0: + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREAN.TXT"); + break; + case 1: + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREFR.TXT"); + break; + case 2: + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREES.TXT"); + break; + default: + error("Charge_Credits(): Unhandled language"); + break; + } + ptr = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); v9 = ptr; - v7 = 0; + int idxLines = 0; v8 = 0; do { - if (*v9 == 37) { - v0 = *(v9 + 1); - if (v0 == 37) { + if (*v9 == '%') { + if (v9[1] == '%') { v8 = 1; goto LABEL_13; } - v1 = 60 * v7; - _globals.Credit[v1 + 1] = v0; - _globals.Credit[v1] = 1; -// *(_DWORD *)(v1 + _globals.Credit[4]) = _globals.Credit_y + v7 * _globals.Credit_step; - _globals.Credit[4 + v1] = _globals.Credit_y + v7 * _globals.Credit_step & 0xFF; - _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 8 & 0xFF; - _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 16 & 0xFF; - _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 24 & 0xFF; - v2 = 0; - v3 = &_globals.Credit[v1]; + _globals.Credit[idxLines]._colour = v9[1]; + _globals.Credit[idxLines]._actvFl = true; + _globals.Credit[idxLines]._linePosY = _globals.Credit_y + idxLines * _globals.Credit_step; + int idxBuf = 0; + v3 = _globals.Credit[idxLines]; while (1) { - v4 = *(v9 + v2 + 3); - if (v4 == 37 || v4 == 10) + v4 = *(v9 + idxBuf + 3); + if (v4 == '%' || v4 == 10) break; - v3[v2++ + 10] = v4; - if (v2 > 49) + v3._line[idxBuf] = v4; + idxBuf++; + if (idxBuf > 49) goto LABEL_11; } - v3[v2 + 10] = 0; -// *(_WORD *)&_globals.Credit[60 * v7 + 8] = v2 - 1; - _globals.Credit[60 * v7 + 8] = (v2 - 1) & 0xFF; - _globals.Credit[60 * v7 + 9] = ((v2 - 1) >> 8) & 0xFF; + v3._line[idxBuf] = 0; + _globals.Credit[idxLines]._lineSize = idxBuf - 1; LABEL_11: - ++v7; + ++idxLines; } - _globals.Credit_lignes = v7; + _globals.Credit_lignes = idxLines; LABEL_13: v9 = v9 + 1; } while (v8 != 1); + +/* Useless v5 = 0; if (_globals.Credit_lignes > 0) { do ++v5; while (v5 < _globals.Credit_lignes); } +*/ _globals.dos_free2(ptr); } @@ -2489,26 +2496,28 @@ void HopkinsEngine::Credits() { int soundId = 28; do { for (int i = 0; i < _globals.Credit_lignes; ++i) { - if (_globals.Credit[60 * i] == 1) { + if (_globals.Credit[i]._actvFl) { int nextY = _globals.Credit_y + i * _globals.Credit_step; -// *(_DWORD *)&Credit[60 * i + 4] = nextY; - _globals.Credit[60 * i + 4] = nextY & 0xFF; - _globals.Credit[60 * i + 5] = (nextY >> 8) & 0xFF; - _globals.Credit[60 * i + 6] = (nextY >> 16) & 0xFF; - _globals.Credit[60 * i + 7] = (nextY >> 24) & 0xFF; + _globals.Credit[i]._linePosY = nextY; if ((nextY - 21 >= 0) && (nextY - 21 <= 418)) { - char tmpVal = _globals.Credit[60 * i + 1]; - int a1 = 0; - if (tmpVal == 49) - a1 = 163; - if (tmpVal == 50) - a1 = 161; - if (tmpVal == 51) - a1 = 162; -// if (*(_WORD *)&Credit[60 * i + 8] != -1) - if ((_globals.Credit[60 * i + 8] != 0xFF) && _globals.Credit[60 * i + 9] != 0xFF) - CREDIT_AFFICHE(nextY, _globals.Credit + (60 * i + 8), a1); + int col = 0; + switch (_globals.Credit[i]._colour) { + case '1': + col = 163; + break; + case '2': + col = 161; + break; + case '3': + col = 162; + break; + default: + warning("Credit line skipped, unknown colour"); + break; + } + if (_globals.Credit[i]._lineSize != -1) + CREDIT_AFFICHE(nextY, _globals.Credit[i]._line, col); } } } @@ -2519,11 +2528,7 @@ void HopkinsEngine::Credits() { } else { _eventsManager.VBL(); } -// if (*(_DWORD *)&Credit[20 * (3 * Credit_lignes - 3) + 4] <= 39) { - if ( _globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] + - (_globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] << 8) + - (_globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] << 16) + - (_globals.Credit[20 * (3 * _globals.Credit_lignes - 3) + 4] << 24) <= 39) { + if ( _globals.Credit[_globals.Credit_lignes - 1]._linePosY <= 39) { _globals.Credit_y = 440; ++soundId; if (soundId > 31) -- cgit v1.2.3 From b15e6f0ac5f4b32ddc657dce73d0fcce62afdbcd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Nov 2012 22:37:38 +0100 Subject: HOPKINS: Finish work on Credit --- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 60 ++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a9fc30ff9c..b8f4714c26 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -288,7 +288,7 @@ struct CreditItem { int _colour; int _linePosY; int _lineSize; - byte _line[49]; + byte _line[50]; }; class HopkinsEngine; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 9ee216cebd..740cb6f458 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -104,8 +104,6 @@ Common::Error HopkinsEngine::run() { _soundManager.WSOUND_INIT(); - Credits(); - bool retVal; if (getPlatform() == Common::kPlatformLinux) { if (getIsDemo()) @@ -2369,12 +2367,6 @@ int HopkinsEngine::PWBASE() { void HopkinsEngine::Charge_Credits() { warning("Charge_Credits()"); - CreditItem v3; // ebx@5 - char v4; // al@6 - char v8; // [sp+14h] [bp-Ch]@1 - byte *v9; // [sp+18h] [bp-8h]@1 - byte *ptr; // [sp+1Ch] [bp-4h]@1 - _globals.Credit_y = 440; _globals.Credit_l = 10; _globals.Credit_h = 40; @@ -2394,39 +2386,38 @@ void HopkinsEngine::Charge_Credits() { break; } - ptr = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); - v9 = ptr; + byte *bufPtr = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + byte *curPtr = bufPtr; int idxLines = 0; - v8 = 0; + bool loopCond = false; do { - if (*v9 == '%') { - if (v9[1] == '%') { - v8 = 1; - goto LABEL_13; + if (*curPtr == '%') { + if (curPtr[1] == '%') { + loopCond = true; + break; } - _globals.Credit[idxLines]._colour = v9[1]; + _globals.Credit[idxLines]._colour = curPtr[1]; _globals.Credit[idxLines]._actvFl = true; _globals.Credit[idxLines]._linePosY = _globals.Credit_y + idxLines * _globals.Credit_step; int idxBuf = 0; - v3 = _globals.Credit[idxLines]; while (1) { - v4 = *(v9 + idxBuf + 3); - if (v4 == '%' || v4 == 10) + byte curChar = curPtr[idxBuf + 3]; + if (curChar == '%' || curChar == 10) break; - v3._line[idxBuf] = v4; + _globals.Credit[idxLines]._line[idxBuf] = curChar; idxBuf++; - if (idxBuf > 49) - goto LABEL_11; + if (idxBuf >= 49) + break; } - v3._line[idxBuf] = 0; + _globals.Credit[idxLines]._line[idxBuf] = 0; _globals.Credit[idxLines]._lineSize = idxBuf - 1; -LABEL_11: + curPtr = curPtr + idxBuf + 2; ++idxLines; + } else { + curPtr++; } _globals.Credit_lignes = idxLines; -LABEL_13: - v9 = v9 + 1; - } while (v8 != 1); + } while (!loopCond); /* Useless v5 = 0; @@ -2436,18 +2427,17 @@ LABEL_13: while (v5 < _globals.Credit_lignes); } */ - _globals.dos_free2(ptr); + _globals.dos_free2(bufPtr); } void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { warning("CREDIT_AFFICHE"); - byte *v3 = buffer; - byte *v4 = buffer; + byte *bufPtr = buffer; int strWidth = 0; byte curChar; while (1) { - curChar = *v4++; + curChar = *bufPtr++; if (!curChar) break; if (curChar > 31) @@ -2471,8 +2461,9 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { if (endPosY > _globals.Credit_by1) _globals.Credit_by1 = endPosY; + bufPtr = buffer; while (1) { - curChar = *v3++; + curChar = *bufPtr++; if (!curChar) break; if (curChar > 31) { @@ -2513,7 +2504,8 @@ void HopkinsEngine::Credits() { col = 162; break; default: - warning("Credit line skipped, unknown colour"); + warning("Unknown colour, default to col #1"); + col = 163; break; } if (_globals.Credit[i]._lineSize != -1) @@ -2539,7 +2531,7 @@ void HopkinsEngine::Credits() { _globals.Credit_bx1 = -1; _globals.Credit_by = -1; _globals.Credit_by1 = -1; - } while (_eventsManager.BMOUSE() != 1); + } while ((_eventsManager.BMOUSE() != 1) && (!g_system->getEventManager()->shouldQuit())); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _eventsManager.souris_flag = true; -- cgit v1.2.3 From db5626adb6f282b5c1ce68cbe8d0097e82ba1a39 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Nov 2012 22:58:48 +0100 Subject: HOPKINS: Fix exit in full game --- engines/hopkins/hopkins.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 740cb6f458..42d4de8579 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -589,6 +589,9 @@ LABEL_11: for (;;) { for (;;) { for (;;) { + if (g_system->getEventManager()->shouldQuit()) + return false; + if (_globals.SORTIE == 300) goto LABEL_11; if (_globals.SORTIE != 18) -- cgit v1.2.3 From e920b06ececf39db787b3ec26be3ffe1b498ea1d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Nov 2012 13:34:15 +0100 Subject: HOPKINS: Add some more code specific to the full version (linux) --- engines/hopkins/anim.cpp | 51 +++++++++++++++++++++++++++++++++------------ engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 28 +++++++++++++------------ engines/hopkins/talk.cpp | 30 ++++++++++++++++++++++---- 4 files changed, 80 insertions(+), 31 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 0296b9ec3b..993b64e167 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -1021,6 +1021,12 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, if (_vm->_animationManager.NO_SEQ) { if (v7 == 1) memcpy(ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + if (!_vm->getIsDemo()) { + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + } _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.DD_Lock(); @@ -1039,19 +1045,38 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } - _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = false; - _vm->_soundManager.LOAD_ANM_SOUND(); - if (_vm->_globals.iRegul == 1) { - do { - if (_vm->_eventsManager.ESC_KEY == true) { - if (!_vm->_eventsManager.NOESC) - goto LABEL_59; - _vm->_eventsManager.ESC_KEY = false; - } - _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < a3); + if (_vm->getIsDemo()) { + _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager.ESC_KEY = false; + _vm->_soundManager.LOAD_ANM_SOUND(); + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->_eventsManager.ESC_KEY == true) { + if (!_vm->_eventsManager.NOESC) + goto LABEL_59; + _vm->_eventsManager.ESC_KEY = false; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (_vm->_eventsManager.lItCounter < a3); + } + } else { + if (NO_COUL) + _vm->_graphicsManager.FADE_INW_LINUX(v9); + _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) { + if (!_vm->_eventsManager.NOESC) + goto LABEL_59; + _vm->_eventsManager.ESC_KEY = false; + } + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (_vm->_eventsManager.lItCounter < a3); + } } _vm->_eventsManager.lItCounter = 0; v5 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index b8f4714c26..f9d2b0c05e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -415,7 +415,7 @@ public: int Max_Perso_Y; bool DESACTIVE_INVENT; bool FLAG_VISIBLE; - bool netscape; + bool netscape; // CHECKME: Useless variable? bool NOMARCHE; int NBBLOC; bool NO_VISU; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 42d4de8579..1ea8f1f5db 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1767,19 +1767,21 @@ void HopkinsEngine::INTRORUN() { } void HopkinsEngine::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; + if (getIsDemo()) { + 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() { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 44f7e704f5..7d8eecbf64 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -489,10 +489,28 @@ int TalkManager::DIALOGUE_REP(int idx) { _vm->_eventsManager.souris_bb = false; _vm->_eventsManager.souris_b = false; - do { - _vm->_eventsManager.VBL(); - ++v14; - } while (v14 != v6); + if (_vm->getIsDemo()) { + do { + _vm->_eventsManager.VBL(); + ++v14; + } while (v14 != v6); + } else { + int tmpVal = 0; + do { + _vm->_eventsManager.VBL(); + ++v14; + if ( _vm->_eventsManager.souris_b || _vm->_eventsManager.souris_bb ) + v14 = v6; + if (_vm->_eventsManager.BMOUSE()) { + i = 5; + tmpVal = v6 / 5; + if (tmpVal < 0) + tmpVal = -tmpVal; + if (v14 > tmpVal) + v14 = v6; + } + } while (v14 != v6); + } } if (!_vm->_soundManager.TEXTOFF) @@ -1314,6 +1332,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(4); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + + if (!_vm->getIsDemo()) + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_Lock(); -- cgit v1.2.3 From 6d1db995408f3325824698b330300a0292a49931 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Nov 2012 08:32:40 +0100 Subject: HOPKINS: Remove some magic values, add a safety check in Copy_Video_Vbe16 --- engines/hopkins/anim.cpp | 22 +++++++++--------- engines/hopkins/files.cpp | 2 +- engines/hopkins/graphics.cpp | 53 ++++++++++++++++++++++++-------------------- engines/hopkins/graphics.h | 4 ++++ 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 993b64e167..a5821bbcce 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -149,14 +149,14 @@ LABEL_38: _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (hasScreenCopy) { - if (*v10 != (byte)-4) { + if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); else _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); } - } else if (*v10 != (byte)-4) { + } else if (*v10 != kByteStop) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe3(v10); if (_vm->_graphicsManager.Winbpp == 2) @@ -224,7 +224,7 @@ LABEL_58: v5 = -1; if (!v5) { f.read(v10, READ_LE_UINT32(ptr + 8)); - if (*v10 != (byte)-4) + if (*v10 != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); } } while (v5 != -1); @@ -440,14 +440,14 @@ LABEL_77: _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v8) { - if (*v12 != (byte)-4) { + if (*v12 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v12 != (byte)-4) { + } else if (*v12 != kByteStop) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe3(v12); if (_vm->_graphicsManager.Winbpp == 2) @@ -617,7 +617,7 @@ LABEL_114: if (!v6) { f.read(v12, READ_LE_UINT32(v13 + 8)); - if (*v12 != (byte)-4) + if (*v12 != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptra); } } while (v6 != -1); @@ -1107,14 +1107,14 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v7) { - if (*v9 != (byte)-4) { + if (*v9 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v9, ptr); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v9 != (byte)-4) { + } else if (*v9 != kByteStop) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe(v9); if (_vm->_graphicsManager.Winbpp == 2) @@ -1274,14 +1274,14 @@ LABEL_33: _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v7) { - if (*v10 != (byte)-4) { + if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v10 != (byte)-4) { + } else if (*v10 != kByteStop) { if (_vm->_graphicsManager.Winbpp == 1) _vm->_graphicsManager.Copy_Video_Vbe(v10); if (_vm->_graphicsManager.Winbpp == 2) @@ -1343,7 +1343,7 @@ LABEL_54: v5 = true; if (!v5) { f.read(v10, READ_LE_UINT32(v11 + 8)); - if (*v10 != (byte)-4) + if (*v10 != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); } } while (!v5); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 79b672ca33..aafa56691f 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -99,7 +99,7 @@ void FileManager::DMESS1() { void FileManager::bload(const Common::String &file, byte *buf) { Common::File f; if (!f.open(file)) - error("Error openinig file - %s", file.c_str()); + error("Error opening file - %s", file.c_str()); int32 filesize = f.size(); _vm->_fileManager.bload_it(f, buf, filesize); f.close(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a455d35f40..8af5792389 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -957,17 +957,17 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) srcByte = *srcP; if (*srcP < 0xDEu) goto Video_Cont3_wVbe; - if (srcByte == (byte)-4) + if (srcByte == kByteStop) return; - if (srcByte < 0xFBu) { + if (srcByte < kSetOffset) { destOffset += (byte)(*srcP + 35); srcByte = *(srcP++ + 1); - } else if (srcByte == (byte)-3) { + } else if (srcByte == k8bVal) { destOffset += *(srcP + 1); srcByte = *(srcP + 2); srcP += 2; - } else if (srcByte == (byte)-2) { + } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); srcByte = *(srcP + 3); srcP += 3; @@ -1019,16 +1019,16 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { if (*srcP < 222) goto Video_Cont3_Vbe; - if (srcByte == 252) + if (srcByte == kByteStop) return; - if (srcByte < 251) { + if (srcByte < kSetOffset) { destOffset += *srcP + 35; srcByte = *(srcP++ + 1); - } else if (srcByte == (byte)-3) { + } else if (srcByte == k8bVal) { destOffset += *(srcP + 1); srcByte = *(srcP + 2); srcP += 2; - } else if (srcByte == (byte)-2) { + } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); srcByte = *(srcP + 3); srcP += 3; @@ -1070,16 +1070,16 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { for (;;) { byte srcByte = *srcP; if (srcByte >= 222) { - if (srcByte == 252) + if (srcByte == kByteStop) return; - if (srcByte < 251) { + if (srcByte < kSetOffset) { destOffset += srcByte - 221; srcByte = *++srcP; - } else if (srcByte == 253) { + } else if (srcByte == k8bVal) { destOffset += *(const byte *)(srcP + 1); srcByte = *(const byte *)(srcP + 2); srcP += 2; - } else if (srcByte == 254) { + } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); srcByte = *(const byte *)(srcP + 3); srcP += 3; @@ -1090,6 +1090,11 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } } + if (destOffset > 640 * 480) { + warning("HACK: Stopping anim, out of bounds - 0x%x %d", srcByte, destOffset); + return; + } + if (srcByte > 210) { if (srcByte == 211) { int pixelCount = *(srcP + 1); @@ -1131,15 +1136,15 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { srcP = srcData; for (;;) { pixelIndex = *srcP; - if (*srcP < 0xFCu) + if (*srcP < kByteStop) goto Video_Cont_Vbe16a; - if (pixelIndex == (byte)-4) + if (pixelIndex == kByteStop) return; - if (pixelIndex == (byte)-3) { + if (pixelIndex == k8bVal) { destOffset += *(srcP + 1); pixelIndex = *(srcP + 2); srcP += 2; - } else if (pixelIndex == (byte)-2) { + } else if (pixelIndex == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); pixelIndex = *(srcP + 3); srcP += 3; @@ -2295,15 +2300,15 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { srcPtr = src; while (1) { byteVal = *srcPtr; - if (*srcPtr < 0xFCu) + if (*srcPtr < kByteStop) goto Video_Cont_wVbe; - if (byteVal == (byte)-4) + if (byteVal == kByteStop) return; - if (byteVal == (byte)-3) { + if (byteVal == k8bVal) { destOffset += *(srcPtr + 1); byteVal = *(srcPtr + 2); srcPtr += 2; - } else if (byteVal == (byte)-2) { + } else if (byteVal == k16bVal) { destOffset += READ_LE_UINT16(srcPtr + 1); byteVal = *(srcPtr + 3); srcPtr += 3; @@ -2329,15 +2334,15 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { srcP = src; while (1) { byteVal = *srcP; - if (*srcP < 0xFCu) + if (*srcP < kByteStop) goto Video_Cont_Vbe; - if (byteVal == (byte)-4) + if (byteVal == kByteStop) return; - if (byteVal == (byte)-3) { + if (byteVal == k8bVal) { destOffset += *(srcP + 1); byteVal = *(srcP + 2); srcP += 2; - } else if (byteVal == (byte)-2) { + } else if (byteVal == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); byteVal = *(srcP + 3); srcP += 3; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 5112672848..e29ede718e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -34,6 +34,10 @@ namespace Hopkins { #define PALETTE_SIZE 256 #define PALETTE_BLOCK_SIZE (PALETTE_SIZE * 3) #define PALETTE_EXT_BLOCK_SIZE 800 +static const byte kSetOffset = 251; +static const byte kByteStop = 252; +static const byte k8bVal = 253; +static const byte k16bVal = 254; struct RGB8 { byte r; -- cgit v1.2.3 From 3b878fc4c52a91034ff921cde00c868162d7e600 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 Nov 2012 21:24:52 +1100 Subject: HOPKINS: Fixed some save/loading of TEMP.SCR to use the SaveLoadManager. These should really be refactored in the future to use a memory buffer. Moderns systems have enough memory that it shouldn't be a problem to store a copy of the currently loaded background. --- engines/hopkins/anim.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a5821bbcce..fc576c4a32 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -279,6 +279,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == 1280) @@ -362,7 +363,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_globals.dos_free2(v13); f.close(); - _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -468,7 +469,7 @@ LABEL_88: _vm->_globals.dos_free2(v13); f.close(); - _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -533,7 +534,7 @@ LABEL_88: _vm->_globals.dos_free2(v13); f.close(); - _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -632,7 +633,7 @@ LABEL_114: _vm->_graphicsManager.FADE_LINUX = 0; _vm->_globals.dos_free2(v13); - _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -1142,7 +1143,7 @@ LABEL_59: f.close(); if (!NO_COUL) { - _vm->_fileManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_eventsManager.souris_flag = true; -- cgit v1.2.3 From 03468b17187c2d8d30085927491674d93ad631a8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Nov 2012 00:43:05 +0100 Subject: HOPKINS: Add voice to detection, except for the Win95 demo (to be fixed) --- engines/hopkins/detection.cpp | 8 ++++++++ engines/hopkins/detection_tables.h | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 8724802552..684854bb45 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -66,9 +66,17 @@ static const PlainGameDescriptor hopkinsGames[] = { #include "hopkins/detection_tables.h" +const static char *directoryGlobs[] = { + "hopdata", + "voice", + 0 +}; + class HopkinsMetaEngine : public AdvancedMetaEngine { public: HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), hopkinsGames) { + _maxScanDepth = 3; + _directoryGlobs = directoryGlobs; } virtual const char *getName() const { diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 58fa088b94..54c0fc9cbb 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -30,6 +30,7 @@ static const HopkinsGameDescription gameDescriptions[] = { "Linux Demo v1.00", { {"Hopkins-PDemo.bin", 0, "88b4d6e14b9b1407083cb3d1213c0fa7", 272027}, + {"RES_VAN.RES", 0, "29414c05be8f9fe794c61572a65def12", 16060544}, AD_LISTEND }, Common::EN_ANY, @@ -46,6 +47,7 @@ static const HopkinsGameDescription gameDescriptions[] = { "Linux Demo v1.02", { {"Hopkins-PDemo.bin", 0, "f82f4e698f3a189419351be0de2b2f8e", 273760}, + {"RES_VAN.RES", 0, "29414c05be8f9fe794c61572a65def12", 16060544}, AD_LISTEND }, Common::EN_ANY, @@ -62,6 +64,7 @@ static const HopkinsGameDescription gameDescriptions[] = { 0, { {"Hopkins.exe", 0, "63d45f882278e5a9fa1027066223e5d9", 292864}, + {"ENG_VOI.RES", 0, "fa5789d1d8c19d160bce44a33e742fdf", 66860711}, AD_LISTEND }, Common::EN_ANY, @@ -72,6 +75,7 @@ static const HopkinsGameDescription gameDescriptions[] = { }, { // Hopkins FBI Win95 Demo, provided by Strangerke + // CHECKME: No voice! a second file is required though... Also, it has multi-language support { "hopkins", "Win95 Demo", @@ -92,6 +96,7 @@ static const HopkinsGameDescription gameDescriptions[] = { 0, { {"Hopkins.exe", 0, "277a5c144bf9ec7d8450ae37afb85090", 419281}, + {"RES_VAN.RES", 0, "f1693ac0b0859c8ecd8cb30ff43cf55f", 38296346}, AD_LISTEND }, Common::EN_ANY, @@ -107,6 +112,23 @@ static const HopkinsGameDescription gameDescriptions[] = { 0, { {"Hopkins.bin", 0, "71611380cb31744bf909b8319a65e6e6", 275844}, + {"RES_VFR.RES", 0, "0490d4d1aa71075ebf71cc79e5dc7894", 39817945}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformLinux, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { + // Hopkins FBI Linux, provided by Strangerke + { + "hopkins", + 0, + { + {"Hopkins.bin", 0, "71611380cb31744bf909b8319a65e6e6", 275844}, + {"RES_VAN.RES", 0, "29414c05be8f9fe794c61572a65def12", 38832455}, AD_LISTEND }, Common::EN_ANY, -- cgit v1.2.3 From 63f69f2fa507baac3734019745aeda087d64be3e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 12:31:51 +1100 Subject: HOPKINS: Bugfixes for PLAY_ANM2 animation player --- engines/hopkins/anim.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index fc576c4a32..678e55e597 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -309,7 +309,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.Cls_Pal(); v11 = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.SCROLL_ECRAN(0); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -434,7 +434,7 @@ LABEL_48: if (v5) goto LABEL_88; - f.read(v12, READ_LE_UINT32(v13 + 2)); + f.read(v12, READ_LE_UINT32(v13 + 8)); if (_vm->_globals.iRegul == 1) break; LABEL_77: -- cgit v1.2.3 From 60c46fe386ad5f927ceda75912af5bd8b5ed563c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 12:36:28 +1100 Subject: HOPKINS: Bugfix for restoring screen after PLAY_ANM2 animation plays. --- engines/hopkins/anim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 678e55e597..5209ca39ef 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -661,7 +661,7 @@ LABEL_114: } } else { _vm->_eventsManager.souris_max(); - _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); + _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); -- cgit v1.2.3 From 848dcbcf0993f7bb15d16db4d65daaa0d4ffaf82 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 15:13:52 +1100 Subject: HOPKINS: Properly implemented CONSTRUIT_FICHIER for animations. The game has separate folders for selected animations at different resolutions. --- engines/hopkins/files.cpp | 41 ++++++++++++++++++++++++++++++++++------- engines/hopkins/files.h | 11 ++++++++++- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index aafa56691f..daa618d7c2 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -134,16 +134,43 @@ int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) { return _vm->_globals.NFICHIER.size(); } -// Build File -void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file) { - // At this point, the original program did a big switch statement to determine - // whether to preprend the CD or installed directory path into REPJEU +void FileManager::CONSTRUIT_FICHIER(const Common::String &folder, const Common::String &file) { + Common::String folderToUse = folder; - if (hop[0] == 'A' && hop[1] == 'N' && hop[2] == 'N') { - error("TODO: CONSTRUIT_FICHIER"); + // A lot of the code in the original engine based on COPIE_SEQ was used to determine + // whether a file resided on the CD or hard disk. Since the ScummVM implementatoin + // requires all the files in the same location, we only need to do a somewhat simpler + // check for animations that don't exist in the ANM folder, but rather in special + // sub-folders depending on the physical screen resolution being used. + + if (folder == "ANM") { + switch (_vm->_globals.SVGA) { + case 1: + if (TEST_REP(folderToUse, file)) + folderToUse = "TSVGA"; + break; + case 2: + if (TEST_REP(folderToUse, file)) + folderToUse = "SVGA"; + break; + case 3: + if (TEST_REP(folderToUse, file)) + folderToUse = "VGA"; + break; + default: + break; + } } - _vm->_globals.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); + _vm->_globals.NFICHIER = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); +} + +bool FileManager::TEST_REP(const Common::String &folder, const Common::String &file) { + Common::String filename = folder.empty() ? file : + Common::String::format("%s/%s", folder.c_str(), file.c_str()); + + Common::File f; + return !f.exists(filename); } // Free File diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index d9df4341ca..e63e5370c8 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -33,6 +33,8 @@ namespace Hopkins { class HopkinsEngine; class FileManager { +private: + bool TEST_REP(const Common::String &folder, const Common::String &file); public: HopkinsEngine *_vm; public: @@ -48,7 +50,14 @@ public: int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); void F_Censure(); int CONSTRUIT_SYSTEM(const Common::String &file); - void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file); + + /** + * Construct a filename based on a suggested folder and filename. + * @param folder Folder to use. May be overriden for animations. + * @param file Filename + */ + void CONSTRUIT_FICHIER(const Common::String &folder, const Common::String &file); + byte *LIBERE_FICHIER(byte *ptr); byte *RECHERCHE_CAT(const Common::String &file, int a2); Common::String CONSTRUIT_LINUX(const Common::String &file); -- cgit v1.2.3 From f2002f729a35df903c4e06373fc966f1cc5b0719 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 15:45:37 +1100 Subject: HOPKINS: Fix for hearing police report after leaving bank. --- engines/hopkins/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index dd1f9cdd1d..04464f5e28 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2697,7 +2697,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.NOPARLE = false; v5 = 0; } - if (_vm->_globals.SAUVEGARDE->data[svField180] == 1 && !_vm->_globals.SAUVEGARDE->data[svField172]) { + if (_vm->_globals.SAUVEGARDE->data[svField80] == 1 && !_vm->_globals.SAUVEGARDE->data[svField172]) { _vm->_globals.SAUVEGARDE->data[svField172] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); -- cgit v1.2.3 From 8b0ae07969dbdbeb9ad955ab1f23c570ca300167 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Nov 2012 09:59:50 +0100 Subject: HOPKINS: Use common::string instead of hardcoded values in CONSTRUIT_FICHIER --- engines/hopkins/files.cpp | 8 ++++---- engines/hopkins/globals.cpp | 3 +++ engines/hopkins/globals.h | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index daa618d7c2..bc523af254 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -143,19 +143,19 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &folder, const Common:: // check for animations that don't exist in the ANM folder, but rather in special // sub-folders depending on the physical screen resolution being used. - if (folder == "ANM") { + if (folder == _vm->_globals.HOPANM) { switch (_vm->_globals.SVGA) { case 1: if (TEST_REP(folderToUse, file)) - folderToUse = "TSVGA"; + folderToUse = _vm->_globals.HOPTSVGA; break; case 2: if (TEST_REP(folderToUse, file)) - folderToUse = "SVGA"; + folderToUse = _vm->_globals.HOPSVGA; break; case 3: if (TEST_REP(folderToUse, file)) - folderToUse = "VGA"; + folderToUse = _vm->_globals.HOPVGA; break; default: break; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ef400b7865..2283c6b10a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -296,6 +296,9 @@ void Globals::setConfig() { HOPMUSIC = "MUSIC"; HOPVOICE = "VOICE"; HOPANM = "ANM"; + HOPTSVGA = "TSVGA"; + HOPSVGA = "SVGA"; + HOPVGA = "VGA"; HOPSEQ = "SEQ"; // CHECKME: Should be in Globals() but it doesn't work diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f9d2b0c05e..382487a822 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -343,6 +343,9 @@ public: Common::String HOPMUSIC; Common::String HOPVOICE; Common::String HOPANM; + Common::String HOPTSVGA; + Common::String HOPSVGA; + Common::String HOPVGA; Common::String HOPSEQ; Common::String FICH_ZONE; Common::String FICH_TEXTE; -- cgit v1.2.3 From 0fdea57c544c8c1bd1c816262d9319367334eb83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 20:49:07 +1100 Subject: HOPKINS: Lots of code implemented for Hopkin's computer --- engines/hopkins/computer.cpp | 1316 ++++++++++++++++++++++++++++++++++++++++++ engines/hopkins/computer.h | 137 +++++ engines/hopkins/events.cpp | 25 + engines/hopkins/events.h | 27 + engines/hopkins/font.cpp | 66 ++- engines/hopkins/font.h | 5 +- engines/hopkins/graphics.cpp | 198 ++++++- engines/hopkins/graphics.h | 6 + engines/hopkins/hopkins.cpp | 13 +- engines/hopkins/hopkins.h | 2 + engines/hopkins/menu.cpp | 196 ------- engines/hopkins/menu.h | 1 - engines/hopkins/module.mk | 1 + engines/hopkins/sound.cpp | 27 + engines/hopkins/sound.h | 1 + 15 files changed, 1809 insertions(+), 212 deletions(-) create mode 100644 engines/hopkins/computer.cpp create mode 100644 engines/hopkins/computer.h diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp new file mode 100644 index 0000000000..afeb6ba6b4 --- /dev/null +++ b/engines/hopkins/computer.cpp @@ -0,0 +1,1316 @@ +/* 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/file.h" +#include "common/textconsole.h" +#include "hopkins/font.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" +#include "hopkins/objects.h" + +namespace Hopkins { + +ComputerManager::ComputerManager() { + Common::fill(&MenuText[0], &MenuText[10600], '\0'); + Common::fill(&Sup_string[0], &Sup_string[200], '\0'); + CASSESPR = NULL; + FMOUSE = false; + TEXT_COL = 0; + CASSETAB = 0; + NBBRIQUES = 0; + CASSESCORE = 0; + CASSEVIE = 0; + CASSESPEED = 0; + BALLEHORI = 0; + BALLEVERTI = 0; + NB_TABLE = 0; + RAQX = 0; + CASSEP1 = 0; + CASSEP2 = 0; + CASSDER = 0; +} + +void ComputerManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void ComputerManager::setvideomode() { + TEXT_MODE(); +} + +void ComputerManager::TEXT_MODE() { + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); + + _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; + _vm->_fileManager.CONSTRUIT_SYSTEM("STFONT.SPR"); + _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); + _vm->_globals.police = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.police_l = 8; + _vm->_globals.police_h = 8; + _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); + _vm->_graphicsManager.FADE_INW(); + Charge_Menu(); + _vm->_eventsManager.souris_flag = false; +} + +void ComputerManager::clearscreen() { + _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); + _vm->_graphicsManager.FADE_INW(); +} + +void ComputerManager::settextcolor(int col) { + TEXT_COL = col; +} + +void ComputerManager::settextposition(int xp, int yp) { + _textPosition.x = xp; + _textPosition.y = yp; +} + +void ComputerManager::COMPUT_HOPKINS(int mode) { + int v2; + char *v3; + int v4; + char v5; + char *v6; + int v7; + char v8; + char *v9; + int v10; + char v11; + int v12; + char s[12]; + const char *s2; + + _vm->_eventsManager.ESC_KEY = 0; + v2 = 0; + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + setvideomode(); + settextcolor(4); + + _vm->_eventsManager.videkey(); + settextposition(2, 4); + if (mode == 1) + outtext(&MenuText[10]); + if (mode == 2) + outtext(&MenuText[0xDE]); + if (mode == 3) + outtext(&MenuText[0x1B2]); + + settextcolor(1); + if (mode == 3) { + settextposition(10, 8); + outtext(&MenuText[0x286]); + } + settextposition(12, 28); + outtext(&MenuText[0x35A]); + settextposition(14, 35); + + v3 = &s[0]; + memset(s, 0, 8u); + TXT4(280, 224, 8); + + strcpy(s, Sup_string); + + if (mode == 1) { + s2 = "HOPKINS"; + v4 = 8; + v5 = 1; + do { + if (!v4) + break; + v5 = *v3++ == *s2++; + --v4; + } while (v5); + if (v5) + v2 = 1; + } + if (mode == 2) { + v6 = &s[0]; + s2 = "328MHZA"; + v7 = 8; + v8 = 1; + do { + if (!v7) + break; + v8 = *v6++ == *s2++; + --v7; + } while (v8); + if (v8) + v2 = 1; + } + if (mode == 3) { + v9 = &s[0]; + s2 = "ALLFREE"; + v10 = 8; + v11 = 1; + do { + if (!v10) + break; + v11 = *v9++ == *s2++; + --v10; + } while (v11); + if (v11) + v2 = 1; + } + if (v2) { + while (!_vm->shouldQuit()) { + _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + if (mode == 1) + outtext(&MenuText[10]); + if (mode == 2) + outtext(&MenuText[0xDE]); + if (mode == 3) + outtext(&MenuText[0x1B2]); + settextcolor(15); + settextposition(8, 25); + settextcolor(15); + outtext2(&MenuText[0x502]); + settextposition(20, 25); + outtext2(&MenuText[0x5D6]); + if (mode == 1) { + settextposition(10, 25); + outtext2(&MenuText[0x6AA]); + settextposition(12, 25); + outtext2(&MenuText[0x77E]); + settextposition(14, 25); + outtext2(&MenuText[0x852]); + settextposition(16, 25); + outtext2(&MenuText[0x926]); + } + if (mode == 2) { + _vm->_eventsManager.videkey(); + settextposition(10, 25); + outtext2(&MenuText[0x95A]); + settextposition(12, 25); + outtext2(&MenuText[0xACE]); + settextposition(14, 25); + outtext2(&MenuText[0xBA2]); + settextposition(16, 25); + outtext2(&MenuText[0xC76]); + settextposition(18, 25); + outtext2(&MenuText[0xD4A]); + } + + do { + v12 = _vm->_eventsManager.keywin(); + if (_vm->shouldQuit()) + return; + + v2 = 0; + if ((uint16)(v12 - 48) <= 8u) + v2 = 1; + } while (v2 != 1); + + if (v12 == 48) + break; + if (v12 == 49) { + GAMES(); + } else if (mode == 1) { + _vm->_eventsManager.videkey(); + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext(&MenuText[10]); + settextcolor(15); + if (v12 == 50) + LIT_TEXTE(1); + if (v12 == 51) + LIT_TEXTE(2); + if (v12 == 52) + LIT_TEXTE(3); + if (v12 == 53) + LIT_TEXTE(4); + } else if (mode == 2) { + clearscreen(); + settextcolor(4); + settextposition(2, 4); + outtext(&MenuText[0xDE]); + settextcolor(15); + if (v12 == 50) + LIT_TEXTE(6); + if (v12 == 51) + LIT_TEXTE(7); + if (v12 == 52) + LIT_TEXTE(8); + if (v12 == 53) + LIT_TEXTE(9); + if (v12 == 54) { + LIT_TEXTE(10); + _vm->_globals.SAUVEGARDE->data[svField270] = 4; + } + } + } + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + } else { + settextcolor(4); + settextposition(16, 25); + outtext(&MenuText[0x42E]); + _vm->_eventsManager.VBL(); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + RESTORE_POLICE(); + _vm->_eventsManager.MOUSE_OFF(); + } + if (mode == 1) + _vm->_globals.SORTIE = 13; + if ((uint16)(mode - 2) <= 1u) + _vm->_globals.SORTIE = 14; + + _vm->_graphicsManager.RESET_SEGMENT_VESA(); +} + +void ComputerManager::Charge_Menu() { + +} + +void ComputerManager::TXT4(int xp, int yp, int a3) { + int v3; + bool v4, v12; + char v5; + int v6; + char v7; + int v8; + byte v9; + int textIndex; + char newChar; + Common::String charString; + + v3 = xp; + textIndex = 0; + v4 = v12 = _vm->_eventsManager.souris_flag; + _vm->_eventsManager.souris_flag = false; + + _vm->_fontManager.TEXT_NOW(xp, yp, "_", -4); + do { + v5 = _vm->_eventsManager.keywin(); + if (_vm->shouldQuit()) + return; + + v6 = v5; + v7 = 42; + if (v5 == 45) + v7 = 45; + if (v5 == 48) + v7 = 48; + if (v5 == 49) + v7 = 49; + if (v5 == 50) + v7 = 50; + if (v5 == 51) + v7 = 51; + if (v5 == 52) + v7 = 52; + if (v5 == 53) + v7 = 53; + if (v5 == 54) + v7 = 54; + if (v5 == 55) + v7 = 55; + if (v5 == 56) + v7 = 56; + if (v5 == 57) + v7 = 57; + if (v5 == 65 || v5 == 97) + v7 = 65; + if (v5 == 66 || v5 == 98) + v7 = 66; + if (v5 == 67 || v5 == 99) + v7 = 67; + if (v5 == 68 || v5 == 100) + v7 = 68; + if (v5 == 69 || v5 == 101) + v7 = 69; + if (v5 == 70 || v5 == 102) + v7 = 70; + if (v5 == 71 || v5 == 103) + v7 = 71; + if (v5 == 72 || v5 == 104) + v7 = 72; + if (v5 == 73 || v5 == 105) + v7 = 73; + if (v5 == 74 || v5 == 106) + v7 = 74; + if (v5 == 75 || v5 == 107) + v7 = 75; + if (v5 == 76 || v5 == 108) + v7 = 76; + if (v5 == 77 || v5 == 109) + v7 = 77; + if (v5 == 78 || v5 == 110) + v7 = 78; + if (v5 == 79 || v5 == 111) + v7 = 79; + if (v5 == 80 || v5 == 112) + v7 = 80; + if (v5 == 81 || v5 == 113) + v7 = 81; + if (v5 == 82 || v5 == 114) + v7 = 82; + if (v5 == 83 || v5 == 115) + v7 = 83; + if (v5 == 84 || v5 == 116) + v7 = 84; + if (v5 == 85 || v5 == 117) + v7 = 85; + if (v5 == 86 || v5 == 118) + v7 = 86; + if (v5 == 87 || v5 == 119) + v7 = 87; + if (v5 == 88 || v5 == 120) + v7 = 88; + if (v5 == 89 || v5 == 121) + v7 = 89; + if (v5 == 90 || v5 == 122) + v7 = 90; + if (v5 == 8 && textIndex > 0) { + Sup_string[textIndex--] = 0; + v3 -= _vm->_globals.police_l; + v8 = v3 + 2 * _vm->_globals.police_l; + v9 = v7; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, 2 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, v8, yp + 12); + _vm->_fontManager.TEXT_NOW(v3, yp, "_", -4); + v7 = v9; + } + if (v7 != '*') { + newChar = v7; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, _vm->_globals.police_l + v3, yp + 12); + Sup_string[textIndex] = newChar; + + charString = Common::String::format("%c_", newChar); + _vm->_fontManager.TEXT_NOW(v3, yp, charString, -4); + ++textIndex; + v3 += _vm->_globals.police_l; + } + _vm->_eventsManager.VBL(); + v4 = a3; + } while (textIndex != a3 && v6 != 13); + + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, _vm->_globals.police_l, + 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, _vm->_globals.police_l + v3, yp + 12); + + _vm->_eventsManager.VBL(); + Sup_string[textIndex] = 0; + _vm->_eventsManager.souris_flag = v12; +} + +void ComputerManager::outtext(const Common::String &msg) { + _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, TEXT_COL); +} + +void ComputerManager::outtext2(const Common::String &msg) { + _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, TEXT_COL); +} + +void ComputerManager::RESTORE_POLICE() { + _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); + _vm->_fileManager.CONSTRUIT_SYSTEM("FONTE3.SPR"); + _vm->_globals.police = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + + _vm->_globals.police_l = 12; + _vm->_globals.police_h = 21; + _vm->_eventsManager.souris_flag = true; +} + +void ComputerManager::LIT_TEXTE(int a1) { + uint16 v1; + int v2; + uint16 v3; + int v4; + int v5; + int v6; + int v7; + int v8; + uint16 v10; + byte *ptr; + Common::String v12; + Common::String numStr; + int num; + + _vm->_eventsManager.ESC_KEY = false; + + if (_vm->_globals.FR == 0) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPKAN.TXT"); + if (_vm->_globals.FR == 1) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPK.TXT"); + if (_vm->_globals.FR == 2) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPKES.TXT"); + + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v1 = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + v2 = 0; + v3 = 0; + if (v1 > 0u) { + do { + if (*(ptr + v3) == '%') { + numStr = Common::String::format("%c%c", *(ptr + v3 + 1), *(ptr + v3 + 2)); + num = atol(numStr.c_str()); + + if (num == a1) + v2 = 1; + } + if (v2 == 1) + break; + ++v3; + } while (v3 < v1); + } + v4 = v3; + if (v3 > v1 - 1) + error("Error with Hopkins computer file"); + + v10 = v3 + 3; + v5 = 1; + v6 = 5; + v7 = 0; + do { + v4 = *(ptr + v10); + if (v4 == 13) { +// v12[v7] = 0; +// v7 = 0; + v8 = v4; + settextposition(v6, v5); + outtext(v12); + + ++v6; + v5 = 1; + _vm->_eventsManager.VBL(); + v4 = v8; + v12 = ""; + } else if (v4 != '%') { + //v12[v7++] = v4; + v12 += v4; + ++v7; + } + ++v10; + } while (v4 != 37); + + _vm->_eventsManager.videkey(); + _vm->_eventsManager.wingetch(); + _vm->_globals.dos_free2(ptr); +} + +void ComputerManager::GAMES() { + const byte *v1; + int v2; + + v1 = _vm->_objectsManager.Sprite[0].spriteData; + v2 = _vm->_globals.vitesse; + _vm->_globals.vitesse = 1; + _vm->_eventsManager.CHANGE_MOUSE(0); + CASSESPR = g_PTRNUL; + _vm->_eventsManager.CASSE = 1; + _vm->_eventsManager.CASSE_SOURIS_ON(); + CASSETAB = g_PTRNUL; + NBBRIQUES = 0; + CASSESCORE = 0; + CASSEVIE = 5; + CASSESPEED = 1; + BALLEHORI = 0; + BALLEVERTI = 0; + NB_TABLE = 0; + _vm->_graphicsManager.min_y = 0; + _vm->_graphicsManager.max_x = 320; + _vm->_graphicsManager.max_y = 200; + _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND37.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); + _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); + _vm->_fileManager.CONSTRUIT_SYSTEM("_vm->_eventsManager.CASSE.SPR"); + CASSESPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + CHARGE_SCORE(); + MODE_VGA256(); + NEWTAB(); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + PLAY_BRIQUE(); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + CASSESPR = _vm->_globals.LIBERE_FICHIER(CASSESPR); + CASSETAB = _vm->_globals.dos_free2(CASSETAB); + _vm->_objectsManager.Sprite[0].spriteData = v1; + + _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.DEL_SAMPLE(2); + _vm->_soundManager.DEL_SAMPLE(3); + _vm->_globals.vitesse = v2; + _vm->_eventsManager.CASSE = 0; + _vm->_eventsManager.CASSE_SOURIS_OFF(); + setvideomode(); + settextcolor(15); + clearscreen(); + _vm->_graphicsManager.max_x = 680; + _vm->_graphicsManager.min_y = 0; + _vm->_graphicsManager.max_y = 460; +} + +void ComputerManager::CHARGE_SCORE() { + int v0; + int v1; + char v2; + int v3; + int v4; + char v5; + byte *ptr; + int v8; + + _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v8 = 0; + do { + v0 = 16 * v8; + v1 = 0; + do { + v2 = *(ptr + v1 + (int)(16 * v8)); + if (!v2) + v2 = 32; + *(&Score[v0] + v1++) = v2; + } while (v1 <= 4); + v3 = v0 + 6; + v4 = 0; + do { + v5 = *(ptr + v4 + v3); + if (!v5) + v5 = 48; + *(&Score[16 * v8 + 6] + v4++) = v5; + } while (v4 <= 8); + *(ptr + v3 + 9) = 0; + ++v8; + } while (v8 <= 5); + + _vm->_globals.dos_free2(ptr); + CASSE_HISCORE = atol((const char *)&Score[86]); +} + +void ComputerManager::MODE_VGA256() { + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.SCANLINE(0x140u); + _vm->_fileManager.DMESS(); +} + +void ComputerManager::NEWTAB() { + Common::String file; + Common::File f; + + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.SPRITE_OFF(1); + ++CASSEVIE; + if (CASSEVIE > 11) + CASSEVIE = 11; + _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); + AFF_VIE(); + if (g_PTRNUL != CASSETAB) + CASSETAB = _vm->_globals.dos_free2(CASSETAB); + + ++NB_TABLE; + while (!_vm->shouldQuit()) { + file = Common::String::format("TAB%d.TAB", NB_TABLE); + + _vm->_fileManager.CONSTRUIT_SYSTEM(file); + if (f.open(_vm->_globals.NFICHIER)) + break; + + NB_TABLE = 1; + } + f.close(); + + CASSETAB = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + AFF_BRIQUES(); + _vm->_objectsManager.SPRITE(CASSESPR, 150, 192, 0, 13, 0, 0, 0, 0); + _vm->_objectsManager.SPRITE(CASSESPR, 164, 187, 1, 14, 0, 0, 0, 0); + BALLE = Common::Point(164, 187); + RAQX = 150; + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.SPRITE_ON(1); + _vm->_eventsManager.MOUSE_ON1(); + FMOUSE = true; + _vm->_soundManager.PLAY_SAMPLE(3, 5); +} + +void ComputerManager::AFF_BRIQUES() { + int v0; + int v1; + int v2; + uint16 v3; + byte *v4; + + NBBRIQUES = 0; + CASSESPEED = 1; + v4 = CASSETAB; + v3 = 0; + do { + v0 = *((uint16 *)v4 + v3); + v1 = *((uint16 *)v4 + v3 + 1); + v2 = *((uint16 *)v4 + v3 + 4); + if (v0 != -1) { + if (v2 <= 6) + ++NBBRIQUES; + if (v2 == 3) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 17); + if (v2 == 6) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 18); + if (v2 == 5) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 19); + if (v2 == 4) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 20); + if (v2 == 1) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 21); + if (v2 == 2) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 22); + if (v2 == 31) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 23); + } + v3 += 6; + } while (v0 != -1); + IMPRIMESCORE(); +} + +void ComputerManager::AFF_VIE() { + int v0; + int v1; + int v2; + int v3; + int v4; + + v0 = CASSEVIE - 1; + v1 = 10; + v2 = 0; + do { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, 10, 15); + v1 += 7; + ++v2; + } while (v2 <= 11); + if (v0) { + v3 = 10; + v4 = 0; + if (v0 > 0) { + do { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v3, 10, 14); + v3 += 7; + ++v4; + } while (v4 < v0); + } + } +} + +void ComputerManager::PLAY_BRIQUE() { + int v1 = 0; + int v; + + while (!_vm->shouldQuit()) { + while (!_vm->shouldQuit()) { + _vm->_eventsManager.MOUSE_OFF(); + BALLE = Common::Point(RAQX + 14, 187); + _vm->_objectsManager.SETYSPR(1, 187); + _vm->_objectsManager.SETXSPR(1, BALLE.x); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_eventsManager.VBL(); + _vm->_graphicsManager.FADE_IN_CASSE(); + do { + RAQX = _vm->_eventsManager.souris_x; + if (_vm->_eventsManager.souris_x <= 4) + RAQX = 5; + if (RAQX > 282) + RAQX = 282; + _vm->_objectsManager.SETXSPR(0, RAQX); + _vm->_objectsManager.SETXSPR(1, RAQX + 14); + _vm->_objectsManager.SETYSPR(1, 187); + _vm->_eventsManager.VBL(); + } while (_vm->_eventsManager.BMOUSE() != 1); + + CASSESPEED = 1; + BALLE = Common::Point(RAQX + 14, 187); + BALLEHORI = RAQX > 135; + BALLEVERTI = 0; + + do { + RAQX = _vm->_eventsManager.souris_x; + if ((int)_vm->_eventsManager.souris_x <= 4) + RAQX = 5; + if (RAQX > 282) + RAQX = 282; + _vm->_objectsManager.SETXSPR(0, RAQX); + v1 = DEP_BALLE(); + _vm->_eventsManager.VBL(); + } while (!_vm->shouldQuit() && !v1); + if (v1 != 1) + break; + _vm->_graphicsManager.FADE_OUT_CASSE(); + --CASSEVIE; + if (CASSEVIE) { + AFF_VIE(); + if (CASSEVIE) + continue; + } + _vm->_eventsManager.MOUSE_ON1(); + _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.SPRITE_OFF(1); + if (CASSESCORE > CASSE_HISCORE) + NAME_SCORE(); + v = HIGHT_SCORE(); + if (v != 1) + break; + + NBBRIQUES = 0; + CASSESCORE = 0; + CASSEVIE = 4; + CASSESPEED = 1; + BALLEHORI = 0; + BALLEVERTI = 0; + NB_TABLE = 0; + CHARGE_SCORE(); + NEWTAB(); + } + if (v1 != 2) + return; + _vm->_graphicsManager.FADE_OUT_CASSE(); + NEWTAB(); + } +} + +int ComputerManager::HIGHT_SCORE() { + int v0; + int v1; + int v2; + int v3; + int v4; + int v6; + byte *ptr; + + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + CHARGE_SCORE(); + _vm->_graphicsManager.LOAD_IMAGEVGA("HISCORE.PCX"); + _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + v6 = 0; + do { + v0 = 19 * v6; + v0 = v0 + 46; + v1 = 0; + do { + PRINT_HSCORE(ptr, 9 * v1 + 69, v0, *(&Score[16 * v6] + v1)); + ++v1; + } while (v1 <= 5); + v2 = 0; + do { + PRINT_HSCORE(ptr, 9 * v2 + 199, v0, *(&Score[16 * v6 + 6] + v2)); + ++v2; + } while (v2 <= 8); + ++v6; + } while (v6 <= 5); + _vm->_graphicsManager.FADE_IN_CASSE(); + _vm->_graphicsManager.RESET_SEGMENT_VESA(); + v3 = 0; + do { + v4 = _vm->_eventsManager.souris_x + 13; + v0 = _vm->_eventsManager.souris_y; + if (_vm->_eventsManager.BMOUSE() == 1 && (uint16)(v4 - 15) <= 0x21u && (uint16)(v0 - 176) <= 0xDu) + v3 = 1; + if (_vm->_eventsManager.BMOUSE() == 1 + && (uint16)(v4 - 274) <= 0x20u + && (uint16)(v0 - 176) <= 0xDu) + v3 = 2; + _vm->_eventsManager.VBL(); + } while (!v3); + _vm->_eventsManager.MOUSE_OFF(); + _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_globals.LIBERE_FICHIER(ptr); + return v3; +} + +void ComputerManager::NAME_SCORE() { + int v0; + int v1; + int v2; + int v3; + int i; + byte *ptr; + char s[16]; + + _vm->_graphicsManager.LOAD_IMAGEVGA("NAME.PCX"); + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); + ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_graphicsManager.FADE_IN_CASSE(); + v0 = 0; + do { + PRINT_HSCORE(ptr, 9 * v0 + 140, 78, 1); + + v1 = toupper(_vm->_eventsManager.keywin()); + if (v1 <= 47) + v1 = 32; + if (v1 > 90) + v1 = 32; + if ((uint16)(v1 - 58) <= 6u) + v1 = 32; + Score[v0 + 80] = v1; + PRINT_HSCORE(ptr, 9 * v0 + 140, 78, v1); + + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + ++v0; + } while (v0 <= 4); + memset(&Score[86], 32, 9u); + sprintf(s, "%d", CASSESCORE); + v2 = 0; + do + ++v2; + while (s[v2]); + v3 = 8; + for (i = v2; ; Score[v3-- + 86] = s[i]) { + --i; + if (i <= -1) + break; + } + _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_globals.dos_free2(ptr); + SAUVE_SCORE(); +} + +void ComputerManager::IMPRIMESCORE() { + __int16 v0; + __int16 v1; + __int16 i; + char s[40]; + + sprintf(s, "%d", CASSESCORE); + v0 = 0; + do + ++v0; + while (s[v0]); + v1 = 0; + for (i = v0; ; IMPSCORE(v1++, (byte)s[i])) { + --i; + if (i <= -1) + break; + } +} + +void ComputerManager::IMPSCORE(int a1, int a2) { + signed __int16 v2; + __int16 v3; + + v2 = 203; + v3 = 3; + if (a1 == 1) + v2 = 193; + if (a1 == 2) + v2 = 183; + if (a1 == 3) + v2 = 170; + if (a1 == 4) + v2 = 160; + if (a1 == 5) + v2 = 150; + if (a1 == 9) + v2 = 137; + if (a2 == 49) + v3 = 4; + if (a2 == 50) + v3 = 5; + if (a2 == 51) + v3 = 6; + if (a2 == 52) + v3 = 7; + if (a2 == 53) + v3 = 8; + if (a2 == 54) + v3 = 9; + if (a2 == 55) + v3 = 10; + if (a2 == 56) + v3 = 11; + if (a2 == 57) + v3 = 12; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v2 - 3, 11, v3); +} + +void ComputerManager::SAUVE_SCORE() { + int v0; + int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + char v8; + int v9; + int v10; + char v11; + int v13; + int v14; + byte *ptr; + int v16[6]; + int v17[6]; + + v0 = 0; + do { + v1 = atol((const char *)(16 * v0 + Score + 6)); + v17[v0] = v1; + if (!v1) + v17[v0] = 5; + ++v0; + } while (v0 <= 5); + v13 = 0; + do { + v2 = 0; + v3 = 0; + do { + v4 = v17[v2]; + if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4 + && v17[4] <= v4 && v17[5] <= v4) + v3 = 1; + if (v3 == 1) { + v16[v13] = v2; + v17[v2] = 0; + } else { + ++v2; + } + } while (v3 != 1); + ++v13; + } while (v13 <= 5); + + ptr = _vm->_globals.dos_malloc2(0x64u); + memset(ptr, 0, 0x63u); + v5 = 0; + do { + v6 = 16 * v5; + v14 = v16[v5]; + v7 = 0; + do { + v8 = *(&Score[16 * v14] + v7); + if (!v8) + v8 = 32; + *(ptr + (16 * v5) + v7++) = v8; + } while (v7 <= 4); + + *(ptr + v6 + 5) = 0; + v9 = v6 + 6; + v10 = 0; + do { + v11 = *(&Score[16 * v14 + 6] + v10); + if (!v11) + v11 = 48; + *(ptr + v9 + v10++) = v11; + } while (v10 <= 8); + *(ptr + v9 + 9) = 0; + ++v5; + } while (v5 <= 5); + + _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u); + _vm->_globals.dos_free2(ptr); +} + +void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { + char v4; + int v5; + + v4 = a4; + v5 = 36; + if (!a4) + v4 = 32; + if (v4 == 100) + v5 = 0; + if ((byte)(v4 - 48) <= 9u) + v5 = (byte)v4 - 48; + if ((byte)(v4 - 65) <= 0x19u) + v5 = (byte)v4 - 55; + if (v4 == 32) + v5 = 36; + if (v4 == 1) + v5 = 37; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, a2, a3, v5); +} + +int ComputerManager::DEP_BALLE() { + int v0; + __int16 v1; + int v2; + signed __int16 v4; + + v4 = 0; + //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; + // TODO: Figure out random number + v0 = _vm->getRandomNumber(6); + if (CASSESPEED == 1) { + CASSEP1 = 1; + CASSEP2 = 1; + } + if (CASSESPEED == 2) { + CASSEP1 = 1; + CASSEP2 = 2; + } + if (CASSESPEED == 3) { + CASSEP1 = 2; + CASSEP2 = 2; + } + if (CASSESPEED == 4) { + CASSEP1 = 3; + CASSEP2 = 2; + } + v1 = CASSEP1; + if (CASSDER == CASSEP1) + v1 = CASSEP2; + if (BALLEVERTI == 1) + BALLE.y += v1; + if (!BALLEVERTI) + BALLE.y -= v1; + if (BALLEHORI == 1) + BALLE.x += v1; + if (!BALLEHORI) + BALLE.x -= v1; + CASSDER = v1; + if (BALLE.x <= 6) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + BALLE.x = v0 + 6; + BALLEHORI = BALLEHORI != 1; + } + if (BALLE.x > 307) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + BALLE.x = 307 - v0; + BALLEHORI = BALLEHORI != 1; + } + if (BALLE.y <= 6) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + BALLE.y = v0 + 7; + BALLEVERTI = BALLEVERTI != 1; + } + if ((uint16)(BALLE.y - 186) <= 8u) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + if (BALLE.x > RAQX - 2) { + v2 = BALLE.x + 6; + if (v2 < RAQX + 36) { + BALLEVERTI = 0; + if (v2 <= RAQX + 15) { + BALLEHORI = 0; + if (BALLE.x >= RAQX && v2 <= RAQX + 5) + BALLE.x -= 4; + if (BALLE.x >= RAQX + 5 && BALLE.x + 6 <= RAQX + 10) + BALLE.x -= 2; + } + if (BALLE.x >= RAQX + 19 && BALLE.x + 6 <= RAQX + 36) { + BALLEHORI = 1; + if (BALLE.x >= RAQX + 29) + BALLE.x += 4; + if (BALLE.x >= RAQX + 24 && BALLE.x + 6 <= RAQX + 29) + BALLE.x += 2; + } + } + } + } + if (BALLE.y > 194) + v4 = 1; + VERIFBRIQUES(); + _vm->_objectsManager.SETXSPR(1, BALLE.x); + _vm->_objectsManager.SETYSPR(1, BALLE.y); + if (!NBBRIQUES) + v4 = 2; + return v4; +} + + + +void ComputerManager::VERIFBRIQUES() { + __int16 v0; + __int16 v1; + __int16 v2; + __int16 v3; + signed __int16 v4; + __int16 v5; + __int16 v6; + signed __int16 v7; + uint16 v8; + byte *v9; + __int16 v10; + __int16 v11; + __int16 v12; + __int16 v13; + + v7 = 0; + //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; + // TODO: Check if correct + v6 = _vm->getRandomNumber(6) + 1; + v0 = BALLE.x; + v13 = BALLE.y; + v5 = BALLE.x + 6; + v12 = BALLE.y + 6; + v9 = CASSETAB; + v8 = 0; + do { + v1 = *((uint16 *)v9 + v8); + v11 = *((uint16 *)v9 + v8 + 1); + v2 = *((uint16 *)v9 + v8 + 2); + v10 = *((uint16 *)v9 + v8 + 3); + v3 = *((uint16 *)v9 + v8 + 4); + if (*((uint16 *)v9 + v8 + 5) != 1 || v1 == -1) + goto LABEL_60; + v4 = 0; + if (v13 <= v10 && v12 >= v10) { + if (v0 >= v1 && v5 <= v2) { + v4 = 1; + BALLEVERTI = 1; + } + if (v5 >= v1) { + if (v0 <= v1) { + ++v4; + BALLEVERTI = 1; + BALLEHORI = 0; + if (v3 == 31) + BALLE.x -= v6; + } + } + if (v0 <= v2) { + if (v5 >= v2) { + ++v4; + BALLEVERTI = 1; + BALLEHORI = 1; + if (v3 == 31) + BALLE.x += v6; + } + } + } + if (v12 >= v11) { + if (v13 > v11) + goto LABEL_31; + if (v0 >= v1 && v5 <= v2) { + ++v4; + BALLEVERTI = 0; + } + if (v5 >= v1) { + if (v0 <= v1) { + ++v4; + BALLEVERTI = 0; + BALLEHORI = 0; + if (v3 == 31) + BALLE.x -= 2; + } + } + if (v0 <= v2) { + if (v5 >= v2) { + ++v4; + BALLEVERTI = 0; + BALLEHORI = 1; + if (v3 == 31) + BALLE.x += v6; + } + } + } + if (v13 >= v11) { +LABEL_31: + if (v12 <= v10) { + if (v5 >= v1) { + if (v0 <= v1) { + ++v4; + BALLEHORI = 0; + if (v3 == 31) + BALLE.x -= v6; + } + } + if (v0 <= v2) { + if (v5 >= v2) { + ++v4; + BALLEHORI = 1; + if (v3 == 31) + BALLE.x += v6; + } + } + } + } + if (v4) { + if (v3 == 31) { + _vm->_soundManager.PLAY_SAMPLE(2, 6); + } else { + _vm->_soundManager.PLAY_SAMPLE(1, 5); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, v11, 16); + if (v3 == 1) + CASSESCORE += 10; + if (v3 == 2) + CASSESCORE += 5; + if (v3 == 3) { + CASSESCORE += 50; + if (CASSESPEED <= 1) + CASSESPEED = 2; + if (NBBRIQUES <= 19) + CASSESPEED = 3; + } + if (v3 == 4) + CASSESCORE += 20; + if (v3 == 5) { + CASSESCORE += 30; + if (CASSESPEED <= 1) + CASSESPEED = 2; + } + if (v3 == 6) + CASSESCORE += 40; + IMPRIMESCORE(); + --NBBRIQUES; + *((uint16 *)v9 + v8 + 5) = 0; + v7 = 1; + } + } +LABEL_60: + if (v7 == 1) + v1 = -1; + v8 += 6; + } while (v1 != -1); +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h new file mode 100644 index 0000000000..612178dc4a --- /dev/null +++ b/engines/hopkins/computer.h @@ -0,0 +1,137 @@ +/* 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_COMPUTER_H +#define HOPKINS_COMPUTER_H + +#include "common/scummsys.h" +#include "common/rect.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +class ComputerManager { +private: + HopkinsEngine *_vm; + char MenuText[10600]; + char Sup_string[200]; + byte Score[96]; + int TEXT_COL; + Common::Point _textPosition; + Common::Point BALLE; + byte *CASSESPR; + byte *CASSETAB; + bool FMOUSE; + int NBBRIQUES; + int CASSESCORE; + int CASSEVIE; + int CASSESPEED; + int BALLEHORI; + int BALLEVERTI; + int NB_TABLE; + int RAQX; + int CASSE_HISCORE; + int CASSEP1; + int CASSEP2; + int CASSDER; + + /** + * Load the menu text + */ + void Charge_Menu(); + + void TXT4(int xp, int yp, int a3); + + /** + * Restores the scene for the FBI headquarters room + */ + void RESTORE_POLICE(); + + /** + * Sets up textual entry mode. Used by the code for Hopkins computer. + */ + void setvideomode(); + + /** + * Sets up textual entry mode. Used by the code for Hopkins computer. + */ + void TEXT_MODE(); + + /** + * Clear the screen + */ + void clearscreen(); + + /** + * Sets the text mode color + */ + void settextcolor(int col); + + /** + * Sets the text position + * @param xp X position + * @param yp Y position + */ + void settextposition(int xp, int yp); + + /** + * Outputs a text string + */ + void outtext(const Common::String &msg); + + /** + * Outputs a text string + */ + void outtext2(const Common::String &msg); + + void GAMES(); + void LIT_TEXTE(int a1); + void CHARGE_SCORE(); + void MODE_VGA256(); + void NEWTAB(); + void AFF_BRIQUES(); + void AFF_VIE(); + void PLAY_BRIQUE(); + int HIGHT_SCORE(); + void NAME_SCORE(); + void IMPSCORE(int a1, int a2); + void SAUVE_SCORE(); + void PRINT_HSCORE(byte *objectData, int a2, int a3, int a4); + void IMPRIMESCORE(); + int DEP_BALLE(); + void VERIFBRIQUES(); +public: + ComputerManager(); + void setParent(HopkinsEngine *vm); + + /** + * Show Hopkin's computer + * @param mode Display mode + */ + void COMPUT_HOPKINS(int mode); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_COMPUTER_H */ diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 81ca05b236..d8c55124a3 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -133,6 +133,10 @@ void EventsManager::MOUSE_ON() { CursorMan.showMouse(true); } +void EventsManager::MOUSE_ON1() { + MOUSE_ON(); +} + // Change Mouse Cursor void EventsManager::CHANGE_MOUSE(int id) { int cursorId = id; @@ -239,6 +243,27 @@ void EventsManager::handleKey(Common::Event &event) { } +int EventsManager::keywin() { + Common::Event event; + + while (!_vm->shouldQuit()) { + _vm->_soundManager.checkSounds(); + checkForNextFrameCounter(); + + // Handle pending events looking for keypress events + while (g_system->getEventManager()->pollEvent(event)) { + if (event.type == Common::EVENT_KEYDOWN) + return event.kbd.ascii; + } + + // Slight delay been checks to avoid maxing CPU usage + g_system->delayMillis(10); + } + + // Game is quitting + return -1; +} + void EventsManager::VBL() { int v1; int v2; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 158e08c8de..25bd60b510 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -79,12 +79,39 @@ public: int YMOUSE(); int BMOUSE(); void MOUSE_ON(); + void MOUSE_ON1(); void MOUSE_OFF(); void CHANGE_MOUSE(int id); void CONTROLE_MES(); void delay(int delay); void VBL(); + + /** + * Waits for a keypress, ignoring mouse events + * @return Keypress, or -1 if game quit was requested + */ + int keywin(); + + /** + * Unused by engine + */ + void videkey() { } + + /** + * Unused by engine + */ + void CASSE_SOURIS_ON() { } + + /** + * Unused by engine + */ + void CASSE_SOURIS_OFF() { } + + void wingetch() { + // TODO + warning("TODO: wingetch"); + } }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 651d0d40f5..2b38bdb900 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -481,17 +481,79 @@ LABEL_57: } } -void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int colour) { +void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int col) { + const char *srcP; + char currChar; + int charIndex; + + srcP = message.c_str(); + for (;;) { + currChar = *srcP++; + if (!currChar) + break; + if (currChar >= 32) { + charIndex = currChar - 32; + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + xp, yp, currChar - 32, col); + xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, charIndex); + } + } + _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp, yp + 12); +} + + +void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int col) { for (uint idx = 0; idx < message.size(); ++idx) { char currentChar = message[idx]; if (currentChar > 31) { int characterIndex = currentChar - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, - xp, yp, characterIndex, colour); + xp, yp, characterIndex, col); xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, characterIndex); } } } +void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col) { + const char *srcP; + int v5; + int v6; + byte v7; + char v8; + int v9; + + srcP = msg.c_str(); + v9 = xp; + v8 = col; + do { + v7 = *srcP++; + if (v7 == '&') { + v8 = 2; + v7 = *srcP++; + } + if (v7 == '$') { + v8 = 4; + v7 = *srcP++; + } + if (!v7) + break; + if (v7 >= 32) { + v5 = v7 - 32; + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, v9, yp, v7 - 32, v8); + v9 += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); + v6 = _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); + if (_vm->_eventsManager.ESC_KEY) { + _vm->_globals.iRegul = 1; + _vm->_eventsManager.VBL(); + } else { + _vm->_globals.iRegul = 4; + _vm->_eventsManager.VBL(); + _vm->_globals.iRegul = 1; + } + } + } while (v7); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 90201902a6..a2ae88a028 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -80,7 +80,10 @@ public: void OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4); void DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10); void BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp); - void TEXT_NOW1(int xp, int yp, const Common::String &message, int colour); + + void TEXT_NOW(int xp, int yp, const Common::String &message, int col); + void TEXT_NOW1(int xp, int yp, const Common::String &message, int col); + void TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col); }; } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8af5792389..10d9e996da 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -181,6 +181,29 @@ void GraphicsManager::LOAD_IMAGE(const Common::String &file) { INIT_TABLE(165, 170, Palette); } + +void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { + SCANLINE(SCREEN_WIDTH); + DD_Lock(); + Cls_Video(); + DD_Unlock(); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + A_PCX320(VESA_SCREEN, _vm->_globals.NFICHIER, Palette); + memcpy(VESA_BUFFER, VESA_SCREEN, 0xFA00u); + _vm->_eventsManager.souris_max(); + SCANLINE(320); + max_x = 320; + + DD_Lock(); + if (Winbpp == 1) + CopyAsm(VESA_BUFFER); + if (Winbpp == 2) + CopyAsm16(VESA_BUFFER); + DD_Unlock(); + + FADE_IN_CASSE(); +} + // Load Screen void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { bool flag; @@ -365,6 +388,88 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by f.close(); } +void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *palette) { + size_t filesize; + int v4; + size_t v5; + int v6; + size_t v7; + int v8; + byte v9; + int v10; + int v11; + char v12; + int v15; + int v16; + int32 v17; + byte *ptr; + Common::File f; + + if (!f.open(file)) + error("File not found - %s", file.c_str()); + + filesize = f.size(); + + f.read(surface, 0x80u); + v4 = filesize - 896; + ptr = _vm->_globals.dos_malloc2(0xFE00u); + if (v4 >= 0xFA00) { + v15 = v4 / 0xFA00 + 1; + v17 = 64000 * (v4 / 0xFA00) - v4; + if (((uint32)v17 & 0x80000000u) != 0) + v17 = -v17; + f.read(ptr, 0xFA00u); + v5 = 64000; + } else { + v15 = 1; + v17 = v4; + f.read(ptr, v4); + v5 = v4; + } + v16 = v15 - 1; + v6 = 0; + v7 = 0; + do { + if (v7 == v5) { + v7 = 0; + --v16; + v5 = 64000; + if (!v16) + v5 = v17; + v8 = v6; + f.read(ptr, v5); + v6 = v8; + } + v9 = *(ptr + v7++); + if (v9 > 0xC0u) { + v10 = v9 - 192; + if (v7 == v5) { + v7 = 0; + --v16; + v5 = 64000; + if (v16 == 1) + v5 = v17; + v11 = v6; + f.read(ptr, v5); + v6 = v11; + } + v12 = *(ptr + v7++); + do { + *(surface + v6++) = v12; + --v10; + } while (v10); + } else { + *(surface + v6++) = v9; + } + } while (v6 <= 0xF9FF); + + f.seek(filesize - 768); + f.read(palette, 0x300u); + f.close(); + + _vm->_globals.dos_free2(ptr); +} + // Clear Palette void GraphicsManager::Cls_Pal() { Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); @@ -855,9 +960,9 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa } void GraphicsManager::SETCOLOR(int palIndex, int r, int g, int b) { - _vm->_graphicsManager.Palette[palIndex * 3] = 255 * r / 100; - _vm->_graphicsManager.Palette[palIndex * 3 + 1] = 255 * g / 100; - _vm->_graphicsManager.Palette[palIndex * 3 + 2] = 255 * b / 100; + Palette[palIndex * 3] = 255 * r / 100; + Palette[palIndex * 3 + 1] = 255 * g / 100; + Palette[palIndex * 3 + 2] = 255 * b / 100; setpal_vga256(Palette); } @@ -940,6 +1045,30 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { fade_in(Palette, FADESPD, surface); } +void GraphicsManager::FADE_IN_CASSE() { + setpal_vga256(Palette); + if (Winbpp == 2) { + DD_Lock(); + CopyAsm16(VESA_BUFFER); + DD_Unlock(); + } + DD_VBL(); +} + +void GraphicsManager::FADE_OUT_CASSE() { + byte palette[PALETTE_EXT_BLOCK_SIZE]; + + memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); + setpal_vga256(palette); + + if (Winbpp == 2) { + DD_Lock(); + CopyAsm16(VESA_BUFFER); + DD_Unlock(); + } + DD_VBL(); +} + void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { int rleValue; int destOffset; @@ -1523,6 +1652,22 @@ void GraphicsManager::Affiche_Segment_Vesa() { SDL_NBLOCS = 0; } +void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx) { + int height, width; + + width = _vm->_objectsManager.Get_Largeur(objectData, idx); + height = _vm->_objectsManager.Get_Hauteur(objectData, idx); + if (*objectData == 78) { + Affiche_Perfect(VESA_SCREEN, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + Affiche_Perfect(VESA_BUFFER, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + } else { + Sprite_Vesa(VESA_BUFFER, objectData, xp + 300, yp + 300, idx); + Sprite_Vesa(VESA_SCREEN, objectData, xp + 300, yp + 300, idx); + } + if (!_vm->_globals.NO_VISU) + Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); +} + void GraphicsManager::CopyAsm(const byte *surface) { const byte *srcP; byte srcByte; @@ -1565,6 +1710,48 @@ void GraphicsManager::CopyAsm(const byte *surface) { } while (yCtr); } +void GraphicsManager::CopyAsm16(const byte *surface) { + const byte *v1; + byte *v2; + int v3; + signed int v4; + byte *v5; + uint16 *v6; + int v; + uint16 *v8; + int v9; + byte *v10; + const byte *v11; + + assert(VideoPtr); + v1 = surface; + v2 = 30 * WinScan + (byte *)VideoPtr->pixels; + v3 = 200; + do { + v11 = v1; + v10 = v2; + v4 = 320; + v9 = v3; + v5 = PAL_PIXELS; + do { + v = 2 * *v1; + v6 = (uint16 *)(v5 + 2 * *v1); + v = *v6; + *v2 = *v6; + *(v2 + 1) = v; + v8 = (uint16 *)(WinScan + v2); + *v8 = v; + *(v8 + 1) = v; + ++v1; + v2 = (byte *)v8 - WinScan + 4; + --v4; + } while (v4); + v1 = v11 + 320; + v2 = WinScan * 2 + v10; + v3 = v9 - 1; + } while (v9 != 1); +} + void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { byte *destP; int yNext; @@ -2256,7 +2443,7 @@ void GraphicsManager::NB_SCREEN() { Trans_bloc2(VESA_BUFFER, TABLE_COUL, 307200); if (nbrligne == 1280) Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400); - _vm->_graphicsManager.DD_Lock(); + DD_Lock(); if (Winbpp == 2) { if (SDL_ECHELLE) m_scroll16A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -2269,7 +2456,7 @@ void GraphicsManager::NB_SCREEN() { else m_scroll2(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - _vm->_graphicsManager.DD_Unlock(); + DD_Unlock(); destP = VESA_SCREEN; srcP = VESA_BUFFER; @@ -2413,5 +2600,4 @@ void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, byte } while (yCtr); } - } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e29ede718e..22b8e9f290 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -116,11 +116,13 @@ public: void DD_UNLOCK() { DD_Unlock(); } void Cls_Video(); void LOAD_IMAGE(const Common::String &file); + void LOAD_IMAGEVGA(const Common::String &file); void INIT_TABLE(int minIndex, int maxIndex, byte *palette); int SCROLL_ECRAN(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void A_PCX320(byte *surface, const Common::String &file, byte *palette); void Cls_Pal(); void SCANLINE(int pitch); void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); @@ -138,6 +140,8 @@ public: void FADE_OUTW(); void FADE_OUTW_LINUX(const byte *surface); void FADE_INW_LINUX(const byte *surface); + void FADE_IN_CASSE(); + void FADE_OUT_CASSE(); void setpal_vga256(const byte *palette); void setpal_vga256_linux(const byte *palette, const byte *surface); void SETCOLOR(int palIndex, int r, int g, int b); @@ -169,7 +173,9 @@ public: void Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2); int Magic_Number(int v); void Affiche_Segment_Vesa(); + void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); + void CopyAsm16(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int Reel_Zoom(int v, int percentage); int Reel_Reduc(int v, int percentage); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1ea8f1f5db..d19d074634 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -41,6 +41,7 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe g_vm = this; _debugger.setParent(this); _animationManager.setParent(this); + _computerManager.setParent(this); _dialogsManager.setParent(this); _eventsManager.setParent(this); _fileManager.setParent(this); @@ -443,7 +444,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)_globals.SAUVEGARDE + 5) = 113; - _menuManager.COMPUT_HOPKINS(1); + _computerManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -460,7 +461,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)_globals.SAUVEGARDE + 5) = 114; - _menuManager.COMPUT_HOPKINS(2); + _computerManager.COMPUT_HOPKINS(2); goto LABEL_128; } if (_globals.SORTIE == 115) { @@ -469,7 +470,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)_globals.SAUVEGARDE + 5) = 115; - _menuManager.COMPUT_HOPKINS(3); + _computerManager.COMPUT_HOPKINS(3); LABEL_128: _graphicsManager.DD_Lock(); @@ -1271,7 +1272,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)_globals.SAUVEGARDE + 5) = 113; - _menuManager.COMPUT_HOPKINS(1); + _computerManager.COMPUT_HOPKINS(1); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1287,7 +1288,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)_globals.SAUVEGARDE + 5) = 114; - _menuManager.COMPUT_HOPKINS(2); + _computerManager.COMPUT_HOPKINS(2); goto LABEL_243; } switch (_globals.SORTIE) { @@ -1297,7 +1298,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)_globals.SAUVEGARDE + 5) = 115; - _menuManager.COMPUT_HOPKINS(3); + _computerManager.COMPUT_HOPKINS(3); LABEL_243: _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 6b210fffed..73e57d336b 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -32,6 +32,7 @@ #include "engines/engine.h" #include "graphics/surface.h" #include "hopkins/anim.h" +#include "hopkins/computer.h" #include "hopkins/debugger.h" #include "hopkins/dialogs.h" #include "hopkins/events.h" @@ -115,6 +116,7 @@ protected: public: Debugger _debugger; AnimationManager _animationManager; + ComputerManager _computerManager; DialogsManager _dialogsManager; EventsManager _eventsManager; FontManager _fontManager; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 56b73c1fa1..b8ec31d67c 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -233,202 +233,6 @@ int MenuManager::MENU() { return result; } -void MenuManager::COMPUT_HOPKINS(int idx) { - // This is a text mode display? - warning("TODO: COMPUT_HOPKINS"); - /* - int v2; - char *v3; - int v4; - char v5; - char *v6; - int v7; - char v8; - char *v9; - int v10; - char v11; - int v12; - Common::String s; - Common::String s2; - - _vm->_eventsManager.ESC_KEY = 0; - v2 = 0; - _vm->_graphicsManager.RESET_SEGMENT_VESA(); - setvideomode(); - settextcolor(4); - _vm->_graphicsManager.videkey(); - settextposition(2, 4); - if (idx == 1) - outtext((const char *)&MenuText[10]); - if (idx == 2) - outtext((const char *)&MenuText[0xDE]); - if (idx == 3) - outtext((const char *)&MenuText[0x1B2]); - settextcolor(1); - if (idx == 3) { - settextposition(10, 8); - outtext((const char *)&MenuText[0x286]); - } - settextposition(12, 28); - outtext((const char *)&MenuText[0x35A]); - settextposition(14, 35); - v3 = &s; - memset(&s, 0, 8u); - TXT4(280, 224, 8); - s = Sup_string; - if (idx == 1) { - s2 = "HOPKINS"; - v4 = 8; - v5 = 1; - do { - if (!v4) - break; - v5 = *v3++ == *s2++; - --v4; - } while (v5); - if (v5) - v2 = 1; - } - if (idx == 2) { - v6 = &s; - s2 = "328MHZA"; - v7 = 8; - v8 = 1; - do { - if (!v7) - break; - v8 = *v6++ == *s2++; - --v7; - } while (v8); - if (v8) - v2 = 1; - } - if (idx == 3) { - v9 = &s; - s2 = "ALLFREE"; - v10 = 8; - v11 = 1; - do { - if (!v10) - break; - v11 = *v9++ == *s2++; - --v10; - } while (v11); - if (v11) - v2 = 1; - } - if (v2) { - while (1) { - ESC_KEY = 0; - _vm->_graphicsManager.videkey(); - clearscreen(); - settextcolor(4); - settextposition(2, 4); - if (idx == 1) - outtext((const char *)&MenuText[10]); - if (idx == 2) - outtext((const char *)&MenuText[0xDE]); - if (idx == 3) - outtext((const char *)&MenuText[0x1B2]); - settextcolor(15); - settextposition(8, 25); - settextcolor(15); - outtext2((const char *)&MenuText[0x502]); - settextposition(20, 25); - outtext2((const char *)&MenuText[0x5D6]); - if (idx == 1) { - settextposition(10, 25); - outtext2((const char *)&MenuText[0x6AA]); - settextposition(12, 25); - outtext2((const char *)&MenuText[0x77E]); - settextposition(14, 25); - outtext2((const char *)&MenuText[0x852]); - settextposition(16, 25); - outtext2((const char *)&MenuText[0x926]); - } - if (idx == 2) { - _vm->_graphicsManager.videkey(); - settextposition(10, 25); - outtext2((const char *)&MenuText[0x95A]); - settextposition(12, 25); - outtext2((const char *)&MenuText[0xACE]); - settextposition(14, 25); - outtext2((const char *)&MenuText[0xBA2]); - settextposition(16, 25); - outtext2((const char *)&MenuText[0xC76]); - settextposition(18, 25); - outtext2((const char *)&MenuText[0xD4A]); - } - do { - v12 = (byte)keywin(v2, s2); - v2 = 0; - if ((uint16)(v12 - 48) <= 8u) - v2 = 1; - } while (v2 != 1); - if (v12 == 48) - break; - if (v12 == 49) { - GAMES(s2); - } else if (idx == 1) { - _vm->_graphicsManager.videkey(); - clearscreen(); - settextcolor(4); - settextposition(2, 4); - outtext((const char *)&MenuText[10]); - settextcolor(15); - if (v12 == 50) - LIT_TEXTE(1); - if (v12 == 51) - LIT_TEXTE(2); - if (v12 == 52) - LIT_TEXTE(3); - if (v12 == 53) - LIT_TEXTE(4); - } else if (idx == 2) { - clearscreen(); - settextcolor(4); - settextposition(2, 4); - outtext((const char *)&MenuText[0xDE]); - settextcolor(15); - if (v12 == 50) - LIT_TEXTE(6); - if (v12 == 51) - LIT_TEXTE(7); - if (v12 == 52) - LIT_TEXTE(8); - if (v12 == 53) - LIT_TEXTE(9); - if (v12ii == 54) { - LIT_TEXTE(10); - _vm->_globals.SAUVEGARDE->data[svField270] = 4; - } - } - } - _vm->_graphicsManager.DD_Lock(); - Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.DD_VBL(); - RESTORE_POLICE(); - } else { - settextcolor(4); - settextposition(16, 25); - outtext((const char *)&MenuText[0x42E]); - _vm->_eventsManager.VBL(); - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); - _vm->_graphicsManager.DD_Lock(); - Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.DD_VBL(); - RESTORE_POLICE(); - _vm->_eventsManager.MOUSE_OFF(); - } - if (idx == 1) - _vm->_globals.SORTIE = 13; - if ((uint16)(idx - 2) <= 1u) - _vm->_globals.SORTIE = 14; - return _vm->_graphicsManager.RESET_SEGMENT_VESA(); - */ -} } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 58788fca46..5c174815ff 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -40,7 +40,6 @@ public: void setParent(HopkinsEngine *vm); int MENU(); - void COMPUT_HOPKINS(int a1); }; } // End of namespace Hopkins diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index 109104f229..5c1a7dd478 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -2,6 +2,7 @@ MODULE := engines/hopkins MODULE_OBJS := \ anim.o \ + computer.o \ debugger.o \ detection.o \ dialogs.o \ diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 13979c5cd8..519d43b05a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -575,6 +575,33 @@ void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { } } +void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { + if (CARD_SB && !SOUNDOFF && SOUND[wavIndex]._active) { + if (SOUND_FLAG) + DEL_NWAV(SOUND_NUM); + if (voiceMode == 5) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(1, wavIndex); + } + if (voiceMode == 6) { + if (VOICE_STAT(2) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(2, wavIndex); + } + if (voiceMode == 7) { + if (VOICE_STAT(3) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(3, wavIndex); + } + if (voiceMode == 8) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + PLAY_SAMPLE_SDL(1, wavIndex); + } + } +} + void SoundManager::PLAY_SAMPLE2(int idx) { if (CARD_SB && !SOUNDOFF && SOUND[idx]._active) { if (SOUND_FLAG) diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 36184715ba..fa0a5419a2 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -157,6 +157,7 @@ public: void MODSetVoiceVolume(); void MODSetMusicVolume(int volume); void CHARGE_SAMPLE(int wavIndex, const Common::String &file); + void PLAY_SAMPLE(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); void PLAY_WAV(int wavIndex); -- cgit v1.2.3 From 928b1ae0d02daee9362f111d51ae81f0fc3b86f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 21:13:10 +1100 Subject: HOPKINS: Bugfix for CHARGE_BANK_SPRITE1 --- engines/hopkins/anim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 5209ca39ef..0953cd9f50 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -792,7 +792,7 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam if (*(v3 + 1) == 'L' && *(v3 + 2) == 'E') _vm->_globals.Bank[idx].fileHeader = 1; if (*(v3 + 1) == 'O' && *(v3 + 2) == 'R') - _vm->_globals.Bank[184].fileHeader = 2; + _vm->_globals.Bank[idx].fileHeader = 2; if (_vm->_globals.Bank[idx].fileHeader) { _vm->_globals.Bank[idx].data = v3; -- cgit v1.2.3 From 2f116e01c76bf8c208451b670d29e6ef3f05b9a8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Nov 2012 11:57:02 +0100 Subject: HOPKINS: Fix original bug in chapter 2, when searching the box. Add a safeguard to the sequence parser --- engines/hopkins/objects.cpp | 24 +++++++++++++----------- engines/hopkins/objects.h | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 04464f5e28..1aaed5a997 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4555,7 +4555,7 @@ void ObjectsManager::Q_GAUCHE(int idx) { if (idx == 6) SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); if (idx == 7) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,-1,", 0, 0, 8, 1); if (idx == 8) SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); if (idx == 9) @@ -5331,19 +5331,16 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } } -void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6) { +void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6) { int v6; - int16 v7; char v8; int v9; int16 v10; int v11; int spriteIndex; char v14; - int16 v15; Common::String v16; - v15 = 0; v6 = 0; spriteIndex = 0; v16 = " "; @@ -5358,23 +5355,28 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &a2, int a3, int a4 Sprite[0].field12 += a3; Sprite[0].field14 += a4; Sprite[0].fieldE = a6; + + uint strPos = 0; do { + bool loopCond = false; do { - v7 = 0; - v8 = a2[v15]; - if (v8 == ',') { + v8 = animationSeq[strPos]; + if ((animationSeq[strPos] == ',') || (strPos == animationSeq.size() - 1)) { + // Safeguard: if the sequence doesn't end with a coma, simulate it's present. + if (animationSeq[strPos] != ',') + v16.setChar(v8, v6); v9 = atoi(v16.c_str()); spriteIndex = v9; v6 = 0; v16 = " "; - v7 = 1; + loopCond = true; } else { v9 = v6; v16.setChar(v8, v6); v6 = v6 + 1; } - ++v15; - } while (v7 != 1); + ++strPos; + } while (!loopCond); if (spriteIndex != -1) { Sprite[0].spriteData = a1; Sprite[0].spriteIndex = spriteIndex; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 60ace316da..0af22a8483 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -233,7 +233,7 @@ public: int colision(int xp, int yp); void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); - void SPACTION(byte *a1, const Common::String &a2, int a3, int a4, int a5, int a6); + void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6); void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); void BLOQUE_ANIMX(int idx, int a2); -- cgit v1.2.3 From 5ae26a1910fef2163e8b1aad3cad2a0df5b02421 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 22:00:54 +1100 Subject: HOPKINS: Bugfixes for entering forest --- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/objects.cpp | 38 +++++++++++++++++++------------------- engines/hopkins/objects.h | 16 ++++++++++++---- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d19d074634..a513be7889 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -932,7 +932,7 @@ LABEL_140: _globals.DESACTIVE_INVENT = false; _globals.FORET = 1; _globals.NOSPRECRAN = true; - Common::String im = "IM" + _globals.SORTIE; + Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 04464f5e28..e0b41a9978 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -5560,8 +5560,8 @@ void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { _vm->_globals.BL_ANIM[idx].v2 = a2; } -void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v) { +void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, + const Common::String &animFile, const Common::String &s4, int v) { int v5; int v6; int v7; @@ -5581,12 +5581,12 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = false; _vm->_globals.AFFIVBL = false; - if (!s1.empty()) - _vm->_graphicsManager.LOAD_IMAGE(s1); - if (!s2.empty()) - INILINK(s2); - if (!s3.empty()) - _vm->_animationManager.CHARGE_ANIM(s3); + if (!backgroundFile.empty()) + _vm->_graphicsManager.LOAD_IMAGE(backgroundFile); + if (!linkFile.empty()) + INILINK(linkFile); + if (!animFile.empty()) + _vm->_animationManager.CHARGE_ANIM(animFile); _vm->_graphicsManager.VISU_ALL(); if (!s4.empty()) { if (!_vm->_globals.NOSPRECRAN) @@ -5655,7 +5655,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s return; _vm->_graphicsManager.FADE_OUTW(); - if (!s3.empty()) + if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); if (_vm->_globals.ECRAN == 61) SPRITE_OFF(0); @@ -5663,8 +5663,8 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s _vm->_globals.iRegul = 0; } -void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v) { +void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, + const Common::String &animFile, const Common::String &s4, int v) { int mouseButtons; bool breakFlag; int xp, yp; @@ -5684,12 +5684,12 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.WSOUND(v); _vm->_globals.iRegul = 1; - if (!s1.empty()) - _vm->_graphicsManager.LOAD_IMAGE(s1); - if (!s2.empty()) - INILINK(s2); - if (!s3.empty()) { - _vm->_animationManager.CHARGE_ANIM(s3); + if (!backgroundFile.empty()) + _vm->_graphicsManager.LOAD_IMAGE(backgroundFile); + if (!linkFile.empty()) + INILINK(linkFile); + if (!animFile.empty()) { + _vm->_animationManager.CHARGE_ANIM(animFile); _vm->_graphicsManager.VISU_ALL(); } if (!s4.empty()) { @@ -5739,7 +5739,7 @@ LABEL_70: _vm->_globals.CACHE_ON(); _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); - SPECIAL_INI(s2); + SPECIAL_INI(linkFile); _vm->_eventsManager.souris_n = 4; g_old_x = PERX; g_old_y = PERY; @@ -5812,7 +5812,7 @@ LABEL_70: SPRITE_OFF(1); DEUXPERSO = false; } - if (!s3.empty()) + if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); CLEAR_ECRAN(); } else { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 60ace316da..9fbc06c15b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -237,10 +237,18 @@ public: void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); void BLOQUE_ANIMX(int idx, int a2); - void PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v); - void PERSONAGE2(const Common::String &s1, const Common::String &s2, const Common::String &s3, - const Common::String &s4, int v); + + /** + * Game scene control method + */ + void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, + const Common::String &animFile, const Common::String &s4, int v); + + /** + * Game scene control method + */ + void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, + const Common::String &animFile, const Common::String &s4, int v); }; } // End of namespace Hopkins -- cgit v1.2.3 From 98a3f96ce01e7bcbcfd180af333b482f9f33d652 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Nov 2012 22:09:04 +1100 Subject: HOPKINS: Bugfix for cursor background transparency when in forest --- engines/hopkins/events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index d8c55124a3..9f2743c5b8 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -537,7 +537,7 @@ void EventsManager::updateCursor() { // Set the ScummVM cursor from the surface Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); CursorMan.replaceCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, - xOffset, 0, 0, true, &pixelFormat); + xOffset, 0, *((uint16 *)cursorPixels), true, &pixelFormat); // Delete the cursor surface delete[] cursorPixels; -- cgit v1.2.3 From cdbba33e38c341619222b93b3200776a1026304b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Nov 2012 23:09:16 +0100 Subject: HOPKINS: Fix PCX loading when no present in CAT file. --- engines/hopkins/files.cpp | 2 +- engines/hopkins/graphics.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index bc523af254..13e54bb288 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -298,7 +298,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { if (name == "FINIS") { _vm->_globals.dos_free2(ptr); - return false; + return g_PTRNUL; } offsetVal += 23; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 10d9e996da..4f0450453b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -212,7 +212,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { _vm->_fileManager.DMESS1(); flag = true; - if (_vm->_fileManager.RECHERCHE_CAT(file, 6)) { + if (_vm->_fileManager.RECHERCHE_CAT(file, 6) == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); if (!f.open(_vm->_globals.NFICHIER)) error("CHARGE_ECRAN - %s", file.c_str()); @@ -371,7 +371,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by // Decode the PCX if (!pcxDecoder.loadStream(f)) - error("Error decoding PCX"); + error("Error decoding PCX %s", file.c_str()); const Graphics::Surface *s = pcxDecoder.getSurface(); -- cgit v1.2.3 From 3da8683c48780520ae5302cecc3d3dd670433c42 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 10:16:05 +1100 Subject: HOPKINS: Bugfixes for the sequence player --- engines/hopkins/anim.cpp | 69 ++++++++++++++++++------------------------------ engines/hopkins/anim.h | 4 +-- 2 files changed, 28 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 0953cd9f50..0531f43267 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -958,32 +958,20 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count } while (v21 <= count && v3 != 1); } -void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, uint32 a5) { - int v5; +void AnimationManager::PLAY_SEQ(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { + bool readError; int v7; byte *ptr = NULL; byte *v9; byte *v10; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - char v18; + int soundNumber; size_t nbytes; - int buf; Common::File f; if (_vm->shouldQuit()) return; v7 = 0; - v14 = 0; - v13 = 0; - v16 = 0; - v15 = 0; - v17 = 1; _vm->_eventsManager.souris_flag = false; if (!NO_COUL) { _vm->_eventsManager.VBL(); @@ -998,20 +986,15 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, } v9 = _vm->_graphicsManager.VESA_SCREEN; v10 = _vm->_globals.dos_malloc2(0x16u); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a2); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); - f.read(&buf, 6u); + f.skip(6); f.read(_vm->_graphicsManager.Palette, 0x320u); - f.read(&buf, 4u); + f.skip(4); nbytes = f.readUint32LE(); - v18 = f.readUint32LE(); - v17 = f.readUint16LE(); - v16 = f.readUint16LE(); - v15 = f.readUint16LE(); - v14 = f.readUint16LE(); - v13 = f.readUint16LE(); + f.skip(14); f.read(v9, nbytes); if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { @@ -1059,7 +1042,7 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < a3); + } while (_vm->_eventsManager.lItCounter < rate1); } } else { if (NO_COUL) @@ -1076,24 +1059,23 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < a3); + } while (_vm->_eventsManager.lItCounter < rate1); } } _vm->_eventsManager.lItCounter = 0; - v5 = 0; - v12 = 0; + readError = false; + soundNumber = 0; do { - ++v12; - _vm->_soundManager.PLAY_ANM_SOUND(v12); - memset(&buf, 0, 6u); + ++soundNumber; + _vm->_soundManager.PLAY_ANM_SOUND(soundNumber); memset(v10, 0, 0x13u); if (f.read(v10, 16) != 16) - v5 = -1; + readError = true; if (strncmp((const char *)v10, "IMAGE=", 6)) - v5 = -1; - if (!v5) { - f.read(v9, (int16)READ_LE_UINT16(v10 + 8)); + readError = true; + if (!readError) { + f.read(v9, READ_LE_UINT32(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager.ESC_KEY == true) { @@ -1103,7 +1085,7 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < a4); + } while (_vm->_eventsManager.lItCounter < rate2); } _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); @@ -1125,7 +1107,8 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); } - } while (v5 != -1); + } while (!readError); + if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager.ESC_KEY == true) { @@ -1135,7 +1118,7 @@ void AnimationManager::PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < a5); + } while (_vm->_eventsManager.lItCounter < rate3); } _vm->_eventsManager.lItCounter = 0; LABEL_59: @@ -1153,7 +1136,7 @@ LABEL_59: _vm->_globals.dos_free2(v10); } -void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4) { +void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool v4; bool v5; int v7; @@ -1184,7 +1167,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, _vm->_eventsManager.souris_flag = false; v10 = _vm->_graphicsManager.VESA_SCREEN; v11 = _vm->_globals.dos_malloc2(0x16u); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, a1); + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("File not found - %s", _vm->_globals.NFICHIER.c_str()); @@ -1242,7 +1225,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, break; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= a2) + if (_vm->_eventsManager.lItCounter >= rate1) goto LABEL_23; } LABEL_48: @@ -1299,7 +1282,7 @@ LABEL_44: goto LABEL_48; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= a4) + if (_vm->_eventsManager.lItCounter >= rate3) goto LABEL_53; } } else { @@ -1313,7 +1296,7 @@ LABEL_53: _vm->_eventsManager.CONTROLE_MES(); if (REDRAW_ANIM() == true) goto LABEL_48; - if (_vm->_eventsManager.lItCounter >= a3) + if (_vm->_eventsManager.lItCounter >= rate2) goto LABEL_33; } LABEL_54: diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 66afcfcc5e..316833c01c 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -50,8 +50,8 @@ public: void CHARGE_ANIM(const Common::String &animName); void CLEAR_ANIM(); void RECHERCHE_ANIM(const byte *data, int animIndex, int count); - void PLAY_SEQ(const Common::String &a2, uint32 a3, uint32 a4, uint32 a5); - void PLAY_SEQ2(const Common::String &a1, uint32 a2, uint32 a3, uint32 a4); + void PLAY_SEQ(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); + void PLAY_SEQ2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); }; } // End of namespace Hopkins -- cgit v1.2.3 From 832f06fa8ac761e8cae5811a54629fd77e83e336 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 10:31:58 +1100 Subject: HOPKINS: Bugfix for crash when pushing button in purgatory control room --- engines/hopkins/sound.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 519d43b05a..8974d3e9fe 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -625,7 +625,7 @@ void SoundManager::PLAY_WAV(int wavIndex) { int SoundManager::VOICE_STAT(int voiceIndex) { if (Voice[voiceIndex]._status) { int wavIndex = Voice[voiceIndex]._wavIndex; - if (Swav[wavIndex]._audioStream->endOfStream()) + if (Swav[wavIndex]._audioStream != NULL && Swav[wavIndex]._audioStream->endOfStream()) STOP_VOICE(voiceIndex); } @@ -670,10 +670,11 @@ void SoundManager::PLAY_VOICE_SDL() { bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { if (Swav[wavIndex]._active) { - Swav[wavIndex]._active = false; - _vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle); delete Swav[wavIndex]._audioStream; + Swav[wavIndex]._audioStream = NULL; + Swav[wavIndex]._active = false; + return true; } else { return false; -- cgit v1.2.3 From 8331a015fc0498feb925307f4b265269cd3ee5cb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 Nov 2012 00:57:19 +0100 Subject: HOPKINS: Replace MenuText by an array of structures, implement Charge_Menu() --- engines/hopkins/computer.cpp | 84 ++++++++++++++++++++++++++++++++------------ engines/hopkins/computer.h | 9 ++++- 2 files changed, 69 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index afeb6ba6b4..de477b6102 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -33,7 +33,11 @@ namespace Hopkins { ComputerManager::ComputerManager() { - Common::fill(&MenuText[0], &MenuText[10600], '\0'); + for (int i = 0; i < 50; i++) { + MenuText[i]._actvFl = false; + MenuText[i]._lineSize = 0; + memset(MenuText[i]._line, 0, 90); + } Common::fill(&Sup_string[0], &Sup_string[200], '\0'); CASSESPR = NULL; FMOUSE = false; @@ -50,6 +54,7 @@ ComputerManager::ComputerManager() { CASSEP1 = 0; CASSEP2 = 0; CASSDER = 0; + Menu_lignes = 0; } void ComputerManager::setParent(HopkinsEngine *vm) { @@ -117,19 +122,19 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { _vm->_eventsManager.videkey(); settextposition(2, 4); if (mode == 1) - outtext(&MenuText[10]); + outtext(Common::String(MenuText[0]._line)); if (mode == 2) - outtext(&MenuText[0xDE]); + outtext(Common::String(MenuText[1]._line)); if (mode == 3) - outtext(&MenuText[0x1B2]); + outtext(Common::String(MenuText[2]._line)); settextcolor(1); if (mode == 3) { settextposition(10, 8); - outtext(&MenuText[0x286]); + outtext(Common::String(MenuText[3]._line)); } settextposition(12, 28); - outtext(&MenuText[0x35A]); + outtext(Common::String(MenuText[4]._line)); settextposition(14, 35); v3 = &s[0]; @@ -187,39 +192,40 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { settextcolor(4); settextposition(2, 4); if (mode == 1) - outtext(&MenuText[10]); + outtext(Common::String(MenuText[0]._line)); if (mode == 2) - outtext(&MenuText[0xDE]); + outtext(Common::String(MenuText[1]._line)); if (mode == 3) - outtext(&MenuText[0x1B2]); + outtext(Common::String(MenuText[2]._line)); settextcolor(15); settextposition(8, 25); settextcolor(15); - outtext2(&MenuText[0x502]); + outtext2(Common::String(MenuText[6]._line)); settextposition(20, 25); - outtext2(&MenuText[0x5D6]); + outtext2(Common::String(MenuText[7]._line)); if (mode == 1) { settextposition(10, 25); - outtext2(&MenuText[0x6AA]); + outtext2(Common::String(MenuText[8]._line)); settextposition(12, 25); - outtext2(&MenuText[0x77E]); + outtext2(Common::String(MenuText[9]._line)); settextposition(14, 25); - outtext2(&MenuText[0x852]); + outtext2(Common::String(MenuText[10]._line)); settextposition(16, 25); - outtext2(&MenuText[0x926]); + outtext2(Common::String(MenuText[11]._line)); } if (mode == 2) { _vm->_eventsManager.videkey(); settextposition(10, 25); - outtext2(&MenuText[0x95A]); +// outtext2(Common::String(MenuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy + outtext2(Common::String(MenuText[12]._line)); settextposition(12, 25); - outtext2(&MenuText[0xACE]); + outtext2(Common::String(MenuText[13]._line)); settextposition(14, 25); - outtext2(&MenuText[0xBA2]); + outtext2(Common::String(MenuText[14]._line)); settextposition(16, 25); - outtext2(&MenuText[0xC76]); + outtext2(Common::String(MenuText[15]._line)); settextposition(18, 25); - outtext2(&MenuText[0xD4A]); + outtext2(Common::String(MenuText[16]._line)); } do { @@ -241,7 +247,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { clearscreen(); settextcolor(4); settextposition(2, 4); - outtext(&MenuText[10]); + outtext(Common::String(MenuText[0]._line)); settextcolor(15); if (v12 == 50) LIT_TEXTE(1); @@ -255,7 +261,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { clearscreen(); settextcolor(4); settextposition(2, 4); - outtext(&MenuText[0xDE]); + outtext(Common::String(MenuText[1]._line)); settextcolor(15); if (v12 == 50) LIT_TEXTE(6); @@ -279,7 +285,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { } else { settextcolor(4); settextposition(16, 25); - outtext(&MenuText[0x42E]); + outtext(Common::String(MenuText[5]._line)); _vm->_eventsManager.VBL(); memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); _vm->_graphicsManager.DD_Lock(); @@ -298,7 +304,39 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { } void ComputerManager::Charge_Menu() { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); + byte *ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + byte *tmpPtr = ptr; + int lineNum = 0; + int strPos; + bool loopCond = false; + do { + if (tmpPtr[0] == '%') { + if (tmpPtr[1] == '%') { + loopCond = true; + goto LABEL_13; + } + MenuText[lineNum]._actvFl = 1; + strPos = 0; + while (1) { + byte curChar = tmpPtr[strPos + 2]; + if (curChar == '%' || curChar == 10) + break; + MenuText[lineNum]._line[strPos++] = curChar; + if (strPos > 89) + goto LABEL_11; + } + MenuText[lineNum]._line[strPos] = 0; + MenuText[lineNum]._lineSize = strPos - 1; + LABEL_11: + ++lineNum; + } + Menu_lignes = lineNum; + LABEL_13: + tmpPtr = tmpPtr + 1; + } while (!loopCond); + _vm->_globals.dos_free2(ptr); } void ComputerManager::TXT4(int xp, int yp, int a3) { diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 612178dc4a..e781d56e0a 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -31,10 +31,16 @@ namespace Hopkins { class HopkinsEngine; +struct MenuItem { + bool _actvFl; + int _lineSize; + char _line[90]; +}; + class ComputerManager { private: HopkinsEngine *_vm; - char MenuText[10600]; + MenuItem MenuText[50]; char Sup_string[200]; byte Score[96]; int TEXT_COL; @@ -55,6 +61,7 @@ private: int CASSEP1; int CASSEP2; int CASSDER; + int Menu_lignes; // CHECKME: Useless variable /** * Load the menu text -- cgit v1.2.3 From 10bb9e7e1496be994398fc4e5020cbcb4ef77144 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 11:48:28 +1100 Subject: HOPKINS: Pathfinding bugfix to fix error walking in Purgatory hallway --- engines/hopkins/lines.cpp | 282 +++++++++++++++++++++++----------------------- 1 file changed, 139 insertions(+), 143 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2ba89962d7..40dbbdcf71 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1700,124 +1700,122 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { int v8; int v9; int v10; - int v11; - int v12; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; + int v11; + int v12; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; int v20; - int v21; + int v21; int v22; - int v23; - int v24; - int v25; + int v23; + int v24; + int v25; int v26; - int v27; - int v28; - int v29; + int v27; + int v28; + int v29; int v31; - int v32; - int v33; int v34; - int v35; + int v35; int v36; int v37; int v38; int v39; - int v40; - int v41; + int v40; + int v41; int v42; - int v43; - int v44; - int v45; + int v43; + int v44; + int v45; int v46; int v47; - int v48; - int v49; - int v50; + int v48; + int v49; + int v50; int v51; - int v52; - int v53; - int v54; + int v52; + int v53; + int v54; int v55; int v56; - int v57; + int v57; int v58; - int v59; + int v59; int v60; - int v61; - int v62; + int v61; + int v62; int v63; - int v64; - int v65; - int v66; + int v64; + int v65; + int v66; int v67; int v68; int i; - int16 *v70; - int v71; - int v72; - int j; + int16 *v70; + int v71; + int v72; + int j; int16 *v74; int v75; - int v76; + int v76; int v77; int v78; int v79; - int v80; - int16 *v81; + int v80; + int16 *v81; int v82; int v83; - int16 *v84; + int16 *v84; int v85; - int v86; + int v86; int v87; int v88; int v89; - int v90; + int v90; int16 *v91; - int v92; + int v92; int v93; int v94; int16 *v95; - int v96; - int v97; + int v96; + int v97; int v98; int v99; int v100; - int v101; - int v102; - int v103; + int v101; + int v102; + int v103; int v104; - int v105; - int v106; - int v107; + int v105; + int v106; + int v107; int v108; - int v109; + int v109; int v110; int v111; int v112; - int v113; + int v113; int v114; int v115; - int v116; + int v116; int v117; - int v118 = 0; - int v119 = 0; + int v118; + int v119; int v120; int v121; - int v122; + int v122; int v123; int v124; - int v125; - int v126[10]; - int v131[10]; - int v136[10]; - int v141[10]; - + int v125; + int v126[9]; + int v131[9]; + int v136[9]; + int v141[9]; + v123 = destX; v122 = destY; v121 = 0; @@ -1904,7 +1902,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v16 = 5; do { v101 = v16; - v17 = colision2_ligne(v123, v15, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); + v17 = colision2_ligne(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE); v16 = v101; if (v17 == 1 && v141[v101] <= _vm->_objectsManager.DERLIGNE) break; @@ -1914,7 +1912,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { ++v15; } while (_vm->_graphicsManager.max_y > v15); } - v131[3] = v14; + v131[5] = v14; v18 = 0; v19 = v122; if (_vm->_graphicsManager.min_y < v122) { @@ -1927,8 +1925,8 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { break; v136[v102] = 0; v141[v102] = -1; - if (v131[3] < v18) { - if (v141[3] != -1) + if (v131[5] < v18) { + if (v141[5] != -1) break; } ++v18; @@ -1942,7 +1940,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v24 = 3; do { v103 = v24; - v25 = colision2_ligne(v23, v122, &v136[2], &v141[2], 0, _vm->_objectsManager.DERLIGNE); + v25 = colision2_ligne(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v24 = v103; if (v25 == 1 && v141[v103] <= _vm->_objectsManager.DERLIGNE) break; @@ -1953,19 +1951,19 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { if (v141[1] != -1) break; } - if (v131[3] < v22 && v141[3] != -1) + if (v131[5] < v22 && v141[5] != -1) break; ++v23; } while (_vm->_graphicsManager.max_x > v23); } - v131[2] = v22; + v131[3] = v22; v26 = 0; v27 = v123; if (_vm->_graphicsManager.min_x < v123) { v28 = 7; do { v104 = v28; - v29 = colision2_ligne(v27, v122, &v136[4], &v141[4], 0, _vm->_objectsManager.DERLIGNE); + v29 = colision2_ligne(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE); v28 = v104; if (v29 == 1 && v141[v104] <= _vm->_objectsManager.DERLIGNE) break; @@ -1976,61 +1974,59 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { if (v141[1] != -1) break; } - if (v131[3] < v26 && v141[3] != -1) + if (v131[5] < v26 && v141[5] != -1) break; - if (v131[2] < v26 && v141[2] != -1) + if (v131[3] < v26 && v141[3] != -1) break; --v27; } while (_vm->_graphicsManager.min_x < v27); } - v131[4] = v26; + v131[7] = v26; if (v141[1] < 0 || _vm->_objectsManager.DERLIGNE < v141[1]) v141[1] = -1; - if (v141[2] < 0 || _vm->_objectsManager.DERLIGNE < v141[2]) - v141[2] = -1; if (v141[3] < 0 || _vm->_objectsManager.DERLIGNE < v141[3]) v141[3] = -1; - if (v141[4] < 0 || _vm->_objectsManager.DERLIGNE < v141[4]) - v141[4] = -1; + if (v141[5] < 0 || _vm->_objectsManager.DERLIGNE < v141[5]) + v141[5] = -1; + if (v141[7] < 0 || _vm->_objectsManager.DERLIGNE < v141[7]) + v141[7] = -1; if (v141[1] < 0) v131[1] = 1300; - if (v141[2] < 0) - v131[2] = 1300; if (v141[3] < 0) v131[3] = 1300; - if (v141[4] < 0) - v131[4] = 1300; - if (v141[1] == -1 && v141[2] == -1 && v141[3] == -1 && v141[4] == -1) + if (v141[5] < 0) + v131[5] = 1300; + if (v141[7] < 0) + v131[7] = 1300; + if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) return (int16 *)g_PTRNUL; v31 = 0; - if (v141[3] != -1 && v131[1] >= v131[3] && v131[2] >= v131[3] && v131[4] >= v131[3]) { - v121 = v141[3]; - v120 = v136[3]; + if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { + v121 = v141[5]; + v120 = v136[5]; v31 = 1; } - if (v141[1] != -1 && !v31 && v131[3] >= v131[1] && v131[2] >= v131[1] && v131[4] >= v131[1]) { + if (v141[1] != -1 && !v31 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { v121 = v141[1]; v120 = v136[1]; v31 = 1; } - if (v141[2] != -1 && !v31 && v131[1] >= v131[2] && v131[3] >= v131[2] && v131[4] >= v131[2]) { - v121 = v141[2]; - v120 = v136[2]; + if (v141[3] != -1 && !v31 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { + v121 = v141[3]; + v120 = v136[3]; v31 = 1; } - if (v141[4] != -1 && !v31 && v131[3] >= v131[4] && v131[2] >= v131[4] && v131[1] >= v131[4]) { - v121 = v141[4]; - v120 = v136[4]; + if (v141[7] != -1 && !v31 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { + v121 = v141[7]; + v120 = v136[7]; } - v32 = 0; - do { - v33 = v32; - v141[v33] = -1; - v136[v33] = 0; - v131[v33] = 1300; - v126[v33] = 1300; - ++v32; - } while (v32 <= 8); + + for (v12 = 0; v12 <= 8; ++v12) { + v141[v12] = -1; + v136[v12] = 0; + v131[v12] = 1300; + v126[v12] = 1300; + } v34 = 0; v35 = a2; @@ -2038,7 +2034,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v36 = 5; do { v105 = v36; - v37 = colision2_ligne(a1, v35, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); + v37 = colision2_ligne(a1, v35, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE); v36 = v105; if (v37 == 1 && v141[v105] <= _vm->_objectsManager.DERLIGNE) break; @@ -2048,7 +2044,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { ++v35; } while (_vm->_graphicsManager.max_y > v35); } - v131[3] = v34 + 1; + v131[5] = v34 + 1; v38 = 0; v39 = a2; if (_vm->_graphicsManager.min_y < a2) { @@ -2062,7 +2058,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v136[v106] = 0; v141[v106] = -1; ++v38; - if (v141[3] != -1) { + if (v141[5] != -1) { if (v38 > 80) break; } @@ -2076,70 +2072,70 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v44 = 3; do { v107 = v44; - v45 = colision2_ligne(v43, a2, &v136[2], &v141[2], 0, _vm->_objectsManager.DERLIGNE); + v45 = colision2_ligne(v43, a2, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v44 = v107; if (v45 == 1 && v141[v107] <= _vm->_objectsManager.DERLIGNE) break; v136[v107] = 0; v141[v107] = -1; ++v42; - if (v141[3] != -1 || v141[1] != -1) { + if (v141[5] != -1 || v141[1] != -1) { if (v42 > 100) break; } ++v43; } while (_vm->_graphicsManager.max_x > v43); } - v131[2] = v42 + 1; + v131[3] = v42 + 1; v46 = 0; v47 = a1; if (_vm->_graphicsManager.min_x < a1) { v48 = 7; do { v108 = v48; - v49 = colision2_ligne(v47, a2, &v136[4], &v141[4], 0, _vm->_objectsManager.DERLIGNE); + v49 = colision2_ligne(v47, a2, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE); v48 = v108; if (v49 == 1 && v141[v108] <= _vm->_objectsManager.DERLIGNE) break; v136[v108] = 0; v141[v108] = -1; ++v46; - if (v141[3] != -1 || v141[1] != -1 || v141[2] != -1) { + if (v141[5] != -1 || v141[1] != -1 || v141[3] != -1) { if (v46 > 100) break; } --v47; } while (_vm->_graphicsManager.min_x < v47); } - v131[4] = v46 + 1; + v131[7] = v46 + 1; if (v141[1] != -1) { v50 = v141[1] - v121; if (v50 < 0) v50 = -v50; v126[1] = v50; } - if (v141[2] != -1) { - v51 = v141[2] - v121; + if (v141[3] != -1) { + v51 = v141[3] - v121; if (v51 < 0) v51 = -v51; - v126[2] = v51; + v126[3] = v51; } - if (v141[3] != -1) { - v52 = v141[3] - v121; + if (v141[5] != -1) { + v52 = v141[5] - v121; if (v52 < 0) v52 = -v52; - v126[3] = v52; + v126[5] = v52; } - if (v141[4] != -1) { - v53 = v141[4] - v121; + if (v141[7] != -1) { + v53 = v141[7] - v121; if (v53 < 0) v53 = -v53; - v126[4] = v53; + v126[7] = v53; } - if (v141[1] == -1 && v141[2] == -1 && v141[3] == -1 && v141[4] == -1) - error("ERREUR POINT PLUS PROCHE Du perso NON TROUVE"); + if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) + error("Nearest point not found error"); v54 = 0; - if (v141[1] != -1 && v126[2] >= v126[1] && v126[3] >= v126[1] && v126[4] >= v126[1]) { + if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { v54 = 1; v115 = v141[1]; v111 = v131[1]; @@ -2147,26 +2143,26 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v114 = v136[1]; } if (!v54) { - if (v141[3] != -1 && v126[2] >= v126[3] && v126[1] >= v126[3] && v126[4] >= v126[3]) { + if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { v54 = 1; - v115 = v141[3]; - v111 = v131[3]; + v115 = v141[5]; + v111 = v131[5]; v113 = 5; - v114 = v136[3]; + v114 = v136[5]; } if (!v54) { - if (v141[2] != -1 && v126[1] >= v126[2] && v126[3] >= v126[2] && v126[4] >= v126[2]) { + if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { v54 = 1; - v115 = v141[2]; - v111 = v131[2]; + v115 = v141[3]; + v111 = v131[3]; v113 = 3; - v114 = v136[2]; + v114 = v136[3]; } - if (!v54 && v141[4] != -1 && v126[1] >= v126[4] && v126[3] >= v126[4] && v126[2] >= v126[4]) { - v115 = v141[4]; - v111 = v131[4]; + if (!v54 && v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { + v115 = v141[7]; + v111 = v131[7]; v113 = 7; - v114 = v136[4]; + v114 = v136[7]; } } } @@ -2182,7 +2178,7 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if ((uint16)colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, &_vm->_globals.super_parcours[0], 4); @@ -2206,7 +2202,7 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if ((uint16)colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, &_vm->_globals.super_parcours[0], 4); @@ -2230,7 +2226,7 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if ((uint16)colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, &_vm->_globals.super_parcours[0], 4); @@ -2254,7 +2250,7 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if ((uint16)colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, &_vm->_globals.super_parcours[0], 4); -- cgit v1.2.3 From 4661b0ab86f7e9177ada2255ca1802668b74caeb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 13:14:18 +1100 Subject: HOPKINS: Bugfix for throwing a dart at the switch in Purgatory --- engines/hopkins/lines.cpp | 86 ++++++++++++++++++++++----------------------- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 4 ++- 3 files changed, 47 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 40dbbdcf71..4337f93357 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1692,7 +1692,7 @@ LABEL_17: } // Avoid 2 -int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { +int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v4; int v5; int v6; @@ -1827,11 +1827,11 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { if (destY <= 24) v122 = 25; if (!_vm->_globals.NOT_VERIF) { - v4 = a1 - _vm->_globals.old_x1_65; + v4 = srcX - _vm->_globals.old_x1_65; if (v4 < 0) v4 = -v4; if (v4 <= 4) { - v5 = a2 - _vm->_globals.old_y1_66; + v5 = srcY - _vm->_globals.old_y1_66; if (v5 < 0) v5 = -v5; if (v5 <= 4) { @@ -1847,11 +1847,11 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } } } - v8 = a1 - destX; + v8 = srcX - destX; if (v8 < 0) v8 = -v8; if (v8 <= 4) { - v9 = a2 - v122; + v9 = srcY - v122; if (v9 < 0) v9 = -v9; if (v9 <= 4) @@ -1862,9 +1862,9 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } _vm->_globals.NOT_VERIF = 0; _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; - _vm->_globals.old_x1_65 = a1; + _vm->_globals.old_x1_65 = srcX; _vm->_globals.old_x2_67 = destX; - _vm->_globals.old_y1_66 = a2; + _vm->_globals.old_y1_66 = srcY; _vm->_globals.old_y2_68 = v122; _vm->_globals.STOP_BUG = 0; v112 = 0; @@ -1876,11 +1876,11 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { v123 = _vm->_graphicsManager.max_x - 10; if (v122 > _vm->_globals.Max_Perso_Y) v122 = _vm->_globals.Max_Perso_Y; - v10 = a1 - v123; + v10 = srcX - v123; if (v10 < 0) v10 = -v10; if (v10 <= 3) { - v11 = a2 - v122; + v11 = srcY - v122; if (v11 < 0) v11 = -v11; if (v11 <= 3) @@ -1895,7 +1895,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { ++v12; } - if (PARC_PERS(a1, a2, v123, v122, -1, -1, 0) != 1) { + if (PARC_PERS(srcX, srcY, v123, v122, -1, -1, 0) != 1) { v14 = 0; v15 = v122; if (_vm->_graphicsManager.max_y > v122) { @@ -2029,12 +2029,12 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } v34 = 0; - v35 = a2; - if (_vm->_graphicsManager.max_y > a2) { + v35 = srcY; + if (_vm->_graphicsManager.max_y > srcY) { v36 = 5; do { v105 = v36; - v37 = colision2_ligne(a1, v35, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE); + v37 = colision2_ligne(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE); v36 = v105; if (v37 == 1 && v141[v105] <= _vm->_objectsManager.DERLIGNE) break; @@ -2046,12 +2046,12 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } v131[5] = v34 + 1; v38 = 0; - v39 = a2; - if (_vm->_graphicsManager.min_y < a2) { + v39 = srcY; + if (_vm->_graphicsManager.min_y < srcY) { v40 = 1; do { v106 = v40; - v41 = colision2_ligne(a1, v39, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE); + v41 = colision2_ligne(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE); v40 = v106; if (v41 == 1 && v141[v106] <= _vm->_objectsManager.DERLIGNE) break; @@ -2067,12 +2067,12 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } v131[1] = v38 + 1; v42 = 0; - v43 = a1; - if (_vm->_graphicsManager.max_x > a1) { + v43 = srcX; + if (_vm->_graphicsManager.max_x > srcX) { v44 = 3; do { v107 = v44; - v45 = colision2_ligne(v43, a2, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); + v45 = colision2_ligne(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v44 = v107; if (v45 == 1 && v141[v107] <= _vm->_objectsManager.DERLIGNE) break; @@ -2088,12 +2088,12 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } v131[3] = v42 + 1; v46 = 0; - v47 = a1; - if (_vm->_graphicsManager.min_x < a1) { + v47 = srcX; + if (_vm->_graphicsManager.min_x < srcX) { v48 = 7; do { v108 = v48; - v49 = colision2_ligne(v47, a2, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE); + v49 = colision2_ligne(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE); v48 = v108; if (v49 == 1 && v141[v108] <= _vm->_objectsManager.DERLIGNE) break; @@ -2166,7 +2166,7 @@ int16 *LinesManager::PARCOURS2(int a1, int a2, int destX, int destY) { } } } - v55 = PARC_PERS(a1, a2, v123, v122, v115, v121, 0); + v55 = PARC_PERS(srcX, srcY, v123, v122, v115, v121, 0); if (v55 != 1) { if (v55 == 2) { LABEL_201: @@ -2178,19 +2178,19 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if (colision2_ligne(a1, a2 - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v58 = GENIAL(v124, v125, a1, a2 - v56, a1, a2 - v111, v112, &_vm->_globals.super_parcours[0], 4); + v58 = GENIAL(v124, v125, srcX, srcY - v56, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); if (v58 == -1) goto LABEL_282; v112 = v58; if (NVPY != -1) - v56 = a2 - NVPY; + v56 = srcY - NVPY; } v59 = v112; - _vm->_globals.super_parcours[v59] = a1; - _vm->_globals.super_parcours[v59 + 1] = a2 - v56; + _vm->_globals.super_parcours[v59] = srcX; + _vm->_globals.super_parcours[v59 + 1] = srcY - v56; _vm->_globals.super_parcours[v59 + 2] = 1; _vm->_globals.super_parcours[v59 + 3] = 0; v112 += 4; @@ -2202,19 +2202,19 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if (colision2_ligne(a1, v60 + a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v61 = GENIAL(v124, v125, a1, v60 + a2, a1, v111 + a2, v112, &_vm->_globals.super_parcours[0], 4); + v61 = GENIAL(v124, v125, srcX, v60 + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) goto LABEL_282; v112 = v61; if (NVPY != -1) - v60 = NVPY - a2; + v60 = NVPY - srcY; } v62 = v112; - _vm->_globals.super_parcours[v62] = a1; - _vm->_globals.super_parcours[v62 + 1] = v60 + a2; + _vm->_globals.super_parcours[v62] = srcX; + _vm->_globals.super_parcours[v62 + 1] = v60 + srcY; _vm->_globals.super_parcours[v62 + 2] = 5; _vm->_globals.super_parcours[v62 + 3] = 0; v112 += 4; @@ -2226,19 +2226,19 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if (colision2_ligne(a1 - v63, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v64 = GENIAL(v124, v125, a1 - v63, a2, a1 - v111, a2, v112, &_vm->_globals.super_parcours[0], 4); + v64 = GENIAL(v124, v125, srcX - v63, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v64 == -1) goto LABEL_282; v112 = v64; if (NVPX != -1) - v63 = a1 - NVPX; + v63 = srcX - NVPX; } v65 = v112; - _vm->_globals.super_parcours[v65] = a1 - v63; - _vm->_globals.super_parcours[v65 + 1] = a2; + _vm->_globals.super_parcours[v65] = srcX - v63; + _vm->_globals.super_parcours[v65 + 1] = srcY; _vm->_globals.super_parcours[v65 + 2] = 7; _vm->_globals.super_parcours[v65 + 3] = 0; v112 += 4; @@ -2250,19 +2250,19 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if (colision2_ligne(v66 + a1, a2, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; - v67 = GENIAL(v124, v125, v66 + a1, a2, v111 + a1, a2, v112, &_vm->_globals.super_parcours[0], 4); + v67 = GENIAL(v124, v125, v66 + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v67 == -1) goto LABEL_282; v112 = v67; if (NVPX != -1) - v66 = NVPX - a1; + v66 = NVPX - srcX; } v68 = v112; - _vm->_globals.super_parcours[v68] = v66 + a1; - _vm->_globals.super_parcours[v68 + 1] = a2; + _vm->_globals.super_parcours[v68] = v66 + srcX; + _vm->_globals.super_parcours[v68 + 1] = srcY; _vm->_globals.super_parcours[v68 + 2] = 3; _vm->_globals.super_parcours[v68 + 3] = 0; v112 += 4; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 20a1bccb65..d029aaa9b0 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -85,7 +85,7 @@ public: int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); int MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); - int16 *PARCOURS2(int a1, int a2, int a3, int a4); + int16 *PARCOURS2(int srcX, int srcY, int destX, int destY); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); int SMOOTH_MOVE(int a3, int a4, int a5, int a6); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a553f02fae..ec052dba35 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2916,8 +2916,10 @@ LABEL_65: ARRET_PERSO_FLAG = 1; ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField13] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField132] == 1 + && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager.btsouris == 23) { + // Special case for throwing darts at the switch in Purgatory - the player shouldn't move _vm->_globals.chemin = (int16 *)g_PTRNUL; XSPR(0); YSPR(0); -- cgit v1.2.3 From 08dcceeefcc6b79c1b6c96f0f25744512565bdaf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 13:42:44 +1100 Subject: HOPKINS: Cleanup of FORET flag and bugfix for when leaving forest. --- engines/hopkins/globals.cpp | 4 ++-- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 8 ++++---- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2283c6b10a..5a24a5f207 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -141,7 +141,7 @@ Globals::Globals() { nbrligne = 0; largeur_boite = 0; hauteur_boite = 0; - FORET = 0; + FORET = false; OBJL = OBJH = 0; HELICO = 0; CAT_POSI = 0; @@ -419,7 +419,7 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; FORETSPR = g_PTRNUL; - FORET = 0; + FORET = false; cache_souris = dos_malloc2(2500); GESTE = g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 382487a822..84eca3b688 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -388,7 +388,7 @@ public: int hauteur_boite; int GESTE_FLAG; byte *FORETSPR; - int FORET; + bool FORET; byte *COUCOU; int16 *chemin; byte *cache_souris; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a513be7889..de8f41e895 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -930,7 +930,7 @@ LABEL_140: _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.DESACTIVE_INVENT = false; - _globals.FORET = 1; + _globals.FORET = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -941,10 +941,10 @@ LABEL_140: } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; - if (_globals.SORTIE - 35 > 14) { + if ((uint)(_globals.SORTIE - 35) > 14) { _globals.dos_free2(_globals.FORETSPR); _globals.FORETSPR = g_PTRNUL; - _globals.FORET = 0; + _globals.FORET = false; _soundManager.DEL_SAMPLE(1); } } else if (_globals.SORTIE == 32) { @@ -1856,7 +1856,7 @@ void HopkinsEngine::REST_SYSTEM() { void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); - _globals.FORET = 0; + _globals.FORET = false; _eventsManager.CASSE = false; _globals.DESACTIVE_INVENT = true; _globals.FLAG_VISIBLE = false; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b8ec31d67c..7f7e3803cc 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -54,7 +54,7 @@ int MenuManager::MENU() { result = 0; while (!g_system->getEventManager()->shouldQuit()) { - _vm->_globals.FORET = 0; + _vm->_globals.FORET = false; _vm->_eventsManager.CASSE = false; _vm->_globals.DESACTIVE_INVENT = true; _vm->_globals.FLAG_VISIBLE = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ec052dba35..9b46b3d03d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2940,7 +2940,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.TEXTE_OFF(5); - if (_vm->_globals.FORET != 1 || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { + if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager.start_x >= XSPR(0) - 320) -- cgit v1.2.3 From 9a996d66d443292f0485ea062a72b62a45cec43e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 15:21:16 +1100 Subject: HOPKINS: Bugfix for crash when walking in the projection room --- engines/hopkins/graphics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 4f0450453b..f2d23c7602 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1805,7 +1805,7 @@ int GraphicsManager::Asm_Reduc(int v, int percentage) { return v; } - + // Display 'Perfect?' void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag) { const byte *spriteStartP; @@ -1821,7 +1821,6 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int clippedWidth; int xCtr2; int v20; - int v21 = 0; int v22; int v23; int v24; @@ -1901,7 +1900,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_Flag_x = 0; Largeur = spriteWidth; v20 = Asm_Zoom(spriteWidth, zoom2); - v22 = Asm_Zoom(v21, zoom2); + v22 = Asm_Zoom(spriteHeight1, zoom2); if (modeFlag) { v29 = v20 + dest1P; if (clip_y) { @@ -2017,6 +2016,7 @@ R_Aff_Zoom_Larg_Cont1: } if (v20 > (uint16)clip_x1) v20 = (uint16)clip_x1; + do { while (1) { v60 = v22; -- cgit v1.2.3 From 5b7b4bc9dfdaff9cb8b0aa8fd3f3293eb2ae23d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 16:05:38 +1100 Subject: HOPKINS: Fix for computer text display at the correct position --- engines/hopkins/computer.cpp | 4 ++-- engines/hopkins/font.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index de477b6102..e43bedfeb2 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -94,8 +94,8 @@ void ComputerManager::settextcolor(int col) { } void ComputerManager::settextposition(int xp, int yp) { - _textPosition.x = xp; - _textPosition.y = yp; + _textPosition.x = xp << 3; + _textPosition.y = yp << 4; } void ComputerManager::COMPUT_HOPKINS(int mode) { diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 2b38bdb900..07a61d94a2 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -520,27 +520,27 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col int v5; int v6; byte v7; - char v8; + int fontCol; int v9; srcP = msg.c_str(); v9 = xp; - v8 = col; + fontCol = col; do { v7 = *srcP++; if (v7 == '&') { - v8 = 2; + fontCol = 2; v7 = *srcP++; } if (v7 == '$') { - v8 = 4; + fontCol = 4; v7 = *srcP++; } if (!v7) break; if (v7 >= 32) { v5 = v7 - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, v9, yp, v7 - 32, v8); + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, v9, yp, v7 - 32, fontCol); v9 += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); v6 = _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); -- cgit v1.2.3 From 67ae9e93069794532f43e43ac0396389a64c13bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 16:16:59 +1100 Subject: HOPKINS: Bugfixes for computer screen text --- engines/hopkins/computer.cpp | 2 +- engines/hopkins/computer.h | 7 ++++--- engines/hopkins/font.cpp | 9 +++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index e43bedfeb2..3c2a0573b9 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -93,7 +93,7 @@ void ComputerManager::settextcolor(int col) { TEXT_COL = col; } -void ComputerManager::settextposition(int xp, int yp) { +void ComputerManager::settextposition(int yp, int xp) { _textPosition.x = xp << 3; _textPosition.y = yp << 4; } diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index e781d56e0a..8cccd67197 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -96,11 +96,12 @@ private: void settextcolor(int col); /** - * Sets the text position - * @param xp X position + * Sets the text position. * @param yp Y position + * @param xp X position + * @remarks Yes, the reverse co-ordinate pair is really like that in the original game. */ - void settextposition(int xp, int yp); + void settextposition(int yp, int xp); /** * Outputs a text string diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 07a61d94a2..0ddd257939 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -552,6 +552,15 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col _vm->_eventsManager.VBL(); _vm->_globals.iRegul = 1; } + + if (_vm->_eventsManager.ESC_KEY) { + _vm->_globals.iRegul = 1; + _vm->_eventsManager.VBL(); + } else { + _vm->_globals.iRegul = 4; + _vm->_eventsManager.VBL(); + _vm->_globals.iRegul = 1; + } } } while (v7); } -- cgit v1.2.3 From 9bc308b32bc521b6b7e25956ada534ad92be6485 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 16:19:26 +1100 Subject: HOPKINS: Remove old stub event loop from the HopkinsEngine::run method --- engines/hopkins/hopkins.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index de8f41e895..7f261cb698 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -105,25 +105,14 @@ Common::Error HopkinsEngine::run() { _soundManager.WSOUND_INIT(); - bool retVal; if (getPlatform() == Common::kPlatformLinux) { if (getIsDemo()) - retVal = runLinuxDemo(); + runLinuxDemo(); else - retVal = runLinuxFull(); + runLinuxFull(); } else { warning("Unhandled version, switching to linux demo"); - retVal = runLinuxDemo(); - } - - if (!retVal) - return Common::kNoError; - - // Stub event loop - Common::Event evt; - while (!g_system->getEventManager()->shouldQuit()) { - while (g_system->getEventManager()->pollEvent(evt)) - g_system->updateScreen(); + runLinuxDemo(); } return Common::kNoError; -- cgit v1.2.3 From 9f36cedd3181cb62b0a718724194ed6f102ff331 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 19:31:43 +1100 Subject: HOPKINS: Added enum for different FBI computer terminals, and capitalisatoin bugfixes --- engines/hopkins/computer.cpp | 58 +++++++++++++++++++++++--------------------- engines/hopkins/computer.h | 8 +++--- engines/hopkins/events.cpp | 50 +++++++++++++++++++++++++++++--------- engines/hopkins/events.h | 1 + engines/hopkins/font.cpp | 17 ++++--------- engines/hopkins/hopkins.cpp | 12 ++++----- 6 files changed, 86 insertions(+), 60 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 3c2a0573b9..f9d86d35b2 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -98,8 +98,9 @@ void ComputerManager::settextposition(int yp, int xp) { _textPosition.y = yp << 4; } -void ComputerManager::COMPUT_HOPKINS(int mode) { - int v2; +void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { + bool passwordMatch; + bool numericFlag; char *v3; int v4; char v5; @@ -114,22 +115,22 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { const char *s2; _vm->_eventsManager.ESC_KEY = 0; - v2 = 0; + passwordMatch = false; _vm->_graphicsManager.RESET_SEGMENT_VESA(); setvideomode(); settextcolor(4); _vm->_eventsManager.videkey(); settextposition(2, 4); - if (mode == 1) + if (mode == COMPUTER_HOPKINS) outtext(Common::String(MenuText[0]._line)); - if (mode == 2) + if (mode == COMPUTER_SAMANTHAS) outtext(Common::String(MenuText[1]._line)); - if (mode == 3) + if (mode == COMPUTER_PUBLIC) outtext(Common::String(MenuText[2]._line)); settextcolor(1); - if (mode == 3) { + if (mode == COMPUTER_PUBLIC) { settextposition(10, 8); outtext(Common::String(MenuText[3]._line)); } @@ -143,7 +144,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { strcpy(s, Sup_string); - if (mode == 1) { + if (mode == COMPUTER_HOPKINS) { s2 = "HOPKINS"; v4 = 8; v5 = 1; @@ -154,9 +155,9 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { --v4; } while (v5); if (v5) - v2 = 1; + passwordMatch = true; } - if (mode == 2) { + if (mode == COMPUTER_SAMANTHAS) { v6 = &s[0]; s2 = "328MHZA"; v7 = 8; @@ -168,9 +169,9 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { --v7; } while (v8); if (v8) - v2 = 1; + passwordMatch = true; } - if (mode == 3) { + if (mode == COMPUTER_PUBLIC) { v9 = &s[0]; s2 = "ALLFREE"; v10 = 8; @@ -182,20 +183,20 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { --v10; } while (v11); if (v11) - v2 = 1; + passwordMatch = true; } - if (v2) { + if (passwordMatch) { while (!_vm->shouldQuit()) { - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager.ESC_KEY = false; _vm->_eventsManager.videkey(); clearscreen(); settextcolor(4); settextposition(2, 4); - if (mode == 1) + if (mode == COMPUTER_HOPKINS) outtext(Common::String(MenuText[0]._line)); - if (mode == 2) + if (mode == COMPUTER_SAMANTHAS) outtext(Common::String(MenuText[1]._line)); - if (mode == 3) + if (mode == COMPUTER_PUBLIC) outtext(Common::String(MenuText[2]._line)); settextcolor(15); settextposition(8, 25); @@ -203,7 +204,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { outtext2(Common::String(MenuText[6]._line)); settextposition(20, 25); outtext2(Common::String(MenuText[7]._line)); - if (mode == 1) { + if (mode == COMPUTER_HOPKINS) { settextposition(10, 25); outtext2(Common::String(MenuText[8]._line)); settextposition(12, 25); @@ -213,7 +214,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { settextposition(16, 25); outtext2(Common::String(MenuText[11]._line)); } - if (mode == 2) { + if (mode == COMPUTER_SAMANTHAS) { _vm->_eventsManager.videkey(); settextposition(10, 25); // outtext2(Common::String(MenuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy @@ -233,16 +234,16 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { if (_vm->shouldQuit()) return; - v2 = 0; + numericFlag = false; if ((uint16)(v12 - 48) <= 8u) - v2 = 1; - } while (v2 != 1); + numericFlag = true; + } while (!numericFlag); if (v12 == 48) break; if (v12 == 49) { GAMES(); - } else if (mode == 1) { + } else if (mode == COMPUTER_HOPKINS) { _vm->_eventsManager.videkey(); clearscreen(); settextcolor(4); @@ -257,7 +258,7 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { LIT_TEXTE(3); if (v12 == 53) LIT_TEXTE(4); - } else if (mode == 2) { + } else if (mode == COMPUTER_SAMANTHAS) { clearscreen(); settextcolor(4); settextposition(2, 4); @@ -283,10 +284,13 @@ void ComputerManager::COMPUT_HOPKINS(int mode) { _vm->_graphicsManager.DD_VBL(); RESTORE_POLICE(); } else { + // Access Denied settextcolor(4); settextposition(16, 25); outtext(Common::String(MenuText[5]._line)); _vm->_eventsManager.VBL(); + _vm->_eventsManager.delay(1000); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -443,7 +447,7 @@ void ComputerManager::TXT4(int xp, int yp, int a3) { v3 -= _vm->_globals.police_l; v8 = v3 + 2 * _vm->_globals.police_l; v9 = v7; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, 2 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, v8, yp + 12); _vm->_fontManager.TEXT_NOW(v3, yp, "_", -4); v7 = v9; @@ -592,7 +596,7 @@ void ComputerManager::GAMES() { _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND37.WAV"); _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); - _vm->_fileManager.CONSTRUIT_SYSTEM("_vm->_eventsManager.CASSE.SPR"); + _vm->_fileManager.CONSTRUIT_SYSTEM("CASSE.SPR"); CASSESPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); CHARGE_SCORE(); MODE_VGA256(); diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 8cccd67197..15f36cc089 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -37,6 +37,8 @@ struct MenuItem { char _line[90]; }; +enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLIC = 3 }; + class ComputerManager { private: HopkinsEngine *_vm; @@ -134,10 +136,10 @@ public: void setParent(HopkinsEngine *vm); /** - * Show Hopkin's computer - * @param mode Display mode + * Show a computer in the FBI office + * @param mode Which computer to display */ - void COMPUT_HOPKINS(int mode); + void COMPUT_HOPKINS(ComputerEnum mode); }; } // End of namespace Hopkins diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 9f2743c5b8..f91dceabde 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -50,6 +50,7 @@ EventsManager::EventsManager() { OLD_ICONE = 0; Bufferobjet = NULL; + Common::fill(&keyState[0], &keyState[256], false); _priorCounterTime = 0; _priorFrameTime = 0; } @@ -202,9 +203,12 @@ void EventsManager::pollEvents() { return; case Common::EVENT_KEYDOWN: + keyState[toupper(event.kbd.ascii)] = true; handleKey(event); return; - + case Common::EVENT_KEYUP: + keyState[toupper(event.kbd.ascii)] = false; + return; case Common::EVENT_LBUTTONDOWN: souris_b = 1; break; @@ -244,24 +248,46 @@ void EventsManager::handleKey(Common::Event &event) { } int EventsManager::keywin() { - Common::Event event; + char foundChar = '\0'; - while (!_vm->shouldQuit()) { - _vm->_soundManager.checkSounds(); - checkForNextFrameCounter(); + while (!foundChar) { + if (_vm->shouldQuit()) + return -1; + + for (char ch = 'A'; ch <= 'Z'; ++ch) { + if (keyState[ch]) { + foundChar = ch; + break; + } + } - // Handle pending events looking for keypress events - while (g_system->getEventManager()->pollEvent(event)) { - if (event.type == Common::EVENT_KEYDOWN) - return event.kbd.ascii; + for (char ch = '0'; ch <= '9'; ++ch) { + if (keyState[ch]) { + foundChar = ch; + break; + } } - // Slight delay been checks to avoid maxing CPU usage + if (keyState['.']) + foundChar = '.'; + else if (keyState[8]) + foundChar = 8; + else if (keyState[13]) + foundChar = 13; + else if (keyState[' ']) + foundChar = ' '; + + VBL(); + } + + // Wait for keypress release + while (keyState[foundChar] && !_vm->shouldQuit()) { + VBL(); g_system->delayMillis(10); } - // Game is quitting - return -1; + // Return character + return foundChar; } void EventsManager::VBL() { diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 25bd60b510..24f71c1a97 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -66,6 +66,7 @@ public: DIALOG_KEY GAME_KEY; int btsouris; byte *Bufferobjet; + bool keyState[256]; public: EventsManager(); ~EventsManager(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 0ddd257939..8fd69fa766 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -485,6 +485,7 @@ void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int co const char *srcP; char currChar; int charIndex; + int currentX = xp; srcP = message.c_str(); for (;;) { @@ -494,11 +495,12 @@ void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int co if (currChar >= 32) { charIndex = currChar - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, - xp, yp, currChar - 32, col); - xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, charIndex); + currentX, yp, currChar - 32, col); + currentX += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, charIndex); } } - _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp, yp + 12); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, currentX, yp + 12); } @@ -552,15 +554,6 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col _vm->_eventsManager.VBL(); _vm->_globals.iRegul = 1; } - - if (_vm->_eventsManager.ESC_KEY) { - _vm->_globals.iRegul = 1; - _vm->_eventsManager.VBL(); - } else { - _vm->_globals.iRegul = 4; - _vm->_eventsManager.VBL(); - _vm->_globals.iRegul = 1; - } } } while (v7); } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 7f261cb698..40d689df49 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -433,7 +433,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)_globals.SAUVEGARDE + 5) = 113; - _computerManager.COMPUT_HOPKINS(1); + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -450,7 +450,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)_globals.SAUVEGARDE + 5) = 114; - _computerManager.COMPUT_HOPKINS(2); + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); goto LABEL_128; } if (_globals.SORTIE == 115) { @@ -459,7 +459,7 @@ LABEL_124: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)_globals.SAUVEGARDE + 5) = 115; - _computerManager.COMPUT_HOPKINS(3); + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); LABEL_128: _graphicsManager.DD_Lock(); @@ -1261,7 +1261,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 113; *((byte *)_globals.SAUVEGARDE + 5) = 113; - _computerManager.COMPUT_HOPKINS(1); + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1277,7 +1277,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 114; *((byte *)_globals.SAUVEGARDE + 5) = 114; - _computerManager.COMPUT_HOPKINS(2); + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); goto LABEL_243; } switch (_globals.SORTIE) { @@ -1287,7 +1287,7 @@ LABEL_239: *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; _globals.ECRAN = 115; *((byte *)_globals.SAUVEGARDE + 5) = 115; - _computerManager.COMPUT_HOPKINS(3); + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); LABEL_243: _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); -- cgit v1.2.3 From 25a311c65b1ea33c242d741971565c2d8b86768b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 20:28:03 +1100 Subject: HOPKINS: Bugfixes for setup of Breakout sub-game --- engines/hopkins/computer.cpp | 164 +++++++++++++++++++++---------------------- engines/hopkins/computer.h | 14 +++- engines/hopkins/graphics.cpp | 2 +- 3 files changed, 93 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index f9d86d35b2..673a04517e 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -582,7 +582,7 @@ void ComputerManager::GAMES() { CASSESPR = g_PTRNUL; _vm->_eventsManager.CASSE = 1; _vm->_eventsManager.CASSE_SOURIS_ON(); - CASSETAB = g_PTRNUL; + CASSETAB = (int16 *)g_PTRNUL; NBBRIQUES = 0; CASSESCORE = 0; CASSEVIE = 5; @@ -605,7 +605,8 @@ void ComputerManager::GAMES() { PLAY_BRIQUE(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); CASSESPR = _vm->_globals.LIBERE_FICHIER(CASSESPR); - CASSETAB = _vm->_globals.dos_free2(CASSETAB); + _vm->_globals.dos_free2((byte *)CASSETAB); + CASSETAB = (int16 *)g_PTRNUL; _vm->_objectsManager.Sprite[0].spriteData = v1; _vm->_soundManager.DEL_SAMPLE(1); @@ -623,41 +624,31 @@ void ComputerManager::GAMES() { } void ComputerManager::CHARGE_SCORE() { - int v0; - int v1; - char v2; - int v3; - int v4; - char v5; + char nextChar; byte *ptr; - int v8; _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v8 = 0; - do { - v0 = 16 * v8; - v1 = 0; - do { - v2 = *(ptr + v1 + (int)(16 * v8)); - if (!v2) - v2 = 32; - *(&Score[v0] + v1++) = v2; - } while (v1 <= 4); - v3 = v0 + 6; - v4 = 0; - do { - v5 = *(ptr + v4 + v3); - if (!v5) - v5 = 48; - *(&Score[16 * v8 + 6] + v4++) = v5; - } while (v4 <= 8); - *(ptr + v3 + 9) = 0; - ++v8; - } while (v8 <= 5); + ptr = _vm->_globals.dos_malloc2(100); + _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, ptr); + + for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { + for (int i = 0; i < 5; ++i) { + nextChar = *(ptr + i + (16 * scoreIndex)); + if (!nextChar) + nextChar = ' '; + Score[scoreIndex].name += nextChar; + } + + for (int i = 0; i < 9; ++i) { + nextChar = *(ptr + i + scoreIndex * 16 + 6); + if (!nextChar) + nextChar = '0'; + Score[scoreIndex].score += nextChar; + } + } _vm->_globals.dos_free2(ptr); - CASSE_HISCORE = atol((const char *)&Score[86]); + CASSE_HISCORE = atol(Score[5].score.c_str()); } void ComputerManager::MODE_VGA256() { @@ -680,8 +671,10 @@ void ComputerManager::NEWTAB() { CASSEVIE = 11; _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); AFF_VIE(); - if (g_PTRNUL != CASSETAB) - CASSETAB = _vm->_globals.dos_free2(CASSETAB); + if (CASSETAB != (int16 *)g_PTRNUL) { + _vm->_globals.dos_free2((byte *)CASSETAB); + CASSETAB = (int16 *)g_PTRNUL; + } ++NB_TABLE; while (!_vm->shouldQuit()) { @@ -695,7 +688,7 @@ void ComputerManager::NEWTAB() { } f.close(); - CASSETAB = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + CASSETAB = (int16 *)_vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); AFF_BRIQUES(); _vm->_objectsManager.SPRITE(CASSESPR, 150, 192, 0, 13, 0, 0, 0, 0); _vm->_objectsManager.SPRITE(CASSESPR, 164, 187, 1, 14, 0, 0, 0, 0); @@ -709,40 +702,42 @@ void ComputerManager::NEWTAB() { } void ComputerManager::AFF_BRIQUES() { - int v0; - int v1; + int xp; + int yp; int v2; uint16 v3; - byte *v4; + int16 *v4; NBBRIQUES = 0; CASSESPEED = 1; v4 = CASSETAB; v3 = 0; do { - v0 = *((uint16 *)v4 + v3); - v1 = *((uint16 *)v4 + v3 + 1); - v2 = *((uint16 *)v4 + v3 + 4); - if (v0 != -1) { + xp = v4[v3]; + yp = v4[v3 + 1]; + v2 = v4[v3 + 4]; + if (xp != -1) { if (v2 <= 6) ++NBBRIQUES; + if (v2 == 3) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 17); - if (v2 == 6) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 18); - if (v2 == 5) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 19); - if (v2 == 4) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 20); - if (v2 == 1) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 21); - if (v2 == 2) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 22); - if (v2 == 31) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v0, v1, 23); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 17); + else if (v2 == 6) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 18); + else if (v2 == 5) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 19); + else if (v2 == 4) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 20); + else if (v2 == 1) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 21); + else if (v2 == 2) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 22); + else if (v2 == 31) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 23); } v3 += 6; - } while (v0 != -1); + } while (xp != -1); + IMPRIMESCORE(); } @@ -873,12 +868,12 @@ int ComputerManager::HIGHT_SCORE() { v0 = v0 + 46; v1 = 0; do { - PRINT_HSCORE(ptr, 9 * v1 + 69, v0, *(&Score[16 * v6] + v1)); + PRINT_HSCORE(ptr, 9 * v1 + 69, v0, Score[v6].name[v1]); ++v1; } while (v1 <= 5); v2 = 0; do { - PRINT_HSCORE(ptr, 9 * v2 + 199, v0, *(&Score[16 * v6 + 6] + v2)); + PRINT_HSCORE(ptr, 9 * v2 + 199, v0, Score[v6].score[v2]); ++v2; } while (v2 <= 8); ++v6; @@ -905,7 +900,7 @@ int ComputerManager::HIGHT_SCORE() { void ComputerManager::NAME_SCORE() { int v0; - int v1; + char v1; int v2; int v3; int i; @@ -931,7 +926,7 @@ void ComputerManager::NAME_SCORE() { v1 = 32; if ((uint16)(v1 - 58) <= 6u) v1 = 32; - Score[v0 + 80] = v1; + Score[5].name.setChar(v0, v1); PRINT_HSCORE(ptr, 9 * v0 + 140, 78, v1); _vm->_eventsManager.VBL(); @@ -948,14 +943,15 @@ void ComputerManager::NAME_SCORE() { _vm->_eventsManager.VBL(); ++v0; } while (v0 <= 4); - memset(&Score[86], 32, 9u); + Score[5].score = " "; + sprintf(s, "%d", CASSESCORE); v2 = 0; do ++v2; while (s[v2]); v3 = 8; - for (i = v2; ; Score[v3-- + 86] = s[i]) { + for (i = v2; ; Score[5].score.setChar(v3--, s[i])) { --i; if (i <= -1) break; @@ -1044,7 +1040,7 @@ void ComputerManager::SAUVE_SCORE() { v0 = 0; do { - v1 = atol((const char *)(16 * v0 + Score + 6)); + v1 = atol(Score[v0].score.c_str()); v17[v0] = v1; if (!v1) v17[v0] = 5; @@ -1077,7 +1073,7 @@ void ComputerManager::SAUVE_SCORE() { v14 = v16[v5]; v7 = 0; do { - v8 = *(&Score[16 * v14] + v7); + v8 = Score[v14].name[v7]; if (!v8) v8 = 32; *(ptr + (16 * v5) + v7++) = v8; @@ -1087,7 +1083,7 @@ void ComputerManager::SAUVE_SCORE() { v9 = v6 + 6; v10 = 0; do { - v11 = *(&Score[16 * v14 + 6] + v10); + v11 = Score[v14].score[v10]; if (!v11) v11 = 48; *(ptr + v9 + v10++) = v11; @@ -1211,20 +1207,20 @@ int ComputerManager::DEP_BALLE() { void ComputerManager::VERIFBRIQUES() { - __int16 v0; - __int16 v1; - __int16 v2; - __int16 v3; - signed __int16 v4; - __int16 v5; - __int16 v6; - signed __int16 v7; + int v0; + int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; uint16 v8; - byte *v9; - __int16 v10; - __int16 v11; - __int16 v12; - __int16 v13; + int16 *v9; + int v10; + int v11; + int v12; + int v13; v7 = 0; //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; @@ -1237,12 +1233,12 @@ void ComputerManager::VERIFBRIQUES() { v9 = CASSETAB; v8 = 0; do { - v1 = *((uint16 *)v9 + v8); - v11 = *((uint16 *)v9 + v8 + 1); - v2 = *((uint16 *)v9 + v8 + 2); - v10 = *((uint16 *)v9 + v8 + 3); - v3 = *((uint16 *)v9 + v8 + 4); - if (*((uint16 *)v9 + v8 + 5) != 1 || v1 == -1) + v1 = v9[v8]; + v11 = v9[v8 + 1]; + v2 = v9[v8 + 2]; + v10 = v9[v8 + 3]; + v3 = v9[v8 + 4]; + if (v9[v8 + 5] != 1 || v1 == -1) goto LABEL_60; v4 = 0; if (v13 <= v10 && v12 >= v10) { diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 15f36cc089..8605e2bf31 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -37,6 +37,11 @@ struct MenuItem { char _line[90]; }; +struct ScoreItem { + Common::String name; + Common::String score; +}; + enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLIC = 3 }; class ComputerManager { @@ -44,12 +49,12 @@ private: HopkinsEngine *_vm; MenuItem MenuText[50]; char Sup_string[200]; - byte Score[96]; + ScoreItem Score[6]; int TEXT_COL; Common::Point _textPosition; Common::Point BALLE; byte *CASSESPR; - byte *CASSETAB; + int16 *CASSETAB; bool FMOUSE; int NBBRIQUES; int CASSESCORE; @@ -122,7 +127,12 @@ private: void NEWTAB(); void AFF_BRIQUES(); void AFF_VIE(); + + /** + * Play the Breakout game + */ void PLAY_BRIQUE(); + int HIGHT_SCORE(); void NAME_SCORE(); void IMPSCORE(int a1, int a2); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f2d23c7602..b5985a1f4f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1528,7 +1528,7 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { } if (addFlag) { - assert(_vm->_globals.NBBLOC < 50); + assert(_vm->_globals.NBBLOC < 250); BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; bloc.field0 = 1; -- cgit v1.2.3 From c1bd7e26b0508dd99c1eda3eef645f142312bc83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 20:58:53 +1100 Subject: HOPKINS: Bugfixes to actually play Breakout --- engines/hopkins/computer.cpp | 16 ++++++++++------ engines/hopkins/events.cpp | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 673a04517e..2e24b1bbc6 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -580,7 +580,7 @@ void ComputerManager::GAMES() { _vm->_globals.vitesse = 1; _vm->_eventsManager.CHANGE_MOUSE(0); CASSESPR = g_PTRNUL; - _vm->_eventsManager.CASSE = 1; + _vm->_eventsManager.CASSE = true; _vm->_eventsManager.CASSE_SOURIS_ON(); CASSETAB = (int16 *)g_PTRNUL; NBBRIQUES = 0; @@ -613,7 +613,7 @@ void ComputerManager::GAMES() { _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); _vm->_globals.vitesse = v2; - _vm->_eventsManager.CASSE = 0; + _vm->_eventsManager.CASSE = false; _vm->_eventsManager.CASSE_SOURIS_OFF(); setvideomode(); settextcolor(15); @@ -775,6 +775,7 @@ void ComputerManager::PLAY_BRIQUE() { while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) { + // Set up the racket and ball _vm->_eventsManager.MOUSE_OFF(); BALLE = Common::Point(RAQX + 14, 187); _vm->_objectsManager.SETYSPR(1, 187); @@ -782,6 +783,8 @@ void ComputerManager::PLAY_BRIQUE() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.FADE_IN_CASSE(); + + // Wait for mouse press to start playing do { RAQX = _vm->_eventsManager.souris_x; if (_vm->_eventsManager.souris_x <= 4) @@ -792,16 +795,17 @@ void ComputerManager::PLAY_BRIQUE() { _vm->_objectsManager.SETXSPR(1, RAQX + 14); _vm->_objectsManager.SETYSPR(1, 187); _vm->_eventsManager.VBL(); - } while (_vm->_eventsManager.BMOUSE() != 1); + } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); CASSESPEED = 1; BALLE = Common::Point(RAQX + 14, 187); BALLEHORI = RAQX > 135; BALLEVERTI = 0; - + + // Play loop do { - RAQX = _vm->_eventsManager.souris_x; - if ((int)_vm->_eventsManager.souris_x <= 4) + RAQX = _vm->_eventsManager.XMOUSE(); + if (_vm->_eventsManager.souris_x <= 4) RAQX = 5; if (RAQX > 282) RAQX = 282; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f91dceabde..911ffcf3e1 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -405,6 +405,8 @@ LABEL_54: checkForNextFrameCounter(); while (CASSE || _vm->_globals.iRegul != 1) { + checkForNextFrameCounter(); + if (CASSE != true) goto LABEL_63; if (lItCounter > 1) -- cgit v1.2.3 From 43e0daf5d1b32f6a443a4cedd9fb932c24d211e3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 21:12:21 +1100 Subject: HOPKINS: Bugfix to allow Breakout paddle movement whilst waiting for starting click --- engines/hopkins/computer.cpp | 3 ++- engines/hopkins/computer.h | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 2e24b1bbc6..4f0fc1b5ec 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -786,7 +786,7 @@ void ComputerManager::PLAY_BRIQUE() { // Wait for mouse press to start playing do { - RAQX = _vm->_eventsManager.souris_x; + RAQX = _vm->_eventsManager.XMOUSE(); if (_vm->_eventsManager.souris_x <= 4) RAQX = 5; if (RAQX > 282) @@ -817,6 +817,7 @@ void ComputerManager::PLAY_BRIQUE() { break; _vm->_graphicsManager.FADE_OUT_CASSE(); --CASSEVIE; + if (CASSEVIE) { AFF_VIE(); if (CASSEVIE) diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 8605e2bf31..41526ee03c 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -57,11 +57,32 @@ private: int16 *CASSETAB; bool FMOUSE; int NBBRIQUES; + + /** + * Breakout score + */ int CASSESCORE; + + /** + * Number of Breakout lives remaining + */ int CASSEVIE; + + /** + * Breakout game speed + */ int CASSESPEED; + + /** + * Breakout ball horizontal position + */ int BALLEHORI; + + /** + * Breakout ball vertical position + */ int BALLEVERTI; + int NB_TABLE; int RAQX; int CASSE_HISCORE; -- cgit v1.2.3 From 62759ea2a2917ac3e94058a421942a931c316ab1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Nov 2012 21:24:24 +1100 Subject: HOPKINS: Changed computer info display to wait for a keypress after displaying --- engines/hopkins/computer.cpp | 6 +++--- engines/hopkins/events.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 4f0fc1b5ec..31f3af6162 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -110,7 +110,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { char *v9; int v10; char v11; - int v12; + char v12; char s[12]; const char *s2; @@ -241,7 +241,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { if (v12 == 48) break; - if (v12 == 49) { + if (v12 == '1') { GAMES(); } else if (mode == COMPUTER_HOPKINS) { _vm->_eventsManager.videkey(); @@ -567,7 +567,7 @@ void ComputerManager::LIT_TEXTE(int a1) { } while (v4 != 37); _vm->_eventsManager.videkey(); - _vm->_eventsManager.wingetch(); + _vm->_eventsManager.keywin(); _vm->_globals.dos_free2(ptr); } diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 24f71c1a97..94ce87f8a1 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -108,11 +108,6 @@ public: * Unused by engine */ void CASSE_SOURIS_OFF() { } - - void wingetch() { - // TODO - warning("TODO: wingetch"); - } }; } // End of namespace Hopkins -- cgit v1.2.3 From 2af626c3af4674bf9c46a1743f6cb2f3f352ba18 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 Nov 2012 00:15:52 +0100 Subject: HOPKINS: Partially fix entering high scores. Still far from perfect. --- engines/hopkins/computer.cpp | 47 ++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 31f3af6162..61592b89a3 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -904,13 +904,8 @@ int ComputerManager::HIGHT_SCORE() { } void ComputerManager::NAME_SCORE() { - int v0; - char v1; - int v2; - int v3; - int i; + char curChar; byte *ptr; - char s[16]; _vm->_graphicsManager.LOAD_IMAGEVGA("NAME.PCX"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -920,19 +915,18 @@ void ComputerManager::NAME_SCORE() { _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_graphicsManager.FADE_IN_CASSE(); - v0 = 0; + int strPos = 0; do { - PRINT_HSCORE(ptr, 9 * v0 + 140, 78, 1); - - v1 = toupper(_vm->_eventsManager.keywin()); - if (v1 <= 47) - v1 = 32; - if (v1 > 90) - v1 = 32; - if ((uint16)(v1 - 58) <= 6u) - v1 = 32; - Score[5].name.setChar(v0, v1); - PRINT_HSCORE(ptr, 9 * v0 + 140, 78, v1); + PRINT_HSCORE(ptr, 9 * strPos + 140, 78, 1); + + curChar = toupper(_vm->_eventsManager.keywin()); + if ((curChar <= '/') || (curChar > 'Z')) + curChar = ' '; + if ((uint16)(curChar - 58) <= 6u) + curChar = ' '; + + Score[5].name.setChar(curChar, strPos); + PRINT_HSCORE(ptr, 9 * strPos + 140, 78, curChar); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); @@ -946,17 +940,18 @@ void ComputerManager::NAME_SCORE() { _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); - ++v0; - } while (v0 <= 4); + ++strPos; + } while (strPos <= 4); Score[5].score = " "; - sprintf(s, "%d", CASSESCORE); - v2 = 0; + char score[16]; + sprintf(score, "%d", CASSESCORE); + int scoreLen = 0; do - ++v2; - while (s[v2]); - v3 = 8; - for (i = v2; ; Score[5].score.setChar(v3--, s[i])) { + ++scoreLen; + while (score[scoreLen]); + int scorePos = 8; + for (int i = scoreLen; ; Score[5].score.setChar(score[i], scorePos--)) { --i; if (i <= -1) break; -- cgit v1.2.3 From dd241bd41cba5d0bfac0ace58f4924f61840b207 Mon Sep 17 00:00:00 2001 From: Alex Bevilacqua Date: Tue, 20 Nov 2012 09:36:54 -0500 Subject: HOPKINS: fix compilation (Linux) --- engines/hopkins/computer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 61592b89a3..d858f50e7b 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -962,9 +962,9 @@ void ComputerManager::NAME_SCORE() { } void ComputerManager::IMPRIMESCORE() { - __int16 v0; - __int16 v1; - __int16 i; + int16 v0; + int16 v1; + int16 i; char s[40]; sprintf(s, "%d", CASSESCORE); @@ -981,8 +981,8 @@ void ComputerManager::IMPRIMESCORE() { } void ComputerManager::IMPSCORE(int a1, int a2) { - signed __int16 v2; - __int16 v3; + int16 v2; + int16 v3; v2 = 203; v3 = 3; @@ -1120,9 +1120,9 @@ void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { int ComputerManager::DEP_BALLE() { int v0; - __int16 v1; + int16 v1; int v2; - signed __int16 v4; + int16 v4; v4 = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; -- cgit v1.2.3 From 7bd46c4ee065832025a360b846f1ffc3ffb89848 Mon Sep 17 00:00:00 2001 From: Alex Bevilacqua Date: Tue, 20 Nov 2012 09:37:40 -0500 Subject: HOPKINS: add another detetction entry for the Win95 full game --- engines/hopkins/detection_tables.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 54c0fc9cbb..50152cfb4c 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -105,6 +105,23 @@ static const HopkinsGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { + // Hopkins FBI Win95, provided by alexbevi + // Dec 15 1998 hopkins.exe + { + "hopkins", + 0, + { + {"Hopkins.exe", 0, "a587762dd50d5933e1c89f9975180764", 378694}, + {"RES_VAN.RES", 0, "f1693ac0b0859c8ecd8cb30ff43cf55f", 38296346}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, { // Hopkins FBI Linux, provided by Strangerke { -- cgit v1.2.3 From ec81dfb65585ee2cd0c5da9de35b54cb5ca8f37f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 Nov 2012 00:20:55 +0100 Subject: HOPKINS: Fix potential problem reported by alexbevi, cleanup variables in INTRORUN --- engines/hopkins/hopkins.cpp | 105 ++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 72 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 40d689df49..64b7de2f94 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1479,25 +1479,6 @@ void HopkinsEngine::INIT_SYSTEM() { } void HopkinsEngine::INTRORUN() { - signed int v2; - signed int v3; - uint16 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; - int v21; - char v22; - char v23; byte paletteData[PALETTE_EXT_BLOCK_SIZE]; byte paletteData2[PALETTE_EXT_BLOCK_SIZE]; @@ -1533,33 +1514,28 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _globals.BPP_NOAFF = true; - v2 = 0; - do { + for (int i = 0; i <= 4; i++) _eventsManager.VBL(); - ++v2; - } while (v2 <= 4); _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); if (_graphicsManager.DOUBLE_ECRAN == true) { _graphicsManager.no_scroll = 2; - v3 = 0; + bool v3 = false; _graphicsManager.SCROLL = 0; do { _graphicsManager.SCROLL += 2; if (_graphicsManager.SCROLL > (SCREEN_WIDTH - 2)) { _graphicsManager.SCROLL = SCREEN_WIDTH; - v3 = 1; + v3 = true; } - if (_eventsManager.XMOUSE() < _graphicsManager.SCROLL + 10) { - v4 = _eventsManager.YMOUSE(); - _eventsManager.souris_xy(_eventsManager.souris_x + 4, v4); - } + if (_eventsManager.XMOUSE() < _graphicsManager.SCROLL + 10) + _eventsManager.souris_xy(_eventsManager.souris_x + 4, _eventsManager.YMOUSE()); _eventsManager.VBL(); - } while (!shouldQuit() && v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); + } while (!shouldQuit() && !v3 && _graphicsManager.SCROLL != SCREEN_WIDTH); _eventsManager.VBL(); _graphicsManager.no_scroll = 0; @@ -1584,17 +1560,14 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _globals.BPP_NOAFF = true; - v5 = 0; - - do { + + for (int i = 0; i <= 4; i++) _eventsManager.VBL(); - ++v5; - } while (v5 <= 4); _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - for (i = 0; i < 200 / _globals.vitesse; ++i) + for (int i = 0; i < 200 / _globals.vitesse; ++i) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); @@ -1602,9 +1575,10 @@ void HopkinsEngine::INTRORUN() { _objectsManager.BOBANIM_OFF(3); _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); - v21 = *(uint16 *)&_graphicsManager.Palette[796]; - v22 = _graphicsManager.Palette[798]; - v7 = (int)&v23; + + // CHECKME: Useless variables? + // v21 = *(uint16 *)&_graphicsManager.Palette[796]; + // v22 = _graphicsManager.Palette[798]; _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); _graphicsManager.FIN_VISU(); @@ -1634,18 +1608,15 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _globals.BPP_NOAFF = true; - v8 = 0; - - do { + + for (int i = 0; i <= 3; i++) _eventsManager.VBL(); - ++v8; - } while (v8 <= 3); _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); - v9 = 0; - + + int v9 = 0; while (!shouldQuit() && !_eventsManager.ESC_KEY) { if (v9 == 12) { _objectsManager.BOBANIM_ON(3); @@ -1657,57 +1628,47 @@ void HopkinsEngine::INTRORUN() { 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); - + + + for (int i = 1, v12 = 4 * v9; i <= PALETTE_BLOCK_SIZE; i++) { + if (_graphicsManager.Palette[i] > v12) + _graphicsManager.Palette[i] -= v12; + } + _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); - v13 = 1; - + + if (2 * v9 > 1) { - v7 = 2 * v9; - - do { + for (int i = 1; i < 2 * v9; i++) _eventsManager.VBL(); - ++v13; - } while (v13 < v7); } _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); - v14 = 1; - if (20 - v9 > 1) { - v7 = 20 - v9; - - do { + if (20 - v9 > 1) { + for (int i = 1; i < 20 - v9; i++) _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) + for (int j = 1; j < 100 / _globals.vitesse; ++j) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _objectsManager.BOBANIM_OFF(3); - for (k = 1; k < 60 / _globals.vitesse; ++k) + for (int k = 1; k < 60 / _globals.vitesse; ++k) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(5); - for (l = 0; l < 20 / _globals.vitesse; ++l) + for (int 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) { + for (int m = 0; m < 50 / _globals.vitesse; ++m) { if (m == 30 / _globals.vitesse) { _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(8, 3); -- cgit v1.2.3 From 8e376ccc81afc994c6441399aa5c50886a91f241 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 Nov 2012 08:04:50 +0100 Subject: HOPKINS: Clean up some 'for' statements --- engines/hopkins/anim.cpp | 7 +--- engines/hopkins/computer.cpp | 94 +++++++++++++++++--------------------------- engines/hopkins/dialogs.cpp | 21 +++------- engines/hopkins/hopkins.cpp | 57 ++++----------------------- 4 files changed, 50 insertions(+), 129 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 0531f43267..43b7229f19 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -873,7 +873,6 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count int v11; int v12; int v13; - int v14; int v15; int v16; int v17; @@ -929,8 +928,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count WRITE_LE_UINT16(dataP + 26, v12); *(dataP + 28) = v13; - v14 = 1; - do { + for (int v14 = 1; v14 <= 4999; v14++) { v9 += 10; v23 += 10; if (!v22) @@ -947,8 +945,7 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count WRITE_LE_UINT16(v9 + 4, v22); WRITE_LE_UINT16(v9 + 6, v16); *(v9 + 8) = v17; - ++v14; - } while (v14 <= 4999); + } v3 = 1; } } diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 61592b89a3..04e3e2dfb2 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -742,20 +742,17 @@ void ComputerManager::AFF_BRIQUES() { } void ComputerManager::AFF_VIE() { - int v0; - int v1; - int v2; int v3; int v4; - v0 = CASSEVIE - 1; - v1 = 10; - v2 = 0; - do { + int v0 = CASSEVIE - 1; + int v1 = 10; + + for (int v2 = 0; v2 <= 11; v2++) { _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, 10, 15); v1 += 7; - ++v2; - } while (v2 <= 11); + } + if (v0) { v3 = 10; v4 = 0; @@ -851,11 +848,8 @@ void ComputerManager::PLAY_BRIQUE() { int ComputerManager::HIGHT_SCORE() { int v0; - int v1; - int v2; int v3; int v4; - int v6; byte *ptr; _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -867,22 +861,18 @@ int ComputerManager::HIGHT_SCORE() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - v6 = 0; - do { + + for (int v6 = 0; v6 <= 5; v6++) { v0 = 19 * v6; - v0 = v0 + 46; - v1 = 0; - do { + v0 += 46; + for (int v1 = 0; v1 <= 5; v1++) PRINT_HSCORE(ptr, 9 * v1 + 69, v0, Score[v6].name[v1]); - ++v1; - } while (v1 <= 5); - v2 = 0; - do { + + for (int v2 = 0; v2 <= 8; v2++) PRINT_HSCORE(ptr, 9 * v2 + 199, v0, Score[v6].score[v2]); - ++v2; - } while (v2 <= 8); - ++v6; - } while (v6 <= 5); + + } + _vm->_graphicsManager.FADE_IN_CASSE(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); v3 = 0; @@ -915,8 +905,7 @@ void ComputerManager::NAME_SCORE() { _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); _vm->_graphicsManager.FADE_IN_CASSE(); - int strPos = 0; - do { + for (int strPos = 0; strPos <= 4; strPos++) { PRINT_HSCORE(ptr, 9 * strPos + 140, 78, 1); curChar = toupper(_vm->_eventsManager.keywin()); @@ -940,8 +929,7 @@ void ComputerManager::NAME_SCORE() { _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); - ++strPos; - } while (strPos <= 4); + } Score[5].score = " "; char score[16]; @@ -1020,77 +1008,65 @@ void ComputerManager::IMPSCORE(int a1, int a2) { } void ComputerManager::SAUVE_SCORE() { - int v0; int v1; int v2; - int v3; int v4; - int v5; int v6; - int v7; char v8; int v9; - int v10; char v11; - int v13; int v14; byte *ptr; int v16[6]; int v17[6]; - v0 = 0; - do { + for (int v0 = 0; v0 <= 5; v0++) { v1 = atol(Score[v0].score.c_str()); v17[v0] = v1; if (!v1) v17[v0] = 5; - ++v0; - } while (v0 <= 5); - v13 = 0; - do { + } + + for (int v13 = 0; v13 <= 5; v13++) { v2 = 0; - v3 = 0; + bool v3 = false; do { v4 = v17[v2]; if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4 && v17[4] <= v4 && v17[5] <= v4) - v3 = 1; - if (v3 == 1) { + v3 = true; + if (v3) { v16[v13] = v2; v17[v2] = 0; } else { ++v2; } - } while (v3 != 1); - ++v13; - } while (v13 <= 5); + } while (!v3); + } ptr = _vm->_globals.dos_malloc2(0x64u); memset(ptr, 0, 0x63u); - v5 = 0; - do { + for (int v5 = 0; v5 <= 5; v5++) { v6 = 16 * v5; v14 = v16[v5]; - v7 = 0; - do { + for (int v7 = 0; v7 <= 4; v7++) { v8 = Score[v14].name[v7]; if (!v8) v8 = 32; - *(ptr + (16 * v5) + v7++) = v8; - } while (v7 <= 4); + *(ptr + (16 * v5) + v7) = v8; + }; *(ptr + v6 + 5) = 0; v9 = v6 + 6; - v10 = 0; - do { + + for (int v10 = 0; v10 <= 8; v10++) { v11 = Score[v14].score[v10]; if (!v11) v11 = 48; - *(ptr + v9 + v10++) = v11; - } while (v10 <= 8); + *(ptr + v9 + v10) = v11; + }; *(ptr + v9 + 9) = 0; - ++v5; - } while (v5 <= 5); + } _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 4013afd775..c3821e9ba2 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -301,10 +301,8 @@ void DialogsManager::showOptionsDialog() { } void DialogsManager::showInventory() { - int v1; size_t filesize; int v4; - int v5; int v6; byte *v7; int v8; @@ -313,7 +311,6 @@ void DialogsManager::showInventory() { int v11; int v12; int v13; - int v14; int v15; int v16; int v17; @@ -327,14 +324,12 @@ void DialogsManager::showInventory() { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; _vm->_objectsManager.FLAG_VISIBLE = false; - v1 = 0; - do { + for (int v1 = 0; v1 <= 1; v1++) { INVENT_ANIM(); _vm->_eventsManager.XMOUSE(); _vm->_eventsManager.YMOUSE(); _vm->_eventsManager.VBL(); - ++v1; - } while (v1 <= 1); + } _vm->_dialogsManager.Winventaire = g_PTRNUL; LABEL_7: @@ -376,11 +371,9 @@ LABEL_7: v19 + 300, 414, 0, 0, 0, 0); v15 = 0; v4 = 0; - v14 = 1; - do { + for (int v14 = 1; v14 <= 5; v14++) { v16 = 0; - v5 = 1; - do { + for (int v5 = 1; v5 <= 6; v5++) { ++v4; v6 = _vm->_globals.INVENTAIRE[v4]; if (v6 && v4 <= 29) { @@ -390,11 +383,9 @@ LABEL_7: _vm->_globals.dos_free2(v7); } v16 += 54; - ++v5; - } while (v5 <= 6); + }; v15 += 38; - ++v14; - } while (v14 <= 5); + } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, inventairex, inventairey, inventairel, inventaireh); _vm->_eventsManager.souris_bb = 0; v20 = 0; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 64b7de2f94..4ce2f0ec3d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1837,8 +1837,6 @@ void HopkinsEngine::PUBQUIT() { } void HopkinsEngine::INCENDIE() { - warning("INCENDIE()"); - _globals.DESACTIVE_INVENT = true; _globals.iRegul = 1; _graphicsManager.LOAD_IMAGE("IM71"); @@ -1850,31 +1848,22 @@ void HopkinsEngine::INCENDIE() { _graphicsManager.VISU_ALL(); _globals.BPP_NOAFF = true; - int cpt = 0; - do { + for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - ++cpt; - } while (cpt <= 4); _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _globals.iRegul = 1; - cpt = 0; - do { + for (int cpt = 0; cpt <= 249; cpt++) _eventsManager.VBL(); - ++cpt; - } while (cpt <= 249); _globals.NOPARLE = true; _talkManager.PARLER_PERSO("SVGARD1.pe2"); _globals.NOPARLE = false; - cpt = 0; - do { + for (int cpt = 0; cpt <= 49; cpt++) _eventsManager.VBL(); - ++cpt; - } while (cpt <= 49); _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); @@ -1883,8 +1872,6 @@ void HopkinsEngine::INCENDIE() { } void HopkinsEngine::BASE() { - warning("BASE()"); - _globals.iRegul = 1; _graphicsManager.nbrligne = 640; _graphicsManager.DD_Lock(); @@ -1919,8 +1906,7 @@ void HopkinsEngine::BASE() { _graphicsManager.FADE_LINUX = 2; _animationManager.PLAY_ANM("OC30.anm", 10, 18, 18); } - } - if (_globals.SVGA == 2) { + } else if (_globals.SVGA == 2) { _animationManager.PLAY_ANM("base00a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) _animationManager.PLAY_ANM("base05a.anm", 10, 18, 18); @@ -1955,8 +1941,6 @@ void HopkinsEngine::BASE() { } void HopkinsEngine::BASED() { - warning("BASED()"); - _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1975,11 +1959,8 @@ void HopkinsEngine::BASED() { _objectsManager.INILINK("IM92"); _globals.BPP_NOAFF = true; - int cpt = 0; - do { + for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - ++cpt; - } while (cpt <= 4); _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); @@ -1998,8 +1979,6 @@ void HopkinsEngine::BASED() { } void HopkinsEngine::JOUE_FIN() { - warning("JOUE_FIN()"); - _globals.PERSO = _globals.dos_free2(_globals.PERSO); _dialogsManager.VIRE_INVENT = true; _globals.DESACTIVE_INVENT = true; @@ -2027,11 +2006,8 @@ void HopkinsEngine::JOUE_FIN() { _eventsManager.CHANGE_MOUSE(0); _globals.BPP_NOAFF = true; - int cpt = 0; - do { + for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - ++cpt; - } while (cpt <= 4); _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); @@ -2158,8 +2134,6 @@ void HopkinsEngine::JOUE_FIN() { } void HopkinsEngine::AVION() { - warning("AVION()"); - _soundManager.WSOUND(28); _globals.iRegul = 1; _globals.nbrligne = 640; @@ -2240,8 +2214,6 @@ void HopkinsEngine::AVION() { } int HopkinsEngine::PWBASE() { - warning("PWBASE()"); - _globals.DESACTIVE_INVENT = true; _graphicsManager.LOAD_IMAGE("PBASE"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -2321,8 +2293,6 @@ int HopkinsEngine::PWBASE() { } void HopkinsEngine::Charge_Credits() { - warning("Charge_Credits()"); - _globals.Credit_y = 440; _globals.Credit_l = 10; _globals.Credit_h = 40; @@ -2387,8 +2357,6 @@ void HopkinsEngine::Charge_Credits() { } void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { - warning("CREDIT_AFFICHE"); - byte *bufPtr = buffer; int strWidth = 0; byte curChar; @@ -2430,8 +2398,6 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { } void HopkinsEngine::Credits() { - warning("Credits()"); - Charge_Credits(); _globals.Credit_y = 436; _graphicsManager.LOAD_IMAGE("GENERIC"); @@ -2494,8 +2460,6 @@ void HopkinsEngine::Credits() { } void HopkinsEngine::BTOCEAN() { - warning("BTOCEAN()"); - _fontManager.TEXTE_OFF(9); if (_eventsManager.btsouris == 16) { _eventsManager.XMOUSE(); @@ -2684,8 +2648,6 @@ LABEL_91: } void HopkinsEngine::OCEAN_HOME() { - warning("OCEAN_HOME()"); - if (_globals.OCEAN_SENS == 3) _objectsManager.SETANISPR(0, 0); if (_globals.OCEAN_SENS == 7) @@ -2697,8 +2659,6 @@ void HopkinsEngine::OCEAN_HOME() { } void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { - warning("OCEAN()"); - _globals.PLAN_FLAG = false; _graphicsManager.NOFADE = false; _globals.NOMARCHE = false; @@ -2757,11 +2717,8 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _eventsManager.MOUSE_ON(); _eventsManager.CHANGE_MOUSE(4); - int cpt = 0; - do { + for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - ++cpt; - } while (cpt <= 4); if (!_graphicsManager.NOFADE) _graphicsManager.FADE_INW(); -- cgit v1.2.3 From f9a58d0aaa8fc1591028b9b877bcd181b3e5006e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 21 Nov 2012 21:59:35 +1100 Subject: HOPKINS: Enable cursor animations like the original --- engines/hopkins/events.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 911ffcf3e1..e6dbf347fb 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -397,6 +397,8 @@ LABEL_45: _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, yp + 300, souris_n); */ + + _vm->_eventsManager.updateCursor(); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); LABEL_54: _vm->_globals.vitesse = 2; -- cgit v1.2.3 From cbbc9287881514743860ce7475ec4b62c78b3940 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 Nov 2012 22:42:51 +0100 Subject: HOPKINS: some renaming and reworking --- dists/msvc9/create_msvc9.bat | 6 ++--- engines/hopkins/dialogs.cpp | 64 ++++++++++++++++++++++++-------------------- engines/hopkins/hopkins.cpp | 18 ++++++------- engines/hopkins/hopkins.h | 2 +- 4 files changed, 48 insertions(+), 42 deletions(-) diff --git a/dists/msvc9/create_msvc9.bat b/dists/msvc9/create_msvc9.bat index 1622cd9037..8b6f289161 100644 --- a/dists/msvc9/create_msvc9.bat +++ b/dists/msvc9/create_msvc9.bat @@ -53,21 +53,21 @@ goto done echo. echo Creating project files with all engines enabled (stable and unstable) echo. -create_project ..\.. --enable-all-engines --msvc --msvc-version 9 +create_project ..\.. --enable-all-engines --msvc --msvc-version 9 --disable-taskbar --disable-freetype goto done :stable echo. echo Creating normal project files, with only the stable engines enabled echo. -create_project ..\.. --msvc --msvc-version 9 +create_project ..\.. --msvc --msvc-version 9 --disable-taskbar --disable-freetype goto done :tools echo. echo Creating tools project files echo. -create_project ..\.. --tools --msvc --msvc-version 9 +create_project ..\.. --tools --msvc --msvc-version 9 --disable-taskbar --disable-freetype goto done :clean_check diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index c3821e9ba2..e20409a3b4 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -243,13 +243,14 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_graphicsManager.MANU_SCROLL) _vm->_globals.opt_scrtype = 2; - if (_vm->_graphicsManager.MANU_SCROLL == 1) + else if (_vm->_graphicsManager.MANU_SCROLL == 1) _vm->_globals.opt_scrtype = 1; + if (_vm->_globals.vitesse == 1) _vm->_globals.opt_vitesse = 6; - if (_vm->_globals.vitesse == 2) + else if (_vm->_globals.vitesse == 2) _vm->_globals.opt_vitesse = 5; - if (_vm->_globals.vitesse == 3) + else if (_vm->_globals.vitesse == 3) _vm->_globals.opt_vitesse = 4; _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; @@ -259,33 +260,34 @@ void DialogsManager::showOptionsDialog() { if (_vm->_globals.SVGA == 1) _vm->_globals.opt_anm = 10; - if (_vm->_globals.SVGA == 2) + else if (_vm->_globals.SVGA == 2) _vm->_globals.opt_anm = 9; - if (_vm->_globals.SVGA == 3) + else if (_vm->_globals.SVGA == 3) _vm->_globals.opt_anm = 11; + if (_vm->_graphicsManager.SPEED_SCROLL == 1) _vm->_globals.opt_scrspeed = 12; - if (_vm->_graphicsManager.SPEED_SCROLL == 2) + else if (_vm->_graphicsManager.SPEED_SCROLL == 2) _vm->_globals.opt_scrspeed = 13; - if (_vm->_graphicsManager.SPEED_SCROLL == 4) + else if (_vm->_graphicsManager.SPEED_SCROLL == 4) _vm->_globals.opt_scrspeed = 14; - if (_vm->_graphicsManager.SPEED_SCROLL == 8) + else if (_vm->_graphicsManager.SPEED_SCROLL == 8) _vm->_globals.opt_scrspeed = 15; - if (_vm->_graphicsManager.SPEED_SCROLL == 16) + else if (_vm->_graphicsManager.SPEED_SCROLL == 16) _vm->_globals.opt_scrspeed = 16; - if (_vm->_graphicsManager.SPEED_SCROLL == 32) + else if (_vm->_graphicsManager.SPEED_SCROLL == 32) _vm->_globals.opt_scrspeed = 17; - if (_vm->_graphicsManager.SPEED_SCROLL == 48) + else if (_vm->_graphicsManager.SPEED_SCROLL == 48) _vm->_globals.opt_scrspeed = 18; - if (_vm->_graphicsManager.SPEED_SCROLL == 64) + else if (_vm->_graphicsManager.SPEED_SCROLL == 64) _vm->_globals.opt_scrspeed = 19; - if (_vm->_graphicsManager.SPEED_SCROLL == 128) + else if (_vm->_graphicsManager.SPEED_SCROLL == 128) _vm->_globals.opt_scrspeed = 20; - if (_vm->_graphicsManager.SPEED_SCROLL == 160) + else if (_vm->_graphicsManager.SPEED_SCROLL == 160) _vm->_globals.opt_scrspeed = 21; - if (_vm->_graphicsManager.SPEED_SCROLL == 320) + else if (_vm->_graphicsManager.SPEED_SCROLL == 320) _vm->_globals.opt_scrspeed = 22; - if (_vm->_graphicsManager.SPEED_SCROLL == 640) + else if (_vm->_graphicsManager.SPEED_SCROLL == 640) _vm->_globals.opt_scrspeed = 23; _vm->_eventsManager.VBL(); @@ -731,33 +733,37 @@ int DialogsManager::CHERCHE_PARTIE() { } if ((uint16)(yp - 388) <= 0x10u && xp > _vm->_graphicsManager.ofscroll + 273 && xp < _vm->_graphicsManager.ofscroll + 355) slotNumber = 7; - if (slotNumber == 1) { + + switch (slotNumber) { + case 1: _vm->_objectsManager.SL_X = 189; _vm->_objectsManager.SL_Y = 111; - } - if (slotNumber == 2) { + break; + case 2: _vm->_objectsManager.SL_X = 322; _vm->_objectsManager.SL_Y = 111; - } - if (slotNumber == 3) { + break; + case 3: _vm->_objectsManager.SL_X = 189; _vm->_objectsManager.SL_Y = 202; - } - if (slotNumber == 4) { + break; + case 4: _vm->_objectsManager.SL_X = 322; _vm->_objectsManager.SL_Y = 202; - } - if (slotNumber == 5) { + break; + case 5: _vm->_objectsManager.SL_X = 189; _vm->_objectsManager.SL_Y = 293; - } - if (slotNumber == 6) { + break; + case 6: _vm->_objectsManager.SL_X = 322; _vm->_objectsManager.SL_Y = 293; - } - if (slotNumber == 7 || !slotNumber) { + break; + case 0: + case 7: _vm->_objectsManager.SL_X = 0; _vm->_objectsManager.SL_Y = 0; + break; } return slotNumber; } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4ce2f0ec3d..0c76ab307d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2658,7 +2658,7 @@ void HopkinsEngine::OCEAN_HOME() { _objectsManager.SETANISPR(0, 9); } -void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9) { +void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9) { _globals.PLAN_FLAG = false; _graphicsManager.NOFADE = false; _globals.NOMARCHE = false; @@ -2681,13 +2681,13 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 else if (a1 == 91) _objectsManager.INILINK("IM91"); - if (!a5) + if (!exit1) _objectsManager.ZONE_OFF(1); - if (!a6) + if (!exit2) _objectsManager.ZONE_OFF(2); - if (!a7) + if (!exit3) _objectsManager.ZONE_OFF(3); - if (!a8) + if (!exit4) _objectsManager.ZONE_OFF(4); if (!_globals.OCEAN_SENS) _globals.OCEAN_SENS = a4; @@ -2738,13 +2738,13 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 } while (!loopCond); if (_globals.SORTIE == 1) - _globals.SORTIE = a5; + _globals.SORTIE = exit1; if (_globals.SORTIE == 2) - _globals.SORTIE = a6; + _globals.SORTIE = exit2; if (_globals.SORTIE == 3) - _globals.SORTIE = a7; + _globals.SORTIE = exit3; if (_globals.SORTIE == 4) - _globals.SORTIE = a8; + _globals.SORTIE = exit4; _graphicsManager.FADE_OUTW(); _objectsManager.SPRITE_OFF(0); _globals.AFFLI = false; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 73e57d336b..bd071eda0c 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -100,7 +100,7 @@ private: int PWBASE(); void BTOCEAN(); void OCEAN_HOME(); - void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 a5, int16 a6, int16 a7, int16 a8, int16 a9); + void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9); void Charge_Credits(); void CREDIT_AFFICHE(int startPosY, byte *buffer, char colour); void Credits(); -- cgit v1.2.3 From 42bafc57195e23dc8bee0e323d01454a77af104f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 Nov 2012 23:55:16 +0100 Subject: HOPKINS: Fix problem with some keys (A, Z, Q, M on Azerty keyboards) --- engines/hopkins/events.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index e6dbf347fb..e66ecd3bb8 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -211,19 +211,24 @@ void EventsManager::pollEvents() { return; case Common::EVENT_LBUTTONDOWN: souris_b = 1; - break; + return; case Common::EVENT_RBUTTONDOWN: souris_b = 2; - break; + return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: souris_b = 0; return; - default: break; } } + + for (char chr = 'A'; chr <= 'Z'; chr++) + keyState[chr] = false; + + for (char chr = '0'; chr <= '9'; chr++) + keyState[chr] = false; } void EventsManager::handleKey(Common::Event &event) { @@ -271,8 +276,10 @@ int EventsManager::keywin() { if (keyState['.']) foundChar = '.'; else if (keyState[8]) + // BACKSPACE foundChar = 8; else if (keyState[13]) + // ENTER foundChar = 13; else if (keyState[' ']) foundChar = ' '; -- cgit v1.2.3 From 60a154a5d7b2de92527c34d8a99fd36bff135314 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Nov 2012 00:03:26 +0100 Subject: HOPKINS: Fix erroneous modification in create_msvc9 --- dists/msvc9/create_msvc9.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dists/msvc9/create_msvc9.bat b/dists/msvc9/create_msvc9.bat index 8b6f289161..1622cd9037 100644 --- a/dists/msvc9/create_msvc9.bat +++ b/dists/msvc9/create_msvc9.bat @@ -53,21 +53,21 @@ goto done echo. echo Creating project files with all engines enabled (stable and unstable) echo. -create_project ..\.. --enable-all-engines --msvc --msvc-version 9 --disable-taskbar --disable-freetype +create_project ..\.. --enable-all-engines --msvc --msvc-version 9 goto done :stable echo. echo Creating normal project files, with only the stable engines enabled echo. -create_project ..\.. --msvc --msvc-version 9 --disable-taskbar --disable-freetype +create_project ..\.. --msvc --msvc-version 9 goto done :tools echo. echo Creating tools project files echo. -create_project ..\.. --tools --msvc --msvc-version 9 --disable-taskbar --disable-freetype +create_project ..\.. --tools --msvc --msvc-version 9 goto done :clean_check -- cgit v1.2.3 From 7d146d5ed3ef6ef9e41e902ad5d2cbedb935c9bf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Nov 2012 00:18:54 +0100 Subject: HOPKINS: Cleanup TXT4() --- engines/hopkins/computer.cpp | 217 +++++++++++++++++++++---------------------- engines/hopkins/computer.h | 2 +- 2 files changed, 107 insertions(+), 112 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index e7c43c0e37..ee322cdda2 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -343,137 +343,132 @@ void ComputerManager::Charge_Menu() { _vm->_globals.dos_free2(ptr); } -void ComputerManager::TXT4(int xp, int yp, int a3) { - int v3; - bool v4, v12; - char v5; - int v6; - char v7; - int v8; - byte v9; - int textIndex; - char newChar; +void ComputerManager::TXT4(int xp, int yp, int textIdx) { + char curChar; + char newChar; + char mappedChar; Common::String charString; - v3 = xp; - textIndex = 0; - v4 = v12 = _vm->_eventsManager.souris_flag; + int x1 = xp; + int x2 = 0; + + int textIndex = 0; + bool oldMouseFlag = _vm->_eventsManager.souris_flag; _vm->_eventsManager.souris_flag = false; _vm->_fontManager.TEXT_NOW(xp, yp, "_", -4); do { - v5 = _vm->_eventsManager.keywin(); + curChar = _vm->_eventsManager.keywin(); if (_vm->shouldQuit()) return; - v6 = v5; - v7 = 42; - if (v5 == 45) - v7 = 45; - if (v5 == 48) - v7 = 48; - if (v5 == 49) - v7 = 49; - if (v5 == 50) - v7 = 50; - if (v5 == 51) - v7 = 51; - if (v5 == 52) - v7 = 52; - if (v5 == 53) - v7 = 53; - if (v5 == 54) - v7 = 54; - if (v5 == 55) - v7 = 55; - if (v5 == 56) - v7 = 56; - if (v5 == 57) - v7 = 57; - if (v5 == 65 || v5 == 97) - v7 = 65; - if (v5 == 66 || v5 == 98) - v7 = 66; - if (v5 == 67 || v5 == 99) - v7 = 67; - if (v5 == 68 || v5 == 100) - v7 = 68; - if (v5 == 69 || v5 == 101) - v7 = 69; - if (v5 == 70 || v5 == 102) - v7 = 70; - if (v5 == 71 || v5 == 103) - v7 = 71; - if (v5 == 72 || v5 == 104) - v7 = 72; - if (v5 == 73 || v5 == 105) - v7 = 73; - if (v5 == 74 || v5 == 106) - v7 = 74; - if (v5 == 75 || v5 == 107) - v7 = 75; - if (v5 == 76 || v5 == 108) - v7 = 76; - if (v5 == 77 || v5 == 109) - v7 = 77; - if (v5 == 78 || v5 == 110) - v7 = 78; - if (v5 == 79 || v5 == 111) - v7 = 79; - if (v5 == 80 || v5 == 112) - v7 = 80; - if (v5 == 81 || v5 == 113) - v7 = 81; - if (v5 == 82 || v5 == 114) - v7 = 82; - if (v5 == 83 || v5 == 115) - v7 = 83; - if (v5 == 84 || v5 == 116) - v7 = 84; - if (v5 == 85 || v5 == 117) - v7 = 85; - if (v5 == 86 || v5 == 118) - v7 = 86; - if (v5 == 87 || v5 == 119) - v7 = 87; - if (v5 == 88 || v5 == 120) - v7 = 88; - if (v5 == 89 || v5 == 121) - v7 = 89; - if (v5 == 90 || v5 == 122) - v7 = 90; - if (v5 == 8 && textIndex > 0) { + mappedChar = '*'; + + if (curChar == '-') + mappedChar = 45; + else if (curChar == '0') + mappedChar = 48; + else if (curChar == '1') + mappedChar = 49; + else if (curChar == '2') + mappedChar = 50; + else if (curChar == '3') + mappedChar = 51; + else if (curChar == '4') + mappedChar = 52; + else if (curChar == '5') + mappedChar = 53; + else if (curChar == '6') + mappedChar = 54; + else if (curChar == '7') + mappedChar = 55; + else if (curChar == '8') + mappedChar = 56; + else if (curChar == '9') + mappedChar = 57; + else if (curChar == 'A' || curChar == 'a') + mappedChar = 65; + else if (curChar == 'B' || curChar == 'b') + mappedChar = 66; + else if (curChar == 'C' || curChar == 'c') + mappedChar = 67; + else if (curChar == 'D' || curChar == 'd') + mappedChar = 68; + else if (curChar == 'E' || curChar == 'e') + mappedChar = 69; + else if (curChar == 'F' || curChar == 'f') + mappedChar = 70; + else if (curChar == 'G' || curChar == 'g') + mappedChar = 71; + else if (curChar == 'H' || curChar == 'h') + mappedChar = 72; + else if (curChar == 'I' || curChar == 'i') + mappedChar = 73; + else if (curChar == 'J' || curChar == 'j') + mappedChar = 74; + else if (curChar == 'K' || curChar == 'k') + mappedChar = 75; + else if (curChar == 'L' || curChar == 'l') + mappedChar = 76; + else if (curChar == 'M' || curChar == 'm') + mappedChar = 77; + else if (curChar == 'N' || curChar == 'n') + mappedChar = 78; + else if (curChar == 'O' || curChar == 'o') + mappedChar = 79; + else if (curChar == 'P' || curChar == 'p') + mappedChar = 80; + else if (curChar == 'Q' || curChar == 'q') + mappedChar = 81; + else if (curChar == 'R' || curChar == 'r') + mappedChar = 82; + else if (curChar == 'S' || curChar == 's') + mappedChar = 83; + else if (curChar == 'T' || curChar == 't') + mappedChar = 84; + else if (curChar == 'U' || curChar == 'u') + mappedChar = 85; + else if (curChar == 'V' || curChar == 'v') + mappedChar = 86; + else if (curChar == 'W' || curChar == 'w') + mappedChar = 87; + else if (curChar == 'X' || curChar == 'x') + mappedChar = 88; + else if (curChar == 'Y' || curChar == 'y') + mappedChar = 89; + else if (curChar == 'Z' || curChar == 'z') + mappedChar = 90; + + // BackSpace + if (curChar == 8 && textIndex > 0) { Sup_string[textIndex--] = 0; - v3 -= _vm->_globals.police_l; - v8 = v3 + 2 * _vm->_globals.police_l; - v9 = v7; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, v8, yp + 12); - _vm->_fontManager.TEXT_NOW(v3, yp, "_", -4); - v7 = v9; + x1 -= _vm->_globals.police_l; + x2 = x1 + 2 * _vm->_globals.police_l; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, x2, yp + 12); + _vm->_fontManager.TEXT_NOW(x1, yp, "_", -4); } - if (v7 != '*') { - newChar = v7; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, _vm->_globals.police_l + v3, yp + 12); + if (mappedChar != '*') { + newChar = mappedChar; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); Sup_string[textIndex] = newChar; charString = Common::String::format("%c_", newChar); - _vm->_fontManager.TEXT_NOW(v3, yp, charString, -4); + _vm->_fontManager.TEXT_NOW(x1, yp, charString, -4); ++textIndex; - v3 += _vm->_globals.police_l; + x1 += _vm->_globals.police_l; } _vm->_eventsManager.VBL(); - v4 = a3; - } while (textIndex != a3 && v6 != 13); + } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, v3, yp, _vm->_globals.police_l, - 12, _vm->_graphicsManager.VESA_BUFFER, v3, yp); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v3, yp, _vm->_globals.police_l + v3, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, + 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); + _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); _vm->_eventsManager.VBL(); Sup_string[textIndex] = 0; - _vm->_eventsManager.souris_flag = v12; + _vm->_eventsManager.souris_flag = oldMouseFlag; } void ComputerManager::outtext(const Common::String &msg) { @@ -911,7 +906,7 @@ void ComputerManager::NAME_SCORE() { curChar = toupper(_vm->_eventsManager.keywin()); if ((curChar <= '/') || (curChar > 'Z')) curChar = ' '; - if ((uint16)(curChar - 58) <= 6u) + if ((uint16)(curChar - ':') <= 6u) curChar = ' '; Score[5].name.setChar(curChar, strPos); diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 41526ee03c..edd214e596 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -96,7 +96,7 @@ private: */ void Charge_Menu(); - void TXT4(int xp, int yp, int a3); + void TXT4(int xp, int yp, int textIdx); /** * Restores the scene for the FBI headquarters room -- cgit v1.2.3 From 9a674ac89cadaf1da9457d9e274cb56a4900da0d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 23 Nov 2012 21:55:17 +1100 Subject: HOPKINS: Bugfix to showing selected inventory item in factory lift --- engines/hopkins/events.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index e66ecd3bb8..746fc5666d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -374,8 +374,10 @@ LABEL_34: LABEL_35: if (!_vm->_globals.PUBEXIT) _vm->_objectsManager.AFF_SPRITES(); - if (souris_flag != true) + if (souris_flag != true) { + updateCursor(); goto LABEL_54; + } if (btsouris == 23) goto LABEL_45; if (yp >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || v14 <= 1 || v13 <= 1) { -- cgit v1.2.3 From 384ca5dd827c1a62d81a957fbfd3a18ed47a56e0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Nov 2012 22:21:35 +0100 Subject: HOPKINS: Fix CppCheck warnings --- engines/hopkins/anim.cpp | 129 ++++++++++++------------------- engines/hopkins/computer.cpp | 76 +++++++----------- engines/hopkins/dialogs.cpp | 74 +++++++----------- engines/hopkins/events.cpp | 35 ++++----- engines/hopkins/files.cpp | 4 +- engines/hopkins/font.cpp | 178 ++++++++++++++++--------------------------- engines/hopkins/globals.cpp | 42 ++++------ 7 files changed, 203 insertions(+), 335 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 43b7229f19..ee959d169d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -41,7 +41,6 @@ AnimationManager::AnimationManager() { // Play Anim void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { int v4; - int v5; bool hasScreenCopy; byte *screenCopy = NULL; byte *v10 = NULL; @@ -214,7 +213,7 @@ LABEL_58: memcpy(screenCopy, v10, 0x4B000u); - v5 = 0; + int v5 = 0; do { memset(ptr, 0, 0x13u); if (f.read(ptr, 16) != 16) @@ -245,25 +244,15 @@ LABEL_58: // Play Anim 2 void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { - byte *v4; int v5; - int v6; int v8; byte *ptr; - byte *ptra; int v11; byte *v12; byte *v13; int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - char v21; size_t nbytes; byte buf[6]; - char v25; Common::File f; if (_vm->shouldQuit()) @@ -271,11 +260,6 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint v8 = 0; while (!_vm->shouldQuit()) { - v17 = 0; - v16 = 0; - v19 = 0; - v18 = 0; - v20 = 1; memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); @@ -298,12 +282,12 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint f.read(_vm->_graphicsManager.Palette, 0x320u); f.read(&buf, 4); nbytes = f.readUint32LE(); - v21 = f.readUint32LE(); - v20 = f.readUint16LE(); - v19 = f.readUint16LE(); - v18 = f.readUint16LE(); - v17 = f.readUint16LE(); - v16 = f.readUint16LE(); + f.readUint32LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); f.read(v12, nbytes); @@ -367,7 +351,6 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); - v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -428,7 +411,6 @@ LABEL_48: if (f.read(v13, 0x10) != 0x10) v5 = -1; - v25 = 0; if (strncmp((const char *)v13, "IMAGE=", 6)) v5 = -1; @@ -473,7 +455,6 @@ LABEL_88: g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); - v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -538,7 +519,6 @@ LABEL_88: g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); - v4 = &_vm->_graphicsManager.Palette[769]; _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -591,6 +571,7 @@ LABEL_114: f.close(); if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { + byte *ptra; ptra = _vm->_globals.dos_malloc2(0x4B000u); f.seek(0); @@ -598,16 +579,18 @@ LABEL_114: f.read(_vm->_graphicsManager.Palette, 0x320u); f.read(&buf, 4u); nbytes = f.readUint32LE(); - v21 = f.readUint32LE(); - v20 = f.readUint16LE(); - v19 = f.readUint16LE(); - v18 = f.readUint16LE(); - v17 = f.readUint16LE(); - v16 = f.readUint16LE(); + + f.readUint32LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.read(v12, nbytes); memcpy(ptra, v12, 0x4B000u); - v6 = 0; + int v6 = 0; do { memset(&buf, 0, 6u); memset(v13, 0, 0x13u); @@ -767,17 +750,9 @@ void AnimationManager::CLEAR_ANIM() { int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filename) { byte *v3; byte *v4; - int v7; - int v8; - int width; - int height; byte *v13; - int v16; - int v17; byte *ptr; byte *v19; - int v20; - int v21; int result = 0; _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); _vm->_globals.Bank[idx].field1C = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); @@ -797,20 +772,22 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam if (_vm->_globals.Bank[idx].fileHeader) { _vm->_globals.Bank[idx].data = v3; - v7 = 0; - v8 = 0; + bool loopCond = false; + int v8 = 0; + int width; + int height; do { ptr = v4; width = _vm->_objectsManager.Get_Largeur(v4, v8); height = _vm->_objectsManager.Get_Hauteur(ptr, v8); v4 = ptr; if (!width && !height) - v7 = 1; - if (!v7) + loopCond = true; + if (!loopCond) ++v8; if (v8 > 249) - v7 = 1; - } while (v7 != 1); + loopCond = true; + } while (!loopCond); if (v8 <= 249) { _vm->_globals.Bank[idx].field1A = v8; @@ -830,16 +807,16 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam v13 = v19; if (_vm->_globals.Bank[idx].field1A > 0) { - for (int v14 = 0; v14 < _vm->_globals.Bank[idx].field1A; ++v14) { - v16 = (int16)READ_LE_UINT16(v13); - v17 = (int16)READ_LE_UINT16(v13 + 2); - v21 = (int16)READ_LE_UINT16(v13 + 4); - v20 = (int16)READ_LE_UINT16(v13 + 6); + for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx) { + int x1 = (int16)READ_LE_UINT16(v13); + int y1 = (int16)READ_LE_UINT16(v13 + 2); + int x2 = (int16)READ_LE_UINT16(v13 + 4); + int y2 = (int16)READ_LE_UINT16(v13 + 6); v13 += 8; - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, v14, v16, v17, 0); + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, objIdx, x1, y1, 0); if (_vm->_globals.Bank[idx].fileHeader == 2) - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, v14, v21, v20, 1); + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, objIdx, x2, y2, 1); } } @@ -1135,19 +1112,11 @@ LABEL_59: void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool v4; - bool v5; int v7; byte *ptr = NULL; - byte *ptra; byte *v10; byte *v11 = NULL; int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - char v19; size_t nbytes; Common::File f; @@ -1156,11 +1125,6 @@ void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint3 if (_vm->shouldQuit()) return; - v15 = 0; - v14 = 0; - v17 = 0; - v16 = 0; - v18 = 1; _vm->_eventsManager.souris_flag = false; v10 = _vm->_graphicsManager.VESA_SCREEN; v11 = _vm->_globals.dos_malloc2(0x16u); @@ -1173,12 +1137,12 @@ void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint3 f.read(_vm->_graphicsManager.Palette, 0x320u); 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.readUint32LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); f.read(v10, nbytes); if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { @@ -1298,6 +1262,7 @@ LABEL_53: } LABEL_54: if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) { + byte *ptra; ptra = _vm->_globals.dos_malloc2(0x4B000u); f.seek(0); @@ -1305,16 +1270,18 @@ LABEL_54: f.read(_vm->_graphicsManager.Palette, 0x320u); 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.readUint32LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.readUint16LE(); + f.read(v10, nbytes); memcpy(ptra, v10, 0x4B000u); - v5 = false; + bool v5 = false; do { memset(v11, 0, 0x13u); if (f.read(v11, 16) != 16) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index ee322cdda2..d2e1209516 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -100,17 +100,7 @@ void ComputerManager::settextposition(int yp, int xp) { void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { bool passwordMatch; - bool numericFlag; char *v3; - int v4; - char v5; - char *v6; - int v7; - char v8; - char *v9; - int v10; - char v11; - char v12; char s[12]; const char *s2; @@ -138,16 +128,15 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { outtext(Common::String(MenuText[4]._line)); settextposition(14, 35); - v3 = &s[0]; - memset(s, 0, 8u); + memset(s, 0, 12); TXT4(280, 224, 8); - strcpy(s, Sup_string); + v3 = &s[0]; if (mode == COMPUTER_HOPKINS) { s2 = "HOPKINS"; - v4 = 8; - v5 = 1; + int v4 = 8; + char v5 = 1; do { if (!v4) break; @@ -158,28 +147,28 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { passwordMatch = true; } if (mode == COMPUTER_SAMANTHAS) { - v6 = &s[0]; + char *v6 = &s[0]; s2 = "328MHZA"; - v7 = 8; - v8 = 1; + int v7 = 8; + bool v8 = true; do { if (!v7) break; - v8 = *v6++ == *s2++; + v8 = (*v6++ == *s2++); --v7; } while (v8); if (v8) passwordMatch = true; } if (mode == COMPUTER_PUBLIC) { - v9 = &s[0]; + char *v9 = &s[0]; s2 = "ALLFREE"; - v10 = 8; - v11 = 1; + int v10 = 8; + bool v11 = true; do { if (!v10) break; - v11 = *v9++ == *s2++; + v11 = (*v9++ == *s2++); --v10; } while (v11); if (v11) @@ -229,18 +218,21 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { outtext2(Common::String(MenuText[16]._line)); } + bool numericFlag = false; + char v12; do { v12 = _vm->_eventsManager.keywin(); if (_vm->shouldQuit()) return; - numericFlag = false; if ((uint16)(v12 - 48) <= 8u) numericFlag = true; } while (!numericFlag); - if (v12 == 48) + // 0 - Quit + if (v12 == '0') break; + // 1 - Games if (v12 == '1') { GAMES(); } else if (mode == COMPUTER_HOPKINS) { @@ -1090,15 +1082,11 @@ void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { } int ComputerManager::DEP_BALLE() { - int v0; int16 v1; - int v2; - int16 v4; - - v4 = 0; + int16 v4 = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; // TODO: Figure out random number - v0 = _vm->getRandomNumber(6); + int v0 = _vm->getRandomNumber(6); if (CASSESPEED == 1) { CASSEP1 = 1; CASSEP2 = 1; @@ -1145,7 +1133,7 @@ int ComputerManager::DEP_BALLE() { if ((uint16)(BALLE.y - 186) <= 8u) { _vm->_soundManager.PLAY_SAMPLE(2, 6); if (BALLE.x > RAQX - 2) { - v2 = BALLE.x + 6; + int v2 = BALLE.x + 6; if (v2 < RAQX + 36) { BALLEVERTI = 0; if (v2 <= RAQX + 15) { @@ -1178,31 +1166,23 @@ int ComputerManager::DEP_BALLE() { void ComputerManager::VERIFBRIQUES() { - int v0; int v1; int v2; int v3; int v4; - int v5; - int v6; - int v7; - uint16 v8; - int16 *v9; int v10; int v11; - int v12; - int v13; - v7 = 0; + int v7 = 0; //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; // TODO: Check if correct - v6 = _vm->getRandomNumber(6) + 1; - v0 = BALLE.x; - v13 = BALLE.y; - v5 = BALLE.x + 6; - v12 = BALLE.y + 6; - v9 = CASSETAB; - v8 = 0; + int v6 = _vm->getRandomNumber(6) + 1; + int v0 = BALLE.x; + int v13 = BALLE.y; + int v5 = BALLE.x + 6; + int v12 = BALLE.y + 6; + int16 *v9 = CASSETAB; + uint16 v8 = 0; do { v1 = v9[v8]; v11 = v9[v8 + 1]; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e20409a3b4..000afed3c8 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -303,25 +303,6 @@ void DialogsManager::showOptionsDialog() { } void DialogsManager::showInventory() { - size_t filesize; - int v4; - int v6; - byte *v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - Common::File f; - - v13 = 0; if (!VIRE_INVENT && !AFFINVEN && !_vm->_globals.DESACTIVE_INVENT) { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; @@ -352,34 +333,35 @@ LABEL_7: break; } + Common::File f; if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); - filesize = f.size(); + size_t filesize = f.size(); _vm->_dialogsManager.Winventaire = _vm->_globals.dos_malloc2(filesize); _vm->_fileManager.bload_it(f, _vm->_dialogsManager.Winventaire, filesize); f.close(); _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v19 = _vm->_graphicsManager.ofscroll + 152; - v18 = _vm->_objectsManager.Get_Largeur(_vm->_dialogsManager.Winventaire, 0); - v17 = _vm->_objectsManager.Get_Hauteur(_vm->_dialogsManager.Winventaire, 0); + int v19 = _vm->_graphicsManager.ofscroll + 152; + int v18 = _vm->_objectsManager.Get_Largeur(_vm->_dialogsManager.Winventaire, 0); + int v17 = _vm->_objectsManager.Get_Hauteur(_vm->_dialogsManager.Winventaire, 0); inventairex = v19; inventairey = 114; inventairel = v18; inventaireh = v17; _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, v19 + 300, 414, 0, 0, 0, 0); - v15 = 0; - v4 = 0; + int v15 = 0; + int v4 = 0; for (int v14 = 1; v14 <= 5; v14++) { - v16 = 0; + int v16 = 0; for (int v5 = 1; v5 <= 6; v5++) { ++v4; - v6 = _vm->_globals.INVENTAIRE[v4]; + int v6 = _vm->_globals.INVENTAIRE[v4]; if (v6 && v4 <= 29) { - v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); + byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); _vm->_globals.dos_free2(v7); @@ -390,18 +372,19 @@ LABEL_7: } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, inventairex, inventairey, inventairel, inventaireh); _vm->_eventsManager.souris_bb = 0; - v20 = 0; + bool v20 = false; + int v13 = 0; // Main loop to select an inventory item while (!_vm->shouldQuit()) { // Turn on drawing the inventory dialog in the event manager AFFINVEN = true; - v8 = _vm->_eventsManager.XMOUSE(); - v9 = _vm->_eventsManager.YMOUSE(); - v12 = _vm->_eventsManager.BMOUSE(); - v10 = v13; - v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); + int v8 = _vm->_eventsManager.XMOUSE(); + int v9 = _vm->_eventsManager.YMOUSE(); + int v12 = _vm->_eventsManager.BMOUSE(); + int v10 = v13; + int v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); v13 = v11; if (v11 != v10) _vm->_objectsManager.PARAMCADRE(v11); @@ -422,8 +405,8 @@ LABEL_7: v9 = v13; _vm->_objectsManager.VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); if (_vm->_eventsManager.btsouris == 8) - v20 = 1; - if (v20 != 1) { + v20 = true; + if (!v20) { _vm->_scriptManager.TRAVAILOBJET = 1; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; @@ -439,22 +422,22 @@ LABEL_7: } if (_vm->_globals.SORTIE) { if (_vm->_globals.SORTIE == 2) - v20 = 1; + v20 = true; _vm->_globals.SORTIE = 0; - if (v20 != 1) { + if (!v20) { inventaire2 = _vm->_globals.dos_free2(inventaire2); if (g_PTRNUL != _vm->_dialogsManager.Winventaire) _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); goto LABEL_7; } - } else if (v20 != 1) { + } else if (!v20) { AFFINVEN = true; } } } if (VIRE_INVENT == true) - v20 = 1; - if (v20 == 1) + v20 = true; + if (v20) break; _vm->_eventsManager.VBL(); if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) @@ -463,7 +446,7 @@ LABEL_7: _vm->_fontManager.TEXTE_OFF(9); if (AFFINVEN) { AFFINVEN = false; - v9 = 114; +// v9 = 114; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; @@ -491,9 +474,6 @@ LABEL_7: } void DialogsManager::INVENT_ANIM() { - int v0; - int v1; - if (!DESACTIVE_INVENT) { if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, @@ -509,8 +489,8 @@ void DialogsManager::INVENT_ANIM() { _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - v0 = _vm->_graphicsManager.ofscroll + 2; - v1 = _vm->_graphicsManager.ofscroll + 2; + int v0 = _vm->_graphicsManager.ofscroll + 2; + int v1 = _vm->_graphicsManager.ofscroll + 2; _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); _vm->_objectsManager.I_old_x = v0; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 746fc5666d..5dc68064f2 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -301,11 +301,6 @@ void EventsManager::VBL() { int v1; int v2; int v3; - int v4; - int v5; - int v6; - int v7; - int v10; signed int v11 = 0; signed int v12 = 0; int v13 = 0; @@ -437,6 +432,7 @@ LABEL_65: if (_vm->_graphicsManager.DOUBLE_ECRAN != true || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { + int v4; if (_vm->_graphicsManager.no_scroll != 2) { if (XMOUSE() > _vm->_graphicsManager.SCROLL + 620) _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; @@ -458,10 +454,10 @@ LABEL_65: _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.SDL_ECHELLE) { if (_vm->_graphicsManager.Winbpp == 2) { - v5 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + int v5 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v5); } else { - v6 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + int v6 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v6); } _vm->_graphicsManager.DD_Unlock(); @@ -477,17 +473,18 @@ LABEL_65: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, 640, 460); } - if (!_vm->_globals.BPP_NOAFF) { -// SDL_UpdateRects(LinuxScr, 1, dstrect); - } + + // CHECKME: Useless? + // if (!_vm->_globals.BPP_NOAFF) { + // // SDL_UpdateRects(LinuxScr, 1, dstrect); + // } + if (_vm->_globals.NBBLOC) { - v7 = 1; - v10 = _vm->_globals.NBBLOC + 1; - do { - if (_vm->_globals.BLOC[v7].field0 == 1) - _vm->_globals.BLOC[v7].field0 = 0; - ++v7; - } while (v10 != v7); + int v10 = _vm->_globals.NBBLOC + 1; + for (int i = 1; i != v10; i++) { + if (_vm->_globals.BLOC[i].field0 == 1) + _vm->_globals.BLOC[i].field0 = 0; + } } _vm->_globals.NBBLOC = 0; start_x = v4; @@ -500,6 +497,9 @@ LABEL_65: } souris_bb = souris_b; souris_b = 0; +#if 0 + // Commented by Strangerke. Looks completely useless. + if (souris_flag == true) { if (btsouris != 23) { if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { @@ -520,6 +520,7 @@ LABEL_65: } } LABEL_113: +#endif _vm->_soundManager.VERIF_SOUND(); CONTROLE_MES(); } diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 13e54bb288..a5d193fda7 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -285,7 +285,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { bool matchFlag = false; int offsetVal = 0; - do { + while (!matchFlag) { Common::String name = (const char *)ptr + offsetVal; if (name == filename) { @@ -302,7 +302,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { } offsetVal += 23; - } while (!matchFlag); + } _vm->_globals.dos_free2(ptr); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 8fd69fa766..64f39f9c9e 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -114,74 +114,23 @@ void FontManager::DOS_TEXT(int idx, int messageId, const Common::String &filenam // Box void FontManager::BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp) { - int filesize; byte *v9; - const byte *v10; - int v11; - byte v13; - byte v14; - int v15; - byte v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - byte v24; - int v25; - int v27; - int v28; - int v29; - int v32; - int v34; - int v36; - int v37; - int ptrb; - int ptrc; - byte *ptrd; byte *ptre; Common::String s; - int v49; - int blockSize; - int v51; - int blockHeight; - int v53; - int blockWidth; - int v55; - int v56; - int lineSize; - int lineCount; byte *v59; - byte *v60; - byte *v61; - int v62; - int v63; - int v64; - int v65; - int v66; - int v67; - int v68; - int v69; - int v70; - int v71; - int v73; - int i; - int v75; Common::String file; Common::File f; - v73 = xp; - v70 = yp; - lineCount = 0; + int v73 = xp; + int v70 = yp; if (idx < 0) error("Bad number for text"); _vm->_globals.police_l = 11; _vm->_globals.largeur_boite = 11 * Txt[idx].field3FE; + int lineCount = 0; if (Txt[idx].textLoaded) { - v34 = Txt[idx].field3FC; + int v34 = Txt[idx].field3FC; if (v34 != 6 && v34 != 1 && v34 != 3 && v34 != 5) { int yCurrent = yp + 5; if (Txt[idx].lineCount > 0) { @@ -191,8 +140,8 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, } } } else { - v36 = Txt[idx].height; - v37 = Txt[idx].width; + int v36 = Txt[idx].height; + int v37 = Txt[idx].width; _vm->_graphicsManager.Restore_Mem( _vm->_graphicsManager.VESA_BUFFER, Txt[idx].textBlock, @@ -203,7 +152,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); } } else { - v62 = 0; + int v62 = 0; do { TRIER_TEXT[v62++] = 0; } while (v62 <= 19); @@ -219,11 +168,12 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, if (!f.open(nom_index)) error("Error opening file - %s", nom_index.c_str()); - filesize = f.size(); - for (i = 0; i < (filesize / 4); ++i) + int filesize = f.size(); + for (int i = 0; i < (filesize / 4); ++i) Index[i] = f.readUint32LE(); f.close(); } + int v11, v69; if (filename[0] != 'Z' || filename[1] != 'O') { if (!f.open(file)) error("Error opening file - %s", nom_index.c_str()); @@ -246,17 +196,19 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, Common::fill(&v9[0], &v9[0x6e], 0); texte_tmp = v9; - v10 = _vm->_globals.BUF_ZONE + Index[messageId]; + const byte *v10 = _vm->_globals.BUF_ZONE + Index[messageId]; memcpy(v9, v10, 0x60u); v11 = 0; WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } v59 = texte_tmp; - v63 = 0; + int v63 = 0; + int v64 = 0; + byte *v60; if (!v69) goto LABEL_43; do { - v13 = *v59; + byte v13 = *v59; if ((byte)(*v59 + 46) > 0x1Bu) { if ((byte)(v13 + 80) > 0x1Bu) { if ((byte)(v13 - 65) <= 0x19u || (byte)(v13 - 97) <= 0x19u) @@ -273,10 +225,9 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, } while (v63 < v69); v60 = texte_tmp; - v64 = 0; if (v69) { while (1) { - v14 = *(v60 + v64); + byte v14 = *(v60 + v64); if (v14 == '\r' || v14 == '\n') { *(v60 + v64) = 0; if (!Txt[idx].field3FE) @@ -289,7 +240,8 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, Txt[idx].field3FE = v64; _vm->_globals.largeur_boite = 0; - v15 = 0; + int v15 = 0; + byte v16; if (v64 + 1 > 0) { do { v16 = *(v60 + v15); @@ -300,13 +252,12 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, } while (v15 < v64 + 1); } _vm->_globals.largeur_boite += 2; - v17 = _vm->_globals.largeur_boite / 2; + int v17 = _vm->_globals.largeur_boite / 2; if (v17 < 0) v17 = -v17; Txt[idx].xp = 320 - v17; v73 = _vm->_eventsManager.start_x + 320 - v17; lineCount = 1; - v18 = 0; if (v64 + 1 > 0) { Txt[idx].lines[0] = Common::String((const char *)v60, v64); } @@ -314,11 +265,13 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, LABEL_43: if (!_vm->_globals.largeur_boite) _vm->_globals.largeur_boite = 240; - v65 = 0; - v61 = texte_tmp; + int v65 = 0; + byte *v61 = texte_tmp; + int v21; + int lineSize; do { - v19 = 0; - ptrb = _vm->_globals.largeur_boite - 4; + int v19 = 0; + int ptrb = _vm->_globals.largeur_boite - 4; while (1) { lineSize = v19; do @@ -339,7 +292,7 @@ LABEL_55: if (v11 == '%') lineSize = v19; LABEL_57: - v20 = lineCount; + int v20 = lineCount; v21 = v11; // WORKAROUND: Perhaps due to the usage of ScummVM strings here, recalculate what the @@ -355,48 +308,45 @@ LABEL_57: v65 += lineSize; v11 = v21; } while (v21 != 37); - v66 = 0; - do { - v22 = TRIER_TEXT[v66]; + + for (int i = 0; i <= 19; i++) { + int v22 = TRIER_TEXT[i]; if (v22 <= 0) { - TRIER_TEXT[v66] = 0; + TRIER_TEXT[i] = 0; } else { - ptrc = 0; - v23 = 0; + int ptrc = 0; + int v23 = 0; if (v22 - 1 > 0) { do { - Common::String &line = Txt[idx].lines[v66]; - v24 = (v23 >= (int)line.size()) ? '\0' : line[v23]; + Common::String &line = Txt[idx].lines[i]; + byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if ((byte)v24 <= 0x1Fu) v24 = 32; ptrc += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v24 - 32); ++v23; - } while (v23 < TRIER_TEXT[v66] - 1); + } while (v23 < TRIER_TEXT[i] - 1); } - TRIER_TEXT[v66] = ptrc; + TRIER_TEXT[i] = ptrc; } - ++v66; - } while (v66 <= 19); - v67 = 0; - do { - v25 = v67; + } + for (int i = 0; i <= 19; i++) { + int v25 = i; do { ++v25; if (v25 == 20) v25 = 0; - if (TRIER_TEXT[v67] < TRIER_TEXT[v25]) - TRIER_TEXT[v67] = 0; - } while (v25 != (int16)v67); - ++v67; - } while (v67 <= 19); - v68 = 0; - do { - if (TRIER_TEXT[v68]) - _vm->_globals.largeur_boite = TRIER_TEXT[v68]; - ++v68; - } while (v68 <= 19); + if (TRIER_TEXT[i] < TRIER_TEXT[v25]) + TRIER_TEXT[i] = 0; + } while (v25 != i); + }; + + for (int i = 0; i <= 19; i++) { + if (TRIER_TEXT[i]) + _vm->_globals.largeur_boite = TRIER_TEXT[i]; + } if ((uint16)(Txt[idx].field3FC - 2) > 1u) { + int i; for (i = xp - _vm->_eventsManager.start_x; _vm->_globals.largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC; i -= 2) ; Txt[idx].xp = i; @@ -414,26 +364,26 @@ LABEL_57: } } _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; - v56 = v73; - v55 = yp; - v53 = _vm->_globals.largeur_boite + 10; - v51 = (_vm->_globals.police_h + 1) * lineCount + 12; + int v56 = v73; + int v55 = yp; + int v53 = _vm->_globals.largeur_boite + 10; + int v51 = (_vm->_globals.police_h + 1) * lineCount + 12; if (Txt[idx].field3FC == 6) { - v27 = v53 / 2; + int v27 = v53 / 2; if (v27 < 0) v27 = -v27; Txt[idx].xp = 315 - v27; - v28 = _vm->_eventsManager.start_x + 315 - v27; + int v28 = _vm->_eventsManager.start_x + 315 - v27; v73 = _vm->_eventsManager.start_x + 315 - v27; Txt[idx].yp = 50; v70 = 50; v55 = 50; v56 = v28; } - v29 = Txt[idx].field3FC; + int v29 = Txt[idx].field3FC; if (v29 == 1 || v29 == 3 || (uint16)(v29 - 5) <= 1u) { - v49 = v51 * v53; - ptrd = _vm->_globals.dos_malloc2(v51 * v53); + int v49 = v51 * v53; + byte *ptrd = _vm->_globals.dos_malloc2(v49); if (ptrd == g_PTRNUL) { error("Cutting a block for text box (%d)", v49); } @@ -448,8 +398,8 @@ LABEL_57: _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); } Txt[idx].lineCount = lineCount; - v75 = v73 + 5; - v71 = v70 + 5; + int v75 = v73 + 5; + int v71 = v70 + 5; if (lineCount > 0) { for (int lineNum = 0; lineNum < lineCount; ++lineNum) { @@ -458,16 +408,16 @@ LABEL_57: } } - blockWidth = v53 + 1; - blockHeight = v51 + 1; + int blockWidth = v53 + 1; + int blockHeight = v51 + 1; Txt[idx].width = blockWidth; Txt[idx].height = blockHeight; - v32 = Txt[idx].field3FC; + int v32 = Txt[idx].field3FC; if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { if (Txt[idx].textBlock != g_PTRNUL) Txt[idx].textBlock = _vm->_globals.dos_free2(Txt[idx].textBlock); - blockSize = blockHeight * blockWidth; + int blockSize = blockHeight * blockWidth; ptre = _vm->_globals.dos_malloc2(blockSize + 20); if (ptre == g_PTRNUL) error("Cutting a block for text box (%d)", blockSize); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 5a24a5f207..882d869d33 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -569,16 +569,8 @@ void Globals::CACHE_ADD(int idx) { // Load Cache void Globals::CHARGE_CACHE(const Common::String &file) { byte *v2 = g_PTRNUL; - int v4; - int v5; - int v6; - int v8; - int v9; - int v11; byte *spriteData; byte *ptr; - int v14; - int v15; Common::String v16; Common::File f; @@ -592,34 +584,32 @@ void Globals::CHARGE_CACHE(const Common::String &file) { if (f.exists(NFICHIER)) { spriteData = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); CACHE_BANQUE[1] = spriteData; - v15 = 60; - v14 = 0; - do { - v11 = (int16)READ_LE_UINT16((uint16 *)ptr + v15); - v4 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); - v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); - v6 = v14; + int v15 = 60; + for (int i = 0; i <= 21; i++) { + int v11 = (int16)READ_LE_UINT16((uint16 *)ptr + v15); + int v4 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); + int v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); + int v6 = i; Cache[v6].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); Cache[v6].field2 = v11; Cache[v6].field0 = v4; Cache[v6].field4 = v5; Cache[v6].field12 = 1; if (spriteData == g_PTRNUL) { - Cache[v14].fieldA = 0; + Cache[i].fieldA = 0; } else { - v8 = _vm->_objectsManager.Get_Largeur(spriteData, v11); - v9 = _vm->_objectsManager.Get_Hauteur(spriteData, v11); - Cache[v14].fieldC = spriteData; - Cache[v14].field6 = v8; - Cache[v14].field8 = v9; - Cache[v14].fieldA = 1; + int v8 = _vm->_objectsManager.Get_Largeur(spriteData, v11); + int v9 = _vm->_objectsManager.Get_Hauteur(spriteData, v11); + Cache[i].fieldC = spriteData; + Cache[i].field6 = v8; + Cache[i].field8 = v9; + Cache[i].fieldA = 1; } - if ( !Cache[v14].field0 && !Cache[v14].field4 && !Cache[v14].field2) - Cache[v14].fieldA = 0; + if ( !Cache[i].field0 && !Cache[i].field4 && !Cache[i].field2) + Cache[i].fieldA = 0; v15 += 5; - ++v14; - } while (v14 <= 21); + } CACHE_ON(); v2 = ptr; } -- cgit v1.2.3 From 38acdce7358a92d78faecd618f1905ad5fe8462b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Nov 2012 00:16:44 +0100 Subject: HOPKINS: Fix more CppCheck warnings --- engines/hopkins/graphics.cpp | 213 ++++++++++++++----------------------------- engines/hopkins/hopkins.cpp | 8 +- engines/hopkins/lines.cpp | 141 ++++++++++------------------ engines/hopkins/objects.cpp | 52 ++++------- engines/hopkins/script.cpp | 159 ++++++++++++-------------------- engines/hopkins/sound.cpp | 4 +- engines/hopkins/talk.cpp | 23 ++--- 7 files changed, 205 insertions(+), 395 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b5985a1f4f..29b3631887 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -831,23 +831,15 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { int palByte; - int palIndex; - int palDataIndex; - int palCtr3; - int palCtr4; - int palCtr5; - int palValue; - int palCtr2; - int palCtr1; uint16 palMax; byte palData[PALETTE_BLOCK_SIZE]; int tempPalette[PALETTE_BLOCK_SIZE]; palMax = palByte = FADESPD; if (palette) { - palIndex = 0; + int palIndex = 0; do { - palDataIndex = palIndex; + int palDataIndex = palIndex; palByte = *(palIndex + palette); palByte <<= 8; tempPalette[palDataIndex] = palByte; @@ -863,13 +855,13 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac DD_VBL(); } - palCtr3 = 0; + int palCtr3 = 0; if (palMax > 0) { do { - palCtr4 = 0; + int palCtr4 = 0; do { - palCtr5 = palCtr4; - palValue = tempPalette[palCtr4] - (*(palCtr4 + palette) << 8) / palMax; + int palCtr5 = palCtr4; + int palValue = tempPalette[palCtr4] - (*(palCtr4 + palette) << 8) / palMax; tempPalette[palCtr5] = palValue; palData[palCtr5] = (palValue >> 8) & 0xff; ++palCtr4; @@ -888,10 +880,8 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } while (palMax > palCtr3); } - palCtr2 = 0; - do { - palData[palCtr2++] = 0; - } while (palCtr2 < (PALETTE_BLOCK_SIZE)); + for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) + palData[i] = 0; setpal_vga256(palData); @@ -903,10 +893,8 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac goto LABEL_28; } } else { - palCtr1 = 0; - do { - palData[palCtr1++] = 0; - } while (palCtr1 < (PALETTE_BLOCK_SIZE)); + for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) + palData[i] = 0; setpal_vga256(palData); if (Winbpp == 2) { @@ -1479,15 +1467,9 @@ void GraphicsManager::VISU_ALL() { } void GraphicsManager::RESET_SEGMENT_VESA() { - int idx; - int blocCount; - if (_vm->_globals.NBBLOC > 0) { - idx = 0; - blocCount = _vm->_globals.NBBLOC; - do { - _vm->_globals.BLOC[idx++].field0 = 0; - } while (idx != blocCount); + for (int idx = 0; idx != _vm->_globals.NBBLOC; idx++) + _vm->_globals.BLOC[idx].field0 = 0; _vm->_globals.NBBLOC = 0; } @@ -1497,7 +1479,6 @@ void GraphicsManager::RESET_SEGMENT_VESA() { void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { int tempX; int blocCount; - int16 blocIndex; bool addFlag; tempX = x1; @@ -1514,7 +1495,7 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { blocCount = _vm->_globals.NBBLOC; if (_vm->_globals.NBBLOC > 1) { - blocIndex = 0; + int16 blocIndex = 0; do { BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; @@ -1811,71 +1792,23 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp const byte *spriteStartP; int i; const byte *spriteSizeP; - int spriteWidth; - int spriteHeight1; const byte *spritePixelsP; byte *dest1P; - int xCtr1; byte *dest2P; - int xLeft; - int clippedWidth; - int xCtr2; - int v20; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int v28; byte *v29; - int v30; - int v31; - int v32; - int v33; - int v34; - int v35; - int spriteHeight2; - int v37; - int v38; - uint16 v39; byte *v40; - int v41; - uint16 v42; - const byte *spritePixelsCopyP; - const byte *spritePixelsCopy2P; const byte *v45; const byte *v46; - byte *dest1CopyP; - byte *destCopy2P; - int v49; - int v50; - byte *v51; - int v52; - byte *v53; - byte *v54; - byte *v55; - int yCtr1; - int yCtr2; - int v58; - int v59; - int v60; - int v61; - int v62; - int v63; - int v64; - int v65; spriteStartP = srcData + 3; for (i = frameIndex; i; --i) spriteStartP += READ_LE_UINT32(spriteStartP) + 16; - spriteWidth = 0; - spriteHeight1 = 0; spriteSizeP = spriteStartP + 4; - spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); + int spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); spriteSizeP += 2; - spriteHeight1 = spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); + int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); + int spriteHeight1 = spriteHeight2; spritePixelsP = spriteSizeP + 10; clip_x = 0; clip_y = 0; @@ -1899,17 +1832,17 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_Flag_y = 0; Agr_Flag_x = 0; Largeur = spriteWidth; - v20 = Asm_Zoom(spriteWidth, zoom2); - v22 = Asm_Zoom(spriteHeight1, zoom2); + int v20 = Asm_Zoom(spriteWidth, zoom2); + int v22 = Asm_Zoom(spriteHeight1, zoom2); if (modeFlag) { v29 = v20 + dest1P; if (clip_y) { if ((uint16)clip_y >= v22) return; - v61 = v22; - v52 = v20; - v30 = 0; - v31 = (uint16)clip_y; + int v61 = v22; + int v52 = v20; + int v30 = 0; + int v31 = (uint16)clip_y; while (Asm_Zoom(v30 + 1, zoom2) < v31) ; v20 = v52; @@ -1925,25 +1858,26 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v20 -= (uint16)clip_x; } if (v20 > (uint16)clip_x1) { - v32 = v20 - (uint16)clip_x1; + int v32 = v20 - (uint16)clip_x1; v29 -= v32; - v62 = v22; - v33 = 0; + int v62 = v22; + int v33 = 0; while (Asm_Zoom(v33 + 1, zoom2) < v32) ; - v34 = v33; + int v34 = v33; v22 = v62; spritePixelsP += v34; v20 = (uint16)clip_x1; } + int v63; do { while (1) { v63 = v22; - v53 = v29; + byte *v53 = v29; v46 = spritePixelsP; Agr_Flag_x = 0; Agr_x = 0; - v35 = v20; + int v35 = v20; do { while (1) { if (*spritePixelsP) @@ -1986,10 +1920,10 @@ R_Aff_Zoom_Larg_Cont1: if (clip_y) { if ((uint16)clip_y >= v22) return; - v58 = v22; - v49 = v20; - v23 = 0; - v24 = (uint16)clip_y; + int v58 = v22; + int v49 = v20; + int v23 = 0; + int v24 = (uint16)clip_y; while (Asm_Zoom(v23 + 1, zoom2) < v24) ; v20 = v49; @@ -2002,13 +1936,13 @@ R_Aff_Zoom_Larg_Cont1: if (clip_x) { if ((uint16)clip_x >= v20) return; - v59 = v22; - v50 = v20; - v25 = (uint16)clip_x; - v26 = 0; + int v59 = v22; + int v50 = v20; + int v25 = (uint16)clip_x; + int v26 = 0; while (Asm_Zoom(v26 + 1, zoom2) < v25) ; - v27 = v26; + int v27 = v26; v22 = v59; spritePixelsP += v27; dest1P += (uint16)clip_x; @@ -2017,12 +1951,13 @@ R_Aff_Zoom_Larg_Cont1: if (v20 > (uint16)clip_x1) v20 = (uint16)clip_x1; + int v60; do { while (1) { v60 = v22; - v51 = dest1P; + byte *v51 = dest1P; v45 = spritePixelsP; - v28 = v20; + int v28 = v20; Agr_Flag_x = 0; Agr_x = 0; do { @@ -2070,17 +2005,17 @@ Aff_Zoom_Larg_Cont1: Largeur = spriteWidth; Red = zoom1; if (zoom1 < 100) { - v37 = Asm_Reduc(spriteWidth, Red); + int v37 = Asm_Reduc(spriteWidth, Red); if (modeFlag) { v40 = v37 + dest1P; do { - v65 = spriteHeight2; - v55 = v40; + int v65 = spriteHeight2; + byte *v55 = v40; Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; - v41 = Largeur; - v42 = v37; + int v41 = Largeur; + int v42 = v37; do { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { @@ -2105,13 +2040,13 @@ Aff_Zoom_Larg_Cont1: } while (spriteHeight2); } else { do { - v64 = spriteHeight2; - v54 = dest1P; + int v64 = spriteHeight2; + byte *v54 = dest1P; Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; - v38 = Largeur; - v39 = 0; + int v38 = Largeur; + int v39 = 0; do { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { @@ -2149,7 +2084,7 @@ Aff_Zoom_Larg_Cont1: dest2P += nbrligne2 * (uint16)clip_y; spriteHeight1 -= (uint16)clip_y; } - xLeft = (uint16)clip_y1; + int xLeft = (uint16)clip_y1; if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; xLeft = clip_x; @@ -2159,23 +2094,22 @@ Aff_Zoom_Larg_Cont1: spriteWidth -= xLeft; } if (spriteWidth > (uint16)clip_x1) { - clippedWidth = spriteWidth - (uint16)clip_x1; + int clippedWidth = spriteWidth - (uint16)clip_x1; spritePixelsP += clippedWidth; dest2P -= clippedWidth; spriteWidth = (uint16)clip_x1; } + int yCtr2; do { yCtr2 = spriteHeight1; - destCopy2P = dest2P; - spritePixelsCopy2P = spritePixelsP; - xCtr2 = spriteWidth; - do { + byte *destCopy2P = dest2P; + const byte *spritePixelsCopy2P = spritePixelsP; + for (int xCtr2 = spriteWidth; xCtr2; xCtr2--) { if (*spritePixelsP) *dest2P = *spritePixelsP; ++spritePixelsP; --dest2P; - --xCtr2; - } while (xCtr2); + } spritePixelsP = spec_largeur + spritePixelsCopy2P; dest2P = nbrligne2 + destCopy2P; spriteHeight1 = yCtr2 - 1; @@ -2200,18 +2134,17 @@ Aff_Zoom_Larg_Cont1: } if (spriteWidth > (uint16)clip_x1) spriteWidth = (uint16)clip_x1; + int yCtr1; do { yCtr1 = spriteHeight1; - dest1CopyP = dest1P; - spritePixelsCopyP = spritePixelsP; - xCtr1 = spriteWidth; - do { + byte *dest1CopyP = dest1P; + const byte *spritePixelsCopyP = spritePixelsP; + for (int xCtr1 = spriteWidth; xCtr1; xCtr1--) { if (*spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; ++spritePixelsP; - --xCtr1; - } while (xCtr1); + } spritePixelsP = spec_largeur + spritePixelsCopyP; dest1P = nbrligne2 + dest1CopyP; spriteHeight1 = yCtr1 - 1; @@ -2246,7 +2179,6 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int int croppedWidth; int croppedHeight; int xRight; - int height2; int top2; int left; @@ -2271,7 +2203,7 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int croppedWidth = max_x - left; if (croppedWidth > 0 && croppedHeight > 0) { - height2 = croppedHeight; + int height2 = croppedHeight; Copy_Mem(surface, left, top2, croppedWidth, croppedHeight, destSurface, destX, destY); Ajoute_Segment_Vesa(left, top2, left + croppedWidth, top2 + height2); } @@ -2363,16 +2295,10 @@ void GraphicsManager::INI_ECRAN2(const Common::String &file) { } void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { - int dataOffset; - int dataVal1; - bool doneFlag; - byte *ptr; - Common::String filename; + int dataOffset = 1; + Common::String filename = file + ".ini"; + byte *ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); - dataOffset = 1; - - filename = file + ".ini"; - ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); if (ptr == g_PTRNUL) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); @@ -2397,9 +2323,9 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { error("Error, file not ini"); } else { - doneFlag = false; + bool doneFlag = false; do { - dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); + int dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); if (_vm->shouldQuit()) return; @@ -2549,7 +2475,6 @@ Video_Cont_Vbe: void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) { const byte *srcP; byte *destP; - const byte *lineSrcP; srcP = xp + nbrligne2 * yp + srcSurface; destP = destSurface; @@ -2565,7 +2490,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Red_y += Red; if (Red_y < 100) { Red_x = 0; - lineSrcP = srcP; + const byte *lineSrcP = srcP; for (int xCtr = 0; xCtr < Largeur; ++xCtr) { Red_x += Red; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0c76ab307d..190a6ad679 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1820,10 +1820,12 @@ void HopkinsEngine::PUBQUIT() { _globals.netscape = true; bool mouseClicked = false; - int xp, yp; + + // CHECKME: Useless variables ? + // int xp, yp; do { - xp = _eventsManager.XMOUSE(); - yp = _eventsManager.YMOUSE(); +// xp = _eventsManager.XMOUSE(); +// yp = _eventsManager.YMOUSE(); _eventsManager.VBL(); if (_eventsManager.BMOUSE() == 1) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4337f93357..2a6addc9d8 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -140,21 +140,7 @@ void LinesManager::RETIRE_LIGNE_ZONE(int idx) { // Add Line Zone void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { - int v8; - int v9; int16 *zoneData; - int16 *dataP; - int v11; - int v13; - int v14; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; if (a2 != a3 || a3 != a4 || a3 != a5) { if (idx > 400) @@ -162,39 +148,39 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (LigneZone[idx].zoneData != (int16 *)g_PTRNUL) LigneZone[idx].zoneData = (int16 *)_vm->_globals.dos_free2((byte *)LigneZone[idx].zoneData); - v8 = a2 - a4; + int v8 = a2 - a4; if (a2 - a4 < 0) v8 = -v8; - v19 = v8; - v9 = a3 - a5; + int v19 = v8; + int v9 = a3 - a5; if (a3 - a5 < 0) v9 = -v9; - v18 = v9; + int v18 = v9; + int v20 = 1; if (v19 <= v9) - v20 = v9 + 1; + v20 += v9; else - v20 = v19 + 1; + v20 += v19; zoneData = (int16 *)_vm->_globals.dos_malloc2(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); - v11 = idx; + int v11 = idx; LigneZone[v11].zoneData = zoneData; if (zoneData == (int16 *)g_PTRNUL) error("AJOUTE LIGNE ZONE"); - dataP = zoneData; - v23 = 1000 * v19 / v20; - v22 = 1000 * v18 / v20; + int16 *dataP = zoneData; + int v23 = 1000 * v19 / v20; + int v22 = 1000 * v18 / v20; if (a4 < a2) v23 = -v23; if (a5 < a3) v22 = -v22; - v13 = 1000 * a2; - v16 = 1000 * a3; - v17 = 1000 * a2 / 1000; - v21 = 1000 * a3 / 1000; - v14 = 0; + int v13 = 1000 * a2; + int v16 = 1000 * a3; + int v17 = 1000 * a2 / 1000; + int v21 = 1000 * a3 / 1000; if (v20 > 0) { - do { + for (int i = 0; i < v20; i++) { *dataP++ = v17; *dataP++ = v21; @@ -202,8 +188,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in v16 += v22; v17 = v13 / 1000; v21 = v16 / 1000; - ++v14; - } while (v20 > v14); + } } *dataP++ = -1; *dataP++ = -1; @@ -389,46 +374,32 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, // Line Collision 2 int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int v6; int16 *v7; - int v8; - int v9; - int v10; - int v11; - int v12; int16 *v13; - int v14; int result; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - v24 = a5; - v6 = a5; + int v24 = a5; + int v6 = a5; if (a5 >= a6 + 1) { LABEL_29: result = 0; } else { - v22 = a1 + 4; - v21 = a1 - 4; - v20 = a2 + 4; - v19 = a2 - 4; + int v11; + int v22 = a1 + 4; + int v21 = a1 - 4; + int v20 = a2 + 4; + int v19 = a2 - 4; + int v17; while (1) { v7 = Ligne[v6].lineData; if (v7 != (int16 *)g_PTRNUL) { - v23 = 1; - v8 = 2 * Ligne[v6].field0; - v9 = v7[0]; - v16 = v7[1]; - v10 = v7[v8 - 2]; - v18 = v7[v8 - 1]; + int v23 = 1; + int v8 = 2 * Ligne[v6].field0; + int v9 = v7[0]; + int v16 = v7[1]; + int v10 = v7[v8 - 2]; + int v18 = v7[v8 - 1]; if (v7[0] >= v10) goto LABEL_32; if (v22 < v9 || v21 > v10) @@ -461,10 +432,10 @@ LABEL_28: goto LABEL_29; } while (1) { - v12 = v7[0]; + int v12 = v7[0]; v13 = v7 + 1; - v14 = v13[0]; + int v14 = v13[0]; v7 = v13 + 1; if (a1 == v12 || a1 + 1 == v12) { @@ -483,46 +454,32 @@ LABEL_28: } int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int v6; int16 *v7; - int v8; - int v9; - int v10; - int v11; - int v12; int16 *v13; int result; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - v24 = a5; - v6 = a5; + int v24 = a5; + int v6 = a5; + if (a5 >= a6 + 1) { LABEL_47: result = 0; } else { - v22 = a1 + 10; - v21 = a1 - 10; - v20 = a2 + 10; - v19 = a2 - 10; + int v22 = a1 + 10; + int v21 = a1 - 10; + int v20 = a2 + 10; + int v19 = a2 - 10; + int v11, v18; for (;;) { v7 = Ligne[v6].lineData; if (v7 != (int16 *)g_PTRNUL) { - v23 = 1; - v8 = 2 * Ligne[v6].field0; - v9 = v7[0]; - v15 = v7[1]; - v10 = v7[v8 - 2]; - v17 = v7[v8 - 1]; + int v23 = 1; + int v8 = 2 * Ligne[v6].field0; + int v9 = v7[0]; + int v15 = v7[1]; + int v10 = v7[v8 - 2]; + int v17 = v7[v8 - 1]; if (v7[0] >= v10) goto LABEL_50; if (v22 < v9 || v21 > v10) @@ -555,9 +512,9 @@ LABEL_46: goto LABEL_47; } while (1) { - v12 = v7[0]; + int v12 = v7[0]; v13 = v7 + 1; - v16 = v13[0]; + int v16 = v13[0]; v7 = v13 + 1; if (a1 == v12 || v12 == a1 + 1 diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9b46b3d03d..1a544a931b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -159,24 +159,20 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { // Delete Object void ObjectsManager::DELETE_OBJET(int objIndex) { - int v1; - int v2; - int i; - - v1 = 0; - v2 = 0; + byte lookCond = false; + int v2 = 0; do { ++v2; if (_vm->_globals.INVENTAIRE[v2] == objIndex) - v1 = 1; + lookCond = true; if (v2 > 32) - v1 = 1; - } while (v1 != 1); + lookCond = true; + } while (!lookCond); if (v2 <= 32) { if (v2 == 32) { _vm->_globals.INVENTAIRE[32] = 0; } else { - for (i = v2; i < 32; ++i) + for (int i = v2; i < 32; ++i) _vm->_globals.INVENTAIRE[i] = _vm->_globals.INVENTAIRE[i + 1]; } } @@ -608,18 +604,9 @@ void ObjectsManager::BOB_ZERO(int idx) { } void ObjectsManager::DEF_BOB(int idx) { - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int xp; - int yp; - if (_vm->_globals.Bob[idx].isActive) { - xp = _vm->_globals.Bob[idx].oldX; - yp = _vm->_globals.Bob[idx].oldY; + int xp = _vm->_globals.Bob[idx].oldX; + int yp = _vm->_globals.Bob[idx].oldY; if (_vm->_globals.Bob[idx].isSprite) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, @@ -637,24 +624,24 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].oldWidth; _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].oldHeight; - v5 = _vm->_globals.Liste2[idx].xp; - v6 = _vm->_graphicsManager.min_x; + int v5 = _vm->_globals.Liste2[idx].xp; + int v6 = _vm->_graphicsManager.min_x; if (v5 < _vm->_graphicsManager.min_x) { _vm->_globals.Liste2[idx].width -= _vm->_graphicsManager.min_x - v5; _vm->_globals.Liste2[idx].xp = v6; } - v7 = _vm->_globals.Liste2[idx].yp; - v8 = _vm->_graphicsManager.min_y; + int v7 = _vm->_globals.Liste2[idx].yp; + int v8 = _vm->_graphicsManager.min_y; if (v7 < _vm->_graphicsManager.min_y) { _vm->_globals.Liste2[idx].height -= _vm->_graphicsManager.min_y - v7; _vm->_globals.Liste2[idx].yp = v8; } - v9 = _vm->_globals.Liste2[idx].xp; + int v9 = _vm->_globals.Liste2[idx].xp; if (_vm->_globals.Liste2[idx].width + v9 > _vm->_graphicsManager.max_x) _vm->_globals.Liste2[idx].width = _vm->_graphicsManager.max_x - v9; - v10 = _vm->_globals.Liste2[idx].yp; + int v10 = _vm->_globals.Liste2[idx].yp; if (_vm->_globals.Liste2[idx].height + v10 > _vm->_graphicsManager.max_y) _vm->_globals.Liste2[idx].height = _vm->_graphicsManager.max_y - v10; @@ -671,7 +658,6 @@ void ObjectsManager::DEF_BOB(int idx) { } void ObjectsManager::BOB_VISU(int idx) { - int v1; const byte *data; int16 v6; int16 offsetY; @@ -684,7 +670,7 @@ void ObjectsManager::BOB_VISU(int idx) { BOB_ZERO(idx); data = _vm->_globals.Bqe_Anim[idx].data; - v1 = (int16)READ_LE_UINT16(data); + int v1 = (int16)READ_LE_UINT16(data); v9 = (int16)READ_LE_UINT16(data + 2); v8 = (int16)READ_LE_UINT16(data + 4); offsetY = (int16)READ_LE_UINT16(data + 6); @@ -850,9 +836,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { v7 = _vm->_globals.Bob[idx].field36; if (v7 < 0) { - v7 = v7; - if (v7 < 0) - v7 = -v7; + v7 = -v7; v20 = v7; if (v7 > 95) v20 = 95; @@ -1130,9 +1114,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { v9 = Sprite[idx].fieldC; if (v9 < 0) { - v9 = v9; - if (v9 < 0) - v9 = -v9; + v9 = -v9; reducePercent = v9; if (v9 > 95) reducePercent = 95; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index ba0d81b8bf..e8f1fff6d5 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -43,52 +43,6 @@ void ScriptManager::setParent(HopkinsEngine *vm) { } int ScriptManager::Traduction(byte *a1) { - int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int v28; - int v29; - int v30; - int v31; - int v32; - int v33; - int v34; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v43; - int v44; - int v45; - int v46; char v47; char v48; char v49; @@ -108,7 +62,6 @@ int ScriptManager::Traduction(byte *a1) { int v67; int v68; int v69; - int v70; int v71; int v72; int v73; @@ -117,17 +70,17 @@ int ScriptManager::Traduction(byte *a1) { int v76; Common::String file; - v1 = 0; - v70 = 0; + int v1 = 0; + int v70 = 0; if (*a1 != 'F' || *(a1 + 1) != 'C') return 0; if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { v70 = *(a1 + 6); - v2 = *(a1 + 7); + int v2 = *(a1 + 7); v69 = *(a1 + 8); v67 = (int16)READ_LE_UINT16(a1 + 9); v65 = (int16)READ_LE_UINT16(a1 + 11); - v3 = (int16)READ_LE_UINT16(a1 + 13); + int v3 = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { @@ -247,7 +200,7 @@ LABEL_104: if (_vm->_objectsManager.DESACTIVE != true) { v72 = *(a1 + 5); v70 = *(a1 + 6); - v4 = *(a1 + 7); + int v4 = *(a1 + 7); v68 = (int16)READ_LE_UINT16(a1 + 8); v66 = (int16)READ_LE_UINT16(a1 + 10); if (v72 == 52) { @@ -280,8 +233,8 @@ LABEL_1141: if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { if (_vm->_objectsManager.DESACTIVE != true) { _vm->_objectsManager.DEUXPERSO = false; - v5 = *(a1 + 5); - v6 = (int16)READ_LE_UINT16(a1 + 8); + int v5 = *(a1 + 5); + int v6 = (int16)READ_LE_UINT16(a1 + 8); _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(a1 + 6); _vm->_objectsManager.PERY = v6; _vm->_objectsManager.PERI = v5; @@ -350,10 +303,10 @@ LABEL_1141: } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { if (_vm->_objectsManager.DESACTIVE != true) { - v7 = *(a1 + 5); + int v7 = *(a1 + 5); v70 = *(a1 + 6); - v8 = *(a1 + 7); - v9 = *(a1 + 8); + int v8 = *(a1 + 7); + int v9 = *(a1 + 8); _vm->_objectsManager.RECALL = 0; _vm->_globals.OLD_ECRAN = _vm->_globals.ECRAN; _vm->_globals.SAUVEGARDE->data[svField6] = _vm->_globals.ECRAN; @@ -560,7 +513,7 @@ LABEL_1141: v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; - v10 = 0; + int v10 = 0; if (v74 + 1 > 0) { do { if (_vm->shouldQuit()) @@ -783,14 +736,14 @@ LABEL_1141: _vm->_animationManager.CHARGE_ANIM("otage"); _vm->_graphicsManager.LOAD_IMAGE("IM05"); _vm->_graphicsManager.VISU_ALL(); - v11 = 0; - do { + + for (int i = 0; i <= 4; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v11; - } while (v11 <= 4); + } + _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); do { @@ -811,14 +764,14 @@ LABEL_1141: _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); _vm->_graphicsManager.VISU_ALL(); - v12 = 0; - do { + + for (int i = 0; i <= 4; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v12; - } while (v12 <= 4); + } + _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); @@ -891,8 +844,8 @@ LABEL_1141: if (v76 == 46) { _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v13 = _vm->_objectsManager.YSPR(0); - v14 = _vm->_objectsManager.XSPR(0); + int v13 = _vm->_objectsManager.YSPR(0); + int v14 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); _vm->_objectsManager.NUMZONE = -1; do { @@ -907,7 +860,7 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - v15 = 0; + int v15 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -968,8 +921,8 @@ LABEL_1141: _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v16 = _vm->_objectsManager.YSPR(0); - v17 = _vm->_objectsManager.XSPR(0); + int v16 = _vm->_objectsManager.YSPR(0); + int v17 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); _vm->_globals.NOT_VERIF = 1; do { @@ -982,7 +935,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); - v18 = 0; + int v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); do { if (_vm->shouldQuit()) @@ -1019,10 +972,10 @@ LABEL_1141: _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - v19 = 12; + int v19 = 12; if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) v19 = 41; - v20 = 0; + int v20 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1059,7 +1012,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(13); _vm->_objectsManager.SET_BOBPOSI(12, 0); _vm->_objectsManager.SET_BOBPOSI(13, 0); - v21 = 0; + int v21 = 0; _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); do { @@ -1100,8 +1053,8 @@ LABEL_1141: _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v22 = _vm->_objectsManager.YSPR(0); - v23 = _vm->_objectsManager.XSPR(0); + int v22 = _vm->_objectsManager.YSPR(0); + int v23 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); _vm->_globals.NOT_VERIF = 1; do { @@ -1119,7 +1072,7 @@ LABEL_1141: _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND48.WAV", 2); _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); - v24 = 0; + int v24 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1209,7 +1162,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(1); _vm->_objectsManager.BOBANIM_ON(2); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - v25 = 0; + int v25 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1251,7 +1204,7 @@ LABEL_1141: _vm->_objectsManager.BOBANIM_ON(1); _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); - v26 = 0; + int v26 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1347,18 +1300,18 @@ LABEL_1141: _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - v27 = _vm->_objectsManager.YSPR(0); - v28 = _vm->_objectsManager.XSPR(0); + int v27 = _vm->_objectsManager.YSPR(0); + int v28 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - v29 = _vm->_objectsManager.YSPR(0); - v30 = _vm->_objectsManager.XSPR(0); + int v29 = _vm->_objectsManager.YSPR(0); + int v30 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); } if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - v31 = _vm->_objectsManager.YSPR(0); - v32 = _vm->_objectsManager.XSPR(0); + int v31 = _vm->_objectsManager.YSPR(0); + int v32 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); } _vm->_globals.NOT_VERIF = 1; @@ -1374,7 +1327,7 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { _vm->_objectsManager.BOBANIM_ON(4); - v33 = 0; + int v33 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1403,7 +1356,7 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { _vm->_objectsManager.BOBANIM_ON(6); - v34 = 0; + int v34 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1432,7 +1385,7 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { _vm->_objectsManager.BOBANIM_ON(5); - v35 = 0; + int v35 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1567,14 +1520,14 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); - v36 = 1; - do { + + for (int i = 1; i <= 39; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v36; - } while (v36 <= 39); + } + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -1593,8 +1546,8 @@ LABEL_1141: } _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v37 = _vm->_objectsManager.YSPR(0); - v38 = _vm->_objectsManager.XSPR(0); + int v37 = _vm->_objectsManager.YSPR(0); + int v38 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = 0; @@ -1625,8 +1578,8 @@ LABEL_1141: _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - v39 = _vm->_objectsManager.YSPR(0); - v40 = _vm->_objectsManager.XSPR(0); + int v39 = _vm->_objectsManager.YSPR(0); + int v40 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); _vm->_objectsManager.NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; @@ -1680,7 +1633,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); - v41 = 0; + int v41 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1700,7 +1653,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); - v42 = 0; + int v42 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1779,8 +1732,8 @@ LABEL_1141: _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - v43 = _vm->_objectsManager.YSPR(0); - v44 = _vm->_objectsManager.XSPR(0); + int v43 = _vm->_objectsManager.YSPR(0); + int v44 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); _vm->_globals.NOT_VERIF = 1; do { @@ -1791,7 +1744,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.SPRITE_OFF(0); - v45 = 0; + int v45 = 0; _vm->_objectsManager.BOBANIM_ON(7); do { if (_vm->shouldQuit()) @@ -1840,7 +1793,7 @@ LABEL_1141: _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(11); - v46 = 0; + int v46 = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 8974d3e9fe..da3a3de747 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -633,11 +633,9 @@ int SoundManager::VOICE_STAT(int voiceIndex) { } void SoundManager::STOP_VOICE(int voiceIndex) { - int wavIndex; - if (Voice[voiceIndex]._status) { Voice[voiceIndex]._status = 0; - wavIndex = Voice[voiceIndex]._wavIndex; + int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { if (Swav[wavIndex].freeSample) DEL_SAMPLE_SDL(wavIndex); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 7d8eecbf64..0e57e57437 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -196,19 +196,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } void TalkManager::PARLER_PERSO2(const Common::String &filename) { - int v1; - int v2; - int v3; - int v4; - int v5; - byte v7; - int v8; - int v9; - - v9 = 0; + int v9 = 0; _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; - v7 = _vm->_dialogsManager.DESACTIVE_INVENT; + byte v7 = _vm->_dialogsManager.DESACTIVE_INVENT; _vm->_dialogsManager.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; @@ -237,19 +228,20 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { break; } - v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); + int v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); PCHERCHE = 20 * (int16)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; + int v8 = _vm->_eventsManager.btsouris; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(0); if (!_vm->_globals.NOPARLE) { - v2 = v1 + 3; + int v2 = v1 + 3; + int v3; do { v3 = DIALOGUE(); if (v3 != v2) @@ -261,7 +253,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { } if (_vm->_globals.NOPARLE) { - v4 = 1; + int v4 = 1; + int v5; do v5 = DIALOGUE_REP(v4++); while (v5 != -1); -- cgit v1.2.3 From 6db4aca751e3289ea69a4f919d8234e24c6df31d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Nov 2012 00:57:37 +0100 Subject: HOPKINS: Fix more CppCheck warnings --- engines/hopkins/lines.cpp | 102 +++++++++++++++----------------------------- engines/hopkins/objects.cpp | 43 ++++++------------- 2 files changed, 48 insertions(+), 97 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2a6addc9d8..c13691a3a5 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -616,62 +616,32 @@ void LinesManager::INIPARCOURS() { // Avoid int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7) { - int v7; - int v8; - int i; - int16 *v10; - int v11; - int v12; - int v13; - int16 *v14; - int v15; - int v16; - int j; - int16 *v18; - int v19; - int v20; - int k; - int16 *v22; - int v23; - int v24; - int v25; - int16 *v26; - int v27; - int v28; - int v29; - int16 *v30; - int v31; - int v32; - int v34; - int v35; - int v36; + int v36 = a1; + int v7 = a2; + int v8 = a3; int v50; - - v36 = a1; - v7 = a2; - v8 = a3; if (a1 < a4) { - for (i = a2; Ligne[a1].field0 > i; ++i) { - v10 = Ligne[a1].lineData; - v11 = v10[2 * i]; - v50 = v10[2 * i + 1]; + for (int i = a2; Ligne[a1].field0 > i; ++i) { + int16 *v10 = Ligne[a1].lineData; + int v11 = v10[2 * i]; + int v50 = v10[2 * i + 1]; - v12 = v8; + int v12 = v8; a6[v12] = v11; a6[v12 + 1] = v50; a6[v12 + 2] = Ligne[a1].field6; v8 += a7; } - v34 = a1 + 1; + int v34 = a1 + 1; if ((int)(a1 + 1) < a4) { do { - v13 = 0; + int v13 = 0; if (Ligne[v34].field0 > 0) { do { - v14 = Ligne[v34].lineData; - v15 = v14[2 * v13]; + int16 *v14 = Ligne[v34].lineData; + int v15 = v14[2 * v13]; v50 = v14[2 * v13 + 1]; - v16 = v8; + int v16 = v8; a6[v16] = v15; a6[v16 + 1] = v50; @@ -687,26 +657,26 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i v36 = a4; } if (v36 > a4) { - for (j = v7; j > 0; --j) { - v18 = Ligne[v36].lineData; - v19 = v18[2 * j]; + for (int j = v7; j > 0; --j) { + int16 *v18 = Ligne[v36].lineData; + int v19 = v18[2 * j]; v50 = v18[2 * j + 1]; - v20 = v8; + int v20 = v8; a6[v20] = v19; a6[v20 + 1] = v50; a6[v20 + 2] = Ligne[v36].field8; v8 += a7; } - v35 = v36 - 1; + int v35 = v36 - 1; if ((int)(v36 - 1) > a4) { do { - for (k = Ligne[v35].field0 - 1; k > 0; --k) { - v22 = Ligne[v35].lineData; - v23 = v22[2 * k]; + for (int k = Ligne[v35].field0 - 1; k > 0; --k) { + int16 *v22 = Ligne[v35].lineData; + int v23 = v22[2 * k]; v50 = v22[2 * k + 1]; - v24 = v8; + int v24 = v8; a6[v24] = v23; a6[v24 + 1] = v50; a6[v24 + 2] = Ligne[v35].field8; @@ -721,34 +691,30 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i if (v36 == a4) { if (a5 >= v7) { if (a5 > v7) { - v29 = v7; - do { - v30 = Ligne[a4].lineData; - v31 = v30[2 * v29]; - v50 = v30[2 * v29 + 1]; + for (int i = v7; i > a5; i++) { + int16 *v30 = Ligne[a4].lineData; + int v31 = v30[2 * i]; + v50 = v30[2 * i + 1]; - v32 = v8; + int v32 = v8; a6[v32] = v31; a6[v32 + 1] = v50; a6[v32 + 2] = Ligne[a4].field6; v8 += a7; - ++v29; - } while (a5 > v29); + } } } else { - v25 = v7; - do { - v26 = Ligne[a4].lineData; - v27 = v26[2 * v25]; - v50 = v26[2 * v25 + 1]; + for (int i = v7; i > a5; i++) { + int16 *v26 = Ligne[a4].lineData; + int v27 = v26[2 * i]; + v50 = v26[2 * i+ 1]; - v28 = v8; + int v28 = v8; a6[v28] = v27; a6[v28 + 1] = v50; a6[v28 + 2] = Ligne[a4].field8; v8 += a7; - --v25; - } while (a5 < v25); + } } } return v8; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 1a544a931b..e4c5f0ac05 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -658,23 +658,17 @@ void ObjectsManager::DEF_BOB(int idx) { } void ObjectsManager::BOB_VISU(int idx) { - const byte *data; - int16 v6; - int16 offsetY; - int16 v8; - int16 v9; - PRIORITY = 1; if (!_vm->_globals.Bob[idx].field0) { BOB_ZERO(idx); - data = _vm->_globals.Bqe_Anim[idx].data; + const byte *data = _vm->_globals.Bqe_Anim[idx].data; int v1 = (int16)READ_LE_UINT16(data); - v9 = (int16)READ_LE_UINT16(data + 2); - v8 = (int16)READ_LE_UINT16(data + 4); - offsetY = (int16)READ_LE_UINT16(data + 6); - v6 = (int16)READ_LE_UINT16(data + 8); + int16 v9 = (int16)READ_LE_UINT16(data + 2); + int16 v8 = (int16)READ_LE_UINT16(data + 4); + int16 offsetY = (int16)READ_LE_UINT16(data + 6); + int16 v6 = (int16)READ_LE_UINT16(data + 8); if ((int16)READ_LE_UINT16(data)) { if (_vm->_globals.Bank[v1].field4) { if (!v9) @@ -725,31 +719,22 @@ void ObjectsManager::BOB_OFFSETY(int idx, int v) { } void ObjectsManager::SCBOB(int idx) { - int v1; - int v2; - int v3; - int v4; - int v6; - int v7; - int v8; - int v9; - - v1 = idx; + int v1 = idx; if (_vm->_globals.Cache[idx].fieldA > 0) { - v8 = 0; + int v8 = 0; do { v1 = v8; if (_vm->_globals.Bob[v1].field0) { if (!_vm->_globals.Bob[v8].field16) { if (!_vm->_globals.Bob[v8].field34) { if ( _vm->_globals.Bob[v8].frameIndex != 250) { - v2 = _vm->_globals.Bob[v8].oldWidth; - v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; - v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; - v3 =_vm->_globals.Cache[idx].field0; - v4 =_vm->_globals.Cache[idx].field4; - v7 =_vm->_globals.Cache[idx].field6 + v3; - v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; + int v2 = _vm->_globals.Bob[v8].oldWidth; + int v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; + int v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; + int v3 =_vm->_globals.Cache[idx].field0; + int v4 =_vm->_globals.Cache[idx].field4; + int v7 =_vm->_globals.Cache[idx].field6 + v3; + int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; if (v6 > v4) { if (v6 < v1) { -- cgit v1.2.3 From d52ae2f47be379172ba63810d8c83cd33585ffe6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 Nov 2012 22:25:19 +1100 Subject: HOPKINS: Clean-up of CHANGE_TETE to fix switching characters --- engines/hopkins/globals.h | 16 ++-- engines/hopkins/objects.cpp | 206 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 2 +- engines/hopkins/saveload.cpp | 14 +-- engines/hopkins/saveload.h | 2 +- engines/hopkins/script.cpp | 18 ++-- 6 files changed, 130 insertions(+), 128 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 84eca3b688..980593a235 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -204,11 +204,11 @@ struct HopkinsItem { int field2; }; -struct Sauvegarde1 { - int field0; - int field1; +struct CharacterLocation { + int xp; + int yp; int field2; - int field3; + int location; int field4; }; @@ -274,12 +274,14 @@ enum SauvegardeOffset { , svField401 = 401 }; +enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_2 = 2 }; + // TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { byte data[0x802]; - Sauvegarde1 field360; - Sauvegarde1 field370; - Sauvegarde1 field380; + CharacterLocation field360; + CharacterLocation field370; + CharacterLocation field380; int16 inventory[35]; // Originally at offset 1300 of data array }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e4c5f0ac05..8b43ef84e1 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2743,14 +2743,14 @@ void ObjectsManager::BTGAUCHE() { && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(1, 0); + CHANGE_TETE(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(2, 0); + CHANGE_TETE(CHARACTER_2, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { @@ -2758,14 +2758,14 @@ void ObjectsManager::BTGAUCHE() { && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(0, 1); + CHANGE_TETE(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } if (_vm->_globals.SAUVEGARDE->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 567) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(0, 2); + CHANGE_TETE(CHARACTER_HOPKINS, CHARACTER_2); return; } } @@ -3068,117 +3068,117 @@ void ObjectsManager::CLEAR_ECRAN() { } // Change Face/Head -void ObjectsManager::CHANGE_TETE(int a1, int a2) { - int v2; - Sauvegarde1 *v3; - Sauvegarde1 *v4; - Sauvegarde1 *v5; - Sauvegarde1 *v6; - Sauvegarde1 *v7; - Sauvegarde1 *v8; - Sauvegarde1 *v9; +void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { + CharacterLocation *loc; CH_TETE = 1; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, 532, 25, 65, 40, _vm->_graphicsManager.VESA_BUFFER, 532, 25); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (a1 == 2) { - if (!a2) { - if (_vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { - CH_TETE = 0; - v3 = &_vm->_globals.SAUVEGARDE->field380; - v3->field0 = XSPR(0); - v3->field1 = YSPR(0); - v3->field2 = 64; - v3->field3 = _vm->_globals.ECRAN; - v3->field4 = Sprite[0].field0; - SPRITE_OFF(1); - SPRITE(_vm->_globals.TETE, v3->field0, v3->field1, 1, 3, v3->field4, 0, 20, 127); - SPRITE_ON(1); - SPRITE_OFF(0); - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField357] = 1; - T_RECTIF = 0; - v4 = &_vm->_globals.SAUVEGARDE->field370; - _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); - _vm->_globals.PERSO_TYPE = 0; - SPRITE(_vm->_globals.PERSO, v4->field0, v4->field1, 0, 64, v4->field4, 0, 34, 190); -LABEL_9: - SPRITE_ON(0); - return; - } - } - } - if (!a1) { - if (a2 == 2 && _vm->_globals.SAUVEGARDE->data[svField193] == _vm->_globals.ECRAN) { - CH_TETE = 0; - v5 = &_vm->_globals.SAUVEGARDE->field370; - v5->field0 = XSPR(0); - v5->field1 = YSPR(0); - v5->field2 = 64; - v5->field3 = _vm->_globals.ECRAN; - v5->field4 = Sprite[0].fieldC; - SPRITE_OFF(1); - SPRITE(_vm->_globals.TETE, v5->field0, v5->field1, 1, 2, v5->field4, 0, 34, 190); - SPRITE_ON(1); - SPRITE_OFF(0); - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 1; - _vm->_globals.SAUVEGARDE->data[svField357] = 0; - v6 = &_vm->_globals.SAUVEGARDE->field380; - _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); - _vm->_globals.PERSO_TYPE = 2; - SPRITE(_vm->_globals.PERSO, v6->field0, v6->field1, 0, 64, v6->field4, 0, 20, 127); - goto LABEL_9; - } - v7 = &_vm->_globals.SAUVEGARDE->field370; - v7->field0 = XSPR(0); - v7->field1 = YSPR(0); - v7->field2 = 64; - v7->field3 = _vm->_globals.ECRAN; - v7->field4 = Sprite[0].fieldC; - } - if (a1 == 1) { - v8 = &_vm->_globals.SAUVEGARDE->field360; - v8->field0 = XSPR(0); - v8->field1 = YSPR(0); - v8->field2 = 64; - v8->field3 = _vm->_globals.ECRAN; - v8->field4 = Sprite[0].fieldC; - } - if (a1 == 2) { - v9 = &_vm->_globals.SAUVEGARDE->field380; - v9->field0 = XSPR(0); - v9->field1 = YSPR(0); - v9->field2 = 64; - v9->field3 = _vm->_globals.ECRAN; - v9->field4 = Sprite[0].fieldC; - } - if (!a2) { - _vm->_globals.SAUVEGARDE->data[svField121] = 0; + + if (a1 == CHARACTER_2 && !a2 && _vm->_globals.SAUVEGARDE->field370.location) { + CH_TETE = 0; + loc = &_vm->_globals.SAUVEGARDE->field380; + loc->xp = XSPR(0); + loc->yp = YSPR(0); + loc->field2 = 64; + loc->location = _vm->_globals.ECRAN; + loc->field4 = Sprite[0].field0; + + SPRITE_OFF(1); + SPRITE(_vm->_globals.TETE, loc->xp, loc->yp, 1, 3, loc->field4, 0, 20, 127); + SPRITE_ON(1); + SPRITE_OFF(0); + _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField188]; - } - if (a2 == 1) { - _vm->_globals.SAUVEGARDE->data[svField121] = 1; - _vm->_globals.SAUVEGARDE->data[svField354] = 1; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField183]; - } - if (a2 == 2) { - _vm->_globals.SAUVEGARDE->data[svField121] = 0; + T_RECTIF = 0; + + loc = &_vm->_globals.SAUVEGARDE->field370; + _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 0; + SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); + SPRITE_ON(0); + _vm->_globals.HOPKINS_DATA(); + } else if (!a1 && a2 == CHARACTER_2 && _vm->_globals.SAUVEGARDE->field380.location == _vm->_globals.ECRAN) { + CH_TETE = 0; + loc = &_vm->_globals.SAUVEGARDE->field370; + loc->xp = XSPR(0); + loc->yp = YSPR(0); + loc->field2 = 64; + loc->location = _vm->_globals.ECRAN; + loc->field4 = Sprite[0].fieldC; + SPRITE_OFF(1); + SPRITE(_vm->_globals.TETE, loc->xp, loc->yp, 1, 2, loc->field4, 0, 34, 190); + SPRITE_ON(1); + SPRITE_OFF(0); _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - v2 = _vm->_globals.SAUVEGARDE->data[svField193]; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField193]; + + loc = &_vm->_globals.SAUVEGARDE->field380; + _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); + _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_globals.PERSO_TYPE = 2; + SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 20, 127); + SPRITE_ON(0); + _vm->_globals.HOPKINS_DATA(); + } else { + switch (a1) { + case CHARACTER_HOPKINS: + loc = &_vm->_globals.SAUVEGARDE->field370; + loc->xp = XSPR(0); + loc->yp = YSPR(0); + loc->field2 = 64; + loc->location = _vm->_globals.ECRAN; + loc->field4 = Sprite[0].fieldC; + break; + case CHARACTER_HOPKINS_CLONE: + loc = &_vm->_globals.SAUVEGARDE->field360; + loc->xp = XSPR(0); + loc->yp = YSPR(0); + loc->field2 = 64; + loc->location = _vm->_globals.ECRAN; + loc->field4 = Sprite[0].fieldC; + break; + case CHARACTER_2: + loc = &_vm->_globals.SAUVEGARDE->field380; + loc->xp = XSPR(0); + loc->yp = YSPR(0); + loc->field2 = 64; + loc->location = _vm->_globals.ECRAN; + loc->field4 = Sprite[0].fieldC; + break; + default: + break; + } + + switch (a2) { + case CHARACTER_HOPKINS: + _vm->_globals.SAUVEGARDE->data[svField121] = 0; + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField357] = 1; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field370.location; + break; + case CHARACTER_HOPKINS_CLONE: + _vm->_globals.SAUVEGARDE->data[svField121] = 1; + _vm->_globals.SAUVEGARDE->data[svField354] = 1; + _vm->_globals.SAUVEGARDE->data[svField356] = 0; + _vm->_globals.SAUVEGARDE->data[svField357] = 0; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field360.location; + break; + case CHARACTER_2: + _vm->_globals.SAUVEGARDE->data[svField121] = 0; + _vm->_globals.SAUVEGARDE->data[svField354] = 0; + _vm->_globals.SAUVEGARDE->data[svField356] = 1; + _vm->_globals.SAUVEGARDE->data[svField357] = 0; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field380.location; + break; + } } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index f8d959c7fa..aec0ef1c4c 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -189,7 +189,7 @@ public: void PARADISE(); void CLEAR_ECRAN(); - void CHANGE_TETE(int a1, int a2); + void CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2); void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); int16 *PARC_VOITURE(int a1, int a2, int a3, int a4); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index cd7c32c345..958737d773 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -235,19 +235,19 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { void SaveLoadManager::syncSavegameData(Common::Serializer &s) { s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 0x802); - syncSauvegarde1(s, _vm->_globals.SAUVEGARDE->field360); - syncSauvegarde1(s, _vm->_globals.SAUVEGARDE->field370); - syncSauvegarde1(s, _vm->_globals.SAUVEGARDE->field380); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->field360); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->field370); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->field380); for (int i = 0; i < 35; ++i) s.syncAsSint16LE(_vm->_globals.SAUVEGARDE->inventory[i]); } -void SaveLoadManager::syncSauvegarde1(Common::Serializer &s, Sauvegarde1 &item) { - s.syncAsSint16LE(item.field0); - s.syncAsSint16LE(item.field1); +void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLocation &item) { + s.syncAsSint16LE(item.xp); + s.syncAsSint16LE(item.yp); s.syncAsSint16LE(item.field2); - s.syncAsSint16LE(item.field3); + s.syncAsSint16LE(item.location); s.syncAsSint16LE(item.field4); } diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 647c64d2e7..f4f94995a9 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -50,7 +50,7 @@ private: void createThumbnail(Graphics::Surface *s); void syncSavegameData(Common::Serializer &s); - void syncSauvegarde1(Common::Serializer &s, Sauvegarde1 &item); + void syncCharacterLocation(Common::Serializer &s, CharacterLocation &item); public: void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index e8f1fff6d5..22c8a65dd9 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -47,9 +47,9 @@ int ScriptManager::Traduction(byte *a1) { char v48; char v49; int v50; - Sauvegarde1 *v51; + CharacterLocation *v51; int v52; - Sauvegarde1 *v53; + CharacterLocation *v53; int v54; int v55; int v56; @@ -1958,10 +1958,10 @@ LABEL_1141: ++v71; } while (v71 <= 29); v51 = &_vm->_globals.SAUVEGARDE->field370; - v51->field0 = _vm->_objectsManager.XSPR(0); - v51->field1 = _vm->_objectsManager.YSPR(0); + v51->xp = _vm->_objectsManager.XSPR(0); + v51->yp = _vm->_objectsManager.YSPR(0); v51->field2 = 57; - v51->field3 = 97; + v51->location = 97; _vm->_globals.SAUVEGARDE->data[svField121] = 1; _vm->_globals.SAUVEGARDE->data[svField352] = 1; _vm->_globals.SAUVEGARDE->data[svField353] = 1; @@ -2186,10 +2186,10 @@ LABEL_1141: _vm->_animationManager.PLAY_SEQ("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; v53 = &_vm->_globals.SAUVEGARDE->field380; - v53->field0 = 404; - v53->field1 = 395; + v53->xp = 404; + v53->yp = 395; v53->field2 = 64; - v53->field3 = _vm->_globals.ECRAN; + v53->location = _vm->_globals.ECRAN; v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) @@ -2202,7 +2202,7 @@ LABEL_1141: _vm->_globals.SAUVEGARDE->data[svField355] = 1; _vm->_objectsManager.DEUXPERSO = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->field0, v53->field1, 1, 3, v53->field4, 0, 20, 127); + _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->xp, v53->yp, 1, 3, v53->field4, 0, 20, 127); _vm->_objectsManager.SPRITE_ON(1); } if (v76 == 245) { -- cgit v1.2.3 From b695d9c7090629ed990c49f3b05cce74d4f3b1f7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 Nov 2012 22:31:12 +1100 Subject: HOPKINS: Changed final PlayerCharacter constant to CHARACTER_SAMANTHA --- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 980593a235..bc87144eb3 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -274,7 +274,7 @@ enum SauvegardeOffset { , svField401 = 401 }; -enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_2 = 2 }; +enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 }; // TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8b43ef84e1..fc25712823 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2750,7 +2750,7 @@ void ObjectsManager::BTGAUCHE() { && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(CHARACTER_2, CHARACTER_HOPKINS); + CHANGE_TETE(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { @@ -2765,7 +2765,7 @@ void ObjectsManager::BTGAUCHE() { && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 567) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(CHARACTER_HOPKINS, CHARACTER_2); + CHANGE_TETE(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); return; } } @@ -3077,7 +3077,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (a1 == CHARACTER_2 && !a2 && _vm->_globals.SAUVEGARDE->field370.location) { + if (a1 == CHARACTER_SAMANTHA && !a2 && _vm->_globals.SAUVEGARDE->field370.location) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->field380; loc->xp = XSPR(0); @@ -3103,7 +3103,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); - } else if (!a1 && a2 == CHARACTER_2 && _vm->_globals.SAUVEGARDE->field380.location == _vm->_globals.ECRAN) { + } else if (!a1 && a2 == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->field380.location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->field370; loc->xp = XSPR(0); @@ -3144,7 +3144,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { loc->location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; break; - case CHARACTER_2: + case CHARACTER_SAMANTHA: loc = &_vm->_globals.SAUVEGARDE->field380; loc->xp = XSPR(0); loc->yp = YSPR(0); @@ -3171,7 +3171,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { _vm->_globals.SAUVEGARDE->data[svField357] = 0; _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field360.location; break; - case CHARACTER_2: + case CHARACTER_SAMANTHA: _vm->_globals.SAUVEGARDE->data[svField121] = 0; _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; -- cgit v1.2.3 From fd421b6bae804b29f605f4000bddf613abfd7c5d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Nov 2012 15:32:56 +0100 Subject: HOPKINS: Fix more CppCheck warnings --- engines/hopkins/graphics.cpp | 3 +- engines/hopkins/lines.cpp | 430 +++++++++++++++---------------------------- engines/hopkins/script.cpp | 65 +++---- 3 files changed, 175 insertions(+), 323 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 29b3631887..a5d9768319 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2295,7 +2295,6 @@ void GraphicsManager::INI_ECRAN2(const Common::String &file) { } void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { - int dataOffset = 1; Common::String filename = file + ".ini"; byte *ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); @@ -2324,6 +2323,8 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { error("Error, file not ini"); } else { bool doneFlag = false; + int dataOffset = 1; + do { int dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); if (_vm->shouldQuit()) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c13691a3a5..1c383762d8 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -331,6 +331,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, Ligne[idx].field6 = 2; Ligne[idx].field8 = 6; } + // CHECKME: v37 conditions are impossible to meet! if (v11 == -1 && v37 <= 249 && v37 > 1000) { Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; @@ -373,6 +374,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, } // Line Collision 2 +// TODO: Should return a bool int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { int16 *v7; int16 *v13; @@ -632,26 +634,23 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i a6[v12 + 2] = Ligne[a1].field6; v8 += a7; } - int v34 = a1 + 1; + if ((int)(a1 + 1) < a4) { - do { - int v13 = 0; + for (int v34 = a1 + 1; v34 < a4; v34++) { if (Ligne[v34].field0 > 0) { - do { + for (int i = 0; i < Ligne[v34].field0; i++) { int16 *v14 = Ligne[v34].lineData; - int v15 = v14[2 * v13]; - v50 = v14[2 * v13 + 1]; + int v15 = v14[2 * i]; + v50 = v14[2 * i + 1]; int v16 = v8; a6[v16] = v15; a6[v16 + 1] = v50; a6[v16 + 2] = Ligne[v34].field6; v8 += a7; - ++v13; - } while (Ligne[v34].field0 > v13); + } } - ++v34; - } while (v34 < a4); + } } v7 = 0; v36 = a4; @@ -668,9 +667,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i a6[v20 + 2] = Ligne[v36].field8; v8 += a7; } - int v35 = v36 - 1; if ((int)(v36 - 1) > a4) { - do { + for (int v35 = v36 - 1; v35 > a4; v35--) { for (int k = Ligne[v35].field0 - 1; k > 0; --k) { int16 *v22 = Ligne[v35].lineData; int v23 = v22[2 * k]; @@ -682,8 +680,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i a6[v24 + 2] = Ligne[v35].field8; v8 += a7; } - --v35; - } while (v35 > a4); + + } } v7 = Ligne[a4].field0 - 1; v36 = a4; @@ -722,72 +720,39 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i // Avoid 1 int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9) { - int v9; - int v10; - int i; - int16 *v12; - int v13; - int v14; - int v15; - int v16; - int16 *v17; - int v18; - int v19; - int j; - int16 *v21; - int v22; - int v23; - int v24; - int k; - int16 *v26; - int v27; - int v28; - int v29; - int16 *v30; - int v31; - int v32; - int v33; - int16 *v34; - int v35; - int v36; - int v38; - int v39; - int v40; + int v9 = a1; + int v10 = a2; + int v40 = a3; int v50; - - v9 = a1; - v10 = a2; - v40 = a3; if (a4 < a1) { - for (i = a2; Ligne[a1].field0 > i; ++i) { - v12 = Ligne[a1].lineData; - v13 = v12[2 * i]; + for (int i = a2; Ligne[a1].field0 > i; ++i) { + int16 *v12 = Ligne[a1].lineData; + int v13 = v12[2 * i]; v50 = v12[2 * i + 1]; - v14 = v40; + int v14 = v40; a6[v14] = v13; a6[v14 + 1] = v50; a6[v14 + 2] = Ligne[a1].field6; v40 += a7; } - v15 = a1 + 1; + int v15 = a1 + 1; if ((int)(a1 + 1) == a9 + 1) v15 = a8; while (a4 != v15) { - v16 = 0; if (Ligne[v15].field0 > 0) { - do { - v17 = Ligne[v15].lineData; - v18 = v17[2 * v16]; + for (int v16 = 0; v16 < Ligne[v15].field0; v16++) { + int16 *v17 = Ligne[v15].lineData; + int v18 = v17[2 * v16]; v50 = v17[2 * v16 + 1]; - v19 = v40; + int v19 = v40; a6[v19] = v18; a6[v19 + 1] = v50; a6[v19 + 2] = Ligne[v15].field6; v40 += a7; - ++v16; - } while (Ligne[v15].field0 > v16); + + } } ++v15; if (a9 + 1 == v15) @@ -797,27 +762,27 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v9 = a4; } if (a4 > v9) { - for (j = v10; j > 0; --j) { - v21 = Ligne[v9].lineData; - v22 = v21[2 * j]; + for (int j = v10; j > 0; --j) { + int16 *v21 = Ligne[v9].lineData; + int v22 = v21[2 * j]; v50 = v21[2 * j + 1]; - v23 = v40; + int v23 = v40; a6[v23] = v22; a6[v23 + 1] = v50; a6[v23 + 2] = Ligne[v9].field8; v40 += a7; } - v24 = v9 - 1; + int v24 = v9 - 1; if (v24 == a8 - 1) v24 = a9; while (a4 != v24) { - for (k = Ligne[v24].field0 - 1; k > 0; --k) { - v26 = Ligne[v24].lineData; - v27 = v26[2 * k]; + for (int k = Ligne[v24].field0 - 1; k > 0; --k) { + int16 *v26 = Ligne[v24].lineData; + int v27 = v26[2 * k]; v50 = v26[2 * k + 1]; - v28 = v40; + int v28 = v40; a6[v28] = v27; a6[v28 + 1] = v50; a6[v28 + 2] = Ligne[v24].field8; @@ -833,36 +798,32 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, if (a4 == v9) { if (a5 >= v10) { if (a5 > v10) { - v33 = v10; - v39 = a4; - do { - v34 = Ligne[v39].lineData; - v35 = v34[2 * v33]; + int v39 = a4; + for (int v33 = v10; v33 < a5; v33++) { + int16 *v34 = Ligne[v39].lineData; + int v35 = v34[2 * v33]; v50 = v34[2 * v33 + 1]; - v36 = v40; + int v36 = v40; a6[v36] = v35; a6[v36 + 1] = v50; a6[v36 + 2] = Ligne[v39].field6; v40 += a7; - ++v33; - } while (a5 > v33); + } } } else { - v29 = v10; - v38 = a4; - do { - v30 = Ligne[v38].lineData; - v31 = v30[2 * v29]; + int v38 = a4; + for (int v29 = v10; v29 > a5; v29--) { + int16 *v30 = Ligne[v38].lineData; + int v31 = v30[2 * v29]; v50 = v30[2 * v29 + 1]; - v32 = v40; + int v32 = v40; a6[v32] = v31; a6[v32 + 1] = v50; a6[v32 + 2] = Ligne[v38].field8; v40 += a7; - --v29; - } while (a5 < v29); + } } } return v40; @@ -1181,101 +1142,9 @@ LABEL_186: } int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { - int v9; - int16 *v10; - int v11; - int16 *v12; - int16 *v13; - int v14; - int v15; - int16 *v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - int v25; - int v26; - int v27; - int16 *v28; - int v29; - int v30; - int v31; - int v32; - int v33; - int v34; - int v35 = 0; - int v36 = 0; - int v37; - int v38; - int v40; - int v41; - int v42 = 0; - int v43 = 0; - int v44 = 0; - int v45 = 0; - int v46 = 0; - int v47 = 0; - int v48 = 0; - int v49 = 0; - int v50; - int16 *v51; - int v52; - int v53; - int v54; - int v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v61; - int v62; - int v63; - int v64; - int v65; - int v66 = 0; - int v67; - int v68 = 0; - int v69; - int v70 = 0; - int v71; - int v72 = 0; - int v73; - int v74; - int v75; - int v76; - int v77 = 0; - int v78 = 0; - int v79 = 0; - int v80; - int v81; - int v82; - int v83; - int v84; - int v85; - int v86; - int v87; - int v88; - int v89; - int i; - int v91; - int v92; - int v93; - int v94; - int v95; - int v96; - int v97; - int v98; - int v99; - int v100; - int v101; - - v99 = a7; - v80 = -1; + int v99 = a7; + int v80 = -1; + int v9; ++_vm->_globals.STOP_BUG; if (_vm->_globals.STOP_BUG > 10) { v9 = a7; @@ -1285,16 +1154,17 @@ LABEL_112: a8[v9 + 2] = -1; return -1; } - v10 = Ligne[a1].lineData; - v98 = v10[0]; - v97 = v10[1]; - v92 = a1; + int16 *v10 = Ligne[a1].lineData; + int v98 = v10[0]; + int v97 = v10[1]; + int v92 = a1; + int v65; while (1) { - v86 = v92 - 1; - v11 = 2 * Ligne[v92 - 1].field0; + int v86 = v92 - 1; + int v11 = 2 * Ligne[v92 - 1].field0; - v12 = Ligne[v92 - 1].lineData; + int16 *v12 = Ligne[v92 - 1].lineData; if (v12 == (int16 *)g_PTRNUL) break; while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) { @@ -1313,18 +1183,19 @@ LABEL_112: v97 = v12[1]; } LABEL_11: - v13 = Ligne[a1].lineData; - v14 = 2 * Ligne[a1].field0; - v95 = v13[v14 - 2]; - v93 = v13[v14 - 1]; - v91 = a1; - + int16 *v13 = Ligne[a1].lineData; + int v14 = 2 * Ligne[a1].field0; + int v95 = v13[v14 - 2]; + int v93 = v13[v14 - 1]; + int v91 = a1; + int v100, v101; for (;;) { - v87 = v91 + 1; - v15 = 2 * Ligne[v91 + 1].field0; - v16 = Ligne[v91 + 1].lineData; + int v87 = v91 + 1; + int v15 = 2 * Ligne[v91 + 1].field0; + int16 *v16 = Ligne[v91 + 1].lineData; if (v16 == (int16 *)g_PTRNUL) break; + int v17; while (1) { v65 = v15; v17 = v16[v15 - 2]; @@ -1346,23 +1217,23 @@ LABEL_11: v93 = v16[v65 - 1]; } LABEL_17: - v18 = a3 - a5; + int v18 = a3 - a5; if (a3 - a5 < 0) v18 = -v18; - v58 = v18 + 1; - v19 = a4 - a6; + int v58 = v18 + 1; + int v19 = a4 - a6; if (a4 - a6 < 0) v19 = -v19; - v85 = v19 + 1; - v20 = v19 + 1; + int v85 = v19 + 1; + int v20 = v19 + 1; if (v58 > v20) v85 = v18 + 1; - v84 = 1000 * v58 / v85; - v83 = 1000 * v20 / v85; - v21 = 1000 * a3; - v22 = 1000 * a4; - v82 = v21 / 1000; - v81 = v22 / 1000; + int v84 = 1000 * v58 / v85; + int v83 = 1000 * v20 / v85; + int v21 = 1000 * a3; + int v22 = 1000 * a4; + int v82 = v21 / 1000; + int v81 = v22 / 1000; if (a5 < a3) v84 = -v84; if (a6 < a4) @@ -1371,12 +1242,11 @@ LABEL_17: v85 = 800; Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0); - v23 = 0; - v88 = 0; + int v23 = 0; if (v85 + 1 > 0) { - v51 = _vm->_globals.BufLig; - do { - v24 = v23; + int16 *v51 = _vm->_globals.BufLig; + for (int v88 = 0; v88 < v85 + 1; v88++) { + int v24 = v23; v51[v24] = v82; v51[v24 + 1] = v81; v21 += v84; @@ -1384,40 +1254,44 @@ LABEL_17: v82 = v21 / 1000; v81 = v22 / 1000; v23 += 2; - ++v88; - } while (v88 < v85 + 1); + } } - v25 = v23 - 2; - v26 = 0; - v89 = v85 + 1; - if ((int)(v85 + 1) > 0) { - do { - v96 = _vm->_globals.BufLig[v25]; - v94 = _vm->_globals.BufLig[v25 + 1]; + int v25 = v23 - 2; + bool loopCond = false; + int v77 = 0; + int v78 = 0; + int v79 = 0; + if (v85 + 1 > 0) { + for (int v89 = v85 + 1; v89 > 0; v89--) { + int v96 = _vm->_globals.BufLig[v25]; + int v94 = _vm->_globals.BufLig[v25 + 1]; if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { v80 = v100; v77 = v101; v78 = v96; v79 = v94; - v26 = 1; + loopCond = true; } - if (v26 == 1) + if (loopCond) break; v25 -= 2; - --v89; - } while (v89 > 0); + } } - for (i = v92; i < v91 + 1; ++i) { - v27 = 2 * Ligne[i].field0; - v28 = Ligne[i].lineData; + int v66 = 0; + int v68 = 0; + int v70 = 0; + int v72 = 0; + for (int i = v92; i < v91 + 1; ++i) { + int v27 = 2 * Ligne[i].field0; + int16 *v28 = Ligne[i].lineData; if (v28 == (int16 *)g_PTRNUL) error("error in genial routine"); - v29 = v28[0]; - v30 = v28[1]; - v59 = v28[1]; - v31 = v27; - v32 = v28[v27 - 2]; - v33 = v28[v31 - 1]; + int v29 = v28[0]; + int v30 = v28[1]; + int v59 = v28[1]; + int v31 = v27; + int v32 = v28[v27 - 2]; + int v33 = v28[v31 - 1]; if (i == v92) { v72 = v33; if (v30 <= v33) @@ -1450,13 +1324,14 @@ LABEL_17: v66 = v32; } } - v69 = v68 - 2; - v73 = v72 - 2; - v67 = v66 + 2; - v71 = v70 + 2; + int v69 = v68 - 2; + int v73 = v72 - 2; + int v67 = v66 + 2; + int v71 = v70 + 2; if (a5 >= v69 && a5 <= v67 && a6 >= v73 && a6 <= v71) { - v34 = a6; - v76 = -1; + int v34 = a6; + int v76 = -1; + int v60 = 0; do { --v34; v60 = colision2_ligne(a5, v34, &v101, &v100, v92, v91); @@ -1465,8 +1340,9 @@ LABEL_17: if (!v34 || v73 > v34) v60 = 1; } while (v60 != 1); - v35 = a6; - v75 = -1; + int v35 = a6; + int v75 = -1; + int v61 = 0; do { ++v35; v61 = colision2_ligne(a5, v35, &v101, &v100, v92, v91); @@ -1475,8 +1351,9 @@ LABEL_17: if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) v61 = 1; } while (v61 != 1); - v36 = a5; - v74 = -1; + int v36 = a5; + int v74 = -1; + int v62 = 0; do { ++v36; v62 = colision2_ligne(v36, a6, &v101, &v100, v92, v91); @@ -1485,8 +1362,9 @@ LABEL_17: if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) v62 = 1; } while (v62 != 1); - v37 = a5; - v38 = -1; + int v37 = a5; + int v38 = -1; + int v63 = 0; do { --v37; v63 = colision2_ligne(v37, a6, &v101, &v100, v92, v91); @@ -1504,13 +1382,13 @@ LABEL_17: NVPX = v78; NVPY = v79; if (a1 < v80) { - v40 = v80 - a1; - if (v80 - a1 < 0) + int v40 = v80 - a1; + if (v40 < 0) v40 = -v40; - v41 = v40; - v42 = a1; - v43 = 0; - v52 = v92 - 1; + int v41 = v40; + int v42 = a1; + int v43 = 0; + int v52 = v92 - 1; do { if (v52 == v42) v42 = v91; @@ -1520,12 +1398,12 @@ LABEL_17: v42 = v91; } while (v80 != v42); if (v41 == v43) { - v44 = Ligne[a1].field0 / 2; - v54 = Ligne[a1].field0 / 2; + int v44 = Ligne[a1].field0 / 2; + int v54 = Ligne[a1].field0 / 2; if (v44 < 0) v54 = -v44; if (a2 > v54) { - v55 = Ligne[a1].field0 / 2; + int v55 = Ligne[a1].field0 / 2; if (v44 < 0) v55 = -v44; if (a2 >= v55) @@ -1540,13 +1418,13 @@ LABEL_17: v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); } if (a1 > v80) { - v45 = a1 - v80; - if (a1 - v80 < 0) + int v45 = a1 - v80; + if (v45 < 0) v45 = -v45; - v46 = v45; - v47 = a1; - v48 = 0; - v53 = v91 + 1; + int v46 = v45; + int v47 = a1; + int v48 = 0; + int v53 = v91 + 1; do { if (v53 == v47) v47 = v92; @@ -1556,12 +1434,12 @@ LABEL_17: v47 = v92; } while (v80 != v47); if (v46 == v48) { - v49 = Ligne[a1].field0 / 2; - v56 = Ligne[a1].field0 / 2; + int v49 = Ligne[a1].field0 / 2; + int v56 = Ligne[a1].field0 / 2; if (v49 < 0) v56 = -v49; if (a2 > v56) { - v57 = Ligne[a1].field0 / 2; + int v57 = Ligne[a1].field0 / 2; if (v49 < 0) v57 = -v49; if (a2 >= v57) @@ -1577,10 +1455,11 @@ LABEL_17: } if (a1 == v80) v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); + int v64 = 0; do { v64 = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); if (v64 == 1) { - v50 = v100; + int v50 = v100; if (Ligne[v50].field4 == 1) --NVPY; if (Ligne[v50].field4 == 2) { @@ -2378,16 +2257,6 @@ LABEL_282: } int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int v15; - int v16; int16 *v17; int v18; int v19; @@ -2518,7 +2387,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v145; int colResult = 0; - v7 = a1; + int v7 = a1; v90 = a2; v137 = a7; v136 = 0; @@ -2526,7 +2395,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int v136 = 1; v144 = a5; if (colision2_ligne(a1, a2, &v145, &v144, 0, TOTAL_LIGNES) == 1) { - v8 = Ligne[v144].field4; + int v8 = Ligne[v144].field4; if (v8 == 1) v90 = a2 - 2; if (v8 == 2) { @@ -2559,6 +2428,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int v140 = -1; v138 = -1; + int v9, v10, v11, v12, v13, v14; for (;;) { v111 = v7; v109 = v90; @@ -2705,6 +2575,7 @@ LABEL_103: v91 = 4; if ((unsigned int)v102 <= 0x1FE) v91 = 5; + // CHECKME: The two conditions on v102 are not compatible! if (v102 >= -1 && v102 <= -510) v91 = 6; if ((unsigned int)(v102 + 510) <= 0x1FE) @@ -2760,8 +2631,9 @@ LABEL_67: } v91 = SMOOTH_SENS; v14 = 0; + int v16; while (1) { - v15 = SMOOTH[v14].field0; + int v15 = SMOOTH[v14].field0; v112 = v15; v110 = SMOOTH[v14].field2; if (v15 == -1 || SMOOTH[v14].field2 == -1) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 22c8a65dd9..948e2b2112 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -48,26 +48,7 @@ int ScriptManager::Traduction(byte *a1) { char v49; int v50; CharacterLocation *v51; - int v52; CharacterLocation *v53; - int v54; - int v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v65; - int v66; - int v67; - int v68; - int v69; - int v71; - int v72; - int v73; - int v74; - int v75; - int v76; Common::String file; int v1 = 0; @@ -77,9 +58,9 @@ int ScriptManager::Traduction(byte *a1) { if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { v70 = *(a1 + 6); int v2 = *(a1 + 7); - v69 = *(a1 + 8); - v67 = (int16)READ_LE_UINT16(a1 + 9); - v65 = (int16)READ_LE_UINT16(a1 + 11); + int v69 = *(a1 + 8); + int v67 = (int16)READ_LE_UINT16(a1 + 9); + int v65 = (int16)READ_LE_UINT16(a1 + 11); int v3 = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { @@ -198,11 +179,11 @@ LABEL_98: LABEL_104: if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { if (_vm->_objectsManager.DESACTIVE != true) { - v72 = *(a1 + 5); - v70 = *(a1 + 6); + int v72 = *(a1 + 5); + int v70 = *(a1 + 6); int v4 = *(a1 + 7); - v68 = (int16)READ_LE_UINT16(a1 + 8); - v66 = (int16)READ_LE_UINT16(a1 + 10); + int v68 = (int16)READ_LE_UINT16(a1 + 8); + int v66 = (int16)READ_LE_UINT16(a1 + 10); if (v72 == 52) { _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(a1 + 10), v70); } else if (v72 == 51) { @@ -325,7 +306,7 @@ LABEL_1141: v1 = 1; } if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { - v73 = (int16)READ_LE_UINT16(a1 + 5); + int v73 = (int16)READ_LE_UINT16(a1 + 5); if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { v70 = 0; if ((int16)READ_LE_UINT16(a1 + 5) == 14) @@ -510,7 +491,7 @@ LABEL_1141: if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') v1 = 1; if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + int v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; int v10 = 0; @@ -558,7 +539,7 @@ LABEL_1141: v1 = 1; } if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { - v75 = (int16)READ_LE_UINT16(a1 + 5); + int v75 = (int16)READ_LE_UINT16(a1 + 5); if (v75 <= 100) _vm->_objectsManager.BOBANIM_ON(v75); else @@ -566,7 +547,7 @@ LABEL_1141: v1 = 1; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { - v76 = (int16)READ_LE_UINT16(a1 + 5); + int v76 = (int16)READ_LE_UINT16(a1 + 5); if (v76 == 7) _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); if (v76 == 8) @@ -1949,14 +1930,12 @@ LABEL_1141: } if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(617, 4); - v71 = 0; - do { + for (int i = 0; i <= 29; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v71; - } while (v71 <= 29); + } v51 = &_vm->_globals.SAUVEGARDE->field370; v51->xp = _vm->_objectsManager.XSPR(0); v51->yp = _vm->_objectsManager.YSPR(0); @@ -2018,7 +1997,7 @@ LABEL_1141: _vm->_graphicsManager.VISU_ALL(); _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW(); - v52 = 0; + bool v52 = false; _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); do { if (_vm->shouldQuit()) @@ -2026,7 +2005,7 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { _vm->_soundManager.PLAY_WAV(1); - v52 = 1; + v52 = true; } _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 34); @@ -2191,7 +2170,7 @@ LABEL_1141: v53->field2 = 64; v53->location = _vm->_globals.ECRAN; - v54 = _vm->_globals.STAILLE[790 / 2]; + int v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; v76 = -(100 * (67 - (100 - v54)) / 67); @@ -2246,8 +2225,8 @@ LABEL_1141: _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - v55 = _vm->_objectsManager.YSPR(0); - v56 = _vm->_objectsManager.XSPR(0); + int v55 = _vm->_objectsManager.YSPR(0); + int v56 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; @@ -2270,8 +2249,8 @@ LABEL_1141: _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - v57 = _vm->_objectsManager.YSPR(0); - v58 = _vm->_objectsManager.XSPR(0); + int v57 = _vm->_objectsManager.YSPR(0); + int v58 = _vm->_objectsManager.XSPR(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; @@ -2316,13 +2295,13 @@ LABEL_1141: v1 = 1; } if (*(a1 + 2) == 'J' && *(a1 + 3) == 'U' && *(a1 + 4) == 'M') { - v59 = (int16)READ_LE_UINT16(a1 + 7); + int v59 = (int16)READ_LE_UINT16(a1 + 7); _vm->_objectsManager.NVZONE = (int16)READ_LE_UINT16(a1 + 5); _vm->_objectsManager.NVVERBE = v59; v1 = 6; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { - v60 = (int16)READ_LE_UINT16(a1 + 5); + int v60 = (int16)READ_LE_UINT16(a1 + 5); file = Common::String::format("SOUND%d.WAV", v60); _vm->_soundManager.PLAY_SOUND(file); -- cgit v1.2.3 From cc9a0bbb6d428391a507c71947ae616677153673 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Nov 2012 07:08:13 +1100 Subject: HOPKINS: Comments and parameter naming for CHANGE_TETE --- engines/hopkins/objects.cpp | 10 +++++----- engines/hopkins/objects.h | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index fc25712823..e87965ca65 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3068,7 +3068,7 @@ void ObjectsManager::CLEAR_ECRAN() { } // Change Face/Head -void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { +void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { CharacterLocation *loc; CH_TETE = 1; @@ -3077,7 +3077,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (a1 == CHARACTER_SAMANTHA && !a2 && _vm->_globals.SAUVEGARDE->field370.location) { + if (oldCharacter == CHARACTER_SAMANTHA && !newCharacter && _vm->_globals.SAUVEGARDE->field370.location) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->field380; loc->xp = XSPR(0); @@ -3103,7 +3103,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); - } else if (!a1 && a2 == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->field380.location == _vm->_globals.ECRAN) { + } else if (!oldCharacter && newCharacter == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->field380.location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->field370; loc->xp = XSPR(0); @@ -3127,7 +3127,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); } else { - switch (a1) { + switch (oldCharacter) { case CHARACTER_HOPKINS: loc = &_vm->_globals.SAUVEGARDE->field370; loc->xp = XSPR(0); @@ -3156,7 +3156,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2) { break; } - switch (a2) { + switch (newCharacter) { case CHARACTER_HOPKINS: _vm->_globals.SAUVEGARDE->data[svField121] = 0; _vm->_globals.SAUVEGARDE->data[svField354] = 0; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index aec0ef1c4c..d38000aa43 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -189,7 +189,13 @@ public: void PARADISE(); void CLEAR_ECRAN(); - void CHANGE_TETE(PlayerCharacter a1, PlayerCharacter a2); + /** + * Change the currently active player + * @param oldCharacter Previously played character + * @param newCharacter New character to play + */ + void CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); + void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); int16 *PARC_VOITURE(int a1, int a2, int a3, int a4); -- cgit v1.2.3 From f6a098bc4f804feb0708ab92b6f9f950d0ac5fdd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Nov 2012 20:18:38 +1100 Subject: HOPKINS: Bugfix for intermittent crash when opening Save/Load dialog --- engines/hopkins/font.cpp | 18 ++++++------------ engines/hopkins/font.h | 1 + 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 64f39f9c9e..df9aa94458 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -32,23 +32,17 @@ namespace Hopkins { +FontManager::FontManager() { + clearAll(); +} + void FontManager::setParent(HopkinsEngine *vm) { _vm = vm; } void FontManager::clearAll() { - for (int idx = 0; idx < 11; ++idx) { - Txt[idx].textOn = false; - Txt[idx].lineCount = 0; - Txt[idx].field3FC = 0; - Txt[idx].field3FE = 0; - Txt[idx].textBlock = NULL; - Txt[idx].width = 0; - Txt[idx].height = 0; - Txt[idx].textLoaded = false; - - ListeTxt[idx].enabled = false; - } + for (int idx = 0; idx < 11; ++idx) + Common::fill((byte *)&Txt[idx], (byte *)&Txt[idx] + sizeof(TxtItem), 0); } // Text On diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index a2ae88a028..08b32377a7 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -71,6 +71,7 @@ public: int Index[4048]; byte *texte_tmp; public: + FontManager(); void setParent(HopkinsEngine *vm); void clearAll(); -- cgit v1.2.3 From dc07463dfd2dfcf5132cd338599521df98d089d2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Nov 2012 20:31:45 +1100 Subject: HOPKINS: Disable scene scrolling when the Options or save/load dialog is shown --- engines/hopkins/dialogs.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 000afed3c8..d30cdafafa 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -531,13 +531,19 @@ void DialogsManager::TestForDialogOpening() { _vm->_dialogsManager.showInventory(); break; case KEY_OPTIONS: + _vm->_graphicsManager.no_scroll = 1; _vm->_dialogsManager.showOptionsDialog(); + _vm->_graphicsManager.no_scroll = 0; break; case KEY_LOAD: + _vm->_graphicsManager.no_scroll = 1; _vm->_dialogsManager.CHARGE_PARTIE(); + _vm->_graphicsManager.no_scroll = 0; break; case KEY_SAVE: + _vm->_graphicsManager.no_scroll = 1; _vm->_dialogsManager.SAUVE_PARTIE(); + _vm->_graphicsManager.no_scroll = 0; break; default: break; -- cgit v1.2.3 From 9f9bf34ffd112893ea62b0cf0905f8109d3ef5a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Nov 2012 20:56:47 +1100 Subject: HOPKINS: Renamed CharcaterInfo fields of SAUVEGARDE --- engines/hopkins/globals.h | 6 +++--- engines/hopkins/objects.cpp | 24 ++++++++++++------------ engines/hopkins/saveload.cpp | 6 +++--- engines/hopkins/script.cpp | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index bc87144eb3..366b13ddfc 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -279,9 +279,9 @@ enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARA // TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { byte data[0x802]; - CharacterLocation field360; - CharacterLocation field370; - CharacterLocation field380; + CharacterLocation cloneHopkins; + CharacterLocation realHopkins; + CharacterLocation samantha; int16 inventory[35]; // Originally at offset 1300 of data array }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e87965ca65..43c7d163c0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3077,9 +3077,9 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (oldCharacter == CHARACTER_SAMANTHA && !newCharacter && _vm->_globals.SAUVEGARDE->field370.location) { + if (oldCharacter == CHARACTER_SAMANTHA && !newCharacter && _vm->_globals.SAUVEGARDE->realHopkins.location) { CH_TETE = 0; - loc = &_vm->_globals.SAUVEGARDE->field380; + loc = &_vm->_globals.SAUVEGARDE->samantha; loc->xp = XSPR(0); loc->yp = YSPR(0); loc->field2 = 64; @@ -3096,16 +3096,16 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField357] = 1; T_RECTIF = 0; - loc = &_vm->_globals.SAUVEGARDE->field370; + loc = &_vm->_globals.SAUVEGARDE->realHopkins; _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); - } else if (!oldCharacter && newCharacter == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->field380.location == _vm->_globals.ECRAN) { + } else if (!oldCharacter && newCharacter == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { CH_TETE = 0; - loc = &_vm->_globals.SAUVEGARDE->field370; + loc = &_vm->_globals.SAUVEGARDE->realHopkins; loc->xp = XSPR(0); loc->yp = YSPR(0); loc->field2 = 64; @@ -3119,7 +3119,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - loc = &_vm->_globals.SAUVEGARDE->field380; + loc = &_vm->_globals.SAUVEGARDE->samantha; _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); _vm->_globals.PERSO_TYPE = 2; @@ -3129,7 +3129,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n } else { switch (oldCharacter) { case CHARACTER_HOPKINS: - loc = &_vm->_globals.SAUVEGARDE->field370; + loc = &_vm->_globals.SAUVEGARDE->realHopkins; loc->xp = XSPR(0); loc->yp = YSPR(0); loc->field2 = 64; @@ -3137,7 +3137,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->field4 = Sprite[0].fieldC; break; case CHARACTER_HOPKINS_CLONE: - loc = &_vm->_globals.SAUVEGARDE->field360; + loc = &_vm->_globals.SAUVEGARDE->cloneHopkins; loc->xp = XSPR(0); loc->yp = YSPR(0); loc->field2 = 64; @@ -3145,7 +3145,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->field4 = Sprite[0].fieldC; break; case CHARACTER_SAMANTHA: - loc = &_vm->_globals.SAUVEGARDE->field380; + loc = &_vm->_globals.SAUVEGARDE->samantha; loc->xp = XSPR(0); loc->yp = YSPR(0); loc->field2 = 64; @@ -3162,21 +3162,21 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field370.location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->realHopkins.location; break; case CHARACTER_HOPKINS_CLONE: _vm->_globals.SAUVEGARDE->data[svField121] = 1; _vm->_globals.SAUVEGARDE->data[svField354] = 1; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field360.location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->cloneHopkins.location; break; case CHARACTER_SAMANTHA: _vm->_globals.SAUVEGARDE->data[svField121] = 0; _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->field380.location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->samantha.location; break; } } diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 958737d773..47fc140290 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -235,9 +235,9 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { void SaveLoadManager::syncSavegameData(Common::Serializer &s) { s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 0x802); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->field360); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->field370); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->field380); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->cloneHopkins); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->realHopkins); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->samantha); for (int i = 0; i < 35; ++i) s.syncAsSint16LE(_vm->_globals.SAUVEGARDE->inventory[i]); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 948e2b2112..a0b17c13ed 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1936,7 +1936,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - v51 = &_vm->_globals.SAUVEGARDE->field370; + v51 = &_vm->_globals.SAUVEGARDE->realHopkins; v51->xp = _vm->_objectsManager.XSPR(0); v51->yp = _vm->_objectsManager.YSPR(0); v51->field2 = 57; @@ -2164,7 +2164,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.PLAY_SEQ("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; - v53 = &_vm->_globals.SAUVEGARDE->field380; + v53 = &_vm->_globals.SAUVEGARDE->samantha; v53->xp = 404; v53->yp = 395; v53->field2 = 64; -- cgit v1.2.3 From fc33d2d7625e3a3967f17b0c01f7bdef1e1dec8b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Nov 2012 21:25:14 +1100 Subject: HOPKINS: Replaced many occurrences of 640 with SCREEN_WIDTH --- engines/hopkins/anim.cpp | 16 ++++++++-------- engines/hopkins/events.cpp | 14 +++++++------- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/hopkins.cpp | 12 ++++++------ engines/hopkins/objects.cpp | 16 ++++++++-------- engines/hopkins/talk.cpp | 16 ++++++++-------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index ee959d169d..cf69e7164b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -74,7 +74,7 @@ LABEL_2: _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); } - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > 640) { + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { hasScreenCopy = true; screenCopy = _vm->_globals.dos_malloc2(0x4B000u); memcpy(screenCopy, v10, 0x4B000u); @@ -88,15 +88,15 @@ LABEL_2: _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (hasScreenCopy) - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(v10, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (hasScreenCopy) - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(v10, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); @@ -151,9 +151,9 @@ LABEL_38: if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*v10 != kByteStop) { if (_vm->_graphicsManager.Winbpp == 1) @@ -190,7 +190,7 @@ LABEL_57: _vm->_globals.dos_free2(ptr); f.close(); - if (1 /*hasScreenCopy <= 640 */) + if (1 /*hasScreenCopy <= SCREEN_WIDTH */) goto LABEL_2; goto LABEL_55; } diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 5dc68064f2..2271bff7b4 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -441,8 +441,8 @@ LABEL_65: } if (_vm->_graphicsManager.SCROLL < 0) _vm->_graphicsManager.SCROLL = 0; - if (_vm->_graphicsManager.SCROLL > 640) - _vm->_graphicsManager.SCROLL = 640; + if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) + _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; if (_vm->_graphicsManager.SDL_ECHELLE) v4 = _vm->_graphicsManager.Magic_Number(_vm->_graphicsManager.SCROLL); else @@ -455,10 +455,10 @@ LABEL_65: if (_vm->_graphicsManager.SDL_ECHELLE) { if (_vm->_graphicsManager.Winbpp == 2) { int v5 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v5); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v5); } else { int v6 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, v6); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v6); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.Reel_Zoom(0, _vm->_graphicsManager.SDL_ECHELLE); @@ -467,11 +467,11 @@ LABEL_65: _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.Reel_Zoom(0x1B8u, _vm->_graphicsManager.SDL_ECHELLE)); } else { if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, 640, 440, 0, 20); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, 640, 460); + _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); } // CHECKME: Useless? diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a5d9768319..3b204ba057 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1207,7 +1207,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } } - if (destOffset > 640 * 480) { + if (destOffset > SCREEN_WIDTH * SCREEN_HEIGHT) { warning("HACK: Stopping anim, out of bounds - 0x%x %d", srcByte, destOffset); return; } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 190a6ad679..dc9db140bf 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1349,7 +1349,7 @@ LABEL_243: _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; - _graphicsManager.nbrligne = 640; + _graphicsManager.nbrligne = SCREEN_WIDTH; break; } } @@ -1402,7 +1402,7 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { void HopkinsEngine::INIT_SYSTEM() { // Set graphics mode - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); // Synchronise the sound settings from ScummVM _soundManager.syncSoundSettings(); @@ -1749,8 +1749,8 @@ void HopkinsEngine::ENDEMO() { } void HopkinsEngine::BOOM() { - _graphicsManager.nbrligne = 640; - _graphicsManager.SCANLINE(640); + _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager.SCANLINE(SCREEN_WIDTH); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1875,7 +1875,7 @@ void HopkinsEngine::INCENDIE() { void HopkinsEngine::BASE() { _globals.iRegul = 1; - _graphicsManager.nbrligne = 640; + _graphicsManager.nbrligne = SCREEN_WIDTH; _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2138,7 +2138,7 @@ void HopkinsEngine::JOUE_FIN() { void HopkinsEngine::AVION() { _soundManager.WSOUND(28); _globals.iRegul = 1; - _globals.nbrligne = 640; + _globals.nbrligne = SCREEN_WIDTH; _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 43c7d163c0..eaca054036 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2929,8 +2929,8 @@ LABEL_64: _vm->_graphicsManager.SCROLL = 0; v1 = 1; } - if (_vm->_graphicsManager.SCROLL > 640) { - _vm->_graphicsManager.SCROLL = 640; + if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { + _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; v1 = 1; } if (_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) { @@ -2948,8 +2948,8 @@ LABEL_64: _vm->_graphicsManager.SCROLL = 0; v1 = 1; } - if (_vm->_graphicsManager.SCROLL > 640) { - _vm->_graphicsManager.SCROLL = 640; + if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { + _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; v1 = 1; } if (_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) { @@ -4263,15 +4263,15 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); v2 = _vm->_graphicsManager.VESA_BUFFER; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0e57e57437..20bf11b13c 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -165,15 +165,15 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.DD_LOCK(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_UNLOCK(); v8 = _vm->_graphicsManager.VESA_BUFFER; @@ -1334,15 +1334,15 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, 640, 480, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); -- cgit v1.2.3 From fede8845aae8cc91d5a4d3da7df7e9d8ea54dc82 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Nov 2012 22:38:37 +1100 Subject: HOPKINS: Properly initialise the NO_COUL variable at startup. This fixes animation issues with the factory lift near the end of the game. --- engines/hopkins/anim.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index cf69e7164b..9cd97cf53a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -36,6 +36,7 @@ namespace Hopkins { AnimationManager::AnimationManager() { CLS_ANM = false; NO_SEQ = false; + NO_COUL = false; } // Play Anim -- cgit v1.2.3 From 39edde3513fa9258a421fc9af8278a181ca97a41 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 Nov 2012 20:51:10 +1100 Subject: HOPKINS: fix hanging when selecting Exit from the Linux full game menu --- engines/hopkins/hopkins.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dc9db140bf..242108daee 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -564,6 +564,7 @@ LABEL_11: if (_globals.SORTIE == -1) { _globals.PERSO = _globals.dos_free2(_globals.PERSO); REST_SYSTEM(); + return true; } } for (;;) { -- cgit v1.2.3 From 64ec4a1c63a142c7eb3ce21e112e18eb5c6c107c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 Nov 2012 21:05:11 +1100 Subject: HOPKINS: Fix if condition check in CHANGE_TETE --- engines/hopkins/objects.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index eaca054036..dcb3a40b27 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3077,7 +3077,8 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (oldCharacter == CHARACTER_SAMANTHA && !newCharacter && _vm->_globals.SAUVEGARDE->realHopkins.location) { + if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS + && _vm->_globals.SAUVEGARDE->realHopkins.location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->samantha; loc->xp = XSPR(0); @@ -3103,7 +3104,8 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); - } else if (!oldCharacter && newCharacter == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { + } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA + && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->realHopkins; loc->xp = XSPR(0); @@ -3111,10 +3113,12 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->field2 = 64; loc->location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; + SPRITE_OFF(1); SPRITE(_vm->_globals.TETE, loc->xp, loc->yp, 1, 2, loc->field4, 0, 34, 190); SPRITE_ON(1); SPRITE_OFF(0); + _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; -- cgit v1.2.3 From cf5a2fd878640ada856808f097c54b68bc526728 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 Nov 2012 21:36:45 +1100 Subject: HOPKINS: Fix SAUVEGARDE pointer references to use proper data array --- engines/hopkins/globals.h | 12 ++++++++ engines/hopkins/hopkins.cpp | 72 ++++++++++++++++++++++----------------------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 366b13ddfc..7d01d9fa45 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -226,15 +226,22 @@ enum SauvegardeOffset { , svField80 = 80 , svField94 = 94 , svField95 = 95 + , svField113 = 113 + , svField117 = 117 , svField121 = 121 , svField122 = 122 + , svField123 = 123 , svField132 = 132 , svField133 = 133 + , svField135 = 135 + , svField166 = 166 + , svField167 = 167 , svField170 = 170 , svField171 = 171 , svField172 = 172 , svField173 = 173 , svField176 = 176 + , svField177 = 177 , svField180 = 180 , svField181 = 181 , svField182 = 182 @@ -250,14 +257,19 @@ enum SauvegardeOffset { , svField192 = 192 , svField193 = 193 , svField194 = 194 + , svField220 = 220 + , svField225 = 225 , svField228 = 228 , svField231 = 231 , svField253 = 253 , svField261 = 261 , svField270 = 270 , svField300 = 300 + , svField311 = 311 + , svField312 = 312 , svField318 = 318 , svField320 = 320 + , svField330 = 330 , svField333 = 333 , svField338 = 338 , svField339 = 339 diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 242108daee..7e88a4fd63 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -208,7 +208,7 @@ LABEL_13: if (_globals.SORTIE != 3) break; - if (!*((byte *)_globals.SAUVEGARDE + 170)) { + if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); if (_globals.FR == 1) _graphicsManager.LOAD_IMAGE("fondfr"); @@ -237,7 +237,7 @@ LABEL_13: _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - *((byte *)_globals.SAUVEGARDE + 170) = 1; + _globals.SAUVEGARDE->data[svField170] = 1; } _globals.Max_Propre = 5; @@ -262,7 +262,7 @@ LABEL_13: _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - byte v1 = *((byte *)_globals.SAUVEGARDE + 80); + byte v1 = _globals.SAUVEGARDE->data[svField80]; if (v1) { if (v1 == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); @@ -294,7 +294,7 @@ LABEL_13: if (_globals.SORTIE != 7) break; - if (*((byte *)_globals.SAUVEGARDE + 220)) + if (_globals.SAUVEGARDE->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -306,7 +306,7 @@ LABEL_13: _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!*((byte *)_globals.SAUVEGARDE + 225)) + if (!_globals.SAUVEGARDE->data[svField225]) goto LABEL_109; _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { @@ -332,7 +332,7 @@ LABEL_13: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (*((byte *)_globals.SAUVEGARDE + 225)) { + if (_globals.SAUVEGARDE->data[svField225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { @@ -366,7 +366,7 @@ LABEL_109: _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - byte v2 = *((byte *)_globals.SAUVEGARDE + 113); + byte v2 = _globals.SAUVEGARDE->data[svField113]; if (v2 == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!v2) { @@ -430,9 +430,9 @@ LABEL_124: } else if (_globals.SORTIE == 113) { _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; - *((byte *)_globals.SAUVEGARDE + 5) = 113; + _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); @@ -447,18 +447,18 @@ LABEL_124: if (_globals.SORTIE == 114) { _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 114; - *((byte *)_globals.SAUVEGARDE + 5) = 114; + _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); goto LABEL_128; } if (_globals.SORTIE == 115) { _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; - *((byte *)_globals.SAUVEGARDE + 5) = 115; + _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); LABEL_128: @@ -616,7 +616,7 @@ LABEL_11: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (*((byte *)_globals.SAUVEGARDE + 123)) + if (_globals.SAUVEGARDE->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); @@ -655,7 +655,7 @@ LABEL_231: } if (_globals.SORTIE != 3) break; - if (!*((byte *)_globals.SAUVEGARDE + 170)) { + if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); if (_globals.FR == 1) _graphicsManager.LOAD_IMAGE("fondfr"); @@ -682,7 +682,7 @@ LABEL_231: _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - *((byte *)_globals.SAUVEGARDE + 170) = 1; + _globals.SAUVEGARDE->data[svField170] = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -704,7 +704,7 @@ LABEL_231: _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - byte v2 = *((byte *)_globals.SAUVEGARDE + 80); + byte v2 = _globals.SAUVEGARDE->data[svField80]; if (v2) { if (v2 == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); @@ -731,7 +731,7 @@ LABEL_231: } if (_globals.SORTIE != 7) break; - if (*((byte *)_globals.SAUVEGARDE + 220)) + if (_globals.SAUVEGARDE->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -741,7 +741,7 @@ LABEL_231: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!*((byte *)_globals.SAUVEGARDE + 225)) + if (!_globals.SAUVEGARDE->data[svField225]) goto LABEL_140; _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); } else { @@ -765,7 +765,7 @@ LABEL_231: _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (*((byte *)_globals.SAUVEGARDE + 225)) { + if (_globals.SAUVEGARDE->data[svField225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { @@ -799,7 +799,7 @@ LABEL_140: _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - byte v3 = *((byte *)_globals.SAUVEGARDE + 113); + byte v3 = _globals.SAUVEGARDE->data[svField113]; if (v3 == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!v3) { @@ -812,7 +812,7 @@ LABEL_140: _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - byte v4 = *((byte *)_globals.SAUVEGARDE + 117); + byte v4 = _globals.SAUVEGARDE->data[svField117]; if (v4 == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); } else if (!v4) { @@ -840,7 +840,7 @@ LABEL_140: _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - byte v5 = *((byte *)_globals.SAUVEGARDE + 181); + byte v5 = _globals.SAUVEGARDE->data[svField181]; if (v5) { if (v5 == 1) _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); @@ -875,7 +875,7 @@ LABEL_140: _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - byte v6 = *((byte *)_globals.SAUVEGARDE + 177); + byte v6 = _globals.SAUVEGARDE->data[svField177]; if (v6 == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); } else if (!v6) { @@ -889,7 +889,7 @@ LABEL_140: _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - if (*((byte *)_globals.SAUVEGARDE + 166) != 1 || *((byte *)_globals.SAUVEGARDE + 167) != 1) + if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); else _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); @@ -1022,7 +1022,7 @@ LABEL_140: goto LABEL_239; } if (_globals.SORTIE == 61) { - if (*((byte *)_globals.SAUVEGARDE + 311) == 1 && !*((byte *)_globals.SAUVEGARDE + 312)) + if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) INCENDIE(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); @@ -1119,7 +1119,7 @@ LABEL_140: _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - byte v7 = *((byte *)_globals.SAUVEGARDE + 318); + byte v7 = _globals.SAUVEGARDE->data[svField318]; if (v7 == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); } else if (!v7) { @@ -1135,7 +1135,7 @@ LABEL_140: _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; - if (*((byte *)_globals.SAUVEGARDE + 330)) + if (_globals.SAUVEGARDE->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); else _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); @@ -1259,9 +1259,9 @@ LABEL_239: } else if (_globals.SORTIE == 113) { _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; - *((byte *)_globals.SAUVEGARDE + 5) = 113; + _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -1275,9 +1275,9 @@ LABEL_239: if (_globals.SORTIE == 114) { _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 114; - *((byte *)_globals.SAUVEGARDE + 5) = 114; + _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); goto LABEL_243; } @@ -1285,9 +1285,9 @@ LABEL_239: case 115: _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - *((byte *)_globals.SAUVEGARDE + 6) = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; - *((byte *)_globals.SAUVEGARDE + 5) = 115; + _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); LABEL_243: _graphicsManager.DD_Lock(); @@ -1870,7 +1870,7 @@ void HopkinsEngine::INCENDIE() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - *((byte *)_globals.SAUVEGARDE + 312) = 1; + _globals.SAUVEGARDE->data[svField312] = 1; _globals.DESACTIVE_INVENT = false; } @@ -2062,7 +2062,7 @@ void HopkinsEngine::JOUE_FIN() { while (_objectsManager.BOBPOSI(7) != 120); _objectsManager.BOBANIM_OFF(7); - if (*((byte *)_globals.SAUVEGARDE + 135) == 1) { + if (_globals.SAUVEGARDE->data[svField135] == 1) { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; _graphicsManager.FADE_LINUX = 2; -- cgit v1.2.3 From 81d8ec5a74c784b4cd6c9cf9d9ffdefc6d6f8db4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Nov 2012 22:33:51 +0100 Subject: HOPKINS: Rework SCBOB(), silent some CppCheck warnings --- engines/hopkins/font.cpp | 30 ++++----- engines/hopkins/objects.cpp | 148 +++++++++++++++++--------------------------- engines/hopkins/script.cpp | 40 +++++------- engines/hopkins/talk.cpp | 10 ++- 4 files changed, 86 insertions(+), 142 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index df9aa94458..414d88e399 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -111,7 +111,6 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, byte *v9; byte *ptre; Common::String s; - byte *v59; Common::String file; Common::File f; @@ -122,7 +121,6 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, _vm->_globals.police_l = 11; _vm->_globals.largeur_boite = 11 * Txt[idx].field3FE; - int lineCount = 0; if (Txt[idx].textLoaded) { int v34 = Txt[idx].field3FC; if (v34 != 6 && v34 != 1 && v34 != 3 && v34 != 5) { @@ -146,6 +144,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); } } else { + int lineCount = 0; int v62 = 0; do { TRIER_TEXT[v62++] = 0; @@ -195,13 +194,11 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v11 = 0; WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } - v59 = texte_tmp; - int v63 = 0; - int v64 = 0; + byte *v59 = texte_tmp; byte *v60; if (!v69) goto LABEL_43; - do { + for (int v63 = 0; v63 < v69; v63++) { byte v13 = *v59; if ((byte)(*v59 + 46) > 0x1Bu) { if ((byte)(v13 + 80) > 0x1Bu) { @@ -214,12 +211,12 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v13 += 111; } *v59 = v13; - v59 = v59 + 1; - ++v63; - } while (v63 < v69); + v59++; + }; v60 = texte_tmp; if (v69) { + int v64 = 0; while (1) { byte v14 = *(v60 + v64); if (v14 == '\r' || v14 == '\n') { @@ -234,16 +231,13 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, Txt[idx].field3FE = v64; _vm->_globals.largeur_boite = 0; - int v15 = 0; - byte v16; if (v64 + 1 > 0) { - do { - v16 = *(v60 + v15); + for (int v15 = 0; v15 < v64 + 1; v15++) { + byte v16 = *(v60 + v15); if ((byte)v16 <= 0x1Fu) v16 = 32; _vm->_globals.largeur_boite += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v16 - 32); - ++v15; - } while (v15 < v64 + 1); + } } _vm->_globals.largeur_boite += 2; int v17 = _vm->_globals.largeur_boite / 2; @@ -309,16 +303,14 @@ LABEL_57: TRIER_TEXT[i] = 0; } else { int ptrc = 0; - int v23 = 0; if (v22 - 1 > 0) { - do { + for (int v23 = 0; v23 < TRIER_TEXT[i] - 1; v23++) { Common::String &line = Txt[idx].lines[i]; byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if ((byte)v24 <= 0x1Fu) v24 = 32; ptrc += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v24 - 32); - ++v23; - } while (v23 < TRIER_TEXT[i] - 1); + } } TRIER_TEXT[i] = ptrc; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index dcb3a40b27..767decdded 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -719,106 +719,75 @@ void ObjectsManager::BOB_OFFSETY(int idx, int v) { } void ObjectsManager::SCBOB(int idx) { + if (_vm->_globals.Cache[idx].fieldA <= 0) + return; + int v1 = idx; - if (_vm->_globals.Cache[idx].fieldA > 0) { - int v8 = 0; - do { - v1 = v8; - if (_vm->_globals.Bob[v1].field0) { - if (!_vm->_globals.Bob[v8].field16) { - if (!_vm->_globals.Bob[v8].field34) { - if ( _vm->_globals.Bob[v8].frameIndex != 250) { - int v2 = _vm->_globals.Bob[v8].oldWidth; - int v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; - int v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; - int v3 =_vm->_globals.Cache[idx].field0; - int v4 =_vm->_globals.Cache[idx].field4; - int v7 =_vm->_globals.Cache[idx].field6 + v3; - int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; - - if (v6 > v4) { - if (v6 < v1) { - v1 = 0; - if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx].field6 + v3)) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } - - if (!(uint16)v1) { - if (v2 >= v3 && v7 >= v2) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } - if (!(uint16)v1) { - if ( v7 >= v2 && v2 >= v3 ) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } - if (!(uint16)v1) { - if (v2 >= v3 && v9 <= v7) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } - if (!(uint16)v1 && v2 <= v3 && v9 >= v7) - ++_vm->_globals.Cache[idx].fieldA; - } - } - } - } - } - } + for (int v8 = 0; v8 <= 20; v8++) { + v1 = v8; + if ((_vm->_globals.Bob[v1].field0) && (!_vm->_globals.Bob[v8].field16) && (!_vm->_globals.Bob[v8].field34) && (_vm->_globals.Bob[v8].frameIndex != 250)) { + int v2 = _vm->_globals.Bob[v8].oldWidth; + int v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; + int v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; + int v3 =_vm->_globals.Cache[idx].field0; + int v4 =_vm->_globals.Cache[idx].field4; + int v7 =_vm->_globals.Cache[idx].field6 + v3; + int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; + + if ((v6 > v4) && (v6 < v1)) { + v1 = 0; + if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx].field6 + v3)) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + if (!(uint16)v1) { + if (v2 >= v3 && v7 >= v2) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; } } + if (!(uint16)v1) { + if ( v7 >= v2 && v2 >= v3 ) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + } + if (!(uint16)v1) { + if (v2 >= v3 && v9 <= v7) { + ++_vm->_globals.Cache[idx].fieldA; + v1 = 1; + } + } + if (!(uint16)v1 && v2 <= v3 && v9 >= v7) + ++_vm->_globals.Cache[idx].fieldA; } - ++v8; - } while (v8 <= 20); + } } } void ObjectsManager::CALCUL_BOB(int idx) { - int result; - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v13; - int v14; - int v15; - int v17; - int v20; - int v21; - int v22; - _vm->_globals.Bob[idx].isActive = false; if (_vm->_globals.Bob[idx].isSprite) { _vm->_globals.Bob[idx].field38 = 0; _vm->_globals.Bob[idx].field36 = 0; } - result = _vm->_globals.Bob[idx].frameIndex; + int result = _vm->_globals.Bob[idx].frameIndex; if (result != 250) { + int v5, v15, v22; if (_vm->_globals.Bob[idx].field38) { - v4 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 1); - v22 = v4; - v15 = v4; + v22 = v15 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 1); v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 1); } else { - v3 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 0); - v22 = v3; - v15 = v3; + v22 = v15 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 0); v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 0); } - v17 = v5; - v6 = v5; - v21 = 0; - v20 = 0; - v7 = _vm->_globals.Bob[idx].field36; + int v17 = v5; + int v6 = v5; + int v21 = 0; + int v20 = 0; + int v7 = _vm->_globals.Bob[idx].field36; if (v7 < 0) { v7 = -v7; @@ -832,16 +801,14 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 >= 0) { v22 = _vm->_graphicsManager.Reel_Zoom(v15, v21); } else { - v8 = v15; if (v15 < 0) - v8 = -v15; - v15 = v8; - v22 = -_vm->_graphicsManager.Reel_Zoom(v8, v21); + v15 = -v15; + v22 = -_vm->_graphicsManager.Reel_Zoom(v15, v21); } if (v6 >= 0) { v17 = _vm->_graphicsManager.Reel_Zoom(v6, v21); } else { - v9 = v15; + int v9 = v15; if (v15 < 0) v9 = -v15; v6 = v9; @@ -853,24 +820,21 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v15 >= 0) { v22 = _vm->_graphicsManager.Reel_Reduc(v15, v20); } else { - v10 = v15; - if (v15 < 0) - v10 = -v15; - v15 = v10; - v22 = -_vm->_graphicsManager.Reel_Reduc(v10, v20); + v15 = -v15; + v22 = -_vm->_graphicsManager.Reel_Reduc(v15, v20); } if (v6 >= 0) { v17 = _vm->_graphicsManager.Reel_Reduc(v6, v20); } else { - v11 = v15; + int v11 = v15; if (v15 < 0) v11 = -v15; v17 = -_vm->_graphicsManager.Reel_Reduc(v11, v20); } } - v13 = _vm->_globals.Bob[idx].xp - v22; - v14 = _vm->_globals.Bob[idx].yp - v17; + int v13 = _vm->_globals.Bob[idx].xp - v22; + int v14 = _vm->_globals.Bob[idx].yp - v17; _vm->_globals.Bob[idx].isActive = true; _vm->_globals.Bob[idx].oldX = v13; _vm->_globals.Bob[idx].oldY = v14; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a0b17c13ed..9955b77aca 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -43,14 +43,6 @@ void ScriptManager::setParent(HopkinsEngine *vm) { } int ScriptManager::Traduction(byte *a1) { - char v47; - char v48; - char v49; - int v50; - CharacterLocation *v51; - CharacterLocation *v53; - Common::String file; - int v1 = 0; int v70 = 0; if (*a1 != 'F' || *(a1 + 1) != 'C') @@ -494,15 +486,13 @@ LABEL_1141: int v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; - int v10 = 0; if (v74 + 1 > 0) { - do { + for (int v10 = 0; v10 < v74 + 1; v10++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - ++v10; - } while (v10 < v74 + 1); + } } v1 = 1; } @@ -1812,7 +1802,7 @@ LABEL_1141: if (v76 == 40) _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); if (v76 == 236) { - v47 = _vm->_globals.SAUVEGARDE->data[svField341]; + char v47 = _vm->_globals.SAUVEGARDE->data[svField341]; if (v47) { if (v47 == 2) v70 = 5; @@ -1840,7 +1830,7 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); } if (v76 == 237) { - v48 = _vm->_globals.SAUVEGARDE->data[svField341]; + char v48 = _vm->_globals.SAUVEGARDE->data[svField341]; if (v48) { if (v48 == 2) v70 = 5; @@ -1868,7 +1858,7 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); } if (v76 == 238) { - v49 = _vm->_globals.SAUVEGARDE->data[svField341]; + char v49 = _vm->_globals.SAUVEGARDE->data[svField341]; if (v49) { if (v49 == 2) v70 = 5; @@ -1902,24 +1892,24 @@ LABEL_1141: } if (v76 == 240) { _vm->_objectsManager.BOBANIM_ON(1); - v50 = 0; + bool soundFlag = false; do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - if (_vm->_objectsManager.BOBPOSI(1) == 12 && !v50) { + if (_vm->_objectsManager.BOBPOSI(1) == 12 && !soundFlag) { _vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); - v50 = 1; + soundFlag = true; } if (_vm->_objectsManager.BOBPOSI(1) == 13) - v50 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 25 && !v50) { + soundFlag = false; + if (_vm->_objectsManager.BOBPOSI(1) == 25 && !soundFlag) { _vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); - v50 = 1; + soundFlag = true; } if (_vm->_objectsManager.BOBPOSI(1) == 25) - v50 = 0; + soundFlag = false; } while (_vm->_objectsManager.BOBPOSI(1) != 32); _vm->_objectsManager.BOBANIM_OFF(1); _vm->_objectsManager.BOBANIM_ON(2); @@ -1936,7 +1926,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - v51 = &_vm->_globals.SAUVEGARDE->realHopkins; + CharacterLocation *v51 = &_vm->_globals.SAUVEGARDE->realHopkins; v51->xp = _vm->_objectsManager.XSPR(0); v51->yp = _vm->_objectsManager.YSPR(0); v51->field2 = 57; @@ -2164,7 +2154,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.PLAY_SEQ("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; - v53 = &_vm->_globals.SAUVEGARDE->samantha; + CharacterLocation *v53 = &_vm->_globals.SAUVEGARDE->samantha; v53->xp = 404; v53->yp = 395; v53->field2 = 64; @@ -2303,7 +2293,7 @@ LABEL_1141: if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { int v60 = (int16)READ_LE_UINT16(a1 + 5); - file = Common::String::format("SOUND%d.WAV", v60); + Common::String file = Common::String::format("SOUND%d.WAV", v60); _vm->_soundManager.PLAY_SOUND(file); v1 = 1; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 20bf11b13c..9642ed1ec1 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -196,7 +196,6 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } void TalkManager::PARLER_PERSO2(const Common::String &filename) { - int v9 = 0; _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; byte v7 = _vm->_dialogsManager.DESACTIVE_INVENT; @@ -244,11 +243,10 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { int v3; do { v3 = DIALOGUE(); - if (v3 != v2) - v9 = DIALOGUE_REP(v3); - - if (v9 == -1) - v3 = v1 + 3; + if (v3 != v2) { + if (DIALOGUE_REP(v3) == -1) + v3 = v1 + 3; + } } while (v3 != v2); } -- cgit v1.2.3 From 8896ba99fcde2b694dfe86769c3fc1621d8b3296 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 28 Nov 2012 20:40:39 +1100 Subject: HOPKINS: Fix incorrect loop increment in CONTOURNE method --- engines/hopkins/lines.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 1c383762d8..1d93096987 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -702,7 +702,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } } } else { - for (int i = v7; i > a5; i++) { + for (int i = v7; i > a5; --i) { int16 *v26 = Ligne[a4].lineData; int v27 = v26[2 * i]; v50 = v26[2 * i+ 1]; -- cgit v1.2.3 From 0465fa37b901c812bd2dc130afd0dfc0368e0ff3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 28 Nov 2012 20:42:56 +1100 Subject: HOPKINS: Bugfix for Hopkins/Samantha appearing when you're controlling the other. --- engines/hopkins/script.cpp | 54 +++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 9955b77aca..8330c1ea43 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -213,41 +213,37 @@ LABEL_1141: _vm->_objectsManager.PERI = v5; if (_vm->_objectsManager.CH_TETE == 1) { if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 - && _vm->_globals.SAUVEGARDE->data[svField180] - && _vm->_globals.SAUVEGARDE->data[svField181] - && _vm->_globals.SAUVEGARDE->data[svField182] - && _vm->_globals.SAUVEGARDE->data[svField183]) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField180]; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField181]; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField182]; + && _vm->_globals.SAUVEGARDE->cloneHopkins.xp && _vm->_globals.SAUVEGARDE->cloneHopkins.yp + && _vm->_globals.SAUVEGARDE->cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->cloneHopkins.location) { + + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->cloneHopkins.xp; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->cloneHopkins.yp; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->cloneHopkins.field2; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->data[svField190] - && _vm->_globals.SAUVEGARDE->data[svField191] - && _vm->_globals.SAUVEGARDE->data[svField192] - && _vm->_globals.SAUVEGARDE->data[svField193]) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField190]; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField191]; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField192]; + && _vm->_globals.SAUVEGARDE->samantha.xp && _vm->_globals.SAUVEGARDE->samantha.yp + && _vm->_globals.SAUVEGARDE->samantha.field2 && _vm->_globals.SAUVEGARDE->samantha.location) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->samantha.xp; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->samantha.yp; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->samantha.field2; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->data[svField185] - && _vm->_globals.SAUVEGARDE->data[svField186] - && _vm->_globals.SAUVEGARDE->data[svField187] - && _vm->_globals.SAUVEGARDE->data[svField188]) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->data[svField185]; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->data[svField186]; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->data[svField187]; + && _vm->_globals.SAUVEGARDE->realHopkins.xp && _vm->_globals.SAUVEGARDE->realHopkins.yp + && _vm->_globals.SAUVEGARDE->realHopkins.field2 && _vm->_globals.SAUVEGARDE->realHopkins.location) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->realHopkins.xp; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->realHopkins.yp; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->realHopkins.field2; } } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->data[svField188] == _vm->_globals.ECRAN) { + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 + && _vm->_globals.SAUVEGARDE->realHopkins.location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->data[svField185], - _vm->_globals.SAUVEGARDE->data[svField186], + _vm->_globals.SAUVEGARDE->realHopkins.xp, + _vm->_globals.SAUVEGARDE->realHopkins.yp, 1, 2, - _vm->_globals.SAUVEGARDE->data[svField189], + _vm->_globals.SAUVEGARDE->realHopkins.field4, 0, 34, 190); @@ -256,14 +252,14 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 && _vm->_globals.SAUVEGARDE->data[svField355] == 1 - && _vm->_globals.SAUVEGARDE->data[svField193] == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->data[svField190], - _vm->_globals.SAUVEGARDE->data[svField191], + _vm->_globals.SAUVEGARDE->samantha.xp, + _vm->_globals.SAUVEGARDE->samantha.yp, 1, 3, - _vm->_globals.SAUVEGARDE->data[svField194], + _vm->_globals.SAUVEGARDE->samantha.field4, 0, 20, 127); -- cgit v1.2.3 From ef90135bb96f43b01ae8d6a8c57b901c56f23872 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 28 Nov 2012 20:49:26 +1100 Subject: HOPKINS: Bugfix for exiting game when the map screen is being shown --- engines/hopkins/hopkins.cpp | 3 +++ engines/hopkins/hopkins.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 7e88a4fd63..ddb7e3ad95 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2228,6 +2228,9 @@ int HopkinsEngine::PWBASE() { bool loopCond = false; int zone; do { + if (shouldQuit()) + return 0; + int mouseButton = _eventsManager.BMOUSE(); int posX = _eventsManager.XMOUSE(); int posY = _eventsManager.YMOUSE(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index bd071eda0c..5b5968a73f 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -97,7 +97,12 @@ private: void BASED(); void JOUE_FIN(); void AVION(); + + /** + * Displays the map screen in the underground base. + */ int PWBASE(); + void BTOCEAN(); void OCEAN_HOME(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9); -- cgit v1.2.3 From ca95da2f87cdaa9a228b4d8d22a4a0334d0db2ce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 28 Nov 2012 21:03:11 +1100 Subject: HOPKINS: Fix for character select icons appearing on the map screen --- engines/hopkins/dialogs.cpp | 3 +-- engines/hopkins/dialogs.h | 1 - engines/hopkins/talk.cpp | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index d30cdafafa..645f06dc65 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -36,7 +36,6 @@ namespace Hopkins { DialogsManager::DialogsManager() { - DESACTIVE_INVENT = false; INVENTFLAG = false; AFFINVEN = false; VIRE_INVENT = false; @@ -474,7 +473,7 @@ LABEL_7: } void DialogsManager::INVENT_ANIM() { - if (!DESACTIVE_INVENT) { + if (!_vm->_globals.DESACTIVE_INVENT) { if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index 3f4cdfadbb..19c7faae1f 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -38,7 +38,6 @@ class DialogsManager { private: HopkinsEngine *_vm; public: - bool DESACTIVE_INVENT; bool INVENTFLAG; bool AFFINVEN; bool VIRE_INVENT; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 9642ed1ec1..6bb0110dc5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -198,8 +198,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; - byte v7 = _vm->_dialogsManager.DESACTIVE_INVENT; - _vm->_dialogsManager.DESACTIVE_INVENT = 1; + bool v7 = _vm->_globals.DESACTIVE_INVENT; + _vm->_globals.DESACTIVE_INVENT = 1; BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -265,7 +265,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_objectsManager.DESACTIVE_CURSOR = 0; - _vm->_dialogsManager.DESACTIVE_INVENT = v7; + _vm->_globals.DESACTIVE_INVENT = v7; STATI = 0; } -- cgit v1.2.3 From b0ce324685882c5e302958f64ad15dc04c0b9eae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 28 Nov 2012 21:15:07 +1100 Subject: HOPKINS: Bugfix for ending delay after Bernie is killed --- engines/hopkins/globals.cpp | 2 -- engines/hopkins/globals.h | 2 -- engines/hopkins/hopkins.cpp | 7 +++---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 882d869d33..02f70f1bc3 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -126,8 +126,6 @@ Globals::Globals() { VOICEVOL = 6; XSETMODE = 0; XZOOM = 0; - lItCounter = 0; - lOldItCounter = 0; g_old_anim = 0; g_old_sens = 0; g_old_sens2 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7d01d9fa45..abde148e20 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -372,8 +372,6 @@ public: bool MUSICOFF; bool VOICEOFF; bool CENSURE; - int lItCounter; - int lOldItCounter; int g_old_anim; int g_old_sens, g_old_sens2; int last_sens; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ddb7e3ad95..dc65de0aa0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1475,8 +1475,6 @@ void HopkinsEngine::INIT_SYSTEM() { _eventsManager.ofset_souris_x = 0; _eventsManager.ofset_souris_y = 0; - _globals.lItCounter = 0; - _globals.lOldItCounter = 0; } void HopkinsEngine::INTRORUN() { @@ -2071,11 +2069,12 @@ void HopkinsEngine::JOUE_FIN() { _soundManager.DEL_SAMPLE(1); _graphicsManager.LOAD_IMAGE("PLAN3"); _graphicsManager.FADE_INW(); - _globals.lItCounter = 0; + + _eventsManager.lItCounter = 0; if (!_eventsManager.ESC_KEY) { do _eventsManager.CONTROLE_MES(); - while (_globals.lItCounter < 2000 / _globals.vitesse && !_eventsManager.ESC_KEY); + while (_eventsManager.lItCounter < 2000 / _globals.vitesse && !_eventsManager.ESC_KEY); } _eventsManager.ESC_KEY = false; _graphicsManager.FADE_OUTW(); -- cgit v1.2.3 From b230dff1e9631cd61775685a9676ec5ab04ff19e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Nov 2012 23:15:47 +1100 Subject: HOPKINS: Fix savegame thumbnails --- engines/hopkins/dialogs.cpp | 7 ++++- engines/hopkins/saveload.cpp | 67 +++++++++++++++++++++++++++++++++++++++++--- engines/hopkins/saveload.h | 5 ++++ 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 645f06dc65..436e4f694a 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -653,7 +653,10 @@ void DialogsManager::LOAD_SAUVE(int a1) { for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { if (_vm->_saveLoadManager.readSavegameHeader(slotNumber, header)) { - thumb = (byte *)header.thumbnail->pixels; + Graphics::Surface thumb8; + _vm->_saveLoadManager.convertThumb16To8(header.thumbnail, &thumb8); + + thumb = (byte *)thumb8.pixels; switch (slotNumber) { case 1: @@ -676,6 +679,8 @@ void DialogsManager::LOAD_SAUVE(int a1) { break; } + thumb8.free(); + header.thumbnail->free(); delete header.thumbnail; } } diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 47fc140290..0abd519a81 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -225,12 +225,30 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { int w = _vm->_graphicsManager.Reel_Reduc(SCREEN_WIDTH, REDUCE_AMOUNT); int h = _vm->_graphicsManager.Reel_Reduc(SCREEN_HEIGHT - 40, REDUCE_AMOUNT); - s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + Graphics::Surface thumb8; + thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)s->pixels, + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)thumb8.pixels, _vm->_eventsManager.start_x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); - _vm->_graphicsManager.INIT_TABLE(45, 80, _vm->_graphicsManager.Palette); -// _vm->_graphicsManager.Trans_bloc2((byte *)s->pixels, _vm->_graphicsManager.TABLE_COUL, 11136); + + // Convert the 8-bit pixel to 16 bit surface + s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + + const byte *srcP = (const byte *)thumb8.pixels; + uint16 *destP = (uint16 *)s->pixels; + + for (int yp = 0; yp < h; ++yp) { + // Copy over the line, using the source pixels as lookups into the pixels palette + const byte *lineSrcP = srcP; + uint16 *lineDestP = destP; + + for (int xp = 0; xp < w; ++xp) + *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; + + // Move to the start of the next line + srcP += w; + destP += w; + } } void SaveLoadManager::syncSavegameData(Common::Serializer &s) { @@ -251,4 +269,45 @@ void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLoca s.syncAsSint16LE(item.field4); } +void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Surface *thumb8) { + thumb8->create(thumb16->w, thumb16->h, Graphics::PixelFormat::createFormatCLUT8()); + Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); + + uint16 palette[PALETTE_SIZE]; + for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) + palette[palIndex] = READ_LE_UINT16(&_vm->_graphicsManager.PAL_PIXELS[palIndex * 2]); + + const uint16 *srcP = (const uint16 *)thumb16->pixels; + byte *destP = (byte *)thumb8->pixels; + + for (int yp = 0; yp < thumb16->h; ++yp) { + const uint16 *lineSrcP = srcP; + byte *lineDestP = destP; + + for (int xp = 0; xp < thumb16->w; ++xp) { + byte r, g, b; + pixelFormat16.colorToRGB(*lineSrcP++, r, g, b); + + // Scan the palette for the closest match + int difference = 99999, foundIndex = 0; + for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) { + byte rCurrent, gCurrent, bCurrent; + pixelFormat16.colorToRGB(palette[palIndex], rCurrent, gCurrent, bCurrent); + + int diff = ABS((int)r - (int)rCurrent) + ABS((int)g - (int)gCurrent) + ABS((int)b - (int)bCurrent); + if (diff < difference) { + difference = diff; + foundIndex = palIndex; + } + } + + *lineDestP++ = foundIndex; + } + + // Move to the start of the next line + srcP += thumb16->w; + destP += thumb16->w; + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index f4f94995a9..aa59fe7ba4 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -64,6 +64,11 @@ public: static bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); Common::Error save(int slot, const Common::String &saveName); Common::Error restore(int slot); + + /** + * Converts a 16-bit thumbnail to 8 bit paletted using the currently active palette. + */ + void convertThumb16To8(Graphics::Surface *thumb16, Graphics::Surface *thumb8); }; } // End of namespace Hopkins -- cgit v1.2.3 From 0ece49e5cbe3d0360f097c9566587774108d62dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Nov 2012 23:35:14 +1100 Subject: HOPKINS: Added extra flag check to can save/load currently methods --- engines/hopkins/hopkins.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dc65de0aa0..24e8240856 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -68,14 +68,14 @@ Common::String HopkinsEngine::generateSaveName(int slot) { * Returns true if it is currently okay to restore a game */ bool HopkinsEngine::canLoadGameStateCurrently() { - return !_globals.SORTIE && !_globals.PLAN_FLAG; + return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager.souris_flag; } /** * Returns true if it is currently okay to save the game */ bool HopkinsEngine::canSaveGameStateCurrently() { - return !_globals.SORTIE && !_globals.PLAN_FLAG; + return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager.souris_flag; } /** -- cgit v1.2.3 From 5bc956627ecc339c52da9c83982c279bca1872a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Dec 2012 00:01:37 +1100 Subject: HOPKINS: Clean up multiple VBL calls in NAME_SCORE --- engines/hopkins/computer.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index d2e1209516..b682fc2936 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -904,18 +904,8 @@ void ComputerManager::NAME_SCORE() { Score[5].name.setChar(curChar, strPos); PRINT_HSCORE(ptr, 9 * strPos + 140, 78, curChar); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); + for (int idx = 0; idx < 12; ++idx) + _vm->_eventsManager.VBL(); } Score[5].score = " "; -- cgit v1.2.3 From d45b22f822187c2e23c9645986862c2edde2016b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Dec 2012 00:04:48 +1100 Subject: HOPKINS: Fix exiting game when displaying Breakout high score table --- engines/hopkins/computer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b682fc2936..d46cc55260 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -873,7 +873,7 @@ int ComputerManager::HIGHT_SCORE() { && (uint16)(v0 - 176) <= 0xDu) v3 = 2; _vm->_eventsManager.VBL(); - } while (!v3); + } while (!v3 && !_vm->shouldQuit()); _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_OUT_CASSE(); _vm->_globals.LIBERE_FICHIER(ptr); -- cgit v1.2.3 From 5cd2633b3bf4ce80517afc9de618278e4f004d85 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Dec 2012 17:16:00 +1100 Subject: HOPKINS: Initial implementation of new codec for Windows APC sound files --- engines/hopkins/sound.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++--- engines/hopkins/sound.h | 4 ++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index da3a3de747..6f9f17a937 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -20,6 +20,7 @@ * */ +#include "audio/decoders/adpcm_intern.h" #include "common/system.h" #include "common/config-manager.h" #include "common/file.h" @@ -28,6 +29,45 @@ #include "hopkins/globals.h" #include "hopkins/hopkins.h" +namespace Audio { + +class APC_ADPCMStream : public Audio::DVI_ADPCMStream { +public: + APC_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int rate, int channels) : DVI_ADPCMStream(stream, disposeAfterUse, stream->size(), rate, channels, 0) { + stream->seek(-12, SEEK_CUR); + _status.ima_ch[0].last = _startValue[0] = stream->readUint32LE(); + _status.ima_ch[1].last = _startValue[1] = stream->readUint32LE(); + stream->seek(4, SEEK_CUR); + } + + void reset() { + DVI_ADPCMStream::reset(); + _status.ima_ch[0].last = _startValue[0]; + _status.ima_ch[1].last = _startValue[1]; + } + +private: + int16 _startValue[2]; +}; + +Audio::RewindableAudioStream *makeAPCStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) { + if (stream->readUint32BE() != MKTAG('C', 'R', 'Y', 'O')) + return 0; + if (stream->readUint32BE() != MKTAG('_', 'A', 'P', 'C')) + return 0; + stream->readUint32BE(); // version + stream->readUint32LE(); // out size + uint32 rate = stream->readUint32LE(); + stream->skip(8); // initial values, will be handled by the class + bool stereo = stream->readUint32LE() != 0; + + return new APC_ADPCMStream(stream, disposeAfterUse, rate, stereo ? 2 : 1); +} + +} + +/*------------------------------------------------------------------------*/ + namespace Hopkins { SoundManager::SoundManager() { @@ -388,7 +428,7 @@ void SoundManager::LOAD_MSAMPLE(int mwavIndex, const Common::String &file) { if (!f.open(file)) error("Could not open %s for reading", file.c_str()); - Mwav[mwavIndex]._audioStream = Audio::makeWAVStream(f.readStream(f.size()), DisposeAfterUse::YES); + Mwav[mwavIndex]._audioStream = makeSoundStream(f.readStream(f.size())); Mwav[mwavIndex]._active = true; f.close(); @@ -685,8 +725,7 @@ bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffs error("Could not open %s for reading", filename.c_str()); f.seek(fileOffset); - item._audioStream = Audio::makeWAVStream(f.readStream((entryLength == 0) ? f.size() : entryLength), - DisposeAfterUse::YES); + item._audioStream = makeSoundStream(f.readStream((entryLength == 0) ? f.size() : entryLength)); f.close(); return true; @@ -789,4 +828,11 @@ void SoundManager::updateScummVMSoundSettings() { ConfMan.flushToDisk(); } +Audio::RewindableAudioStream *SoundManager::makeSoundStream(Common::SeekableReadStream *stream) { + if (_vm->getPlatform() == Common::kPlatformWindows) + return Audio::makeAPCStream(stream, DisposeAfterUse::YES); + else + return Audio::makeWAVStream(stream, DisposeAfterUse::YES); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index fa0a5419a2..75cb29789c 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -107,6 +107,10 @@ private: */ void checkVoices(); + /** + * Creates an audio stream based on a passed raw stream + */ + Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); public: int SPECIAL_SOUND; int SOUNDVOL; -- cgit v1.2.3 From ad7ed5eae89f0fc70df8ee6316b272fa05be199a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Dec 2012 19:10:22 +1100 Subject: HOPKINS: Fix button selections in Breakout high scores list --- engines/hopkins/computer.cpp | 47 ++++++++++++++++++++++++-------------------- engines/hopkins/computer.h | 4 ++++ 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index d46cc55260..b16b64c246 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -834,9 +834,9 @@ void ComputerManager::PLAY_BRIQUE() { } int ComputerManager::HIGHT_SCORE() { - int v0; - int v3; - int v4; + int yp; + int buttonIndex; + int xp; byte *ptr; _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -849,35 +849,40 @@ int ComputerManager::HIGHT_SCORE() { _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - for (int v6 = 0; v6 <= 5; v6++) { - v0 = 19 * v6; - v0 += 46; - for (int v1 = 0; v1 <= 5; v1++) - PRINT_HSCORE(ptr, 9 * v1 + 69, v0, Score[v6].name[v1]); + // Loop for displaying the scores + for (int scoreIndex = 0; scoreIndex <= 5; scoreIndex++) { + yp = 19 * scoreIndex; + yp += 46; - for (int v2 = 0; v2 <= 8; v2++) - PRINT_HSCORE(ptr, 9 * v2 + 199, v0, Score[v6].score[v2]); + // Display the characters of the name + for (int i = 0; i <= 5; i++) + PRINT_HSCORE(ptr, 9 * i + 69, yp, Score[scoreIndex].name[i]); + // Display the digits of the score + for (int i = 0; i <= 8; i++) + PRINT_HSCORE(ptr, 9 * i + 199, yp, Score[scoreIndex].score[i]); } _vm->_graphicsManager.FADE_IN_CASSE(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - v3 = 0; + buttonIndex = 0; do { - v4 = _vm->_eventsManager.souris_x + 13; - v0 = _vm->_eventsManager.souris_y; - if (_vm->_eventsManager.BMOUSE() == 1 && (uint16)(v4 - 15) <= 0x21u && (uint16)(v0 - 176) <= 0xDu) - v3 = 1; - if (_vm->_eventsManager.BMOUSE() == 1 - && (uint16)(v4 - 274) <= 0x20u - && (uint16)(v0 - 176) <= 0xDu) - v3 = 2; + _vm->_eventsManager.CONTROLE_MES(); + xp = _vm->_eventsManager.XMOUSE(); + yp = _vm->_eventsManager.YMOUSE(); + + if (_vm->_eventsManager.BMOUSE() == 1 && ABS(xp - 79) <= 33 && ABS(yp - 396) <= 13) + buttonIndex = 1; + else if (_vm->_eventsManager.BMOUSE() == 1 && ABS(xp - 583) <= 32 && ABS(yp - 396) <= 13) + buttonIndex = 2; + _vm->_eventsManager.VBL(); - } while (!v3 && !_vm->shouldQuit()); + } while (!buttonIndex && !_vm->shouldQuit()); + _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_OUT_CASSE(); _vm->_globals.LIBERE_FICHIER(ptr); - return v3; + return buttonIndex; } void ComputerManager::NAME_SCORE() { diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index edd214e596..6632213bfe 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -154,6 +154,10 @@ private: */ void PLAY_BRIQUE(); + /** + * Show the high scores for the Breakout game + * @return The selected button index: 1 = Game, 2 = Quit + */ int HIGHT_SCORE(); void NAME_SCORE(); void IMPSCORE(int a1, int a2); -- cgit v1.2.3 From a23813f9a1340654607a647b6a2494e253c4b348 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 2 Dec 2012 10:42:04 +0100 Subject: HOPKINS: Add main code for Win95 demo --- engines/hopkins/graphics.cpp | 5 +- engines/hopkins/hopkins.cpp | 331 ++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 2 + 3 files changed, 334 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3b204ba057..697a57cdde 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -88,8 +88,11 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { _vm = vm; if (_vm->getIsDemo()) { + if (_vm->getPlatform() == Common::kPlatformLinux) // CHECKME: Should be 0? - MANU_SCROLL = 1; + MANU_SCROLL = 1; + else + MANU_SCROLL = 0; SPEED_SCROLL = 16; } else { MANU_SCROLL = 0; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 24e8240856..4b2497fc22 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -110,6 +110,13 @@ Common::Error HopkinsEngine::run() { runLinuxDemo(); else runLinuxFull(); + } else if (getPlatform() == Common::kPlatformWindows) { + if (getIsDemo()) + runWin95Demo(); + else { + warning("Unhandled version, switching to linux demo"); + runLinuxDemo(); + } } else { warning("Unhandled version, switching to linux demo"); runLinuxDemo(); @@ -118,6 +125,321 @@ Common::Error HopkinsEngine::run() { return Common::kNoError; } +bool HopkinsEngine::runWin95Demo() { + _globals.CHARGE_OBJET(); + _objectsManager.CHANGE_OBJET(14); + _objectsManager.AJOUTE_OBJET(14); + + _globals.HELICO = 0; + _globals.iRegul = 1; + + warning("TODO Affiche_Version(1)"); + + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + + warning("TODO Fin_Interrupt()"); + warning("TODO TEST = 1;"); + warning("TODO no_vsync = 1;"); + _eventsManager.lItCounter = 0; + warning("TODO Init_Interrupt_();"); + + _globals.iRegul = 1; + _globals.vitesse = 1; + + int v23 = 1; + do { + ++v23; + _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 0, 0, 640, 440, _graphicsManager.VESA_BUFFER, 0, 0); + _eventsManager.VBL(); + } while (v23 < 50); + + _globals.iRegul = 0; + warning("TODO SPEEDJ = _globals.lItCounter;"); + warning("TODO no_vsync = 0;"); + warning("TODO TEST = 0;"); +// printf_(v27, v26, (int)"\n speed=%d", SBYTE2(dword_452A26)); +// if (SPEEDJ > 475) + if (_eventsManager.lItCounter > 475) + _globals.vitesse = 2; +// if (SPEEDJ > 700) + if (_eventsManager.lItCounter > 700) + _globals.vitesse = 3; + warning("TODO Fin_Interrupt_();"); + warning("TODO Init_Interrupt_();"); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.PLANX = _globals.PLANY = 0; + memset(_globals.SAUVEGARDE, 0, 2000); + _globals.SORTIE = 0; + _globals.PASSWORD = true; + warning("TODO ADULT();"); +// v37 = v35; +LABEL_18: + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + } + } + while (1) { + while (1) { + while (1) { + while (1) { + while (1) { + if (_globals.SORTIE == 300) + goto LABEL_18; + if (_globals.SORTIE != 1) + break; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2); + } + if (_globals.SORTIE != 3) + break; + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(0x1F4u); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 200, 28); + else + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 200, 28); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _graphicsManager.FADE_OUTW(); + _globals.SAUVEGARDE->data[svField170] = 1; + } + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + } + if (4 != _globals.SORTIE) + break; + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + } + if (_globals.SORTIE == 5) + break; + switch (_globals.SORTIE) { + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + case 9: + _globals.Max_Propre_Gen = 10; + _globals.Max_Propre = 15; + _globals.Max_Perso_Y = 440; + _globals.Max_Ligne_Long = 20; + if (_globals.SAUVEGARDE->data[svField225]) + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + else + BOOM(); + break; + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 15; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + case 12: + _globals.Max_Propre_Gen = 10; + _globals.Max_Propre = 15; + _globals.Max_Perso_Y = 450; + _globals.Max_Ligne_Long = 20; + if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("ENDFR"); + else if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("ENDUK"); + _graphicsManager.FADE_INW(); + _eventsManager.MOUSE_ON(); + do + _eventsManager.VBL(); + while (_eventsManager.BMOUSE() != 1); + _graphicsManager.FADE_OUTW(); + REST_SYSTEM(); + } + BOOM(); + break; + case 13: + case 14: + case 15: + NO_DISPO(11); + break; + default: + if (_globals.SORTIE == 16) + goto LABEL_52; + if (_globals.SORTIE == 17) { + NO_DISPO(1); + } else if (_globals.SORTIE != 24 && _globals.SORTIE != 25 && _globals.SORTIE != 33 + && _globals.SORTIE != 26 && _globals.SORTIE != 27 && _globals.SORTIE != 28 + && _globals.SORTIE != 29 && _globals.SORTIE != 30 && _globals.SORTIE != 31 + && _globals.SORTIE != 32 && _globals.SORTIE != 34 + && (_globals.SORTIE <= 34 || _globals.SORTIE >= 100)) { + switch (_globals.SORTIE) { + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + case 113: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + break; + case 114: + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals.SORTIE = 0; + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + break; + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + break; + default: + if (_globals.SORTIE == 151) { + _soundManager.WSOUND(28); + _globals.iRegul = 4; // CHECKME! + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _graphicsManager.LOAD_IMAGE("njour3a"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(5000); + _graphicsManager.FADE_OUTW(); + _globals.SORTIE = 300; + _globals.iRegul = 0; + } + if (_globals.SORTIE == 150) { + _soundManager.WSOUND(28); + _globals.iRegul = 4; // CHECKME! + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + if (_globals.SORTIE == 152) { + _soundManager.WSOUND(28); + _globals.iRegul = 4; // CHECKME! + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + goto LABEL_18; + } + } + else + { +LABEL_52: + NO_DISPO(4); + } + break; + } + } + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 455; + + byte v1 = _globals.SAUVEGARDE->data[svField80]; + if (v1) { + if (v1 == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + _globals.NOSPRECRAN = false; + } +} + bool HopkinsEngine::runLinuxDemo() { _globals.CHARGE_OBJET(); _objectsManager.CHANGE_OBJET(14); @@ -451,7 +773,9 @@ LABEL_124: _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); - goto LABEL_128; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); } if (_globals.SORTIE == 115) { _globals.SORTIE = 0; @@ -460,8 +784,6 @@ LABEL_124: _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); - -LABEL_128: _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2765,4 +3087,7 @@ void HopkinsEngine::syncSoundSettings() { _soundManager.syncSoundSettings(); } +void HopkinsEngine::NO_DISPO(int sortie) { + warning("STUB - NO_DISPO"); +} } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 5b5968a73f..7663926566 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -109,7 +109,9 @@ private: void Charge_Credits(); void CREDIT_AFFICHE(int startPosY, byte *buffer, char colour); void Credits(); + void NO_DISPO(int sortie); + bool runWin95Demo(); bool runLinuxDemo(); bool runLinuxFull(); -- cgit v1.2.3 From 4631b46f347122b35e5ebf0a383364da0bce9981 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 2 Dec 2012 12:02:27 +0100 Subject: HOPKINS: Use an unsigned int for speed variable --- engines/hopkins/computer.cpp | 8 +++----- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 34 +++++++++++++++++----------------- engines/hopkins/objects.cpp | 27 +++++++++++---------------- engines/hopkins/script.cpp | 4 ++-- 5 files changed, 34 insertions(+), 41 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b16b64c246..373c023c86 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -559,11 +559,9 @@ void ComputerManager::LIT_TEXTE(int a1) { } void ComputerManager::GAMES() { - const byte *v1; - int v2; + const byte *v1 = _vm->_objectsManager.Sprite[0].spriteData; + uint oldSpeed = _vm->_globals.vitesse; - v1 = _vm->_objectsManager.Sprite[0].spriteData; - v2 = _vm->_globals.vitesse; _vm->_globals.vitesse = 1; _vm->_eventsManager.CHANGE_MOUSE(0); CASSESPR = g_PTRNUL; @@ -599,7 +597,7 @@ void ComputerManager::GAMES() { _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); - _vm->_globals.vitesse = v2; + _vm->_globals.vitesse = oldSpeed; _vm->_eventsManager.CASSE = false; _vm->_eventsManager.CASSE_SOURIS_OFF(); setvideomode(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index abde148e20..131c48cb4c 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -347,7 +347,7 @@ public: bool XFORCE8; bool CARD_SB; int PERSO_TYPE; - int vitesse; + uint vitesse; int INSTALL_TYPE; Common::String HOPIMAGE; Common::String HOPANIM; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4b2497fc22..d04b926f08 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1888,7 +1888,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - for (int i = 0; i < 200 / _globals.vitesse; ++i) + for (uint i = 0; i < 200 / _globals.vitesse; ++i) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); @@ -1973,23 +1973,23 @@ void HopkinsEngine::INTRORUN() { v9 += 2; if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); - for (int j = 1; j < 100 / _globals.vitesse; ++j) + for (uint j = 1; j < 100 / _globals.vitesse; ++j) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _objectsManager.BOBANIM_OFF(3); - for (int k = 1; k < 60 / _globals.vitesse; ++k) + for (uint k = 1; k < 60 / _globals.vitesse; ++k) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(5); - for (int l = 0; l < 20 / _globals.vitesse; ++l) + for (uint 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 (int m = 0; m < 50 / _globals.vitesse; ++m) { + for (uint m = 0; m < 50 / _globals.vitesse; ++m) { if (m == 30 / _globals.vitesse) { _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(8, 3); @@ -2807,9 +2807,9 @@ void HopkinsEngine::BTOCEAN() { while (1) { if (_globals.vitesse == 1) oldX -= 2; - if (_globals.vitesse == 2) + else if (_globals.vitesse == 2) oldX -= 4; - if (_globals.vitesse == 3) + else if (_globals.vitesse == 3) oldX -= 6; _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); @@ -2839,9 +2839,9 @@ LABEL_22: while (1) { if (_globals.vitesse == 1) oldX += 2; - if (_globals.vitesse == 2) + else if (_globals.vitesse == 2) oldX += 4; - if (_globals.vitesse == 3) + else if (_globals.vitesse == 3) oldX += 6; _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); @@ -2864,9 +2864,9 @@ LABEL_41: do { if (_globals.vitesse == 1) oldX += 2; - if (_globals.vitesse == 2) + else if (_globals.vitesse == 2) oldX += 4; - if (_globals.vitesse == 3) + else if (_globals.vitesse == 3) oldX += 6; _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); @@ -2889,9 +2889,9 @@ LABEL_57: do { if (_globals.vitesse == 1) oldX -= 2; - if (_globals.vitesse == 2) + else if (_globals.vitesse == 2) oldX -= 4; - if (_globals.vitesse == 3) + else if (_globals.vitesse == 3) oldX -= 6; _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); @@ -2920,9 +2920,9 @@ LABEL_72: do { if (_globals.vitesse == 1) oldX += 2; - if (_globals.vitesse == 2) + else if (_globals.vitesse == 2) oldX += 4; - if (_globals.vitesse == 3) + else if (_globals.vitesse == 3) oldX += 6; _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); @@ -2945,9 +2945,9 @@ LABEL_91: while (1) { if (_globals.vitesse == 1) oldX -= 2; - if (_globals.vitesse == 2) + else if (_globals.vitesse == 2) oldX -= 4; - if (_globals.vitesse == 3) + else if (_globals.vitesse == 3) oldX -= 6; _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 767decdded..c42feb7791 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1164,7 +1164,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int v1; int v2; int v5; - int v6; + uint v6; int v7; int v8; int v10; @@ -1269,6 +1269,7 @@ LABEL_38: if (v10 > 0) { v11 = v10 / _vm->_globals.vitesse; _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals.vitesse; + // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) _vm->_globals.Bob[idx].field12 = 1; } @@ -2263,14 +2264,13 @@ LABEL_153: } void ObjectsManager::GOHOME2() { - signed int v0; int16 v2; - v0 = 2; if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { + int v0 = 2; if (_vm->_globals.vitesse == 2) v0 = 4; - if (_vm->_globals.vitesse == 3) + else if (_vm->_globals.vitesse == 3) v0 = 6; _vm->_globals.j_104 = 0; if (v0) { @@ -3152,19 +3152,14 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n // Check Size void ObjectsManager::VERIFTAILLE() { - int v0; - int v1; - int v2; - - v0 = _vm->_globals.STAILLE[YSPR(0)]; + int v0 = _vm->_globals.STAILLE[YSPR(0)]; if (_vm->_globals.PERSO_TYPE == 1) { - v1 = v0; + int v1 = v0; if (v0 < 0) v1 = -v0; v0 = 20 * (5 * v1 - 100) / -80; - } - if (_vm->_globals.PERSO_TYPE == 2) { - v2 = v0; + } else if (_vm->_globals.PERSO_TYPE == 2) { + int v2 = v0; if (v0 < 0) v2 = -v0; v0 = 20 * (5 * v2 - 165) / -67; @@ -5217,7 +5212,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in v19 = " "; if (_vm->_globals.vitesse == 2) v15 = a5 / 2; - if (_vm->_globals.vitesse == 3) + else if (_vm->_globals.vitesse == 3) v15 = a5 / 3; v14 = Sprite[0].spriteData; spriteIndex = Sprite[0].spriteIndex; @@ -5284,7 +5279,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int v14 = a5; if (_vm->_globals.vitesse == 2) v14 = a5 / 2; - if (_vm->_globals.vitesse == 3) + else if (_vm->_globals.vitesse == 3) v14 = a5 / 3; S_old_spr = Sprite[0].spriteData; S_old_ani = Sprite[0].spriteIndex; @@ -5351,7 +5346,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a v13 = a5; if (_vm->_globals.vitesse == 2) v13 = a5 / 2; - if (_vm->_globals.vitesse == 3) + else if (_vm->_globals.vitesse == 3) v13 = a5 / 3; while (1) { v6 = 0; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 8330c1ea43..d0b086c6e7 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -479,11 +479,11 @@ LABEL_1141: if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') v1 = 1; if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - int v74 = (int16)READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; if (!v74) v74 = 1; if (v74 + 1 > 0) { - for (int v10 = 0; v10 < v74 + 1; v10++) { + for (uint v10 = 0; v10 < v74 + 1; v10++) { if (_vm->shouldQuit()) return -1; // Exiting game -- cgit v1.2.3 From 222c3f2661f1c5a747728405ed934f3ae273f5f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Dec 2012 22:14:03 +1100 Subject: HOPKINS: Implemented ADULT() method needed for Windows demo --- engines/hopkins/hopkins.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 4 ++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d04b926f08..d4d5411054 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -181,7 +181,10 @@ bool HopkinsEngine::runWin95Demo() { memset(_globals.SAUVEGARDE, 0, 2000); _globals.SORTIE = 0; _globals.PASSWORD = true; - warning("TODO ADULT();"); + + if (!ADULT()) + return Common::kNoError; + // v37 = v35; LABEL_18: if (_globals.SORTIE == 300) @@ -3090,4 +3093,56 @@ void HopkinsEngine::syncSoundSettings() { void HopkinsEngine::NO_DISPO(int sortie) { warning("STUB - NO_DISPO"); } + +bool HopkinsEngine::ADULT() { + int xp, yp; + int buttonIndex; + + _graphicsManager.min_x = 0; + _graphicsManager.min_y = 0; + _graphicsManager.max_x = SCREEN_WIDTH; + _graphicsManager.max_y = SCREEN_HEIGHT - 1; + _eventsManager.CASSE = false; + _globals.FORET = false; + _globals.FLAG_VISIBLE = false; + _globals.DESACTIVE_INVENT = true; + _globals.SORTIE = false; + + _graphicsManager.LOAD_IMAGE("ADULT"); + _graphicsManager.FADE_INW(); + _eventsManager.MOUSE_ON(); + _eventsManager.CHANGE_MOUSE(0); + _eventsManager.btsouris = false; + _eventsManager.souris_n = false; + + do { + xp = _eventsManager.XMOUSE(); + yp = _eventsManager.YMOUSE(); + + buttonIndex = 0; + if (xp >= 37 && xp <= 169 && yp >= 406 && yp <= 445) + buttonIndex = 2; + else if (xp >= 424 && xp <= 602 && yp >= 406 && yp <= 445) + buttonIndex = 1; + + _eventsManager.VBL(); + } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.BMOUSE() != 1)); + + _globals.DESACTIVE_INVENT = false; + _globals.FLAG_VISIBLE = false; + _graphicsManager.FADE_OUTW(); + + if (buttonIndex != 2) { + // Quit game + return false; + } else { + // Continue + _graphicsManager.min_x = 0; + _graphicsManager.max_y = 20; + _graphicsManager.max_x = SCREEN_WIDTH; + _graphicsManager.max_y = SCREEN_HEIGHT - 20; + return true; + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 7663926566..81d8f6b2cd 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -115,6 +115,10 @@ private: bool runLinuxDemo(); bool runLinuxFull(); + /** + * Show warning screen about the game being adults only. + */ + bool ADULT(); protected: // Engine APIs virtual Common::Error run(); -- cgit v1.2.3 From 3841a0d0068498e23895a565c441bda62d65dc03 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Dec 2012 22:33:01 +1100 Subject: HOPKINS: Bugfix for loading APC music files in the Windows versions --- engines/hopkins/sound.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 6f9f17a937..08f6f4abff 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -333,7 +333,8 @@ void SoundManager::LOAD_MUSIC(const Common::String &file) { s[2] = '\0'; mwavIndex = atol(&s[0]); - filename = Common::String::format("%s_%s.WAV", file.c_str(), &s[0]); + filename = Common::String::format("%s_%s.%s", file.c_str(), &s[0], + (_vm->getPlatform() == Common::kPlatformWindows) ? "APC" : "WAV"); LOAD_MSAMPLE(mwavIndex, filename); assert(destIndex < MUSIC_WAVE_COUNT); -- cgit v1.2.3 From 542d7fd068d0718b3e74c21251c4d28680f50b84 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Dec 2012 22:33:35 +1100 Subject: HOPKINS: Bugfixes for quitting in the Windows demo version --- engines/hopkins/hopkins.cpp | 26 +++++++++++++++----------- engines/hopkins/menu.cpp | 3 +++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d4d5411054..b0487c1cfc 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -195,13 +195,17 @@ LABEL_18: if (_globals.SORTIE == -1) { _globals.PERSO = _globals.dos_free2(_globals.PERSO); REST_SYSTEM(); + return false; } } - while (1) { - while (1) { - while (1) { - while (1) { - while (1) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + if (g_system->getEventManager()->shouldQuit()) + return false; + if (_globals.SORTIE == 300) goto LABEL_18; if (_globals.SORTIE != 1) @@ -2656,7 +2660,7 @@ void HopkinsEngine::Charge_Credits() { _globals.Credit[idxLines]._actvFl = true; _globals.Credit[idxLines]._linePosY = _globals.Credit_y + idxLines * _globals.Credit_step; int idxBuf = 0; - while (1) { + for (;;) { byte curChar = curPtr[idxBuf + 3]; if (curChar == '%' || curChar == 10) break; @@ -2690,7 +2694,7 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { byte *bufPtr = buffer; int strWidth = 0; byte curChar; - while (1) { + for (;;) { curChar = *bufPtr++; if (!curChar) break; @@ -2716,7 +2720,7 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { _globals.Credit_by1 = endPosY; bufPtr = buffer; - while (1) { + for (;;) { curChar = *bufPtr++; if (!curChar) break; @@ -2807,7 +2811,7 @@ void HopkinsEngine::BTOCEAN() { _globals.OCEAN_SENS = 7; _globals.SORTIE = 1; int oldX = _objectsManager.XSPR(0); - while (1) { + for (;;) { if (_globals.vitesse == 1) oldX -= 2; else if (_globals.vitesse == 2) @@ -2839,7 +2843,7 @@ LABEL_22: _globals.OCEAN_SENS = 3; _globals.SORTIE = 2; int oldX = _objectsManager.XSPR(0); - while (1) { + for (;;) { if (_globals.vitesse == 1) oldX += 2; else if (_globals.vitesse == 2) @@ -2945,7 +2949,7 @@ LABEL_72: LABEL_91: if (_globals.OCEAN_SENS == 7) { int oldX = _objectsManager.XSPR(0); - while (1) { + for (;;) { if (_globals.vitesse == 1) oldX -= 2; else if (_globals.vitesse == 2) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 7f7e3803cc..18484580e7 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -52,6 +52,9 @@ int MenuManager::MENU() { int frame2Index; int frame1Index; + if (g_system->getEventManager()->shouldQuit()) + return -1; + result = 0; while (!g_system->getEventManager()->shouldQuit()) { _vm->_globals.FORET = false; -- cgit v1.2.3 From 5dd1776228555bdc698cae2261ace5ebc3dafa12 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 3 Dec 2012 07:48:37 +0100 Subject: HOPKINS: Win95 demo is now completable --- engines/hopkins/hopkins.cpp | 19 ++++++++++++------- engines/hopkins/script.cpp | 32 ++++++++++++++++++++++++-------- engines/hopkins/sound.cpp | 25 +++++++++++++++++++++---- engines/hopkins/sound.h | 1 + 4 files changed, 58 insertions(+), 19 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b0487c1cfc..062337df4d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -126,6 +126,8 @@ Common::Error HopkinsEngine::run() { } bool HopkinsEngine::runWin95Demo() { + _globals.SVGA = 1; + _globals.CHARGE_OBJET(); _objectsManager.CHANGE_OBJET(14); _objectsManager.AJOUTE_OBJET(14); @@ -225,7 +227,7 @@ LABEL_18: if (!_globals.FR) _graphicsManager.LOAD_IMAGE("fondan"); _graphicsManager.FADE_INW(); - _eventsManager.delay(0x1F4u); + _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; @@ -234,9 +236,9 @@ LABEL_18: _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 200, 28); + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 200, 28); + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); @@ -2063,6 +2065,13 @@ void HopkinsEngine::PASS() { } } +void HopkinsEngine::NO_DISPO(int sortie) { + // Use the code of the linux demo instead of the code of the Windows demo. + // The behavior is somewhat better, and common code is easier to maintain. + PASS(); + _globals.SORTIE = sortie; +} + void HopkinsEngine::ENDEMO() { _soundManager.WSOUND(28); if (_globals.FR == 1) @@ -3094,10 +3103,6 @@ void HopkinsEngine::syncSoundSettings() { _soundManager.syncSoundSettings(); } -void HopkinsEngine::NO_DISPO(int sortie) { - warning("STUB - NO_DISPO"); -} - bool HopkinsEngine::ADULT() { int xp, yp; int buttonIndex; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d0b086c6e7..0898556e41 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -630,11 +630,13 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); + memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + } _vm->_globals.SORTIE = 6; } if (v76 == 607) { @@ -697,9 +699,15 @@ LABEL_1141: _vm->_fontManager.TEXTE_OFF(9); _vm->_graphicsManager.FIN_VISU(); _vm->_objectsManager.CLEAR_ECRAN(); - _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); + + if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { + _vm->_graphicsManager.FADE_OUTW(); + } else { + _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); + } + _vm->_animationManager.CHARGE_ANIM("otage"); _vm->_graphicsManager.LOAD_IMAGE("IM05"); _vm->_graphicsManager.VISU_ALL(); @@ -744,10 +752,18 @@ LABEL_1141: _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.FIN_VISU(); + + if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) + _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); + _vm->_soundManager.SPECIAL_SOUND = 14; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); _vm->_soundManager.SPECIAL_SOUND = 0; + + if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.DESACTIVE_INVENT = false; _vm->_globals.HELICO = 1; } diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 08f6f4abff..6b2f5b3053 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -426,8 +426,11 @@ void SoundManager::checkVoices() { void SoundManager::LOAD_MSAMPLE(int mwavIndex, const Common::String &file) { if (!Mwav[mwavIndex]._active) { Common::File f; - if (!f.open(file)) - error("Could not open %s for reading", file.c_str()); + if (!f.open(file)) { + // Fallback from WAV to APC... + if (!f.open(setExtension(file, ".APC"))) + error("Could not open %s for reading", file.c_str()); + } Mwav[mwavIndex]._audioStream = makeSoundStream(f.readStream(f.size())); Mwav[mwavIndex]._active = true; @@ -722,8 +725,11 @@ bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item) { Common::File f; - if (!f.open(filename)) - error("Could not open %s for reading", filename.c_str()); + if (!f.open(filename)) { + // Fallback from WAV to APC... + if (!f.open(setExtension(filename, ".APC"))) + error("Could not open %s for reading", filename.c_str()); + } f.seek(fileOffset); item._audioStream = makeSoundStream(f.readStream((entryLength == 0) ? f.size() : entryLength)); @@ -836,4 +842,15 @@ Audio::RewindableAudioStream *SoundManager::makeSoundStream(Common::SeekableRead return Audio::makeWAVStream(stream, DisposeAfterUse::YES); } +// Blatant rip from gob engine. Hi DrMcCoy! +Common::String SoundManager::setExtension(const Common::String &str, const Common::String &ext) { + if (str.empty()) + return str; + + const char *dot = strrchr(str.c_str(), '.'); + if (dot) + return Common::String(str.c_str(), dot - str.c_str()) + ext; + + return str + ext; +} } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 75cb29789c..e5562437ef 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -168,6 +168,7 @@ public: void syncSoundSettings(); void updateScummVMSoundSettings(); void checkSounds(); + Common::String setExtension(const Common::String &str, const Common::String &ext); }; } // End of namespace Hopkins -- cgit v1.2.3 From 84cad29ed62954a15dadcc82f61ee3228ba04136 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 3 Dec 2012 07:52:31 +0100 Subject: HOPKINS: Rewrite a for statement in previous commit --- engines/hopkins/hopkins.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 062337df4d..0ce9b6d1cb 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -154,12 +154,10 @@ bool HopkinsEngine::runWin95Demo() { _globals.iRegul = 1; _globals.vitesse = 1; - int v23 = 1; - do { - ++v23; + for (int i = 1; i < 50; i++) { _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 0, 0, 640, 440, _graphicsManager.VESA_BUFFER, 0, 0); _eventsManager.VBL(); - } while (v23 < 50); + } _globals.iRegul = 0; warning("TODO SPEEDJ = _globals.lItCounter;"); -- cgit v1.2.3 From 99f3442393145643678519076ffbd5c07fcbe4b2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 4 Dec 2012 21:35:54 +0100 Subject: HOPKINS: Add code for win95 full version --- engines/hopkins/hopkins.cpp | 912 +++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 6 + 2 files changed, 914 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0ce9b6d1cb..8d47a06b43 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -113,10 +113,8 @@ Common::Error HopkinsEngine::run() { } else if (getPlatform() == Common::kPlatformWindows) { if (getIsDemo()) runWin95Demo(); - else { - warning("Unhandled version, switching to linux demo"); - runLinuxDemo(); - } + else + runWin95full(); } else { warning("Unhandled version, switching to linux demo"); runLinuxDemo(); @@ -849,6 +847,907 @@ LABEL_124: return true; } +bool HopkinsEngine::runWin95full() { +/* + __int16 v4; // dx@1 + int v5; // ecx@1 + int v6; // edx@1 + int v7; // ecx@1 + _DWORD *v8; // edi@1 + char v9; // cl@1 + int v10; // eax@5 + signed int v11; // edi@5 + int v12; // esi@5 + int v13; // edx@5 + int v14; // ecx@5 + int v15; // edx@11 + int v16; // ecx@11 + int v17; // ecx@17 + int v18; // edx@17 + int v19; // edx@17 + int v20; // ecx@17 + int v21; // edx@17 + int v22; // ecx@17 + int v23; // ecx@17 + int v24; // edx@17 + int v25; // ecx@17 + int v26; // ecx@19 + int v27; // ecx@19 + int v28; // edx@19 + int v29; // ecx@19 + signed int v30; // esi@19 + int v31; // ecx@19 + int v32; // ecx@19 + int v33; // edx@19 + int v34; // ecx@19 + int v35; // ecx@113 + int v36; // ecx@113 + int v37; // eax@113 + int v38; // ecx@113 + int v39; // edx@113 + int v40; // ecx@113 + int v41; // ecx@113 + __int16 v42; // cx@116 + __int16 v43; // dx@118 + int v44; // ecx@118 + int v45; // ecx@120 + int v46; // ecx@121 + int v47; // edx@121 + int v48; // ecx@121 + int v49; // ecx@122 + int v50; // edx@122 + int v51; // ecx@122 + int v52; // edx@128 + int v53; // ecx@128 + int v54; // ecx@132 + int v55; // ecx@136 + char v56; // bh@138 + int v57; // ecx@139 + int v58; // ebx@139 + char v59; // dl@149 + char v60; // dl@154 + char v61; // bl@164 + int v62; // ecx@165 + int v63; // ebx@165 + int v64; // eax@170 + int v65; // ecx@170 + int v66; // ecx@170 + int v67; // edx@170 + int v68; // eax@177 + int v69; // ecx@178 + int v70; // ecx@178 + char v71; // bl@195 + int v72; // eax@238 + int v73; // ecx@239 + int v74; // edx@239 + int v75; // ecx@239 + int v76; // edx@250 + char v77; // al@250 + int v78; // ecx@250 + int v79; // edx@251 + char v80; // al@251 + int v81; // ecx@251 + int v82; // edx@252 + char v83; // al@252 + int v84; // ecx@252 + int v85; // edx@268 + int v86; // ecx@268 + int v87[2]; // [sp+0h] [bp-20h]@1 + int v88; // [sp+8h] [bp-18h]@121 + char v89; // [sp+Ch] [bp-14h]@121 + __int16 v90; // [sp+10h] [bp-10h]@121 +*/ + + _globals.SVGA = 2; +// _SPEED_SCROLL = 4; + + warning("TODO: Init_Interrupt_()"); + + _globals.CHARGE_OBJET(); + _objectsManager.CHANGE_OBJET(14); + _objectsManager.AJOUTE_OBJET(14); + _globals.HELICO = 0; + _globals.iRegul = 1; + + warning("TODO: Affiche_Version();"); + + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + + _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); + _graphicsManager.FADE_OUTW(); + if (!_eventsManager.ESC_KEY) + INTRORUN(); + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 0; + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.PLANX = _globals.PLANY = 0; + memset(_globals.SAUVEGARDE, 0, 2000); + _globals.SORTIE = 0; + _globals.PASSWORD = true; +LABEL_20: + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU();; + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + return false; + } + } + + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + for (;;) { + if (g_system->getEventManager()->shouldQuit()) + return false; + if (_globals.SORTIE == 300) + goto LABEL_20; + if (_globals.SORTIE != 18) + break; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); + } + if (_globals.SORTIE != 23) + break; + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + } + if (_globals.SORTIE != 22) + break; + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + } + if (_globals.SORTIE != 19) + break; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + if (_globals.SAUVEGARDE->data[svField123]) + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + else + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + } + if (_globals.SORTIE != 20) + break; + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 8; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + if (_globals.SORTIE == 17) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); + if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + } + if (_globals.SORTIE != 1) + break; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + } + if (_globals.SORTIE != 3) + break; + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _soundManager.SPECIAL_SOUND = 2; + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + if (_globals.CENSURE) + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _graphicsManager.FADE_OUTW(); + _globals.SAUVEGARDE->data[svField170] = 1; + } + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + } + if (_globals.SORTIE != 4) + break; + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + } + if (_globals.SORTIE == 5) + break; + switch (_globals.SORTIE) { + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + case 6: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + case 9: + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField225]) + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + else + BOOM(); + break; + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + case 12: + _globals.Max_Propre_Gen = 10; + _globals.Max_Ligne_Long = 20; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 15; + if (_globals.SAUVEGARDE->data[svField225]) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); + } + break; + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _globals.NOSPRECRAN = false; + break; + case 16: + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + break; + case 17: + _globals.Max_Propre = 50; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.Max_Ligne_Long = 40; + if (_globals.SAUVEGARDE->data[svField117] == 1) { + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + } else if (!_globals.SAUVEGARDE->data[svField117]) { + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + } + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(29); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + case 24: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField181]) { + if (_globals.SAUVEGARDE->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); + } else { + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + } + break; + case 25: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + break; + case 27: + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre = 10; + if (_globals.SAUVEGARDE->data[svField177] == 1) { + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + } else if (!_globals.SAUVEGARDE->data[svField177]) { + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + } + break; + case 28: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + else + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + break; + case 29: + _globals.Max_Propre = 60; + _globals.Max_Ligne_Long = 50; + _globals.Max_Propre_Gen = 50; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + break; + case 30: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + _globals.NOSPRECRAN = false; + break; + case 31: + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + break; + default: + if (_globals.SORTIE > 34 && _globals.SORTIE < 42) { + _globals.Max_Propre_Gen = 20; + _globals.fmusic = 13; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 435; + _globals.DESACTIVE_INVENT = false; + _globals.FORET = true; + _globals.NOSPRECRAN = true; + Common::String im = Common::String::format("IM%d", _globals.SORTIE); + _soundManager.WSOUND(13); + if (_globals.FORETSPR == g_PTRNUL) { + _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); + _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + } + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); + _globals.NOSPRECRAN = false; + if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { + _globals.dos_free2(_globals.FORETSPR); + _globals.FORETSPR = g_PTRNUL; + _globals.FORET = false; + _soundManager.DEL_SAMPLE(1); + } + } else { + switch (_globals.SORTIE) { + case 32: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + break; + case 34: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); + _globals.NOSPRECRAN = false; + break; + case 51: + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre = 20; + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + break; + case 52: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + break; + case 54: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + break; + case 55: + _globals.Max_Propre = 40; + _globals.Max_Perso_Y = 460; + _globals.Max_Ligne_Long = 30; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + break; + case 56: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + break; + case 58: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + break; + case 57: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + break; + case 59: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); + _globals.NOSPRECRAN = false; + break; + case 60: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); + _globals.NOSPRECRAN = false; + break; + case 61: + if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + INCENDIE(); + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + break; + case 63: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); + _globals.NOSPRECRAN = false; + break; + case 64: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + break; + case 65: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); + _globals.NOSPRECRAN = false; + break; + case 66: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); + _globals.NOSPRECRAN = false; + break; + case 69: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); + _globals.NOSPRECRAN = false; + break; + case 62: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); + _globals.NOSPRECRAN = false; + break; + case 68: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + break; + case 67: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); + _globals.NOSPRECRAN = false; + break; + case 70: + _globals.Max_Perso_Y = 435; + _globals.Max_Propre = 8; + _globals.NOSPRECRAN = true; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); + _globals.NOSPRECRAN = false; + break; + case 71: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); + _globals.NOSPRECRAN = false; + break; + case 73: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField318] == 1) { + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + } else if (!_globals.SAUVEGARDE->data[svField318]) { + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + } + break; + case 75: + BASE(); + break; + case 93: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField330]) + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); + break; + case 94: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + break; + case 95: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = false; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + break; + case 97: + _globals.Max_Perso_Y = 435; + _globals.Max_Propre = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + case 98: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + break; + case 99: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + break; + case 96: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + break; + case 77: + OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + break; + case 78: + OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + break; + case 79: + OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + break; + case 80: + OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + break; + case 81: + OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + break; + case 82: + OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + break; + case 83: + OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + break; + case 84: + OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + break; + case 85: + OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + break; + case 86: + OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + break; + case 87: + OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + break; + case 88: + OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + break; + case 89: + OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + break; + case 91: + OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + break; + case 90: + BASED(); + break; + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + case 113: + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals.SORTIE = 0; + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + break; + case 114: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + break; + case 115: + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals.SORTIE = 0; + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + break; + case 100: + JOUE_FIN(); + break; + case 50: + AVION(); + _globals.SORTIE = 51; + break; + default: + if (_globals.SORTIE < 194 || _globals.SORTIE > 199) { + if (_globals.SORTIE == 151) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + if (_globals.SORTIE == 150) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + if (_globals.SORTIE == 152) { + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + } + goto LABEL_20; + } + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + warning("TODO: heapshrink();"); + _soundManager.WSOUND(23); + _globals.SORTIE = WBASE(); + _soundManager.WSOUND_OFF(); + warning("TODO: heapshrink();"); + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; + _graphicsManager.nbrligne = SCREEN_WIDTH; +// MODE_VESA(); + _graphicsManager.SET_MODE(640, 480); + if (_objectsManager.SPEED_FLAG >> 16 == -1) // I guess it's not a boolean... + error("FIN BASE SOUS MARINE"); + break; + } + } + break; + } + } + _globals.Max_Propre = _globals.SORTIE; + _globals.Max_Ligne_Long = _globals.SORTIE; + _globals.Max_Propre_Gen = _globals.SORTIE; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 455; + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + _globals.NOSPRECRAN = false; + } +} + bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(16); @@ -2633,6 +3532,11 @@ int HopkinsEngine::PWBASE() { return result; } +int HopkinsEngine::WBASE() { + warning("STUB: WBASE()"); + return 300; +} + void HopkinsEngine::Charge_Credits() { _globals.Credit_y = 440; _globals.Credit_l = 10; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 81d8f6b2cd..fc8f6253cd 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -103,6 +103,11 @@ private: */ int PWBASE(); + /** + * Runs the Wolf3D-like in the underground base. + */ + int WBASE(); + void BTOCEAN(); void OCEAN_HOME(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9); @@ -113,6 +118,7 @@ private: bool runWin95Demo(); bool runLinuxDemo(); + bool runWin95full(); bool runLinuxFull(); /** -- cgit v1.2.3 From f91b1f1129d6be7c70b63e63c0a60640d30a8d2c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 4 Dec 2012 21:36:53 +0100 Subject: HOPKINS: Janitorials: remove some while(1) --- engines/hopkins/anim.cpp | 4 ++-- engines/hopkins/computer.cpp | 2 +- engines/hopkins/font.cpp | 4 ++-- engines/hopkins/graphics.cpp | 12 ++++++------ engines/hopkins/lines.cpp | 14 +++++++------- engines/hopkins/objects.cpp | 4 ++-- engines/hopkins/talk.cpp | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 9cd97cf53a..97ec536b0b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -332,7 +332,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; - while (1) { + for (;;) { if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_114; if (REDRAW_ANIM() == true) @@ -403,7 +403,7 @@ LABEL_48: _vm->_eventsManager.lItCounter = 0; v5 = 0; v15 = 0; - while (1) { + for (;;) { ++v15; _vm->_soundManager.PLAY_ANM_SOUND(v15); memset(&buf, 0, 6u); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 373c023c86..74c1c644bd 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -315,7 +315,7 @@ void ComputerManager::Charge_Menu() { } MenuText[lineNum]._actvFl = 1; strPos = 0; - while (1) { + for (;;) { byte curChar = tmpPtr[strPos + 2]; if (curChar == '%' || curChar == 10) break; diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 414d88e399..b5813f8163 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -217,7 +217,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v60 = texte_tmp; if (v69) { int v64 = 0; - while (1) { + for (;;) { byte v14 = *(v60 + v64); if (v14 == '\r' || v14 == '\n') { *(v60 + v64) = 0; @@ -260,7 +260,7 @@ LABEL_43: do { int v19 = 0; int ptrb = _vm->_globals.largeur_boite - 4; - while (1) { + for (;;) { lineSize = v19; do v11 = *(v61 + v65 + v19++); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 697a57cdde..35a067cec5 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1874,7 +1874,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp } int v63; do { - while (1) { + for (;;) { v63 = v22; byte *v53 = v29; v46 = spritePixelsP; @@ -1882,7 +1882,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_x = 0; int v35 = v20; do { - while (1) { + for (;;) { if (*spritePixelsP) *v29 = *spritePixelsP; --v29; @@ -1956,7 +1956,7 @@ R_Aff_Zoom_Larg_Cont1: int v60; do { - while (1) { + for (;;) { v60 = v22; byte *v51 = dest1P; v45 = spritePixelsP; @@ -1964,7 +1964,7 @@ R_Aff_Zoom_Larg_Cont1: Agr_Flag_x = 0; Agr_x = 0; do { - while (1) { + for (;;) { if (*spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; @@ -2415,7 +2415,7 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { result = 0; destOffset = 0; srcPtr = src; - while (1) { + for (;;) { byteVal = *srcPtr; if (*srcPtr < kByteStop) goto Video_Cont_wVbe; @@ -2449,7 +2449,7 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { assert(VideoPtr); destOffset = 0; srcP = src; - while (1) { + for (;;) { byteVal = *srcP; if (*srcP < kByteStop) goto Video_Cont_Vbe; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 1d93096987..2aaa6adc63 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -392,7 +392,7 @@ LABEL_29: int v20 = a2 + 4; int v19 = a2 - 4; int v17; - while (1) { + for (;;) { v7 = Ligne[v6].lineData; if (v7 != (int16 *)g_PTRNUL) { @@ -433,7 +433,7 @@ LABEL_28: if (v24 >= a6 + 1) goto LABEL_29; } - while (1) { + for (;;) { int v12 = v7[0]; v13 = v7 + 1; @@ -513,7 +513,7 @@ LABEL_46: if (v24 >= a6 + 1) goto LABEL_47; } - while (1) { + for (;;) { int v12 = v7[0]; v13 = v7 + 1; int v16 = v13[0]; @@ -1160,7 +1160,7 @@ LABEL_112: int v92 = a1; int v65; - while (1) { + for (;;) { int v86 = v92 - 1; int v11 = 2 * Ligne[v92 - 1].field0; @@ -1196,7 +1196,7 @@ LABEL_11: if (v16 == (int16 *)g_PTRNUL) break; int v17; - while (1) { + for (;;) { v65 = v15; v17 = v16[v15 - 2]; if (v16[0] == v95) { @@ -2632,7 +2632,7 @@ LABEL_67: v91 = SMOOTH_SENS; v14 = 0; int v16; - while (1) { + for (;;) { int v15 = SMOOTH[v14].field0; v112 = v15; v110 = SMOOTH[v14].field2; @@ -2750,7 +2750,7 @@ LABEL_195: goto LABEL_248; } v39 = v92; - while (1) { + for (;;) { if (colision2_ligne(a3, v39, &v141, &v140, 0, TOTAL_LIGNES) == 1) { if (_vm->_objectsManager.DERLIGNE < v140) { v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c42feb7791..6951f48a6f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2274,7 +2274,7 @@ void ObjectsManager::GOHOME2() { v0 = 6; _vm->_globals.j_104 = 0; if (v0) { - while (1) { + for (;;) { nouveau_x = *_vm->_globals.chemin; _vm->_globals.chemin++; @@ -5348,7 +5348,7 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a v13 = a5 / 2; else if (_vm->_globals.vitesse == 3) v13 = a5 / 3; - while (1) { + for (;;) { v6 = 0; v7 = a2[v14]; if (v7 == 44) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 6bb0110dc5..9bdaae155f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -783,7 +783,7 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v2 = 0; v3 = 0; v4 = a1; - while (1) { + for (;;) { if (*(BUFFERPERSO + v4) == 'A' && *(BUFFERPERSO + v4 + 1) == 'N' && *(BUFFERPERSO + v4 + 2) == 'I' @@ -990,7 +990,7 @@ LABEL_2: v15 = 0; if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; - while (1) { + for (;;) { if (*v5 == 'C') { if (*(v5 + 1) == 'O') { if (*(v5 + 2) == 'D') { -- cgit v1.2.3 From 6aa44d12336d240749c92753d5886715f01b19bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 4 Dec 2012 23:25:01 +0100 Subject: HOPKINS: Fix glitch in full win95 version logic --- engines/hopkins/hopkins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 8d47a06b43..c2145d474d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1724,7 +1724,7 @@ LABEL_20: _graphicsManager.nbrligne = SCREEN_WIDTH; // MODE_VESA(); _graphicsManager.SET_MODE(640, 480); - if (_objectsManager.SPEED_FLAG >> 16 == -1) // I guess it's not a boolean... + if (_globals.SORTIE == -1) error("FIN BASE SOUS MARINE"); break; } -- cgit v1.2.3 From 1665340fca244d2f0e8e08e0d8426f3b3bf37f79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 4 Dec 2012 23:29:28 +0100 Subject: HOPKINS: Add MODE_VESA() --- engines/hopkins/graphics.cpp | 4 ++++ engines/hopkins/graphics.h | 1 + engines/hopkins/hopkins.cpp | 21 +++++++-------------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 35a067cec5..0075fb0830 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2529,4 +2529,8 @@ void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, byte } while (yCtr); } +void GraphicsManager::MODE_VESA() { + SET_MODE(640, 480); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 22b8e9f290..df0c71f8c3 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -195,6 +195,7 @@ public: void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col); void Plot_Vline(byte *surface, int xp, int yp, int height, byte col); + void MODE_VESA(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c2145d474d..88aaa9452a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -356,8 +356,7 @@ LABEL_18: _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); break; case 114: _globals.OLD_ECRAN = _globals.ECRAN; @@ -366,8 +365,7 @@ LABEL_18: _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); break; case 115: _globals.SORTIE = 0; @@ -376,8 +374,7 @@ LABEL_18: _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); break; default: if (_globals.SORTIE == 151) { @@ -1642,8 +1639,7 @@ LABEL_20: _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); break; case 114: _globals.SORTIE = 0; @@ -1652,8 +1648,7 @@ LABEL_20: _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); break; case 115: _globals.OLD_ECRAN = _globals.ECRAN; @@ -1662,8 +1657,7 @@ LABEL_20: _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); break; case 100: JOUE_FIN(); @@ -1722,8 +1716,7 @@ LABEL_20: _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager.nbrligne = SCREEN_WIDTH; -// MODE_VESA(); - _graphicsManager.SET_MODE(640, 480); + _graphicsManager.MODE_VESA(); if (_globals.SORTIE == -1) error("FIN BASE SOUS MARINE"); break; -- cgit v1.2.3 From 13cb37defca1adb315919b00c53061f1d2226873 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 5 Dec 2012 01:15:59 +0100 Subject: HOPKINS: Add detection for Polish demo --- engines/hopkins/detection_tables.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 50152cfb4c..ffb1164ed4 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -89,6 +89,22 @@ static const HopkinsGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { + // Hopkins FBI Win95 Polish Demo, provided by Strangerke + { + "hopkins", + "Win95 Demo", + { + {"Hopkins.exe", 0, "7595c0b9374739b212ee9f8f412ac716", 307200}, + {"RES_VAN.RES", 0, "8262cfba261c200af4451902689dffe0", 12233202}, + AD_LISTEND + }, + Common::PL_POL, + Common::kPlatformWindows, + ADGF_DEMO, + GUIO1(GUIO_NONE) + }, + }, { // Hopkins FBI Win95, provided by Strangerke { -- cgit v1.2.3 From b671fbc534ac33a165c282d9990fac465af19d1e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 5 Dec 2012 01:17:40 +0100 Subject: HOPKINS: Remove commented variables in runWin95Full --- engines/hopkins/hopkins.cpp | 90 --------------------------------------------- 1 file changed, 90 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 88aaa9452a..cb184a685a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -845,96 +845,6 @@ LABEL_124: } bool HopkinsEngine::runWin95full() { -/* - __int16 v4; // dx@1 - int v5; // ecx@1 - int v6; // edx@1 - int v7; // ecx@1 - _DWORD *v8; // edi@1 - char v9; // cl@1 - int v10; // eax@5 - signed int v11; // edi@5 - int v12; // esi@5 - int v13; // edx@5 - int v14; // ecx@5 - int v15; // edx@11 - int v16; // ecx@11 - int v17; // ecx@17 - int v18; // edx@17 - int v19; // edx@17 - int v20; // ecx@17 - int v21; // edx@17 - int v22; // ecx@17 - int v23; // ecx@17 - int v24; // edx@17 - int v25; // ecx@17 - int v26; // ecx@19 - int v27; // ecx@19 - int v28; // edx@19 - int v29; // ecx@19 - signed int v30; // esi@19 - int v31; // ecx@19 - int v32; // ecx@19 - int v33; // edx@19 - int v34; // ecx@19 - int v35; // ecx@113 - int v36; // ecx@113 - int v37; // eax@113 - int v38; // ecx@113 - int v39; // edx@113 - int v40; // ecx@113 - int v41; // ecx@113 - __int16 v42; // cx@116 - __int16 v43; // dx@118 - int v44; // ecx@118 - int v45; // ecx@120 - int v46; // ecx@121 - int v47; // edx@121 - int v48; // ecx@121 - int v49; // ecx@122 - int v50; // edx@122 - int v51; // ecx@122 - int v52; // edx@128 - int v53; // ecx@128 - int v54; // ecx@132 - int v55; // ecx@136 - char v56; // bh@138 - int v57; // ecx@139 - int v58; // ebx@139 - char v59; // dl@149 - char v60; // dl@154 - char v61; // bl@164 - int v62; // ecx@165 - int v63; // ebx@165 - int v64; // eax@170 - int v65; // ecx@170 - int v66; // ecx@170 - int v67; // edx@170 - int v68; // eax@177 - int v69; // ecx@178 - int v70; // ecx@178 - char v71; // bl@195 - int v72; // eax@238 - int v73; // ecx@239 - int v74; // edx@239 - int v75; // ecx@239 - int v76; // edx@250 - char v77; // al@250 - int v78; // ecx@250 - int v79; // edx@251 - char v80; // al@251 - int v81; // ecx@251 - int v82; // edx@252 - char v83; // al@252 - int v84; // ecx@252 - int v85; // edx@268 - int v86; // ecx@268 - int v87[2]; // [sp+0h] [bp-20h]@1 - int v88; // [sp+8h] [bp-18h]@121 - char v89; // [sp+Ch] [bp-14h]@121 - __int16 v90; // [sp+10h] [bp-10h]@121 -*/ - _globals.SVGA = 2; // _SPEED_SCROLL = 4; -- cgit v1.2.3 From 8aebc05322dfd5539a5f754d9440b6d653840769 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 5 Dec 2012 01:27:25 +0100 Subject: HOPKINS: Polish demo now starts --- engines/hopkins/hopkins.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index cb184a685a..4ad2d2a696 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -180,8 +180,9 @@ bool HopkinsEngine::runWin95Demo() { _globals.SORTIE = 0; _globals.PASSWORD = true; - if (!ADULT()) - return Common::kNoError; + if (getLanguage() != Common::PL_POL) + if (!ADULT()) + return Common::kNoError; // v37 = v35; LABEL_18: -- cgit v1.2.3 From e0711bb832b8224d261e21030eeceaafd91fbf6c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Dec 2012 20:41:58 +1100 Subject: HOPKINS: Fix some compiler warnings under gcc --- engines/hopkins/events.cpp | 18 +++++++++--------- engines/hopkins/lines.cpp | 2 +- engines/hopkins/script.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 2271bff7b4..be261342d1 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -203,11 +203,11 @@ void EventsManager::pollEvents() { return; case Common::EVENT_KEYDOWN: - keyState[toupper(event.kbd.ascii)] = true; + keyState[(byte)toupper(event.kbd.ascii)] = true; handleKey(event); return; case Common::EVENT_KEYUP: - keyState[toupper(event.kbd.ascii)] = false; + keyState[(byte)toupper(event.kbd.ascii)] = false; return; case Common::EVENT_LBUTTONDOWN: souris_b = 1; @@ -225,10 +225,10 @@ void EventsManager::pollEvents() { } for (char chr = 'A'; chr <= 'Z'; chr++) - keyState[chr] = false; + keyState[(byte)chr] = false; for (char chr = '0'; chr <= '9'; chr++) - keyState[chr] = false; + keyState[(byte)chr] = false; } void EventsManager::handleKey(Common::Event &event) { @@ -260,20 +260,20 @@ int EventsManager::keywin() { return -1; for (char ch = 'A'; ch <= 'Z'; ++ch) { - if (keyState[ch]) { + if (keyState[(byte)ch]) { foundChar = ch; break; } } for (char ch = '0'; ch <= '9'; ++ch) { - if (keyState[ch]) { + if (keyState[(byte)ch]) { foundChar = ch; break; } } - if (keyState['.']) + if (keyState[(byte)'.']) foundChar = '.'; else if (keyState[8]) // BACKSPACE @@ -281,14 +281,14 @@ int EventsManager::keywin() { else if (keyState[13]) // ENTER foundChar = 13; - else if (keyState[' ']) + else if (keyState[(byte)' ']) foundChar = ' '; VBL(); } // Wait for keypress release - while (keyState[foundChar] && !_vm->shouldQuit()) { + while (keyState[(byte)foundChar] && !_vm->shouldQuit()) { VBL(); g_system->delayMillis(10); } diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2aaa6adc63..4a3eabe878 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -626,7 +626,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i for (int i = a2; Ligne[a1].field0 > i; ++i) { int16 *v10 = Ligne[a1].lineData; int v11 = v10[2 * i]; - int v50 = v10[2 * i + 1]; + v50 = v10[2 * i + 1]; int v12 = v8; a6[v12] = v11; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 0898556e41..a96b8d197e 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -172,7 +172,7 @@ LABEL_104: if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { if (_vm->_objectsManager.DESACTIVE != true) { int v72 = *(a1 + 5); - int v70 = *(a1 + 6); + v70 = *(a1 + 6); int v4 = *(a1 + 7); int v68 = (int16)READ_LE_UINT16(a1 + 8); int v66 = (int16)READ_LE_UINT16(a1 + 10); -- cgit v1.2.3 From 1f0e31d95ffa0cd072c06b31d37c4ef3014abb7e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Dec 2012 20:49:05 +1100 Subject: HOPKINS: Clean up shadowed variable in SCBOB --- engines/hopkins/objects.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6951f48a6f..9112245738 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -722,13 +722,11 @@ void ObjectsManager::SCBOB(int idx) { if (_vm->_globals.Cache[idx].fieldA <= 0) return; - int v1 = idx; - for (int v8 = 0; v8 <= 20; v8++) { - v1 = v8; - if ((_vm->_globals.Bob[v1].field0) && (!_vm->_globals.Bob[v8].field16) && (!_vm->_globals.Bob[v8].field34) && (_vm->_globals.Bob[v8].frameIndex != 250)) { - int v2 = _vm->_globals.Bob[v8].oldWidth; - int v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; - int v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; + for (int idx = 0; idx <= 20; idx++) { + if ((_vm->_globals.Bob[idx].field0) && (!_vm->_globals.Bob[idx].field16) && (!_vm->_globals.Bob[idx].field34) && (_vm->_globals.Bob[idx].frameIndex != 250)) { + int v2 = _vm->_globals.Bob[idx].oldWidth; + int v9 = _vm->_globals.Bob[idx].oldX + _vm->_globals.Bob[idx].oldWidth; + int v6 = _vm->_globals.Bob[idx].oldY + _vm->_globals.Bob[idx].oldHeight; int v3 =_vm->_globals.Cache[idx].field0; int v4 =_vm->_globals.Cache[idx].field4; int v7 =_vm->_globals.Cache[idx].field6 + v3; @@ -740,25 +738,25 @@ void ObjectsManager::SCBOB(int idx) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } - if (!(uint16)v1) { + if (!v1) { if (v2 >= v3 && v7 >= v2) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } } - if (!(uint16)v1) { + if (!v1) { if ( v7 >= v2 && v2 >= v3 ) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } } - if (!(uint16)v1) { + if (!v1) { if (v2 >= v3 && v9 <= v7) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } } - if (!(uint16)v1 && v2 <= v3 && v9 >= v7) + if (!v1 && v2 <= v3 && v9 >= v7) ++_vm->_globals.Cache[idx].fieldA; } } -- cgit v1.2.3 From 6831f5bae612b8472d2f0ce82ec492192c29634b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Dec 2012 20:53:14 +1100 Subject: HOPKINS: Further fixes for SCBOB --- engines/hopkins/objects.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9112245738..ebc1e03f1a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -722,11 +722,11 @@ void ObjectsManager::SCBOB(int idx) { if (_vm->_globals.Cache[idx].fieldA <= 0) return; - for (int idx = 0; idx <= 20; idx++) { - if ((_vm->_globals.Bob[idx].field0) && (!_vm->_globals.Bob[idx].field16) && (!_vm->_globals.Bob[idx].field34) && (_vm->_globals.Bob[idx].frameIndex != 250)) { - int v2 = _vm->_globals.Bob[idx].oldWidth; - int v9 = _vm->_globals.Bob[idx].oldX + _vm->_globals.Bob[idx].oldWidth; - int v6 = _vm->_globals.Bob[idx].oldY + _vm->_globals.Bob[idx].oldHeight; + for (int v8 = 0; v8 <= 20; v8++) { + if ((_vm->_globals.Bob[v8].field0) && (!_vm->_globals.Bob[v8].field16) && (!_vm->_globals.Bob[v8].field34) && (_vm->_globals.Bob[v8].frameIndex != 250)) { + int v2 = _vm->_globals.Bob[v8].oldWidth; + int v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; + int v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; int v3 =_vm->_globals.Cache[idx].field0; int v4 =_vm->_globals.Cache[idx].field4; int v7 =_vm->_globals.Cache[idx].field6 + v3; @@ -738,25 +738,25 @@ void ObjectsManager::SCBOB(int idx) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } - if (!v1) { + if (!(uint16)v1) { if (v2 >= v3 && v7 >= v2) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } } - if (!v1) { + if (!(uint16)v1) { if ( v7 >= v2 && v2 >= v3 ) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } } - if (!v1) { + if (!(uint16)v1) { if (v2 >= v3 && v9 <= v7) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } } - if (!v1 && v2 <= v3 && v9 >= v7) + if (!(uint16)v1 && v2 <= v3 && v9 >= v7) ++_vm->_globals.Cache[idx].fieldA; } } -- cgit v1.2.3 From 89f3ecdfb13ab2156776639b4d97016f962c42bc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 6 Dec 2012 00:10:46 +0100 Subject: HOPKINS: Better initialization of FontManager --- engines/hopkins/font.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index b5813f8163..cb7580cc33 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -41,8 +41,26 @@ void FontManager::setParent(HopkinsEngine *vm) { } void FontManager::clearAll() { - for (int idx = 0; idx < 11; ++idx) + for (int idx = 0; idx < 12; ++idx) { Common::fill((byte *)&Txt[idx], (byte *)&Txt[idx] + sizeof(TxtItem), 0); + + ListeTxt[idx].enabled = false; + ListeTxt[idx].height = 0; + ListeTxt[idx].width = 0; + ListeTxt[idx].xp = 0; + ListeTxt[idx].yp = 0; + } + + for (int idx = 0; idx < 21; idx++) + TRIER_TEXT[idx] = 0; + + oldname = Common::String(""); + nom_index = Common::String(""); + + for (int idx = 0; idx < 4048; idx++) + Index[idx] = 0; + + texte_tmp = g_PTRNUL; } // Text On -- cgit v1.2.3 From dbef4b914776eaba290e0c8b0be3b2f52a42896c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 6 Dec 2012 07:44:24 +0100 Subject: HOPKINS: Remove duplicate variable --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 02f70f1bc3..aee0cb23a2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -227,7 +227,6 @@ Globals::Globals() { XFULLSCREEN = false; XFORCE16 = false; XFORCE8 = false; - CARD_SB = false; SOUNDOFF = false; MUSICOFF = false; VOICEOFF = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 131c48cb4c..2e3097eafb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -345,7 +345,6 @@ public: int XZOOM; bool XFORCE16; bool XFORCE8; - bool CARD_SB; int PERSO_TYPE; uint vitesse; int INSTALL_TYPE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4ad2d2a696..7d53655203 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2530,7 +2530,6 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { _globals.XFORCE16 = iniParams["FORCE16BITS"] == "YES"; _globals.XFORCE8 = iniParams["FORCE8BITS"] == "YES"; - _globals.CARD_SB = iniParams["SOUND"] == "YES"; } void HopkinsEngine::INIT_SYSTEM() { -- cgit v1.2.3 From a645f876c34501a088df0c945746e80ec1ac51fa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 6 Dec 2012 07:49:55 +0100 Subject: HOPKINS: Remove CARD_SB variable. Sound card is always present. --- engines/hopkins/sound.cpp | 100 +++++++++++++++++++--------------------------- engines/hopkins/sound.h | 1 - 2 files changed, 42 insertions(+), 59 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 6b2f5b3053..8ffe5a4f32 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -88,8 +88,6 @@ SoundManager::SoundManager() { old_music = 0; MOD_FLAG = false; - CARD_SB = true; - for (int i = 0; i < VOICE_COUNT; ++i) Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); for (int i = 0; i < SWAV_COUNT; ++i) @@ -111,7 +109,7 @@ void SoundManager::WSOUND_INIT() { } void SoundManager::VERIF_SOUND() { - if (CARD_SB && !SOUNDOFF && SOUND_FLAG) { + if (!SOUNDOFF && SOUND_FLAG) { if (!VOICE_STAT(1)) { STOP_VOICE(1); DEL_NWAV(SOUND_NUM); @@ -203,7 +201,7 @@ void SoundManager::PLAY_ANM_SOUND(int soundNumber) { } void SoundManager::WSOUND(int soundNumber) { - if (CARD_SB && (old_music != soundNumber || !MOD_FLAG)) { + if (old_music != soundNumber || !MOD_FLAG) { if (MOD_FLAG == 1) WSOUND_OFF(); if (soundNumber == 1) @@ -273,26 +271,24 @@ void SoundManager::WSOUND(int soundNumber) { } void SoundManager::WSOUND_OFF() { - if (CARD_SB) { - STOP_VOICE(0); - STOP_VOICE(1); - STOP_VOICE(2); - if (_vm->_soundManager.SOUND_FLAG) - DEL_NWAV(SOUND_NUM); + STOP_VOICE(0); + STOP_VOICE(1); + STOP_VOICE(2); + if (_vm->_soundManager.SOUND_FLAG) + DEL_NWAV(SOUND_NUM); - for (int i = 1; i <= 48; ++i) - DEL_SAMPLE_SDL(i); + for (int i = 1; i <= 48; ++i) + DEL_SAMPLE_SDL(i); - if (MOD_FLAG) { - STOP_MUSIC(); - DEL_MUSIC(); - MOD_FLAG = false; - } + if (MOD_FLAG) { + STOP_MUSIC(); + DEL_MUSIC(); + MOD_FLAG = false; } } void SoundManager::PLAY_MOD(const Common::String &file) { - if (CARD_SB && !MUSICOFF) { + if (!MUSICOFF) { _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPMUSIC, file); if (MOD_FLAG) { STOP_MUSIC(); @@ -459,7 +455,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { size_t catPos, catLen; fileNumber = voiceId; - if (!CARD_SB || VOICEOFF == 1) + if (VOICEOFF == 1) return false; if ((unsigned int)(voiceMode - 1) <= 1 @@ -569,20 +565,18 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { } void SoundManager::DEL_SAMPLE(int soundIndex) { - if (CARD_SB) { - if (VOICE_STAT(1) == 1) - STOP_VOICE(1); - if (VOICE_STAT(2) == 2) - STOP_VOICE(2); - if (VOICE_STAT(3) == 3) - STOP_VOICE(3); - DEL_SAMPLE_SDL(soundIndex); - SOUND[soundIndex]._active = false; - } + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); + if (VOICE_STAT(2) == 2) + STOP_VOICE(2); + if (VOICE_STAT(3) == 3) + STOP_VOICE(3); + DEL_SAMPLE_SDL(soundIndex); + SOUND[soundIndex]._active = false; } void SoundManager::PLAY_SOUND(const Common::String &file) { - if (CARD_SB && !SOUNDOFF) { + if (!SOUNDOFF) { if (SOUND_FLAG) DEL_NWAV(SOUND_NUM); LOAD_NWAV(file, 1); @@ -591,11 +585,9 @@ void SoundManager::PLAY_SOUND(const Common::String &file) { } void SoundManager::PLAY_SOUND2(const Common::String &file) { - if (CARD_SB) { - if (!SOUNDOFF) { - LOAD_NWAV(file, 1); - PLAY_NWAV(1); - } + if (!SOUNDOFF) { + LOAD_NWAV(file, 1); + PLAY_NWAV(1); } } @@ -612,15 +604,13 @@ void SoundManager::MODSetMusicVolume(int volume) { } void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { - if (CARD_SB) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); - LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); - SOUND[wavIndex]._active = true; - } + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); + LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); + SOUND[wavIndex]._active = true; } void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { - if (CARD_SB && !SOUNDOFF && SOUND[wavIndex]._active) { + if (!SOUNDOFF && SOUND[wavIndex]._active) { if (SOUND_FLAG) DEL_NWAV(SOUND_NUM); if (voiceMode == 5) { @@ -647,7 +637,7 @@ void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { } void SoundManager::PLAY_SAMPLE2(int idx) { - if (CARD_SB && !SOUNDOFF && SOUND[idx]._active) { + if (!SOUNDOFF && SOUND[idx]._active) { if (SOUND_FLAG) DEL_NWAV(SOUND_NUM); if (VOICE_STAT(1) == 1) @@ -657,13 +647,11 @@ void SoundManager::PLAY_SAMPLE2(int idx) { } void SoundManager::LOAD_WAV(const Common::String &file, int wavIndex) { - if (CARD_SB) - LOAD_NWAV(file, wavIndex); + LOAD_NWAV(file, wavIndex); } void SoundManager::PLAY_WAV(int wavIndex) { - if (CARD_SB) - PLAY_NWAV(wavIndex); + PLAY_NWAV(wavIndex); } int SoundManager::VOICE_STAT(int voiceIndex) { @@ -748,14 +736,12 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { - if (CARD_SB) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); - LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 1); - } + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); + LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 1); } void SoundManager::PLAY_NWAV(int wavIndex) { - if (CARD_SB && !SOUND_FLAG && !SOUNDOFF) { + if (!SOUND_FLAG && !SOUNDOFF) { SOUND_FLAG = true; SOUND_NUM = wavIndex; PLAY_SAMPLE_SDL(1, wavIndex); @@ -763,14 +749,12 @@ void SoundManager::PLAY_NWAV(int wavIndex) { } void SoundManager::DEL_NWAV(int wavIndex) { - if (CARD_SB) { - if (DEL_SAMPLE_SDL(wavIndex)) { - if (VOICE_STAT(1) == 1) - STOP_VOICE(1); + if (DEL_SAMPLE_SDL(wavIndex)) { + if (VOICE_STAT(1) == 1) + STOP_VOICE(1); - SOUND_NUM = 0; - SOUND_FLAG = false; - } + SOUND_NUM = 0; + SOUND_FLAG = false; } } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index e5562437ef..4628a47a7d 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -125,7 +125,6 @@ public: bool TEXTOFF; bool SOUND_FLAG; bool VBL_MERDE; - bool CARD_SB; int SOUND_NUM; bool MOD_FLAG; int old_music; -- cgit v1.2.3 From 5ac76b5c5256f15f0f1b41d6c209139147a4d2e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 6 Dec 2012 08:02:30 +0100 Subject: HOPKINS: Remove useless tests in CENSURE() --- engines/hopkins/files.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index a5d193fda7..fbbac191c2 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -115,11 +115,7 @@ void FileManager::F_Censure() { CONSTRUIT_SYSTEM("BLOOD.DAT"); char *data = (char *)CHARGE_FICHIER(_vm->_globals.NFICHIER); - - if (*(data + 6) == 'f' && *(data + 7) == 'r') - _vm->_globals.CENSURE = false; - if (*(data + 6) == 'F' && *(data + 7) == 'R') - _vm->_globals.CENSURE = false; + if (*(data + 6) == 'u' && *(data + 7) == 'k') _vm->_globals.CENSURE = true; if (*(data + 6) == 'U' && *(data + 7) == 'K') -- cgit v1.2.3 From e10f98fa5bafd762316c890b6ea71253c04bd4e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 6 Dec 2012 08:12:00 +0100 Subject: HOPKINS: Add fallback to APC for dialogs --- engines/hopkins/sound.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 8ffe5a4f32..37ac7c4e2a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -512,9 +512,9 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { prefix = "OF"; } - filename = Common::String::format("%s%d.WAV", prefix.c_str(), fileNumber); + filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); - if (!_vm->_fileManager.RECHERCHE_CAT(filename, 9)) { + if (!_vm->_fileManager.RECHERCHE_CAT(filename + ".WAV", 9)) { if (_vm->_globals.FR == 1) _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VFR.RES"); if (!_vm->_globals.FR) @@ -524,11 +524,23 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { catPos = _vm->_globals.CAT_POSI; catLen = _vm->_globals.CAT_TAILLE; - } else { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename); - - if (!f.exists(_vm->_globals.NFICHIER)) - return false; + } else if (!_vm->_fileManager.RECHERCHE_CAT(filename + ".APC", 9)) { + if (_vm->_globals.FR == 1) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VFR.RES"); + if (!_vm->_globals.FR) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VAN.RES"); + if (_vm->_globals.FR == 2) + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VES.RES"); + + catPos = _vm->_globals.CAT_POSI; + catLen = _vm->_globals.CAT_TAILLE; + } else { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename + ".WAV"); + if (!f.exists(_vm->_globals.NFICHIER)) { + _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename + ".APC"); + if (!f.exists(_vm->_globals.NFICHIER)) + return false; + } catPos = 0; catLen = 0; -- cgit v1.2.3 From 91e44d8e21bb2e93cdf030823c0f0d6d4022a366 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Dec 2012 22:44:00 +1100 Subject: HOPKINS: Apply first set of memory leak fixes --- engines/hopkins/events.cpp | 1 + engines/hopkins/globals.cpp | 6 ++++++ engines/hopkins/sound.cpp | 6 ++++++ engines/hopkins/sound.h | 1 + 4 files changed, 14 insertions(+) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index be261342d1..f92e225939 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -57,6 +57,7 @@ EventsManager::EventsManager() { EventsManager::~EventsManager() { _vm->_globals.dos_free2(Bufferobjet); + _vm->_globals.dos_free2(pointeur_souris); } void EventsManager::setParent(HopkinsEngine *vm) { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index aee0cb23a2..e19819f95c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -261,6 +261,8 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); + dos_free2(TETE); + dos_free2(police); dos_free2(BUF_ZONE); dos_free2(CACHE_BANQUE[6]); dos_free2(texte_tmp); @@ -277,6 +279,8 @@ Globals::~Globals() { dos_free2(ADR_FICHIER_OBJ); dos_free2(PERSO); + CLEAR_VBOB(); + free(g_PTRNUL); } @@ -474,6 +478,8 @@ void Globals::CLEAR_VBOB() { VBob[idx].yp = 0; VBob[idx].frameIndex = 0; VBob[idx].fieldC = 0; + if (VBob[idx].surface != g_PTRNUL) + dos_free2(VBob[idx].surface); VBob[idx].surface = g_PTRNUL; VBob[idx].spriteData = g_PTRNUL; VBob[idx].oldSpriteData = g_PTRNUL; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 37ac7c4e2a..4030fe0872 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -99,6 +99,12 @@ SoundManager::SoundManager() { Common::fill((byte *)&Music, (byte *)&Music + sizeof(MusicItem), 0); } +SoundManager::~SoundManager() { + STOP_MUSIC(); + DEL_MUSIC(); + MOD_FLAG = false; +} + void SoundManager::setParent(HopkinsEngine *vm) { _vm = vm; SPECIAL_SOUND = 0; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 4628a47a7d..84bae1deca 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -136,6 +136,7 @@ public: MusicItem Music; public: SoundManager(); + ~SoundManager(); void setParent(HopkinsEngine *vm); void WSOUND_INIT(); -- cgit v1.2.3 From a8c7f7025186b0c4615fc589c708b1ce88cc7713 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Dec 2012 22:45:11 +1100 Subject: HOPKINS: Apply second memory leak patch --- engines/hopkins/saveload.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 0abd519a81..a7e36ebbca 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -249,6 +249,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { srcP += w; destP += w; } + thumb8.free(); } void SaveLoadManager::syncSavegameData(Common::Serializer &s) { -- cgit v1.2.3 From d5042c50492b52e66b0cb7ee88ef86eae753ffab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 8 Dec 2012 15:36:37 +0100 Subject: HOPKINS: Refactor runLinuxDemo to avoid nested loops and gotos --- engines/hopkins/hopkins.cpp | 668 +++++++++++++++++++++----------------------- engines/hopkins/script.cpp | 2 + 2 files changed, 322 insertions(+), 348 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 7d53655203..c188a49393 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -482,364 +482,332 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SORTIE = 0; _globals.PASSWORD = true; -LABEL_12: - if (_globals.SORTIE == 300) -LABEL_13: - _globals.SORTIE = 0; - - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { - if (!g_system->getEventManager()->shouldQuit()) - PUBQUIT(); - _globals.PERSO = _globals.dos_free2(_globals.PERSO); - REST_SYSTEM(); + for (;;) { + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + if (!g_system->getEventManager()->shouldQuit()) + PUBQUIT(); + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + } } - } - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - if (g_system->getEventManager()->shouldQuit()) - return false; - - if (_globals.SORTIE == 300) - goto LABEL_13; - if (_globals.SORTIE == 18) - PASS(); - if (_globals.SORTIE == 23) - PASS(); - if (_globals.SORTIE == 22) - PASS(); - if (_globals.SORTIE == 19) - PASS(); - if (_globals.SORTIE == 20) - PASS(); - if (_globals.SORTIE != 1) - break; + if (g_system->getEventManager()->shouldQuit()) + return false; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); - } - - if (_globals.SORTIE != 3) - break; - - if (!_globals.SAUVEGARDE->data[svField170]) { - _soundManager.WSOUND(3); - if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); - if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); - if (_globals.FR == 2) - _graphicsManager.LOAD_IMAGE("fondes"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); - _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; + switch (_globals.SORTIE) { + case 17: + case 18: + case 19: + case 20: + case 22: + case 23: + case 24: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 34: + case 38: + PASS(); + break; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - - if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - if (_globals.CENSURE == 1) - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _globals.SAUVEGARDE->data[svField170] = 1; - } - - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); - } - - if (_globals.SORTIE != 4) - break; - _globals.DESACTIVE_INVENT = true; - _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; - } + case 1: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + break; - if (_globals.SORTIE != 5) - break; - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = true; - byte v1 = _globals.SAUVEGARDE->data[svField80]; - if (v1) { - if (v1 == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - } - - _globals.NOSPRECRAN = false; - } - - if (_globals.SORTIE != 8) - break; - - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); - } + case 3: + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + if (_globals.FR == 2) + _graphicsManager.LOAD_IMAGE("fondes"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; - if (_globals.SORTIE != 6) - break; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + else + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _globals.SAUVEGARDE->data[svField170] = 1; } + + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + break; + + case 4: + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + break; - if (_globals.SORTIE != 7) - break; + case 5: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 455; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + _globals.NOSPRECRAN = false; + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: if (_globals.SAUVEGARDE->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); - } + break; - if (_globals.SORTIE == 9) { + case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals.SAUVEGARDE->data[svField225]) - goto LABEL_109; + BOOM(); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); - } else { - if (_globals.SORTIE == 10) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - goto LABEL_124; - } - - if (_globals.SORTIE == 11) { + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField225]) { _globals.NOSPRECRAN = true; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - goto LABEL_124; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); } + break; - switch (_globals.SORTIE) { - case 12: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { -LABEL_109: - BOOM(); - } - break; - case 13: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); - break; - case 14: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); - break; - default: - if (_globals.SORTIE == 15) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - goto LABEL_124; - } - if (_globals.SORTIE == 16) { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; - byte v2 = _globals.SAUVEGARDE->data[svField113]; - if (v2 == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!v2) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); - } - } else { - if (_globals.SORTIE == 17) - PASS(); - if (_globals.SORTIE == 24) - PASS(); - if (_globals.SORTIE == 25) { - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); - } else { - if (_globals.SORTIE == 33) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - goto LABEL_124; - } - - if (_globals.SORTIE == 26) { - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); - } else { - if (_globals.SORTIE == 27) - PASS(); - if (_globals.SORTIE == 28) - PASS(); - if (_globals.SORTIE == 29) - PASS(); - if (_globals.SORTIE == 30) - PASS(); - if (_globals.SORTIE == 31) - PASS(); - if (_globals.SORTIE == 35) - ENDEMO(); - if (_globals.SORTIE == 32) - PASS(); - if (_globals.SORTIE == 34) - PASS(); - - if ((uint16)(_globals.SORTIE - 51) <= 38) - PASS(); - if (_globals.SORTIE == 111) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - goto LABEL_124; - } - - if (_globals.SORTIE == 112) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); -LABEL_124: - _globals.NOSPRECRAN = false; - } else if (_globals.SORTIE == 113) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = 113; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); - memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); - _graphicsManager.Cls_Pal(); - _graphicsManager.RESET_SEGMENT_VESA(); - } else { - if (_globals.SORTIE == 114) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = 114; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - } - if (_globals.SORTIE == 115) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = 115; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - } else if ((uint16)(_globals.SORTIE - 194) > 5) { - if (_globals.SORTIE == 151) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - - if (_globals.SORTIE == 150) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - - if (_globals.SORTIE == 152) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - goto LABEL_12; - } - } - } - } - } - break; + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _globals.NOSPRECRAN = false; + break; + + case 16: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } + break; + + case 25: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + + case 35: + ENDEMO(); + break; + + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + + case 113: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField5] = 113; + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); + memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + _graphicsManager.Cls_Pal(); + _graphicsManager.RESET_SEGMENT_VESA(); + break; + + case 114: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField5] = 114; + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField5] = 115; + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + + case 151: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 150: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 152: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; } } return true; @@ -993,7 +961,7 @@ LABEL_20: _graphicsManager.Cls_Pal(); if (!_globals.CENSURE) _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - if (_globals.CENSURE) + else _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); @@ -1807,7 +1775,7 @@ LABEL_231: _graphicsManager.FADE_LINUX = 2; if (!_globals.CENSURE) _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - if (_globals.CENSURE) + else _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); @@ -2847,22 +2815,26 @@ void HopkinsEngine::INTRORUN() { _eventsManager.ESC_KEY = false; } +/** + * If in demo, displays a 'not available' screen and returns to the city map + */ void HopkinsEngine::PASS() { - if (getIsDemo()) { - if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("ndfr"); - else - _graphicsManager.LOAD_IMAGE("nduk"); + if (!getIsDemo()) + return; + + 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_INW(); + if (_soundManager.VOICEOFF) + _eventsManager.delay(500); + else + _soundManager.VOICE_MIX(628, 4); - _graphicsManager.FADE_OUTW(); - _globals.SORTIE = 4; - } + _graphicsManager.FADE_OUTW(); + _globals.SORTIE = 4; } void HopkinsEngine::NO_DISPO(int sortie) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a96b8d197e..1abe125e08 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -729,6 +729,8 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(3) != 100); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.FIN_VISU(); + + // If uncensored, rip the throat of the hostage if (!_vm->_globals.CENSURE) { _vm->_soundManager.SPECIAL_SOUND = 16; _vm->_graphicsManager.FADE_LINUX = 2; -- cgit v1.2.3 From 706e1584fafb417056f404e147a6e3c86a698723 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 8 Dec 2012 20:02:33 +0100 Subject: HOPKINS: Refactor runWin95Demo and PLAY_ANM_SOUND --- engines/hopkins/hopkins.cpp | 547 ++++++++++++++++++++++---------------------- engines/hopkins/sound.cpp | 61 ++--- 2 files changed, 308 insertions(+), 300 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c188a49393..5ac5050599 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -161,7 +161,6 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO SPEEDJ = _globals.lItCounter;"); warning("TODO no_vsync = 0;"); warning("TODO TEST = 0;"); -// printf_(v27, v26, (int)"\n speed=%d", SBYTE2(dword_452A26)); // if (SPEEDJ > 475) if (_eventsManager.lItCounter > 475) _globals.vitesse = 2; @@ -184,263 +183,269 @@ bool HopkinsEngine::runWin95Demo() { if (!ADULT()) return Common::kNoError; -// v37 = v35; -LABEL_18: - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; + for (;;) { + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + return false; + } + } - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); - REST_SYSTEM(); + if (g_system->getEventManager()->shouldQuit()) return false; - } - } - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - if (g_system->getEventManager()->shouldQuit()) - return false; - if (_globals.SORTIE == 300) - goto LABEL_18; - if (_globals.SORTIE != 1) - break; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2); - } - if (_globals.SORTIE != 3) - break; - if (!_globals.SAUVEGARDE->data[svField170]) { - _soundManager.WSOUND(3); - if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); - if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); - _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[svField170] = 1; - } - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); - } - if (4 != _globals.SORTIE) - break; - _globals.DESACTIVE_INVENT = true; - _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; - } - if (_globals.SORTIE == 5) - break; - switch (_globals.SORTIE) { - case 8: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); - break; - case 6: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); - break; - case 7: - if (_globals.SAUVEGARDE->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); - else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); - break; - case 9: - _globals.Max_Propre_Gen = 10; - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 20; - if (_globals.SAUVEGARDE->data[svField225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); - else - BOOM(); - break; - case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; - break; - case 11: - _globals.NOSPRECRAN = true; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 15; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; - break; - case 12: - _globals.Max_Propre_Gen = 10; - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 450; - _globals.Max_Ligne_Long = 20; - if (_globals.SAUVEGARDE->data[svField225]) { - if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("ENDFR"); - else if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("ENDUK"); - _graphicsManager.FADE_INW(); - _eventsManager.MOUSE_ON(); - do - _eventsManager.VBL(); - while (_eventsManager.BMOUSE() != 1); - _graphicsManager.FADE_OUTW(); - REST_SYSTEM(); - } - BOOM(); - break; - case 13: - case 14: - case 15: - NO_DISPO(11); - break; - default: - if (_globals.SORTIE == 16) - goto LABEL_52; - if (_globals.SORTIE == 17) { - NO_DISPO(1); - } else if (_globals.SORTIE != 24 && _globals.SORTIE != 25 && _globals.SORTIE != 33 - && _globals.SORTIE != 26 && _globals.SORTIE != 27 && _globals.SORTIE != 28 - && _globals.SORTIE != 29 && _globals.SORTIE != 30 && _globals.SORTIE != 31 - && _globals.SORTIE != 32 && _globals.SORTIE != 34 - && (_globals.SORTIE <= 34 || _globals.SORTIE >= 100)) { - switch (_globals.SORTIE) { - case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; - break; - case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; - break; - case 113: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); - break; - case 114: - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); - break; - case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); - break; - default: - if (_globals.SORTIE == 151) { - _soundManager.WSOUND(28); - _globals.iRegul = 4; // CHECKME! - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _graphicsManager.LOAD_IMAGE("njour3a"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(5000); - _graphicsManager.FADE_OUTW(); - _globals.SORTIE = 300; - _globals.iRegul = 0; - } - if (_globals.SORTIE == 150) { - _soundManager.WSOUND(28); - _globals.iRegul = 4; // CHECKME! - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - if (_globals.SORTIE == 152) { - _soundManager.WSOUND(28); - _globals.iRegul = 4; // CHECKME! - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - goto LABEL_18; - } - } + switch (_globals.SORTIE) { + case 1: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2); + break; + + case 3: + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); else - { -LABEL_52: - NO_DISPO(4); - } - break; + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _graphicsManager.FADE_OUTW(); + _globals.SAUVEGARDE->data[svField170] = 1; } - } - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.NOSPRECRAN = true; - _globals.Max_Perso_Y = 455; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + break; - byte v1 = _globals.SAUVEGARDE->data[svField80]; - if (v1) { - if (v1 == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - } + case 4: + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + break; - _globals.NOSPRECRAN = false; + case 5: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 455; + + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + _globals.NOSPRECRAN = false; + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 9: + _globals.Max_Propre_Gen = 10; + _globals.Max_Propre = 15; + _globals.Max_Perso_Y = 440; + _globals.Max_Ligne_Long = 20; + if (_globals.SAUVEGARDE->data[svField225]) + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + else + BOOM(); + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 15; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre_Gen = 10; + _globals.Max_Propre = 15; + _globals.Max_Perso_Y = 450; + _globals.Max_Ligne_Long = 20; + if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("ENDFR"); + else if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("ENDUK"); + _graphicsManager.FADE_INW(); + _eventsManager.MOUSE_ON(); + do + _eventsManager.VBL(); + while (_eventsManager.BMOUSE() != 1); + _graphicsManager.FADE_OUTW(); + REST_SYSTEM(); + } + BOOM(); + break; + + case 13: + case 14: + case 15: + NO_DISPO(11); + break; + + case 16: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 33: + case 32: + case 34: + NO_DISPO(4); + break; + + case 17: + NO_DISPO(1); + break; + + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + + case 113: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _graphicsManager.MODE_VESA(); + break; + + case 114: + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals.SORTIE = 0; + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _graphicsManager.MODE_VESA(); + break; + + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _graphicsManager.MODE_VESA(); + break; + + case 150: + _soundManager.WSOUND(28); + _globals.iRegul = 4; // CHECKME! + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 151: + _soundManager.WSOUND(28); + _globals.iRegul = 4; // CHECKME! + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _graphicsManager.LOAD_IMAGE("njour3a"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(5000); + _graphicsManager.FADE_OUTW(); + _globals.SORTIE = 300; + _globals.iRegul = 0; + break; + + case 152: + _soundManager.WSOUND(28); + _globals.iRegul = 4; // CHECKME! + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + } } + return true; } bool HopkinsEngine::runLinuxDemo() { @@ -589,14 +594,6 @@ bool HopkinsEngine::runLinuxDemo() { _globals.NOSPRECRAN = false; break; - case 8: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); - break; - case 6: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; @@ -612,6 +609,14 @@ bool HopkinsEngine::runLinuxDemo() { _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); break; + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; @@ -696,19 +701,19 @@ bool HopkinsEngine::runLinuxDemo() { _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); break; - case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; - break; - case 26: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); - + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + case 35: ENDEMO(); break; @@ -767,30 +772,30 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.DD_Unlock(); break; - case 151: + case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; - + _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; - case 150: + case 151: _soundManager.WSOUND(16); _globals.iRegul = 1; - + _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 4030fe0872..14a3b9d028 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -157,51 +157,54 @@ void SoundManager::LOAD_ANM_SOUND() { void SoundManager::PLAY_ANM_SOUND(int soundNumber) { if (!_vm->_globals.CENSURE && SPECIAL_SOUND == 2) { - if (soundNumber == 20) + switch (soundNumber) { + case 20: PLAY_SAMPLE2(5); - if (soundNumber == 57) - PLAY_SAMPLE2(1); - if (soundNumber == 63) - PLAY_SAMPLE2(1); - if (soundNumber == 69) + break; + case 57: + case 63: + case 69: PLAY_SAMPLE2(1); - if (soundNumber == 75) + break; + case 75: PLAY_SAMPLE2(2); - if (soundNumber == 109) + break; + case 109: PLAY_SAMPLE2(3); - if (soundNumber == 122) + break; + case 122: PLAY_SAMPLE2(4); - } - if (SPECIAL_SOUND == 1 && soundNumber == 17) + break; + } + } else if (SPECIAL_SOUND == 1 && soundNumber == 17) PLAY_SOUND("SOUND42.WAV"); - if (SPECIAL_SOUND == 199 && soundNumber == 72) + else if (SPECIAL_SOUND == 5 && soundNumber == 19) PLAY_WAV(1); - if (SPECIAL_SOUND == 198 && soundNumber == 15) + else if (SPECIAL_SOUND == 14 && soundNumber == 625) PLAY_WAV(1); - if (SPECIAL_SOUND == 16 && soundNumber == 25) + else if (SPECIAL_SOUND == 16 && soundNumber == 25) PLAY_WAV(1); - if (SPECIAL_SOUND == 14 && soundNumber == 625) + else if (SPECIAL_SOUND == 17) { + if (soundNumber == 6) + PLAY_SAMPLE2(1); + else if (soundNumber == 14) + PLAY_SAMPLE2(2); + else if (soundNumber == 67) + PLAY_SAMPLE2(3); + } else if (SPECIAL_SOUND == 198 && soundNumber == 15) PLAY_WAV(1); - if (SPECIAL_SOUND == 208 && soundNumber == 40) + else if (SPECIAL_SOUND == 199 && soundNumber == 72) PLAY_WAV(1); - if (SPECIAL_SOUND == 210 && soundNumber == 2) + else if (SPECIAL_SOUND == 208 && soundNumber == 40) PLAY_WAV(1); - if (SPECIAL_SOUND == 211 && soundNumber == 22) + else if (SPECIAL_SOUND == 210 && soundNumber == 2) PLAY_WAV(1); - if (SPECIAL_SOUND == 5 && soundNumber == 19) + else if (SPECIAL_SOUND == 211 && soundNumber == 22) PLAY_WAV(1); - if (SPECIAL_SOUND == 17) { - if (soundNumber == 6) - PLAY_SAMPLE2(1); - if (soundNumber == 14) - PLAY_SAMPLE2(2); - if (soundNumber == 67) - PLAY_SAMPLE2(3); - } - if (SPECIAL_SOUND == 229) { + else if (SPECIAL_SOUND == 229) { if (soundNumber == 15) PLAY_WAV(1); - if (soundNumber == 91) + else if (soundNumber == 91) PLAY_WAV(2); } } -- cgit v1.2.3 From 0e1eeaa5f14ce8fdc76660578a720835d8072a5c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 8 Dec 2012 20:19:14 +0100 Subject: HOPKINS: Some more refactoring --- engines/hopkins/sound.cpp | 152 ++++++++++++++++++++++++++++++---------------- 1 file changed, 99 insertions(+), 53 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 14a3b9d028..546a792b54 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -124,34 +124,45 @@ void SoundManager::VERIF_SOUND() { } void SoundManager::LOAD_ANM_SOUND() { - if (SPECIAL_SOUND == 200) - VOICE_MIX(682, 1); - if (SPECIAL_SOUND == 199) - LOAD_WAV("SOUND22.WAV", 1); - if (SPECIAL_SOUND == 198) - LOAD_WAV("SOUND3.WAV", 1); - if (SPECIAL_SOUND == 16) - LOAD_WAV("SOUND16.WAV", 1); - if (SPECIAL_SOUND == 14) - LOAD_WAV("SOUND14.WAV", 1); - if (SPECIAL_SOUND == 208) - LOAD_WAV("SOUND77.WAV", 1); - if (SPECIAL_SOUND == 210) - LOAD_WAV("SOUND78.WAV", 1); - if (SPECIAL_SOUND == 211) - LOAD_WAV("SOUND78.WAV", 1); - if (SPECIAL_SOUND == 5) - LOAD_WAV("CRIE.WAV", 1); - if (SPECIAL_SOUND == 2) { + switch (SPECIAL_SOUND) { + case 2: CHARGE_SAMPLE(5, "mitra1.wav"); CHARGE_SAMPLE(1, "tir2.wav"); CHARGE_SAMPLE(2, "sound6.wav"); CHARGE_SAMPLE(3, "sound5.WAV"); CHARGE_SAMPLE(4, "sound4.WAV"); - } - if (SPECIAL_SOUND == 229) { + break; + case 5: + LOAD_WAV("CRIE.WAV", 1); + break; + case 14: + LOAD_WAV("SOUND14.WAV", 1); + break; + case 16: + LOAD_WAV("SOUND16.WAV", 1); + break; + case 198: + LOAD_WAV("SOUND3.WAV", 1); + break; + case 199: + LOAD_WAV("SOUND22.WAV", 1); + break; + case 200: + VOICE_MIX(682, 1); + break; + case 208: + LOAD_WAV("SOUND77.WAV", 1); + break; + case 210: + LOAD_WAV("SOUND78.WAV", 1); + break; + case 211: + LOAD_WAV("SOUND78.WAV", 1); + break; + case 229: LOAD_WAV("SOUND80.WAV", 1); LOAD_WAV("SOUND82.WAV", 2); + break; } } @@ -213,68 +224,103 @@ void SoundManager::WSOUND(int soundNumber) { if (old_music != soundNumber || !MOD_FLAG) { if (MOD_FLAG == 1) WSOUND_OFF(); - if (soundNumber == 1) + + switch (soundNumber) { + case 1: PLAY_MOD("appar"); - if (soundNumber == 2) + break; + case 2: PLAY_MOD("ville"); - if (soundNumber == 3) + break; + case 3: PLAY_MOD("Rock"); - if (soundNumber == 4) + break; + case 4: PLAY_MOD("polic"); - if (soundNumber == 5) + break; + case 5: PLAY_MOD("deep"); - if (soundNumber == 6) + break; + case 6: PLAY_MOD("purga"); - if (soundNumber == 12) - PLAY_MOD("purg2"); - if (soundNumber == 7) + break; + case 7: PLAY_MOD("rivie"); - if (soundNumber == 8) + break; + case 8: PLAY_MOD("SUSPE"); - if (soundNumber == 9) + break; + case 9: PLAY_MOD("labo"); - if (soundNumber == 10) + break; + case 10: PLAY_MOD("cadav"); - if (soundNumber == 11) + break; + case 11: PLAY_MOD("caban"); - if (soundNumber == 13) + break; + case 12: + PLAY_MOD("purg2"); + break; + case 13: PLAY_MOD("foret"); - if (soundNumber == 14) + break; + case 14: PLAY_MOD("ile"); - if (soundNumber == 15) + break; + case 15: PLAY_MOD("ile2"); - if (soundNumber == 16) + break; + case 16: PLAY_MOD("hopki"); - if (soundNumber == 17) + break; + case 17: PLAY_MOD("peur"); - if (soundNumber == 18) + break; + case 18: PLAY_MOD("peur"); - if (soundNumber == 19) + break; + case 19: PLAY_MOD("BASE"); - if (soundNumber == 20) + break; + case 20: PLAY_MOD("cada2"); - if (soundNumber == 21) + break; + case 21: PLAY_MOD("usine"); - if (soundNumber == 22) + break; + case 22: PLAY_MOD("chien"); - if (soundNumber == 23) + break; + case 23: PLAY_MOD("coeur"); - if (soundNumber == 24) + break; + case 24: PLAY_MOD("stand"); - if (soundNumber == 25) + break; + case 25: PLAY_MOD("ocean"); - if (soundNumber == 26) + break; + case 26: PLAY_MOD("base3"); - if (soundNumber == 27) + break; + case 27: PLAY_MOD("gloop"); - if (soundNumber == 28) + break; + case 28: PLAY_MOD("cant"); - if (soundNumber == 29) + break; + case 29: PLAY_MOD("feel"); - if (soundNumber == 30) + break; + case 30: PLAY_MOD("lost"); - if (soundNumber == 31) + break; + case 31: PLAY_MOD("tobac"); + break; + } + old_music = soundNumber; } } -- cgit v1.2.3 From d68a296258c44857f7a202303aac7b3817d03510 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Dec 2012 00:07:54 +0100 Subject: HOPKINS: Refactor runWin95Full --- engines/hopkins/hopkins.cpp | 1581 ++++++++++++++++++++++--------------------- 1 file changed, 826 insertions(+), 755 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5ac5050599..058b0a6b82 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -854,774 +854,845 @@ bool HopkinsEngine::runWin95full() { memset(_globals.SAUVEGARDE, 0, 2000); _globals.SORTIE = 0; _globals.PASSWORD = true; -LABEL_20: - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU();; - if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); - REST_SYSTEM(); - return false; - } - } - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - if (g_system->getEventManager()->shouldQuit()) - return false; - if (_globals.SORTIE == 300) - goto LABEL_20; - if (_globals.SORTIE != 18) - break; - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); - } - if (_globals.SORTIE != 23) - break; - _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 20; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); - } - if (_globals.SORTIE != 22) - break; - _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _globals.Max_Ligne_Long = 20; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); - } - if (_globals.SORTIE != 19) - break; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - if (_globals.SAUVEGARDE->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); - else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); - } - if (_globals.SORTIE != 20) - break; - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 8; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); - if (_globals.SORTIE == 17) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); - if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); - _globals.iRegul = 0; - } - } - if (_globals.SORTIE != 1) - break; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); - } - if (_globals.SORTIE != 3) - break; - if (!_globals.SAUVEGARDE->data[svField170]) { - _soundManager.WSOUND(3); - if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); - if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); - _soundManager.SPECIAL_SOUND = 2; - _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[svField170] = 1; - } - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.NOSPRECRAN = true; - _globals.Max_Perso_Y = 450; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); - } - if (_globals.SORTIE != 4) - break; - _globals.DESACTIVE_INVENT = true; - _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU();; + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + return false; } - if (_globals.SORTIE == 5) - break; - switch (_globals.SORTIE) { - case 8: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); - break; - case 6: - _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 460; - _globals.Max_Ligne_Long = 20; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); - break; - case 7: - if (_globals.SAUVEGARDE->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); - else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); - break; - case 9: - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + } + + if (g_system->getEventManager()->shouldQuit()) + return false; + + switch (_globals.SORTIE) { + case 1: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + break; + + case 3: + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + else if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _soundManager.SPECIAL_SOUND = 2; + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); else - BOOM(); - break; - case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; - break; - case 11: - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; - break; - case 12: - _globals.Max_Propre_Gen = 10; - _globals.Max_Ligne_Long = 20; - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 15; - if (_globals.SAUVEGARDE->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { - BOOM(); - } - break; - case 13: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); - break; - case 14: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); - break; - case 15: + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _graphicsManager.FADE_OUTW(); + _globals.SAUVEGARDE->data[svField170] = 1; + } + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + break; + + case 4: + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + break; + + case 5: + _globals.Max_Propre = _globals.SORTIE; + _globals.Max_Ligne_Long = _globals.SORTIE; + _globals.Max_Propre_Gen = _globals.SORTIE; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 455; + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + + _globals.NOSPRECRAN = false; + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 9: + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField225]) + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + else + BOOM(); + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre_Gen = 10; + _globals.Max_Ligne_Long = 20; + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 15; + if (_globals.SAUVEGARDE->data[svField225]) { _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - _globals.NOSPRECRAN = false; - break; - case 16: - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - if (_globals.SAUVEGARDE->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); - } - break; - case 17: - _globals.Max_Propre = 50; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 40; - if (_globals.SAUVEGARDE->data[svField117] == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!_globals.SAUVEGARDE->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); - } - if (_globals.SORTIE == 18) { - _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(29); - if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); - _globals.iRegul = 0; - } - break; - case 24: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField181]) { - if (_globals.SAUVEGARDE->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); - } else { - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); - } - break; - case 25: - _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _globals.Max_Ligne_Long = 20; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); - break; - case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; - break; - case 26: + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); + } + break; + + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _globals.NOSPRECRAN = false; + break; + + case 16: + _globals.Max_Perso_Y = 450; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + break; + + case 17: + _globals.Max_Propre = 50; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.Max_Ligne_Long = 40; + if (_globals.SAUVEGARDE->data[svField117] == 1) { + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + } else if (!_globals.SAUVEGARDE->data[svField117]) { + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + } + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(29); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 18: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); + break; + + case 19: + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + if (_globals.SAUVEGARDE->data[svField123]) + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + else + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + break; + + case 20: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 8; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + if (_globals.SORTIE == 17) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 22: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + break; + + case 23: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + break; + + case 24: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField181]) { + if (_globals.SAUVEGARDE->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); + } else { + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + } + break; + + case 25: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + break; + + case 27: + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre = 10; + if (_globals.SAUVEGARDE->data[svField177] == 1) { + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + } else if (!_globals.SAUVEGARDE->data[svField177]) { + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + } + break; + + case 28: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + else + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + break; + + case 29: + _globals.Max_Propre = 60; + _globals.Max_Ligne_Long = 50; + _globals.Max_Propre_Gen = 50; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + break; + + case 30: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + _globals.NOSPRECRAN = false; + break; + + case 31: + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + break; + + case 32: + _globals.Max_Propre = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _globals.Max_Ligne_Long = 20; + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + break; + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + + case 34: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); + _globals.NOSPRECRAN = false; + break; + + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: { + _globals.Max_Propre_Gen = 20; + _globals.fmusic = 13; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); - break; - case 27: - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre = 10; - if (_globals.SAUVEGARDE->data[svField177] == 1) { - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!_globals.SAUVEGARDE->data[svField177]) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); - } - break; - case 28: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); - else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); - break; - case 29: - _globals.Max_Propre = 60; - _globals.Max_Ligne_Long = 50; - _globals.Max_Propre_Gen = 50; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); - break; - case 30: - _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; - _globals.Max_Perso_Y = 440; + _globals.DESACTIVE_INVENT = false; + _globals.FORET = true; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + Common::String im = Common::String::format("IM%d", _globals.SORTIE); + _soundManager.WSOUND(13); + if (_globals.FORETSPR == g_PTRNUL) { + _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); + _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + } + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; + if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { + _globals.dos_free2(_globals.FORETSPR); + _globals.FORETSPR = g_PTRNUL; + _globals.FORET = false; + _soundManager.DEL_SAMPLE(1); + } break; - case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); - break; - default: - if (_globals.SORTIE > 34 && _globals.SORTIE < 42) { - _globals.Max_Propre_Gen = 20; - _globals.fmusic = 13; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Perso_Y = 435; - _globals.DESACTIVE_INVENT = false; - _globals.FORET = true; - _globals.NOSPRECRAN = true; - Common::String im = Common::String::format("IM%d", _globals.SORTIE); - _soundManager.WSOUND(13); - if (_globals.FORETSPR == g_PTRNUL) { - _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); - _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); - } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); - _globals.NOSPRECRAN = false; - if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { - _globals.dos_free2(_globals.FORETSPR); - _globals.FORETSPR = g_PTRNUL; - _globals.FORET = false; - _soundManager.DEL_SAMPLE(1); - } - } else { - switch (_globals.SORTIE) { - case 32: - _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _globals.Max_Ligne_Long = 20; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); - break; - case 34: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); - _globals.NOSPRECRAN = false; - break; - case 51: - _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre = 20; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); - break; - case 52: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); - break; - case 54: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); - break; - case 55: - _globals.Max_Propre = 40; - _globals.Max_Perso_Y = 460; - _globals.Max_Ligne_Long = 30; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); - break; - case 56: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); - break; - case 58: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); - break; - case 57: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); - break; - case 59: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); - _globals.NOSPRECRAN = false; - break; - case 60: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); - _globals.NOSPRECRAN = false; - break; - case 61: - if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) - INCENDIE(); - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); - break; - case 63: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); - _globals.NOSPRECRAN = false; - break; - case 64: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); - break; - case 65: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); - _globals.NOSPRECRAN = false; - break; - case 66: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); - _globals.NOSPRECRAN = false; - break; - case 69: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); - _globals.NOSPRECRAN = false; - break; - case 62: - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); - _globals.NOSPRECRAN = false; - break; - case 68: - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); - break; - case 67: - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); - _globals.NOSPRECRAN = false; - break; - case 70: - _globals.Max_Perso_Y = 435; - _globals.Max_Propre = 8; - _globals.NOSPRECRAN = true; - _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); - _globals.NOSPRECRAN = false; - break; - case 71: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); - _globals.NOSPRECRAN = false; - break; - case 73: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField318] == 1) { - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!_globals.SAUVEGARDE->data[svField318]) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); - } - break; - case 75: - BASE(); - break; - case 93: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); - else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); - break; - case 94: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); - break; - case 95: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = false; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); - break; - case 97: - _globals.Max_Perso_Y = 435; - _globals.Max_Propre = 5; - _globals.NOSPRECRAN = true; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); - if (_globals.SORTIE == 18) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); - _globals.iRegul = 0; - } - break; - case 98: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); - break; - case 99: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); - break; - case 96: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.NOSPRECRAN = true; - _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 5; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); - break; - case 77: - OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); - break; - case 78: - OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); - break; - case 79: - OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); - break; - case 80: - OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); - break; - case 81: - OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); - break; - case 82: - OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); - break; - case 83: - OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); - break; - case 84: - OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); - break; - case 85: - OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); - break; - case 86: - OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); - break; - case 87: - OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); - break; - case 88: - OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); - break; - case 89: - OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); - break; - case 91: - OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); - break; - case 90: - BASED(); - break; - case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; - break; - case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; - break; - case 113: - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); - break; - case 114: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); - break; - case 115: - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); - break; - case 100: - JOUE_FIN(); - break; - case 50: - AVION(); - _globals.SORTIE = 51; - break; - default: - if (_globals.SORTIE < 194 || _globals.SORTIE > 199) { - if (_globals.SORTIE == 151) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - if (_globals.SORTIE == 150) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - if (_globals.SORTIE == 152) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); - _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - goto LABEL_20; - } - _globals.PERSO = _globals.dos_free2(_globals.PERSO); - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - warning("TODO: heapshrink();"); - _soundManager.WSOUND(23); - _globals.SORTIE = WBASE(); - _soundManager.WSOUND_OFF(); - warning("TODO: heapshrink();"); - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); - _globals.PERSO_TYPE = 0; - _globals.iRegul = 0; - _graphicsManager.nbrligne = SCREEN_WIDTH; - _graphicsManager.MODE_VESA(); - if (_globals.SORTIE == -1) - error("FIN BASE SOUS MARINE"); - break; - } } - break; + case 50: + AVION(); + _globals.SORTIE = 51; + break; + + case 51: + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre = 20; + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + break; + + case 52: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + break; + + case 54: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + break; + + case 55: + _globals.Max_Propre = 40; + _globals.Max_Perso_Y = 460; + _globals.Max_Ligne_Long = 30; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + break; + + case 56: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + break; + + case 57: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + break; + + case 58: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + break; + + case 59: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); + _globals.NOSPRECRAN = false; + break; + + case 60: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); + _globals.NOSPRECRAN = false; + break; + + case 61: + if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + INCENDIE(); + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + break; + + case 62: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); + _globals.NOSPRECRAN = false; + break; + + case 63: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); + _globals.NOSPRECRAN = false; + break; + + case 64: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + break; + + case 65: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); + _globals.NOSPRECRAN = false; + break; + + case 66: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); + _globals.NOSPRECRAN = false; + break; + + case 67: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); + _globals.NOSPRECRAN = false; + break; + + case 68: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + break; + + case 69: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); + _globals.NOSPRECRAN = false; + break; + + case 70: + _globals.Max_Perso_Y = 435; + _globals.Max_Propre = 8; + _globals.NOSPRECRAN = true; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); + _globals.NOSPRECRAN = false; + break; + + case 71: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); + _globals.NOSPRECRAN = false; + break; + + case 73: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField318] == 1) { + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + } else if (!_globals.SAUVEGARDE->data[svField318]) { + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); } - } - _globals.Max_Propre = _globals.SORTIE; - _globals.Max_Ligne_Long = _globals.SORTIE; - _globals.Max_Propre_Gen = _globals.SORTIE; - _globals.NOSPRECRAN = true; - _globals.Max_Perso_Y = 455; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - } + break; + + case 75: + BASE(); + break; + + case 77: + OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + break; + + case 78: + OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + break; + + case 79: + OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + break; + + case 80: + OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + break; + + case 81: + OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + break; + + case 82: + OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + break; + + case 83: + OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + break; + + case 84: + OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + break; + + case 85: + OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + break; + + case 86: + OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + break; + + case 87: + OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + break; + + case 88: + OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + break; + + case 89: + OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + break; + + case 90: + BASED(); + break; + + case 91: + OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + break; + + case 93: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField330]) + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); + break; + + case 94: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 440; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + break; + + case 95: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = false; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + break; + + case 96: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + break; + + case 97: + _globals.Max_Perso_Y = 435; + _globals.Max_Propre = 5; + _globals.NOSPRECRAN = true; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; - _globals.NOSPRECRAN = false; + case 98: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + break; + + case 99: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Perso_Y = 435; + _globals.Max_Propre_Gen = 5; + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + break; + + case 100: + JOUE_FIN(); + break; + + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + + case 113: + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals.SORTIE = 0; + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _graphicsManager.MODE_VESA(); + break; + + case 114: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _graphicsManager.MODE_VESA(); + break; + + case 115: + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; + _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals.SORTIE = 0; + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _graphicsManager.MODE_VESA(); + break; + + case 150: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 151: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 152: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + warning("TODO: heapshrink();"); + _soundManager.WSOUND(23); + _globals.SORTIE = WBASE(); + _soundManager.WSOUND_OFF(); + warning("TODO: heapshrink();"); + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; + _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager.MODE_VESA(); + if (_globals.SORTIE == -1) + error("FIN BASE SOUS MARINE"); + break; + } } } -- cgit v1.2.3 From 88c223824ed586c10d9f90f3b08c0fe1b5d5e7bc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Dec 2012 01:19:48 +0100 Subject: HOPKINS: Refactor runLinuxFull --- engines/hopkins/hopkins.cpp | 1629 ++++++++++++++++++++++--------------------- 1 file changed, 832 insertions(+), 797 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 058b0a6b82..df18dc12e2 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1694,6 +1694,7 @@ bool HopkinsEngine::runWin95full() { break; } } + return true; } bool HopkinsEngine::runLinuxFull() { @@ -1731,819 +1732,853 @@ bool HopkinsEngine::runLinuxFull() { _globals.SORTIE = 0; _globals.PASSWORD = false; -LABEL_10: - if (_globals.SORTIE == 300) -LABEL_11: - _globals.SORTIE = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); - REST_SYSTEM(); - return true; - } - } for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - for (;;) { - if (g_system->getEventManager()->shouldQuit()) - return false; - - if (_globals.SORTIE == 300) - goto LABEL_11; - if (_globals.SORTIE != 18) - break; - _globals.NOSPRECRAN = true; - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); - } - if (_globals.SORTIE != 23) - break; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); - } - if (_globals.SORTIE != 22) - break; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); - } - if (_globals.SORTIE != 19) - break; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); - else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); - } - if (_globals.SORTIE != 20) - break; - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 8; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); - if (_globals.SORTIE == 17) { - _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(6); - _graphicsManager.FADE_LINUX = 2; - if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); - if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); -LABEL_231: - _globals.iRegul = 0; - } - } - if (_globals.SORTIE != 1) - break; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); - } - if (_globals.SORTIE != 3) - break; - if (!_globals.SAUVEGARDE->data[svField170]) { - _soundManager.WSOUND(3); - if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); - if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); - if (_globals.FR == 2) - _graphicsManager.LOAD_IMAGE("fondes"); - _graphicsManager.FADE_INW(); - _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); - _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); - else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _globals.SAUVEGARDE->data[svField170] = 1; - } - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); - } - if (_globals.SORTIE != 4) - break; - _globals.DESACTIVE_INVENT = true; - _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; - } - if (_globals.SORTIE != 5) - break; - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = true; - byte v2 = _globals.SAUVEGARDE->data[svField80]; - if (v2) { - if (v2 == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - } - _globals.NOSPRECRAN = false; - } - if (_globals.SORTIE != 8) - break; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); - } - if (_globals.SORTIE != 6) - break; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + REST_SYSTEM(); + return true; } - if (_globals.SORTIE != 7) - break; + } + + if (g_system->getEventManager()->shouldQuit()) + return false; + + switch (_globals.SORTIE) { + case 1: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + break; + + case 3: + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("fondfr"); + else if (!_globals.FR) + _graphicsManager.LOAD_IMAGE("fondan"); + else if (_globals.FR == 2) + _graphicsManager.LOAD_IMAGE("fondes"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + if (!_globals.CENSURE) + _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + else + _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _globals.SAUVEGARDE->data[svField170] = 1; + } + + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + break; + + case 4: + _globals.DESACTIVE_INVENT = true; + _objectsManager.PLAN_BETA(); + _globals.DESACTIVE_INVENT = false; + break; + + case 5: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 455; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + _globals.NOSPRECRAN = false; + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: if (_globals.SAUVEGARDE->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); - } - if (_globals.SORTIE == 9) { + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals.SAUVEGARDE->data[svField225]) - goto LABEL_140; + BOOM(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); - } else { - if (_globals.SORTIE == 10) { + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField225]) { _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - goto LABEL_239; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); } - if (_globals.SORTIE == 11) { - _globals.NOSPRECRAN = true; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - goto LABEL_239; + break; + + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _globals.NOSPRECRAN = false; + break; + + case 16: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } - switch (_globals.SORTIE) { - case 12: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { -LABEL_140: - BOOM(); - } - break; - case 13: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); - break; - case 14: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); - break; - default: - if (_globals.SORTIE == 15) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - goto LABEL_239; - } - switch (_globals.SORTIE) { - case 16: { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - byte v3 = _globals.SAUVEGARDE->data[svField113]; - if (v3 == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!v3) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); - } - break; - } - case 17: { - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - byte v4 = _globals.SAUVEGARDE->data[svField117]; - if (v4 == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!v4) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); - } - if (_globals.SORTIE == 18) { - _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(29); - _graphicsManager.FADE_LINUX = 2; - if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); - if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); - goto LABEL_231; - } - break; - } - case 24: { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - byte v5 = _globals.SAUVEGARDE->data[svField181]; - if (v5) { - if (v5 == 1) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); - } else { - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); - } - break; - } - case 25: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); - break; - default: - if (_globals.SORTIE == 33) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - goto LABEL_239; - } - switch (_globals.SORTIE) { - case 26: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); - break; - case 27: { - _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - byte v6 = _globals.SAUVEGARDE->data[svField177]; - if (v6 == 1) { - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!v6) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); - } - break; - } - case 28: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); - else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); - break; - case 29: - _globals.Max_Propre = 60; - _globals.Max_Ligne_Long = 50; - _globals.Max_Propre_Gen = 50; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); - break; - default: - if (_globals.SORTIE == 30) { - _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); - goto LABEL_239; - } - if (_globals.SORTIE == 31) { - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); - } else if ((uint16)(_globals.SORTIE - 35) <= 6u) { - _globals.fmusic = 13; - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _globals.DESACTIVE_INVENT = false; - _globals.FORET = true; - _globals.NOSPRECRAN = true; - Common::String im = Common::String::format("IM%d", _globals.SORTIE); - _soundManager.WSOUND(13); - if (_globals.FORETSPR == g_PTRNUL) { - _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); - _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); - } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); - _globals.NOSPRECRAN = false; - if ((uint)(_globals.SORTIE - 35) > 14) { - _globals.dos_free2(_globals.FORETSPR); - _globals.FORETSPR = g_PTRNUL; - _globals.FORET = false; - _soundManager.DEL_SAMPLE(1); - } - } else if (_globals.SORTIE == 32) { - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); - } else { - if (_globals.SORTIE == 34) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); - goto LABEL_239; - } - switch (_globals.SORTIE) { - case 51: - _globals.Max_Propre = 20; - _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); - break; - case 52: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); - break; - case 54: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); - break; - case 55: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 460; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); - break; - case 56: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); - break; - case 58: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); - break; - case 57: - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); - break; - default: - if (_globals.SORTIE == 59) { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 60) { - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 61) { - if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) - INCENDIE(); - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); - } else { - if (_globals.SORTIE == 63) { - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 64) { - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); - } else { - if (_globals.SORTIE == 65) { - _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 66) { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 69) { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 62) { - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 68) { - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); - } else { - if (_globals.SORTIE == 67) { - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 70) { - _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); - goto LABEL_239; - } - if (_globals.SORTIE == 71) { - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); - goto LABEL_239; - } - switch (_globals.SORTIE) { - case 73: { - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - byte v7 = _globals.SAUVEGARDE->data[svField318]; - if (v7 == 1) { - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!v7) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); - } - break; - } - case 75: - BASE(); - break; - case 93: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); - else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); - break; - case 94: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); - break; - case 95: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); - break; - case 97: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); - if (_globals.SORTIE == 18) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); - if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); - goto LABEL_231; - } - break; - case 98: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); - break; - case 99: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); - break; - case 96: - _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); - break; - case 77: - OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); - break; - case 78: - OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); - break; - case 79: - OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); - break; - case 80: - OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); - break; - case 81: - OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); - break; - case 82: - OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); - break; - case 83: - OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); - break; - case 84: - OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); - break; - case 85: - OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); - break; - case 86: - OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); - break; - case 87: - OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); - break; - case 88: - OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); - break; - case 89: - OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); - break; - case 91: - OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); - break; - case 90: - BASED(); - break; - default: - if (_globals.SORTIE == 111) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - goto LABEL_239; - } - if (_globals.SORTIE == 112) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); -LABEL_239: - _globals.NOSPRECRAN = false; - } else if (_globals.SORTIE == 113) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = 113; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); - memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); - _graphicsManager.Cls_Pal(); - _graphicsManager.RESET_SEGMENT_VESA(); - } else { - if (_globals.SORTIE == 114) { - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = 114; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); - goto LABEL_243; - } - switch (_globals.SORTIE) { - case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = 115; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); -LABEL_243: - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - break; - case 100: - JOUE_FIN(); - break; - case 50: - AVION(); - _globals.SORTIE = 51; - break; - default: - if ((uint16)(_globals.SORTIE - 194) > 5u) { - if (_globals.SORTIE == 151) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - if (_globals.SORTIE == 150) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - if (_globals.SORTIE == 152) { - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals.SORTIE = 300; - } - goto LABEL_10; - } - _globals.PERSO = _globals.dos_free2(_globals.PERSO); - _globals.iRegul = 1; - _soundManager.WSOUND(23); - _globals.SORTIE = PWBASE(); - _soundManager.WSOUND_OFF(); - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); - _globals.PERSO_TYPE = 0; - _globals.iRegul = 0; - _graphicsManager.nbrligne = SCREEN_WIDTH; - break; - } - } - break; - } - } - } - } - break; - } - } - break; - } - break; - } - break; + break; + + case 17: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField117] == 1) { + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + } else if (!_globals.SAUVEGARDE->data[svField117]) { + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); } + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(29); + _graphicsManager.FADE_LINUX = 2; + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _globals.iRegul = 0; + } + break; + + case 18: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); + break; + + case 19: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField123]) + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + else + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + break; + + case 20: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 8; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + if (_globals.SORTIE == 17) { + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(6); + _graphicsManager.FADE_LINUX = 2; + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); + _globals.iRegul = 0; + } + break; + + case 22: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + break; + + case 23: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + break; + + case 24: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField181]) { + if (_globals.SAUVEGARDE->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); + } else { + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + } + break; + + case 25: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + break; + + case 27: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField177] == 1) { + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + } else if (!_globals.SAUVEGARDE->data[svField177]) { + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + } + break; + + case 28: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + else + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + break; + + case 29: + _globals.Max_Propre = 60; + _globals.Max_Ligne_Long = 50; + _globals.Max_Propre_Gen = 50; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + break; + + case 30: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + _globals.NOSPRECRAN = false; + break; + + case 31: + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + break; + + case 32: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + break; + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + + case 34: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); + _globals.NOSPRECRAN = false; + break; + + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: { + _globals.fmusic = 13; + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.DESACTIVE_INVENT = false; + _globals.FORET = true; + _globals.NOSPRECRAN = true; + Common::String im = Common::String::format("IM%d", _globals.SORTIE); + _soundManager.WSOUND(13); + if (_globals.FORETSPR == g_PTRNUL) { + _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); + _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + } + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); + _globals.NOSPRECRAN = false; + if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { + _globals.dos_free2(_globals.FORETSPR); + _globals.FORETSPR = g_PTRNUL; + _globals.FORET = false; + _soundManager.DEL_SAMPLE(1); + } + break; + } + + case 50: + AVION(); + _globals.SORTIE = 51; + break; + + case 51: + _globals.Max_Propre = 20; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + break; + + case 52: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + break; + + case 54: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + break; + + case 55: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 460; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + break; + + case 56: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + break; + + case 57: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + break; + + case 58: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + break; + + case 59: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); + _globals.NOSPRECRAN = false; + break; + + case 60: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); + _globals.NOSPRECRAN = false; + break; + + case 61: + if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + INCENDIE(); + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + break; + + case 62: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); + _globals.NOSPRECRAN = false; + break; + + case 63: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); + _globals.NOSPRECRAN = false; + break; + + case 64: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + break; + + case 65: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); + _globals.NOSPRECRAN = false; + break; + + case 66: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); + _globals.NOSPRECRAN = false; + break; + + case 67: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); + _globals.NOSPRECRAN = false; + break; + + case 68: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + break; + + case 69: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); + _globals.NOSPRECRAN = false; + break; + + case 70: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); + _globals.NOSPRECRAN = false; + break; + + case 71: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); + _globals.NOSPRECRAN = false; + break; + + case 73: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField318] == 1) { + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + } else if (!_globals.SAUVEGARDE->data[svField318]) { + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + } + break; + + case 75: + BASE(); + break; + + case 77: + OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + break; + + case 78: + OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + break; + + case 79: + OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + break; + + case 80: + OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + break; + + case 81: + OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + break; + + case 82: + OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + break; + + case 83: + OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + break; + + case 84: + OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + break; + + case 85: + OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + break; + + case 86: + OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + break; + + case 87: + OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + break; + + case 88: + OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + break; + + case 89: + OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + break; + + case 91: + OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + break; + + case 90: + BASED(); + break; + + case 93: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField330]) + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); + break; + + case 94: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + break; + + case 95: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + break; + + case 96: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + break; + + case 97: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 98: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + break; + + case 99: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + break; + + case 100: + JOUE_FIN(); + break; + + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + + case 113: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField5] = 113; + _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); + memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + _graphicsManager.Cls_Pal(); + _graphicsManager.RESET_SEGMENT_VESA(); + break; + + case 114: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField5] = 114; + _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField5] = 115; + _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + + case 150: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 151: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 152: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.iRegul = 1; + _soundManager.WSOUND(23); + _globals.SORTIE = PWBASE(); + _soundManager.WSOUND_OFF(); + _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; + _graphicsManager.nbrligne = SCREEN_WIDTH; + break; } } return true; -- cgit v1.2.3 From 17da9c0694aaa4a4514c84c624adb67e25b24c5f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Dec 2012 10:00:13 +0100 Subject: HOPKINS: Fix crash in Win95 EN Demo, enable intro in Win95 PL demo --- engines/hopkins/hopkins.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index df18dc12e2..edcfb5afb5 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -142,7 +142,10 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.LOAD_IMAGE("H2"); _graphicsManager.FADE_INW(); - + + if (!_eventsManager.ESC_KEY) + INTRORUN(); + warning("TODO Fin_Interrupt()"); warning("TODO TEST = 1;"); warning("TODO no_vsync = 1;"); @@ -2688,6 +2691,10 @@ void HopkinsEngine::INIT_SYSTEM() { } void HopkinsEngine::INTRORUN() { + // Win95 EN demo doesn't include the intro + if ((getLanguage() == Common::EN_ANY) && (getPlatform() == Common::kPlatformWindows) && (getIsDemo())) + return; + byte paletteData[PALETTE_EXT_BLOCK_SIZE]; byte paletteData2[PALETTE_EXT_BLOCK_SIZE]; -- cgit v1.2.3 From 9987b436f5605e857eacfc070de4a96546dc6c16 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Dec 2012 10:05:26 +0100 Subject: HOPKINS: Fix language internal mapping for Polish --- engines/hopkins/globals.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e19819f95c..e4a405ef0c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -303,8 +303,10 @@ void Globals::setConfig() { HOPSEQ = "SEQ"; // CHECKME: Should be in Globals() but it doesn't work + // The Polish version is a translation of the English version. The filenames are the same. switch (_vm->getLanguage()) { case Common::EN_ANY: + case Common::PL_POL: FR = 0; break; case Common::FR_FRA: @@ -314,7 +316,7 @@ void Globals::setConfig() { FR = 2; break; default: - warning("Language initialization to be verified"); + warning("Unknown language in internal language mapping"); break; } -- cgit v1.2.3 From fedf2ca70f7d38e0b49adec8b61b0a6b464b9929 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Dec 2012 20:38:28 +1100 Subject: HOPKINS: Bugfix for sounds in the Breakout game --- engines/hopkins/computer.cpp | 2 ++ engines/hopkins/sound.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 74c1c644bd..cddc1f18c1 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -786,6 +786,8 @@ void ComputerManager::PLAY_BRIQUE() { // Play loop do { + _vm->_soundManager.checkSounds(); + RAQX = _vm->_eventsManager.XMOUSE(); if (_vm->_eventsManager.souris_x <= 4) RAQX = 5; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 546a792b54..1f7e6a9ee0 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -840,6 +840,7 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { int volume = (voiceIndex == 2) ? VOICEVOL * 255 / 16 : SOUNDVOL * 255 / 16; // Start the voice playing + Swav[wavIndex]._audioStream->rewind(); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, Swav[wavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); } -- cgit v1.2.3 From 867cbbf4ff6ddfca826724a7ff74f44a06e8d044 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Dec 2012 20:22:12 +0100 Subject: HOPKINS: Refactor fileManager --- engines/hopkins/anim.cpp | 30 ++++---- engines/hopkins/computer.cpp | 49 ++++++------ engines/hopkins/dialogs.cpp | 32 ++++---- engines/hopkins/events.cpp | 1 - engines/hopkins/files.cpp | 172 +++++++++++++++++++------------------------ engines/hopkins/files.h | 33 +++------ engines/hopkins/font.cpp | 2 +- engines/hopkins/globals.cpp | 13 ++-- engines/hopkins/globals.h | 1 + engines/hopkins/graphics.cpp | 37 +++++----- engines/hopkins/hopkins.cpp | 90 +++++++++++----------- engines/hopkins/menu.cpp | 10 +-- engines/hopkins/objects.cpp | 87 +++++++++++----------- engines/hopkins/script.cpp | 20 ++--- engines/hopkins/sound.cpp | 34 ++++----- engines/hopkins/talk.cpp | 44 +++++------ 16 files changed, 306 insertions(+), 349 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 97ec536b0b..dbd4289f36 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -59,7 +59,7 @@ LABEL_2: v10 = _vm->_graphicsManager.VESA_SCREEN; ptr = _vm->_globals.dos_malloc2(0x14u); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) error("File not found - %s", _vm->_globals.NFICHIER.c_str()); @@ -263,18 +263,18 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint while (!_vm->shouldQuit()) { memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); - if (_vm->_graphicsManager.nbrligne == 1280) + else if (_vm->_graphicsManager.nbrligne == 1280) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager.VESA_SCREEN; v13 = _vm->_globals.dos_malloc2(0x14u); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANM, filename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -685,7 +685,7 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { CLEAR_ANIM(); Common::String filename = animName + ".ANI"; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); Common::File f; if (!f.open(_vm->_globals.NFICHIER)) @@ -710,7 +710,7 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { for (int idx = 1; idx <= 6; ++idx) { if (files[idx - 1][0]) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, files[idx - 1]); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, files[idx - 1]); if (!f.exists(_vm->_globals.NFICHIER)) error("File not found"); @@ -755,13 +755,13 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam byte *ptr; byte *v19; int result = 0; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); - _vm->_globals.Bank[idx].field1C = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); _vm->_globals.Bank[idx].field4 = 1; _vm->_globals.Bank[idx].filename1 = filename; _vm->_globals.Bank[idx].filename2 = _vm->_globals.REP_SPR; - v3 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v3 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v4 = v3; _vm->_globals.Bank[idx].fileHeader = 0; @@ -801,10 +801,10 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam } while (ch != '.'); ofsFilename += ".OFS"; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, ofsFilename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, ofsFilename); Common::File f; if (f.exists(_vm->_globals.NFICHIER)) { - v19 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + v19 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v13 = v19; if (_vm->_globals.Bank[idx].field1A > 0) { @@ -951,17 +951,17 @@ void AnimationManager::PLAY_SEQ(const Common::String &file, uint32 rate1, uint32 if (!NO_COUL) { _vm->_eventsManager.VBL(); - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); - if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager.VESA_SCREEN; v10 = _vm->_globals.dos_malloc2(0x16u); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -1129,7 +1129,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint3 _vm->_eventsManager.souris_flag = false; v10 = _vm->_graphicsManager.VESA_SCREEN; v11 = _vm->_globals.dos_malloc2(0x16u); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSEQ, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("File not found - %s", _vm->_globals.NFICHIER.c_str()); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index cddc1f18c1..bc90074d18 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -73,9 +73,9 @@ void ComputerManager::TEXT_MODE() { //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; - _vm->_fileManager.CONSTRUIT_SYSTEM("STFONT.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "STFONT.SPR"); _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); - _vm->_globals.police = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); @@ -300,8 +300,8 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { } void ComputerManager::Charge_Menu() { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); - byte *ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); + byte *ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); byte *tmpPtr = ptr; int lineNum = 0; int strPos; @@ -473,8 +473,8 @@ void ComputerManager::outtext2(const Common::String &msg) { void ComputerManager::RESTORE_POLICE() { _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); - _vm->_fileManager.CONSTRUIT_SYSTEM("FONTE3.SPR"); - _vm->_globals.police = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FONTE3.SPR"); + _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.police_l = 12; _vm->_globals.police_h = 21; @@ -499,14 +499,14 @@ void ComputerManager::LIT_TEXTE(int a1) { _vm->_eventsManager.ESC_KEY = false; if (_vm->_globals.FR == 0) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPKAN.TXT"); - if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPK.TXT"); - if (_vm->_globals.FR == 2) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "THOPKES.TXT"); - - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - v1 = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKAN.TXT"); + else if (_vm->_globals.FR == 1) + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPK.TXT"); + else if (_vm->_globals.FR == 2) + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKES.TXT"); + + ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + v1 = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); v2 = 0; v3 = 0; if (v1 > 0u) { @@ -581,8 +581,8 @@ void ComputerManager::GAMES() { _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND37.WAV"); _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); - _vm->_fileManager.CONSTRUIT_SYSTEM("CASSE.SPR"); - CASSESPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "CASSE.SPR"); + CASSESPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); CHARGE_SCORE(); MODE_VGA256(); NEWTAB(); @@ -612,7 +612,7 @@ void ComputerManager::CHARGE_SCORE() { char nextChar; byte *ptr; - _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); + _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); ptr = _vm->_globals.dos_malloc2(100); _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, ptr); @@ -642,7 +642,6 @@ void ComputerManager::MODE_VGA256() { _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.SCANLINE(0x140u); - _vm->_fileManager.DMESS(); } void ComputerManager::NEWTAB() { @@ -665,7 +664,7 @@ void ComputerManager::NEWTAB() { while (!_vm->shouldQuit()) { file = Common::String::format("TAB%d.TAB", NB_TABLE); - _vm->_fileManager.CONSTRUIT_SYSTEM(file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, file); if (f.open(_vm->_globals.NFICHIER)) break; @@ -673,7 +672,7 @@ void ComputerManager::NEWTAB() { } f.close(); - CASSETAB = (int16 *)_vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + CASSETAB = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); AFF_BRIQUES(); _vm->_objectsManager.SPRITE(CASSESPR, 150, 192, 0, 13, 0, 0, 0, 0); _vm->_objectsManager.SPRITE(CASSESPR, 164, 187, 1, 14, 0, 0, 0, 0); @@ -842,8 +841,8 @@ int ComputerManager::HIGHT_SCORE() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); CHARGE_SCORE(); _vm->_graphicsManager.LOAD_IMAGEVGA("HISCORE.PCX"); - _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); + ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -894,8 +893,8 @@ void ComputerManager::NAME_SCORE() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_fileManager.CONSTRUIT_SYSTEM("ALPHA.SPR"); - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); + ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_graphicsManager.FADE_IN_CASSE(); for (int strPos = 0; strPos <= 4; strPos++) { PRINT_HSCORE(ptr, 9 * strPos + 140, 78, 1); @@ -1050,7 +1049,7 @@ void ComputerManager::SAUVE_SCORE() { *(ptr + v9 + 9) = 0; } - _vm->_fileManager.CONSTRUIT_LINUX("HISCORE.DAT"); + _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u); _vm->_globals.dos_free2(ptr); } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 436e4f694a..774767311e 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -60,13 +60,13 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.CHANGE_MOUSE(0); _vm->_eventsManager.VBL(); if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIFR.SPR"); - if (!_vm->_globals.FR) - _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIAN.SPR"); - if (_vm->_globals.FR == 2) - _vm->_fileManager.CONSTRUIT_SYSTEM("OPTIES.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIFR.SPR"); + else if (!_vm->_globals.FR) + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIAN.SPR"); + else if (_vm->_globals.FR == 2) + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); - _vm->_globals.OPTION_SPR = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.OPTION_FLAG = true; do { @@ -322,13 +322,13 @@ LABEL_7: switch (_vm->_globals.FR) { case 0: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTAN.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTAN.SPR"); break; case 1: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTFR.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTFR.SPR"); break; case 2: - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENTES.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTES.SPR"); break; } @@ -338,11 +338,11 @@ LABEL_7: size_t filesize = f.size(); _vm->_dialogsManager.Winventaire = _vm->_globals.dos_malloc2(filesize); - _vm->_fileManager.bload_it(f, _vm->_dialogsManager.Winventaire, filesize); + _vm->_fileManager.readStream(f, _vm->_dialogsManager.Winventaire, filesize); f.close(); - _vm->_fileManager.CONSTRUIT_SYSTEM("INVENT2.SPR"); - inventaire2 = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); + inventaire2 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); int v19 = _vm->_graphicsManager.ofscroll + 152; int v18 = _vm->_objectsManager.Get_Largeur(_vm->_dialogsManager.Winventaire, 0); int v17 = _vm->_objectsManager.Get_Hauteur(_vm->_dialogsManager.Winventaire, 0); @@ -624,18 +624,18 @@ void DialogsManager::LOAD_SAUVE(int a1) { switch (_vm->_globals.FR) { case 0: - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEAN.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEAN.SPR"); break; case 1: - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEFR.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEFR.SPR"); break; case 2: - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVEES.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEES.SPR"); break; } _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_fileManager.CONSTRUIT_SYSTEM("SAVE2.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVE2.SPR"); _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f92e225939..d876481393 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -319,7 +319,6 @@ void EventsManager::VBL() { _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 50, 0x280u, 340, 0, 50); else _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 20, 0x280u, 440, 0, 20); - _vm->_fileManager.DMESS(); --_vm->_graphicsManager.REDRAW; } _vm->_graphicsManager.DD_Unlock(); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index fbbac191c2..f251d51388 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -38,8 +38,10 @@ void FileManager::setParent(HopkinsEngine *vm) { _vm = vm; } -// Load INI File -void FileManager::Chage_Inifile(Common::StringMap &iniParams) { +/** + * Load INI File + */ +void FileManager::loadIniFile(Common::StringMap &iniParams) { // TODO: Review whether we can do something cleaner with ScummVM initialisation than // just initialising the INI array as if it had read in the INI file @@ -52,10 +54,10 @@ void FileManager::Chage_Inifile(Common::StringMap &iniParams) { iniParams["SOUND"] = "YES"; } -// Load File -byte *FileManager::CHARGE_FICHIER(const Common::String &file) { - DMESS1(); - +/** + * Load a file + */ +byte *FileManager::loadFile(const Common::String &file) { Common::File f; if (!f.open(file)) error("Error opening %s", file.c_str()); @@ -66,55 +68,27 @@ byte *FileManager::CHARGE_FICHIER(const Common::String &file) { if (!data) error("Error allocating space for file being loaded - %s", file.c_str()); - bload_it(f, data, filesize); + readStream(f, data, filesize); f.close(); return data; } -// Load File 2 -void FileManager::CHARGE_FICHIER2(const Common::String &file, byte *buf) { - Common::File f; - size_t filesize; - - DMESS1(); - if (!f.open(file)) - error("Error opening file - %s", file.c_str()); - - filesize = f.size(); - _vm->_fileManager.bload_it(f, buf, filesize); - f.close(); -} - -// Guess: Debug Message -void FileManager::DMESS() { - // No implementation in original -} - -// Guess: Debug Message 1 -void FileManager::DMESS1() { - // No implementation in original -} - -void FileManager::bload(const Common::String &file, byte *buf) { - Common::File f; - if (!f.open(file)) - error("Error opening file - %s", file.c_str()); - int32 filesize = f.size(); - _vm->_fileManager.bload_it(f, buf, filesize); - f.close(); -} - -int FileManager::bload_it(Common::ReadStream &stream, void *buf, size_t nbytes) { +/** + * Read a given number of bytes from a Stream into a pre-allocated buffer + */ +int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes) { return stream.read(buf, nbytes); } -// Censorship -void FileManager::F_Censure() { +/** + * Initialize censorship based on blood.dat file + */ +void FileManager::initCensorship() { _vm->_globals.CENSURE = false; - CONSTRUIT_SYSTEM("BLOOD.DAT"); - char *data = (char *)CHARGE_FICHIER(_vm->_globals.NFICHIER); + constructFilename(_vm->_globals.HOPSYSTEM, "BLOOD.DAT"); + char *data = (char *)loadFile(_vm->_globals.NFICHIER); if (*(data + 6) == 'u' && *(data + 7) == 'k') _vm->_globals.CENSURE = true; @@ -124,13 +98,12 @@ void FileManager::F_Censure() { free(data); } -// Build System -int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) { - _vm->_globals.NFICHIER = Common::String::format("system/%s", file.c_str()); - return _vm->_globals.NFICHIER.size(); -} - -void FileManager::CONSTRUIT_FICHIER(const Common::String &folder, const Common::String &file) { +/** + * Construct a filename based on a suggested folder and filename. + * @param folder Folder to use. May be overriden for animations. + * @param file Filename + */ +void FileManager::constructFilename(const Common::String &folder, const Common::String &file) { Common::String folderToUse = folder; // A lot of the code in the original engine based on COPIE_SEQ was used to determine @@ -142,15 +115,15 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &folder, const Common:: if (folder == _vm->_globals.HOPANM) { switch (_vm->_globals.SVGA) { case 1: - if (TEST_REP(folderToUse, file)) + if (fileExists(folderToUse, file)) folderToUse = _vm->_globals.HOPTSVGA; break; case 2: - if (TEST_REP(folderToUse, file)) + if (fileExists(folderToUse, file)) folderToUse = _vm->_globals.HOPSVGA; break; case 3: - if (TEST_REP(folderToUse, file)) + if (fileExists(folderToUse, file)) folderToUse = _vm->_globals.HOPVGA; break; default: @@ -161,7 +134,18 @@ void FileManager::CONSTRUIT_FICHIER(const Common::String &folder, const Common:: _vm->_globals.NFICHIER = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); } -bool FileManager::TEST_REP(const Common::String &folder, const Common::String &file) { +/** + * Construct Linux filename + */ +Common::String FileManager::constructLinuxFilename(const Common::String &file) { + _vm->_globals.NFICHIER = file; + return file; +} + +/** + * Check if a file is present in a given (optional) folder + */ +bool FileManager::fileExists(const Common::String &folder, const Common::String &file) { Common::String filename = folder.empty() ? file : Common::String::format("%s/%s", folder.c_str(), file.c_str()); @@ -169,14 +153,10 @@ bool FileManager::TEST_REP(const Common::String &folder, const Common::String &f return !f.exists(filename); } -// Free File -byte *FileManager::LIBERE_FICHIER(byte *ptr) { - free(ptr); - return g_PTRNUL; -} - -// Search Cat -byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { +/** + * Search file in Cat file + */ +byte *FileManager::searchCat(const Common::String &file, int a2) { byte *ptr = NULL; Common::File f; @@ -185,91 +165,91 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { switch (a2) { case 1: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_INI.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_INI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_INI.RES"); + ptr = loadFile(_vm->_globals.NFICHIER); + constructFilename(_vm->_globals.HOPLINK, "RES_INI.RES"); break; case 2: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_REP.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_REP.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_REP.RES"); + ptr = loadFile(_vm->_globals.NFICHIER); + constructFilename(_vm->_globals.HOPLINK, "RES_REP.RES"); break; case 3: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_LIN.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_LIN.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_LIN.RES"); + ptr = loadFile(_vm->_globals.NFICHIER); + constructFilename(_vm->_globals.HOPLINK, "RES_LIN.RES"); break; case 4: - CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_ANI.CAT"); + constructFilename(_vm->_globals.HOPANIM, "RES_ANI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); - CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_ANI.RES"); + ptr = loadFile(_vm->_globals.NFICHIER); + constructFilename(_vm->_globals.HOPANIM, "RES_ANI.RES"); break; case 5: - CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_PER.CAT"); + constructFilename(_vm->_globals.HOPANIM, "RES_PER.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); - CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_PER.RES"); + ptr = loadFile(_vm->_globals.NFICHIER); + constructFilename(_vm->_globals.HOPANIM, "RES_PER.RES"); break; case 6: - CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, "PIC.CAT"); + constructFilename(_vm->_globals.HOPIMAGE, "PIC.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals.NFICHIER); break; case 7: - CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.CAT"); + constructFilename(_vm->_globals.HOPANIM, "RES_SAN.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals.NFICHIER); break; case 8: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_SLI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals.NFICHIER); break; case 9: switch (_vm->_globals.FR) { case 0: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_VAN.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_VAN.CAT"); break; case 1: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_VFR.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_VFR.CAT"); break; case 2: - CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_VES.CAT"); + constructFilename(_vm->_globals.HOPLINK, "RES_VES.CAT"); break; } if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - ptr = CHARGE_FICHIER(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals.NFICHIER); break; // Deliberate fall-through to default: @@ -313,7 +293,7 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { if (catData == g_PTRNUL) error("CHARGE_FICHIER"); - bload_it(f, catData, _vm->_globals.CAT_TAILLE); + readStream(f, catData, _vm->_globals.CAT_TAILLE); f.close(); result = catData; } else { @@ -323,8 +303,10 @@ byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { return result; } -// File Size -uint32 FileManager::FLONG(const Common::String &filename) { +/** + * Returns the size of a file. Throws an error if the file can't be found + */ +uint32 FileManager::fileSize(const Common::String &filename) { Common::File f; uint32 size; @@ -337,10 +319,4 @@ uint32 FileManager::FLONG(const Common::String &filename) { return size; } -// Build Linux -Common::String FileManager::CONSTRUIT_LINUX(const Common::String &file) { - _vm->_globals.NFICHIER = file; - return file; -} - } // End of namespace Hopkins diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index e63e5370c8..fe63fd0848 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -34,38 +34,23 @@ class HopkinsEngine; class FileManager { private: - bool TEST_REP(const Common::String &folder, const Common::String &file); + bool fileExists(const Common::String &folder, const Common::String &file); public: HopkinsEngine *_vm; public: FileManager(); void setParent(HopkinsEngine *vm); - void Chage_Inifile(Common::StringMap &iniParams); - byte *CHARGE_FICHIER(const Common::String &file); - void CHARGE_FICHIER2(const Common::String &file, byte *a2); - void DMESS(); - void DMESS1(); - void bload(const Common::String &file, byte *buf); - int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); - void F_Censure(); - int CONSTRUIT_SYSTEM(const Common::String &file); - - /** - * Construct a filename based on a suggested folder and filename. - * @param folder Folder to use. May be overriden for animations. - * @param file Filename - */ - void CONSTRUIT_FICHIER(const Common::String &folder, const Common::String &file); + void loadIniFile(Common::StringMap &iniParams); + byte *loadFile(const Common::String &file); + int readStream(Common::ReadStream &stream, void *buf, size_t nbytes); + void initCensorship(); + void constructFilename(const Common::String &folder, const Common::String &file); - byte *LIBERE_FICHIER(byte *ptr); - byte *RECHERCHE_CAT(const Common::String &file, int a2); - Common::String CONSTRUIT_LINUX(const Common::String &file); + byte *searchCat(const Common::String &file, int a2); + Common::String constructLinuxFilename(const Common::String &file); - /** - * Returns the size of a file. Throws an error if the file can't be found - */ - uint32 FLONG(const Common::String &filename); + uint32 fileSize(const Common::String &filename); }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index cb7580cc33..c7fae50218 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -168,7 +168,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, TRIER_TEXT[v62++] = 0; } while (v62 <= 19); Txt[idx].textLoaded = true; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); file = _vm->_globals.NFICHIER; if (strncmp(file.c_str(), oldname.c_str(), strlen(file.c_str())) != 0) { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e4a405ef0c..a311c91253 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -301,6 +301,7 @@ void Globals::setConfig() { HOPSVGA = "SVGA"; HOPVGA = "VGA"; HOPSEQ = "SEQ"; + HOPSYSTEM = "SYSTEM"; // CHECKME: Should be in Globals() but it doesn't work // The Polish version is a translation of the English version. The filenames are the same. @@ -490,8 +491,8 @@ void Globals::CLEAR_VBOB() { // Load Object void Globals::CHARGE_OBJET() { - _vm->_fileManager.CONSTRUIT_SYSTEM("OBJET.DAT"); - byte *data = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); + _vm->_fileManager.constructFilename(HOPSYSTEM, "OBJET.DAT"); + byte *data = _vm->_fileManager.loadFile(NFICHIER); byte *srcP = data; for (int idx = 0; idx < 300; ++idx) { @@ -580,14 +581,14 @@ void Globals::CHARGE_CACHE(const Common::String &file) { Common::File f; RESET_CACHE(); - _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, file); - ptr = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); + _vm->_fileManager.constructFilename(HOPLINK, file); + ptr = _vm->_fileManager.loadFile(NFICHIER); v16 = Common::String((const char *)ptr); - _vm->_fileManager.CONSTRUIT_FICHIER(HOPLINK, v16); + _vm->_fileManager.constructFilename(HOPLINK, v16); if (f.exists(NFICHIER)) { - spriteData = _vm->_fileManager.CHARGE_FICHIER(NFICHIER); + spriteData = _vm->_fileManager.loadFile(NFICHIER); CACHE_BANQUE[1] = spriteData; int v15 = 60; for (int i = 0; i <= 21; i++) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 2e3097eafb..c44316611c 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -360,6 +360,7 @@ public: Common::String HOPSVGA; Common::String HOPVGA; Common::String HOPSEQ; + Common::String HOPSYSTEM; Common::String FICH_ZONE; Common::String FICH_TEXTE; Common::String NFICHIER; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0075fb0830..1f734e284c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -190,7 +190,7 @@ void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { DD_Lock(); Cls_Video(); DD_Unlock(); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); A_PCX320(VESA_SCREEN, _vm->_globals.NFICHIER, Palette); memcpy(VESA_BUFFER, VESA_SCREEN, 0xFA00u); _vm->_eventsManager.souris_max(); @@ -209,14 +209,11 @@ void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { // Load Screen void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { - bool flag; Common::File f; - _vm->_fileManager.DMESS1(); - - flag = true; - if (_vm->_fileManager.RECHERCHE_CAT(file, 6) == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + bool flag = true; + if (_vm->_fileManager.searchCat(file, 6) == g_PTRNUL) { + _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); if (!f.open(_vm->_globals.NFICHIER)) error("CHARGE_ECRAN - %s", file.c_str()); @@ -360,14 +357,14 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by if (typeFlag) { // Load PCX from within the PIC resource - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, "PIC.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, "PIC.RES"); if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); f.seek(_vm->_globals.CAT_POSI); } else { // Load stand alone PCX file - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPIMAGE, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); } @@ -2299,26 +2296,26 @@ void GraphicsManager::INI_ECRAN2(const Common::String &file) { void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { Common::String filename = file + ".ini"; - byte *ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 1); + byte *ptr = _vm->_fileManager.searchCat(filename, 1); if (ptr == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (!mode) { filename = file + ".spr"; if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_globals.SPRITE_ECRAN = _vm->_globals.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); if (!_vm->_globals.NOSPRECRAN) { - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.RECHERCHE_CAT(filename, 8); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); } else { _vm->_globals.CAT_FLAG = true; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; } } @@ -2351,11 +2348,11 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); filename = file + ".rep"; - byte *dataP = _vm->_fileManager.RECHERCHE_CAT(filename, 2); + byte *dataP = _vm->_fileManager.searchCat(filename, 2); _vm->_globals.COUCOU = dataP; if (g_PTRNUL == dataP) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); - dataP = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + dataP = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.COUCOU = dataP; } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index edcfb5afb5..b040cd712c 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -96,11 +96,11 @@ Common::Error HopkinsEngine::run() { _saveLoadManager.initSaves(); Common::StringMap iniParams; - _fileManager.Chage_Inifile(iniParams); + _fileManager.loadIniFile(iniParams); processIniParams(iniParams); _globals.setConfig(); - _fileManager.F_Censure(); + _fileManager.initCensorship(); INIT_SYSTEM(); _soundManager.WSOUND_INIT(); @@ -174,8 +174,8 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Init_Interrupt_();"); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 2000); @@ -482,8 +482,8 @@ bool HopkinsEngine::runLinuxDemo() { INTRORUN(); _globals.iRegul = 0; - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 2000); @@ -849,9 +849,9 @@ bool HopkinsEngine::runWin95full() { _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 0; - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 2000); @@ -1236,7 +1236,7 @@ bool HopkinsEngine::runWin95full() { Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { - _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); } @@ -1686,8 +1686,8 @@ bool HopkinsEngine::runWin95full() { _globals.SORTIE = WBASE(); _soundManager.WSOUND_OFF(); warning("TODO: heapshrink();"); - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager.nbrligne = SCREEN_WIDTH; @@ -1727,8 +1727,8 @@ bool HopkinsEngine::runLinuxFull() { INTRORUN(); _globals.iRegul = 0; - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 2000); @@ -2114,7 +2114,7 @@ bool HopkinsEngine::runLinuxFull() { Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { - _fileManager.CONSTRUIT_SYSTEM("HOPDEG.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); } @@ -2576,8 +2576,8 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(23); _globals.SORTIE = PWBASE(); _soundManager.WSOUND_OFF(); - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager.nbrligne = SCREEN_WIDTH; @@ -2629,18 +2629,18 @@ void HopkinsEngine::INIT_SYSTEM() { switch (_globals.FR) { case 0: if (!_eventsManager.mouse_linux) - _fileManager.CONSTRUIT_SYSTEM("SOUAN.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUAN.SPR"); else - _fileManager.CONSTRUIT_SYSTEM("LSOUAN.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUAN.SPR"); break; case 1: if (!_eventsManager.mouse_linux) - _fileManager.CONSTRUIT_SYSTEM("SOUFR.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUFR.SPR"); else - _fileManager.CONSTRUIT_SYSTEM("LSOUFR.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUFR.SPR"); break; case 2: - _fileManager.CONSTRUIT_SYSTEM("SOUES.SPR"); + _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUES.SPR"); break; } @@ -2651,31 +2651,31 @@ void HopkinsEngine::INIT_SYSTEM() { _eventsManager.souris_sizex = 34; _eventsManager.souris_sizey = 20; } - _eventsManager.pointeur_souris = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _eventsManager.pointeur_souris = _fileManager.loadFile(_globals.NFICHIER); _globals.clearAll(); - _fileManager.CONSTRUIT_SYSTEM("FONTE3.SPR"); - _globals.police = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "FONTE3.SPR"); + _globals.police = _fileManager.loadFile(_globals.NFICHIER); _globals.police_l = 12; _globals.police_h = 21; - _fileManager.CONSTRUIT_SYSTEM("ICONE.SPR"); - _globals.ICONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); - _fileManager.CONSTRUIT_SYSTEM("TETE.SPR"); - _globals.TETE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "ICONE.SPR"); + _globals.ICONE = _fileManager.loadFile(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "TETE.SPR"); + _globals.TETE = _fileManager.loadFile(_globals.NFICHIER); switch (_globals.FR) { case 0: - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "ZONEAN.TXT"); - _globals.BUF_ZONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPLINK, "ZONEAN.TXT"); + _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; case 1: - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "ZONE01.TXT"); - _globals.BUF_ZONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPLINK, "ZONE01.TXT"); + _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; case 2: - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "ZONEES.TXT"); - _globals.BUF_ZONE = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPLINK, "ZONEES.TXT"); + _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; } @@ -2988,7 +2988,7 @@ void HopkinsEngine::BOOM() { _graphicsManager.FADE_LINUX = 2; if (_globals.SVGA == 1) _animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_globals.SVGA == 2) + else if (_globals.SVGA == 2) _animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _soundManager.SPECIAL_SOUND = 0; @@ -3357,8 +3357,8 @@ void HopkinsEngine::JOUE_FIN() { _globals.iRegul = 0; _globals.SORTIE = 300; } - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _globals.PERSO = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; } @@ -3537,20 +3537,20 @@ void HopkinsEngine::Charge_Credits() { _globals.Credit_step = 45; switch (_globals.FR) { case 0: - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREAN.TXT"); + _fileManager.constructFilename(_globals.HOPLINK, "CREAN.TXT"); break; case 1: - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREFR.TXT"); + _fileManager.constructFilename(_globals.HOPLINK, "CREFR.TXT"); break; case 2: - _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREES.TXT"); + _fileManager.constructFilename(_globals.HOPLINK, "CREES.TXT"); break; default: error("Charge_Credits(): Unhandled language"); break; } - byte *bufPtr = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + byte *bufPtr = _fileManager.loadFile(_globals.NFICHIER); byte *curPtr = bufPtr; int idxLines = 0; bool loopCond = false; @@ -3905,8 +3905,8 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _globals.AFFIVBL = true; _globals.DESACTIVE_INVENT = true; _soundManager.WSOUND(a9); - _fileManager.CONSTRUIT_SYSTEM("VAISSEAU.SPR"); - _fileManager.CHARGE_FICHIER2(_globals.NFICHIER, _globals.PERSO); + _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); if (a2.size()) _graphicsManager.LOAD_IMAGE(a2); @@ -3987,8 +3987,8 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _objectsManager.SPRITE_OFF(0); _globals.AFFLI = false; _objectsManager.CLEAR_ECRAN(); - _fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _fileManager.CHARGE_FICHIER2(_globals.NFICHIER, _globals.PERSO); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; } diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 18484580e7..bcb2e3d737 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -84,11 +84,11 @@ int MenuManager::MENU() { _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.FR == 0) - _vm->_fileManager.CONSTRUIT_SYSTEM("MENUAN.SPR"); - if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_SYSTEM("MENUFR.SPR"); - if (_vm->_globals.FR == 2) - _vm->_fileManager.CONSTRUIT_SYSTEM("MENUES.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUAN.SPR"); + else if (_vm->_globals.FR == 1) + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUFR.SPR"); + else if (_vm->_globals.FR == 2) + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.MOUSE_ON(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ebc1e03f1a..e0fc5fd3ec 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -120,7 +120,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { - _vm->_fileManager.CONSTRUIT_SYSTEM("OBJET1.SPR"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OBJET1.SPR"); _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::CHARGE_SPRITE(_vm->_globals.NFICHIER); } _vm->_globals.NUM_FICHIER_OBJ = val1; @@ -258,7 +258,7 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn byte *ObjectsManager::DEL_FICHIER_OBJ() { _vm->_globals.NUM_FICHIER_OBJ = 0; if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) - _vm->_globals.ADR_FICHIER_OBJ = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); + _vm->_globals.ADR_FICHIER_OBJ = _vm->_globals.LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); byte *result = g_PTRNUL; _vm->_globals.ADR_FICHIER_OBJ = g_PTRNUL; @@ -267,8 +267,7 @@ byte *ObjectsManager::DEL_FICHIER_OBJ() { // Load Sprite byte *ObjectsManager::CHARGE_SPRITE(const Common::String &file) { - _vm->_fileManager.DMESS1(); - return _vm->_fileManager.CHARGE_FICHIER(file); + return _vm->_fileManager.loadFile(file); } int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { @@ -2336,8 +2335,8 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); + ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v4 = 0; v5 = 0; do { @@ -2402,13 +2401,13 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { ++v1; } while (v1 <= 100); - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); Common::File f; if (!f.exists(_vm->_globals.NFICHIER)) error("File not found : %s", _vm->_globals.NFICHIER.c_str()); - ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v4 = 0; v18 = 0; v17 = 0; @@ -2571,8 +2570,8 @@ void ObjectsManager::PLAN_BETA() { CHARGE_OBSTACLE("PLAN.OB2"); _vm->_globals.CHARGE_CACHE("PLAN.CA2"); CHARGE_ZONE("PLAN.ZO2"); - _vm->_fileManager.CONSTRUIT_SYSTEM("VOITURE.SPR"); - sprite_ptr = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "VOITURE.SPR"); + sprite_ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_animationManager.CHARGE_ANIM("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN"); @@ -3005,9 +3004,9 @@ void ObjectsManager::CLEAR_ECRAN() { DERLIGNE = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.COUCOU != g_PTRNUL) - _vm->_globals.COUCOU = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.COUCOU); + _vm->_globals.COUCOU = _vm->_globals.LIBERE_FICHIER(_vm->_globals.COUCOU); if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_globals.SPRITE_ECRAN = _vm->_globals.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager.start_x = 0; _vm->_eventsManager.souris_n = 0; Vold_taille = 200; @@ -3060,8 +3059,8 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n T_RECTIF = 0; loc = &_vm->_globals.SAUVEGARDE->realHopkins; - _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); @@ -3086,8 +3085,8 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField357] = 0; loc = &_vm->_globals.SAUVEGARDE->samantha; - _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 2; SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 20, 127); SPRITE_ON(0); @@ -4122,10 +4121,10 @@ void ObjectsManager::OPTI_OBJET() { int v7; file = "OBJET1.ini"; - data = _vm->_fileManager.RECHERCHE_CAT(file, 1); + data = _vm->_fileManager.searchCat(file, 1); if (data == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); - data = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); + data = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if ((data == g_PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { @@ -4355,8 +4354,8 @@ void ObjectsManager::ACTION_DOS(int idx) { _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 1; - _vm->_fileManager.CONSTRUIT_SYSTEM("DOS.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "DOS.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4391,8 +4390,8 @@ void ObjectsManager::ACTION_DROITE(int idx) { if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); @@ -4421,8 +4420,8 @@ void ObjectsManager::Q_DROITE(int idx) { if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4451,8 +4450,8 @@ void ObjectsManager::ACTION_FACE(int idx) { if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; - _vm->_fileManager.CONSTRUIT_SYSTEM("FACE.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FACE.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4469,8 +4468,8 @@ void ObjectsManager::Q_GAUCHE(int idx) { if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.CONSTRUIT_SYSTEM("3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); @@ -4499,8 +4498,8 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { if (_vm->_globals.GESTE != g_PTRNUL) _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.CONSTRUIT_SYSTEM("PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 1); @@ -4651,10 +4650,10 @@ void ObjectsManager::INILINK(const Common::String &file) { v2 = 0; filename = file + ".LNK"; - ptr = _vm->_fileManager.RECHERCHE_CAT(filename, 3); + ptr = _vm->_fileManager.searchCat(filename, 3); nbytes = _vm->_globals.CAT_TAILLE; if (ptr == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -4663,7 +4662,7 @@ void ObjectsManager::INILINK(const Common::String &file) { ptr = _vm->_globals.dos_malloc2(nbytes); if (g_PTRNUL == ptr) error("INILINK"); - _vm->_fileManager.bload_it(f, ptr, nbytes); + _vm->_fileManager.readStream(f, ptr, nbytes); f.close(); } if (!OBSSEUL) { @@ -4674,17 +4673,17 @@ void ObjectsManager::INILINK(const Common::String &file) { filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.RECHERCHE_CAT(filename2, 8); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, filename2); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename2); } else { _vm->_globals.CAT_FLAG = true; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, "RES_SLI.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; v36 = 60; v37 = ptr + 1000; @@ -5639,21 +5638,21 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!_vm->_globals.PERSO_TYPE) goto LABEL_70; if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { - _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; } if (!_vm->_globals.PERSO_TYPE) { LABEL_70: if (_vm->_globals.SAUVEGARDE->data[svField122] == 1) { - _vm->_fileManager.CONSTRUIT_SYSTEM("HOPFEM.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 1; } } if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals.SAUVEGARDE->data[svField356] == 1) { - _vm->_fileManager.CONSTRUIT_SYSTEM("PSAMAN.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 2; } _vm->_globals.HOPKINS_DATA(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1abe125e08..e9eca6cb5d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -554,7 +554,7 @@ LABEL_1141: _vm->_graphicsManager.FADESPD = 1; if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE1A.ANM", 100, 18, 100); - if (_vm->_globals.SVGA == 1) + else if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM("BOMBE1.ANM", 100, 18, 100); } _vm->_graphicsManager.LOAD_IMAGE("BOMBEB"); @@ -586,7 +586,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_LINUX = 2; if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) + else if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); @@ -601,7 +601,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 199; if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) + else if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; @@ -618,7 +618,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_LINUX = 2; if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) + else if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; @@ -633,7 +633,7 @@ LABEL_1141: if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); - if (_vm->_globals.SVGA == 2) + else if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); } @@ -1951,8 +1951,8 @@ LABEL_1141: _vm->_globals.SAUVEGARDE->data[svField354] = 1; } if (v76 == 56) { - _vm->_fileManager.CONSTRUIT_SYSTEM("HOPFEM.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 1; _vm->_globals.SAUVEGARDE->data[svField122] = 1; _vm->_globals.HOPKINS_DATA(); @@ -1961,8 +1961,8 @@ LABEL_1141: _vm->_objectsManager.VERIFTAILLE(); } if (v76 == 57) { - _vm->_fileManager.CONSTRUIT_SYSTEM("PERSO.SPR"); - _vm->_fileManager.CHARGE_FICHIER2(_vm->_globals.NFICHIER, _vm->_globals.PERSO); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; _vm->_globals.SAUVEGARDE->data[svField122] = 0; _vm->_globals.HOPKINS_DATA(); @@ -2094,7 +2094,7 @@ LABEL_1141: _vm->_globals.NOPARLE = false; if (_vm->_globals.SVGA == 1) _vm->_animationManager.PLAY_ANM2("T421.ANM", 100, 14, 500); - if (_vm->_globals.SVGA == 2) + else if (_vm->_globals.SVGA == 2) _vm->_animationManager.PLAY_ANM2("T421a.ANM", 100, 14, 500); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 1f7e6a9ee0..6c01051d60 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -344,7 +344,7 @@ void SoundManager::WSOUND_OFF() { void SoundManager::PLAY_MOD(const Common::String &file) { if (!MUSICOFF) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPMUSIC, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, file); if (MOD_FLAG) { STOP_MUSIC(); DEL_MUSIC(); @@ -569,30 +569,30 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); - if (!_vm->_fileManager.RECHERCHE_CAT(filename + ".WAV", 9)) { + if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VFR.RES"); - if (!_vm->_globals.FR) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VAN.RES"); - if (_vm->_globals.FR == 2) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VES.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); + else if (!_vm->_globals.FR) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); + else if (_vm->_globals.FR == 2) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals.CAT_POSI; catLen = _vm->_globals.CAT_TAILLE; - } else if (!_vm->_fileManager.RECHERCHE_CAT(filename + ".APC", 9)) { + } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { if (_vm->_globals.FR == 1) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VFR.RES"); - if (!_vm->_globals.FR) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VAN.RES"); - if (_vm->_globals.FR == 2) - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, "RES_VES.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); + else if (!_vm->_globals.FR) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); + else if (_vm->_globals.FR == 2) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals.CAT_POSI; catLen = _vm->_globals.CAT_TAILLE; } else { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename + ".WAV"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".WAV"); if (!f.exists(_vm->_globals.NFICHIER)) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPVOICE, filename + ".APC"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".APC"); if (!f.exists(_vm->_globals.NFICHIER)) return false; } @@ -671,7 +671,7 @@ void SoundManager::MODSetMusicVolume(int volume) { } void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); SOUND[wavIndex]._active = true; } @@ -803,7 +803,7 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPSOUND, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 1); } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 9bdaae155f..5cb1147169 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -71,12 +71,12 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.no_scroll = 1; bool old_DESACTIVE_INVENT = _vm->_globals.DESACTIVE_INVENT; _vm->_globals.DESACTIVE_INVENT = true; - BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); + BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); - BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; RENVOIE_FICHIER(40, v16, (const char *)BUFFERPERSO); @@ -92,21 +92,21 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); v3 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v16, 7); + PERSOSPR = _vm->_fileManager.searchCat(v16, 7); if (PERSOSPR) { _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v16); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v16); } else { _vm->_globals.CAT_FLAG = true; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); - if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); if (!_vm->_graphicsManager.nbrligne) @@ -200,12 +200,12 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { STATI = 1; bool v7 = _vm->_globals.DESACTIVE_INVENT; _vm->_globals.DESACTIVE_INVENT = 1; - BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(filename, 5); + BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); - BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; @@ -649,7 +649,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v18 = 0; _vm->_globals.police_l = 11; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file); + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); // Build up the filename filename = dest = _vm->_globals.NFICHIER; @@ -1219,12 +1219,12 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(0); - BUFFERPERSO = _vm->_fileManager.RECHERCHE_CAT(a2, 5); + BUFFERPERSO = _vm->_fileManager.searchCat(a2, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, a2); - BUFFERPERSO = _vm->_fileManager.CHARGE_FICHIER(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.FLONG(_vm->_globals.NFICHIER); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, a2); + BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } RENVOIE_FICHIER(40, v23, (const char *)BUFFERPERSO); RENVOIE_FICHIER(0, v22, (const char *)BUFFERPERSO); @@ -1236,18 +1236,18 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!v6) { v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); } - PERSOSPR = _vm->_fileManager.RECHERCHE_CAT(v23, 7); + PERSOSPR = _vm->_fileManager.searchCat(v23, 7); if (PERSOSPR) { _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, v23); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v23); } else { _vm->_globals.CAT_FLAG = true; - _vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, "RES_SAN.RES"); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; - _vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR"); + _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) -- cgit v1.2.3 From 742b9e4750658615e57690aff228580edfd5c8b0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Dec 2012 22:35:59 +0100 Subject: HOPKINS: Rename animationManager functions --- engines/hopkins/anim.cpp | 83 +++++++++------ engines/hopkins/anim.h | 20 ++-- engines/hopkins/hopkins.cpp | 240 ++++++++++++++++++++++---------------------- engines/hopkins/objects.cpp | 16 +-- engines/hopkins/script.cpp | 74 +++++++------- engines/hopkins/sound.cpp | 2 +- engines/hopkins/sound.h | 2 +- engines/hopkins/talk.cpp | 30 +++--- engines/hopkins/talk.h | 4 +- 9 files changed, 245 insertions(+), 226 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index dbd4289f36..441721e141 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -34,13 +34,15 @@ namespace Hopkins { AnimationManager::AnimationManager() { - CLS_ANM = false; + clearAnimationFl = false; NO_SEQ = false; NO_COUL = false; } -// Play Anim -void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { +/** + * Play Anim + */ +void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { int v4; bool hasScreenCopy; byte *screenCopy = NULL; @@ -70,7 +72,7 @@ LABEL_2: f.skip(14); f.read(v10, nbytes); - if (CLS_ANM == true) { + if (clearAnimationFl == true) { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); @@ -110,7 +112,7 @@ LABEL_2: while (!_vm->shouldQuit()) { if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_58; - if (REDRAW_ANIM() == true) + if (redrawAnim() == true) break; _vm->_eventsManager.CONTROLE_MES(); if (_vm->_eventsManager.lItCounter >= rate1) @@ -132,7 +134,7 @@ LABEL_25: v13 = 0; while (!_vm->shouldQuit()) { ++v13; - _vm->_soundManager.PLAY_ANM_SOUND(v13); + _vm->_soundManager.playAnim_SOUND(v13); if (f.read(ptr, 16) != 16) v4 = -1; @@ -169,7 +171,7 @@ LABEL_49: if (v4 == -1) { if (_vm->_globals.iRegul == 1) { while (_vm->_eventsManager.ESC_KEY != true) { - if (REDRAW_ANIM() == true) + if (redrawAnim() == true) goto LABEL_53; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -185,7 +187,7 @@ LABEL_57: } } while (!_vm->shouldQuit() && _vm->_eventsManager.ESC_KEY != true) { - if (REDRAW_ANIM() == true) { + if (redrawAnim() == true) { if (_vm->_graphicsManager.NOLOCK == true) break; _vm->_globals.dos_free2(ptr); @@ -243,8 +245,10 @@ LABEL_58: _vm->_graphicsManager.NOLOCK = false; } -// Play Anim 2 -void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { +/** + * Play Animation, type 2 + */ +void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { int v5; int v8; byte *ptr; @@ -335,7 +339,7 @@ void AnimationManager::PLAY_ANM2(const Common::String &filename, uint32 a2, uint for (;;) { if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_114; - if (REDRAW_ANIM() == true) + if (redrawAnim() == true) break; _vm->_eventsManager.CONTROLE_MES(); if (_vm->_eventsManager.lItCounter >= a2) @@ -405,7 +409,7 @@ LABEL_48: v15 = 0; for (;;) { ++v15; - _vm->_soundManager.PLAY_ANM_SOUND(v15); + _vm->_soundManager.playAnim_SOUND(v15); memset(&buf, 0, 6u); memset(v13, 0, 0x13u); @@ -444,7 +448,7 @@ LABEL_88: if (v5 == -1) { if (_vm->_globals.iRegul == 1) { while (_vm->_eventsManager.ESC_KEY != true) { - if (REDRAW_ANIM() == true) { + if (redrawAnim() == true) { if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_114; if (v8 == 1) @@ -508,7 +512,7 @@ LABEL_88: } } while (_vm->_eventsManager.ESC_KEY != true) { - if (REDRAW_ANIM() == true) { + if (redrawAnim() == true) { if (_vm->_graphicsManager.NOLOCK == true) break; if (v8 == 1) @@ -667,12 +671,14 @@ LABEL_114: _vm->_graphicsManager.DD_VBL(); } -bool AnimationManager::REDRAW_ANIM() { +bool AnimationManager::redrawAnim() { return false; } -// Load Anim -void AnimationManager::CHARGE_ANIM(const Common::String &animName) { +/** + * Load Animation + */ +void AnimationManager::loadAnim(const Common::String &animName) { byte v20[15]; char header[10]; char filename1[15]; @@ -682,7 +688,7 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { char filename5[15]; char filename6[15]; - CLEAR_ANIM(); + clearAnim(); Common::String filename = animName + ".ANI"; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); @@ -714,7 +720,7 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { if (!f.exists(_vm->_globals.NFICHIER)) error("File not found"); - if (CHARGE_BANK_SPRITE1(idx, files[idx - 1])) + if (loadSpriteBank(idx, files[idx - 1])) error("File not compatible with this soft."); } } @@ -724,13 +730,16 @@ void AnimationManager::CHARGE_ANIM(const Common::String &animName) { f.close(); for (int idx = 1; idx <= 20; ++idx) { - RECHERCHE_ANIM(data, idx, nbytes); + searchAnim(data, idx, nbytes); } _vm->_globals.dos_free2(data); } -void AnimationManager::CLEAR_ANIM() { +/** + * Clear animation + */ +void AnimationManager::clearAnim() { for (int idx = 0; idx < 35; ++idx) { if (_vm->_globals.Bqe_Anim[idx].data != g_PTRNUL) _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); @@ -747,8 +756,10 @@ void AnimationManager::CLEAR_ANIM() { } } -// Load Sprite Bank 1 -int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filename) { +/** + * Load Sprite Bank + */ +int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *v3; byte *v4; byte *v13; @@ -839,8 +850,10 @@ int AnimationManager::CHARGE_BANK_SPRITE1(int idx, const Common::String &filenam return result; } -// Search Anim -void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count) { +/** + * Search Animation + */ +void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { int v3; const byte *v5; int v6; @@ -933,7 +946,10 @@ void AnimationManager::RECHERCHE_ANIM(const byte *data, int animIndex, int count } while (v21 <= count && v3 != 1); } -void AnimationManager::PLAY_SEQ(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { +/** + * Play sequence + */ +void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool readError; int v7; byte *ptr = NULL; @@ -1042,7 +1058,7 @@ void AnimationManager::PLAY_SEQ(const Common::String &file, uint32 rate1, uint32 soundNumber = 0; do { ++soundNumber; - _vm->_soundManager.PLAY_ANM_SOUND(soundNumber); + _vm->_soundManager.playAnim_SOUND(soundNumber); memset(v10, 0, 0x13u); if (f.read(v10, 16) != 16) readError = true; @@ -1111,7 +1127,10 @@ LABEL_59: _vm->_globals.dos_free2(v10); } -void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { +/** + * Play Sequence type 2 + */ +void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool v4; int v7; byte *ptr = NULL; @@ -1183,7 +1202,7 @@ void AnimationManager::PLAY_SEQ2(const Common::String &file, uint32 rate1, uint3 while (!_vm->shouldQuit()) { if (_vm->_eventsManager.ESC_KEY == true) goto LABEL_54; - if (REDRAW_ANIM() == true) + if (redrawAnim() == true) break; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1203,7 +1222,7 @@ LABEL_23: v4 = false; v13 = 0; while (!_vm->shouldQuit()) { - _vm->_soundManager.PLAY_ANM_SOUND(v13++); + _vm->_soundManager.playAnim_SOUND(v13++); memset(v11, 0, 0x13u); if (f.read(v11, 16) != 16) @@ -1240,7 +1259,7 @@ LABEL_44: if (v4) { if (_vm->_globals.iRegul == 1) { while (_vm->_eventsManager.ESC_KEY != true) { - if (REDRAW_ANIM() == true) + if (redrawAnim() == true) goto LABEL_48; _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1256,7 +1275,7 @@ LABEL_53: } while (_vm->_eventsManager.ESC_KEY != true) { _vm->_eventsManager.CONTROLE_MES(); - if (REDRAW_ANIM() == true) + if (redrawAnim() == true) goto LABEL_48; if (_vm->_eventsManager.lItCounter >= rate2) goto LABEL_33; diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 316833c01c..8b7c9d7912 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -34,24 +34,24 @@ class HopkinsEngine; class AnimationManager { private: - int CHARGE_BANK_SPRITE1(int idx, const Common::String &filename); + int loadSpriteBank(int idx, const Common::String &filename); public: HopkinsEngine *_vm; - bool CLS_ANM; + bool clearAnimationFl; bool NO_SEQ; bool NO_COUL; public: AnimationManager(); void setParent(HopkinsEngine *vm) { _vm = vm; } - void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); - void PLAY_ANM2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); - bool REDRAW_ANIM(); - void CHARGE_ANIM(const Common::String &animName); - void CLEAR_ANIM(); - void RECHERCHE_ANIM(const byte *data, int animIndex, int count); - void PLAY_SEQ(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); - void PLAY_SEQ2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); + void playAnim(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); + void playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); + bool redrawAnim(); + void loadAnim(const Common::String &animName); + void clearAnim(); + void searchAnim(const byte *data, int animIndex, int count); + void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); + void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b040cd712c..6b5350aed7 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -228,9 +228,9 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); @@ -415,7 +415,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.Cls_Video(); _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -442,7 +442,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.Cls_Video(); _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -470,7 +470,7 @@ bool HopkinsEngine::runLinuxDemo() { if (!_globals.internet) { _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); + _animationManager.playAnim("MP.ANM", 10, 16, 200); } _graphicsManager.LOAD_IMAGE("H2"); @@ -556,9 +556,9 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.FADE_LINUX = 2; if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); @@ -784,7 +784,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -798,7 +798,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -812,7 +812,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -840,7 +840,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200); + _animationManager.playAnim("MP.ANM", 10, 16, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager.ESC_KEY) INTRORUN(); @@ -899,9 +899,9 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); @@ -1056,9 +1056,9 @@ bool HopkinsEngine::runWin95full() { _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); _graphicsManager.FADE_OUTS(); _globals.iRegul = 0; } @@ -1099,9 +1099,9 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2.ANM", 12, 18, 50); _graphicsManager.FADE_OUTS(); _globals.iRegul = 0; } @@ -1566,9 +1566,9 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); _graphicsManager.FADE_OUTS(); _globals.iRegul = 0; } @@ -1643,7 +1643,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.Cls_Video(); _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -1655,7 +1655,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.Cls_Video(); _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -1667,7 +1667,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.Cls_Video(); _graphicsManager.DD_UNLOCK(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -1779,9 +1779,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; if (!_globals.CENSURE) - _animationManager.PLAY_ANM("BANQUE.ANM", 200, 28, 200); + _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else - _animationManager.PLAY_ANM("BANKUK.ANM", 200, 28, 200); + _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); @@ -1935,9 +1935,9 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(29); _graphicsManager.FADE_LINUX = 2; if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); _globals.iRegul = 0; } break; @@ -1978,9 +1978,9 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(6); _graphicsManager.FADE_LINUX = 2; if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG2A.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG2.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2.ANM", 12, 18, 50); _globals.iRegul = 0; } break; @@ -2445,9 +2445,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("PURG1A.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); _graphicsManager.FADE_OUTS(); _globals.iRegul = 0; } @@ -2534,7 +2534,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR1A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -2547,7 +2547,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR3A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -2560,7 +2560,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -2704,15 +2704,15 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _eventsManager.VBL(); _soundManager.WSOUND(16); - _animationManager.CLS_ANM = true; - _animationManager.PLAY_ANM("J1.anm", 12, 12, 50); + _animationManager.clearAnimationFl = true; + _animationManager.playAnim("J1.anm", 12, 12, 50); if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(1, 3); - _animationManager.PLAY_ANM("J2.anm", 12, 12, 50); + _animationManager.playAnim("J2.anm", 12, 12, 50); if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(2, 3); - _animationManager.PLAY_ANM("J3.anm", 12, 12, 50); + _animationManager.playAnim("J3.anm", 12, 12, 50); if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(3, 3); @@ -2765,7 +2765,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.no_scroll = 0; _graphicsManager.LOAD_IMAGE("intro2"); _graphicsManager.SCROLL_ECRAN(0); - _animationManager.CHARGE_ANIM("INTRO2"); + _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); _objectsManager.BOBANIM_OFF(3); @@ -2803,7 +2803,7 @@ void HopkinsEngine::INTRORUN() { _soundManager.SPECIAL_SOUND = 5; _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("ELEC.ANM", 10, 26, 200); + _animationManager.playAnim("ELEC.ANM", 10, 26, 200); if (shouldQuit()) return; @@ -2812,7 +2812,7 @@ void HopkinsEngine::INTRORUN() { if (!_eventsManager.ESC_KEY) { _graphicsManager.LOAD_IMAGE("intro2"); _graphicsManager.SCROLL_ECRAN(0); - _animationManager.CHARGE_ANIM("INTRO2"); + _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); _objectsManager.BOBANIM_OFF(3); @@ -2896,29 +2896,29 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - _animationManager.CLS_ANM = true; + _animationManager.clearAnimationFl = true; _soundManager.WSOUND(3); _soundManager.SPECIAL_SOUND = 1; - _animationManager.PLAY_ANM("INTRO1.anm", 10, 24, 18); + _animationManager.playAnim("INTRO1.anm", 10, 24, 18); if (shouldQuit()) return; _soundManager.SPECIAL_SOUND = 0; if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("INTRO2.anm", 10, 24, 18); + _animationManager.playAnim("INTRO2.anm", 10, 24, 18); if (shouldQuit()) return; if (!_eventsManager.ESC_KEY) { - _animationManager.PLAY_ANM("INTRO3.anm", 10, 24, 200); + _animationManager.playAnim("INTRO3.anm", 10, 24, 200); if (shouldQuit()) return; if (!_eventsManager.ESC_KEY) { - _animationManager.CLS_ANM = false; + _animationManager.clearAnimationFl = false; _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("J4.anm", 12, 12, 1000); + _animationManager.playAnim("J4.anm", 12, 12, 1000); } } } @@ -2987,13 +2987,13 @@ void HopkinsEngine::BOOM() { _soundManager.SPECIAL_SOUND = 199; _graphicsManager.FADE_LINUX = 2; if (_globals.SVGA == 1) - _animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + _animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); else if (_globals.SVGA == 2) - _animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _soundManager.SPECIAL_SOUND = 0; _graphicsManager.LOAD_IMAGE("IM15"); - _animationManager.CHARGE_ANIM("ANIM15"); + _animationManager.loadAnim("ANIM15"); _graphicsManager.VISU_ALL(); _objectsManager.BOBANIM_OFF(7); _globals.BPP_NOAFF = true; @@ -3069,7 +3069,7 @@ void HopkinsEngine::INCENDIE() { _globals.DESACTIVE_INVENT = true; _globals.iRegul = 1; _graphicsManager.LOAD_IMAGE("IM71"); - _animationManager.CHARGE_ANIM("ANIM71"); + _animationManager.loadAnim("ANIM71"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -3107,65 +3107,65 @@ void HopkinsEngine::BASE() { _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.CLS_ANM = true; + _animationManager.clearAnimationFl = true; _soundManager.WSOUND(25); if (_globals.SVGA == 1) { - _animationManager.PLAY_ANM("base00.anm", 10, 18, 18); + _animationManager.playAnim("base00.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base05.anm", 10, 18, 18); + _animationManager.playAnim("base05.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base10.anm", 10, 18, 18); + _animationManager.playAnim("base10.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base20.anm", 10, 18, 18); + _animationManager.playAnim("base20.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base30.anm", 10, 18, 18); + _animationManager.playAnim("base30.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base40.anm", 10, 18, 18); + _animationManager.playAnim("base40.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base50.anm", 10, 18, 18); + _animationManager.playAnim("base50.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC00.anm", 10, 18, 18); + _animationManager.playAnim("OC00.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC05.anm", 10, 18, 18); + _animationManager.playAnim("OC05.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC10.anm", 10, 18, 18); + _animationManager.playAnim("OC10.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC20.anm", 10, 18, 18); + _animationManager.playAnim("OC20.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) { _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("OC30.anm", 10, 18, 18); + _animationManager.playAnim("OC30.anm", 10, 18, 18); } } else if (_globals.SVGA == 2) { - _animationManager.PLAY_ANM("base00a.anm", 10, 18, 18); + _animationManager.playAnim("base00a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base05a.anm", 10, 18, 18); + _animationManager.playAnim("base05a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base10a.anm", 10, 18, 18); + _animationManager.playAnim("base10a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base20a.anm", 10, 18, 18); + _animationManager.playAnim("base20a.anm", 10, 18, 18); // CHECKME: The original code was doing the opposite test, which looks like a bug. if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base30a.anm", 10, 18, 18); + _animationManager.playAnim("base30a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base40a.anm", 10, 18, 18); + _animationManager.playAnim("base40a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("base50a.anm", 10, 18, 18); + _animationManager.playAnim("base50a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC00a.anm", 10, 18, 18); + _animationManager.playAnim("OC00a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC05a.anm", 10, 18, 18); + _animationManager.playAnim("OC05a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC10a.anm", 10, 18, 18); + _animationManager.playAnim("OC10a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("OC20a.anm", 10, 18, 18); + _animationManager.playAnim("OC20a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) { _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("OC30a.anm", 10, 18, 18); + _animationManager.playAnim("OC30a.anm", 10, 18, 18); } } _eventsManager.ESC_KEY = false; - _animationManager.CLS_ANM = false; + _animationManager.clearAnimationFl = false; _globals.SORTIE = 85; } @@ -3180,10 +3180,10 @@ void HopkinsEngine::BASED() { _globals.DESACTIVE_INVENT = true; _animationManager.NO_COUL = true; _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_SEQ("abase.seq", 50, 15, 50); + _animationManager.playSequence("abase.seq", 50, 15, 50); _animationManager.NO_COUL = false; _graphicsManager.LOAD_IMAGE("IM92"); - _animationManager.CHARGE_ANIM("ANIM92"); + _animationManager.loadAnim("ANIM92"); _graphicsManager.VISU_ALL(); _objectsManager.INILINK("IM92"); _globals.BPP_NOAFF = true; @@ -3222,7 +3222,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.AFFIVBL = false; _soundManager.CHARGE_SAMPLE(1, "SOUND90.WAV"); _graphicsManager.LOAD_IMAGE("IM100"); - _animationManager.CHARGE_ANIM("ANIM100"); + _animationManager.loadAnim("ANIM100"); _graphicsManager.VISU_ALL(); _eventsManager.MOUSE_ON(); _objectsManager.BOBANIM_OFF(7); @@ -3292,7 +3292,7 @@ void HopkinsEngine::JOUE_FIN() { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("BERM.ANM", 100, 24, 300); + _animationManager.playAnim("BERM.ANM", 100, 24, 300); _graphicsManager.FIN_VISU(); _soundManager.DEL_SAMPLE(1); _graphicsManager.LOAD_IMAGE("PLAN3"); @@ -3309,17 +3309,17 @@ void HopkinsEngine::JOUE_FIN() { _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 0; _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("JOUR2A.anm", 12, 12, 1000); + _animationManager.playAnim("JOUR2A.anm", 12, 12, 1000); _soundManager.WSOUND(11); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.PLAY_ANM("FF1a.anm", 18, 18, 9); - _animationManager.PLAY_ANM("FF1a.anm", 9, 18, 9); - _animationManager.PLAY_ANM("FF1a.anm", 9, 18, 18); - _animationManager.PLAY_ANM("FF1a.anm", 9, 18, 9); - _animationManager.PLAY_ANM("FF2a.anm", 24, 24, 100); + _animationManager.playAnim("FF1a.anm", 18, 18, 9); + _animationManager.playAnim("FF1a.anm", 9, 18, 9); + _animationManager.playAnim("FF1a.anm", 9, 18, 18); + _animationManager.playAnim("FF1a.anm", 9, 18, 9); + _animationManager.playAnim("FF2a.anm", 24, 24, 100); Credits(); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -3328,7 +3328,7 @@ void HopkinsEngine::JOUE_FIN() { } else { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; - _animationManager.PLAY_ANM2("BERM.ANM", 100, 24, 300); + _animationManager.playAnim2("BERM.ANM", 100, 24, 300); _objectsManager.BOBANIM_OFF(7); _objectsManager.BOBANIM_ON(8); _globals.NOPARLE = true; @@ -3353,7 +3353,7 @@ void HopkinsEngine::JOUE_FIN() { _soundManager.SPECIAL_SOUND = 0; _dialogsManager.VIRE_INVENT = false; _globals.DESACTIVE_INVENT = false; - _animationManager.PLAY_ANM("JOUR4A.anm", 12, 12, 1000); + _animationManager.playAnim("JOUR4A.anm", 12, 12, 1000); _globals.iRegul = 0; _globals.SORTIE = 300; } @@ -3372,75 +3372,75 @@ void HopkinsEngine::AVION() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.CLS_ANM = false; + _animationManager.clearAnimationFl = false; if (_globals.SVGA == 1) { - _animationManager.PLAY_ANM("aerop00.anm", 10, 18, 18); + _animationManager.playAnim("aerop00.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop10.anm", 10, 18, 18); + _animationManager.playAnim("aerop10.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop20.anm", 10, 18, 18); + _animationManager.playAnim("aerop20.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop30.anm", 10, 18, 18); + _animationManager.playAnim("aerop30.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop40.anm", 10, 18, 18); + _animationManager.playAnim("aerop40.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop50.anm", 10, 18, 18); + _animationManager.playAnim("aerop50.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop60.anm", 10, 18, 18); + _animationManager.playAnim("aerop60.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop70.anm", 10, 18, 18); + _animationManager.playAnim("aerop70.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans00.anm", 10, 18, 18); + _animationManager.playAnim("trans00.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans10.anm", 10, 18, 18); + _animationManager.playAnim("trans10.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans15.anm", 10, 18, 18); + _animationManager.playAnim("trans15.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans20.anm", 10, 18, 18); + _animationManager.playAnim("trans20.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans30.anm", 10, 18, 18); + _animationManager.playAnim("trans30.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans40.anm", 10, 18, 18); + _animationManager.playAnim("trans40.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) { _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("PARA00.anm", 9, 9, 9); + _animationManager.playAnim("PARA00.anm", 9, 9, 9); } } else if (_globals.SVGA == 2) { - _animationManager.PLAY_ANM("aerop00a.anm", 10, 18, 18); + _animationManager.playAnim("aerop00a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("serop10a.anm", 10, 18, 18); + _animationManager.playAnim("serop10a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop20a.anm", 10, 18, 18); + _animationManager.playAnim("aerop20a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop30a.anm", 10, 18, 18); + _animationManager.playAnim("aerop30a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop40a.anm", 10, 18, 18); + _animationManager.playAnim("aerop40a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop50a.anm", 10, 18, 18); + _animationManager.playAnim("aerop50a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop60a.anm", 10, 18, 18); + _animationManager.playAnim("aerop60a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("aerop70a.anm", 10, 18, 18); + _animationManager.playAnim("aerop70a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans00a.anm", 10, 18, 18); + _animationManager.playAnim("trans00a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans10a.anm", 10, 18, 18); + _animationManager.playAnim("trans10a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans15a.anm", 10, 18, 18); + _animationManager.playAnim("trans15a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans20a.anm", 10, 18, 18); + _animationManager.playAnim("trans20a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans30a.anm", 10, 18, 18); + _animationManager.playAnim("trans30a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) - _animationManager.PLAY_ANM("trans40a.anm", 10, 18, 18); + _animationManager.playAnim("trans40a.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) { _graphicsManager.FADE_LINUX = 2; - _animationManager.PLAY_ANM("PARA00a.anm", 9, 9, 9); + _animationManager.playAnim("PARA00a.anm", 9, 9, 9); } } _eventsManager.ESC_KEY = 0; - _animationManager.CLS_ANM = 0; + _animationManager.clearAnimationFl = false; } int HopkinsEngine::PWBASE() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e0fc5fd3ec..e7d4822098 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2572,7 +2572,7 @@ void ObjectsManager::PLAN_BETA() { CHARGE_ZONE("PLAN.ZO2"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "VOITURE.SPR"); sprite_ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_animationManager.CHARGE_ANIM("PLAN"); + _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN"); v2 = 0; @@ -2978,7 +2978,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_fontManager.TEXTE_OFF(5); _vm->_fontManager.TEXTE_OFF(9); _vm->_globals.CLEAR_VBOB(); - _vm->_animationManager.CLEAR_ANIM(); + _vm->_animationManager.clearAnim(); _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); @@ -4205,8 +4205,8 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_soundManager.SPECIAL_SOUND = 198; PERSO_ON = true; _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.CLS_ANM = false; - _vm->_animationManager.PLAY_ANM("otage.ANM", 1, 24, 500); + _vm->_animationManager.clearAnimationFl = false; + _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); _vm->_animationManager.NO_SEQ = false; _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_globals.NECESSAIRE = true; @@ -5460,7 +5460,7 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) } if (_vm->_globals.SAUVEGARDE->data[v6] == 3) { _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_ANM("CREVE2.ANM", 100, 24, 500); + _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); _vm->_globals.SORTIE = 150; _vm->_graphicsManager.NOFADE = true; BOB_OFF(1); @@ -5517,7 +5517,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (!linkFile.empty()) INILINK(linkFile); if (!animFile.empty()) - _vm->_animationManager.CHARGE_ANIM(animFile); + _vm->_animationManager.loadAnim(animFile); _vm->_graphicsManager.VISU_ALL(); if (!s4.empty()) { if (!_vm->_globals.NOSPRECRAN) @@ -5546,7 +5546,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.ECRAN == 61) { - _vm->_animationManager.PLAY_SEQ("OUVRE.SEQ", 10, 4, 10); + _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); BOBANIM_OFF(3); _vm->_globals.NOT_VERIF = 1; g_old_x = XSPR(0); @@ -5620,7 +5620,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!linkFile.empty()) INILINK(linkFile); if (!animFile.empty()) { - _vm->_animationManager.CHARGE_ANIM(animFile); + _vm->_animationManager.loadAnim(animFile); _vm->_graphicsManager.VISU_ALL(); } if (!s4.empty()) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index e9eca6cb5d..4d4c0e27be 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -553,9 +553,9 @@ LABEL_1141: _vm->_graphicsManager.FADE_LINUX = 2; _vm->_graphicsManager.FADESPD = 1; if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE1A.ANM", 100, 18, 100); + _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); else if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE1.ANM", 100, 18, 100); + _vm->_animationManager.playAnim("BOMBE1.ANM", 100, 18, 100); } _vm->_graphicsManager.LOAD_IMAGE("BOMBEB"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -585,9 +585,9 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); _vm->_graphicsManager.NOFADE = true; @@ -600,9 +600,9 @@ LABEL_1141: _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); @@ -617,9 +617,9 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); @@ -632,9 +632,9 @@ LABEL_1141: _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM("BOMBE3.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE3.ANM", 50, 14, 500); else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM("BOMBE3A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); } _vm->_globals.SORTIE = 6; @@ -643,7 +643,7 @@ LABEL_1141: if (!_vm->_globals.internet) { memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); v1 = _vm->_graphicsManager.OLD_PAL[769]; - _vm->_animationManager.PLAY_ANM2("PLAN.ANM", 50, 10, 800); + _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } _vm->_globals.NBBLOC = 0; } @@ -705,10 +705,10 @@ LABEL_1141: } else { _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("HELICO.SEQ", 10, 4, 10); + _vm->_animationManager.playSequence2("HELICO.SEQ", 10, 4, 10); } - _vm->_animationManager.CHARGE_ANIM("otage"); + _vm->_animationManager.loadAnim("otage"); _vm->_graphicsManager.LOAD_IMAGE("IM05"); _vm->_graphicsManager.VISU_ALL(); @@ -734,10 +734,10 @@ LABEL_1141: if (!_vm->_globals.CENSURE) { _vm->_soundManager.SPECIAL_SOUND = 16; _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_ANM("EGORGE.ANM", 50, 28, 500); + _vm->_animationManager.playAnim("EGORGE.ANM", 50, 28, 500); _vm->_soundManager.SPECIAL_SOUND = 0; } - _vm->_animationManager.CHARGE_ANIM("ASCEN"); + _vm->_animationManager.loadAnim("ASCEN"); _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); _vm->_graphicsManager.VISU_ALL(); @@ -760,7 +760,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 14; _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("ASSOM.SEQ", 10, 4, 500); + _vm->_animationManager.playSequence2("ASSOM.SEQ", 10, 4, 500); _vm->_soundManager.SPECIAL_SOUND = 0; if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) @@ -787,7 +787,7 @@ LABEL_1141: } if (v76 == 37) { _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_SEQ2("corde.SEQ", 32, 32, 100); + _vm->_animationManager.playSequence2("corde.SEQ", 32, 32, 100); _vm->_graphicsManager.NOFADE = true; } if (v76 == 38) { @@ -795,10 +795,10 @@ LABEL_1141: _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); _vm->_soundManager.SPECIAL_SOUND = 17; - _vm->_animationManager.PLAY_SEQ("grenade.SEQ", 1, 32, 100); + _vm->_animationManager.playSequence("grenade.SEQ", 1, 32, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.PLAY_ANM("CREVE17.ANM", 24, 24, 200); + _vm->_animationManager.playAnim("CREVE17.ANM", 24, 24, 200); _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); @@ -1229,11 +1229,11 @@ LABEL_1141: if (v76 == 90) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_animationManager.PLAY_SEQ("CIB5A.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_animationManager.PLAY_SEQ("CIB5C.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB5C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); } @@ -1241,11 +1241,11 @@ LABEL_1141: if (v76 == 91) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField186]) { - _vm->_animationManager.PLAY_SEQ("CIB5B.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { - _vm->_animationManager.PLAY_SEQ("CIB5D.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB5D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); } @@ -1253,11 +1253,11 @@ LABEL_1141: if (v76 == 92) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_animationManager.PLAY_SEQ("CIB6A.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_animationManager.PLAY_SEQ("CIB6C.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB6C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); } @@ -1265,11 +1265,11 @@ LABEL_1141: if (v76 == 93) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals.SAUVEGARDE->data[svField184]) { - _vm->_animationManager.PLAY_SEQ("CIB6B.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { - _vm->_animationManager.PLAY_SEQ("CIB6D.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("CIB6D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); } @@ -1478,7 +1478,7 @@ LABEL_1141: if (v76 == 210) { _vm->_animationManager.NO_SEQ = true; _vm->_soundManager.SPECIAL_SOUND = 210; - _vm->_animationManager.PLAY_SEQ2("SECRET1.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); _vm->_objectsManager.BOBANIM_ON(9); @@ -1500,7 +1500,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_globals.NO_VISU = false; _vm->_soundManager.SPECIAL_SOUND = 211; - _vm->_animationManager.PLAY_SEQ("SECRET2.SEQ", 1, 12, 100); + _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager.NOFADE = true; @@ -1525,7 +1525,7 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; _vm->_eventsManager.NOESC = true; - _vm->_animationManager.PLAY_SEQ("SORT.SEQ", 10, 4, 10); + _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); _vm->_eventsManager.NOESC = false; _vm->_soundManager.SPECIAL_SOUND = 0; } @@ -1702,7 +1702,7 @@ LABEL_1141: } if (v76 == 229) { _vm->_soundManager.SPECIAL_SOUND = 229; - _vm->_animationManager.PLAY_SEQ("MUR.SEQ", 1, 12, 1); + _vm->_animationManager.playSequence("MUR.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); } @@ -1997,7 +1997,7 @@ LABEL_1141: _vm->_fontManager.TEXTE_OFF(9); _vm->_graphicsManager.FIN_VISU(); _vm->_graphicsManager.LOAD_IMAGE("IM20f"); - _vm->_animationManager.CHARGE_ANIM("ANIM20f"); + _vm->_animationManager.loadAnim("ANIM20f"); _vm->_graphicsManager.VISU_ALL(); _vm->_eventsManager.MOUSE_OFF(); _vm->_graphicsManager.FADE_INW(); @@ -2093,9 +2093,9 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); _vm->_globals.NOPARLE = false; if (_vm->_globals.SVGA == 1) - _vm->_animationManager.PLAY_ANM2("T421.ANM", 100, 14, 500); + _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.PLAY_ANM2("T421a.ANM", 100, 14, 500); + _vm->_animationManager.playAnim2("T421a.ANM", 100, 14, 500); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); @@ -2157,7 +2157,7 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.PLAY_SEQ("RESU.SEQ", 2, 24, 2); + _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); _vm->_animationManager.NO_SEQ = false; } else { _vm->_objectsManager.OPTI_ONE(7, 0, 14, 0); @@ -2166,7 +2166,7 @@ LABEL_1141: if (v76 == 242) { _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.PLAY_SEQ("RESUF.SEQ", 1, 24, 1); + _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; CharacterLocation *v53 = &_vm->_globals.SAUVEGARDE->samantha; v53->xp = 404; @@ -2202,7 +2202,7 @@ LABEL_1141: _vm->_objectsManager.PERSO_ON = true; _vm->_graphicsManager.NB_SCREEN(); _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.PLAY_SEQ2("TUNNEL.SEQ", 1, 18, 20); + _vm->_animationManager.playSequence2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 6c01051d60..d42590f593 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -166,7 +166,7 @@ void SoundManager::LOAD_ANM_SOUND() { } } -void SoundManager::PLAY_ANM_SOUND(int soundNumber) { +void SoundManager::playAnim_SOUND(int soundNumber) { if (!_vm->_globals.CENSURE && SPECIAL_SOUND == 2) { switch (soundNumber) { case 20: diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 84bae1deca..206bea89e3 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -142,7 +142,7 @@ public: void WSOUND_INIT(); void VERIF_SOUND(); void LOAD_ANM_SOUND(); - void PLAY_ANM_SOUND(int soundNumber); + void playAnim_SOUND(int soundNumber); void LOAD_WAV(const Common::String &file, int wavIndex); void WSOUND(int soundNumber); void WSOUND_OFF(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 5cb1147169..8aa3fcd090 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -140,7 +140,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v7 = DIALOGUE_REP(v6++); while (v7 != -1); } - CLEAR_ANIM_PERSO(); + clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); @@ -832,37 +832,37 @@ void TalkManager::ANIM_PERSO_INIT() { v1 = BUFFERPERSO + 110; v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); if (v2) - RECHERCHE_ANIM_PERSO(21, (BUFFERPERSO + 110), v2, TAILLEPERSO); + searchCharacterAnim(21, (BUFFERPERSO + 110), v2, TAILLEPERSO); v4 = (int16)READ_LE_UINT16((uint16 *)v0 + 44); if (v4) - RECHERCHE_ANIM_PERSO(22, v1, v4, TAILLEPERSO); + searchCharacterAnim(22, v1, v4, TAILLEPERSO); v5 = (int16)READ_LE_UINT16((uint16 *)v0 + 45); if (v5) - RECHERCHE_ANIM_PERSO(23, v1, v5, TAILLEPERSO); + searchCharacterAnim(23, v1, v5, TAILLEPERSO); v6 = (int16)READ_LE_UINT16((uint16 *)v0 + 46); if (v6) - RECHERCHE_ANIM_PERSO(24, v1, v6, TAILLEPERSO); + searchCharacterAnim(24, v1, v6, TAILLEPERSO); v7 = (int16)READ_LE_UINT16((uint16 *)v0 + 47); if (v7) - RECHERCHE_ANIM_PERSO(25, v1, v7, TAILLEPERSO); + searchCharacterAnim(25, v1, v7, TAILLEPERSO); v8 = (int16)READ_LE_UINT16((uint16 *)v0 + 48); if (v8) - RECHERCHE_ANIM_PERSO(26, v1, v8, TAILLEPERSO); + searchCharacterAnim(26, v1, v8, TAILLEPERSO); v9 = (int16)READ_LE_UINT16((uint16 *)v0 + 49); if (v9) - RECHERCHE_ANIM_PERSO(27, v1, v9, TAILLEPERSO); + searchCharacterAnim(27, v1, v9, TAILLEPERSO); v10 = (int16)READ_LE_UINT16((uint16 *)v0 + 50); if (v10) - RECHERCHE_ANIM_PERSO(28, v1, v10, TAILLEPERSO); + searchCharacterAnim(28, v1, v10, TAILLEPERSO); v11 = (int16)READ_LE_UINT16((uint16 *)v0 + 51); if (v11) - RECHERCHE_ANIM_PERSO(29, v1, v11, TAILLEPERSO); + searchCharacterAnim(29, v1, v11, TAILLEPERSO); v12 = (int16)READ_LE_UINT16((uint16 *)v0 + 52); if (v12) - RECHERCHE_ANIM_PERSO(30, v1, v12, TAILLEPERSO); + searchCharacterAnim(30, v1, v12, TAILLEPERSO); } -void TalkManager::CLEAR_ANIM_PERSO() { +void TalkManager::clearCharacterAnim() { for (int idx = 21; idx <= 34; ++idx) { if (_vm->_globals.Bqe_Anim[idx].data != g_PTRNUL) _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); @@ -872,7 +872,7 @@ void TalkManager::CLEAR_ANIM_PERSO() { } } -bool TalkManager::RECHERCHE_ANIM_PERSO(int a1, const byte *bufPerso, int a3, int a4) { +bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int a4) { bool result; const byte *v5; int v6; @@ -1291,8 +1291,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { } while (!_vm->_globals.SORTIE); FIN_VISU_PARLE(); FIN_VISU_WAIT(); - CLEAR_ANIM_PERSO(); - CLEAR_ANIM_PERSO(); + clearCharacterAnim(); + clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 3c13bf81d4..3b0ec674ff 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -63,8 +63,8 @@ public: void BOB_VISU_PARLE(int idx); void CHERCHE_ANIM0(int a1, int a2); void ANIM_PERSO_INIT(); - void CLEAR_ANIM_PERSO(); - bool RECHERCHE_ANIM_PERSO(int a1, const byte *a2, int a3, int a4); + void clearCharacterAnim(); + bool searchCharacterAnim(int a1, const byte *a2, int a3, int a4); void REPONSE(int a1, int a2); void REPONSE2(int a1, int a2); void OBJET_VIVANT(const Common::String &a2); -- cgit v1.2.3 From 663bf3139f5091b61f2c9f43b90ffe31793dece1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Dec 2012 00:23:51 +0100 Subject: HOPKINS: Rename (most of) ComputerManager functions --- engines/hopkins/anim.cpp | 4 +- engines/hopkins/anim.h | 2 +- engines/hopkins/computer.cpp | 705 ++++++++++++++++++++++++------------------- engines/hopkins/computer.h | 160 +++------- engines/hopkins/hopkins.cpp | 38 +-- engines/hopkins/objects.cpp | 2 +- 6 files changed, 455 insertions(+), 456 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 441721e141..984163005a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -34,7 +34,7 @@ namespace Hopkins { AnimationManager::AnimationManager() { - clearAnimationFl = false; + _clearAnimationFl = false; NO_SEQ = false; NO_COUL = false; } @@ -72,7 +72,7 @@ LABEL_2: f.skip(14); f.read(v10, nbytes); - if (clearAnimationFl == true) { + if (_clearAnimationFl) { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 8b7c9d7912..1c7c97b89f 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -37,7 +37,7 @@ private: int loadSpriteBank(int idx, const Common::String &filename); public: HopkinsEngine *_vm; - bool clearAnimationFl; + bool _clearAnimationFl; bool NO_SEQ; bool NO_COUL; public: diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index bc90074d18..f5646d6168 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -34,38 +34,42 @@ namespace Hopkins { ComputerManager::ComputerManager() { for (int i = 0; i < 50; i++) { - MenuText[i]._actvFl = false; - MenuText[i]._lineSize = 0; - memset(MenuText[i]._line, 0, 90); + _menuText[i]._actvFl = false; + _menuText[i]._lineSize = 0; + memset(_menuText[i]._line, 0, 90); } - Common::fill(&Sup_string[0], &Sup_string[200], '\0'); - CASSESPR = NULL; - FMOUSE = false; - TEXT_COL = 0; - CASSETAB = 0; - NBBRIQUES = 0; - CASSESCORE = 0; - CASSEVIE = 0; - CASSESPEED = 0; - BALLEHORI = 0; - BALLEVERTI = 0; - NB_TABLE = 0; + Common::fill(&_inputBuf[0], &_inputBuf[200], '\0'); + _breakoutSpr = NULL; + _textColor = 0; + _breakoutLevel = NULL; + _breakoutBrickNbr = 0; + _breakoutScore = 0; + _breakoutLifes = 0; + _breakoutSpeed = 0; + _ballRightFl = false; + _ballUpFl = false; + _breakoutLevelNbr = 0; RAQX = 0; CASSEP1 = 0; CASSEP2 = 0; CASSDER = 0; - Menu_lignes = 0; } void ComputerManager::setParent(HopkinsEngine *vm) { _vm = vm; } -void ComputerManager::setvideomode() { - TEXT_MODE(); +/** + * Sets up textual entry mode. Used by the code for Hopkins computer. + */ +void ComputerManager::setVideoMode() { + setTextMode(); } -void ComputerManager::TEXT_MODE() { +/** + * Sets up Textual entry mode + */ +void ComputerManager::setTextMode() { _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); @@ -80,25 +84,41 @@ void ComputerManager::TEXT_MODE() { _vm->_globals.police_h = 8; _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); _vm->_graphicsManager.FADE_INW(); - Charge_Menu(); + loadMenu(); _vm->_eventsManager.souris_flag = false; } -void ComputerManager::clearscreen() { +/** + * Clear the screen + */ +void ComputerManager::clearScreen() { _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); _vm->_graphicsManager.FADE_INW(); } -void ComputerManager::settextcolor(int col) { - TEXT_COL = col; +/** + * Sets the text mode color + */ +void ComputerManager::setTextColor(int col) { + _textColor = col; } -void ComputerManager::settextposition(int yp, int xp) { +/** + * Sets the text position. + * @param yp Y position + * @param xp X position + * @remarks Yes, the reverse co-ordinate pair is really like that in the original game. + */ +void ComputerManager::setTextPosition(int yp, int xp) { _textPosition.x = xp << 3; _textPosition.y = yp << 4; } -void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { +/** + * Show a computer in the FBI office + * @param mode Which computer to display + */ +void ComputerManager::showComputer(ComputerEnum mode) { bool passwordMatch; char *v3; char s[12]; @@ -107,30 +127,30 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_eventsManager.ESC_KEY = 0; passwordMatch = false; _vm->_graphicsManager.RESET_SEGMENT_VESA(); - setvideomode(); - settextcolor(4); + setVideoMode(); + setTextColor(4); _vm->_eventsManager.videkey(); - settextposition(2, 4); + setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) - outtext(Common::String(MenuText[0]._line)); - if (mode == COMPUTER_SAMANTHAS) - outtext(Common::String(MenuText[1]._line)); - if (mode == COMPUTER_PUBLIC) - outtext(Common::String(MenuText[2]._line)); + outText(Common::String(_menuText[0]._line)); + else if (mode == COMPUTER_SAMANTHAS) + outText(Common::String(_menuText[1]._line)); + else if (mode == COMPUTER_PUBLIC) + outText(Common::String(_menuText[2]._line)); - settextcolor(1); + setTextColor(1); if (mode == COMPUTER_PUBLIC) { - settextposition(10, 8); - outtext(Common::String(MenuText[3]._line)); + setTextPosition(10, 8); + outText(Common::String(_menuText[3]._line)); } - settextposition(12, 28); - outtext(Common::String(MenuText[4]._line)); - settextposition(14, 35); + setTextPosition(12, 28); + outText(Common::String(_menuText[4]._line)); + setTextPosition(14, 35); memset(s, 0, 12); TXT4(280, 224, 8); - strcpy(s, Sup_string); + strcpy(s, _inputBuf); v3 = &s[0]; if (mode == COMPUTER_HOPKINS) { @@ -145,8 +165,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { } while (v5); if (v5) passwordMatch = true; - } - if (mode == COMPUTER_SAMANTHAS) { + } else if (mode == COMPUTER_SAMANTHAS) { char *v6 = &s[0]; s2 = "328MHZA"; int v7 = 8; @@ -159,8 +178,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { } while (v8); if (v8) passwordMatch = true; - } - if (mode == COMPUTER_PUBLIC) { + } else if (mode == COMPUTER_PUBLIC) { char *v9 = &s[0]; s2 = "ALLFREE"; int v10 = 8; @@ -174,48 +192,48 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { if (v11) passwordMatch = true; } + if (passwordMatch) { while (!_vm->shouldQuit()) { _vm->_eventsManager.ESC_KEY = false; _vm->_eventsManager.videkey(); - clearscreen(); - settextcolor(4); - settextposition(2, 4); + clearScreen(); + setTextColor(4); + setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) - outtext(Common::String(MenuText[0]._line)); - if (mode == COMPUTER_SAMANTHAS) - outtext(Common::String(MenuText[1]._line)); - if (mode == COMPUTER_PUBLIC) - outtext(Common::String(MenuText[2]._line)); - settextcolor(15); - settextposition(8, 25); - settextcolor(15); - outtext2(Common::String(MenuText[6]._line)); - settextposition(20, 25); - outtext2(Common::String(MenuText[7]._line)); + outText(Common::String(_menuText[0]._line)); + else if (mode == COMPUTER_SAMANTHAS) + outText(Common::String(_menuText[1]._line)); + else if (mode == COMPUTER_PUBLIC) + outText(Common::String(_menuText[2]._line)); + setTextColor(15); + setTextPosition(8, 25); + setTextColor(15); + outText2(Common::String(_menuText[6]._line)); + setTextPosition(20, 25); + outText2(Common::String(_menuText[7]._line)); if (mode == COMPUTER_HOPKINS) { - settextposition(10, 25); - outtext2(Common::String(MenuText[8]._line)); - settextposition(12, 25); - outtext2(Common::String(MenuText[9]._line)); - settextposition(14, 25); - outtext2(Common::String(MenuText[10]._line)); - settextposition(16, 25); - outtext2(Common::String(MenuText[11]._line)); - } - if (mode == COMPUTER_SAMANTHAS) { + setTextPosition(10, 25); + outText2(Common::String(_menuText[8]._line)); + setTextPosition(12, 25); + outText2(Common::String(_menuText[9]._line)); + setTextPosition(14, 25); + outText2(Common::String(_menuText[10]._line)); + setTextPosition(16, 25); + outText2(Common::String(_menuText[11]._line)); + } else if (mode == COMPUTER_SAMANTHAS) { _vm->_eventsManager.videkey(); - settextposition(10, 25); -// outtext2(Common::String(MenuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy - outtext2(Common::String(MenuText[12]._line)); - settextposition(12, 25); - outtext2(Common::String(MenuText[13]._line)); - settextposition(14, 25); - outtext2(Common::String(MenuText[14]._line)); - settextposition(16, 25); - outtext2(Common::String(MenuText[15]._line)); - settextposition(18, 25); - outtext2(Common::String(MenuText[16]._line)); + setTextPosition(10, 25); +// outText2(Common::String(_menuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy + outText2(Common::String(_menuText[12]._line)); + setTextPosition(12, 25); + outText2(Common::String(_menuText[13]._line)); + setTextPosition(14, 25); + outText2(Common::String(_menuText[14]._line)); + setTextPosition(16, 25); + outText2(Common::String(_menuText[15]._line)); + setTextPosition(18, 25); + outText2(Common::String(_menuText[16]._line)); } bool numericFlag = false; @@ -234,38 +252,38 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { break; // 1 - Games if (v12 == '1') { - GAMES(); + displayGamesSubMenu(); } else if (mode == COMPUTER_HOPKINS) { _vm->_eventsManager.videkey(); - clearscreen(); - settextcolor(4); - settextposition(2, 4); - outtext(Common::String(MenuText[0]._line)); - settextcolor(15); + clearScreen(); + setTextColor(4); + setTextPosition(2, 4); + outText(Common::String(_menuText[0]._line)); + setTextColor(15); if (v12 == 50) - LIT_TEXTE(1); + readText(1); if (v12 == 51) - LIT_TEXTE(2); + readText(2); if (v12 == 52) - LIT_TEXTE(3); + readText(3); if (v12 == 53) - LIT_TEXTE(4); + readText(4); } else if (mode == COMPUTER_SAMANTHAS) { - clearscreen(); - settextcolor(4); - settextposition(2, 4); - outtext(Common::String(MenuText[1]._line)); - settextcolor(15); + clearScreen(); + setTextColor(4); + setTextPosition(2, 4); + outText(Common::String(_menuText[1]._line)); + setTextColor(15); if (v12 == 50) - LIT_TEXTE(6); + readText(6); if (v12 == 51) - LIT_TEXTE(7); + readText(7); if (v12 == 52) - LIT_TEXTE(8); + readText(8); if (v12 == 53) - LIT_TEXTE(9); + readText(9); if (v12 == 54) { - LIT_TEXTE(10); + readText(10); _vm->_globals.SAUVEGARDE->data[svField270] = 4; } } @@ -274,12 +292,12 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); - RESTORE_POLICE(); + restoreFBIRoom(); } else { // Access Denied - settextcolor(4); - settextposition(16, 25); - outtext(Common::String(MenuText[5]._line)); + setTextColor(4); + setTextPosition(16, 25); + outText(Common::String(_menuText[5]._line)); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(1000); @@ -288,7 +306,7 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); - RESTORE_POLICE(); + restoreFBIRoom(); _vm->_eventsManager.MOUSE_OFF(); } if (mode == 1) @@ -299,7 +317,10 @@ void ComputerManager::COMPUT_HOPKINS(ComputerEnum mode) { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } -void ComputerManager::Charge_Menu() { +/** + * Load Menu data + */ +void ComputerManager::loadMenu() { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); byte *ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); byte *tmpPtr = ptr; @@ -313,22 +334,21 @@ void ComputerManager::Charge_Menu() { loopCond = true; goto LABEL_13; } - MenuText[lineNum]._actvFl = 1; + _menuText[lineNum]._actvFl = 1; strPos = 0; for (;;) { byte curChar = tmpPtr[strPos + 2]; if (curChar == '%' || curChar == 10) break; - MenuText[lineNum]._line[strPos++] = curChar; + _menuText[lineNum]._line[strPos++] = curChar; if (strPos > 89) goto LABEL_11; } - MenuText[lineNum]._line[strPos] = 0; - MenuText[lineNum]._lineSize = strPos - 1; + _menuText[lineNum]._line[strPos] = 0; + _menuText[lineNum]._lineSize = strPos - 1; LABEL_11: ++lineNum; } - Menu_lignes = lineNum; LABEL_13: tmpPtr = tmpPtr + 1; } while (!loopCond); @@ -433,7 +453,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { // BackSpace if (curChar == 8 && textIndex > 0) { - Sup_string[textIndex--] = 0; + _inputBuf[textIndex--] = 0; x1 -= _vm->_globals.police_l; x2 = x1 + 2 * _vm->_globals.police_l; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); @@ -444,7 +464,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { newChar = mappedChar; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); - Sup_string[textIndex] = newChar; + _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); _vm->_fontManager.TEXT_NOW(x1, yp, charString, -4); @@ -459,19 +479,28 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); _vm->_eventsManager.VBL(); - Sup_string[textIndex] = 0; + _inputBuf[textIndex] = 0; _vm->_eventsManager.souris_flag = oldMouseFlag; } -void ComputerManager::outtext(const Common::String &msg) { - _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, TEXT_COL); +/** + * Outputs a text string + */ +void ComputerManager::outText(const Common::String &msg) { + _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, _textColor); } -void ComputerManager::outtext2(const Common::String &msg) { - _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, TEXT_COL); +/** + * Outputs a text string + */ +void ComputerManager::outText2(const Common::String &msg) { + _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, _textColor); } -void ComputerManager::RESTORE_POLICE() { +/** + * Restores the scene for the FBI headquarters room + */ +void ComputerManager::restoreFBIRoom() { _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FONTE3.SPR"); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -481,7 +510,10 @@ void ComputerManager::RESTORE_POLICE() { _vm->_eventsManager.souris_flag = true; } -void ComputerManager::LIT_TEXTE(int a1) { +/** + * Display texts for the given menu entry + */ +void ComputerManager::readText(int idx) { uint16 v1; int v2; uint16 v3; @@ -515,7 +547,7 @@ void ComputerManager::LIT_TEXTE(int a1) { numStr = Common::String::format("%c%c", *(ptr + v3 + 1), *(ptr + v3 + 2)); num = atol(numStr.c_str()); - if (num == a1) + if (num == idx) v2 = 1; } if (v2 == 1) @@ -537,8 +569,8 @@ void ComputerManager::LIT_TEXTE(int a1) { // v12[v7] = 0; // v7 = 0; v8 = v4; - settextposition(v6, v5); - outtext(v12); + setTextPosition(v6, v5); + outText(v12); ++v6; v5 = 1; @@ -558,23 +590,26 @@ void ComputerManager::LIT_TEXTE(int a1) { _vm->_globals.dos_free2(ptr); } -void ComputerManager::GAMES() { +/** + * Display breakout when Games sub-menu is selected + */ +void ComputerManager::displayGamesSubMenu() { const byte *v1 = _vm->_objectsManager.Sprite[0].spriteData; uint oldSpeed = _vm->_globals.vitesse; _vm->_globals.vitesse = 1; _vm->_eventsManager.CHANGE_MOUSE(0); - CASSESPR = g_PTRNUL; + _breakoutSpr = g_PTRNUL; _vm->_eventsManager.CASSE = true; _vm->_eventsManager.CASSE_SOURIS_ON(); - CASSETAB = (int16 *)g_PTRNUL; - NBBRIQUES = 0; - CASSESCORE = 0; - CASSEVIE = 5; - CASSESPEED = 1; - BALLEHORI = 0; - BALLEVERTI = 0; - NB_TABLE = 0; + _breakoutLevel = (int16 *)g_PTRNUL; + _breakoutBrickNbr = 0; + _breakoutScore = 0; + _breakoutLifes = 5; + _breakoutSpeed = 1; + _ballRightFl = false; + _ballUpFl = false; + _breakoutLevelNbr = 0; _vm->_graphicsManager.min_y = 0; _vm->_graphicsManager.max_x = 320; _vm->_graphicsManager.max_y = 200; @@ -582,16 +617,16 @@ void ComputerManager::GAMES() { _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "CASSE.SPR"); - CASSESPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - CHARGE_SCORE(); - MODE_VGA256(); - NEWTAB(); + _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + loadHiscore(); + setModeVGA256(); + newLevel(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - PLAY_BRIQUE(); + playBreakout(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - CASSESPR = _vm->_globals.LIBERE_FICHIER(CASSESPR); - _vm->_globals.dos_free2((byte *)CASSETAB); - CASSETAB = (int16 *)g_PTRNUL; + _breakoutSpr = _vm->_globals.LIBERE_FICHIER(_breakoutSpr); + _vm->_globals.dos_free2((byte *)_breakoutLevel); + _breakoutLevel = (int16 *)g_PTRNUL; _vm->_objectsManager.Sprite[0].spriteData = v1; _vm->_soundManager.DEL_SAMPLE(1); @@ -600,15 +635,18 @@ void ComputerManager::GAMES() { _vm->_globals.vitesse = oldSpeed; _vm->_eventsManager.CASSE = false; _vm->_eventsManager.CASSE_SOURIS_OFF(); - setvideomode(); - settextcolor(15); - clearscreen(); + setVideoMode(); + setTextColor(15); + clearScreen(); _vm->_graphicsManager.max_x = 680; _vm->_graphicsManager.min_y = 0; _vm->_graphicsManager.max_y = 460; } -void ComputerManager::CHARGE_SCORE() { +/** + * Load Highscore from file + */ +void ComputerManager::loadHiscore() { char nextChar; byte *ptr; @@ -621,22 +659,25 @@ void ComputerManager::CHARGE_SCORE() { nextChar = *(ptr + i + (16 * scoreIndex)); if (!nextChar) nextChar = ' '; - Score[scoreIndex].name += nextChar; + _score[scoreIndex]._name += nextChar; } for (int i = 0; i < 9; ++i) { nextChar = *(ptr + i + scoreIndex * 16 + 6); if (!nextChar) nextChar = '0'; - Score[scoreIndex].score += nextChar; + _score[scoreIndex]._score += nextChar; } } _vm->_globals.dos_free2(ptr); - CASSE_HISCORE = atol(Score[5].score.c_str()); + _breakoutHiscore = atol(_score[5]._score.c_str()); } -void ComputerManager::MODE_VGA256() { +/** + * VGA 256 col + */ +void ComputerManager::setModeVGA256() { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); @@ -644,57 +685,62 @@ void ComputerManager::MODE_VGA256() { _vm->_graphicsManager.SCANLINE(0x140u); } -void ComputerManager::NEWTAB() { +/** + * Load new level + */ +void ComputerManager::newLevel() { Common::String file; Common::File f; _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.SPRITE_OFF(1); - ++CASSEVIE; - if (CASSEVIE > 11) - CASSEVIE = 11; + ++_breakoutLifes; + if (_breakoutLifes > 11) + _breakoutLifes = 11; _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); - AFF_VIE(); - if (CASSETAB != (int16 *)g_PTRNUL) { - _vm->_globals.dos_free2((byte *)CASSETAB); - CASSETAB = (int16 *)g_PTRNUL; + displayLifes(); + if (_breakoutLevel != (int16 *)g_PTRNUL) { + _vm->_globals.dos_free2((byte *)_breakoutLevel); + _breakoutLevel = (int16 *)g_PTRNUL; } - ++NB_TABLE; + ++_breakoutLevelNbr; while (!_vm->shouldQuit()) { - file = Common::String::format("TAB%d.TAB", NB_TABLE); + file = Common::String::format("TAB%d.TAB", _breakoutLevelNbr); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, file); if (f.open(_vm->_globals.NFICHIER)) break; - NB_TABLE = 1; + _breakoutLevelNbr = 1; } f.close(); - CASSETAB = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - AFF_BRIQUES(); - _vm->_objectsManager.SPRITE(CASSESPR, 150, 192, 0, 13, 0, 0, 0, 0); - _vm->_objectsManager.SPRITE(CASSESPR, 164, 187, 1, 14, 0, 0, 0, 0); - BALLE = Common::Point(164, 187); + _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + displayBricks(); + _vm->_objectsManager.SPRITE(_breakoutSpr, 150, 192, 0, 13, 0, 0, 0, 0); + _vm->_objectsManager.SPRITE(_breakoutSpr, 164, 187, 1, 14, 0, 0, 0, 0); + _ballPosition = Common::Point(164, 187); RAQX = 150; _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.SPRITE_ON(1); _vm->_eventsManager.MOUSE_ON1(); - FMOUSE = true; _vm->_soundManager.PLAY_SAMPLE(3, 5); } -void ComputerManager::AFF_BRIQUES() { +/** + * Display bricks in breakout game + */ +void ComputerManager::displayBricks() { int xp; int yp; int v2; uint16 v3; int16 *v4; - NBBRIQUES = 0; - CASSESPEED = 1; - v4 = CASSETAB; + _breakoutBrickNbr = 0; + _breakoutSpeed = 1; + v4 = _breakoutLevel; v3 = 0; do { xp = v4[v3]; @@ -702,38 +748,41 @@ void ComputerManager::AFF_BRIQUES() { v2 = v4[v3 + 4]; if (xp != -1) { if (v2 <= 6) - ++NBBRIQUES; + ++_breakoutBrickNbr; if (v2 == 3) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 17); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 17); else if (v2 == 6) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 18); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 18); else if (v2 == 5) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 19); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 19); else if (v2 == 4) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 20); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 20); else if (v2 == 1) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 21); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 21); else if (v2 == 2) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 22); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 22); else if (v2 == 31) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, xp, yp, 23); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 23); } v3 += 6; } while (xp != -1); - IMPRIMESCORE(); + displayScore(); } -void ComputerManager::AFF_VIE() { +/** + * Display Lifes in breakout game + */ +void ComputerManager::displayLifes() { int v3; int v4; - int v0 = CASSEVIE - 1; + int v0 = _breakoutLifes - 1; int v1 = 10; - for (int v2 = 0; v2 <= 11; v2++) { - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, 10, 15); + for (int i = 0; i <= 11; i++) { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v1, 10, 15); v1 += 7; } @@ -742,7 +791,7 @@ void ComputerManager::AFF_VIE() { v4 = 0; if (v0 > 0) { do { - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v3, 10, 14); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v3, 10, 14); v3 += 7; ++v4; } while (v4 < v0); @@ -750,7 +799,10 @@ void ComputerManager::AFF_VIE() { } } -void ComputerManager::PLAY_BRIQUE() { +/** + * Main function for breakout game + */ +void ComputerManager::playBreakout() { int v1 = 0; int v; @@ -758,9 +810,9 @@ void ComputerManager::PLAY_BRIQUE() { while (!_vm->shouldQuit()) { // Set up the racket and ball _vm->_eventsManager.MOUSE_OFF(); - BALLE = Common::Point(RAQX + 14, 187); + _ballPosition = Common::Point(RAQX + 14, 187); _vm->_objectsManager.SETYSPR(1, 187); - _vm->_objectsManager.SETXSPR(1, BALLE.x); + _vm->_objectsManager.SETXSPR(1, _ballPosition.x); _vm->_graphicsManager.RESET_SEGMENT_VESA(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.FADE_IN_CASSE(); @@ -778,10 +830,10 @@ void ComputerManager::PLAY_BRIQUE() { _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); - CASSESPEED = 1; - BALLE = Common::Point(RAQX + 14, 187); - BALLEHORI = RAQX > 135; - BALLEVERTI = 0; + _breakoutSpeed = 1; + _ballPosition = Common::Point(RAQX + 14, 187); + _ballRightFl = (RAQX > 135); + _ballUpFl = false; // Play loop do { @@ -793,53 +845,57 @@ void ComputerManager::PLAY_BRIQUE() { if (RAQX > 282) RAQX = 282; _vm->_objectsManager.SETXSPR(0, RAQX); - v1 = DEP_BALLE(); + v1 = moveBall(); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && !v1); if (v1 != 1) break; _vm->_graphicsManager.FADE_OUT_CASSE(); - --CASSEVIE; + --_breakoutLifes; - if (CASSEVIE) { - AFF_VIE(); - if (CASSEVIE) + if (_breakoutLifes) { + displayLifes(); + if (_breakoutLifes) continue; } _vm->_eventsManager.MOUSE_ON1(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.SPRITE_OFF(1); - if (CASSESCORE > CASSE_HISCORE) - NAME_SCORE(); - v = HIGHT_SCORE(); + if (_breakoutScore > _breakoutHiscore) + getScoreName(); + v = displayHiscores(); if (v != 1) break; - NBBRIQUES = 0; - CASSESCORE = 0; - CASSEVIE = 4; - CASSESPEED = 1; - BALLEHORI = 0; - BALLEVERTI = 0; - NB_TABLE = 0; - CHARGE_SCORE(); - NEWTAB(); + _breakoutBrickNbr = 0; + _breakoutScore = 0; + _breakoutLifes = 4; + _breakoutSpeed = 1; + _ballRightFl = false; + _ballUpFl = false; + _breakoutLevelNbr = 0; + loadHiscore(); + newLevel(); } if (v1 != 2) return; _vm->_graphicsManager.FADE_OUT_CASSE(); - NEWTAB(); + newLevel(); } } -int ComputerManager::HIGHT_SCORE() { +/** + * Show the high scores for the Breakout game + * @return The selected button index: 1 = Game, 2 = Quit + */ +int ComputerManager::displayHiscores() { int yp; int buttonIndex; int xp; byte *ptr; _vm->_graphicsManager.RESET_SEGMENT_VESA(); - CHARGE_SCORE(); + loadHiscore(); _vm->_graphicsManager.LOAD_IMAGEVGA("HISCORE.PCX"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -855,11 +911,11 @@ int ComputerManager::HIGHT_SCORE() { // Display the characters of the name for (int i = 0; i <= 5; i++) - PRINT_HSCORE(ptr, 9 * i + 69, yp, Score[scoreIndex].name[i]); + displayHiscoreLine(ptr, 9 * i + 69, yp, _score[scoreIndex]._name[i]); // Display the digits of the score for (int i = 0; i <= 8; i++) - PRINT_HSCORE(ptr, 9 * i + 199, yp, Score[scoreIndex].score[i]); + displayHiscoreLine(ptr, 9 * i + 199, yp, _score[scoreIndex]._score[i]); } _vm->_graphicsManager.FADE_IN_CASSE(); @@ -884,7 +940,10 @@ int ComputerManager::HIGHT_SCORE() { return buttonIndex; } -void ComputerManager::NAME_SCORE() { +/** + * Display a screen to enter player name in the case of a new hiscore + */ +void ComputerManager::getScoreName() { char curChar; byte *ptr; @@ -897,7 +956,7 @@ void ComputerManager::NAME_SCORE() { ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_graphicsManager.FADE_IN_CASSE(); for (int strPos = 0; strPos <= 4; strPos++) { - PRINT_HSCORE(ptr, 9 * strPos + 140, 78, 1); + displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); curChar = toupper(_vm->_eventsManager.keywin()); if ((curChar <= '/') || (curChar > 'Z')) @@ -905,38 +964,41 @@ void ComputerManager::NAME_SCORE() { if ((uint16)(curChar - ':') <= 6u) curChar = ' '; - Score[5].name.setChar(curChar, strPos); - PRINT_HSCORE(ptr, 9 * strPos + 140, 78, curChar); + _score[5]._name.setChar(curChar, strPos); + displayHiscoreLine(ptr, 9 * strPos + 140, 78, curChar); for (int idx = 0; idx < 12; ++idx) _vm->_eventsManager.VBL(); } - Score[5].score = " "; + _score[5]._score = " "; char score[16]; - sprintf(score, "%d", CASSESCORE); + sprintf(score, "%d", _breakoutScore); int scoreLen = 0; do ++scoreLen; while (score[scoreLen]); int scorePos = 8; - for (int i = scoreLen; ; Score[5].score.setChar(score[i], scorePos--)) { + for (int i = scoreLen; ; _score[5]._score.setChar(score[i], scorePos--)) { --i; if (i <= -1) break; } _vm->_graphicsManager.FADE_OUT_CASSE(); _vm->_globals.dos_free2(ptr); - SAUVE_SCORE(); + saveScore(); } -void ComputerManager::IMPRIMESCORE() { +/** + * Display current score + */ +void ComputerManager::displayScore() { int16 v0; int16 v1; int16 i; char s[40]; - sprintf(s, "%d", CASSESCORE); + sprintf(s, "%d", _breakoutScore); v0 = 0; do ++v0; @@ -950,11 +1012,9 @@ void ComputerManager::IMPRIMESCORE() { } void ComputerManager::IMPSCORE(int a1, int a2) { - int16 v2; - int16 v3; + int16 v2 = 203; + int16 v3 = 3; - v2 = 203; - v3 = 3; if (a1 == 1) v2 = 193; if (a1 == 2) @@ -985,10 +1045,13 @@ void ComputerManager::IMPSCORE(int a1, int a2) { v3 = 11; if (a2 == 57) v3 = 12; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v2 - 3, 11, v3); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v2 - 3, 11, v3); } -void ComputerManager::SAUVE_SCORE() { +/** + * Save Hiscore in file + */ +void ComputerManager::saveScore() { int v1; int v2; int v4; @@ -1002,7 +1065,7 @@ void ComputerManager::SAUVE_SCORE() { int v17[6]; for (int v0 = 0; v0 <= 5; v0++) { - v1 = atol(Score[v0].score.c_str()); + v1 = atol(_score[v0]._score.c_str()); v17[v0] = v1; if (!v1) v17[v0] = 5; @@ -1031,7 +1094,7 @@ void ComputerManager::SAUVE_SCORE() { v6 = 16 * v5; v14 = v16[v5]; for (int v7 = 0; v7 <= 4; v7++) { - v8 = Score[v14].name[v7]; + v8 = _score[v14]._name[v7]; if (!v8) v8 = 32; *(ptr + (16 * v5) + v7) = v8; @@ -1041,7 +1104,7 @@ void ComputerManager::SAUVE_SCORE() { v9 = v6 + 6; for (int v10 = 0; v10 <= 8; v10++) { - v11 = Score[v14].score[v10]; + v11 = _score[v14]._score[v10]; if (!v11) v11 = 48; *(ptr + v9 + v10) = v11; @@ -1054,7 +1117,10 @@ void ComputerManager::SAUVE_SCORE() { _vm->_globals.dos_free2(ptr); } -void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { +/** + * Display parts of the hiscore line + */ +void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) { char v4; int v5; @@ -1072,94 +1138,101 @@ void ComputerManager::PRINT_HSCORE(byte *objectData, int a2, int a3, int a4) { v5 = 36; if (v4 == 1) v5 = 37; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, a2, a3, v5); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, x, y, v5); } -int ComputerManager::DEP_BALLE() { +/** + * Handle ball moves + */ +int ComputerManager::moveBall() { int16 v1; int16 v4 = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; // TODO: Figure out random number int v0 = _vm->getRandomNumber(6); - if (CASSESPEED == 1) { + if (_breakoutSpeed == 1) { CASSEP1 = 1; CASSEP2 = 1; } - if (CASSESPEED == 2) { + if (_breakoutSpeed == 2) { CASSEP1 = 1; CASSEP2 = 2; } - if (CASSESPEED == 3) { + if (_breakoutSpeed == 3) { CASSEP1 = 2; CASSEP2 = 2; } - if (CASSESPEED == 4) { + if (_breakoutSpeed == 4) { CASSEP1 = 3; CASSEP2 = 2; } v1 = CASSEP1; if (CASSDER == CASSEP1) v1 = CASSEP2; - if (BALLEVERTI == 1) - BALLE.y += v1; - if (!BALLEVERTI) - BALLE.y -= v1; - if (BALLEHORI == 1) - BALLE.x += v1; - if (!BALLEHORI) - BALLE.x -= v1; + + if (_ballUpFl) + _ballPosition.y += v1; + else + _ballPosition.y -= v1; + + if (_ballRightFl) + _ballPosition.x += v1; + else + _ballPosition.x -= v1; + CASSDER = v1; - if (BALLE.x <= 6) { + if (_ballPosition.x <= 6) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - BALLE.x = v0 + 6; - BALLEHORI = BALLEHORI != 1; + _ballPosition.x = v0 + 6; + _ballRightFl = !_ballRightFl; } - if (BALLE.x > 307) { + if (_ballPosition.x > 307) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - BALLE.x = 307 - v0; - BALLEHORI = BALLEHORI != 1; + _ballPosition.x = 307 - v0; + _ballRightFl = !_ballRightFl; } - if (BALLE.y <= 6) { + if (_ballPosition.y <= 6) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - BALLE.y = v0 + 7; - BALLEVERTI = BALLEVERTI != 1; + _ballPosition.y = v0 + 7; + _ballUpFl = !_ballUpFl; } - if ((uint16)(BALLE.y - 186) <= 8u) { + if ((uint16)(_ballPosition.y - 186) <= 8u) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - if (BALLE.x > RAQX - 2) { - int v2 = BALLE.x + 6; + if (_ballPosition.x > RAQX - 2) { + int v2 = _ballPosition.x + 6; if (v2 < RAQX + 36) { - BALLEVERTI = 0; + _ballUpFl = false; if (v2 <= RAQX + 15) { - BALLEHORI = 0; - if (BALLE.x >= RAQX && v2 <= RAQX + 5) - BALLE.x -= 4; - if (BALLE.x >= RAQX + 5 && BALLE.x + 6 <= RAQX + 10) - BALLE.x -= 2; + _ballRightFl = false; + if (_ballPosition.x >= RAQX && v2 <= RAQX + 5) + _ballPosition.x -= 4; + if (_ballPosition.x >= RAQX + 5 && _ballPosition.x + 6 <= RAQX + 10) + _ballPosition.x -= 2; } - if (BALLE.x >= RAQX + 19 && BALLE.x + 6 <= RAQX + 36) { - BALLEHORI = 1; - if (BALLE.x >= RAQX + 29) - BALLE.x += 4; - if (BALLE.x >= RAQX + 24 && BALLE.x + 6 <= RAQX + 29) - BALLE.x += 2; + if (_ballPosition.x >= RAQX + 19 && _ballPosition.x + 6 <= RAQX + 36) { + _ballRightFl = true; + if (_ballPosition.x >= RAQX + 29) + _ballPosition.x += 4; + if (_ballPosition.x >= RAQX + 24 && _ballPosition.x + 6 <= RAQX + 29) + _ballPosition.x += 2; } } } } - if (BALLE.y > 194) + if (_ballPosition.y > 194) v4 = 1; - VERIFBRIQUES(); - _vm->_objectsManager.SETXSPR(1, BALLE.x); - _vm->_objectsManager.SETYSPR(1, BALLE.y); - if (!NBBRIQUES) + checkBallCollisions(); + _vm->_objectsManager.SETXSPR(1, _ballPosition.x); + _vm->_objectsManager.SETYSPR(1, _ballPosition.y); + if (!_breakoutBrickNbr) v4 = 2; return v4; } - - -void ComputerManager::VERIFBRIQUES() { +/** + * Check ball collision with bricks + */ +void ComputerManager::checkBallCollisions() { int v1; int v2; int v3; @@ -1171,11 +1244,11 @@ void ComputerManager::VERIFBRIQUES() { //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; // TODO: Check if correct int v6 = _vm->getRandomNumber(6) + 1; - int v0 = BALLE.x; - int v13 = BALLE.y; - int v5 = BALLE.x + 6; - int v12 = BALLE.y + 6; - int16 *v9 = CASSETAB; + int v0 = _ballPosition.x; + int v13 = _ballPosition.y; + int v5 = _ballPosition.x + 6; + int v12 = _ballPosition.y + 6; + int16 *v9 = _breakoutLevel; uint16 v8 = 0; do { v1 = v9[v8]; @@ -1189,24 +1262,24 @@ void ComputerManager::VERIFBRIQUES() { if (v13 <= v10 && v12 >= v10) { if (v0 >= v1 && v5 <= v2) { v4 = 1; - BALLEVERTI = 1; + _ballUpFl = true; } if (v5 >= v1) { if (v0 <= v1) { ++v4; - BALLEVERTI = 1; - BALLEHORI = 0; + _ballUpFl = true; + _ballRightFl = false; if (v3 == 31) - BALLE.x -= v6; + _ballPosition.x -= v6; } } if (v0 <= v2) { if (v5 >= v2) { ++v4; - BALLEVERTI = 1; - BALLEHORI = 1; + _ballUpFl = true; + _ballRightFl = true; if (v3 == 31) - BALLE.x += v6; + _ballPosition.x += v6; } } } @@ -1215,24 +1288,24 @@ void ComputerManager::VERIFBRIQUES() { goto LABEL_31; if (v0 >= v1 && v5 <= v2) { ++v4; - BALLEVERTI = 0; + _ballUpFl = false; } if (v5 >= v1) { if (v0 <= v1) { ++v4; - BALLEVERTI = 0; - BALLEHORI = 0; + _ballUpFl = false; + _ballRightFl = false; if (v3 == 31) - BALLE.x -= 2; + _ballPosition.x -= 2; } } if (v0 <= v2) { if (v5 >= v2) { ++v4; - BALLEVERTI = 0; - BALLEHORI = 1; + _ballUpFl = false; + _ballRightFl = true; if (v3 == 31) - BALLE.x += v6; + _ballPosition.x += v6; } } } @@ -1242,17 +1315,17 @@ LABEL_31: if (v5 >= v1) { if (v0 <= v1) { ++v4; - BALLEHORI = 0; + _ballRightFl = false; if (v3 == 31) - BALLE.x -= v6; + _ballPosition.x -= v6; } } if (v0 <= v2) { if (v5 >= v2) { ++v4; - BALLEHORI = 1; + _ballRightFl = true; if (v3 == 31) - BALLE.x += v6; + _ballPosition.x += v6; } } } @@ -1262,29 +1335,29 @@ LABEL_31: _vm->_soundManager.PLAY_SAMPLE(2, 6); } else { _vm->_soundManager.PLAY_SAMPLE(1, 5); - _vm->_graphicsManager.AFFICHE_SPEEDVGA(CASSESPR, v1, v11, 16); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v1, v11, 16); if (v3 == 1) - CASSESCORE += 10; + _breakoutScore += 10; if (v3 == 2) - CASSESCORE += 5; + _breakoutScore += 5; if (v3 == 3) { - CASSESCORE += 50; - if (CASSESPEED <= 1) - CASSESPEED = 2; - if (NBBRIQUES <= 19) - CASSESPEED = 3; + _breakoutScore += 50; + if (_breakoutSpeed <= 1) + _breakoutSpeed = 2; + if (_breakoutBrickNbr <= 19) + _breakoutSpeed = 3; } if (v3 == 4) - CASSESCORE += 20; + _breakoutScore += 20; if (v3 == 5) { - CASSESCORE += 30; - if (CASSESPEED <= 1) - CASSESPEED = 2; + _breakoutScore += 30; + if (_breakoutSpeed <= 1) + _breakoutSpeed = 2; } if (v3 == 6) - CASSESCORE += 40; - IMPRIMESCORE(); - --NBBRIQUES; + _breakoutScore += 40; + displayScore(); + --_breakoutBrickNbr; *((uint16 *)v9 + v8 + 5) = 0; v7 = 1; } diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 6632213bfe..e7cfc10bd7 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -38,8 +38,8 @@ struct MenuItem { }; struct ScoreItem { - Common::String name; - Common::String score; + Common::String _name; + Common::String _score; }; enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLIC = 3 }; @@ -47,134 +47,60 @@ enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLI class ComputerManager { private: HopkinsEngine *_vm; - MenuItem MenuText[50]; - char Sup_string[200]; - ScoreItem Score[6]; - int TEXT_COL; + MenuItem _menuText[50]; + char _inputBuf[200]; + ScoreItem _score[6]; + int _textColor; Common::Point _textPosition; - Common::Point BALLE; - byte *CASSESPR; - int16 *CASSETAB; - bool FMOUSE; - int NBBRIQUES; - - /** - * Breakout score - */ - int CASSESCORE; - - /** - * Number of Breakout lives remaining - */ - int CASSEVIE; - - /** - * Breakout game speed - */ - int CASSESPEED; - - /** - * Breakout ball horizontal position - */ - int BALLEHORI; - - /** - * Breakout ball vertical position - */ - int BALLEVERTI; - - int NB_TABLE; + Common::Point _ballPosition; + byte *_breakoutSpr; + int16 *_breakoutLevel; + int _breakoutBrickNbr; + int _breakoutScore; + int _breakoutLifes; + int _breakoutSpeed; + bool _ballRightFl; + bool _ballUpFl; + int _breakoutLevelNbr; int RAQX; - int CASSE_HISCORE; + int _breakoutHiscore; int CASSEP1; int CASSEP2; int CASSDER; - int Menu_lignes; // CHECKME: Useless variable - /** - * Load the menu text - */ - void Charge_Menu(); + void loadMenu(); + void restoreFBIRoom(); + void setVideoMode(); + void setTextMode(); + void clearScreen(); + void setTextColor(int col); + void setTextPosition(int yp, int xp); + void outText(const Common::String &msg); + void outText2(const Common::String &msg); + void readText(int idx); + void loadHiscore(); + void newLevel(); + void setModeVGA256(); + void displayLifes(); + void displayBricks(); + void displayGamesSubMenu(); + void displayScore(); + int displayHiscores(); + void displayHiscoreLine(byte *objectData, int x, int y, int a4); + void playBreakout(); + void saveScore(); + int moveBall(); + void checkBallCollisions(); + void getScoreName(); void TXT4(int xp, int yp, int textIdx); - /** - * Restores the scene for the FBI headquarters room - */ - void RESTORE_POLICE(); - - /** - * Sets up textual entry mode. Used by the code for Hopkins computer. - */ - void setvideomode(); - - /** - * Sets up textual entry mode. Used by the code for Hopkins computer. - */ - void TEXT_MODE(); - - /** - * Clear the screen - */ - void clearscreen(); - - /** - * Sets the text mode color - */ - void settextcolor(int col); - - /** - * Sets the text position. - * @param yp Y position - * @param xp X position - * @remarks Yes, the reverse co-ordinate pair is really like that in the original game. - */ - void settextposition(int yp, int xp); - - /** - * Outputs a text string - */ - void outtext(const Common::String &msg); - - /** - * Outputs a text string - */ - void outtext2(const Common::String &msg); - - void GAMES(); - void LIT_TEXTE(int a1); - void CHARGE_SCORE(); - void MODE_VGA256(); - void NEWTAB(); - void AFF_BRIQUES(); - void AFF_VIE(); - - /** - * Play the Breakout game - */ - void PLAY_BRIQUE(); - - /** - * Show the high scores for the Breakout game - * @return The selected button index: 1 = Game, 2 = Quit - */ - int HIGHT_SCORE(); - void NAME_SCORE(); void IMPSCORE(int a1, int a2); - void SAUVE_SCORE(); - void PRINT_HSCORE(byte *objectData, int a2, int a3, int a4); - void IMPRIMESCORE(); - int DEP_BALLE(); - void VERIFBRIQUES(); + public: ComputerManager(); void setParent(HopkinsEngine *vm); - - /** - * Show a computer in the FBI office - * @param mode Which computer to display - */ - void COMPUT_HOPKINS(ComputerEnum mode); + void showComputer(ComputerEnum mode); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 6b5350aed7..42b0a1b522 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -384,7 +384,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.MODE_VESA(); break; @@ -394,7 +394,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.MODE_VESA(); break; @@ -404,7 +404,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.MODE_VESA(); break; @@ -739,7 +739,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -757,7 +757,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -769,7 +769,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -1612,7 +1612,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.MODE_VESA(); break; @@ -1622,7 +1622,7 @@ bool HopkinsEngine::runWin95full() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.MODE_VESA(); break; @@ -1632,7 +1632,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.MODE_VESA(); break; @@ -2491,7 +2491,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; - _computerManager.COMPUT_HOPKINS(COMPUTER_HOPKINS); + _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2508,7 +2508,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; - _computerManager.COMPUT_HOPKINS(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2520,7 +2520,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; - _computerManager.COMPUT_HOPKINS(COMPUTER_PUBLIC); + _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); @@ -2704,7 +2704,7 @@ void HopkinsEngine::INTRORUN() { _globals.iRegul = 1; _eventsManager.VBL(); _soundManager.WSOUND(16); - _animationManager.clearAnimationFl = true; + _animationManager._clearAnimationFl = true; _animationManager.playAnim("J1.anm", 12, 12, 50); if (!_eventsManager.ESC_KEY) { _soundManager.VOICE_MIX(1, 3); @@ -2896,7 +2896,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - _animationManager.clearAnimationFl = true; + _animationManager._clearAnimationFl = true; _soundManager.WSOUND(3); _soundManager.SPECIAL_SOUND = 1; _animationManager.playAnim("INTRO1.anm", 10, 24, 18); @@ -2916,7 +2916,7 @@ void HopkinsEngine::INTRORUN() { return; if (!_eventsManager.ESC_KEY) { - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("J4.anm", 12, 12, 1000); } @@ -3107,7 +3107,7 @@ void HopkinsEngine::BASE() { _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.clearAnimationFl = true; + _animationManager._clearAnimationFl = true; _soundManager.WSOUND(25); if (_globals.SVGA == 1) { _animationManager.playAnim("base00.anm", 10, 18, 18); @@ -3165,7 +3165,7 @@ void HopkinsEngine::BASE() { } _eventsManager.ESC_KEY = false; - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; _globals.SORTIE = 85; } @@ -3372,7 +3372,7 @@ void HopkinsEngine::AVION() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; if (_globals.SVGA == 1) { _animationManager.playAnim("aerop00.anm", 10, 18, 18); if (!_eventsManager.ESC_KEY) @@ -3440,7 +3440,7 @@ void HopkinsEngine::AVION() { } _eventsManager.ESC_KEY = 0; - _animationManager.clearAnimationFl = false; + _animationManager._clearAnimationFl = false; } int HopkinsEngine::PWBASE() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e7d4822098..7496f70625 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4205,7 +4205,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_soundManager.SPECIAL_SOUND = 198; PERSO_ON = true; _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.clearAnimationFl = false; + _vm->_animationManager._clearAnimationFl = false; _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); _vm->_animationManager.NO_SEQ = false; _vm->_soundManager.SPECIAL_SOUND = 0; -- cgit v1.2.3 From 269a6f9caeccc8e311d03d8df9e9aaa84c67224b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Dec 2012 07:54:03 +0100 Subject: HOPKINS: Some more function renaming --- engines/hopkins/anim.cpp | 4 +- engines/hopkins/dialogs.cpp | 91 +++++++++++++++++++++++--------------------- engines/hopkins/dialogs.h | 18 ++++----- engines/hopkins/font.cpp | 12 +++--- engines/hopkins/globals.cpp | 4 +- engines/hopkins/graphics.cpp | 8 ++-- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 54 ++++++++++++++------------ engines/hopkins/objects.h | 4 +- 10 files changed, 105 insertions(+), 96 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 984163005a..7678b7cdf1 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -790,8 +790,8 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { int height; do { ptr = v4; - width = _vm->_objectsManager.Get_Largeur(v4, v8); - height = _vm->_objectsManager.Get_Hauteur(ptr, v8); + width = _vm->_objectsManager.getWidth(v4, v8); + height = _vm->_objectsManager.getHeight(ptr, v8); v4 = ptr; if (!width && !height) loopCond = true; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 774767311e..fd7b102f15 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -37,10 +37,10 @@ namespace Hopkins { DialogsManager::DialogsManager() { INVENTFLAG = false; - AFFINVEN = false; + _inventDisplayedFl = false; VIRE_INVENT = false; - inventairex = inventairey = 0; - inventairel = inventaireh = 0; + _inventX = _inventY = 0; + _inventWidth = _inventHeight = 0; Winventaire = NULL; inventaire2 = g_PTRNUL; } @@ -302,7 +302,7 @@ void DialogsManager::showOptionsDialog() { } void DialogsManager::showInventory() { - if (!VIRE_INVENT && !AFFINVEN && !_vm->_globals.DESACTIVE_INVENT) { + if (!VIRE_INVENT && !_inventDisplayedFl && !_vm->_globals.DESACTIVE_INVENT) { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; _vm->_objectsManager.FLAG_VISIBLE = false; @@ -343,13 +343,12 @@ LABEL_7: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); inventaire2 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - int v19 = _vm->_graphicsManager.ofscroll + 152; - int v18 = _vm->_objectsManager.Get_Largeur(_vm->_dialogsManager.Winventaire, 0); - int v17 = _vm->_objectsManager.Get_Hauteur(_vm->_dialogsManager.Winventaire, 0); - inventairex = v19; - inventairey = 114; - inventairel = v18; - inventaireh = v17; + + int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; + _inventY = 114; + int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager.Winventaire, 0); + int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager.Winventaire, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, v19 + 300, 414, 0, 0, 0, 0); int v15 = 0; @@ -369,7 +368,7 @@ LABEL_7: }; v15 += 38; } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, inventairex, inventairey, inventairel, inventaireh); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager.souris_bb = 0; bool v20 = false; int v13 = 0; @@ -377,7 +376,7 @@ LABEL_7: // Main loop to select an inventory item while (!_vm->shouldQuit()) { // Turn on drawing the inventory dialog in the event manager - AFFINVEN = true; + _inventDisplayedFl = true; int v8 = _vm->_eventsManager.XMOUSE(); int v9 = _vm->_eventsManager.YMOUSE(); @@ -430,7 +429,7 @@ LABEL_7: goto LABEL_7; } } else if (!v20) { - AFFINVEN = true; + _inventDisplayedFl = true; } } } @@ -443,8 +442,8 @@ LABEL_7: _vm->_objectsManager.SPECIAL_JEU(); } _vm->_fontManager.TEXTE_OFF(9); - if (AFFINVEN) { - AFFINVEN = false; + if (_inventDisplayedFl) { + _inventDisplayedFl = false; // v9 = 114; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); @@ -456,10 +455,10 @@ LABEL_7: if (_vm->_eventsManager.btsouris == 1) showOptionsDialog(); - if (_vm->_eventsManager.btsouris == 3) - _vm->_dialogsManager.CHARGE_PARTIE(); - if (_vm->_eventsManager.btsouris == 2) - _vm->_dialogsManager.SAUVE_PARTIE(); + else if (_vm->_eventsManager.btsouris == 3) + _vm->_dialogsManager.showLoadGame(); + else if (_vm->_eventsManager.btsouris == 2) + _vm->_dialogsManager.showSaveGame(); _vm->_eventsManager.btsouris = 4; _vm->_eventsManager.CHANGE_MOUSE(4); @@ -515,7 +514,10 @@ void DialogsManager::INVENT_ANIM() { } } -void DialogsManager::TestForDialogOpening() { +/** + * Test dialog opening + */ +void DialogsManager::testDialogOpening() { if (_vm->_globals.PLAN_FLAG) _vm->_eventsManager.GAME_KEY = KEY_NONE; @@ -536,12 +538,12 @@ void DialogsManager::TestForDialogOpening() { break; case KEY_LOAD: _vm->_graphicsManager.no_scroll = 1; - _vm->_dialogsManager.CHARGE_PARTIE(); + _vm->_dialogsManager.showLoadGame(); _vm->_graphicsManager.no_scroll = 0; break; case KEY_SAVE: _vm->_graphicsManager.no_scroll = 1; - _vm->_dialogsManager.SAUVE_PARTIE(); + _vm->_dialogsManager.showSaveGame(); _vm->_graphicsManager.no_scroll = 0; break; default: @@ -554,15 +556,17 @@ void DialogsManager::TestForDialogOpening() { } } -// Load Game -void DialogsManager::CHARGE_PARTIE() { +/** + * Load Game dialog + */ +void DialogsManager::showLoadGame() { int slotNumber; _vm->_eventsManager.VBL(); - LOAD_SAUVE(2); + showSaveLoad(2); do { do { - slotNumber = CHERCHE_PARTIE(); + slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); } while (_vm->_eventsManager.BMOUSE() != 1); } while (!slotNumber); @@ -582,17 +586,19 @@ void DialogsManager::CHARGE_PARTIE() { _vm->_objectsManager.CHANGE_OBJET(14); } -// Save Game -void DialogsManager::SAUVE_PARTIE() { +/** + * Save Game dialog + */ +void DialogsManager::showSaveGame() { int slotNumber; Common::String saveName; _vm->_eventsManager.VBL(); - LOAD_SAUVE(1); + showSaveLoad(1); do { do { - slotNumber = CHERCHE_PARTIE(); + slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); } while (!_vm->shouldQuit() && !slotNumber); @@ -615,9 +621,10 @@ void DialogsManager::SAUVE_PARTIE() { } } - -// Load Save -void DialogsManager::LOAD_SAUVE(int a1) { +/** + * Load/Save dialog + */ +void DialogsManager::showSaveLoad(int a1) { int slotNumber; hopkinsSavegameHeader header; byte *thumb; @@ -692,15 +699,13 @@ void DialogsManager::LOAD_SAUVE(int a1) { _vm->_objectsManager.SL_Y = 0; } -// Search Game -int DialogsManager::CHERCHE_PARTIE() { - int slotNumber; - int xp; - int yp; - - slotNumber = 0; - xp = _vm->_eventsManager.XMOUSE(); - yp = _vm->_eventsManager.YMOUSE(); +/** + * Search savegames + */ +int DialogsManager::searchSavegames() { + int slotNumber = 0; + int xp = _vm->_eventsManager.XMOUSE(); + int yp = _vm->_eventsManager.YMOUSE(); _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; if ((uint16)(yp - 112) <= 0x56u) { diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index 19c7faae1f..b98759dc56 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -38,27 +38,27 @@ class DialogsManager { private: HopkinsEngine *_vm; public: + int _inventX, _inventY; + int _inventWidth, _inventHeight; + bool INVENTFLAG; - bool AFFINVEN; + bool _inventDisplayedFl; bool VIRE_INVENT; - int inventairex, inventairey; - int inventairel, inventaireh; byte *Winventaire; byte *inventaire2; public: DialogsManager(); ~DialogsManager(); void setParent(HopkinsEngine *vm); - + void showLoadGame(); + void showSaveGame(); + void showSaveLoad(int a1); void showOptionsDialog(); void showInventory(); + int searchSavegames(); + void testDialogOpening(); void INVENT_ANIM(); - void TestForDialogOpening(); - void CHARGE_PARTIE(); - void SAUVE_PARTIE(); - void LOAD_SAUVE(int a1); - int CHERCHE_PARTIE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index c7fae50218..dccba0d3ea 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -254,7 +254,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, byte v16 = *(v60 + v15); if ((byte)v16 <= 0x1Fu) v16 = 32; - _vm->_globals.largeur_boite += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v16 - 32); + _vm->_globals.largeur_boite += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v16 - 32); } } _vm->_globals.largeur_boite += 2; @@ -327,7 +327,7 @@ LABEL_57: byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if ((byte)v24 <= 0x1Fu) v24 = 32; - ptrc += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, (byte)v24 - 32); + ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); } } TRIER_TEXT[i] = ptrc; @@ -450,7 +450,7 @@ void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int co charIndex = currChar - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, currentX, yp, currChar - 32, col); - currentX += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, charIndex); + currentX += _vm->_objectsManager.getWidth(_vm->_globals.police, charIndex); } } @@ -466,7 +466,7 @@ void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int c int characterIndex = currentChar - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, xp, yp, characterIndex, col); - xp += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, characterIndex); + xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); } } } @@ -497,8 +497,8 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col if (v7 >= 32) { v5 = v7 - 32; _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, v9, yp, v7 - 32, fontCol); - v9 += _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); - v6 = _vm->_objectsManager.Get_Largeur(_vm->_globals.police, v5); + v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5); + v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5); _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); if (_vm->_eventsManager.ESC_KEY) { _vm->_globals.iRegul = 1; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a311c91253..90d5268c99 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -604,8 +604,8 @@ void Globals::CHARGE_CACHE(const Common::String &file) { if (spriteData == g_PTRNUL) { Cache[i].fieldA = 0; } else { - int v8 = _vm->_objectsManager.Get_Largeur(spriteData, v11); - int v9 = _vm->_objectsManager.Get_Hauteur(spriteData, v11); + int v8 = _vm->_objectsManager.getWidth(spriteData, v11); + int v9 = _vm->_objectsManager.getHeight(spriteData, v11); Cache[i].fieldC = spriteData; Cache[i].field6 = v8; Cache[i].field8 = v9; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 1f734e284c..38cbcc6126 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1636,8 +1636,8 @@ void GraphicsManager::Affiche_Segment_Vesa() { void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx) { int height, width; - width = _vm->_objectsManager.Get_Largeur(objectData, idx); - height = _vm->_objectsManager.Get_Hauteur(objectData, idx); + width = _vm->_objectsManager.getWidth(objectData, idx); + height = _vm->_objectsManager.getHeight(objectData, idx); if (*objectData == 78) { Affiche_Perfect(VESA_SCREEN, objectData, xp + 300, yp + 300, idx, 0, 0, 0); Affiche_Perfect(VESA_BUFFER, objectData, xp + 300, yp + 300, idx, 0, 0, 0); @@ -2161,8 +2161,8 @@ Aff_Zoom_Larg_Cont1: void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { int width, height; - width = _vm->_objectsManager.Get_Largeur(spriteData, spriteIndex); - height = _vm->_objectsManager.Get_Hauteur(spriteData, spriteIndex); + width = _vm->_objectsManager.getWidth(spriteData, spriteIndex); + height = _vm->_objectsManager.getHeight(spriteData, spriteIndex); if (*spriteData == 78) { Affiche_Perfect(VESA_SCREEN, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); Affiche_Perfect(VESA_BUFFER, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 42b0a1b522..e8df4bf203 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -3603,7 +3603,7 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) - strWidth += _objectsManager.Get_Largeur(_globals.police, curChar - 32); + strWidth += _objectsManager.getWidth(_globals.police, curChar - 32); } int startPosX = 320 - strWidth / 2; int endPosX = strWidth + startPosX; @@ -3630,7 +3630,7 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { break; if (curChar > 31) { _graphicsManager.Affiche_Fonte(_graphicsManager.VESA_BUFFER, _globals.police, startPosX, startPosY, curChar - 32, colour); - startPosX += _objectsManager.Get_Largeur(_globals.police, curChar - 32); + startPosX += _objectsManager.getWidth(_globals.police, curChar - 32); } } } diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index bcb2e3d737..a284e893d6 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -192,7 +192,7 @@ int MenuManager::MENU() { _vm->_eventsManager.delay(200); _vm->_globals.SORTIE = -1; - _vm->_dialogsManager.CHARGE_PARTIE(); + _vm->_dialogsManager.showLoadGame(); if (_vm->_globals.SORTIE != -1) { result = _vm->_globals.SORTIE; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7496f70625..190dfb86b7 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -126,8 +126,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { _vm->_globals.NUM_FICHIER_OBJ = val1; } - int width = ObjectsManager::Get_Largeur(_vm->_globals.ADR_FICHIER_OBJ, val2); - int height = ObjectsManager::Get_Hauteur(_vm->_globals.ADR_FICHIER_OBJ, val2); + int width = ObjectsManager::getWidth(_vm->_globals.ADR_FICHIER_OBJ, val2); + int height = ObjectsManager::getHeight(_vm->_globals.ADR_FICHIER_OBJ, val2); _vm->_globals.OBJL = width; _vm->_globals.OBJH = height; @@ -224,8 +224,10 @@ int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool is return result; } -// Get Width -int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { +/** + * Get Width + */ +int ObjectsManager::getWidth(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; @@ -233,8 +235,10 @@ int ObjectsManager::Get_Largeur(const byte *objectData, int idx) { return (int16)READ_LE_UINT16(rectP + 4); } -// Get height -int ObjectsManager::Get_Hauteur(const byte *objectData, int idx) { +/** + * Get height + */ +int ObjectsManager::getHeight(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; @@ -477,13 +481,13 @@ void ObjectsManager::AFF_SPRITES() { } _vm->_globals.NBTRI = 0; - if (_vm->_dialogsManager.AFFINVEN) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventaireh); + if (_vm->_dialogsManager._inventDisplayedFl) { + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); if (old_cadx && old_cady) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); if (cadx && cady) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, cadx + 300, cady + 300, cadi); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager.inventairex, _vm->_dialogsManager.inventairey, _vm->_dialogsManager.inventairex + _vm->_dialogsManager.inventairel, _vm->_dialogsManager.inventairey + _vm->_dialogsManager.inventaireh); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } if (SL_FLAG == true) { @@ -842,8 +846,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Liste2[idx].xp = v13; _vm->_globals.Liste2[idx].yp = v14; - int width = Get_Largeur(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); - int height = Get_Hauteur(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); + int width = getWidth(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); + int height = getHeight(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); if (v21) { width = _vm->_graphicsManager.Reel_Zoom(width, v21); @@ -1122,8 +1126,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { _vm->_globals.Liste[v17].field0 = 1; _vm->_globals.Liste[v17].field2 = v15; _vm->_globals.Liste[v17].field4 = v16; - width = Get_Largeur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); - height = Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + width = getWidth(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + height = getHeight(Sprite[idx].spriteData, Sprite[idx].spriteIndex); if (zoomPercent) { width = _vm->_graphicsManager.Reel_Zoom(width, zoomPercent); @@ -1354,8 +1358,8 @@ void ObjectsManager::AFF_VBOB() { int idx = 0; do { if (_vm->_globals.VBob[idx].field4 == 4) { - width = Get_Largeur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - height = Get_Hauteur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].xp, @@ -1386,8 +1390,8 @@ void ObjectsManager::AFF_VBOB() { } if (_vm->_globals.VBob[idx].field4 == 3) { - width = Get_Largeur(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); - height = Get_Hauteur(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); + width = getWidth(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); + height = getHeight(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, @@ -1415,8 +1419,8 @@ void ObjectsManager::AFF_VBOB() { } if (_vm->_globals.VBob[idx].field4 == 1) { - width = Get_Largeur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - height = Get_Hauteur(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); if (_vm->_globals.VBob[idx].surface != g_PTRNUL) _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); @@ -1564,13 +1568,13 @@ void ObjectsManager::SPRITE_GEL(int idx) { int ObjectsManager::SXSPR(int idx) { if (idx > 5) error("request of the size of a sprite x > MAX_SPRITE."); - return Get_Largeur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + return getWidth(Sprite[idx].spriteData, Sprite[idx].spriteIndex); } int ObjectsManager::SYSPR(int idx) { if (idx > 5) error("request of the size of a sprite y > MAX_SPRITE."); - return Get_Hauteur(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + return getHeight(Sprite[idx].spriteData, Sprite[idx].spriteIndex); } int ObjectsManager::POSISPR(int idx) { @@ -4706,8 +4710,8 @@ void ObjectsManager::INILINK(const Common::String &file) { } else { v12 = v8; v13 = _vm->_globals.CACHE_BANQUE[1]; - v14 = Get_Largeur(v13, v8); - v15 = Get_Hauteur(v13, v12); + v14 = getWidth(v13, v8); + v15 = getHeight(v13, v12); _vm->_globals.Cache[v40].fieldC = v13; _vm->_globals.Cache[v40].field6 = v14; _vm->_globals.Cache[v40].field8 = v15; @@ -5571,7 +5575,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } if (v9 == 2) BTDROITE(); - _vm->_dialogsManager.TestForDialogOpening(); + _vm->_dialogsManager.testDialogOpening(); VERIFZONE(); if (_vm->_globals.GOACTION == 1) PARADISE(); @@ -5718,7 +5722,7 @@ LABEL_70: } } if (!_vm->_globals.SORTIE) { - _vm->_dialogsManager.TestForDialogOpening(); + _vm->_dialogsManager.testDialogOpening(); VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d38000aa43..7b00a2db45 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -125,8 +125,8 @@ public: byte *CAPTURE_OBJET(int objIndex, int mode); void DELETE_OBJET(int objIndex); - int Get_Largeur(const byte *objectData, int idx); - int Get_Hauteur(const byte *objectData, int idx); + int getWidth(const byte *objectData, int idx); + int getHeight(const byte *objectData, int idx); int sprite_alone(const byte *objectData, byte *sprite, int objIndex); byte *DEL_FICHIER_OBJ(); -- cgit v1.2.3 From 9d8a2154f2fb19c1501c504bc05b5529d2efaff2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Dec 2012 22:16:09 +1100 Subject: HOPKINS: Cleanup of playAnim method --- engines/hopkins/anim.cpp | 241 ++++++++++++++++++++++------------------------- 1 file changed, 111 insertions(+), 130 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 7678b7cdf1..a900a0353a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -40,14 +40,18 @@ AnimationManager::AnimationManager() { } /** - * Play Anim + * Play Animation + * @param filename Filename of animation to play + * @param rate1 Delay amount before starting animation + * @param rate2 Delay amount between animation frames + * @param rate3 Delay amount after animation finishes */ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { - int v4; + bool breakFlag; bool hasScreenCopy; byte *screenCopy = NULL; - byte *v10 = NULL; - int v13; + byte *screenP = NULL; + int frameNumber; byte *ptr = NULL; size_t nbytes; Common::File f; @@ -56,153 +60,129 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui return; hasScreenCopy = false; - while (!_vm->shouldQuit()) { -LABEL_2: - v10 = _vm->_graphicsManager.VESA_SCREEN; - ptr = _vm->_globals.dos_malloc2(0x14u); + screenP = _vm->_graphicsManager.VESA_SCREEN; + ptr = _vm->_globals.dos_malloc2(0x14u); - _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); - if (!f.open(_vm->_globals.NFICHIER)) - error("File not found - %s", _vm->_globals.NFICHIER.c_str()); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); + if (!f.open(_vm->_globals.NFICHIER)) + error("File not found - %s", _vm->_globals.NFICHIER.c_str()); - f.skip(6); - f.read(_vm->_graphicsManager.Palette, 0x320u); - f.skip(4); - nbytes = f.readUint32LE(); - f.skip(14); - f.read(v10, nbytes); + f.skip(6); + f.read(_vm->_graphicsManager.Palette, 0x320u); + f.skip(4); + nbytes = f.readUint32LE(); + f.skip(14); + f.read(screenP, nbytes); - if (_clearAnimationFl) { - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); - } - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { - hasScreenCopy = true; - screenCopy = _vm->_globals.dos_malloc2(0x4B000u); - memcpy(screenCopy, v10, 0x4B000u); + if (_clearAnimationFl) { + _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.Cls_Video(); + _vm->_graphicsManager.DD_Unlock(); + } + if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + hasScreenCopy = true; + screenCopy = _vm->_globals.dos_malloc2(0x4B000u); + memcpy(screenCopy, screenP, 0x4B000u); + } + if (NO_SEQ) { + if (hasScreenCopy) + memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + _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 (hasScreenCopy) + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - if (NO_SEQ) { + if (_vm->_graphicsManager.Winbpp == 1) { if (hasScreenCopy) - memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); - _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 (hasScreenCopy) - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (hasScreenCopy) - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.DD_VBL(); + _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll2(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = false; - _vm->_soundManager.LOAD_ANM_SOUND(); - if (_vm->_globals.iRegul != 1) - break; - while (!_vm->shouldQuit()) { + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.DD_VBL(); + } + _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager.ESC_KEY = false; + _vm->_soundManager.LOAD_ANM_SOUND(); + + if (_vm->_globals.iRegul == 1) { + // Do pre-animation delay + do { if (_vm->_eventsManager.ESC_KEY == true) - goto LABEL_58; - if (redrawAnim() == true) - break; - _vm->_eventsManager.CONTROLE_MES(); - if (_vm->_eventsManager.lItCounter >= rate1) - goto LABEL_25; - } -LABEL_53: - if (_vm->_graphicsManager.NOLOCK == true) - goto LABEL_58; - _vm->_globals.dos_free2(ptr); - f.close(); + goto EXIT; - if (hasScreenCopy == 1) -LABEL_55: - screenCopy = _vm->_globals.dos_free2(screenCopy); + _vm->_eventsManager.CONTROLE_MES(); + } while (!_vm->shouldQuit() && _vm->_eventsManager.lItCounter < rate1); } -LABEL_25: + _vm->_eventsManager.lItCounter = 0; - v4 = 0; - v13 = 0; + breakFlag = false; + frameNumber = 0; while (!_vm->shouldQuit()) { - ++v13; - _vm->_soundManager.playAnim_SOUND(v13); + ++frameNumber; + _vm->_soundManager.playAnim_SOUND(frameNumber); + // Read frame header if (f.read(ptr, 16) != 16) - v4 = -1; + breakFlag = true; if (strncmp((char *)ptr, "IMAGE=", 6)) - v4 = -1; - if (v4) - goto LABEL_49; - - f.read(v10, READ_LE_UINT32(ptr + 8)); - if (_vm->_globals.iRegul == 1) + breakFlag = true; + if (breakFlag) break; -LABEL_38: + + f.read(screenP, READ_LE_UINT32(ptr + 8)); + + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->_eventsManager.ESC_KEY) + goto EXIT; + + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (!_vm->shouldQuit() && _vm->_eventsManager.lItCounter < rate2); + } + _vm->_eventsManager.lItCounter = 0; _vm->_graphicsManager.DD_Lock(); if (hasScreenCopy) { - if (*v10 != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); + if (*screenP != kByteStop) { + _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); } - } else if (*v10 != kByteStop) { + } else if (*screenP != kByteStop) { if (_vm->_graphicsManager.Winbpp == 1) - _vm->_graphicsManager.Copy_Video_Vbe3(v10); + _vm->_graphicsManager.Copy_Video_Vbe3(screenP); if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.Copy_Video_Vbe16(v10); + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); -LABEL_49: - if (v4 == -1) { - if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager.ESC_KEY != true) { - if (redrawAnim() == true) - goto LABEL_53; - _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= rate3) - goto LABEL_57; - } - } else { -LABEL_57: - _vm->_eventsManager.lItCounter = 0; - _vm->_soundManager.VERIF_SOUND(); - } - goto LABEL_58; - } } - while (!_vm->shouldQuit() && _vm->_eventsManager.ESC_KEY != true) { - if (redrawAnim() == true) { - if (_vm->_graphicsManager.NOLOCK == true) + + if (_vm->_globals.iRegul == 1) { + // Do post-animation delay + do { + if (_vm->_eventsManager.ESC_KEY) break; - _vm->_globals.dos_free2(ptr); - f.close(); - if (1 /*hasScreenCopy <= SCREEN_WIDTH */) - goto LABEL_2; - goto LABEL_55; - } - _vm->_eventsManager.CONTROLE_MES(); - _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= rate2) - goto LABEL_38; + _vm->_eventsManager.CONTROLE_MES(); + _vm->_soundManager.VERIF_SOUND(); + } while (_vm->_eventsManager.lItCounter < rate3); } -LABEL_58: + + _vm->_eventsManager.lItCounter = 0; + _vm->_soundManager.VERIF_SOUND(); +EXIT: if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { screenCopy = _vm->_globals.dos_malloc2(0x4B000u); @@ -212,28 +192,29 @@ LABEL_58: f.skip(4); nbytes = f.readUint32LE(); f.skip(14); - f.read(v10, nbytes); + f.read(screenP, nbytes); - memcpy(screenCopy, v10, 0x4B000u); + memcpy(screenCopy, screenP, 0x4B000u); - int v5 = 0; + breakFlag = false; do { - memset(ptr, 0, 0x13u); - if (f.read(ptr, 16) != 16) - v5 = -1; + memset(ptr, 0, 20); + if (f.read(ptr, 16) != 16) + breakFlag = true; if (strncmp((char *)ptr, "IMAGE=", 6)) - v5 = -1; - if (!v5) { - f.read(v10, READ_LE_UINT32(ptr + 8)); - if (*v10 != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe3(v10, screenCopy); + breakFlag = true; + + if (!breakFlag) { + f.read(screenP, READ_LE_UINT32(ptr + 8)); + if (*screenP != kByteStop) + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); } - } while (v5 != -1); + } while (breakFlag); _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); screenCopy = _vm->_globals.dos_free2(screenCopy); } - if (hasScreenCopy == 1) { + if (hasScreenCopy) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); _vm->_globals.dos_free2(screenCopy); -- cgit v1.2.3 From 6aa2ef92b9f8e4d13f454bdcf140a159ea573a81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Dec 2012 22:16:47 +1100 Subject: HOPKINS: Bugfix for first display of newspaper in the Linux full game intro --- engines/hopkins/hopkins.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index e8df4bf203..92246928b0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1717,11 +1717,12 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.LOAD_IMAGE("H2"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); _globals.vitesse = 2; _globals.iRegul = 1; _graphicsManager.FADE_LINUX = 2; - _graphicsManager.FADE_OUTW(); + _animationManager.playAnim("MP.ANM", 10, 16, 200); if (!_eventsManager.ESC_KEY) INTRORUN(); -- cgit v1.2.3 From 78cf8296e04dc28ceae13c392f9b8596b808d6d0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Dec 2012 22:17:35 +0100 Subject: HOPKINS: Fix typo reported by alex --- engines/hopkins/computer.cpp | 28 ++++++++++++++-------------- engines/hopkins/computer.h | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index f5646d6168..2d96603513 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -44,7 +44,7 @@ ComputerManager::ComputerManager() { _breakoutLevel = NULL; _breakoutBrickNbr = 0; _breakoutScore = 0; - _breakoutLifes = 0; + _breakoutLives = 0; _breakoutSpeed = 0; _ballRightFl = false; _ballUpFl = false; @@ -605,7 +605,7 @@ void ComputerManager::displayGamesSubMenu() { _breakoutLevel = (int16 *)g_PTRNUL; _breakoutBrickNbr = 0; _breakoutScore = 0; - _breakoutLifes = 5; + _breakoutLives = 5; _breakoutSpeed = 1; _ballRightFl = false; _ballUpFl = false; @@ -694,11 +694,11 @@ void ComputerManager::newLevel() { _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.SPRITE_OFF(1); - ++_breakoutLifes; - if (_breakoutLifes > 11) - _breakoutLifes = 11; + ++_breakoutLives; + if (_breakoutLives > 11) + _breakoutLives = 11; _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); - displayLifes(); + displayLives(); if (_breakoutLevel != (int16 *)g_PTRNUL) { _vm->_globals.dos_free2((byte *)_breakoutLevel); _breakoutLevel = (int16 *)g_PTRNUL; @@ -772,13 +772,13 @@ void ComputerManager::displayBricks() { } /** - * Display Lifes in breakout game + * Display Lives in breakout game */ -void ComputerManager::displayLifes() { +void ComputerManager::displayLives() { int v3; int v4; - int v0 = _breakoutLifes - 1; + int v0 = _breakoutLives - 1; int v1 = 10; for (int i = 0; i <= 11; i++) { @@ -851,11 +851,11 @@ void ComputerManager::playBreakout() { if (v1 != 1) break; _vm->_graphicsManager.FADE_OUT_CASSE(); - --_breakoutLifes; + --_breakoutLives; - if (_breakoutLifes) { - displayLifes(); - if (_breakoutLifes) + if (_breakoutLives) { + displayLives(); + if (_breakoutLives) continue; } _vm->_eventsManager.MOUSE_ON1(); @@ -869,7 +869,7 @@ void ComputerManager::playBreakout() { _breakoutBrickNbr = 0; _breakoutScore = 0; - _breakoutLifes = 4; + _breakoutLives = 4; _breakoutSpeed = 1; _ballRightFl = false; _ballUpFl = false; diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index e7cfc10bd7..dfa7529633 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -57,7 +57,7 @@ private: int16 *_breakoutLevel; int _breakoutBrickNbr; int _breakoutScore; - int _breakoutLifes; + int _breakoutLives; int _breakoutSpeed; bool _ballRightFl; bool _ballUpFl; @@ -81,7 +81,7 @@ private: void loadHiscore(); void newLevel(); void setModeVGA256(); - void displayLifes(); + void displayLives(); void displayBricks(); void displayGamesSubMenu(); void displayScore(); -- cgit v1.2.3 From af667771a918370988cc656412e2ddea3d1d44a3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Dec 2012 23:57:59 +0100 Subject: HOPKINS: Rename functions in DialogManager --- engines/hopkins/dialogs.cpp | 65 ++++++++++++++++++++++++--------------------- engines/hopkins/dialogs.h | 11 ++++---- engines/hopkins/globals.cpp | 8 +++--- engines/hopkins/globals.h | 4 +-- engines/hopkins/hopkins.cpp | 58 ++++++++++++++++++++-------------------- engines/hopkins/menu.cpp | 4 +-- engines/hopkins/objects.cpp | 54 ++++++++++++++++++------------------- engines/hopkins/script.cpp | 12 ++++----- engines/hopkins/talk.cpp | 14 +++++----- 9 files changed, 116 insertions(+), 114 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index fd7b102f15..617221fa88 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -36,17 +36,17 @@ namespace Hopkins { DialogsManager::DialogsManager() { - INVENTFLAG = false; + _inventFl = false; _inventDisplayedFl = false; - VIRE_INVENT = false; + _removeInventFl = false; _inventX = _inventY = 0; _inventWidth = _inventHeight = 0; - Winventaire = NULL; - inventaire2 = g_PTRNUL; + _inventWin1 = g_PTRNUL; + _inventBuf2 = g_PTRNUL; } DialogsManager::~DialogsManager() { - _vm->_globals.dos_free2(Winventaire); + _vm->_globals.dos_free2(_inventWin1); } void DialogsManager::setParent(HopkinsEngine *vm) { @@ -67,7 +67,7 @@ void DialogsManager::showOptionsDialog() { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.OPTION_FLAG = true; + _vm->_globals._optionDialogFl = true; do { if (_vm->_eventsManager.BMOUSE()) { @@ -298,26 +298,26 @@ void DialogsManager::showOptionsDialog() { _vm->_graphicsManager.ofscroll + 498, 320); _vm->_globals.OPTION_SPR = _vm->_globals.dos_free2(_vm->_globals.OPTION_SPR); - _vm->_globals.OPTION_FLAG = false; + _vm->_globals._optionDialogFl = false; } void DialogsManager::showInventory() { - if (!VIRE_INVENT && !_inventDisplayedFl && !_vm->_globals.DESACTIVE_INVENT) { + if (!_removeInventFl && !_inventDisplayedFl && !_vm->_globals._disableInventFl) { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; _vm->_objectsManager.FLAG_VISIBLE = false; for (int v1 = 0; v1 <= 1; v1++) { - INVENT_ANIM(); + inventAnim(); _vm->_eventsManager.XMOUSE(); _vm->_eventsManager.YMOUSE(); _vm->_eventsManager.VBL(); } - _vm->_dialogsManager.Winventaire = g_PTRNUL; + _vm->_dialogsManager._inventWin1 = g_PTRNUL; LABEL_7: _vm->_eventsManager.souris_bb = 0; _vm->_eventsManager.souris_b = 0; - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); switch (_vm->_globals.FR) { @@ -337,19 +337,19 @@ LABEL_7: error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); size_t filesize = f.size(); - _vm->_dialogsManager.Winventaire = _vm->_globals.dos_malloc2(filesize); - _vm->_fileManager.readStream(f, _vm->_dialogsManager.Winventaire, filesize); + _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_malloc2(filesize); + _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); f.close(); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); - inventaire2 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; _inventY = 114; - int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager.Winventaire, 0); - int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager.Winventaire, 0); + int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); + int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, v19 + 300, 414, 0, 0, 0, 0); int v15 = 0; int v4 = 0; @@ -368,7 +368,7 @@ LABEL_7: }; v15 += 38; } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _inventX, _inventY, _inventWidth, _inventHeight); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager.souris_bb = 0; bool v20 = false; int v13 = 0; @@ -423,9 +423,9 @@ LABEL_7: v20 = true; _vm->_globals.SORTIE = 0; if (!v20) { - inventaire2 = _vm->_globals.dos_free2(inventaire2); - if (g_PTRNUL != _vm->_dialogsManager.Winventaire) - _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); + _inventBuf2 = _vm->_globals.dos_free2(_inventBuf2); + if (g_PTRNUL != _vm->_dialogsManager._inventWin1) + _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_free2(_vm->_dialogsManager._inventWin1); goto LABEL_7; } } else if (!v20) { @@ -433,7 +433,7 @@ LABEL_7: } } } - if (VIRE_INVENT == true) + if (_removeInventFl == true) v20 = true; if (v20) break; @@ -449,9 +449,9 @@ LABEL_7: _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; } - if (_vm->_dialogsManager.Winventaire != g_PTRNUL) - _vm->_dialogsManager.Winventaire = _vm->_globals.dos_free2(_vm->_dialogsManager.Winventaire); - inventaire2 = _vm->_globals.dos_free2(inventaire2); + if (_vm->_dialogsManager._inventWin1 != g_PTRNUL) + _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_free2(_vm->_dialogsManager._inventWin1); + _inventBuf2 = _vm->_globals.dos_free2(_inventBuf2); if (_vm->_eventsManager.btsouris == 1) showOptionsDialog(); @@ -466,13 +466,16 @@ LABEL_7: _vm->_objectsManager.cady = 0; _vm->_objectsManager.old_cadx = 0; _vm->_objectsManager.cadx = 0; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; _vm->_graphicsManager.no_scroll = 0; } } -void DialogsManager::INVENT_ANIM() { - if (!_vm->_globals.DESACTIVE_INVENT) { +/** + * Inventory Animations + */ +void DialogsManager::inventAnim() { + if (!_vm->_globals._disableInventFl) { if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); @@ -522,10 +525,10 @@ void DialogsManager::testDialogOpening() { _vm->_eventsManager.GAME_KEY = KEY_NONE; if (_vm->_eventsManager.GAME_KEY != KEY_NONE) { - if (!INVENTFLAG) { + if (!_inventFl) { DIALOG_KEY key = _vm->_eventsManager.GAME_KEY; _vm->_eventsManager.GAME_KEY = KEY_NONE; - INVENTFLAG = true; + _inventFl = true; switch (key) { case KEY_INVENTORY: @@ -550,7 +553,7 @@ void DialogsManager::testDialogOpening() { break; } - INVENTFLAG = false; + _inventFl = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; } } diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index b98759dc56..7608af2377 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -41,11 +41,11 @@ public: int _inventX, _inventY; int _inventWidth, _inventHeight; - bool INVENTFLAG; + bool _inventFl; bool _inventDisplayedFl; - bool VIRE_INVENT; - byte *Winventaire; - byte *inventaire2; + bool _removeInventFl; + byte *_inventWin1; + byte *_inventBuf2; public: DialogsManager(); ~DialogsManager(); @@ -57,8 +57,7 @@ public: void showInventory(); int searchSavegames(); void testDialogOpening(); - - void INVENT_ANIM(); + void inventAnim(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 90d5268c99..7a91dc074d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -233,12 +233,12 @@ Globals::Globals() { CENSURE = false; GESTE_FLAG = false; BPP_NOAFF = false; - DESACTIVE_INVENT = false; + _disableInventFl = false; FLAG_VISIBLE = false; netscape = false; NOMARCHE = false; NO_VISU = false; - OPTION_FLAG = false; + _optionDialogFl = false; CACHEFLAG = false; NOPARLE = false; couleur_40 = 50; @@ -368,8 +368,8 @@ void Globals::clearAll() { NUM_FICHIER_OBJ = 0; Bufferdecor = g_PTRNUL; _vm->_eventsManager.Bufferobjet = g_PTRNUL; - _vm->_dialogsManager.Winventaire = g_PTRNUL; - _vm->_dialogsManager.inventaire2 = g_PTRNUL; + _vm->_dialogsManager._inventWin1 = g_PTRNUL; + _vm->_dialogsManager._inventBuf2 = g_PTRNUL; COUCOU = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; SAUVEGARDE = (Sauvegarde *)g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c44316611c..1cbd6d8e7b 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -428,14 +428,14 @@ public: int Max_Propre_Gen; int Max_Ligne_Long; int Max_Perso_Y; - bool DESACTIVE_INVENT; + bool _disableInventFl; bool FLAG_VISIBLE; bool netscape; // CHECKME: Useless variable? bool NOMARCHE; int NBBLOC; bool NO_VISU; byte *OPTION_SPR; - bool OPTION_FLAG; + bool _optionDialogFl; int opt_anm; int opt_vitesse; int opt_scrtype; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 92246928b0..305fed10a3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -248,9 +248,9 @@ bool HopkinsEngine::runWin95Demo() { break; case 4: - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; break; case 5: @@ -576,9 +576,9 @@ bool HopkinsEngine::runLinuxDemo() { break; case 4: - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; break; case 5: @@ -919,9 +919,9 @@ bool HopkinsEngine::runWin95full() { break; case 4: - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; break; case 5: @@ -1230,7 +1230,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; _globals.FORET = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); @@ -1800,9 +1800,9 @@ bool HopkinsEngine::runLinuxFull() { break; case 4: - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _objectsManager.PLAN_BETA(); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; break; case 5: @@ -2109,7 +2109,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; _globals.FORET = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); @@ -3036,7 +3036,7 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.RESET_SEGMENT_VESA(); _globals.FORET = false; _eventsManager.CASSE = false; - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _globals.FLAG_VISIBLE = false; _graphicsManager.LOAD_IMAGE("BOX"); _soundManager.WSOUND(28); @@ -3067,7 +3067,7 @@ void HopkinsEngine::PUBQUIT() { } void HopkinsEngine::INCENDIE() { - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _globals.iRegul = 1; _graphicsManager.LOAD_IMAGE("IM71"); _animationManager.loadAnim("ANIM71"); @@ -3098,7 +3098,7 @@ void HopkinsEngine::INCENDIE() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); _globals.SAUVEGARDE->data[svField312] = 1; - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; } void HopkinsEngine::BASE() { @@ -3178,7 +3178,7 @@ void HopkinsEngine::BASED() { _animationManager.NO_SEQ = false; _soundManager.WSOUND(26); _globals.iRegul = 1; - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _animationManager.NO_COUL = true; _graphicsManager.FADE_LINUX = 2; _animationManager.playSequence("abase.seq", 50, 15, 50); @@ -3203,15 +3203,15 @@ void HopkinsEngine::BASED() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); _globals.RESET_CACHE(); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; _globals.SORTIE = 93; _globals.iRegul = 0; } void HopkinsEngine::JOUE_FIN() { _globals.PERSO = _globals.dos_free2(_globals.PERSO); - _dialogsManager.VIRE_INVENT = true; - _globals.DESACTIVE_INVENT = true; + _dialogsManager._removeInventFl = true; + _globals._disableInventFl = true; _graphicsManager.ofscroll = 0; _globals.PLAN_FLAG = false; _globals.iRegul = 1; @@ -3249,7 +3249,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.NOPARLE = true; _talkManager.PARLER_PERSO("GM4.PE2"); - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _objectsManager.BOBANIM_OFF(6); _objectsManager.BOBANIM_OFF(10); _objectsManager.BOBANIM_ON(9); @@ -3268,7 +3268,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.NOPARLE = true; _talkManager.PARLER_PERSO("DUELB4.PE2"); _eventsManager.MOUSE_OFF(); - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; do _eventsManager.VBL(); @@ -3324,8 +3324,8 @@ void HopkinsEngine::JOUE_FIN() { Credits(); _globals.iRegul = 0; _globals.SORTIE = 300; - _dialogsManager.VIRE_INVENT = false; - _globals.DESACTIVE_INVENT = false; + _dialogsManager._removeInventFl = false; + _globals._disableInventFl = false; } else { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; @@ -3334,7 +3334,7 @@ void HopkinsEngine::JOUE_FIN() { _objectsManager.BOBANIM_ON(8); _globals.NOPARLE = true; _talkManager.PARLER_PERSO("GM5.PE2"); - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; do _eventsManager.VBL(); @@ -3352,8 +3352,8 @@ void HopkinsEngine::JOUE_FIN() { _soundManager.WSOUND(16); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 0; - _dialogsManager.VIRE_INVENT = false; - _globals.DESACTIVE_INVENT = false; + _dialogsManager._removeInventFl = false; + _globals._disableInventFl = false; _animationManager.playAnim("JOUR4A.anm", 12, 12, 1000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -3445,7 +3445,7 @@ void HopkinsEngine::AVION() { } int HopkinsEngine::PWBASE() { - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _graphicsManager.LOAD_IMAGE("PBASE"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -3496,7 +3496,7 @@ int HopkinsEngine::PWBASE() { loopCond = true; } while (!loopCond); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; _graphicsManager.FADE_OUTW(); int result; @@ -3904,7 +3904,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _globals.SORTIE = 0; _globals.AFFLI = false; _globals.AFFIVBL = true; - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _soundManager.WSOUND(a9); _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -4010,7 +4010,7 @@ bool HopkinsEngine::ADULT() { _eventsManager.CASSE = false; _globals.FORET = false; _globals.FLAG_VISIBLE = false; - _globals.DESACTIVE_INVENT = true; + _globals._disableInventFl = true; _globals.SORTIE = false; _graphicsManager.LOAD_IMAGE("ADULT"); @@ -4033,7 +4033,7 @@ bool HopkinsEngine::ADULT() { _eventsManager.VBL(); } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.BMOUSE() != 1)); - _globals.DESACTIVE_INVENT = false; + _globals._disableInventFl = false; _globals.FLAG_VISIBLE = false; _graphicsManager.FADE_OUTW(); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index a284e893d6..a6bb272685 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -59,7 +59,7 @@ int MenuManager::MENU() { while (!g_system->getEventManager()->shouldQuit()) { _vm->_globals.FORET = false; _vm->_eventsManager.CASSE = false; - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; _vm->_globals.FLAG_VISIBLE = false; _vm->_globals.SORTIE = 0; @@ -230,7 +230,7 @@ int MenuManager::MENU() { } _vm->_globals.LIBERE_FICHIER(spriteData); - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; _vm->_globals.FLAG_VISIBLE = false; _vm->_graphicsManager.FADE_OUTW(); return result; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 190dfb86b7..d83c9a53f9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -482,11 +482,11 @@ void ObjectsManager::AFF_SPRITES() { _vm->_globals.NBTRI = 0; if (_vm->_dialogsManager._inventDisplayedFl) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.Winventaire, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); if (old_cadx && old_cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, old_cadx + 300, old_cady + 300, old_cadi + 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, old_cadx + 300, old_cady + 300, old_cadi + 1); if (cadx && cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager.inventaire2, cadx + 300, cady + 300, cadi); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, cadx + 300, cady + 300, cadi); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } @@ -499,7 +499,7 @@ void ObjectsManager::AFF_SPRITES() { } // If the Options dialog is activated, draw the elements - if (_vm->_globals.OPTION_FLAG) { + if (_vm->_globals._optionDialogFl) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager.start_x + 464, 407, 0); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, @@ -560,7 +560,7 @@ void ObjectsManager::AFF_SPRITES() { } } - _vm->_dialogsManager.INVENT_ANIM(); + _vm->_dialogsManager.inventAnim(); } void ObjectsManager::INIT_BOB() { @@ -2553,7 +2553,7 @@ void ObjectsManager::PLAN_BETA() { int v5; v1 = 0; - _vm->_dialogsManager.INVENTFLAG = false; + _vm->_dialogsManager._inventFl = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; @@ -2692,14 +2692,14 @@ void ObjectsManager::BTGAUCHE() { destX = _vm->_eventsManager.XMOUSE(); destY = _vm->_eventsManager.YMOUSE(); - if (!_vm->_dialogsManager.INVENTFLAG && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { + if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { v1 = _vm->_eventsManager.btsouris; - _vm->_dialogsManager.INVENTFLAG = true; + _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); - _vm->_dialogsManager.INVENTFLAG = false; + _vm->_dialogsManager._inventFl = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; if (!_vm->_globals.SORTIE) { - _vm->_dialogsManager.INVENTFLAG = false; + _vm->_dialogsManager._inventFl = false; _vm->_eventsManager.btsouris = v1; } return; @@ -4259,7 +4259,7 @@ void ObjectsManager::SPECIAL_JEU() { && YSPR(0) > 372 && YSPR(0) <= 398; if (_vm->_globals.ECRAN == 57) { - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { BOBANIM_OFF(5); SET_BOBPOSI(5, 0); @@ -4275,10 +4275,10 @@ void ObjectsManager::SPECIAL_JEU() { ZONE_ON(14); _vm->_globals.SAUVEGARDE->data[svField261] = 3; } - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; } if (_vm->_globals.ECRAN == 93 && !_vm->_globals.SAUVEGARDE->data[svField333]) { - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; do _vm->_eventsManager.VBL(); while (BOBPOSI(8) != 3); @@ -4286,7 +4286,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_talkManager.PARLER_PERSO("GM3.PE2"); BOBANIM_OFF(8); _vm->_globals.SAUVEGARDE->data[svField333] = 1; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; } } @@ -4896,15 +4896,15 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); _vm->_globals.iRegul = 1; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; _vm->_graphicsManager.NOFADE = true; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); _vm->_graphicsManager.NOFADE = true; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; } if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4950,7 +4950,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { ++v7; } while (v7 <= 3); _vm->_graphicsManager.NOFADE = true; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; } } @@ -5431,24 +5431,24 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) if (v7) { if (v7 == 1) { if (a6 == 1 && BOBPOSI(1) == 26) { - _vm->_dialogsManager.VIRE_INVENT = true; + _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 2 && BOBPOSI(2) == 26) { - _vm->_dialogsManager.VIRE_INVENT = true; + _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 3 && BOBPOSI(3) == 27) { - _vm->_dialogsManager.VIRE_INVENT = true; + _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals.SAUVEGARDE->data[v6] = 4; } if (a6 == 4 && BOBPOSI(4) == 27) { - _vm->_dialogsManager.VIRE_INVENT = true; + _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_dialogsManager.VIRE_INVENT = true; + _vm->_dialogsManager._removeInventFl = true; _vm->_globals.SAUVEGARDE->data[v6] = 4; } } @@ -5504,9 +5504,9 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo int v9; v5 = 0; - _vm->_dialogsManager.INVENTFLAG = false; + _vm->_dialogsManager._inventFl = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; - _vm->_dialogsManager.VIRE_INVENT = false; + _vm->_dialogsManager._removeInventFl = false; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; @@ -5604,12 +5604,12 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm bool breakFlag; int xp, yp; - _vm->_dialogsManager.INVENTFLAG = false; + _vm->_dialogsManager._inventFl = false; _vm->_eventsManager.GAME_KEY = KEY_NONE; verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; - _vm->_dialogsManager.VIRE_INVENT = false; + _vm->_dialogsManager._removeInventFl = false; _vm->_globals.PLAN_FLAG = false; _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 4d4c0e27be..82f645b4f6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -691,7 +691,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("fjour.pe2"); if (v76 == 13) { _vm->_eventsManager.souris_b = _vm->_eventsManager.souris_bb; - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); @@ -766,7 +766,7 @@ LABEL_1141: if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) _vm->_graphicsManager.FADE_OUTW(); - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; _vm->_globals.HELICO = 1; } if (v76 == 36) { @@ -805,9 +805,9 @@ LABEL_1141: _vm->_graphicsManager.NOFADE = true; } if (v76 == 29) { - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; } if (v76 == 22) _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); @@ -1521,7 +1521,7 @@ LABEL_1141: if (v76 == 207) _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); if (v76 == 208) { - _vm->_globals.DESACTIVE_INVENT = true; + _vm->_globals._disableInventFl = true; if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; _vm->_eventsManager.NOESC = true; @@ -1545,7 +1545,7 @@ LABEL_1141: } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.SETANISPR(0, 64); _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; } if (v76 == 209) { _vm->_objectsManager.SET_BOBPOSI(1, 0); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 8aa3fcd090..e66705256e 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -69,8 +69,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_fontManager.TEXTE_OFF(9); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 1; - bool old_DESACTIVE_INVENT = _vm->_globals.DESACTIVE_INVENT; - _vm->_globals.DESACTIVE_INVENT = true; + bool oldDisableInventFl = _vm->_globals._disableInventFl; + _vm->_globals._disableInventFl = true; BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -185,7 +185,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v8 = v8 + 2; *v8 = *(v9 + 2); v10 = v8 + 1; - _vm->_globals.DESACTIVE_INVENT = old_DESACTIVE_INVENT; + _vm->_globals._disableInventFl = oldDisableInventFl; _vm->_graphicsManager.DD_VBL(); v11 = 0; do { @@ -198,8 +198,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_objectsManager.DESACTIVE_CURSOR = 1; STATI = 1; - bool v7 = _vm->_globals.DESACTIVE_INVENT; - _vm->_globals.DESACTIVE_INVENT = 1; + bool v7 = _vm->_globals._disableInventFl; + _vm->_globals._disableInventFl = true; BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -265,7 +265,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_objectsManager.DESACTIVE_CURSOR = 0; - _vm->_globals.DESACTIVE_INVENT = v7; + _vm->_globals._disableInventFl = v7; STATI = 0; } @@ -1353,7 +1353,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { v14 = v14 + 2; *v14 = *(v15 + 2); v16 = v14 + 1; - _vm->_globals.DESACTIVE_INVENT = false; + _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); v17 = 0; do { -- cgit v1.2.3 From 299fbfc7c7558cd8275b86ef746ba73ea5ecbee2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Dec 2012 01:53:50 +0100 Subject: HOPKINS: Start renaming EventsManager functions --- engines/hopkins/anim.cpp | 96 +++++++-------- engines/hopkins/computer.cpp | 57 ++++----- engines/hopkins/dialogs.cpp | 80 ++++++------ engines/hopkins/events.cpp | 222 ++++++++++++++++----------------- engines/hopkins/events.h | 62 ++++------ engines/hopkins/font.cpp | 12 +- engines/hopkins/globals.cpp | 4 +- engines/hopkins/graphics.cpp | 68 +++++----- engines/hopkins/hopkins.cpp | 286 +++++++++++++++++++++---------------------- engines/hopkins/menu.cpp | 10 +- engines/hopkins/objects.cpp | 156 ++++++++++++----------- engines/hopkins/saveload.cpp | 2 +- engines/hopkins/script.cpp | 12 +- engines/hopkins/sound.cpp | 6 +- engines/hopkins/talk.cpp | 38 +++--- 15 files changed, 537 insertions(+), 574 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a900a0353a..f9b47d4cbf 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -107,13 +107,13 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { // Do pre-animation delay do { - if (_vm->_eventsManager.ESC_KEY == true) + if (_vm->_eventsManager._escKeyFl) goto EXIT; _vm->_eventsManager.CONTROLE_MES(); @@ -140,7 +140,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY) + if (_vm->_eventsManager._escKeyFl) goto EXIT; _vm->_eventsManager.CONTROLE_MES(); @@ -172,7 +172,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { // Do post-animation delay do { - if (_vm->_eventsManager.ESC_KEY) + if (_vm->_eventsManager._escKeyFl) break; _vm->_eventsManager.CONTROLE_MES(); @@ -313,12 +313,12 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; for (;;) { - if (_vm->_eventsManager.ESC_KEY == true) + if (_vm->_eventsManager._escKeyFl == true) goto LABEL_114; if (redrawAnim() == true) break; @@ -349,18 +349,17 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else { - _vm->_eventsManager.souris_max(); _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); @@ -428,7 +427,7 @@ LABEL_77: LABEL_88: if (v5 == -1) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager.ESC_KEY != true) { + while (_vm->_eventsManager._escKeyFl != true) { if (redrawAnim() == true) { if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_114; @@ -453,18 +452,17 @@ LABEL_88: _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else { - _vm->_eventsManager.souris_max(); _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); @@ -492,7 +490,7 @@ LABEL_88: goto LABEL_114; } } - while (_vm->_eventsManager.ESC_KEY != true) { + while (_vm->_eventsManager._escKeyFl != true) { if (redrawAnim() == true) { if (_vm->_graphicsManager.NOLOCK == true) break; @@ -517,18 +515,17 @@ LABEL_88: _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else { - _vm->_eventsManager.souris_max(); _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); @@ -618,18 +615,17 @@ LABEL_114: _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else { - _vm->_eventsManager.souris_max(); _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); @@ -944,7 +940,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui return; v7 = 0; - _vm->_eventsManager.souris_flag = false; + _vm->_eventsManager._mouseFl = false; if (!NO_COUL) { _vm->_eventsManager.VBL(); @@ -1003,14 +999,14 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } if (_vm->getIsDemo()) { _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY == true) { - if (!_vm->_eventsManager.NOESC) + if (_vm->_eventsManager._escKeyFl == true) { + if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1020,14 +1016,14 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (NO_COUL) _vm->_graphicsManager.FADE_INW_LINUX(v9); _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY) { - if (!_vm->_eventsManager.NOESC) + if (_vm->_eventsManager._escKeyFl) { + if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1050,10 +1046,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.read(v9, READ_LE_UINT32(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY == true) { - if (!_vm->_eventsManager.NOESC) + if (_vm->_eventsManager._escKeyFl == true) { + if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1083,10 +1079,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager.ESC_KEY == true) { - if (!_vm->_eventsManager.NOESC) + if (_vm->_eventsManager._escKeyFl == true) { + if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.CONTROLE_MES(); _vm->_soundManager.VERIF_SOUND(); @@ -1101,7 +1097,7 @@ LABEL_59: _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - _vm->_eventsManager.souris_flag = true; + _vm->_eventsManager._mouseFl = true; } if (v7 == 1) _vm->_globals.dos_free2(ptr); @@ -1126,7 +1122,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->shouldQuit()) return; - _vm->_eventsManager.souris_flag = false; + _vm->_eventsManager._mouseFl = false; v10 = _vm->_graphicsManager.VESA_SCREEN; v11 = _vm->_globals.dos_malloc2(0x16u); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); @@ -1176,12 +1172,12 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager.lItCounter = 0; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) break; while (!_vm->shouldQuit()) { - if (_vm->_eventsManager.ESC_KEY == true) + if (_vm->_eventsManager._escKeyFl == true) goto LABEL_54; if (redrawAnim() == true) break; @@ -1239,7 +1235,7 @@ LABEL_33: LABEL_44: if (v4) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager.ESC_KEY != true) { + while (_vm->_eventsManager._escKeyFl != true) { if (redrawAnim() == true) goto LABEL_48; _vm->_eventsManager.CONTROLE_MES(); @@ -1254,7 +1250,7 @@ LABEL_53: goto LABEL_54; } } - while (_vm->_eventsManager.ESC_KEY != true) { + while (_vm->_eventsManager._escKeyFl != true) { _vm->_eventsManager.CONTROLE_MES(); if (redrawAnim() == true) goto LABEL_48; @@ -1308,7 +1304,7 @@ LABEL_54: f.close(); _vm->_globals.dos_free2(v11); - _vm->_eventsManager.souris_flag = true; + _vm->_eventsManager._mouseFl = true; } } // End of namespace Hopkins diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 2d96603513..4f818770f7 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -85,7 +85,7 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); _vm->_graphicsManager.FADE_INW(); loadMenu(); - _vm->_eventsManager.souris_flag = false; + _vm->_eventsManager._mouseFl = false; } /** @@ -124,13 +124,12 @@ void ComputerManager::showComputer(ComputerEnum mode) { char s[12]; const char *s2; - _vm->_eventsManager.ESC_KEY = 0; + _vm->_eventsManager._escKeyFl = false; passwordMatch = false; _vm->_graphicsManager.RESET_SEGMENT_VESA(); setVideoMode(); setTextColor(4); - _vm->_eventsManager.videkey(); setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) outText(Common::String(_menuText[0]._line)); @@ -195,8 +194,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { if (passwordMatch) { while (!_vm->shouldQuit()) { - _vm->_eventsManager.ESC_KEY = false; - _vm->_eventsManager.videkey(); + _vm->_eventsManager._escKeyFl = false; clearScreen(); setTextColor(4); setTextPosition(2, 4); @@ -222,7 +220,6 @@ void ComputerManager::showComputer(ComputerEnum mode) { setTextPosition(16, 25); outText2(Common::String(_menuText[11]._line)); } else if (mode == COMPUTER_SAMANTHAS) { - _vm->_eventsManager.videkey(); setTextPosition(10, 25); // outText2(Common::String(_menuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy outText2(Common::String(_menuText[12]._line)); @@ -254,7 +251,6 @@ void ComputerManager::showComputer(ComputerEnum mode) { if (v12 == '1') { displayGamesSubMenu(); } else if (mode == COMPUTER_HOPKINS) { - _vm->_eventsManager.videkey(); clearScreen(); setTextColor(4); setTextPosition(2, 4); @@ -307,7 +303,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); restoreFBIRoom(); - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); } if (mode == 1) _vm->_globals.SORTIE = 13; @@ -365,8 +361,8 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { int x2 = 0; int textIndex = 0; - bool oldMouseFlag = _vm->_eventsManager.souris_flag; - _vm->_eventsManager.souris_flag = false; + bool oldMouseFlag = _vm->_eventsManager._mouseFl; + _vm->_eventsManager._mouseFl = false; _vm->_fontManager.TEXT_NOW(xp, yp, "_", -4); do { @@ -480,7 +476,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; - _vm->_eventsManager.souris_flag = oldMouseFlag; + _vm->_eventsManager._mouseFl = oldMouseFlag; } /** @@ -507,7 +503,7 @@ void ComputerManager::restoreFBIRoom() { _vm->_globals.police_l = 12; _vm->_globals.police_h = 21; - _vm->_eventsManager.souris_flag = true; + _vm->_eventsManager._mouseFl = true; } /** @@ -528,7 +524,7 @@ void ComputerManager::readText(int idx) { Common::String numStr; int num; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; if (_vm->_globals.FR == 0) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKAN.TXT"); @@ -585,7 +581,6 @@ void ComputerManager::readText(int idx) { ++v10; } while (v4 != 37); - _vm->_eventsManager.videkey(); _vm->_eventsManager.keywin(); _vm->_globals.dos_free2(ptr); } @@ -598,10 +593,9 @@ void ComputerManager::displayGamesSubMenu() { uint oldSpeed = _vm->_globals.vitesse; _vm->_globals.vitesse = 1; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); _breakoutSpr = g_PTRNUL; - _vm->_eventsManager.CASSE = true; - _vm->_eventsManager.CASSE_SOURIS_ON(); + _vm->_eventsManager._breakoutFl = true; _breakoutLevel = (int16 *)g_PTRNUL; _breakoutBrickNbr = 0; _breakoutScore = 0; @@ -633,8 +627,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); _vm->_globals.vitesse = oldSpeed; - _vm->_eventsManager.CASSE = false; - _vm->_eventsManager.CASSE_SOURIS_OFF(); + _vm->_eventsManager._breakoutFl = false; setVideoMode(); setTextColor(15); clearScreen(); @@ -724,7 +717,7 @@ void ComputerManager::newLevel() { RAQX = 150; _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.SPRITE_ON(1); - _vm->_eventsManager.MOUSE_ON1(); + _vm->_eventsManager.mouseOn(); _vm->_soundManager.PLAY_SAMPLE(3, 5); } @@ -809,7 +802,7 @@ void ComputerManager::playBreakout() { while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) { // Set up the racket and ball - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); _ballPosition = Common::Point(RAQX + 14, 187); _vm->_objectsManager.SETYSPR(1, 187); _vm->_objectsManager.SETXSPR(1, _ballPosition.x); @@ -819,8 +812,8 @@ void ComputerManager::playBreakout() { // Wait for mouse press to start playing do { - RAQX = _vm->_eventsManager.XMOUSE(); - if (_vm->_eventsManager.souris_x <= 4) + RAQX = _vm->_eventsManager.getMouseX(); + if (_vm->_eventsManager._mousePos.x <= 4) RAQX = 5; if (RAQX > 282) RAQX = 282; @@ -828,7 +821,7 @@ void ComputerManager::playBreakout() { _vm->_objectsManager.SETXSPR(1, RAQX + 14); _vm->_objectsManager.SETYSPR(1, 187); _vm->_eventsManager.VBL(); - } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); + } while (!_vm->shouldQuit() && _vm->_eventsManager.getMouseButton() != 1); _breakoutSpeed = 1; _ballPosition = Common::Point(RAQX + 14, 187); @@ -839,8 +832,8 @@ void ComputerManager::playBreakout() { do { _vm->_soundManager.checkSounds(); - RAQX = _vm->_eventsManager.XMOUSE(); - if (_vm->_eventsManager.souris_x <= 4) + RAQX = _vm->_eventsManager.getMouseX(); + if (_vm->_eventsManager._mousePos.x <= 4) RAQX = 5; if (RAQX > 282) RAQX = 282; @@ -858,7 +851,7 @@ void ComputerManager::playBreakout() { if (_breakoutLives) continue; } - _vm->_eventsManager.MOUSE_ON1(); + _vm->_eventsManager.mouseOn(); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.SPRITE_OFF(1); if (_breakoutScore > _breakoutHiscore) @@ -923,18 +916,18 @@ int ComputerManager::displayHiscores() { buttonIndex = 0; do { _vm->_eventsManager.CONTROLE_MES(); - xp = _vm->_eventsManager.XMOUSE(); - yp = _vm->_eventsManager.YMOUSE(); + xp = _vm->_eventsManager.getMouseX(); + yp = _vm->_eventsManager.getMouseY(); - if (_vm->_eventsManager.BMOUSE() == 1 && ABS(xp - 79) <= 33 && ABS(yp - 396) <= 13) + if (_vm->_eventsManager.getMouseButton() == 1 && ABS(xp - 79) <= 33 && ABS(yp - 396) <= 13) buttonIndex = 1; - else if (_vm->_eventsManager.BMOUSE() == 1 && ABS(xp - 583) <= 32 && ABS(yp - 396) <= 13) + else if (_vm->_eventsManager.getMouseButton() == 1 && ABS(xp - 583) <= 32 && ABS(yp - 396) <= 13) buttonIndex = 2; _vm->_eventsManager.VBL(); } while (!buttonIndex && !_vm->shouldQuit()); - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.FADE_OUT_CASSE(); _vm->_globals.LIBERE_FICHIER(ptr); return buttonIndex; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 617221fa88..9b842a15c5 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -57,7 +57,7 @@ void DialogsManager::showOptionsDialog() { bool doneFlag; doneFlag = false; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); if (_vm->_globals.FR == 1) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIFR.SPR"); @@ -70,10 +70,10 @@ void DialogsManager::showOptionsDialog() { _vm->_globals._optionDialogFl = true; do { - if (_vm->_eventsManager.BMOUSE()) { - Common::Point mousePos(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); - mousePos.x = _vm->_eventsManager.XMOUSE(); - mousePos.y = _vm->_eventsManager.YMOUSE(); + if (_vm->_eventsManager.getMouseButton()) { + Common::Point mousePos(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); + mousePos.x = _vm->_eventsManager.getMouseX(); + mousePos.y = _vm->_eventsManager.getMouseY(); if (!_vm->_soundManager.MUSICOFF) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { @@ -308,8 +308,8 @@ void DialogsManager::showInventory() { _vm->_objectsManager.FLAG_VISIBLE = false; for (int v1 = 0; v1 <= 1; v1++) { inventAnim(); - _vm->_eventsManager.XMOUSE(); - _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.getMouseX(); + _vm->_eventsManager.getMouseY(); _vm->_eventsManager.VBL(); } _vm->_dialogsManager._inventWin1 = g_PTRNUL; @@ -378,9 +378,9 @@ LABEL_7: // Turn on drawing the inventory dialog in the event manager _inventDisplayedFl = true; - int v8 = _vm->_eventsManager.XMOUSE(); - int v9 = _vm->_eventsManager.YMOUSE(); - int v12 = _vm->_eventsManager.BMOUSE(); + int v8 = _vm->_eventsManager.getMouseX(); + int v9 = _vm->_eventsManager.getMouseY(); + int v12 = _vm->_eventsManager.getMouseButton(); int v10 = v13; int v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); v13 = v11; @@ -392,7 +392,7 @@ LABEL_7: if (v12 == 2) { _vm->_objectsManager.OBJETPLUS(v13); if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); } } } @@ -415,7 +415,7 @@ LABEL_7: if (_vm->_soundManager.VOICEOFF == 1) { do _vm->_eventsManager.VBL(); - while (!_vm->_globals.SORTIE && _vm->_eventsManager.BMOUSE() != 1); + while (!_vm->_globals.SORTIE && _vm->_eventsManager.getMouseButton() != 1); _vm->_fontManager.TEXTE_OFF(9); } if (_vm->_globals.SORTIE) { @@ -461,7 +461,7 @@ LABEL_7: _vm->_dialogsManager.showSaveGame(); _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); _vm->_objectsManager.old_cady = 0; _vm->_objectsManager.cady = 0; _vm->_objectsManager.old_cadx = 0; @@ -522,12 +522,12 @@ void DialogsManager::inventAnim() { */ void DialogsManager::testDialogOpening() { if (_vm->_globals.PLAN_FLAG) - _vm->_eventsManager.GAME_KEY = KEY_NONE; + _vm->_eventsManager._gameKey = KEY_NONE; - if (_vm->_eventsManager.GAME_KEY != KEY_NONE) { + if (_vm->_eventsManager._gameKey != KEY_NONE) { if (!_inventFl) { - DIALOG_KEY key = _vm->_eventsManager.GAME_KEY; - _vm->_eventsManager.GAME_KEY = KEY_NONE; + DIALOG_KEY key = _vm->_eventsManager._gameKey; + _vm->_eventsManager._gameKey = KEY_NONE; _inventFl = true; switch (key) { @@ -554,7 +554,7 @@ void DialogsManager::testDialogOpening() { } _inventFl = false; - _vm->_eventsManager.GAME_KEY = KEY_NONE; + _vm->_eventsManager._gameKey = KEY_NONE; } } } @@ -571,11 +571,11 @@ void DialogsManager::showLoadGame() { do { slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); - } while (_vm->_eventsManager.BMOUSE() != 1); + } while (_vm->_eventsManager.getMouseButton() != 1); } while (!slotNumber); _vm->_objectsManager.SL_FLAG = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, 457, 413); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); @@ -603,12 +603,12 @@ void DialogsManager::showSaveGame() { do { slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); - } while (!_vm->shouldQuit() && _vm->_eventsManager.BMOUSE() != 1); + } while (!_vm->shouldQuit() && _vm->_eventsManager.getMouseButton() != 1); } while (!_vm->shouldQuit() && !slotNumber); _vm->_objectsManager.SL_FLAG = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager.start_x + 183, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x + 183, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); @@ -647,18 +647,18 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVE2.SPR"); _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 483, 360, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); if (_vm->_globals.FR) { if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 525, 375, 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 525, 375, 1); if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 515, 375, 2); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 515, 375, 2); } else { if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 535, 372, 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 535, 372, 1); if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 539, 372, 2); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 539, 372, 2); } for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { @@ -670,22 +670,22 @@ void DialogsManager::showSaveLoad(int a1) { switch (slotNumber) { case 1: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 190, 112, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 190, 112, 0x80u, 87); break; case 2: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 323, 112, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 112, 0x80u, 87); break; case 3: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 190, 203, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 190, 203, 0x80u, 87); break; case 4: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 323, 203, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 203, 0x80u, 87); break; case 5: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 190, 294, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 190, 294, 0x80u, 87); break; case 6: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager.start_x + 323, 294, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 294, 0x80u, 87); break; } @@ -695,7 +695,7 @@ void DialogsManager::showSaveLoad(int a1) { } } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); _vm->_objectsManager.SL_FLAG = true; _vm->_objectsManager.SL_MODE = a1; _vm->_objectsManager.SL_X = 0; @@ -707,12 +707,12 @@ void DialogsManager::showSaveLoad(int a1) { */ int DialogsManager::searchSavegames() { int slotNumber = 0; - int xp = _vm->_eventsManager.XMOUSE(); - int yp = _vm->_eventsManager.YMOUSE(); + int xp = _vm->_eventsManager.getMouseX(); + int yp = _vm->_eventsManager.getMouseY(); - _vm->_graphicsManager.ofscroll = _vm->_eventsManager.start_x; + _vm->_graphicsManager.ofscroll = _vm->_eventsManager._startPos.x; if ((uint16)(yp - 112) <= 0x56u) { - if (xp > _vm->_eventsManager.start_x + 189 && xp < _vm->_eventsManager.start_x + 318) + if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) slotNumber = 1; if ((uint16)(yp - 112) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) slotNumber = 2; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index d876481393..f99c1bdb34 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -32,115 +32,115 @@ namespace Hopkins { EventsManager::EventsManager() { - souris_flag = false; - mouse_linux = false; - souris_sizex = souris_sizey = 0; - ofset_souris_x = ofset_souris_y = 0; - start_x = start_y = 0; - CASSE = false; + _mouseFl = false; + _mouseLinuxFl = false; + _mouseSizeX = _mouseSizeY = 0; + _mouseOffset.x = _mouseOffset.y = 0; + _startPos.x = _startPos.y = 0; + _breakoutFl = false; souris_n = 0; souris_bb = 0; souris_b = 0; - pointeur_souris = NULL; + _mouseCursor = NULL; _gameCounter = 0; lItCounter = 0; - ESC_KEY = false; - GAME_KEY = KEY_NONE; + _escKeyFl = false; + _gameKey = KEY_NONE; btsouris = 0; - OLD_ICONE = 0; - Bufferobjet = NULL; + _oldIconId = 0; + _objectBuf = NULL; - Common::fill(&keyState[0], &keyState[256], false); + Common::fill(&_keyState[0], &_keyState[256], false); _priorCounterTime = 0; _priorFrameTime = 0; } EventsManager::~EventsManager() { - _vm->_globals.dos_free2(Bufferobjet); - _vm->_globals.dos_free2(pointeur_souris); + _vm->_globals.dos_free2(_objectBuf); + _vm->_globals.dos_free2(_mouseCursor); } void EventsManager::setParent(HopkinsEngine *vm) { _vm = vm; } -// Install Mouse -void EventsManager::INSTALL_SOURIS() { - // No implementation in original -} - // Mouse On -void EventsManager::souris_on() { - souris_flag = true; +void EventsManager::setMouseOn() { + _mouseFl = true; - if (mouse_linux) { - souris_sizex = 52; - souris_sizey = 32; + if (_mouseLinuxFl) { + _mouseSizeX = 52; + _mouseSizeY = 32; } else { - souris_sizex = 34; - souris_sizey = 20; + _mouseSizeX = 34; + _mouseSizeY = 20; } - ofset_souris_x = 0; - ofset_souris_y = 0; + _mouseOffset.x = 0; + _mouseOffset.y = 0; - if (!CASSE) - souris_xy(300, 200); + if (!_breakoutFl) + setMouseXY(300, 200); else - souris_xy(150, 100); + setMouseXY(150, 100); } -// Set Mouse position -void EventsManager::souris_xy(int xp, int yp) { +/** + * Set Mouse position + */ +void EventsManager::setMouseXY(int xp, int yp) { g_system->warpMouse(xp, yp); } -// Mouse Max -void EventsManager::souris_max() { - // No implementation in original -} - -// Get Mouse X -int EventsManager::XMOUSE() { - souris_x = start_x + g_system->getEventManager()->getMousePos().x; - souris_y = g_system->getEventManager()->getMousePos().y; +/** + * Get Mouse X + */ +int EventsManager::getMouseX() { + _mousePos.x = _startPos.x + g_system->getEventManager()->getMousePos().x; + _mousePos.y = g_system->getEventManager()->getMousePos().y; - return souris_x + ofset_souris_x; + return _mousePos.x + _mouseOffset.x; } -// Get Mouse Y -int EventsManager::YMOUSE() { - souris_x = start_x + g_system->getEventManager()->getMousePos().x; - souris_y = g_system->getEventManager()->getMousePos().y; +/** + * Get Mouse Y + */ +int EventsManager::getMouseY() { + _mousePos.x = _startPos.x + g_system->getEventManager()->getMousePos().x; + _mousePos.y = g_system->getEventManager()->getMousePos().y; - return souris_y + ofset_souris_y; + return _mousePos.y + _mouseOffset.y; } -// Get Mouse Button -int EventsManager::BMOUSE() { +/** + * Get Mouse Button + */ +int EventsManager::getMouseButton() { CONTROLE_MES(); return souris_bb; } -// Mouse Off -void EventsManager::MOUSE_OFF() { - souris_flag = false; +/** + * Mouse Off + */ +void EventsManager::mouseOff() { + _mouseFl = false; CursorMan.showMouse(false); } -// Mouse On -void EventsManager::MOUSE_ON() { - souris_on(); - souris_flag = true; +/** + * Mouse On + */ +void EventsManager::mouseOn() { + setMouseOn(); + _mouseFl = true; CursorMan.showMouse(true); } -void EventsManager::MOUSE_ON1() { - MOUSE_ON(); -} - -// Change Mouse Cursor -void EventsManager::CHANGE_MOUSE(int id) { +/** + * Change Mouse Cursor + */ +void EventsManager::changeMouseCursor(int id) { int cursorId = id; if (btsouris != 23) { @@ -149,8 +149,8 @@ void EventsManager::CHANGE_MOUSE(int id) { if (cursorId == 25) cursorId = 5; - if (OLD_ICONE != cursorId || !cursorId) { - OLD_ICONE = cursorId; + if (_oldIconId != cursorId || !cursorId) { + _oldIconId = cursorId; souris_n = cursorId; updateCursor(); @@ -204,11 +204,11 @@ void EventsManager::pollEvents() { return; case Common::EVENT_KEYDOWN: - keyState[(byte)toupper(event.kbd.ascii)] = true; + _keyState[(byte)toupper(event.kbd.ascii)] = true; handleKey(event); return; case Common::EVENT_KEYUP: - keyState[(byte)toupper(event.kbd.ascii)] = false; + _keyState[(byte)toupper(event.kbd.ascii)] = false; return; case Common::EVENT_LBUTTONDOWN: souris_b = 1; @@ -226,23 +226,23 @@ void EventsManager::pollEvents() { } for (char chr = 'A'; chr <= 'Z'; chr++) - keyState[(byte)chr] = false; + _keyState[(byte)chr] = false; for (char chr = '0'; chr <= '9'; chr++) - keyState[(byte)chr] = false; + _keyState[(byte)chr] = false; } void EventsManager::handleKey(Common::Event &event) { - ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE; + _escKeyFl = (event.kbd.keycode == Common::KEYCODE_ESCAPE); if (event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB) - GAME_KEY = KEY_INVENTORY; + _gameKey = KEY_INVENTORY; else if (event.kbd.keycode == Common::KEYCODE_F5) - GAME_KEY = KEY_SAVE; + _gameKey = KEY_SAVE; else if (event.kbd.keycode == Common::KEYCODE_F7) - GAME_KEY = KEY_LOAD; + _gameKey = KEY_LOAD; else if (event.kbd.keycode == Common::KEYCODE_F1 || event.kbd.keycode == Common::KEYCODE_o) - GAME_KEY = KEY_OPTIONS; + _gameKey = KEY_OPTIONS; // Check for debugger if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { @@ -261,35 +261,35 @@ int EventsManager::keywin() { return -1; for (char ch = 'A'; ch <= 'Z'; ++ch) { - if (keyState[(byte)ch]) { + if (_keyState[(byte)ch]) { foundChar = ch; break; } } for (char ch = '0'; ch <= '9'; ++ch) { - if (keyState[(byte)ch]) { + if (_keyState[(byte)ch]) { foundChar = ch; break; } } - if (keyState[(byte)'.']) + if (_keyState[(byte)'.']) foundChar = '.'; - else if (keyState[8]) + else if (_keyState[8]) // BACKSPACE foundChar = 8; - else if (keyState[13]) + else if (_keyState[13]) // ENTER foundChar = 13; - else if (keyState[(byte)' ']) + else if (_keyState[(byte)' ']) foundChar = ' '; VBL(); } // Wait for keypress release - while (keyState[(byte)foundChar] && !_vm->shouldQuit()) { + while (_keyState[(byte)foundChar] && !_vm->shouldQuit()) { VBL(); g_system->delayMillis(10); } @@ -311,7 +311,7 @@ void EventsManager::VBL() { if (_vm->_graphicsManager.REDRAW) { _vm->_graphicsManager.DD_Lock(); - if (CASSE) { + if (_breakoutFl) { _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.REDRAW = 0; } else { @@ -323,45 +323,45 @@ void EventsManager::VBL() { } _vm->_graphicsManager.DD_Unlock(); } - if (souris_flag == true) { + if (_mouseFl == true) { v1 = 20; - if (!mouse_linux) + if (!_mouseLinuxFl) v1 = 10; v2 = 20; - if (!mouse_linux) + if (!_mouseLinuxFl) v2 = 15; - v15 = souris_x - v1; - yp = souris_y; - v14 = souris_sizex; - v13 = souris_sizey; + v15 = _mousePos.x - v1; + yp = _mousePos.y; + v14 = _mouseSizeX; + v13 = _mouseSizeY; if (btsouris == 23) { v14 = _vm->_globals.OBJL; v13 = _vm->_globals.OBJH; goto LABEL_35; } - if (CASSE) { + if (_breakoutFl) { if (v15 < _vm->_graphicsManager.min_x) v15 = _vm->_graphicsManager.min_x; - if (souris_y < _vm->_graphicsManager.min_y) + if (_mousePos.y < _vm->_graphicsManager.min_y) yp = _vm->_graphicsManager.min_y; - if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) - v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x); - if (yp + souris_sizey < _vm->_graphicsManager.max_y) + if (_mouseSizeX + v15 >= _vm->_graphicsManager.max_x) + v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager.max_x); + if (yp + _mouseSizeY < _vm->_graphicsManager.max_y) goto LABEL_34; - v3 = yp + souris_sizey - _vm->_graphicsManager.max_y; + v3 = yp + _mouseSizeY - _vm->_graphicsManager.max_y; } else { if (v15 < _vm->_graphicsManager.min_x) v15 = _vm->_graphicsManager.min_x - v1; v2 = (int16)v2; - if (souris_y < _vm->_graphicsManager.min_y - (int16)v2) + if (_mousePos.y < _vm->_graphicsManager.min_y - (int16)v2) yp = _vm->_graphicsManager.min_y - (int16)v2; - if (souris_sizex + v15 >= _vm->_graphicsManager.max_x) - v14 = souris_sizex - (souris_sizex + v15 - _vm->_graphicsManager.max_x - v1); - if (yp + souris_sizey < v2 + _vm->_graphicsManager.max_y) + if (_mouseSizeX + v15 >= _vm->_graphicsManager.max_x) + v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager.max_x - v1); + if (yp + _mouseSizeY < v2 + _vm->_graphicsManager.max_y) goto LABEL_34; - v3 = v2 + yp + souris_sizey - _vm->_graphicsManager.max_y; + v3 = v2 + yp + _mouseSizeY - _vm->_graphicsManager.max_y; } - v13 = souris_sizey - v3; + v13 = _mouseSizeY - v3; LABEL_34: v12 = v14 + v15; v11 = yp + v13; @@ -369,7 +369,7 @@ LABEL_34: LABEL_35: if (!_vm->_globals.PUBEXIT) _vm->_objectsManager.AFF_SPRITES(); - if (souris_flag != true) { + if (_mouseFl != true) { updateCursor(); goto LABEL_54; } @@ -410,10 +410,10 @@ LABEL_54: while (!_vm->shouldQuit()) { checkForNextFrameCounter(); - while (CASSE || _vm->_globals.iRegul != 1) { + while (_breakoutFl || _vm->_globals.iRegul != 1) { checkForNextFrameCounter(); - if (CASSE != true) + if (_breakoutFl != true) goto LABEL_63; if (lItCounter > 1) goto LABEL_65; @@ -434,9 +434,9 @@ LABEL_65: } else { int v4; if (_vm->_graphicsManager.no_scroll != 2) { - if (XMOUSE() > _vm->_graphicsManager.SCROLL + 620) + if (getMouseX() > _vm->_graphicsManager.SCROLL + 620) _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; - if (XMOUSE() < _vm->_graphicsManager.SCROLL + 10) + if (getMouseX() < _vm->_graphicsManager.SCROLL + 10) _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; } if (_vm->_graphicsManager.SCROLL < 0) @@ -487,12 +487,12 @@ LABEL_65: } } _vm->_globals.NBBLOC = 0; - start_x = v4; + _startPos.x = v4; _vm->_graphicsManager.ofscroll = v4; _vm->_graphicsManager.SCROLL = v4; } _vm->_graphicsManager.OLD_SCROLL = v4; - start_x = v4; + _startPos.x = v4; _vm->_graphicsManager.ofscroll = v4; } souris_bb = souris_b; @@ -541,10 +541,10 @@ void EventsManager::updateCursor() { if (btsouris != 23) { // Draw standard cursor - _vm->_graphicsManager.Sprite_Vesa(cursorSurface, pointeur_souris, 300, 300, souris_n); + _vm->_graphicsManager.Sprite_Vesa(cursorSurface, _mouseCursor, 300, 300, souris_n); } else { // Draw the active inventory object - _vm->_graphicsManager.Affiche_Perfect(cursorSurface, Bufferobjet, 300, 300, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(cursorSurface, _objectBuf, 300, 300, 0, 0, 0, 0); } // Reset the clipping bounds @@ -572,7 +572,7 @@ void EventsManager::updateCursor() { } // Calculate the X offset within the pointer image to the actual cursor data - int xOffset = !mouse_linux ? 10 : 20; + int xOffset = !_mouseLinuxFl ? 10 : 20; // Set the ScummVM cursor from the surface Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 94ce87f8a1..fef8c2a4c2 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -45,44 +45,41 @@ private: void checkForNextFrameCounter(); void updateCursor(); public: - bool souris_flag; - bool mouse_linux; - 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 OLD_ICONE; + bool _mouseFl; + bool _mouseLinuxFl; + int _mouseSizeX, _mouseSizeY; + Common::Point _mouseOffset; + Common::Point _startPos; + Common::Point _mousePos; + bool _breakoutFl; + int _oldIconId; int souris_n; int souris_bb; int souris_b; - byte *pointeur_souris; + byte *_mouseCursor; uint32 _gameCounter; uint32 lItCounter; uint32 _priorCounterTime; uint32 _priorFrameTime; - bool ESC_KEY; - bool NOESC; - DIALOG_KEY GAME_KEY; + bool _escKeyFl; + bool _disableEscKeyFl; + DIALOG_KEY _gameKey; int btsouris; - byte *Bufferobjet; - bool keyState[256]; + byte *_objectBuf; + bool _keyState[256]; public: EventsManager(); ~EventsManager(); void setParent(HopkinsEngine *vm); - void INSTALL_SOURIS(); - void souris_on(); - void souris_xy(int xp, int yp); - void souris_max(); - int XMOUSE(); - int YMOUSE(); - int BMOUSE(); - void MOUSE_ON(); - void MOUSE_ON1(); - void MOUSE_OFF(); - void CHANGE_MOUSE(int id); + void setMouseOn(); + void setMouseXY(int xp, int yp); + int getMouseX(); + int getMouseY(); + int getMouseButton(); + void mouseOn(); + void mouseOff(); + void changeMouseCursor(int id); void CONTROLE_MES(); void delay(int delay); @@ -93,21 +90,6 @@ public: * @return Keypress, or -1 if game quit was requested */ int keywin(); - - /** - * Unused by engine - */ - void videkey() { } - - /** - * Unused by engine - */ - void CASSE_SOURIS_ON() { } - - /** - * Unused by engine - */ - void CASSE_SOURIS_OFF() { } }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index dccba0d3ea..9efae223cd 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -262,7 +262,7 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, if (v17 < 0) v17 = -v17; Txt[idx].xp = 320 - v17; - v73 = _vm->_eventsManager.start_x + 320 - v17; + v73 = _vm->_eventsManager._startPos.x + 320 - v17; lineCount = 1; if (v64 + 1 > 0) { Txt[idx].lines[0] = Common::String((const char *)v60, v64); @@ -351,10 +351,10 @@ LABEL_57: if ((uint16)(Txt[idx].field3FC - 2) > 1u) { int i; - for (i = xp - _vm->_eventsManager.start_x; _vm->_globals.largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC; i -= 2) + for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals.largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC; i -= 2) ; Txt[idx].xp = i; - v73 = _vm->_eventsManager.start_x + i; + v73 = _vm->_eventsManager._startPos.x + i; } else { if (_vm->_globals.nbrligne == (SCREEN_WIDTH - 1)) { while (_vm->_globals.largeur_boite + v73 > 638 && v73 > -2) @@ -377,8 +377,8 @@ LABEL_57: if (v27 < 0) v27 = -v27; Txt[idx].xp = 315 - v27; - int v28 = _vm->_eventsManager.start_x + 315 - v27; - v73 = _vm->_eventsManager.start_x + 315 - v27; + int v28 = _vm->_eventsManager._startPos.x + 315 - v27; + v73 = _vm->_eventsManager._startPos.x + 315 - v27; Txt[idx].yp = 50; v70 = 50; v55 = 50; @@ -500,7 +500,7 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5); v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5); _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); - if (_vm->_eventsManager.ESC_KEY) { + if (_vm->_eventsManager._escKeyFl) { _vm->_globals.iRegul = 1; _vm->_eventsManager.VBL(); } else { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 7a91dc074d..e5a4e85ed4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -367,7 +367,7 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; NUM_FICHIER_OBJ = 0; Bufferdecor = g_PTRNUL; - _vm->_eventsManager.Bufferobjet = g_PTRNUL; + _vm->_eventsManager._objectBuf = g_PTRNUL; _vm->_dialogsManager._inventWin1 = g_PTRNUL; _vm->_dialogsManager._inventBuf2 = g_PTRNUL; COUCOU = g_PTRNUL; @@ -418,7 +418,7 @@ void Globals::clearAll() { largeur_boite = 240; TEXTE_FORMATE = 300; - _vm->_eventsManager.Bufferobjet = dos_malloc2(2500); + _vm->_eventsManager._objectBuf = dos_malloc2(2500); INVENTAIRE_OBJET = dos_malloc2(2500); ADR_FICHIER_OBJ = g_PTRNUL; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 38cbcc6126..0fd0de58dd 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -193,7 +193,6 @@ void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); A_PCX320(VESA_SCREEN, _vm->_globals.NFICHIER, Palette); memcpy(VESA_BUFFER, VESA_SCREEN, 0xFA00u); - _vm->_eventsManager.souris_max(); SCANLINE(320); max_x = 320; @@ -230,7 +229,6 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { Cls_Pal(); if (!DOUBLE_ECRAN) { - _vm->_eventsManager.souris_max(); SCANLINE(SCREEN_WIDTH); max_x = SCREEN_WIDTH; DD_Lock(); @@ -297,7 +295,7 @@ void GraphicsManager::INIT_TABLE(int minIndex, int maxIndex, byte *palette) { // Scroll Screen int GraphicsManager::SCROLL_ECRAN(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); - _vm->_eventsManager.start_x = result; + _vm->_eventsManager._startPos.x = result; ofscroll = result; SCROLL = result; return result; @@ -809,9 +807,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface setpal_vga256(palData2); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } } @@ -822,9 +820,9 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface // Refresh the screen if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } } @@ -849,9 +847,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -870,9 +868,9 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -887,7 +885,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac if (Winbpp == 2) { if (!SDL_ECHELLE) { - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } goto LABEL_28; @@ -899,12 +897,12 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); if (Winbpp == 2) { if (!SDL_ECHELLE) { - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } LABEL_28: - m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } } @@ -939,9 +937,9 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(surface, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -1547,7 +1545,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (bloc.field0 != 1) continue; - if (_vm->_eventsManager.CASSE != false) { + if (_vm->_eventsManager._breakoutFl) { if (Winbpp == 1) { Copy_Vga(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); } else if (Winbpp == 2) { @@ -1558,17 +1556,17 @@ void GraphicsManager::Affiche_Segment_Vesa() { dstRect.top = bloc.y1 * 2 + 30; dstRect.setWidth((bloc.x2 - bloc.x1) * 2); dstRect.setHeight((bloc.y2 - bloc.y1) * 2); - } else if (bloc.x2 > _vm->_eventsManager.start_x && bloc.x1 < (_vm->_eventsManager.start_x + SCREEN_WIDTH)) { - if (bloc.x1 < _vm->_eventsManager.start_x) - bloc.x1 = _vm->_eventsManager.start_x; - if (bloc.x2 > (_vm->_eventsManager.start_x + SCREEN_WIDTH)) - bloc.x2 = _vm->_eventsManager.start_x + SCREEN_WIDTH; + } else if (bloc.x2 > _vm->_eventsManager._startPos.x && bloc.x1 < (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) { + if (bloc.x1 < _vm->_eventsManager._startPos.x) + bloc.x1 = _vm->_eventsManager._startPos.x; + if (bloc.x2 > (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) + bloc.x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; if (SDL_ECHELLE) { // Calculate the bounds int xp = Magic_Number(bloc.x1) - 4; - if (xp < _vm->_eventsManager.start_x) - xp = _vm->_eventsManager.start_x; + if (xp < _vm->_eventsManager._startPos.x) + xp = _vm->_eventsManager._startPos.x; int yp = Magic_Number(bloc.y1) - 4; if (yp < 0) yp = 0; @@ -1579,7 +1577,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (height < 4) height = 4; - if ((xp - _vm->_eventsManager.start_x + width) > SCREEN_WIDTH) + if ((xp - _vm->_eventsManager._startPos.x + width) > SCREEN_WIDTH) xp -= 4; if ((height - yp) > (SCREEN_HEIGHT - 40)) yp -= 4; @@ -1589,15 +1587,15 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (Winbpp == 2) { m_scroll16A(VESA_BUFFER, xp, yp, width, height, - Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } else { m_scroll2A(VESA_BUFFER, xp, yp, width, height, - Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } DD_Unlock(); - dstRect.left = Reel_Zoom(xp - _vm->_eventsManager.start_x, SDL_ECHELLE); + dstRect.left = Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE); dstRect.top = Reel_Zoom(yp, SDL_ECHELLE); dstRect.setWidth(Reel_Zoom(width, SDL_ECHELLE)); dstRect.setHeight(Reel_Zoom(height, SDL_ECHELLE)); @@ -1607,13 +1605,13 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (Winbpp == 2) { m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, - bloc.x1 - _vm->_eventsManager.start_x, bloc.y1); + bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); } else { m_scroll(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, - bloc.x1 - _vm->_eventsManager.start_x, bloc.y1); + bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); } - dstRect.left = bloc.x1 - _vm->_eventsManager.start_x; + dstRect.left = bloc.x1 - _vm->_eventsManager._startPos.x; dstRect.top = bloc.y1; dstRect.setWidth(bloc.x2 - bloc.x1); dstRect.setHeight(bloc.y2 - bloc.y1); @@ -2373,15 +2371,15 @@ void GraphicsManager::NB_SCREEN() { DD_Lock(); if (Winbpp == 2) { if (SDL_ECHELLE) - m_scroll16A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16A(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll16(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (Winbpp == 1) { if (SDL_ECHELLE) - m_scroll2A(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll2A(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - m_scroll2(VESA_BUFFER, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll2(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } DD_Unlock(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 305fed10a3..c1e7667340 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -68,14 +68,14 @@ Common::String HopkinsEngine::generateSaveName(int slot) { * Returns true if it is currently okay to restore a game */ bool HopkinsEngine::canLoadGameStateCurrently() { - return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager.souris_flag; + return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager._mouseFl; } /** * Returns true if it is currently okay to save the game */ bool HopkinsEngine::canSaveGameStateCurrently() { - return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager.souris_flag; + return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager._mouseFl; } /** @@ -143,7 +143,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.LOAD_IMAGE("H2"); _graphicsManager.FADE_INW(); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) INTRORUN(); warning("TODO Fin_Interrupt()"); @@ -331,10 +331,10 @@ bool HopkinsEngine::runWin95Demo() { else if (!_globals.FR) _graphicsManager.LOAD_IMAGE("ENDUK"); _graphicsManager.FADE_INW(); - _eventsManager.MOUSE_ON(); + _eventsManager.mouseOn(); do _eventsManager.VBL(); - while (_eventsManager.BMOUSE() != 1); + while (_eventsManager.getMouseButton() != 1); _graphicsManager.FADE_OUTW(); REST_SYSTEM(); } @@ -457,7 +457,7 @@ bool HopkinsEngine::runLinuxDemo() { _objectsManager.AJOUTE_OBJET(14); _globals.HELICO = 0; - _eventsManager.MOUSE_OFF(); + _eventsManager.mouseOff(); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -478,7 +478,7 @@ bool HopkinsEngine::runLinuxDemo() { _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) INTRORUN(); _globals.iRegul = 0; @@ -842,7 +842,7 @@ bool HopkinsEngine::runWin95full() { _animationManager.playAnim("MP.ANM", 10, 16, 200); _graphicsManager.FADE_OUTW(); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) INTRORUN(); _graphicsManager.LOAD_IMAGE("H2"); _graphicsManager.FADE_INW(); @@ -1708,7 +1708,7 @@ bool HopkinsEngine::runLinuxFull() { _objectsManager.AJOUTE_OBJET(14); _globals.HELICO = 0; - _eventsManager.MOUSE_OFF(); + _eventsManager.mouseOff(); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -1724,7 +1724,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("MP.ANM", 10, 16, 200); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) INTRORUN(); _globals.iRegul = 0; @@ -2623,19 +2623,19 @@ void HopkinsEngine::INIT_SYSTEM() { _soundManager.syncSoundSettings(); if (getPlatform() == Common::kPlatformLinux) - _eventsManager.mouse_linux = true; + _eventsManager._mouseLinuxFl = true; else - _eventsManager.mouse_linux = false; + _eventsManager._mouseLinuxFl = false; switch (_globals.FR) { case 0: - if (!_eventsManager.mouse_linux) + if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUAN.SPR"); else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUAN.SPR"); break; case 1: - if (!_eventsManager.mouse_linux) + if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUFR.SPR"); else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUFR.SPR"); @@ -2645,14 +2645,14 @@ void HopkinsEngine::INIT_SYSTEM() { break; } - if (_eventsManager.mouse_linux) { - _eventsManager.souris_sizex = 52; - _eventsManager.souris_sizey = 32; + if (_eventsManager._mouseLinuxFl) { + _eventsManager._mouseSizeX = 52; + _eventsManager._mouseSizeY = 32; } else { - _eventsManager.souris_sizex = 34; - _eventsManager.souris_sizey = 20; + _eventsManager._mouseSizeX = 34; + _eventsManager._mouseSizeY = 20; } - _eventsManager.pointeur_souris = _fileManager.loadFile(_globals.NFICHIER); + _eventsManager._mouseCursor = _fileManager.loadFile(_globals.NFICHIER); _globals.clearAll(); @@ -2680,15 +2680,13 @@ void HopkinsEngine::INIT_SYSTEM() { break; } - _eventsManager.INSTALL_SOURIS(); - _eventsManager.souris_on(); - _eventsManager.souris_flag = false; - _eventsManager.souris_max(); + _eventsManager.setMouseOn(); + _eventsManager._mouseFl = false; _globals.HOPKINS_DATA(); - _eventsManager.ofset_souris_x = 0; - _eventsManager.ofset_souris_y = 0; + _eventsManager._mouseOffset.x = 0; + _eventsManager._mouseOffset.y = 0; } void HopkinsEngine::INTRORUN() { @@ -2701,21 +2699,21 @@ void HopkinsEngine::INTRORUN() { memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE); _eventsManager.VBL(); - _eventsManager.souris_flag = false; + _eventsManager._mouseFl = false; _globals.iRegul = 1; _eventsManager.VBL(); _soundManager.WSOUND(16); _animationManager._clearAnimationFl = true; _animationManager.playAnim("J1.anm", 12, 12, 50); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _soundManager.VOICE_MIX(1, 3); _animationManager.playAnim("J2.anm", 12, 12, 50); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _soundManager.VOICE_MIX(2, 3); _animationManager.playAnim("J3.anm", 12, 12, 50); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _soundManager.VOICE_MIX(3, 3); _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); @@ -2749,8 +2747,8 @@ void HopkinsEngine::INTRORUN() { v3 = true; } - if (_eventsManager.XMOUSE() < _graphicsManager.SCROLL + 10) - _eventsManager.souris_xy(_eventsManager.souris_x + 4, _eventsManager.YMOUSE()); + if (_eventsManager.getMouseX() < _graphicsManager.SCROLL + 10) + _eventsManager.setMouseXY(_eventsManager._mousePos.x + 4, _eventsManager.getMouseY()); _eventsManager.VBL(); } while (!shouldQuit() && !v3 && _graphicsManager.SCROLL != SCREEN_WIDTH); @@ -2810,7 +2808,7 @@ void HopkinsEngine::INTRORUN() { _soundManager.SPECIAL_SOUND = 0; - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _graphicsManager.LOAD_IMAGE("intro2"); _graphicsManager.SCROLL_ECRAN(0); _animationManager.loadAnim("INTRO2"); @@ -2834,7 +2832,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); int v9 = 0; - while (!shouldQuit() && !_eventsManager.ESC_KEY) { + while (!shouldQuit() && !_eventsManager._escKeyFl) { if (v9 == 12) { _objectsManager.BOBANIM_ON(3); _eventsManager.VBL(); @@ -2906,17 +2904,17 @@ void HopkinsEngine::INTRORUN() { _soundManager.SPECIAL_SOUND = 0; - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _animationManager.playAnim("INTRO2.anm", 10, 24, 18); if (shouldQuit()) return; - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _animationManager.playAnim("INTRO3.anm", 10, 24, 200); if (shouldQuit()) return; - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _animationManager._clearAnimationFl = false; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("J4.anm", 12, 12, 1000); @@ -2931,7 +2929,7 @@ void HopkinsEngine::INTRORUN() { } } - _eventsManager.ESC_KEY = false; + _eventsManager._escKeyFl = false; } /** @@ -3005,7 +3003,7 @@ void HopkinsEngine::BOOM() { _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); - _eventsManager.MOUSE_OFF(); + _eventsManager.mouseOff(); for (int idx = 0; idx < 20; ++idx) { _eventsManager.VBL(); @@ -3035,14 +3033,14 @@ void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); _globals.FORET = false; - _eventsManager.CASSE = false; + _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _globals.FLAG_VISIBLE = false; _graphicsManager.LOAD_IMAGE("BOX"); _soundManager.WSOUND(28); _graphicsManager.FADE_INW(); - _eventsManager.MOUSE_ON(); - _eventsManager.CHANGE_MOUSE(0); + _eventsManager.mouseOn(); + _eventsManager.changeMouseCursor(0); _eventsManager.btsouris = 0; _eventsManager.souris_n = 0; _globals.netscape = true; @@ -3056,7 +3054,7 @@ void HopkinsEngine::PUBQUIT() { // yp = _eventsManager.YMOUSE(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) + if (_eventsManager.getMouseButton() == 1) mouseClicked = true; } while (!mouseClicked && !g_system->getEventManager()->shouldQuit()); @@ -3112,60 +3110,60 @@ void HopkinsEngine::BASE() { _soundManager.WSOUND(25); if (_globals.SVGA == 1) { _animationManager.playAnim("base00.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base05.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base10.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base20.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base30.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base40.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base50.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC00.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC05.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC10.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC20.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("OC30.anm", 10, 18, 18); } } else if (_globals.SVGA == 2) { _animationManager.playAnim("base00a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base05a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base10a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base20a.anm", 10, 18, 18); // CHECKME: The original code was doing the opposite test, which looks like a bug. - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base30a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base40a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base50a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC00a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC05a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC10a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("OC20a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("OC30a.anm", 10, 18, 18); } } - _eventsManager.ESC_KEY = false; + _eventsManager._escKeyFl = false; _animationManager._clearAnimationFl = false; _globals.SORTIE = 85; } @@ -3225,7 +3223,7 @@ void HopkinsEngine::JOUE_FIN() { _graphicsManager.LOAD_IMAGE("IM100"); _animationManager.loadAnim("ANIM100"); _graphicsManager.VISU_ALL(); - _eventsManager.MOUSE_ON(); + _eventsManager.mouseOn(); _objectsManager.BOBANIM_OFF(7); _objectsManager.BOBANIM_OFF(8); _objectsManager.BOBANIM_OFF(9); @@ -3233,7 +3231,7 @@ void HopkinsEngine::JOUE_FIN() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _eventsManager.CHANGE_MOUSE(0); + _eventsManager.changeMouseCursor(0); _globals.BPP_NOAFF = true; for (int cpt = 0; cpt <= 4; cpt++) @@ -3267,7 +3265,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.NOPARLE = true; _talkManager.PARLER_PERSO("DUELB4.PE2"); - _eventsManager.MOUSE_OFF(); + _eventsManager.mouseOff(); _globals._disableInventFl = true; do @@ -3300,12 +3298,12 @@ void HopkinsEngine::JOUE_FIN() { _graphicsManager.FADE_INW(); _eventsManager.lItCounter = 0; - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { do _eventsManager.CONTROLE_MES(); - while (_eventsManager.lItCounter < 2000 / _globals.vitesse && !_eventsManager.ESC_KEY); + while (_eventsManager.lItCounter < 2000 / _globals.vitesse && !_eventsManager._escKeyFl); } - _eventsManager.ESC_KEY = false; + _eventsManager._escKeyFl = false; _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 0; @@ -3376,71 +3374,71 @@ void HopkinsEngine::AVION() { _animationManager._clearAnimationFl = false; if (_globals.SVGA == 1) { _animationManager.playAnim("aerop00.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop10.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop20.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop30.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop40.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop50.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop60.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop70.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans00.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans10.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans15.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans20.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans30.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans40.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("PARA00.anm", 9, 9, 9); } } else if (_globals.SVGA == 2) { _animationManager.playAnim("aerop00a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("serop10a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop20a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop30a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop40a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop50a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop60a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("aerop70a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans00a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans10a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans15a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans20a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans30a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("trans40a.anm", 10, 18, 18); - if (!_eventsManager.ESC_KEY) { + if (!_eventsManager._escKeyFl) { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("PARA00a.anm", 9, 9, 9); } } - _eventsManager.ESC_KEY = 0; + _eventsManager._escKeyFl = false; _animationManager._clearAnimationFl = false; } @@ -3451,7 +3449,7 @@ int HopkinsEngine::PWBASE() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _eventsManager.CHANGE_MOUSE(0); + _eventsManager.changeMouseCursor(0); _graphicsManager.FADE_INW(); bool loopCond = false; int zone; @@ -3459,9 +3457,9 @@ int HopkinsEngine::PWBASE() { if (shouldQuit()) return 0; - int mouseButton = _eventsManager.BMOUSE(); - int posX = _eventsManager.XMOUSE(); - int posY = _eventsManager.YMOUSE(); + int mouseButton = _eventsManager.getMouseButton(); + int posX = _eventsManager.getMouseX(); + int posY = _eventsManager.getMouseY(); zone = 0; if ((posX - 181 <= 16) && (posY - 66 <= 22) && (posX - 181 >= 0) && (posY - 66 >= 0)) @@ -3482,13 +3480,13 @@ int HopkinsEngine::PWBASE() { (posX - 106 >= 0) && (posY - 267 >= 0)) zone = 6; if (zone) { - _eventsManager.CHANGE_MOUSE(4); + _eventsManager.changeMouseCursor(4); _globals.couleur_40 += 25; if (_globals.couleur_40 > 100) _globals.couleur_40 = 0; _graphicsManager.SETCOLOR4(251, _globals.couleur_40, _globals.couleur_40, _globals.couleur_40); } else { - _eventsManager.CHANGE_MOUSE(0); + _eventsManager.changeMouseCursor(0); _graphicsManager.SETCOLOR4(251, 100, 100, 100); } _eventsManager.VBL(); @@ -3642,7 +3640,7 @@ void HopkinsEngine::Credits() { _graphicsManager.LOAD_IMAGE("GENERIC"); _graphicsManager.FADE_INW(); _soundManager.WSOUND(28); - _eventsManager.souris_flag = false; + _eventsManager._mouseFl = false; _globals.iRegul = 3; _globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1; int soundId = 28; @@ -3692,26 +3690,26 @@ void HopkinsEngine::Credits() { _globals.Credit_bx1 = -1; _globals.Credit_by = -1; _globals.Credit_by1 = -1; - } while ((_eventsManager.BMOUSE() != 1) && (!g_system->getEventManager()->shouldQuit())); + } while ((_eventsManager.getMouseButton() != 1) && (!g_system->getEventManager()->shouldQuit())); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; - _eventsManager.souris_flag = true; + _eventsManager._mouseFl = true; } void HopkinsEngine::BTOCEAN() { _fontManager.TEXTE_OFF(9); if (_eventsManager.btsouris == 16) { - _eventsManager.XMOUSE(); + _eventsManager.getMouseX(); if (_objectsManager.NUMZONE > 0) { - int oldPosX = _eventsManager.XMOUSE(); - int oldPosY = _eventsManager.YMOUSE(); + int oldPosX = _eventsManager.getMouseX(); + int oldPosY = _eventsManager.getMouseY(); bool displAnim = false; if (_objectsManager.NUMZONE == 1) { if (_globals.OCEAN_SENS == 3) _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, 0); - if (_globals.OCEAN_SENS == 1) + else if (_globals.OCEAN_SENS == 1) _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, 0); - if (_globals.OCEAN_SENS == 5) + else if (_globals.OCEAN_SENS == 5) _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 7; _globals.SORTIE = 1; @@ -3726,9 +3724,9 @@ void HopkinsEngine::BTOCEAN() { _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) { - if (oldPosX == _eventsManager.XMOUSE()) { - if (_eventsManager.YMOUSE() == oldPosY) + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) break; } } @@ -3741,9 +3739,9 @@ LABEL_22: if (_objectsManager.NUMZONE == 2) { if (_globals.OCEAN_SENS == 7) _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); - if (_globals.OCEAN_SENS == 1) + else if (_globals.OCEAN_SENS == 1) _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); - if (_globals.OCEAN_SENS == 5) + else if (_globals.OCEAN_SENS == 5) _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 3; _globals.SORTIE = 2; @@ -3758,9 +3756,9 @@ LABEL_22: _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) { - if (oldPosX == _eventsManager.XMOUSE()) { - if (_eventsManager.YMOUSE() == oldPosY) + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) break; } } @@ -3783,9 +3781,9 @@ LABEL_41: _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) { - if (oldPosX == _eventsManager.XMOUSE()) { - if (_eventsManager.YMOUSE() == oldPosY) { + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) { displAnim = true; goto LABEL_57; } @@ -3808,9 +3806,9 @@ LABEL_57: _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) { - if (oldPosX == _eventsManager.XMOUSE()) { - if (_eventsManager.YMOUSE() == oldPosY) { + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) { displAnim = true; goto LABEL_72; } @@ -3839,9 +3837,9 @@ LABEL_72: _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) { - if (oldPosX == _eventsManager.XMOUSE()) { - if (_eventsManager.YMOUSE() == oldPosY) { + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) { displAnim = true; goto LABEL_91; } @@ -3864,9 +3862,9 @@ LABEL_91: _objectsManager.SETXSPR(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.BMOUSE() == 1) { - if (oldPosX == _eventsManager.XMOUSE()) { - if (_eventsManager.YMOUSE() == oldPosY) + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) break; } } @@ -3953,8 +3951,8 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _graphicsManager.SETCOLOR3(254, 0, 0, 0); _objectsManager.SPRITE_ON(0); _globals.chemin = (int16 *)g_PTRNUL; - _eventsManager.MOUSE_ON(); - _eventsManager.CHANGE_MOUSE(4); + _eventsManager.mouseOn(); + _eventsManager.changeMouseCursor(4); for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); @@ -3966,7 +3964,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 bool loopCond = false; do { - int mouseButton = _eventsManager.BMOUSE(); + int mouseButton = _eventsManager.getMouseButton(); if (mouseButton && mouseButton == 1) BTOCEAN(); _objectsManager.VERIFZONE(); @@ -4007,7 +4005,7 @@ bool HopkinsEngine::ADULT() { _graphicsManager.min_y = 0; _graphicsManager.max_x = SCREEN_WIDTH; _graphicsManager.max_y = SCREEN_HEIGHT - 1; - _eventsManager.CASSE = false; + _eventsManager._breakoutFl = false; _globals.FORET = false; _globals.FLAG_VISIBLE = false; _globals._disableInventFl = true; @@ -4015,14 +4013,14 @@ bool HopkinsEngine::ADULT() { _graphicsManager.LOAD_IMAGE("ADULT"); _graphicsManager.FADE_INW(); - _eventsManager.MOUSE_ON(); - _eventsManager.CHANGE_MOUSE(0); + _eventsManager.mouseOn(); + _eventsManager.changeMouseCursor(0); _eventsManager.btsouris = false; _eventsManager.souris_n = false; do { - xp = _eventsManager.XMOUSE(); - yp = _eventsManager.YMOUSE(); + xp = _eventsManager.getMouseX(); + yp = _eventsManager.getMouseY(); buttonIndex = 0; if (xp >= 37 && xp <= 169 && yp >= 406 && yp <= 445) @@ -4031,7 +4029,7 @@ bool HopkinsEngine::ADULT() { buttonIndex = 1; _eventsManager.VBL(); - } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.BMOUSE() != 1)); + } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.getMouseButton() != 1)); _globals._disableInventFl = false; _globals.FLAG_VISIBLE = false; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index a6bb272685..9228c6cb5f 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -58,7 +58,7 @@ int MenuManager::MENU() { result = 0; while (!g_system->getEventManager()->shouldQuit()) { _vm->_globals.FORET = false; - _vm->_eventsManager.CASSE = false; + _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; _vm->_globals.FLAG_VISIBLE = false; _vm->_globals.SORTIE = 0; @@ -91,8 +91,8 @@ int MenuManager::MENU() { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); - _vm->_eventsManager.MOUSE_ON(); - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.mouseOn(); + _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.btsouris = 0; _vm->_eventsManager.souris_n = 0; @@ -107,7 +107,7 @@ int MenuManager::MENU() { return -1; menuIndex = MENU_NONE; - mousePos = Common::Point(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE()); + mousePos = Common::Point(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); if ((uint16)(mousePos.x - 232) <= 176) { if ((uint16)(mousePos.y - 261) <= 23) @@ -174,7 +174,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, frame5Index + 8); _vm->_eventsManager.VBL(); - if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex != MENU_NONE) + if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) selectionMade = 1; } while (!selectionMade); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d83c9a53f9..1da0420ac0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -101,7 +101,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { // Change Object byte *ObjectsManager::CHANGE_OBJET(int objIndex) { byte *result = CAPTURE_OBJET(objIndex, 1); - _vm->_eventsManager.Bufferobjet = result; + _vm->_eventsManager._objectBuf = result; _vm->_globals.Nouv_objet = 1; _vm->_globals.OBJET_EN_COURS = objIndex; return result; @@ -141,8 +141,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { break; case 1: - sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_eventsManager.Bufferobjet, val2); - dataP = _vm->_eventsManager.Bufferobjet; + sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_eventsManager._objectBuf, val2); + dataP = _vm->_eventsManager._objectBuf; break; case 3: @@ -491,32 +491,32 @@ void ObjectsManager::AFF_SPRITES() { } if (SL_FLAG == true) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager.start_x + 183, 60, 0x112u, 353); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); if (SL_X && SL_Y) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager.start_x + 300, SL_Y + 300, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 183, 60, _vm->_eventsManager.start_x + 457, 413); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); } // If the Options dialog is activated, draw the elements if (_vm->_globals._optionDialogFl) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 464, 407, 0); + _vm->_eventsManager._startPos.x + 464, 407, 0); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 657, 556, _vm->_globals.opt_vitesse); + _vm->_eventsManager._startPos.x + 657, 556, _vm->_globals.opt_vitesse); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 731, 495, _vm->_globals.opt_txt); + _vm->_eventsManager._startPos.x + 731, 495, _vm->_globals.opt_txt); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 731, 468, _vm->_globals.opt_voice); + _vm->_eventsManager._startPos.x + 731, 468, _vm->_globals.opt_voice); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 731, 441, _vm->_globals.opt_sound); + _vm->_eventsManager._startPos.x + 731, 441, _vm->_globals.opt_sound); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 731, 414, _vm->_globals.opt_music); + _vm->_eventsManager._startPos.x + 731, 414, _vm->_globals.opt_music); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 600, 522, _vm->_globals.opt_anm); + _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals.opt_anm); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, - _vm->_eventsManager.start_x + 611, 502, _vm->_globals.opt_scrspeed); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager.start_x + 164, 107, _vm->_eventsManager.start_x + 498, 320); + _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals.opt_scrspeed); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); } // Loop to draw any on-screen text @@ -525,7 +525,7 @@ void ObjectsManager::AFF_SPRITES() { if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) _vm->_fontManager.BOITE(idx, _vm->_fontManager.Txt[idx].messageId, _vm->_fontManager.Txt[idx].filename, - _vm->_eventsManager.start_x + _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); + _vm->_eventsManager._startPos.x + _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); else _vm->_fontManager.BOITE( idx, @@ -536,7 +536,7 @@ void ObjectsManager::AFF_SPRITES() { _vm->_fontManager.ListeTxt[idx].enabled = true; if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) - _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager.start_x + _vm->_fontManager.Txt[idx].xp; + _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager._startPos.x + _vm->_fontManager.Txt[idx].xp; else _vm->_fontManager.ListeTxt[idx].xp = _vm->_fontManager.Txt[idx].xp; @@ -1216,7 +1216,7 @@ void ObjectsManager::AFF_BOB_ANIM() { if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == true && idx > 20 ) - _vm->_globals.Bob[idx].xp += _vm->_eventsManager.start_x; + _vm->_globals.Bob[idx].xp += _vm->_eventsManager._startPos.x; _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); @@ -1257,7 +1257,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == true && idx > 20) - _vm->_globals.Bob[idx].xp += _vm->_eventsManager.start_x; + _vm->_globals.Bob[idx].xp += _vm->_eventsManager._startPos.x; _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v21 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); @@ -1630,11 +1630,11 @@ void ObjectsManager::VERIFZONE() { uint16 v3; int v4; - v0 = _vm->_eventsManager.XMOUSE(); - v1 = _vm->_eventsManager.YMOUSE(); + v0 = _vm->_eventsManager.getMouseX(); + v1 = _vm->_eventsManager.getMouseY(); v2 = v1; if (_vm->_globals.PLAN_FLAG - || _vm->_eventsManager.start_x >= v0 + || _vm->_eventsManager._startPos.x >= v0 || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) || (v1 = v2 - 1, (uint16)(v2 - 1) > 0x3Bu)) { if (FLAG_VISIBLE == true) @@ -1663,7 +1663,7 @@ void ObjectsManager::VERIFZONE() { if (_vm->_globals.old_zone_68 != v4) { _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); if (_vm->_globals.zozo_73 == 1) { _vm->_fontManager.TEXTE_OFF(5); _vm->_globals.zozo_73 = 0; @@ -1698,7 +1698,7 @@ LABEL_54: if (_vm->_eventsManager.btsouris == 4) { v1 = 5 * v4; if (_vm->_globals.ZONEP[v4].field6 == 2) { - _vm->_eventsManager.CHANGE_MOUSE(16); + _vm->_eventsManager.changeMouseCursor(16); _vm->_eventsManager.btsouris = 16; verbe = 16; } @@ -1706,7 +1706,7 @@ LABEL_54: } else { _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); } } NUMZONE = v4; @@ -1723,7 +1723,7 @@ LABEL_54: if ((_vm->_globals.PLAN_FLAG == true && v4 == -1) || !v4) { verbe = 0; _vm->_eventsManager.btsouris = 0; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); } } } @@ -2554,7 +2554,7 @@ void ObjectsManager::PLAN_BETA() { v1 = 0; _vm->_dialogsManager._inventFl = false; - _vm->_eventsManager.GAME_KEY = KEY_NONE; + _vm->_eventsManager._gameKey = KEY_NONE; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; _vm->_globals.Max_Propre_Gen = 1; @@ -2593,9 +2593,9 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANI = 1; } SPRITE(sprite_ptr, _vm->_globals.PLANX, _vm->_globals.PLANY, 0, _vm->_globals.PLANI, 0, 0, 5, 5); - _vm->_eventsManager.souris_xy(_vm->_globals.PLANX, _vm->_globals.PLANY); + _vm->_eventsManager.setMouseXY(_vm->_globals.PLANX, _vm->_globals.PLANY); my_anim = 0; - _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.mouseOn(); v3 = XSPR(0); _vm->_graphicsManager.SCROLL_ECRAN(v3 - 320); _vm->_graphicsManager.ofscroll = XSPR(0) - 320; @@ -2616,11 +2616,11 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; _vm->_graphicsManager.FADE_INW(); - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager.NOFADE = false; do { - v5 = _vm->_eventsManager.BMOUSE(); + v5 = _vm->_eventsManager.getMouseButton(); if (v5) { if (_vm->_globals.SAUVEGARDE->data[svField170] == 1 && !_vm->_globals.SAUVEGARDE->data[svField171]) { _vm->_globals.SAUVEGARDE->data[svField171] = 1; @@ -2689,15 +2689,15 @@ void ObjectsManager::BTGAUCHE() { int v18; _vm->_fontManager.TEXTE_OFF(9); - destX = _vm->_eventsManager.XMOUSE(); - destY = _vm->_eventsManager.YMOUSE(); + destX = _vm->_eventsManager.getMouseX(); + destY = _vm->_eventsManager.getMouseY(); if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { v1 = _vm->_eventsManager.btsouris; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); _vm->_dialogsManager._inventFl = false; - _vm->_eventsManager.GAME_KEY = KEY_NONE; + _vm->_eventsManager._gameKey = KEY_NONE; if (!_vm->_globals.SORTIE) { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager.btsouris = v1; @@ -2862,9 +2862,7 @@ void ObjectsManager::PARADISE() { int v1; char result; int v3; - uint16 v4; int v5; - uint16 v6; v1 = 0; ARRET_PERSO_FLAG = 0; @@ -2875,15 +2873,15 @@ void ObjectsManager::PARADISE() { if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.no_scroll = 2; - if (_vm->_eventsManager.start_x >= XSPR(0) - 320) + if (_vm->_eventsManager._startPos.x >= XSPR(0) - 320) goto LABEL_64; - v3 = _vm->_eventsManager.start_x + 320 - XSPR(0); + v3 = _vm->_eventsManager._startPos.x + 320 - XSPR(0); if (v3 < 0) v3 = -v3; if (v3 <= 160) { LABEL_64: - if (_vm->_eventsManager.start_x > XSPR(0) - 320) { - v5 = _vm->_eventsManager.start_x + 320 - XSPR(0); + if (_vm->_eventsManager._startPos.x > XSPR(0) - 320) { + v5 = _vm->_eventsManager._startPos.x + 320 - XSPR(0); if (v5 < 0) v5 = -v5; if (v5 > 160) { @@ -2898,12 +2896,11 @@ LABEL_64: _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; v1 = 1; } - if (_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) { - v6 = _vm->_eventsManager.YMOUSE(); - _vm->_eventsManager.souris_xy(_vm->_eventsManager.souris_x - 4, v6); - } + if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) + _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x - 4, _vm->_eventsManager.getMouseY()); + _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager.start_x > XSPR(0) - 320); + } while (v1 != 1 && _vm->_eventsManager._startPos.x > XSPR(0) - 320); } } } else { @@ -2917,17 +2914,16 @@ LABEL_64: _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; v1 = 1; } - if (_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) { - v4 = _vm->_eventsManager.YMOUSE(); - _vm->_eventsManager.souris_xy(_vm->_eventsManager.souris_x + 4, v4); - } + if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager.SCROLL + 10) + _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x + 4, _vm->_eventsManager.getMouseY()); + _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager.start_x < XSPR(0) - 320); + } while (v1 != 1 && _vm->_eventsManager._startPos.x < XSPR(0) - 320); } - if (_vm->_eventsManager.XMOUSE() > _vm->_graphicsManager.SCROLL + 620) - _vm->_eventsManager.souris_xy(_vm->_graphicsManager.SCROLL + 610, 0); - if (_vm->_eventsManager.XMOUSE() < _vm->_graphicsManager.SCROLL + 10) - _vm->_eventsManager.souris_xy(_vm->_graphicsManager.SCROLL + 10, 0); + if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) + _vm->_eventsManager.setMouseXY(_vm->_graphicsManager.SCROLL + 610, 0); + if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager.SCROLL + 10) + _vm->_eventsManager.setMouseXY(_vm->_graphicsManager.SCROLL + 10, 0); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 0; } @@ -2935,7 +2931,7 @@ LABEL_64: } else { _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); } - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { NUMZONE = -1; FORCEZONE = 1; @@ -2953,14 +2949,14 @@ LABEL_64: _vm->_eventsManager.btsouris = 4; } if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); NUMZONE = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } if (_vm->_globals.PLAN_FLAG == true) { _vm->_eventsManager.btsouris = 0; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); } if (_vm->_globals.NOMARCHE == true) { if (_vm->_eventsManager.btsouris == 4) { @@ -3011,7 +3007,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.COUCOU = _vm->_globals.LIBERE_FICHIER(_vm->_globals.COUCOU); if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = _vm->_globals.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); - _vm->_eventsManager.start_x = 0; + _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager.souris_n = 0; Vold_taille = 200; _vm->_globals.SAUVEGARDE->data[svField1] = 0; @@ -3820,7 +3816,7 @@ void ObjectsManager::BTDROITE() { if ((uint16)(NUMZONE + 1) > 1u) { VERBEPLUS(); if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); verbe = _vm->_eventsManager.btsouris; } } @@ -3853,9 +3849,9 @@ int ObjectsManager::MZONE() { v18 = 0; v17 = 0; v16 = 0; - xp = _vm->_eventsManager.souris_x + _vm->_eventsManager.ofset_souris_x; - yp = _vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y; - if ((_vm->_eventsManager.souris_y + _vm->_eventsManager.ofset_souris_y) > 19) { + xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; + yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; + if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { v1 = 0; do { v2 = _vm->_globals.BOBZONE[v1]; @@ -4022,9 +4018,9 @@ void ObjectsManager::PARAMCADRE(int a1) { cadi = 0; } if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.CHANGE_MOUSE(_vm->_eventsManager.btsouris); - _vm->_eventsManager.XMOUSE(); - _vm->_eventsManager.YMOUSE(); + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); + _vm->_eventsManager.getMouseX(); + _vm->_eventsManager.getMouseY(); } void ObjectsManager::OBJETPLUS(int idx) { @@ -4227,15 +4223,15 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); v2 = _vm->_graphicsManager.VESA_BUFFER; @@ -5505,7 +5501,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo v5 = 0; _vm->_dialogsManager._inventFl = false; - _vm->_eventsManager.GAME_KEY = KEY_NONE; + _vm->_eventsManager._gameKey = KEY_NONE; _vm->_dialogsManager._removeInventFl = false; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = false; @@ -5529,7 +5525,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (!s4.empty() && _vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN2(s4); } - _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.mouseOn(); if (_vm->_globals.ECRAN == 61) { SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); SPRITE_ON(0); @@ -5540,7 +5536,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); _vm->_globals.BPP_NOAFF = true; v6 = 0; do { @@ -5568,7 +5564,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo SETANISPR(0, 64); } do { - v9 = _vm->_eventsManager.BMOUSE(); + v9 = _vm->_eventsManager.getMouseButton(); if (v9 == 1) { BTGAUCHE(); v9 = 1; @@ -5605,7 +5601,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm int xp, yp; _vm->_dialogsManager._inventFl = false; - _vm->_eventsManager.GAME_KEY = KEY_NONE; + _vm->_eventsManager._gameKey = KEY_NONE; verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; @@ -5633,7 +5629,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!s4.empty() && _vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN2(s4); } - _vm->_eventsManager.MOUSE_ON(); + _vm->_eventsManager.mouseOn(); _vm->_eventsManager.btsouris = 4; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -5666,7 +5662,7 @@ LABEL_70: SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 28, 155); if (_vm->_globals.PERSO_TYPE == 2) SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 20, 127); - _vm->_eventsManager.souris_xy(PERX, PERY); + _vm->_eventsManager.setMouseXY(PERX, PERY); if (_vm->_graphicsManager.DOUBLE_ECRAN == true) _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; VERIFTAILLE(); @@ -5691,19 +5687,19 @@ LABEL_70: if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_INW(); _vm->_graphicsManager.NOFADE = false; - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); int xCheck = 0; int yCheck = 0; breakFlag = false; while (!_vm->shouldQuit() && !breakFlag) { - mouseButtons = _vm->_eventsManager.BMOUSE(); + mouseButtons = _vm->_eventsManager.getMouseButton(); if (mouseButtons) { if (mouseButtons == 1) { if (verbe == 16 && _vm->_eventsManager.btsouris == 16) { - xp = _vm->_eventsManager.XMOUSE(); - yp = _vm->_eventsManager.YMOUSE(); + xp = _vm->_eventsManager.getMouseX(); + yp = _vm->_eventsManager.getMouseY(); if (xCheck == xp) { if (yCheck == yp) { diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index a7e36ebbca..5eab0c05bf 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -229,7 +229,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)thumb8.pixels, - _vm->_eventsManager.start_x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); + _vm->_eventsManager._startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); // Convert the 8-bit pixel to 16 bit surface s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 82f645b4f6..6478dcdc7f 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -719,7 +719,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); do { if (_vm->shouldQuit()) @@ -738,7 +738,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 0; } _vm->_animationManager.loadAnim("ASCEN"); - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); _vm->_graphicsManager.VISU_ALL(); @@ -749,7 +749,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); @@ -1524,9 +1524,9 @@ LABEL_1141: _vm->_globals._disableInventFl = true; if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; - _vm->_eventsManager.NOESC = true; + _vm->_eventsManager._disableEscKeyFl = true; _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); - _vm->_eventsManager.NOESC = false; + _vm->_eventsManager._disableEscKeyFl = false; _vm->_soundManager.SPECIAL_SOUND = 0; } _vm->_globals.NOT_VERIF = 1; @@ -1999,7 +1999,7 @@ LABEL_1141: _vm->_graphicsManager.LOAD_IMAGE("IM20f"); _vm->_animationManager.loadAnim("ANIM20f"); _vm->_graphicsManager.VISU_ALL(); - _vm->_eventsManager.MOUSE_OFF(); + _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.FADE_INW(); bool v52 = false; _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index d42590f593..db1b072e95 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -613,10 +613,10 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { do { if (SPECIAL_SOUND != 4 && !VBL_MERDE) _vm->_eventsManager.VBL(); - if (_vm->_eventsManager.BMOUSE()) + if (_vm->_eventsManager.getMouseButton()) break; _vm->_eventsManager.CONTROLE_MES(); - if (_vm->_eventsManager.ESC_KEY) + if (_vm->_eventsManager._escKeyFl) break; if (!VOICE_STAT(2)) breakFlag = true; @@ -626,7 +626,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { STOP_VOICE(2); DEL_SAMPLE_SDL(20); MUSICVOL = oldMusicVol; - _vm->_eventsManager.ESC_KEY = false; + _vm->_eventsManager._escKeyFl = false; VBL_MERDE = 0; return true; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e66705256e..2246ab3b50 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -122,7 +122,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PLIGNE4 = v2 + 3; v14 = _vm->_eventsManager.btsouris; _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { v4 = v2 + 3; do { @@ -154,7 +154,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_objectsManager.PERSO_ON = false; _vm->_eventsManager.btsouris = v14; - _vm->_eventsManager.CHANGE_MOUSE(v14); + _vm->_eventsManager.changeMouseCursor(v14); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); if (_vm->getIsDemo() == false) @@ -165,15 +165,15 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.DD_LOCK(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_UNLOCK(); v8 = _vm->_graphicsManager.VESA_BUFFER; @@ -236,7 +236,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { PLIGNE4 = v1 + 3; int v8 = _vm->_eventsManager.btsouris; _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { int v2 = v1 + 3; @@ -261,7 +261,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); _vm->_eventsManager.btsouris = v8; - _vm->_eventsManager.CHANGE_MOUSE(v8); + _vm->_eventsManager.changeMouseCursor(v8); _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_objectsManager.DESACTIVE_CURSOR = 0; @@ -332,7 +332,7 @@ int TalkManager::DIALOGUE() { v5 = -1; v6 = 0; do { - v7 = _vm->_eventsManager.YMOUSE(); + v7 = _vm->_eventsManager.getMouseY(); if ((v4 - 20 * v19) < v7 && (v4 - 1) > v7) { v8 = v7; _vm->_fontManager.OPTI_COUL_TXT(6, 7, 8, 5); @@ -357,7 +357,7 @@ int TalkManager::DIALOGUE() { } _vm->_eventsManager.VBL(); - if (_vm->_eventsManager.BMOUSE()) + if (_vm->_eventsManager.getMouseButton()) v6 = 1; if (v5 == -1) v6 = 0; @@ -492,7 +492,7 @@ int TalkManager::DIALOGUE_REP(int idx) { ++v14; if ( _vm->_eventsManager.souris_b || _vm->_eventsManager.souris_bb ) v14 = v6; - if (_vm->_eventsManager.BMOUSE()) { + if (_vm->_eventsManager.getMouseButton()) { i = 5; tmpVal = v6 / 5; if (tmpVal < 0) @@ -807,7 +807,7 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { do { v7 = (int16)READ_LE_UINT16(&v8[2 * v6 + 4]); if (v7 && _vm->_globals.vitesse != 501) - _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager.start_x + (int16)READ_LE_UINT16(&v8[2 * v6]), + _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), (int16)READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); v6 += 5; } while (_vm->_globals.vitesse != 501 && v7); @@ -1218,7 +1218,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { while (v2 <= 44); _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(0); + _vm->_eventsManager.changeMouseCursor(0); BUFFERPERSO = _vm->_fileManager.searchCat(a2, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; if (BUFFERPERSO == g_PTRNUL) { @@ -1277,7 +1277,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.FORCEZONE = 1; _vm->_objectsManager.NUMZONE = -1; do { - v12 = _vm->_eventsManager.BMOUSE(); + v12 = _vm->_eventsManager.getMouseButton(); if (v12 == 1) { _vm->_objectsManager.BTGAUCHE(); v12 = 1; @@ -1321,7 +1321,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PERSO_ON = false; _vm->_eventsManager.btsouris = 4; - _vm->_eventsManager.CHANGE_MOUSE(4); + _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); if (!_vm->getIsDemo()) @@ -1332,15 +1332,15 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } if (_vm->_graphicsManager.Winbpp == 1) { if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager.start_x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); -- cgit v1.2.3 From d274441e12e7112620747a5129bb2af77cdb852f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Dec 2012 08:31:07 +0100 Subject: HOPKINS: Some more renaming --- engines/hopkins/anim.cpp | 84 +++++++-------- engines/hopkins/computer.cpp | 10 +- engines/hopkins/dialogs.cpp | 30 +++--- engines/hopkins/events.cpp | 74 +++++++------ engines/hopkins/events.h | 22 ++-- engines/hopkins/hopkins.cpp | 28 ++--- engines/hopkins/menu.cpp | 4 +- engines/hopkins/objects.cpp | 240 +++++++++++++++++++++---------------------- engines/hopkins/script.cpp | 2 +- engines/hopkins/sound.cpp | 2 +- engines/hopkins/talk.cpp | 22 ++-- 11 files changed, 259 insertions(+), 259 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index f9b47d4cbf..1558069e6b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -106,7 +106,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); @@ -116,11 +116,11 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->_eventsManager._escKeyFl) goto EXIT; - _vm->_eventsManager.CONTROLE_MES(); - } while (!_vm->shouldQuit() && _vm->_eventsManager.lItCounter < rate1); + _vm->_eventsManager.refreshEvents(); + } while (!_vm->shouldQuit() && _vm->_eventsManager._rateCounter < rate1); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; breakFlag = false; frameNumber = 0; while (!_vm->shouldQuit()) { @@ -143,12 +143,12 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->_eventsManager._escKeyFl) goto EXIT; - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - } while (!_vm->shouldQuit() && _vm->_eventsManager.lItCounter < rate2); + } while (!_vm->shouldQuit() && _vm->_eventsManager._rateCounter < rate2); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.DD_Lock(); if (hasScreenCopy) { if (*screenP != kByteStop) { @@ -175,12 +175,12 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->_eventsManager._escKeyFl) break; - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate3); + } while (_vm->_eventsManager._rateCounter < rate3); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_soundManager.VERIF_SOUND(); EXIT: if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { @@ -312,7 +312,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) @@ -322,8 +322,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint goto LABEL_114; if (redrawAnim() == true) break; - _vm->_eventsManager.CONTROLE_MES(); - if (_vm->_eventsManager.lItCounter >= a2) + _vm->_eventsManager.refreshEvents(); + if (_vm->_eventsManager._rateCounter >= a2) goto LABEL_48; } if (_vm->_graphicsManager.NOLOCK == true) @@ -384,7 +384,7 @@ LABEL_112: _vm->_graphicsManager.FADE_INS(); } LABEL_48: - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; v5 = 0; v15 = 0; for (;;) { @@ -405,7 +405,7 @@ LABEL_48: if (_vm->_globals.iRegul == 1) break; LABEL_77: - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v8) { if (*v12 != kByteStop) { @@ -481,9 +481,9 @@ LABEL_88: } goto LABEL_112; } - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= a4) + if (_vm->_eventsManager._rateCounter >= a4) goto LABEL_114; } } @@ -544,9 +544,9 @@ LABEL_88: } goto LABEL_112; } - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= a3) + if (_vm->_eventsManager._rateCounter >= a3) goto LABEL_77; } LABEL_114: @@ -998,7 +998,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.DD_VBL(); } if (_vm->getIsDemo()) { - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { @@ -1008,14 +1008,14 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui goto LABEL_59; _vm->_eventsManager._escKeyFl = false; } - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate1); + } while (_vm->_eventsManager._rateCounter < rate1); } } else { if (NO_COUL) _vm->_graphicsManager.FADE_INW_LINUX(v9); - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { @@ -1025,12 +1025,12 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui goto LABEL_59; _vm->_eventsManager._escKeyFl = false; } - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate1); + } while (_vm->_eventsManager._rateCounter < rate1); } } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; readError = false; soundNumber = 0; do { @@ -1051,11 +1051,11 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui goto LABEL_59; _vm->_eventsManager._escKeyFl = false; } - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate2); + } while (_vm->_eventsManager._rateCounter < rate2); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v7) { if (*v9 != kByteStop) { @@ -1084,11 +1084,11 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui goto LABEL_59; _vm->_eventsManager._escKeyFl = false; } - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - } while (_vm->_eventsManager.lItCounter < rate3); + } while (_vm->_eventsManager._rateCounter < rate3); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; LABEL_59: _vm->_graphicsManager.NOLOCK = false; f.close(); @@ -1171,7 +1171,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul != 1) @@ -1181,9 +1181,9 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u goto LABEL_54; if (redrawAnim() == true) break; - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= rate1) + if (_vm->_eventsManager._rateCounter >= rate1) goto LABEL_23; } LABEL_48: @@ -1195,7 +1195,7 @@ LABEL_48: f.close(); } LABEL_23: - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; v4 = false; v13 = 0; while (!_vm->shouldQuit()) { @@ -1213,7 +1213,7 @@ LABEL_23: if (_vm->_globals.iRegul == 1) break; LABEL_33: - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.DD_Lock(); if (v7) { if (*v10 != kByteStop) { @@ -1238,23 +1238,23 @@ LABEL_44: while (_vm->_eventsManager._escKeyFl != true) { if (redrawAnim() == true) goto LABEL_48; - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager.lItCounter >= rate3) + if (_vm->_eventsManager._rateCounter >= rate3) goto LABEL_53; } } else { LABEL_53: - _vm->_eventsManager.lItCounter = 0; + _vm->_eventsManager._rateCounter = 0; } goto LABEL_54; } } while (_vm->_eventsManager._escKeyFl != true) { - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); if (redrawAnim() == true) goto LABEL_48; - if (_vm->_eventsManager.lItCounter >= rate2) + if (_vm->_eventsManager._rateCounter >= rate2) goto LABEL_33; } LABEL_54: diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 4f818770f7..1c8080aeef 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -236,7 +236,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { bool numericFlag = false; char v12; do { - v12 = _vm->_eventsManager.keywin(); + v12 = _vm->_eventsManager.waitKeyPress(); if (_vm->shouldQuit()) return; @@ -366,7 +366,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_fontManager.TEXT_NOW(xp, yp, "_", -4); do { - curChar = _vm->_eventsManager.keywin(); + curChar = _vm->_eventsManager.waitKeyPress(); if (_vm->shouldQuit()) return; @@ -581,7 +581,7 @@ void ComputerManager::readText(int idx) { ++v10; } while (v4 != 37); - _vm->_eventsManager.keywin(); + _vm->_eventsManager.waitKeyPress(); _vm->_globals.dos_free2(ptr); } @@ -915,7 +915,7 @@ int ComputerManager::displayHiscores() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); buttonIndex = 0; do { - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); xp = _vm->_eventsManager.getMouseX(); yp = _vm->_eventsManager.getMouseY(); @@ -951,7 +951,7 @@ void ComputerManager::getScoreName() { for (int strPos = 0; strPos <= 4; strPos++) { displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); - curChar = toupper(_vm->_eventsManager.keywin()); + curChar = toupper(_vm->_eventsManager.waitKeyPress()); if ((curChar <= '/') || (curChar > 'Z')) curChar = ' '; if ((uint16)(curChar - ':') <= 6u) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 9b842a15c5..7ebcbc8953 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -315,8 +315,8 @@ void DialogsManager::showInventory() { _vm->_dialogsManager._inventWin1 = g_PTRNUL; LABEL_7: - _vm->_eventsManager.souris_bb = 0; - _vm->_eventsManager.souris_b = 0; + _vm->_eventsManager._curMouseButton = 0; + _vm->_eventsManager._mouseButton = 0; _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -369,7 +369,7 @@ LABEL_7: v15 += 38; } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); - _vm->_eventsManager.souris_bb = 0; + _vm->_eventsManager._curMouseButton = 0; bool v20 = false; int v13 = 0; @@ -386,29 +386,29 @@ LABEL_7: v13 = v11; if (v11 != v10) _vm->_objectsManager.PARAMCADRE(v11); - if (_vm->_eventsManager.btsouris != 16) { - if ((uint16)(_vm->_eventsManager.btsouris - 1) > 1u) { - if (_vm->_eventsManager.btsouris != 3) { + if (_vm->_eventsManager._mouseCursorId != 16) { + if ((uint16)(_vm->_eventsManager._mouseCursorId - 1) > 1u) { + if (_vm->_eventsManager._mouseCursorId != 3) { if (v12 == 2) { _vm->_objectsManager.OBJETPLUS(v13); - if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); } } } } if (v12 == 1) { - if (_vm->_eventsManager.btsouris == 1 || _vm->_eventsManager.btsouris == 16 || !_vm->_eventsManager.btsouris || (uint16)(_vm->_eventsManager.btsouris - 2) <= 1u) + if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) break; v9 = v13; _vm->_objectsManager.VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); - if (_vm->_eventsManager.btsouris == 8) + if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; if (!v20) { _vm->_scriptManager.TRAVAILOBJET = 1; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; - _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager.btsouris; + _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); _vm->_scriptManager.TRAVAILOBJET = 0; @@ -453,14 +453,14 @@ LABEL_7: _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_free2(_vm->_dialogsManager._inventWin1); _inventBuf2 = _vm->_globals.dos_free2(_inventBuf2); - if (_vm->_eventsManager.btsouris == 1) + if (_vm->_eventsManager._mouseCursorId == 1) showOptionsDialog(); - else if (_vm->_eventsManager.btsouris == 3) + else if (_vm->_eventsManager._mouseCursorId == 3) _vm->_dialogsManager.showLoadGame(); - else if (_vm->_eventsManager.btsouris == 2) + else if (_vm->_eventsManager._mouseCursorId == 2) _vm->_dialogsManager.showSaveGame(); - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); _vm->_objectsManager.old_cady = 0; _vm->_objectsManager.cady = 0; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f99c1bdb34..7976ba853d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -38,15 +38,15 @@ EventsManager::EventsManager() { _mouseOffset.x = _mouseOffset.y = 0; _startPos.x = _startPos.y = 0; _breakoutFl = false; - souris_n = 0; - souris_bb = 0; - souris_b = 0; + _mouseSpriteId = 0; + _curMouseButton = 0; + _mouseButton = 0; _mouseCursor = NULL; _gameCounter = 0; - lItCounter = 0; + _rateCounter = 0; _escKeyFl = false; _gameKey = KEY_NONE; - btsouris = 0; + _mouseCursorId = 0; _oldIconId = 0; _objectBuf = NULL; @@ -116,8 +116,8 @@ int EventsManager::getMouseY() { * Get Mouse Button */ int EventsManager::getMouseButton() { - CONTROLE_MES(); - return souris_bb; + refreshEvents(); + return _curMouseButton; } /** @@ -143,23 +143,25 @@ void EventsManager::mouseOn() { void EventsManager::changeMouseCursor(int id) { int cursorId = id; - if (btsouris != 23) { - if (id == 4 && btsouris == 4 && _vm->_globals.NOMARCHE) - cursorId = 0; - if (cursorId == 25) - cursorId = 5; + if (_mouseCursorId != 23) { + if (id == 4 && _mouseCursorId == 4 && _vm->_globals.NOMARCHE) + _mouseCursorId = 0; + if (_mouseCursorId == 25) + _mouseCursorId = 5; - if (_oldIconId != cursorId || !cursorId) { - _oldIconId = cursorId; - souris_n = cursorId; + if (_oldIconId != _mouseCursorId || !_mouseCursorId) { + _oldIconId = _mouseCursorId; + _mouseCursorId = cursorId; updateCursor(); } } } -// Check Events -void EventsManager::CONTROLE_MES() { +/** + * Check Events + */ +void EventsManager::refreshEvents() { _vm->_soundManager.checkSounds(); pollEvents(); @@ -170,7 +172,7 @@ void EventsManager::checkForNextFrameCounter() { uint32 milli = g_system->getMillis(); while ((milli - _priorCounterTime) >= 10) { _priorCounterTime += 10; - lItCounter += 3; + _rateCounter += 3; } // Check for next game frame @@ -211,14 +213,14 @@ void EventsManager::pollEvents() { _keyState[(byte)toupper(event.kbd.ascii)] = false; return; case Common::EVENT_LBUTTONDOWN: - souris_b = 1; + _mouseButton = 1; return; case Common::EVENT_RBUTTONDOWN: - souris_b = 2; + _mouseButton = 2; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: - souris_b = 0; + _mouseButton = 0; return; default: break; @@ -253,7 +255,11 @@ void EventsManager::handleKey(Common::Event &event) { } -int EventsManager::keywin() { +/** + * Waits for a keypress, ignoring mouse events + * @return Keypress, or -1 if game quit was requested + */ +int EventsManager::waitKeyPress() { char foundChar = '\0'; while (!foundChar) { @@ -334,7 +340,7 @@ void EventsManager::VBL() { yp = _mousePos.y; v14 = _mouseSizeX; v13 = _mouseSizeY; - if (btsouris == 23) { + if (_mouseCursorId == 23) { v14 = _vm->_globals.OBJL; v13 = _vm->_globals.OBJH; goto LABEL_35; @@ -373,10 +379,10 @@ LABEL_35: updateCursor(); goto LABEL_54; } - if (btsouris == 23) + if (_mouseCursorId == 23) goto LABEL_45; if (yp >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || v14 <= 1 || v13 <= 1) { - if (btsouris != 23) + if (_mouseCursorId != 23) goto LABEL_54; LABEL_45: if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x) { @@ -415,20 +421,20 @@ LABEL_54: if (_breakoutFl != true) goto LABEL_63; - if (lItCounter > 1) + if (_rateCounter > 1) goto LABEL_65; } if (_vm->_globals.vitesse != 2) break; - if (lItCounter > 9) + if (_rateCounter > 9) goto LABEL_65; } LABEL_63: ; - } while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && lItCounter <= 15); + } while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && _rateCounter <= 15); LABEL_65: _vm->_globals.vitesse = 2; - lItCounter = 0; + _rateCounter = 0; if (_vm->_graphicsManager.DOUBLE_ECRAN != true || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { @@ -495,8 +501,8 @@ LABEL_65: _startPos.x = v4; _vm->_graphicsManager.ofscroll = v4; } - souris_bb = souris_b; - souris_b = 0; + _curMouseButton = _mouseButton; + _mouseButton = 0; #if 0 // Commented by Strangerke. Looks completely useless. @@ -522,7 +528,7 @@ LABEL_65: LABEL_113: #endif _vm->_soundManager.VERIF_SOUND(); - CONTROLE_MES(); + refreshEvents(); } void EventsManager::updateCursor() { @@ -539,9 +545,9 @@ void EventsManager::updateCursor() { byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL]; Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0); - if (btsouris != 23) { + if (_mouseCursorId != 23) { // Draw standard cursor - _vm->_graphicsManager.Sprite_Vesa(cursorSurface, _mouseCursor, 300, 300, souris_n); + _vm->_graphicsManager.Sprite_Vesa(cursorSurface, _mouseCursor, 300, 300, _mouseSpriteId); } else { // Draw the active inventory object _vm->_graphicsManager.Affiche_Perfect(cursorSurface, _objectBuf, 300, 300, 0, 0, 0, 0); diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index fef8c2a4c2..530a3f8121 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -53,25 +53,24 @@ public: Common::Point _mousePos; bool _breakoutFl; int _oldIconId; - int souris_n; - int souris_bb; - int souris_b; + int _mouseSpriteId; + int _curMouseButton; + int _mouseButton; byte *_mouseCursor; uint32 _gameCounter; - uint32 lItCounter; + uint32 _rateCounter; uint32 _priorCounterTime; uint32 _priorFrameTime; bool _escKeyFl; bool _disableEscKeyFl; DIALOG_KEY _gameKey; - int btsouris; + int _mouseCursorId; byte *_objectBuf; bool _keyState[256]; public: EventsManager(); ~EventsManager(); void setParent(HopkinsEngine *vm); - void setMouseOn(); void setMouseXY(int xp, int yp); int getMouseX(); @@ -80,16 +79,11 @@ public: void mouseOn(); void mouseOff(); void changeMouseCursor(int id); - - void CONTROLE_MES(); + void refreshEvents(); void delay(int delay); - void VBL(); + int waitKeyPress(); - /** - * Waits for a keypress, ignoring mouse events - * @return Keypress, or -1 if game quit was requested - */ - int keywin(); + void VBL(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c1e7667340..ff2a0735a0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -149,7 +149,7 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Fin_Interrupt()"); warning("TODO TEST = 1;"); warning("TODO no_vsync = 1;"); - _eventsManager.lItCounter = 0; + _eventsManager._rateCounter = 0; warning("TODO Init_Interrupt_();"); _globals.iRegul = 1; @@ -161,14 +161,14 @@ bool HopkinsEngine::runWin95Demo() { } _globals.iRegul = 0; - warning("TODO SPEEDJ = _globals.lItCounter;"); + warning("TODO SPEEDJ = _globals._rateCounter;"); warning("TODO no_vsync = 0;"); warning("TODO TEST = 0;"); // if (SPEEDJ > 475) - if (_eventsManager.lItCounter > 475) + if (_eventsManager._rateCounter > 475) _globals.vitesse = 2; // if (SPEEDJ > 700) - if (_eventsManager.lItCounter > 700) + if (_eventsManager._rateCounter > 700) _globals.vitesse = 3; warning("TODO Fin_Interrupt_();"); warning("TODO Init_Interrupt_();"); @@ -3026,7 +3026,7 @@ void HopkinsEngine::BOOM() { void HopkinsEngine::REST_SYSTEM() { quitGame(); - _eventsManager.CONTROLE_MES(); + _eventsManager.refreshEvents(); } void HopkinsEngine::PUBQUIT() { @@ -3041,8 +3041,8 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(0); - _eventsManager.btsouris = 0; - _eventsManager.souris_n = 0; + _eventsManager._mouseCursorId = 0; + _eventsManager._mouseSpriteId = 0; _globals.netscape = true; bool mouseClicked = false; @@ -3297,11 +3297,11 @@ void HopkinsEngine::JOUE_FIN() { _graphicsManager.LOAD_IMAGE("PLAN3"); _graphicsManager.FADE_INW(); - _eventsManager.lItCounter = 0; + _eventsManager._rateCounter = 0; if (!_eventsManager._escKeyFl) { do - _eventsManager.CONTROLE_MES(); - while (_eventsManager.lItCounter < 2000 / _globals.vitesse && !_eventsManager._escKeyFl); + _eventsManager.refreshEvents(); + while (_eventsManager._rateCounter < 2000 / _globals.vitesse && !_eventsManager._escKeyFl); } _eventsManager._escKeyFl = false; _graphicsManager.FADE_OUTW(); @@ -3698,7 +3698,7 @@ void HopkinsEngine::Credits() { void HopkinsEngine::BTOCEAN() { _fontManager.TEXTE_OFF(9); - if (_eventsManager.btsouris == 16) { + if (_eventsManager._mouseCursorId == 16) { _eventsManager.getMouseX(); if (_objectsManager.NUMZONE > 0) { int oldPosX = _eventsManager.getMouseX(); @@ -4009,14 +4009,14 @@ bool HopkinsEngine::ADULT() { _globals.FORET = false; _globals.FLAG_VISIBLE = false; _globals._disableInventFl = true; - _globals.SORTIE = false; + _globals.SORTIE = 0; _graphicsManager.LOAD_IMAGE("ADULT"); _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(0); - _eventsManager.btsouris = false; - _eventsManager.souris_n = false; + _eventsManager._mouseCursorId = 0; + _eventsManager._mouseSpriteId = 0; do { xp = _eventsManager.getMouseX(); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 9228c6cb5f..9e5abf0c3e 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -93,8 +93,8 @@ int MenuManager::MENU() { spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.mouseOn(); _vm->_eventsManager.changeMouseCursor(0); - _vm->_eventsManager.btsouris = 0; - _vm->_eventsManager.souris_n = 0; + _vm->_eventsManager._mouseCursorId = 0; + _vm->_eventsManager._mouseSpriteId = 0; for (;;) { for (;;) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 1da0420ac0..44123cb84f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1662,7 +1662,7 @@ void ObjectsManager::VERIFZONE() { } if (_vm->_globals.old_zone_68 != v4) { _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); if (_vm->_globals.zozo_73 == 1) { _vm->_fontManager.TEXTE_OFF(5); @@ -1695,17 +1695,17 @@ LABEL_54: _vm->_globals.force_to_data_0 = 0; _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0); - if (_vm->_eventsManager.btsouris == 4) { + if (_vm->_eventsManager._mouseCursorId == 4) { v1 = 5 * v4; if (_vm->_globals.ZONEP[v4].field6 == 2) { _vm->_eventsManager.changeMouseCursor(16); - _vm->_eventsManager.btsouris = 16; + _vm->_eventsManager._mouseCursorId = 16; verbe = 16; } } } else { _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); } } @@ -1714,7 +1714,7 @@ LABEL_54: _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; if (_vm->_globals.NOMARCHE == true) { - if (_vm->_eventsManager.btsouris == 4) { + if (_vm->_eventsManager._mouseCursorId == 4) { v1 = v4 + 1; if ((uint16)(v4 + 1) > 1u) BTDROITE(); @@ -1722,7 +1722,7 @@ LABEL_54: } if ((_vm->_globals.PLAN_FLAG == true && v4 == -1) || !v4) { verbe = 0; - _vm->_eventsManager.btsouris = 0; + _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } } @@ -2635,7 +2635,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); _vm->_globals.NOPARLE = false; v5 = 0; - _vm->_eventsManager.souris_bb = false; + _vm->_eventsManager._curMouseButton = 0; } if (v5 == 1) BTGAUCHE(); @@ -2693,14 +2693,14 @@ void ObjectsManager::BTGAUCHE() { destY = _vm->_eventsManager.getMouseY(); if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { - v1 = _vm->_eventsManager.btsouris; + v1 = _vm->_eventsManager._mouseCursorId; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; if (!_vm->_globals.SORTIE) { _vm->_dialogsManager._inventFl = false; - _vm->_eventsManager.btsouris = v1; + _vm->_eventsManager._mouseCursorId = v1; } return; } @@ -2761,7 +2761,7 @@ void ObjectsManager::BTGAUCHE() { _vm->_globals.SAUVEGARDE->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == true && (_vm->_eventsManager.btsouris != 4 || NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG == true && (_vm->_eventsManager._mouseCursorId != 4 || NUMZONE <= 0)) return; if ((uint16)(NUMZONE + 1) > 1u) { zoneCount = NUMZONE; @@ -2833,7 +2833,7 @@ LABEL_65: } if ((uint16)(NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler - if (_vm->_eventsManager.btsouris == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager.btsouris, _vm->_eventsManager.btsouris == 23)) + if (_vm->_eventsManager._mouseCursorId == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager._mouseCursorId, _vm->_eventsManager._mouseCursorId == 23)) _vm->_globals.SAUVEGARDE->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == true) _vm->_globals.SAUVEGARDE->data[svField1] = 6; @@ -2844,13 +2844,13 @@ LABEL_65: _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); ARRET_PERSO_FLAG = 0; - if (_vm->_eventsManager.btsouris == 21 && _vm->_globals.BOBZONE[NUMZONE]) { + if (_vm->_eventsManager._mouseCursorId == 21 && _vm->_globals.BOBZONE[NUMZONE]) { ARRET_PERSO_FLAG = 1; ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField132] == 1 && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 - && _vm->_eventsManager.btsouris == 23) { + && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move _vm->_globals.chemin = (int16 *)g_PTRNUL; XSPR(0); @@ -2937,29 +2937,29 @@ LABEL_64: FORCEZONE = 1; } if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; CHANGEVERBE = 0; } else { - _vm->_eventsManager.btsouris = _vm->_globals.SAUVEGARDE->data[svField1]; + _vm->_eventsManager._mouseCursorId = _vm->_globals.SAUVEGARDE->data[svField1]; if (CHANGEVERBE == 1) { VERBEPLUS(); CHANGEVERBE = 0; } - if (_vm->_eventsManager.btsouris == 5) - _vm->_eventsManager.btsouris = 4; + if (_vm->_eventsManager._mouseCursorId == 5) + _vm->_eventsManager._mouseCursorId = 4; } - if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); NUMZONE = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } if (_vm->_globals.PLAN_FLAG == true) { - _vm->_eventsManager.btsouris = 0; + _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } if (_vm->_globals.NOMARCHE == true) { - if (_vm->_eventsManager.btsouris == 4) { + if (_vm->_eventsManager._mouseCursorId == 4) { result = NUMZONE + 1; if ((uint16)(NUMZONE + 1) > 1u) BTDROITE(); @@ -2990,7 +2990,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.BOBZONE_FLAG[v2] = false; ++v1; } while (v1 <= 48); - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; verbe = 4; NUMZONE = 0; Vold_taille = 0; @@ -3008,7 +3008,7 @@ void ObjectsManager::CLEAR_ECRAN() { if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) _vm->_globals.SPRITE_ECRAN = _vm->_globals.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; - _vm->_eventsManager.souris_n = 0; + _vm->_eventsManager._mouseSpriteId = 0; Vold_taille = 200; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; @@ -3614,8 +3614,8 @@ LABEL_88: void ObjectsManager::VERBEPLUS() { int v; - v = _vm->_eventsManager.btsouris + 1; - _vm->_eventsManager.btsouris = v; + v = _vm->_eventsManager._mouseCursorId + 1; + _vm->_eventsManager._mouseCursorId = v; if (v == 4) goto LABEL_24; if (v == 5) @@ -3662,150 +3662,150 @@ void ObjectsManager::VERBEPLUS() { goto LABEL_67; do { do { - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; LABEL_24: if (_vm->_globals.NOMARCHE != true || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { - if (_vm->_eventsManager.btsouris == 4) + if (_vm->_eventsManager._mouseCursorId == 4) return; } else { - _vm->_eventsManager.btsouris = 5; + _vm->_eventsManager._mouseCursorId = 5; } LABEL_28: - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 6) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 6) { LABEL_29: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 7) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 7) { LABEL_31: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 8) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 8) { LABEL_33: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 9) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 9) { LABEL_35: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 10) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 10) { LABEL_37: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 11) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 11) { LABEL_39: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 12) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 12) { LABEL_41: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 13) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 13) { LABEL_43: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 14) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 14) { LABEL_45: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 15) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 15) { LABEL_47: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 16) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 16) { LABEL_49: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 17) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 17) { LABEL_51: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 18) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 18) { LABEL_53: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 19) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 19) { LABEL_55: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 20) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 20) { LABEL_57: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 21) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 21) { LABEL_59: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 22) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 22) { LABEL_61: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 23) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 23) { LABEL_63: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 24) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 24) { LABEL_65: v = 5 * NUMZONE; if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) return; } - v = _vm->_eventsManager.btsouris + 1; - _vm->_eventsManager.btsouris = v; + v = _vm->_eventsManager._mouseCursorId + 1; + _vm->_eventsManager._mouseCursorId = v; } while (v != 25); LABEL_67: v = 5 * NUMZONE; @@ -3815,9 +3815,9 @@ LABEL_67: void ObjectsManager::BTDROITE() { if ((uint16)(NUMZONE + 1) > 1u) { VERBEPLUS(); - if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); - verbe = _vm->_eventsManager.btsouris; + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); + verbe = _vm->_eventsManager._mouseCursorId; } } @@ -4000,25 +4000,25 @@ void ObjectsManager::PARAMCADRE(int a1) { cadi = 0; } if (!a1) - _vm->_eventsManager.btsouris = 0; + _vm->_eventsManager._mouseCursorId = 0; if (a1 == 32) - _vm->_eventsManager.btsouris = 16; + _vm->_eventsManager._mouseCursorId = 16; if (a1 == 30) - _vm->_eventsManager.btsouris = 2; + _vm->_eventsManager._mouseCursorId = 2; if (a1 == 31) - _vm->_eventsManager.btsouris = 3; + _vm->_eventsManager._mouseCursorId = 3; if ((uint16)(a1 - 1) <= 0x1Cu) - _vm->_eventsManager.btsouris = 8; + _vm->_eventsManager._mouseCursorId = 8; if (a1 == 29) - _vm->_eventsManager.btsouris = 1; + _vm->_eventsManager._mouseCursorId = 1; if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals.INVENTAIRE[a1]) { - _vm->_eventsManager.btsouris = 0; + _vm->_eventsManager._mouseCursorId = 0; cadx = 0; cady = 0; cadi = 0; } - if (_vm->_eventsManager.btsouris != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager.btsouris); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); _vm->_eventsManager.getMouseX(); _vm->_eventsManager.getMouseY(); } @@ -4028,79 +4028,79 @@ void ObjectsManager::OBJETPLUS(int idx) { int v2; int v3; - v1 = _vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris && _vm->_eventsManager.btsouris != 16 && (uint16)(_vm->_eventsManager.btsouris - 2) > 1u) { - v2 = _vm->_eventsManager.btsouris++ + 1; + v1 = _vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId && _vm->_eventsManager._mouseCursorId != 16 && (uint16)(_vm->_eventsManager._mouseCursorId - 2) > 1u) { + v2 = _vm->_eventsManager._mouseCursorId++ + 1; if (v1 == 5) goto LABEL_24; if (v2 == 7) goto LABEL_26; if (v2 != 8) { if (v2 == 9) - _vm->_eventsManager.btsouris = 10; - if (_vm->_eventsManager.btsouris == 10) + _vm->_eventsManager._mouseCursorId = 10; + if (_vm->_eventsManager._mouseCursorId == 10) goto LABEL_29; - if (_vm->_eventsManager.btsouris == 11) + if (_vm->_eventsManager._mouseCursorId == 11) goto LABEL_31; - if (_vm->_eventsManager.btsouris == 12) - _vm->_eventsManager.btsouris = 13; - if (_vm->_eventsManager.btsouris == 13) + if (_vm->_eventsManager._mouseCursorId == 12) + _vm->_eventsManager._mouseCursorId = 13; + if (_vm->_eventsManager._mouseCursorId == 13) goto LABEL_33; - if (_vm->_eventsManager.btsouris == 14) - _vm->_eventsManager.btsouris = 15; - if (_vm->_eventsManager.btsouris == 15) + if (_vm->_eventsManager._mouseCursorId == 14) + _vm->_eventsManager._mouseCursorId = 15; + if (_vm->_eventsManager._mouseCursorId == 15) goto LABEL_35; - if ((uint16)(_vm->_eventsManager.btsouris - 16) <= 6u) - _vm->_eventsManager.btsouris = 23; - if (_vm->_eventsManager.btsouris == 23) + if ((uint16)(_vm->_eventsManager._mouseCursorId - 16) <= 6u) + _vm->_eventsManager._mouseCursorId = 23; + if (_vm->_eventsManager._mouseCursorId == 23) goto LABEL_37; - if (_vm->_eventsManager.btsouris == 24) - _vm->_eventsManager.btsouris = 25; - if (_vm->_eventsManager.btsouris == 25) + if (_vm->_eventsManager._mouseCursorId == 24) + _vm->_eventsManager._mouseCursorId = 25; + if (_vm->_eventsManager._mouseCursorId == 25) goto LABEL_39; do { - _vm->_eventsManager.btsouris = 6; + _vm->_eventsManager._mouseCursorId = 6; LABEL_24: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field2 == 1) break; - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 7) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 7) { LABEL_26: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field3 == 1) return; } - v3 = _vm->_eventsManager.btsouris++; - if (_vm->_eventsManager.btsouris == 8) + v3 = _vm->_eventsManager._mouseCursorId++; + if (_vm->_eventsManager._mouseCursorId == 8) break; - _vm->_eventsManager.btsouris = v3 + 3; + _vm->_eventsManager._mouseCursorId = v3 + 3; if (v3 == 7) { LABEL_29: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field7 == 1) return; } - ++_vm->_eventsManager.btsouris; - if (_vm->_eventsManager.btsouris == 11) { + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_eventsManager._mouseCursorId == 11) { LABEL_31: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field4 == 1) return; } - _vm->_eventsManager.btsouris += 2; - if (_vm->_eventsManager.btsouris == 13) { + _vm->_eventsManager._mouseCursorId += 2; + if (_vm->_eventsManager._mouseCursorId == 13) { LABEL_33: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field5 == 1) return; } - _vm->_eventsManager.btsouris += 2; - if (_vm->_eventsManager.btsouris == 15) { + _vm->_eventsManager._mouseCursorId += 2; + if (_vm->_eventsManager._mouseCursorId == 15) { LABEL_35: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field6 == 1) return; } - _vm->_eventsManager.btsouris = 23; + _vm->_eventsManager._mouseCursorId = 23; LABEL_37: if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field6 == 2) break; - _vm->_eventsManager.btsouris = 25; + _vm->_eventsManager._mouseCursorId = 25; LABEL_39: ; } while (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field7 != 2); @@ -4109,7 +4109,7 @@ LABEL_39: } void ObjectsManager::VALID_OBJET(int a1) { - if (_vm->_eventsManager.btsouris == 8) + if (_vm->_eventsManager._mouseCursorId == 8) CHANGE_OBJET(a1); } @@ -4882,7 +4882,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { BOBANIM_ON(8); } if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { - _vm->_eventsManager.souris_n = 4; + _vm->_eventsManager._mouseSpriteId = 4; _vm->_globals.BPP_NOAFF = true; v3 = 0; do { @@ -4968,8 +4968,8 @@ void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, } void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { - _vm->_eventsManager.souris_bb = 0; - _vm->_eventsManager.souris_b = 0; + _vm->_eventsManager._curMouseButton = 0; + _vm->_eventsManager._mouseButton = 0; if (a4 != 3) { BOBANIM_ON(a1); @@ -4978,7 +4978,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { do { _vm->_eventsManager.VBL(); - if (_vm->_eventsManager.souris_bb) + if (_vm->_eventsManager._curMouseButton) break; } while (a3 != BOBPOSI(a1)); if (!a4) @@ -5630,7 +5630,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.INI_ECRAN2(s4); } _vm->_eventsManager.mouseOn(); - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -5671,7 +5671,7 @@ LABEL_70: _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); SPECIAL_INI(linkFile); - _vm->_eventsManager.souris_n = 4; + _vm->_eventsManager._mouseSpriteId = 4; g_old_x = PERX; g_old_y = PERY; _vm->_globals.g_old_sens = -1; @@ -5697,7 +5697,7 @@ LABEL_70: mouseButtons = _vm->_eventsManager.getMouseButton(); if (mouseButtons) { if (mouseButtons == 1) { - if (verbe == 16 && _vm->_eventsManager.btsouris == 16) { + if (verbe == 16 && _vm->_eventsManager._mouseCursorId == 16) { xp = _vm->_eventsManager.getMouseX(); yp = _vm->_eventsManager.getMouseY(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 6478dcdc7f..6f3a06ab6b 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -690,7 +690,7 @@ LABEL_1141: if (v76 == 18) _vm->_talkManager.PARLER_PERSO("fjour.pe2"); if (v76 == 13) { - _vm->_eventsManager.souris_b = _vm->_eventsManager.souris_bb; + _vm->_eventsManager._mouseButton = _vm->_eventsManager._curMouseButton; _vm->_globals._disableInventFl = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index db1b072e95..01a977cfe4 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -615,7 +615,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) break; - _vm->_eventsManager.CONTROLE_MES(); + _vm->_eventsManager.refreshEvents(); if (_vm->_eventsManager._escKeyFl) break; if (!VOICE_STAT(2)) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2246ab3b50..a13f757d77 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -120,8 +120,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PLIGNE2 = v2 + 1; PLIGNE3 = v2 + 2; PLIGNE4 = v2 + 3; - v14 = _vm->_eventsManager.btsouris; - _vm->_eventsManager.btsouris = 4; + v14 = _vm->_eventsManager._mouseCursorId; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { v4 = v2 + 3; @@ -152,7 +152,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; - _vm->_eventsManager.btsouris = v14; + _vm->_eventsManager._mouseCursorId = v14; _vm->_eventsManager.changeMouseCursor(v14); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -234,8 +234,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { PLIGNE2 = v1 + 1; PLIGNE3 = v1 + 2; PLIGNE4 = v1 + 3; - int v8 = _vm->_eventsManager.btsouris; - _vm->_eventsManager.btsouris = 4; + int v8 = _vm->_eventsManager._mouseCursorId; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { @@ -259,7 +259,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { } BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); - _vm->_eventsManager.btsouris = v8; + _vm->_eventsManager._mouseCursorId = v8; _vm->_eventsManager.changeMouseCursor(v8); _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); @@ -477,8 +477,8 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager.VOICE_MIX(v22, 1)) { v14 = 0; - _vm->_eventsManager.souris_bb = false; - _vm->_eventsManager.souris_b = false; + _vm->_eventsManager._curMouseButton = 0; + _vm->_eventsManager._mouseButton = 0; if (_vm->getIsDemo()) { do { @@ -490,7 +490,7 @@ int TalkManager::DIALOGUE_REP(int idx) { do { _vm->_eventsManager.VBL(); ++v14; - if ( _vm->_eventsManager.souris_b || _vm->_eventsManager.souris_bb ) + if (_vm->_eventsManager._mouseButton || _vm->_eventsManager._curMouseButton) v14 = v6; if (_vm->_eventsManager.getMouseButton()) { i = 5; @@ -1217,7 +1217,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.BOBZONE[v2++] = 0; while (v2 <= 44); _vm->_objectsManager.NUMZONE = -1; - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); BUFFERPERSO = _vm->_fileManager.searchCat(a2, 5); TAILLEPERSO = _vm->_globals.CAT_TAILLE; @@ -1320,7 +1320,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; - _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); -- cgit v1.2.3 From 3b3a28e27f038207b72f03b478b7bf93357d1c25 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 12 Dec 2012 00:22:18 +0100 Subject: HOPKINS: Rename functions in FontManager --- engines/hopkins/computer.cpp | 8 +- engines/hopkins/dialogs.cpp | 4 +- engines/hopkins/events.cpp | 2 +- engines/hopkins/font.cpp | 264 ++++++++++++++++++++++--------------------- engines/hopkins/font.h | 78 ++++++------- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/objects.cpp | 97 ++++++++-------- engines/hopkins/script.cpp | 36 +++--- engines/hopkins/talk.cpp | 46 ++++---- 9 files changed, 272 insertions(+), 265 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 1c8080aeef..6dc7f1e6ac 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -364,7 +364,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { bool oldMouseFlag = _vm->_eventsManager._mouseFl; _vm->_eventsManager._mouseFl = false; - _vm->_fontManager.TEXT_NOW(xp, yp, "_", -4); + _vm->_fontManager.displayTextVesa(xp, yp, "_", -4); do { curChar = _vm->_eventsManager.waitKeyPress(); if (_vm->shouldQuit()) @@ -454,7 +454,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { x2 = x1 + 2 * _vm->_globals.police_l; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, x2, yp + 12); - _vm->_fontManager.TEXT_NOW(x1, yp, "_", -4); + _vm->_fontManager.displayTextVesa(x1, yp, "_", -4); } if (mappedChar != '*') { newChar = mappedChar; @@ -463,7 +463,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); - _vm->_fontManager.TEXT_NOW(x1, yp, charString, -4); + _vm->_fontManager.displayTextVesa(x1, yp, charString, -4); ++textIndex; x1 += _vm->_globals.police_l; } @@ -490,7 +490,7 @@ void ComputerManager::outText(const Common::String &msg) { * Outputs a text string */ void ComputerManager::outText2(const Common::String &msg) { - _vm->_fontManager.TEXT_NOW(_textPosition.x, _textPosition.y, msg, _textColor); + _vm->_fontManager.displayTextVesa(_textPosition.x, _textPosition.y, msg, _textColor); } /** diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7ebcbc8953..0c72005894 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -416,7 +416,7 @@ LABEL_7: do _vm->_eventsManager.VBL(); while (!_vm->_globals.SORTIE && _vm->_eventsManager.getMouseButton() != 1); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); } if (_vm->_globals.SORTIE) { if (_vm->_globals.SORTIE == 2) @@ -441,7 +441,7 @@ LABEL_7: if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) _vm->_objectsManager.SPECIAL_JEU(); } - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { _inventDisplayedFl = false; // v9 = 114; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 7976ba853d..5f9ee21464 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -456,7 +456,7 @@ LABEL_65: if (_vm->_graphicsManager.OLD_SCROLL == v4) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.SDL_ECHELLE) { if (_vm->_graphicsManager.Winbpp == 2) { diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 9efae223cd..7b5cfded30 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -42,90 +42,100 @@ void FontManager::setParent(HopkinsEngine *vm) { void FontManager::clearAll() { for (int idx = 0; idx < 12; ++idx) { - Common::fill((byte *)&Txt[idx], (byte *)&Txt[idx] + sizeof(TxtItem), 0); + Common::fill((byte *)&_text[idx], (byte *)&_text[idx] + sizeof(TxtItem), 0); - ListeTxt[idx].enabled = false; - ListeTxt[idx].height = 0; - ListeTxt[idx].width = 0; - ListeTxt[idx].xp = 0; - ListeTxt[idx].yp = 0; + _textList[idx]._enabledFl = false; + _textList[idx]._height = 0; + _textList[idx]._width = 0; + _textList[idx]._pos.x = 0; + _textList[idx]._pos.y = 0; } for (int idx = 0; idx < 21; idx++) - TRIER_TEXT[idx] = 0; + _textSortArray[idx] = 0; - oldname = Common::String(""); - nom_index = Common::String(""); + _oldName = Common::String(""); + _indexName = Common::String(""); for (int idx = 0; idx < 4048; idx++) - Index[idx] = 0; + _index[idx] = 0; - texte_tmp = g_PTRNUL; + _tempText = g_PTRNUL; } -// Text On -void FontManager::TEXTE_ON(int idx) { - if ((idx - 5) > 11) +/** + * Display Text + */ +void FontManager::showText(int idx) { + if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); - TxtItem &txt = Txt[idx - 5]; - txt.textOn = true; - txt.textLoaded = false; + TxtItem &txt = _text[idx - 5]; + txt._textOnFl = true; + txt._textLoadedFl = false; - if (txt.textBlock != g_PTRNUL) { - _vm->_globals.dos_free2(txt.textBlock); - txt.textBlock = g_PTRNUL; + if (txt._textBlock != g_PTRNUL) { + _vm->_globals.dos_free2(txt._textBlock); + txt._textBlock = g_PTRNUL; } } -// Text Off -void FontManager::TEXTE_OFF(int idx) { - if ((idx - 5) > 11) +/** + * Hide text + */ +void FontManager::hideText(int idx) { + if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); - TxtItem &txt = Txt[idx - 5]; - txt.textOn = false; - txt.textLoaded = false; + TxtItem &txt = _text[idx - 5]; + txt._textOnFl = false; + txt._textLoadedFl = false; - if (txt.textBlock != g_PTRNUL) { - _vm->_globals.dos_free2(txt.textBlock); - txt.textBlock = g_PTRNUL; + if (txt._textBlock != g_PTRNUL) { + _vm->_globals.dos_free2(txt._textBlock); + txt._textBlock = g_PTRNUL; } } -// Text Color -void FontManager::COUL_TXT(int idx, byte colByte) { - Txt[idx - 5].colour = colByte; +/** + * Set Text Color + */ +void FontManager::setTextColor(int idx, byte colByte) { + _text[idx - 5]._color = colByte; } -// Text Optimal Color -void FontManager::OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4) { - COUL_TXT(idx1, 255); - COUL_TXT(idx2, 255); - COUL_TXT(idx3, 255); - COUL_TXT(idx4, 253); +/** + * Set Text Optimal Color + */ +void FontManager::setOptimalColor(int idx1, int idx2, int idx3, int idx4) { + setTextColor(idx1, 255); + setTextColor(idx2, 255); + setTextColor(idx3, 255); + setTextColor(idx4, 253); } -// -void FontManager::DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int colour) { - if ((idx - 5) > 11) +/** + * Init text structure + */ +void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int textType, int a9, int color) { + if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); - TxtItem &txt = Txt[idx - 5]; - txt.textOn = false; - txt.filename = filename; - txt.xp = xp; - txt.yp = yp; - txt.messageId = messageId; - txt.fieldE = a6; - txt.field10 = a7; - txt.field3FC = a8; - txt.field3FE = a9; - txt.colour = colour; + TxtItem &txt = _text[idx - 5]; + txt._textOnFl = false; + txt._filename = filename; + txt._pos.x = xp; + txt._pos.y = yp; + txt._messageId = messageId; + txt._fieldE = a6; // Useless variable + txt._field10 = a7; // Useless variable + txt._textType = textType; + txt._field3FE = a9; + txt._color = color; } // Box -void FontManager::BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp) { +void FontManager::box(int idx, int messageId, const Common::String &filename, int xp, int yp) { byte *v9; byte *ptre; Common::String s; @@ -138,66 +148,66 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, error("Bad number for text"); _vm->_globals.police_l = 11; - _vm->_globals.largeur_boite = 11 * Txt[idx].field3FE; - if (Txt[idx].textLoaded) { - int v34 = Txt[idx].field3FC; - if (v34 != 6 && v34 != 1 && v34 != 3 && v34 != 5) { + _vm->_globals.largeur_boite = 11 * _text[idx]._field3FE; + if (_text[idx]._textLoadedFl) { + int textType = _text[idx]._textType; + if (textType != 6 && textType != 1 && textType != 3 && textType != 5) { int yCurrent = yp + 5; - if (Txt[idx].lineCount > 0) { - for (int lineNum = 0; lineNum < Txt[idx].lineCount; ++lineNum) { - TEXT_NOW1(xp + 5, yCurrent, Txt[idx].lines[lineNum], Txt[idx].colour); + if (_text[idx]._lineCount > 0) { + for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { + displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); yCurrent += _vm->_globals.police_h + 1; } } } else { - int v36 = Txt[idx].height; - int v37 = Txt[idx].width; + int height = _text[idx]._height; + int width = _text[idx]._width; _vm->_graphicsManager.Restore_Mem( _vm->_graphicsManager.VESA_BUFFER, - Txt[idx].textBlock, + _text[idx]._textBlock, xp, yp, - Txt[idx].width, - Txt[idx].height); - _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + v37, yp + v36); + _text[idx]._width, + _text[idx]._height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); } } else { int lineCount = 0; int v62 = 0; do { - TRIER_TEXT[v62++] = 0; + _textSortArray[v62++] = 0; } while (v62 <= 19); - Txt[idx].textLoaded = true; + _text[idx]._textLoadedFl = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); file = _vm->_globals.NFICHIER; - if (strncmp(file.c_str(), oldname.c_str(), strlen(file.c_str())) != 0) { + if (strncmp(file.c_str(), _oldName.c_str(), strlen(file.c_str())) != 0) { // Starting to access a new file, so read in the index file for the file - oldname = file; - nom_index = Common::String(file.c_str(), file.size() - 3); - nom_index += "IND"; + _oldName = file; + _indexName = Common::String(file.c_str(), file.size() - 3); + _indexName += "IND"; - if (!f.open(nom_index)) - error("Error opening file - %s", nom_index.c_str()); + if (!f.open(_indexName)) + error("Error opening file - %s", _indexName.c_str()); int filesize = f.size(); for (int i = 0; i < (filesize / 4); ++i) - Index[i] = f.readUint32LE(); + _index[i] = f.readUint32LE(); f.close(); } int v11, v69; if (filename[0] != 'Z' || filename[1] != 'O') { if (!f.open(file)) - error("Error opening file - %s", nom_index.c_str()); + error("Error opening file - %s", _indexName.c_str()); v69 = 2048; - f.seek(Index[messageId]); + f.seek(_index[messageId]); - texte_tmp = _vm->_globals.dos_malloc2(0x80Au); - if (texte_tmp == g_PTRNUL) + _tempText = _vm->_globals.dos_malloc2(0x80Au); + if (_tempText == g_PTRNUL) error("Error allocating text"); - Common::fill(&texte_tmp[0], &texte_tmp[0x80a], 0); - f.read(texte_tmp, 0x800u); + Common::fill(&_tempText[0], &_tempText[0x80a], 0); + f.read(_tempText, 0x800u); f.close(); _vm->_globals.texte_long = 2048; } else { @@ -206,13 +216,13 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v9 = _vm->_globals.dos_malloc2(0x6Eu); Common::fill(&v9[0], &v9[0x6e], 0); - texte_tmp = v9; - const byte *v10 = _vm->_globals.BUF_ZONE + Index[messageId]; + _tempText = v9; + const byte *v10 = _vm->_globals.BUF_ZONE + _index[messageId]; memcpy(v9, v10, 0x60u); v11 = 0; WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } - byte *v59 = texte_tmp; + byte *v59 = _tempText; byte *v60; if (!v69) goto LABEL_43; @@ -232,21 +242,21 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, v59++; }; - v60 = texte_tmp; + v60 = _tempText; if (v69) { int v64 = 0; for (;;) { byte v14 = *(v60 + v64); if (v14 == '\r' || v14 == '\n') { *(v60 + v64) = 0; - if (!Txt[idx].field3FE) + if (!_text[idx]._field3FE) break; } ++v64; if (v69 <= v64) goto LABEL_43; } - Txt[idx].field3FE = v64; + _text[idx]._field3FE = v64; _vm->_globals.largeur_boite = 0; if (v64 + 1 > 0) { @@ -261,18 +271,18 @@ void FontManager::BOITE(int idx, int messageId, const Common::String &filename, int v17 = _vm->_globals.largeur_boite / 2; if (v17 < 0) v17 = -v17; - Txt[idx].xp = 320 - v17; + _text[idx]._pos.x = 320 - v17; v73 = _vm->_eventsManager._startPos.x + 320 - v17; lineCount = 1; if (v64 + 1 > 0) { - Txt[idx].lines[0] = Common::String((const char *)v60, v64); + _text[idx]._lines[0] = Common::String((const char *)v60, v64); } } else { LABEL_43: if (!_vm->_globals.largeur_boite) _vm->_globals.largeur_boite = 240; int v65 = 0; - byte *v61 = texte_tmp; + byte *v61 = _tempText; int v21; int lineSize; do { @@ -308,29 +318,29 @@ LABEL_57: while (actualSize < lineSize && *(v61 + v65 + actualSize)) ++actualSize; - Txt[idx].lines[v20] = Common::String((const char *)v61 + v65, actualSize); - TRIER_TEXT[lineCount++] = lineSize; + _text[idx]._lines[v20] = Common::String((const char *)v61 + v65, actualSize); + _textSortArray[lineCount++] = lineSize; v65 += lineSize; v11 = v21; } while (v21 != 37); for (int i = 0; i <= 19; i++) { - int v22 = TRIER_TEXT[i]; + int v22 = _textSortArray[i]; if (v22 <= 0) { - TRIER_TEXT[i] = 0; + _textSortArray[i] = 0; } else { int ptrc = 0; if (v22 - 1 > 0) { - for (int v23 = 0; v23 < TRIER_TEXT[i] - 1; v23++) { - Common::String &line = Txt[idx].lines[i]; + for (int v23 = 0; v23 < _textSortArray[i] - 1; v23++) { + Common::String &line = _text[idx]._lines[i]; byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if ((byte)v24 <= 0x1Fu) v24 = 32; ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); } } - TRIER_TEXT[i] = ptrc; + _textSortArray[i] = ptrc; } } for (int i = 0; i <= 19; i++) { @@ -339,21 +349,21 @@ LABEL_57: ++v25; if (v25 == 20) v25 = 0; - if (TRIER_TEXT[i] < TRIER_TEXT[v25]) - TRIER_TEXT[i] = 0; + if (_textSortArray[i] < _textSortArray[v25]) + _textSortArray[i] = 0; } while (v25 != i); }; for (int i = 0; i <= 19; i++) { - if (TRIER_TEXT[i]) - _vm->_globals.largeur_boite = TRIER_TEXT[i]; + if (_textSortArray[i]) + _vm->_globals.largeur_boite = _textSortArray[i]; } - if ((uint16)(Txt[idx].field3FC - 2) > 1u) { + if (_text[idx]._textType > 3) { int i; - for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals.largeur_boite + i > 638 && i > -2 && Txt[idx].field3FC; i -= 2) + for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals.largeur_boite + i > 638 && i > -2 && _text[idx]._textType; i -= 2) ; - Txt[idx].xp = i; + _text[idx]._pos.x = i; v73 = _vm->_eventsManager._startPos.x + i; } else { if (_vm->_globals.nbrligne == (SCREEN_WIDTH - 1)) { @@ -364,7 +374,7 @@ LABEL_57: while (_vm->_globals.largeur_boite + v73 > 1278 && v73 > -2) v73 -= 2; } - Txt[idx].xp = v73; + _text[idx]._pos.x = v73; } } _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; @@ -372,20 +382,20 @@ LABEL_57: int v55 = yp; int v53 = _vm->_globals.largeur_boite + 10; int v51 = (_vm->_globals.police_h + 1) * lineCount + 12; - if (Txt[idx].field3FC == 6) { + if (_text[idx]._textType == 6) { int v27 = v53 / 2; if (v27 < 0) v27 = -v27; - Txt[idx].xp = 315 - v27; + _text[idx]._pos.x = 315 - v27; int v28 = _vm->_eventsManager._startPos.x + 315 - v27; v73 = _vm->_eventsManager._startPos.x + 315 - v27; - Txt[idx].yp = 50; + _text[idx]._pos.y = 50; v70 = 50; v55 = 50; v56 = v28; } - int v29 = Txt[idx].field3FC; - if (v29 == 1 || v29 == 3 || (uint16)(v29 - 5) <= 1u) { + int textType = _text[idx]._textType; + if (textType == 1 || textType == 3 || textType == 5 || textType == 6) { int v49 = v51 * v53; byte *ptrd = _vm->_globals.dos_malloc2(v49); if (ptrd == g_PTRNUL) { @@ -401,13 +411,13 @@ LABEL_57: _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); } - Txt[idx].lineCount = lineCount; + _text[idx]._lineCount = lineCount; int v75 = v73 + 5; int v71 = v70 + 5; if (lineCount > 0) { for (int lineNum = 0; lineNum < lineCount; ++lineNum) { - TEXT_NOW1(v75, v71, Txt[idx].lines[lineNum], Txt[idx].colour); + displayText(v75, v71, _text[idx]._lines[lineNum], _text[idx]._color); v71 += _vm->_globals.police_h + 1; } } @@ -415,27 +425,29 @@ LABEL_57: int blockWidth = v53 + 1; int blockHeight = v51 + 1; - Txt[idx].width = blockWidth; - Txt[idx].height = blockHeight; - int v32 = Txt[idx].field3FC; - if (v32 == 6 || v32 == 1 || v32 == 3 || v32 == 5) { - if (Txt[idx].textBlock != g_PTRNUL) - Txt[idx].textBlock = _vm->_globals.dos_free2(Txt[idx].textBlock); + _text[idx]._width = blockWidth; + _text[idx]._height = blockHeight; + textType = _text[idx]._textType; + if (textType == 6 || textType == 1 || textType == 3 || textType == 5) { + if (_text[idx]._textBlock != g_PTRNUL) + _text[idx]._textBlock = _vm->_globals.dos_free2(_text[idx]._textBlock); int blockSize = blockHeight * blockWidth; ptre = _vm->_globals.dos_malloc2(blockSize + 20); if (ptre == g_PTRNUL) error("Cutting a block for text box (%d)", blockSize); - Txt[idx].textBlock = ptre; - Txt[idx].width = blockWidth; - Txt[idx].height = blockHeight; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, Txt[idx].textBlock, v56, v55, Txt[idx].width, blockHeight); + _text[idx]._textBlock = ptre; + _text[idx]._width = blockWidth; + _text[idx]._height = blockHeight; + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _text[idx]._textBlock, v56, v55, _text[idx]._width, blockHeight); } - texte_tmp = _vm->_globals.dos_free2(texte_tmp); + _tempText = _vm->_globals.dos_free2(_tempText); } } - -void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int col) { +/** + * Directly display text + */ +void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, int col) { const char *srcP; char currChar; int charIndex; @@ -458,7 +470,7 @@ void FontManager::TEXT_NOW(int xp, int yp, const Common::String &message, int co } -void FontManager::TEXT_NOW1(int xp, int yp, const Common::String &message, int col) { +void FontManager::displayText(int xp, int yp, const Common::String &message, int col) { for (uint idx = 0; idx < message.size(); ++idx) { char currentChar = message[idx]; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 08b32377a7..dbe6a2dc67 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -24,66 +24,66 @@ #define HOPKINS_FONT_H #include "common/scummsys.h" +#include "common/events.h" #include "common/str.h" namespace Hopkins { +#define MAX_TEXT 11 + class HopkinsEngine; struct TxtItem { - bool textOn; - int field2; - Common::String filename; - int16 xp; - int16 yp; - int messageId; - int fieldE; - int field10; - int lineCount; - Common::String lines[10]; - int field3FC; - int field3FE; - byte *textBlock; - int16 width; - int16 height; - bool textLoaded; - int colour; + bool _textOnFl; +// int _field2; // Unused variable + Common::String _filename; + Common::Point _pos; + int _messageId; + int _fieldE; // Useless variable + int _field10; // Useless variable + int _lineCount; + Common::String _lines[10]; + int _textType; + int _field3FE; + byte *_textBlock; + int16 _width; + int16 _height; + bool _textLoadedFl; + int _color; }; -struct ListeTxtItem { - bool enabled; - int16 xp; - int16 yp; - int16 width; - int16 height; +struct TxtItemList { + bool _enabledFl; + Common::Point _pos; + int16 _width; + int16 _height; }; - class FontManager { private: HopkinsEngine *_vm; public: - TxtItem Txt[12]; - ListeTxtItem ListeTxt[12]; - int TRIER_TEXT[21]; - Common::String oldname; - Common::String nom_index; - int Index[4048]; - byte *texte_tmp; + TxtItem _text[12]; + TxtItemList _textList[12]; + int _textSortArray[21]; + Common::String _oldName; + Common::String _indexName; + int _index[4048]; + byte *_tempText; public: FontManager(); void setParent(HopkinsEngine *vm); void clearAll(); - void TEXTE_ON(int idx); - void TEXTE_OFF(int idx); - void COUL_TXT(int idx, byte colByte); - void OPTI_COUL_TXT(int idx1, int idx2, int idx3, int idx4); - void DOS_TEXT(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int a8, int a9, int a10); - void BOITE(int idx, int messageId, const Common::String &filename, int xp, int yp); + void showText(int idx); + void hideText(int idx); + void setTextColor(int idx, byte colByte); + void setOptimalColor(int idx1, int idx2, int idx3, int idx4); + void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int textType, int a9, int a10); + void box(int idx, int messageId, const Common::String &filename, int xp, int yp); - void TEXT_NOW(int xp, int yp, const Common::String &message, int col); - void TEXT_NOW1(int xp, int yp, const Common::String &message, int col); + void displayTextVesa(int xp, int yp, const Common::String &message, int col); + void displayText(int xp, int yp, const Common::String &message, int col); void TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col); }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ff2a0735a0..54f2c55ae2 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -3697,7 +3697,7 @@ void HopkinsEngine::Credits() { } void HopkinsEngine::BTOCEAN() { - _fontManager.TEXTE_OFF(9); + _fontManager.hideText(9); if (_eventsManager._mouseCursorId == 16) { _eventsManager.getMouseX(); if (_objectsManager.NUMZONE > 0) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 44123cb84f..a050663090 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -316,8 +316,6 @@ void ObjectsManager::AFF_SPRITES() { int v11; uint16 *v12; int v13; - int v20; - int v21; int y1_1; int y1_2; int v25; @@ -333,13 +331,13 @@ void ObjectsManager::AFF_SPRITES() { // Handle copying any background areas that text are going to be drawn on _vm->_globals.NBTRI = 0; for (int idx = 0; idx <= 10; ++idx) { - if (_vm->_fontManager.ListeTxt[idx].enabled && _vm->_fontManager.Txt[idx].field3FC != 2) { - v1 = _vm->_fontManager.ListeTxt[idx].xp; + if (_vm->_fontManager._textList[idx]._enabledFl && _vm->_fontManager._text[idx]._textType != 2) { + v1 = _vm->_fontManager._textList[idx]._pos.x; x1_1 = v1 - 2; if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) x1_1 = _vm->_graphicsManager.min_x; - v2 = _vm->_fontManager.ListeTxt[idx].yp; + v2 = _vm->_fontManager._textList[idx]._pos.y; y1_1 = v2 - 2; if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) @@ -352,10 +350,10 @@ void ObjectsManager::AFF_SPRITES() { destY = _vm->_graphicsManager.min_y; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_1, y1_1, - _vm->_fontManager.ListeTxt[idx].width + 4, _vm->_fontManager.ListeTxt[idx].height + 4, + _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, _vm->_graphicsManager.VESA_BUFFER, destX, destY); - _vm->_fontManager.ListeTxt[idx].enabled = false; + _vm->_fontManager._textList[idx]._enabledFl = false; } } @@ -521,42 +519,39 @@ void ObjectsManager::AFF_SPRITES() { // Loop to draw any on-screen text for (int idx = 0; idx <= 10; ++idx) { - if (_vm->_fontManager.Txt[idx].textOn) { - if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) - _vm->_fontManager.BOITE(idx, - _vm->_fontManager.Txt[idx].messageId, _vm->_fontManager.Txt[idx].filename, - _vm->_eventsManager._startPos.x + _vm->_fontManager.Txt[idx].xp, _vm->_fontManager.Txt[idx].yp); + if (_vm->_fontManager._text[idx]._textOnFl) { + if (_vm->_fontManager._text[idx]._textType > 3) + _vm->_fontManager.box(idx, + _vm->_fontManager._text[idx]._messageId, _vm->_fontManager._text[idx]._filename, + _vm->_eventsManager._startPos.x + _vm->_fontManager._text[idx]._pos.x, _vm->_fontManager._text[idx]._pos.y); else - _vm->_fontManager.BOITE( - idx, - _vm->_fontManager.Txt[idx].messageId, - _vm->_fontManager.Txt[idx].filename, - _vm->_fontManager.Txt[idx].xp, - _vm->_fontManager.Txt[idx].yp); - _vm->_fontManager.ListeTxt[idx].enabled = true; + _vm->_fontManager.box(idx, + _vm->_fontManager._text[idx]._messageId, _vm->_fontManager._text[idx]._filename, + _vm->_fontManager._text[idx]._pos.x, _vm->_fontManager._text[idx]._pos.y); + _vm->_fontManager._textList[idx]._enabledFl = true; - if ((uint16)(_vm->_fontManager.Txt[idx].field3FC - 2) > 1) - _vm->_fontManager.ListeTxt[idx].xp = _vm->_eventsManager._startPos.x + _vm->_fontManager.Txt[idx].xp; + if (_vm->_fontManager._text[idx]._textType > 3) + _vm->_fontManager._textList[idx]._pos.x = _vm->_eventsManager._startPos.x + _vm->_fontManager._text[idx]._pos.x; else - _vm->_fontManager.ListeTxt[idx].xp = _vm->_fontManager.Txt[idx].xp; + _vm->_fontManager._textList[idx]._pos.x = _vm->_fontManager._text[idx]._pos.x; - _vm->_fontManager.ListeTxt[idx].yp = _vm->_fontManager.Txt[idx].yp; - _vm->_fontManager.ListeTxt[idx].width = _vm->_fontManager.Txt[idx].width; - _vm->_fontManager.ListeTxt[idx].height = _vm->_fontManager.Txt[idx].height; - - if (_vm->_fontManager.ListeTxt[idx].xp < _vm->_graphicsManager.min_x) - _vm->_fontManager.ListeTxt[idx].xp = _vm->_graphicsManager.min_x - 1; - if (_vm->_fontManager.ListeTxt[idx].yp < _vm->_graphicsManager.min_y) - _vm->_fontManager.ListeTxt[idx].yp = _vm->_graphicsManager.min_y - 1; - - v20 = _vm->_fontManager.ListeTxt[idx].xp; - if (_vm->_fontManager.ListeTxt[idx].width + v20 > _vm->_graphicsManager.max_x) - _vm->_fontManager.ListeTxt[idx].width = _vm->_graphicsManager.max_x - v20; - v21 = _vm->_fontManager.ListeTxt[idx].yp; - if (_vm->_fontManager.ListeTxt[idx].height + v21 > _vm->_graphicsManager.max_y) - _vm->_fontManager.ListeTxt[idx].height = _vm->_graphicsManager.max_y - v21; - if (_vm->_fontManager.ListeTxt[idx].width <= 0 || _vm->_fontManager.ListeTxt[idx].height <= 0) - _vm->_fontManager.ListeTxt[idx].enabled = false; + _vm->_fontManager._textList[idx]._pos.y = _vm->_fontManager._text[idx]._pos.y; + _vm->_fontManager._textList[idx]._width = _vm->_fontManager._text[idx]._width; + _vm->_fontManager._textList[idx]._height = _vm->_fontManager._text[idx]._height; + + if (_vm->_fontManager._textList[idx]._pos.x < _vm->_graphicsManager.min_x) + _vm->_fontManager._textList[idx]._pos.x = _vm->_graphicsManager.min_x - 1; + if (_vm->_fontManager._textList[idx]._pos.y < _vm->_graphicsManager.min_y) + _vm->_fontManager._textList[idx]._pos.y = _vm->_graphicsManager.min_y - 1; + + int posX = _vm->_fontManager._textList[idx]._pos.x; + if (_vm->_fontManager._textList[idx]._width + posX > _vm->_graphicsManager.max_x) + _vm->_fontManager._textList[idx]._width = _vm->_graphicsManager.max_x - posX; + int posY = _vm->_fontManager._textList[idx]._pos.y; + if (_vm->_fontManager._textList[idx]._height + posY > _vm->_graphicsManager.max_y) + _vm->_fontManager._textList[idx]._height = _vm->_graphicsManager.max_y - posY; + if (_vm->_fontManager._textList[idx]._width <= 0 || _vm->_fontManager._textList[idx]._height <= 0) + _vm->_fontManager._textList[idx]._enabledFl = false; } } @@ -1665,7 +1660,7 @@ void ObjectsManager::VERIFZONE() { _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); if (_vm->_globals.zozo_73 == 1) { - _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.hideText(5); _vm->_globals.zozo_73 = 0; return; } @@ -1686,8 +1681,8 @@ LABEL_54: || _vm->_globals.ZONEP[v4].fieldE || _vm->_globals.ZONEP[v4].fieldF)) { if (_vm->_globals.old_zone_68 != v4) { - _vm->_fontManager.DOS_TEXT(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 20, 25, 0, 0, 252); - _vm->_fontManager.TEXTE_ON(5); + _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 20, 25, 0, 0, 252); + _vm->_fontManager.showText(5); _vm->_globals.zozo_73 = 1; } _vm->_globals.force_to_data_0 += 25; @@ -2688,7 +2683,7 @@ void ObjectsManager::BTGAUCHE() { int v17; int v18; - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); destX = _vm->_eventsManager.getMouseX(); destY = _vm->_eventsManager.getMouseY(); @@ -2841,7 +2836,7 @@ LABEL_65: _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; _vm->_globals.GOACTION = 1; } - _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); ARRET_PERSO_FLAG = 0; if (_vm->_eventsManager._mouseCursorId == 21 && _vm->_globals.BOBZONE[NUMZONE]) { @@ -2869,7 +2864,7 @@ void ObjectsManager::PARADISE() { ARRET_PERSO_NUM = 0; result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { - _vm->_fontManager.TEXTE_OFF(5); + _vm->_fontManager.hideText(5); if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { _vm->_graphicsManager.no_scroll = 2; @@ -2975,8 +2970,8 @@ void ObjectsManager::CLEAR_ECRAN() { CLEAR_SPR(); _vm->_graphicsManager.FIN_VISU(); - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(9); _vm->_globals.CLEAR_VBOB(); _vm->_animationManager.clearAnim(); _vm->_linesManager.CLEAR_ZONE(); @@ -4920,11 +4915,11 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { ++v5; } while (v5 <= 4); VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.DOS_TEXT(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); + _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); + _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(383, 4); @@ -4938,7 +4933,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { ++v6; } while (v6 <= 199); } - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); VBOB_OFF(5); v7 = 0; do { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 6f3a06ab6b..84ae0443cd 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -134,37 +134,37 @@ int ScriptManager::Traduction(byte *a1) { } while (_vm->_soundManager.SOUND_FLAG); } if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.DOS_TEXT(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); + _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(v3, 4); } if (TRAVAILOBJET == 1) { if (_vm->_globals.SAUVEGARDE->data[svField356]) { - _vm->_fontManager.DOS_TEXT(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); + _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); + _vm->_fontManager.showText(9); if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(635, 4); goto LABEL_104; } if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.DOS_TEXT(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.DOS_TEXT(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - if (_vm->_globals.FR == 2) { + _vm->_fontManager.initTextBuffers(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + else if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) + _vm->_fontManager.initTextBuffers(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + else if (_vm->_globals.FR == 2) { if (_vm->_soundManager.TEXTOFF) { LABEL_98: if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(v3, 5); goto LABEL_104; } - _vm->_fontManager.DOS_TEXT(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); } if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_ON(9); + _vm->_fontManager.showText(9); goto LABEL_98; } } @@ -543,7 +543,7 @@ LABEL_1141: _vm->_objectsManager.OPTI_ONE(20, 0, 14, 4); } if (v76 == 12) { - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); @@ -695,8 +695,8 @@ LABEL_1141: _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(9); _vm->_graphicsManager.FIN_VISU(); _vm->_objectsManager.CLEAR_ECRAN(); @@ -1927,10 +1927,10 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(1) != 32); _vm->_objectsManager.BOBANIM_OFF(1); _vm->_objectsManager.BOBANIM_ON(2); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.DOS_TEXT(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); - _vm->_fontManager.TEXTE_ON(9); + _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); + _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICEOFF) _vm->_soundManager.VOICE_MIX(617, 4); @@ -1993,8 +1993,8 @@ LABEL_1141: _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); _vm->_objectsManager.SPRITE_OFF(0); - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(9); _vm->_graphicsManager.FIN_VISU(); _vm->_graphicsManager.LOAD_IMAGE("IM20f"); _vm->_animationManager.loadAnim("ANIM20f"); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index a13f757d77..31ebb3cc3a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -65,8 +65,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { Common::String v16; v15 = 0; - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 1; bool oldDisableInventFl = _vm->_globals._disableInventFl; @@ -320,14 +320,14 @@ int TalkManager::DIALOGUE() { v21 = v20 - 20 * v3; v18 = v20 - 20 * v3 - 1; v4 = v20 - 20 * v3 - 20 * v2; - _vm->_fontManager.DOS_TEXT(5, PLIGNE1, FQUEST, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); - _vm->_fontManager.DOS_TEXT(6, PLIGNE2, FQUEST, 5, v4, 0, 0, 0, 65, 255); - _vm->_fontManager.DOS_TEXT(7, PLIGNE3, FQUEST, 5, v21, 0, 0, 0, 65, 255); - _vm->_fontManager.DOS_TEXT(8, PLIGNE4, FQUEST, 5, v20, 0, 0, 0, 65, 255); - _vm->_fontManager.TEXTE_ON(5); - _vm->_fontManager.TEXTE_ON(6); - _vm->_fontManager.TEXTE_ON(7); - _vm->_fontManager.TEXTE_ON(8); + _vm->_fontManager.initTextBuffers(5, PLIGNE1, FQUEST, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(6, PLIGNE2, FQUEST, 5, v4, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(7, PLIGNE3, FQUEST, 5, v21, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(8, PLIGNE4, FQUEST, 5, v20, 0, 0, 0, 65, 255); + _vm->_fontManager.showText(5); + _vm->_fontManager.showText(6); + _vm->_fontManager.showText(7); + _vm->_fontManager.showText(8); v5 = -1; v6 = 0; @@ -335,24 +335,24 @@ int TalkManager::DIALOGUE() { v7 = _vm->_eventsManager.getMouseY(); if ((v4 - 20 * v19) < v7 && (v4 - 1) > v7) { v8 = v7; - _vm->_fontManager.OPTI_COUL_TXT(6, 7, 8, 5); + _vm->_fontManager.setOptimalColor(6, 7, 8, 5); v5 = PLIGNE1; v7 = v8; } if (v7 > v4 && v18 > v7) { v9 = v7; - _vm->_fontManager.OPTI_COUL_TXT(5, 7, 8, 6); + _vm->_fontManager.setOptimalColor(5, 7, 8, 6); v5 = PLIGNE2; v7 = v9; } if (v21 < v7 && (v20 - 1) > v7) { v10 = v7; - _vm->_fontManager.OPTI_COUL_TXT(5, 6, 8, 7); + _vm->_fontManager.setOptimalColor(5, 6, 8, 7); v5 = PLIGNE3; v7 = v10; } if (v20 < v7 && v7 < 419) { - _vm->_fontManager.OPTI_COUL_TXT(5, 6, 7, 8); + _vm->_fontManager.setOptimalColor(5, 6, 7, 8); v5 = PLIGNE4; } @@ -364,10 +364,10 @@ int TalkManager::DIALOGUE() { } while (!_vm->shouldQuit() && v6 != 1); _vm->_soundManager.VOICE_MIX(v5, 1); - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(6); - _vm->_fontManager.TEXTE_OFF(7); - _vm->_fontManager.TEXTE_OFF(8); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(6); + _vm->_fontManager.hideText(7); + _vm->_fontManager.hideText(8); if (STATI) { v11 = BUFFERPERSO; @@ -472,8 +472,8 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.DOS_TEXT(9, v22, FREPON, v25, v24, 20, 25, 5, v23, 252); - _vm->_fontManager.TEXTE_ON(9); + _vm->_fontManager.initTextBuffers(9, v22, FREPON, v25, v24, 20, 25, 5, v23, 252); + _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICE_MIX(v22, 1)) { v14 = 0; @@ -505,7 +505,7 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(9); if (STATI) { v15 = BUFFERPERSO; v16 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); @@ -1205,8 +1205,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { Common::String v22; Common::String v23; - _vm->_fontManager.TEXTE_OFF(5); - _vm->_fontManager.TEXTE_OFF(9); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 1; _vm->_linesManager.CLEAR_ZONE(); -- cgit v1.2.3 From eece86d78e6821638772da0a5198e690c0f08745 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 12 Dec 2012 08:05:04 +0100 Subject: HOPKINS: Homogenization of memory management --- engines/hopkins/anim.cpp | 79 +++++++++++++++++++++----------------------- engines/hopkins/computer.cpp | 30 ++++++++--------- engines/hopkins/dialogs.cpp | 27 ++++++++------- engines/hopkins/events.cpp | 4 +-- engines/hopkins/files.cpp | 8 ++--- engines/hopkins/font.cpp | 33 ++++++++---------- engines/hopkins/globals.cpp | 64 +++++++++++++++-------------------- engines/hopkins/globals.h | 5 ++- engines/hopkins/graphics.cpp | 20 +++++------ engines/hopkins/hopkins.cpp | 22 ++++++------ engines/hopkins/lines.cpp | 19 ++++------- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 69 ++++++++++++++------------------------ engines/hopkins/talk.cpp | 27 +++++++-------- 14 files changed, 176 insertions(+), 233 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 1558069e6b..80e1bdb19b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -61,7 +61,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui hasScreenCopy = false; screenP = _vm->_graphicsManager.VESA_SCREEN; - ptr = _vm->_globals.dos_malloc2(0x14u); + ptr = _vm->_globals.allocMemory(0x14u); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) @@ -81,7 +81,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { hasScreenCopy = true; - screenCopy = _vm->_globals.dos_malloc2(0x4B000u); + screenCopy = _vm->_globals.allocMemory(0x4B000u); memcpy(screenCopy, screenP, 0x4B000u); } if (NO_SEQ) { @@ -184,7 +184,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_soundManager.VERIF_SOUND(); EXIT: if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { - screenCopy = _vm->_globals.dos_malloc2(0x4B000u); + screenCopy = _vm->_globals.allocMemory(0x4B000u); f.seek(0); f.skip(6); @@ -212,17 +212,17 @@ EXIT: } } while (breakFlag); _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); - screenCopy = _vm->_globals.dos_free2(screenCopy); + screenCopy = _vm->_globals.freeMemory(screenCopy); } if (hasScreenCopy) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); - _vm->_globals.dos_free2(screenCopy); + screenCopy = _vm->_globals.freeMemory(screenCopy); } _vm->_graphicsManager.FADE_LINUX = 0; f.close(); - _vm->_globals.dos_free2(ptr); + ptr = _vm->_globals.freeMemory(ptr); _vm->_graphicsManager.NOLOCK = false; } @@ -258,7 +258,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager.VESA_SCREEN; - v13 = _vm->_globals.dos_malloc2(0x14u); + v13 = _vm->_globals.allocMemory(0x14u); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) @@ -287,7 +287,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.max_x = SCREEN_WIDTH; if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { v8 = 1; - ptr = _vm->_globals.dos_malloc2(0x4B000u); + ptr = _vm->_globals.allocMemory(0x4B000u); memcpy(ptr, v12, 0x4B000u); } if (_vm->_animationManager.NO_SEQ) { @@ -329,8 +329,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_114; if (v8 == 1) - ptr = _vm->_globals.dos_free2(ptr); - _vm->_globals.dos_free2(v13); + ptr = _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory(v13); f.close(); _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); @@ -432,8 +432,8 @@ LABEL_88: if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_114; if (v8 == 1) - ptr = _vm->_globals.dos_free2(ptr); - _vm->_globals.dos_free2(v13); + ptr = _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory(v13); f.close(); _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); @@ -495,8 +495,8 @@ LABEL_88: if (_vm->_graphicsManager.NOLOCK == true) break; if (v8 == 1) - ptr = _vm->_globals.dos_free2(ptr); - _vm->_globals.dos_free2(v13); + ptr = _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory(v13); f.close(); _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); @@ -555,7 +555,7 @@ LABEL_114: if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { byte *ptra; - ptra = _vm->_globals.dos_malloc2(0x4B000u); + ptra = _vm->_globals.allocMemory(0x4B000u); f.seek(0); f.read(&buf, 6); @@ -589,15 +589,15 @@ LABEL_114: } } while (v6 != -1); _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); - ptr = _vm->_globals.dos_free2(ptra); + ptra = _vm->_globals.freeMemory(ptra); } if (v8 == 1) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); } _vm->_graphicsManager.FADE_LINUX = 0; - _vm->_globals.dos_free2(v13); + _vm->_globals.freeMemory(v13); _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); @@ -702,7 +702,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { } } - byte *data = _vm->_globals.dos_malloc2(nbytes + 1); + byte *data = _vm->_globals.allocMemory(nbytes + 1); f.read(data, nbytes); f.close(); @@ -710,7 +710,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { searchAnim(data, idx, nbytes); } - _vm->_globals.dos_free2(data); + _vm->_globals.freeMemory(data); } /** @@ -718,14 +718,12 @@ void AnimationManager::loadAnim(const Common::String &animName) { */ void AnimationManager::clearAnim() { for (int idx = 0; idx < 35; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].data != g_PTRNUL) - _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); + _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx].data); _vm->_globals.Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - if (_vm->_globals.Bank[idx].data != g_PTRNUL) - _vm->_globals.Bank[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bank[idx].data); + _vm->_globals.Bank[idx].data = _vm->_globals.freeMemory(_vm->_globals.Bank[idx].data); _vm->_globals.Bank[idx].field4 = 0; _vm->_globals.Bank[idx].filename1 = ""; _vm->_globals.Bank[idx].fileHeader = 0; @@ -809,17 +807,17 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { } } - _vm->_globals.dos_free2(v19); + _vm->_globals.freeMemory(v19); } result = 0; } else { - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); _vm->_globals.Bank[idx].field4 = 0; result = -2; } } else { - _vm->_globals.dos_free2(v3); + _vm->_globals.freeMemory(v3); _vm->_globals.Bank[idx].field4 = 0; result = -1; } @@ -877,7 +875,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { ++v7; ++v5; } while (v8 != 1); - _vm->_globals.Bqe_Anim[v19].data = _vm->_globals.dos_malloc2(v7 + 50); + _vm->_globals.Bqe_Anim[v19].data = _vm->_globals.allocMemory(v7 + 50); _vm->_globals.Bqe_Anim[animIndex].field4 = 1; memcpy(_vm->_globals.Bqe_Anim[v19].data, v21 + data + 5, 0x14u); @@ -953,7 +951,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager.VESA_SCREEN; - v10 = _vm->_globals.dos_malloc2(0x16u); + v10 = _vm->_globals.allocMemory(0x16u); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -967,7 +965,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { v7 = 1; - ptr = _vm->_globals.dos_malloc2(0x4B000u); + ptr = _vm->_globals.allocMemory(0x4B000u); memcpy(ptr, v9, 0x4B000u); } if (_vm->_animationManager.NO_SEQ) { @@ -1100,8 +1098,8 @@ LABEL_59: _vm->_eventsManager._mouseFl = true; } if (v7 == 1) - _vm->_globals.dos_free2(ptr); - _vm->_globals.dos_free2(v10); + _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory(v10); } /** @@ -1124,7 +1122,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._mouseFl = false; v10 = _vm->_graphicsManager.VESA_SCREEN; - v11 = _vm->_globals.dos_malloc2(0x16u); + v11 = _vm->_globals.allocMemory(0x16u); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) @@ -1144,7 +1142,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { v7 = 1; - ptr = _vm->_globals.dos_malloc2(0x4B000u); + ptr = _vm->_globals.allocMemory(0x4B000u); memcpy((void *)ptr, v10, 0x4B000u); } if (_vm->_animationManager.NO_SEQ) { @@ -1190,8 +1188,8 @@ LABEL_48: if (_vm->_graphicsManager.NOLOCK == true) goto LABEL_54; if (v7 == 1) - ptr = _vm->_globals.dos_free2(ptr); - _vm->_globals.dos_free2(v11); + ptr = _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory(v11); f.close(); } LABEL_23: @@ -1259,8 +1257,7 @@ LABEL_53: } LABEL_54: if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) { - byte *ptra; - ptra = _vm->_globals.dos_malloc2(0x4B000u); + byte *ptra = _vm->_globals.allocMemory(0x4B000u); f.seek(0); f.skip(6); @@ -1293,17 +1290,17 @@ LABEL_54: } } while (!v5); _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); - ptr = _vm->_globals.dos_free2(ptra); + ptra = _vm->_globals.freeMemory(ptra); } if (v7 == 1) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); } _vm->_graphicsManager.FADE_LINUX = 0; f.close(); - _vm->_globals.dos_free2(v11); + _vm->_globals.freeMemory(v11); _vm->_eventsManager._mouseFl = true; } diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 6dc7f1e6ac..e2c1ada8ef 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -78,7 +78,7 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "STFONT.SPR"); - _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); + _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; @@ -348,7 +348,7 @@ void ComputerManager::loadMenu() { LABEL_13: tmpPtr = tmpPtr + 1; } while (!loopCond); - _vm->_globals.dos_free2(ptr); + ptr = _vm->_globals.freeMemory(ptr); } void ComputerManager::TXT4(int xp, int yp, int textIdx) { @@ -497,7 +497,7 @@ void ComputerManager::outText2(const Common::String &msg) { * Restores the scene for the FBI headquarters room */ void ComputerManager::restoreFBIRoom() { - _vm->_globals.police = _vm->_globals.dos_free2(_vm->_globals.police); + _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FONTE3.SPR"); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -582,7 +582,7 @@ void ComputerManager::readText(int idx) { } while (v4 != 37); _vm->_eventsManager.waitKeyPress(); - _vm->_globals.dos_free2(ptr); + ptr = _vm->_globals.freeMemory(ptr); } /** @@ -618,9 +618,8 @@ void ComputerManager::displayGamesSubMenu() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); playBreakout(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - _breakoutSpr = _vm->_globals.LIBERE_FICHIER(_breakoutSpr); - _vm->_globals.dos_free2((byte *)_breakoutLevel); - _breakoutLevel = (int16 *)g_PTRNUL; + _breakoutSpr = _vm->_globals.freeMemory(_breakoutSpr); + _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); _vm->_objectsManager.Sprite[0].spriteData = v1; _vm->_soundManager.DEL_SAMPLE(1); @@ -644,7 +643,7 @@ void ComputerManager::loadHiscore() { byte *ptr; _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); - ptr = _vm->_globals.dos_malloc2(100); + ptr = _vm->_globals.allocMemory(100); _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { @@ -663,7 +662,7 @@ void ComputerManager::loadHiscore() { } } - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); _breakoutHiscore = atol(_score[5]._score.c_str()); } @@ -692,10 +691,7 @@ void ComputerManager::newLevel() { _breakoutLives = 11; _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); displayLives(); - if (_breakoutLevel != (int16 *)g_PTRNUL) { - _vm->_globals.dos_free2((byte *)_breakoutLevel); - _breakoutLevel = (int16 *)g_PTRNUL; - } + _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); ++_breakoutLevelNbr; while (!_vm->shouldQuit()) { @@ -929,7 +925,7 @@ int ComputerManager::displayHiscores() { _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.FADE_OUT_CASSE(); - _vm->_globals.LIBERE_FICHIER(ptr); + _vm->_globals.freeMemory(ptr); return buttonIndex; } @@ -978,7 +974,7 @@ void ComputerManager::getScoreName() { break; } _vm->_graphicsManager.FADE_OUT_CASSE(); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); saveScore(); } @@ -1081,7 +1077,7 @@ void ComputerManager::saveScore() { } while (!v3); } - ptr = _vm->_globals.dos_malloc2(0x64u); + ptr = _vm->_globals.allocMemory(0x64u); memset(ptr, 0, 0x63u); for (int v5 = 0; v5 <= 5; v5++) { v6 = 16 * v5; @@ -1107,7 +1103,7 @@ void ComputerManager::saveScore() { _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); } /** diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0c72005894..4072126508 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -46,7 +46,7 @@ DialogsManager::DialogsManager() { } DialogsManager::~DialogsManager() { - _vm->_globals.dos_free2(_inventWin1); + _vm->_globals.freeMemory(_inventWin1); } void DialogsManager::setParent(HopkinsEngine *vm) { @@ -297,7 +297,7 @@ void DialogsManager::showOptionsDialog() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, _vm->_graphicsManager.ofscroll + 498, 320); - _vm->_globals.OPTION_SPR = _vm->_globals.dos_free2(_vm->_globals.OPTION_SPR); + _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR); _vm->_globals._optionDialogFl = false; } @@ -337,7 +337,7 @@ LABEL_7: error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); size_t filesize = f.size(); - _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_malloc2(filesize); + _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); f.close(); @@ -362,7 +362,7 @@ LABEL_7: byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); - _vm->_globals.dos_free2(v7); + _vm->_globals.freeMemory(v7); } v16 += 54; }; @@ -423,9 +423,8 @@ LABEL_7: v20 = true; _vm->_globals.SORTIE = 0; if (!v20) { - _inventBuf2 = _vm->_globals.dos_free2(_inventBuf2); - if (g_PTRNUL != _vm->_dialogsManager._inventWin1) - _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_free2(_vm->_dialogsManager._inventWin1); + _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); + _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); goto LABEL_7; } } else if (!v20) { @@ -449,9 +448,9 @@ LABEL_7: _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; } - if (_vm->_dialogsManager._inventWin1 != g_PTRNUL) - _vm->_dialogsManager._inventWin1 = _vm->_globals.dos_free2(_vm->_dialogsManager._inventWin1); - _inventBuf2 = _vm->_globals.dos_free2(_inventBuf2); + + _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); if (_vm->_eventsManager._mouseCursorId == 1) showOptionsDialog(); @@ -577,8 +576,8 @@ void DialogsManager::showLoadGame() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); _vm->_objectsManager.BOBTOUS = true; - _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); - _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR2); _vm->_objectsManager.SL_X = 0; _vm->_objectsManager.SL_Y = 0; @@ -610,8 +609,8 @@ void DialogsManager::showSaveGame() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); _vm->_objectsManager.BOBTOUS = true; - _vm->_objectsManager.SL_SPR = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR); - _vm->_objectsManager.SL_SPR2 = _vm->_globals.dos_free2(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); + _vm->_objectsManager.SL_SPR2 = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR2); _vm->_objectsManager.SL_X = 0; _vm->_objectsManager.SL_Y = 0; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 5f9ee21464..8f077d5463 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -56,8 +56,8 @@ EventsManager::EventsManager() { } EventsManager::~EventsManager() { - _vm->_globals.dos_free2(_objectBuf); - _vm->_globals.dos_free2(_mouseCursor); + _vm->_globals.freeMemory(_objectBuf); + _vm->_globals.freeMemory(_mouseCursor); } void EventsManager::setParent(HopkinsEngine *vm) { diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index f251d51388..998ab57fc5 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -64,7 +64,7 @@ byte *FileManager::loadFile(const Common::String &file) { // Allocate space for the file contents size_t filesize = f.size(); - byte *data = _vm->_globals.dos_malloc2(filesize); + byte *data = _vm->_globals.allocMemory(filesize); if (!data) error("Error allocating space for file being loaded - %s", file.c_str()); @@ -273,14 +273,14 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { } if (name == "FINIS") { - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); return g_PTRNUL; } offsetVal += 23; } - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); // TODO: Double check whether this really should be an unsigned int comparison if ((uint16)(a2 - 6) > 1 && (uint16)(a2 - 8) > 1) { @@ -289,7 +289,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { f.seek(_vm->_globals.CAT_POSI); - byte *catData = _vm->_globals.dos_malloc2(_vm->_globals.CAT_TAILLE); + byte *catData = _vm->_globals.allocMemory(_vm->_globals.CAT_TAILLE); if (catData == g_PTRNUL) error("CHARGE_FICHIER"); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 7b5cfded30..400ab48cfe 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -74,10 +74,7 @@ void FontManager::showText(int idx) { txt._textOnFl = true; txt._textLoadedFl = false; - if (txt._textBlock != g_PTRNUL) { - _vm->_globals.dos_free2(txt._textBlock); - txt._textBlock = g_PTRNUL; - } + txt._textBlock = _vm->_globals.freeMemory(txt._textBlock); } /** @@ -90,11 +87,7 @@ void FontManager::hideText(int idx) { TxtItem &txt = _text[idx - 5]; txt._textOnFl = false; txt._textLoadedFl = false; - - if (txt._textBlock != g_PTRNUL) { - _vm->_globals.dos_free2(txt._textBlock); - txt._textBlock = g_PTRNUL; - } + txt._textBlock = _vm->_globals.freeMemory(txt._textBlock); } /** @@ -202,7 +195,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in v69 = 2048; f.seek(_index[messageId]); - _tempText = _vm->_globals.dos_malloc2(0x80Au); + _tempText = _vm->_globals.allocMemory(0x80Au); if (_tempText == g_PTRNUL) error("Error allocating text"); @@ -213,7 +206,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } else { v69 = 100; _vm->_globals.texte_long = 100; - v9 = _vm->_globals.dos_malloc2(0x6Eu); + v9 = _vm->_globals.allocMemory(0x6Eu); Common::fill(&v9[0], &v9[0x6e], 0); _tempText = v9; @@ -397,14 +390,14 @@ LABEL_57: int textType = _text[idx]._textType; if (textType == 1 || textType == 3 || textType == 5 || textType == 6) { int v49 = v51 * v53; - byte *ptrd = _vm->_globals.dos_malloc2(v49); + byte *ptrd = _vm->_globals.allocMemory(v49); if (ptrd == g_PTRNUL) { error("Cutting a block for text box (%d)", v49); } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager.TABLE_COUL, v49); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); - _vm->_globals.dos_free2(ptrd); + _vm->_globals.freeMemory(ptrd); _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, (byte)-2); _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v51 + v55, v53, (byte)-2); @@ -429,10 +422,9 @@ LABEL_57: _text[idx]._height = blockHeight; textType = _text[idx]._textType; if (textType == 6 || textType == 1 || textType == 3 || textType == 5) { - if (_text[idx]._textBlock != g_PTRNUL) - _text[idx]._textBlock = _vm->_globals.dos_free2(_text[idx]._textBlock); + _text[idx]._textBlock = _vm->_globals.freeMemory(_text[idx]._textBlock); int blockSize = blockHeight * blockWidth; - ptre = _vm->_globals.dos_malloc2(blockSize + 20); + ptre = _vm->_globals.allocMemory(blockSize + 20); if (ptre == g_PTRNUL) error("Cutting a block for text box (%d)", blockSize); @@ -441,11 +433,12 @@ LABEL_57: _text[idx]._height = blockHeight; _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _text[idx]._textBlock, v56, v55, _text[idx]._width, blockHeight); } - _tempText = _vm->_globals.dos_free2(_tempText); + _tempText = _vm->_globals.freeMemory(_tempText); } } + /** - * Directly display text + * Directly display text (using a VESA segment) */ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, int col) { const char *srcP; @@ -469,7 +462,9 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, currentX, yp + 12); } - +/** + * Directly display text + */ void FontManager::displayText(int xp, int yp, const Common::String &message, int col) { for (uint idx = 0; idx < message.size(); ++idx) { char currentChar = message[idx]; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e5a4e85ed4..ed4e998df3 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -261,23 +261,23 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); - dos_free2(TETE); - dos_free2(police); - dos_free2(BUF_ZONE); - dos_free2(CACHE_BANQUE[6]); - dos_free2(texte_tmp); - dos_free2(SPRITE_ECRAN); - dos_free2((byte *)SAUVEGARDE); - dos_free2(BUFFERTAPE); - dos_free2(inventaire2); - dos_free2(GESTE); - dos_free2(INVENTAIRE_OBJET); - dos_free2(FORETSPR); - dos_free2(COUCOU); - dos_free2(cache_souris); - dos_free2(Bufferdecor); - dos_free2(ADR_FICHIER_OBJ); - dos_free2(PERSO); + freeMemory(TETE); + freeMemory(police); + freeMemory(BUF_ZONE); + freeMemory(CACHE_BANQUE[6]); + freeMemory(texte_tmp); + freeMemory(SPRITE_ECRAN); + freeMemory((byte *)SAUVEGARDE); + freeMemory(BUFFERTAPE); + freeMemory(inventaire2); + freeMemory(GESTE); + freeMemory(INVENTAIRE_OBJET); + freeMemory(FORETSPR); + freeMemory(COUCOU); + freeMemory(cache_souris); + freeMemory(Bufferdecor); + freeMemory(ADR_FICHIER_OBJ); + freeMemory(PERSO); CLEAR_VBOB(); @@ -406,7 +406,7 @@ void Globals::clearAll() { texte_long = 0; texte_tmp = g_PTRNUL; - BUFFERTAPE = dos_malloc2(85000); + BUFFERTAPE = allocMemory(85000); SAUVEGARDE = (Sauvegarde *)malloc(sizeof(Sauvegarde)); memset(SAUVEGARDE, 0, sizeof(Sauvegarde)); @@ -418,14 +418,14 @@ void Globals::clearAll() { largeur_boite = 240; TEXTE_FORMATE = 300; - _vm->_eventsManager._objectBuf = dos_malloc2(2500); - INVENTAIRE_OBJET = dos_malloc2(2500); + _vm->_eventsManager._objectBuf = allocMemory(2500); + INVENTAIRE_OBJET = allocMemory(2500); ADR_FICHIER_OBJ = g_PTRNUL; FORETSPR = g_PTRNUL; FORET = false; - cache_souris = dos_malloc2(2500); + cache_souris = allocMemory(2500); GESTE = g_PTRNUL; GESTE_FLAG = false; } @@ -481,9 +481,7 @@ void Globals::CLEAR_VBOB() { VBob[idx].yp = 0; VBob[idx].frameIndex = 0; VBob[idx].fieldC = 0; - if (VBob[idx].surface != g_PTRNUL) - dos_free2(VBob[idx].surface); - VBob[idx].surface = g_PTRNUL; + VBob[idx].surface = freeMemory(VBob[idx].surface); VBob[idx].spriteData = g_PTRNUL; VBob[idx].oldSpriteData = g_PTRNUL; } @@ -509,34 +507,24 @@ void Globals::CHARGE_OBJET() { free(data); } -byte *Globals::dos_malloc2(int count) { +byte *Globals::allocMemory(int count) { byte *result = (byte *)malloc(count); if (!result) result = g_PTRNUL; return result; } -byte *Globals::dos_free2(byte *p) { +byte *Globals::freeMemory(byte *p) { if (p != g_PTRNUL) free(p); return g_PTRNUL; } -// Free File -byte *Globals::LIBERE_FICHIER(byte *p) { - dos_free2(p); - return g_PTRNUL; -} - // Reset Cache void Globals::RESET_CACHE() { - byte *dataP; for (int idx = 1; idx <= 5; ++idx) { - dataP = CACHE_BANQUE[idx]; - if (dataP != g_PTRNUL && dataP) - CACHE_BANQUE[idx] = dos_free2(CACHE_BANQUE[idx]); - CACHE_BANQUE[idx] = g_PTRNUL; + CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); } for (int idx = 0; idx <= 20; ++idx) { @@ -619,7 +607,7 @@ void Globals::CHARGE_CACHE(const Common::String &file) { CACHE_ON(); v2 = ptr; } - dos_free2(v2); + freeMemory(v2); } void Globals::B_CACHE_OFF(int idx) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 1cbd6d8e7b..eebfea5782 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -499,9 +499,8 @@ public: void INIT_VBOB(); void CLEAR_VBOB(); void CHARGE_OBJET(); - byte *dos_malloc2(int count); - byte *dos_free2(byte *p); - byte *LIBERE_FICHIER(byte *p); + byte *allocMemory(int count); + byte *freeMemory(byte *p); void RESET_CACHE(); void CACHE_ON(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0fd0de58dd..32b7b62688 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -80,8 +80,8 @@ GraphicsManager::GraphicsManager() { } GraphicsManager::~GraphicsManager() { - _vm->_globals.dos_free2(VESA_SCREEN); - _vm->_globals.dos_free2(VESA_BUFFER); + _vm->_globals.freeMemory(VESA_SCREEN); + _vm->_globals.freeMemory(VESA_BUFFER); } void GraphicsManager::setParent(HopkinsEngine *vm) { @@ -135,8 +135,8 @@ void GraphicsManager::SET_MODE(int width, int height) { } // Init surfaces - VESA_SCREEN = _vm->_globals.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); - VESA_BUFFER = _vm->_globals.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + VESA_SCREEN = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + VESA_BUFFER = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); VideoPtr = NULL; XSCREEN = width; @@ -410,7 +410,7 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * f.read(surface, 0x80u); v4 = filesize - 896; - ptr = _vm->_globals.dos_malloc2(0xFE00u); + ptr = _vm->_globals.allocMemory(0xFE00u); if (v4 >= 0xFA00) { v15 = v4 / 0xFA00 + 1; v17 = 64000 * (v4 / 0xFA00) - v4; @@ -465,7 +465,7 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * f.read(palette, 0x300u); f.close(); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); } // Clear Palette @@ -2302,8 +2302,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { } if (!mode) { filename = file + ".spr"; - if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) - _vm->_globals.SPRITE_ECRAN = _vm->_globals.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); if (!_vm->_globals.NOSPRECRAN) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { @@ -2340,10 +2339,9 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { doneFlag = true; } while (!doneFlag); } - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); if (mode != 1) { - if (g_PTRNUL != _vm->_globals.COUCOU) - _vm->_globals.COUCOU = _vm->_globals.dos_free2(_vm->_globals.COUCOU); + _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); filename = file + ".rep"; byte *dataP = _vm->_fileManager.searchCat(filename, 2); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 54f2c55ae2..28723edd33 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -193,7 +193,7 @@ bool HopkinsEngine::runWin95Demo() { if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); REST_SYSTEM(); return false; } @@ -499,7 +499,7 @@ bool HopkinsEngine::runLinuxDemo() { if (_globals.SORTIE == -1) { if (!g_system->getEventManager()->shouldQuit()) PUBQUIT(); - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); REST_SYSTEM(); } } @@ -864,7 +864,7 @@ bool HopkinsEngine::runWin95full() { if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU();; if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); REST_SYSTEM(); return false; } @@ -1243,8 +1243,7 @@ bool HopkinsEngine::runWin95full() { _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { - _globals.dos_free2(_globals.FORETSPR); - _globals.FORETSPR = g_PTRNUL; + _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.FORET = false; _soundManager.DEL_SAMPLE(1); } @@ -1678,7 +1677,7 @@ bool HopkinsEngine::runWin95full() { case 197: case 198: case 199: - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; _soundManager.WSOUND_OFF(); warning("TODO: heapshrink();"); @@ -1742,7 +1741,7 @@ bool HopkinsEngine::runLinuxFull() { if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); REST_SYSTEM(); return true; } @@ -2122,8 +2121,7 @@ bool HopkinsEngine::runLinuxFull() { _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { - _globals.dos_free2(_globals.FORETSPR); - _globals.FORETSPR = g_PTRNUL; + _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.FORET = false; _soundManager.DEL_SAMPLE(1); } @@ -2572,7 +2570,7 @@ bool HopkinsEngine::runLinuxFull() { case 197: case 198: case 199: - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; _soundManager.WSOUND(23); _globals.SORTIE = PWBASE(); @@ -3207,7 +3205,7 @@ void HopkinsEngine::BASED() { } void HopkinsEngine::JOUE_FIN() { - _globals.PERSO = _globals.dos_free2(_globals.PERSO); + _globals.PERSO = _globals.freeMemory(_globals.PERSO); _dialogsManager._removeInventFl = true; _globals._disableInventFl = true; _graphicsManager.ofscroll = 0; @@ -3590,7 +3588,7 @@ void HopkinsEngine::Charge_Credits() { while (v5 < _globals.Credit_lignes); } */ - _globals.dos_free2(bufPtr); + _globals.freeMemory(bufPtr); } void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4a3eabe878..85a6e07aad 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -132,10 +132,8 @@ int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { void LinesManager::RETIRE_LIGNE_ZONE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (_vm->_linesManager.LigneZone[idx].zoneData != (int16 *)g_PTRNUL) - _vm->_globals.dos_free2((byte *)_vm->_linesManager.LigneZone[idx].zoneData); - _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; + _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager.LigneZone[idx].zoneData); } // Add Line Zone @@ -146,8 +144,8 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (LigneZone[idx].zoneData != (int16 *)g_PTRNUL) - LigneZone[idx].zoneData = (int16 *)_vm->_globals.dos_free2((byte *)LigneZone[idx].zoneData); + LigneZone[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)LigneZone[idx].zoneData); + int v8 = a2 - a4; if (a2 - a4 < 0) v8 = -v8; @@ -162,7 +160,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in else v20 += v19; - zoneData = (int16 *)_vm->_globals.dos_malloc2(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); + zoneData = (int16 *)_vm->_globals.allocMemory(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); int v11 = idx; LigneZone[v11].zoneData = zoneData; if (zoneData == (int16 *)g_PTRNUL) @@ -214,9 +212,7 @@ void LinesManager::RESET_OBSTACLE() { void LinesManager::RETIRE_LIGNE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (Ligne[idx].lineData != (int16 *)g_PTRNUL) - _vm->_globals.dos_free2((byte *)Ligne[idx].lineData); - Ligne[idx].lineData = (int16 *)g_PTRNUL; + Ligne[idx].lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx].lineData); } // Add Line @@ -249,8 +245,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (TOTAL_LIGNES < idx) TOTAL_LIGNES = idx; - if (Ligne[idx].lineData != (int16 *)g_PTRNUL) - _vm->_globals.dos_free2((byte *)Ligne[idx].lineData); + Ligne[idx].lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx].lineData); v7 = a3 - a5; if (a3 - a5 < 0) v7 = -v7; @@ -263,7 +258,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (v8 > (int)(v9 + 1)) v34 = v8; - v10 = _vm->_globals.dos_malloc2(4 * v34 + 8); + v10 = _vm->_globals.allocMemory(4 * v34 + 8); if (v10 == g_PTRNUL) error("AJOUTE LIGNE OBSTACLE"); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 9e5abf0c3e..7dbd386d90 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -229,7 +229,7 @@ int MenuManager::MENU() { break; } - _vm->_globals.LIBERE_FICHIER(spriteData); + _vm->_globals.freeMemory(spriteData); _vm->_globals._disableInventFl = false; _vm->_globals.FLAG_VISIBLE = false; _vm->_graphicsManager.FADE_OUTW(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a050663090..eb195c213b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -133,7 +133,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { switch (mode) { case 0: - dataP = _vm->_globals.dos_malloc2(height * width); + dataP = _vm->_globals.allocMemory(height * width); if (dataP == g_PTRNUL) error("CAPTURE_OBJET"); @@ -261,12 +261,9 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn byte *ObjectsManager::DEL_FICHIER_OBJ() { _vm->_globals.NUM_FICHIER_OBJ = 0; - if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) - _vm->_globals.ADR_FICHIER_OBJ = _vm->_globals.LIBERE_FICHIER(_vm->_globals.ADR_FICHIER_OBJ); + _vm->_globals.ADR_FICHIER_OBJ = _vm->_globals.freeMemory(_vm->_globals.ADR_FICHIER_OBJ); - byte *result = g_PTRNUL; - _vm->_globals.ADR_FICHIER_OBJ = g_PTRNUL; - return result; + return g_PTRNUL; } // Load Sprite @@ -1369,11 +1366,9 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, _vm->_globals.VBob[idx].xp + width, height + _vm->_globals.VBob[idx].yp); - if (_vm->_globals.VBob[idx].surface != g_PTRNUL) - _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); _vm->_globals.VBob[idx].field4 = 0; - _vm->_globals.VBob[idx].surface = g_PTRNUL; _vm->_globals.VBob[idx].spriteData = g_PTRNUL; _vm->_globals.VBob[idx].xp = 0; _vm->_globals.VBob[idx].yp = 0; @@ -1404,10 +1399,8 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx].field4 = 1; _vm->_globals.VBob[idx].oldSpriteData = _vm->_globals.VBob[idx].spriteData; - if (_vm->_globals.VBob[idx].surface != g_PTRNUL) - _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); - _vm->_globals.VBob[idx].surface = g_PTRNUL; _vm->_globals.VBob[idx].oldX = _vm->_globals.VBob[idx].xp; _vm->_globals.VBob[idx].oldY = _vm->_globals.VBob[idx].yp; _vm->_globals.VBob[idx].oldFrameIndex = _vm->_globals.VBob[idx].frameIndex; @@ -1417,10 +1410,9 @@ void ObjectsManager::AFF_VBOB() { width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - if (_vm->_globals.VBob[idx].surface != g_PTRNUL) - _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); - byte *surface = _vm->_globals.dos_malloc2(height * width); + byte *surface = _vm->_globals.allocMemory(height * width); _vm->_globals.VBob[idx].surface = surface; _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, @@ -1551,9 +1543,7 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, void ObjectsManager::SPRITE_OFF(int idx) { Sprite[idx].field0 = 3; - if (Sprite[idx].field1C != g_PTRNUL) - _vm->_globals.dos_free2(Sprite[idx].field1C); - Sprite[idx].field1C = g_PTRNUL; + Sprite[idx].field1C = _vm->_globals.freeMemory(Sprite[idx].field1C); } void ObjectsManager::SPRITE_GEL(int idx) { @@ -2355,7 +2345,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { ++v5; } while (v1 != -1); _vm->_linesManager.INIPARCOURS(); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); } // Load Zone @@ -2466,7 +2456,7 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { _vm->_globals.ZONEP[v15++].field12 = READ_LE_UINT16(v13 + 2 * v14++); while (v15 <= 100); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); CARRE_ZONE(); } @@ -2656,7 +2646,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANI = 1; SPRITE_OFF(0); _vm->_globals.AFFLI = false; - sprite_ptr = _vm->_globals.LIBERE_FICHIER(sprite_ptr); + sprite_ptr = _vm->_globals.freeMemory(sprite_ptr); CLEAR_ECRAN(); _vm->_globals.NOSPRECRAN = false; _vm->_globals.PLAN_FLAG = false; @@ -2998,10 +2988,8 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals.COUCOU != g_PTRNUL) - _vm->_globals.COUCOU = _vm->_globals.LIBERE_FICHIER(_vm->_globals.COUCOU); - if (g_PTRNUL != _vm->_globals.SPRITE_ECRAN) - _vm->_globals.SPRITE_ECRAN = _vm->_globals.LIBERE_FICHIER(_vm->_globals.SPRITE_ECRAN); + _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); + _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager._mouseSpriteId = 0; Vold_taille = 200; @@ -4143,7 +4131,7 @@ void ObjectsManager::OPTI_OBJET() { v7 = 1; } while (v7 != 1); } - _vm->_globals.dos_free2(data); + _vm->_globals.freeMemory(data); } void ObjectsManager::SPECIAL_JEU() { @@ -4189,7 +4177,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); _vm->_globals.NOPARLE = false; if (!_vm->_globals.CENSURE) { - v1 = _vm->_globals.dos_malloc2(0x3E8u); + v1 = _vm->_globals.allocMemory(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); @@ -4214,7 +4202,7 @@ void ObjectsManager::SPECIAL_JEU() { PERSO_ON = false; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); - _vm->_globals.dos_free2(v1); + _vm->_globals.freeMemory(v1); _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.Winbpp == 2) { if (_vm->_graphicsManager.SDL_ECHELLE) @@ -4315,8 +4303,7 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { _vm->_globals.VBob[idx].oldFrameIndex = frameIndex; _vm->_globals.VBob[idx].spriteData = src; _vm->_globals.VBob[idx].oldSpriteData = src; - if (_vm->_globals.VBob[idx].surface != g_PTRNUL) - _vm->_globals.VBob[idx].surface = _vm->_globals.dos_free2(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); } int f4 = _vm->_globals.VBob[idx].field4; @@ -4345,8 +4332,7 @@ void ObjectsManager::VBOB_OFF(int idx) { void ObjectsManager::ACTION_DOS(int idx) { if (_vm->_globals.GESTE_FLAG != 1) { - if (g_PTRNUL != _vm->_globals.GESTE) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 1; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "DOS.SPR"); @@ -4382,8 +4368,7 @@ void ObjectsManager::ACTION_DOS(int idx) { void ObjectsManager::ACTION_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -4412,8 +4397,7 @@ void ObjectsManager::ACTION_DROITE(int idx) { void ObjectsManager::Q_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -4442,8 +4426,7 @@ void ObjectsManager::Q_DROITE(int idx) { void ObjectsManager::ACTION_FACE(int idx) { if (_vm->_globals.GESTE_FLAG != 2) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FACE.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -4460,8 +4443,7 @@ void ObjectsManager::ACTION_FACE(int idx) { void ObjectsManager::Q_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -4490,8 +4472,7 @@ void ObjectsManager::Q_GAUCHE(int idx) { void ObjectsManager::ACTION_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { - if (_vm->_globals.GESTE != g_PTRNUL) - _vm->_globals.GESTE = _vm->_globals.dos_free2(_vm->_globals.GESTE); + _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -4654,7 +4635,7 @@ void ObjectsManager::INILINK(const Common::String &file) { error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); nbytes = f.size(); - ptr = _vm->_globals.dos_malloc2(nbytes); + ptr = _vm->_globals.allocMemory(nbytes); if (g_PTRNUL == ptr) error("INILINK"); _vm->_fileManager.readStream(f, ptr, nbytes); @@ -4833,7 +4814,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } while (nbytes > v42); } } - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); } void ObjectsManager::SPECIAL_INI(const Common::String &a1) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 31ebb3cc3a..ed41e34c0f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -143,8 +143,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; - BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); - PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); + BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + PERSOSPR = _vm->_globals.freeMemory(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; @@ -258,7 +258,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { while (v5 != -1); } - BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); + BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); _vm->_eventsManager._mouseCursorId = v8; _vm->_eventsManager.changeMouseCursor(v8); @@ -670,7 +670,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { error("Error opening file - %s", dest.c_str()); f.seek(indexData[idx]); - ptr = _vm->_globals.dos_malloc2(2058); + ptr = _vm->_globals.allocMemory(2058); if (ptr == g_PTRNUL) error("temporary TEXT"); f.read(ptr, 2048); @@ -864,10 +864,7 @@ void TalkManager::ANIM_PERSO_INIT() { void TalkManager::clearCharacterAnim() { for (int idx = 21; idx <= 34; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].data != g_PTRNUL) - _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.dos_free2(_vm->_globals.Bqe_Anim[idx].data); - - _vm->_globals.Bqe_Anim[idx].data = g_PTRNUL; + _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx].data); _vm->_globals.Bqe_Anim[idx].field4 = 0; } } @@ -919,7 +916,7 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int ++v6; ++v5; } while (v7 != 1); - _vm->_globals.Bqe_Anim[v20].data = _vm->_globals.dos_malloc2(v6 + 50); + _vm->_globals.Bqe_Anim[v20].data = _vm->_globals.allocMemory(v6 + 50); _vm->_globals.Bqe_Anim[a1].field4 = 1; memcpy(_vm->_globals.Bqe_Anim[v20].data, (const byte *)(v22 + bufPerso + 5), 20); v8 = _vm->_globals.Bqe_Anim[v20].data; @@ -1007,7 +1004,7 @@ LABEL_2: v5 = v5 + 1; if (v15 == 1) { v6 = v5 + 5; - ptr = _vm->_globals.dos_malloc2(620); + ptr = _vm->_globals.allocMemory(620); if (g_PTRNUL == ptr) error("TRADUC"); memset(ptr, 0, 620); @@ -1061,13 +1058,13 @@ LABEL_2: if (!v10 || v10 == 5) v17 = 1; if (v10 == 6) { - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); v2 = _vm->_objectsManager.NVZONE; v3 = _vm->_objectsManager.NVVERBE; goto LABEL_2; } } while (v17 != 1); - _vm->_globals.dos_free2(ptr); + _vm->_globals.freeMemory(ptr); _vm->_globals.SAUVEGARDE->data[svField2] = 0; return; } @@ -1295,8 +1292,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; - BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); - PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR); + BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + PERSOSPR = _vm->_globals.freeMemory(PERSOSPR); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; _vm->_linesManager.CLEAR_ZONE(); @@ -1306,7 +1303,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { do _vm->_globals.BOBZONE[v13++] = 0; while (v13 <= 44); - _vm->_globals.LIBERE_FICHIER(_vm->_globals.COUCOU); + _vm->_globals.freeMemory(_vm->_globals.COUCOU); _vm->_globals.COUCOU = v11; _vm->_objectsManager.DESACTIVE = true; _vm->_objectsManager.INILINK(v20); -- cgit v1.2.3 From fb5d1736fa8e0a513e8f9125760412e79d9bbe7a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 12 Dec 2012 23:16:07 +0100 Subject: HOPKINS: Fix bugs introduced in previous commits --- engines/hopkins/events.cpp | 12 ++++++------ engines/hopkins/font.cpp | 2 +- engines/hopkins/objects.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 8f077d5463..b0be096dc6 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -145,13 +145,13 @@ void EventsManager::changeMouseCursor(int id) { if (_mouseCursorId != 23) { if (id == 4 && _mouseCursorId == 4 && _vm->_globals.NOMARCHE) - _mouseCursorId = 0; - if (_mouseCursorId == 25) - _mouseCursorId = 5; + cursorId = 0; + if (cursorId == 25) + cursorId = 5; - if (_oldIconId != _mouseCursorId || !_mouseCursorId) { - _oldIconId = _mouseCursorId; - _mouseCursorId = cursorId; + if (_oldIconId != cursorId || !cursorId) { + _oldIconId = cursorId; + _mouseSpriteId = cursorId; updateCursor(); } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 400ab48cfe..cc5f2c05a6 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -352,7 +352,7 @@ LABEL_57: _vm->_globals.largeur_boite = _textSortArray[i]; } - if (_text[idx]._textType > 3) { + if ((_text[idx]._textType < 2) || (_text[idx]._textType > 3)) { int i; for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals.largeur_boite + i > 638 && i > -2 && _text[idx]._textType; i -= 2) ; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index eb195c213b..3bc788eb3c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -517,7 +517,7 @@ void ObjectsManager::AFF_SPRITES() { // Loop to draw any on-screen text for (int idx = 0; idx <= 10; ++idx) { if (_vm->_fontManager._text[idx]._textOnFl) { - if (_vm->_fontManager._text[idx]._textType > 3) + if ((_vm->_fontManager._text[idx]._textType < 2) || (_vm->_fontManager._text[idx]._textType > 3)) _vm->_fontManager.box(idx, _vm->_fontManager._text[idx]._messageId, _vm->_fontManager._text[idx]._filename, _vm->_eventsManager._startPos.x + _vm->_fontManager._text[idx]._pos.x, _vm->_fontManager._text[idx]._pos.y); @@ -527,7 +527,7 @@ void ObjectsManager::AFF_SPRITES() { _vm->_fontManager._text[idx]._pos.x, _vm->_fontManager._text[idx]._pos.y); _vm->_fontManager._textList[idx]._enabledFl = true; - if (_vm->_fontManager._text[idx]._textType > 3) + if ((_vm->_fontManager._text[idx]._textType < 2) || (_vm->_fontManager._text[idx]._textType > 3)) _vm->_fontManager._textList[idx]._pos.x = _vm->_eventsManager._startPos.x + _vm->_fontManager._text[idx]._pos.x; else _vm->_fontManager._textList[idx]._pos.x = _vm->_fontManager._text[idx]._pos.x; -- cgit v1.2.3 From 95025312a7c3b184fef3818ece1f1d55b7fb19d1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 14 Dec 2012 01:49:22 +0100 Subject: HOPKINS: Janitorial - Remove trailing space and double semi columns --- engines/hopkins/anim.cpp | 118 +++---- engines/hopkins/computer.cpp | 138 ++++---- engines/hopkins/debugger.h | 2 +- engines/hopkins/detection_tables.h | 18 + engines/hopkins/dialogs.cpp | 58 ++-- engines/hopkins/events.cpp | 24 +- engines/hopkins/files.cpp | 18 +- engines/hopkins/font.cpp | 52 +-- engines/hopkins/font.h | 2 +- engines/hopkins/globals.cpp | 42 +-- engines/hopkins/globals.h | 4 +- engines/hopkins/graphics.cpp | 290 ++++++++-------- engines/hopkins/graphics.h | 2 +- engines/hopkins/lines.cpp | 516 ++++++++++++++-------------- engines/hopkins/menu.cpp | 32 +- engines/hopkins/objects.cpp | 688 ++++++++++++++++++------------------- engines/hopkins/objects.h | 10 +- engines/hopkins/saveload.cpp | 14 +- engines/hopkins/script.cpp | 48 +-- engines/hopkins/sound.cpp | 28 +- engines/hopkins/sound.h | 2 +- engines/hopkins/talk.cpp | 216 ++++++------ 22 files changed, 1170 insertions(+), 1152 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 80e1bdb19b..601ff00e9e 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -48,8 +48,8 @@ AnimationManager::AnimationManager() { */ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { bool breakFlag; - bool hasScreenCopy; - byte *screenCopy = NULL; + bool hasScreenCopy; + byte *screenCopy = NULL; byte *screenP = NULL; int frameNumber; byte *ptr = NULL; @@ -193,7 +193,7 @@ EXIT: nbytes = f.readUint32LE(); f.skip(14); f.read(screenP, nbytes); - + memcpy(screenCopy, screenP, 0x4B000u); breakFlag = false; @@ -204,7 +204,7 @@ EXIT: breakFlag = true; if (strncmp((char *)ptr, "IMAGE=", 6)) breakFlag = true; - + if (!breakFlag) { f.read(screenP, READ_LE_UINT32(ptr + 8)); if (*screenP != kByteStop) @@ -219,7 +219,7 @@ EXIT: _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); screenCopy = _vm->_globals.freeMemory(screenCopy); } - + _vm->_graphicsManager.FADE_LINUX = 0; f.close(); ptr = _vm->_globals.freeMemory(ptr); @@ -230,15 +230,15 @@ EXIT: * Play Animation, type 2 */ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { - int v5; - int v8; - byte *ptr; - int v11; - byte *v12; - byte *v13; - int v15; - size_t nbytes; - byte buf[6]; + int v5; + int v8; + byte *ptr; + int v11; + byte *v12; + byte *v13; + int v15; + size_t nbytes; + byte buf[6]; Common::File f; if (_vm->shouldQuit()) @@ -268,7 +268,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint f.read(_vm->_graphicsManager.Palette, 0x320u); f.read(&buf, 4); nbytes = f.readUint32LE(); - f.readUint32LE(); + f.readUint32LE(); f.readUint16LE(); f.readUint16LE(); f.readUint16LE(); @@ -276,7 +276,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint f.readUint16LE(); f.read(v12, nbytes); - + _vm->_graphicsManager.Cls_Pal(); v11 = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); @@ -392,7 +392,7 @@ LABEL_48: _vm->_soundManager.playAnim_SOUND(v15); memset(&buf, 0, 6u); memset(v13, 0, 0x13u); - + if (f.read(v13, 0x10) != 0x10) v5 = -1; @@ -554,9 +554,9 @@ LABEL_114: f.close(); if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { - byte *ptra; + byte *ptra; ptra = _vm->_globals.allocMemory(0x4B000u); - + f.seek(0); f.read(&buf, 6); f.read(_vm->_graphicsManager.Palette, 0x320u); @@ -669,11 +669,11 @@ void AnimationManager::loadAnim(const Common::String &animName) { Common::String filename = animName + ".ANI"; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - + Common::File f; if (!f.open(_vm->_globals.NFICHIER)) error("Failed to open %s", _vm->_globals.NFICHIER.c_str()); - + int filesize = f.size(); int nbytes = filesize - 115; f.read(header, 10); @@ -694,7 +694,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { for (int idx = 1; idx <= 6; ++idx) { if (files[idx - 1][0]) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, files[idx - 1]); - + if (!f.exists(_vm->_globals.NFICHIER)) error("File not found"); if (loadSpriteBank(idx, files[idx - 1])) @@ -736,9 +736,9 @@ void AnimationManager::clearAnim() { */ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *v3; - byte *v4; + byte *v4; byte *v13; - byte *ptr; + byte *ptr; byte *v19; int result = 0; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); @@ -755,14 +755,14 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_globals.Bank[idx].fileHeader = 1; if (*(v3 + 1) == 'O' && *(v3 + 2) == 'R') _vm->_globals.Bank[idx].fileHeader = 2; - + if (_vm->_globals.Bank[idx].fileHeader) { _vm->_globals.Bank[idx].data = v3; bool loopCond = false; int v8 = 0; - int width; - int height; + int width; + int height; do { ptr = v4; width = _vm->_objectsManager.getWidth(v4, v8); @@ -775,10 +775,10 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { if (v8 > 249) loopCond = true; } while (!loopCond); - + if (v8 <= 249) { _vm->_globals.Bank[idx].field1A = v8; - + Common::String ofsFilename = _vm->_globals.Bank[idx].filename1; char ch; do { @@ -786,13 +786,13 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { ofsFilename.deleteLastChar(); } while (ch != '.'); ofsFilename += ".OFS"; - + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, ofsFilename); Common::File f; if (f.exists(_vm->_globals.NFICHIER)) { v19 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v13 = v19; - + if (_vm->_globals.Bank[idx].field1A > 0) { for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx) { int x1 = (int16)READ_LE_UINT16(v13); @@ -806,10 +806,10 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, objIdx, x2, y2, 1); } } - + _vm->_globals.freeMemory(v19); } - + result = 0; } else { _vm->_globals.freeMemory(ptr); @@ -825,28 +825,28 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { return result; } -/** +/** * Search Animation */ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { int v3; - const byte *v5; - int v6; - int v7; + const byte *v5; + int v6; + int v7; int v8; - byte *v9; + byte *v9; int v10; int v11; int v12; - int v13; - int v15; - int v16; - int v17; - int v19; + int v13; + int v15; + int v16; + int v17; + int v19; int v20; - int v21; + int v21; int v22; - const byte *v23; + const byte *v23; int v; v21 = 0; @@ -925,13 +925,13 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { * Play sequence */ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { - bool readError; - int v7; - byte *ptr = NULL; - byte *v9; - byte *v10; + bool readError; + int v7; + byte *ptr = NULL; + byte *v9; + byte *v10; int soundNumber; - size_t nbytes; + size_t nbytes; Common::File f; if (_vm->shouldQuit()) @@ -1106,13 +1106,13 @@ LABEL_59: * Play Sequence type 2 */ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { - bool v4; - int v7; - byte *ptr = NULL; - byte *v10; - byte *v11 = NULL; - int v13; - size_t nbytes; + bool v4; + int v7; + byte *ptr = NULL; + byte *v10; + byte *v11 = NULL; + int v13; + size_t nbytes; Common::File f; v7 = 0; @@ -1258,7 +1258,7 @@ LABEL_53: LABEL_54: if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) { byte *ptra = _vm->_globals.allocMemory(0x4B000u); - + f.seek(0); f.skip(6); f.read(_vm->_graphicsManager.Palette, 0x320u); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index e2c1ada8ef..3a23bec6c0 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -119,9 +119,9 @@ void ComputerManager::setTextPosition(int yp, int xp) { * @param mode Which computer to display */ void ComputerManager::showComputer(ComputerEnum mode) { - bool passwordMatch; - char *v3; - char s[12]; + bool passwordMatch; + char *v3; + char s[12]; const char *s2; _vm->_eventsManager._escKeyFl = false; @@ -309,7 +309,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_globals.SORTIE = 13; if ((uint16)(mode - 2) <= 1u) _vm->_globals.SORTIE = 14; - + _vm->_graphicsManager.RESET_SEGMENT_VESA(); } @@ -470,10 +470,10 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); - + _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; _vm->_eventsManager._mouseFl = oldMouseFlag; @@ -510,18 +510,18 @@ void ComputerManager::restoreFBIRoom() { * Display texts for the given menu entry */ void ComputerManager::readText(int idx) { - uint16 v1; - int v2; - uint16 v3; - int v4; - int v5; - int v6; - int v7; - int v8; - uint16 v10; - byte *ptr; - Common::String v12; - Common::String numStr; + uint16 v1; + int v2; + uint16 v3; + int v4; + int v5; + int v6; + int v7; + int v8; + uint16 v10; + byte *ptr; + Common::String v12; + Common::String numStr; int num; _vm->_eventsManager._escKeyFl = false; @@ -554,7 +554,7 @@ void ComputerManager::readText(int idx) { v4 = v3; if (v3 > v1 - 1) error("Error with Hopkins computer file"); - + v10 = v3 + 3; v5 = 1; v6 = 5; @@ -639,8 +639,8 @@ void ComputerManager::displayGamesSubMenu() { * Load Highscore from file */ void ComputerManager::loadHiscore() { - char nextChar; - byte *ptr; + char nextChar; + byte *ptr; _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); ptr = _vm->_globals.allocMemory(100); @@ -652,21 +652,21 @@ void ComputerManager::loadHiscore() { if (!nextChar) nextChar = ' '; _score[scoreIndex]._name += nextChar; - } + } for (int i = 0; i < 9; ++i) { nextChar = *(ptr + i + scoreIndex * 16 + 6); if (!nextChar) nextChar = '0'; _score[scoreIndex]._score += nextChar; - } - } + } + } _vm->_globals.freeMemory(ptr); _breakoutHiscore = atol(_score[5]._score.c_str()); } -/** +/** * VGA 256 col */ void ComputerManager::setModeVGA256() { @@ -721,11 +721,11 @@ void ComputerManager::newLevel() { * Display bricks in breakout game */ void ComputerManager::displayBricks() { - int xp; - int yp; - int v2; - uint16 v3; - int16 *v4; + int xp; + int yp; + int v2; + uint16 v3; + int16 *v4; _breakoutBrickNbr = 0; _breakoutSpeed = 1; @@ -738,7 +738,7 @@ void ComputerManager::displayBricks() { if (xp != -1) { if (v2 <= 6) ++_breakoutBrickNbr; - + if (v2 == 3) _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 17); else if (v2 == 6) @@ -764,8 +764,8 @@ void ComputerManager::displayBricks() { * Display Lives in breakout game */ void ComputerManager::displayLives() { - int v3; - int v4; + int v3; + int v4; int v0 = _breakoutLives - 1; int v1 = 10; @@ -792,8 +792,8 @@ void ComputerManager::displayLives() { * Main function for breakout game */ void ComputerManager::playBreakout() { - int v1 = 0; - int v; + int v1 = 0; + int v; while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) { @@ -878,10 +878,10 @@ void ComputerManager::playBreakout() { * @return The selected button index: 1 = Game, 2 = Quit */ int ComputerManager::displayHiscores() { - int yp; - int buttonIndex; - int xp; - byte *ptr; + int yp; + int buttonIndex; + int xp; + byte *ptr; _vm->_graphicsManager.RESET_SEGMENT_VESA(); loadHiscore(); @@ -933,8 +933,8 @@ int ComputerManager::displayHiscores() { * Display a screen to enter player name in the case of a new hiscore */ void ComputerManager::getScoreName() { - char curChar; - byte *ptr; + char curChar; + byte *ptr; _vm->_graphicsManager.LOAD_IMAGEVGA("NAME.PCX"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -961,7 +961,7 @@ void ComputerManager::getScoreName() { } _score[5]._score = " "; - char score[16]; + char score[16]; sprintf(score, "%d", _breakoutScore); int scoreLen = 0; do @@ -982,10 +982,10 @@ void ComputerManager::getScoreName() { * Display current score */ void ComputerManager::displayScore() { - int16 v0; - int16 v1; - int16 i; - char s[40]; + int16 v0; + int16 v1; + int16 i; + char s[40]; sprintf(s, "%d", _breakoutScore); v0 = 0; @@ -1041,17 +1041,17 @@ void ComputerManager::IMPSCORE(int a1, int a2) { * Save Hiscore in file */ void ComputerManager::saveScore() { - int v1; - int v2; - int v4; - int v6; - char v8; - int v9; - char v11; - int v14; - byte *ptr; - int v16[6]; - int v17[6]; + int v1; + int v2; + int v4; + int v6; + char v8; + int v9; + char v11; + int v14; + byte *ptr; + int v16[6]; + int v17[6]; for (int v0 = 0; v0 <= 5; v0++) { v1 = atol(_score[v0]._score.c_str()); @@ -1065,7 +1065,7 @@ void ComputerManager::saveScore() { bool v3 = false; do { v4 = v17[v2]; - if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4 + if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4 && v17[4] <= v4 && v17[5] <= v4) v3 = true; if (v3) { @@ -1110,8 +1110,8 @@ void ComputerManager::saveScore() { * Display parts of the hiscore line */ void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) { - char v4; - int v5; + char v4; + int v5; v4 = a4; v5 = 36; @@ -1134,11 +1134,11 @@ void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) * Handle ball moves */ int ComputerManager::moveBall() { - int16 v1; + int16 v1; int16 v4 = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; // TODO: Figure out random number - int v0 = _vm->getRandomNumber(6); + int v0 = _vm->getRandomNumber(6); if (_breakoutSpeed == 1) { CASSEP1 = 1; CASSEP2 = 1; @@ -1166,7 +1166,7 @@ int ComputerManager::moveBall() { if (_ballRightFl) _ballPosition.x += v1; - else + else _ballPosition.x -= v1; CASSDER = v1; @@ -1222,12 +1222,12 @@ int ComputerManager::moveBall() { * Check ball collision with bricks */ void ComputerManager::checkBallCollisions() { - int v1; - int v2; - int v3; - int v4; - int v10; - int v11; + int v1; + int v2; + int v3; + int v4; + int v10; + int v11; int v7 = 0; //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; diff --git a/engines/hopkins/debugger.h b/engines/hopkins/debugger.h index 7a2f44aafe..aabc95c5f1 100644 --- a/engines/hopkins/debugger.h +++ b/engines/hopkins/debugger.h @@ -33,7 +33,7 @@ class HopkinsEngine; class Debugger : public GUI::Debugger { private: HopkinsEngine *_vm; - + public: Debugger(); virtual ~Debugger() {} diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index ffb1164ed4..5c24935acf 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -170,6 +170,24 @@ static const HopkinsGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + + { + // Hopkins FBI BeOS, provided by Strangerke + { + "hopkins", + 0, + { + {"ENG_VOI.RES", 0, "fa5789d1d8c19d160bce44a33e742fdf", 66860711}, + {"Hopkins_ FBI", 0, "8940ce2e618c42691b66aad5d6c223b0", 757936}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformBeOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { AD_TABLE_END_MARKER } }; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 4072126508..e29592ad30 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -65,7 +65,7 @@ void DialogsManager::showOptionsDialog() { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIAN.SPR"); else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); - + _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals._optionDialogFl = true; @@ -74,13 +74,13 @@ void DialogsManager::showOptionsDialog() { Common::Point mousePos(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); mousePos.x = _vm->_eventsManager.getMouseX(); mousePos.y = _vm->_eventsManager.getMouseY(); - + if (!_vm->_soundManager.MUSICOFF) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { // Change the music volume ++_vm->_soundManager.MUSICVOL; _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; - + if (_vm->_soundManager.MUSICVOL <= 12) _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else @@ -89,14 +89,14 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - + if (!_vm->_soundManager.MUSICOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { --_vm->_soundManager.MUSICVOL; if (_vm->_soundManager.MUSICVOL >= 0) _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else _vm->_soundManager.MUSICVOL = 0; - + _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); @@ -115,7 +115,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - + if (!_vm->_soundManager.SOUNDOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { --_vm->_soundManager.SOUNDVOL; if (_vm->_soundManager.SOUNDVOL >= 0) @@ -128,11 +128,11 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } } - + if (!_vm->_soundManager.VOICEOFF) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { ++_vm->_soundManager.VOICEVOL; - + if (_vm->_soundManager.VOICEVOL <= 16) _vm->_soundManager.PLAY_SOUND("bruit2.wav"); else @@ -142,7 +142,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - + if (!_vm->_soundManager.VOICEOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { --_vm->_soundManager.VOICEVOL; if (_vm->_soundManager.VOICEVOL >= 0) @@ -155,7 +155,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } } - + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) _vm->_soundManager.TEXTOFF = _vm->_soundManager.TEXTOFF != 1; @@ -178,7 +178,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) { _vm->_soundManager.SOUNDOFF = _vm->_soundManager.SOUNDOFF != 1; @@ -187,7 +187,7 @@ void DialogsManager::showOptionsDialog() { } } } - + if (mousePos.x >= _vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { _vm->_globals.SORTIE = 300; doneFlag = true; @@ -256,7 +256,7 @@ void DialogsManager::showOptionsDialog() { _vm->_globals.opt_voice = !_vm->_soundManager.VOICEOFF ? 7 : 8; _vm->_globals.opt_sound = !_vm->_soundManager.SOUNDOFF ? 7 : 8; _vm->_globals.opt_music = !_vm->_soundManager.MUSICOFF ? 7 : 8; - + if (_vm->_globals.SVGA == 1) _vm->_globals.opt_anm = 10; else if (_vm->_globals.SVGA == 2) @@ -292,9 +292,9 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.VBL(); } while (!doneFlag); - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_graphicsManager.ofscroll + 164, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_graphicsManager.ofscroll + 164, 107, 335, 215, _vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll + 164, 107); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, _vm->_graphicsManager.ofscroll + 498, 320); _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR); @@ -349,7 +349,7 @@ LABEL_7: int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, v19 + 300, 414, 0, 0, 0, 0); int v15 = 0; int v4 = 0; @@ -360,7 +360,7 @@ LABEL_7: int v6 = _vm->_globals.INVENTAIRE[v4]; if (v6 && v4 <= 29) { byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); _vm->_globals.freeMemory(v7); } @@ -476,18 +476,18 @@ LABEL_7: void DialogsManager::inventAnim() { if (!_vm->_globals._disableInventFl) { if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; } - + if (_vm->_objectsManager.FLAG_VISIBLE) { if (_vm->_objectsManager.I_old_x <= 1) _vm->_objectsManager.I_old_x = 2; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); - + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); int v0 = _vm->_graphicsManager.ofscroll + 2; int v1 = _vm->_graphicsManager.ofscroll + 2; @@ -495,7 +495,7 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); _vm->_objectsManager.I_old_x = v0; } - + if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); @@ -522,7 +522,7 @@ void DialogsManager::inventAnim() { void DialogsManager::testDialogOpening() { if (_vm->_globals.PLAN_FLAG) _vm->_eventsManager._gameKey = KEY_NONE; - + if (_vm->_eventsManager._gameKey != KEY_NONE) { if (!_inventFl) { DIALOG_KEY key = _vm->_eventsManager._gameKey; @@ -562,7 +562,7 @@ void DialogsManager::testDialogOpening() { * Load Game dialog */ void DialogsManager::showLoadGame() { - int slotNumber; + int slotNumber; _vm->_eventsManager.VBL(); showSaveLoad(2); @@ -584,7 +584,7 @@ void DialogsManager::showLoadGame() { if (slotNumber != 7) { _vm->_saveLoadManager.restore(slotNumber); } - + _vm->_objectsManager.CHANGE_OBJET(14); } @@ -592,8 +592,8 @@ void DialogsManager::showLoadGame() { * Save Game dialog */ void DialogsManager::showSaveGame() { - int slotNumber; - Common::String saveName; + int slotNumber; + Common::String saveName; _vm->_eventsManager.VBL(); @@ -627,7 +627,7 @@ void DialogsManager::showSaveGame() { * Load/Save dialog */ void DialogsManager::showSaveLoad(int a1) { - int slotNumber; + int slotNumber; hopkinsSavegameHeader header; byte *thumb; @@ -687,7 +687,7 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 294, 0x80u, 87); break; } - + thumb8.free(); header.thumbnail->free(); delete header.thumbnail; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index b0be096dc6..2f3dc413df 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -148,7 +148,7 @@ void EventsManager::changeMouseCursor(int id) { cursorId = 0; if (cursorId == 25) cursorId = 5; - + if (_oldIconId != cursorId || !cursorId) { _oldIconId = cursorId; _mouseSpriteId = cursorId; @@ -191,7 +191,7 @@ void EventsManager::delay(int totalMilli) { while (!g_system->getEventManager()->shouldQuit() && g_system->getMillis() < delayEnd) { g_system->delayMillis(10); - } + } } void EventsManager::pollEvents() { @@ -236,7 +236,7 @@ void EventsManager::pollEvents() { void EventsManager::handleKey(Common::Event &event) { _escKeyFl = (event.kbd.keycode == Common::KEYCODE_ESCAPE); - + if (event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB) _gameKey = KEY_INVENTORY; else if (event.kbd.keycode == Common::KEYCODE_F5) @@ -306,13 +306,13 @@ int EventsManager::waitKeyPress() { void EventsManager::VBL() { int v1; - int v2; - int v3; + int v2; + int v3; signed int v11 = 0; signed int v12 = 0; - int v13 = 0; - unsigned int v14 = 0; - int v15 = 0; + int v13 = 0; + unsigned int v14 = 0; + int v15 = 0; int yp = 0; if (_vm->_graphicsManager.REDRAW) { @@ -438,7 +438,7 @@ LABEL_65: if (_vm->_graphicsManager.DOUBLE_ECRAN != true || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { - int v4; + int v4; if (_vm->_graphicsManager.no_scroll != 2) { if (getMouseX() > _vm->_graphicsManager.SCROLL + 620) _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; @@ -529,7 +529,7 @@ LABEL_113: #endif _vm->_soundManager.VERIF_SOUND(); refreshEvents(); -} +} void EventsManager::updateCursor() { // Backup the current sprite clipping bounds and reset them @@ -559,7 +559,7 @@ void EventsManager::updateCursor() { _vm->_graphicsManager.max_x = clipBounds.right; _vm->_graphicsManager.max_y = clipBounds.bottom; _vm->_graphicsManager.nbrligne2 = pitch; - + // Convert the cursor to the pixel format. At the moment, it's hardcoded // to expect the game to be in 16-bit mode uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL]; @@ -585,7 +585,7 @@ void EventsManager::updateCursor() { CursorMan.replaceCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, xOffset, 0, *((uint16 *)cursorPixels), true, &pixelFormat); - // Delete the cursor surface + // Delete the cursor surface delete[] cursorPixels; delete[] cursorSurface; } diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 998ab57fc5..04d4dab3cd 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -42,7 +42,7 @@ void FileManager::setParent(HopkinsEngine *vm) { * Load INI File */ void FileManager::loadIniFile(Common::StringMap &iniParams) { - // TODO: Review whether we can do something cleaner with ScummVM initialisation than + // TODO: Review whether we can do something cleaner with ScummVM initialisation than // just initialising the INI array as if it had read in the INI file iniParams["FULLSCREEN"] = "NO"; @@ -70,7 +70,7 @@ byte *FileManager::loadFile(const Common::String &file) { readStream(f, data, filesize); f.close(); - + return data; } @@ -146,7 +146,7 @@ Common::String FileManager::constructLinuxFilename(const Common::String &file) { * Check if a file is present in a given (optional) folder */ bool FileManager::fileExists(const Common::String &folder, const Common::String &file) { - Common::String filename = folder.empty() ? file : + Common::String filename = folder.empty() ? file : Common::String::format("%s/%s", folder.c_str(), file.c_str()); Common::File f; @@ -159,7 +159,7 @@ bool FileManager::fileExists(const Common::String &folder, const Common::String byte *FileManager::searchCat(const Common::String &file, int a2) { byte *ptr = NULL; Common::File f; - + Common::String filename = file; filename.toUppercase(); @@ -168,7 +168,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { constructFilename(_vm->_globals.HOPLINK, "RES_INI.CAT"); if (!f.exists(_vm->_globals.NFICHIER)) return g_PTRNUL; - + ptr = loadFile(_vm->_globals.NFICHIER); constructFilename(_vm->_globals.HOPLINK, "RES_INI.RES"); break; @@ -260,10 +260,10 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { byte *result; bool matchFlag = false; int offsetVal = 0; - + while (!matchFlag) { Common::String name = (const char *)ptr + offsetVal; - + if (name == filename) { // Found entry for file, so get it's details from the catalogue entry const byte *pData = ptr + offsetVal; @@ -276,7 +276,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { _vm->_globals.freeMemory(ptr); return g_PTRNUL; } - + offsetVal += 23; } @@ -315,7 +315,7 @@ uint32 FileManager::fileSize(const Common::String &filename) { size = f.size(); f.close(); - + return size; } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index cc5f2c05a6..92d0c72263 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -56,7 +56,7 @@ void FontManager::clearAll() { _oldName = Common::String(""); _indexName = Common::String(""); - + for (int idx = 0; idx < 4048; idx++) _index[idx] = 0; @@ -69,11 +69,11 @@ void FontManager::clearAll() { void FontManager::showText(int idx) { if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); - + TxtItem &txt = _text[idx - 5]; txt._textOnFl = true; txt._textLoadedFl = false; - + txt._textBlock = _vm->_globals.freeMemory(txt._textBlock); } @@ -83,7 +83,7 @@ void FontManager::showText(int idx) { void FontManager::hideText(int idx) { if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); - + TxtItem &txt = _text[idx - 5]; txt._textOnFl = false; txt._textLoadedFl = false; @@ -113,7 +113,7 @@ void FontManager::setOptimalColor(int idx1, int idx2, int idx3, int idx4) { void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int textType, int a9, int color) { if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); - + TxtItem &txt = _text[idx - 5]; txt._textOnFl = false; txt._filename = filename; @@ -129,10 +129,10 @@ void FontManager::initTextBuffers(int idx, int messageId, const Common::String & // Box void FontManager::box(int idx, int messageId, const Common::String &filename, int xp, int yp) { - byte *v9; - byte *ptre; - Common::String s; - Common::String file; + byte *v9; + byte *ptre; + Common::String s; + Common::String file; Common::File f; int v73 = xp; @@ -150,7 +150,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); yCurrent += _vm->_globals.police_h + 1; - } + } } } else { int height = _text[idx]._height; @@ -179,7 +179,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _oldName = file; _indexName = Common::String(file.c_str(), file.size() - 3); _indexName += "IND"; - + if (!f.open(_indexName)) error("Error opening file - %s", _indexName.c_str()); int filesize = f.size(); @@ -198,7 +198,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _tempText = _vm->_globals.allocMemory(0x80Au); if (_tempText == g_PTRNUL) error("Error allocating text"); - + Common::fill(&_tempText[0], &_tempText[0x80a], 0); f.read(_tempText, 0x800u); f.close(); @@ -398,7 +398,7 @@ LABEL_57: _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager.TABLE_COUL, v49); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); _vm->_globals.freeMemory(ptrd); - + _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, (byte)-2); _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v51 + v55, v53, (byte)-2); _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); @@ -417,7 +417,7 @@ LABEL_57: int blockWidth = v53 + 1; int blockHeight = v51 + 1; - + _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; textType = _text[idx]._textType; @@ -437,13 +437,13 @@ LABEL_57: } } -/** +/** * Directly display text (using a VESA segment) */ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, int col) { const char *srcP; - char currChar; - int charIndex; + char currChar; + int charIndex; int currentX = xp; srcP = message.c_str(); @@ -453,7 +453,7 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, break; if (currChar >= 32) { charIndex = currChar - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, currentX, yp, currChar - 32, col); currentX += _vm->_objectsManager.getWidth(_vm->_globals.police, charIndex); } @@ -462,7 +462,7 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, currentX, yp + 12); } -/** +/** * Directly display text */ void FontManager::displayText(int xp, int yp, const Common::String &message, int col) { @@ -471,7 +471,7 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, xp, yp, characterIndex, col); xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); } @@ -479,12 +479,12 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int } void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col) { - const char *srcP; - int v5; - int v6; - byte v7; - int fontCol; - int v9; + const char *srcP; + int v5; + int v6; + byte v7; + int fontCol; + int v9; srcP = msg.c_str(); v9 = xp; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index dbe6a2dc67..1b9bd3404f 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -81,7 +81,7 @@ public: void setOptimalColor(int idx1, int idx2, int idx3, int idx4); void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int textType, int a9, int a10); void box(int idx, int messageId, const Common::String &filename, int xp, int yp); - + void displayTextVesa(int xp, int yp, const Common::String &message, int col); void displayText(int xp, int yp, const Common::String &message, int col); void TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ed4e998df3..e13a184d5e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -37,26 +37,26 @@ byte *g_PTRNUL; // Default data for the Hopkins array const int HOPKINS_PERSO_0[] = { - 0, -2, 0, -3, 0, -6, 0, -1, 0, -3, 0, -3, 0, -5, 0, -3, 0, -6, 0, -3, 0, -3, 0, -3, - 9, -4, 8, -4, 6, -2, 9, -2, 9, -3, 9, -3, 9, -4, 9, -2, 9, -2, 8, -2, 9, -3, 9, -2, - 13, 0, 13, 0, 13, 0, 13, 0, 14, 0, 13, 0, 13, 0, 12, 0, 12, 0, 14, 0, 13, 0, 14, 0, - 10, 3, 9, 3, 10, 4, 8, 2, 7, 1, 10, 2, 9, 2, 7, 4, 7, 3, 8, 0, 9, 1, 9, 1, 0, 4, 0, + 0, -2, 0, -3, 0, -6, 0, -1, 0, -3, 0, -3, 0, -5, 0, -3, 0, -6, 0, -3, 0, -3, 0, -3, + 9, -4, 8, -4, 6, -2, 9, -2, 9, -3, 9, -3, 9, -4, 9, -2, 9, -2, 8, -2, 9, -3, 9, -2, + 13, 0, 13, 0, 13, 0, 13, 0, 14, 0, 13, 0, 13, 0, 12, 0, 12, 0, 14, 0, 13, 0, 14, 0, + 10, 3, 9, 3, 10, 4, 8, 2, 7, 1, 10, 2, 9, 2, 7, 4, 7, 3, 8, 0, 9, 1, 9, 1, 0, 4, 0, 4, 0, 6, 0, 3, 0, 4, 0, 3, 0, 4, 0, 4, 0, 6, 0, 3, 0, 3, 0, 3 }; const int HOPKINS_PERSO_1[] = { - 0, -2, 0, -2, 0, -5, 0, -1, 0, -2, 0, -2, 0, -4, 0, -2, 0, -5, 0, -2, 0, -2, 0, -2, - 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, - 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, - 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, + 0, -2, 0, -2, 0, -5, 0, -1, 0, -2, 0, -2, 0, -4, 0, -2, 0, -5, 0, -2, 0, -2, 0, -2, + 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, + 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, + 11, 0, 10, 0, 11, 0, 11, 0, 11, 0, 11, 0, 12, 0, 11, 0, 9, 0, 10, 0, 11, 0, 11, 0, 0, 3, 0, 3, 0, 5, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 5, 0, 3, 0, 3, 0, 3 }; const int HOPKINS_PERSO_2[] = { - 0, -2, 0, 0, 0, -3, 0, -2, 0, -2, 0, -1, 0, -2, 0, -1, 0, -3, 0, -2, 0, -2, 0, -2, - 8, 0, 9, 0, 5, 0, 9, 0, 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 8, 0, 9, 0, - 5, 0, 9, 0, 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 8, 0, 9, 0, 5, 0, 9, 0, - 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 2, + 0, -2, 0, 0, 0, -3, 0, -2, 0, -2, 0, -1, 0, -2, 0, -1, 0, -3, 0, -2, 0, -2, 0, -2, + 8, 0, 9, 0, 5, 0, 9, 0, 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 8, 0, 9, 0, + 5, 0, 9, 0, 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 8, 0, 9, 0, 5, 0, 9, 0, + 7, 0, 7, 0, 7, 0, 7, 0, 6, 0, 7, 0, 6, 0, 9, 0, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 2 }; @@ -346,13 +346,13 @@ void Globals::setConfig() { void Globals::clearAll() { // TODO: The original allocated an explicit memory block for the null pointer // to point to. For now, we're seeing if the NULL value will do as well - + for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = g_PTRNUL; nbrligne = 80; INIT_ANIM(); - + texte_tmp = g_PTRNUL; texte_long = 0; police = g_PTRNUL; @@ -360,7 +360,7 @@ void Globals::clearAll() { police_l = 0; hauteur_boite = 0; largeur_boite = 0; - + _vm->_fontManager.clearAll(); INIT_VBOB(); @@ -374,7 +374,7 @@ void Globals::clearAll() { SPRITE_ECRAN = g_PTRNUL; SAUVEGARDE = (Sauvegarde *)g_PTRNUL; OBJET_EN_COURS = 0; - + for (int idx = 0; idx < 105; ++idx) { ZONEP[idx].destX = 0; ZONEP[idx].destY = 0; @@ -484,7 +484,7 @@ void Globals::CLEAR_VBOB() { VBob[idx].surface = freeMemory(VBob[idx].surface); VBob[idx].spriteData = g_PTRNUL; VBob[idx].oldSpriteData = g_PTRNUL; - } + } } // Load Object @@ -563,8 +563,8 @@ void Globals::CACHE_ADD(int idx) { // Load Cache void Globals::CHARGE_CACHE(const Common::String &file) { byte *v2 = g_PTRNUL; - byte *spriteData; - byte *ptr; + byte *spriteData; + byte *ptr; Common::String v16; Common::File f; @@ -574,7 +574,7 @@ void Globals::CHARGE_CACHE(const Common::String &file) { v16 = Common::String((const char *)ptr); _vm->_fileManager.constructFilename(HOPLINK, v16); - + if (f.exists(NFICHIER)) { spriteData = _vm->_fileManager.loadFile(NFICHIER); CACHE_BANQUE[1] = spriteData; @@ -599,7 +599,7 @@ void Globals::CHARGE_CACHE(const Common::String &file) { Cache[i].field8 = v9; Cache[i].fieldA = 1; } - + if ( !Cache[i].field0 && !Cache[i].field4 && !Cache[i].field2) Cache[i].fieldA = 0; v15 += 5; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index eebfea5782..803a63384a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -503,9 +503,9 @@ public: byte *freeMemory(byte *p); void RESET_CACHE(); - void CACHE_ON(); + void CACHE_ON(); void CACHE_OFF(int v1 = 0); - void CACHE_SUB(int idx); + void CACHE_SUB(int idx); void CACHE_ADD(int idx); void CHARGE_CACHE(const Common::String &file); void B_CACHE_OFF(int idx); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 32b7b62688..3dbd97a9da 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -91,7 +91,7 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { if (_vm->getPlatform() == Common::kPlatformLinux) // CHECKME: Should be 0? MANU_SCROLL = 1; - else + else MANU_SCROLL = 0; SPEED_SCROLL = 16; } else { @@ -114,7 +114,7 @@ void GraphicsManager::SET_MODE(int width, int height) { SDL_ECHELLE = 75; if (_vm->_globals.XSETMODE == 5) SDL_ECHELLE = _vm->_globals.XZOOM; - + int bpp = 8; if (_vm->_globals.XFORCE8 == true) bpp = 8; @@ -202,7 +202,7 @@ void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { if (Winbpp == 2) CopyAsm16(VESA_BUFFER); DD_Unlock(); - + FADE_IN_CASSE(); } @@ -241,7 +241,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { } else if (Winbpp == 1) { if (!SDL_ECHELLE) m_scroll2(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else + else m_scroll2A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } @@ -278,7 +278,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { void GraphicsManager::INIT_TABLE(int minIndex, int maxIndex, byte *palette) { for (int idx = 0; idx < 256; ++idx) TABLE_COUL[idx] = idx; - + Trans_bloc(TABLE_COUL, palette, 256, minIndex, maxIndex); for (int idx = 0; idx < 256; ++idx) { @@ -320,7 +320,7 @@ void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int m col2 += minThreshold; if (col2 < col1) continue; - + col2 -= maxThreshold; if (col2 > col1) continue; @@ -332,9 +332,9 @@ void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int m } void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { - byte *dataP; - int count; - byte dataVal; + byte *dataP; + int count; + byte dataVal; dataP = surface; count = size - 1; @@ -372,7 +372,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by error("Error decoding PCX %s", file.c_str()); const Graphics::Surface *s = pcxDecoder.getSurface(); - + // Copy out the dimensions and pixels of the decoded surface DOUBLE_ECRAN = s->w > SCREEN_WIDTH; PCX_L = s->w; @@ -382,28 +382,28 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by // Copy out the palette const byte *palSrc = pcxDecoder.getPalette(); Common::copy((const byte *)palSrc, (const byte *)palSrc + PALETTE_BLOCK_SIZE, palette); - + f.close(); } void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *palette) { - size_t filesize; - int v4; - size_t v5; - int v6; - size_t v7; - int v8; - byte v9; - int v10; - int v11; - char v12; - int v15; - int v16; - int32 v17; - byte *ptr; - Common::File f; - - if (!f.open(file)) + size_t filesize; + int v4; + size_t v5; + int v6; + size_t v7; + int v8; + byte v9; + int v10; + int v11; + char v12; + int v15; + int v16; + int32 v17; + byte *ptr; + Common::File f; + + if (!f.open(file)) error("File not found - %s", file.c_str()); filesize = f.size(); @@ -562,7 +562,7 @@ void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, } --xCtr; } while ( xCtr ); - + srcP = srcCopyP; destP = WinScan + destCopyP; if (Agr_Flag_y) @@ -648,7 +648,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width *(uint16 *)destP = pixelWord; destP += 2; } - + --xCtr; } while (xCtr); @@ -657,12 +657,12 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width destP = WinScan + destCopyP; if (Agr_Flag_y == 1) break; - + Agr_y += SDL_ECHELLE; - + if ((unsigned int)Agr_y < 100) break; - + Agr_y -= 100; Agr_Flag_y = 1; } @@ -679,18 +679,18 @@ void GraphicsManager::Copy_Vga(const byte *surface, int xp, int yp, int width, i int yCount; int xCount; byte srcByte; - byte *loopDestP; - byte *loopSrcP; - byte *loopSrc2P; - byte *tempDestP; - const byte *tempSrcP; - int yCtr; + byte *loopDestP; + byte *loopSrcP; + byte *loopSrc2P; + byte *tempDestP; + const byte *tempSrcP; + int yCtr; assert(VideoPtr); srcP = xp + 320 * yp + surface; destP = 30 * WinScan + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels; yCount = height; - + do { yCtr = yCount; xCount = width; @@ -709,7 +709,7 @@ void GraphicsManager::Copy_Vga(const byte *surface, int xp, int yp, int width, i destP = loopSrc2P - WinScan + 1; --xCount; } while (xCount); - + destP = WinScan + WinScan + tempDestP; srcP = tempSrcP + 320; yCount = yCtr - 1; @@ -717,9 +717,9 @@ void GraphicsManager::Copy_Vga(const byte *surface, int xp, int yp, int width, i } void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - const byte *srcP; - uint16 *destP; - int yCount; + const byte *srcP; + uint16 *destP; + int yCount; int xCount; int xCtr; const byte *palette; @@ -736,7 +736,7 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, destP = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels); yCount = height; xCount = width; - + do { yCtr = yCount; xCtr = xCount; @@ -744,13 +744,13 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, loopDestP = destP; savedXCount = xCount; palette = PAL_PIXELS; - + do { tempSrcP = (uint16 *)(palette + 2 * *srcP); srcByte = *tempSrcP; *destP = *tempSrcP; *(destP + 1) = srcByte; - + tempDestP = (uint16 *)((byte *)destP + WinScan); *tempDestP = srcByte; *(tempDestP + 1) = srcByte; @@ -758,7 +758,7 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, destP = (uint16 *)((byte *)tempDestP - WinScan + 4); --xCtr; } while (xCtr); - + xCount = savedXCount; destP = (uint16 *)((byte *)loopDestP + WinScan * 2); srcP = loopSrcP + 320; @@ -776,7 +776,7 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface // Set current palette to black setpal_vga256(palData2); - + // Loop through fading in the palette uint16 *pTemp1 = &palData1[1]; for (int fadeIndex = 0; fadeIndex < FADESPD; ++fadeIndex) { @@ -791,14 +791,14 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface if (palData2[palOffset + 1] < palette[palOffset + 1]) { uint16 *pDest = &pTemp1[palOffset]; - uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; + uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; *pDest = v; palData2[palOffset + 1] = (v >> 8) & 0xff; } if (palData2[palOffset + 2] < palette[palOffset + 2]) { uint16 *pDest = &pTemp2[palOffset]; - uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; + uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; *pDest = v; palData2[palOffset + 2] = (v >> 8) & 0xff; } @@ -843,7 +843,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac tempPalette[palDataIndex] = palByte; palData[palDataIndex] = *(palIndex++ + palette); } while (palIndex < PALETTE_BLOCK_SIZE); - + setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) @@ -852,7 +852,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } - + int palCtr3 = 0; if (palMax > 0) { do { @@ -864,14 +864,14 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac palData[palCtr5] = (palValue >> 8) & 0xff; ++palCtr4; } while (palCtr4 < (PALETTE_BLOCK_SIZE)); - + setpal_vga256(palData); if (Winbpp == 2) { if (SDL_ECHELLE) m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - + DD_VBL(); } ++palCtr3; @@ -882,7 +882,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac palData[i] = 0; setpal_vga256(palData); - + if (Winbpp == 2) { if (!SDL_ECHELLE) { m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -934,13 +934,13 @@ void GraphicsManager::setpal_vga256(const byte *palette) { void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { CHANGE_PALETTE(palette); - + if (Winbpp == 2) { if (SDL_ECHELLE) m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - + DD_VBL(); } } @@ -949,7 +949,7 @@ void GraphicsManager::SETCOLOR(int palIndex, int r, int g, int b) { Palette[palIndex * 3] = 255 * r / 100; Palette[palIndex * 3 + 1] = 255 * g / 100; Palette[palIndex * 3 + 2] = 255 * b / 100; - + setpal_vga256(Palette); } @@ -965,8 +965,8 @@ void GraphicsManager::SETCOLOR3(int palIndex, int r, int g, int b) { void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { int rv, gv, bv; - int palOffset; - int v8; + int palOffset; + int v8; rv = 255 * r / 100; gv = 255 * g / 100; @@ -980,9 +980,9 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { cmap[v8] = rv; cmap[v8 + 1] = gv; cmap[v8 + 2] = bv; - + WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); - + if (Winbpp == 1) g_system->getPaletteManager()->setPalette(cmap, palIndex, 1); } @@ -1057,13 +1057,13 @@ void GraphicsManager::FADE_OUT_CASSE() { void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { int rleValue; - int destOffset; - const byte *srcP; + int destOffset; + const byte *srcP; byte srcByte; byte destLen1; - byte *destSlice1P; - byte destLen2; - byte *destSlice2P; + byte *destSlice1P; + byte destLen2; + byte *destSlice2P; rleValue = 0; destOffset = 0; @@ -1133,7 +1133,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { srcByte = *srcP; if (*srcP < 222) goto Video_Cont3_Vbe; - + if (srcByte == kByteStop) return; if (srcByte < kSetOffset) { @@ -1243,9 +1243,9 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { - int destOffset; - const byte *srcP; - byte pixelIndex; + int destOffset; + const byte *srcP; + byte pixelIndex; destOffset = 0; srcP = srcData; @@ -1278,9 +1278,9 @@ Video_Cont_Vbe16a: void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height) { const byte *srcP; byte *destP; - int rowCount; + int rowCount; int i; - int rowCount2; + int rowCount2; // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within // the screen, and so thus can read areas outside of the allocated surface buffer @@ -1323,7 +1323,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int width = READ_LE_UINT16(spriteP); spriteP += 2; int height = READ_LE_UINT16(spriteP); - + // Clip X clip_x1 = width; if ((xp + width) <= (min_x + 300)) @@ -1377,7 +1377,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Set up surface destination byte *destP = surface + (yp - 300) * nbrligne2 + (xp - 300); - + // Handling for clipped versus non-clipped if (clip_flag) { // Clipped version @@ -1424,7 +1424,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, Common::copy(spriteP, spriteP + width, tempDestP); spriteP += width; } - + tempDestP += width; } @@ -1468,7 +1468,7 @@ void GraphicsManager::RESET_SEGMENT_VESA() { if (_vm->_globals.NBBLOC > 0) { for (int idx = 0; idx != _vm->_globals.NBBLOC; idx++) _vm->_globals.BLOC[idx].field0 = 0; - + _vm->_globals.NBBLOC = 0; } } @@ -1497,7 +1497,7 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { do { BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; - if (bloc.field0 == 1 + if (bloc.field0 == 1 && tempX >= bloc.x1 && x2 <= bloc.x2 && y1 >= bloc.y1 && y2 <= bloc.y2) addFlag = false; @@ -1505,7 +1505,7 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { blocCount = blocIndex; } while (_vm->_globals.NBBLOC + 1 != blocIndex); } - + if (addFlag) { assert(_vm->_globals.NBBLOC < 250); BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; @@ -1527,7 +1527,7 @@ int GraphicsManager::Magic_Number(signed int v) { ++result; if (result & 2) result += 2; - + return result; } @@ -1544,14 +1544,14 @@ void GraphicsManager::Affiche_Segment_Vesa() { Common::Rect &dstRect = dstrect[idx - 1]; if (bloc.field0 != 1) continue; - + if (_vm->_eventsManager._breakoutFl) { if (Winbpp == 1) { Copy_Vga(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); } else if (Winbpp == 2) { Copy_Vga16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); } - + dstRect.left = bloc.x1 * 2; dstRect.top = bloc.y1 * 2 + 30; dstRect.setWidth((bloc.x2 - bloc.x1) * 2); @@ -1561,7 +1561,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { bloc.x1 = _vm->_eventsManager._startPos.x; if (bloc.x2 > (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) bloc.x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; - + if (SDL_ECHELLE) { // Calculate the bounds int xp = Magic_Number(bloc.x1) - 4; @@ -1586,10 +1586,10 @@ void GraphicsManager::Affiche_Segment_Vesa() { DD_Lock(); if (Winbpp == 2) { - m_scroll16A(VESA_BUFFER, xp, yp, width, height, + m_scroll16A(VESA_BUFFER, xp, yp, width, height, Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } else { - m_scroll2A(VESA_BUFFER, xp, yp, width, height, + m_scroll2A(VESA_BUFFER, xp, yp, width, height, Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); } @@ -1619,7 +1619,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { DD_Unlock(); } } - + _vm->_globals.BLOC[idx].field0 = 0; } @@ -1650,13 +1650,13 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i void GraphicsManager::CopyAsm(const byte *surface) { const byte *srcP; byte srcByte; - byte *destP; + byte *destP; int yCtr; int xCtr; - byte *dest1P; - byte *dest2P; - byte *dest3P; - byte *destPitch; + byte *dest1P; + byte *dest2P; + byte *dest3P; + byte *destPitch; const byte *srcPitch; assert(VideoPtr); @@ -1668,7 +1668,7 @@ void GraphicsManager::CopyAsm(const byte *surface) { srcPitch = srcP; destPitch = destP; xCtr = 320; - + do { srcByte = *srcP; *destP = *srcP; @@ -1682,7 +1682,7 @@ void GraphicsManager::CopyAsm(const byte *surface) { ++srcP; --xCtr; } while (xCtr); - + srcP = srcPitch + 320; destP = WinScan + WinScan + destPitch; --yCtr; @@ -1690,17 +1690,17 @@ void GraphicsManager::CopyAsm(const byte *surface) { } void GraphicsManager::CopyAsm16(const byte *surface) { - const byte *v1; - byte *v2; - int v3; - signed int v4; - byte *v5; - uint16 *v6; - int v; - uint16 *v8; - int v9; - byte *v10; - const byte *v11; + const byte *v1; + byte *v2; + int v3; + signed int v4; + byte *v5; + uint16 *v6; + int v; + uint16 *v8; + int v9; + byte *v10; + const byte *v11; assert(VideoPtr); v1 = surface; @@ -1770,7 +1770,7 @@ int GraphicsManager::Reel_Zoom(int v, int percentage) { int GraphicsManager::Asm_Zoom(int v, int percentage) { if (v) v += percentage * (long int)v / 100; - + return v; } @@ -1781,22 +1781,22 @@ int GraphicsManager::Reel_Reduc(int v, int percentage) { int GraphicsManager::Asm_Reduc(int v, int percentage) { if (v) v -= percentage * (long int)v / 100; - + return v; } - -// Display 'Perfect?' + +// Display 'Perfect?' void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag) { - const byte *spriteStartP; - int i; + const byte *spriteStartP; + int i; const byte *spriteSizeP; - const byte *spritePixelsP; - byte *dest1P; - byte *dest2P; - byte *v29; - byte *v40; - const byte *v45; - const byte *v46; + const byte *spritePixelsP; + byte *dest1P; + byte *dest2P; + byte *v29; + byte *v40; + const byte *v45; + const byte *v46; spriteStartP = srcData + 3; for (i = frameIndex; i; --i) @@ -2173,18 +2173,18 @@ void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int } void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { - int top; - int croppedWidth; + int top; + int croppedWidth; int croppedHeight; - int xRight; - int top2; + int xRight; + int top2; int left; left = x1; top = y1; croppedWidth = width; croppedHeight = height; - + if (x1 < min_x) { croppedWidth = width - (min_x - x1); left = min_x; @@ -2208,13 +2208,13 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int } void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY) { - const byte *srcP; - byte *destP; + const byte *srcP; + byte *destP; int yp; int yCurrent; byte *dest2P; const byte *src2P; - unsigned int pitch; + unsigned int pitch; srcP = x1 + nbrligne2 * y1 + srcSurface; destP = destX + nbrligne2 * destY + destSurface; @@ -2233,16 +2233,16 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned } // Display Font -void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, +void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour) { const byte *spriteDataP; - int i; - const byte *spriteSizeP; - int spriteWidth; + int i; + const byte *spriteSizeP; + int spriteWidth; int spriteHeight; const byte *spritePixelsP; byte *destP; - int xCtr; + int xCtr; byte destByte; byte *destLineP; int yCtr; @@ -2272,7 +2272,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x destByte = colour; *destP = destByte; } - + ++destP; ++spritePixelsP; --xCtr; @@ -2342,7 +2342,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_globals.freeMemory(ptr); if (mode != 1) { _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); - + filename = file + ".rep"; byte *dataP = _vm->_fileManager.searchCat(filename, 2); _vm->_globals.COUCOU = dataP; @@ -2357,7 +2357,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { } void GraphicsManager::NB_SCREEN() { - byte *destP; + byte *destP; const byte *srcP; if (!_vm->_globals.NECESSAIRE) @@ -2380,7 +2380,7 @@ void GraphicsManager::NB_SCREEN() { m_scroll2(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } DD_Unlock(); - + destP = VESA_SCREEN; srcP = VESA_BUFFER; memcpy(VESA_SCREEN, VESA_BUFFER, 0x95FFCu); @@ -2400,10 +2400,10 @@ void GraphicsManager::videkey() { } void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { - int result; - int destOffset; - const byte *srcPtr; - byte byteVal; + int result; + int destOffset; + const byte *srcPtr; + byte byteVal; result = 0; destOffset = 0; @@ -2435,10 +2435,10 @@ Video_Cont_wVbe: } void GraphicsManager::Copy_Video_Vbe(const byte *src) { - int destOffset; - const byte *srcP; - byte byteVal; - + int destOffset; + const byte *srcP; + byte byteVal; + assert(VideoPtr); destOffset = 0; srcP = src; @@ -2470,8 +2470,8 @@ Video_Cont_Vbe: // Reduce Screen void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) { - const byte *srcP; - byte *destP; + const byte *srcP; + byte *destP; srcP = xp + nbrligne2 * yp + srcSurface; destP = destSurface; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index df0c71f8c3..e92cbf8fdc 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -156,7 +156,7 @@ public: void Copy_Video_Vbe16(const byte *srcData); void Copy_Video_Vbe16a(const byte *srcData); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height); - + /** * Draws a sprite onto the screen * @param surface Destination surface diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 85a6e07aad..890aeffb1f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -86,7 +86,7 @@ int LinesManager::ZONE_OBJET(int a1, int a2) { } int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { - int v3; + int v3; signed int v4; v3 = a2; @@ -190,7 +190,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in } *dataP++ = -1; *dataP++ = -1; - + LigneZone[idx].count = v20; LigneZone[idx].field2 = a6; } else { @@ -217,11 +217,11 @@ void LinesManager::RETIRE_LIGNE(int idx) { // Add Line void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { - int v7; - int v8; - int v9; - byte *v10; - int v11; + int v7; + int v8; + int v9; + byte *v10; + int v11; int v12; int v13; int v24; @@ -257,7 +257,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v33 = v9 + 1; if (v8 > (int)(v9 + 1)) v34 = v8; - + v10 = _vm->_globals.allocMemory(4 * v34 + 8); if (v10 == g_PTRNUL) error("AJOUTE LIGNE OBSTACLE"); @@ -362,7 +362,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v27 = v32 + 2; v27[0] = -1; v27[1] = -1; - + Ligne[idx].field0 = v35 + 1; Ligne[idx].field2 = a7; Ligne[idx].field4 = a2; @@ -371,9 +371,9 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, // Line Collision 2 // TODO: Should return a bool int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int16 *v7; - int16 *v13; - int result; + int16 *v7; + int16 *v13; + int result; int v24 = a5; int v6 = a5; @@ -430,7 +430,7 @@ LABEL_28: } for (;;) { int v12 = v7[0]; - + v13 = v7 + 1; int v14 = v13[0]; v7 = v13 + 1; @@ -451,7 +451,7 @@ LABEL_28: } int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int16 *v7; + int16 *v7; int16 *v13; int result; @@ -550,16 +550,16 @@ LABEL_46: // Init route void LinesManager::INIPARCOURS() { - int v0; - int v1; - int v2; - int16 *v3; - int v4; - int v5; - int v6; - int16 *v7; - int v8; - int v9; + int v0; + int v1; + int v2; + int16 *v3; + int v4; + int v5; + int v6; + int16 *v7; + int v8; + int v9; int v11; int v12; int v13; @@ -577,7 +577,7 @@ void LinesManager::INIPARCOURS() { v4 = v3[2 * v2 - 2]; v5 = v3[2 * v2 - 1]; - if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 + if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 || _vm->_graphicsManager.min_y == v5) v1 = 1; if (v15 == v4 && v14 == v5) @@ -622,7 +622,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i int16 *v10 = Ligne[a1].lineData; int v11 = v10[2 * i]; v50 = v10[2 * i + 1]; - + int v12 = v8; a6[v12] = v11; a6[v12 + 1] = v50; @@ -655,7 +655,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i int16 *v18 = Ligne[v36].lineData; int v19 = v18[2 * j]; v50 = v18[2 * j + 1]; - + int v20 = v8; a6[v20] = v19; a6[v20 + 1] = v50; @@ -746,7 +746,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, a6[v19 + 1] = v50; a6[v19 + 2] = Ligne[v15].field6; v40 += a7; - + } } ++v15; @@ -825,52 +825,52 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, } int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { - int v5; - int v6; - int v7; - int v8; - int v9; + int v5; + int v6; + int v7; + int v8; + int v9; int v10; - int i; + int i; int v12; int v13; - int j; + int j; int v15; int v16; - int k; + int k; int v18; int v19; - int l; + int l; int v21; - int v22; - int v23; - int v24; + int v22; + int v23; + int v24; int v25; int v26; - int v27; + int v27; int v28; int v29; - int v30; + int v30; int v31; int v32; - int v33; - int v35 = 0; - int v36 = 0; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42 = 0; - int v43 = 0; - int v44 = 0; - int v45 = 0; - int v46 = 0; - int v47 = 0; - int v48 = 0; - int v49 = 0; - int v50; - int v51; + int v33; + int v35 = 0; + int v36 = 0; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42 = 0; + int v43 = 0; + int v44 = 0; + int v45 = 0; + int v46 = 0; + int v47 = 0; + int v48 = 0; + int v49 = 0; + int v50; + int v51; v5 = a1; v6 = a2; @@ -1490,12 +1490,12 @@ LABEL_17: // Avoid 2 int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; int v10; int v11; int v12; @@ -1516,7 +1516,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v28; int v29; int v31; - int v34; + int v34; int v35; int v36; int v37; @@ -1557,32 +1557,32 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v72; int j; int16 *v74; - int v75; - int v76; - int v77; - int v78; - int v79; - int v80; + int v75; + int v76; + int v77; + int v78; + int v79; + int v80; int16 *v81; - int v82; - int v83; - int16 *v84; - int v85; - int v86; - int v87; - int v88; - int v89; + int v82; + int v83; + int16 *v84; + int v85; + int v86; + int v87; + int v88; + int v89; int v90; - int16 *v91; + int16 *v91; int v92; - int v93; + int v93; int v94; - int16 *v95; + int16 *v95; int v96; - int v97; - int v98; - int v99; - int v100; + int v97; + int v98; + int v99; + int v100; int v101; int v102; int v103; @@ -1591,23 +1591,23 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v106; int v107; int v108; - int v109; - int v110; - int v111; - int v112; + int v109; + int v110; + int v111; + int v112; int v113; - int v114; - int v115; - int v116; - int v117; - int v118; - int v119; - int v120; - int v121; - int v122; - int v123; - int v124; - int v125; + int v114; + int v115; + int v116; + int v117; + int v118; + int v119; + int v120; + int v121; + int v122; + int v123; + int v124; + int v125; int v126[9]; int v131[9]; int v136[9]; @@ -1683,7 +1683,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (v11 <= 3) return (int16 *)g_PTRNUL; } - + for (v12 = 0; v12 <= 8; ++v12) { v141[v12] = -1; v136[v12] = 0; @@ -1817,13 +1817,13 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v121 = v141[7]; v120 = v136[7]; } - + for (v12 = 0; v12 <= 8; ++v12) { v141[v12] = -1; v136[v12] = 0; v131[v12] = 1300; v126[v12] = 1300; - } + } v34 = 0; v35 = srcY; @@ -2311,29 +2311,29 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v73; int v74; int v76; - int16 *v77; - int16 *v78; - int v79; - int16 *v80; - int v81; - int16 *v82; - int v83; - int16 *v84; - int v85; - int16 *v86; - int v87; - int16 *v88; - int v89; - int v90; - int v91; - int v92; - int v93; - int v94; - int v95; - int v96; - int v97; - int v98; - int v99; + int16 *v77; + int16 *v78; + int v79; + int16 *v80; + int v81; + int16 *v82; + int v83; + int16 *v84; + int v85; + int16 *v86; + int v87; + int16 *v88; + int v89; + int v90; + int v91; + int v92; + int v93; + int v94; + int v95; + int v96; + int v97; + int v98; + int v99; int v100; int v101; int v102; @@ -2374,11 +2374,11 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v137; int v138; int v139; - int v140; - int v141; - int v142; - int v143; - int v144; + int v140; + int v141; + int v142; + int v143; + int v144; int v145; int colResult = 0; @@ -2661,7 +2661,7 @@ LABEL_157: v32[v31] = -1; v32[v31 + 1] = -1; v32[v31 + 2] = -1; - + v117 = 0; v33 = v98; v92 = v97; @@ -3085,20 +3085,20 @@ LABEL_248: } int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v11; - int v12; - int v13; - int v14; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v11; + int v12; + int v13; + int v14; int v15; int v16; - int v17; - int v18; + int v17; + int v18; v4 = a1 - a3; if (a1 - a3 < 0) @@ -3140,27 +3140,27 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { } int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { - int v6; - int v7; - int v8; - int v9; + int v6; + int v7; + int v8; + int v9; int v10; int v11; int v12; - int v13; - int v14; - int v15; + int v13; + int v14; + int v15; int v16; int v17; int v18; int v19; int v20; int v21; - int v22; - int v23; - int v24; - int v25; - int v26; + int v22; + int v23; + int v24; + int v25; + int v26; int v27; int v28; int v29; @@ -3169,33 +3169,33 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v32; int v33; int v34; - int v35; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v43; - int v44; - int v45; - int v46; - int v47; - int v48; - int v49 = 0; - int v50; - int v51; - int v52; - int v53; - int v54; - int v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v61; - int v62; + int v35; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49 = 0; + int v50; + int v51; + int v52; + int v53; + int v54; + int v55; + int v56; + int v57; + int v58; + int v59; + int v60; + int v61; + int v62; int v63; v62 = a3; @@ -3408,53 +3408,53 @@ LABEL_85: } int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int16 *v15; - int v16; - int v17; - int v18; - int v19; - int16 *v20; - int v21; - int v22; - int v23; - int16 *v25; - int16 *v26; - int v27; - int v28; - int v29; - int v30; - int v31; - int v32; - int v33 = 0; - int v34 = 0; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v43; - int v44; - int v45; - int v46; - int v47; - int v48; - int v49; - int v50; - int v51; - int v52; - int v53; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; + int v12; + int v13; + int v14; + int16 *v15; + int v16; + int v17; + int v18; + int v19; + int16 *v20; + int v21; + int v22; + int v23; + int16 *v25; + int16 *v26; + int v27; + int v28; + int v29; + int v30; + int v31; + int v32; + int v33 = 0; + int v34 = 0; + int v35; + int v36; + int v37; + int v38; + int v39; + int v40; + int v41; + int v42; + int v43; + int v44; + int v45; + int v46; + int v47; + int v48; + int v49; + int v50; + int v51; + int v52; + int v53; v41 = a3; v40 = TEST_LIGNE(a1, a2 - 2, &v42, &v50, &v46); @@ -3620,30 +3620,30 @@ LABEL_60: // Test line int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { - int i; - int v6; - int16 *v7; - int v8; - int v9; - int v10; - int v11; - int16 *v12; - int v13; - int v14; - int v15; - int v16; - int16 *v17; - int v18; - int v19; - int v20; - int v21; - int result; - int v23; - int v24 = 0; - int v25; - int v26; - int v27; - int v28; + int i; + int v6; + int16 *v7; + int v8; + int v9; + int v10; + int v11; + int16 *v12; + int v13; + int v14; + int v15; + int v16; + int16 *v17; + int v18; + int v19; + int v20; + int v21; + int result; + int v23; + int v24 = 0; + int v25; + int v26; + int v27; + int v28; v26 = 0; v25 = _vm->_objectsManager.DERLIGNE + 1; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 7dbd386d90..e63cde6b34 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -42,7 +42,7 @@ void MenuManager::setParent(HopkinsEngine *vm) { enum MenuSelection { MENU_NONE = 0, PLAY_GAME = 1, LOAD_GAME = 2, OPTIONS = 3, INTRODUCTION = 4, QUIT = 5 }; int MenuManager::MENU() { - byte *spriteData = NULL; + byte *spriteData = NULL; MenuSelection menuIndex; Common::Point mousePos; signed int result; @@ -65,7 +65,7 @@ int MenuManager::MENU() { for (int idx = 0; idx < 31; ++idx) _vm->_globals.INVENTAIRE[idx] = 0; - + memset(_vm->_globals.SAUVEGARDE, 0, 2000); _vm->_objectsManager.AJOUTE_OBJET(14); frame5Index = 0; @@ -81,7 +81,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.LOAD_IMAGE("MENUFR"); else if (_vm->_globals.FR == 2) _vm->_graphicsManager.LOAD_IMAGE("MENUES"); - + _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.FR == 0) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUAN.SPR"); @@ -89,13 +89,13 @@ int MenuManager::MENU() { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUFR.SPR"); else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); - + spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); _vm->_eventsManager.mouseOn(); _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager._mouseSpriteId = 0; - + for (;;) { for (;;) { _vm->_soundManager.WSOUND(28); @@ -108,7 +108,7 @@ int MenuManager::MENU() { menuIndex = MENU_NONE; mousePos = Common::Point(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); - + if ((uint16)(mousePos.x - 232) <= 176) { if ((uint16)(mousePos.y - 261) <= 23) menuIndex = PLAY_GAME; @@ -118,11 +118,11 @@ int MenuManager::MENU() { menuIndex = OPTIONS; if ((uint16)(mousePos.y - 356) <= 23) menuIndex = INTRODUCTION; - + if ((uint16)(mousePos.y - 388) <= 23) menuIndex = QUIT; } - + switch (menuIndex) { case MENU_NONE: frame1Index = 0; @@ -166,18 +166,18 @@ int MenuManager::MENU() { frame4Index = 0; frame5Index = 1; } - + _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, frame1Index); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, frame2Index + 2); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, frame3Index + 4); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, frame4Index + 6); _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, frame5Index + 8); _vm->_eventsManager.VBL(); - + if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) selectionMade = 1; } while (!selectionMade); - + if (menuIndex == PLAY_GAME) { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); _vm->_eventsManager.VBL(); @@ -190,20 +190,20 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - + _vm->_globals.SORTIE = -1; _vm->_dialogsManager.showLoadGame(); - + if (_vm->_globals.SORTIE != -1) { result = _vm->_globals.SORTIE; break; } _vm->_globals.SORTIE = 0; } - + if (menuIndex != OPTIONS) break; - + // Options menu item selected _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, 12); _vm->_eventsManager.VBL(); @@ -228,7 +228,7 @@ int MenuManager::MENU() { } break; } - + _vm->_globals.freeMemory(spriteData); _vm->_globals._disableInventFl = false; _vm->_globals.FLAG_VISIBLE = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3bc788eb3c..dc09154d82 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -87,7 +87,7 @@ ObjectsManager::ObjectsManager() { OBSSEUL = 0; NVVERBE = 0; NVZONE = 0; - S_old_ani = 0; + S_old_ani = 0; S_old_ret = 0; nouveau_x = nouveau_y = 0; nouveau_sens = 0; @@ -136,7 +136,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { dataP = _vm->_globals.allocMemory(height * width); if (dataP == g_PTRNUL) error("CAPTURE_OBJET"); - + capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); break; @@ -184,7 +184,7 @@ void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSi byte *startP = data + 3; for (int i = idx; i; --i) startP += READ_LE_UINT32(startP) + 16; - + byte *rectP = startP + 8; if (isSize == 1) { // Set size @@ -202,7 +202,7 @@ int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool is const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) v3 += READ_LE_UINT32(v3) + 16; - + const byte *v5 = v3 + 8; int result = (int16)READ_LE_UINT16(v5); if (isSize) @@ -215,7 +215,7 @@ int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool is const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) v3 += READ_LE_UINT32(v3) + 16; - + const byte *v5 = v3 + 10; int result = (int16)READ_LE_UINT16(v5); if (isSize) @@ -231,7 +231,7 @@ int ObjectsManager::getWidth(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - + return (int16)READ_LE_UINT16(rectP + 4); } @@ -242,7 +242,7 @@ int ObjectsManager::getHeight(const byte *objectData, int idx) { const byte *rectP = objectData + 3; for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - + return (int16)READ_LE_UINT16(rectP + 6); } @@ -262,7 +262,7 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn byte *ObjectsManager::DEL_FICHIER_OBJ() { _vm->_globals.NUM_FICHIER_OBJ = 0; _vm->_globals.ADR_FICHIER_OBJ = _vm->_globals.freeMemory(_vm->_globals.ADR_FICHIER_OBJ); - + return g_PTRNUL; } @@ -295,7 +295,7 @@ int ObjectsManager::AJOUTE_OBJET(int objIndex) { if (arrIndex == 32) flag = true; } while (!flag); - + _vm->_globals.INVENTAIRE[arrIndex] = objIndex; return arrIndex; } @@ -312,7 +312,7 @@ void ObjectsManager::AFF_SPRITES() { int v9; int v11; uint16 *v12; - int v13; + int v13; int y1_1; int y1_2; int v25; @@ -331,12 +331,12 @@ void ObjectsManager::AFF_SPRITES() { if (_vm->_fontManager._textList[idx]._enabledFl && _vm->_fontManager._text[idx]._textType != 2) { v1 = _vm->_fontManager._textList[idx]._pos.x; x1_1 = v1 - 2; - + if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) x1_1 = _vm->_graphicsManager.min_x; v2 = _vm->_fontManager._textList[idx]._pos.y; y1_1 = v2 - 2; - + if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) y1_1 = _vm->_graphicsManager.min_y; destX = v1 - 2; @@ -345,7 +345,7 @@ void ObjectsManager::AFF_SPRITES() { destY = v2 - 2; if (destY < _vm->_graphicsManager.min_y) destY = _vm->_graphicsManager.min_y; - + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_1, y1_1, _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, _vm->_graphicsManager.VESA_BUFFER, @@ -371,15 +371,15 @@ void ObjectsManager::AFF_SPRITES() { v9 = v7 - 2; if (v9 < _vm->_graphicsManager.min_y) v9 = _vm->_graphicsManager.min_y; - - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_2, y1_2, - _vm->_globals.Liste[idx].width + 4, _vm->_globals.Liste[idx].height + 4, + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_2, y1_2, + _vm->_globals.Liste[idx].width + 4, _vm->_globals.Liste[idx].height + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); _vm->_globals.Liste[idx].field0 = 0; } - } + } } - + AFF_BOB_ANIM(); AFF_VBOB(); @@ -392,19 +392,19 @@ void ObjectsManager::AFF_SPRITES() { if (Sprite[idx].field2A == 1) AvantTri(TRI_SPRITE, idx, Sprite[idx].field32 + Sprite[idx].field2E); } - } - + } + if (_vm->_globals.CACHEFLAG) VERIFCACHE(); } - + if (PRIORITY == 1 && _vm->_globals.NBTRI) { v33 = 1; do { arr[v33] = v33; ++v33; } while (v33 <= 48); - + v25 = _vm->_globals.NBTRI; do { v27 = 0; @@ -424,7 +424,7 @@ void ObjectsManager::AFF_SPRITES() { } while (v34 < v26); } } while (v27); - + v35 = 1; if (_vm->_globals.NBTRI + 1 > 1) { do { @@ -474,7 +474,7 @@ void ObjectsManager::AFF_SPRITES() { _vm->_globals.Tri[idx].priority = 0; _vm->_globals.Tri[idx].unused = 0; } - + _vm->_globals.NBTRI = 0; if (_vm->_dialogsManager._inventDisplayedFl) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); @@ -484,32 +484,32 @@ void ObjectsManager::AFF_SPRITES() { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, cadx + 300, cady + 300, cadi); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } - + if (SL_FLAG == true) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); if (SL_X && SL_Y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); - + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); } // If the Options dialog is activated, draw the elements if (_vm->_globals._optionDialogFl) { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 464, 407, 0); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 657, 556, _vm->_globals.opt_vitesse); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 495, _vm->_globals.opt_txt); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 468, _vm->_globals.opt_voice); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 441, _vm->_globals.opt_sound); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 414, _vm->_globals.opt_music); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals.opt_anm); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals.opt_scrspeed); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); } @@ -526,12 +526,12 @@ void ObjectsManager::AFF_SPRITES() { _vm->_fontManager._text[idx]._messageId, _vm->_fontManager._text[idx]._filename, _vm->_fontManager._text[idx]._pos.x, _vm->_fontManager._text[idx]._pos.y); _vm->_fontManager._textList[idx]._enabledFl = true; - + if ((_vm->_fontManager._text[idx]._textType < 2) || (_vm->_fontManager._text[idx]._textType > 3)) _vm->_fontManager._textList[idx]._pos.x = _vm->_eventsManager._startPos.x + _vm->_fontManager._text[idx]._pos.x; else _vm->_fontManager._textList[idx]._pos.x = _vm->_fontManager._text[idx]._pos.x; - + _vm->_fontManager._textList[idx]._pos.y = _vm->_fontManager._text[idx]._pos.y; _vm->_fontManager._textList[idx]._width = _vm->_fontManager._text[idx]._width; _vm->_fontManager._textList[idx]._height = _vm->_fontManager._text[idx]._height; @@ -551,7 +551,7 @@ void ObjectsManager::AFF_SPRITES() { _vm->_fontManager._textList[idx]._enabledFl = false; } } - + _vm->_dialogsManager.inventAnim(); } @@ -604,10 +604,10 @@ void ObjectsManager::DEF_BOB(int idx) { int yp = _vm->_globals.Bob[idx].oldY; if (_vm->_globals.Bob[idx].isSprite) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx].frameIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx].frameIndex, _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx].oldY2, _vm->_globals.Bob[idx].field38); @@ -615,7 +615,7 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx].field0 = 1; _vm->_globals.Liste2[idx].xp = xp; _vm->_globals.Liste2[idx].yp = yp; - + _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].oldWidth; _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].oldHeight; @@ -625,21 +625,21 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx].width -= _vm->_graphicsManager.min_x - v5; _vm->_globals.Liste2[idx].xp = v6; } - + int v7 = _vm->_globals.Liste2[idx].yp; int v8 = _vm->_graphicsManager.min_y; if (v7 < _vm->_graphicsManager.min_y) { _vm->_globals.Liste2[idx].height -= _vm->_graphicsManager.min_y - v7; _vm->_globals.Liste2[idx].yp = v8; } - + int v9 = _vm->_globals.Liste2[idx].xp; if (_vm->_globals.Liste2[idx].width + v9 > _vm->_graphicsManager.max_x) _vm->_globals.Liste2[idx].width = _vm->_graphicsManager.max_x - v9; int v10 = _vm->_globals.Liste2[idx].yp; if (_vm->_globals.Liste2[idx].height + v10 > _vm->_graphicsManager.max_y) _vm->_globals.Liste2[idx].height = _vm->_graphicsManager.max_y - v10; - + if (_vm->_globals.Liste2[idx].width <= 0 || _vm->_globals.Liste2[idx].height <= 0) _vm->_globals.Liste2[idx].field0 = 0; @@ -670,10 +670,10 @@ void ObjectsManager::BOB_VISU(int idx) { v9 = 1; if (!v6) v6 = -1; - + if ((int16)READ_LE_UINT16(data + 24)) { _vm->_globals.Bob[idx].isSprite = false; - + if (_vm->_globals.Bank[v1].fileHeader == 1) { _vm->_globals.Bob[idx].isSprite = true; _vm->_globals.Bob[idx].field36 = 0; @@ -726,7 +726,7 @@ void ObjectsManager::SCBOB(int idx) { int v4 =_vm->_globals.Cache[idx].field4; int v7 =_vm->_globals.Cache[idx].field6 + v3; int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; - + if ((v6 > v4) && (v6 < v1)) { v1 = 0; if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx].field6 + v3)) { @@ -764,7 +764,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Bob[idx].field38 = 0; _vm->_globals.Bob[idx].field36 = 0; } - + int result = _vm->_globals.Bob[idx].frameIndex; if (result != 250) { int v5, v15, v22; @@ -775,13 +775,13 @@ void ObjectsManager::CALCUL_BOB(int idx) { v22 = v15 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 0); v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 0); } - + int v17 = v5; int v6 = v5; int v21 = 0; int v20 = 0; int v7 = _vm->_globals.Bob[idx].field36; - + if (v7 < 0) { v7 = -v7; v20 = v7; @@ -808,7 +808,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { v17 = -_vm->_graphicsManager.Reel_Zoom(v9, v21); } } - + if (v20) { if (v15 >= 0) { v22 = _vm->_graphicsManager.Reel_Reduc(v15, v20); @@ -825,7 +825,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { v17 = -_vm->_graphicsManager.Reel_Reduc(v11, v20); } } - + int v13 = _vm->_globals.Bob[idx].xp - v22; int v14 = _vm->_globals.Bob[idx].yp - v17; _vm->_globals.Bob[idx].isActive = true; @@ -849,7 +849,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { height = _vm->_graphicsManager.Reel_Reduc(height, v20); width = _vm->_graphicsManager.Reel_Reduc(width, v20); } - + _vm->_globals.Liste2[idx].width = width; _vm->_globals.Liste2[idx].height = height; _vm->_globals.Bob[idx].oldWidth = width; @@ -862,11 +862,11 @@ void ObjectsManager::VERIFCACHE() { int v2; int v3; int v4; - int v5; - int v6; - int v7; - int v8; - int v9; + int v5; + int v6; + int v7; + int v8; + int v9; int v10; int v11; @@ -884,7 +884,7 @@ void ObjectsManager::VERIFCACHE() { v6 = _vm->_globals.Cache[v8].field0; v3 = _vm->_globals.Cache[v8].field4; v9 = _vm->_globals.Cache[v8].field6 + v6; - + if (v2 > v3) { if (v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + v3)) { v4 = 0; @@ -916,10 +916,10 @@ void ObjectsManager::VERIFCACHE() { } } } - + ++v10; } while (v10 <= 4); - + SCBOB(v8); if (_vm->_globals.Cache[v8].fieldA == v7) { if (_vm->_globals.Cache[v8].field10 == 1) { @@ -927,11 +927,11 @@ void ObjectsManager::VERIFCACHE() { _vm->_globals.Cache[v8].fieldA = 1; } } else { - v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + + v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + _vm->_globals.Cache[v8].field4; if (v5 > 440) v5 = 500; - + AvantTri(TRI_CACHE, v8, v5); _vm->_globals.Cache[v8].fieldA = 1; _vm->_globals.Cache[v8].field10 = 1; @@ -942,28 +942,28 @@ void ObjectsManager::VERIFCACHE() { } void ObjectsManager::DEF_SPRITE(int idx) { - int v2; + int v2; int v3; int v4; - int v5; - int v6; - int v7; - int v8; - int v9; + int v5; + int v6; + int v7; + int v8; + int v9; int v10; int v11; int v12; - int v13; + int v13; v2 = idx; if (Sprite[v2].field2A) { v3 = Sprite[v2].field2C; v4 = Sprite[v2].field2E; if (Sprite[v2].field28) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, v3 + 300, v4 + 300, Sprite[v2].spriteIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, v3 + 300, v4 + 300, Sprite[v2].spriteIndex, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); v5 = idx; @@ -972,7 +972,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[v5].height = Sprite[v6].field32; v7 = _vm->_globals.Liste[v5].field2; v8 = _vm->_graphicsManager.min_x; - + if (v7 < _vm->_graphicsManager.min_x) { _vm->_globals.Liste[v5].width -= _vm->_graphicsManager.min_x - v7; _vm->_globals.Liste[v5].field2 = v8; @@ -1007,9 +1007,9 @@ void ObjectsManager::DEF_CACHE(int idx) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.CACHE_BANQUE[1], _vm->_globals.Cache[idx].field0 + 300, _vm->_globals.Cache[idx].field4 + 300, _vm->_globals.Cache[idx].field2); - - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx].field0, - _vm->_globals.Cache[idx].field4, + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx].field0, + _vm->_globals.Cache[idx].field4, _vm->_globals.Cache[idx].field0 + _vm->_globals.Cache[idx].field6, _vm->_globals.Cache[idx].field4 + _vm->_globals.Cache[idx].field8); } @@ -1023,14 +1023,14 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int v6; int v7; int v8; - int v9; - int v10; - int v11; - int v12; - int v13; + int v9; + int v10; + int v11; + int v12; + int v13; int v15; int v16; - int v17; + int v17; int v22; Sprite[idx].field2A = 0; @@ -1047,13 +1047,13 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { v4 = Sprite[idx].field12 + v3; v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 0); } - + v9 = Sprite[idx].field14 + v6; v7 = v9; v8 = v9; int zoomPercent = 0; int reducePercent = 0; - + v9 = Sprite[idx].fieldC; if (v9 < 0) { v9 = -v9; @@ -1063,19 +1063,19 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } if (Sprite[idx].fieldC > 0) zoomPercent = Sprite[idx].fieldC; - + if (zoomPercent) { if (v4 >= 0) { v22 = _vm->_graphicsManager.Reel_Zoom(v4, zoomPercent); } else { v10 = v4; - + if (v4 < 0) v10 = -v4; v4 = v10; v22 = -_vm->_graphicsManager.Reel_Zoom(v10, zoomPercent); } - + if (v8 >= 0) { v7 = _vm->_graphicsManager.Reel_Zoom(v8, zoomPercent); } else { @@ -1105,7 +1105,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { v7 = -_vm->_graphicsManager.Reel_Reduc(v13, reducePercent); } } - + v15 = Sprite[idx].spritePos.x - v22; v16 = Sprite[idx].spritePos.y - v7; Sprite[idx].field2C = v15; @@ -1113,7 +1113,7 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { Sprite[idx].field2A = 1; Sprite[idx].field34 = zoomPercent; Sprite[idx].field36 = reducePercent; - + v17 = idx; _vm->_globals.Liste[v17].field0 = 1; _vm->_globals.Liste[v17].field2 = v15; @@ -1125,12 +1125,12 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { width = _vm->_graphicsManager.Reel_Zoom(width, zoomPercent); height = _vm->_graphicsManager.Reel_Zoom(height, zoomPercent); } - + if (reducePercent) { height = _vm->_graphicsManager.Reel_Reduc(height, reducePercent); width = _vm->_graphicsManager.Reel_Reduc(width, reducePercent); } - + Sprite[idx].field30 = width; Sprite[idx].field32 = height; } @@ -1143,12 +1143,12 @@ int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { ++_vm->_globals.NBTRI; if (_vm->_globals.NBTRI > 48) error("NBTRI too high"); - + result = _vm->_globals.NBTRI; _vm->_globals.Tri[result].triMode = triMode; _vm->_globals.Tri[result].index = index; _vm->_globals.Tri[result].priority = priority; - + return result; } @@ -1162,14 +1162,14 @@ void ObjectsManager::AFF_BOB_ANIM() { int v8; int v10; int v11; - int v12; - int v13; + int v12; + int v13; int v14; int v18; int v19; - byte *v20; - byte *v21; - int v22; + byte *v20; + byte *v21; + int v22; int v24; int v26; int v27; @@ -1182,7 +1182,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field1C = 0; continue; } - + if (_vm->_globals.Bob[idx].field0 == 10) { _vm->_globals.Bob[idx].field1C = 0; v1 = _vm->_globals.Bob[idx].field20; @@ -1190,7 +1190,7 @@ void ObjectsManager::AFF_BOB_ANIM() { v1 = 50; if (_vm->_globals.Bob[idx].animData == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) goto LABEL_38; - + v2 = _vm->_globals.Bob[idx].field14; if (_vm->_globals.Bob[idx].field12 == v2) { _vm->_globals.Bob[idx].field1C = 1; @@ -1198,10 +1198,10 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field14 = v2 + 1; _vm->_globals.Bob[idx].field1C = 0; } - + if (_vm->_globals.Bob[idx].field1C != 1) goto LABEL_38; - + v20 = _vm->_globals.Bob[idx].animData + 20; v24 = _vm->_globals.Bob[idx].field10; _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v20 + 2 * v24); @@ -1209,7 +1209,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == true && idx > 20 ) _vm->_globals.Bob[idx].xp += _vm->_eventsManager._startPos.x; - + _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); @@ -1217,7 +1217,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field38 = *(v20 + 2 * v24 + 9); _vm->_globals.Bob[idx].field10 += 5; v5 = _vm->_globals.Bob[idx].field12; - + if (v5 > 0) { v6 = v5 / _vm->_globals.vitesse; _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals.vitesse; @@ -1226,12 +1226,12 @@ LABEL_37: _vm->_globals.Bob[idx].field14 = 1; LABEL_38: v12 = idx; - + if ((unsigned int)(_vm->_globals.Bob[v12].field1E - 1) <= 1u) _vm->_globals.Bob[v12].field1C = 1; continue; } - + _vm->_globals.Bob[idx].field12 = 1; } if (!_vm->_globals.Bob[idx].field12) { @@ -1245,7 +1245,7 @@ LABEL_38: _vm->_globals.Bob[idx].field10 = 0; v21 = _vm->_globals.Bob[idx].animData + 20; _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v21); - + if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == true && idx > 20) @@ -1258,7 +1258,7 @@ LABEL_38: _vm->_globals.Bob[idx].field38 = *(v21 + 9); _vm->_globals.Bob[idx].field10 += 5; v10 = _vm->_globals.Bob[idx].field12; - + if (v10 > 0) { v11 = v10 / _vm->_globals.vitesse; _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals.vitesse; @@ -1268,7 +1268,7 @@ LABEL_38: } } } - + goto LABEL_37; } } while (idx != 35); @@ -1282,17 +1282,17 @@ LABEL_38: ++v26; } while (v26 != 35); } - + BOBTOUS = false; v27 = 0; - + do { ++v27; if (v27 > 20 || PERSO_ON != true) { if (_vm->_globals.Bob[v27].field0 == 10) { if (_vm->_globals.Bob[v27].field1C == 1) { v14 = _vm->_globals.Bob[v27].field1E; - + if (v14 != 2) { if (v14 != 4) { if (_vm->_globals.Liste2[v27].field0) { @@ -1307,7 +1307,7 @@ LABEL_38: } } } - + v22 = v27; if (_vm->_globals.Bob[v22].field0 == 11) { if (_vm->_globals.Liste2[v27].field0) { @@ -1318,12 +1318,12 @@ LABEL_38: _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp); _vm->_globals.Liste2[v27].field0 = 0; } - + _vm->_globals.Bob[v22].field0 = 0; } } } while (v27 != 35); - + v28 = 0; do { ++v28; @@ -1333,7 +1333,7 @@ LABEL_38: CALCUL_BOB(v28); int v = _vm->_globals.Bob[v18].oldHeight + _vm->_globals.Bob[v18].oldY; v19 = _vm->_globals.Bob[v18].oldX2 + v; - + if (v19 > 450) v19 = 600; @@ -1345,18 +1345,18 @@ LABEL_38: // Display VBOB void ObjectsManager::AFF_VBOB() { - int width, height; + int width, height; int idx = 0; do { if (_vm->_globals.VBob[idx].field4 == 4) { width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, + + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, width, height); - + _vm->_graphicsManager.Restore_Mem( _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, @@ -1365,9 +1365,9 @@ void ObjectsManager::AFF_VBOB() { _vm->_graphicsManager.Ajoute_Segment_Vesa( _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, _vm->_globals.VBob[idx].xp + width, height + _vm->_globals.VBob[idx].yp); - + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); - + _vm->_globals.VBob[idx].field4 = 0; _vm->_globals.VBob[idx].spriteData = g_PTRNUL; _vm->_globals.VBob[idx].xp = 0; @@ -1382,25 +1382,25 @@ void ObjectsManager::AFF_VBOB() { if (_vm->_globals.VBob[idx].field4 == 3) { width = getWidth(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); height = getHeight(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); - + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, _vm->_globals.VBob[idx].oldY, width, height); - + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, _vm->_globals.VBob[idx].oldY, width, height); - + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].oldX, _vm->_globals.VBob[idx].oldY, _vm->_globals.VBob[idx].oldX + width, _vm->_globals.VBob[idx].oldY + height); - + _vm->_globals.VBob[idx].field4 = 1; _vm->_globals.VBob[idx].oldSpriteData = _vm->_globals.VBob[idx].spriteData; - + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); - + _vm->_globals.VBob[idx].oldX = _vm->_globals.VBob[idx].xp; _vm->_globals.VBob[idx].oldY = _vm->_globals.VBob[idx].yp; _vm->_globals.VBob[idx].oldFrameIndex = _vm->_globals.VBob[idx].frameIndex; @@ -1409,22 +1409,22 @@ void ObjectsManager::AFF_VBOB() { if (_vm->_globals.VBob[idx].field4 == 1) { width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - + _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); - + byte *surface = _vm->_globals.allocMemory(height * width); _vm->_globals.VBob[idx].surface = surface; - - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, width, height); - + byte *v10 = _vm->_globals.VBob[idx].spriteData; if (*v10 == 78) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_SCREEN, v10, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_SCREEN, v10, _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, _vm->_globals.VBob[idx].frameIndex, 0, 0, 0); - + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, @@ -1434,12 +1434,12 @@ void ObjectsManager::AFF_VBOB() { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, v10, _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, _vm->_globals.VBob[idx].frameIndex); - + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, _vm->_globals.VBob[idx].frameIndex); } - + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp , _vm->_globals.VBob[idx].xp + width, _vm->_globals.VBob[idx].yp + height); @@ -1491,7 +1491,7 @@ void ObjectsManager::CLEAR_SPR() { void ObjectsManager::SPRITE_ON(int idx) { if (idx > 5) error("Attempt to display a sprite > MAX_SPRITE."); - + Sprite[idx].field0 = 1; } @@ -1595,7 +1595,7 @@ void ObjectsManager::SETYSPR(int idx, int yp) { void ObjectsManager::SETTAILLESPR(int idx, int a2) { if (idx > 5) error("Set the Coord. there a sprite> MAX_SPRITE."); - + if (Sprite[idx].field28 != 1) Sprite[idx].fieldC = a2; } @@ -1610,7 +1610,7 @@ void ObjectsManager::SETFLIPSPR(int idx, int a2) { void ObjectsManager::VERIFZONE() { int v0; - int v1; + int v1; int v2; uint16 v3; int v4; @@ -1678,7 +1678,7 @@ LABEL_54: _vm->_globals.force_to_data_0 += 25; if (_vm->_globals.force_to_data_0 > 100) _vm->_globals.force_to_data_0 = 0; - _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, + _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0); if (_vm->_eventsManager._mouseCursorId == 4) { v1 = 5 * v4; @@ -1715,60 +1715,60 @@ LABEL_54: } void ObjectsManager::GOHOME() { - int16 v0; - int16 v1; - int16 v3; - int16 v4; + int16 v0; + int16 v1; + int16 v3; + int16 v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; - int16 v9; + int16 v9; int16 v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; - int v15; - int16 v16; - unsigned int v17; - unsigned int v18; - int v19; - int16 v20; - unsigned int v21; - unsigned int v22; - int16 v23; - int16 v24; - unsigned int v25; - unsigned int v26; - unsigned int v27; - unsigned int v28; - int16 v29; - int16 v30; + int v15; + int16 v16; + unsigned int v17; + unsigned int v18; + int v19; + int16 v20; + unsigned int v21; + unsigned int v22; + int16 v23; + int16 v24; + unsigned int v25; + unsigned int v26; + unsigned int v27; + unsigned int v28; + int16 v29; + int16 v30; unsigned int v31; unsigned int v32; unsigned int v33; - unsigned int v34; + unsigned int v34; int16 v35; int16 v36; unsigned int v37; unsigned int v38; unsigned int v39; unsigned int v40; - int16 v41; - int16 v42; + int16 v41; + int16 v42; unsigned int v43; unsigned int v44; unsigned int v45; unsigned int v46; int16 v47; - int16 v48; - int16 v49; - int v50; + int16 v48; + int16 v49; + int v50; int16 v51; int16 v52; int16 v54; - int v55; + int v55; int16 v56; int16 v57; int16 v58; @@ -2250,7 +2250,7 @@ LABEL_153: } void ObjectsManager::GOHOME2() { - int16 v2; + int16 v2; if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { int v0 = 2; @@ -2289,7 +2289,7 @@ void ObjectsManager::GOHOME2() { SETANISPR(0, 2); if (_vm->_globals.last_sens == 7) SETANISPR(0, 3); - + _vm->_globals.chemin = (int16 *)g_PTRNUL; my_anim = 0; A_ANIM = 0; @@ -2316,10 +2316,10 @@ LABEL_19: // Load Obstacle void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { - int16 v1; - byte *ptr; - int16 v4; - int16 v5; + int16 v1; + byte *ptr; + int16 v4; + int16 v5; _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager.TOTAL_LIGNES = 0; @@ -2350,24 +2350,24 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { // Load Zone void ObjectsManager::CHARGE_ZONE(const Common::String &file) { - signed int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - int16 v7; - int v8; - byte *v9; - int v10; - signed int v11; - int v12; - byte *v13; - int v14; - signed int v15; - int16 v17; - int16 v18; - byte *ptr; + signed int v1; + int v2; + int v3; + int v4; + int v5; + int v6; + int16 v7; + int v8; + byte *v9; + int v10; + signed int v11; + int v12; + byte *v13; + int v14; + signed int v15; + int16 v17; + int16 v18; + byte *ptr; v1 = 1; do { @@ -2391,7 +2391,7 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { } while (v1 <= 100); _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); - + Common::File f; if (!f.exists(_vm->_globals.NFICHIER)) error("File not found : %s", _vm->_globals.NFICHIER.c_str()); @@ -2463,14 +2463,14 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { // Square Zone void ObjectsManager::CARRE_ZONE() { int16 *dataP; - int v4; - int v5; - int v7; - int v8; - int v10; - int v11; - int v12; - int v13; + int v4; + int v5; + int v7; + int v8; + int v10; + int v11; + int v12; + int v13; int v14; for (int idx = 0; idx < 100; ++idx) { @@ -2571,7 +2571,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.CACHE_OFF(19); _vm->_globals.CACHE_OFF(20); _vm->_globals.CACHE_ON(); - + if (!_vm->_globals.PLANX && !_vm->_globals.PLANY) { _vm->_globals.PLANX = 900; _vm->_globals.PLANY = 319; @@ -2591,19 +2591,19 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_globals.BPP_NOAFF = true; - + v4 = 0; do { _vm->_eventsManager.VBL(); ++v4; } while (v4 <= 4); - + _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; _vm->_graphicsManager.FADE_INW(); _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager.NOFADE = false; - + do { v5 = _vm->_eventsManager.getMouseButton(); if (v5) { @@ -2625,14 +2625,14 @@ void ObjectsManager::PLAN_BETA() { if (v5 == 1) BTGAUCHE(); } - + VERIFZONE(); GOHOME2(); - + if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION == 1) PARADISE(); _vm->_eventsManager.VBL(); - + if (_vm->_globals.SORTIE) v1 = 1; } while (!_vm->shouldQuit() && v1 != 1); @@ -2650,7 +2650,7 @@ void ObjectsManager::PLAN_BETA() { CLEAR_ECRAN(); _vm->_globals.NOSPRECRAN = false; _vm->_globals.PLAN_FLAG = false; -} +} // Left Button void ObjectsManager::BTGAUCHE() { @@ -2658,18 +2658,18 @@ void ObjectsManager::BTGAUCHE() { int destX, destY; int v1; int v2; - int16 *v3; - int16 *v4; - int16 *v5; - int zoneCount; + int16 *v3; + int16 *v4; + int16 *v5; + int zoneCount; int zoneX; int zoneY; - int16 *v9; + int16 *v9; int v10; int v11; int v12; - int16 *v13; - int16 *v16; + int16 *v13; + int16 *v16; int v17; int v18; @@ -2833,8 +2833,8 @@ LABEL_65: ARRET_PERSO_FLAG = 1; ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField132] == 1 - && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 + if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField132] == 1 + && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2846,8 +2846,8 @@ LABEL_65: void ObjectsManager::PARADISE() { int v1; char result; - int v3; - int v5; + int v3; + int v5; v1 = 0; ARRET_PERSO_FLAG = 0; @@ -3013,7 +3013,7 @@ void ObjectsManager::CLEAR_ECRAN() { // Change Face/Head void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { - CharacterLocation *loc; + CharacterLocation *loc; CH_TETE = 1; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, 532, 25, 65, 40, _vm->_graphicsManager.VESA_BUFFER, 532, 25); @@ -3021,7 +3021,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS + if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals.SAUVEGARDE->realHopkins.location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->samantha; @@ -3048,7 +3048,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); - } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA + } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->realHopkins; @@ -3057,7 +3057,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->field2 = 64; loc->location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; - + SPRITE_OFF(1); SPRITE(_vm->_globals.TETE, loc->xp, loc->yp, 1, 2, loc->field4, 0, 34, 190); SPRITE_ON(1); @@ -3153,9 +3153,9 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { int v4; int v5; int v6; - int v7; - int v8; - int v9; + int v7; + int v8; + int v9; int v10; int v11; int v12; @@ -3230,59 +3230,59 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v10; int v11; int v12; - int v13; - int v14; - int v15; + int v13; + int v14; + int v15; int v16; - int v17; - int v18; - int v19; + int v17; + int v18; + int v19; int v20; - int v21; + int v21; int16 *result; int v23; - int v24; - int v25; + int v24; + int v25; int v26; - int v27; + int v27; int v28; int v29; - int v30; - int v31; - int v32; + int v30; + int v31; + int v32; int16 *v33; - int v34; - int v35; - int i; - int16 *v37; - int v39; + int v34; + int v35; + int i; + int16 *v37; + int v39; int v40; - int16 *v41; - int v43; + int16 *v41; + int v43; int k; - int16 *v45; - int v47; - int v48; + int16 *v45; + int v47; + int v48; int v49; - int16 *v50; - int v52; + int16 *v50; + int v52; int v53; - int16 *v54; - int v56; + int16 *v54; + int v56; int v57; - int16 *v58; - int v60; - int v61; + int16 *v58; + int v60; + int v61; int v62; int v63; int v64; int v65; - int v66; - int v67; - int v68; - int v69; - int j; - int l; + int v66; + int v67; + int v68; + int v69; + int j; + int l; int v72; int v73; int v74; @@ -3808,19 +3808,19 @@ int ObjectsManager::MZONE() { signed int result; int16 v1; int16 v2; - int v3; + int v3; int16 v4; int16 v5; - int v6; + int v6; int16 v7; - int v8; - int v9; + int v8; + int v9; int16 yCurrent; int16 v11; - int16 j; - int16 k; - int16 xCurrent; - int v15; + int16 j; + int16 k; + int16 xCurrent; + int v15; int16 v16; int16 v17; int16 v18; @@ -4097,7 +4097,7 @@ void ObjectsManager::VALID_OBJET(int a1) { } void ObjectsManager::OPTI_OBJET() { - byte *data; + byte *data; Common::String file; int v0 = 1; int v5; @@ -4109,7 +4109,7 @@ void ObjectsManager::OPTI_OBJET() { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); data = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); } - + if ((data == g_PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { error("Not an INI file"); } else { @@ -4195,7 +4195,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NECESSAIRE = true; _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; - + _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); @@ -4272,8 +4272,8 @@ void ObjectsManager::SPECIAL_JEU() { void ObjectsManager::BOB_VIVANT(int idx) { int v1; int v2; - int v3; - int v4; + int v3; + int v4; v1 = 5 * idx; v2 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); @@ -4281,8 +4281,8 @@ void ObjectsManager::BOB_VIVANT(int idx) { v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, - _vm->_graphicsManager.ofscroll + v2, v3, + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, + _vm->_graphicsManager.ofscroll + v2, v3, *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); if (_vm->_globals.NO_OFFSET) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, v2, v3, v4); @@ -4292,7 +4292,7 @@ void ObjectsManager::BOB_VIVANT(int idx) { void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { if (idx > 29) error("MAX_VBOB exceeded"); - + if (_vm->_globals.VBob[idx].field4 <= 1) { _vm->_globals.VBob[idx].field4 = 1; _vm->_globals.VBob[idx].xp = xp; @@ -4305,7 +4305,7 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { _vm->_globals.VBob[idx].oldSpriteData = src; _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); } - + int f4 = _vm->_globals.VBob[idx].field4; if (f4 == 2 || f4 == 4) { _vm->_globals.VBob[idx].field4 = 3; @@ -4323,7 +4323,7 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { void ObjectsManager::VBOB_OFF(int idx) { if (idx > 29) error("MAX_VBOB exceeded"); - + if (_vm->_globals.VBob[idx].field4 <= 1) _vm->_globals.VBob[idx].field4 = 0; else @@ -4529,7 +4529,7 @@ void ObjectsManager::OPTI_ONE(int idx, int a2, int a3, int a4) { if (!a4) BOBANIM_OFF(idx); if (a4 == 4) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.Bob[idx].spriteData, + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].oldX, _vm->_globals.Bob[idx].oldY, _vm->_globals.Bob[idx].frameIndex); BOBANIM_OFF(idx); _vm->_eventsManager.VBL(); @@ -4585,8 +4585,8 @@ int ObjectsManager::BOBA(int idx) { void ObjectsManager::INILINK(const Common::String &file) { int v1; int v2; - int v8; - int v9; + int v8; + int v9; int v10; int v11; int v12; @@ -4618,7 +4618,7 @@ void ObjectsManager::INILINK(const Common::String &file) { size_t v41; size_t v42; size_t nbytes; - byte *ptr; + byte *ptr; Common::String filename, filename2; Common::File f; @@ -4630,7 +4630,7 @@ void ObjectsManager::INILINK(const Common::String &file) { nbytes = _vm->_globals.CAT_TAILLE; if (ptr == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); - + if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); @@ -4646,11 +4646,11 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.STAILLE[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx); _vm->_globals.RESET_CACHE(); - + filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); - + if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename2); @@ -4676,7 +4676,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.Cache[v11].field0 = v9; _vm->_globals.Cache[v11].field4 = v10; _vm->_globals.Cache[v11].field12 = 1; - + if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[v40].fieldA = 0; } else { @@ -4689,7 +4689,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.Cache[v40].field8 = v15; _vm->_globals.Cache[v40].fieldA = 1; } - if (!_vm->_globals.Cache[v40].field0 && !_vm->_globals.Cache[v40].field4 + if (!_vm->_globals.Cache[v40].field0 && !_vm->_globals.Cache[v40].field4 && !_vm->_globals.Cache[v40].field2) _vm->_globals.Cache[v40].fieldA = 0; @@ -4814,16 +4814,16 @@ void ObjectsManager::INILINK(const Common::String &file) { } while (nbytes > v42); } } - _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory(ptr); } void ObjectsManager::SPECIAL_INI(const Common::String &a1) { - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; if (_vm->_globals.ECRAN == 73 && !_vm->_globals.SAUVEGARDE->data[svField318]) { _vm->_globals.CACHE_SUB(0); @@ -5086,10 +5086,10 @@ void ObjectsManager::VERBE_ON(int idx, int a2) { } int ObjectsManager::CALC_PROPRE(int idx) { - int v1; - int v2; - int v3; - int v4; + int v1; + int v2; + int v3; + int v4; v1 = 25; v2 = _vm->_globals.STAILLE[idx]; @@ -5164,19 +5164,19 @@ int ObjectsManager::colision(int xp, int yp) { } void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6) { - int v6; - int v7; - char v8; - int v9; - int v10; - int v11; - int v13; - const byte *v14; - char v15; - int v16; - int spriteIndex; - int v18; - Common::String v19; + int v6; + int v7; + char v8; + int v9; + int v10; + int v11; + int v13; + const byte *v14; + char v15; + int v16; + int spriteIndex; + int v18; + Common::String v19; v18 = 0; v6 = 0; @@ -5237,14 +5237,14 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6) { - int v6; - char v8; - int v9; - int16 v10; - int v11; - int spriteIndex; - char v14; - Common::String v16; + int v6; + char v8; + int v9; + int16 v10; + int v11; + int spriteIndex; + char v14; + Common::String v16; v6 = 0; spriteIndex = 0; @@ -5300,16 +5300,16 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int } void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { - int v5; - int v6; - char v7; - int v8; - int v9; - int v10; - int spriteIndex; - int v13; - int v14; - Common::String v15; + int v5; + int v6; + char v7; + int v8; + int v9; + int v10; + int spriteIndex; + int v13; + int v14; + Common::String v15; int v16; v14 = 0; @@ -5365,8 +5365,8 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a } void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) { - signed int v6; - char v7; + signed int v6; + char v7; v6 = a1; if (_vm->_globals.ECRAN == a1) { @@ -5467,13 +5467,13 @@ void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { _vm->_globals.BL_ANIM[idx].v2 = a2; } -void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, +void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v) { - int v5; - int v6; - int v7; - int v8; - int v9; + int v5; + int v6; + int v7; + int v8; + int v9; v5 = 0; _vm->_dialogsManager._inventFl = false; @@ -5570,7 +5570,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.iRegul = 0; } -void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, +void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v) { int mouseButtons; bool breakFlag; @@ -5665,8 +5665,8 @@ LABEL_70: _vm->_graphicsManager.NOFADE = false; _vm->_eventsManager.changeMouseCursor(4); - int xCheck = 0; - int yCheck = 0; + int xCheck = 0; + int yCheck = 0; breakFlag = false; while (!_vm->shouldQuit() && !breakFlag) { @@ -5696,7 +5696,7 @@ LABEL_70: if (!_vm->_globals.SORTIE) { _vm->_dialogsManager.testDialogOpening(); VERIFZONE(); - if (_vm->_globals.chemin == (int16 *)g_PTRNUL + if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { if (_vm->_globals.GOACTION == 1) PARADISE(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7b00a2db45..10e0265e20 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -73,7 +73,7 @@ public: byte *SL_SPR; byte *SL_SPR2; byte *sprite_ptr; - const byte *S_old_spr; + const byte *S_old_spr; bool PERSO_ON; bool SL_FLAG; int SL_MODE; @@ -112,7 +112,7 @@ public: int OBSSEUL; int NVVERBE; int NVZONE; - int S_old_ani; + int S_old_ani; int S_old_ret; int nouveau_x, nouveau_y; int nouveau_sens; @@ -188,7 +188,7 @@ public: void BTGAUCHE(); void PARADISE(); void CLEAR_ECRAN(); - + /** * Change the currently active player * @param oldCharacter Previously played character @@ -247,13 +247,13 @@ public: /** * Game scene control method */ - void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, + void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v); /** * Game scene control method */ - void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, + void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v); }; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 5eab0c05bf..a7771cd97d 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -49,7 +49,7 @@ bool SaveLoadManager::bsave(const Common::String &file, const void *buf, size_t delete f; return bytesWritten == n; - } else + } else return false; } @@ -62,7 +62,7 @@ void SaveLoadManager::initSaves() { Common::String dataFilename = "HISCORE.DAT"; byte data[100]; Common::fill(&data[0], &data[100], 0); - + SAUVE_FICHIER(dataFilename, data, 100); } @@ -195,7 +195,7 @@ Common::Error SaveLoadManager::restore(int slot) { delete saveFile; // Unpack the inventory - for (int i = 0; i < 35; ++i) + for (int i = 0; i < 35; ++i) _vm->_globals.INVENTAIRE[i] = _vm->_globals.SAUVEGARDE->inventory[i]; // Set variables from loaded data as necessary @@ -223,16 +223,16 @@ bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header void SaveLoadManager::createThumbnail(Graphics::Surface *s) { int w = _vm->_graphicsManager.Reel_Reduc(SCREEN_WIDTH, REDUCE_AMOUNT); - int h = _vm->_graphicsManager.Reel_Reduc(SCREEN_HEIGHT - 40, REDUCE_AMOUNT); + int h = _vm->_graphicsManager.Reel_Reduc(SCREEN_HEIGHT - 40, REDUCE_AMOUNT); Graphics::Surface thumb8; thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)thumb8.pixels, + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)thumb8.pixels, _vm->_eventsManager._startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); // Convert the 8-bit pixel to 16 bit surface - s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); const byte *srcP = (const byte *)thumb8.pixels; uint16 *destP = (uint16 *)s->pixels; @@ -294,7 +294,7 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) { byte rCurrent, gCurrent, bCurrent; pixelFormat16.colorToRGB(palette[palIndex], rCurrent, gCurrent, bCurrent); - + int diff = ABS((int)r - (int)rCurrent) + ABS((int)g - (int)gCurrent) + ABS((int)b - (int)bCurrent); if (diff < difference) { difference = diff; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 84ae0443cd..c56637979b 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -215,7 +215,7 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 && _vm->_globals.SAUVEGARDE->cloneHopkins.xp && _vm->_globals.SAUVEGARDE->cloneHopkins.yp && _vm->_globals.SAUVEGARDE->cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->cloneHopkins.location) { - + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->cloneHopkins.xp; _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->cloneHopkins.yp; _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->cloneHopkins.field2; @@ -235,7 +235,7 @@ LABEL_1141: _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->realHopkins.field2; } } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 + if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && _vm->_globals.SAUVEGARDE->realHopkins.location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, @@ -700,7 +700,7 @@ LABEL_1141: _vm->_graphicsManager.FIN_VISU(); _vm->_objectsManager.CLEAR_ECRAN(); - if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { + if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { _vm->_graphicsManager.FADE_OUTW(); } else { _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); @@ -729,7 +729,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(3) != 100); _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); _vm->_graphicsManager.FIN_VISU(); - + // If uncensored, rip the throat of the hostage if (!_vm->_globals.CENSURE) { _vm->_soundManager.SPECIAL_SOUND = 16; @@ -2306,7 +2306,7 @@ LABEL_1141: } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { int v60 = (int16)READ_LE_UINT16(a1 + 5); - + Common::String file = Common::String::format("SOUND%d.WAV", v60); _vm->_soundManager.PLAY_SOUND(file); v1 = 1; @@ -2328,24 +2328,24 @@ int ScriptManager::Control_Goto(const byte *dataP) { } int ScriptManager::Control_If(const byte *dataP, int a2) { - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - const byte *v8; - int v9; - int v10; - int v11; - int v12; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; - int v20; + int v2; + int v3; + int v4; + int v5; + int v6; + int v7; + const byte *v8; + int v9; + int v10; + int v11; + int v12; + int v14; + int v15; + int v16; + int v17; + int v18; + int v19; + int v20; v2 = a2; LABEL_2: @@ -2445,7 +2445,7 @@ LABEL_63: } int ScriptManager::Traduction2(const byte *dataP) { - int16 result; + int16 result; result = 0; if (*dataP != 'F' || *(dataP + 1) != 'C') { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 01a977cfe4..209215bba6 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -334,7 +334,7 @@ void SoundManager::WSOUND_OFF() { for (int i = 1; i <= 48; ++i) DEL_SAMPLE_SDL(i); - + if (MOD_FLAG) { STOP_MUSIC(); DEL_MUSIC(); @@ -450,12 +450,12 @@ void SoundManager::checkMusic() { if (mwavIndex == -1) { Music._currentIndex = 0; mwavIndex = Music._mwavIndexes[Music._currentIndex]; - } + } int volume = MUSICVOL * 255 / 16; Mwav[mwavIndex]._audioStream->rewind(); - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, Mwav[mwavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); } } @@ -501,9 +501,9 @@ void SoundManager::DEL_MSAMPLE(int mwavIndex) { } bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { - int fileNumber; - int oldMusicVol; - bool breakFlag; + int fileNumber; + int oldMusicVol; + bool breakFlag; Common::String prefix; Common::String filename; Common::File f; @@ -553,7 +553,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { || voiceId == 632 || voiceId == 645)) fileNumber = 684; - + if ((unsigned int)(voiceMode - 1) <= 1) { prefix = "DF"; } @@ -568,7 +568,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { } filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); - + if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { if (_vm->_globals.FR == 1) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); @@ -589,7 +589,7 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { catPos = _vm->_globals.CAT_POSI; catLen = _vm->_globals.CAT_TAILLE; - } else { + } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".WAV"); if (!f.exists(_vm->_globals.NFICHIER)) { _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".APC"); @@ -751,7 +751,7 @@ void SoundManager::SDL_LVOICE(size_t filePosition, size_t entryLength) { Swav[20]._active = true; } - + void SoundManager::PLAY_VOICE_SDL() { if (!Swav[20]._active) error("Bad handle"); @@ -836,12 +836,12 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { Voice[voiceIndex]._status = 1; Voice[voiceIndex].field14 = 4; Voice[voiceIndex]._wavIndex = wavIndex; - + int volume = (voiceIndex == 2) ? VOICEVOL * 255 / 16 : SOUNDVOL * 255 / 16; // Start the voice playing Swav[wavIndex]._audioStream->rewind(); - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, Swav[wavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); } @@ -889,9 +889,9 @@ void SoundManager::updateScummVMSoundSettings() { Audio::RewindableAudioStream *SoundManager::makeSoundStream(Common::SeekableReadStream *stream) { if (_vm->getPlatform() == Common::kPlatformWindows) - return Audio::makeAPCStream(stream, DisposeAfterUse::YES); + return Audio::makeAPCStream(stream, DisposeAfterUse::YES); else - return Audio::makeWAVStream(stream, DisposeAfterUse::YES); + return Audio::makeWAVStream(stream, DisposeAfterUse::YES); } // Blatant rip from gob engine. Hi DrMcCoy! diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 206bea89e3..8a151531b2 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -164,7 +164,7 @@ public: void PLAY_SAMPLE(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); void PLAY_WAV(int wavIndex); - + void syncSoundSettings(); void updateScummVMSoundSettings(); void checkSounds(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ed41e34c0f..dbb621c0dd 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -50,19 +50,19 @@ void TalkManager::setParent(HopkinsEngine *vm) { } void TalkManager::PARLER_PERSO(const Common::String &filename) { - int v2; - int v3; - int v4; + int v2; + int v3; + int v4; int v5; int v6; int v7; - byte *v8; - byte *v9; + byte *v8; + byte *v9; byte *v10; int v11; int v14; int v15; - Common::String v16; + Common::String v16; v15 = 0; _vm->_fontManager.hideText(5); @@ -118,7 +118,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { ANIM_PERSO_INIT(); PLIGNE1 = v2; PLIGNE2 = v2 + 1; - PLIGNE3 = v2 + 2; + PLIGNE3 = v2 + 2; PLIGNE4 = v2 + 3; v14 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; @@ -153,7 +153,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_objectsManager.PERSO_ON = false; _vm->_eventsManager._mouseCursorId = v14; - + _vm->_eventsManager.changeMouseCursor(v14); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -237,7 +237,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { int v8 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); - + if (!_vm->_globals.NOPARLE) { int v2 = v1 + 3; int v3; @@ -274,7 +274,7 @@ void TalkManager::RENVOIE_FICHIER(int srcStart, Common::String &dest, const char } int TalkManager::DIALOGUE() { - byte *v0; + byte *v0; int v1; int v2; int v3; @@ -285,13 +285,13 @@ int TalkManager::DIALOGUE() { int v8; int v9; int v10; - byte *v11; + byte *v11; int v12; int v13; int v14; int v15; int v16; - int v18; + int v18; int v19; int v20; int v21; @@ -312,7 +312,7 @@ int TalkManager::DIALOGUE() { } else { VISU_WAIT(); } - + v19 = VERIF_BOITE(PLIGNE1, FQUEST, 65); v2 = VERIF_BOITE(PLIGNE2, FQUEST, 65); v3 = VERIF_BOITE(PLIGNE3, FQUEST, 65); @@ -355,20 +355,20 @@ int TalkManager::DIALOGUE() { _vm->_fontManager.setOptimalColor(5, 6, 7, 8); v5 = PLIGNE4; } - + _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) v6 = 1; if (v5 == -1) v6 = 0; } while (!_vm->shouldQuit() && v6 != 1); - + _vm->_soundManager.VOICE_MIX(v5, 1); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(6); _vm->_fontManager.hideText(7); _vm->_fontManager.hideText(8); - + if (STATI) { v11 = BUFFERPERSO; v12 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); @@ -389,7 +389,7 @@ int TalkManager::DIALOGUE() { } else { FIN_VISU_WAIT(); } - + _vm->_eventsManager.VBL(); return v5; } @@ -398,28 +398,28 @@ int TalkManager::DIALOGUE_REP(int idx) { int v1; int v2; byte *v3; - int i; + int i; int v6; int v7; byte *v8; - int v9; + int v9; int v10; int v11; int v12; int v13; int v14; void *v15; - int v16; - int v17; - int v18; - int v19; - int v20; - int v21; - int v22; - int v23; - int v24; - int v25; - + int v16; + int v17; + int v18; + int v19; + int v20; + int v21; + int v22; + int v23; + int v24; + int v25; + v1 = 0; v2 = 0; v3 = BUFFERPERSO + 110; @@ -444,7 +444,7 @@ int TalkManager::DIALOGUE_REP(int idx) { PLIGNE3 = (int16)READ_LE_UINT16((uint16 *)v3 + 7); v6 = (int16)READ_LE_UINT16((uint16 *)v3 + 8); v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9); - + if (v7) _vm->_globals.SAUVEGARDE->data[svField4] = v7; @@ -535,16 +535,16 @@ int TalkManager::DIALOGUE_REP(int idx) { void TalkManager::CHERCHE_PAL(int a1, int a2) { int v2; - size_t v4; + size_t v4; unsigned int v5; - byte *palette; - int v8; + byte *palette; + int v8; v2 = 0; v8 = 0; v4 = a1; for (;;) { - if ( *(BUFFERPERSO + v4) == 'P' + if ( *(BUFFERPERSO + v4) == 'P' && *(BUFFERPERSO + v4 + 1) == 'A' && *(BUFFERPERSO + v4 + 2) == 'L') { v8 = 1; @@ -556,7 +556,7 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { if (TAILLEPERSO == v4) return; } - + v5 = v2 + 5; palette = BUFFERPERSO + v5; PALPERSO = BUFFERPERSO + v5; @@ -588,7 +588,7 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { *(palette + 763) = 0; *(palette + 764) = 0; } - + _vm->_graphicsManager.setpal_vga256(palette); _vm->_graphicsManager.INIT_TABLE(145, 150, palette); } @@ -617,10 +617,10 @@ void TalkManager::FIN_VISU_PARLE() { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) _vm->_objectsManager.BOB_OFF(idx); } - + _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); - + for (int idx = 21; idx <= 25; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) _vm->_objectsManager.BOB_ZERO(idx); @@ -630,17 +630,17 @@ void TalkManager::FIN_VISU_PARLE() { int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { int v6; int v7; - char v8; + char v8; int v9; int v10; - char v11; - char v13; - char v14; + char v11; + char v13; + char v14; int v15; - byte *ptr; + byte *ptr; int v17; int v18; - byte *v19; + byte *v19; uint32 indexData[4047]; Common::String filename; Common::String dest; @@ -650,7 +650,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v18 = 0; _vm->_globals.police_l = 11; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); - + // Build up the filename filename = dest = _vm->_globals.NFICHIER; while (filename.lastChar() != '.') @@ -660,7 +660,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { if (!f.open(filename)) error("Could not open file - %s", filename.c_str()); filesize = f.size(); - assert(filesize < 16188); + assert(filesize < 16188); for (int i = 0; i < (filesize / 4); ++i) indexData[i] = f.readUint32LE(); @@ -694,7 +694,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v19 = v19 + 1; ++v6; } while ((unsigned int)v6 < 0x800); - + v7 = 0; do { v8 = *(ptr + v7); @@ -772,13 +772,13 @@ void TalkManager::BOB_VISU_PARLE(int idx) { void TalkManager::CHERCHE_ANIM0(int a1, int a2) { size_t v2; - int v3; + int v3; size_t v4; unsigned int v5; unsigned int v6; int v7; - byte *v8; - byte *v9; + byte *v8; + byte *v9; v2 = 0; v3 = 0; @@ -816,14 +816,14 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { void TalkManager::ANIM_PERSO_INIT() { byte *v0; - byte *v1; + byte *v1; int v2; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; int v10; int v11; int v12; @@ -870,26 +870,26 @@ void TalkManager::clearCharacterAnim() { } bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int a4) { - bool result; - const byte *v5; - int v6; + bool result; + const byte *v5; + int v6; int v7; - byte *v8; - byte *v9; + byte *v8; + byte *v9; int v10; int v11; int v12; - char v13; + char v13; int v14; int v15; int v16; - char v17; - int v18; + char v17; + int v18; int v19; - int v20; - int v22; + int v20; + int v22; int v23; - const byte *v24; + const byte *v24; v22 = 0; result = false; @@ -964,22 +964,22 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int } void TalkManager::REPONSE(int a1, int a2) { - byte v2; - byte v3; - byte *v5; - byte *v6; - uint16 v7; - byte *v8; - int v9; - int v10; - uint16 v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v17; - byte *ptr; + byte v2; + byte v3; + byte *v5; + byte *v6; + uint16 v7; + byte *v8; + int v9; + int v10; + uint16 v11; + int v12; + int v13; + int v14; + int v15; + int v16; + int v17; + byte *ptr; v2 = a1; v3 = a2; @@ -1073,15 +1073,15 @@ LABEL_2: } void TalkManager::REPONSE2(int a1, int a2) { - signed int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; + signed int v3; + int v4; + int v5; + int v6; + int v7; + int v8; + int v9; + int v10; + int v11; v3 = 0; if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { @@ -1185,22 +1185,22 @@ void TalkManager::REPONSE2(int a1, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - int v2; - const char *v4; - int v5; + int v2; + const char *v4; + int v5; bool v6; - int v10; - byte *v11; - int v12; - int v13; - byte *v14; - byte *v15; - byte *v16; - int v17; + int v10; + byte *v11; + int v12; + int v13; + byte *v14; + byte *v15; + byte *v16; + int v17; Common::String s; - Common::String v20; - Common::String v22; - Common::String v23; + Common::String v20; + Common::String v22; + Common::String v23; _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); -- cgit v1.2.3 From a3ea2537184f0127d883525d939cdb0bce9a21cf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 14 Dec 2012 01:53:17 +0100 Subject: HOPKINS: Add support for BeOS full version --- common/platform.cpp | 1 + common/platform.h | 1 + engines/hopkins/hopkins.cpp | 1195 ++++++++++++++++++++++++++++++++++++------- engines/hopkins/hopkins.h | 1 + 4 files changed, 1025 insertions(+), 173 deletions(-) diff --git a/common/platform.cpp b/common/platform.cpp index d34803d15e..899e3f45ae 100644 --- a/common/platform.cpp +++ b/common/platform.cpp @@ -51,6 +51,7 @@ const PlatformDescription g_platforms[] = { { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi }, { "ios", "ios", "ios", "Apple iOS", kPlatformIOS }, { "os2", "os2", "os2", "OS/2", kPlatformOS2 }, + { "beos", "beos", "beos", "BeOS", kPlatformBeOS }, { 0, 0, 0, "Default", kPlatformUnknown } }; diff --git a/common/platform.h b/common/platform.h index 9595083207..b5ead825fc 100644 --- a/common/platform.h +++ b/common/platform.h @@ -56,6 +56,7 @@ enum Platform { kPlatformCDi, kPlatformIOS, kPlatformOS2, + kPlatformBeOS, kPlatformUnknown = -1 }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 28723edd33..6da437c19d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -115,6 +115,12 @@ Common::Error HopkinsEngine::run() { runWin95Demo(); else runWin95full(); + } else if (getPlatform() == Common::kPlatformBeOS) { + if (getIsDemo()) { + warning("Unhandled version, switching to linux demo"); + runLinuxDemo(); + } else + runBeOSFull(); } else { warning("Unhandled version, switching to linux demo"); runLinuxDemo(); @@ -181,7 +187,7 @@ bool HopkinsEngine::runWin95Demo() { memset(_globals.SAUVEGARDE, 0, 2000); _globals.SORTIE = 0; _globals.PASSWORD = true; - + if (getLanguage() != Common::PL_POL) if (!ADULT()) return Common::kNoError; @@ -189,7 +195,7 @@ bool HopkinsEngine::runWin95Demo() { for (;;) { if (_globals.SORTIE == 300) _globals.SORTIE = 0; - + if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { @@ -259,14 +265,14 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre_Gen = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; - + if (_globals.SAUVEGARDE->data[svField80]) { if (_globals.SAUVEGARDE->data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } - + _globals.NOSPRECRAN = false; break; @@ -358,7 +364,7 @@ bool HopkinsEngine::runWin95Demo() { case 31: case 33: case 32: - case 34: + case 34: NO_DISPO(4); break; @@ -480,7 +486,7 @@ bool HopkinsEngine::runLinuxDemo() { if (!_eventsManager._escKeyFl) INTRORUN(); - + _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -493,7 +499,7 @@ bool HopkinsEngine::runLinuxDemo() { for (;;) { if (_globals.SORTIE == 300) _globals.SORTIE = 0; - + if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { @@ -554,7 +560,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; - + if (!_globals.CENSURE) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else @@ -566,7 +572,7 @@ bool HopkinsEngine::runLinuxDemo() { _soundManager.DEL_SAMPLE(4); _globals.SAUVEGARDE->data[svField170] = 1; } - + _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; @@ -574,7 +580,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); break; - + case 4: _globals._disableInventFl = true; _objectsManager.PLAN_BETA(); @@ -593,132 +599,982 @@ bool HopkinsEngine::runLinuxDemo() { } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } - + + _globals.NOSPRECRAN = false; + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 460; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 9: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + + if (!_globals.SAUVEGARDE->data[svField225]) + BOOM(); + + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField225]) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); + } + break; + + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); + _globals.NOSPRECRAN = false; + break; + + case 16: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + break; + + case 25: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + break; + + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + + case 35: + ENDEMO(); + break; + + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); _globals.NOSPRECRAN = false; break; - - case 6: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + + case 113: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField5] = 113; + _computerManager.showComputer(COMPUTER_HOPKINS); + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); + memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + _graphicsManager.Cls_Pal(); + _graphicsManager.RESET_SEGMENT_VESA(); + break; + + case 114: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField5] = 114; + _computerManager.showComputer(COMPUTER_SAMANTHAS); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField5] = 115; + _computerManager.showComputer(COMPUTER_PUBLIC); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + break; + + case 150: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 151: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 152: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + } + } + return true; +} + +bool HopkinsEngine::runBeOSFull() { + _globals.SVGA = 2; + + warning("TODO: Init_Interrupt()"); + _globals.CHARGE_OBJET(); + _objectsManager.CHANGE_OBJET(14); + _objectsManager.AJOUTE_OBJET(14); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _graphicsManager.Cls_Video(); + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("MP.ANM", 10, 0, 200); + _graphicsManager.FADE_OUTW(); + if (!_eventsManager._escKeyFl) + INTRORUN(); + _graphicsManager.FADE_OUTS(); + _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.FADE_INW(); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 0; + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.PLANX = _globals.PLANY = 0; + memset(_globals.SAUVEGARDE, 0, 0x7CCu); + _globals.SORTIE = 0; + + for (;;) { + + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.freeMemory(_globals.PERSO); + REST_SYSTEM(); + } + } + + if (g_system->getEventManager()->shouldQuit()) + return false; + + switch (_globals.SORTIE) { + case 1: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + break; + + case 3: + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + _graphicsManager.LOAD_IMAGE("FOND"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(5000); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + _graphicsManager.Cls_Video(); + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _graphicsManager.FADE_OUTW(); + _globals.SAUVEGARDE->data[svField170] = 1; + } + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + break; + + case 4: + _globals._disableInventFl = true; + _objectsManager.PLAN_BETA(); + _globals._disableInventFl = false; + break; + + case 5: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 455; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + _globals.NOSPRECRAN = false; + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 9: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + if (!_globals.SAUVEGARDE->data[svField225]) + BOOM(); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField225]) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); + } + break; + + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18); + _globals.NOSPRECRAN = false; + break; + + case 16: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + break; + + case 17: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField117] == 1) { + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + } else if (!_globals.SAUVEGARDE->data[svField117]) { + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + } + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _graphicsManager.Cls_Video(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 18: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); + break; + + case 19: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField123]) + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + else + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + break; + + case 20: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 8; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + if (_globals.SORTIE == 17) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.Cls_Video(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.playAnim("PURG2.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 22: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + break; + + case 23: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + break; + + case 24: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField181]) { + if (_globals.SAUVEGARDE->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1); + } else { + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + } + break; + + case 25: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); + break; + + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); + break; + + case 27: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField177] == 1) { + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + } else if (!_globals.SAUVEGARDE->data[svField177]) { + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + } + break; + + case 28: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + else + _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1); + break; + + case 29: + _globals.Max_Propre = 60; + _globals.Max_Ligne_Long = 50; + _globals.Max_Propre_Gen = 50; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + break; + + case 30: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + _globals.NOSPRECRAN = false; + break; + + case 31: + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + break; + + case 32: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + break; + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + + case 34: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); + _globals.NOSPRECRAN = false; + break; + + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: { + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals._disableInventFl = false; + _globals.FORET = true; + _globals.NOSPRECRAN = true; + Common::String im = Common::String::format("IM%d", _globals.SORTIE); + _soundManager.WSOUND(13); + if (_globals.FORETSPR == g_PTRNUL) { + _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); + _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + } + + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); + _globals.NOSPRECRAN = false; + if ((_globals.SORTIE < 35) || (_globals.SORTIE > 49)) { + _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); + _globals.FORET = false; + _soundManager.DEL_SAMPLE(1); + } + break; + } + + case 50: + AVION(); + _globals.SORTIE = 51; + break; + + case 51: + _globals.Max_Propre = 20; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + break; + + case 52: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + break; + + case 54: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + break; + + case 55: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + break; + + case 56: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + break; + + case 57: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + break; + + case 58: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + break; + + case 59: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); + _globals.NOSPRECRAN = false; + break; + + case 60: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); + _globals.NOSPRECRAN = false; + break; + + case 61: + if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + INCENDIE(); + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + break; + + case 62: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); + _globals.NOSPRECRAN = false; + break; + + case 63: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); + _globals.NOSPRECRAN = false; + break; + + case 64: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + break; + + case 65: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); + _globals.NOSPRECRAN = false; + break; + + case 66: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); + _globals.NOSPRECRAN = false; + break; + + case 67: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); + _globals.NOSPRECRAN = false; + break; + + case 68: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + break; + + case 69: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); + _globals.NOSPRECRAN = false; + break; + + case 70: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); + _globals.NOSPRECRAN = false; + break; + + case 71: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); + _globals.NOSPRECRAN = false; + break; + + case 73: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField318] == 1) { + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + } else if (!_globals.SAUVEGARDE->data[svField318]) { + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + } + break; + + case 75: + BASE(); + break; + + case 77: + OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + break; + + case 78: + OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + break; + + case 79: + OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + break; + + case 80: + OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + break; + + case 81: + OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + break; + + case 82: + OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + break; + + case 83: + OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); break; - case 7: - if (_globals.SAUVEGARDE->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); - else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + case 84: + OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); break; - case 8: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + case 85: + OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); break; - case 9: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 440; - - if (!_globals.SAUVEGARDE->data[svField225]) - BOOM(); + case 86: + OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + break; - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + case 87: + OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); break; - case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + case 88: + OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); break; - case 11: - _globals.NOSPRECRAN = true; - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + case 89: + OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); break; - case 12: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { - BOOM(); - } + case 90: + BASED(); break; - case 13: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + case 91: + OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); break; - case 14: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; + case 93: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField330]) + _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); + break; + + case 94: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; - case 15: + case 95: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); break; - case 16: + case 96: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; - _globals.Max_Perso_Y = 450; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + break; - if (_globals.SAUVEGARDE->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); - } - break; + case 97: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _graphicsManager.Cls_Video(); + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - case 25: - _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } break; - case 26: - _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; + case 98: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + break; - case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; + case 99: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; - case 35: - ENDEMO(); + case 100: + JOUE_FIN(); break; case 111: @@ -740,15 +1596,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); - memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); - _graphicsManager.Cls_Pal(); - _graphicsManager.RESET_SEGMENT_VESA(); + _graphicsManager.MODE_VESA(); break; case 114: @@ -758,9 +1606,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.MODE_VESA(); break; case 115: @@ -770,21 +1616,15 @@ bool HopkinsEngine::runLinuxDemo() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.MODE_VESA(); break; case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -792,13 +1632,9 @@ bool HopkinsEngine::runLinuxDemo() { case 151: _soundManager.WSOUND(16); _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; @@ -806,16 +1642,30 @@ bool HopkinsEngine::runLinuxDemo() { case 152: _soundManager.WSOUND(16); _globals.iRegul = 1; - - _graphicsManager.DD_Lock(); _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); + _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; break; + + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + _globals.PERSO = _globals.freeMemory(_globals.PERSO); + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(23); + _globals.SORTIE = PWBASE(); + _soundManager.WSOUND_OFF(); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; + break; } } return true; @@ -823,7 +1673,6 @@ bool HopkinsEngine::runLinuxDemo() { bool HopkinsEngine::runWin95full() { _globals.SVGA = 2; -// _SPEED_SCROLL = 4; warning("TODO: Init_Interrupt_()"); @@ -862,7 +1711,7 @@ bool HopkinsEngine::runWin95full() { _globals.SORTIE = 0; if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU();; + _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); REST_SYSTEM(); @@ -936,7 +1785,7 @@ bool HopkinsEngine::runWin95full() { } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } - + _globals.NOSPRECRAN = false; break; @@ -1725,7 +2574,7 @@ bool HopkinsEngine::runLinuxFull() { if (!_eventsManager._escKeyFl) INTRORUN(); - + _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -2238,7 +3087,7 @@ bool HopkinsEngine::runLinuxFull() { _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); _globals.NOSPRECRAN = false; break; - + case 64: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; @@ -2246,7 +3095,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; - + case 65: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; @@ -2629,7 +3478,7 @@ void HopkinsEngine::INIT_SYSTEM() { case 0: if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUAN.SPR"); - else + else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUAN.SPR"); break; case 1: @@ -2642,7 +3491,7 @@ void HopkinsEngine::INIT_SYSTEM() { _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUES.SPR"); break; } - + if (_eventsManager._mouseLinuxFl) { _eventsManager._mouseSizeX = 52; _eventsManager._mouseSizeY = 32; @@ -2662,7 +3511,7 @@ void HopkinsEngine::INIT_SYSTEM() { _globals.ICONE = _fileManager.loadFile(_globals.NFICHIER); _fileManager.constructFilename(_globals.HOPSYSTEM, "TETE.SPR"); _globals.TETE = _fileManager.loadFile(_globals.NFICHIER); - + switch (_globals.FR) { case 0: _fileManager.constructFilename(_globals.HOPLINK, "ZONEAN.TXT"); @@ -2737,26 +3586,26 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.no_scroll = 2; bool v3 = false; _graphicsManager.SCROLL = 0; - + do { _graphicsManager.SCROLL += 2; if (_graphicsManager.SCROLL > (SCREEN_WIDTH - 2)) { _graphicsManager.SCROLL = SCREEN_WIDTH; v3 = true; } - + if (_eventsManager.getMouseX() < _graphicsManager.SCROLL + 10) _eventsManager.setMouseXY(_eventsManager._mousePos.x + 4, _eventsManager.getMouseY()); _eventsManager.VBL(); } while (!shouldQuit() && !v3 && _graphicsManager.SCROLL != SCREEN_WIDTH); - + _eventsManager.VBL(); _graphicsManager.no_scroll = 0; if (shouldQuit()) return; } - + _soundManager.VOICE_MIX(4, 3); _graphicsManager.FADE_OUTW(); _graphicsManager.no_scroll = 0; @@ -2776,19 +3625,19 @@ void HopkinsEngine::INTRORUN() { for (int i = 0; i <= 4; i++) _eventsManager.VBL(); - + _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); for (uint i = 0; i < 200 / _globals.vitesse; ++i) _eventsManager.VBL(); - + _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(5, 3); _objectsManager.BOBANIM_OFF(3); _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); - + // CHECKME: Useless variables? // v21 = *(uint16 *)&_graphicsManager.Palette[796]; // v22 = _graphicsManager.Palette[798]; @@ -2805,7 +3654,7 @@ void HopkinsEngine::INTRORUN() { return; _soundManager.SPECIAL_SOUND = 0; - + if (!_eventsManager._escKeyFl) { _graphicsManager.LOAD_IMAGE("intro2"); _graphicsManager.SCROLL_ECRAN(0); @@ -2824,7 +3673,7 @@ void HopkinsEngine::INTRORUN() { for (int i = 0; i <= 3; i++) _eventsManager.VBL(); - + _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); @@ -2838,10 +3687,10 @@ void HopkinsEngine::INTRORUN() { _eventsManager.VBL(); _objectsManager.BOBANIM_OFF(3); } - + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); - - + + for (int i = 1, v12 = 4 * v9; i <= PALETTE_BLOCK_SIZE; i++) { if (_graphicsManager.Palette[i] > v12) @@ -2854,24 +3703,24 @@ void HopkinsEngine::INTRORUN() { if (2 * v9 > 1) { for (int i = 1; i < 2 * v9; i++) _eventsManager.VBL(); - } - + } + _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); - if (20 - v9 > 1) { + if (20 - v9 > 1) { for (int i = 1; i < 20 - v9; i++) _eventsManager.VBL(); } - + v9 += 2; if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); for (uint j = 1; j < 100 / _globals.vitesse; ++j) _eventsManager.VBL(); - + _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _objectsManager.BOBANIM_OFF(3); - + for (uint k = 1; k < 60 / _globals.vitesse; ++k) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(5); @@ -2880,14 +3729,14 @@ void HopkinsEngine::INTRORUN() { Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); - + for (uint m = 0; m < 50 / _globals.vitesse; ++m) { if (m == 30 / _globals.vitesse) { _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(8, 3); _objectsManager.BOBANIM_OFF(3); } - + _eventsManager.VBL(); } @@ -2906,7 +3755,7 @@ void HopkinsEngine::INTRORUN() { _animationManager.playAnim("INTRO2.anm", 10, 24, 18); if (shouldQuit()) return; - + if (!_eventsManager._escKeyFl) { _animationManager.playAnim("INTRO3.anm", 10, 24, 200); if (shouldQuit()) @@ -2926,11 +3775,11 @@ void HopkinsEngine::INTRORUN() { } } } - + _eventsManager._escKeyFl = false; } -/** +/** * If in demo, displays a 'not available' screen and returns to the city map */ void HopkinsEngine::PASS() { @@ -2941,13 +3790,13 @@ void HopkinsEngine::PASS() { _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; } @@ -2965,7 +3814,7 @@ void HopkinsEngine::ENDEMO() { _graphicsManager.LOAD_IMAGE("endfr"); else _graphicsManager.LOAD_IMAGE("enduk"); - + _graphicsManager.FADE_INW(); _eventsManager.delay(1500); _graphicsManager.FADE_OUTW(); @@ -2979,7 +3828,7 @@ void HopkinsEngine::BOOM() { _graphicsManager.Cls_Video(); _graphicsManager.DD_Unlock(); _graphicsManager.Cls_Pal(); - + _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 199; _graphicsManager.FADE_LINUX = 2; @@ -2987,7 +3836,7 @@ void HopkinsEngine::BOOM() { _animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); else if (_globals.SVGA == 2) _animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - + _soundManager.SPECIAL_SOUND = 0; _graphicsManager.LOAD_IMAGE("IM15"); _animationManager.loadAnim("ANIM15"); @@ -2998,15 +3847,15 @@ void HopkinsEngine::BOOM() { for (int idx = 0; idx < 5; ++idx) { _eventsManager.VBL(); } - + _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _eventsManager.mouseOff(); - + for (int idx = 0; idx < 20; ++idx) { _eventsManager.VBL(); } - + _globals.NOPARLE = true; _talkManager.PARLER_PERSO2("vire.pe2"); _globals.NOPARLE = false; @@ -3051,7 +3900,7 @@ void HopkinsEngine::PUBQUIT() { // xp = _eventsManager.XMOUSE(); // yp = _eventsManager.YMOUSE(); _eventsManager.VBL(); - + if (_eventsManager.getMouseButton() == 1) mouseClicked = true; } while (!mouseClicked && !g_system->getEventManager()->shouldQuit()); @@ -3141,7 +3990,7 @@ void HopkinsEngine::BASE() { if (!_eventsManager._escKeyFl) _animationManager.playAnim("base20a.anm", 10, 18, 18); // CHECKME: The original code was doing the opposite test, which looks like a bug. - if (!_eventsManager._escKeyFl) + if (!_eventsManager._escKeyFl) _animationManager.playAnim("base30a.anm", 10, 18, 18); if (!_eventsManager._escKeyFl) _animationManager.playAnim("base40a.anm", 10, 18, 18); @@ -4028,7 +4877,7 @@ bool HopkinsEngine::ADULT() { _eventsManager.VBL(); } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.getMouseButton() != 1)); - + _globals._disableInventFl = false; _globals.FLAG_VISIBLE = false; _graphicsManager.FADE_OUTW(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index fc8f6253cd..34b65dcaea 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -120,6 +120,7 @@ private: bool runLinuxDemo(); bool runWin95full(); bool runLinuxFull(); + bool runBeOSFull(); /** * Show warning screen about the game being adults only. -- cgit v1.2.3 From 0ec1994adc2f70ef1f7bb1ffc6b005e9201c7127 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Dec 2012 10:21:08 +0100 Subject: HOPKINS: Use direct values in case5, in win95 full --- engines/hopkins/hopkins.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 6da437c19d..62974d0f4a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1774,9 +1774,9 @@ bool HopkinsEngine::runWin95full() { break; case 5: - _globals.Max_Propre = _globals.SORTIE; - _globals.Max_Ligne_Long = _globals.SORTIE; - _globals.Max_Propre_Gen = _globals.SORTIE; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; if (_globals.SAUVEGARDE->data[svField80]) { -- cgit v1.2.3 From d7d8c19dae1a8ca586851892da406a3b4025f4c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Dec 2012 22:46:09 +0100 Subject: HOPKINS: Merge two zoom in and out functions --- engines/hopkins/events.cpp | 12 ++--- engines/hopkins/graphics.cpp | 52 ++++++++++----------- engines/hopkins/graphics.h | 6 +-- engines/hopkins/lines.cpp | 24 +++++----- engines/hopkins/objects.cpp | 108 +++++++++++++++++++++---------------------- engines/hopkins/saveload.cpp | 4 +- 6 files changed, 101 insertions(+), 105 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 2f3dc413df..090135d075 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -460,17 +460,17 @@ LABEL_65: _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.SDL_ECHELLE) { if (_vm->_graphicsManager.Winbpp == 2) { - int v5 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + int v5 = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v5); } else { - int v6 = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + int v6 = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v6); } _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.Reel_Zoom(0, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.Reel_Zoom(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.Reel_Zoom(0x280u, _vm->_graphicsManager.SDL_ECHELLE)); - _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.Reel_Zoom(0x1B8u, _vm->_graphicsManager.SDL_ECHELLE)); + _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.zoomIn(0, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.zoomIn(0x280u, _vm->_graphicsManager.SDL_ECHELLE)); + _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.zoomIn(0x1B8u, _vm->_graphicsManager.SDL_ECHELLE)); } else { if (_vm->_graphicsManager.Winbpp == 2) _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3dbd97a9da..b28c33450f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -122,8 +122,8 @@ void GraphicsManager::SET_MODE(int width, int height) { bpp = 16; if (SDL_ECHELLE) { - width = Reel_Zoom(width, SDL_ECHELLE); - height = Reel_Zoom(height, SDL_ECHELLE); + width = zoomIn(width, SDL_ECHELLE); + height = zoomIn(height, SDL_ECHELLE); } Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); @@ -1587,18 +1587,18 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (Winbpp == 2) { m_scroll16A(VESA_BUFFER, xp, yp, width, height, - Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), zoomIn(yp, SDL_ECHELLE)); } else { m_scroll2A(VESA_BUFFER, xp, yp, width, height, - Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), Reel_Zoom(yp, SDL_ECHELLE)); + zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), zoomIn(yp, SDL_ECHELLE)); } DD_Unlock(); - dstRect.left = Reel_Zoom(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE); - dstRect.top = Reel_Zoom(yp, SDL_ECHELLE); - dstRect.setWidth(Reel_Zoom(width, SDL_ECHELLE)); - dstRect.setHeight(Reel_Zoom(height, SDL_ECHELLE)); + dstRect.left = zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE); + dstRect.top = zoomIn(yp, SDL_ECHELLE); + dstRect.setWidth(zoomIn(width, SDL_ECHELLE)); + dstRect.setHeight(zoomIn(height, SDL_ECHELLE)); } else { // WORKAROUND: Original didn't lock the screen for access DD_Lock(); @@ -1763,22 +1763,20 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in } while (yCtr != 1); } -int GraphicsManager::Reel_Zoom(int v, int percentage) { - return Asm_Zoom(v, percentage); -} - -int GraphicsManager::Asm_Zoom(int v, int percentage) { +/** + * Compute the value of a parameter plus a given percentage + */ +int GraphicsManager::zoomIn( int v, int percentage ) { if (v) v += percentage * (long int)v / 100; return v; } -int GraphicsManager::Reel_Reduc(int v, int percentage) { - return Asm_Reduc(v, percentage); -} - -int GraphicsManager::Asm_Reduc(int v, int percentage) { +/** + * Compute the value of a parameter minus a given percentage + */ +int GraphicsManager::zoomOut(int v, int percentage) { if (v) v -= percentage * (long int)v / 100; @@ -1830,8 +1828,8 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_Flag_y = 0; Agr_Flag_x = 0; Largeur = spriteWidth; - int v20 = Asm_Zoom(spriteWidth, zoom2); - int v22 = Asm_Zoom(spriteHeight1, zoom2); + int v20 = zoomIn(spriteWidth, zoom2); + int v22 = zoomIn(spriteHeight1, zoom2); if (modeFlag) { v29 = v20 + dest1P; if (clip_y) { @@ -1841,7 +1839,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v52 = v20; int v30 = 0; int v31 = (uint16)clip_y; - while (Asm_Zoom(v30 + 1, zoom2) < v31) + while (zoomIn(v30 + 1, zoom2) < v31) ; v20 = v52; spritePixelsP += Largeur * v30; @@ -1860,7 +1858,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v29 -= v32; int v62 = v22; int v33 = 0; - while (Asm_Zoom(v33 + 1, zoom2) < v32) + while (zoomIn(v33 + 1, zoom2) < v32) ; int v34 = v33; v22 = v62; @@ -1922,7 +1920,7 @@ R_Aff_Zoom_Larg_Cont1: int v49 = v20; int v23 = 0; int v24 = (uint16)clip_y; - while (Asm_Zoom(v23 + 1, zoom2) < v24) + while (zoomIn(v23 + 1, zoom2) < v24) ; v20 = v49; spritePixelsP += Largeur * v23; @@ -1938,7 +1936,7 @@ R_Aff_Zoom_Larg_Cont1: int v50 = v20; int v25 = (uint16)clip_x; int v26 = 0; - while (Asm_Zoom(v26 + 1, zoom2) < v25) + while (zoomIn(v26 + 1, zoom2) < v25) ; int v27 = v26; v22 = v59; @@ -2003,7 +2001,7 @@ Aff_Zoom_Larg_Cont1: Largeur = spriteWidth; Red = zoom1; if (zoom1 < 100) { - int v37 = Asm_Reduc(spriteWidth, Red); + int v37 = zoomOut(spriteWidth, Red); if (modeFlag) { v40 = v37 + dest1P; do { @@ -2480,8 +2478,8 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Red_x = 0; Red_y = 0; if (zoom < 100) { - Reduc_Ecran_L = Asm_Reduc(width, Red); - Reduc_Ecran_H = Asm_Reduc(height, Red); + Reduc_Ecran_L = zoomOut(width, Red); + Reduc_Ecran_H = zoomOut(height, Red); for (int yCtr = 0; yCtr < height; ++yCtr, srcP += nbrligne2) { Red_y += Red; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e92cbf8fdc..4d4777a115 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -52,8 +52,6 @@ private: HopkinsEngine *_vm; void CHARGE_ECRAN(const Common::String &file); - int Asm_Zoom(int v, int percentage); - int Asm_Reduc(int v, int percentage); public: int _lockCtr; bool SDL_MODEYES; @@ -177,8 +175,8 @@ public: void CopyAsm(const byte *surface); void CopyAsm16(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); - int Reel_Zoom(int v, int percentage); - int Reel_Reduc(int v, int percentage); + int zoomIn(int v, int percentage); + int zoomOut(int v, int percentage); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag); void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 890aeffb1f..99ed0d9440 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3218,11 +3218,11 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v28 = -v26; v48 = _vm->_globals.STAILLE[v63]; v45 = v63; - v25 = _vm->_graphicsManager.Reel_Reduc(v25, v28); + v25 = _vm->_graphicsManager.zoomOut(v25, v28); v29 = v27; if ((v27 & 0x80000000u) != 0) v29 = -v27; - v40 = _vm->_graphicsManager.Reel_Reduc(v40, v29); + v40 = _vm->_graphicsManager.zoomOut(v40, v29); v63 = v45; v26 = v48; } @@ -3232,11 +3232,11 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { if (v26 < 0) v31 = -v26; v46 = v63; - v25 = _vm->_graphicsManager.Reel_Zoom(v25, v31); + v25 = _vm->_graphicsManager.zoomIn(v25, v31); v32 = v30; if ((v30 & 0x80000000u) != 0) v32 = -v30; - v40 = _vm->_graphicsManager.Reel_Zoom(v40, v32); + v40 = _vm->_graphicsManager.zoomIn(v40, v32); v63 = v46; } v33 = v63 + v40; @@ -3281,11 +3281,11 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v17 = -v15; v47 = _vm->_globals.STAILLE[v63]; v43 = v63; - v14 = _vm->_graphicsManager.Reel_Reduc(v14, v17); + v14 = _vm->_graphicsManager.zoomOut(v14, v17); v18 = v16; if ((v16 & 0x80000000u) != 0) v18 = -v16; - v39 = _vm->_graphicsManager.Reel_Reduc(v39, v18); + v39 = _vm->_graphicsManager.zoomOut(v39, v18); v63 = v43; v15 = v47; } @@ -3295,11 +3295,11 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { if (v15 < 0) v20 = -v15; v44 = v63; - v14 = _vm->_graphicsManager.Reel_Zoom(v14, v20); + v14 = _vm->_graphicsManager.zoomIn(v14, v20); v21 = v19; if ((v19 & 0x80000000u) != 0) v21 = -v19; - v39 = _vm->_graphicsManager.Reel_Zoom(v39, v21); + v39 = _vm->_graphicsManager.zoomIn(v39, v21); v63 = v44; } v22 = v63 + v39; @@ -3336,8 +3336,8 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { do { v10 = _vm->_globals.Hopkins[v51].field2; v42 = v63; - v11 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v51].field0, 0x19u); - v38 = _vm->_graphicsManager.Reel_Reduc(v10, 0x19u); + v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 0x19u); + v38 = _vm->_graphicsManager.zoomOut(v10, 0x19u); v63 = v42; v12 = 0; if (v11 > 0) { @@ -3372,8 +3372,8 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { do { v6 = _vm->_globals.Hopkins[v50].field2; v41 = v63; - v7 = _vm->_graphicsManager.Reel_Reduc(_vm->_globals.Hopkins[v50].field0, 0x19u); - v37 = _vm->_graphicsManager.Reel_Reduc(v6, 0x19u); + v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 0x19u); + v37 = _vm->_graphicsManager.zoomOut(v6, 0x19u); v63 = v41; v8 = 0; if (v7 > 0) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index dc09154d82..c000aa912d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -792,37 +792,37 @@ void ObjectsManager::CALCUL_BOB(int idx) { v21 = _vm->_globals.Bob[idx].field36; if (v21) { if (v15 >= 0) { - v22 = _vm->_graphicsManager.Reel_Zoom(v15, v21); + v22 = _vm->_graphicsManager.zoomIn(v15, v21); } else { if (v15 < 0) v15 = -v15; - v22 = -_vm->_graphicsManager.Reel_Zoom(v15, v21); + v22 = -_vm->_graphicsManager.zoomIn(v15, v21); } if (v6 >= 0) { - v17 = _vm->_graphicsManager.Reel_Zoom(v6, v21); + v17 = _vm->_graphicsManager.zoomIn(v6, v21); } else { int v9 = v15; if (v15 < 0) v9 = -v15; v6 = v9; - v17 = -_vm->_graphicsManager.Reel_Zoom(v9, v21); + v17 = -_vm->_graphicsManager.zoomIn(v9, v21); } } if (v20) { if (v15 >= 0) { - v22 = _vm->_graphicsManager.Reel_Reduc(v15, v20); + v22 = _vm->_graphicsManager.zoomOut(v15, v20); } else { v15 = -v15; - v22 = -_vm->_graphicsManager.Reel_Reduc(v15, v20); + v22 = -_vm->_graphicsManager.zoomOut(v15, v20); } if (v6 >= 0) { - v17 = _vm->_graphicsManager.Reel_Reduc(v6, v20); + v17 = _vm->_graphicsManager.zoomOut(v6, v20); } else { int v11 = v15; if (v15 < 0) v11 = -v15; - v17 = -_vm->_graphicsManager.Reel_Reduc(v11, v20); + v17 = -_vm->_graphicsManager.zoomOut(v11, v20); } } @@ -842,12 +842,12 @@ void ObjectsManager::CALCUL_BOB(int idx) { int height = getHeight(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); if (v21) { - width = _vm->_graphicsManager.Reel_Zoom(width, v21); - height = _vm->_graphicsManager.Reel_Zoom(height, v21); + width = _vm->_graphicsManager.zoomIn(width, v21); + height = _vm->_graphicsManager.zoomIn(height, v21); } if (v20) { - height = _vm->_graphicsManager.Reel_Reduc(height, v20); - width = _vm->_graphicsManager.Reel_Reduc(width, v20); + height = _vm->_graphicsManager.zoomOut(height, v20); + width = _vm->_graphicsManager.zoomOut(width, v20); } _vm->_globals.Liste2[idx].width = width; @@ -1066,43 +1066,43 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { if (zoomPercent) { if (v4 >= 0) { - v22 = _vm->_graphicsManager.Reel_Zoom(v4, zoomPercent); + v22 = _vm->_graphicsManager.zoomIn(v4, zoomPercent); } else { v10 = v4; if (v4 < 0) v10 = -v4; v4 = v10; - v22 = -_vm->_graphicsManager.Reel_Zoom(v10, zoomPercent); + v22 = -_vm->_graphicsManager.zoomIn(v10, zoomPercent); } if (v8 >= 0) { - v7 = _vm->_graphicsManager.Reel_Zoom(v8, zoomPercent); + v7 = _vm->_graphicsManager.zoomIn(v8, zoomPercent); } else { v11 = v4; if (v4 < 0) v11 = -v4; v8 = v11; - v7 = -_vm->_graphicsManager.Reel_Zoom(v11, zoomPercent); + v7 = -_vm->_graphicsManager.zoomIn(v11, zoomPercent); } } if (reducePercent) { if (v4 >= 0) { - v22 = _vm->_graphicsManager.Reel_Reduc(v4, reducePercent); + v22 = _vm->_graphicsManager.zoomOut(v4, reducePercent); } else { v12 = v4; if (v4 < 0) v12 = -v4; v4 = v12; - v22 = -_vm->_graphicsManager.Reel_Reduc(v12, reducePercent); + v22 = -_vm->_graphicsManager.zoomOut(v12, reducePercent); } if (v8 >= 0) { - v7 = _vm->_graphicsManager.Reel_Reduc(v8, reducePercent); + v7 = _vm->_graphicsManager.zoomOut(v8, reducePercent); } else { v13 = v4; if (v4 < 0) v13 = -v4; - v7 = -_vm->_graphicsManager.Reel_Reduc(v13, reducePercent); + v7 = -_vm->_graphicsManager.zoomOut(v13, reducePercent); } } @@ -1122,13 +1122,13 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { height = getHeight(Sprite[idx].spriteData, Sprite[idx].spriteIndex); if (zoomPercent) { - width = _vm->_graphicsManager.Reel_Zoom(width, zoomPercent); - height = _vm->_graphicsManager.Reel_Zoom(height, zoomPercent); + width = _vm->_graphicsManager.zoomIn(width, zoomPercent); + height = _vm->_graphicsManager.zoomIn(height, zoomPercent); } if (reducePercent) { - height = _vm->_graphicsManager.Reel_Reduc(height, reducePercent); - width = _vm->_graphicsManager.Reel_Reduc(width, reducePercent); + height = _vm->_graphicsManager.zoomOut(height, reducePercent); + width = _vm->_graphicsManager.zoomOut(width, reducePercent); } Sprite[idx].field30 = width; @@ -1853,21 +1853,21 @@ LABEL_241: v5 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v5 = -Sprite[0].fieldC; - v3 = _vm->_graphicsManager.Reel_Reduc(v3, v5); + v3 = _vm->_graphicsManager.zoomOut(v3, v5); v6 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v6 = -Sprite[0].fieldC; - v4 = _vm->_graphicsManager.Reel_Reduc(v4, v6); + v4 = _vm->_graphicsManager.zoomOut(v4, v6); } if (Sprite[0].fieldC > 0) { v7 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v7 = -Sprite[0].fieldC; - v3 = _vm->_graphicsManager.Reel_Zoom(v3, v7); + v3 = _vm->_graphicsManager.zoomIn(v3, v7); v8 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v8 = -Sprite[0].fieldC; - v4 = _vm->_graphicsManager.Reel_Zoom(v4, v8); + v4 = _vm->_graphicsManager.zoomIn(v4, v8); } v0 = v3 + g_old_x; v58 = g_old_y + v4; @@ -1891,21 +1891,21 @@ LABEL_23: v11 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v11 = -Sprite[0].fieldC; - v9 = _vm->_graphicsManager.Reel_Reduc(v9, v11); + v9 = _vm->_graphicsManager.zoomOut(v9, v11); v12 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v12 = -Sprite[0].fieldC; - v10 = _vm->_graphicsManager.Reel_Reduc(v10, v12); + v10 = _vm->_graphicsManager.zoomOut(v10, v12); } if (Sprite[0].fieldC > 0) { v13 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v13 = -Sprite[0].fieldC; - v9 = _vm->_graphicsManager.Reel_Zoom(v9, v13); + v9 = _vm->_graphicsManager.zoomIn(v9, v13); v14 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v14 = -Sprite[0].fieldC; - v10 = _vm->_graphicsManager.Reel_Zoom(v10, v14); + v10 = _vm->_graphicsManager.zoomIn(v10, v14); } v0 = g_old_x - v9; v58 = g_old_y - v10; @@ -1931,13 +1931,13 @@ LABEL_43: v17 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v17 = -Sprite[0].fieldC; - v16 = _vm->_graphicsManager.Reel_Reduc(v16, v17); + v16 = _vm->_graphicsManager.zoomOut(v16, v17); } if (Sprite[0].fieldC > 0) { v18 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v18 = -Sprite[0].fieldC; - v16 = _vm->_graphicsManager.Reel_Zoom(v16, v18); + v16 = _vm->_graphicsManager.zoomIn(v16, v18); } v0 = g_old_x; v58 = g_old_y - v16; @@ -1963,13 +1963,13 @@ LABEL_60: v21 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v21 = -Sprite[0].fieldC; - v20 = _vm->_graphicsManager.Reel_Reduc(v20, v21); + v20 = _vm->_graphicsManager.zoomOut(v20, v21); } if (Sprite[0].fieldC > 0) { v22 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v22 = -Sprite[0].fieldC; - v20 = _vm->_graphicsManager.Reel_Zoom(v20, v22); + v20 = _vm->_graphicsManager.zoomIn(v20, v22); } v0 = g_old_x; v58 = v20 + g_old_y; @@ -1993,21 +1993,21 @@ LABEL_77: v25 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v25 = -Sprite[0].fieldC; - v23 = _vm->_graphicsManager.Reel_Reduc(v23, v25); + v23 = _vm->_graphicsManager.zoomOut(v23, v25); v26 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v26 = -Sprite[0].fieldC; - v24 = _vm->_graphicsManager.Reel_Reduc(v24, v26); + v24 = _vm->_graphicsManager.zoomOut(v24, v26); } if (Sprite[0].fieldC > 0) { v27 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v27 = -Sprite[0].fieldC; - v23 = _vm->_graphicsManager.Reel_Zoom(v23, v27); + v23 = _vm->_graphicsManager.zoomIn(v23, v27); v28 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v28 = -Sprite[0].fieldC; - v24 = _vm->_graphicsManager.Reel_Zoom(v24, v28); + v24 = _vm->_graphicsManager.zoomIn(v24, v28); } v0 = v23 + g_old_x; v58 = g_old_y + v24; @@ -2031,21 +2031,21 @@ LABEL_96: v31 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v31 = -Sprite[0].fieldC; - v29 = _vm->_graphicsManager.Reel_Reduc(v29, v31); + v29 = _vm->_graphicsManager.zoomOut(v29, v31); v32 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v32 = -Sprite[0].fieldC; - v30 = _vm->_graphicsManager.Reel_Reduc(v30, v32); + v30 = _vm->_graphicsManager.zoomOut(v30, v32); } if (Sprite[0].fieldC > 0) { v33 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v33 = -Sprite[0].fieldC; - v29 = _vm->_graphicsManager.Reel_Zoom(v29, v33); + v29 = _vm->_graphicsManager.zoomIn(v29, v33); v34 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v34 = -Sprite[0].fieldC; - v30 = _vm->_graphicsManager.Reel_Zoom(v30, v34); + v30 = _vm->_graphicsManager.zoomIn(v30, v34); } v0 = g_old_x - v29; v58 = g_old_y + v30; @@ -2069,21 +2069,21 @@ LABEL_115: v37 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v37 = -Sprite[0].fieldC; - v35 = _vm->_graphicsManager.Reel_Reduc(v35, v37); + v35 = _vm->_graphicsManager.zoomOut(v35, v37); v38 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v38 = -Sprite[0].fieldC; - v36 = _vm->_graphicsManager.Reel_Reduc(v36, v38); + v36 = _vm->_graphicsManager.zoomOut(v36, v38); } if (Sprite[0].fieldC > 0) { v39 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v39 = -Sprite[0].fieldC; - v35 = _vm->_graphicsManager.Reel_Zoom(v35, v39); + v35 = _vm->_graphicsManager.zoomIn(v35, v39); v40 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v40 = -Sprite[0].fieldC; - v36 = _vm->_graphicsManager.Reel_Zoom(v36, v40); + v36 = _vm->_graphicsManager.zoomIn(v36, v40); } v0 = v35 + g_old_x; v58 = g_old_y + v36; @@ -2107,21 +2107,21 @@ LABEL_134: v43 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v43 = -Sprite[0].fieldC; - v41 = _vm->_graphicsManager.Reel_Reduc(v41, v43); + v41 = _vm->_graphicsManager.zoomOut(v41, v43); v44 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v44 = -Sprite[0].fieldC; - v42 = _vm->_graphicsManager.Reel_Reduc(v42, v44); + v42 = _vm->_graphicsManager.zoomOut(v42, v44); } if (Sprite[0].fieldC > 0) { v45 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v45 = -Sprite[0].fieldC; - v41 = _vm->_graphicsManager.Reel_Zoom(v41, v45); + v41 = _vm->_graphicsManager.zoomIn(v41, v45); v46 = Sprite[0].fieldC; if (Sprite[0].fieldC < 0) v46 = -Sprite[0].fieldC; - v42 = _vm->_graphicsManager.Reel_Zoom(v42, v46); + v42 = _vm->_graphicsManager.zoomIn(v42, v46); } v0 = g_old_x - v41; v58 = g_old_y + v42; @@ -5106,9 +5106,9 @@ int ObjectsManager::CALC_PROPRE(int idx) { v2 = 20 * (5 * v4 - 165) / -67; } if (v2 < 0) - return _vm->_graphicsManager.Reel_Reduc(0x19u, -v2); + return _vm->_graphicsManager.zoomOut(0x19u, -v2); if (v2 > 0) - return _vm->_graphicsManager.Reel_Zoom(0x19u, v2); + return _vm->_graphicsManager.zoomIn(0x19u, v2); return v1; } diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index a7771cd97d..4b08f18f67 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -222,8 +222,8 @@ bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header #define REDUCE_AMOUNT 80 void SaveLoadManager::createThumbnail(Graphics::Surface *s) { - int w = _vm->_graphicsManager.Reel_Reduc(SCREEN_WIDTH, REDUCE_AMOUNT); - int h = _vm->_graphicsManager.Reel_Reduc(SCREEN_HEIGHT - 40, REDUCE_AMOUNT); + int w = _vm->_graphicsManager.zoomOut(SCREEN_WIDTH, REDUCE_AMOUNT); + int h = _vm->_graphicsManager.zoomOut(SCREEN_HEIGHT - 40, REDUCE_AMOUNT); Graphics::Surface thumb8; thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); -- cgit v1.2.3 From 2d172ab46e76f416b307ae11471a09c979855702 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Dec 2012 23:28:58 +0100 Subject: HOPKINS: Remove all code related to 8b display --- engines/hopkins/anim.cpp | 239 +++++++++-------------------------- engines/hopkins/events.cpp | 14 +-- engines/hopkins/globals.cpp | 2 - engines/hopkins/globals.h | 2 - engines/hopkins/graphics.cpp | 294 ++++++++++--------------------------------- engines/hopkins/graphics.h | 3 - engines/hopkins/hopkins.cpp | 3 - engines/hopkins/objects.cpp | 16 +-- engines/hopkins/talk.cpp | 32 ++--- 9 files changed, 138 insertions(+), 467 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 601ff00e9e..3f3040fa45 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -79,7 +79,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); } - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { hasScreenCopy = true; screenCopy = _vm->_globals.allocMemory(0x4B000u); memcpy(screenCopy, screenP, 0x4B000u); @@ -91,18 +91,10 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (hasScreenCopy) - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (hasScreenCopy) - _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (hasScreenCopy) + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } @@ -153,16 +145,10 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (hasScreenCopy) { if (*screenP != kByteStop) { _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.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*screenP != kByteStop) { - if (_vm->_graphicsManager.Winbpp == 1) - _vm->_graphicsManager.Copy_Video_Vbe3(screenP); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); @@ -285,7 +271,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.Cls_Video(); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.max_x = SCREEN_WIDTH; - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v8 = 1; ptr = _vm->_globals.allocMemory(0x4B000u); memcpy(ptr, v12, 0x4B000u); @@ -297,18 +283,10 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (v8) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (v8) - _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (v8) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } @@ -347,36 +325,19 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) -LABEL_111: - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } LABEL_112: _vm->_graphicsManager.DD_Unlock(); @@ -410,16 +371,10 @@ LABEL_77: if (v8) { if (*v12 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*v12 != kByteStop) { - if (_vm->_graphicsManager.Winbpp == 1) - _vm->_graphicsManager.Copy_Video_Vbe3(v12); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.Copy_Video_Vbe16(v12); + _vm->_graphicsManager.Copy_Video_Vbe16(v12); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); @@ -450,34 +405,19 @@ LABEL_88: _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - goto LABEL_111; - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } goto LABEL_112; } @@ -513,34 +453,19 @@ LABEL_88: _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - goto LABEL_111; - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } goto LABEL_112; } @@ -613,35 +538,19 @@ LABEL_114: _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.FADE_INS(); @@ -963,7 +872,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.skip(14); f.read(v9, nbytes); - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v7 = 1; ptr = _vm->_globals.allocMemory(0x4B000u); memcpy(ptr, v9, 0x4B000u); @@ -980,18 +889,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (v7) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (v7) - _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (v7) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } @@ -1058,16 +959,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (v7) { if (*v9 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v9, ptr); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*v9 != kByteStop) { - if (_vm->_graphicsManager.Winbpp == 1) - _vm->_graphicsManager.Copy_Video_Vbe(v9); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.Copy_Video_Vbe16a(v9); + _vm->_graphicsManager.Copy_Video_Vbe16a(v9); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); @@ -1140,7 +1035,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u f.readUint16LE(); f.read(v10, nbytes); - if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) { + if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v7 = 1; ptr = _vm->_globals.allocMemory(0x4B000u); memcpy((void *)ptr, v10, 0x4B000u); @@ -1154,18 +1049,10 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u } else { _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - if (_vm->_graphicsManager.Winbpp == 2) { - if (v7) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (v7) - _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (v7) + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); } @@ -1216,16 +1103,10 @@ LABEL_33: if (v7) { if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*v10 != kByteStop) { - if (_vm->_graphicsManager.Winbpp == 1) - _vm->_graphicsManager.Copy_Video_Vbe(v10); - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.Copy_Video_Vbe16a(v10); + _vm->_graphicsManager.Copy_Video_Vbe16a(v10); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.DD_VBL(); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 090135d075..e610137981 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -459,23 +459,15 @@ LABEL_65: _vm->_fontManager.hideText(9); _vm->_graphicsManager.DD_Lock(); if (_vm->_graphicsManager.SDL_ECHELLE) { - if (_vm->_graphicsManager.Winbpp == 2) { - int v5 = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v5); - } else { - int v6 = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v6); - } + int v5 = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v5); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.zoomIn(0, _vm->_graphicsManager.SDL_ECHELLE); _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.zoomIn(0x280u, _vm->_graphicsManager.SDL_ECHELLE)); _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.zoomIn(0x1B8u, _vm->_graphicsManager.SDL_ECHELLE)); } else { - if (_vm->_graphicsManager.Winbpp == 2) - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e13a184d5e..83ef82dd31 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -225,8 +225,6 @@ Globals::Globals() { SOUNDOFF = false; VOICEOFF = false; XFULLSCREEN = false; - XFORCE16 = false; - XFORCE8 = false; SOUNDOFF = false; MUSICOFF = false; VOICEOFF = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 803a63384a..f9b855a805 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -343,8 +343,6 @@ public: bool XFULLSCREEN; int XSETMODE; int XZOOM; - bool XFORCE16; - bool XFORCE8; int PERSO_TYPE; uint vitesse; int INSTALL_TYPE; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b28c33450f..e4e1936b21 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -39,7 +39,6 @@ GraphicsManager::GraphicsManager() { SDL_ECHELLE = 0; XSCREEN = YSCREEN = 0; WinScan = 0; - Winbpp = 0; PAL_PIXELS = NULL; nbrligne = 0; Linear = false; @@ -115,24 +114,13 @@ void GraphicsManager::SET_MODE(int width, int height) { if (_vm->_globals.XSETMODE == 5) SDL_ECHELLE = _vm->_globals.XZOOM; - int bpp = 8; - if (_vm->_globals.XFORCE8 == true) - bpp = 8; - if (_vm->_globals.XFORCE16 == true) - bpp = 16; - if (SDL_ECHELLE) { width = zoomIn(width, SDL_ECHELLE); height = zoomIn(height, SDL_ECHELLE); } Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); - - if (bpp == 8) { - initGraphics(width, height, true); - } else { - initGraphics(width, height, true, &pixelFormat16); - } + initGraphics(width, height, true, &pixelFormat16); // Init surfaces VESA_SCREEN = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); @@ -143,8 +131,7 @@ void GraphicsManager::SET_MODE(int width, int height) { YSCREEN = height; Linear = true; - Winbpp = bpp / 8; - WinScan = width * Winbpp; + WinScan = width * 2; // Refactor me PAL_PIXELS = SD_PIXELS; nbrligne = width; @@ -197,10 +184,7 @@ void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { max_x = 320; DD_Lock(); - if (Winbpp == 1) - CopyAsm(VESA_BUFFER); - if (Winbpp == 2) - CopyAsm16(VESA_BUFFER); + CopyAsm16(VESA_BUFFER); DD_Unlock(); FADE_IN_CASSE(); @@ -233,17 +217,10 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { max_x = SCREEN_WIDTH; DD_Lock(); Cls_Video(); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } else if (Winbpp == 1) { - if (!SDL_ECHELLE) - m_scroll2(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll2A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (SDL_ECHELLE) + m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_Unlock(); } else { @@ -255,19 +232,10 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (MANU_SCROLL == 1) { DD_Lock(); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (Winbpp == 1) { - if (!SDL_ECHELLE) - m_scroll2(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll2A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - + if (SDL_ECHELLE) + m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_Unlock(); } } @@ -472,10 +440,6 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * void GraphicsManager::Cls_Pal() { Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); SD_PIXELS[0] = 0; - - if (Winbpp == 1) { - g_system->getPaletteManager()->setPalette(cmap, 0, 256); - } } void GraphicsManager::SCANLINE(int pitch) { @@ -508,80 +472,6 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i } while (yCtr != 1); } -void GraphicsManager::m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *srcP; - byte *destP; - int destPitch; - int srcPitch; - int yCtr; - - assert(VideoPtr); - srcP = xs + nbrligne2 * ys + surface; - destP = destX + WinScan * destY + (byte *)VideoPtr->pixels; - destPitch = WinScan - SCREEN_WIDTH; - srcPitch = nbrligne2 - SCREEN_WIDTH; - yCtr = height; - - do { - memcpy(destP, srcP, SCREEN_WIDTH); - destP = destP + destPitch + SCREEN_WIDTH; - srcP = srcP + srcPitch + SCREEN_WIDTH; - --yCtr; - } while (yCtr); -} - -void GraphicsManager::m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *srcP; - byte *destP; - int yCtr; - int xCtr; - byte srcByte; - const byte *srcCopyP; - byte *destCopyP; - - assert(VideoPtr); - srcP = xs + nbrligne2 * ys + surface; - destP = destX + WinScan * destY + (byte *)VideoPtr->pixels; - yCtr = height; - Agr_x = 0; - Agr_y = 0; - Agr_Flag_y = 0; - do { - for (;;) { - destCopyP = destP; - srcCopyP = srcP; - xCtr = width; - Agr_x = 0; - do { - srcByte = *srcP; - *destP++ = *srcP++; - Agr_x += SDL_ECHELLE; - if ((unsigned int)Agr_x >= 100) { - Agr_x -= 100; - *destP++ = srcByte; - } - --xCtr; - } while ( xCtr ); - - srcP = srcCopyP; - destP = WinScan + destCopyP; - if (Agr_Flag_y) - break; - - Agr_y += SDL_ECHELLE; - if ((unsigned int)Agr_y < 100) - break; - - Agr_y -= 100; - Agr_Flag_y = 1; - } - - Agr_Flag_y = 0; - srcP = nbrligne2 + srcCopyP; - --yCtr; - } while (yCtr); -} - /** * Copies data from a 8-bit palette surface into the 16-bit screen */ @@ -805,26 +695,22 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface } setpal_vga256(palData2); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_VBL(); - } - } - - // Set the final palette - setpal_vga256(palette); - - // Refresh the screen - if (Winbpp == 2) { if (SDL_ECHELLE) m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } + + // Set the final palette + setpal_vga256(palette); + + // Refresh the screen + if (SDL_ECHELLE) + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + DD_VBL(); } void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { @@ -845,13 +731,11 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } while (palIndex < PALETTE_BLOCK_SIZE); setpal_vga256(palData); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_VBL(); - } + if (SDL_ECHELLE) + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + DD_VBL(); int palCtr3 = 0; if (palMax > 0) { @@ -866,14 +750,12 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } while (palCtr4 < (PALETTE_BLOCK_SIZE)); setpal_vga256(palData); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (SDL_ECHELLE) + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_VBL(); - } + DD_VBL(); ++palCtr3; } while (palMax > palCtr3); } @@ -883,28 +765,24 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); - if (Winbpp == 2) { - if (!SDL_ECHELLE) { - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); - } - goto LABEL_28; + if (!SDL_ECHELLE) { + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + return DD_VBL(); } + goto LABEL_28; } else { for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) palData[i] = 0; setpal_vga256(palData); - if (Winbpp == 2) { - if (!SDL_ECHELLE) { - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); - } - -LABEL_28: - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (!SDL_ECHELLE) { + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } + +LABEL_28: + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + return DD_VBL(); } } @@ -934,15 +812,11 @@ void GraphicsManager::setpal_vga256(const byte *palette) { void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { CHANGE_PALETTE(palette); - - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - - DD_VBL(); - } + if (SDL_ECHELLE) + m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + DD_VBL(); } void GraphicsManager::SETCOLOR(int palIndex, int r, int g, int b) { @@ -982,9 +856,6 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { cmap[v8 + 2] = bv; WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); - - if (Winbpp == 1) - g_system->getPaletteManager()->setPalette(cmap, palIndex, 1); } void GraphicsManager::CHANGE_PALETTE(const byte *palette) { @@ -999,21 +870,14 @@ void GraphicsManager::CHANGE_PALETTE(const byte *palette) { for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { *(uint16 *)&SD_PIXELS[2 * idx] = MapRGB(*srcP, *(srcP + 1), *(srcP + 2)); } - - if (Winbpp == 1) - g_system->getPaletteManager()->setPalette(cmap, 0, PALETTE_SIZE); } uint16 GraphicsManager::MapRGB(byte r, byte g, byte b) { - if (Winbpp == 1) { - error("TODO: Support in 8-bit graphics mode"); - } else { - Graphics::PixelFormat format = g_system->getScreenFormat(); + Graphics::PixelFormat format = g_system->getScreenFormat(); - return (r >> format.rLoss) << format.rShift - | (g >> format.gLoss) << format.gShift - | (b >> format.bLoss) << format.bShift; - } + return (r >> format.rLoss) << format.rShift + | (g >> format.gLoss) << format.gShift + | (b >> format.bLoss) << format.bShift; } void GraphicsManager::DD_VBL() { @@ -1033,11 +897,9 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { void GraphicsManager::FADE_IN_CASSE() { setpal_vga256(Palette); - if (Winbpp == 2) { - DD_Lock(); - CopyAsm16(VESA_BUFFER); - DD_Unlock(); - } + DD_Lock(); + CopyAsm16(VESA_BUFFER); + DD_Unlock(); DD_VBL(); } @@ -1047,11 +909,9 @@ void GraphicsManager::FADE_OUT_CASSE() { memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); setpal_vga256(palette); - if (Winbpp == 2) { - DD_Lock(); - CopyAsm16(VESA_BUFFER); - DD_Unlock(); - } + DD_Lock(); + CopyAsm16(VESA_BUFFER); + DD_Unlock(); DD_VBL(); } @@ -1546,12 +1406,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { continue; if (_vm->_eventsManager._breakoutFl) { - if (Winbpp == 1) { - Copy_Vga(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); - } else if (Winbpp == 2) { - Copy_Vga16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); - } - + Copy_Vga16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); dstRect.left = bloc.x1 * 2; dstRect.top = bloc.y1 * 2 + 30; dstRect.setWidth((bloc.x2 - bloc.x1) * 2); @@ -1584,15 +1439,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { // WORKAROUND: Original didn't lock the screen for access DD_Lock(); - - if (Winbpp == 2) { - m_scroll16A(VESA_BUFFER, xp, yp, width, height, - zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), zoomIn(yp, SDL_ECHELLE)); - } else { - m_scroll2A(VESA_BUFFER, xp, yp, width, height, - zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), zoomIn(yp, SDL_ECHELLE)); - } - + m_scroll16A(VESA_BUFFER, xp, yp, width, height, zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), zoomIn(yp, SDL_ECHELLE)); DD_Unlock(); dstRect.left = zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE); @@ -1602,14 +1449,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { } else { // WORKAROUND: Original didn't lock the screen for access DD_Lock(); - - if (Winbpp == 2) { - m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, - bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); - } else { - m_scroll(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, - bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); - } + m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); dstRect.left = bloc.x1 - _vm->_eventsManager._startPos.x; dstRect.top = bloc.y1; @@ -2365,18 +2205,10 @@ void GraphicsManager::NB_SCREEN() { if (nbrligne == 1280) Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400); DD_Lock(); - if (Winbpp == 2) { - if (SDL_ECHELLE) - m_scroll16A(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (Winbpp == 1) { - if (SDL_ECHELLE) - m_scroll2A(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll2(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (SDL_ECHELLE) + m_scroll16A(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + m_scroll16(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_Unlock(); destP = VESA_SCREEN; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 4d4777a115..df71dea2f4 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -59,7 +59,6 @@ public: int XSCREEN; int YSCREEN; int WinScan; - int Winbpp; byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; int nbrligne; @@ -124,8 +123,6 @@ public: void Cls_Pal(); void SCANLINE(int pitch); void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); - void m_scroll2(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); - void m_scroll2A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void Copy_Vga(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 62974d0f4a..047b26ad32 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -3457,9 +3457,6 @@ void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { int zoom = atoi(iniParams["ZOOM"].c_str()); _globals.XZOOM = CLIP(zoom, 25, 100); } - - _globals.XFORCE16 = iniParams["FORCE16BITS"] == "YES"; - _globals.XFORCE8 = iniParams["FORCE8BITS"] == "YES"; } void HopkinsEngine::INIT_SYSTEM() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c000aa912d..739a060aec 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4204,18 +4204,10 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.freeMemory(v1); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); v2 = _vm->_graphicsManager.VESA_BUFFER; v3 = _vm->_graphicsManager.VESA_SCREEN; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index dbb621c0dd..94241711af 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -163,18 +163,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_LOCK(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_UNLOCK(); v8 = _vm->_graphicsManager.VESA_BUFFER; v9 = _vm->_graphicsManager.VESA_SCREEN; @@ -1327,18 +1319,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.Winbpp == 2) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - if (_vm->_graphicsManager.Winbpp == 1) { - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll2A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll2(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } + if (_vm->_graphicsManager.SDL_ECHELLE) + _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + else + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); v14 = _vm->_graphicsManager.VESA_BUFFER; -- cgit v1.2.3 From 3c31d91d97c6f621e7f9bc22e3efe3b8ca38a079 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Dec 2012 00:26:54 +0100 Subject: HOPKINS: Remove zoom, mode, SDL Zoom and fullscreen variables Also remove functions related to the loading of INI files --- engines/hopkins/anim.cpp | 48 ++++----------- engines/hopkins/events.cpp | 66 ++++---------------- engines/hopkins/files.cpp | 16 ----- engines/hopkins/files.h | 1 - engines/hopkins/globals.cpp | 3 - engines/hopkins/globals.h | 3 - engines/hopkins/graphics.cpp | 139 ++++++------------------------------------- engines/hopkins/graphics.h | 2 - engines/hopkins/hopkins.cpp | 22 +------ engines/hopkins/hopkins.h | 5 -- engines/hopkins/objects.cpp | 9 +-- engines/hopkins/talk.cpp | 10 +--- 12 files changed, 48 insertions(+), 276 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 3f3040fa45..d1c6f18425 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -321,23 +321,17 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { + if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } LABEL_112: _vm->_graphicsManager.DD_Unlock(); @@ -401,23 +395,17 @@ LABEL_88: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { + if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } goto LABEL_112; } @@ -449,23 +437,17 @@ LABEL_88: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { + if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } goto LABEL_112; } @@ -534,23 +516,17 @@ LABEL_114: _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.SCROLL_ECRAN(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { + if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.max_x = SCREEN_WIDTH; _vm->_graphicsManager.DD_Lock(); _vm->_graphicsManager.Cls_Video(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.FADE_INS(); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index e610137981..7756b2b2b1 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -435,10 +435,9 @@ LABEL_63: LABEL_65: _vm->_globals.vitesse = 2; _rateCounter = 0; - if (_vm->_graphicsManager.DOUBLE_ECRAN != true || _vm->_graphicsManager.no_scroll == 1) { + if (!_vm->_graphicsManager.DOUBLE_ECRAN || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { - int v4; if (_vm->_graphicsManager.no_scroll != 2) { if (getMouseX() > _vm->_graphicsManager.SCROLL + 620) _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; @@ -449,33 +448,14 @@ LABEL_65: _vm->_graphicsManager.SCROLL = 0; if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; - if (_vm->_graphicsManager.SDL_ECHELLE) - v4 = _vm->_graphicsManager.Magic_Number(_vm->_graphicsManager.SCROLL); - else - v4 = _vm->_graphicsManager.SCROLL; - if (_vm->_graphicsManager.OLD_SCROLL == v4) { + if (_vm->_graphicsManager.OLD_SCROLL == _vm->_graphicsManager.SCROLL) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { _vm->_fontManager.hideText(9); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) { - int v5 = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, v5); - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.dstrect[0].left = _vm->_graphicsManager.zoomIn(0, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.dstrect[0].top = _vm->_graphicsManager.zoomIn(0x14u, _vm->_graphicsManager.SDL_ECHELLE); - _vm->_graphicsManager.dstrect[0].setWidth(_vm->_graphicsManager.zoomIn(0x280u, _vm->_graphicsManager.SDL_ECHELLE)); - _vm->_graphicsManager.dstrect[0].setHeight(_vm->_graphicsManager.zoomIn(0x1B8u, _vm->_graphicsManager.SDL_ECHELLE)); - } else { - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, v4, 20, SCREEN_WIDTH, 440, 0, 20); - _vm->_graphicsManager.DD_Unlock(); - _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); - } - - // CHECKME: Useless? - // if (!_vm->_globals.BPP_NOAFF) { - // // SDL_UpdateRects(LinuxScr, 1, dstrect); - // } + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.SCROLL, 20, SCREEN_WIDTH, 440, 0, 20); + _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); if (_vm->_globals.NBBLOC) { int v10 = _vm->_globals.NBBLOC + 1; @@ -485,40 +465,16 @@ LABEL_65: } } _vm->_globals.NBBLOC = 0; - _startPos.x = v4; - _vm->_graphicsManager.ofscroll = v4; - _vm->_graphicsManager.SCROLL = v4; + _startPos.x = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager.SCROLL = _vm->_graphicsManager.SCROLL; } - _vm->_graphicsManager.OLD_SCROLL = v4; - _startPos.x = v4; - _vm->_graphicsManager.ofscroll = v4; + _vm->_graphicsManager.OLD_SCROLL = _vm->_graphicsManager.SCROLL; + _startPos.x = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; } _curMouseButton = _mouseButton; _mouseButton = 0; -#if 0 - // Commented by Strangerke. Looks completely useless. - - if (souris_flag == true) { - if (btsouris != 23) { - if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { -/* Commented out in favour of using ScummVM cursor display - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); -*/ - goto LABEL_113; - } - if (btsouris != 23) - goto LABEL_113; - } - if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x && v14 > 1 && v13 > 1) { -/* Commented out in favour of using ScummVM cursor display - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); -*/ - } - } -LABEL_113: -#endif _vm->_soundManager.VERIF_SOUND(); refreshEvents(); } diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 04d4dab3cd..3e840ed60e 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -38,22 +38,6 @@ void FileManager::setParent(HopkinsEngine *vm) { _vm = vm; } -/** - * Load INI File - */ -void FileManager::loadIniFile(Common::StringMap &iniParams) { - // TODO: Review whether we can do something cleaner with ScummVM initialisation than - // just initialising the INI array as if it had read in the INI file - - iniParams["FULLSCREEN"] = "NO"; - iniParams["SETMODE"] = "1"; // 640x480 - iniParams["ZOOM"] = "100"; // No zooming - iniParams["VIDEOMEM"] = "YES"; - iniParams["FORCE8BITS"] = "NO"; - iniParams["FORCE16BITS"] = "YES"; - iniParams["SOUND"] = "YES"; -} - /** * Load a file */ diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index fe63fd0848..3328a66ace 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -41,7 +41,6 @@ public: FileManager(); void setParent(HopkinsEngine *vm); - void loadIniFile(Common::StringMap &iniParams); byte *loadFile(const Common::String &file); int readStream(Common::ReadStream &stream, void *buf, size_t nbytes); void initCensorship(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 83ef82dd31..0d6a77e496 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -124,8 +124,6 @@ Globals::Globals() { MUSICVOL = 6; SOUNDVOL = 6; VOICEVOL = 6; - XSETMODE = 0; - XZOOM = 0; g_old_anim = 0; g_old_sens = 0; g_old_sens2 = 0; @@ -224,7 +222,6 @@ Globals::Globals() { MUSICOFF = false; SOUNDOFF = false; VOICEOFF = false; - XFULLSCREEN = false; SOUNDOFF = false; MUSICOFF = false; VOICEOFF = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f9b855a805..d99808be63 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -340,9 +340,6 @@ public: int SVGA; bool internet; bool PUBEXIT; - bool XFULLSCREEN; - int XSETMODE; - int XZOOM; int PERSO_TYPE; uint vitesse; int INSTALL_TYPE; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index e4e1936b21..ddd05a8fd8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -36,7 +36,6 @@ namespace Hopkins { GraphicsManager::GraphicsManager() { _lockCtr = 0; SDL_MODEYES = false; - SDL_ECHELLE = 0; XSCREEN = YSCREEN = 0; WinScan = 0; PAL_PIXELS = NULL; @@ -101,24 +100,6 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { - SDL_ECHELLE = 0; - - if (_vm->_globals.XSETMODE == 1) - SDL_ECHELLE = 0; - if (_vm->_globals.XSETMODE == 2) - SDL_ECHELLE = 25; - if (_vm->_globals.XSETMODE == 3) - SDL_ECHELLE = 50; - if (_vm->_globals.XSETMODE == 4) - SDL_ECHELLE = 75; - if (_vm->_globals.XSETMODE == 5) - SDL_ECHELLE = _vm->_globals.XZOOM; - - if (SDL_ECHELLE) { - width = zoomIn(width, SDL_ECHELLE); - height = zoomIn(height, SDL_ECHELLE); - } - Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); initGraphics(width, height, true, &pixelFormat16); @@ -217,11 +198,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { max_x = SCREEN_WIDTH; DD_Lock(); Cls_Video(); - if (SDL_ECHELLE) - m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - + m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_Unlock(); } else { SCANLINE(SCREEN_WIDTH * 2); @@ -232,10 +209,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (MANU_SCROLL == 1) { DD_Lock(); - if (SDL_ECHELLE) - m_scroll16A(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_Unlock(); } } @@ -532,7 +506,6 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width *(uint16 *)destP = pixelWord; ++srcP; destP += 2; - Agr_x += SDL_ECHELLE; if ((unsigned int)Agr_x >= 100) { Agr_x -= 100; *(uint16 *)destP = pixelWord; @@ -548,8 +521,6 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width if (Agr_Flag_y == 1) break; - Agr_y += SDL_ECHELLE; - if ((unsigned int)Agr_y < 100) break; @@ -695,10 +666,7 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface } setpal_vga256(palData2); - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -706,10 +674,7 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface setpal_vga256(palette); // Refresh the screen - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -731,10 +696,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } while (palIndex < PALETTE_BLOCK_SIZE); setpal_vga256(palData); - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); int palCtr3 = 0; @@ -750,11 +712,7 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac } while (palCtr4 < (PALETTE_BLOCK_SIZE)); setpal_vga256(palData); - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); ++palCtr3; } while (palMax > palCtr3); @@ -765,23 +723,14 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac setpal_vga256(palData); - if (!SDL_ECHELLE) { - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); - } - goto LABEL_28; + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + return DD_VBL(); } else { for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) palData[i] = 0; setpal_vga256(palData); - if (!SDL_ECHELLE) { - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); - } - -LABEL_28: - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } } @@ -812,10 +761,7 @@ void GraphicsManager::setpal_vga256(const byte *palette) { void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { CHANGE_PALETTE(palette); - if (SDL_ECHELLE) - m_scroll16A(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -1378,19 +1324,6 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { } } -int GraphicsManager::Magic_Number(signed int v) { - int result = v; - - if (!v) - result = 4; - if (result & 1) - ++result; - if (result & 2) - result += 2; - - return result; -} - // Display VESA Segment void GraphicsManager::Affiche_Segment_Vesa() { if (_vm->_globals.NBBLOC == 0) @@ -1417,47 +1350,16 @@ void GraphicsManager::Affiche_Segment_Vesa() { if (bloc.x2 > (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) bloc.x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; - if (SDL_ECHELLE) { - // Calculate the bounds - int xp = Magic_Number(bloc.x1) - 4; - if (xp < _vm->_eventsManager._startPos.x) - xp = _vm->_eventsManager._startPos.x; - int yp = Magic_Number(bloc.y1) - 4; - if (yp < 0) - yp = 0; - int width = Magic_Number(bloc.x2) + 4 - xp; - if (width < 4) - width = 4; - int height = Magic_Number(bloc.y2) + 4 - yp; - if (height < 4) - height = 4; - - if ((xp - _vm->_eventsManager._startPos.x + width) > SCREEN_WIDTH) - xp -= 4; - if ((height - yp) > (SCREEN_HEIGHT - 40)) - yp -= 4; - - // WORKAROUND: Original didn't lock the screen for access - DD_Lock(); - m_scroll16A(VESA_BUFFER, xp, yp, width, height, zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE), zoomIn(yp, SDL_ECHELLE)); - DD_Unlock(); - - dstRect.left = zoomIn(xp - _vm->_eventsManager._startPos.x, SDL_ECHELLE); - dstRect.top = zoomIn(yp, SDL_ECHELLE); - dstRect.setWidth(zoomIn(width, SDL_ECHELLE)); - dstRect.setHeight(zoomIn(height, SDL_ECHELLE)); - } else { - // WORKAROUND: Original didn't lock the screen for access - DD_Lock(); - m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); + // WORKAROUND: Original didn't lock the screen for access + DD_Lock(); + m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); - dstRect.left = bloc.x1 - _vm->_eventsManager._startPos.x; - dstRect.top = bloc.y1; - dstRect.setWidth(bloc.x2 - bloc.x1); - dstRect.setHeight(bloc.y2 - bloc.y1); + dstRect.left = bloc.x1 - _vm->_eventsManager._startPos.x; + dstRect.top = bloc.y1; + dstRect.setWidth(bloc.x2 - bloc.x1); + dstRect.setHeight(bloc.y2 - bloc.y1); - DD_Unlock(); - } + DD_Unlock(); } _vm->_globals.BLOC[idx].field0 = 0; @@ -2205,10 +2107,7 @@ void GraphicsManager::NB_SCREEN() { if (nbrligne == 1280) Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400); DD_Lock(); - if (SDL_ECHELLE) - m_scroll16A(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - m_scroll16(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + m_scroll16(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_Unlock(); destP = VESA_SCREEN; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index df71dea2f4..f88fee9fbc 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -55,7 +55,6 @@ private: public: int _lockCtr; bool SDL_MODEYES; - int SDL_ECHELLE; int XSCREEN; int YSCREEN; int WinScan; @@ -166,7 +165,6 @@ public: void VISU_ALL(); void RESET_SEGMENT_VESA(); void Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2); - int Magic_Number(int v); void Affiche_Segment_Vesa(); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 047b26ad32..c744d25fe1 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -95,10 +95,6 @@ Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc) Common::Error HopkinsEngine::run() { _saveLoadManager.initSaves(); - Common::StringMap iniParams; - _fileManager.loadIniFile(iniParams); - processIniParams(iniParams); - _globals.setConfig(); _fileManager.initCensorship(); INIT_SYSTEM(); @@ -3443,22 +3439,6 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } -void HopkinsEngine::processIniParams(Common::StringMap &iniParams) { - _globals.XFULLSCREEN = iniParams["FULLSCREEN"] == "YES"; - - _globals.XSETMODE = 1; - if (iniParams.contains("SETMODE")) { - int setMode = atoi(iniParams["SETMODE"].c_str()); - _globals.XSETMODE = CLIP(setMode, 1, 5); - } - - _globals.XZOOM = 0; - if (_globals.XSETMODE == 5 && iniParams.contains("ZOOM")) { - int zoom = atoi(iniParams["ZOOM"].c_str()); - _globals.XZOOM = CLIP(zoom, 25, 100); - } -} - void HopkinsEngine::INIT_SYSTEM() { // Set graphics mode _graphicsManager.SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); @@ -3579,7 +3559,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - if (_graphicsManager.DOUBLE_ECRAN == true) { + if (_graphicsManager.DOUBLE_ECRAN) { _graphicsManager.no_scroll = 2; bool v3 = false; _graphicsManager.SCROLL = 0; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 34b65dcaea..62f49d33e6 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -80,11 +80,6 @@ private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; - /** - * Processes the loaded list of ini file parameters - */ - void processIniParams(Common::StringMap &iniParams); - void INIT_SYSTEM(); void PASS(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 739a060aec..6e552e138f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2856,7 +2856,7 @@ void ObjectsManager::PARADISE() { if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { - if (_vm->_graphicsManager.DOUBLE_ECRAN == true) { + if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= XSPR(0) - 320) goto LABEL_64; @@ -4204,10 +4204,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.freeMemory(v1); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); v2 = _vm->_graphicsManager.VESA_BUFFER; v3 = _vm->_graphicsManager.VESA_SCREEN; @@ -5631,7 +5628,7 @@ LABEL_70: if (_vm->_globals.PERSO_TYPE == 2) SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 20, 127); _vm->_eventsManager.setMouseXY(PERX, PERY); - if (_vm->_graphicsManager.DOUBLE_ECRAN == true) + if (_vm->_graphicsManager.DOUBLE_ECRAN) _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; VERIFTAILLE(); SPRITE_ON(0); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 94241711af..eaf1199c13 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -163,10 +163,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_LOCK(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_UNLOCK(); v8 = _vm->_graphicsManager.VESA_BUFFER; v9 = _vm->_graphicsManager.VESA_SCREEN; @@ -1319,10 +1316,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); _vm->_graphicsManager.DD_Lock(); - if (_vm->_graphicsManager.SDL_ECHELLE) - _vm->_graphicsManager.m_scroll16A(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - else - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.DD_Unlock(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); v14 = _vm->_graphicsManager.VESA_BUFFER; -- cgit v1.2.3 From 38437c4efeae05a093adbcc23f21bbe109658a07 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Dec 2012 02:11:36 +0100 Subject: HOPKINS: Some more renaming --- engines/hopkins/computer.cpp | 8 +- engines/hopkins/events.cpp | 11 --- engines/hopkins/globals.h | 13 ++-- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/objects.cpp | 175 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 9 +-- engines/hopkins/saveload.cpp | 6 +- engines/hopkins/script.cpp | 48 ++++++------ 8 files changed, 128 insertions(+), 144 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 3a23bec6c0..f978fba682 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -589,7 +589,7 @@ void ComputerManager::readText(int idx) { * Display breakout when Games sub-menu is selected */ void ComputerManager::displayGamesSubMenu() { - const byte *v1 = _vm->_objectsManager.Sprite[0].spriteData; + const byte *v1 = _vm->_objectsManager.Sprite[0]._spriteData; uint oldSpeed = _vm->_globals.vitesse; _vm->_globals.vitesse = 1; @@ -620,7 +620,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); _breakoutSpr = _vm->_globals.freeMemory(_breakoutSpr); _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); - _vm->_objectsManager.Sprite[0].spriteData = v1; + _vm->_objectsManager.Sprite[0]._spriteData = v1; _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); @@ -707,8 +707,8 @@ void ComputerManager::newLevel() { _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); displayBricks(); - _vm->_objectsManager.SPRITE(_breakoutSpr, 150, 192, 0, 13, 0, 0, 0, 0); - _vm->_objectsManager.SPRITE(_breakoutSpr, 164, 187, 1, 14, 0, 0, 0, 0); + _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); + _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); _ballPosition = Common::Point(164, 187); RAQX = 150; _vm->_objectsManager.SPRITE_ON(0); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 7756b2b2b1..17909b16a1 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -392,22 +392,11 @@ LABEL_45: v13 -= yp + v13 - _vm->_graphicsManager.max_y; if (v14 > 1 && v13 > 1) { _vm->_eventsManager.updateCursor(); -/* Commented out in favour of using ScummVM cursor display - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); - - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bufferobjet, v15 + 300, yp + 300, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v14 + v15, yp + v13); -*/ } } goto LABEL_54; } -/* Commented out in favour of using ScummVM cursor display - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.cache_souris, v15, yp, v14, v13); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, pointeur_souris, v15 + 300, yp + 300, souris_n); -*/ - _vm->_eventsManager.updateCursor(); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); LABEL_54: diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index d99808be63..2019e7d098 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/str.h" +#include "common/events.h" namespace Hopkins { @@ -174,10 +175,9 @@ enum TriMode { TRI_NONE = 0, TRI_BOB = 1, TRI_SPRITE = 2, TRI_CACHE = 3 }; * Structure to represent a pending display of either a Bob, Sprite, or Cache Item. */ struct TriItem { - TriMode triMode; - int index; - int priority; - int unused; + TriMode _triMode; + int _index; + int _priority; }; struct CacheItem { @@ -205,10 +205,9 @@ struct HopkinsItem { }; struct CharacterLocation { - int xp; - int yp; + Common::Point _pos; int field2; - int location; + int _location; int field4; }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c744d25fe1..c156e37d3a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4768,7 +4768,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _objectsManager.PERX = -20; _objectsManager.PERI = 0; } - _objectsManager.SPRITE(_globals.PERSO, _objectsManager.PERX, 110, 0, _objectsManager.PERI, 0, 0, 0, 0); + _objectsManager.SPRITE(_globals.PERSO, Common::Point(_objectsManager.PERX, 110), 0, _objectsManager.PERI, 0, 0, 0, 0); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6e552e138f..32f2175e7c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -415,7 +415,7 @@ void ObjectsManager::AFF_SPRITES() { do { v11 = arr[v34]; v12 = &arr[v34 + 1]; - if (_vm->_globals.Tri[arr[v34]].priority > _vm->_globals.Tri[*v12].priority) { + if (_vm->_globals.Tri[arr[v34]]._priority > _vm->_globals.Tri[*v12]._priority) { arr[v34] = *v12; *v12 = v11; ++v27; @@ -429,50 +429,49 @@ void ObjectsManager::AFF_SPRITES() { if (_vm->_globals.NBTRI + 1 > 1) { do { v13 = arr[v35]; - switch (_vm->_globals.Tri[v13].triMode) { + switch (_vm->_globals.Tri[v13]._triMode) { case TRI_BOB: - DEF_BOB(_vm->_globals.Tri[v13].index); + DEF_BOB(_vm->_globals.Tri[v13]._index); break; case TRI_SPRITE: - DEF_SPRITE(_vm->_globals.Tri[v13].index); + DEF_SPRITE(_vm->_globals.Tri[v13]._index); break; case TRI_CACHE: - DEF_CACHE(_vm->_globals.Tri[v13].index); + DEF_CACHE(_vm->_globals.Tri[v13]._index); break; default: break; } - _vm->_globals.Tri[v13].triMode = TRI_NONE; + _vm->_globals.Tri[v13]._triMode = TRI_NONE; ++v35; } while (v35 < _vm->_globals.NBTRI + 1); } } else { if (_vm->_globals.NBTRI + 1 > 1) { for (int idx = 1; idx < (_vm->_globals.NBTRI + 1); ++idx) { - switch (_vm->_globals.Tri[idx].triMode) { + switch (_vm->_globals.Tri[idx]._triMode) { case TRI_BOB: - DEF_BOB(_vm->_globals.Tri[idx].index); + DEF_BOB(_vm->_globals.Tri[idx]._index); break; case TRI_SPRITE: - DEF_SPRITE(_vm->_globals.Tri[idx].index); + DEF_SPRITE(_vm->_globals.Tri[idx]._index); break; case TRI_CACHE: - DEF_CACHE(_vm->_globals.Tri[idx].index); + DEF_CACHE(_vm->_globals.Tri[idx]._index); break; default: break; } - _vm->_globals.Tri[idx].triMode = TRI_NONE; + _vm->_globals.Tri[idx]._triMode = TRI_NONE; } } } // Reset the Tri array for (int idx = 0; idx < 50; ++idx) { - _vm->_globals.Tri[idx].triMode = TRI_NONE; - _vm->_globals.Tri[idx].index = 0; - _vm->_globals.Tri[idx].priority = 0; - _vm->_globals.Tri[idx].unused = 0; + _vm->_globals.Tri[idx]._triMode = TRI_NONE; + _vm->_globals.Tri[idx]._index = 0; + _vm->_globals.Tri[idx]._priority = 0; } _vm->_globals.NBTRI = 0; @@ -877,7 +876,7 @@ void ObjectsManager::VERIFCACHE() { v10 = 0; do { if (Sprite[v10].field0 == 1) { - if (Sprite[v10].spriteIndex != 250) { + if (Sprite[v10]._spriteIndex != 250) { v1 = Sprite[v10].field2C; v11 = Sprite[v10].field30 + v1; v2 = Sprite[v10].field32 + Sprite[v10].field2E; @@ -960,11 +959,11 @@ void ObjectsManager::DEF_SPRITE(int idx) { v3 = Sprite[v2].field2C; v4 = Sprite[v2].field2E; if (Sprite[v2].field28) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, - v3 + 300, v4 + 300, Sprite[v2].spriteIndex); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2]._spriteData, + v3 + 300, v4 + 300, Sprite[v2]._spriteIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2].spriteData, - v3 + 300, v4 + 300, Sprite[v2].spriteIndex, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2]._spriteData, + v3 + 300, v4 + 300, Sprite[v2]._spriteIndex, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); v5 = idx; v6 = idx; @@ -1034,18 +1033,18 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int v22; Sprite[idx].field2A = 0; - int spriteIndex = Sprite[idx].spriteIndex; + int spriteIndex = Sprite[idx]._spriteIndex; if (spriteIndex != 250) { if (Sprite[idx].fieldE) { - v5 = get_offsetx(Sprite[idx].spriteData, spriteIndex, 1); + v5 = get_offsetx(Sprite[idx]._spriteData, spriteIndex, 1); v22 = Sprite[idx].field12 + v5; v4 = Sprite[idx].field12 + v5; - v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 1); + v6 = get_offsety(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex, 1); } else { - v3 = get_offsetx(Sprite[idx].spriteData, spriteIndex, 0); + v3 = get_offsetx(Sprite[idx]._spriteData, spriteIndex, 0); v22 = Sprite[idx].field12 + v3; v4 = Sprite[idx].field12 + v3; - v6 = get_offsety(Sprite[idx].spriteData, Sprite[idx].spriteIndex, 0); + v6 = get_offsety(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex, 0); } v9 = Sprite[idx].field14 + v6; @@ -1106,8 +1105,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } } - v15 = Sprite[idx].spritePos.x - v22; - v16 = Sprite[idx].spritePos.y - v7; + v15 = Sprite[idx]._spritePos.x - v22; + v16 = Sprite[idx]._spritePos.y - v7; Sprite[idx].field2C = v15; Sprite[idx].field2E = v16; Sprite[idx].field2A = 1; @@ -1118,8 +1117,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { _vm->_globals.Liste[v17].field0 = 1; _vm->_globals.Liste[v17].field2 = v15; _vm->_globals.Liste[v17].field4 = v16; - width = getWidth(Sprite[idx].spriteData, Sprite[idx].spriteIndex); - height = getHeight(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + width = getWidth(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); + height = getHeight(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); if (zoomPercent) { width = _vm->_graphicsManager.zoomIn(width, zoomPercent); @@ -1145,9 +1144,9 @@ int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { error("NBTRI too high"); result = _vm->_globals.NBTRI; - _vm->_globals.Tri[result].triMode = triMode; - _vm->_globals.Tri[result].index = index; - _vm->_globals.Tri[result].priority = priority; + _vm->_globals.Tri[result]._triMode = triMode; + _vm->_globals.Tri[result]._index = index; + _vm->_globals.Tri[result]._priority = priority; return result; } @@ -1452,13 +1451,13 @@ void ObjectsManager::AFF_VBOB() { int ObjectsManager::XSPR(int idx) { if (idx > 5) error("request of the Coord. x a sprite > MAX_SPRITE."); - return Sprite[idx].spritePos.x; + return Sprite[idx]._spritePos.x; } int ObjectsManager::YSPR(int idx) { if (idx > 5) error("request of the Coord. y a sprite > MAX_SPRITE."); - return Sprite[idx].spritePos.y; + return Sprite[idx]._spritePos.y; } void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { @@ -1471,7 +1470,7 @@ void ObjectsManager::CLEAR_SPR() { idx = 0; do { Sprite[idx].field1C = g_PTRNUL; - Sprite[idx].spriteData = g_PTRNUL; + Sprite[idx]._spriteData = g_PTRNUL; Sprite[idx].field0 = 0; ++idx; } while (idx <= 4); @@ -1495,12 +1494,12 @@ void ObjectsManager::SPRITE_ON(int idx) { Sprite[idx].field0 = 1; } -void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { +void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { if (idx > 5) error("Attempt to display a sprite > MAX_SPRITE."); - Sprite[idx].spriteData = spriteData; - Sprite[idx].spritePos = Common::Point(xp, yp); - Sprite[idx].spriteIndex = spriteIndex; + Sprite[idx]._spriteData = spriteData; + Sprite[idx]._spritePos = pos; + Sprite[idx]._spriteIndex = spriteIndex; Sprite[idx].fieldC = a6; Sprite[idx].field12 = a8; Sprite[idx].field14 = a9; @@ -1522,7 +1521,7 @@ void ObjectsManager::SPRITE(const byte *spriteData, int xp, int yp, int idx, int } void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5) { - Sprite[idx].spriteData = spriteData; + Sprite[idx]._spriteData = spriteData; Sprite[idx].field1C = a3; Sprite[idx].field20 = a4; Sprite[idx].field24 = 0; @@ -1553,13 +1552,13 @@ void ObjectsManager::SPRITE_GEL(int idx) { int ObjectsManager::SXSPR(int idx) { if (idx > 5) error("request of the size of a sprite x > MAX_SPRITE."); - return getWidth(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + return getWidth(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); } int ObjectsManager::SYSPR(int idx) { if (idx > 5) error("request of the size of a sprite y > MAX_SPRITE."); - return getHeight(Sprite[idx].spriteData, Sprite[idx].spriteIndex); + return getHeight(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); } int ObjectsManager::POSISPR(int idx) { @@ -1575,20 +1574,20 @@ void ObjectsManager::SETPOSISPR(int idx, int a2) { void ObjectsManager::SETXSPR(int idx, int xp) { if (idx > 5) error("Set the Coord. x a sprite> MAX_SPRITE."); - Sprite[idx].spritePos.x = xp; + Sprite[idx]._spritePos.x = xp; } void ObjectsManager::SETANISPR(int idx, int spriteIndex) { if (idx > 5) error("Set the Coord. x a sprite> MAX_SPRITE."); - Sprite[idx].spriteIndex = spriteIndex; + Sprite[idx]._spriteIndex = spriteIndex; } void ObjectsManager::SETYSPR(int idx, int yp) { if ( idx > 5 ) error("Set the Coord. y a sprite> MAX_SPRITE."); - Sprite[idx].spritePos.y = yp; + Sprite[idx]._spritePos.y = yp; } // Set Sprite Size @@ -2577,7 +2576,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANY = 319; _vm->_globals.PLANI = 1; } - SPRITE(sprite_ptr, _vm->_globals.PLANX, _vm->_globals.PLANY, 0, _vm->_globals.PLANI, 0, 0, 5, 5); + SPRITE(sprite_ptr, Common::Point(_vm->_globals.PLANX, _vm->_globals.PLANY), 0, _vm->_globals.PLANI, 0, 0, 5, 5); _vm->_eventsManager.setMouseXY(_vm->_globals.PLANX, _vm->_globals.PLANY); my_anim = 0; _vm->_eventsManager.mouseOn(); @@ -3022,17 +3021,17 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.chemin = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS - && _vm->_globals.SAUVEGARDE->realHopkins.location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->realHopkins._location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->samantha; - loc->xp = XSPR(0); - loc->yp = YSPR(0); + loc->_pos.x = XSPR(0); + loc->_pos.y = YSPR(0); loc->field2 = 64; - loc->location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].field0; SPRITE_OFF(1); - SPRITE(_vm->_globals.TETE, loc->xp, loc->yp, 1, 3, loc->field4, 0, 20, 127); + SPRITE(_vm->_globals.TETE, loc->_pos, 1, 3, loc->field4, 0, 20, 127); SPRITE_ON(1); SPRITE_OFF(0); @@ -3045,21 +3044,21 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; - SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 34, 190); + SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA - && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->samantha._location == _vm->_globals.ECRAN) { CH_TETE = 0; loc = &_vm->_globals.SAUVEGARDE->realHopkins; - loc->xp = XSPR(0); - loc->yp = YSPR(0); + loc->_pos.x = XSPR(0); + loc->_pos.y = YSPR(0); loc->field2 = 64; - loc->location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; SPRITE_OFF(1); - SPRITE(_vm->_globals.TETE, loc->xp, loc->yp, 1, 2, loc->field4, 0, 34, 190); + SPRITE(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); SPRITE_ON(1); SPRITE_OFF(0); @@ -3071,33 +3070,33 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 2; - SPRITE(_vm->_globals.PERSO, loc->xp, loc->yp, 0, 64, loc->field4, 0, 20, 127); + SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); } else { switch (oldCharacter) { case CHARACTER_HOPKINS: loc = &_vm->_globals.SAUVEGARDE->realHopkins; - loc->xp = XSPR(0); - loc->yp = YSPR(0); + loc->_pos.x = XSPR(0); + loc->_pos.y = YSPR(0); loc->field2 = 64; - loc->location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; break; case CHARACTER_HOPKINS_CLONE: loc = &_vm->_globals.SAUVEGARDE->cloneHopkins; - loc->xp = XSPR(0); - loc->yp = YSPR(0); + loc->_pos.x = XSPR(0); + loc->_pos.y = YSPR(0); loc->field2 = 64; - loc->location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; break; case CHARACTER_SAMANTHA: loc = &_vm->_globals.SAUVEGARDE->samantha; - loc->xp = XSPR(0); - loc->yp = YSPR(0); + loc->_pos.x = XSPR(0); + loc->_pos.y = YSPR(0); loc->field2 = 64; - loc->location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals.ECRAN; loc->field4 = Sprite[0].fieldC; break; default: @@ -3110,21 +3109,21 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->realHopkins.location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->realHopkins._location; break; case CHARACTER_HOPKINS_CLONE: _vm->_globals.SAUVEGARDE->data[svField121] = 1; _vm->_globals.SAUVEGARDE->data[svField354] = 1; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->cloneHopkins.location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->cloneHopkins._location; break; case CHARACTER_SAMANTHA: _vm->_globals.SAUVEGARDE->data[svField121] = 0; _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->samantha.location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->samantha._location; break; } } @@ -5176,8 +5175,8 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in v15 = a5 / 2; else if (_vm->_globals.vitesse == 3) v15 = a5 / 3; - v14 = Sprite[0].spriteData; - spriteIndex = Sprite[0].spriteIndex; + v14 = Sprite[0]._spriteData; + spriteIndex = Sprite[0]._spriteIndex; v16 = Sprite[0].fieldE; Sprite[0].field12 += a3; Sprite[0].field14 += a4; @@ -5200,14 +5199,14 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in ++v18; if (v7 == 1) { if (v13 == -1) { - Sprite[0].spriteData = v14; - Sprite[0].spriteIndex = spriteIndex; + Sprite[0]._spriteData = v14; + Sprite[0]._spriteIndex = spriteIndex; Sprite[0].field12 -= a3; Sprite[0].field14 -= a4; Sprite[0].fieldE = v16; } else { - Sprite[0].spriteData = spriteData; - Sprite[0].spriteIndex = v13; + Sprite[0]._spriteData = spriteData; + Sprite[0]._spriteIndex = v13; } v10 = 0; v9 = v15; @@ -5243,8 +5242,8 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int v14 = a5 / 2; else if (_vm->_globals.vitesse == 3) v14 = a5 / 3; - S_old_spr = Sprite[0].spriteData; - S_old_ani = Sprite[0].spriteIndex; + S_old_spr = Sprite[0]._spriteData; + S_old_ani = Sprite[0]._spriteIndex; S_old_ret = Sprite[0].fieldE; Sprite[0].field12 += a3; Sprite[0].field14 += a4; @@ -5272,8 +5271,8 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int ++strPos; } while (!loopCond); if (spriteIndex != -1) { - Sprite[0].spriteData = a1; - Sprite[0].spriteIndex = spriteIndex; + Sprite[0]._spriteData = a1; + Sprite[0]._spriteIndex = spriteIndex; } v10 = 0; v9 = v14; @@ -5327,14 +5326,14 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a ++v14; if (v6 == 1) { if (spriteIndex == -1) { - Sprite[0].spriteData = S_old_spr; - Sprite[0].spriteIndex = S_old_ani; + Sprite[0]._spriteData = S_old_spr; + Sprite[0]._spriteIndex = S_old_ani; Sprite[0].field12 -= a3; Sprite[0].field14 -= a4; Sprite[0].fieldE = S_old_ret; } else { - Sprite[0].spriteData = a1; - Sprite[0].spriteIndex = spriteIndex; + Sprite[0]._spriteData = a1; + Sprite[0]._spriteIndex = spriteIndex; } v9 = 0; @@ -5492,7 +5491,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } _vm->_eventsManager.mouseOn(); if (_vm->_globals.ECRAN == 61) { - SPRITE(_vm->_globals.PERSO, 330, 418, 0, 60, 0, 0, 34, 190); + SPRITE(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, 0, 34, 190); SPRITE_ON(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); @@ -5622,11 +5621,11 @@ LABEL_70: } _vm->_globals.HOPKINS_DATA(); if (!_vm->_globals.PERSO_TYPE) - SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 34, 190); + SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 34, 190); if (_vm->_globals.PERSO_TYPE == 1) - SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 28, 155); + SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 28, 155); if (_vm->_globals.PERSO_TYPE == 2) - SPRITE(_vm->_globals.PERSO, PERX, PERY, 0, PERI, 0, 0, 20, 127); + SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 20, 127); _vm->_eventsManager.setMouseXY(PERX, PERY); if (_vm->_graphicsManager.DOUBLE_ECRAN) _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 10e0265e20..afccec9c04 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -32,12 +32,11 @@ namespace Hopkins { struct SpriteItem { int field0; - const byte *spriteData; - Common::Point spritePos; - int spriteY; + const byte *_spriteData; + Common::Point _spritePos; int fieldC; int fieldE; - int spriteIndex; + int _spriteIndex; int field12; int field14; byte *field1C; @@ -164,7 +163,7 @@ public: void CLEAR_SPR(); void SPRITE_ON(int idx); - void SPRITE(const byte *spriteData, int xp, int yp, int idx, int spriteIndex, int a6, int a7, int a8, int a9); + void SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5); void SPRITE_OFF(int idx); void SPRITE_GEL(int idx); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 4b08f18f67..f56706a44e 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -263,10 +263,10 @@ void SaveLoadManager::syncSavegameData(Common::Serializer &s) { } void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLocation &item) { - s.syncAsSint16LE(item.xp); - s.syncAsSint16LE(item.yp); + s.syncAsSint16LE(item._pos.x); + s.syncAsSint16LE(item._pos.y); s.syncAsSint16LE(item.field2); - s.syncAsSint16LE(item.location); + s.syncAsSint16LE(item._location); s.syncAsSint16LE(item.field4); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c56637979b..9bd6ce0964 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -213,34 +213,33 @@ LABEL_1141: _vm->_objectsManager.PERI = v5; if (_vm->_objectsManager.CH_TETE == 1) { if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 - && _vm->_globals.SAUVEGARDE->cloneHopkins.xp && _vm->_globals.SAUVEGARDE->cloneHopkins.yp - && _vm->_globals.SAUVEGARDE->cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->cloneHopkins.location) { + && _vm->_globals.SAUVEGARDE->cloneHopkins._pos.x && _vm->_globals.SAUVEGARDE->cloneHopkins._pos.y + && _vm->_globals.SAUVEGARDE->cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->cloneHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->cloneHopkins.xp; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->cloneHopkins.yp; + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->cloneHopkins._pos.x; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->cloneHopkins._pos.y; _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->cloneHopkins.field2; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->samantha.xp && _vm->_globals.SAUVEGARDE->samantha.yp - && _vm->_globals.SAUVEGARDE->samantha.field2 && _vm->_globals.SAUVEGARDE->samantha.location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->samantha.xp; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->samantha.yp; + && _vm->_globals.SAUVEGARDE->samantha._pos.x && _vm->_globals.SAUVEGARDE->samantha._pos.y + && _vm->_globals.SAUVEGARDE->samantha.field2 && _vm->_globals.SAUVEGARDE->samantha._location) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->samantha._pos.x; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->samantha._pos.y; _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->samantha.field2; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->realHopkins.xp && _vm->_globals.SAUVEGARDE->realHopkins.yp - && _vm->_globals.SAUVEGARDE->realHopkins.field2 && _vm->_globals.SAUVEGARDE->realHopkins.location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->realHopkins.xp; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->realHopkins.yp; + && _vm->_globals.SAUVEGARDE->realHopkins._pos.x && _vm->_globals.SAUVEGARDE->realHopkins._pos.y + && _vm->_globals.SAUVEGARDE->realHopkins.field2 && _vm->_globals.SAUVEGARDE->realHopkins._location) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->realHopkins._pos.x; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->realHopkins._pos.y; _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->realHopkins.field2; } } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->realHopkins.location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->realHopkins._location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->realHopkins.xp, - _vm->_globals.SAUVEGARDE->realHopkins.yp, + _vm->_globals.SAUVEGARDE->realHopkins._pos, 1, 2, _vm->_globals.SAUVEGARDE->realHopkins.field4, @@ -252,11 +251,10 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 && _vm->_globals.SAUVEGARDE->data[svField355] == 1 - && _vm->_globals.SAUVEGARDE->samantha.location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->samantha._location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->samantha.xp, - _vm->_globals.SAUVEGARDE->samantha.yp, + _vm->_globals.SAUVEGARDE->samantha._pos, 1, 3, _vm->_globals.SAUVEGARDE->samantha.field4, @@ -1941,10 +1939,10 @@ LABEL_1141: _vm->_eventsManager.VBL(); } CharacterLocation *v51 = &_vm->_globals.SAUVEGARDE->realHopkins; - v51->xp = _vm->_objectsManager.XSPR(0); - v51->yp = _vm->_objectsManager.YSPR(0); + v51->_pos.x = _vm->_objectsManager.XSPR(0); + v51->_pos.y = _vm->_objectsManager.YSPR(0); v51->field2 = 57; - v51->location = 97; + v51->_location = 97; _vm->_globals.SAUVEGARDE->data[svField121] = 1; _vm->_globals.SAUVEGARDE->data[svField352] = 1; _vm->_globals.SAUVEGARDE->data[svField353] = 1; @@ -2169,10 +2167,10 @@ LABEL_1141: _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; CharacterLocation *v53 = &_vm->_globals.SAUVEGARDE->samantha; - v53->xp = 404; - v53->yp = 395; + v53->_pos.x = 404; + v53->_pos.y = 395; v53->field2 = 64; - v53->location = _vm->_globals.ECRAN; + v53->_location = _vm->_globals.ECRAN; int v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) @@ -2185,7 +2183,7 @@ LABEL_1141: _vm->_globals.SAUVEGARDE->data[svField355] = 1; _vm->_objectsManager.DEUXPERSO = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->xp, v53->yp, 1, 3, v53->field4, 0, 20, 127); + _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); _vm->_objectsManager.SPRITE_ON(1); } if (v76 == 245) { -- cgit v1.2.3 From 0aab5168ce61d51fe0034db3c30247dd23b22813 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Dec 2012 09:56:50 +0100 Subject: HOPKINS: Start renaming ObjectsManager members --- engines/hopkins/computer.cpp | 4 +- engines/hopkins/dialogs.cpp | 14 +- engines/hopkins/graphics.cpp | 47 +--- engines/hopkins/graphics.h | 1 - engines/hopkins/objects.cpp | 597 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 25 +- engines/hopkins/script.cpp | 8 +- engines/hopkins/talk.cpp | 8 +- 8 files changed, 329 insertions(+), 375 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index f978fba682..467b21352b 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -589,7 +589,7 @@ void ComputerManager::readText(int idx) { * Display breakout when Games sub-menu is selected */ void ComputerManager::displayGamesSubMenu() { - const byte *v1 = _vm->_objectsManager.Sprite[0]._spriteData; + const byte *v1 = _vm->_objectsManager._sprite[0]._spriteData; uint oldSpeed = _vm->_globals.vitesse; _vm->_globals.vitesse = 1; @@ -620,7 +620,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); _breakoutSpr = _vm->_globals.freeMemory(_breakoutSpr); _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); - _vm->_objectsManager.Sprite[0]._spriteData = v1; + _vm->_objectsManager._sprite[0]._spriteData = v1; _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e29592ad30..627a3c8fe0 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -305,7 +305,7 @@ void DialogsManager::showInventory() { if (!_removeInventFl && !_inventDisplayedFl && !_vm->_globals._disableInventFl) { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; - _vm->_objectsManager.FLAG_VISIBLE = false; + _vm->_objectsManager._visibleFl = false; for (int v1 = 0; v1 <= 1; v1++) { inventAnim(); _vm->_eventsManager.getMouseX(); @@ -385,7 +385,7 @@ LABEL_7: int v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); v13 = v11; if (v11 != v10) - _vm->_objectsManager.PARAMCADRE(v11); + _vm->_objectsManager.initBorder(v11); if (_vm->_eventsManager._mouseCursorId != 16) { if ((uint16)(_vm->_eventsManager._mouseCursorId - 1) > 1u) { if (_vm->_eventsManager._mouseCursorId != 3) { @@ -461,10 +461,8 @@ LABEL_7: _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); - _vm->_objectsManager.old_cady = 0; - _vm->_objectsManager.cady = 0; - _vm->_objectsManager.old_cadx = 0; - _vm->_objectsManager.cadx = 0; + _vm->_objectsManager._oldBorderPos = Common::Point(0, 0); + _vm->_objectsManager._borderPos = Common::Point(0, 0); _vm->_globals._disableInventFl = false; _vm->_graphicsManager.no_scroll = 0; } @@ -475,14 +473,14 @@ LABEL_7: */ void DialogsManager::inventAnim() { if (!_vm->_globals._disableInventFl) { - if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager.FLAG_VISIBLE) { + if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; } - if (_vm->_objectsManager.FLAG_VISIBLE) { + if (_vm->_objectsManager._visibleFl) { if (_vm->_objectsManager.I_old_x <= 1) _vm->_objectsManager.I_old_x = 2; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ddd05a8fd8..27a39059cb 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -534,49 +534,6 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } while (yCtr != 1); } -void GraphicsManager::Copy_Vga(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - const byte *srcP; - byte *destP; - int yCount; - int xCount; - byte srcByte; - byte *loopDestP; - byte *loopSrcP; - byte *loopSrc2P; - byte *tempDestP; - const byte *tempSrcP; - int yCtr; - - assert(VideoPtr); - srcP = xp + 320 * yp + surface; - destP = 30 * WinScan + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels; - yCount = height; - - do { - yCtr = yCount; - xCount = width; - tempSrcP = srcP; - tempDestP = destP; - do { - srcByte = *srcP; - *destP = *srcP; - loopDestP = WinScan + destP; - *loopDestP = srcByte; - loopSrcP = loopDestP - WinScan + 1; - *loopSrcP = srcByte; - loopSrc2P = WinScan + loopSrcP; - *loopSrc2P = srcByte; - ++srcP; - destP = loopSrc2P - WinScan + 1; - --xCount; - } while (xCount); - - destP = WinScan + WinScan + tempDestP; - srcP = tempSrcP + 320; - yCount = yCtr - 1; - } while (yCtr != 1); -} - void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { const byte *srcP; uint16 *destP; @@ -2092,8 +2049,8 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_globals.COUCOU = dataP; } } - _vm->_objectsManager.FORCEZONE = 1; - _vm->_objectsManager.CHANGEVERBE = 0; + _vm->_objectsManager._forceZoneFl = true; + _vm->_objectsManager._changeVerbFl = false; } void GraphicsManager::NB_SCREEN() { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index f88fee9fbc..deb396b0db 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -124,7 +124,6 @@ public: void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); - void Copy_Vga(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); void fade_in(const byte *palette, int step, const byte *surface); void fade_out(const byte *palette, int step, const byte *surface); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 32f2175e7c..36c5395ab8 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -35,35 +35,36 @@ namespace Hopkins { ObjectsManager::ObjectsManager() { for (int i = 0; i < 6; ++i) { - Common::fill((byte *)&Sprite[i], (byte *)&Sprite[i] + sizeof(SpriteItem), 0); + Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0); } - PRIORITY = 0; - old_cadx = old_cady = old_cadi = 0; - cadx = cady = cadi = 0; + _priorityFl = false; + _oldBorderPos = Common::Point(0, 0); + _oldBorderSpriteIndex = 0; + _borderPos = Common::Point(0, 0); + _borderSpriteIndex = 0; SL_X = SL_Y = 0; I_old_x = I_old_y = 0; g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; SL_SPR = g_PTRNUL; SL_SPR2 = g_PTRNUL; - sprite_ptr = g_PTRNUL; + _spritePtr = g_PTRNUL; S_old_spr = g_PTRNUL; PERSO_ON = false; SL_FLAG = false; SL_MODE = false; - FLAG_VISIBLE = false; - DESACTIVE_CURSOR = 0; + _visibleFl = false; + _disableCursorFl = false; BOBTOUS = false; my_anim = 0; NUMZONE = 0; ARRET_PERSO_FLAG = 0; ARRET_PERSO_NUM = 0; - FORCEZONE = 0; - CHANGEVERBE = 0; - verbe = 0; + _forceZoneFl = false; + _changeVerbFl = false; + _verb = 0; Vold_taille = 0; - SPEED_FLAG = false; SPEED_X = SPEED_Y = 0; SPEED_IMAGE = 0; SPEED_PTR = g_PTRNUL; @@ -387,10 +388,10 @@ void ObjectsManager::AFF_SPRITES() { // Handle drawing characters on the screen for (int idx = 0; idx < 5; ++idx) { _vm->_globals.Liste[idx].field0 = 0; - if (Sprite[idx].field0 == 1) { + if (_sprite[idx].field0 == 1) { CALCUL_SPRITE(idx); - if (Sprite[idx].field2A == 1) - AvantTri(TRI_SPRITE, idx, Sprite[idx].field32 + Sprite[idx].field2E); + if (_sprite[idx].field2A == 1) + AvantTri(TRI_SPRITE, idx, _sprite[idx].field32 + _sprite[idx].field2E); } } @@ -398,7 +399,7 @@ void ObjectsManager::AFF_SPRITES() { VERIFCACHE(); } - if (PRIORITY == 1 && _vm->_globals.NBTRI) { + if (_priorityFl && _vm->_globals.NBTRI) { v33 = 1; do { arr[v33] = v33; @@ -477,10 +478,10 @@ void ObjectsManager::AFF_SPRITES() { _vm->_globals.NBTRI = 0; if (_vm->_dialogsManager._inventDisplayedFl) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); - if (old_cadx && old_cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, old_cadx + 300, old_cady + 300, old_cadi + 1); - if (cadx && cady) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, cadx + 300, cady + 300, cadi); + if (_oldBorderPos.x && _oldBorderPos.y) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, _oldBorderPos.x + 300, _oldBorderPos.y + 300, _oldBorderSpriteIndex + 1); + if (_borderPos.x && _borderPos.y) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, _borderPos.x + 300, _borderPos.y + 300, _borderSpriteIndex); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } @@ -652,7 +653,7 @@ void ObjectsManager::DEF_BOB(int idx) { } void ObjectsManager::BOB_VISU(int idx) { - PRIORITY = 1; + _priorityFl = true; if (!_vm->_globals.Bob[idx].field0) { BOB_ZERO(idx); @@ -875,11 +876,11 @@ void ObjectsManager::VERIFCACHE() { v7 = _vm->_globals.Cache[v8].fieldA; v10 = 0; do { - if (Sprite[v10].field0 == 1) { - if (Sprite[v10]._spriteIndex != 250) { - v1 = Sprite[v10].field2C; - v11 = Sprite[v10].field30 + v1; - v2 = Sprite[v10].field32 + Sprite[v10].field2E; + if (_sprite[v10].field0 == 1) { + if (_sprite[v10]._spriteIndex != 250) { + v1 = _sprite[v10].field2C; + v11 = _sprite[v10].field30 + v1; + v2 = _sprite[v10].field32 + _sprite[v10].field2E; v6 = _vm->_globals.Cache[v8].field0; v3 = _vm->_globals.Cache[v8].field4; v9 = _vm->_globals.Cache[v8].field6 + v6; @@ -955,20 +956,20 @@ void ObjectsManager::DEF_SPRITE(int idx) { int v13; v2 = idx; - if (Sprite[v2].field2A) { - v3 = Sprite[v2].field2C; - v4 = Sprite[v2].field2E; - if (Sprite[v2].field28) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2]._spriteData, - v3 + 300, v4 + 300, Sprite[v2]._spriteIndex); + if (_sprite[v2].field2A) { + v3 = _sprite[v2].field2C; + v4 = _sprite[v2].field2E; + if (_sprite[v2].field28) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _sprite[v2]._spriteData, + v3 + 300, v4 + 300, _sprite[v2]._spriteIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, Sprite[v2]._spriteData, - v3 + 300, v4 + 300, Sprite[v2]._spriteIndex, Sprite[v2].field36, Sprite[v2].field34, Sprite[v2].fieldE); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _sprite[v2]._spriteData, + v3 + 300, v4 + 300, _sprite[v2]._spriteIndex, _sprite[v2].field36, _sprite[v2].field34, _sprite[v2].fieldE); v5 = idx; v6 = idx; - _vm->_globals.Liste[v5].width = Sprite[v6].field30; - _vm->_globals.Liste[v5].height = Sprite[v6].field32; + _vm->_globals.Liste[v5].width = _sprite[v6].field30; + _vm->_globals.Liste[v5].height = _sprite[v6].field32; v7 = _vm->_globals.Liste[v5].field2; v8 = _vm->_graphicsManager.min_x; @@ -1032,36 +1033,36 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { int v17; int v22; - Sprite[idx].field2A = 0; - int spriteIndex = Sprite[idx]._spriteIndex; + _sprite[idx].field2A = 0; + int spriteIndex = _sprite[idx]._spriteIndex; if (spriteIndex != 250) { - if (Sprite[idx].fieldE) { - v5 = get_offsetx(Sprite[idx]._spriteData, spriteIndex, 1); - v22 = Sprite[idx].field12 + v5; - v4 = Sprite[idx].field12 + v5; - v6 = get_offsety(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex, 1); + if (_sprite[idx].fieldE) { + v5 = get_offsetx(_sprite[idx]._spriteData, spriteIndex, 1); + v22 = _sprite[idx].field12 + v5; + v4 = _sprite[idx].field12 + v5; + v6 = get_offsety(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 1); } else { - v3 = get_offsetx(Sprite[idx]._spriteData, spriteIndex, 0); - v22 = Sprite[idx].field12 + v3; - v4 = Sprite[idx].field12 + v3; - v6 = get_offsety(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex, 0); + v3 = get_offsetx(_sprite[idx]._spriteData, spriteIndex, 0); + v22 = _sprite[idx].field12 + v3; + v4 = _sprite[idx].field12 + v3; + v6 = get_offsety(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 0); } - v9 = Sprite[idx].field14 + v6; + v9 = _sprite[idx].field14 + v6; v7 = v9; v8 = v9; int zoomPercent = 0; int reducePercent = 0; - v9 = Sprite[idx].fieldC; + v9 = _sprite[idx].fieldC; if (v9 < 0) { v9 = -v9; reducePercent = v9; if (v9 > 95) reducePercent = 95; } - if (Sprite[idx].fieldC > 0) - zoomPercent = Sprite[idx].fieldC; + if (_sprite[idx].fieldC > 0) + zoomPercent = _sprite[idx].fieldC; if (zoomPercent) { if (v4 >= 0) { @@ -1105,20 +1106,20 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { } } - v15 = Sprite[idx]._spritePos.x - v22; - v16 = Sprite[idx]._spritePos.y - v7; - Sprite[idx].field2C = v15; - Sprite[idx].field2E = v16; - Sprite[idx].field2A = 1; - Sprite[idx].field34 = zoomPercent; - Sprite[idx].field36 = reducePercent; + v15 = _sprite[idx]._spritePos.x - v22; + v16 = _sprite[idx]._spritePos.y - v7; + _sprite[idx].field2C = v15; + _sprite[idx].field2E = v16; + _sprite[idx].field2A = 1; + _sprite[idx].field34 = zoomPercent; + _sprite[idx].field36 = reducePercent; v17 = idx; _vm->_globals.Liste[v17].field0 = 1; _vm->_globals.Liste[v17].field2 = v15; _vm->_globals.Liste[v17].field4 = v16; - width = getWidth(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); - height = getHeight(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); + width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); + height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); if (zoomPercent) { width = _vm->_graphicsManager.zoomIn(width, zoomPercent); @@ -1130,8 +1131,8 @@ void ObjectsManager::CALCUL_SPRITE(int idx) { width = _vm->_graphicsManager.zoomOut(width, reducePercent); } - Sprite[idx].field30 = width; - Sprite[idx].field32 = height; + _sprite[idx].field30 = width; + _sprite[idx].field32 = height; } } @@ -1451,13 +1452,13 @@ void ObjectsManager::AFF_VBOB() { int ObjectsManager::XSPR(int idx) { if (idx > 5) error("request of the Coord. x a sprite > MAX_SPRITE."); - return Sprite[idx]._spritePos.x; + return _sprite[idx]._spritePos.x; } int ObjectsManager::YSPR(int idx) { if (idx > 5) error("request of the Coord. y a sprite > MAX_SPRITE."); - return Sprite[idx]._spritePos.y; + return _sprite[idx]._spritePos.y; } void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { @@ -1469,9 +1470,9 @@ void ObjectsManager::CLEAR_SPR() { idx = 0; do { - Sprite[idx].field1C = g_PTRNUL; - Sprite[idx]._spriteData = g_PTRNUL; - Sprite[idx].field0 = 0; + _sprite[idx].field1C = g_PTRNUL; + _sprite[idx]._spriteData = g_PTRNUL; + _sprite[idx].field0 = 0; ++idx; } while (idx <= 4); @@ -1491,103 +1492,103 @@ void ObjectsManager::SPRITE_ON(int idx) { if (idx > 5) error("Attempt to display a sprite > MAX_SPRITE."); - Sprite[idx].field0 = 1; + _sprite[idx].field0 = 1; } void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { if (idx > 5) error("Attempt to display a sprite > MAX_SPRITE."); - Sprite[idx]._spriteData = spriteData; - Sprite[idx]._spritePos = pos; - Sprite[idx]._spriteIndex = spriteIndex; - Sprite[idx].fieldC = a6; - Sprite[idx].field12 = a8; - Sprite[idx].field14 = a9; - Sprite[idx].field1C = g_PTRNUL; - Sprite[idx].field20 = 0; - Sprite[idx].field24 = 0; - Sprite[idx].field26 = 0; - Sprite[idx].field22 = 0; - Sprite[idx].field0 = 0; - Sprite[idx].field28 = 0; - Sprite[idx].fieldE = a7; + _sprite[idx]._spriteData = spriteData; + _sprite[idx]._spritePos = pos; + _sprite[idx]._spriteIndex = spriteIndex; + _sprite[idx].fieldC = a6; + _sprite[idx].field12 = a8; + _sprite[idx].field14 = a9; + _sprite[idx].field1C = g_PTRNUL; + _sprite[idx].field20 = 0; + _sprite[idx].field24 = 0; + _sprite[idx].field26 = 0; + _sprite[idx].field22 = 0; + _sprite[idx].field0 = 0; + _sprite[idx].field28 = 0; + _sprite[idx].fieldE = a7; if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') - Sprite[idx].field28 = 1; + _sprite[idx].field28 = 1; - if (Sprite[idx].field28 == 1) { - Sprite[idx].fieldC = 0; - Sprite[idx].fieldE = 0; + if (_sprite[idx].field28 == 1) { + _sprite[idx].fieldC = 0; + _sprite[idx].fieldE = 0; } } void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5) { - Sprite[idx]._spriteData = spriteData; - Sprite[idx].field1C = a3; - Sprite[idx].field20 = a4; - Sprite[idx].field24 = 0; - Sprite[idx].field26 = 0; - Sprite[idx].fieldC = 0; - Sprite[idx].fieldE = 0; - Sprite[idx].field0 = 1; - Sprite[idx].field22 = 0; - Sprite[idx].field14 = a5; + _sprite[idx]._spriteData = spriteData; + _sprite[idx].field1C = a3; + _sprite[idx].field20 = a4; + _sprite[idx].field24 = 0; + _sprite[idx].field26 = 0; + _sprite[idx].fieldC = 0; + _sprite[idx].fieldE = 0; + _sprite[idx].field0 = 1; + _sprite[idx].field22 = 0; + _sprite[idx].field14 = a5; if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') - Sprite[idx].field28 = 1; + _sprite[idx].field28 = 1; - if (Sprite[idx].field28 == 1) { - Sprite[idx].fieldC = 0; - Sprite[idx].fieldE = 0; + if (_sprite[idx].field28 == 1) { + _sprite[idx].fieldC = 0; + _sprite[idx].fieldE = 0; } } void ObjectsManager::SPRITE_OFF(int idx) { - Sprite[idx].field0 = 3; - Sprite[idx].field1C = _vm->_globals.freeMemory(Sprite[idx].field1C); + _sprite[idx].field0 = 3; + _sprite[idx].field1C = _vm->_globals.freeMemory(_sprite[idx].field1C); } void ObjectsManager::SPRITE_GEL(int idx) { - Sprite[idx].field0 = 3; + _sprite[idx].field0 = 3; } int ObjectsManager::SXSPR(int idx) { if (idx > 5) error("request of the size of a sprite x > MAX_SPRITE."); - return getWidth(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); + return getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); } int ObjectsManager::SYSPR(int idx) { if (idx > 5) error("request of the size of a sprite y > MAX_SPRITE."); - return getHeight(Sprite[idx]._spriteData, Sprite[idx]._spriteIndex); + return getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); } int ObjectsManager::POSISPR(int idx) { - return Sprite[idx].field22 / 6; + return _sprite[idx].field22 / 6; } void ObjectsManager::SETPOSISPR(int idx, int a2) { - Sprite[idx].field22 = 6 * a2; - Sprite[idx].field24 = 0; - Sprite[idx].field26 = 0; + _sprite[idx].field22 = 6 * a2; + _sprite[idx].field24 = 0; + _sprite[idx].field26 = 0; } void ObjectsManager::SETXSPR(int idx, int xp) { if (idx > 5) error("Set the Coord. x a sprite> MAX_SPRITE."); - Sprite[idx]._spritePos.x = xp; + _sprite[idx]._spritePos.x = xp; } void ObjectsManager::SETANISPR(int idx, int spriteIndex) { if (idx > 5) error("Set the Coord. x a sprite> MAX_SPRITE."); - Sprite[idx]._spriteIndex = spriteIndex; + _sprite[idx]._spriteIndex = spriteIndex; } void ObjectsManager::SETYSPR(int idx, int yp) { if ( idx > 5 ) error("Set the Coord. y a sprite> MAX_SPRITE."); - Sprite[idx]._spritePos.y = yp; + _sprite[idx]._spritePos.y = yp; } // Set Sprite Size @@ -1595,15 +1596,15 @@ void ObjectsManager::SETTAILLESPR(int idx, int a2) { if (idx > 5) error("Set the Coord. there a sprite> MAX_SPRITE."); - if (Sprite[idx].field28 != 1) - Sprite[idx].fieldC = a2; + if (_sprite[idx].field28 != 1) + _sprite[idx].fieldC = a2; } void ObjectsManager::SETFLIPSPR(int idx, int a2) { - if (Sprite[idx].field28 != 1) { + if (_sprite[idx].field28 != 1) { if (idx > 5) error("Set the Coord. there a sprite> MAX_SPRITE."); - Sprite[idx].fieldE = a2; + _sprite[idx].fieldE = a2; } } @@ -1621,18 +1622,18 @@ void ObjectsManager::VERIFZONE() { || _vm->_eventsManager._startPos.x >= v0 || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) || (v1 = v2 - 1, (uint16)(v2 - 1) > 0x3Bu)) { - if (FLAG_VISIBLE == true) + if (_visibleFl == true) FLAG_VISIBLE_EFFACE = 4; - FLAG_VISIBLE = false; + _visibleFl = false; } else { - FLAG_VISIBLE = true; + _visibleFl = true; } - if (FORCEZONE == 1) { + if (_forceZoneFl) { _vm->_globals.compteur_71 = 100; _vm->_globals.old_zone_68 = -1; _vm->_globals.old_x_69 = -200; _vm->_globals.old_y_70 = -220; - FORCEZONE = 0; + _forceZoneFl = false; } v3 = _vm->_globals.compteur_71 + 1; _vm->_globals.compteur_71 = v3; @@ -1684,7 +1685,7 @@ LABEL_54: if (_vm->_globals.ZONEP[v4].field6 == 2) { _vm->_eventsManager.changeMouseCursor(16); _vm->_eventsManager._mouseCursorId = 16; - verbe = 16; + _verb = 16; } } } else { @@ -1705,7 +1706,7 @@ LABEL_54: } } if ((_vm->_globals.PLAN_FLAG == true && v4 == -1) || !v4) { - verbe = 0; + _verb = 0; _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } @@ -1848,24 +1849,24 @@ LABEL_241: v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (Sprite[0].fieldC < 0) { - v5 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v5 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v5 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v5 = -_sprite[0].fieldC; v3 = _vm->_graphicsManager.zoomOut(v3, v5); - v6 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v6 = -Sprite[0].fieldC; + v6 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v6 = -_sprite[0].fieldC; v4 = _vm->_graphicsManager.zoomOut(v4, v6); } - if (Sprite[0].fieldC > 0) { - v7 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v7 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v7 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v7 = -_sprite[0].fieldC; v3 = _vm->_graphicsManager.zoomIn(v3, v7); - v8 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v8 = -Sprite[0].fieldC; + v8 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v8 = -_sprite[0].fieldC; v4 = _vm->_graphicsManager.zoomIn(v4, v8); } v0 = v3 + g_old_x; @@ -1886,24 +1887,24 @@ LABEL_23: } else { v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (Sprite[0].fieldC < 0) { - v11 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v11 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v11 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v11 = -_sprite[0].fieldC; v9 = _vm->_graphicsManager.zoomOut(v9, v11); - v12 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v12 = -Sprite[0].fieldC; + v12 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v12 = -_sprite[0].fieldC; v10 = _vm->_graphicsManager.zoomOut(v10, v12); } - if (Sprite[0].fieldC > 0) { - v13 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v13 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v13 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v13 = -_sprite[0].fieldC; v9 = _vm->_graphicsManager.zoomIn(v9, v13); - v14 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v14 = -Sprite[0].fieldC; + v14 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v14 = -_sprite[0].fieldC; v10 = _vm->_graphicsManager.zoomIn(v10, v14); } v0 = g_old_x - v9; @@ -1926,16 +1927,16 @@ LABEL_43: if (v15 < 0) v15 = -v15; v16 = v15; - if (Sprite[0].fieldC < 0) { - v17 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v17 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v17 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v17 = -_sprite[0].fieldC; v16 = _vm->_graphicsManager.zoomOut(v16, v17); } - if (Sprite[0].fieldC > 0) { - v18 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v18 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v18 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v18 = -_sprite[0].fieldC; v16 = _vm->_graphicsManager.zoomIn(v16, v18); } v0 = g_old_x; @@ -1958,16 +1959,16 @@ LABEL_60: if (v19 < 0) v19 = -v19; v20 = v19; - if (Sprite[0].fieldC < 0) { - v21 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v21 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v21 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v21 = -_sprite[0].fieldC; v20 = _vm->_graphicsManager.zoomOut(v20, v21); } - if (Sprite[0].fieldC > 0) { - v22 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v22 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v22 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v22 = -_sprite[0].fieldC; v20 = _vm->_graphicsManager.zoomIn(v20, v22); } v0 = g_old_x; @@ -1988,24 +1989,24 @@ LABEL_77: } else { v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (Sprite[0].fieldC < 0) { - v25 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v25 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v25 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v25 = -_sprite[0].fieldC; v23 = _vm->_graphicsManager.zoomOut(v23, v25); - v26 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v26 = -Sprite[0].fieldC; + v26 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v26 = -_sprite[0].fieldC; v24 = _vm->_graphicsManager.zoomOut(v24, v26); } - if (Sprite[0].fieldC > 0) { - v27 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v27 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v27 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v27 = -_sprite[0].fieldC; v23 = _vm->_graphicsManager.zoomIn(v23, v27); - v28 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v28 = -Sprite[0].fieldC; + v28 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v28 = -_sprite[0].fieldC; v24 = _vm->_graphicsManager.zoomIn(v24, v28); } v0 = v23 + g_old_x; @@ -2026,24 +2027,24 @@ LABEL_96: } else { v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (Sprite[0].fieldC < 0) { - v31 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v31 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v31 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v31 = -_sprite[0].fieldC; v29 = _vm->_graphicsManager.zoomOut(v29, v31); - v32 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v32 = -Sprite[0].fieldC; + v32 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v32 = -_sprite[0].fieldC; v30 = _vm->_graphicsManager.zoomOut(v30, v32); } - if (Sprite[0].fieldC > 0) { - v33 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v33 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v33 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v33 = -_sprite[0].fieldC; v29 = _vm->_graphicsManager.zoomIn(v29, v33); - v34 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v34 = -Sprite[0].fieldC; + v34 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v34 = -_sprite[0].fieldC; v30 = _vm->_graphicsManager.zoomIn(v30, v34); } v0 = g_old_x - v29; @@ -2064,24 +2065,24 @@ LABEL_115: } else { v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (Sprite[0].fieldC < 0) { - v37 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v37 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v37 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v37 = -_sprite[0].fieldC; v35 = _vm->_graphicsManager.zoomOut(v35, v37); - v38 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v38 = -Sprite[0].fieldC; + v38 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v38 = -_sprite[0].fieldC; v36 = _vm->_graphicsManager.zoomOut(v36, v38); } - if (Sprite[0].fieldC > 0) { - v39 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v39 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v39 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v39 = -_sprite[0].fieldC; v35 = _vm->_graphicsManager.zoomIn(v35, v39); - v40 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v40 = -Sprite[0].fieldC; + v40 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v40 = -_sprite[0].fieldC; v36 = _vm->_graphicsManager.zoomIn(v36, v40); } v0 = v35 + g_old_x; @@ -2102,24 +2103,24 @@ LABEL_134: } else { v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (Sprite[0].fieldC < 0) { - v43 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v43 = -Sprite[0].fieldC; + if (_sprite[0].fieldC < 0) { + v43 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v43 = -_sprite[0].fieldC; v41 = _vm->_graphicsManager.zoomOut(v41, v43); - v44 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v44 = -Sprite[0].fieldC; + v44 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v44 = -_sprite[0].fieldC; v42 = _vm->_graphicsManager.zoomOut(v42, v44); } - if (Sprite[0].fieldC > 0) { - v45 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v45 = -Sprite[0].fieldC; + if (_sprite[0].fieldC > 0) { + v45 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v45 = -_sprite[0].fieldC; v41 = _vm->_graphicsManager.zoomIn(v41, v45); - v46 = Sprite[0].fieldC; - if (Sprite[0].fieldC < 0) - v46 = -Sprite[0].fieldC; + v46 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v46 = -_sprite[0].fieldC; v42 = _vm->_graphicsManager.zoomIn(v42, v46); } v0 = g_old_x - v41; @@ -2547,7 +2548,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLAN_FLAG = true; _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; - sprite_ptr = g_PTRNUL; + _spritePtr = g_PTRNUL; _vm->_globals.SORTIE = 0; _vm->_globals.AFFLI = false; _vm->_globals.AFFIVBL = false; @@ -2559,7 +2560,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.CHARGE_CACHE("PLAN.CA2"); CHARGE_ZONE("PLAN.ZO2"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "VOITURE.SPR"); - sprite_ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _spritePtr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN"); @@ -2576,7 +2577,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANY = 319; _vm->_globals.PLANI = 1; } - SPRITE(sprite_ptr, Common::Point(_vm->_globals.PLANX, _vm->_globals.PLANY), 0, _vm->_globals.PLANI, 0, 0, 5, 5); + SPRITE(_spritePtr, Common::Point(_vm->_globals.PLANX, _vm->_globals.PLANY), 0, _vm->_globals.PLANI, 0, 0, 5, 5); _vm->_eventsManager.setMouseXY(_vm->_globals.PLANX, _vm->_globals.PLANY); my_anim = 0; _vm->_eventsManager.mouseOn(); @@ -2645,7 +2646,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANI = 1; SPRITE_OFF(0); _vm->_globals.AFFLI = false; - sprite_ptr = _vm->_globals.freeMemory(sprite_ptr); + _spritePtr = _vm->_globals.freeMemory(_spritePtr); CLEAR_ECRAN(); _vm->_globals.NOSPRECRAN = false; _vm->_globals.PLAN_FLAG = false; @@ -2918,16 +2919,16 @@ LABEL_64: _vm->_eventsManager.changeMouseCursor(4); if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { NUMZONE = -1; - FORCEZONE = 1; + _forceZoneFl = true; } if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager._mouseCursorId = 4; - CHANGEVERBE = 0; + _changeVerbFl = false; } else { _vm->_eventsManager._mouseCursorId = _vm->_globals.SAUVEGARDE->data[svField1]; - if (CHANGEVERBE == 1) { + if (_changeVerbFl) { VERBEPLUS(); - CHANGEVERBE = 0; + _changeVerbFl = false; } if (_vm->_eventsManager._mouseCursorId == 5) _vm->_eventsManager._mouseCursorId = 4; @@ -2975,15 +2976,14 @@ void ObjectsManager::CLEAR_ECRAN() { ++v1; } while (v1 <= 48); _vm->_eventsManager._mouseCursorId = 4; - verbe = 4; + _verb = 4; NUMZONE = 0; Vold_taille = 0; - SPEED_FLAG = false; SPEED_PTR = g_PTRNUL; SPEED_X = 0; SPEED_Y = 0; SPEED_IMAGE = 0; - FORCEZONE = 1; + _forceZoneFl = true; _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2995,8 +2995,8 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; _vm->_globals.GOACTION = 0; - FORCEZONE = 1; - CHANGEVERBE = 0; + _forceZoneFl = true; + _changeVerbFl = false; _vm->_globals.NOSPRECRAN = false; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.g_old_sens = -1; @@ -3028,7 +3028,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->_pos.y = YSPR(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; - loc->field4 = Sprite[0].field0; + loc->field4 = _sprite[0].field0; SPRITE_OFF(1); SPRITE(_vm->_globals.TETE, loc->_pos, 1, 3, loc->field4, 0, 20, 127); @@ -3055,7 +3055,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->_pos.y = YSPR(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; - loc->field4 = Sprite[0].fieldC; + loc->field4 = _sprite[0].fieldC; SPRITE_OFF(1); SPRITE(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); @@ -3081,7 +3081,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->_pos.y = YSPR(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; - loc->field4 = Sprite[0].fieldC; + loc->field4 = _sprite[0].fieldC; break; case CHARACTER_HOPKINS_CLONE: loc = &_vm->_globals.SAUVEGARDE->cloneHopkins; @@ -3089,7 +3089,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->_pos.y = YSPR(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; - loc->field4 = Sprite[0].fieldC; + loc->field4 = _sprite[0].fieldC; break; case CHARACTER_SAMANTHA: loc = &_vm->_globals.SAUVEGARDE->samantha; @@ -3097,7 +3097,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n loc->_pos.y = YSPR(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; - loc->field4 = Sprite[0].fieldC; + loc->field4 = _sprite[0].fieldC; break; default: break; @@ -3799,7 +3799,7 @@ void ObjectsManager::BTDROITE() { VERBEPLUS(); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); - verbe = _vm->_eventsManager._mouseCursorId; + _verb = _vm->_eventsManager._mouseCursorId; } } @@ -3941,45 +3941,46 @@ LABEL_58: } return result; } - -void ObjectsManager::PARAMCADRE(int a1) { - old_cadx = cadx; - old_cady = cady; - old_cadi = cadi; +/** + * Prepare border used to highlight the place below mouse cursor, in the inventory. + * Also set the mouse cursor + */ +void ObjectsManager::initBorder(int a1) { + _oldBorderPos = _borderPos; + _oldBorderSpriteIndex = _borderSpriteIndex; if ((uint16)(a1 - 1) <= 5u) - cady = 120; + _borderPos.y = 120; if ((uint16)(a1 - 7) <= 5u) - cady = 158; + _borderPos.y = 158; if ((uint16)(a1 - 13) <= 5u) - cady = 196; + _borderPos.y = 196; if ((uint16)(a1 - 19) <= 5u) - cady = 234; + _borderPos.y = 234; if ((uint16)(a1 - 25) <= 4u) - cady = 272; + _borderPos.y = 272; if (a1 == 1 || a1 == 7 || a1 == 13 || a1 == 19 || a1 == 25) - cadx = _vm->_graphicsManager.ofscroll + 158; + _borderPos.x = _vm->_graphicsManager.ofscroll + 158; if (a1 == 2 || a1 == 8 || a1 == 14 || a1 == 20 || a1 == 26) - cadx = _vm->_graphicsManager.ofscroll + 212; + _borderPos.x = _vm->_graphicsManager.ofscroll + 212; if (a1 == 3 || a1 == 9 || a1 == 15 || a1 == 21 || a1 == 27) - cadx = _vm->_graphicsManager.ofscroll + 266; + _borderPos.x = _vm->_graphicsManager.ofscroll + 266; if (a1 == 4 || a1 == 10 || a1 == 16 || a1 == 22 || a1 == 28) - cadx = _vm->_graphicsManager.ofscroll + 320; + _borderPos.x = _vm->_graphicsManager.ofscroll + 320; if (a1 == 5 || a1 == 11 || a1 == 17 || a1 == 23 || a1 == 29) - cadx = _vm->_graphicsManager.ofscroll + 374; + _borderPos.x = _vm->_graphicsManager.ofscroll + 374; if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u) - cadx = _vm->_graphicsManager.ofscroll + 428; + _borderPos.x = _vm->_graphicsManager.ofscroll + 428; if ((uint16)(a1 - 1) <= 0x1Cu) - cadi = 0; + _borderSpriteIndex = 0; if ((uint16)(a1 - 30) <= 1u) - cadi = 2; + _borderSpriteIndex = 2; if (a1 == 30) - cady = 272; + _borderPos.y = 272; if (a1 == 31) - cady = 290; + _borderPos.y = 290; if (!a1 || a1 == 32) { - cadx = 0; - cady = 0; - cadi = 0; + _borderPos = Common::Point(0, 0); + _borderSpriteIndex = 0; } if (!a1) _vm->_eventsManager._mouseCursorId = 0; @@ -3995,9 +3996,8 @@ void ObjectsManager::PARAMCADRE(int a1) { _vm->_eventsManager._mouseCursorId = 1; if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals.INVENTAIRE[a1]) { _vm->_eventsManager._mouseCursorId = 0; - cadx = 0; - cady = 0; - cadi = 0; + _borderPos = Common::Point(0, 0); + _borderSpriteIndex = 0; } if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); @@ -4526,7 +4526,6 @@ void ObjectsManager::OPTI_ONE(int idx, int a2, int a3, int a4) { void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { - SPEED_FLAG = true; SPEED_PTR = speedData; SPEED_X = xp; SPEED_Y = yp; @@ -5007,7 +5006,7 @@ void ObjectsManager::VERBE_OFF(int idx, int a2) { if (a2 == 24) { _vm->_globals.ZONEP[idx].field9 = 0; } - CHANGEVERBE = 1; + _changeVerbFl = true; } void ObjectsManager::VERBE_ON(int idx, int a2) { @@ -5175,12 +5174,12 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in v15 = a5 / 2; else if (_vm->_globals.vitesse == 3) v15 = a5 / 3; - v14 = Sprite[0]._spriteData; - spriteIndex = Sprite[0]._spriteIndex; - v16 = Sprite[0].fieldE; - Sprite[0].field12 += a3; - Sprite[0].field14 += a4; - Sprite[0].fieldE = a6; + v14 = _sprite[0]._spriteData; + spriteIndex = _sprite[0]._spriteIndex; + v16 = _sprite[0].fieldE; + _sprite[0].field12 += a3; + _sprite[0].field14 += a4; + _sprite[0].fieldE = a6; for (;;) { v7 = 0; @@ -5199,14 +5198,14 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in ++v18; if (v7 == 1) { if (v13 == -1) { - Sprite[0]._spriteData = v14; - Sprite[0]._spriteIndex = spriteIndex; - Sprite[0].field12 -= a3; - Sprite[0].field14 -= a4; - Sprite[0].fieldE = v16; + _sprite[0]._spriteData = v14; + _sprite[0]._spriteIndex = spriteIndex; + _sprite[0].field12 -= a3; + _sprite[0].field14 -= a4; + _sprite[0].fieldE = v16; } else { - Sprite[0]._spriteData = spriteData; - Sprite[0]._spriteIndex = v13; + _sprite[0]._spriteData = spriteData; + _sprite[0]._spriteIndex = v13; } v10 = 0; v9 = v15; @@ -5242,12 +5241,12 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int v14 = a5 / 2; else if (_vm->_globals.vitesse == 3) v14 = a5 / 3; - S_old_spr = Sprite[0]._spriteData; - S_old_ani = Sprite[0]._spriteIndex; - S_old_ret = Sprite[0].fieldE; - Sprite[0].field12 += a3; - Sprite[0].field14 += a4; - Sprite[0].fieldE = a6; + S_old_spr = _sprite[0]._spriteData; + S_old_ani = _sprite[0]._spriteIndex; + S_old_ret = _sprite[0].fieldE; + _sprite[0].field12 += a3; + _sprite[0].field14 += a4; + _sprite[0].fieldE = a6; uint strPos = 0; do { @@ -5271,8 +5270,8 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int ++strPos; } while (!loopCond); if (spriteIndex != -1) { - Sprite[0]._spriteData = a1; - Sprite[0]._spriteIndex = spriteIndex; + _sprite[0]._spriteData = a1; + _sprite[0]._spriteIndex = spriteIndex; } v10 = 0; v9 = v14; @@ -5326,14 +5325,14 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a ++v14; if (v6 == 1) { if (spriteIndex == -1) { - Sprite[0]._spriteData = S_old_spr; - Sprite[0]._spriteIndex = S_old_ani; - Sprite[0].field12 -= a3; - Sprite[0].field14 -= a4; - Sprite[0].fieldE = S_old_ret; + _sprite[0]._spriteData = S_old_spr; + _sprite[0]._spriteIndex = S_old_ani; + _sprite[0].field12 -= a3; + _sprite[0].field14 -= a4; + _sprite[0].fieldE = S_old_ret; } else { - Sprite[0]._spriteData = a1; - Sprite[0]._spriteIndex = spriteIndex; + _sprite[0]._spriteData = a1; + _sprite[0]._spriteIndex = spriteIndex; } v9 = 0; @@ -5566,7 +5565,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; - verbe = 4; + _verb = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; _vm->_dialogsManager._removeInventFl = false; @@ -5661,7 +5660,7 @@ LABEL_70: mouseButtons = _vm->_eventsManager.getMouseButton(); if (mouseButtons) { if (mouseButtons == 1) { - if (verbe == 16 && _vm->_eventsManager._mouseCursorId == 16) { + if (_verb == 16 && _vm->_eventsManager._mouseCursorId == 16) { xp = _vm->_eventsManager.getMouseX(); yp = _vm->_eventsManager.getMouseY(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index afccec9c04..0faf0f3a32 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -61,33 +61,34 @@ private: HopkinsEngine *_vm; public: - SpriteItem Sprite[6]; - int PRIORITY; - int old_cadx, old_cady, old_cadi; - int cadx, cady, cadi; + SpriteItem _sprite[6]; + bool _priorityFl; + Common::Point _oldBorderPos; + int _oldBorderSpriteIndex; + Common::Point _borderPos; + int _borderSpriteIndex; int SL_X, SL_Y; int I_old_x, I_old_y; int g_old_x, g_old_y; int FLAG_VISIBLE_EFFACE; byte *SL_SPR; byte *SL_SPR2; - byte *sprite_ptr; + byte *_spritePtr; const byte *S_old_spr; bool PERSO_ON; bool SL_FLAG; int SL_MODE; - bool FLAG_VISIBLE; - int DESACTIVE_CURSOR; + bool _visibleFl; + bool _disableCursorFl; bool BOBTOUS; int my_anim; int NUMZONE; int ARRET_PERSO_FLAG; int ARRET_PERSO_NUM; - int FORCEZONE; - int CHANGEVERBE; - int verbe; + bool _forceZoneFl; + bool _changeVerbFl; + int _verb; int Vold_taille; - bool SPEED_FLAG; int SPEED_X, SPEED_Y; int SPEED_IMAGE; byte *SPEED_PTR; @@ -201,7 +202,7 @@ public: void VERBEPLUS(); void BTDROITE(); int MZONE(); - void PARAMCADRE(int a1); + void initBorder(int a1); void OBJETPLUS(int a1); void VALID_OBJET(int a1); void OPTI_OBJET(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 9bd6ce0964..b4d72f1494 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1954,8 +1954,8 @@ LABEL_1141: _vm->_globals.PERSO_TYPE = 1; _vm->_globals.SAUVEGARDE->data[svField122] = 1; _vm->_globals.HOPKINS_DATA(); - _vm->_objectsManager.Sprite[0].field12 = 28; - _vm->_objectsManager.Sprite[0].field14 = 155; + _vm->_objectsManager._sprite[0].field12 = 28; + _vm->_objectsManager._sprite[0].field14 = 155; _vm->_objectsManager.VERIFTAILLE(); } if (v76 == 57) { @@ -1964,8 +1964,8 @@ LABEL_1141: _vm->_globals.PERSO_TYPE = 0; _vm->_globals.SAUVEGARDE->data[svField122] = 0; _vm->_globals.HOPKINS_DATA(); - _vm->_objectsManager.Sprite[0].field12 = 34; - _vm->_objectsManager.Sprite[0].field14 = 190; + _vm->_objectsManager._sprite[0].field12 = 34; + _vm->_objectsManager._sprite[0].field14 = 190; _vm->_objectsManager.VERIFTAILLE(); } if (v76 == 25) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index eaf1199c13..77b8fdc6a5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -185,7 +185,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } void TalkManager::PARLER_PERSO2(const Common::String &filename) { - _vm->_objectsManager.DESACTIVE_CURSOR = 1; + _vm->_objectsManager._disableCursorFl = true; STATI = 1; bool v7 = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; @@ -253,7 +253,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager.changeMouseCursor(v8); _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - _vm->_objectsManager.DESACTIVE_CURSOR = 0; + _vm->_objectsManager._disableCursorFl = false; _vm->_globals._disableInventFl = v7; STATI = 0; } @@ -736,7 +736,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { int v4; byte *v5; - _vm->_objectsManager.PRIORITY = 1; + _vm->_objectsManager._priorityFl = true; if (!_vm->_globals.Bob[idx].field0) { _vm->_objectsManager.BOB_ZERO(idx); v5 = _vm->_globals.Bqe_Anim[idx].data; @@ -1260,7 +1260,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { VISU_WAIT(); _vm->_graphicsManager.INI_ECRAN2(v22); _vm->_globals.NOMARCHE = true; - _vm->_objectsManager.FORCEZONE = 1; + _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager.NUMZONE = -1; do { v12 = _vm->_eventsManager.getMouseButton(); -- cgit v1.2.3 From 385d097167a6aaa0a2c1edc0e23c4b55cbd41230 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Dec 2012 14:22:24 +0100 Subject: HOPKINS: Some more renaming --- engines/hopkins/dialogs.cpp | 14 +++--- engines/hopkins/events.cpp | 2 +- engines/hopkins/globals.cpp | 8 ++-- engines/hopkins/globals.h | 6 +-- engines/hopkins/hopkins.cpp | 26 +++++------ engines/hopkins/menu.cpp | 6 +-- engines/hopkins/objects.cpp | 102 ++++++++++++++++++++++--------------------- engines/hopkins/objects.h | 10 ++--- engines/hopkins/saveload.cpp | 4 +- engines/hopkins/script.cpp | 4 +- engines/hopkins/talk.cpp | 4 +- 11 files changed, 94 insertions(+), 92 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 627a3c8fe0..2c17d24e2e 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -357,7 +357,7 @@ LABEL_7: int v16 = 0; for (int v5 = 1; v5 <= 6; v5++) { ++v4; - int v6 = _vm->_globals.INVENTAIRE[v4]; + int v6 = _vm->_globals._inventory[v4]; if (v6 && v4 <= 29) { byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, @@ -401,13 +401,13 @@ LABEL_7: if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) break; v9 = v13; - _vm->_objectsManager.VALID_OBJET(_vm->_globals.INVENTAIRE[v13]); + _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; if (!v20) { _vm->_scriptManager.TRAVAILOBJET = 1; - _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; - _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals.INVENTAIRE[v13]; + _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals._inventory[v13]; _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); _vm->_scriptManager.TRAVAILOBJET = 0; @@ -583,7 +583,7 @@ void DialogsManager::showLoadGame() { _vm->_saveLoadManager.restore(slotNumber); } - _vm->_objectsManager.CHANGE_OBJET(14); + _vm->_objectsManager.changeObject(14); } /** @@ -641,9 +641,9 @@ void DialogsManager::showSaveLoad(int a1) { break; } - _vm->_objectsManager.SL_SPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVE2.SPR"); - _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); if (_vm->_globals.FR) { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 17909b16a1..4667219af6 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -374,7 +374,7 @@ LABEL_34: } LABEL_35: if (!_vm->_globals.PUBEXIT) - _vm->_objectsManager.AFF_SPRITES(); + _vm->_objectsManager.displaySprite(); if (_mouseFl != true) { updateCursor(); goto LABEL_54; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 0d6a77e496..56e09260f2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -109,7 +109,7 @@ Globals::Globals() { Common::fill((byte *)&Hopkins[i], (byte *)&Hopkins[i] + sizeof(HopkinsItem), 0); for (int i = 0; i < 36; ++i) - INVENTAIRE[i] = 0; + _inventory[i] = 0; for (int i = 0; i < 51; ++i) Common::fill((byte *)&Tri[i], (byte *)&Tri[i] + sizeof(TriItem), 0); @@ -132,7 +132,7 @@ Globals::Globals() { TETE = NULL; texte_long = 0; TEXTE_FORMATE = 0; - OBJET_EN_COURS = 0; + _curObjectIndex = 0; NUM_FICHIER_OBJ = 0; nbrligne = 0; largeur_boite = 0; @@ -142,7 +142,7 @@ Globals::Globals() { HELICO = 0; CAT_POSI = 0; CAT_TAILLE = 0; - Nouv_objet = 0; + _newObjectFl = false; iRegul = 0; SORTIE = 0; PLANX = PLANY = 0; @@ -368,7 +368,7 @@ void Globals::clearAll() { COUCOU = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; SAUVEGARDE = (Sauvegarde *)g_PTRNUL; - OBJET_EN_COURS = 0; + _curObjectIndex = 0; for (int idx = 0; idx < 105; ++idx) { ZONEP[idx].destX = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 2019e7d098..4dc0034fc3 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -333,7 +333,7 @@ public: int16 super_parcours[32002]; int Param[2100]; HopkinsItem Hopkins[70]; - int INVENTAIRE[36]; + int _inventory[36]; TriItem Tri[51]; int FR; int SVGA; @@ -386,7 +386,7 @@ public: int16 *essai2; byte *inventaire2; byte *GESTE; - int OBJET_EN_COURS; + int _curObjectIndex; int NUM_FICHIER_OBJ; int nbrligne; int largeur_boite; @@ -403,7 +403,7 @@ public: byte *ADR_FICHIER_OBJ; byte *PERSO; int OBJL, OBJH; - int Nouv_objet; + bool _newObjectFl; int HELICO; uint32 CAT_POSI; uint32 CAT_TAILLE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c156e37d3a..9e70258a09 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -129,8 +129,8 @@ bool HopkinsEngine::runWin95Demo() { _globals.SVGA = 1; _globals.CHARGE_OBJET(); - _objectsManager.CHANGE_OBJET(14); - _objectsManager.AJOUTE_OBJET(14); + _objectsManager.changeObject(14); + _objectsManager.addObject(14); _globals.HELICO = 0; _globals.iRegul = 1; @@ -455,8 +455,8 @@ bool HopkinsEngine::runWin95Demo() { bool HopkinsEngine::runLinuxDemo() { _globals.CHARGE_OBJET(); - _objectsManager.CHANGE_OBJET(14); - _objectsManager.AJOUTE_OBJET(14); + _objectsManager.changeObject(14); + _objectsManager.addObject(14); _globals.HELICO = 0; _eventsManager.mouseOff(); @@ -828,8 +828,8 @@ bool HopkinsEngine::runBeOSFull() { warning("TODO: Init_Interrupt()"); _globals.CHARGE_OBJET(); - _objectsManager.CHANGE_OBJET(14); - _objectsManager.AJOUTE_OBJET(14); + _objectsManager.changeObject(14); + _objectsManager.addObject(14); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; @@ -1216,7 +1216,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); } @@ -1673,8 +1673,8 @@ bool HopkinsEngine::runWin95full() { warning("TODO: Init_Interrupt_()"); _globals.CHARGE_OBJET(); - _objectsManager.CHANGE_OBJET(14); - _objectsManager.AJOUTE_OBJET(14); + _objectsManager.changeObject(14); + _objectsManager.addObject(14); _globals.HELICO = 0; _globals.iRegul = 1; @@ -2082,7 +2082,7 @@ bool HopkinsEngine::runWin95full() { _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); @@ -2548,8 +2548,8 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(16); _globals.CHARGE_OBJET(); - _objectsManager.CHANGE_OBJET(14); - _objectsManager.AJOUTE_OBJET(14); + _objectsManager.changeObject(14); + _objectsManager.addObject(14); _globals.HELICO = 0; _eventsManager.mouseOff(); @@ -2960,7 +2960,7 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.CHARGE_SPRITE(_globals.NFICHIER); + _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index e63cde6b34..6f17879cba 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -64,10 +64,10 @@ int MenuManager::MENU() { _vm->_globals.SORTIE = 0; for (int idx = 0; idx < 31; ++idx) - _vm->_globals.INVENTAIRE[idx] = 0; + _vm->_globals._inventory[idx] = 0; memset(_vm->_globals.SAUVEGARDE, 0, 2000); - _vm->_objectsManager.AJOUTE_OBJET(14); + _vm->_objectsManager.addObject(14); frame5Index = 0; frame4Index = 0; frame3Index = 0; @@ -90,7 +90,7 @@ int MenuManager::MENU() { else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); - spriteData = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + spriteData = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_eventsManager.mouseOn(); _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager._mouseCursorId = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 36c5395ab8..2750b97489 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -99,13 +99,13 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { _vm = vm; } -// Change Object -byte *ObjectsManager::CHANGE_OBJET(int objIndex) { - byte *result = CAPTURE_OBJET(objIndex, 1); - _vm->_eventsManager._objectBuf = result; - _vm->_globals.Nouv_objet = 1; - _vm->_globals.OBJET_EN_COURS = objIndex; - return result; +/** + * Change Object + */ +void ObjectsManager::changeObject(int objIndex) { + _vm->_eventsManager._objectBuf = CAPTURE_OBJET(objIndex, 1); + _vm->_globals._newObjectFl = true; + _vm->_globals._curObjectIndex = objIndex; } byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { @@ -122,7 +122,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OBJET1.SPR"); - _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::CHARGE_SPRITE(_vm->_globals.NFICHIER); + _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite(_vm->_globals.NFICHIER); } _vm->_globals.NUM_FICHIER_OBJ = val1; } @@ -158,26 +158,25 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { return dataP; } -// Delete Object -void ObjectsManager::DELETE_OBJET(int objIndex) { - byte lookCond = false; - int v2 = 0; - do { - ++v2; - if (_vm->_globals.INVENTAIRE[v2] == objIndex) - lookCond = true; - if (v2 > 32) - lookCond = true; - } while (!lookCond); - if (v2 <= 32) { - if (v2 == 32) { - _vm->_globals.INVENTAIRE[32] = 0; +/** + * Remove an Object from the inventory + */ +void ObjectsManager::removeObject(int objIndex) { + int idx; + for (idx = 1; idx <= 32; ++idx) { + if (_vm->_globals._inventory[idx] == objIndex) + break; + } + + if (idx <= 32) { + if (idx == 32) { + _vm->_globals._inventory[32] = 0; } else { - for (int i = v2; i < 32; ++i) - _vm->_globals.INVENTAIRE[i] = _vm->_globals.INVENTAIRE[i + 1]; + for (int i = idx; i < 32; ++i) + _vm->_globals._inventory[i] = _vm->_globals._inventory[i + 1]; } } - CHANGE_OBJET(14); + changeObject(14); } @@ -267,8 +266,10 @@ byte *ObjectsManager::DEL_FICHIER_OBJ() { return g_PTRNUL; } -// Load Sprite -byte *ObjectsManager::CHARGE_SPRITE(const Common::String &file) { +/** + * Load Sprite from file + */ +byte *ObjectsManager::loadSprite(const Common::String &file) { return _vm->_fileManager.loadFile(file); } @@ -285,24 +286,28 @@ int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int return result; } -// Add Object -int ObjectsManager::AJOUTE_OBJET(int objIndex) { +/** + * Add Object + */ +int ObjectsManager::addObject(int objIndex) { bool flag = false; int arrIndex = 0; do { ++arrIndex; - if (!_vm->_globals.INVENTAIRE[arrIndex]) + if (!_vm->_globals._inventory[arrIndex]) flag = true; if (arrIndex == 32) flag = true; } while (!flag); - _vm->_globals.INVENTAIRE[arrIndex] = objIndex; + _vm->_globals._inventory[arrIndex] = objIndex; return arrIndex; } -// Display Sprite -void ObjectsManager::AFF_SPRITES() { +/** + * Display Sprite + */ +void ObjectsManager::displaySprite() { int v1; int v2; int destX; @@ -865,13 +870,11 @@ void ObjectsManager::VERIFCACHE() { int v5; int v6; int v7; - int v8; int v9; int v10; int v11; - v8 = 0; - do { + for (int v8 = 0; v8 <= 19; v8++) { if (_vm->_globals.Cache[v8].fieldA > 0) { v7 = _vm->_globals.Cache[v8].fieldA; v10 = 0; @@ -937,8 +940,7 @@ void ObjectsManager::VERIFCACHE() { _vm->_globals.Cache[v8].field10 = 1; } } - ++v8; - } while (v8 <= 19); + } } void ObjectsManager::DEF_SPRITE(int idx) { @@ -2823,7 +2825,7 @@ LABEL_65: if (_vm->_globals.PLAN_FLAG == true) _vm->_globals.SAUVEGARDE->data[svField1] = 6; _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; - _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; + _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; _vm->_globals.GOACTION = 1; } _vm->_fontManager.hideText(5); @@ -2834,7 +2836,7 @@ LABEL_65: ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField132] == 1 - && _vm->_globals.OBJET_EN_COURS == 20 && NUMZONE == 12 + && _vm->_globals._curObjectIndex == 20 && NUMZONE == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -3994,7 +3996,7 @@ void ObjectsManager::initBorder(int a1) { _vm->_eventsManager._mouseCursorId = 8; if (a1 == 29) _vm->_eventsManager._mouseCursorId = 1; - if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals.INVENTAIRE[a1]) { + if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals._inventory[a1]) { _vm->_eventsManager._mouseCursorId = 0; _borderPos = Common::Point(0, 0); _borderSpriteIndex = 0; @@ -4043,12 +4045,12 @@ void ObjectsManager::OBJETPLUS(int idx) { do { _vm->_eventsManager._mouseCursorId = 6; LABEL_24: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field2 == 1) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field2 == 1) break; ++_vm->_eventsManager._mouseCursorId; if (_vm->_eventsManager._mouseCursorId == 7) { LABEL_26: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field3 == 1) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field3 == 1) return; } v3 = _vm->_eventsManager._mouseCursorId++; @@ -4057,42 +4059,42 @@ LABEL_26: _vm->_eventsManager._mouseCursorId = v3 + 3; if (v3 == 7) { LABEL_29: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field7 == 1) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 == 1) return; } ++_vm->_eventsManager._mouseCursorId; if (_vm->_eventsManager._mouseCursorId == 11) { LABEL_31: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field4 == 1) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field4 == 1) return; } _vm->_eventsManager._mouseCursorId += 2; if (_vm->_eventsManager._mouseCursorId == 13) { LABEL_33: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field5 == 1) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field5 == 1) return; } _vm->_eventsManager._mouseCursorId += 2; if (_vm->_eventsManager._mouseCursorId == 15) { LABEL_35: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field6 == 1) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 1) return; } _vm->_eventsManager._mouseCursorId = 23; LABEL_37: - if (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field6 == 2) + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 2) break; _vm->_eventsManager._mouseCursorId = 25; LABEL_39: ; - } while (_vm->_globals.ObjetW[_vm->_globals.INVENTAIRE[idx]].field7 != 2); + } while (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 != 2); } } } void ObjectsManager::VALID_OBJET(int a1) { if (_vm->_eventsManager._mouseCursorId == 8) - CHANGE_OBJET(a1); + changeObject(a1); } void ObjectsManager::OPTI_OBJET() { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 0faf0f3a32..db2fd9e912 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -121,23 +121,23 @@ public: ObjectsManager(); void setParent(HopkinsEngine *vm); - byte *CHANGE_OBJET(int objIndex); + void changeObject(int objIndex); byte *CAPTURE_OBJET(int objIndex, int mode); - void DELETE_OBJET(int objIndex); + void removeObject(int objIndex); int getWidth(const byte *objectData, int idx); int getHeight(const byte *objectData, int idx); int sprite_alone(const byte *objectData, byte *sprite, int objIndex); byte *DEL_FICHIER_OBJ(); - byte *CHARGE_SPRITE(const Common::String &file); + byte *loadSprite(const Common::String &file); void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); int get_offsetx(const byte *spriteData, int spriteIndex, bool isSize); int get_offsety(const byte *spriteData, int spriteIndex, bool isSize); - void AFF_SPRITES(); + void displaySprite(); int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); - int AJOUTE_OBJET(int objIndex); + int addObject(int objIndex); void INIT_BOB(); void BOB_ZERO(int idx); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index f56706a44e..18cb26e002 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -144,7 +144,7 @@ Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { // Set up the inventory for (int i = 0; i < 35; ++i) - _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals.INVENTAIRE[i]; + _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals._inventory[i]; /* Create the savegame */ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( @@ -196,7 +196,7 @@ Common::Error SaveLoadManager::restore(int slot) { // Unpack the inventory for (int i = 0; i < 35; ++i) - _vm->_globals.INVENTAIRE[i] = _vm->_globals.SAUVEGARDE->inventory[i]; + _vm->_globals._inventory[i] = _vm->_globals.SAUVEGARDE->inventory[i]; // Set variables from loaded data as necessary _vm->_globals.SAUVEGARDE->data[svField10] = slot; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index b4d72f1494..072a63cf28 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -493,11 +493,11 @@ LABEL_1141: if (*(a1 + 2) == 'O') { if (*(a1 + 3) == 'B' && *(a1 + 4) == 'P') { v1 = 1; - _vm->_objectsManager.AJOUTE_OBJET((int16)READ_LE_UINT16(a1 + 5)); + _vm->_objectsManager.addObject((int16)READ_LE_UINT16(a1 + 5)); } if (*(a1 + 2) == 'O' && *(a1 + 3) == 'B' && *(a1 + 4) == 'M') { v1 = 1; - _vm->_objectsManager.DELETE_OBJET((int16)READ_LE_UINT16(a1 + 5)); + _vm->_objectsManager.removeObject((int16)READ_LE_UINT16(a1 + 5)); } } if (*(a1 + 2) == 'G' && *(a1 + 3) == 'O' && *(a1 + 4) == 'T') diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 77b8fdc6a5..292afafc98 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -100,7 +100,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + PERSOSPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -1230,7 +1230,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - PERSOSPR = _vm->_objectsManager.CHARGE_SPRITE(_vm->_globals.NFICHIER); + PERSOSPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); -- cgit v1.2.3 From e99d5b320a3e2737d0bb6aa9d4c401b2c3116beb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 17 Dec 2012 00:16:49 +0100 Subject: HOPKINS: Renaming of members of Globals and ObjectsManager --- engines/hopkins/anim.cpp | 37 ++- engines/hopkins/computer.cpp | 16 +- engines/hopkins/events.cpp | 4 +- engines/hopkins/globals.cpp | 33 +- engines/hopkins/globals.h | 90 +++--- engines/hopkins/graphics.cpp | 51 ++- engines/hopkins/hopkins.cpp | 32 +- engines/hopkins/objects.cpp | 725 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 17 +- engines/hopkins/saveload.cpp | 12 +- engines/hopkins/script.cpp | 124 ++++---- engines/hopkins/talk.cpp | 22 +- 12 files changed, 576 insertions(+), 587 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index d1c6f18425..a1b318c103 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -603,15 +603,15 @@ void AnimationManager::loadAnim(const Common::String &animName) { */ void AnimationManager::clearAnim() { for (int idx = 0; idx < 35; ++idx) { - _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx].data); + _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx]._data); _vm->_globals.Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - _vm->_globals.Bank[idx].data = _vm->_globals.freeMemory(_vm->_globals.Bank[idx].data); + _vm->_globals.Bank[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bank[idx]._data); _vm->_globals.Bank[idx].field4 = 0; - _vm->_globals.Bank[idx].filename1 = ""; - _vm->_globals.Bank[idx].fileHeader = 0; + _vm->_globals.Bank[idx]._filename = ""; + _vm->_globals.Bank[idx]._fileHeader = 0; _vm->_globals.Bank[idx].field1C = 0; } } @@ -629,20 +629,19 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); _vm->_globals.Bank[idx].field4 = 1; - _vm->_globals.Bank[idx].filename1 = filename; - _vm->_globals.Bank[idx].filename2 = _vm->_globals.REP_SPR; + _vm->_globals.Bank[idx]._filename = filename; v3 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v4 = v3; - _vm->_globals.Bank[idx].fileHeader = 0; + _vm->_globals.Bank[idx]._fileHeader = 0; if (*(v3 + 1) == 'L' && *(v3 + 2) == 'E') - _vm->_globals.Bank[idx].fileHeader = 1; + _vm->_globals.Bank[idx]._fileHeader = 1; if (*(v3 + 1) == 'O' && *(v3 + 2) == 'R') - _vm->_globals.Bank[idx].fileHeader = 2; + _vm->_globals.Bank[idx]._fileHeader = 2; - if (_vm->_globals.Bank[idx].fileHeader) { - _vm->_globals.Bank[idx].data = v3; + if (_vm->_globals.Bank[idx]._fileHeader) { + _vm->_globals.Bank[idx]._data = v3; bool loopCond = false; int v8 = 0; @@ -664,7 +663,7 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { if (v8 <= 249) { _vm->_globals.Bank[idx].field1A = v8; - Common::String ofsFilename = _vm->_globals.Bank[idx].filename1; + Common::String ofsFilename = _vm->_globals.Bank[idx]._filename; char ch; do { ch = ofsFilename.lastChar(); @@ -686,9 +685,9 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { int y2 = (int16)READ_LE_UINT16(v13 + 6); v13 += 8; - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, objIdx, x1, y1, 0); - if (_vm->_globals.Bank[idx].fileHeader == 2) - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx].data, objIdx, x2, y2, 1); + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); + if (_vm->_globals.Bank[idx]._fileHeader == 2) + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); } } @@ -753,18 +752,18 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { v8 = 1; if (count < v6) { _vm->_globals.Bqe_Anim[animIndex].field4 = 0; - _vm->_globals.Bqe_Anim[v19].data = g_PTRNUL; + _vm->_globals.Bqe_Anim[v19]._data = g_PTRNUL; return; } ++v6; ++v7; ++v5; } while (v8 != 1); - _vm->_globals.Bqe_Anim[v19].data = _vm->_globals.allocMemory(v7 + 50); + _vm->_globals.Bqe_Anim[v19]._data = _vm->_globals.allocMemory(v7 + 50); _vm->_globals.Bqe_Anim[animIndex].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[v19].data, v21 + data + 5, 0x14u); + memcpy(_vm->_globals.Bqe_Anim[v19]._data, v21 + data + 5, 0x14u); - byte *dataP = _vm->_globals.Bqe_Anim[v19].data; + byte *dataP = _vm->_globals.Bqe_Anim[v19]._data; v9 = dataP + 20; v23 = v21 + data + 25; v10 = READ_LE_UINT16(v21 + data + 25); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 467b21352b..165f4c3b3b 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -800,8 +800,8 @@ void ComputerManager::playBreakout() { // Set up the racket and ball _vm->_eventsManager.mouseOff(); _ballPosition = Common::Point(RAQX + 14, 187); - _vm->_objectsManager.SETYSPR(1, 187); - _vm->_objectsManager.SETXSPR(1, _ballPosition.x); + _vm->_objectsManager.setSpriteY(1, 187); + _vm->_objectsManager.setSpriteX(1, _ballPosition.x); _vm->_graphicsManager.RESET_SEGMENT_VESA(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.FADE_IN_CASSE(); @@ -813,9 +813,9 @@ void ComputerManager::playBreakout() { RAQX = 5; if (RAQX > 282) RAQX = 282; - _vm->_objectsManager.SETXSPR(0, RAQX); - _vm->_objectsManager.SETXSPR(1, RAQX + 14); - _vm->_objectsManager.SETYSPR(1, 187); + _vm->_objectsManager.setSpriteX(0, RAQX); + _vm->_objectsManager.setSpriteX(1, RAQX + 14); + _vm->_objectsManager.setSpriteY(1, 187); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && _vm->_eventsManager.getMouseButton() != 1); @@ -833,7 +833,7 @@ void ComputerManager::playBreakout() { RAQX = 5; if (RAQX > 282) RAQX = 282; - _vm->_objectsManager.SETXSPR(0, RAQX); + _vm->_objectsManager.setSpriteX(0, RAQX); v1 = moveBall(); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && !v1); @@ -1211,8 +1211,8 @@ int ComputerManager::moveBall() { if (_ballPosition.y > 194) v4 = 1; checkBallCollisions(); - _vm->_objectsManager.SETXSPR(1, _ballPosition.x); - _vm->_objectsManager.SETYSPR(1, _ballPosition.y); + _vm->_objectsManager.setSpriteX(1, _ballPosition.x); + _vm->_objectsManager.setSpriteY(1, _ballPosition.y); if (!_breakoutBrickNbr) v4 = 2; return v4; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 4667219af6..ba43e182ee 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -449,8 +449,8 @@ LABEL_65: if (_vm->_globals.NBBLOC) { int v10 = _vm->_globals.NBBLOC + 1; for (int i = 1; i != v10; i++) { - if (_vm->_globals.BLOC[i].field0 == 1) - _vm->_globals.BLOC[i].field0 = 0; + if (_vm->_globals.BLOC[i]._activeFl) + _vm->_globals.BLOC[i]._activeFl = false; } } _vm->_globals.NBBLOC = 0; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 56e09260f2..82da133636 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -371,8 +371,8 @@ void Globals::clearAll() { _curObjectIndex = 0; for (int idx = 0; idx < 105; ++idx) { - ZONEP[idx].destX = 0; - ZONEP[idx].destY = 0; + ZONEP[idx]._destX = 0; + ZONEP[idx]._destY = 0; ZONEP[idx].field4 = 0; } @@ -442,43 +442,42 @@ void Globals::HOPKINS_DATA() { void Globals::INIT_ANIM() { for (int idx = 0; idx < 35; ++idx) { - Bqe_Anim[idx].data = g_PTRNUL; + Bqe_Anim[idx]._data = g_PTRNUL; Bqe_Anim[idx].field4 = 0; } for (int idx = 0; idx < 8; ++idx) { - Bank[idx].data = g_PTRNUL; + Bank[idx]._data = g_PTRNUL; Bank[idx].field4 = 0; - Bank[idx].filename1 = ""; - Bank[idx].fileHeader = 0; + Bank[idx]._filename = ""; + Bank[idx]._fileHeader = 0; Bank[idx].field1C = 0; - Bank[idx].filename2 = ""; } } void Globals::INIT_VBOB() { for (int idx = 0; idx < 30; ++idx) { VBob[idx].field4 = 0; - VBob[idx].xp = 0; - VBob[idx].yp = 0; - VBob[idx].frameIndex = 0; + VBob[idx]._xp = 0; + VBob[idx]._yp = 0; + VBob[idx]._frameIndex = 0; VBob[idx].fieldC = 0; - VBob[idx].surface = g_PTRNUL; + VBob[idx]._surface = g_PTRNUL; VBob[idx].spriteData = g_PTRNUL; - VBob[idx].oldSpriteData = g_PTRNUL; + VBob[idx]._oldSpriteData = g_PTRNUL; } } void Globals::CLEAR_VBOB() { for (int idx = 0; idx < 30; ++idx) { VBob[idx].field4 = 0; - VBob[idx].xp = 0; - VBob[idx].yp = 0; - VBob[idx].frameIndex = 0; + VBob[idx]._xp = 0; + VBob[idx]._yp = 0; + VBob[idx]._frameIndex = 0; VBob[idx].fieldC = 0; - VBob[idx].surface = freeMemory(VBob[idx].surface); + VBob[idx]._surface = freeMemory(VBob[idx]._surface); VBob[idx].spriteData = g_PTRNUL; - VBob[idx].oldSpriteData = g_PTRNUL; + VBob[idx]._oldSpriteData = g_PTRNUL; } } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 4dc0034fc3..8aa49af756 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -30,8 +30,8 @@ namespace Hopkins { struct ZonePItem { - int destX; - int destY; + int _destX; + int _destY; int field4; int field6; int field7; @@ -60,49 +60,48 @@ struct CarreZoneItem { }; struct BqeAnimItem { - byte *data; + byte *_data; int field4; }; struct BankItem { - byte *data; + byte *_data; int8 field4; - Common::String filename1; - int fileHeader; + Common::String _filename; + int _fileHeader; int field1A; uint32 field1C; - Common::String filename2; }; struct ListeItem { int field0; int field2; int field4; - int width; - int height; + int _width; + int _height; int fieldA; }; struct Liste2Item { - int field0; - int xp; - int yp; - int width; - int height; + bool _visibleFl; + int _xp; + int _yp; + int _width; + int _height; }; struct BobItem { int field0; - byte *spriteData; - int xp; - int yp; - int frameIndex; + byte *_spriteData; + int _xp; + int _yp; + int _frameIndex; int fieldE; int field10; int field12; int field14; int field16; - byte *animData; + byte *_animData; int field1C; int field1E; int field20; @@ -116,14 +115,14 @@ struct BobItem { int field34; int field36; int field38; - bool isSprite; - bool isActive; - int oldX; - int oldY; - int oldWidth; - int oldHeight; - int oldX2; - int oldY2; + bool _isSpriteFl; + bool _activeFl; + int _oldX; + int _oldY; + int _oldWidth; + int _oldHeight; + int _oldX2; + int _oldY2; int field4A; }; @@ -135,16 +134,16 @@ struct BlAnimItem { struct VBobItem { byte *spriteData; int field4; - int xp; - int yp; - int frameIndex; + int _xp; + int _yp; + int _frameIndex; int fieldC; int fieldE; - byte *surface; - int oldX; - int oldY; - int oldFrameIndex; - byte *oldSpriteData; + byte *_surface; + int _oldX; + int _oldY; + int _oldFrameIndex; + byte *_oldSpriteData; }; struct ObjetWItem { @@ -159,11 +158,11 @@ struct ObjetWItem { }; struct BlocItem { - uint16 field0; - int x1; - int y1; - int x2; - int y2; + uint16 _activeFl; + int _x1; + int _y1; + int _x2; + int _y2; }; /** @@ -289,11 +288,11 @@ enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARA // TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { - byte data[0x802]; - CharacterLocation cloneHopkins; - CharacterLocation realHopkins; - CharacterLocation samantha; - int16 inventory[35]; // Originally at offset 1300 of data array + byte data[2050]; + CharacterLocation _cloneHopkins; + CharacterLocation _realHopkins; + CharacterLocation _samantha; + int16 _inventory[35]; // Originally at offset 1300 of data array }; struct CreditItem { @@ -358,7 +357,6 @@ public: Common::String FICH_ZONE; Common::String FICH_TEXTE; Common::String NFICHIER; - Common::String REP_SPR; int SOUNDVOL; int MUSICVOL; int VOICEVOL; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 27a39059cb..cb11b4ddb1 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1230,7 +1230,7 @@ void GraphicsManager::VISU_ALL() { void GraphicsManager::RESET_SEGMENT_VESA() { if (_vm->_globals.NBBLOC > 0) { for (int idx = 0; idx != _vm->_globals.NBBLOC; idx++) - _vm->_globals.BLOC[idx].field0 = 0; + _vm->_globals.BLOC[idx]._activeFl = false; _vm->_globals.NBBLOC = 0; } @@ -1260,9 +1260,8 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { do { BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; - if (bloc.field0 == 1 - && tempX >= bloc.x1 && x2 <= bloc.x2 - && y1 >= bloc.y1 && y2 <= bloc.y2) + if (bloc._activeFl && tempX >= bloc._x1 && x2 <= bloc._x2 + && y1 >= bloc._y1 && y2 <= bloc._y2) addFlag = false; ++blocIndex; blocCount = blocIndex; @@ -1273,11 +1272,11 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { assert(_vm->_globals.NBBLOC < 250); BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; - bloc.field0 = 1; - bloc.x1 = tempX; - bloc.x2 = x2; - bloc.y1 = y1; - bloc.y2 = y2; + bloc._activeFl = true; + bloc._x1 = tempX; + bloc._x2 = x2; + bloc._y1 = y1; + bloc._y2 = y2; } } @@ -1292,34 +1291,34 @@ void GraphicsManager::Affiche_Segment_Vesa() { for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { BlocItem &bloc = _vm->_globals.BLOC[idx]; Common::Rect &dstRect = dstrect[idx - 1]; - if (bloc.field0 != 1) + if (!bloc._activeFl) continue; if (_vm->_eventsManager._breakoutFl) { - Copy_Vga16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1, bloc.y1); - dstRect.left = bloc.x1 * 2; - dstRect.top = bloc.y1 * 2 + 30; - dstRect.setWidth((bloc.x2 - bloc.x1) * 2); - dstRect.setHeight((bloc.y2 - bloc.y1) * 2); - } else if (bloc.x2 > _vm->_eventsManager._startPos.x && bloc.x1 < (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) { - if (bloc.x1 < _vm->_eventsManager._startPos.x) - bloc.x1 = _vm->_eventsManager._startPos.x; - if (bloc.x2 > (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) - bloc.x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; + Copy_Vga16(VESA_BUFFER, bloc._x1, bloc._y1, bloc._x2 - bloc._x1, bloc._y2 - bloc._y1, bloc._x1, bloc._y1); + dstRect.left = bloc._x1 * 2; + dstRect.top = bloc._y1 * 2 + 30; + dstRect.setWidth((bloc._x2 - bloc._x1) * 2); + dstRect.setHeight((bloc._y2 - bloc._y1) * 2); + } else if (bloc._x2 > _vm->_eventsManager._startPos.x && bloc._x1 < (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) { + if (bloc._x1 < _vm->_eventsManager._startPos.x) + bloc._x1 = _vm->_eventsManager._startPos.x; + if (bloc._x2 > (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) + bloc._x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; // WORKAROUND: Original didn't lock the screen for access DD_Lock(); - m_scroll16(VESA_BUFFER, bloc.x1, bloc.y1, bloc.x2 - bloc.x1, bloc.y2 - bloc.y1, bloc.x1 - _vm->_eventsManager._startPos.x, bloc.y1); + m_scroll16(VESA_BUFFER, bloc._x1, bloc._y1, bloc._x2 - bloc._x1, bloc._y2 - bloc._y1, bloc._x1 - _vm->_eventsManager._startPos.x, bloc._y1); - dstRect.left = bloc.x1 - _vm->_eventsManager._startPos.x; - dstRect.top = bloc.y1; - dstRect.setWidth(bloc.x2 - bloc.x1); - dstRect.setHeight(bloc.y2 - bloc.y1); + dstRect.left = bloc._x1 - _vm->_eventsManager._startPos.x; + dstRect.top = bloc._y1; + dstRect.setWidth(bloc._x2 - bloc._x1); + dstRect.setHeight(bloc._y2 - bloc._y1); DD_Unlock(); } - _vm->_globals.BLOC[idx].field0 = 0; + _vm->_globals.BLOC[idx]._activeFl = false; } _vm->_globals.NBBLOC = 0; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 9e70258a09..2780b68113 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4537,7 +4537,7 @@ void HopkinsEngine::BTOCEAN() { _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 7; _globals.SORTIE = 1; - int oldX = _objectsManager.XSPR(0); + int oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals.vitesse == 1) oldX -= 2; @@ -4545,7 +4545,7 @@ void HopkinsEngine::BTOCEAN() { oldX -= 4; else if (_globals.vitesse == 3) oldX -= 6; - _objectsManager.SETXSPR(0, oldX); + _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) { @@ -4569,7 +4569,7 @@ LABEL_22: _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 3; _globals.SORTIE = 2; - int oldX = _objectsManager.XSPR(0); + int oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals.vitesse == 1) oldX += 2; @@ -4577,7 +4577,7 @@ LABEL_22: oldX += 4; else if (_globals.vitesse == 3) oldX += 6; - _objectsManager.SETXSPR(0, oldX); + _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) { @@ -4594,7 +4594,7 @@ LABEL_22: LABEL_41: if (_objectsManager.NUMZONE == 3) { if (_globals.OCEAN_SENS == 3) { - int oldX = _objectsManager.XSPR(0); + int oldX = _objectsManager.getSpriteX(0); do { if (_globals.vitesse == 1) oldX += 2; @@ -4602,7 +4602,7 @@ LABEL_41: oldX += 4; else if (_globals.vitesse == 3) oldX += 6; - _objectsManager.SETXSPR(0, oldX); + _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) { @@ -4619,7 +4619,7 @@ LABEL_41: } LABEL_57: if (_globals.OCEAN_SENS == 7) { - int oldX = _objectsManager.XSPR(0); + int oldX = _objectsManager.getSpriteX(0); do { if (_globals.vitesse == 1) oldX -= 2; @@ -4627,7 +4627,7 @@ LABEL_57: oldX -= 4; else if (_globals.vitesse == 3) oldX -= 6; - _objectsManager.SETXSPR(0, oldX); + _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) { @@ -4650,7 +4650,7 @@ LABEL_72: } if (_objectsManager.NUMZONE == 4) { if (_globals.OCEAN_SENS == 3) { - int oldX = _objectsManager.XSPR(0); + int oldX = _objectsManager.getSpriteX(0); do { if (_globals.vitesse == 1) oldX += 2; @@ -4658,7 +4658,7 @@ LABEL_72: oldX += 4; else if (_globals.vitesse == 3) oldX += 6; - _objectsManager.SETXSPR(0, oldX); + _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) { @@ -4675,7 +4675,7 @@ LABEL_72: } LABEL_91: if (_globals.OCEAN_SENS == 7) { - int oldX = _objectsManager.XSPR(0); + int oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals.vitesse == 1) oldX -= 2; @@ -4683,7 +4683,7 @@ LABEL_91: oldX -= 4; else if (_globals.vitesse == 3) oldX -= 6; - _objectsManager.SETXSPR(0, oldX); + _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) { @@ -4710,13 +4710,13 @@ LABEL_91: void HopkinsEngine::OCEAN_HOME() { if (_globals.OCEAN_SENS == 3) - _objectsManager.SETANISPR(0, 0); + _objectsManager.setSpriteIndex(0, 0); if (_globals.OCEAN_SENS == 7) - _objectsManager.SETANISPR(0, 18); + _objectsManager.setSpriteIndex(0, 18); if (_globals.OCEAN_SENS == 1) - _objectsManager.SETANISPR(0, 27); + _objectsManager.setSpriteIndex(0, 27); if (_globals.OCEAN_SENS == 5) - _objectsManager.SETANISPR(0, 9); + _objectsManager.setSpriteIndex(0, 9); } void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2750b97489..6e3aa4f2e5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -180,13 +180,16 @@ void ObjectsManager::removeObject(int objIndex) { } +/** + * Set Offset XY + */ void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { byte *startP = data + 3; for (int i = idx; i; --i) startP += READ_LE_UINT32(startP) + 16; byte *rectP = startP + 8; - if (isSize == 1) { + if (isSize) { // Set size byte *pointP = rectP + 4; WRITE_LE_UINT16(pointP, xp); @@ -259,11 +262,9 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn return result; } -byte *ObjectsManager::DEL_FICHIER_OBJ() { +void ObjectsManager::DEL_FICHIER_OBJ() { _vm->_globals.NUM_FICHIER_OBJ = 0; _vm->_globals.ADR_FICHIER_OBJ = _vm->_globals.freeMemory(_vm->_globals.ADR_FICHIER_OBJ); - - return g_PTRNUL; } /** @@ -361,7 +362,7 @@ void ObjectsManager::displaySprite() { } if (!PERSO_ON) { - for (int idx = 0; idx < 5; ++idx) { + for (int idx = 0; idx < MAX_SPRITE; ++idx) { if (_vm->_globals.Liste[idx].field0) { v6 = _vm->_globals.Liste[idx].field2; x1_2 = v6 - 2; @@ -379,7 +380,7 @@ void ObjectsManager::displaySprite() { v9 = _vm->_graphicsManager.min_y; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_2, y1_2, - _vm->_globals.Liste[idx].width + 4, _vm->_globals.Liste[idx].height + 4, + _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, _vm->_graphicsManager.VESA_BUFFER, v8, v9); _vm->_globals.Liste[idx].field0 = 0; } @@ -391,7 +392,7 @@ void ObjectsManager::displaySprite() { if (!PERSO_ON) { // Handle drawing characters on the screen - for (int idx = 0; idx < 5; ++idx) { + for (int idx = 0; idx < MAX_SPRITE; ++idx) { _vm->_globals.Liste[idx].field0 = 0; if (_sprite[idx].field0 == 1) { CALCUL_SPRITE(idx); @@ -491,7 +492,7 @@ void ObjectsManager::displaySprite() { } if (SL_FLAG == true) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); if (SL_X && SL_Y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); @@ -571,16 +572,16 @@ void ObjectsManager::BOB_ZERO(int idx) { Liste2Item &item = _vm->_globals.Liste2[idx]; bob.field0 = 0; - bob.spriteData = g_PTRNUL; - bob.xp = 0; - bob.yp = 0; - bob.frameIndex = 0; + bob._spriteData = g_PTRNUL; + bob._xp = 0; + bob._yp = 0; + bob._frameIndex = 0; bob.fieldE = 0; bob.field10 = 0; bob.field12 = 0; bob.field14 = 0; bob.field16 = 0; - bob.animData = g_PTRNUL; + bob._animData = g_PTRNUL; bob.field1C = 0; bob.field1E = 0; bob.field20 = 0; @@ -594,66 +595,65 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field34 = 0; bob.field36 = 0; bob.field38 = 0; - bob.oldX2 = 0; + bob._oldX2 = 0; - item.field0 = 0; - item.xp = 0; - item.yp = 0; - item.width = 0; - item.height = 0; + item._visibleFl = false; + item._xp = 0; + item._yp = 0; + item._width = 0; + item._height = 0; } void ObjectsManager::DEF_BOB(int idx) { - if (_vm->_globals.Bob[idx].isActive) { - int xp = _vm->_globals.Bob[idx].oldX; - int yp = _vm->_globals.Bob[idx].oldY; + if (_vm->_globals.Bob[idx]._activeFl) { + int xp = _vm->_globals.Bob[idx]._oldX; + int yp = _vm->_globals.Bob[idx]._oldY; - if (_vm->_globals.Bob[idx].isSprite) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx].spriteData, - xp + 300, yp + 300, _vm->_globals.Bob[idx].frameIndex); + if (_vm->_globals.Bob[idx]._isSpriteFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx]._spriteData, + xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.Bob[idx].spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx].frameIndex, - _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx].oldY2, + _vm->_globals.Bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex, + _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx]._oldY2, _vm->_globals.Bob[idx].field38); - _vm->_globals.Liste2[idx].field0 = 1; - _vm->_globals.Liste2[idx].xp = xp; - _vm->_globals.Liste2[idx].yp = yp; + _vm->_globals.Liste2[idx]._visibleFl = true; + _vm->_globals.Liste2[idx]._xp = xp; + _vm->_globals.Liste2[idx]._yp = yp; - _vm->_globals.Liste2[idx].width = _vm->_globals.Bob[idx].oldWidth; - _vm->_globals.Liste2[idx].height = _vm->_globals.Bob[idx].oldHeight; + _vm->_globals.Liste2[idx]._width = _vm->_globals.Bob[idx]._oldWidth; + _vm->_globals.Liste2[idx]._height = _vm->_globals.Bob[idx]._oldHeight; - int v5 = _vm->_globals.Liste2[idx].xp; - int v6 = _vm->_graphicsManager.min_x; + int v5 = _vm->_globals.Liste2[idx]._xp; if (v5 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste2[idx].width -= _vm->_graphicsManager.min_x - v5; - _vm->_globals.Liste2[idx].xp = v6; + _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager.min_x - v5; + _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager.min_x; } - int v7 = _vm->_globals.Liste2[idx].yp; - int v8 = _vm->_graphicsManager.min_y; + int v7 = _vm->_globals.Liste2[idx]._yp; if (v7 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste2[idx].height -= _vm->_graphicsManager.min_y - v7; - _vm->_globals.Liste2[idx].yp = v8; + _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager.min_y - v7; + _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager.min_y; } - int v9 = _vm->_globals.Liste2[idx].xp; - if (_vm->_globals.Liste2[idx].width + v9 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste2[idx].width = _vm->_graphicsManager.max_x - v9; - int v10 = _vm->_globals.Liste2[idx].yp; - if (_vm->_globals.Liste2[idx].height + v10 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste2[idx].height = _vm->_graphicsManager.max_y - v10; + int v9 = _vm->_globals.Liste2[idx]._xp; + if (_vm->_globals.Liste2[idx]._width + v9 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager.max_x - v9; - if (_vm->_globals.Liste2[idx].width <= 0 || _vm->_globals.Liste2[idx].height <= 0) - _vm->_globals.Liste2[idx].field0 = 0; + int v10 = _vm->_globals.Liste2[idx]._yp; + if (_vm->_globals.Liste2[idx]._height + v10 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager.max_y - v10; - if (_vm->_globals.Liste2[idx].field0 == 1) + if (_vm->_globals.Liste2[idx]._width <= 0 || _vm->_globals.Liste2[idx]._height <= 0) + _vm->_globals.Liste2[idx]._visibleFl = false; + + if (_vm->_globals.Liste2[idx]._visibleFl) _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.Liste2[idx].xp, - _vm->_globals.Liste2[idx].yp, - _vm->_globals.Liste2[idx].xp + _vm->_globals.Liste2[idx].width, - _vm->_globals.Liste2[idx].yp + _vm->_globals.Liste2[idx].height); + _vm->_globals.Liste2[idx]._xp, + _vm->_globals.Liste2[idx]._yp, + _vm->_globals.Liste2[idx]._xp + _vm->_globals.Liste2[idx]._width, + _vm->_globals.Liste2[idx]._yp + _vm->_globals.Liste2[idx]._height); } } @@ -663,7 +663,7 @@ void ObjectsManager::BOB_VISU(int idx) { if (!_vm->_globals.Bob[idx].field0) { BOB_ZERO(idx); - const byte *data = _vm->_globals.Bqe_Anim[idx].data; + const byte *data = _vm->_globals.Bqe_Anim[idx]._data; int v1 = (int16)READ_LE_UINT16(data); int16 v9 = (int16)READ_LE_UINT16(data + 2); int16 v8 = (int16)READ_LE_UINT16(data + 4); @@ -677,17 +677,17 @@ void ObjectsManager::BOB_VISU(int idx) { v6 = -1; if ((int16)READ_LE_UINT16(data + 24)) { - _vm->_globals.Bob[idx].isSprite = false; + _vm->_globals.Bob[idx]._isSpriteFl = false; - if (_vm->_globals.Bank[v1].fileHeader == 1) { - _vm->_globals.Bob[idx].isSprite = true; + if (_vm->_globals.Bank[v1]._fileHeader == 1) { + _vm->_globals.Bob[idx]._isSpriteFl = true; _vm->_globals.Bob[idx].field36 = 0; _vm->_globals.Bob[idx].field38 = 0; } - _vm->_globals.Bob[idx].animData = _vm->_globals.Bqe_Anim[idx].data; + _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals.Bob[idx].field0 = 10; - _vm->_globals.Bob[idx].spriteData = _vm->_globals.Bank[v1].data; + _vm->_globals.Bob[idx]._spriteData = _vm->_globals.Bank[v1]._data; _vm->_globals.Bob[idx].field1E = v9; _vm->_globals.Bob[idx].field20 = v6; @@ -707,11 +707,11 @@ void ObjectsManager::BOB_OFF(int idx) { } void ObjectsManager::BOB_OFFSET(int idx, int v) { - _vm->_globals.Bob[idx].oldX2 = v; + _vm->_globals.Bob[idx]._oldX2 = v; } void ObjectsManager::BOB_ADJUST(int idx, int v) { - _vm->_globals.Bob[idx].oldX2 = v; + _vm->_globals.Bob[idx]._oldX2 = v; } void ObjectsManager::BOB_OFFSETY(int idx, int v) { @@ -723,10 +723,10 @@ void ObjectsManager::SCBOB(int idx) { return; for (int v8 = 0; v8 <= 20; v8++) { - if ((_vm->_globals.Bob[v8].field0) && (!_vm->_globals.Bob[v8].field16) && (!_vm->_globals.Bob[v8].field34) && (_vm->_globals.Bob[v8].frameIndex != 250)) { - int v2 = _vm->_globals.Bob[v8].oldWidth; - int v9 = _vm->_globals.Bob[v8].oldX + _vm->_globals.Bob[v8].oldWidth; - int v6 = _vm->_globals.Bob[v8].oldY + _vm->_globals.Bob[v8].oldHeight; + if ((_vm->_globals.Bob[v8].field0) && (!_vm->_globals.Bob[v8].field16) && (!_vm->_globals.Bob[v8].field34) && (_vm->_globals.Bob[v8]._frameIndex != 250)) { + int v2 = _vm->_globals.Bob[v8]._oldWidth; + int v9 = _vm->_globals.Bob[v8]._oldX + _vm->_globals.Bob[v8]._oldWidth; + int v6 = _vm->_globals.Bob[v8]._oldY + _vm->_globals.Bob[v8]._oldHeight; int v3 =_vm->_globals.Cache[idx].field0; int v4 =_vm->_globals.Cache[idx].field4; int v7 =_vm->_globals.Cache[idx].field6 + v3; @@ -764,21 +764,21 @@ void ObjectsManager::SCBOB(int idx) { } void ObjectsManager::CALCUL_BOB(int idx) { - _vm->_globals.Bob[idx].isActive = false; - if (_vm->_globals.Bob[idx].isSprite) { + _vm->_globals.Bob[idx]._activeFl = false; + if (_vm->_globals.Bob[idx]._isSpriteFl) { _vm->_globals.Bob[idx].field38 = 0; _vm->_globals.Bob[idx].field36 = 0; } - int result = _vm->_globals.Bob[idx].frameIndex; + int result = _vm->_globals.Bob[idx]._frameIndex; if (result != 250) { int v5, v15, v22; if (_vm->_globals.Bob[idx].field38) { - v22 = v15 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 1); - v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 1); + v22 = v15 = get_offsetx(_vm->_globals.Bob[idx]._spriteData, result, 1); + v5 = get_offsety(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex, 1); } else { - v22 = v15 = get_offsetx(_vm->_globals.Bob[idx].spriteData, result, 0); - v5 = get_offsety(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex, 0); + v22 = v15 = get_offsetx(_vm->_globals.Bob[idx]._spriteData, result, 0); + v5 = get_offsety(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex, 0); } int v17 = v5; @@ -831,20 +831,20 @@ void ObjectsManager::CALCUL_BOB(int idx) { } } - int v13 = _vm->_globals.Bob[idx].xp - v22; - int v14 = _vm->_globals.Bob[idx].yp - v17; - _vm->_globals.Bob[idx].isActive = true; - _vm->_globals.Bob[idx].oldX = v13; - _vm->_globals.Bob[idx].oldY = v14; - _vm->_globals.Bob[idx].oldY2 = v21; + int v13 = _vm->_globals.Bob[idx]._xp - v22; + int v14 = _vm->_globals.Bob[idx]._yp - v17; + _vm->_globals.Bob[idx]._activeFl = true; + _vm->_globals.Bob[idx]._oldX = v13; + _vm->_globals.Bob[idx]._oldY = v14; + _vm->_globals.Bob[idx]._oldY2 = v21; _vm->_globals.Bob[idx].field4A = v20; - _vm->_globals.Liste2[idx].field0 = 1; - _vm->_globals.Liste2[idx].xp = v13; - _vm->_globals.Liste2[idx].yp = v14; + _vm->_globals.Liste2[idx]._visibleFl = true; + _vm->_globals.Liste2[idx]._xp = v13; + _vm->_globals.Liste2[idx]._yp = v14; - int width = getWidth(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); - int height = getHeight(_vm->_globals.Bob[idx].spriteData, _vm->_globals.Bob[idx].frameIndex); + int width = getWidth(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex); + int height = getHeight(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex); if (v21) { width = _vm->_graphicsManager.zoomIn(width, v21); @@ -855,10 +855,10 @@ void ObjectsManager::CALCUL_BOB(int idx) { width = _vm->_graphicsManager.zoomOut(width, v20); } - _vm->_globals.Liste2[idx].width = width; - _vm->_globals.Liste2[idx].height = height; - _vm->_globals.Bob[idx].oldWidth = width; - _vm->_globals.Bob[idx].oldHeight = height; + _vm->_globals.Liste2[idx]._width = width; + _vm->_globals.Liste2[idx]._height = height; + _vm->_globals.Bob[idx]._oldWidth = width; + _vm->_globals.Bob[idx]._oldHeight = height; } } @@ -871,14 +871,12 @@ void ObjectsManager::VERIFCACHE() { int v6; int v7; int v9; - int v10; int v11; for (int v8 = 0; v8 <= 19; v8++) { if (_vm->_globals.Cache[v8].fieldA > 0) { v7 = _vm->_globals.Cache[v8].fieldA; - v10 = 0; - do { + for (int v10 = 0; v10 <= 4; v10++) { if (_sprite[v10].field0 == 1) { if (_sprite[v10]._spriteIndex != 250) { v1 = _sprite[v10].field2C; @@ -919,9 +917,7 @@ void ObjectsManager::VERIFCACHE() { } } } - - ++v10; - } while (v10 <= 4); + } SCBOB(v8); if (_vm->_globals.Cache[v8].fieldA == v7) { @@ -970,29 +966,29 @@ void ObjectsManager::DEF_SPRITE(int idx) { v5 = idx; v6 = idx; - _vm->_globals.Liste[v5].width = _sprite[v6].field30; - _vm->_globals.Liste[v5].height = _sprite[v6].field32; + _vm->_globals.Liste[v5]._width = _sprite[v6].field30; + _vm->_globals.Liste[v5]._height = _sprite[v6].field32; v7 = _vm->_globals.Liste[v5].field2; v8 = _vm->_graphicsManager.min_x; if (v7 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste[v5].width -= _vm->_graphicsManager.min_x - v7; + _vm->_globals.Liste[v5]._width -= _vm->_graphicsManager.min_x - v7; _vm->_globals.Liste[v5].field2 = v8; } v9 = _vm->_globals.Liste[v5].field4; v10 = _vm->_graphicsManager.min_y; if (v9 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste[v5].height -= _vm->_graphicsManager.min_y - v9; + _vm->_globals.Liste[v5]._height -= _vm->_graphicsManager.min_y - v9; _vm->_globals.Liste[v5].field4 = v10; } v11 = _vm->_globals.Liste[v5].field2; - if (_vm->_globals.Liste[v5].width + v11 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste[v5].width = _vm->_graphicsManager.max_x - v11; + if (_vm->_globals.Liste[v5]._width + v11 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste[v5]._width = _vm->_graphicsManager.max_x - v11; v12 = _vm->_globals.Liste[v5].field4; - if ( _vm->_globals.Liste[v5].height + v12 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste[v5].height = _vm->_graphicsManager.max_y - v12; - if ( _vm->_globals.Liste[v5].width <= 0 || _vm->_globals.Liste[v5].height <= 0) + if ( _vm->_globals.Liste[v5]._height + v12 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste[v5]._height = _vm->_graphicsManager.max_y - v12; + if ( _vm->_globals.Liste[v5]._width <= 0 || _vm->_globals.Liste[v5]._height <= 0) _vm->_globals.Liste[v5].field0 = 0; v13 = idx; @@ -1000,8 +996,8 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_graphicsManager.Ajoute_Segment_Vesa( _vm->_globals.Liste[v13].field2, _vm->_globals.Liste[v13].field4, - _vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13].width, - _vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13].height); + _vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13]._width, + _vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13]._height); } } @@ -1190,7 +1186,7 @@ void ObjectsManager::AFF_BOB_ANIM() { v1 = _vm->_globals.Bob[idx].field20; if (v1 == -1) v1 = 50; - if (_vm->_globals.Bob[idx].animData == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) + if (_vm->_globals.Bob[idx]._animData == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) goto LABEL_38; v2 = _vm->_globals.Bob[idx].field14; @@ -1204,18 +1200,18 @@ void ObjectsManager::AFF_BOB_ANIM() { if (_vm->_globals.Bob[idx].field1C != 1) goto LABEL_38; - v20 = _vm->_globals.Bob[idx].animData + 20; + v20 = _vm->_globals.Bob[idx]._animData + 20; v24 = _vm->_globals.Bob[idx].field10; - _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v20 + 2 * v24); + _vm->_globals.Bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; + _vm->_globals.Bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == true && idx > 20 ) - _vm->_globals.Bob[idx].xp += _vm->_eventsManager._startPos.x; + _vm->_globals.Bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); + _vm->_globals.Bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); - _vm->_globals.Bob[idx].frameIndex = *(v20 + 2 * v24 + 8); + _vm->_globals.Bob[idx]._frameIndex = *(v20 + 2 * v24 + 8); _vm->_globals.Bob[idx].field38 = *(v20 + 2 * v24 + 9); _vm->_globals.Bob[idx].field10 += 5; v5 = _vm->_globals.Bob[idx].field12; @@ -1245,18 +1241,18 @@ LABEL_38: _vm->_globals.Bob[idx].field0 = 11; } else { _vm->_globals.Bob[idx].field10 = 0; - v21 = _vm->_globals.Bob[idx].animData + 20; - _vm->_globals.Bob[idx].xp = (int16)READ_LE_UINT16(v21); + v21 = _vm->_globals.Bob[idx]._animData + 20; + _vm->_globals.Bob[idx]._xp = (int16)READ_LE_UINT16(v21); if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals.Bob[idx].xp = _vm->_globals.BL_ANIM[idx].v2; + _vm->_globals.Bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == true && idx > 20) - _vm->_globals.Bob[idx].xp += _vm->_eventsManager._startPos.x; + _vm->_globals.Bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals.Bob[idx].yp = (int16)READ_LE_UINT16(v21 + 2); + _vm->_globals.Bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); - _vm->_globals.Bob[idx].frameIndex = *(v21 + 8); + _vm->_globals.Bob[idx]._frameIndex = *(v21 + 8); _vm->_globals.Bob[idx].field38 = *(v21 + 9); _vm->_globals.Bob[idx].field10 += 5; v10 = _vm->_globals.Bob[idx].field12; @@ -1297,13 +1293,13 @@ LABEL_38: if (v14 != 2) { if (v14 != 4) { - if (_vm->_globals.Liste2[v27].field0) { + if (_vm->_globals.Liste2[v27]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp, - _vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height, - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27].xp, - _vm->_globals.Liste2[v27].yp); - _vm->_globals.Liste2[v27].field0 = 0; + _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, + _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27]._xp, + _vm->_globals.Liste2[v27]._yp); + _vm->_globals.Liste2[v27]._visibleFl = false; } } } @@ -1312,13 +1308,13 @@ LABEL_38: v22 = v27; if (_vm->_globals.Bob[v22].field0 == 11) { - if (_vm->_globals.Liste2[v27].field0) { + if (_vm->_globals.Liste2[v27]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp, - _vm->_globals.Liste2[v27].width, _vm->_globals.Liste2[v27].height, + _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, + _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, _vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.Liste2[v27].xp, _vm->_globals.Liste2[v27].yp); - _vm->_globals.Liste2[v27].field0 = 0; + _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp); + _vm->_globals.Liste2[v27]._visibleFl = false; } _vm->_globals.Bob[v22].field0 = 0; @@ -1330,16 +1326,16 @@ LABEL_38: do { ++v28; v18 = v28; - _vm->_globals.Bob[v18].oldY = 0; + _vm->_globals.Bob[v18]._oldY = 0; if (_vm->_globals.Bob[v18].field0 == 10 && !_vm->_globals.Bob[v18].field16 && _vm->_globals.Bob[v18].field1C == 1) { CALCUL_BOB(v28); - int v = _vm->_globals.Bob[v18].oldHeight + _vm->_globals.Bob[v18].oldY; - v19 = _vm->_globals.Bob[v18].oldX2 + v; + int v = _vm->_globals.Bob[v18]._oldHeight + _vm->_globals.Bob[v18]._oldY; + v19 = _vm->_globals.Bob[v18]._oldX2 + v; if (v19 > 450) v19 = 600; - if (_vm->_globals.Bob[v18].isActive) + if (_vm->_globals.Bob[v18]._activeFl) AvantTri(TRI_BOB, v28, v19); } } while (v28 != 35); @@ -1352,114 +1348,118 @@ void ObjectsManager::AFF_VBOB() { int idx = 0; do { if (_vm->_globals.VBob[idx].field4 == 4) { - width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); + height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].xp, - _vm->_globals.VBob[idx].yp, width, height); + _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, + _vm->_globals.VBob[idx]._yp, width, height); _vm->_graphicsManager.Restore_Mem( - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].surface, - _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx]._surface, + _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, - _vm->_globals.VBob[idx].xp + width, height + _vm->_globals.VBob[idx].yp); + _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, + _vm->_globals.VBob[idx]._xp + width, height + _vm->_globals.VBob[idx]._yp); - _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); _vm->_globals.VBob[idx].field4 = 0; _vm->_globals.VBob[idx].spriteData = g_PTRNUL; - _vm->_globals.VBob[idx].xp = 0; - _vm->_globals.VBob[idx].yp = 0; - _vm->_globals.VBob[idx].oldX = 0; - _vm->_globals.VBob[idx].oldY = 0; - _vm->_globals.VBob[idx].frameIndex = 0; - _vm->_globals.VBob[idx].oldFrameIndex = 0; - _vm->_globals.VBob[idx].oldSpriteData = g_PTRNUL; + _vm->_globals.VBob[idx]._xp = 0; + _vm->_globals.VBob[idx]._yp = 0; + _vm->_globals.VBob[idx]._oldX = 0; + _vm->_globals.VBob[idx]._oldY = 0; + _vm->_globals.VBob[idx]._frameIndex = 0; + _vm->_globals.VBob[idx]._oldFrameIndex = 0; + _vm->_globals.VBob[idx]._oldSpriteData = g_PTRNUL; } if (_vm->_globals.VBob[idx].field4 == 3) { - width = getWidth(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); - height = getHeight(_vm->_globals.VBob[idx].oldSpriteData, _vm->_globals.VBob[idx].oldFrameIndex); + width = getWidth(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); + height = getHeight(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, - _vm->_globals.VBob[idx].oldY, + _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, + _vm->_globals.VBob[idx]._oldY, width, height); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, - _vm->_globals.VBob[idx].surface, _vm->_globals.VBob[idx].oldX, - _vm->_globals.VBob[idx].oldY, width, height); + _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, + _vm->_globals.VBob[idx]._oldY, width, height); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].oldX, - _vm->_globals.VBob[idx].oldY, _vm->_globals.VBob[idx].oldX + width, - _vm->_globals.VBob[idx].oldY + height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx]._oldX, + _vm->_globals.VBob[idx]._oldY, _vm->_globals.VBob[idx]._oldX + width, + _vm->_globals.VBob[idx]._oldY + height); _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx].oldSpriteData = _vm->_globals.VBob[idx].spriteData; + _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx].spriteData; - _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); - _vm->_globals.VBob[idx].oldX = _vm->_globals.VBob[idx].xp; - _vm->_globals.VBob[idx].oldY = _vm->_globals.VBob[idx].yp; - _vm->_globals.VBob[idx].oldFrameIndex = _vm->_globals.VBob[idx].frameIndex; + _vm->_globals.VBob[idx]._oldX = _vm->_globals.VBob[idx]._xp; + _vm->_globals.VBob[idx]._oldY = _vm->_globals.VBob[idx]._yp; + _vm->_globals.VBob[idx]._oldFrameIndex = _vm->_globals.VBob[idx]._frameIndex; } if (_vm->_globals.VBob[idx].field4 == 1) { - width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); - height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx].frameIndex); + width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); + height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); - _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); byte *surface = _vm->_globals.allocMemory(height * width); - _vm->_globals.VBob[idx].surface = surface; + _vm->_globals.VBob[idx]._surface = surface; _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, - _vm->_globals.VBob[idx].xp, _vm->_globals.VBob[idx].yp, width, height); + _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); byte *v10 = _vm->_globals.VBob[idx].spriteData; if (*v10 == 78) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_SCREEN, v10, - _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, - _vm->_globals.VBob[idx].frameIndex, + _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, + _vm->_globals.VBob[idx]._frameIndex, 0, 0, 0); _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx].spriteData, - _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, - _vm->_globals.VBob[idx].frameIndex, + _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, + _vm->_globals.VBob[idx]._frameIndex, 0, 0, 0); } else { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, - v10, _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, - _vm->_globals.VBob[idx].frameIndex); + v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, + _vm->_globals.VBob[idx]._frameIndex); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].spriteData, - _vm->_globals.VBob[idx].xp + 300, _vm->_globals.VBob[idx].yp + 300, - _vm->_globals.VBob[idx].frameIndex); + _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, + _vm->_globals.VBob[idx]._frameIndex); } - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx].xp, - _vm->_globals.VBob[idx].yp , _vm->_globals.VBob[idx].xp + width, - _vm->_globals.VBob[idx].yp + height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx]._xp, + _vm->_globals.VBob[idx]._yp , _vm->_globals.VBob[idx]._xp + width, + _vm->_globals.VBob[idx]._yp + height); _vm->_globals.VBob[idx].field4 = 2; } ++idx; } while ( idx <= 29 ); } -int ObjectsManager::XSPR(int idx) { - if (idx > 5) - error("request of the Coord. x a sprite > MAX_SPRITE."); +/** + * Get Sprite X coordinate + */ +int ObjectsManager::getSpriteX(int idx) { + assert (idx <= MAX_SPRITE); return _sprite[idx]._spritePos.x; } -int ObjectsManager::YSPR(int idx) { - if (idx > 5) - error("request of the Coord. y a sprite > MAX_SPRITE."); +/** + * Get Sprite Y coordinate + */ +int ObjectsManager::getSpriteY(int idx) { + assert (idx <= MAX_SPRITE); return _sprite[idx]._spritePos.y; } @@ -1468,38 +1468,29 @@ void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, } void ObjectsManager::CLEAR_SPR() { - int idx; - - idx = 0; - do { + for (int idx = 0; idx < MAX_SPRITE; idx++) { _sprite[idx].field1C = g_PTRNUL; _sprite[idx]._spriteData = g_PTRNUL; _sprite[idx].field0 = 0; - ++idx; - } while (idx <= 4); + } - idx = 0; - do { + for (int idx = 0; idx < MAX_SPRITE; idx++) { _vm->_globals.Liste[idx].field0 = 0; _vm->_globals.Liste[idx].field2 = 0; _vm->_globals.Liste[idx].field4 = 0; - _vm->_globals.Liste[idx].width = 0; - _vm->_globals.Liste[idx].height = 0; + _vm->_globals.Liste[idx]._width = 0; + _vm->_globals.Liste[idx]._height = 0; _vm->_globals.Liste[idx].fieldA = 0; - ++idx; - } while (idx <= 4); + } } void ObjectsManager::SPRITE_ON(int idx) { - if (idx > 5) - error("Attempt to display a sprite > MAX_SPRITE."); - + assert (idx <= MAX_SPRITE); _sprite[idx].field0 = 1; } void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { - if (idx > 5) - error("Attempt to display a sprite > MAX_SPRITE."); + assert (idx <= MAX_SPRITE); _sprite[idx]._spriteData = spriteData; _sprite[idx]._spritePos = pos; _sprite[idx]._spriteIndex = spriteIndex; @@ -1512,12 +1503,12 @@ void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, _sprite[idx].field26 = 0; _sprite[idx].field22 = 0; _sprite[idx].field0 = 0; - _sprite[idx].field28 = 0; + _sprite[idx].field28 = false; _sprite[idx].fieldE = a7; if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') - _sprite[idx].field28 = 1; + _sprite[idx].field28 = true; - if (_sprite[idx].field28 == 1) { + if (_sprite[idx].field28) { _sprite[idx].fieldC = 0; _sprite[idx].fieldE = 0; } @@ -1535,9 +1526,9 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, _sprite[idx].field22 = 0; _sprite[idx].field14 = a5; if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') - _sprite[idx].field28 = 1; + _sprite[idx].field28 = true; - if (_sprite[idx].field28 == 1) { + if (_sprite[idx].field28) { _sprite[idx].fieldC = 0; _sprite[idx].fieldE = 0; } @@ -1553,14 +1544,12 @@ void ObjectsManager::SPRITE_GEL(int idx) { } int ObjectsManager::SXSPR(int idx) { - if (idx > 5) - error("request of the size of a sprite x > MAX_SPRITE."); + assert (idx <= MAX_SPRITE); return getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); } int ObjectsManager::SYSPR(int idx) { - if (idx > 5) - error("request of the size of a sprite y > MAX_SPRITE."); + assert (idx <= MAX_SPRITE); return getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); } @@ -1574,38 +1563,40 @@ void ObjectsManager::SETPOSISPR(int idx, int a2) { _sprite[idx].field26 = 0; } -void ObjectsManager::SETXSPR(int idx, int xp) { - if (idx > 5) - error("Set the Coord. x a sprite> MAX_SPRITE."); +/** + * Set Sprite X coordinate + */ +void ObjectsManager::setSpriteX(int idx, int xp) { + assert (idx <= MAX_SPRITE); _sprite[idx]._spritePos.x = xp; } -void ObjectsManager::SETANISPR(int idx, int spriteIndex) { - if (idx > 5) - error("Set the Coord. x a sprite> MAX_SPRITE."); - - _sprite[idx]._spriteIndex = spriteIndex; +/** + * Set Sprite Y coordinate + */ +void ObjectsManager::setSpriteY(int idx, int yp) { + assert (idx <= MAX_SPRITE); + _sprite[idx]._spritePos.y = yp; } -void ObjectsManager::SETYSPR(int idx, int yp) { - if ( idx > 5 ) - error("Set the Coord. y a sprite> MAX_SPRITE."); - _sprite[idx]._spritePos.y = yp; +/** + * Set Sprite Index + */ +void ObjectsManager::setSpriteIndex(int idx, int spriteIndex) { + assert (idx <= MAX_SPRITE); + _sprite[idx]._spriteIndex = spriteIndex; } // Set Sprite Size void ObjectsManager::SETTAILLESPR(int idx, int a2) { - if (idx > 5) - error("Set the Coord. there a sprite> MAX_SPRITE."); - - if (_sprite[idx].field28 != 1) + assert (idx <= MAX_SPRITE); + if (!_sprite[idx].field28) _sprite[idx].fieldC = a2; } void ObjectsManager::SETFLIPSPR(int idx, int a2) { - if (_sprite[idx].field28 != 1) { - if (idx > 5) - error("Set the Coord. there a sprite> MAX_SPRITE."); + if (!_sprite[idx].field28) { + assert (idx <= MAX_SPRITE); _sprite[idx].fieldE = a2; } } @@ -1807,7 +1798,7 @@ void ObjectsManager::GOHOME() { g_old_x = nouveau_x; g_old_y = nouveau_y; } else { - SETANISPR(0, _vm->_globals.g_old_sens + 59); + setSpriteIndex(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; if (_vm->_globals.GOACTION == 1) v54 = _vm->_globals.SAUVEGARDE->data[svField2]; @@ -1821,17 +1812,17 @@ void ObjectsManager::GOHOME() { _vm->_globals.g_old_sens = -1; if (v54 > 0) { v55 = v54; - if (_vm->_globals.ZONEP[v55].destX) { - v56 = _vm->_globals.ZONEP[v55].destY; + if (_vm->_globals.ZONEP[v55]._destX) { + v56 = _vm->_globals.ZONEP[v55]._destY; if (v56) { if (v56 != 31) { v57 = _vm->_globals.ZONEP[v55].field4; if (v57 == -1) { - _vm->_globals.ZONEP[v55].destX = 0; - _vm->_globals.ZONEP[v55].destY = 0; + _vm->_globals.ZONEP[v55]._destX = 0; + _vm->_globals.ZONEP[v55]._destY = 0; _vm->_globals.ZONEP[v55].field4 = 0; } else { - SETANISPR(0, v57); + setSpriteIndex(0, v57); _vm->_globals.ACTION_SENS = _vm->_globals.ZONEP[v55].field4 - 59; } } @@ -2154,29 +2145,29 @@ LABEL_153: v49 = _vm->_globals.SAUVEGARDE->data[svField2]; else v49 = NUMZONE; - SETANISPR(0, _vm->_globals.g_old_sens + 59); + setSpriteIndex(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); SETFLIPSPR(0, 0); _vm->_globals.Compteur = 0; _vm->_globals.g_old_sens = -1; - g_old_x = XSPR(0); - g_old_y = YSPR(0); + g_old_x = getSpriteX(0); + g_old_y = getSpriteY(0); if (v49 > 0) { v50 = v49; - if (_vm->_globals.ZONEP[v50].destX) { - v51 = _vm->_globals.ZONEP[v50].destY; + if (_vm->_globals.ZONEP[v50]._destX) { + v51 = _vm->_globals.ZONEP[v50]._destY; if (v51) { if (v51 != 31) { v52 = _vm->_globals.ZONEP[v50].field4; if (v52 == -1) { - _vm->_globals.ZONEP[v50].destX = 0; - _vm->_globals.ZONEP[v50].destY = 0; + _vm->_globals.ZONEP[v50]._destX = 0; + _vm->_globals.ZONEP[v50]._destY = 0; _vm->_globals.ZONEP[v50].field4 = 0; } else { - SETANISPR(0, v52); + setSpriteIndex(0, v52); _vm->_globals.ACTION_SENS = _vm->_globals.ZONEP[v50].field4 - 59; } } @@ -2222,9 +2213,9 @@ LABEL_153: SETFLIPSPR(0, 0); if (_vm->_globals.g_old_sens == 6) SETFLIPSPR(0, 1); - SETXSPR(0, nouveau_x); - SETYSPR(0, nouveau_y); - SETANISPR(0, v1); + setSpriteX(0, nouveau_x); + setSpriteY(0, nouveau_y); + setSpriteIndex(0, v1); } else { if (_vm->_globals.g_old_sens == 7) SETFLIPSPR(0, 1); @@ -2284,13 +2275,13 @@ void ObjectsManager::GOHOME2() { goto LABEL_19; } if (_vm->_globals.last_sens == 1) - SETANISPR(0, 0); + setSpriteIndex(0, 0); if (_vm->_globals.last_sens == 3) - SETANISPR(0, 1); + setSpriteIndex(0, 1); if (_vm->_globals.last_sens == 5) - SETANISPR(0, 2); + setSpriteIndex(0, 2); if (_vm->_globals.last_sens == 7) - SETANISPR(0, 3); + setSpriteIndex(0, 3); _vm->_globals.chemin = (int16 *)g_PTRNUL; my_anim = 0; @@ -2299,16 +2290,16 @@ void ObjectsManager::GOHOME2() { } else { LABEL_19: _vm->_globals.last_sens = nouveau_sens; - SETXSPR(0, nouveau_x); - SETYSPR(0, nouveau_y); + setSpriteX(0, nouveau_x); + setSpriteY(0, nouveau_y); if (_vm->_globals.last_sens == 1) - SETANISPR(0, 4); + setSpriteIndex(0, 4); if (_vm->_globals.last_sens == 3) - SETANISPR(0, 5); + setSpriteIndex(0, 5); if (_vm->_globals.last_sens == 5) - SETANISPR(0, 6); + setSpriteIndex(0, 6); if (_vm->_globals.last_sens == 7) - SETANISPR(0, 7); + setSpriteIndex(0, 7); if (my_anim++ > 1) my_anim = 0; @@ -2374,8 +2365,8 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { v1 = 1; do { v2 = v1; - _vm->_globals.ZONEP[v2].destX = 0; - _vm->_globals.ZONEP[v2].destY = 0; + _vm->_globals.ZONEP[v2]._destX = 0; + _vm->_globals.ZONEP[v2]._destY = 0; _vm->_globals.ZONEP[v2].field4 = 0; _vm->_globals.ZONEP[v2].field6 = 0; _vm->_globals.ZONEP[v2].field7 = 0; @@ -2424,8 +2415,8 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { v7 = 1; do { v8 = v7; - _vm->_globals.ZONEP[v8].destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - _vm->_globals.ZONEP[v8].destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); + _vm->_globals.ZONEP[v8]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + _vm->_globals.ZONEP[v8]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); _vm->_globals.ZONEP[v8].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); v4 += 3; ++v7; @@ -2583,9 +2574,9 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager.setMouseXY(_vm->_globals.PLANX, _vm->_globals.PLANY); my_anim = 0; _vm->_eventsManager.mouseOn(); - v3 = XSPR(0); + v3 = getSpriteX(0); _vm->_graphicsManager.SCROLL_ECRAN(v3 - 320); - _vm->_graphicsManager.ofscroll = XSPR(0) - 320; + _vm->_graphicsManager.ofscroll = getSpriteX(0) - 320; SPRITE_ON(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -2643,8 +2634,8 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.iRegul = 0; _vm->_graphicsManager.NOFADE = false; - _vm->_globals.PLANX = XSPR(0); - _vm->_globals.PLANY = YSPR(0); + _vm->_globals.PLANX = getSpriteX(0); + _vm->_globals.PLANY = getSpriteY(0); _vm->_globals.PLANI = 1; SPRITE_OFF(0); _vm->_globals.AFFLI = false; @@ -2695,14 +2686,14 @@ void ObjectsManager::BTGAUCHE() { && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); + changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); + changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { @@ -2710,14 +2701,14 @@ void ObjectsManager::BTGAUCHE() { && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); + changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } if (_vm->_globals.SAUVEGARDE->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 567) <= 0x1Au && (uint16)(destY - 26) <= 0x21u) { - CHANGE_TETE(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); + changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); return; } } @@ -2752,9 +2743,9 @@ LABEL_38: return; if ((uint16)(NUMZONE + 1) > 1u) { zoneCount = NUMZONE; - zoneX = _vm->_globals.ZONEP[zoneCount].destX; + zoneX = _vm->_globals.ZONEP[zoneCount]._destX; if (zoneX) { - zoneY = _vm->_globals.ZONEP[zoneCount].destY; + zoneY = _vm->_globals.ZONEP[zoneCount]._destY; if (zoneY) { if (zoneY != 31) { destX = zoneX; @@ -2767,16 +2758,16 @@ LABEL_38: v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { - if (YSPR(0) <= 374 || YSPR(0) > 410) { - v10 = XSPR(0); - v11 = YSPR(0); - v12 = XSPR(0); + if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { + v10 = getSpriteX(0); + v11 = getSpriteY(0); + v12 = getSpriteX(0); v13 = _vm->_linesManager.PARCOURS2(v12, v11, v10, 390); _vm->_globals.chemin = v13; if (v13 != (int16 *)g_PTRNUL) PACOURS_PROPRE(v13); - g_old_x = XSPR(0); - g_old_y = YSPR(0); + g_old_x = getSpriteX(0); + g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) { LABEL_64: @@ -2786,7 +2777,7 @@ LABEL_64: goto LABEL_63; } _vm->_globals.chemin = (int16 *)g_PTRNUL; - SETANISPR(0, _vm->_globals.g_old_sens2 + 59); + setSpriteIndex(0, _vm->_globals.g_old_sens2 + 59); _vm->_globals.ACTION_SENS = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); @@ -2797,14 +2788,14 @@ LABEL_64: } if (!_vm->_globals.NOMARCHE) { if (!_vm->_globals.PLAN_FLAG) { - srcY = YSPR(0); - srcX = XSPR(0); + srcY = getSpriteY(0); + srcX = getSpriteX(0); v16 = _vm->_linesManager.PARCOURS2(srcX, srcY, destX, destY); _vm->_globals.chemin = v16; if (v16 != (int16 *)g_PTRNUL) PACOURS_PROPRE(v16); - g_old_x = XSPR(0); - g_old_y = YSPR(0); + g_old_x = getSpriteX(0); + g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) goto LABEL_64; @@ -2813,8 +2804,8 @@ LABEL_63: } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == true) { - v17 = YSPR(0); - v18 = XSPR(0); + v17 = getSpriteY(0); + v18 = getSpriteX(0); _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); } } @@ -2840,8 +2831,8 @@ LABEL_65: && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move _vm->_globals.chemin = (int16 *)g_PTRNUL; - XSPR(0); - YSPR(0); + getSpriteX(0); + getSpriteY(0); } } @@ -2860,15 +2851,15 @@ void ObjectsManager::PARADISE() { if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.no_scroll = 2; - if (_vm->_eventsManager._startPos.x >= XSPR(0) - 320) + if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) goto LABEL_64; - v3 = _vm->_eventsManager._startPos.x + 320 - XSPR(0); + v3 = _vm->_eventsManager._startPos.x + 320 - getSpriteX(0); if (v3 < 0) v3 = -v3; if (v3 <= 160) { LABEL_64: - if (_vm->_eventsManager._startPos.x > XSPR(0) - 320) { - v5 = _vm->_eventsManager._startPos.x + 320 - XSPR(0); + if (_vm->_eventsManager._startPos.x > getSpriteX(0) - 320) { + v5 = _vm->_eventsManager._startPos.x + 320 - getSpriteX(0); if (v5 < 0) v5 = -v5; if (v5 > 160) { @@ -2887,7 +2878,7 @@ LABEL_64: _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x - 4, _vm->_eventsManager.getMouseY()); _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager._startPos.x > XSPR(0) - 320); + } while (v1 != 1 && _vm->_eventsManager._startPos.x > getSpriteX(0) - 320); } } } else { @@ -2905,7 +2896,7 @@ LABEL_64: _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x + 4, _vm->_eventsManager.getMouseY()); _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager._startPos.x < XSPR(0) - 320); + } while (v1 != 1 && _vm->_eventsManager._startPos.x < getSpriteX(0) - 320); } if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) _vm->_eventsManager.setMouseXY(_vm->_graphicsManager.SCROLL + 610, 0); @@ -3012,8 +3003,10 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } -// Change Face/Head -void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { +/** + * Change character Face / Head + */ +void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { CharacterLocation *loc; CH_TETE = 1; @@ -3023,11 +3016,11 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.chemin = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS - && _vm->_globals.SAUVEGARDE->realHopkins._location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->_realHopkins._location == _vm->_globals.ECRAN) { CH_TETE = 0; - loc = &_vm->_globals.SAUVEGARDE->samantha; - loc->_pos.x = XSPR(0); - loc->_pos.y = YSPR(0); + loc = &_vm->_globals.SAUVEGARDE->_samantha; + loc->_pos.x = getSpriteX(0); + loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; loc->field4 = _sprite[0].field0; @@ -3042,7 +3035,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField357] = 1; T_RECTIF = 0; - loc = &_vm->_globals.SAUVEGARDE->realHopkins; + loc = &_vm->_globals.SAUVEGARDE->_realHopkins; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; @@ -3050,11 +3043,11 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA - && _vm->_globals.SAUVEGARDE->samantha._location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->_samantha._location == _vm->_globals.ECRAN) { CH_TETE = 0; - loc = &_vm->_globals.SAUVEGARDE->realHopkins; - loc->_pos.x = XSPR(0); - loc->_pos.y = YSPR(0); + loc = &_vm->_globals.SAUVEGARDE->_realHopkins; + loc->_pos.x = getSpriteX(0); + loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; loc->field4 = _sprite[0].fieldC; @@ -3068,7 +3061,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - loc = &_vm->_globals.SAUVEGARDE->samantha; + loc = &_vm->_globals.SAUVEGARDE->_samantha; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 2; @@ -3078,25 +3071,25 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n } else { switch (oldCharacter) { case CHARACTER_HOPKINS: - loc = &_vm->_globals.SAUVEGARDE->realHopkins; - loc->_pos.x = XSPR(0); - loc->_pos.y = YSPR(0); + loc = &_vm->_globals.SAUVEGARDE->_realHopkins; + loc->_pos.x = getSpriteX(0); + loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; loc->field4 = _sprite[0].fieldC; break; case CHARACTER_HOPKINS_CLONE: - loc = &_vm->_globals.SAUVEGARDE->cloneHopkins; - loc->_pos.x = XSPR(0); - loc->_pos.y = YSPR(0); + loc = &_vm->_globals.SAUVEGARDE->_cloneHopkins; + loc->_pos.x = getSpriteX(0); + loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; loc->field4 = _sprite[0].fieldC; break; case CHARACTER_SAMANTHA: - loc = &_vm->_globals.SAUVEGARDE->samantha; - loc->_pos.x = XSPR(0); - loc->_pos.y = YSPR(0); + loc = &_vm->_globals.SAUVEGARDE->_samantha; + loc->_pos.x = getSpriteX(0); + loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; loc->field4 = _sprite[0].fieldC; @@ -3111,21 +3104,21 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->realHopkins._location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->_realHopkins._location; break; case CHARACTER_HOPKINS_CLONE: _vm->_globals.SAUVEGARDE->data[svField121] = 1; _vm->_globals.SAUVEGARDE->data[svField354] = 1; _vm->_globals.SAUVEGARDE->data[svField356] = 0; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->cloneHopkins._location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->_cloneHopkins._location; break; case CHARACTER_SAMANTHA: _vm->_globals.SAUVEGARDE->data[svField121] = 0; _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->samantha._location; + _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->_samantha._location; break; } } @@ -3133,7 +3126,7 @@ void ObjectsManager::CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter n // Check Size void ObjectsManager::VERIFTAILLE() { - int v0 = _vm->_globals.STAILLE[YSPR(0)]; + int v0 = _vm->_globals.STAILLE[getSpriteY(0)]; if (_vm->_globals.PERSO_TYPE == 1) { int v1 = v0; if (v0 < 0) @@ -3844,23 +3837,23 @@ int ObjectsManager::MZONE() { v3 = v2; v15 = v3; if (_vm->_globals.Bob[v3].field0) { - if (_vm->_globals.Bob[v3].frameIndex != 250) { + if (_vm->_globals.Bob[v3]._frameIndex != 250) { if (!_vm->_globals.Bob[v3].field16) { - v4 = _vm->_globals.Bob[v3].oldX; + v4 = _vm->_globals.Bob[v3]._oldX; if (xp > v4) { - if (xp < _vm->_globals.Bob[v3].oldWidth + v4) { - v5 = _vm->_globals.Bob[v3].oldY; + if (xp < _vm->_globals.Bob[v3]._oldWidth + v4) { + v5 = _vm->_globals.Bob[v3]._oldY; if (yp > v5) { - if (yp < _vm->_globals.Bob[v3].oldHeight + v5) { + if (yp < _vm->_globals.Bob[v3]._oldHeight + v5) { v6 = v1; if (_vm->_globals.ZONEP[v1].field4 == -1) { - _vm->_globals.ZONEP[v6].destX = 0; - _vm->_globals.ZONEP[v1].destY = 0; + _vm->_globals.ZONEP[v6]._destX = 0; + _vm->_globals.ZONEP[v1]._destY = 0; } - if (!_vm->_globals.ZONEP[v6].destX) { - if (!_vm->_globals.ZONEP[v1].destY) { - _vm->_globals.ZONEP[v6].destX = _vm->_globals.Bob[v15].oldWidth + _vm->_globals.Bob[v15].oldX; - _vm->_globals.ZONEP[v1].destY = _vm->_globals.Bob[v15].oldHeight + _vm->_globals.Bob[v15].oldY + 6; + if (!_vm->_globals.ZONEP[v6]._destX) { + if (!_vm->_globals.ZONEP[v1]._destY) { + _vm->_globals.ZONEP[v6]._destX = _vm->_globals.Bob[v15]._oldWidth + _vm->_globals.Bob[v15]._oldX; + _vm->_globals.ZONEP[v1]._destY = _vm->_globals.Bob[v15]._oldHeight + _vm->_globals.Bob[v15]._oldY + 6; _vm->_globals.ZONEP[v1].field4 = -1; } } @@ -4171,7 +4164,7 @@ void ObjectsManager::SPECIAL_JEU() { TEST_FORET(41, 6, 84, 100, 440, 3); } if (_vm->_globals.ECRAN == 5) { - if (YSPR(0) <= 399) { + if (getSpriteY(0) <= 399) { if (!_vm->_globals.SAUVEGARDE->data[svField173]) { _vm->_globals.SAUVEGARDE->data[svField173] = 1; _vm->_globals.NOPARLE = true; @@ -4223,10 +4216,10 @@ void ObjectsManager::SPECIAL_JEU() { } } if (_vm->_globals.ECRAN == 20) - _vm->_globals.SAUVEGARDE->data[svField132] = XSPR(0) > 65 - && XSPR(0) <= 124 - && YSPR(0) > 372 - && YSPR(0) <= 398; + _vm->_globals.SAUVEGARDE->data[svField132] = getSpriteX(0) > 65 + && getSpriteX(0) <= 124 + && getSpriteY(0) > 372 + && getSpriteY(0) <= 398; if (_vm->_globals.ECRAN == 57) { _vm->_globals._disableInventFl = true; if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { @@ -4285,27 +4278,27 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { if (_vm->_globals.VBob[idx].field4 <= 1) { _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx].xp = xp; - _vm->_globals.VBob[idx].yp = yp; - _vm->_globals.VBob[idx].frameIndex = frameIndex; - _vm->_globals.VBob[idx].oldX = xp; - _vm->_globals.VBob[idx].oldY = yp; - _vm->_globals.VBob[idx].oldFrameIndex = frameIndex; + _vm->_globals.VBob[idx]._xp = xp; + _vm->_globals.VBob[idx]._yp = yp; + _vm->_globals.VBob[idx]._frameIndex = frameIndex; + _vm->_globals.VBob[idx]._oldX = xp; + _vm->_globals.VBob[idx]._oldY = yp; + _vm->_globals.VBob[idx]._oldFrameIndex = frameIndex; _vm->_globals.VBob[idx].spriteData = src; - _vm->_globals.VBob[idx].oldSpriteData = src; - _vm->_globals.VBob[idx].surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx].surface); + _vm->_globals.VBob[idx]._oldSpriteData = src; + _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); } int f4 = _vm->_globals.VBob[idx].field4; if (f4 == 2 || f4 == 4) { _vm->_globals.VBob[idx].field4 = 3; - _vm->_globals.VBob[idx].oldX = _vm->_globals.VBob[idx].xp; - _vm->_globals.VBob[idx].oldY = _vm->_globals.VBob[idx].yp; - _vm->_globals.VBob[idx].oldSpriteData = _vm->_globals.VBob[idx].spriteData; - _vm->_globals.VBob[idx].oldFrameIndex = _vm->_globals.VBob[idx].frameIndex; - _vm->_globals.VBob[idx].xp = xp; - _vm->_globals.VBob[idx].yp = yp; - _vm->_globals.VBob[idx].frameIndex = frameIndex; + _vm->_globals.VBob[idx]._oldX = _vm->_globals.VBob[idx]._xp; + _vm->_globals.VBob[idx]._oldY = _vm->_globals.VBob[idx]._yp; + _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx].spriteData; + _vm->_globals.VBob[idx]._oldFrameIndex = _vm->_globals.VBob[idx]._frameIndex; + _vm->_globals.VBob[idx]._xp = xp; + _vm->_globals.VBob[idx]._yp = yp; + _vm->_globals.VBob[idx]._frameIndex = frameIndex; _vm->_globals.VBob[idx].spriteData = src; } } @@ -4519,8 +4512,8 @@ void ObjectsManager::OPTI_ONE(int idx, int a2, int a3, int a4) { if (!a4) BOBANIM_OFF(idx); if (a4 == 4) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.Bob[idx].spriteData, - _vm->_globals.Bob[idx].oldX, _vm->_globals.Bob[idx].oldY, _vm->_globals.Bob[idx].frameIndex); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.Bob[idx]._spriteData, + _vm->_globals.Bob[idx]._oldX, _vm->_globals.Bob[idx]._oldY, _vm->_globals.Bob[idx]._frameIndex); BOBANIM_OFF(idx); _vm->_eventsManager.VBL(); } @@ -4542,7 +4535,7 @@ void ObjectsManager::BOBANIM_ON(int idx) { if (_vm->_globals.Bob[idx].field16) { _vm->_globals.Bob[idx].field16 = 0; _vm->_globals.Bob[idx].field10 = 5; - _vm->_globals.Bob[idx].frameIndex = 250; + _vm->_globals.Bob[idx]._frameIndex = 250; _vm->_globals.Bob[idx].field12 = 0; _vm->_globals.Bob[idx].field14 = 0; } @@ -4560,15 +4553,15 @@ void ObjectsManager::SET_BOBPOSI(int idx, int a2) { } int ObjectsManager::BOBX(int idx) { - return _vm->_globals.Bob[idx].xp; + return _vm->_globals.Bob[idx]._xp; } int ObjectsManager::BOBY(int idx) { - return _vm->_globals.Bob[idx].yp; + return _vm->_globals.Bob[idx]._yp; } int ObjectsManager::BOBA(int idx) { - return _vm->_globals.Bob[idx].frameIndex; + return _vm->_globals.Bob[idx]._frameIndex; } void ObjectsManager::INILINK(const Common::String &file) { @@ -4730,8 +4723,8 @@ void ObjectsManager::INILINK(const Common::String &file) { v18 = 1; do { v19 = v18; - _vm->_globals.ZONEP[v19].destX = 0; - _vm->_globals.ZONEP[v19].destY = 0; + _vm->_globals.ZONEP[v19]._destX = 0; + _vm->_globals.ZONEP[v19]._destY = 0; _vm->_globals.ZONEP[v19].field4 = 0; _vm->_globals.ZONEP[v19].field6 = 0; _vm->_globals.ZONEP[v19].field7 = 0; @@ -4767,8 +4760,8 @@ void ObjectsManager::INILINK(const Common::String &file) { v20 = 1; do { v21 = v20; - _vm->_globals.ZONEP[v21].destX = (int16)READ_LE_UINT16(v17 + 2 * v33); - _vm->_globals.ZONEP[v21].destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); + _vm->_globals.ZONEP[v21]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); + _vm->_globals.ZONEP[v21]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; ++v20; @@ -5433,10 +5426,10 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) BOB_OFF(3); BOB_OFF(4); } - } else if (a2 < XSPR(0) - && a3 > XSPR(0) - && a4 < YSPR(0) - && a5 > YSPR(0)) { + } else if (a2 < getSpriteX(0) + && a3 > getSpriteX(0) + && a4 < getSpriteY(0) + && a5 > getSpriteY(0)) { if (a6 == 1) BOBANIM_ON(1); if (a6 == 2) @@ -5514,19 +5507,19 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); BOBANIM_OFF(3); _vm->_globals.NOT_VERIF = 1; - g_old_x = XSPR(0); + g_old_x = getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v7 = YSPR(0); - v8 = XSPR(0); + v7 = getSpriteY(0); + v8 = getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); _vm->_globals.NOT_VERIF = 1; do { GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - SETANISPR(0, 64); + setSpriteIndex(0, 64); } do { v9 = _vm->_eventsManager.getMouseButton(); @@ -5629,7 +5622,7 @@ LABEL_70: SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 20, 127); _vm->_eventsManager.setMouseXY(PERX, PERY); if (_vm->_graphicsManager.DOUBLE_ECRAN) - _vm->_graphicsManager.SCROLL = (int16)XSPR(0) - 320; + _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; VERIFTAILLE(); SPRITE_ON(0); _vm->_globals.CACHE_ON(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index db2fd9e912..c4cf6f4830 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -28,6 +28,7 @@ #include "common/str.h" #include "hopkins/globals.h" +#define MAX_SPRITE 5 namespace Hopkins { struct SpriteItem { @@ -44,7 +45,7 @@ struct SpriteItem { int field22; int field24; int field26; - int field28; + bool field28; int field2A; int field2C; int field2E; @@ -128,7 +129,7 @@ public: int getWidth(const byte *objectData, int idx); int getHeight(const byte *objectData, int idx); int sprite_alone(const byte *objectData, byte *sprite, int objIndex); - byte *DEL_FICHIER_OBJ(); + void DEL_FICHIER_OBJ(); byte *loadSprite(const Common::String &file); void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); @@ -158,8 +159,8 @@ public: void AFF_BOB_ANIM(); void AFF_VBOB(); - int XSPR(int idx); - int YSPR(int idx); + int getSpriteX(int idx); + int getSpriteY(int idx); void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8); void CLEAR_SPR(); @@ -172,9 +173,9 @@ public: int SYSPR(int idx); int POSISPR(int idx); void SETPOSISPR(int idx, int a2); - void SETXSPR(int idx, int xp); - void SETANISPR(int idx, int spriteIndex); - void SETYSPR(int idx, int yp); + void setSpriteX(int idx, int xp); + void setSpriteIndex(int idx, int spriteIndex); + void setSpriteY(int idx, int yp); void SETTAILLESPR(int idx, int a2); void SETFLIPSPR(int idx, int a2); @@ -194,7 +195,7 @@ public: * @param oldCharacter Previously played character * @param newCharacter New character to play */ - void CHANGE_TETE(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); + void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 18cb26e002..75c69cc87f 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -144,7 +144,7 @@ Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { // Set up the inventory for (int i = 0; i < 35; ++i) - _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals._inventory[i]; + _vm->_globals.SAUVEGARDE->_inventory[i] = _vm->_globals._inventory[i]; /* Create the savegame */ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( @@ -196,7 +196,7 @@ Common::Error SaveLoadManager::restore(int slot) { // Unpack the inventory for (int i = 0; i < 35; ++i) - _vm->_globals._inventory[i] = _vm->_globals.SAUVEGARDE->inventory[i]; + _vm->_globals._inventory[i] = _vm->_globals.SAUVEGARDE->_inventory[i]; // Set variables from loaded data as necessary _vm->_globals.SAUVEGARDE->data[svField10] = slot; @@ -254,12 +254,12 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { void SaveLoadManager::syncSavegameData(Common::Serializer &s) { s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 0x802); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->cloneHopkins); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->realHopkins); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->samantha); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_cloneHopkins); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_realHopkins); + syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_samantha); for (int i = 0; i < 35; ++i) - s.syncAsSint16LE(_vm->_globals.SAUVEGARDE->inventory[i]); + s.syncAsSint16LE(_vm->_globals.SAUVEGARDE->_inventory[i]); } void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLocation &item) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 072a63cf28..52140d5c5f 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -213,36 +213,36 @@ LABEL_1141: _vm->_objectsManager.PERI = v5; if (_vm->_objectsManager.CH_TETE == 1) { if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 - && _vm->_globals.SAUVEGARDE->cloneHopkins._pos.x && _vm->_globals.SAUVEGARDE->cloneHopkins._pos.y - && _vm->_globals.SAUVEGARDE->cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->cloneHopkins._location) { + && _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.x && _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.y + && _vm->_globals.SAUVEGARDE->_cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->_cloneHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->cloneHopkins._pos.x; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->cloneHopkins._pos.y; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->cloneHopkins.field2; + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.x; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.y; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->_cloneHopkins.field2; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->samantha._pos.x && _vm->_globals.SAUVEGARDE->samantha._pos.y - && _vm->_globals.SAUVEGARDE->samantha.field2 && _vm->_globals.SAUVEGARDE->samantha._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->samantha._pos.x; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->samantha._pos.y; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->samantha.field2; + && _vm->_globals.SAUVEGARDE->_samantha._pos.x && _vm->_globals.SAUVEGARDE->_samantha._pos.y + && _vm->_globals.SAUVEGARDE->_samantha.field2 && _vm->_globals.SAUVEGARDE->_samantha._location) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->_samantha._pos.x; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->_samantha._pos.y; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->_samantha.field2; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->realHopkins._pos.x && _vm->_globals.SAUVEGARDE->realHopkins._pos.y - && _vm->_globals.SAUVEGARDE->realHopkins.field2 && _vm->_globals.SAUVEGARDE->realHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->realHopkins._pos.x; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->realHopkins._pos.y; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->realHopkins.field2; + && _vm->_globals.SAUVEGARDE->_realHopkins._pos.x && _vm->_globals.SAUVEGARDE->_realHopkins._pos.y + && _vm->_globals.SAUVEGARDE->_realHopkins.field2 && _vm->_globals.SAUVEGARDE->_realHopkins._location) { + _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->_realHopkins._pos.x; + _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->_realHopkins._pos.y; + _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->_realHopkins.field2; } } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->realHopkins._location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->_realHopkins._location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->realHopkins._pos, + _vm->_globals.SAUVEGARDE->_realHopkins._pos, 1, 2, - _vm->_globals.SAUVEGARDE->realHopkins.field4, + _vm->_globals.SAUVEGARDE->_realHopkins.field4, 0, 34, 190); @@ -251,13 +251,13 @@ LABEL_1141: } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 && _vm->_globals.SAUVEGARDE->data[svField355] == 1 - && _vm->_globals.SAUVEGARDE->samantha._location == _vm->_globals.ECRAN) { + && _vm->_globals.SAUVEGARDE->_samantha._location == _vm->_globals.ECRAN) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->samantha._pos, + _vm->_globals.SAUVEGARDE->_samantha._pos, 1, 3, - _vm->_globals.SAUVEGARDE->samantha.field4, + _vm->_globals.SAUVEGARDE->_samantha.field4, 0, 20, 127); @@ -827,8 +827,8 @@ LABEL_1141: if (v76 == 46) { _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v13 = _vm->_objectsManager.YSPR(0); - int v14 = _vm->_objectsManager.XSPR(0); + int v13 = _vm->_objectsManager.getSpriteY(0); + int v14 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); _vm->_objectsManager.NUMZONE = -1; do { @@ -900,12 +900,12 @@ LABEL_1141: } if (v76 == 59) { _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v16 = _vm->_objectsManager.YSPR(0); - int v17 = _vm->_objectsManager.XSPR(0); + int v16 = _vm->_objectsManager.getSpriteY(0); + int v17 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); _vm->_globals.NOT_VERIF = 1; do { @@ -941,7 +941,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); - _vm->_objectsManager.SETANISPR(0, 62); + _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.BOBANIM_ON(6); _vm->_objectsManager.BOBANIM_OFF(7); @@ -1032,12 +1032,12 @@ LABEL_1141: } if (v76 == 81) { _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v22 = _vm->_objectsManager.YSPR(0); - int v23 = _vm->_objectsManager.XSPR(0); + int v22 = _vm->_objectsManager.getSpriteY(0); + int v23 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); _vm->_globals.NOT_VERIF = 1; do { @@ -1278,23 +1278,23 @@ LABEL_1141: _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); if (v76 == 105) { _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - int v27 = _vm->_objectsManager.YSPR(0); - int v28 = _vm->_objectsManager.XSPR(0); + int v27 = _vm->_objectsManager.getSpriteY(0); + int v28 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - int v29 = _vm->_objectsManager.YSPR(0); - int v30 = _vm->_objectsManager.XSPR(0); + int v29 = _vm->_objectsManager.getSpriteY(0); + int v30 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); } if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - int v31 = _vm->_objectsManager.YSPR(0); - int v32 = _vm->_objectsManager.XSPR(0); + int v31 = _vm->_objectsManager.getSpriteY(0); + int v32 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); } _vm->_globals.NOT_VERIF = 1; @@ -1306,7 +1306,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.SPRITE_OFF(0); - _vm->_objectsManager.SETANISPR(0, 60); + _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { _vm->_objectsManager.BOBANIM_ON(4); @@ -1529,8 +1529,8 @@ LABEL_1141: } _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v37 = _vm->_objectsManager.YSPR(0); - int v38 = _vm->_objectsManager.XSPR(0); + int v37 = _vm->_objectsManager.getSpriteY(0); + int v38 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = 0; @@ -1541,14 +1541,14 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SETANISPR(0, 64); + _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; _vm->_globals._disableInventFl = false; } if (v76 == 209) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(2, 0); - _vm->_objectsManager.SETANISPR(0, 60); + _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_objectsManager.BOBANIM_OFF(4); _vm->_objectsManager.BOBANIM_ON(1); do { @@ -1561,8 +1561,8 @@ LABEL_1141: _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - int v39 = _vm->_objectsManager.YSPR(0); - int v40 = _vm->_objectsManager.XSPR(0); + int v39 = _vm->_objectsManager.getSpriteY(0); + int v40 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); _vm->_objectsManager.NUMZONE = 0; _vm->_globals.NOT_VERIF = 1; @@ -1573,7 +1573,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SETANISPR(0, 64); + _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.BOBANIM_ON(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); do { @@ -1653,7 +1653,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 175) { - _vm->_objectsManager.SETANISPR(0, 55); + _vm->_objectsManager.setSpriteIndex(0, 55); _vm->_objectsManager.SPRITE_OFF(0); _vm->_objectsManager.BOBANIM_ON(9); _vm->_objectsManager.BOBANIM_ON(10); @@ -1710,13 +1710,13 @@ LABEL_1141: _vm->_objectsManager.OBSSEUL = 0; _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - int v43 = _vm->_objectsManager.YSPR(0); - int v44 = _vm->_objectsManager.XSPR(0); + int v43 = _vm->_objectsManager.getSpriteY(0); + int v44 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); _vm->_globals.NOT_VERIF = 1; do { @@ -1740,8 +1740,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(7) != 15); _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.SETXSPR(0, 476); - _vm->_objectsManager.SETYSPR(0, 278); + _vm->_objectsManager.setSpriteX(0, 476); + _vm->_objectsManager.setSpriteY(0, 278); _vm->_objectsManager.SPRITE_ON(0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); _vm->_objectsManager.OBSSEUL = 1; @@ -1938,9 +1938,9 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - CharacterLocation *v51 = &_vm->_globals.SAUVEGARDE->realHopkins; - v51->_pos.x = _vm->_objectsManager.XSPR(0); - v51->_pos.y = _vm->_objectsManager.YSPR(0); + CharacterLocation *v51 = &_vm->_globals.SAUVEGARDE->_realHopkins; + v51->_pos.x = _vm->_objectsManager.getSpriteX(0); + v51->_pos.y = _vm->_objectsManager.getSpriteY(0); v51->field2 = 57; v51->_location = 97; _vm->_globals.SAUVEGARDE->data[svField121] = 1; @@ -2166,7 +2166,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; - CharacterLocation *v53 = &_vm->_globals.SAUVEGARDE->samantha; + CharacterLocation *v53 = &_vm->_globals.SAUVEGARDE->_samantha; v53->_pos.x = 404; v53->_pos.y = 395; v53->field2 = 64; @@ -2189,7 +2189,7 @@ LABEL_1141: if (v76 == 245) { _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); - _vm->_globals.ZONEP[4].destX = 276; + _vm->_globals.ZONEP[4]._destX = 276; _vm->_objectsManager.VERBE_ON(4, 19); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals.SAUVEGARDE->data[svField399] = 1; @@ -2222,13 +2222,13 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("gred1.pe2"); _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - int v55 = _vm->_objectsManager.YSPR(0); - int v56 = _vm->_objectsManager.XSPR(0); + int v55 = _vm->_objectsManager.getSpriteY(0); + int v56 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; @@ -2246,13 +2246,13 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.XSPR(0); + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - int v57 = _vm->_objectsManager.YSPR(0); - int v58 = _vm->_objectsManager.XSPR(0); + int v57 = _vm->_objectsManager.getSpriteY(0); + int v58 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.NUMZONE = -1; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 292afafc98..0a89e9db31 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -739,18 +739,18 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_objectsManager._priorityFl = true; if (!_vm->_globals.Bob[idx].field0) { _vm->_objectsManager.BOB_ZERO(idx); - v5 = _vm->_globals.Bqe_Anim[idx].data; + v5 = _vm->_globals.Bqe_Anim[idx]._data; v4 = (int16)READ_LE_UINT16(v5 + 2); if (!v4) v4 = 1; if ((int16)READ_LE_UINT16(v5 + 24)) { - _vm->_globals.Bob[idx].isSprite = true; + _vm->_globals.Bob[idx]._isSpriteFl = true; _vm->_globals.Bob[idx].field36 = 0; _vm->_globals.Bob[idx].field38 = 0; - _vm->_globals.Bob[idx].animData = _vm->_globals.Bqe_Anim[idx].data; + _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals.Bob[idx].field0 = 10; v5 = PERSOSPR; - _vm->_globals.Bob[idx].spriteData = PERSOSPR; + _vm->_globals.Bob[idx]._spriteData = PERSOSPR; _vm->_globals.Bob[idx].field1E = v4; _vm->_globals.Bob[idx].field20 = -1; _vm->_globals.Bob[idx].field22 = 0; @@ -853,7 +853,7 @@ void TalkManager::ANIM_PERSO_INIT() { void TalkManager::clearCharacterAnim() { for (int idx = 21; idx <= 34; ++idx) { - _vm->_globals.Bqe_Anim[idx].data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx].data); + _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx]._data); _vm->_globals.Bqe_Anim[idx].field4 = 0; } } @@ -899,16 +899,16 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int if (v18 > a4) { _vm->_globals.Bqe_Anim[a1].field4 = 0; result = g_PTRNUL; - _vm->_globals.Bqe_Anim[v20].data = g_PTRNUL; + _vm->_globals.Bqe_Anim[v20]._data = g_PTRNUL; } ++v18; ++v6; ++v5; } while (v7 != 1); - _vm->_globals.Bqe_Anim[v20].data = _vm->_globals.allocMemory(v6 + 50); + _vm->_globals.Bqe_Anim[v20]._data = _vm->_globals.allocMemory(v6 + 50); _vm->_globals.Bqe_Anim[a1].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[v20].data, (const byte *)(v22 + bufPerso + 5), 20); - v8 = _vm->_globals.Bqe_Anim[v20].data; + memcpy(_vm->_globals.Bqe_Anim[v20]._data, (const byte *)(v22 + bufPerso + 5), 20); + v8 = _vm->_globals.Bqe_Anim[v20]._data; v9 = v8 + 20; v24 = v22 + bufPerso + 25; @@ -1076,7 +1076,7 @@ void TalkManager::REPONSE2(int a1, int a2) { if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { if ((uint16)(a1 - 22) <= 1u) { _vm->_objectsManager.SETFLIPSPR(0, 0); - _vm->_objectsManager.SETANISPR(0, 62); + _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); if (a1 == 22) { v4 = _vm->_objectsManager.BOBX(3); @@ -1124,7 +1124,7 @@ void TalkManager::REPONSE2(int a1, int a2) { } if ((uint16)(a1 - 20) <= 1u) { _vm->_objectsManager.SETFLIPSPR(0, 1); - _vm->_objectsManager.SETANISPR(0, 62); + _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); if (a1 == 20) { v8 = _vm->_objectsManager.BOBX(1); -- cgit v1.2.3 From 1182885d127774895246e52d0fef435ff71a8441 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 17 Dec 2012 08:01:29 +0100 Subject: HOPKINS: Some renaming, rework some loop statements --- engines/hopkins/computer.cpp | 8 ++-- engines/hopkins/dialogs.cpp | 8 ++-- engines/hopkins/events.cpp | 6 +-- engines/hopkins/globals.cpp | 8 ++-- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 60 ++++++++++++------------ engines/hopkins/objects.cpp | 44 +++++++++--------- engines/hopkins/script.cpp | 8 ++-- engines/hopkins/talk.cpp | 107 +++++++++++++++++-------------------------- engines/hopkins/talk.h | 4 +- 10 files changed, 117 insertions(+), 140 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 165f4c3b3b..6616ebbb59 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -579,7 +579,7 @@ void ComputerManager::readText(int idx) { ++v7; } ++v10; - } while (v4 != 37); + } while (v4 != '%'); _vm->_eventsManager.waitKeyPress(); ptr = _vm->_globals.freeMemory(ptr); @@ -590,9 +590,9 @@ void ComputerManager::readText(int idx) { */ void ComputerManager::displayGamesSubMenu() { const byte *v1 = _vm->_objectsManager._sprite[0]._spriteData; - uint oldSpeed = _vm->_globals.vitesse; + uint oldSpeed = _vm->_globals._speed; - _vm->_globals.vitesse = 1; + _vm->_globals._speed = 1; _vm->_eventsManager.changeMouseCursor(0); _breakoutSpr = g_PTRNUL; _vm->_eventsManager._breakoutFl = true; @@ -625,7 +625,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); - _vm->_globals.vitesse = oldSpeed; + _vm->_globals._speed = oldSpeed; _vm->_eventsManager._breakoutFl = false; setVideoMode(); setTextColor(15); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 2c17d24e2e..9cb647b112 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -233,7 +233,7 @@ void DialogsManager::showOptionsDialog() { } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) - _vm->_globals.vitesse = 2; + _vm->_globals._speed = 2; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) _vm->_globals.SVGA = 2; if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 0xD3u) @@ -245,11 +245,11 @@ void DialogsManager::showOptionsDialog() { else if (_vm->_graphicsManager.MANU_SCROLL == 1) _vm->_globals.opt_scrtype = 1; - if (_vm->_globals.vitesse == 1) + if (_vm->_globals._speed == 1) _vm->_globals.opt_vitesse = 6; - else if (_vm->_globals.vitesse == 2) + else if (_vm->_globals._speed == 2) _vm->_globals.opt_vitesse = 5; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) _vm->_globals.opt_vitesse = 4; _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index ba43e182ee..311ab92686 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -400,7 +400,7 @@ LABEL_45: _vm->_eventsManager.updateCursor(); _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); LABEL_54: - _vm->_globals.vitesse = 2; + _vm->_globals._speed = 2; do { while (!_vm->shouldQuit()) { checkForNextFrameCounter(); @@ -413,7 +413,7 @@ LABEL_54: if (_rateCounter > 1) goto LABEL_65; } - if (_vm->_globals.vitesse != 2) + if (_vm->_globals._speed != 2) break; if (_rateCounter > 9) goto LABEL_65; @@ -422,7 +422,7 @@ LABEL_63: ; } while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && _rateCounter <= 15); LABEL_65: - _vm->_globals.vitesse = 2; + _vm->_globals._speed = 2; _rateCounter = 0; if (!_vm->_graphicsManager.DOUBLE_ECRAN || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 82da133636..6010ed7574 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -116,10 +116,10 @@ Globals::Globals() { // Initialise fields FR = 0; SVGA = 2; - internet = true; + _internetFl = true; PUBEXIT = false; - vitesse = 1; + _speed = 1; INSTALL_TYPE = 1; MUSICVOL = 6; SOUNDVOL = 6; @@ -317,9 +317,9 @@ void Globals::setConfig() { } if (_vm->getIsDemo()) - internet = true; + _internetFl = true; else - internet = false; + _internetFl = false; // End of CHECKME switch (FR) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 8aa49af756..937483f6bb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -336,10 +336,10 @@ public: TriItem Tri[51]; int FR; int SVGA; - bool internet; + bool _internetFl; bool PUBEXIT; int PERSO_TYPE; - uint vitesse; + uint _speed; int INSTALL_TYPE; Common::String HOPIMAGE; Common::String HOPANIM; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2780b68113..49e4996f4c 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -155,7 +155,7 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Init_Interrupt_();"); _globals.iRegul = 1; - _globals.vitesse = 1; + _globals._speed = 1; for (int i = 1; i < 50; i++) { _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 0, 0, 640, 440, _graphicsManager.VESA_BUFFER, 0, 0); @@ -168,10 +168,10 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO TEST = 0;"); // if (SPEEDJ > 475) if (_eventsManager._rateCounter > 475) - _globals.vitesse = 2; + _globals._speed = 2; // if (SPEEDJ > 700) if (_eventsManager._rateCounter > 700) - _globals.vitesse = 3; + _globals._speed = 3; warning("TODO Fin_Interrupt_();"); warning("TODO Init_Interrupt_();"); _graphicsManager.FADE_OUTW(); @@ -470,7 +470,7 @@ bool HopkinsEngine::runLinuxDemo() { _eventsManager.delay(1500); _graphicsManager.FADE_OUTW(); - if (!_globals.internet) { + if (!_globals._internetFl) { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("MP.ANM", 10, 16, 200); } @@ -2563,7 +2563,7 @@ bool HopkinsEngine::runLinuxFull() { _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); - _globals.vitesse = 2; + _globals._speed = 2; _globals.iRegul = 1; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("MP.ANM", 10, 16, 200); @@ -3606,7 +3606,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - for (uint i = 0; i < 200 / _globals.vitesse; ++i) + for (uint i = 0; i < 200 / _globals._speed; ++i) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); @@ -3691,24 +3691,24 @@ void HopkinsEngine::INTRORUN() { v9 += 2; if (v9 > 15) { _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); - for (uint j = 1; j < 100 / _globals.vitesse; ++j) + for (uint j = 1; j < 100 / _globals._speed; ++j) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(7, 3); _objectsManager.BOBANIM_OFF(3); - for (uint k = 1; k < 60 / _globals.vitesse; ++k) + for (uint k = 1; k < 60 / _globals._speed; ++k) _eventsManager.VBL(); _objectsManager.BOBANIM_ON(5); - for (uint l = 0; l < 20 / _globals.vitesse; ++l) + for (uint l = 0; l < 20 / _globals._speed; ++l) _eventsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); - for (uint m = 0; m < 50 / _globals.vitesse; ++m) { - if (m == 30 / _globals.vitesse) { + for (uint m = 0; m < 50 / _globals._speed; ++m) { + if (m == 30 / _globals._speed) { _objectsManager.BOBANIM_ON(3); _soundManager.VOICE_MIX(8, 3); _objectsManager.BOBANIM_OFF(3); @@ -4125,7 +4125,7 @@ void HopkinsEngine::JOUE_FIN() { if (!_eventsManager._escKeyFl) { do _eventsManager.refreshEvents(); - while (_eventsManager._rateCounter < 2000 / _globals.vitesse && !_eventsManager._escKeyFl); + while (_eventsManager._rateCounter < 2000 / _globals._speed && !_eventsManager._escKeyFl); } _eventsManager._escKeyFl = false; _graphicsManager.FADE_OUTW(); @@ -4539,11 +4539,11 @@ void HopkinsEngine::BTOCEAN() { _globals.SORTIE = 1; int oldX = _objectsManager.getSpriteX(0); for (;;) { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX -= 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX -= 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4571,11 +4571,11 @@ LABEL_22: _globals.SORTIE = 2; int oldX = _objectsManager.getSpriteX(0); for (;;) { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX += 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX += 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4596,11 +4596,11 @@ LABEL_41: if (_globals.OCEAN_SENS == 3) { int oldX = _objectsManager.getSpriteX(0); do { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX += 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX += 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4621,11 +4621,11 @@ LABEL_57: if (_globals.OCEAN_SENS == 7) { int oldX = _objectsManager.getSpriteX(0); do { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX -= 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX -= 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4652,11 +4652,11 @@ LABEL_72: if (_globals.OCEAN_SENS == 3) { int oldX = _objectsManager.getSpriteX(0); do { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX += 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX += 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); @@ -4677,11 +4677,11 @@ LABEL_91: if (_globals.OCEAN_SENS == 7) { int oldX = _objectsManager.getSpriteX(0); for (;;) { - if (_globals.vitesse == 1) + if (_globals._speed == 1) oldX -= 2; - else if (_globals.vitesse == 2) + else if (_globals._speed == 2) oldX -= 4; - else if (_globals.vitesse == 3) + else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6e3aa4f2e5..1f38b74582 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1217,8 +1217,8 @@ void ObjectsManager::AFF_BOB_ANIM() { v5 = _vm->_globals.Bob[idx].field12; if (v5 > 0) { - v6 = v5 / _vm->_globals.vitesse; - _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals.vitesse; + v6 = v5 / _vm->_globals._speed; + _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals._speed; if (v6 > 0) { LABEL_37: _vm->_globals.Bob[idx].field14 = 1; @@ -1258,8 +1258,8 @@ LABEL_38: v10 = _vm->_globals.Bob[idx].field12; if (v10 > 0) { - v11 = v10 / _vm->_globals.vitesse; - _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals.vitesse; + v11 = v10 / _vm->_globals._speed; + _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals._speed; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) _vm->_globals.Bob[idx].field12 = 1; @@ -1870,7 +1870,7 @@ LABEL_241: } v1 = 24; LABEL_23: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals.g_old_sens != 7) goto LABEL_43; @@ -1908,7 +1908,7 @@ LABEL_23: } v1 = 24; LABEL_42: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_43: if (_vm->_globals.g_old_sens != 1) goto LABEL_60; @@ -1940,7 +1940,7 @@ LABEL_43: } v1 = 0; LABEL_59: - _vm->_globals.Compteur = 4 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 4 / _vm->_globals._speed; LABEL_60: if (_vm->_globals.g_old_sens != 5) goto LABEL_77; @@ -1972,7 +1972,7 @@ LABEL_60: } v1 = 48; LABEL_76: - _vm->_globals.Compteur = 4 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 4 / _vm->_globals._speed; LABEL_77: if (_vm->_globals.g_old_sens != 2) goto LABEL_96; @@ -2010,7 +2010,7 @@ LABEL_77: } v1 = 12; LABEL_95: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_96: if (_vm->_globals.g_old_sens != 8) goto LABEL_115; @@ -2048,7 +2048,7 @@ LABEL_96: } v1 = 12; LABEL_114: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_115: if (_vm->_globals.g_old_sens != 4) goto LABEL_134; @@ -2086,7 +2086,7 @@ LABEL_115: } v1 = 36; LABEL_133: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_134: if (_vm->_globals.g_old_sens != 6) goto LABEL_153; @@ -2124,7 +2124,7 @@ LABEL_134: } v1 = 36; LABEL_152: - _vm->_globals.Compteur = 5 / _vm->_globals.vitesse; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_153: v47 = 0; do { @@ -2247,9 +2247,9 @@ void ObjectsManager::GOHOME2() { if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { int v0 = 2; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v0 = 4; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v0 = 6; _vm->_globals.j_104 = 0; if (v0) { @@ -4264,11 +4264,11 @@ void ObjectsManager::BOB_VIVANT(int idx) { v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager._characterSprite, _vm->_graphicsManager.ofscroll + v2, v3, *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); if (_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager.PERSOSPR, v2, v3, v4); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager._characterSprite, v2, v3, v4); } } @@ -5165,9 +5165,9 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in v13 = 0; v15 = a5; v19 = " "; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v15 = a5 / 2; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v15 = a5 / 3; v14 = _sprite[0]._spriteData; spriteIndex = _sprite[0]._spriteIndex; @@ -5232,9 +5232,9 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int spriteIndex = 0; v16 = " "; v14 = a5; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v14 = a5 / 2; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v14 = a5 / 3; S_old_spr = _sprite[0]._spriteData; S_old_ani = _sprite[0]._spriteIndex; @@ -5299,9 +5299,9 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a spriteIndex = 0; v15 = " "; v13 = a5; - if (_vm->_globals.vitesse == 2) + if (_vm->_globals._speed == 2) v13 = a5 / 2; - else if (_vm->_globals.vitesse == 3) + else if (_vm->_globals._speed == 3) v13 = a5 / 3; for (;;) { v6 = 0; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 52140d5c5f..54212b992d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -185,7 +185,7 @@ LABEL_104: goto LABEL_1141; _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); if (v4) - v4 /= _vm->_globals.vitesse; + v4 /= _vm->_globals._speed; if (v4 > 1) { do { if (_vm->shouldQuit()) @@ -477,7 +477,7 @@ LABEL_1141: if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') v1 = 1; if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals.vitesse; + uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals._speed; if (!v74) v74 = 1; if (v74 + 1 > 0) { @@ -547,7 +547,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); } if (v76 == 600) { - if (!_vm->_globals.internet) { + if (!_vm->_globals._internetFl) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_graphicsManager.FADESPD = 1; if (_vm->_globals.SVGA == 2) @@ -638,7 +638,7 @@ LABEL_1141: _vm->_globals.SORTIE = 6; } if (v76 == 607) { - if (!_vm->_globals.internet) { + if (!_vm->_globals._internetFl) { memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); v1 = _vm->_graphicsManager.OLD_PAL[769]; _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0a89e9db31..2fb083baef 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -36,7 +36,7 @@ namespace Hopkins { TalkManager::TalkManager() { BUFFERPERSO = NULL; PALPERSO = NULL; - PERSOSPR = NULL; + _characterSprite = NULL; ADR_ANIM = NULL; TAILLEPERSO = 0; STATI = 0; @@ -54,12 +54,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { int v3; int v4; int v5; - int v6; int v7; byte *v8; byte *v9; byte *v10; - int v11; int v14; int v15; Common::String v16; @@ -92,15 +90,15 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); v3 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PERSOSPR = _vm->_fileManager.searchCat(v16, 7); - if (PERSOSPR) { + _characterSprite = _vm->_fileManager.searchCat(v16, 7); + if (_characterSprite) { _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v16); } else { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - PERSOSPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -115,7 +113,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_objectsManager.PERSO_ON = true; CHERCHE_PAL(v3, 0); CHERCHE_ANIM0(v3, 0); - ANIM_PERSO_INIT(); + initCharacterAnim(); PLIGNE1 = v2; PLIGNE2 = v2 + 1; PLIGNE3 = v2 + 2; @@ -135,7 +133,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } while (v5 != v4); } if (_vm->_globals.NOPARLE == true) { - v6 = 1; + int v6 = 1; do v7 = DIALOGUE_REP(v6++); while (v7 != -1); @@ -144,7 +142,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); - PERSOSPR = _vm->_globals.freeMemory(PERSOSPR); + _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; @@ -176,11 +174,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { v10 = v8 + 1; _vm->_globals._disableInventFl = oldDisableInventFl; _vm->_graphicsManager.DD_VBL(); - v11 = 0; - do { + for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - ++v11; - } while (v11 <= 4); _vm->_graphicsManager.no_scroll = 0; } @@ -617,8 +612,6 @@ void TalkManager::FIN_VISU_PARLE() { } int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { - int v6; - int v7; char v8; int v9; int v10; @@ -666,8 +659,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { f.close(); v19 = ptr; - v6 = 0; - do { + for (int i = 0; i < 2048; i++) { v13 = *v19; if ((byte)(*v19 + 46) > 0x1Bu) { if ((byte)(v13 + 80) > 0x1Bu) { @@ -681,16 +673,13 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { } *v19 = v13; v19 = v19 + 1; - ++v6; - } while ((unsigned int)v6 < 0x800); + } - v7 = 0; - do { - v8 = *(ptr + v7); + for (int i = 0; i < 2048; i++) { + v8 = ptr[i]; if ( v8 == 10 || v8 == 13 ) - *(ptr + v7) = 0; - ++v7; - } while ((unsigned int)v7 < 0x800); + ptr[i] = 0; + } v9 = 0; v15 = (11 * a3) - 4; @@ -703,6 +692,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v14 = v11; ++v10; } while (v11 != 32 && v11 != 37); + if (v10 >= v15 / _vm->_globals.police_l) break; if (v11 == 37) { @@ -749,8 +739,8 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_globals.Bob[idx].field38 = 0; _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals.Bob[idx].field0 = 10; - v5 = PERSOSPR; - _vm->_globals.Bob[idx]._spriteData = PERSOSPR; + v5 = _characterSprite; + _vm->_globals.Bob[idx]._spriteData = _characterSprite; _vm->_globals.Bob[idx].field1E = v4; _vm->_globals.Bob[idx].field20 = -1; _vm->_globals.Bob[idx].field22 = 0; @@ -795,15 +785,18 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v6 = 0; do { v7 = (int16)READ_LE_UINT16(&v8[2 * v6 + 4]); - if (v7 && _vm->_globals.vitesse != 501) - _vm->_graphicsManager.AFFICHE_SPEED(PERSOSPR, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), + if (v7 && _vm->_globals._speed != 501) + _vm->_graphicsManager.AFFICHE_SPEED(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), (int16)READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); v6 += 5; - } while (_vm->_globals.vitesse != 501 && v7); + } while (_vm->_globals._speed != 501 && v7); } } -void TalkManager::ANIM_PERSO_INIT() { +/** + * Initialize character animation + */ +void TalkManager::initCharacterAnim() { byte *v0; byte *v1; int v2; @@ -874,7 +867,6 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int int v16; char v17; int v18; - int v19; int v20; int v22; int v23; @@ -923,8 +915,7 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int WRITE_LE_UINT16(v8 + 24, v23); WRITE_LE_UINT16(v8 + 26, v12); *(v8 + 28) = v13; - v19 = 1; - do { + for (int i = 1; i < 5000; i++) { v9 += 10; v24 += 10; if (!v23) @@ -940,8 +931,7 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int WRITE_LE_UINT16(v9 + 4, v23); WRITE_LE_UINT16(v9 + 6, v16); *(v9 + 8) = v17; - ++v19; - } while (v19 <= 4999); + } result = 1; } if (*(bufPerso + v22) == 'F' && *(bufPerso + v22 + 1) == 'I' && *(bufPerso + v22 + 2) == 'N') @@ -977,15 +967,9 @@ LABEL_2: if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; for (;;) { - if (*v5 == 'C') { - if (*(v5 + 1) == 'O') { - if (*(v5 + 2) == 'D') { - if (*(v5 + 3) == v2) { - if (*(v5 + 4) == v3) - v15 = 1; - } - } - } + if ((*v5 == 'C') && (*(v5 + 1) == 'O') && (*(v5 + 2) == 'D')) { + if ((*(v5 + 3) == v2) && (*(v5 + 4) == v3)) + v15 = 1; } if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') break; @@ -1174,18 +1158,15 @@ void TalkManager::REPONSE2(int a1, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - int v2; const char *v4; int v5; bool v6; int v10; byte *v11; int v12; - int v13; byte *v14; byte *v15; byte *v16; - int v17; Common::String s; Common::String v20; Common::String v22; @@ -1198,10 +1179,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); - v2 = 0; - do - _vm->_globals.BOBZONE[v2++] = 0; - while (v2 <= 44); + + for (int i = 0; i <= 44; i++) + _vm->_globals.BOBZONE[i] = 0; + _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); @@ -1222,15 +1203,15 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!v6) { v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); } - PERSOSPR = _vm->_fileManager.searchCat(v23, 7); - if (PERSOSPR) { + _characterSprite = _vm->_fileManager.searchCat(v23, 7); + if (_characterSprite) { _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v23); } else { _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - PERSOSPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -1255,7 +1236,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PERSO_ON = true; _vm->_globals.GOACTION = 0; _vm->_objectsManager.NUMZONE = -1; - ANIM_PERSO_INIT(); + initCharacterAnim(); VISU_PARLE(); VISU_WAIT(); _vm->_graphicsManager.INI_ECRAN2(v22); @@ -1282,16 +1263,15 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); - PERSOSPR = _vm->_globals.freeMemory(PERSOSPR); + _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); - v13 = 0; - do - _vm->_globals.BOBZONE[v13++] = 0; - while (v13 <= 44); + for (int i = 0; i <= 44; i++) + _vm->_globals.BOBZONE[i] = 0; + _vm->_globals.freeMemory(_vm->_globals.COUCOU); _vm->_globals.COUCOU = v11; _vm->_objectsManager.DESACTIVE = true; @@ -1330,11 +1310,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { v16 = v14 + 1; _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); - v17 = 0; - do { + for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - ++v17; - } while (v17 <= 4); _vm->_graphicsManager.no_scroll = 0; } diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 3b0ec674ff..3cb680d866 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -38,7 +38,7 @@ public: Common::String FREPON; byte *BUFFERPERSO; byte *PALPERSO; - byte *PERSOSPR; + byte *_characterSprite; byte *ADR_ANIM; size_t TAILLEPERSO; int STATI; @@ -62,7 +62,7 @@ public: void VISU_PARLE(); void BOB_VISU_PARLE(int idx); void CHERCHE_ANIM0(int a1, int a2); - void ANIM_PERSO_INIT(); + void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int a1, const byte *a2, int a3, int a4); void REPONSE(int a1, int a2); -- cgit v1.2.3 From fbd2c0e9182cf6a3ff90cf83b47347dfdd4de564 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Dec 2012 00:37:52 +0100 Subject: HOPKINS: Some renaming, rework some loop statements --- engines/hopkins/font.cpp | 25 ++++---- engines/hopkins/graphics.cpp | 148 +++++++++++++++++-------------------------- engines/hopkins/graphics.h | 6 +- engines/hopkins/lines.cpp | 51 +++++---------- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 33 +++------- 6 files changed, 100 insertions(+), 165 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 92d0c72263..c7d48d3717 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -166,10 +166,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } } else { int lineCount = 0; - int v62 = 0; - do { - _textSortArray[v62++] = 0; - } while (v62 <= 19); + for (int v62 = 0; v62 <= 19; v62++) + _textSortArray[v62] = 0; + _text[idx]._textLoadedFl = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); @@ -285,7 +284,7 @@ LABEL_43: lineSize = v19; do v11 = *(v61 + v65 + v19++); - while (v11 != 32 && v11 != 37); + while (v11 != ' ' && v11 != '%'); if (v19 >= ptrb / _vm->_globals.police_l) break; if (v11 == '%') { @@ -296,7 +295,7 @@ LABEL_43: } if (v11 != '%') goto LABEL_57; - v11 = 32; + v11 = ' '; LABEL_55: if (v11 == '%') lineSize = v19; @@ -316,7 +315,7 @@ LABEL_57: v65 += lineSize; v11 = v21; - } while (v21 != 37); + } while (v21 != '%'); for (int i = 0; i <= 19; i++) { int v22 = _textSortArray[i]; @@ -328,8 +327,8 @@ LABEL_57: for (int v23 = 0; v23 < _textSortArray[i] - 1; v23++) { Common::String &line = _text[idx]._lines[i]; byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; - if ((byte)v24 <= 0x1Fu) - v24 = 32; + if (v24 <= 32) + v24 = ' '; ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); } } @@ -399,10 +398,10 @@ LABEL_57: _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); _vm->_globals.freeMemory(ptrd); - _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, (byte)-2); - _vm->_graphicsManager.Plot_Hline(_vm->_graphicsManager.VESA_BUFFER, v56, v51 + v55, v53, (byte)-2); - _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); - _vm->_graphicsManager.Plot_Vline(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager.VESA_BUFFER, v56, v51 + v55, v53, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); } _text[idx]._lineCount = lineCount; int v75 = v73 + 5; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index cb11b4ddb1..7c630dcf42 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -66,7 +66,7 @@ GraphicsManager::GraphicsManager() { SDL_NBLOCS = 0; Red_x = Red_y = 0; Red = 0; - Largeur = 0; + _width = 0; Compteur_y = 0; spec_largeur = 0; @@ -274,17 +274,13 @@ void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int m } void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { - byte *dataP; - int count; byte dataVal; - dataP = surface; - count = size - 1; - do { + byte *dataP = surface; + for (int count = size - 1; count; count--){ dataVal = *dataP++; *(dataP - 1) = *(dataVal + col); - --count; - } while (count); + } } // TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder @@ -332,12 +328,9 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * size_t filesize; int v4; size_t v5; - int v6; size_t v7; - int v8; byte v9; int v10; - int v11; char v12; int v15; int v16; @@ -367,18 +360,17 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * v5 = v4; } v16 = v15 - 1; - v6 = 0; v7 = 0; - do { + for (int i = 0; i < 64000; i++) { if (v7 == v5) { v7 = 0; --v16; v5 = 64000; if (!v16) v5 = v17; - v8 = v6; +// v8 = i; f.read(ptr, v5); - v6 = v8; +// i = v8; } v9 = *(ptr + v7++); if (v9 > 0xC0u) { @@ -389,22 +381,22 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * v5 = 64000; if (v16 == 1) v5 = v17; - v11 = v6; +// v11 = i; f.read(ptr, v5); - v6 = v11; +// i = v11; } v12 = *(ptr + v7++); do { - *(surface + v6++) = v12; + *(surface + i++) = v12; --v10; } while (v10); } else { - *(surface + v6++) = v9; + *(surface + i++) = v9; } - } while (v6 <= 0xF9FF); + } f.seek(filesize - 768); - f.read(palette, 0x300u); + f.read(palette, 768); f.close(); _vm->_globals.freeMemory(ptr); @@ -643,36 +635,31 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac palMax = palByte = FADESPD; if (palette) { - int palIndex = 0; - do { + for (int palIndex = 0; palIndex < PALETTE_BLOCK_SIZE; palIndex++) { int palDataIndex = palIndex; - palByte = *(palIndex + palette); + palByte = palette[palIndex]; palByte <<= 8; tempPalette[palDataIndex] = palByte; - palData[palDataIndex] = *(palIndex++ + palette); - } while (palIndex < PALETTE_BLOCK_SIZE); + palData[palDataIndex] = palette[palIndex]; + } setpal_vga256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); - int palCtr3 = 0; if (palMax > 0) { - do { - int palCtr4 = 0; - do { + for (int palCtr3 = 0; palCtr3 < palMax; palCtr3++) { + for (int palCtr4 = 0; palCtr4 < PALETTE_BLOCK_SIZE; palCtr4++) { int palCtr5 = palCtr4; - int palValue = tempPalette[palCtr4] - (*(palCtr4 + palette) << 8) / palMax; + int palValue = tempPalette[palCtr4] - (palette[palCtr4] << 8) / palMax; tempPalette[palCtr5] = palValue; palData[palCtr5] = (palValue >> 8) & 0xff; - ++palCtr4; - } while (palCtr4 < (PALETTE_BLOCK_SIZE)); + } setpal_vga256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); - ++palCtr3; - } while (palMax > palCtr3); + } } for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) @@ -1349,8 +1336,6 @@ void GraphicsManager::CopyAsm(const byte *surface) { const byte *srcP; byte srcByte; byte *destP; - int yCtr; - int xCtr; byte *dest1P; byte *dest2P; byte *dest3P; @@ -1361,13 +1346,10 @@ void GraphicsManager::CopyAsm(const byte *surface) { srcP = surface; srcByte = 30 * WinScan; destP = (byte *)VideoPtr->pixels + 30 * WinScan; - yCtr = 200; - do { + for (int yCtr = 200; yCtr != 0; yCtr--) { srcPitch = srcP; destPitch = destP; - xCtr = 320; - - do { + for (int xCtr = 320; xCtr != 0; xCtr--) { srcByte = *srcP; *destP = *srcP; dest1P = WinScan + destP; @@ -1378,20 +1360,17 @@ void GraphicsManager::CopyAsm(const byte *surface) { *dest3P = srcByte; destP = dest3P - WinScan + 1; ++srcP; - --xCtr; - } while (xCtr); + } srcP = srcPitch + 320; destP = WinScan + WinScan + destPitch; - --yCtr; - } while (yCtr); + } } void GraphicsManager::CopyAsm16(const byte *surface) { const byte *v1; byte *v2; int v3; - signed int v4; byte *v5; uint16 *v6; int v; @@ -1407,10 +1386,9 @@ void GraphicsManager::CopyAsm16(const byte *surface) { do { v11 = v1; v10 = v2; - v4 = 320; v9 = v3; v5 = PAL_PIXELS; - do { + for (int v4 = 320; v4; v4--) { v = 2 * *v1; v6 = (uint16 *)(v5 + 2 * *v1); v = *v6; @@ -1421,8 +1399,7 @@ void GraphicsManager::CopyAsm16(const byte *surface) { *(v8 + 1) = v; ++v1; v2 = (byte *)v8 - WinScan + 4; - --v4; - } while (v4); + } v1 = v11 + 320; v2 = WinScan * 2 + v10; v3 = v9 - 1; @@ -1525,7 +1502,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_y = 0; Agr_Flag_y = 0; Agr_Flag_x = 0; - Largeur = spriteWidth; + _width = spriteWidth; int v20 = zoomIn(spriteWidth, zoom2); int v22 = zoomIn(spriteHeight1, zoom2); if (modeFlag) { @@ -1540,7 +1517,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp while (zoomIn(v30 + 1, zoom2) < v31) ; v20 = v52; - spritePixelsP += Largeur * v30; + spritePixelsP += _width * v30; v29 += nbrligne2 * (uint16)clip_y; v22 = v61 - (uint16)clip_y; } @@ -1571,8 +1548,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v46 = spritePixelsP; Agr_Flag_x = 0; Agr_x = 0; - int v35 = v20; - do { + for (int v35 = v20; v35; v35--) { for (;;) { if (*spritePixelsP) *v29 = *spritePixelsP; @@ -1590,10 +1566,9 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp goto R_Aff_Zoom_Larg_Cont1; } Agr_Flag_x = 0; - --v35; - } while (v35); + } R_Aff_Zoom_Larg_Cont1: - spritePixelsP = Largeur + v46; + spritePixelsP = _width + v46; v29 = nbrligne2 + v53; ++Compteur_y; if (!Agr_Flag_y) @@ -1621,7 +1596,7 @@ R_Aff_Zoom_Larg_Cont1: while (zoomIn(v23 + 1, zoom2) < v24) ; v20 = v49; - spritePixelsP += Largeur * v23; + spritePixelsP += _width * v23; dest1P += nbrligne2 * (uint16)clip_y; v22 = v58 - (uint16)clip_y; } @@ -1675,7 +1650,7 @@ R_Aff_Zoom_Larg_Cont1: --v28; } while (v28); Aff_Zoom_Larg_Cont1: - spritePixelsP = Largeur + v45; + spritePixelsP = _width + v45; dest1P = nbrligne2 + v51; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; @@ -1696,7 +1671,7 @@ Aff_Zoom_Larg_Cont1: Compteur_y = 0; Red_x = 0; Red_y = 0; - Largeur = spriteWidth; + _width = spriteWidth; Red = zoom1; if (zoom1 < 100) { int v37 = zoomOut(spriteWidth, Red); @@ -1708,9 +1683,8 @@ Aff_Zoom_Larg_Cont1: Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; - int v41 = Largeur; int v42 = v37; - do { + for (int v41 = _width; v41; v41--) { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) @@ -1722,13 +1696,12 @@ Aff_Zoom_Larg_Cont1: Red_x = Red_x - 100; ++spritePixelsP; } - --v41; - } while (v41); + } spriteHeight2 = v65; v40 = nbrligne2 + v55; } else { Red_y = Red_y - 100; - spritePixelsP += Largeur; + spritePixelsP += _width; } --spriteHeight2; } while (spriteHeight2); @@ -1739,9 +1712,8 @@ Aff_Zoom_Larg_Cont1: Red_y = Red + Red_y; if ((uint16)Red_y < 0x64u) { Red_x = 0; - int v38 = Largeur; int v39 = 0; - do { + for (int v38 = _width; v38; v38--) { Red_x = Red + Red_x; if ((uint16)Red_x < 0x64u) { if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) @@ -1753,20 +1725,19 @@ Aff_Zoom_Larg_Cont1: Red_x = Red_x - 100; ++spritePixelsP; } - --v38; - } while (v38); + } spriteHeight2 = v64; dest1P = nbrligne2 + v54; } else { Red_y = Red_y - 100; - spritePixelsP += Largeur; + spritePixelsP += _width; } --spriteHeight2; } while (spriteHeight2); } } } else { - Largeur = spriteWidth; + _width = spriteWidth; Compteur_y = 0; if (modeFlag) { dest2P = spriteWidth + dest1P; @@ -1938,7 +1909,6 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x int spriteHeight; const byte *spritePixelsP; byte *destP; - int xCtr; byte destByte; byte *destLineP; int yCtr; @@ -1955,13 +1925,12 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x spriteHeight = (int16)READ_LE_UINT16(spriteSizeP); spritePixelsP = spriteSizeP + 10; destP = surface + xp + nbrligne2 * yp; - Largeur = spriteWidth; + _width = spriteWidth; do { yCtr = spriteHeight; destLineP = destP; - xCtr = spriteWidth; - do { + for (int xCtr = spriteWidth; xCtr; xCtr--) { destByte = *spritePixelsP; if (*spritePixelsP) { if (destByte == (byte)-4) @@ -1971,8 +1940,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x ++destP; ++spritePixelsP; - --xCtr; - } while (xCtr); + } destP = nbrligne2 + destLineP; spriteHeight = yCtr - 1; } while (yCtr != 1); @@ -2161,7 +2129,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int srcP = xp + nbrligne2 * yp + srcSurface; destP = destSurface; Red = zoom; - Largeur = width; + _width = width; Red_x = 0; Red_y = 0; if (zoom < 100) { @@ -2174,7 +2142,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Red_x = 0; const byte *lineSrcP = srcP; - for (int xCtr = 0; xCtr < Largeur; ++xCtr) { + for (int xCtr = 0; xCtr < _width; ++xCtr) { Red_x += Red; if (Red_x < 100) { *destP++ = *lineSrcP++; @@ -2190,21 +2158,23 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int } } -void GraphicsManager::Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col) { +/** + * Draw horizontal line + */ +void GraphicsManager::drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col) { memset(surface + xp + nbrligne2 * yp, col, width); } -void GraphicsManager::Plot_Vline(byte *surface, int xp, int yp, int height, byte col) { - byte *destP; - int yCtr; +/** + * Draw vertical line + */ +void GraphicsManager::drawVerticalLine(byte *surface, int xp, int yp, int height, byte col) { + byte *destP = surface + xp + nbrligne2 * yp; - destP = surface + xp + nbrligne2 * yp; - yCtr = height; - do { + for (int yCtr = height; yCtr; yCtr--) { *destP = col; destP += nbrligne2; - --yCtr; - } while (yCtr); + } } void GraphicsManager::MODE_VESA() { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index deb396b0db..24ea17083a 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -95,7 +95,7 @@ public: int SDL_NBLOCS; int Red_x, Red_y; int Red; - int Largeur; + int _width; int Compteur_y; int spec_largeur; bool NOFADE; @@ -185,8 +185,8 @@ public: void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); - void Plot_Hline(byte *surface, int xp, int yp, unsigned int width, byte col); - void Plot_Vline(byte *surface, int xp, int yp, int height, byte col); + void drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col); + void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); void MODE_VESA(); }; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 99ed0d9440..63ea1ef8e5 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -226,7 +226,6 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int v13; int v24; int v25; - int v26; int16 *v27; int v30; int v31; @@ -342,9 +341,8 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v31 = 1000 * a3 / 1000; v30 = 1000 * a4 / 1000; v35 = v34 - 1; - v26 = 0; if (v35 > 0) { - do { + for (int v26 = 0; v26 < v35; v26++) { v32[0] = v31; v32[1] = v30; v32 += 2; @@ -353,8 +351,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v25 += v38; v31 = v24 / 1000; v30 = v25 / 1000; - ++v26; - } while (v35 > v26); + } } v32[0] = a5; v32[1] = a6; @@ -556,9 +553,7 @@ void LinesManager::INIPARCOURS() { int16 *v3; int v4; int v5; - int v6; int16 *v7; - int v8; int v9; int v11; int v12; @@ -583,9 +578,9 @@ void LinesManager::INIPARCOURS() { if (v15 == v4 && v14 == v5) v1 = 1; if (v0 == 400) { - v6 = v1; +// v6 = v1; error("ERROR - LAST LINE NOT FOUND"); - v1 = v6; +// v1 = v6; } v7 = Ligne[v0 + 1].lineData; if (v7[0] != v4 && v7[1] != v5) @@ -595,10 +590,9 @@ void LinesManager::INIPARCOURS() { } while (v1 != 1); _vm->_objectsManager.DERLIGNE = v0; - v8 = 1; v13 = _vm->_globals.Max_Ligne_Long; v9 = _vm->_objectsManager.DERLIGNE + 1; - do { + for (int v8 = 1; v8 != 400; v8++) { v11 = v8; if (Ligne[v11].field0 < v13) { if (v8 != v9) { @@ -607,8 +601,7 @@ void LinesManager::INIPARCOURS() { Ligne[v11].field8 = Ligne[v12].field8; } } - ++v8; - } while (v8 != 400); + } } // Avoid @@ -732,7 +725,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v40 += a7; } int v15 = a1 + 1; - if ((int)(a1 + 1) == a9 + 1) + if (a1 + 1 == a9 + 1) v15 = a8; while (a4 != v15) { if (Ligne[v15].field0 > 0) { @@ -842,16 +835,12 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int v19; int l; int v21; - int v22; int v23; int v24; - int v25; int v26; int v27; - int v28; int v29; int v30; - int v31; int v32; int v33; int v35 = 0; @@ -1032,9 +1021,8 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v35 = v43; } if (v21 == 1) { - v22 = 0; if (v39 > 0) { - do { + for (int v22 = 0; v22 < v39; v22++) { if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); @@ -1050,8 +1038,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { _vm->_globals.super_parcours[v24 + 2] = 1; _vm->_globals.super_parcours[v24 + 3] = 0; v7 += 4; - ++v22; - } while (v39 > v22); + } } LABEL_186: NV_LIGNEDEP = v36; @@ -1060,9 +1047,8 @@ LABEL_186: return 1; } if (v21 == 5) { - v25 = 0; if (v37 > 0) { - do { + for (int v25 = 0; v25 < v37; v25++) { if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); @@ -1078,15 +1064,13 @@ LABEL_186: _vm->_globals.super_parcours[v27 + 2] = 5; _vm->_globals.super_parcours[v27 + 3] = 0; v7 += 4; - ++v25; - } while (v37 > v25); + } } goto LABEL_186; } if (v21 == 7) { - v28 = 0; if (v18 > 0) { - do { + for (int v28 = 0; v28 < v18; v28++) { if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); @@ -1102,15 +1086,13 @@ LABEL_186: _vm->_globals.super_parcours[v30 + 2] = 7; _vm->_globals.super_parcours[v30 + 3] = 0; v7 += 4; - ++v28; - } while (v18 > v28); + } } goto LABEL_186; } if (v21 == 3) { - v31 = 0; if (v38 > 0) { - do { + for (int v31 = 0; v31 < v38; v31++) { if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 && _vm->_objectsManager.DERLIGNE < v46) { v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); @@ -1126,8 +1108,7 @@ LABEL_186: _vm->_globals.super_parcours[v33 + 2] = 3; _vm->_globals.super_parcours[v33 + 3] = 0; v7 += 4; - ++v31; - } while (v38 > v31); + } } goto LABEL_186; } @@ -1381,9 +1362,9 @@ LABEL_17: if (v40 < 0) v40 = -v40; int v41 = v40; - int v42 = a1; int v43 = 0; int v52 = v92 - 1; + int v42 = a1; do { if (v52 == v42) v42 = v91; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 6f17879cba..6cb5c2e9b3 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -175,7 +175,7 @@ int MenuManager::MENU() { _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) - selectionMade = 1; + selectionMade = true; } while (!selectionMade); if (menuIndex == PLAY_GAME) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 1f38b74582..5dac113550 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -327,9 +327,6 @@ void ObjectsManager::displaySprite() { int v27; int x1_1; int x1_2; - int v33; - int v34; - int v35; uint16 arr[50]; // Handle copying any background areas that text are going to be drawn on @@ -406,20 +403,16 @@ void ObjectsManager::displaySprite() { } if (_priorityFl && _vm->_globals.NBTRI) { - v33 = 1; - do { + for (int v33 = 1; v33 <= 48; v33++) arr[v33] = v33; - ++v33; - } while (v33 <= 48); v25 = _vm->_globals.NBTRI; do { v27 = 0; - v34 = 1; if (v25 > 1) { v26 = _vm->_globals.NBTRI; - do { + for (int v34 = 1; v34 < v26; v34++) { v11 = arr[v34]; v12 = &arr[v34 + 1]; if (_vm->_globals.Tri[arr[v34]]._priority > _vm->_globals.Tri[*v12]._priority) { @@ -427,14 +420,12 @@ void ObjectsManager::displaySprite() { *v12 = v11; ++v27; } - ++v34; - } while (v34 < v26); + } } } while (v27); - v35 = 1; if (_vm->_globals.NBTRI + 1 > 1) { - do { + for (int v35 = 1; v35 < _vm->_globals.NBTRI + 1; v35++) { v13 = arr[v35]; switch (_vm->_globals.Tri[v13]._triMode) { case TRI_BOB: @@ -450,8 +441,7 @@ void ObjectsManager::displaySprite() { break; } _vm->_globals.Tri[v13]._triMode = TRI_NONE; - ++v35; - } while (v35 < _vm->_globals.NBTRI + 1); + } } } else { if (_vm->_globals.NBTRI + 1 > 1) { @@ -1161,7 +1151,6 @@ void ObjectsManager::AFF_BOB_ANIM() { int v10; int v11; int v12; - int v13; int v14; int v18; int v19; @@ -1169,7 +1158,6 @@ void ObjectsManager::AFF_BOB_ANIM() { byte *v21; int v22; int v24; - int v26; int v27; int v28; @@ -1272,13 +1260,10 @@ LABEL_38: } while (idx != 35); if (!PERSO_ON && BOBTOUS == true) { - v26 = 0; - do { - v13 = v26; - if (_vm->_globals.Bob[v13].field0 == 10 && !_vm->_globals.Bob[v13].field16) - _vm->_globals.Bob[v13].field1C = 1; - ++v26; - } while (v26 != 35); + for (int v26 = 0; v26 != 35; v26++) { + if (_vm->_globals.Bob[v26].field0 == 10 && !_vm->_globals.Bob[v26].field16) + _vm->_globals.Bob[v26].field1C = 1; + } } BOBTOUS = false; -- cgit v1.2.3 From f9653e5c098640131e0f8b1928d22a46831fdbd6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Dec 2012 08:47:28 +0100 Subject: HOPKINS: Remove some do while from ObjectsManager --- engines/hopkins/objects.cpp | 422 ++++++++++++++------------------------------ 1 file changed, 131 insertions(+), 291 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5dac113550..4b4568a506 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1330,8 +1330,7 @@ LABEL_38: void ObjectsManager::AFF_VBOB() { int width, height; - int idx = 0; - do { + for (int idx = 0; idx <= 29; idx++) { if (_vm->_globals.VBob[idx].field4 == 4) { width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); @@ -1428,8 +1427,7 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx]._yp + height); _vm->_globals.VBob[idx].field4 = 2; } - ++idx; - } while ( idx <= 29 ); + } } /** @@ -2328,45 +2326,34 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { // Load Zone void ObjectsManager::CHARGE_ZONE(const Common::String &file) { - signed int v1; - int v2; int v3; int v4; int v5; int v6; - int16 v7; - int v8; byte *v9; int v10; - signed int v11; - int v12; byte *v13; - int v14; - signed int v15; int16 v17; int16 v18; byte *ptr; - v1 = 1; - do { - v2 = v1; - _vm->_globals.ZONEP[v2]._destX = 0; - _vm->_globals.ZONEP[v2]._destY = 0; - _vm->_globals.ZONEP[v2].field4 = 0; - _vm->_globals.ZONEP[v2].field6 = 0; - _vm->_globals.ZONEP[v2].field7 = 0; - _vm->_globals.ZONEP[v2].field8 = 0; - _vm->_globals.ZONEP[v2].field9 = 0; - _vm->_globals.ZONEP[v2].fieldA = 0; - _vm->_globals.ZONEP[v2].fieldB = 0; - _vm->_globals.ZONEP[v2].fieldC = 0; - _vm->_globals.ZONEP[v2].fieldD = 0; - _vm->_globals.ZONEP[v2].fieldE = 0; - _vm->_globals.ZONEP[v2].fieldF = 0; - _vm->_globals.ZONEP[v2].field12 = 0; - _vm->_globals.ZONEP[v2].field10 = 0; - ++v1; - } while (v1 <= 100); + for (int v1 = 1; v1 <= 100; v1++) { + _vm->_globals.ZONEP[v1]._destX = 0; + _vm->_globals.ZONEP[v1]._destY = 0; + _vm->_globals.ZONEP[v1].field4 = 0; + _vm->_globals.ZONEP[v1].field6 = 0; + _vm->_globals.ZONEP[v1].field7 = 0; + _vm->_globals.ZONEP[v1].field8 = 0; + _vm->_globals.ZONEP[v1].field9 = 0; + _vm->_globals.ZONEP[v1].fieldA = 0; + _vm->_globals.ZONEP[v1].fieldB = 0; + _vm->_globals.ZONEP[v1].fieldC = 0; + _vm->_globals.ZONEP[v1].fieldD = 0; + _vm->_globals.ZONEP[v1].fieldE = 0; + _vm->_globals.ZONEP[v1].fieldF = 0; + _vm->_globals.ZONEP[v1].field12 = 0; + _vm->_globals.ZONEP[v1].field10 = 0; + } _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); @@ -2397,42 +2384,34 @@ void ObjectsManager::CHARGE_ZONE(const Common::String &file) { ++v18; ++v17; } while (v3 != -1); - v7 = 1; - do { - v8 = v7; - _vm->_globals.ZONEP[v8]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - _vm->_globals.ZONEP[v8]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); - _vm->_globals.ZONEP[v8].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); + + for (int v7 = 1; v7 <= 100; v7++) { + // CHECKME: Shouldn't it be READ_LE_UINT8? + _vm->_globals.ZONEP[v7]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + _vm->_globals.ZONEP[v7]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); + _vm->_globals.ZONEP[v7].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); v4 += 3; - ++v7; - } while (v7 <= 100); + } v9 = (ptr + 10 * v17 + 606); v10 = 0; - v11 = 1; - do { - v12 = v11; - - _vm->_globals.ZONEP[v12].field6 = *(v10 + v9); - _vm->_globals.ZONEP[v12].field7 = *(v9 + v10 + 1); - _vm->_globals.ZONEP[v12].field8 = *(v9 + v10 + 2); - _vm->_globals.ZONEP[v12].field9 = *(v9 + v10 + 3); - _vm->_globals.ZONEP[v12].fieldA = *(v9 + v10 + 4); - _vm->_globals.ZONEP[v12].fieldB = *(v9 + v10 + 5); - _vm->_globals.ZONEP[v12].fieldC = *(v9 + v10 + 6); - _vm->_globals.ZONEP[v12].fieldD = *(v9 + v10 + 7); - _vm->_globals.ZONEP[v12].fieldE = *(v9 + v10 + 8); - _vm->_globals.ZONEP[v12].fieldF = *(v9 + v10 + 9); + for (int v11 = 1; v11 <= 100; v11++) { + _vm->_globals.ZONEP[v11].field6 = v9[v10]; + _vm->_globals.ZONEP[v11].field7 = v9[v10 + 1]; + _vm->_globals.ZONEP[v11].field8 = v9[v10 + 2]; + _vm->_globals.ZONEP[v11].field9 = v9[v10 + 3]; + _vm->_globals.ZONEP[v11].fieldA = v9[v10 + 4]; + _vm->_globals.ZONEP[v11].fieldB = v9[v10 + 5]; + _vm->_globals.ZONEP[v11].fieldC = v9[v10 + 6]; + _vm->_globals.ZONEP[v11].fieldD = v9[v10 + 7]; + _vm->_globals.ZONEP[v11].fieldE = v9[v10 + 8]; + _vm->_globals.ZONEP[v11].fieldF = v9[v10 + 9]; v10 += 10; - ++v11; - } while (v11 <= 100); + } v13 = v9 + 1010; - v14 = 0; - v15 = 1; - do - _vm->_globals.ZONEP[v15++].field12 = READ_LE_UINT16(v13 + 2 * v14++); - while (v15 <= 100); + for (int v14 = 0; v14 < 100; v14++) + _vm->_globals.ZONEP[v14].field12 = READ_LE_UINT16(v13 + 2 * v14); _vm->_globals.freeMemory(ptr); CARRE_ZONE(); @@ -2443,12 +2422,9 @@ void ObjectsManager::CARRE_ZONE() { int16 *dataP; int v4; int v5; - int v7; - int v8; int v10; int v11; int v12; - int v13; int v14; for (int idx = 0; idx < 100; ++idx) { @@ -2472,10 +2448,9 @@ void ObjectsManager::CARRE_ZONE() { if (_vm->_globals.CarreZone[v4].fieldA > idx) _vm->_globals.CarreZone[v4].fieldA = idx; - v13 = 0; v12 = _vm->_linesManager.LigneZone[idx].count; if (v12 > 0) { - do { + for (int v13 = 0; v13 < v12; v13++) { v5 = *dataP++; v11 = *dataP++; @@ -2487,32 +2462,26 @@ void ObjectsManager::CARRE_ZONE() { _vm->_globals.CarreZone[v4].field6 = v11; if (_vm->_globals.CarreZone[v4].field8 <= v11) _vm->_globals.CarreZone[v4].field8 = v11; - ++v13; - } while (v13 < v12); + } } } } - v7 = 0; - do { - v8 = v7; - v10 = _vm->_globals.CarreZone[v8].field2 - _vm->_globals.CarreZone[v8].field4; + for (int v7 = 0; v7 <= 99; v7++) { + v10 = _vm->_globals.CarreZone[v7].field2 - _vm->_globals.CarreZone[v7].field4; if (v10 < 0) v10 = -v10; - v14 = _vm->_globals.CarreZone[v8].field6 - _vm->_globals.CarreZone[v8].field8; + v14 = _vm->_globals.CarreZone[v7].field6 - _vm->_globals.CarreZone[v7].field8; if (v14 < 0) v14 = -v14; if (v10 == v14) - _vm->_globals.CarreZone[v8].fieldE = 1; - ++v7; - } while (v7 <= 99); + _vm->_globals.CarreZone[v7].fieldE = 1; + } } void ObjectsManager::PLAN_BETA() { int v1; - int v2; int v3; - int v4; int v5; v1 = 0; @@ -2542,10 +2511,8 @@ void ObjectsManager::PLAN_BETA() { _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN"); - v2 = 0; - do { - _vm->_globals.CACHE_OFF(v2++); - } while (v2 <= 15); + for (int v2 = 0; v2 <= 15; v2++) + _vm->_globals.CACHE_OFF(v2); _vm->_globals.CACHE_OFF(19); _vm->_globals.CACHE_OFF(20); _vm->_globals.CACHE_ON(); @@ -2570,11 +2537,8 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_globals.BPP_NOAFF = true; - v4 = 0; - do { + for (int v4 = 0; v4 <= 4; v4++) _vm->_eventsManager.VBL(); - ++v4; - } while (v4 <= 4); _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; @@ -2933,9 +2897,6 @@ LABEL_64: // Clear Screen void ObjectsManager::CLEAR_ECRAN() { - int v1; - int v2; - CLEAR_SPR(); _vm->_graphicsManager.FIN_VISU(); _vm->_fontManager.hideText(5); @@ -2946,13 +2907,10 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.RESET_CACHE(); - v1 = 0; - do { - v2 = v1; - _vm->_globals.BOBZONE[v2] = 0; - _vm->_globals.BOBZONE_FLAG[v2] = false; - ++v1; - } while (v1 <= 48); + for (int v1 = 0; v1 <= 48; v1++) { + _vm->_globals.BOBZONE[v1] = 0; + _vm->_globals.BOBZONE_FLAG[v1] = false; + } _vm->_eventsManager._mouseCursorId = 4; _verb = 4; NUMZONE = 0; @@ -3133,7 +3091,6 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { int v5; int v6; int v7; - int v8; int v9; int v10; int v11; @@ -3171,13 +3128,11 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { } if (v12 < v10) { v7 = v11; - v8 = 0; if (v12 > 0) { - do { + for (int v8 = 0; v8 < v12; v8++) { a1[v7 + 2] = v14; v7 += 4; - ++v8; - } while (v12 > v8); + } } v15 = v14; } @@ -3220,13 +3175,10 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v21; int16 *result; int v23; - int v24; - int v25; int v26; int v27; int v28; int v29; - int v30; int v31; int v32; int16 *v33; @@ -3235,23 +3187,15 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int i; int16 *v37; int v39; - int v40; int16 *v41; - int v43; int k; int16 *v45; int v47; int v48; - int v49; int16 *v50; int v52; - int v53; int16 *v54; - int v56; - int v57; int16 *v58; - int v60; - int v61; int v62; int v63; int v64; @@ -3399,31 +3343,25 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v73 = v87[7]; v72 = v82[7]; } - v24 = 0; - do { - v25 = v24; - v87[v25] = -1; - v82[v25] = 0; - v77[v25] = 1300; - v76[v25] = 1300; - ++v24; - } while (v24 <= 8); + for (int v24 = 0; v24 <= 8; v24++) { + v87[v24] = -1; + v82[v24] = 0; + v77[v24] = 1300; + v76[v24] = 1300; + } v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, DERLIGNE); if (v26 == 1) { v69 = v87[1]; v68 = v82[1]; - } - if (!v26) { + } else if (!v26) { if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { v27 = 0; for (;;) { v28 = _vm->_globals.essai2[v27]; v29 = _vm->_globals.essai2[v27 + 1]; v66 = _vm->_globals.essai2[v27 + 2]; - v27 = v27 + 4; - v30 = v27; + v27 += 4; v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, DERLIGNE); - v27 = v30; if (v31) break; v32 = v67; @@ -3478,18 +3416,15 @@ LABEL_88: v67 = _vm->_linesManager.NV_POSI; goto LABEL_90; } - v40 = 0; if (_vm->_linesManager.Ligne[j].field0 - 2 > 0) { - do { + for (int v40 = 0; v40 < _vm->_linesManager.Ligne[j].field0 - 2; v40++) { v41 = _vm->_linesManager.Ligne[j].lineData; - v43 = v67; - _vm->_globals.super_parcours[v43] = v41[2 * v40]; - _vm->_globals.super_parcours[v43 + 1] = v41[2 * v40 + 1]; - _vm->_globals.super_parcours[v43 + 2] = _vm->_linesManager.Ligne[j].field6; - _vm->_globals.super_parcours[v43 + 3] = 0; + _vm->_globals.super_parcours[v67] = v41[2 * v40]; + _vm->_globals.super_parcours[v67 + 1] = v41[2 * v40 + 1]; + _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[j].field6; + _vm->_globals.super_parcours[v67 + 3] = 0; v67 += 4; - ++v40; - } while (v40 < _vm->_linesManager.Ligne[j].field0 - 2); + } } } v68 = 0; @@ -3515,9 +3450,9 @@ LABEL_88: v73, 0) == 1) goto LABEL_88; - v49 = _vm->_linesManager.Ligne[v48].field0 - 2; + if ((_vm->_linesManager.Ligne[v48].field0 - 2) > 0) { - do { + for (int v49 = _vm->_linesManager.Ligne[v48].field0 - 2; v49 > 0; v49 --) { v50 = _vm->_linesManager.Ligne[l].lineData; v52 = v67; _vm->_globals.super_parcours[v52] = v50[2 * v49]; @@ -3525,8 +3460,7 @@ LABEL_88: _vm->_globals.super_parcours[v52 + 2] = _vm->_linesManager.Ligne[l].field8; _vm->_globals.super_parcours[v52 + 3] = 0; v67 += 4; - --v49; - } while (v49 > 0); + } } } v68 = _vm->_linesManager.Ligne[v73].field0 - 1; @@ -3535,37 +3469,30 @@ LABEL_88: if (v69 == v73) { if (v68 <= v72) { if (v68 < v72) { - v57 = v68; - do { + for (int v57 = v68; v57 < v72; v57++) { v58 = _vm->_linesManager.Ligne[v73].lineData; - v60 = v67; - _vm->_globals.super_parcours[v60] = v58[2 * v57]; - _vm->_globals.super_parcours[v60 + 1] = v58[2 * v57 + 1]; - _vm->_globals.super_parcours[v60 + 2] = _vm->_linesManager.Ligne[v73].field6; - _vm->_globals.super_parcours[v60 + 3] = 0; + _vm->_globals.super_parcours[v67] = v58[2 * v57]; + _vm->_globals.super_parcours[v67 + 1] = v58[2 * v57 + 1]; + _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field6; + _vm->_globals.super_parcours[v67 + 3] = 0; v67 += 4; - ++v57; - } while (v72 > v57); + } } } else { - v53 = v68; - do { + for (int v53 = v68; v53 > v72; v53--) { v54 = _vm->_linesManager.Ligne[v73].lineData; - v56 = v67; - _vm->_globals.super_parcours[v56] = v54[2 * v53]; - _vm->_globals.super_parcours[v56 + 1] = v54[2 * v53 + 1]; - _vm->_globals.super_parcours[v56 + 2] = _vm->_linesManager.Ligne[v73].field8; - _vm->_globals.super_parcours[v56 + 3] = 0; + _vm->_globals.super_parcours[v67] = v54[2 * v53]; + _vm->_globals.super_parcours[v67 + 1] = v54[2 * v53 + 1]; + _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field8; + _vm->_globals.super_parcours[v67 + 3] = 0; v67 += 4; - --v53; - } while (v72 < v53); + } } } - v61 = v67; - _vm->_globals.super_parcours[v61] = -1; - _vm->_globals.super_parcours[v61 + 1] = -1; - _vm->_globals.super_parcours[v61 + 2] = -1; - _vm->_globals.super_parcours[v61 + 3] = -1; + _vm->_globals.super_parcours[v67] = -1; + _vm->_globals.super_parcours[v67 + 1] = -1; + _vm->_globals.super_parcours[v67 + 2] = -1; + _vm->_globals.super_parcours[v67 + 3] = -1; result = &_vm->_globals.super_parcours[0]; } else { result = (int16 *)g_PTRNUL; @@ -3785,13 +3712,11 @@ void ObjectsManager::BTDROITE() { int ObjectsManager::MZONE() { signed int result; - int16 v1; int16 v2; int v3; int16 v4; int16 v5; int v6; - int16 v7; int v8; int v9; int16 yCurrent; @@ -3814,8 +3739,7 @@ int ObjectsManager::MZONE() { xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { - v1 = 0; - do { + for (int v1 = 0; v1 <= 48; v1++) { v2 = _vm->_globals.BOBZONE[v1]; if (v2) { if (_vm->_globals.BOBZONE_FLAG[v1]) { @@ -3852,11 +3776,9 @@ int ObjectsManager::MZONE() { } } } - ++v1; - } while (v1 <= 48); + } _vm->_globals.SegmentEnCours = 0; - v7 = 0; - do { + for (int v7 = 0; v7 <= 99; v7++) { if (_vm->_globals.ZONEP[v7].field10 == 1) { v8 = v7; if (_vm->_globals.CarreZone[v8].field0 == 1) { @@ -3875,8 +3797,7 @@ int ObjectsManager::MZONE() { } } } - ++v7; - } while (v7 <= 99); + } if (!_vm->_globals.SegmentEnCours) goto LABEL_58; @@ -4562,14 +4483,7 @@ void ObjectsManager::INILINK(const Common::String &file) { int v15; byte *v16; byte *v17; - int v18; - int v19; - int v20; - int v21; byte *v22; - int v23; - int v24; - int v25; int16 v27; int16 v28; int v29; @@ -4581,9 +4495,6 @@ void ObjectsManager::INILINK(const Common::String &file) { int v35; int v36; byte *v37; - int v40; - size_t v41; - size_t v42; size_t nbytes; byte *ptr; Common::String filename, filename2; @@ -4630,9 +4541,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CAT_FLAG = false; v36 = 60; v37 = ptr + 1000; - v40 = 0; - - do { + for (int v40 = 0; v40 <= 21; v40++) { v8 = (int16)READ_LE_UINT16(v37 + 2 * v36); v9 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 2); v10 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 4); @@ -4661,16 +4570,14 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.Cache[v40].fieldA = 0; v36 += 5; - ++v40; - } while (v40 <= 21); + } _vm->_globals.CACHE_ON(); } } _vm->_linesManager.RESET_OBSTACLE(); - v41 = 0; if (nbytes) { - do { + for (size_t v41 = 0; v41 < nbytes; v41++) { if (*(ptr + v41) == 'O' && *(ptr + v41 + 1) == 'B' && *(ptr + v41 + 2) == '2') { v16 = ptr + v41 + 4; v32 = 0; @@ -4694,36 +4601,31 @@ void ObjectsManager::INILINK(const Common::String &file) { } while (v27 != -1); _vm->_linesManager.INIPARCOURS(); } - ++v41; - } while (nbytes > v41); + } } if (!OBSSEUL) { - v42 = 0; if (nbytes) { - do { + for (size_t v42 = 0; v42 < nbytes; v42++) { if (*(ptr + v42) == 'Z' && *(ptr + v42 + 1) == 'O' && *(ptr + v42 + 2) == '2') { v17 = ptr + v42 + 4; v33 = 0; v35 = 0; - v18 = 1; - do { - v19 = v18; - _vm->_globals.ZONEP[v19]._destX = 0; - _vm->_globals.ZONEP[v19]._destY = 0; - _vm->_globals.ZONEP[v19].field4 = 0; - _vm->_globals.ZONEP[v19].field6 = 0; - _vm->_globals.ZONEP[v19].field7 = 0; - _vm->_globals.ZONEP[v19].field8 = 0; - _vm->_globals.ZONEP[v19].field9 = 0; - _vm->_globals.ZONEP[v19].fieldA = 0; - _vm->_globals.ZONEP[v19].fieldB = 0; - _vm->_globals.ZONEP[v19].fieldC = 0; - _vm->_globals.ZONEP[v19].fieldD = 0; - _vm->_globals.ZONEP[v19].fieldE = 0; - _vm->_globals.ZONEP[v19].fieldF = 0; - _vm->_globals.ZONEP[v19].field12 = 0; - ++v18; - } while (v18 <= 100); + for (int v18 = 1; v18 <= 100; v18++) { + _vm->_globals.ZONEP[v18]._destX = 0; + _vm->_globals.ZONEP[v18]._destY = 0; + _vm->_globals.ZONEP[v18].field4 = 0; + _vm->_globals.ZONEP[v18].field6 = 0; + _vm->_globals.ZONEP[v18].field7 = 0; + _vm->_globals.ZONEP[v18].field8 = 0; + _vm->_globals.ZONEP[v18].field9 = 0; + _vm->_globals.ZONEP[v18].fieldA = 0; + _vm->_globals.ZONEP[v18].fieldB = 0; + _vm->_globals.ZONEP[v18].fieldC = 0; + _vm->_globals.ZONEP[v18].fieldD = 0; + _vm->_globals.ZONEP[v18].fieldE = 0; + _vm->_globals.ZONEP[v18].fieldF = 0; + _vm->_globals.ZONEP[v18].field12 = 0; + } v31 = 0; do { @@ -4742,21 +4644,16 @@ void ObjectsManager::INILINK(const Common::String &file) { ++v35; ++v31; } while (v28 != -1); - v20 = 1; - do { - v21 = v20; + for (int v21 = 1; v21 <= 100; v21++) { _vm->_globals.ZONEP[v21]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); _vm->_globals.ZONEP[v21]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; - ++v20; - } while (v20 <= 100); + } v22 = ptr + v42 + (10 * v31 + 606) + 4; v29 = 0; - v23 = 1; - do { - v24 = v23; + for (int v24 = 1; v24 <= 100; v24++) { _vm->_globals.ZONEP[v24].field6 = *(v29 + v22); _vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1); _vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2); @@ -4768,30 +4665,19 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.ZONEP[v24].fieldE = *(v22 + v29 + 8); _vm->_globals.ZONEP[v24].fieldF = *(v22 + v29 + 9); v29 += 10; - ++v23; - } while (v23 <= 100); + } v30 = 0; - v25 = 1; - do + for (int v25 = 1; v25 <= 100; v25++) _vm->_globals.ZONEP[v25].field12 = (int16)READ_LE_UINT16(v22 + 1010 + 2 * v30++); - while (++v25 <= 100); CARRE_ZONE(); } - ++v42; - } while (nbytes > v42); + } } } _vm->_globals.freeMemory(ptr); } void ObjectsManager::SPECIAL_INI(const Common::String &a1) { - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - if (_vm->_globals.ECRAN == 73 && !_vm->_globals.SAUVEGARDE->data[svField318]) { _vm->_globals.CACHE_SUB(0); _vm->_globals.CACHE_SUB(1); @@ -4813,12 +4699,10 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.ZONEP[21].field12 = 30; _vm->_globals.ZONEP[22].field12 = 30; _vm->_globals.ZONEP[23].field12 = 30; - v2 = 200; - do { + for (int v2 = 200; v2 <= 214; v2++) { if (_vm->_globals.SAUVEGARDE->data[v2] != 2) _vm->_globals.SAUVEGARDE->data[v2] = 0; - ++v2; - } while (v2 <= 214); + } } if (_vm->_globals.ECRAN == 93) { if (!_vm->_globals.SAUVEGARDE->data[svField333]) @@ -4827,11 +4711,8 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { _vm->_eventsManager._mouseSpriteId = 4; _vm->_globals.BPP_NOAFF = true; - v3 = 0; - do { + for (int v3 = 0; v3 <= 4; v3++) _vm->_eventsManager.VBL(); - ++v3; - } while (v3 <= 4); _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); _vm->_globals.iRegul = 1; @@ -4849,19 +4730,13 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_globals.BPP_NOAFF = true; - v4 = 0; - do { + for (int v4 = 0; v4 <= 4; v4++) _vm->_eventsManager.VBL(); - ++v4; - } while (v4 <= 4); _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); SPRITE_ON(0); - v5 = 0; - do { + for (int v5 = 0; v5 <= 4; v5++) _vm->_eventsManager.VBL(); - ++v5; - } while (v5 <= 4); VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); _vm->_fontManager.hideText(9); if (!_vm->_soundManager.TEXTOFF) { @@ -4875,19 +4750,13 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.SAUVEGARDE->data[svField300] = 1; _vm->_globals.SAUVEGARDE->data[svField320] = 1; if (_vm->_soundManager.VOICEOFF == 1) { - v6 = 0; - do { + for (int v6 = 0; v6 <= 199; v6++) _vm->_eventsManager.VBL(); - ++v6; - } while (v6 <= 199); } _vm->_fontManager.hideText(9); VBOB_OFF(5); - v7 = 0; - do { + for (int v7 = 0; v7 <= 3; v7++) _vm->_eventsManager.VBL(); - ++v7; - } while (v7 <= 3); _vm->_graphicsManager.NOFADE = true; _vm->_globals._disableInventFl = false; } @@ -5135,8 +5004,6 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in int v7; char v8; int v9; - int v10; - int v11; int v13; const byte *v14; char v15; @@ -5187,15 +5054,9 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = v13; } - v10 = 0; - v9 = v15; if (v15 > 0) { - do { - v11 = v9; + for (int v10 = 0; v10 < v15; v10++) _vm->_eventsManager.VBL(); - ++v10; - v9 = v11; - } while (v10 < v11); } if (v13 == -1) break; @@ -5207,8 +5068,6 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int int v6; char v8; int v9; - int16 v10; - int v11; int spriteIndex; char v14; Common::String v16; @@ -5253,15 +5112,9 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int _sprite[0]._spriteData = a1; _sprite[0]._spriteIndex = spriteIndex; } - v10 = 0; - v9 = v14; if (v14 > 0) { - do { - v11 = v9; + for (int v10 = 0; v10 < v14; v10++) _vm->_eventsManager.VBL(); - ++v10; - v9 = v11; - } while (v10 < v11); } } while (spriteIndex != -1); } @@ -5271,13 +5124,10 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a int v6; char v7; int v8; - int v9; - int v10; int spriteIndex; int v13; int v14; Common::String v15; - int v16; v14 = 0; v5 = 0; @@ -5315,15 +5165,9 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a _sprite[0]._spriteIndex = spriteIndex; } - v9 = 0; - v16 = v13; if (v13 > 0) { - do { - v10 = v8; + for (int v9 = 0; v9 < v8; v9++) _vm->_eventsManager.VBL(); - ++v9; - v16 = v10; - } while (v9 < v10); } if (spriteIndex == -1) break; @@ -5437,7 +5281,6 @@ void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v) { int v5; - int v6; int v7; int v8; int v9; @@ -5481,11 +5324,8 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_eventsManager.changeMouseCursor(4); _vm->_globals.BPP_NOAFF = true; - v6 = 0; - do { + for (int v6 = 0; v6 < 4; v6++) _vm->_eventsManager.VBL(); - ++v6; - } while (v6 <= 4); _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.ECRAN == 61) { -- cgit v1.2.3 From 5678fbd3212f3d758863ec2338066797718b8f88 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Dec 2012 21:50:50 +0100 Subject: HOPKINS: Some refactoring and renaming in ObjectsManager --- engines/hopkins/computer.cpp | 8 +-- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/objects.cpp | 127 ++++++++++++++++--------------------------- engines/hopkins/objects.h | 11 +--- engines/hopkins/script.cpp | 44 +++++++-------- 5 files changed, 78 insertions(+), 114 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 6616ebbb59..28526fb5e8 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -684,8 +684,8 @@ void ComputerManager::newLevel() { Common::String file; Common::File f; - _vm->_objectsManager.SPRITE_OFF(0); - _vm->_objectsManager.SPRITE_OFF(1); + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.removeSprite(1); ++_breakoutLives; if (_breakoutLives > 11) _breakoutLives = 11; @@ -848,8 +848,8 @@ void ComputerManager::playBreakout() { continue; } _vm->_eventsManager.mouseOn(); - _vm->_objectsManager.SPRITE_OFF(0); - _vm->_objectsManager.SPRITE_OFF(1); + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.removeSprite(1); if (_breakoutScore > _breakoutHiscore) getScoreName(); v = displayHiscores(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 49e4996f4c..ec88fe8f05 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4807,7 +4807,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 if (_globals.SORTIE == 4) _globals.SORTIE = exit4; _graphicsManager.FADE_OUTW(); - _objectsManager.SPRITE_OFF(0); + _objectsManager.removeSprite(0); _globals.AFFLI = false; _objectsManager.CLEAR_ECRAN(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 4b4568a506..5160bccec9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -391,7 +391,7 @@ void ObjectsManager::displaySprite() { // Handle drawing characters on the screen for (int idx = 0; idx < MAX_SPRITE; ++idx) { _vm->_globals.Liste[idx].field0 = 0; - if (_sprite[idx].field0 == 1) { + if (_sprite[idx]._animationType == 1) { CALCUL_SPRITE(idx); if (_sprite[idx].field2A == 1) AvantTri(TRI_SPRITE, idx, _sprite[idx].field32 + _sprite[idx].field2E); @@ -867,7 +867,7 @@ void ObjectsManager::VERIFCACHE() { if (_vm->_globals.Cache[v8].fieldA > 0) { v7 = _vm->_globals.Cache[v8].fieldA; for (int v10 = 0; v10 <= 4; v10++) { - if (_sprite[v10].field0 == 1) { + if (_sprite[v10]._animationType == 1) { if (_sprite[v10]._spriteIndex != 250) { v1 = _sprite[v10].field2C; v11 = _sprite[v10].field30 + v1; @@ -1152,14 +1152,10 @@ void ObjectsManager::AFF_BOB_ANIM() { int v11; int v12; int v14; - int v18; int v19; byte *v20; byte *v21; - int v22; int v24; - int v27; - int v28; int idx = 0; do { @@ -1267,32 +1263,25 @@ LABEL_38: } BOBTOUS = false; - v27 = 0; - do { - ++v27; + for (int v27 = 1; v27 < 35; v27++) { if (v27 > 20 || PERSO_ON != true) { - if (_vm->_globals.Bob[v27].field0 == 10) { - if (_vm->_globals.Bob[v27].field1C == 1) { - v14 = _vm->_globals.Bob[v27].field1E; - - if (v14 != 2) { - if (v14 != 4) { - if (_vm->_globals.Liste2[v27]._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, - _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27]._xp, - _vm->_globals.Liste2[v27]._yp); - _vm->_globals.Liste2[v27]._visibleFl = false; - } - } + if ((_vm->_globals.Bob[v27].field0 == 10) && (_vm->_globals.Bob[v27].field1C == 1)) { + v14 = _vm->_globals.Bob[v27].field1E; + + if ((v14 != 2) && (v14 != 4)) { + if (_vm->_globals.Liste2[v27]._visibleFl) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, + _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, + _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, + _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27]._xp, + _vm->_globals.Liste2[v27]._yp); + _vm->_globals.Liste2[v27]._visibleFl = false; } } } - v22 = v27; - if (_vm->_globals.Bob[v22].field0 == 11) { + if (_vm->_globals.Bob[v27].field0 == 11) { if (_vm->_globals.Liste2[v27]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, @@ -1302,28 +1291,25 @@ LABEL_38: _vm->_globals.Liste2[v27]._visibleFl = false; } - _vm->_globals.Bob[v22].field0 = 0; + _vm->_globals.Bob[v27].field0 = 0; } } - } while (v27 != 35); + } - v28 = 0; - do { - ++v28; - v18 = v28; - _vm->_globals.Bob[v18]._oldY = 0; - if (_vm->_globals.Bob[v18].field0 == 10 && !_vm->_globals.Bob[v18].field16 && _vm->_globals.Bob[v18].field1C == 1) { + for (int v28 = 1; v28 < 25; v28++) { + _vm->_globals.Bob[v28]._oldY = 0; + if (_vm->_globals.Bob[v28].field0 == 10 && !_vm->_globals.Bob[v28].field16 && _vm->_globals.Bob[v28].field1C == 1) { CALCUL_BOB(v28); - int v = _vm->_globals.Bob[v18]._oldHeight + _vm->_globals.Bob[v18]._oldY; - v19 = _vm->_globals.Bob[v18]._oldX2 + v; + int v = _vm->_globals.Bob[v28]._oldHeight + _vm->_globals.Bob[v28]._oldY; + v19 = _vm->_globals.Bob[v28]._oldX2 + v; if (v19 > 450) v19 = 600; - if (_vm->_globals.Bob[v18]._activeFl) + if (_vm->_globals.Bob[v28]._activeFl) AvantTri(TRI_BOB, v28, v19); } - } while (v28 != 35); + } } // Display VBOB @@ -1450,11 +1436,14 @@ void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, spriteData, a2, a3, a5, a6, a7, a8); } -void ObjectsManager::CLEAR_SPR() { +/** + * Clear sprite structure + */ +void ObjectsManager::clearSprite() { for (int idx = 0; idx < MAX_SPRITE; idx++) { _sprite[idx].field1C = g_PTRNUL; _sprite[idx]._spriteData = g_PTRNUL; - _sprite[idx].field0 = 0; + _sprite[idx]._animationType = 0; } for (int idx = 0; idx < MAX_SPRITE; idx++) { @@ -1469,7 +1458,7 @@ void ObjectsManager::CLEAR_SPR() { void ObjectsManager::SPRITE_ON(int idx) { assert (idx <= MAX_SPRITE); - _sprite[idx].field0 = 1; + _sprite[idx]._animationType = 1; } void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { @@ -1485,7 +1474,7 @@ void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, _sprite[idx].field24 = 0; _sprite[idx].field26 = 0; _sprite[idx].field22 = 0; - _sprite[idx].field0 = 0; + _sprite[idx]._animationType = 0; _sprite[idx].field28 = false; _sprite[idx].fieldE = a7; if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') @@ -1505,7 +1494,7 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, _sprite[idx].field26 = 0; _sprite[idx].fieldC = 0; _sprite[idx].fieldE = 0; - _sprite[idx].field0 = 1; + _sprite[idx]._animationType = 1; _sprite[idx].field22 = 0; _sprite[idx].field14 = a5; if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') @@ -1517,35 +1506,15 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, } } -void ObjectsManager::SPRITE_OFF(int idx) { - _sprite[idx].field0 = 3; +/** + * Freeze sprite animation and free its memory + */ +void ObjectsManager::removeSprite(int idx) { + // Type 3 was also used by freeSprite(), which has been removed as it wasn't used + _sprite[idx]._animationType = 3; _sprite[idx].field1C = _vm->_globals.freeMemory(_sprite[idx].field1C); } -void ObjectsManager::SPRITE_GEL(int idx) { - _sprite[idx].field0 = 3; -} - -int ObjectsManager::SXSPR(int idx) { - assert (idx <= MAX_SPRITE); - return getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); -} - -int ObjectsManager::SYSPR(int idx) { - assert (idx <= MAX_SPRITE); - return getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); -} - -int ObjectsManager::POSISPR(int idx) { - return _sprite[idx].field22 / 6; -} - -void ObjectsManager::SETPOSISPR(int idx, int a2) { - _sprite[idx].field22 = 6 * a2; - _sprite[idx].field24 = 0; - _sprite[idx].field26 = 0; -} - /** * Set Sprite X coordinate */ @@ -2586,7 +2555,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANX = getSpriteX(0); _vm->_globals.PLANY = getSpriteY(0); _vm->_globals.PLANI = 1; - SPRITE_OFF(0); + removeSprite(0); _vm->_globals.AFFLI = false; _spritePtr = _vm->_globals.freeMemory(_spritePtr); CLEAR_ECRAN(); @@ -2897,7 +2866,7 @@ LABEL_64: // Clear Screen void ObjectsManager::CLEAR_ECRAN() { - CLEAR_SPR(); + clearSprite(); _vm->_graphicsManager.FIN_VISU(); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); @@ -2966,12 +2935,12 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals.ECRAN; - loc->field4 = _sprite[0].field0; + loc->field4 = _sprite[0]._animationType; - SPRITE_OFF(1); + removeSprite(1); SPRITE(_vm->_globals.TETE, loc->_pos, 1, 3, loc->field4, 0, 20, 127); SPRITE_ON(1); - SPRITE_OFF(0); + removeSprite(0); _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 0; @@ -2995,10 +2964,10 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_location = _vm->_globals.ECRAN; loc->field4 = _sprite[0].fieldC; - SPRITE_OFF(1); + removeSprite(1); SPRITE(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); SPRITE_ON(1); - SPRITE_OFF(0); + removeSprite(0); _vm->_globals.SAUVEGARDE->data[svField354] = 0; _vm->_globals.SAUVEGARDE->data[svField356] = 1; @@ -5372,7 +5341,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); if (_vm->_globals.ECRAN == 61) - SPRITE_OFF(0); + removeSprite(0); CLEAR_ECRAN(); _vm->_globals.iRegul = 0; } @@ -5520,10 +5489,10 @@ LABEL_70: if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = false; - SPRITE_OFF(0); + removeSprite(0); _vm->_globals.AFFLI = false; if (DEUXPERSO == true) { - SPRITE_OFF(1); + removeSprite(1); DEUXPERSO = false; } if (!animFile.empty()) diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index c4cf6f4830..5793fc5fe3 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -32,7 +32,7 @@ namespace Hopkins { struct SpriteItem { - int field0; + int _animationType; const byte *_spriteData; Common::Point _spritePos; int fieldC; @@ -163,16 +163,11 @@ public: int getSpriteY(int idx); void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8); - void CLEAR_SPR(); + void clearSprite(); void SPRITE_ON(int idx); void SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5); - void SPRITE_OFF(int idx); - void SPRITE_GEL(int idx); - int SXSPR(int idx); - int SYSPR(int idx); - int POSISPR(int idx); - void SETPOSISPR(int idx, int a2); + void removeSprite(int idx); void setSpriteX(int idx, int xp); void setSpriteIndex(int idx, int spriteIndex); void setSpriteY(int idx, int yp); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 54212b992d..704f3763f6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -537,7 +537,7 @@ LABEL_1141: if (v76 == 8) _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); if (v76 == 6) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_ONE(20, 0, 14, 4); } if (v76 == 12) { @@ -692,7 +692,7 @@ LABEL_1141: _vm->_globals._disableInventFl = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_graphicsManager.FIN_VISU(); @@ -838,7 +838,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); @@ -915,7 +915,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); int v18 = 0; @@ -953,7 +953,7 @@ LABEL_1141: } if (v76 == 49) { _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); int v19 = 12; if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) @@ -990,7 +990,7 @@ LABEL_1141: _vm->_globals.CACHE_ON(); } if (v76 == 80) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(12); _vm->_objectsManager.BOBANIM_ON(13); _vm->_objectsManager.SET_BOBPOSI(12, 0); @@ -1047,7 +1047,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(11); _vm->_objectsManager.BOBANIM_ON(8); _vm->_objectsManager.SET_BOBPOSI(11, 0); @@ -1101,7 +1101,7 @@ LABEL_1141: _vm->_objectsManager.SET_BOBPOSI(9, 0); _vm->_objectsManager.SET_BOBPOSI(10, 0); _vm->_objectsManager.SET_BOBPOSI(12, 0); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1305,7 +1305,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { @@ -1400,7 +1400,7 @@ LABEL_1141: _vm->_soundManager.DEL_SAMPLE(1); } if (v76 == 106) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(4); _vm->_objectsManager.SET_BOBPOSI(4, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); @@ -1437,7 +1437,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 107) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); @@ -1493,7 +1493,7 @@ LABEL_1141: _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); } if (v76 == 211) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_globals.CACHE_OFF(); _vm->_animationManager.NO_SEQ = true; _vm->_globals.NO_VISU = false; @@ -1598,7 +1598,7 @@ LABEL_1141: } if (v76 == 203) { _vm->_globals.NO_VISU = true; - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(4); do { if (_vm->shouldQuit()) @@ -1613,7 +1613,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 204) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(3); _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); int v41 = 0; @@ -1633,7 +1633,7 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 205) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); int v42 = 0; @@ -1654,7 +1654,7 @@ LABEL_1141: } if (v76 == 175) { _vm->_objectsManager.setSpriteIndex(0, 55); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(9); _vm->_objectsManager.BOBANIM_ON(10); _vm->_objectsManager.BOB_OFFSET(10, 300); @@ -1726,7 +1726,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); int v45 = 0; _vm->_objectsManager.BOBANIM_ON(7); do { @@ -1751,7 +1751,7 @@ LABEL_1141: } if (v76 == 231) { _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(12); do { if (_vm->shouldQuit()) @@ -1774,7 +1774,7 @@ LABEL_1141: } if (v76 == 233) { _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.BOBANIM_ON(11); int v46 = 0; do { @@ -1898,7 +1898,7 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); } if (v76 == 239) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); } @@ -1990,7 +1990,7 @@ LABEL_1141: if (v76 == 51) { _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_graphicsManager.FIN_VISU(); @@ -2195,7 +2195,7 @@ LABEL_1141: _vm->_globals.SAUVEGARDE->data[svField399] = 1; } if (v76 == 246) { - _vm->_objectsManager.SPRITE_OFF(0); + _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_ONE(6, 0, 15, 0); _vm->_objectsManager.PERSO_ON = true; _vm->_graphicsManager.NB_SCREEN(); -- cgit v1.2.3 From c1aafc9b47f21608c19a686f4eeab243cea036fe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Dec 2012 02:15:32 +0100 Subject: HOPKINS: Rename methods in ObjectsManager, Globals and GraphicsManager --- engines/hopkins/anim.cpp | 170 ++++++++++----------- engines/hopkins/computer.cpp | 44 +++--- engines/hopkins/dialogs.cpp | 64 ++++---- engines/hopkins/events.cpp | 16 +- engines/hopkins/font.cpp | 22 +-- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/graphics.cpp | 249 ++++++++++++++++-------------- engines/hopkins/graphics.h | 30 ++-- engines/hopkins/hopkins.cpp | 352 +++++++++++++++++++++---------------------- engines/hopkins/menu.cpp | 6 +- engines/hopkins/objects.cpp | 199 ++++++++++++------------ engines/hopkins/objects.h | 8 +- engines/hopkins/saveload.cpp | 2 +- engines/hopkins/script.cpp | 24 +-- engines/hopkins/talk.cpp | 48 +++--- 16 files changed, 631 insertions(+), 611 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a1b318c103..313d7a9ee1 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -60,7 +60,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui return; hasScreenCopy = false; - screenP = _vm->_graphicsManager.VESA_SCREEN; + screenP = _vm->_graphicsManager._vesaScreen; ptr = _vm->_globals.allocMemory(0x14u); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); @@ -75,9 +75,9 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui f.read(screenP, nbytes); if (_clearAnimationFl) { - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); } if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { hasScreenCopy = true; @@ -86,16 +86,16 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } if (NO_SEQ) { if (hasScreenCopy) - memcpy(screenCopy, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 0x4B000u); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager._rateCounter = 0; @@ -141,7 +141,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) { if (*screenP != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); @@ -150,7 +150,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } else if (*screenP != kByteStop) { _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); } @@ -209,7 +209,7 @@ EXIT: _vm->_graphicsManager.FADE_LINUX = 0; f.close(); ptr = _vm->_globals.freeMemory(ptr); - _vm->_graphicsManager.NOLOCK = false; + _vm->_graphicsManager._skipVideoLockFl = false; } /** @@ -237,13 +237,13 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager.nbrligne == 1280) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; - v12 = _vm->_graphicsManager.VESA_SCREEN; + v12 = _vm->_graphicsManager._vesaScreen; v13 = _vm->_globals.allocMemory(0x14u); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); @@ -266,10 +266,10 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.Cls_Pal(); v11 = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); - _vm->_graphicsManager.SCROLL_ECRAN(0); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.scrollScreen(0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.max_x = SCREEN_WIDTH; if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v8 = 1; @@ -278,16 +278,16 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint } if (_vm->_animationManager.NO_SEQ) { if (v8 == 1) - memcpy(ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 0x4B000u); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (v8) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll16(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager._rateCounter = 0; @@ -304,37 +304,37 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->_eventsManager._rateCounter >= a2) goto LABEL_48; } - if (_vm->_graphicsManager.NOLOCK == true) + if (_vm->_graphicsManager._skipVideoLockFl == true) goto LABEL_114; if (v8 == 1) ptr = _vm->_globals.freeMemory(ptr); _vm->_globals.freeMemory(v13); f.close(); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); _vm->_graphicsManager.Cls_Pal(); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.SCROLL_ECRAN(v11); + _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } LABEL_112: - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.FADE_INS(); } @@ -361,7 +361,7 @@ LABEL_48: break; LABEL_77: _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (v8) { if (*v12 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); @@ -370,7 +370,7 @@ LABEL_77: } else if (*v12 != kByteStop) { _vm->_graphicsManager.Copy_Video_Vbe16(v12); } - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); LABEL_88: @@ -378,34 +378,34 @@ LABEL_88: if (_vm->_globals.iRegul == 1) { while (_vm->_eventsManager._escKeyFl != true) { if (redrawAnim() == true) { - if (_vm->_graphicsManager.NOLOCK == true) + if (_vm->_graphicsManager._skipVideoLockFl == true) goto LABEL_114; if (v8 == 1) ptr = _vm->_globals.freeMemory(ptr); _vm->_globals.freeMemory(v13); f.close(); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); _vm->_graphicsManager.Cls_Pal(); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.SCROLL_ECRAN(v11); + _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } goto LABEL_112; } @@ -420,34 +420,34 @@ LABEL_88: } while (_vm->_eventsManager._escKeyFl != true) { if (redrawAnim() == true) { - if (_vm->_graphicsManager.NOLOCK == true) + if (_vm->_graphicsManager._skipVideoLockFl == true) break; if (v8 == 1) ptr = _vm->_globals.freeMemory(ptr); _vm->_globals.freeMemory(v13); f.close(); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); _vm->_graphicsManager.Cls_Pal(); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.SCROLL_ECRAN(v11); + _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); _vm->_graphicsManager.max_x = SCREEN_WIDTH; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } goto LABEL_112; } @@ -457,7 +457,7 @@ LABEL_88: goto LABEL_77; } LABEL_114: - _vm->_graphicsManager.NOLOCK = false; + _vm->_graphicsManager._skipVideoLockFl = false; f.close(); if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { @@ -506,29 +506,29 @@ LABEL_114: _vm->_graphicsManager.FADE_LINUX = 0; _vm->_globals.freeMemory(v13); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); _vm->_graphicsManager.Cls_Pal(); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.SCROLL_ECRAN(v11); + _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.SCANLINE(0x500u); _vm->_graphicsManager.max_x = 1280; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.max_x = SCREEN_WIDTH; - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.FADE_INS(); _vm->_graphicsManager.DD_VBL(); } @@ -828,13 +828,13 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; } - v9 = _vm->_graphicsManager.VESA_SCREEN; + v9 = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(0x16u); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) @@ -854,7 +854,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } if (_vm->_animationManager.NO_SEQ) { if (v7 == 1) - memcpy(ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 0x4B000u); if (!_vm->getIsDemo()) { _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -863,12 +863,12 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (v7) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll16(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } if (_vm->getIsDemo()) { @@ -930,7 +930,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } while (_vm->_eventsManager._rateCounter < rate2); } _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (v7) { if (*v9 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v9, ptr); @@ -939,7 +939,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } else if (*v9 != kByteStop) { _vm->_graphicsManager.Copy_Video_Vbe16a(v9); } - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); } @@ -958,11 +958,11 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } _vm->_eventsManager._rateCounter = 0; LABEL_59: - _vm->_graphicsManager.NOLOCK = false; + _vm->_graphicsManager._skipVideoLockFl = false; f.close(); if (!NO_COUL) { - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_eventsManager._mouseFl = true; @@ -991,7 +991,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u return; _vm->_eventsManager._mouseFl = false; - v10 = _vm->_graphicsManager.VESA_SCREEN; + v10 = _vm->_graphicsManager._vesaScreen; v11 = _vm->_globals.allocMemory(0x16u); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); @@ -1018,17 +1018,17 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->_animationManager.NO_SEQ) { if (v7 == 1) { assert(ptr != NULL); - memcpy((void *)ptr, _vm->_graphicsManager.VESA_BUFFER, 0x4B000u); + memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 0x4B000u); } _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); if (v7) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } _vm->_eventsManager._rateCounter = 0; @@ -1047,7 +1047,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u goto LABEL_23; } LABEL_48: - if (_vm->_graphicsManager.NOLOCK == true) + if (_vm->_graphicsManager._skipVideoLockFl == true) goto LABEL_54; if (v7 == 1) ptr = _vm->_globals.freeMemory(ptr); @@ -1074,7 +1074,7 @@ LABEL_23: break; LABEL_33: _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (v7) { if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); @@ -1083,7 +1083,7 @@ LABEL_33: } else if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_Video_Vbe16a(v10); } - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.VERIF_SOUND(); LABEL_44: diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 28526fb5e8..bfc5ca92ff 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -71,9 +71,9 @@ void ComputerManager::setVideoMode() { */ void ComputerManager::setTextMode() { _vm->_graphicsManager.Cls_Pal(); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; @@ -82,7 +82,7 @@ void ComputerManager::setTextMode() { _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; - _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); + _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.FADE_INW(); loadMenu(); _vm->_eventsManager._mouseFl = false; @@ -92,7 +92,7 @@ void ComputerManager::setTextMode() { * Clear the screen */ void ComputerManager::clearScreen() { - _vm->_graphicsManager.LOAD_IMAGE("WINTEXT"); + _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.FADE_INW(); } @@ -284,9 +284,9 @@ void ComputerManager::showComputer(ComputerEnum mode) { } } } - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); restoreFBIRoom(); } else { @@ -297,10 +297,10 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(1000); - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x4AFFFu); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + memset(_vm->_graphicsManager._vesaBuffer, 0, 0x4AFFFu); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); restoreFBIRoom(); _vm->_eventsManager.mouseOff(); @@ -452,13 +452,13 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _inputBuf[textIndex--] = 0; x1 -= _vm->_globals.police_l; x2 = x1 + 2 * _vm->_globals.police_l; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, x2, yp + 12); _vm->_fontManager.displayTextVesa(x1, yp, "_", -4); } if (mappedChar != '*') { newChar = mappedChar; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); _inputBuf[textIndex] = newChar; @@ -470,8 +470,8 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager.VESA_SCREEN, x1, yp, _vm->_globals.police_l, - 12, _vm->_graphicsManager.VESA_BUFFER, x1, yp); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, + 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); _vm->_eventsManager.VBL(); @@ -670,9 +670,9 @@ void ComputerManager::loadHiscore() { * VGA 256 col */ void ComputerManager::setModeVGA256() { - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.Cls_Video(); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.clearScreen(); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.SCANLINE(0x140u); } @@ -689,7 +689,7 @@ void ComputerManager::newLevel() { ++_breakoutLives; if (_breakoutLives > 11) _breakoutLives = 11; - _vm->_graphicsManager.LOAD_IMAGEVGA("CASSEF.PCX"); + _vm->_graphicsManager.loadVgaImage("CASSEF.PCX"); displayLives(); _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); @@ -885,7 +885,7 @@ int ComputerManager::displayHiscores() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); loadHiscore(); - _vm->_graphicsManager.LOAD_IMAGEVGA("HISCORE.PCX"); + _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -936,7 +936,7 @@ void ComputerManager::getScoreName() { char curChar; byte *ptr; - _vm->_graphicsManager.LOAD_IMAGEVGA("NAME.PCX"); + _vm->_graphicsManager.loadVgaImage("NAME.PCX"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 9cb647b112..7f45d06dc8 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -240,10 +240,10 @@ void DialogsManager::showOptionsDialog() { doneFlag = true; } - if (!_vm->_graphicsManager.MANU_SCROLL) - _vm->_globals.opt_scrtype = 2; - else if (_vm->_graphicsManager.MANU_SCROLL == 1) + if (_vm->_graphicsManager.MANU_SCROLL) _vm->_globals.opt_scrtype = 1; + else + _vm->_globals.opt_scrtype = 2; if (_vm->_globals._speed == 1) _vm->_globals.opt_vitesse = 6; @@ -292,8 +292,8 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.VBL(); } while (!doneFlag); - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_graphicsManager.ofscroll + 164, - 107, 335, 215, _vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll + 164, 107); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager.ofscroll + 164, + 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll + 164, 107); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, _vm->_graphicsManager.ofscroll + 498, 320); @@ -349,7 +349,7 @@ LABEL_7: int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, v19 + 300, 414, 0, 0, 0, 0); int v15 = 0; int v4 = 0; @@ -360,7 +360,7 @@ LABEL_7: int v6 = _vm->_globals._inventory[v4]; if (v6 && v4 <= 29) { byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, v7, v19 + v16 + 6, + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); _vm->_globals.freeMemory(v7); } @@ -368,7 +368,7 @@ LABEL_7: }; v15 += 38; } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager._curMouseButton = 0; bool v20 = false; int v13 = 0; @@ -444,7 +444,7 @@ LABEL_7: if (_inventDisplayedFl) { _inventDisplayedFl = false; // v9 = 114; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, v19, 114, v18, v17, _vm->_graphicsManager.VESA_BUFFER, v19, 114); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, v19, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, v19, 114); _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; } @@ -474,8 +474,8 @@ LABEL_7: void DialogsManager::inventAnim() { if (!_vm->_globals._disableInventFl) { if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, - _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; } @@ -483,32 +483,32 @@ void DialogsManager::inventAnim() { if (_vm->_objectsManager._visibleFl) { if (_vm->_objectsManager.I_old_x <= 1) _vm->_objectsManager.I_old_x = 2; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_objectsManager.I_old_x, 27, 48, 38, - _vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.I_old_x, 27); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); int v0 = _vm->_graphicsManager.ofscroll + 2; int v1 = _vm->_graphicsManager.ofscroll + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.ICONE, v1 + 300, 327, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); _vm->_objectsManager.I_old_x = v0; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } } @@ -571,7 +571,7 @@ void DialogsManager::showLoadGame() { } while (_vm->_eventsManager.getMouseButton() != 1); } while (!slotNumber); _vm->_objectsManager.SL_FLAG = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x + 183, 60); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); @@ -604,7 +604,7 @@ void DialogsManager::showSaveGame() { } while (!_vm->shouldQuit() && !slotNumber); _vm->_objectsManager.SL_FLAG = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager.VESA_BUFFER, _vm->_eventsManager._startPos.x + 183, 60); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); @@ -644,18 +644,18 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVE2.SPR"); _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); if (_vm->_globals.FR) { if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 525, 375, 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 525, 375, 1); if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 515, 375, 2); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 515, 375, 2); } else { if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 535, 372, 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 535, 372, 1); if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 539, 372, 2); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 539, 372, 2); } for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { @@ -667,22 +667,22 @@ void DialogsManager::showSaveLoad(int a1) { switch (slotNumber) { case 1: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 190, 112, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 112, 0x80u, 87); break; case 2: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 112, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 112, 0x80u, 87); break; case 3: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 190, 203, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 203, 0x80u, 87); break; case 4: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 203, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 203, 0x80u, 87); break; case 5: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 190, 294, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 294, 0x80u, 87); break; case 6: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, thumb, _vm->_eventsManager._startPos.x + 323, 294, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 294, 0x80u, 87); break; } @@ -692,7 +692,7 @@ void DialogsManager::showSaveLoad(int a1) { } } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); _vm->_objectsManager.SL_FLAG = true; _vm->_objectsManager.SL_MODE = a1; _vm->_objectsManager.SL_X = 0; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 311ab92686..d75d5a098d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -316,18 +316,18 @@ void EventsManager::VBL() { int yp = 0; if (_vm->_graphicsManager.REDRAW) { - _vm->_graphicsManager.DD_Lock(); + _vm->_graphicsManager.lockScreen(); if (_breakoutFl) { - _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager._vesaBuffer); _vm->_graphicsManager.REDRAW = 0; } else { if (_vm->_globals.iRegul == 3) - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 50, 0x280u, 340, 0, 50); + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 50, 0x280u, 340, 0, 50); else - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.ofscroll, 20, 0x280u, 440, 0, 20); + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 20, 0x280u, 440, 0, 20); --_vm->_graphicsManager.REDRAW; } - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.unlockScreen(); } if (_mouseFl == true) { v1 = 20; @@ -441,9 +441,9 @@ LABEL_65: _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { _vm->_fontManager.hideText(9); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.SCROLL, 20, SCREEN_WIDTH, 440, 0, 20); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.SCROLL, 20, SCREEN_WIDTH, 440, 0, 20); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); if (_vm->_globals.NBBLOC) { diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index c7d48d3717..03f513fa64 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -156,7 +156,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int height = _text[idx]._height; int width = _text[idx]._width; _vm->_graphicsManager.Restore_Mem( - _vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, xp, yp, @@ -393,15 +393,15 @@ LABEL_57: if (ptrd == g_PTRNUL) { error("Cutting a block for text box (%d)", v49); } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager.TABLE_COUL, v49); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, ptrd, v56, v55, v53, v51); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); _vm->_globals.freeMemory(ptrd); - _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager.VESA_BUFFER, v56, v55, v53, (byte)-2); - _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager.VESA_BUFFER, v56, v51 + v55, v53, (byte)-2); - _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager.VESA_BUFFER, v56, v70, v51, (byte)-2); - _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager.VESA_BUFFER, v53 + v56, v70, v51, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, v56, v55, v53, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, v56, v51 + v55, v53, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, v56, v70, v51, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, v53 + v56, v70, v51, (byte)-2); } _text[idx]._lineCount = lineCount; int v75 = v73 + 5; @@ -430,7 +430,7 @@ LABEL_57: _text[idx]._textBlock = ptre; _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_BUFFER, _text[idx]._textBlock, v56, v55, _text[idx]._width, blockHeight); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, v56, v55, _text[idx]._width, blockHeight); } _tempText = _vm->_globals.freeMemory(_tempText); } @@ -452,7 +452,7 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, break; if (currChar >= 32) { charIndex = currChar - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, currentX, yp, currChar - 32, col); currentX += _vm->_objectsManager.getWidth(_vm->_globals.police, charIndex); } @@ -470,7 +470,7 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, xp, yp, characterIndex, col); xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); } @@ -502,7 +502,7 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col break; if (v7 >= 32) { v5 = v7 - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.police, v9, yp, v7 - 32, fontCol); + _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, v9, yp, v7 - 32, fontCol); v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5); v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5); _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 6010ed7574..fda679daa4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -171,7 +171,7 @@ Globals::Globals() { AFFIVBL = false; NOT_VERIF = 0; PERSO_TYPE = 0; - GOACTION = 0; + GOACTION = false; NECESSAIRE = false; Compteur = 0; ACTION_SENS = 0; @@ -555,7 +555,7 @@ void Globals::CACHE_ADD(int idx) { } // Load Cache -void Globals::CHARGE_CACHE(const Common::String &file) { +void Globals::loadCache(const Common::String &file) { byte *v2 = g_PTRNUL; byte *spriteData; byte *ptr; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 937483f6bb..85bd6cde89 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -444,7 +444,7 @@ public: bool NOPARLE; bool PLAN_FLAG; bool NECESSAIRE; - int GOACTION; + bool GOACTION; int Compteur; int ACTION_SENS; int SegmentEnCours; @@ -499,7 +499,7 @@ public: void CACHE_OFF(int v1 = 0); void CACHE_SUB(int idx); void CACHE_ADD(int idx); - void CHARGE_CACHE(const Common::String &file); + void loadCache(const Common::String &file); void B_CACHE_OFF(int idx); }; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7c630dcf42..44c775b660 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -34,14 +34,14 @@ namespace Hopkins { GraphicsManager::GraphicsManager() { - _lockCtr = 0; + _lockCounter = 0; SDL_MODEYES = false; XSCREEN = YSCREEN = 0; WinScan = 0; PAL_PIXELS = NULL; nbrligne = 0; Linear = false; - VideoPtr = NULL; + _videoPtr = NULL; ofscroll = 0; SCROLL = 0; PCX_L = PCX_H = 0; @@ -53,7 +53,7 @@ GraphicsManager::GraphicsManager() { Agr_Flag_x = Agr_Flag_y = 0; FADESPD = 15; FADE_LINUX = 0; - NOLOCK = false; + _skipVideoLockFl = false; no_scroll = 0; REDRAW = false; min_x = 0; @@ -78,8 +78,8 @@ GraphicsManager::GraphicsManager() { } GraphicsManager::~GraphicsManager() { - _vm->_globals.freeMemory(VESA_SCREEN); - _vm->_globals.freeMemory(VESA_BUFFER); + _vm->_globals.freeMemory(_vesaScreen); + _vm->_globals.freeMemory(_vesaBuffer); } void GraphicsManager::setParent(HopkinsEngine *vm) { @@ -88,26 +88,26 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { if (_vm->getIsDemo()) { if (_vm->getPlatform() == Common::kPlatformLinux) // CHECKME: Should be 0? - MANU_SCROLL = 1; + MANU_SCROLL = true; else - MANU_SCROLL = 0; + MANU_SCROLL = false; SPEED_SCROLL = 16; } else { - MANU_SCROLL = 0; + MANU_SCROLL = false; SPEED_SCROLL = 32; } } -void GraphicsManager::SET_MODE(int width, int height) { +void GraphicsManager::setGraphicalMode(int width, int height) { if (!SDL_MODEYES) { Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); initGraphics(width, height, true, &pixelFormat16); // Init surfaces - VESA_SCREEN = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); - VESA_BUFFER = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + _vesaScreen = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + _vesaBuffer = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); - VideoPtr = NULL; + _videoPtr = NULL; XSCREEN = width; YSCREEN = height; @@ -124,70 +124,84 @@ void GraphicsManager::SET_MODE(int width, int height) { } } -void GraphicsManager::DD_Lock() { - if (!NOLOCK) { - if (_lockCtr++ == 0) - VideoPtr = g_system->lockScreen(); +/** + * (try to) Lock Screen + */ +void GraphicsManager::lockScreen() { + if (!_skipVideoLockFl) { + if (_lockCounter++ == 0) + _videoPtr = g_system->lockScreen(); } } -void GraphicsManager::DD_Unlock() { - assert(VideoPtr); - if (--_lockCtr == 0) { +/** + * (try to) Unlock Screen + */ +void GraphicsManager::unlockScreen() { + assert(_videoPtr); + if (--_lockCounter == 0) { g_system->unlockScreen(); - VideoPtr = NULL; + _videoPtr = NULL; } } -// Clear Screen -void GraphicsManager::Cls_Video() { - assert(VideoPtr); - - VideoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); +/** + * Clear Screen + */ +void GraphicsManager::clearScreen() { + assert(_videoPtr); + _videoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); } -void GraphicsManager::LOAD_IMAGE(const Common::String &file) { +/** + * Load Image + */ +void GraphicsManager::loadImage(const Common::String &file) { Common::String filename = Common::String::format("%s.PCX", file.c_str()); - CHARGE_ECRAN(filename); + loadScreen(filename); INIT_TABLE(165, 170, Palette); } - -void GraphicsManager::LOAD_IMAGEVGA(const Common::String &file) { +/** + * Load VGA Image + */ +void GraphicsManager::loadVgaImage(const Common::String &file) { SCANLINE(SCREEN_WIDTH); - DD_Lock(); - Cls_Video(); - DD_Unlock(); + lockScreen(); + clearScreen(); + unlockScreen(); _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); - A_PCX320(VESA_SCREEN, _vm->_globals.NFICHIER, Palette); - memcpy(VESA_BUFFER, VESA_SCREEN, 0xFA00u); + A_PCX320(_vesaScreen, _vm->_globals.NFICHIER, Palette); + memcpy(_vesaBuffer, _vesaScreen, 0xFA00u); SCANLINE(320); max_x = 320; - DD_Lock(); - CopyAsm16(VESA_BUFFER); - DD_Unlock(); + lockScreen(); + CopyAsm16(_vesaBuffer); + unlockScreen(); FADE_IN_CASSE(); } -// Load Screen -void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { +/** + * Load Screen + */ +void GraphicsManager::loadScreen(const Common::String &file) { Common::File f; bool flag = true; if (_vm->_fileManager.searchCat(file, 6) == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); if (!f.open(_vm->_globals.NFICHIER)) - error("CHARGE_ECRAN - %s", file.c_str()); + error("loadScreen - %s", file.c_str()); f.seek(0, SEEK_END); f.close(); flag = false; } - SCROLL_ECRAN(0); - A_PCX640_480((byte *)VESA_SCREEN, file, Palette, flag); + scrollScreen(0); + A_PCX640_480((byte *)_vesaScreen, file, Palette, flag); SCROLL = 0; OLD_SCROLL = 0; @@ -196,25 +210,25 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) { if (!DOUBLE_ECRAN) { SCANLINE(SCREEN_WIDTH); max_x = SCREEN_WIDTH; - DD_Lock(); - Cls_Video(); - m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_Unlock(); + lockScreen(); + clearScreen(); + m_scroll16(_vesaScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + unlockScreen(); } else { SCANLINE(SCREEN_WIDTH * 2); max_x = SCREEN_WIDTH * 2; - DD_Lock(); - Cls_Video(); - DD_Unlock(); - - if (MANU_SCROLL == 1) { - DD_Lock(); - m_scroll16(VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_Unlock(); + lockScreen(); + clearScreen(); + unlockScreen(); + + if (MANU_SCROLL) { + lockScreen(); + m_scroll16(_vesaScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + unlockScreen(); } } - memcpy(VESA_BUFFER, VESA_SCREEN, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + memcpy(_vesaBuffer, _vesaScreen, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); } void GraphicsManager::INIT_TABLE(int minIndex, int maxIndex, byte *palette) { @@ -234,13 +248,14 @@ void GraphicsManager::INIT_TABLE(int minIndex, int maxIndex, byte *palette) { TABLE_COUL[0] = 1; } -// Scroll Screen -int GraphicsManager::SCROLL_ECRAN(int amount) { +/** + * Scroll Screen + */ +void GraphicsManager::scrollScreen(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); _vm->_eventsManager._startPos.x = result; ofscroll = result; SCROLL = result; - return result; } void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold) { @@ -421,9 +436,9 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i const byte *src2P; unsigned int widthRemaining; - assert(VideoPtr); + assert(_videoPtr); srcP = xs + nbrligne2 * ys + surface; - destP = destX + WinScan * destY + (byte *)VideoPtr->pixels; + destP = destX + WinScan * destY + (byte *)_videoPtr->pixels; yNext = height; do { yCtr = yNext; @@ -442,11 +457,11 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i * Copies data from a 8-bit palette surface into the 16-bit screen */ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - DD_Lock(); + lockScreen(); - assert(VideoPtr); + assert(_videoPtr); const byte *srcP = xs + nbrligne2 * ys + surface; - uint16 *destP = (uint16 *)((byte *)VideoPtr->pixels + destX * 2 + WinScan * destY); + uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destX * 2 + WinScan * destY); for (int yp = 0; yp < height; ++yp) { // Copy over the line, using the source pixels as lookups into the pixels palette @@ -461,7 +476,7 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, destP += WinScan / 2; } - DD_Unlock(); + unlockScreen(); } // TODO: See if PAL_PIXELS can be converted to a uint16 array @@ -476,9 +491,9 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width const byte *srcCopyP; const byte *destCopyP; - assert(VideoPtr); + assert(_videoPtr); srcP = xs + nbrligne2 * ys + surface; - destP = destX + destX + WinScan * destY + (byte *)VideoPtr->pixels; + destP = destX + destX + WinScan * destY + (byte *)_videoPtr->pixels; yNext = height; Agr_x = 0; Agr_y = 0; @@ -541,9 +556,9 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, const byte *loopSrcP; int yCtr; - assert(VideoPtr); + assert(_videoPtr); srcP = xp + 320 * yp + surface; - destP = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)VideoPtr->pixels); + destP = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)_videoPtr->pixels); yCount = height; xCount = width; @@ -681,22 +696,22 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac void GraphicsManager::FADE_INS() { FADESPD = 1; - fade_in(Palette, 1, (const byte *)VESA_BUFFER); + fade_in(Palette, 1, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_OUTS() { FADESPD = 1; - fade_out(Palette, 1, (const byte *)VESA_BUFFER); + fade_out(Palette, 1, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_INW() { FADESPD = 15; - fade_in(Palette, 20, (const byte *)VESA_BUFFER); + fade_in(Palette, 20, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_OUTW() { FADESPD = 15; - fade_out(Palette, 20, (const byte *)VESA_BUFFER); + fade_out(Palette, 20, (const byte *)_vesaBuffer); } void GraphicsManager::setpal_vga256(const byte *palette) { @@ -787,9 +802,9 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { void GraphicsManager::FADE_IN_CASSE() { setpal_vga256(Palette); - DD_Lock(); - CopyAsm16(VESA_BUFFER); - DD_Unlock(); + lockScreen(); + CopyAsm16(_vesaBuffer); + unlockScreen(); DD_VBL(); } @@ -799,9 +814,9 @@ void GraphicsManager::FADE_OUT_CASSE() { memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); setpal_vga256(palette); - DD_Lock(); - CopyAsm16(VESA_BUFFER); - DD_Unlock(); + lockScreen(); + CopyAsm16(_vesaBuffer); + unlockScreen(); DD_VBL(); } @@ -875,7 +890,7 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { int destLen2; byte *destSlice2P; - assert(VideoPtr); + assert(_videoPtr); rleValue = 0; destOffset = 0; srcP = srcData; @@ -907,20 +922,20 @@ Video_Cont3_Vbe: if (srcByte == 211) { destLen1 = *(srcP + 1); rleValue = *(srcP + 2); - destSlice1P = destOffset + (byte *)VideoPtr->pixels; + destSlice1P = destOffset + (byte *)_videoPtr->pixels; destOffset += destLen1; memset(destSlice1P, rleValue, destLen1); srcP += 3; } else { destLen2 = (byte)(*srcP + 45); rleValue = *(srcP + 1); - destSlice2P = (byte *)(destOffset + (byte *)VideoPtr->pixels); + destSlice2P = (byte *)(destOffset + (byte *)_videoPtr->pixels); destOffset += destLen2; memset(destSlice2P, rleValue, destLen2); srcP += 2; } } else { - *(destOffset + (byte *)VideoPtr->pixels) = srcByte; + *(destOffset + (byte *)_videoPtr->pixels) = srcByte; ++srcP; ++destOffset; } @@ -930,7 +945,7 @@ Video_Cont3_Vbe: void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { const byte *srcP = srcData; int destOffset = 0; - assert(VideoPtr); + assert(_videoPtr); for (;;) { byte srcByte = *srcP; @@ -964,7 +979,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { if (srcByte == 211) { int pixelCount = *(srcP + 1); int pixelIndex = *(srcP + 2); - uint16 *destP = (uint16 *)((byte *)VideoPtr->pixels + destOffset * 2); + uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destOffset * 2); uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex); destOffset += pixelCount; @@ -975,7 +990,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } else { int pixelCount = srcByte - 211; int pixelIndex = *(srcP + 1); - uint16 *destP = (uint16 *)((byte *)VideoPtr->pixels + destOffset * 2); + uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destOffset * 2); uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex); destOffset += pixelCount; @@ -985,7 +1000,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { srcP += 2; } } else { - *((uint16 *)VideoPtr->pixels + destOffset) = *(uint16 *)(PAL_PIXELS + 2 * srcByte); + *((uint16 *)_videoPtr->pixels + destOffset) = *(uint16 *)(PAL_PIXELS + 2 * srcByte); ++srcP; ++destOffset; } @@ -1019,7 +1034,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { srcP += 5; } Video_Cont_Vbe16a: - WRITE_LE_UINT16((byte *)VideoPtr->pixels + destOffset * 2, READ_LE_UINT16(PAL_PIXELS + 2 * pixelIndex)); + WRITE_LE_UINT16((byte *)_videoPtr->pixels + destOffset * 2, READ_LE_UINT16(PAL_PIXELS + 2 * pixelIndex)); ++srcP; ++destOffset; } @@ -1273,7 +1288,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { return; SDL_NBLOCS = _vm->_globals.NBBLOC; - DD_Lock(); + lockScreen(); for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { BlocItem &bloc = _vm->_globals.BLOC[idx]; @@ -1282,7 +1297,7 @@ void GraphicsManager::Affiche_Segment_Vesa() { continue; if (_vm->_eventsManager._breakoutFl) { - Copy_Vga16(VESA_BUFFER, bloc._x1, bloc._y1, bloc._x2 - bloc._x1, bloc._y2 - bloc._y1, bloc._x1, bloc._y1); + Copy_Vga16(_vesaBuffer, bloc._x1, bloc._y1, bloc._x2 - bloc._x1, bloc._y2 - bloc._y1, bloc._x1, bloc._y1); dstRect.left = bloc._x1 * 2; dstRect.top = bloc._y1 * 2 + 30; dstRect.setWidth((bloc._x2 - bloc._x1) * 2); @@ -1294,22 +1309,22 @@ void GraphicsManager::Affiche_Segment_Vesa() { bloc._x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; // WORKAROUND: Original didn't lock the screen for access - DD_Lock(); - m_scroll16(VESA_BUFFER, bloc._x1, bloc._y1, bloc._x2 - bloc._x1, bloc._y2 - bloc._y1, bloc._x1 - _vm->_eventsManager._startPos.x, bloc._y1); + lockScreen(); + m_scroll16(_vesaBuffer, bloc._x1, bloc._y1, bloc._x2 - bloc._x1, bloc._y2 - bloc._y1, bloc._x1 - _vm->_eventsManager._startPos.x, bloc._y1); dstRect.left = bloc._x1 - _vm->_eventsManager._startPos.x; dstRect.top = bloc._y1; dstRect.setWidth(bloc._x2 - bloc._x1); dstRect.setHeight(bloc._y2 - bloc._y1); - DD_Unlock(); + unlockScreen(); } _vm->_globals.BLOC[idx]._activeFl = false; } _vm->_globals.NBBLOC = 0; - DD_Unlock(); + unlockScreen(); if (!_vm->_globals.BPP_NOAFF) { // SDL_UpdateRects(LinuxScr, SDL_NBLOCS, dstrect); } @@ -1322,11 +1337,11 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i width = _vm->_objectsManager.getWidth(objectData, idx); height = _vm->_objectsManager.getHeight(objectData, idx); if (*objectData == 78) { - Affiche_Perfect(VESA_SCREEN, objectData, xp + 300, yp + 300, idx, 0, 0, 0); - Affiche_Perfect(VESA_BUFFER, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + Affiche_Perfect(_vesaScreen, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + Affiche_Perfect(_vesaBuffer, objectData, xp + 300, yp + 300, idx, 0, 0, 0); } else { - Sprite_Vesa(VESA_BUFFER, objectData, xp + 300, yp + 300, idx); - Sprite_Vesa(VESA_SCREEN, objectData, xp + 300, yp + 300, idx); + Sprite_Vesa(_vesaBuffer, objectData, xp + 300, yp + 300, idx); + Sprite_Vesa(_vesaScreen, objectData, xp + 300, yp + 300, idx); } if (!_vm->_globals.NO_VISU) Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); @@ -1342,10 +1357,10 @@ void GraphicsManager::CopyAsm(const byte *surface) { byte *destPitch; const byte *srcPitch; - assert(VideoPtr); + assert(_videoPtr); srcP = surface; srcByte = 30 * WinScan; - destP = (byte *)VideoPtr->pixels + 30 * WinScan; + destP = (byte *)_videoPtr->pixels + 30 * WinScan; for (int yCtr = 200; yCtr != 0; yCtr--) { srcPitch = srcP; destPitch = destP; @@ -1379,9 +1394,9 @@ void GraphicsManager::CopyAsm16(const byte *surface) { byte *v10; const byte *v11; - assert(VideoPtr); + assert(_videoPtr); v1 = surface; - v2 = 30 * WinScan + (byte *)VideoPtr->pixels; + v2 = 30 * WinScan + (byte *)_videoPtr->pixels; v3 = 200; do { v11 = v1; @@ -1829,11 +1844,11 @@ void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int width = _vm->_objectsManager.getWidth(spriteData, spriteIndex); height = _vm->_objectsManager.getHeight(spriteData, spriteIndex); if (*spriteData == 78) { - Affiche_Perfect(VESA_SCREEN, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); - Affiche_Perfect(VESA_BUFFER, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); + Affiche_Perfect(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); + Affiche_Perfect(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); } else { - Sprite_Vesa(VESA_BUFFER, spriteData, xp + 300, yp + 300, spriteIndex); - Sprite_Vesa(VESA_SCREEN, spriteData, xp + 300, yp + 300, spriteIndex); + Sprite_Vesa(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex); + Sprite_Vesa(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex); } if (!_vm->_globals.NO_VISU) Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); @@ -2027,16 +2042,16 @@ void GraphicsManager::NB_SCREEN() { if (!_vm->_globals.NECESSAIRE) INIT_TABLE(50, 65, Palette); if (nbrligne == SCREEN_WIDTH) - Trans_bloc2(VESA_BUFFER, TABLE_COUL, 307200); + Trans_bloc2(_vesaBuffer, TABLE_COUL, 307200); if (nbrligne == 1280) - Trans_bloc2(VESA_BUFFER, TABLE_COUL, 614400); - DD_Lock(); - m_scroll16(VESA_BUFFER, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_Unlock(); - - destP = VESA_SCREEN; - srcP = VESA_BUFFER; - memcpy(VESA_SCREEN, VESA_BUFFER, 0x95FFCu); + Trans_bloc2(_vesaBuffer, TABLE_COUL, 614400); + lockScreen(); + m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + unlockScreen(); + + destP = _vesaScreen; + srcP = _vesaBuffer; + memcpy(_vesaScreen, _vesaBuffer, 0x95FFCu); srcP = srcP + 614396; destP = destP + 614396; *destP = *srcP; @@ -2092,7 +2107,7 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { const byte *srcP; byte byteVal; - assert(VideoPtr); + assert(_videoPtr); destOffset = 0; srcP = src; for (;;) { @@ -2115,7 +2130,7 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { srcP += 5; } Video_Cont_Vbe: - *((byte *)VideoPtr->pixels + destOffset) = byteVal; + *((byte *)_videoPtr->pixels + destOffset) = byteVal; ++srcP; ++destOffset; } @@ -2178,7 +2193,7 @@ void GraphicsManager::drawVerticalLine(byte *surface, int xp, int yp, int height } void GraphicsManager::MODE_VESA() { - SET_MODE(640, 480); + setGraphicalMode(640, 480); } } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 24ea17083a..3439439baa 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -51,9 +51,9 @@ class GraphicsManager { private: HopkinsEngine *_vm; - void CHARGE_ECRAN(const Common::String &file); + void loadScreen(const Common::String &file); public: - int _lockCtr; + int _lockCounter; bool SDL_MODEYES; int XSCREEN; int YSCREEN; @@ -66,16 +66,16 @@ public: byte Palette[PALETTE_EXT_BLOCK_SIZE]; byte OLD_PAL[PALETTE_EXT_BLOCK_SIZE]; bool Linear; - Graphics::Surface *VideoPtr; - byte *VESA_SCREEN; - byte *VESA_BUFFER; + Graphics::Surface *_videoPtr; + byte *_vesaScreen; + byte *_vesaBuffer; int ofscroll; int SCROLL; byte HEADER_PCX[128]; int PCX_L, PCX_H; bool DOUBLE_ECRAN; int OLD_SCROLL; - int MANU_SCROLL; + bool MANU_SCROLL; int SPEED_SCROLL; int nbrligne2; int Agr_x, Agr_y; @@ -83,7 +83,7 @@ public: int FADESPD; byte PALPCX[PALETTE_EXT_BLOCK_SIZE]; int FADE_LINUX; - bool NOLOCK; + bool _skipVideoLockFl; int no_scroll; Common::Rect dstrect[50]; int REDRAW; @@ -105,16 +105,14 @@ public: ~GraphicsManager(); void setParent(HopkinsEngine *vm); - 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 LOAD_IMAGEVGA(const Common::String &file); + void setGraphicalMode(int width, int height); + void lockScreen(); + void unlockScreen(); + void clearScreen(); + void loadImage(const Common::String &file); + void loadVgaImage(const Common::String &file); void INIT_TABLE(int minIndex, int maxIndex, byte *palette); - int SCROLL_ECRAN(int amount); + void scrollScreen(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ec88fe8f05..fc96102cea 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -137,12 +137,12 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Affiche_Version(1)"); - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); - _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); if (!_eventsManager._escKeyFl) @@ -158,7 +158,7 @@ bool HopkinsEngine::runWin95Demo() { _globals._speed = 1; for (int i = 1; i < 50; i++) { - _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 0, 0, 640, 440, _graphicsManager.VESA_BUFFER, 0, 0); + _graphicsManager.SCOPY(_graphicsManager._vesaScreen, 0, 0, 640, 440, _graphicsManager._vesaBuffer, 0, 0); _eventsManager.VBL(); } @@ -217,17 +217,17 @@ bool HopkinsEngine::runWin95Demo() { if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); + _graphicsManager.loadImage("fondfr"); if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.loadImage("fondan"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); if (!_globals.CENSURE) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); @@ -329,9 +329,9 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Ligne_Long = 20; if (_globals.SAUVEGARDE->data[svField225]) { if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("ENDFR"); + _graphicsManager.loadImage("ENDFR"); else if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("ENDUK"); + _graphicsManager.loadImage("ENDUK"); _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); do @@ -413,9 +413,9 @@ bool HopkinsEngine::runWin95Demo() { case 150: _soundManager.WSOUND(28); _globals.iRegul = 4; // CHECKME! - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -425,11 +425,11 @@ bool HopkinsEngine::runWin95Demo() { case 151: _soundManager.WSOUND(28); _globals.iRegul = 4; // CHECKME! - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); - _graphicsManager.LOAD_IMAGE("njour3a"); + _graphicsManager.loadImage("njour3a"); _graphicsManager.FADE_INW(); _eventsManager.delay(5000); _graphicsManager.FADE_OUTW(); @@ -440,9 +440,9 @@ bool HopkinsEngine::runWin95Demo() { case 152: _soundManager.WSOUND(28); _globals.iRegul = 4; // CHECKME! - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -461,11 +461,11 @@ bool HopkinsEngine::runLinuxDemo() { _globals.HELICO = 0; _eventsManager.mouseOff(); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); - _graphicsManager.LOAD_IMAGE("LINUX"); + _graphicsManager.loadImage("LINUX"); _graphicsManager.FADE_INW(); _eventsManager.delay(1500); _graphicsManager.FADE_OUTW(); @@ -475,7 +475,7 @@ bool HopkinsEngine::runLinuxDemo() { _animationManager.playAnim("MP.ANM", 10, 16, 200); } - _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -540,20 +540,20 @@ bool HopkinsEngine::runLinuxDemo() { if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); + _graphicsManager.loadImage("fondfr"); if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.loadImage("fondan"); if (_globals.FR == 2) - _graphicsManager.LOAD_IMAGE("fondes"); + _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; @@ -743,12 +743,12 @@ bool HopkinsEngine::runLinuxDemo() { _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.DD_VBL(); - memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); - memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + memset(_graphicsManager._vesaBuffer, 0, 0x4B000u); + memset(_graphicsManager._vesaScreen, 0, 0x4B000u); _graphicsManager.Cls_Pal(); _graphicsManager.RESET_SEGMENT_VESA(); break; @@ -760,9 +760,9 @@ bool HopkinsEngine::runLinuxDemo() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 115: @@ -772,18 +772,18 @@ bool HopkinsEngine::runLinuxDemo() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); @@ -795,9 +795,9 @@ bool HopkinsEngine::runLinuxDemo() { _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); @@ -809,9 +809,9 @@ bool HopkinsEngine::runLinuxDemo() { _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); @@ -833,14 +833,14 @@ bool HopkinsEngine::runBeOSFull() { _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("MP.ANM", 10, 0, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) INTRORUN(); _graphicsManager.FADE_OUTS(); - _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); _graphicsManager.FADE_OUTW(); _globals.iRegul = 0; @@ -878,13 +878,13 @@ bool HopkinsEngine::runBeOSFull() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - _graphicsManager.LOAD_IMAGE("FOND"); + _graphicsManager.loadImage("FOND"); _graphicsManager.FADE_INW(); _eventsManager.delay(5000); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); _soundManager.SPECIAL_SOUND = 0; @@ -1032,7 +1032,7 @@ bool HopkinsEngine::runBeOSFull() { } if (_globals.SORTIE == 18) { _globals.iRegul = 1; - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); @@ -1075,7 +1075,7 @@ bool HopkinsEngine::runBeOSFull() { if (_globals.SORTIE == 17) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -1540,7 +1540,7 @@ bool HopkinsEngine::runBeOSFull() { if (_globals.SORTIE == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -1618,7 +1618,7 @@ bool HopkinsEngine::runBeOSFull() { case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; @@ -1628,7 +1628,7 @@ bool HopkinsEngine::runBeOSFull() { case 151: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; @@ -1638,7 +1638,7 @@ bool HopkinsEngine::runBeOSFull() { case 152: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.Cls_Video(); + _graphicsManager.clearScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; @@ -1680,16 +1680,16 @@ bool HopkinsEngine::runWin95full() { warning("TODO: Affiche_Version();"); - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("MP.ANM", 10, 16, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) INTRORUN(); - _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -1731,17 +1731,17 @@ bool HopkinsEngine::runWin95full() { if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); + _graphicsManager.loadImage("fondfr"); else if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.loadImage("fondan"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _soundManager.SPECIAL_SOUND = 2; _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); if (!_globals.CENSURE) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); @@ -1894,9 +1894,9 @@ bool HopkinsEngine::runWin95full() { } if (_globals.SORTIE == 18) { _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); @@ -1938,9 +1938,9 @@ bool HopkinsEngine::runWin95full() { if (_globals.SORTIE == 17) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -2404,9 +2404,9 @@ bool HopkinsEngine::runWin95full() { if (_globals.SORTIE == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -2483,9 +2483,9 @@ bool HopkinsEngine::runWin95full() { case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -2495,9 +2495,9 @@ bool HopkinsEngine::runWin95full() { case 151: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -2507,9 +2507,9 @@ bool HopkinsEngine::runWin95full() { case 152: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_LOCK(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_UNLOCK(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -2554,11 +2554,11 @@ bool HopkinsEngine::runLinuxFull() { _globals.HELICO = 0; _eventsManager.mouseOff(); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); - _graphicsManager.LOAD_IMAGE("H2"); + _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -2608,19 +2608,19 @@ bool HopkinsEngine::runLinuxFull() { if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("fondfr"); + _graphicsManager.loadImage("fondfr"); else if (!_globals.FR) - _graphicsManager.LOAD_IMAGE("fondan"); + _graphicsManager.loadImage("fondan"); else if (_globals.FR == 2) - _graphicsManager.LOAD_IMAGE("fondes"); + _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; if (!_globals.CENSURE) @@ -2772,9 +2772,9 @@ bool HopkinsEngine::runLinuxFull() { } if (_globals.SORTIE == 18) { _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); @@ -2815,9 +2815,9 @@ bool HopkinsEngine::runLinuxFull() { _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals.SORTIE == 17) { _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); @@ -3283,9 +3283,9 @@ bool HopkinsEngine::runLinuxFull() { if (_globals.SORTIE == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -3336,12 +3336,12 @@ bool HopkinsEngine::runLinuxFull() { _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.DD_VBL(); - memset(_graphicsManager.VESA_BUFFER, 0, 0x4B000u); - memset(_graphicsManager.VESA_SCREEN, 0, 0x4B000u); + memset(_graphicsManager._vesaBuffer, 0, 0x4B000u); + memset(_graphicsManager._vesaScreen, 0, 0x4B000u); _graphicsManager.Cls_Pal(); _graphicsManager.RESET_SEGMENT_VESA(); break; @@ -3353,9 +3353,9 @@ bool HopkinsEngine::runLinuxFull() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 115: @@ -3365,17 +3365,17 @@ bool HopkinsEngine::runLinuxFull() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); @@ -3386,9 +3386,9 @@ bool HopkinsEngine::runLinuxFull() { case 151: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); @@ -3399,9 +3399,9 @@ bool HopkinsEngine::runLinuxFull() { case 152: _soundManager.WSOUND(16); _globals.iRegul = 1; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); @@ -3441,7 +3441,7 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { void HopkinsEngine::INIT_SYSTEM() { // Set graphics mode - _graphicsManager.SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); + _graphicsManager.setGraphicalMode(SCREEN_WIDTH, SCREEN_HEIGHT); // Synchronise the sound settings from ScummVM _soundManager.syncSoundSettings(); @@ -3539,14 +3539,14 @@ void HopkinsEngine::INTRORUN() { if (!_eventsManager._escKeyFl) { _soundManager.VOICE_MIX(3, 3); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _graphicsManager.DD_VBL(); _soundManager.WSOUND(11); - _graphicsManager.LOAD_IMAGE("intro1"); - _graphicsManager.SCROLL_ECRAN(0); + _graphicsManager.loadImage("intro1"); + _graphicsManager.scrollScreen(0); _graphicsManager.ofscroll = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -3586,8 +3586,8 @@ void HopkinsEngine::INTRORUN() { _soundManager.VOICE_MIX(4, 3); _graphicsManager.FADE_OUTW(); _graphicsManager.no_scroll = 0; - _graphicsManager.LOAD_IMAGE("intro2"); - _graphicsManager.SCROLL_ECRAN(0); + _graphicsManager.loadImage("intro2"); + _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); @@ -3618,7 +3618,7 @@ void HopkinsEngine::INTRORUN() { // CHECKME: Useless variables? // v21 = *(uint16 *)&_graphicsManager.Palette[796]; // v22 = _graphicsManager.Palette[798]; - _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); + _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager._vesaBuffer); _graphicsManager.FIN_VISU(); if (shouldQuit()) @@ -3633,8 +3633,8 @@ void HopkinsEngine::INTRORUN() { _soundManager.SPECIAL_SOUND = 0; if (!_eventsManager._escKeyFl) { - _graphicsManager.LOAD_IMAGE("intro2"); - _graphicsManager.SCROLL_ECRAN(0); + _graphicsManager.loadImage("intro2"); + _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); @@ -3653,7 +3653,7 @@ void HopkinsEngine::INTRORUN() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; - _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); + _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager._vesaBuffer); int v9 = 0; while (!shouldQuit() && !_eventsManager._escKeyFl) { @@ -3674,7 +3674,7 @@ void HopkinsEngine::INTRORUN() { _graphicsManager.Palette[i] -= v12; } - _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); + _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager._vesaBuffer); if (2 * v9 > 1) { @@ -3682,7 +3682,7 @@ void HopkinsEngine::INTRORUN() { _eventsManager.VBL(); } - _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); + _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager._vesaBuffer); if (20 - v9 > 1) { for (int i = 1; i < 20 - v9; i++) _eventsManager.VBL(); @@ -3690,7 +3690,7 @@ void HopkinsEngine::INTRORUN() { v9 += 2; if (v9 > 15) { - _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); + _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager._vesaBuffer); for (uint j = 1; j < 100 / _globals._speed; ++j) _eventsManager.VBL(); @@ -3705,7 +3705,7 @@ void HopkinsEngine::INTRORUN() { _eventsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); - _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); + _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager._vesaBuffer); for (uint m = 0; m < 50 / _globals._speed; ++m) { if (m == 30 / _globals._speed) { @@ -3764,9 +3764,9 @@ void HopkinsEngine::PASS() { return; if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("ndfr"); + _graphicsManager.loadImage("ndfr"); else - _graphicsManager.LOAD_IMAGE("nduk"); + _graphicsManager.loadImage("nduk"); _graphicsManager.FADE_INW(); if (_soundManager.VOICEOFF) @@ -3788,9 +3788,9 @@ void HopkinsEngine::NO_DISPO(int sortie) { void HopkinsEngine::ENDEMO() { _soundManager.WSOUND(28); if (_globals.FR == 1) - _graphicsManager.LOAD_IMAGE("endfr"); + _graphicsManager.loadImage("endfr"); else - _graphicsManager.LOAD_IMAGE("enduk"); + _graphicsManager.loadImage("enduk"); _graphicsManager.FADE_INW(); _eventsManager.delay(1500); @@ -3801,9 +3801,9 @@ void HopkinsEngine::ENDEMO() { void HopkinsEngine::BOOM() { _graphicsManager.nbrligne = SCREEN_WIDTH; _graphicsManager.SCANLINE(SCREEN_WIDTH); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _globals.iRegul = 1; @@ -3815,7 +3815,7 @@ void HopkinsEngine::BOOM() { _animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _soundManager.SPECIAL_SOUND = 0; - _graphicsManager.LOAD_IMAGE("IM15"); + _graphicsManager.loadImage("IM15"); _animationManager.loadAnim("ANIM15"); _graphicsManager.VISU_ALL(); _objectsManager.BOBANIM_OFF(7); @@ -3860,7 +3860,7 @@ void HopkinsEngine::PUBQUIT() { _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _globals.FLAG_VISIBLE = false; - _graphicsManager.LOAD_IMAGE("BOX"); + _graphicsManager.loadImage("BOX"); _soundManager.WSOUND(28); _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); @@ -3891,7 +3891,7 @@ void HopkinsEngine::PUBQUIT() { void HopkinsEngine::INCENDIE() { _globals._disableInventFl = true; _globals.iRegul = 1; - _graphicsManager.LOAD_IMAGE("IM71"); + _graphicsManager.loadImage("IM71"); _animationManager.loadAnim("ANIM71"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -3926,9 +3926,9 @@ void HopkinsEngine::INCENDIE() { void HopkinsEngine::BASE() { _globals.iRegul = 1; _graphicsManager.nbrligne = SCREEN_WIDTH; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager._clearAnimationFl = true; _soundManager.WSOUND(25); @@ -3993,9 +3993,9 @@ void HopkinsEngine::BASE() { } void HopkinsEngine::BASED() { - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.NO_SEQ = false; _soundManager.WSOUND(26); @@ -4005,7 +4005,7 @@ void HopkinsEngine::BASED() { _graphicsManager.FADE_LINUX = 2; _animationManager.playSequence("abase.seq", 50, 15, 50); _animationManager.NO_COUL = false; - _graphicsManager.LOAD_IMAGE("IM92"); + _graphicsManager.loadImage("IM92"); _animationManager.loadAnim("ANIM92"); _graphicsManager.VISU_ALL(); _objectsManager.INILINK("IM92"); @@ -4044,7 +4044,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.AFFLI = false; _globals.AFFIVBL = false; _soundManager.CHARGE_SAMPLE(1, "SOUND90.WAV"); - _graphicsManager.LOAD_IMAGE("IM100"); + _graphicsManager.loadImage("IM100"); _animationManager.loadAnim("ANIM100"); _graphicsManager.VISU_ALL(); _eventsManager.mouseOn(); @@ -4118,7 +4118,7 @@ void HopkinsEngine::JOUE_FIN() { _animationManager.playAnim("BERM.ANM", 100, 24, 300); _graphicsManager.FIN_VISU(); _soundManager.DEL_SAMPLE(1); - _graphicsManager.LOAD_IMAGE("PLAN3"); + _graphicsManager.loadImage("PLAN3"); _graphicsManager.FADE_INW(); _eventsManager._rateCounter = 0; @@ -4134,9 +4134,9 @@ void HopkinsEngine::JOUE_FIN() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR2A.anm", 12, 12, 1000); _soundManager.WSOUND(11); - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager.playAnim("FF1a.anm", 18, 18, 9); _animationManager.playAnim("FF1a.anm", 9, 18, 9); @@ -4190,9 +4190,9 @@ void HopkinsEngine::AVION() { _soundManager.WSOUND(28); _globals.iRegul = 1; _globals.nbrligne = SCREEN_WIDTH; - _graphicsManager.DD_Lock(); - _graphicsManager.Cls_Video(); - _graphicsManager.DD_Unlock(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); _graphicsManager.Cls_Pal(); _animationManager._clearAnimationFl = false; @@ -4268,7 +4268,7 @@ void HopkinsEngine::AVION() { int HopkinsEngine::PWBASE() { _globals._disableInventFl = true; - _graphicsManager.LOAD_IMAGE("PBASE"); + _graphicsManager.loadImage("PBASE"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4452,7 +4452,7 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) { - _graphicsManager.Affiche_Fonte(_graphicsManager.VESA_BUFFER, _globals.police, startPosX, startPosY, curChar - 32, colour); + _graphicsManager.Affiche_Fonte(_graphicsManager._vesaBuffer, _globals.police, startPosX, startPosY, curChar - 32, colour); startPosX += _objectsManager.getWidth(_globals.police, curChar - 32); } } @@ -4461,7 +4461,7 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { void HopkinsEngine::Credits() { Charge_Credits(); _globals.Credit_y = 436; - _graphicsManager.LOAD_IMAGE("GENERIC"); + _graphicsManager.loadImage("GENERIC"); _graphicsManager.FADE_INW(); _soundManager.WSOUND(28); _eventsManager._mouseFl = false; @@ -4499,7 +4499,7 @@ void HopkinsEngine::Credits() { --_globals.Credit_y; if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) { _eventsManager.VBL(); - _graphicsManager.SCOPY(_graphicsManager.VESA_SCREEN, 60, 50, 520, 380, _graphicsManager.VESA_BUFFER, 60, 50); + _graphicsManager.SCOPY(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50); } else { _eventsManager.VBL(); } @@ -4731,7 +4731,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); if (a2.size()) - _graphicsManager.LOAD_IMAGE(a2); + _graphicsManager.loadImage(a2); if ((a1 != 77) && (a1 != 84) && (a1 != 91)) _objectsManager.INILINK("ocean"); @@ -4835,7 +4835,7 @@ bool HopkinsEngine::ADULT() { _globals._disableInventFl = true; _globals.SORTIE = 0; - _graphicsManager.LOAD_IMAGE("ADULT"); + _graphicsManager.loadImage("ADULT"); _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(0); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 6cb5c2e9b3..0e05136bf0 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -76,11 +76,11 @@ int MenuManager::MENU() { if (_vm->_globals.FR == 0) - _vm->_graphicsManager.LOAD_IMAGE("MENUAN"); + _vm->_graphicsManager.loadImage("MENUAN"); else if (_vm->_globals.FR == 1) - _vm->_graphicsManager.LOAD_IMAGE("MENUFR"); + _vm->_graphicsManager.loadImage("MENUFR"); else if (_vm->_globals.FR == 2) - _vm->_graphicsManager.LOAD_IMAGE("MENUES"); + _vm->_graphicsManager.loadImage("MENUES"); _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.FR == 0) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5160bccec9..2e2d492dc6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -350,9 +350,9 @@ void ObjectsManager::displaySprite() { if (destY < _vm->_graphicsManager.min_y) destY = _vm->_graphicsManager.min_y; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_1, y1_1, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, x1_1, y1_1, _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, - _vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager._vesaBuffer, destX, destY); _vm->_fontManager._textList[idx]._enabledFl = false; } @@ -376,9 +376,9 @@ void ObjectsManager::displaySprite() { if (v9 < _vm->_graphicsManager.min_y) v9 = _vm->_graphicsManager.min_y; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, x1_2, y1_2, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, x1_2, y1_2, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, - _vm->_graphicsManager.VESA_BUFFER, v8, v9); + _vm->_graphicsManager._vesaBuffer, v8, v9); _vm->_globals.Liste[idx].field0 = 0; } } @@ -473,39 +473,39 @@ void ObjectsManager::displaySprite() { _vm->_globals.NBTRI = 0; if (_vm->_dialogsManager._inventDisplayedFl) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); if (_oldBorderPos.x && _oldBorderPos.y) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, _oldBorderPos.x + 300, _oldBorderPos.y + 300, _oldBorderSpriteIndex + 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventBuf2, _oldBorderPos.x + 300, _oldBorderPos.y + 300, _oldBorderSpriteIndex + 1); if (_borderPos.x && _borderPos.y) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_dialogsManager._inventBuf2, _borderPos.x + 300, _borderPos.y + 300, _borderSpriteIndex); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventBuf2, _borderPos.x + 300, _borderPos.y + 300, _borderSpriteIndex); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } if (SL_FLAG == true) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); if (SL_X && SL_Y) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); } // If the Options dialog is activated, draw the elements if (_vm->_globals._optionDialogFl) { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 464, 407, 0); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 657, 556, _vm->_globals.opt_vitesse); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 495, _vm->_globals.opt_txt); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 468, _vm->_globals.opt_voice); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 441, _vm->_globals.opt_sound); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 731, 414, _vm->_globals.opt_music); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals.opt_anm); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals.opt_scrspeed); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); } @@ -600,10 +600,10 @@ void ObjectsManager::DEF_BOB(int idx) { int yp = _vm->_globals.Bob[idx]._oldY; if (_vm->_globals.Bob[idx]._isSpriteFl) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Bob[idx]._spriteData, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.Bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.Bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex, _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx]._oldY2, _vm->_globals.Bob[idx].field38); @@ -948,10 +948,10 @@ void ObjectsManager::DEF_SPRITE(int idx) { v3 = _sprite[v2].field2C; v4 = _sprite[v2].field2E; if (_sprite[v2].field28) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _sprite[v2]._spriteData, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[v2]._spriteData, v3 + 300, v4 + 300, _sprite[v2]._spriteIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, _sprite[v2]._spriteData, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[v2]._spriteData, v3 + 300, v4 + 300, _sprite[v2]._spriteIndex, _sprite[v2].field36, _sprite[v2].field34, _sprite[v2].fieldE); v5 = idx; @@ -992,7 +992,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { } void ObjectsManager::DEF_CACHE(int idx) { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, _vm->_globals.CACHE_BANQUE[1], + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1], _vm->_globals.Cache[idx].field0 + 300, _vm->_globals.Cache[idx].field4 + 300, _vm->_globals.Cache[idx].field2); @@ -1271,10 +1271,10 @@ LABEL_38: if ((v14 != 2) && (v14 != 4)) { if (_vm->_globals.Liste2[v27]._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.Liste2[v27]._xp, + _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp); _vm->_globals.Liste2[v27]._visibleFl = false; } @@ -1283,10 +1283,10 @@ LABEL_38: if (_vm->_globals.Bob[v27].field0 == 11) { if (_vm->_globals.Liste2[v27]._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, - _vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp); _vm->_globals.Liste2[v27]._visibleFl = false; } @@ -1321,12 +1321,12 @@ void ObjectsManager::AFF_VBOB() { width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); _vm->_graphicsManager.Restore_Mem( - _vm->_graphicsManager.VESA_BUFFER, _vm->_globals.VBob[idx]._surface, + _vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); @@ -1351,12 +1351,12 @@ void ObjectsManager::AFF_VBOB() { width = getWidth(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); height = getHeight(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_SCREEN, + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, _vm->_globals.VBob[idx]._oldY, width, height); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, _vm->_globals.VBob[idx]._oldY, width, height); @@ -1383,27 +1383,27 @@ void ObjectsManager::AFF_VBOB() { byte *surface = _vm->_globals.allocMemory(height * width); _vm->_globals.VBob[idx]._surface = surface; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager.VESA_SCREEN, surface, + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaScreen, surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); byte *v10 = _vm->_globals.VBob[idx].spriteData; if (*v10 == 78) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_SCREEN, v10, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaScreen, v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex, 0, 0, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex, 0, 0, 0); } else { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_BUFFER, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager.VESA_SCREEN, _vm->_globals.VBob[idx].spriteData, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex); } @@ -1433,7 +1433,7 @@ int ObjectsManager::getSpriteY(int idx) { } void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager.VESA_BUFFER, spriteData, a2, a3, a5, a6, a7, a8); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, spriteData, a2, a3, a5, a6, a7, a8); } /** @@ -1546,10 +1546,10 @@ void ObjectsManager::SETTAILLESPR(int idx, int a2) { _sprite[idx].fieldC = a2; } -void ObjectsManager::SETFLIPSPR(int idx, int a2) { +void ObjectsManager::setFlipSprite(int idx, bool flip) { if (!_sprite[idx].field28) { assert (idx <= MAX_SPRITE); - _sprite[idx].fieldE = a2; + _sprite[idx].fieldE = flip; } } @@ -1647,7 +1647,7 @@ LABEL_54: if (_vm->_eventsManager._mouseCursorId == 4) { v1 = v4 + 1; if ((uint16)(v4 + 1) > 1u) - BTDROITE(); + handleRightButton(); } } if ((_vm->_globals.PLAN_FLAG == true && v4 == -1) || !v4) { @@ -1752,13 +1752,13 @@ void ObjectsManager::GOHOME() { } else { setSpriteIndex(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; - if (_vm->_globals.GOACTION == 1) + if (_vm->_globals.GOACTION) v54 = _vm->_globals.SAUVEGARDE->data[svField2]; else v54 = NUMZONE; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); - SETFLIPSPR(0, 0); + setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.g_old_sens = -1; @@ -2093,7 +2093,7 @@ LABEL_153: _vm->_globals.chemin++; if (nouveau_x == -1 && v48 == -1) { - if (_vm->_globals.GOACTION == 1) + if (_vm->_globals.GOACTION) v49 = _vm->_globals.SAUVEGARDE->data[svField2]; else v49 = NUMZONE; @@ -2101,7 +2101,7 @@ LABEL_153: _vm->_globals.ACTION_SENS = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); - SETFLIPSPR(0, 0); + setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.g_old_sens = -1; g_old_x = getSpriteX(0); @@ -2150,41 +2150,41 @@ LABEL_153: if (v47 == 1) { VERIFTAILLE(); if (_vm->_globals.g_old_sens == 7) - SETFLIPSPR(0, 1); + setFlipSprite(0, true); if (_vm->_globals.g_old_sens == 3) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 1) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 5) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 2) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 8) - SETFLIPSPR(0, 1); + setFlipSprite(0, true); if (_vm->_globals.g_old_sens == 4) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 6) - SETFLIPSPR(0, 1); + setFlipSprite(0, true); setSpriteX(0, nouveau_x); setSpriteY(0, nouveau_y); setSpriteIndex(0, v1); } else { if (_vm->_globals.g_old_sens == 7) - SETFLIPSPR(0, 1); + setFlipSprite(0, true); if (_vm->_globals.g_old_sens == 3) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 1) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 5) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 2) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 8) - SETFLIPSPR(0, 1); + setFlipSprite(0, true); if (_vm->_globals.g_old_sens == 4) - SETFLIPSPR(0, 0); + setFlipSprite(0, false); if (_vm->_globals.g_old_sens == 6) - SETFLIPSPR(0, 1); + setFlipSprite(0, true); _vm->_globals.Compteur = 0; } _vm->_globals.g_old_sens = nouveau_sens; @@ -2293,8 +2293,10 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_globals.freeMemory(ptr); } -// Load Zone -void ObjectsManager::CHARGE_ZONE(const Common::String &file) { +/** + * Load Zone + */ +void ObjectsManager::loadZone(const Common::String &file) { int v3; int v4; int v5; @@ -2471,10 +2473,10 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.NOT_VERIF = 1; _vm->_soundManager.WSOUND(31); _vm->_globals.iRegul = 1; - _vm->_graphicsManager.LOAD_IMAGE("PLAN"); + _vm->_graphicsManager.loadImage("PLAN"); CHARGE_OBSTACLE("PLAN.OB2"); - _vm->_globals.CHARGE_CACHE("PLAN.CA2"); - CHARGE_ZONE("PLAN.ZO2"); + _vm->_globals.loadCache("PLAN.CA2"); + loadZone("PLAN.ZO2"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "VOITURE.SPR"); _spritePtr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_animationManager.loadAnim("PLAN"); @@ -2496,7 +2498,7 @@ void ObjectsManager::PLAN_BETA() { my_anim = 0; _vm->_eventsManager.mouseOn(); v3 = getSpriteX(0); - _vm->_graphicsManager.SCROLL_ECRAN(v3 - 320); + _vm->_graphicsManager.scrollScreen(v3 - 320); _vm->_graphicsManager.ofscroll = getSpriteX(0) - 320; SPRITE_ON(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2534,13 +2536,13 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager._curMouseButton = 0; } if (v5 == 1) - BTGAUCHE(); + handleLeftButton(); } VERIFZONE(); GOHOME2(); - if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION == 1) + if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) PARADISE(); _vm->_eventsManager.VBL(); @@ -2563,8 +2565,10 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLAN_FLAG = false; } -// Left Button -void ObjectsManager::BTGAUCHE() { +/** + * Handle Left button + */ +void ObjectsManager::handleLeftButton() { int srcX, srcY; int destX, destY; int v1; @@ -2631,7 +2635,7 @@ void ObjectsManager::BTGAUCHE() { } } if (_vm->_globals.PLAN_FLAG == true) { - if (_vm->_globals.GOACTION != 1) + if (!_vm->_globals.GOACTION) goto LABEL_38; VERIFZONE(); if (NUMZONE <= 0) @@ -2650,9 +2654,9 @@ void ObjectsManager::BTGAUCHE() { v5[v2 + 2] = -1; v5[v2 + 3] = -1; } - if (_vm->_globals.GOACTION == 1) { + if (_vm->_globals.GOACTION) { VERIFZONE(); - _vm->_globals.GOACTION = 0; + _vm->_globals.GOACTION = false; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2672,7 +2676,7 @@ LABEL_38: } } } - _vm->_globals.GOACTION = 0; + _vm->_globals.GOACTION = false; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { @@ -2699,7 +2703,7 @@ LABEL_64: _vm->_globals.ACTION_SENS = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); - SETFLIPSPR(0, 0); + setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.g_old_sens = -1; goto LABEL_65; @@ -2735,7 +2739,7 @@ LABEL_65: _vm->_globals.SAUVEGARDE->data[svField1] = 6; _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; - _vm->_globals.GOACTION = 1; + _vm->_globals.GOACTION = true; } _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -2858,10 +2862,10 @@ LABEL_64: if (_vm->_eventsManager._mouseCursorId == 4) { result = NUMZONE + 1; if ((uint16)(NUMZONE + 1) > 1u) - BTDROITE(); + handleRightButton(); } } - _vm->_globals.GOACTION = 0; + _vm->_globals.GOACTION = false; } // Clear Screen @@ -2899,7 +2903,7 @@ void ObjectsManager::CLEAR_ECRAN() { Vold_taille = 200; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; - _vm->_globals.GOACTION = 0; + _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; _vm->_globals.NOSPRECRAN = false; @@ -2922,7 +2926,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha CharacterLocation *loc; CH_TETE = 1; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager.VESA_SCREEN, 532, 25, 65, 40, _vm->_graphicsManager.VESA_BUFFER, 532, 25); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -3670,7 +3674,10 @@ LABEL_67: } while (_vm->_globals.ZONEP[NUMZONE].fieldE != 2); } -void ObjectsManager::BTDROITE() { +/** + * Handle Right button + */ +void ObjectsManager::handleRightButton() { if ((uint16)(NUMZONE + 1) > 1u) { VERBEPLUS(); if (_vm->_eventsManager._mouseCursorId != 23) @@ -4049,7 +4056,7 @@ void ObjectsManager::SPECIAL_JEU() { v1 = _vm->_globals.allocMemory(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); - _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; @@ -4065,19 +4072,19 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; - _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); PERSO_ON = false; memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.freeMemory(v1); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_Unlock(); - v2 = _vm->_graphicsManager.VESA_BUFFER; - v3 = _vm->_graphicsManager.VESA_SCREEN; - memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.unlockScreen(); + v2 = _vm->_graphicsManager._vesaBuffer; + v3 = _vm->_graphicsManager._vesaScreen; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu); v3 = v3 + 614396; v2 = v2 + 614396; *v2 = *v3; @@ -5268,7 +5275,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.AFFLI = false; _vm->_globals.AFFIVBL = false; if (!backgroundFile.empty()) - _vm->_graphicsManager.LOAD_IMAGE(backgroundFile); + _vm->_graphicsManager.loadImage(backgroundFile); if (!linkFile.empty()) INILINK(linkFile); if (!animFile.empty()) @@ -5318,14 +5325,14 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo do { v9 = _vm->_eventsManager.getMouseButton(); if (v9 == 1) { - BTGAUCHE(); + handleLeftButton(); v9 = 1; } if (v9 == 2) - BTDROITE(); + handleRightButton(); _vm->_dialogsManager.testDialogOpening(); VERIFZONE(); - if (_vm->_globals.GOACTION == 1) + if (_vm->_globals.GOACTION) PARADISE(); if (!_vm->_globals.SORTIE) { _vm->_eventsManager.VBL(); @@ -5368,7 +5375,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_soundManager.WSOUND(v); _vm->_globals.iRegul = 1; if (!backgroundFile.empty()) - _vm->_graphicsManager.LOAD_IMAGE(backgroundFile); + _vm->_graphicsManager.loadImage(backgroundFile); if (!linkFile.empty()) INILINK(linkFile); if (!animFile.empty()) { @@ -5464,9 +5471,9 @@ LABEL_70: xCheck = xp; yCheck = yp; } - BTGAUCHE(); + handleLeftButton(); } else if (mouseButtons == 2) { - BTDROITE(); + handleRightButton(); } } if (!_vm->_globals.SORTIE) { @@ -5474,7 +5481,7 @@ LABEL_70: VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { - if (_vm->_globals.GOACTION == 1) + if (_vm->_globals.GOACTION) PARADISE(); } SPECIAL_JEU(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 5793fc5fe3..00eddfdd5e 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -172,16 +172,16 @@ public: void setSpriteIndex(int idx, int spriteIndex); void setSpriteY(int idx, int yp); void SETTAILLESPR(int idx, int a2); - void SETFLIPSPR(int idx, int a2); + void setFlipSprite(int idx, bool flip); void VERIFZONE(); void GOHOME(); void GOHOME2(); void CHARGE_OBSTACLE(const Common::String &file); - void CHARGE_ZONE(const Common::String &file); + void loadZone(const Common::String &file); void CARRE_ZONE(); void PLAN_BETA(); - void BTGAUCHE(); + void handleLeftButton(); void PARADISE(); void CLEAR_ECRAN(); @@ -196,7 +196,7 @@ public: void PACOURS_PROPRE(int16 *a1); int16 *PARC_VOITURE(int a1, int a2, int a3, int a4); void VERBEPLUS(); - void BTDROITE(); + void handleRightButton(); int MZONE(); void initBorder(int a1); void OBJETPLUS(int a1); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 75c69cc87f..66afa9fcdf 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -228,7 +228,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { Graphics::Surface thumb8; thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager.VESA_BUFFER, (byte *)thumb8.pixels, + _vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager._vesaBuffer, (byte *)thumb8.pixels, _vm->_eventsManager._startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); // Convert the 8-bit pixel to 16 bit surface diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 704f3763f6..1b6b1b89c0 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -555,7 +555,7 @@ LABEL_1141: else if (_vm->_globals.SVGA == 1) _vm->_animationManager.playAnim("BOMBE1.ANM", 100, 18, 100); } - _vm->_graphicsManager.LOAD_IMAGE("BOMBEB"); + _vm->_graphicsManager.loadImage("BOMBEB"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -587,7 +587,7 @@ LABEL_1141: else if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 151; } @@ -603,7 +603,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); _vm->_globals.SORTIE = 151; } if (v76 == 605) { @@ -620,7 +620,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); _vm->_globals.SORTIE = 151; } if (v76 == 606) { @@ -633,7 +633,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE3.ANM", 50, 14, 500); else if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); - memset(_vm->_graphicsManager.VESA_BUFFER, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); } _vm->_globals.SORTIE = 6; } @@ -707,7 +707,7 @@ LABEL_1141: } _vm->_animationManager.loadAnim("otage"); - _vm->_graphicsManager.LOAD_IMAGE("IM05"); + _vm->_graphicsManager.loadImage("IM05"); _vm->_graphicsManager.VISU_ALL(); for (int i = 0; i <= 4; i++) { @@ -718,14 +718,14 @@ LABEL_1141: } _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager._vesaBuffer); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 100); - _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager._vesaBuffer); _vm->_graphicsManager.FIN_VISU(); // If uncensored, rip the throat of the hostage @@ -737,7 +737,7 @@ LABEL_1141: } _vm->_animationManager.loadAnim("ASCEN"); _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.LOAD_IMAGE("ASCEN"); + _vm->_graphicsManager.loadImage("ASCEN"); _vm->_graphicsManager.VISU_ALL(); for (int i = 0; i <= 4; i++) { @@ -748,9 +748,9 @@ LABEL_1141: } _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager._vesaBuffer); _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); - _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager.VESA_BUFFER); + _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager._vesaBuffer); _vm->_graphicsManager.FIN_VISU(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) @@ -1994,7 +1994,7 @@ LABEL_1141: _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_graphicsManager.FIN_VISU(); - _vm->_graphicsManager.LOAD_IMAGE("IM20f"); + _vm->_graphicsManager.loadImage("IM20f"); _vm->_animationManager.loadAnim("ANIM20f"); _vm->_graphicsManager.VISU_ALL(); _vm->_eventsManager.mouseOff(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2fb083baef..ac6326ad21 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -103,9 +103,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; @@ -146,7 +146,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; @@ -160,12 +160,12 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - _vm->_graphicsManager.DD_LOCK(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_UNLOCK(); - v8 = _vm->_graphicsManager.VESA_BUFFER; - v9 = _vm->_graphicsManager.VESA_SCREEN; - memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.unlockScreen(); + v8 = _vm->_graphicsManager._vesaBuffer; + v9 = _vm->_graphicsManager._vesaScreen; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu); v9 = v9 + 614396; v8 = v8 + 614396; *v8 = *v9; @@ -1059,7 +1059,7 @@ void TalkManager::REPONSE2(int a1, int a2) { v3 = 0; if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { if ((uint16)(a1 - 22) <= 1u) { - _vm->_objectsManager.SETFLIPSPR(0, 0); + _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); if (a1 == 22) { @@ -1107,7 +1107,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.ZONE_OFF(23); } if ((uint16)(a1 - 20) <= 1u) { - _vm->_objectsManager.SETFLIPSPR(0, 1); + _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); if (a1 == 20) { @@ -1216,9 +1216,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x4B000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN, 0x96000u); + _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager.nbrligne) _vm->_graphicsManager.ofscroll = 0; @@ -1234,7 +1234,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.NOMARCHE = true; _vm->_objectsManager.INILINK(v22); _vm->_objectsManager.PERSO_ON = true; - _vm->_globals.GOACTION = 0; + _vm->_globals.GOACTION = false; _vm->_objectsManager.NUMZONE = -1; initCharacterAnim(); VISU_PARLE(); @@ -1246,13 +1246,13 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { do { v12 = _vm->_eventsManager.getMouseButton(); if (v12 == 1) { - _vm->_objectsManager.BTGAUCHE(); + _vm->_objectsManager.handleLeftButton(); v12 = 1; } if (v12 == 2) - _vm->_objectsManager.BTDROITE(); + _vm->_objectsManager.handleRightButton(); _vm->_objectsManager.VERIFZONE(); - if (_vm->_globals.GOACTION == 1) + if (_vm->_globals.GOACTION) _vm->_objectsManager.PARADISE(); _vm->_eventsManager.VBL(); } while (!_vm->_globals.SORTIE); @@ -1282,7 +1282,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager.VESA_SCREEN); + _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; @@ -1295,13 +1295,13 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - _vm->_graphicsManager.DD_Lock(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager.VESA_SCREEN, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.DD_Unlock(); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); - v14 = _vm->_graphicsManager.VESA_BUFFER; - v15 = _vm->_graphicsManager.VESA_SCREEN; - memcpy(_vm->_graphicsManager.VESA_BUFFER, _vm->_graphicsManager.VESA_SCREEN, 0x95FFCu); + v14 = _vm->_graphicsManager._vesaBuffer; + v15 = _vm->_graphicsManager._vesaScreen; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu); v15 = v15 + 614396; v14 = v14 + 614396; WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15)); -- cgit v1.2.3 From 076546d41d1454c87317b5e53c2b322865331d92 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Dec 2012 08:00:22 +0100 Subject: HOPKINS: More renaming --- engines/hopkins/anim.cpp | 12 +-- engines/hopkins/computer.cpp | 2 +- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/events.cpp | 30 +++--- engines/hopkins/files.cpp | 10 +- engines/hopkins/globals.cpp | 6 +- engines/hopkins/globals.h | 7 +- engines/hopkins/graphics.cpp | 123 ++++++++++++------------ engines/hopkins/graphics.h | 6 +- engines/hopkins/hopkins.cpp | 28 +++--- engines/hopkins/objects.cpp | 11 +-- engines/hopkins/sound.cpp | 8 +- engines/hopkins/talk.cpp | 218 +++++++++++++++++++++---------------------- engines/hopkins/talk.h | 10 +- 14 files changed, 229 insertions(+), 244 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 313d7a9ee1..d26b1b8b17 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -236,11 +236,11 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - else if (_vm->_graphicsManager.nbrligne == 1280) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager._vesaScreen; @@ -827,11 +827,11 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager.VBL(); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager._vesaScreen; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index bfc5ca92ff..9509a849bd 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -76,7 +76,7 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.unlockScreen(); //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); - _vm->_graphicsManager.nbrligne = SCREEN_WIDTH; + _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "STFONT.SPR"); _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7f45d06dc8..a228b030ba 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -361,7 +361,7 @@ LABEL_7: if (v6 && v4 <= 29) { byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, - v15 + 120, _vm->_globals.OBJL, _vm->_globals.OBJH); + v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); _vm->_globals.freeMemory(v7); } v16 += 54; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index d75d5a098d..2def49cfbf 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -341,8 +341,8 @@ void EventsManager::VBL() { v14 = _mouseSizeX; v13 = _mouseSizeY; if (_mouseCursorId == 23) { - v14 = _vm->_globals.OBJL; - v13 = _vm->_globals.OBJH; + v14 = _vm->_globals._objectWidth; + v13 = _vm->_globals._objectHeight; goto LABEL_35; } if (_breakoutFl) { @@ -473,14 +473,14 @@ void EventsManager::updateCursor() { Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = _vm->_globals.OBJL; - _vm->_graphicsManager.max_y = _vm->_globals.OBJH; - int pitch = _vm->_graphicsManager.nbrligne2; - _vm->_graphicsManager.nbrligne2 = _vm->_globals.OBJL; + _vm->_graphicsManager.max_x = _vm->_globals._objectWidth; + _vm->_graphicsManager.max_y = _vm->_globals._objectHeight; + int pitch = _vm->_graphicsManager._lineNbr2; + _vm->_graphicsManager._lineNbr2 = _vm->_globals._objectWidth; // Create the temporary cursor surface - byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL]; - Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0); + byte *cursorSurface = new byte[_vm->_globals._objectHeight * _vm->_globals._objectWidth]; + Common::fill(cursorSurface, cursorSurface + _vm->_globals._objectHeight * _vm->_globals._objectWidth, 0); if (_mouseCursorId != 23) { // Draw standard cursor @@ -495,23 +495,23 @@ void EventsManager::updateCursor() { _vm->_graphicsManager.min_y = clipBounds.top; _vm->_graphicsManager.max_x = clipBounds.right; _vm->_graphicsManager.max_y = clipBounds.bottom; - _vm->_graphicsManager.nbrligne2 = pitch; + _vm->_graphicsManager._lineNbr2 = pitch; // Convert the cursor to the pixel format. At the moment, it's hardcoded // to expect the game to be in 16-bit mode - uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL]; + uint16 *cursorPixels = new uint16[_vm->_globals._objectHeight * _vm->_globals._objectWidth]; const byte *srcP = cursorSurface; uint16 *destP = cursorPixels; - for (int yp = 0; yp < _vm->_globals.OBJH; ++yp) { + for (int yp = 0; yp < _vm->_globals._objectHeight; ++yp) { const byte *lineSrcP = srcP; uint16 *lineDestP = destP; - for (int xp = 0; xp < _vm->_globals.OBJL; ++xp) + for (int xp = 0; xp < _vm->_globals._objectWidth; ++xp) *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; - srcP += _vm->_globals.OBJL; - destP += _vm->_globals.OBJL; + srcP += _vm->_globals._objectWidth; + destP += _vm->_globals._objectWidth; } // Calculate the X offset within the pointer image to the actual cursor data @@ -519,7 +519,7 @@ void EventsManager::updateCursor() { // Set the ScummVM cursor from the surface Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - CursorMan.replaceCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH, + CursorMan.replaceCursor(cursorPixels, _vm->_globals._objectWidth, _vm->_globals._objectHeight, xOffset, 0, *((uint16 *)cursorPixels), true, &pixelFormat); // Delete the cursor surface diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 3e840ed60e..8ab86bb180 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -251,8 +251,8 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { if (name == filename) { // Found entry for file, so get it's details from the catalogue entry const byte *pData = ptr + offsetVal; - _vm->_globals.CAT_POSI = READ_LE_UINT32(pData + 15); - _vm->_globals.CAT_TAILLE = READ_LE_UINT32(pData + 19); + _vm->_globals._catalogPos = READ_LE_UINT32(pData + 15); + _vm->_globals._catalogSize = READ_LE_UINT32(pData + 19); matchFlag = true; } @@ -271,13 +271,13 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { if (!f.open(_vm->_globals.NFICHIER)) error("CHARGE_FICHIER"); - f.seek(_vm->_globals.CAT_POSI); + f.seek(_vm->_globals._catalogPos); - byte *catData = _vm->_globals.allocMemory(_vm->_globals.CAT_TAILLE); + byte *catData = _vm->_globals.allocMemory(_vm->_globals._catalogSize); if (catData == g_PTRNUL) error("CHARGE_FICHIER"); - readStream(f, catData, _vm->_globals.CAT_TAILLE); + readStream(f, catData, _vm->_globals._catalogSize); f.close(); result = catData; } else { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fda679daa4..5739cc1d74 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -138,10 +138,10 @@ Globals::Globals() { largeur_boite = 0; hauteur_boite = 0; FORET = false; - OBJL = OBJH = 0; + _objectWidth = _objectHeight = 0; HELICO = 0; - CAT_POSI = 0; - CAT_TAILLE = 0; + _catalogPos = 0; + _catalogSize = 0; _newObjectFl = false; iRegul = 0; SORTIE = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 85bd6cde89..d1fdae57a8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -400,12 +400,11 @@ public: byte *Bufferdecor; byte *ADR_FICHIER_OBJ; byte *PERSO; - int OBJL, OBJH; + int _objectWidth, _objectHeight; bool _newObjectFl; int HELICO; - uint32 CAT_POSI; - uint32 CAT_TAILLE; - bool CAT_FLAG; + uint32 _catalogPos; + uint32 _catalogSize; int iRegul; bool BPP_NOAFF; int SORTIE; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 44c775b660..a6992c0b23 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -39,7 +39,7 @@ GraphicsManager::GraphicsManager() { XSCREEN = YSCREEN = 0; WinScan = 0; PAL_PIXELS = NULL; - nbrligne = 0; + _lineNbr = 0; Linear = false; _videoPtr = NULL; ofscroll = 0; @@ -48,7 +48,7 @@ GraphicsManager::GraphicsManager() { DOUBLE_ECRAN = false; OLD_SCROLL = 0; - nbrligne2 = 0; + _lineNbr2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; FADESPD = 15; @@ -115,7 +115,7 @@ void GraphicsManager::setGraphicalMode(int width, int height) { WinScan = width * 2; // Refactor me PAL_PIXELS = SD_PIXELS; - nbrligne = width; + _lineNbr = width; Common::fill(&cmap[0], &cmap[256 * 3], 0); SDL_MODEYES = true; @@ -311,7 +311,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, "PIC.RES"); if (!f.open(_vm->_globals.NFICHIER)) error("(nom)Erreur en cours de lecture."); - f.seek(_vm->_globals.CAT_POSI); + f.seek(_vm->_globals._catalogPos); } else { // Load stand alone PCX file @@ -424,7 +424,7 @@ void GraphicsManager::Cls_Pal() { } void GraphicsManager::SCANLINE(int pitch) { - nbrligne = nbrligne2 = pitch; + _lineNbr = _lineNbr2 = pitch; } void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { @@ -437,7 +437,7 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i unsigned int widthRemaining; assert(_videoPtr); - srcP = xs + nbrligne2 * ys + surface; + srcP = xs + _lineNbr2 * ys + surface; destP = destX + WinScan * destY + (byte *)_videoPtr->pixels; yNext = height; do { @@ -448,7 +448,7 @@ void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, i widthRemaining = width - 4 * (width >> 2); memcpy(dest2P, src2P, widthRemaining); destP = dest2P + widthRemaining + WinScan - width; - srcP = src2P + widthRemaining + nbrligne2 - width; + srcP = src2P + widthRemaining + _lineNbr2 - width; yNext = yCtr - 1; } while (yCtr != 1); } @@ -460,7 +460,7 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, lockScreen(); assert(_videoPtr); - const byte *srcP = xs + nbrligne2 * ys + surface; + const byte *srcP = xs + _lineNbr2 * ys + surface; uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destX * 2 + WinScan * destY); for (int yp = 0; yp < height; ++yp) { @@ -472,7 +472,7 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, *lineDestP++ = *(uint16 *)&PAL_PIXELS[*lineSrcP++ * 2]; // Move to the start of the next line - srcP += nbrligne2; + srcP += _lineNbr2; destP += WinScan / 2; } @@ -492,7 +492,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width const byte *destCopyP; assert(_videoPtr); - srcP = xs + nbrligne2 * ys + surface; + srcP = xs + _lineNbr2 * ys + surface; destP = destX + destX + WinScan * destY + (byte *)_videoPtr->pixels; yNext = height; Agr_x = 0; @@ -536,7 +536,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } Agr_Flag_y = 0; - srcP = nbrligne2 + srcCopyP; + srcP = _lineNbr2 + srcCopyP; yNext = yCtr - 1; } while (yCtr != 1); } @@ -1049,7 +1049,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within // the screen, and so thus can read areas outside of the allocated surface buffer - srcP = xs + nbrligne2 * ys + srcSurface; + srcP = xs + _lineNbr2 * ys + srcSurface; destP = destSurface; rowCount = height; do { @@ -1069,7 +1069,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int srcP += 4 * (width >> 2); destP += 4 * (width >> 2); } - srcP = nbrligne2 + srcP - width; + srcP = _lineNbr2 + srcP - width; rowCount = rowCount2 - 1; } while (rowCount2 != 1); } @@ -1141,12 +1141,12 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, spriteP += srcOffset; // Set up surface destination - byte *destP = surface + (yp - 300) * nbrligne2 + (xp - 300); + byte *destP = surface + (yp - 300) * _lineNbr2 + (xp - 300); // Handling for clipped versus non-clipped if (clip_flag) { // Clipped version - for (int yc = 0; yc < height; ++yc, destP += nbrligne2) { + for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; byte byteVal; int xc = 0; @@ -1175,7 +1175,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } } else { // Non-clipped - for (int yc = 0; yc < height; ++yc, destP += nbrligne2) { + for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; byte byteVal; @@ -1428,7 +1428,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in int i; int yCtr; - destP = xp + nbrligne2 * yp + destSurface; + destP = xp + _lineNbr2 * yp + destSurface; yNext = height; srcP = src; do { @@ -1448,7 +1448,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in srcP += 4 * (width >> 2); destP += 4 * (width >> 2); } - destP = nbrligne2 + destP - width; + destP = _lineNbr2 + destP - width; yNext = yCtr - 1; } while (yCtr != 1); } @@ -1510,7 +1510,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp clip_x1 = max_x + 300 - xp300; if ((uint16)yp300 < (uint16)(max_y + 300)) { clip_y1 = max_y + 300 - yp300; - dest1P = xp300 + nbrligne2 * (yp300 - 300) - 300 + surface; + dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; if (zoom2) { Compteur_y = 0; Agr_x = 0; @@ -1533,7 +1533,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ; v20 = v52; spritePixelsP += _width * v30; - v29 += nbrligne2 * (uint16)clip_y; + v29 += _lineNbr2 * (uint16)clip_y; v22 = v61 - (uint16)clip_y; } if (v22 > (uint16)clip_y1) @@ -1584,7 +1584,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp } R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; - v29 = nbrligne2 + v53; + v29 = _lineNbr2 + v53; ++Compteur_y; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; @@ -1612,7 +1612,7 @@ R_Aff_Zoom_Larg_Cont1: ; v20 = v49; spritePixelsP += _width * v23; - dest1P += nbrligne2 * (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)clip_y; v22 = v58 - (uint16)clip_y; } if (v22 > (uint16)clip_y1) @@ -1666,7 +1666,7 @@ R_Aff_Zoom_Larg_Cont1: } while (v28); Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v45; - dest1P = nbrligne2 + v51; + dest1P = _lineNbr2 + v51; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 0x64u) @@ -1713,7 +1713,7 @@ Aff_Zoom_Larg_Cont1: } } spriteHeight2 = v65; - v40 = nbrligne2 + v55; + v40 = _lineNbr2 + v55; } else { Red_y = Red_y - 100; spritePixelsP += _width; @@ -1742,7 +1742,7 @@ Aff_Zoom_Larg_Cont1: } } spriteHeight2 = v64; - dest1P = nbrligne2 + v54; + dest1P = _lineNbr2 + v54; } else { Red_y = Red_y - 100; spritePixelsP += _width; @@ -1761,7 +1761,7 @@ Aff_Zoom_Larg_Cont1: if ((uint16)clip_y >= (unsigned int)spriteHeight1) return; spritePixelsP += spriteWidth * (uint16)clip_y; - dest2P += nbrligne2 * (uint16)clip_y; + dest2P += _lineNbr2 * (uint16)clip_y; spriteHeight1 -= (uint16)clip_y; } int xLeft = (uint16)clip_y1; @@ -1791,7 +1791,7 @@ Aff_Zoom_Larg_Cont1: --dest2P; } spritePixelsP = spec_largeur + spritePixelsCopy2P; - dest2P = nbrligne2 + destCopy2P; + dest2P = _lineNbr2 + destCopy2P; spriteHeight1 = yCtr2 - 1; } while (yCtr2 != 1); } else { @@ -1800,7 +1800,7 @@ Aff_Zoom_Larg_Cont1: if ((uint16)clip_y >= (unsigned int)spriteHeight1) return; spritePixelsP += spriteWidth * (uint16)clip_y; - dest1P += nbrligne2 * (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)clip_y; spriteHeight1 -= (uint16)clip_y; } if (spriteHeight1 > clip_y1) @@ -1826,7 +1826,7 @@ Aff_Zoom_Larg_Cont1: ++spritePixelsP; } spritePixelsP = spec_largeur + spritePixelsCopyP; - dest1P = nbrligne2 + dest1CopyP; + dest1P = _lineNbr2 + dest1CopyP; spriteHeight1 = yCtr1 - 1; } while (yCtr1 != 1); } @@ -1898,8 +1898,8 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned const byte *src2P; unsigned int pitch; - srcP = x1 + nbrligne2 * y1 + srcSurface; - destP = destX + nbrligne2 * destY + destSurface; + srcP = x1 + _lineNbr2 * y1 + srcSurface; + destP = destX + _lineNbr2 * destY + destSurface; yp = height; do { yCurrent = yp; @@ -1908,8 +1908,8 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned dest2P = (destP + 4 * (width >> 2)); pitch = width - 4 * (width >> 2); memcpy(dest2P, src2P, pitch); - destP = (dest2P + pitch + nbrligne2 - width); - srcP = (src2P + pitch + nbrligne2 - width); + destP = (dest2P + pitch + _lineNbr2 - width); + srcP = (src2P + pitch + _lineNbr2 - width); yp = yCurrent - 1; } while (yCurrent != 1); } @@ -1939,7 +1939,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x spriteSizeP += 2; spriteHeight = (int16)READ_LE_UINT16(spriteSizeP); spritePixelsP = spriteSizeP + 10; - destP = surface + xp + nbrligne2 * yp; + destP = surface + xp + _lineNbr2 * yp; _width = spriteWidth; do { @@ -1956,7 +1956,7 @@ void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int x ++destP; ++spritePixelsP; } - destP = nbrligne2 + destLineP; + destP = _lineNbr2 + destLineP; spriteHeight = yCtr - 1; } while (yCtr != 1); } @@ -1985,14 +1985,11 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (!_vm->_globals.NOSPRECRAN) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); } else { - _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; } } if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { @@ -2041,9 +2038,9 @@ void GraphicsManager::NB_SCREEN() { if (!_vm->_globals.NECESSAIRE) INIT_TABLE(50, 65, Palette); - if (nbrligne == SCREEN_WIDTH) + if (_lineNbr == SCREEN_WIDTH) Trans_bloc2(_vesaBuffer, TABLE_COUL, 307200); - if (nbrligne == 1280) + else if (_lineNbr == (SCREEN_WIDTH * 2)) Trans_bloc2(_vesaBuffer, TABLE_COUL, 614400); lockScreen(); m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -2113,23 +2110,25 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { for (;;) { byteVal = *srcP; if (*srcP < kByteStop) - goto Video_Cont_Vbe; - if (byteVal == kByteStop) - return; - if (byteVal == k8bVal) { - destOffset += *(srcP + 1); - byteVal = *(srcP + 2); - srcP += 2; - } else if (byteVal == k16bVal) { - destOffset += READ_LE_UINT16(srcP + 1); - byteVal = *(srcP + 3); - srcP += 3; - } else { - destOffset += READ_LE_UINT32(srcP + 1); - byteVal = *(srcP + 5); - srcP += 5; + break; + else { + if (byteVal == kByteStop) + return; + if (byteVal == k8bVal) { + destOffset += *(srcP + 1); + byteVal = *(srcP + 2); + srcP += 2; + } else if (byteVal == k16bVal) { + destOffset += READ_LE_UINT16(srcP + 1); + byteVal = *(srcP + 3); + srcP += 3; + } else { + destOffset += READ_LE_UINT32(srcP + 1); + byteVal = *(srcP + 5); + srcP += 5; + } } -Video_Cont_Vbe: + *((byte *)_videoPtr->pixels + destOffset) = byteVal; ++srcP; ++destOffset; @@ -2141,7 +2140,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int const byte *srcP; byte *destP; - srcP = xp + nbrligne2 * yp + srcSurface; + srcP = xp + _lineNbr2 * yp + srcSurface; destP = destSurface; Red = zoom; _width = width; @@ -2151,7 +2150,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Reduc_Ecran_L = zoomOut(width, Red); Reduc_Ecran_H = zoomOut(height, Red); - for (int yCtr = 0; yCtr < height; ++yCtr, srcP += nbrligne2) { + for (int yCtr = 0; yCtr < height; ++yCtr, srcP += _lineNbr2) { Red_y += Red; if (Red_y < 100) { Red_x = 0; @@ -2177,22 +2176,22 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int * Draw horizontal line */ void GraphicsManager::drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col) { - memset(surface + xp + nbrligne2 * yp, col, width); + memset(surface + xp + _lineNbr2 * yp, col, width); } /** * Draw vertical line */ void GraphicsManager::drawVerticalLine(byte *surface, int xp, int yp, int height, byte col) { - byte *destP = surface + xp + nbrligne2 * yp; + byte *destP = surface + xp + _lineNbr2 * yp; for (int yCtr = height; yCtr; yCtr--) { *destP = col; - destP += nbrligne2; + destP += _lineNbr2; } } -void GraphicsManager::MODE_VESA() { +void GraphicsManager::setModeVesa() { setGraphicalMode(640, 480); } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 3439439baa..b3b4e476a9 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -60,7 +60,7 @@ public: int WinScan; byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; - int nbrligne; + int _lineNbr; byte TABLE_COUL[PALETTE_EXT_BLOCK_SIZE]; byte cmap[PALETTE_BLOCK_SIZE]; byte Palette[PALETTE_EXT_BLOCK_SIZE]; @@ -77,7 +77,7 @@ public: int OLD_SCROLL; bool MANU_SCROLL; int SPEED_SCROLL; - int nbrligne2; + int _lineNbr2; int Agr_x, Agr_y; int Agr_Flag_x, Agr_Flag_y; int FADESPD; @@ -185,7 +185,7 @@ public: void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col); void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); - void MODE_VESA(); + void setModeVesa(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index fc96102cea..27504dce08 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -387,7 +387,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 114: @@ -397,7 +397,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 115: @@ -407,7 +407,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 150: @@ -1592,7 +1592,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.ECRAN = 113; _globals.SAUVEGARDE->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 114: @@ -1602,7 +1602,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.ECRAN = 114; _globals.SAUVEGARDE->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 115: @@ -1612,7 +1612,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.ECRAN = 115; _globals.SAUVEGARDE->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 150: @@ -2457,7 +2457,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 114: @@ -2467,7 +2467,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 115: @@ -2477,7 +2477,7 @@ bool HopkinsEngine::runWin95full() { _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; _globals.SORTIE = 0; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.MODE_VESA(); + _graphicsManager.setModeVesa(); break; case 150: @@ -2534,8 +2534,8 @@ bool HopkinsEngine::runWin95full() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; - _graphicsManager.nbrligne = SCREEN_WIDTH; - _graphicsManager.MODE_VESA(); + _graphicsManager._lineNbr = SCREEN_WIDTH; + _graphicsManager.setModeVesa(); if (_globals.SORTIE == -1) error("FIN BASE SOUS MARINE"); break; @@ -3424,7 +3424,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; - _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager._lineNbr = SCREEN_WIDTH; break; } } @@ -3799,7 +3799,7 @@ void HopkinsEngine::ENDEMO() { } void HopkinsEngine::BOOM() { - _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager._lineNbr = SCREEN_WIDTH; _graphicsManager.SCANLINE(SCREEN_WIDTH); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3925,7 +3925,7 @@ void HopkinsEngine::INCENDIE() { void HopkinsEngine::BASE() { _globals.iRegul = 1; - _graphicsManager.nbrligne = SCREEN_WIDTH; + _graphicsManager._lineNbr = SCREEN_WIDTH; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2e2d492dc6..0c632b02ce 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -129,8 +129,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { int width = ObjectsManager::getWidth(_vm->_globals.ADR_FICHIER_OBJ, val2); int height = ObjectsManager::getHeight(_vm->_globals.ADR_FICHIER_OBJ, val2); - _vm->_globals.OBJL = width; - _vm->_globals.OBJH = height; + _vm->_globals._objectWidth = width; + _vm->_globals._objectHeight = height; switch (mode) { case 0: @@ -4058,7 +4058,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_soundManager.SPECIAL_SOUND = 198; @@ -4481,7 +4481,7 @@ void ObjectsManager::INILINK(const Common::String &file) { filename = file + ".LNK"; ptr = _vm->_fileManager.searchCat(filename, 3); - nbytes = _vm->_globals.CAT_TAILLE; + nbytes = _vm->_globals._catalogSize; if (ptr == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); @@ -4506,15 +4506,12 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename2); } else { - _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; v36 = 60; v37 = ptr + 1000; for (int v40 = 0; v40 <= 21; v40++) { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 209215bba6..1e24346f60 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -577,8 +577,8 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); - catPos = _vm->_globals.CAT_POSI; - catLen = _vm->_globals.CAT_TAILLE; + catPos = _vm->_globals._catalogPos; + catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { if (_vm->_globals.FR == 1) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); @@ -587,8 +587,8 @@ bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { else if (_vm->_globals.FR == 2) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); - catPos = _vm->_globals.CAT_POSI; - catLen = _vm->_globals.CAT_TAILLE; + catPos = _vm->_globals._catalogPos; + catLen = _vm->_globals._catalogSize; } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".WAV"); if (!f.exists(_vm->_globals.NFICHIER)) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ac6326ad21..ef2ff53e19 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -34,11 +34,11 @@ namespace Hopkins { TalkManager::TalkManager() { - BUFFERPERSO = NULL; - PALPERSO = NULL; + _characterBuffer = NULL; + _characterPalette = NULL; _characterSprite = NULL; ADR_ANIM = NULL; - TAILLEPERSO = 0; + _characterSize = 0; STATI = 0; PLIGNE1 = PLIGNE2 = 0; PLIGNE3 = PLIGNE4 = 0; @@ -69,45 +69,42 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.no_scroll = 1; bool oldDisableInventFl = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; - BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); - TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == g_PTRNUL) { + _characterBuffer = _vm->_fileManager.searchCat(filename, 5); + _characterSize = _vm->_globals._catalogSize; + if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; - RENVOIE_FICHIER(40, v16, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer); + RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); + RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); if (_vm->_globals.FR == 1) { - FREPON = FQUEST = "RUE.TXT"; + _answersFilename = _questionsFilename = "RUE.TXT"; } else if (!_vm->_globals.FR) { - FREPON = FQUEST = "RUEAN.TXT"; + _answersFilename = _questionsFilename = "RUEAN.TXT"; } else if (_vm->_globals.FR == 2) { - FREPON = FQUEST = "RUEES.TXT"; + _answersFilename = _questionsFilename = "RUEES.TXT"; } - v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); - v3 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + v3 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _characterSprite = _vm->_fileManager.searchCat(v16, 7); if (_characterSprite) { - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v16); } else { - _vm->_globals.CAT_FLAG = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - else if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; @@ -141,7 +138,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; - BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; @@ -184,35 +181,35 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { STATI = 1; bool v7 = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; - BUFFERPERSO = _vm->_fileManager.searchCat(filename, 5); - TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == g_PTRNUL) { + _characterBuffer = _vm->_fileManager.searchCat(filename, 5); + _characterSize = _vm->_globals._catalogSize; + if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals.SAUVEGARDE->data[svField4] = 0; - RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); + RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); switch (_vm->_globals.FR) { case 0: - FQUEST = "RUEAN.TXT"; - FREPON = "RUEAN.TXT"; + _questionsFilename = "RUEAN.TXT"; + _answersFilename = "RUEAN.TXT"; break; case 1: - FQUEST = "RUE.TXT"; - FREPON = "RUE.TXT"; + _questionsFilename = "RUE.TXT"; + _answersFilename = "RUE.TXT"; break; case 2: - FQUEST = "RUEES.TXT"; - FREPON = "RUEES.TXT"; + _questionsFilename = "RUEES.TXT"; + _answersFilename = "RUEES.TXT"; break; } - int v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + int v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; CHERCHE_PAL(PCHERCHE, 0); PLIGNE1 = v1; PLIGNE2 = v1 + 1; @@ -242,7 +239,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { while (v5 != -1); } - BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _vm->_eventsManager._mouseCursorId = v8; _vm->_eventsManager.changeMouseCursor(v8); @@ -281,8 +278,8 @@ int TalkManager::DIALOGUE() { int v21; if (STATI) { - v0 = BUFFERPERSO; - v1 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + v0 = _characterBuffer; + v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); if (v1) _vm->_objectsManager.BOBANIM_ON(v1); if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 1) @@ -297,17 +294,17 @@ int TalkManager::DIALOGUE() { VISU_WAIT(); } - v19 = VERIF_BOITE(PLIGNE1, FQUEST, 65); - v2 = VERIF_BOITE(PLIGNE2, FQUEST, 65); - v3 = VERIF_BOITE(PLIGNE3, FQUEST, 65); - v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, FQUEST, 65); + v19 = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); + v2 = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); + v3 = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); + v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, _questionsFilename, 65); v21 = v20 - 20 * v3; v18 = v20 - 20 * v3 - 1; v4 = v20 - 20 * v3 - 20 * v2; - _vm->_fontManager.initTextBuffers(5, PLIGNE1, FQUEST, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(6, PLIGNE2, FQUEST, 5, v4, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(7, PLIGNE3, FQUEST, 5, v21, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(8, PLIGNE4, FQUEST, 5, v20, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, v4, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, v21, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, v20, 0, 0, 0, 65, 255); _vm->_fontManager.showText(5); _vm->_fontManager.showText(6); _vm->_fontManager.showText(7); @@ -354,8 +351,8 @@ int TalkManager::DIALOGUE() { _vm->_fontManager.hideText(8); if (STATI) { - v11 = BUFFERPERSO; - v12 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 48); + v11 = _characterBuffer; + v12 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); if (v12) _vm->_objectsManager.BOBANIM_OFF(v12); v13 = (int16)READ_LE_UINT16((uint16 *)v11 + 49); @@ -406,10 +403,10 @@ int TalkManager::DIALOGUE_REP(int idx) { v1 = 0; v2 = 0; - v3 = BUFFERPERSO + 110; - for (i = idx; (int16)READ_LE_UINT16(v3) != idx; v3 = BUFFERPERSO + 20 * v1 + 110) { + v3 = _characterBuffer + 110; + for (i = idx; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) { ++v1; - if ((int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) < v1) + if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < v1) v2 = 1; if (v2 == 1) return -1; @@ -435,8 +432,8 @@ int TalkManager::DIALOGUE_REP(int idx) { if (!v6) v6 = 10; if (STATI) { - v8 = BUFFERPERSO; - v9 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v8 = _characterBuffer; + v9 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v9) _vm->_objectsManager.BOBANIM_ON(v9); v10 = (int16)READ_LE_UINT16((uint16 *)v8 + 44); @@ -456,7 +453,7 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.initTextBuffers(9, v22, FREPON, v25, v24, 20, 25, 5, v23, 252); + _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 20, 25, 5, v23, 252); _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICE_MIX(v22, 1)) { @@ -491,8 +488,8 @@ int TalkManager::DIALOGUE_REP(int idx) { if (!_vm->_soundManager.TEXTOFF) _vm->_fontManager.hideText(9); if (STATI) { - v15 = BUFFERPERSO; - v16 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v15 = _characterBuffer; + v16 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v16) _vm->_objectsManager.BOBANIM_OFF(v16); v17 = (int16)READ_LE_UINT16((uint16 *)v15 + 44); @@ -528,22 +525,22 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { v8 = 0; v4 = a1; for (;;) { - if ( *(BUFFERPERSO + v4) == 'P' - && *(BUFFERPERSO + v4 + 1) == 'A' - && *(BUFFERPERSO + v4 + 2) == 'L') { + if ( *(_characterBuffer + v4) == 'P' + && *(_characterBuffer + v4 + 1) == 'A' + && *(_characterBuffer + v4 + 2) == 'L') { v8 = 1; v2 = v4; } ++v4; if (v8 == 1) break; - if (TAILLEPERSO == v4) + if (_characterSize == v4) return; } v5 = v2 + 5; - palette = BUFFERPERSO + v5; - PALPERSO = BUFFERPERSO + v5; + palette = _characterBuffer + v5; + _characterPalette = _characterBuffer + v5; if (a2 == 0) { *(palette + 762) = 0; *(palette + 763) = 0; @@ -763,24 +760,24 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v3 = 0; v4 = a1; for (;;) { - if (*(BUFFERPERSO + v4) == 'A' - && *(BUFFERPERSO + v4 + 1) == 'N' - && *(BUFFERPERSO + v4 + 2) == 'I' - && *(BUFFERPERSO + v4 + 3) == 'M' - && *(BUFFERPERSO + v4 + 4) == 1) { + if (*(_characterBuffer + v4) == 'A' + && *(_characterBuffer + v4 + 1) == 'N' + && *(_characterBuffer + v4 + 2) == 'I' + && *(_characterBuffer + v4 + 3) == 'M' + && *(_characterBuffer + v4 + 4) == 1) { v3 = 1; v2 = v4; } ++v4; if (v3 == 1) break; - if (TAILLEPERSO == v4) + if (_characterSize == v4) return; } v5 = v2 + 25; - v9 = BUFFERPERSO + v5; - v8 = BUFFERPERSO + v5; - ADR_ANIM = BUFFERPERSO + v5; + v9 = _characterBuffer + v5; + v8 = _characterBuffer + v5; + ADR_ANIM = _characterBuffer + v5; if (!a2) { v6 = 0; do { @@ -810,38 +807,38 @@ void TalkManager::initCharacterAnim() { int v11; int v12; - v0 = BUFFERPERSO; - v1 = BUFFERPERSO + 110; - v2 = (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 43); + v0 = _characterBuffer; + v1 = _characterBuffer + 110; + v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v2) - searchCharacterAnim(21, (BUFFERPERSO + 110), v2, TAILLEPERSO); + searchCharacterAnim(21, (_characterBuffer + 110), v2, _characterSize); v4 = (int16)READ_LE_UINT16((uint16 *)v0 + 44); if (v4) - searchCharacterAnim(22, v1, v4, TAILLEPERSO); + searchCharacterAnim(22, v1, v4, _characterSize); v5 = (int16)READ_LE_UINT16((uint16 *)v0 + 45); if (v5) - searchCharacterAnim(23, v1, v5, TAILLEPERSO); + searchCharacterAnim(23, v1, v5, _characterSize); v6 = (int16)READ_LE_UINT16((uint16 *)v0 + 46); if (v6) - searchCharacterAnim(24, v1, v6, TAILLEPERSO); + searchCharacterAnim(24, v1, v6, _characterSize); v7 = (int16)READ_LE_UINT16((uint16 *)v0 + 47); if (v7) - searchCharacterAnim(25, v1, v7, TAILLEPERSO); + searchCharacterAnim(25, v1, v7, _characterSize); v8 = (int16)READ_LE_UINT16((uint16 *)v0 + 48); if (v8) - searchCharacterAnim(26, v1, v8, TAILLEPERSO); + searchCharacterAnim(26, v1, v8, _characterSize); v9 = (int16)READ_LE_UINT16((uint16 *)v0 + 49); if (v9) - searchCharacterAnim(27, v1, v9, TAILLEPERSO); + searchCharacterAnim(27, v1, v9, _characterSize); v10 = (int16)READ_LE_UINT16((uint16 *)v0 + 50); if (v10) - searchCharacterAnim(28, v1, v10, TAILLEPERSO); + searchCharacterAnim(28, v1, v10, _characterSize); v11 = (int16)READ_LE_UINT16((uint16 *)v0 + 51); if (v11) - searchCharacterAnim(29, v1, v11, TAILLEPERSO); + searchCharacterAnim(29, v1, v11, _characterSize); v12 = (int16)READ_LE_UINT16((uint16 *)v0 + 52); if (v12) - searchCharacterAnim(30, v1, v12, TAILLEPERSO); + searchCharacterAnim(30, v1, v12, _characterSize); } void TalkManager::clearCharacterAnim() { @@ -1158,9 +1155,7 @@ void TalkManager::REPONSE2(int a1, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - const char *v4; int v5; - bool v6; int v10; byte *v11; int v12; @@ -1186,45 +1181,40 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.NUMZONE = -1; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); - BUFFERPERSO = _vm->_fileManager.searchCat(a2, 5); - TAILLEPERSO = _vm->_globals.CAT_TAILLE; - if (BUFFERPERSO == g_PTRNUL) { + _characterBuffer = _vm->_fileManager.searchCat(a2, 5); + _characterSize = _vm->_globals._catalogSize; + if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, a2); - BUFFERPERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - TAILLEPERSO = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } - RENVOIE_FICHIER(40, v23, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(0, v22, (const char *)BUFFERPERSO); - RENVOIE_FICHIER(20, v20, (const char *)BUFFERPERSO); - v4 = "NULL"; + RENVOIE_FICHIER(40, v23, (const char *)_characterBuffer); + RENVOIE_FICHIER(0, v22, (const char *)_characterBuffer); + RENVOIE_FICHIER(20, v20, (const char *)_characterBuffer); v5 = 5; - v6 = v20 != v4; - if (!v6) { + if (v20 == "NULL") v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); - } + _characterSprite = _vm->_fileManager.searchCat(v23, 7); - if (_characterSprite) { - _vm->_globals.CAT_FLAG = false; + if (_characterSprite) _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v23); - } else { - _vm->_globals.CAT_FLAG = true; + else _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); - } + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); - _vm->_globals.CAT_FLAG = false; _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager.nbrligne == SCREEN_WIDTH) + if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); - if (_vm->_graphicsManager.nbrligne == (SCREEN_WIDTH * 2)) + else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); - if (!_vm->_graphicsManager.nbrligne) + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); - v10 = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + v10 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; CHERCHE_PAL(v10, 1); @@ -1262,7 +1252,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { clearCharacterAnim(); _vm->_globals.NOPARLE = false; _vm->_globals.NECESSAIRE = true; - BUFFERPERSO = _vm->_globals.freeMemory(BUFFERPERSO); + _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 3cb680d866..65b06bf8a4 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -34,13 +34,13 @@ class TalkManager { private: HopkinsEngine *_vm; public: - Common::String FQUEST; - Common::String FREPON; - byte *BUFFERPERSO; - byte *PALPERSO; + Common::String _questionsFilename; + Common::String _answersFilename; + byte *_characterBuffer; + byte *_characterPalette; byte *_characterSprite; byte *ADR_ANIM; - size_t TAILLEPERSO; + size_t _characterSize; int STATI; int PLIGNE1, PLIGNE2; int PLIGNE3, PLIGNE4; -- cgit v1.2.3 From 687b7f97df666c392af6f0f4ff3eca7832b1b313 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 20 Dec 2012 00:30:01 +0100 Subject: HOPKINS: Remane functions and variables from Globals --- engines/hopkins/anim.cpp | 18 ++-- engines/hopkins/computer.cpp | 4 +- engines/hopkins/detection.cpp | 16 ++-- engines/hopkins/dialogs.cpp | 10 +-- engines/hopkins/globals.cpp | 40 ++++----- engines/hopkins/globals.h | 38 ++++---- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/objects.cpp | 165 ++++++++++++++++------------------ engines/hopkins/saveload.cpp | 52 +++++------ engines/hopkins/saveload.h | 22 ++--- engines/hopkins/talk.cpp | 201 ++++++++++++++++++++---------------------- 11 files changed, 266 insertions(+), 304 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index d26b1b8b17..a45c49e45e 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -237,9 +237,9 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -311,7 +311,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_globals.freeMemory(v13); f.close(); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -385,7 +385,7 @@ LABEL_88: _vm->_globals.freeMemory(v13); f.close(); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -427,7 +427,7 @@ LABEL_88: _vm->_globals.freeMemory(v13); f.close(); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -506,7 +506,7 @@ LABEL_114: _vm->_graphicsManager.FADE_LINUX = 0; _vm->_globals.freeMemory(v13); - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); @@ -828,9 +828,9 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; } @@ -962,7 +962,7 @@ LABEL_59: f.close(); if (!NO_COUL) { - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_eventsManager._mouseFl = true; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 9509a849bd..610629e439 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -644,7 +644,7 @@ void ComputerManager::loadHiscore() { _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); ptr = _vm->_globals.allocMemory(100); - _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, ptr); + _vm->_saveLoadManager.load(_vm->_globals.NFICHIER, ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { @@ -1102,7 +1102,7 @@ void ComputerManager::saveScore() { } _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, ptr, 0x64u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, ptr, 0x64u); _vm->_globals.freeMemory(ptr); } diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 684854bb45..9ebf6837ea 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -140,10 +140,10 @@ SaveStateList HopkinsMetaEngine::listSaves(const char *target) const { if (in) { if (Hopkins::SaveLoadManager::readSavegameHeader(in, header)) { - saveList.push_back(SaveStateDescriptor(slot, header.saveName)); + saveList.push_back(SaveStateDescriptor(slot, header._saveName)); - header.thumbnail->free(); - delete header.thumbnail; + header._thumbnail->free(); + delete header._thumbnail; } delete in; @@ -173,11 +173,11 @@ SaveStateDescriptor HopkinsMetaEngine::querySaveMetaInfos(const char *target, in delete f; // Create the return descriptor - SaveStateDescriptor desc(slot, header.saveName); - desc.setThumbnail(header.thumbnail); - desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay); - desc.setSaveTime(header.saveHour, header.saveMinutes); - desc.setPlayTime(header.totalFrames * GAME_FRAME_TIME); + SaveStateDescriptor desc(slot, header._saveName); + desc.setThumbnail(header._thumbnail); + desc.setSaveDate(header._year, header._month, header._day); + desc.setSaveTime(header._hour, header._minute); + desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME); return desc; } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index a228b030ba..6efd7b7191 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -580,7 +580,7 @@ void DialogsManager::showLoadGame() { _vm->_objectsManager.SL_Y = 0; if (slotNumber != 7) { - _vm->_saveLoadManager.restore(slotNumber); + _vm->_saveLoadManager.loadGame(slotNumber); } _vm->_objectsManager.changeObject(14); @@ -617,7 +617,7 @@ void DialogsManager::showSaveGame() { saveName = Common::String::format("Save #%d", slotNumber); // Save the game - _vm->_saveLoadManager.save(slotNumber, saveName); + _vm->_saveLoadManager.saveGame(slotNumber, saveName); } } @@ -661,7 +661,7 @@ void DialogsManager::showSaveLoad(int a1) { for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { if (_vm->_saveLoadManager.readSavegameHeader(slotNumber, header)) { Graphics::Surface thumb8; - _vm->_saveLoadManager.convertThumb16To8(header.thumbnail, &thumb8); + _vm->_saveLoadManager.convertThumb16To8(header._thumbnail, &thumb8); thumb = (byte *)thumb8.pixels; @@ -687,8 +687,8 @@ void DialogsManager::showSaveLoad(int a1) { } thumb8.free(); - header.thumbnail->free(); - delete header.thumbnail; + header._thumbnail->free(); + delete header._thumbnail; } } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 5739cc1d74..6af81b819a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -461,9 +461,8 @@ void Globals::INIT_VBOB() { VBob[idx]._xp = 0; VBob[idx]._yp = 0; VBob[idx]._frameIndex = 0; - VBob[idx].fieldC = 0; VBob[idx]._surface = g_PTRNUL; - VBob[idx].spriteData = g_PTRNUL; + VBob[idx]._spriteData = g_PTRNUL; VBob[idx]._oldSpriteData = g_PTRNUL; } } @@ -474,9 +473,8 @@ void Globals::CLEAR_VBOB() { VBob[idx]._xp = 0; VBob[idx]._yp = 0; VBob[idx]._frameIndex = 0; - VBob[idx].fieldC = 0; VBob[idx]._surface = freeMemory(VBob[idx]._surface); - VBob[idx].spriteData = g_PTRNUL; + VBob[idx]._spriteData = g_PTRNUL; VBob[idx]._oldSpriteData = g_PTRNUL; } } @@ -489,7 +487,7 @@ void Globals::CHARGE_OBJET() { for (int idx = 0; idx < 300; ++idx) { ObjetW[idx].field0 = *srcP++; - ObjetW[idx].field1 = *srcP++; + ObjetW[idx]._idx = *srcP++; ObjetW[idx].field2 = *srcP++; ObjetW[idx].field3 = *srcP++; ObjetW[idx].field4 = *srcP++; @@ -522,15 +520,14 @@ void Globals::RESET_CACHE() { } for (int idx = 0; idx <= 20; ++idx) { - Cache[idx].fieldC = g_PTRNUL; - Cache[idx].field0 = 0; - Cache[idx].field4 = 0; - Cache[idx].field2 = 0; + Cache[idx]._spriteData = g_PTRNUL; + Cache[idx]._x = 0; + Cache[idx]._y = 0; + Cache[idx]._spriteIndex = 0; Cache[idx].fieldA = 0; - Cache[idx].field6 = 0; - Cache[idx].field8 = 0; - Cache[idx].field10 = 0; - Cache[idx].field12 = 0; + Cache[idx]._width = 0; + Cache[idx]._height = 0; + Cache[idx].field10 = false; Cache[idx].field14 = 0; } @@ -579,22 +576,21 @@ void Globals::loadCache(const Common::String &file) { int v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); int v6 = i; Cache[v6].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); - Cache[v6].field2 = v11; - Cache[v6].field0 = v4; - Cache[v6].field4 = v5; - Cache[v6].field12 = 1; + Cache[v6]._spriteIndex = v11; + Cache[v6]._x = v4; + Cache[v6]._y = v5; if (spriteData == g_PTRNUL) { Cache[i].fieldA = 0; } else { int v8 = _vm->_objectsManager.getWidth(spriteData, v11); int v9 = _vm->_objectsManager.getHeight(spriteData, v11); - Cache[i].fieldC = spriteData; - Cache[i].field6 = v8; - Cache[i].field8 = v9; + Cache[i]._spriteData = spriteData; + Cache[i]._width = v8; + Cache[i]._height = v9; Cache[i].fieldA = 1; } - if ( !Cache[i].field0 && !Cache[i].field4 && !Cache[i].field2) + if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) Cache[i].fieldA = 0; v15 += 5; } @@ -605,7 +601,7 @@ void Globals::loadCache(const Common::String &file) { } void Globals::B_CACHE_OFF(int idx) { - Bob[idx].field34 = 1; + Bob[idx].field34 = true; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index d1fdae57a8..db26cd8f4e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -96,25 +96,20 @@ struct BobItem { int _xp; int _yp; int _frameIndex; - int fieldE; - int field10; + int field10; // BOBPOSI ? int field12; int field14; - int field16; + bool field16; // set to true in BOBANIM_OFF() byte *_animData; - int field1C; + bool field1C; int field1E; int field20; int field22; - int offsetY; - int field26; - int field28; - int field2A; - int field2C; + int _offsetY; // Unused variable? byte *field30; - int field34; + bool field34; // Set to true in B_CACHE_OFF() int field36; - int field38; + int _modeFlag; bool _isSpriteFl; bool _activeFl; int _oldX; @@ -132,13 +127,11 @@ struct BlAnimItem { }; struct VBobItem { - byte *spriteData; + byte *_spriteData; int field4; int _xp; int _yp; int _frameIndex; - int fieldC; - int fieldE; byte *_surface; int _oldX; int _oldY; @@ -148,7 +141,7 @@ struct VBobItem { struct ObjetWItem { byte field0; - byte field1; + byte _idx; byte field2; byte field3; byte field4; @@ -180,15 +173,14 @@ struct TriItem { }; struct CacheItem { - int field0; - int field2; - int field4; - int field6; - int field8; + int _x; + int _spriteIndex; + int _y; + int _width; + int _height; int fieldA; - byte *fieldC; - int field10; - int field12; + byte *_spriteData; + bool field10; int field14; }; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 27504dce08..1792cf472a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -82,14 +82,14 @@ bool HopkinsEngine::canSaveGameStateCurrently() { * Load the savegame at the specified slot index */ Common::Error HopkinsEngine::loadGameState(int slot) { - return _saveLoadManager.restore(slot); + return _saveLoadManager.loadGame(slot); } /** * Save the game to the given slot index, and with the given name */ Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc) { - return _saveLoadManager.save(slot, desc); + return _saveLoadManager.saveGame(slot, desc); } Common::Error HopkinsEngine::run() { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0c632b02ce..5afd9fe922 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -111,9 +111,9 @@ void ObjectsManager::changeObject(int objIndex) { byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { byte *dataP; - dataP = 0; + dataP = NULL; int val1 = _vm->_globals.ObjetW[objIndex].field0; - int val2 = _vm->_globals.ObjetW[objIndex].field1; + int val2 = _vm->_globals.ObjetW[objIndex]._idx; if (mode == 1) ++val2; @@ -566,25 +566,20 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._xp = 0; bob._yp = 0; bob._frameIndex = 0; - bob.fieldE = 0; bob.field10 = 0; bob.field12 = 0; bob.field14 = 0; - bob.field16 = 0; + bob.field16 = false; bob._animData = g_PTRNUL; - bob.field1C = 0; + bob.field1C = false; bob.field1E = 0; bob.field20 = 0; bob.field22 = 0; - bob.offsetY = 0; - bob.field26 = 0; - bob.field28 = 0; - bob.field2A = 0; - bob.field2C = 0; + bob._offsetY = 0; bob.field30 = g_PTRNUL; - bob.field34 = 0; + bob.field34 = false; bob.field36 = 0; - bob.field38 = 0; + bob._modeFlag = 0; bob._oldX2 = 0; item._visibleFl = false; @@ -606,7 +601,7 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.Bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex, _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx]._oldY2, - _vm->_globals.Bob[idx].field38); + _vm->_globals.Bob[idx]._modeFlag); _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._xp = xp; @@ -672,7 +667,7 @@ void ObjectsManager::BOB_VISU(int idx) { if (_vm->_globals.Bank[v1]._fileHeader == 1) { _vm->_globals.Bob[idx]._isSpriteFl = true; _vm->_globals.Bob[idx].field36 = 0; - _vm->_globals.Bob[idx].field38 = 0; + _vm->_globals.Bob[idx]._modeFlag = 0; } _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; @@ -682,7 +677,7 @@ void ObjectsManager::BOB_VISU(int idx) { _vm->_globals.Bob[idx].field1E = v9; _vm->_globals.Bob[idx].field20 = v6; _vm->_globals.Bob[idx].field22 = v8; - _vm->_globals.Bob[idx].offsetY = offsetY; + _vm->_globals.Bob[idx]._offsetY = offsetY; } } } @@ -705,7 +700,7 @@ void ObjectsManager::BOB_ADJUST(int idx, int v) { } void ObjectsManager::BOB_OFFSETY(int idx, int v) { - _vm->_globals.Bob[idx].offsetY = v; + _vm->_globals.Bob[idx]._offsetY = v; } void ObjectsManager::SCBOB(int idx) { @@ -717,14 +712,14 @@ void ObjectsManager::SCBOB(int idx) { int v2 = _vm->_globals.Bob[v8]._oldWidth; int v9 = _vm->_globals.Bob[v8]._oldX + _vm->_globals.Bob[v8]._oldWidth; int v6 = _vm->_globals.Bob[v8]._oldY + _vm->_globals.Bob[v8]._oldHeight; - int v3 =_vm->_globals.Cache[idx].field0; - int v4 =_vm->_globals.Cache[idx].field4; - int v7 =_vm->_globals.Cache[idx].field6 + v3; - int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx].field8 + v4; + int v3 =_vm->_globals.Cache[idx]._x; + int v4 =_vm->_globals.Cache[idx]._y; + int v7 =_vm->_globals.Cache[idx]._width + v3; + int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + v4; if ((v6 > v4) && (v6 < v1)) { v1 = 0; - if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx].field6 + v3)) { + if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx]._width + v3)) { ++_vm->_globals.Cache[idx].fieldA; v1 = 1; } @@ -756,14 +751,14 @@ void ObjectsManager::SCBOB(int idx) { void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Bob[idx]._activeFl = false; if (_vm->_globals.Bob[idx]._isSpriteFl) { - _vm->_globals.Bob[idx].field38 = 0; + _vm->_globals.Bob[idx]._modeFlag = 0; _vm->_globals.Bob[idx].field36 = 0; } int result = _vm->_globals.Bob[idx]._frameIndex; if (result != 250) { int v5, v15, v22; - if (_vm->_globals.Bob[idx].field38) { + if (_vm->_globals.Bob[idx]._modeFlag) { v22 = v15 = get_offsetx(_vm->_globals.Bob[idx]._spriteData, result, 1); v5 = get_offsety(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex, 1); } else { @@ -872,12 +867,12 @@ void ObjectsManager::VERIFCACHE() { v1 = _sprite[v10].field2C; v11 = _sprite[v10].field30 + v1; v2 = _sprite[v10].field32 + _sprite[v10].field2E; - v6 = _vm->_globals.Cache[v8].field0; - v3 = _vm->_globals.Cache[v8].field4; - v9 = _vm->_globals.Cache[v8].field6 + v6; + v6 = _vm->_globals.Cache[v8]._x; + v3 = _vm->_globals.Cache[v8]._y; + v9 = _vm->_globals.Cache[v8]._width + v6; if (v2 > v3) { - if (v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + v3)) { + if (v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + v3)) { v4 = 0; if (v11 >= v6 && v11 <= v9) { ++_vm->_globals.Cache[v8].fieldA; @@ -911,19 +906,19 @@ void ObjectsManager::VERIFCACHE() { SCBOB(v8); if (_vm->_globals.Cache[v8].fieldA == v7) { - if (_vm->_globals.Cache[v8].field10 == 1) { - _vm->_globals.Cache[v8].field10 = 0; + if (_vm->_globals.Cache[v8].field10) { + _vm->_globals.Cache[v8].field10 = false; _vm->_globals.Cache[v8].fieldA = 1; } } else { - v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8].field8 + - _vm->_globals.Cache[v8].field4; + v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + + _vm->_globals.Cache[v8]._y; if (v5 > 440) v5 = 500; AvantTri(TRI_CACHE, v8, v5); _vm->_globals.Cache[v8].fieldA = 1; - _vm->_globals.Cache[v8].field10 = 1; + _vm->_globals.Cache[v8].field10 = true; } } } @@ -993,13 +988,13 @@ void ObjectsManager::DEF_SPRITE(int idx) { void ObjectsManager::DEF_CACHE(int idx) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1], - _vm->_globals.Cache[idx].field0 + 300, _vm->_globals.Cache[idx].field4 + 300, - _vm->_globals.Cache[idx].field2); + _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, + _vm->_globals.Cache[idx]._spriteIndex); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx].field0, - _vm->_globals.Cache[idx].field4, - _vm->_globals.Cache[idx].field0 + _vm->_globals.Cache[idx].field6, - _vm->_globals.Cache[idx].field4 + _vm->_globals.Cache[idx].field8); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx]._x, + _vm->_globals.Cache[idx]._y, + _vm->_globals.Cache[idx]._x + _vm->_globals.Cache[idx]._width, + _vm->_globals.Cache[idx]._y + _vm->_globals.Cache[idx]._height); } // Compute Sprite @@ -1143,11 +1138,8 @@ int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { // Display BOB Anim void ObjectsManager::AFF_BOB_ANIM() { int v1; - int v2; int v5; uint v6; - int v7; - int v8; int v10; int v11; int v12; @@ -1161,27 +1153,26 @@ void ObjectsManager::AFF_BOB_ANIM() { do { ++idx; if (idx <= 20 && PERSO_ON == true) { - _vm->_globals.Bob[idx].field1C = 0; + _vm->_globals.Bob[idx].field1C = false; continue; } if (_vm->_globals.Bob[idx].field0 == 10) { - _vm->_globals.Bob[idx].field1C = 0; + _vm->_globals.Bob[idx].field1C = false; v1 = _vm->_globals.Bob[idx].field20; if (v1 == -1) v1 = 50; if (_vm->_globals.Bob[idx]._animData == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) goto LABEL_38; - v2 = _vm->_globals.Bob[idx].field14; - if (_vm->_globals.Bob[idx].field12 == v2) { - _vm->_globals.Bob[idx].field1C = 1; + if (_vm->_globals.Bob[idx].field12 == _vm->_globals.Bob[idx].field14) { + _vm->_globals.Bob[idx].field1C = true; } else { - _vm->_globals.Bob[idx].field14 = v2 + 1; - _vm->_globals.Bob[idx].field1C = 0; + _vm->_globals.Bob[idx].field14++; + _vm->_globals.Bob[idx].field1C = false; } - if (_vm->_globals.Bob[idx].field1C != 1) + if (!_vm->_globals.Bob[idx].field1C) goto LABEL_38; v20 = _vm->_globals.Bob[idx]._animData + 20; @@ -1196,7 +1187,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); _vm->_globals.Bob[idx]._frameIndex = *(v20 + 2 * v24 + 8); - _vm->_globals.Bob[idx].field38 = *(v20 + 2 * v24 + 9); + _vm->_globals.Bob[idx]._modeFlag = *(v20 + 2 * v24 + 9); _vm->_globals.Bob[idx].field10 += 5; v5 = _vm->_globals.Bob[idx].field12; @@ -1210,18 +1201,16 @@ LABEL_38: v12 = idx; if ((unsigned int)(_vm->_globals.Bob[v12].field1E - 1) <= 1u) - _vm->_globals.Bob[v12].field1C = 1; + _vm->_globals.Bob[v12].field1C = true; continue; } _vm->_globals.Bob[idx].field12 = 1; } if (!_vm->_globals.Bob[idx].field12) { - v7 = _vm->_globals.Bob[idx].field20; - if (v7 > 0) - _vm->_globals.Bob[idx].field20 = v7 - 1; - v8 = _vm->_globals.Bob[idx].field20; - if (v8 != -1 && v8 <= 0) { + if (_vm->_globals.Bob[idx].field20 > 0) + _vm->_globals.Bob[idx].field20--; + if (_vm->_globals.Bob[idx].field20 != -1 && _vm->_globals.Bob[idx].field20 <= 0) { _vm->_globals.Bob[idx].field0 = 11; } else { _vm->_globals.Bob[idx].field10 = 0; @@ -1236,8 +1225,8 @@ LABEL_38: _vm->_globals.Bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); - _vm->_globals.Bob[idx]._frameIndex = *(v21 + 8); - _vm->_globals.Bob[idx].field38 = *(v21 + 9); + _vm->_globals.Bob[idx]._frameIndex = v21[8]; + _vm->_globals.Bob[idx]._modeFlag = v21[9]; _vm->_globals.Bob[idx].field10 += 5; v10 = _vm->_globals.Bob[idx].field12; @@ -1258,7 +1247,7 @@ LABEL_38: if (!PERSO_ON && BOBTOUS == true) { for (int v26 = 0; v26 != 35; v26++) { if (_vm->_globals.Bob[v26].field0 == 10 && !_vm->_globals.Bob[v26].field16) - _vm->_globals.Bob[v26].field1C = 1; + _vm->_globals.Bob[v26].field1C = true; } } @@ -1266,7 +1255,7 @@ LABEL_38: for (int v27 = 1; v27 < 35; v27++) { if (v27 > 20 || PERSO_ON != true) { - if ((_vm->_globals.Bob[v27].field0 == 10) && (_vm->_globals.Bob[v27].field1C == 1)) { + if ((_vm->_globals.Bob[v27].field0 == 10) && (_vm->_globals.Bob[v27].field1C)) { v14 = _vm->_globals.Bob[v27].field1E; if ((v14 != 2) && (v14 != 4)) { @@ -1298,7 +1287,7 @@ LABEL_38: for (int v28 = 1; v28 < 25; v28++) { _vm->_globals.Bob[v28]._oldY = 0; - if (_vm->_globals.Bob[v28].field0 == 10 && !_vm->_globals.Bob[v28].field16 && _vm->_globals.Bob[v28].field1C == 1) { + if (_vm->_globals.Bob[v28].field0 == 10 && !_vm->_globals.Bob[v28].field16 && _vm->_globals.Bob[v28].field1C) { CALCUL_BOB(v28); int v = _vm->_globals.Bob[v28]._oldHeight + _vm->_globals.Bob[v28]._oldY; v19 = _vm->_globals.Bob[v28]._oldX2 + v; @@ -1318,8 +1307,8 @@ void ObjectsManager::AFF_VBOB() { for (int idx = 0; idx <= 29; idx++) { if (_vm->_globals.VBob[idx].field4 == 4) { - width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); - height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); + width = getWidth(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); + height = getHeight(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, @@ -1337,7 +1326,7 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); _vm->_globals.VBob[idx].field4 = 0; - _vm->_globals.VBob[idx].spriteData = g_PTRNUL; + _vm->_globals.VBob[idx]._spriteData = g_PTRNUL; _vm->_globals.VBob[idx]._xp = 0; _vm->_globals.VBob[idx]._yp = 0; _vm->_globals.VBob[idx]._oldX = 0; @@ -1365,7 +1354,7 @@ void ObjectsManager::AFF_VBOB() { _vm->_globals.VBob[idx]._oldY + height); _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx].spriteData; + _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx]._spriteData; _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); @@ -1375,8 +1364,8 @@ void ObjectsManager::AFF_VBOB() { } if (_vm->_globals.VBob[idx].field4 == 1) { - width = getWidth(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); - height = getHeight(_vm->_globals.VBob[idx].spriteData, _vm->_globals.VBob[idx]._frameIndex); + width = getWidth(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); + height = getHeight(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); @@ -1386,7 +1375,7 @@ void ObjectsManager::AFF_VBOB() { _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaScreen, surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); - byte *v10 = _vm->_globals.VBob[idx].spriteData; + byte *v10 = _vm->_globals.VBob[idx]._spriteData; if (*v10 == 78) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaScreen, v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, @@ -1394,7 +1383,7 @@ void ObjectsManager::AFF_VBOB() { 0, 0, 0); _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, - _vm->_globals.VBob[idx].spriteData, + _vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex, 0, 0, 0); @@ -1403,7 +1392,7 @@ void ObjectsManager::AFF_VBOB() { v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx].spriteData, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, _vm->_globals.VBob[idx]._frameIndex); } @@ -4056,7 +4045,7 @@ void ObjectsManager::SPECIAL_JEU() { v1 = _vm->_globals.allocMemory(0x3E8u); memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); - _vm->_saveLoadManager.SAUVE_FICHIER("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -4072,7 +4061,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; - _vm->_saveLoadManager.bload("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); PERSO_ON = false; @@ -4166,22 +4155,19 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { _vm->_globals.VBob[idx]._oldX = xp; _vm->_globals.VBob[idx]._oldY = yp; _vm->_globals.VBob[idx]._oldFrameIndex = frameIndex; - _vm->_globals.VBob[idx].spriteData = src; + _vm->_globals.VBob[idx]._spriteData = src; _vm->_globals.VBob[idx]._oldSpriteData = src; _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); - } - - int f4 = _vm->_globals.VBob[idx].field4; - if (f4 == 2 || f4 == 4) { + } else if (_vm->_globals.VBob[idx].field4 == 2 || _vm->_globals.VBob[idx].field4 == 4) { _vm->_globals.VBob[idx].field4 = 3; _vm->_globals.VBob[idx]._oldX = _vm->_globals.VBob[idx]._xp; _vm->_globals.VBob[idx]._oldY = _vm->_globals.VBob[idx]._yp; - _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx].spriteData; + _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx]._spriteData; _vm->_globals.VBob[idx]._oldFrameIndex = _vm->_globals.VBob[idx]._frameIndex; _vm->_globals.VBob[idx]._xp = xp; _vm->_globals.VBob[idx]._yp = yp; _vm->_globals.VBob[idx]._frameIndex = frameIndex; - _vm->_globals.VBob[idx].spriteData = src; + _vm->_globals.VBob[idx]._spriteData = src; } } @@ -4415,7 +4401,7 @@ int ObjectsManager::BOBPOSI(int idx) { void ObjectsManager::BOBANIM_ON(int idx) { if (_vm->_globals.Bob[idx].field16) { - _vm->_globals.Bob[idx].field16 = 0; + _vm->_globals.Bob[idx].field16 = false; _vm->_globals.Bob[idx].field10 = 5; _vm->_globals.Bob[idx]._frameIndex = 250; _vm->_globals.Bob[idx].field12 = 0; @@ -4424,7 +4410,7 @@ void ObjectsManager::BOBANIM_ON(int idx) { } void ObjectsManager::BOBANIM_OFF(int idx) { - _vm->_globals.Bob[idx].field16 = 1; + _vm->_globals.Bob[idx].field16 = true; } @@ -4521,10 +4507,9 @@ void ObjectsManager::INILINK(const Common::String &file) { v11 = v40; _vm->_globals.Cache[v11].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); - _vm->_globals.Cache[v11].field2 = v8; - _vm->_globals.Cache[v11].field0 = v9; - _vm->_globals.Cache[v11].field4 = v10; - _vm->_globals.Cache[v11].field12 = 1; + _vm->_globals.Cache[v11]._spriteIndex = v8; + _vm->_globals.Cache[v11]._x = v9; + _vm->_globals.Cache[v11]._y = v10; if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[v40].fieldA = 0; @@ -4533,13 +4518,13 @@ void ObjectsManager::INILINK(const Common::String &file) { v13 = _vm->_globals.CACHE_BANQUE[1]; v14 = getWidth(v13, v8); v15 = getHeight(v13, v12); - _vm->_globals.Cache[v40].fieldC = v13; - _vm->_globals.Cache[v40].field6 = v14; - _vm->_globals.Cache[v40].field8 = v15; + _vm->_globals.Cache[v40]._spriteData = v13; + _vm->_globals.Cache[v40]._width = v14; + _vm->_globals.Cache[v40]._height = v15; _vm->_globals.Cache[v40].fieldA = 1; } - if (!_vm->_globals.Cache[v40].field0 && !_vm->_globals.Cache[v40].field4 - && !_vm->_globals.Cache[v40].field2) + if (!_vm->_globals.Cache[v40]._x && !_vm->_globals.Cache[v40]._y + && !_vm->_globals.Cache[v40]._spriteIndex) _vm->_globals.Cache[v40].fieldA = 0; v36 += 5; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 66afa9fcdf..1510e8e248 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -40,7 +40,7 @@ void SaveLoadManager::setParent(HopkinsEngine *vm) { _vm = vm; } -bool SaveLoadManager::bsave(const Common::String &file, const void *buf, size_t n) { +bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n) { Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file); if (f) { @@ -54,8 +54,8 @@ bool SaveLoadManager::bsave(const Common::String &file, const void *buf, size_t } // Save File -bool SaveLoadManager::SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n) { - return bsave(file, buf, n); +bool SaveLoadManager::saveFile(const Common::String &file, const void *buf, size_t n) { + return save(file, buf, n); } void SaveLoadManager::initSaves() { @@ -63,10 +63,10 @@ void SaveLoadManager::initSaves() { byte data[100]; Common::fill(&data[0], &data[100], 0); - SAUVE_FICHIER(dataFilename, data, 100); + saveFile(dataFilename, data, 100); } -void SaveLoadManager::bload(const Common::String &file, byte *buf) { +void SaveLoadManager::load(const Common::String &file, byte *buf) { Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(file); if (f == NULL) error("Error openinig file - %s", file.c_str()); @@ -78,34 +78,34 @@ void SaveLoadManager::bload(const Common::String &file, byte *buf) { bool SaveLoadManager::readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header) { char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; - header.thumbnail = NULL; + header._thumbnail = NULL; // Validate the header Id in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) return false; - header.version = in->readByte(); - if (header.version > HOPKINS_SAVEGAME_VERSION) + header._version = in->readByte(); + if (header._version > HOPKINS_SAVEGAME_VERSION) return false; // Read in the string - header.saveName.clear(); + header._saveName.clear(); char ch; - while ((ch = (char)in->readByte()) != '\0') header.saveName += ch; + while ((ch = (char)in->readByte()) != '\0') header._saveName += ch; // Get the thumbnail - header.thumbnail = Graphics::loadThumbnail(*in); - if (!header.thumbnail) + header._thumbnail = Graphics::loadThumbnail(*in); + if (!header._thumbnail) return false; // Read in save date/time - header.saveYear = in->readSint16LE(); - header.saveMonth = in->readSint16LE(); - header.saveDay = in->readSint16LE(); - header.saveHour = in->readSint16LE(); - header.saveMinutes = in->readSint16LE(); - header.totalFrames = in->readUint32LE(); + header._year = in->readSint16LE(); + header._month = in->readSint16LE(); + header._day = in->readSint16LE(); + header._hour = in->readSint16LE(); + header._minute = in->readSint16LE(); + header._totalFrames = in->readUint32LE(); return true; } @@ -117,7 +117,7 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg out->writeByte(HOPKINS_SAVEGAME_VERSION); // Write savegame name - out->write(header.saveName.c_str(), header.saveName.size() + 1); + out->write(header._saveName.c_str(), header._saveName.size() + 1); // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); @@ -137,7 +137,7 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg out->writeUint32LE(_vm->_eventsManager._gameCounter); } -Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { +Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName) { /* Pack any necessary data into the savegame data structure */ // Set the selected slot number _vm->_globals.SAUVEGARDE->data[svField10] = slot; @@ -157,8 +157,8 @@ Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { // Write out the savegame header hopkinsSavegameHeader header; - header.saveName = saveName; - header.version = HOPKINS_SAVEGAME_VERSION; + header._saveName = saveName; + header._version = HOPKINS_SAVEGAME_VERSION; writeSavegameHeader(saveFile, header); // Write out the savegame data @@ -171,7 +171,7 @@ Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { return Common::kNoError; } -Common::Error SaveLoadManager::restore(int slot) { +Common::Error SaveLoadManager::loadGame(int slot) { // Try and open the save file for reading Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( _vm->generateSaveName(slot)); @@ -184,9 +184,9 @@ Common::Error SaveLoadManager::restore(int slot) { // Read in the savegame header hopkinsSavegameHeader header; readSavegameHeader(saveFile, header); - if (header.thumbnail) - header.thumbnail->free(); - delete header.thumbnail; + if (header._thumbnail) + header._thumbnail->free(); + delete header._thumbnail; // Read in the savegame data syncSavegameData(serializer); diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index aa59fe7ba4..c2e9488223 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -36,12 +36,12 @@ class HopkinsEngine; #define HOPKINS_SAVEGAME_VERSION 1 struct hopkinsSavegameHeader { - uint8 version; - Common::String saveName; - Graphics::Surface *thumbnail; - int saveYear, saveMonth, saveDay; - int saveHour, saveMinutes; - int totalFrames; + uint8 _version; + Common::String _saveName; + Graphics::Surface *_thumbnail; + int _year, _month, _day; + int _hour, _minute; + int _totalFrames; }; class SaveLoadManager { @@ -55,15 +55,15 @@ public: void setParent(HopkinsEngine *vm); void initSaves(); - bool bsave(const Common::String &file, const void *buf, size_t n); - bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n); - void bload(const Common::String &file, byte *buf); + bool save(const Common::String &file, const void *buf, size_t n); + bool saveFile(const Common::String &file, const void *buf, size_t n); + void load(const Common::String &file, byte *buf); static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header); void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header); static bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); - Common::Error save(int slot, const Common::String &saveName); - Common::Error restore(int slot); + Common::Error saveGame(int slot, const Common::String &saveName); + Common::Error loadGame(int slot); /** * Converts a 16-bit thumbnail to 8 bit paletted using the currently active palette. diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ef2ff53e19..c339b0e1ad 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -100,9 +100,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -143,7 +143,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.NB_SCREEN(); _vm->_globals.NECESSAIRE = false; - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; @@ -733,7 +733,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { if ((int16)READ_LE_UINT16(v5 + 24)) { _vm->_globals.Bob[idx]._isSpriteFl = true; _vm->_globals.Bob[idx].field36 = 0; - _vm->_globals.Bob[idx].field38 = 0; + _vm->_globals.Bob[idx]._modeFlag = 0; _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals.Bob[idx].field0 = 10; v5 = _characterSprite; @@ -741,7 +741,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_globals.Bob[idx].field1E = v4; _vm->_globals.Bob[idx].field20 = -1; _vm->_globals.Bob[idx].field22 = 0; - _vm->_globals.Bob[idx].offsetY = 0; + _vm->_globals.Bob[idx]._offsetY = 0; } } } @@ -946,15 +946,13 @@ void TalkManager::REPONSE(int a1, int a2) { byte *v6; uint16 v7; byte *v8; - int v9; int v10; uint16 v11; int v12; int v13; - int v14; int v15; int v16; - int v17; + bool loopCond; byte *ptr; v2 = a1; @@ -964,11 +962,11 @@ LABEL_2: if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; for (;;) { - if ((*v5 == 'C') && (*(v5 + 1) == 'O') && (*(v5 + 2) == 'D')) { - if ((*(v5 + 3) == v2) && (*(v5 + 4) == v3)) + if (v5[0] == 'C' && v5[1] == 'O' && v5[2] == 'D') { + if (v5[3] == v2 && v5[4] == v3) v15 = 1; } - if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') + if (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N') break; if (!v15) v5 = v5 + 1; @@ -980,10 +978,10 @@ LABEL_2: memset(ptr, 0, 620); v7 = 0; v12 = 0; - v14 = 0; + loopCond = false; do { v16 = 0; - if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'C') { + if (v6[v7] == 'F' && v6[v7 + 1] == 'C') { ++v12; assert(v12 < (620 / 20)); @@ -991,26 +989,25 @@ LABEL_2: v11 = 0; do { assert(v11 < 20); - *(v11++ + v8) = *(v7++ + v6); - if (*(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'F') { + *(v11++ + v8) = v6[v7++]; + if (v6[v7] == 'F' && v6[v7] == 'F') { v16 = 1; - v9 = v11; - *(v9 + v8) = 'F'; - *(v8 + v9 + 1) = 'F'; + v8[v11] = 'F'; + v8[v11 + 1] = 'F'; ++v7; } } while (v16 != 1); } if (v16 != 1) { - if (*(v7 + v6) == 'C' && *(v6 + v7 + 1) == 'O' && *(v6 + v7 + 2) == 'D') - v14 = 1; - if (v16 != 1 && *(v7 + v6) == 'F' && *(v6 + v7 + 1) == 'I' && *(v6 + v7 + 2) == 'N') - v14 = 1; + if (v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') + loopCond = true; + if (v16 != 1 && v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N') + loopCond = true; } v6 += v7 + 1; v7 = 0; - } while (v14 != 1); - v17 = 0; + } while (!loopCond); + loopCond = false; v13 = 1; do { v10 = _vm->_scriptManager.Traduction(ptr + 20 * v13); @@ -1019,21 +1016,23 @@ LABEL_2: if (v10 == 2) v13 = _vm->_scriptManager.Control_Goto(ptr + 20 * v13); - if (v10 == 3) + else if (v10 == 3) v13 = _vm->_scriptManager.Control_If(ptr, v13); + if (v13 == -1) error("Invalid IFF function"); + if (v10 == 1 || v10 == 4) ++v13; - if (!v10 || v10 == 5) - v17 = 1; - if (v10 == 6) { + else if (!v10 || v10 == 5) + loopCond = true; + else if (v10 == 6) { _vm->_globals.freeMemory(ptr); v2 = _vm->_objectsManager.NVZONE; v3 = _vm->_objectsManager.NVVERBE; goto LABEL_2; } - } while (v17 != 1); + } while (!loopCond); _vm->_globals.freeMemory(ptr); _vm->_globals.SAUVEGARDE->data[svField2] = 0; return; @@ -1043,37 +1042,18 @@ LABEL_2: } void TalkManager::REPONSE2(int a1, int a2) { - signed int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - - v3 = 0; + int indx = 0; if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { - if ((uint16)(a1 - 22) <= 1u) { + if (a1 == 22 || a1 == 23) { _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); if (a1 == 22) { - v4 = _vm->_objectsManager.BOBX(3); - _vm->_objectsManager.BLOQUE_ANIMX(6, v4); - } - if (a1 == 23) { - v5 = _vm->_objectsManager.BOBX(4); - _vm->_objectsManager.BLOQUE_ANIMX(6, v5); - } - if (a1 == 22) { - v6 = _vm->_objectsManager.BOBX(3); - _vm->_objectsManager.BLOQUE_ANIMX(8, v6); - } - if (a1 == 23) { - v7 = _vm->_objectsManager.BOBX(4); - _vm->_objectsManager.BLOQUE_ANIMX(8, v7); + _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.BOBX(3)); + _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.BOBX(3)); + } else { // a1 == 23 + _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.BOBX(4)); + _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.BOBX(4)); } _vm->_objectsManager.BOBANIM_OFF(3); _vm->_objectsManager.BOBANIM_OFF(4); @@ -1082,46 +1062,46 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(6) <= 12 && _vm->_objectsManager.BOBPOSI(6) != 12); + while (_vm->_objectsManager.BOBPOSI(6) < 12); _vm->_objectsManager.BOBANIM_OFF(6); _vm->_objectsManager.BOBANIM_ON(8); - if (_vm->_globals.ECRAN == 35) - v3 = 201; - if (_vm->_globals.ECRAN == 36) - v3 = 203; - if (_vm->_globals.ECRAN == 37) - v3 = 205; - if (_vm->_globals.ECRAN == 38) - v3 = 207; - if (_vm->_globals.ECRAN == 39) - v3 = 209; - if (_vm->_globals.ECRAN == 40) - v3 = 211; - if (_vm->_globals.ECRAN == 41) - v3 = 213; - _vm->_globals.SAUVEGARDE->data[v3] = 2; + + switch (_vm->_globals.ECRAN) { + case 35: + indx = 201; + break; + case 36: + indx = 203; + break; + case 37: + indx = 205; + break; + case 38: + indx = 207; + break; + case 39: + indx = 209; + break; + case 40: + indx = 211; + break; + case 41: + indx = 213; + break; + } + _vm->_globals.SAUVEGARDE->data[indx] = 2; _vm->_objectsManager.ZONE_OFF(22); _vm->_objectsManager.ZONE_OFF(23); - } - if ((uint16)(a1 - 20) <= 1u) { + } else if (a1 == 20 || a1 == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); if (a1 == 20) { - v8 = _vm->_objectsManager.BOBX(1); - _vm->_objectsManager.BLOQUE_ANIMX(5, v8); - } - if (a1 == 21) { - v9 = _vm->_objectsManager.BOBX(2); - _vm->_objectsManager.BLOQUE_ANIMX(5, v9); - } - if (a1 == 20) { - v10 = _vm->_objectsManager.BOBX(1); - _vm->_objectsManager.BLOQUE_ANIMX(7, v10); - } - if (a1 == 21) { - v11 = _vm->_objectsManager.BOBX(2); - _vm->_objectsManager.BLOQUE_ANIMX(7, v11); + _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.BOBX(1)); + _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.BOBX(1)); + } else { // a1 == 21 + _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.BOBX(2)); + _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.BOBX(2)); } _vm->_objectsManager.BOBANIM_OFF(1); _vm->_objectsManager.BOBANIM_OFF(2); @@ -1130,24 +1110,33 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) <= 12 && _vm->_objectsManager.BOBPOSI(5) != 12); + while (_vm->_objectsManager.BOBPOSI(5) < 12); _vm->_objectsManager.BOBANIM_OFF(5); _vm->_objectsManager.BOBANIM_ON(7); - if (_vm->_globals.ECRAN == 35) - v3 = 200; - if (_vm->_globals.ECRAN == 36) - v3 = 202; - if (_vm->_globals.ECRAN == 37) - v3 = 204; - if (_vm->_globals.ECRAN == 38) - v3 = 206; - if (_vm->_globals.ECRAN == 39) - v3 = 208; - if (_vm->_globals.ECRAN == 40) - v3 = 210; - if (_vm->_globals.ECRAN == 41) - v3 = 212; - _vm->_globals.SAUVEGARDE->data[v3] = 2; + switch (_vm->_globals.ECRAN) { + case 35: + indx = 200; + break; + case 36: + indx = 202; + break; + case 37: + indx = 204; + break; + case 38: + indx = 206; + break; + case 39: + indx = 208; + break; + case 40: + indx = 210; + break; + case 41: + indx = 212; + break; + } + _vm->_globals.SAUVEGARDE->data[indx] = 2; _vm->_objectsManager.ZONE_OFF(21); _vm->_objectsManager.ZONE_OFF(20); } @@ -1206,9 +1195,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.SAUVE_FICHIER(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -1272,7 +1261,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (_vm->_globals.SORTIE == 101) _vm->_globals.SORTIE = 0; - _vm->_saveLoadManager.bload("TEMP.SCR", _vm->_graphicsManager._vesaScreen); + _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; -- cgit v1.2.3 From 664463d5d829d547a3f28ec40875dacecc78ca06 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 20 Dec 2012 08:35:11 +0100 Subject: HOPKINS: Fix bug introduced in previous commit, more renaming --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 52 +++---- engines/hopkins/objects.cpp | 348 +++++++++++++++++++++++--------------------- engines/hopkins/objects.h | 6 +- engines/hopkins/script.cpp | 246 +++++++++++++++---------------- engines/hopkins/talk.cpp | 110 +++++++------- 7 files changed, 387 insertions(+), 383 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 6af81b819a..2650018c58 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -77,7 +77,7 @@ Globals::Globals() { for (int i = 0; i < 8; ++i) Common::fill((byte *)&Bank[i], (byte *)&Bank[i] + sizeof(BankItem), 0); for (int i = 0; i < 36; ++i) - Common::fill((byte *)&Bob[i], (byte *)&Bob[i] + sizeof(BobItem), 0); + Common::fill((byte *)&_bob[i], (byte *)&_bob[i] + sizeof(BobItem), 0); for (int i = 0; i < 6; ++i) Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0); for (int i = 0; i < 35; ++i) @@ -601,7 +601,7 @@ void Globals::loadCache(const Common::String &file) { } void Globals::B_CACHE_OFF(int idx) { - Bob[idx].field34 = true; + _bob[idx].field34 = true; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index db26cd8f4e..7817eced0b 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -99,7 +99,7 @@ struct BobItem { int field10; // BOBPOSI ? int field12; int field14; - bool field16; // set to true in BOBANIM_OFF() + bool _disabledAnimationFl; byte *_animData; bool field1C; int field1E; @@ -309,7 +309,7 @@ public: CarreZoneItem CarreZone[101]; BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; - BobItem Bob[36]; + BobItem _bob[36]; ListeItem Liste[6]; Liste2Item Liste2[35]; BlAnimItem BL_ANIM[30]; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1792cf472a..68f0aa60a1 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -3591,8 +3591,8 @@ void HopkinsEngine::INTRORUN() { _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); - _objectsManager.BOBANIM_OFF(3); - _objectsManager.BOBANIM_OFF(5); + _objectsManager.stopBobAnimation(3); + _objectsManager.stopBobAnimation(5); _graphicsManager.ofscroll = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -3609,9 +3609,9 @@ void HopkinsEngine::INTRORUN() { for (uint i = 0; i < 200 / _globals._speed; ++i) _eventsManager.VBL(); - _objectsManager.BOBANIM_ON(3); + _objectsManager.setBobAnimation(3); _soundManager.VOICE_MIX(5, 3); - _objectsManager.BOBANIM_OFF(3); + _objectsManager.stopBobAnimation(3); _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager.Palette, 796); @@ -3638,9 +3638,9 @@ void HopkinsEngine::INTRORUN() { _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); _soundManager.WSOUND(23); - _objectsManager.BOBANIM_OFF(3); - _objectsManager.BOBANIM_OFF(5); - _objectsManager.BOBANIM_OFF(1); + _objectsManager.stopBobAnimation(3); + _objectsManager.stopBobAnimation(5); + _objectsManager.stopBobAnimation(1); _graphicsManager.ofscroll = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -3658,11 +3658,11 @@ void HopkinsEngine::INTRORUN() { int v9 = 0; while (!shouldQuit() && !_eventsManager._escKeyFl) { if (v9 == 12) { - _objectsManager.BOBANIM_ON(3); + _objectsManager.setBobAnimation(3); _eventsManager.VBL(); _soundManager.VOICE_MIX(6, 3); _eventsManager.VBL(); - _objectsManager.BOBANIM_OFF(3); + _objectsManager.stopBobAnimation(3); } Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); @@ -3694,13 +3694,13 @@ void HopkinsEngine::INTRORUN() { for (uint j = 1; j < 100 / _globals._speed; ++j) _eventsManager.VBL(); - _objectsManager.BOBANIM_ON(3); + _objectsManager.setBobAnimation(3); _soundManager.VOICE_MIX(7, 3); - _objectsManager.BOBANIM_OFF(3); + _objectsManager.stopBobAnimation(3); for (uint k = 1; k < 60 / _globals._speed; ++k) _eventsManager.VBL(); - _objectsManager.BOBANIM_ON(5); + _objectsManager.setBobAnimation(5); for (uint l = 0; l < 20 / _globals._speed; ++l) _eventsManager.VBL(); @@ -3709,9 +3709,9 @@ void HopkinsEngine::INTRORUN() { for (uint m = 0; m < 50 / _globals._speed; ++m) { if (m == 30 / _globals._speed) { - _objectsManager.BOBANIM_ON(3); + _objectsManager.setBobAnimation(3); _soundManager.VOICE_MIX(8, 3); - _objectsManager.BOBANIM_OFF(3); + _objectsManager.stopBobAnimation(3); } _eventsManager.VBL(); @@ -3818,7 +3818,7 @@ void HopkinsEngine::BOOM() { _graphicsManager.loadImage("IM15"); _animationManager.loadAnim("ANIM15"); _graphicsManager.VISU_ALL(); - _objectsManager.BOBANIM_OFF(7); + _objectsManager.stopBobAnimation(7); _globals.BPP_NOAFF = true; for (int idx = 0; idx < 5; ++idx) { @@ -3836,7 +3836,7 @@ void HopkinsEngine::BOOM() { _globals.NOPARLE = true; _talkManager.PARLER_PERSO2("vire.pe2"); _globals.NOPARLE = false; - _objectsManager.BOBANIM_ON(7); + _objectsManager.setBobAnimation(7); for (int idx = 0; idx < 100; ++idx) { _eventsManager.VBL(); @@ -4048,9 +4048,9 @@ void HopkinsEngine::JOUE_FIN() { _animationManager.loadAnim("ANIM100"); _graphicsManager.VISU_ALL(); _eventsManager.mouseOn(); - _objectsManager.BOBANIM_OFF(7); - _objectsManager.BOBANIM_OFF(8); - _objectsManager.BOBANIM_OFF(9); + _objectsManager.stopBobAnimation(7); + _objectsManager.stopBobAnimation(8); + _objectsManager.stopBobAnimation(9); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4072,10 +4072,10 @@ void HopkinsEngine::JOUE_FIN() { _globals.NOPARLE = true; _talkManager.PARLER_PERSO("GM4.PE2"); _globals._disableInventFl = true; - _objectsManager.BOBANIM_OFF(6); - _objectsManager.BOBANIM_OFF(10); - _objectsManager.BOBANIM_ON(9); - _objectsManager.BOBANIM_ON(7); + _objectsManager.stopBobAnimation(6); + _objectsManager.stopBobAnimation(10); + _objectsManager.setBobAnimation(9); + _objectsManager.setBobAnimation(7); do _eventsManager.VBL(); @@ -4110,7 +4110,7 @@ void HopkinsEngine::JOUE_FIN() { _eventsManager.VBL(); while (_objectsManager.BOBPOSI(7) != 120); - _objectsManager.BOBANIM_OFF(7); + _objectsManager.stopBobAnimation(7); if (_globals.SAUVEGARDE->data[svField135] == 1) { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; @@ -4152,8 +4152,8 @@ void HopkinsEngine::JOUE_FIN() { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; _animationManager.playAnim2("BERM.ANM", 100, 24, 300); - _objectsManager.BOBANIM_OFF(7); - _objectsManager.BOBANIM_ON(8); + _objectsManager.stopBobAnimation(7); + _objectsManager.setBobAnimation(8); _globals.NOPARLE = true; _talkManager.PARLER_PERSO("GM5.PE2"); _globals._disableInventFl = true; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5afd9fe922..42818b4e4a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -558,7 +558,7 @@ void ObjectsManager::INIT_BOB() { } void ObjectsManager::BOB_ZERO(int idx) { - BobItem &bob = _vm->_globals.Bob[idx]; + BobItem &bob = _vm->_globals._bob[idx]; Liste2Item &item = _vm->_globals.Liste2[idx]; bob.field0 = 0; @@ -569,7 +569,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field10 = 0; bob.field12 = 0; bob.field14 = 0; - bob.field16 = false; + bob._disabledAnimationFl = false; bob._animData = g_PTRNUL; bob.field1C = false; bob.field1E = 0; @@ -590,25 +590,25 @@ void ObjectsManager::BOB_ZERO(int idx) { } void ObjectsManager::DEF_BOB(int idx) { - if (_vm->_globals.Bob[idx]._activeFl) { - int xp = _vm->_globals.Bob[idx]._oldX; - int yp = _vm->_globals.Bob[idx]._oldY; + if (_vm->_globals._bob[idx]._activeFl) { + int xp = _vm->_globals._bob[idx]._oldX; + int yp = _vm->_globals._bob[idx]._oldY; - if (_vm->_globals.Bob[idx]._isSpriteFl) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.Bob[idx]._spriteData, - xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex); + if (_vm->_globals._bob[idx]._isSpriteFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._bob[idx]._spriteData, + xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, - _vm->_globals.Bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals.Bob[idx]._frameIndex, - _vm->_globals.Bob[idx].field4A, _vm->_globals.Bob[idx]._oldY2, - _vm->_globals.Bob[idx]._modeFlag); + _vm->_globals._bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex, + _vm->_globals._bob[idx].field4A, _vm->_globals._bob[idx]._oldY2, + _vm->_globals._bob[idx]._modeFlag); _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._xp = xp; _vm->_globals.Liste2[idx]._yp = yp; - _vm->_globals.Liste2[idx]._width = _vm->_globals.Bob[idx]._oldWidth; - _vm->_globals.Liste2[idx]._height = _vm->_globals.Bob[idx]._oldHeight; + _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; + _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; int v5 = _vm->_globals.Liste2[idx]._xp; if (v5 < _vm->_graphicsManager.min_x) { @@ -645,7 +645,7 @@ void ObjectsManager::DEF_BOB(int idx) { void ObjectsManager::BOB_VISU(int idx) { _priorityFl = true; - if (!_vm->_globals.Bob[idx].field0) { + if (!_vm->_globals._bob[idx].field0) { BOB_ZERO(idx); const byte *data = _vm->_globals.Bqe_Anim[idx]._data; @@ -662,22 +662,22 @@ void ObjectsManager::BOB_VISU(int idx) { v6 = -1; if ((int16)READ_LE_UINT16(data + 24)) { - _vm->_globals.Bob[idx]._isSpriteFl = false; + _vm->_globals._bob[idx]._isSpriteFl = false; if (_vm->_globals.Bank[v1]._fileHeader == 1) { - _vm->_globals.Bob[idx]._isSpriteFl = true; - _vm->_globals.Bob[idx].field36 = 0; - _vm->_globals.Bob[idx]._modeFlag = 0; + _vm->_globals._bob[idx]._isSpriteFl = true; + _vm->_globals._bob[idx].field36 = 0; + _vm->_globals._bob[idx]._modeFlag = 0; } - _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; - _vm->_globals.Bob[idx].field0 = 10; - _vm->_globals.Bob[idx]._spriteData = _vm->_globals.Bank[v1]._data; + _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _vm->_globals._bob[idx].field0 = 10; + _vm->_globals._bob[idx]._spriteData = _vm->_globals.Bank[v1]._data; - _vm->_globals.Bob[idx].field1E = v9; - _vm->_globals.Bob[idx].field20 = v6; - _vm->_globals.Bob[idx].field22 = v8; - _vm->_globals.Bob[idx]._offsetY = offsetY; + _vm->_globals._bob[idx].field1E = v9; + _vm->_globals._bob[idx].field20 = v6; + _vm->_globals._bob[idx].field22 = v8; + _vm->_globals._bob[idx]._offsetY = offsetY; } } } @@ -685,22 +685,22 @@ void ObjectsManager::BOB_VISU(int idx) { } void ObjectsManager::BOB_OFF(int idx) { - if (_vm->_globals.Bob[idx].field0 == 3) - _vm->_globals.Bob[idx].field0 = 4; - else if (_vm->_globals.Bob[idx].field0 == 10) - _vm->_globals.Bob[idx].field0 = 11; + if (_vm->_globals._bob[idx].field0 == 3) + _vm->_globals._bob[idx].field0 = 4; + else if (_vm->_globals._bob[idx].field0 == 10) + _vm->_globals._bob[idx].field0 = 11; } void ObjectsManager::BOB_OFFSET(int idx, int v) { - _vm->_globals.Bob[idx]._oldX2 = v; + _vm->_globals._bob[idx]._oldX2 = v; } void ObjectsManager::BOB_ADJUST(int idx, int v) { - _vm->_globals.Bob[idx]._oldX2 = v; + _vm->_globals._bob[idx]._oldX2 = v; } void ObjectsManager::BOB_OFFSETY(int idx, int v) { - _vm->_globals.Bob[idx]._offsetY = v; + _vm->_globals._bob[idx]._offsetY = v; } void ObjectsManager::SCBOB(int idx) { @@ -708,10 +708,10 @@ void ObjectsManager::SCBOB(int idx) { return; for (int v8 = 0; v8 <= 20; v8++) { - if ((_vm->_globals.Bob[v8].field0) && (!_vm->_globals.Bob[v8].field16) && (!_vm->_globals.Bob[v8].field34) && (_vm->_globals.Bob[v8]._frameIndex != 250)) { - int v2 = _vm->_globals.Bob[v8]._oldWidth; - int v9 = _vm->_globals.Bob[v8]._oldX + _vm->_globals.Bob[v8]._oldWidth; - int v6 = _vm->_globals.Bob[v8]._oldY + _vm->_globals.Bob[v8]._oldHeight; + if ((_vm->_globals._bob[v8].field0) && (!_vm->_globals._bob[v8]._disabledAnimationFl) && (!_vm->_globals._bob[v8].field34) && (_vm->_globals._bob[v8]._frameIndex != 250)) { + int v2 = _vm->_globals._bob[v8]._oldWidth; + int v9 = _vm->_globals._bob[v8]._oldX + _vm->_globals._bob[v8]._oldWidth; + int v6 = _vm->_globals._bob[v8]._oldY + _vm->_globals._bob[v8]._oldHeight; int v3 =_vm->_globals.Cache[idx]._x; int v4 =_vm->_globals.Cache[idx]._y; int v7 =_vm->_globals.Cache[idx]._width + v3; @@ -749,28 +749,28 @@ void ObjectsManager::SCBOB(int idx) { } void ObjectsManager::CALCUL_BOB(int idx) { - _vm->_globals.Bob[idx]._activeFl = false; - if (_vm->_globals.Bob[idx]._isSpriteFl) { - _vm->_globals.Bob[idx]._modeFlag = 0; - _vm->_globals.Bob[idx].field36 = 0; + _vm->_globals._bob[idx]._activeFl = false; + if (_vm->_globals._bob[idx]._isSpriteFl) { + _vm->_globals._bob[idx]._modeFlag = 0; + _vm->_globals._bob[idx].field36 = 0; } - int result = _vm->_globals.Bob[idx]._frameIndex; + int result = _vm->_globals._bob[idx]._frameIndex; if (result != 250) { int v5, v15, v22; - if (_vm->_globals.Bob[idx]._modeFlag) { - v22 = v15 = get_offsetx(_vm->_globals.Bob[idx]._spriteData, result, 1); - v5 = get_offsety(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex, 1); + if (_vm->_globals._bob[idx]._modeFlag) { + v22 = v15 = get_offsetx(_vm->_globals._bob[idx]._spriteData, result, 1); + v5 = get_offsety(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); } else { - v22 = v15 = get_offsetx(_vm->_globals.Bob[idx]._spriteData, result, 0); - v5 = get_offsety(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex, 0); + v22 = v15 = get_offsetx(_vm->_globals._bob[idx]._spriteData, result, 0); + v5 = get_offsety(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); } int v17 = v5; int v6 = v5; int v21 = 0; int v20 = 0; - int v7 = _vm->_globals.Bob[idx].field36; + int v7 = _vm->_globals._bob[idx].field36; if (v7 < 0) { v7 = -v7; @@ -778,8 +778,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (v7 > 95) v20 = 95; } - if (_vm->_globals.Bob[idx].field36 > 0) - v21 = _vm->_globals.Bob[idx].field36; + if (_vm->_globals._bob[idx].field36 > 0) + v21 = _vm->_globals._bob[idx].field36; if (v21) { if (v15 >= 0) { v22 = _vm->_graphicsManager.zoomIn(v15, v21); @@ -816,20 +816,20 @@ void ObjectsManager::CALCUL_BOB(int idx) { } } - int v13 = _vm->_globals.Bob[idx]._xp - v22; - int v14 = _vm->_globals.Bob[idx]._yp - v17; - _vm->_globals.Bob[idx]._activeFl = true; - _vm->_globals.Bob[idx]._oldX = v13; - _vm->_globals.Bob[idx]._oldY = v14; - _vm->_globals.Bob[idx]._oldY2 = v21; - _vm->_globals.Bob[idx].field4A = v20; + int v13 = _vm->_globals._bob[idx]._xp - v22; + int v14 = _vm->_globals._bob[idx]._yp - v17; + _vm->_globals._bob[idx]._activeFl = true; + _vm->_globals._bob[idx]._oldX = v13; + _vm->_globals._bob[idx]._oldY = v14; + _vm->_globals._bob[idx]._oldY2 = v21; + _vm->_globals._bob[idx].field4A = v20; _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._xp = v13; _vm->_globals.Liste2[idx]._yp = v14; - int width = getWidth(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex); - int height = getHeight(_vm->_globals.Bob[idx]._spriteData, _vm->_globals.Bob[idx]._frameIndex); + int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); + int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); if (v21) { width = _vm->_graphicsManager.zoomIn(width, v21); @@ -842,8 +842,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Liste2[idx]._width = width; _vm->_globals.Liste2[idx]._height = height; - _vm->_globals.Bob[idx]._oldWidth = width; - _vm->_globals.Bob[idx]._oldHeight = height; + _vm->_globals._bob[idx]._oldWidth = width; + _vm->_globals._bob[idx]._oldHeight = height; } } @@ -1153,89 +1153,89 @@ void ObjectsManager::AFF_BOB_ANIM() { do { ++idx; if (idx <= 20 && PERSO_ON == true) { - _vm->_globals.Bob[idx].field1C = false; + _vm->_globals._bob[idx].field1C = false; continue; } - if (_vm->_globals.Bob[idx].field0 == 10) { - _vm->_globals.Bob[idx].field1C = false; - v1 = _vm->_globals.Bob[idx].field20; + if (_vm->_globals._bob[idx].field0 == 10) { + _vm->_globals._bob[idx].field1C = false; + v1 = _vm->_globals._bob[idx].field20; if (v1 == -1) v1 = 50; - if (_vm->_globals.Bob[idx]._animData == g_PTRNUL || _vm->_globals.Bob[idx].field16 || v1 <= 0) + if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) goto LABEL_38; - if (_vm->_globals.Bob[idx].field12 == _vm->_globals.Bob[idx].field14) { - _vm->_globals.Bob[idx].field1C = true; + if (_vm->_globals._bob[idx].field12 == _vm->_globals._bob[idx].field14) { + _vm->_globals._bob[idx].field1C = true; } else { - _vm->_globals.Bob[idx].field14++; - _vm->_globals.Bob[idx].field1C = false; + _vm->_globals._bob[idx].field14++; + _vm->_globals._bob[idx].field1C = false; } - if (!_vm->_globals.Bob[idx].field1C) + if (!_vm->_globals._bob[idx].field1C) goto LABEL_38; - v20 = _vm->_globals.Bob[idx]._animData + 20; - v24 = _vm->_globals.Bob[idx].field10; - _vm->_globals.Bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); + v20 = _vm->_globals._bob[idx]._animData + 20; + v24 = _vm->_globals._bob[idx].field10; + _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals.Bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; + _vm->_globals._bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; if ( PERSO_ON == true && idx > 20 ) - _vm->_globals.Bob[idx]._xp += _vm->_eventsManager._startPos.x; + _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals.Bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); - _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); - _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); - _vm->_globals.Bob[idx]._frameIndex = *(v20 + 2 * v24 + 8); - _vm->_globals.Bob[idx]._modeFlag = *(v20 + 2 * v24 + 9); - _vm->_globals.Bob[idx].field10 += 5; - v5 = _vm->_globals.Bob[idx].field12; + _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); + _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); + _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); + _vm->_globals._bob[idx]._frameIndex = *(v20 + 2 * v24 + 8); + _vm->_globals._bob[idx]._modeFlag = *(v20 + 2 * v24 + 9); + _vm->_globals._bob[idx].field10 += 5; + v5 = _vm->_globals._bob[idx].field12; if (v5 > 0) { v6 = v5 / _vm->_globals._speed; - _vm->_globals.Bob[idx].field12 = v5 / _vm->_globals._speed; + _vm->_globals._bob[idx].field12 = v5 / _vm->_globals._speed; if (v6 > 0) { LABEL_37: - _vm->_globals.Bob[idx].field14 = 1; + _vm->_globals._bob[idx].field14 = 1; LABEL_38: v12 = idx; - if ((unsigned int)(_vm->_globals.Bob[v12].field1E - 1) <= 1u) - _vm->_globals.Bob[v12].field1C = true; + if ((unsigned int)(_vm->_globals._bob[v12].field1E - 1) <= 1u) + _vm->_globals._bob[v12].field1C = true; continue; } - _vm->_globals.Bob[idx].field12 = 1; + _vm->_globals._bob[idx].field12 = 1; } - if (!_vm->_globals.Bob[idx].field12) { - if (_vm->_globals.Bob[idx].field20 > 0) - _vm->_globals.Bob[idx].field20--; - if (_vm->_globals.Bob[idx].field20 != -1 && _vm->_globals.Bob[idx].field20 <= 0) { - _vm->_globals.Bob[idx].field0 = 11; + if (!_vm->_globals._bob[idx].field12) { + if (_vm->_globals._bob[idx].field20 > 0) + _vm->_globals._bob[idx].field20--; + if (_vm->_globals._bob[idx].field20 != -1 && _vm->_globals._bob[idx].field20 <= 0) { + _vm->_globals._bob[idx].field0 = 11; } else { - _vm->_globals.Bob[idx].field10 = 0; - v21 = _vm->_globals.Bob[idx]._animData + 20; - _vm->_globals.Bob[idx]._xp = (int16)READ_LE_UINT16(v21); + _vm->_globals._bob[idx].field10 = 0; + v21 = _vm->_globals._bob[idx]._animData + 20; + _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals.Bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; + _vm->_globals._bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; if (PERSO_ON == true && idx > 20) - _vm->_globals.Bob[idx]._xp += _vm->_eventsManager._startPos.x; + _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals.Bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); - _vm->_globals.Bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); - _vm->_globals.Bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); - _vm->_globals.Bob[idx]._frameIndex = v21[8]; - _vm->_globals.Bob[idx]._modeFlag = v21[9]; - _vm->_globals.Bob[idx].field10 += 5; - v10 = _vm->_globals.Bob[idx].field12; + _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); + _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); + _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); + _vm->_globals._bob[idx]._frameIndex = v21[8]; + _vm->_globals._bob[idx]._modeFlag = v21[9]; + _vm->_globals._bob[idx].field10 += 5; + v10 = _vm->_globals._bob[idx].field12; if (v10 > 0) { v11 = v10 / _vm->_globals._speed; - _vm->_globals.Bob[idx].field12 = v10 / _vm->_globals._speed; + _vm->_globals._bob[idx].field12 = v10 / _vm->_globals._speed; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) - _vm->_globals.Bob[idx].field12 = 1; + _vm->_globals._bob[idx].field12 = 1; } } } @@ -1246,8 +1246,8 @@ LABEL_38: if (!PERSO_ON && BOBTOUS == true) { for (int v26 = 0; v26 != 35; v26++) { - if (_vm->_globals.Bob[v26].field0 == 10 && !_vm->_globals.Bob[v26].field16) - _vm->_globals.Bob[v26].field1C = true; + if (_vm->_globals._bob[v26].field0 == 10 && !_vm->_globals._bob[v26]._disabledAnimationFl) + _vm->_globals._bob[v26].field1C = true; } } @@ -1255,8 +1255,8 @@ LABEL_38: for (int v27 = 1; v27 < 35; v27++) { if (v27 > 20 || PERSO_ON != true) { - if ((_vm->_globals.Bob[v27].field0 == 10) && (_vm->_globals.Bob[v27].field1C)) { - v14 = _vm->_globals.Bob[v27].field1E; + if ((_vm->_globals._bob[v27].field0 == 10) && (_vm->_globals._bob[v27].field1C)) { + v14 = _vm->_globals._bob[v27].field1E; if ((v14 != 2) && (v14 != 4)) { if (_vm->_globals.Liste2[v27]._visibleFl) { @@ -1270,7 +1270,7 @@ LABEL_38: } } - if (_vm->_globals.Bob[v27].field0 == 11) { + if (_vm->_globals._bob[v27].field0 == 11) { if (_vm->_globals.Liste2[v27]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, @@ -1280,22 +1280,22 @@ LABEL_38: _vm->_globals.Liste2[v27]._visibleFl = false; } - _vm->_globals.Bob[v27].field0 = 0; + _vm->_globals._bob[v27].field0 = 0; } } } for (int v28 = 1; v28 < 25; v28++) { - _vm->_globals.Bob[v28]._oldY = 0; - if (_vm->_globals.Bob[v28].field0 == 10 && !_vm->_globals.Bob[v28].field16 && _vm->_globals.Bob[v28].field1C) { + _vm->_globals._bob[v28]._oldY = 0; + if (_vm->_globals._bob[v28].field0 == 10 && !_vm->_globals._bob[v28]._disabledAnimationFl && _vm->_globals._bob[v28].field1C) { CALCUL_BOB(v28); - int v = _vm->_globals.Bob[v28]._oldHeight + _vm->_globals.Bob[v28]._oldY; - v19 = _vm->_globals.Bob[v28]._oldX2 + v; + int v = _vm->_globals._bob[v28]._oldHeight + _vm->_globals._bob[v28]._oldY; + v19 = _vm->_globals._bob[v28]._oldX2 + v; if (v19 > 450) v19 = 600; - if (_vm->_globals.Bob[v28]._activeFl) + if (_vm->_globals._bob[v28]._activeFl) AvantTri(TRI_BOB, v28, v19); } } @@ -3710,15 +3710,15 @@ int ObjectsManager::MZONE() { if (_vm->_globals.BOBZONE_FLAG[v1]) { v3 = v2; v15 = v3; - if (_vm->_globals.Bob[v3].field0) { - if (_vm->_globals.Bob[v3]._frameIndex != 250) { - if (!_vm->_globals.Bob[v3].field16) { - v4 = _vm->_globals.Bob[v3]._oldX; + if (_vm->_globals._bob[v3].field0) { + if (_vm->_globals._bob[v3]._frameIndex != 250) { + if (!_vm->_globals._bob[v3]._disabledAnimationFl) { + v4 = _vm->_globals._bob[v3]._oldX; if (xp > v4) { - if (xp < _vm->_globals.Bob[v3]._oldWidth + v4) { - v5 = _vm->_globals.Bob[v3]._oldY; + if (xp < _vm->_globals._bob[v3]._oldWidth + v4) { + v5 = _vm->_globals._bob[v3]._oldY; if (yp > v5) { - if (yp < _vm->_globals.Bob[v3]._oldHeight + v5) { + if (yp < _vm->_globals._bob[v3]._oldHeight + v5) { v6 = v1; if (_vm->_globals.ZONEP[v1].field4 == -1) { _vm->_globals.ZONEP[v6]._destX = 0; @@ -3726,8 +3726,8 @@ int ObjectsManager::MZONE() { } if (!_vm->_globals.ZONEP[v6]._destX) { if (!_vm->_globals.ZONEP[v1]._destY) { - _vm->_globals.ZONEP[v6]._destX = _vm->_globals.Bob[v15]._oldWidth + _vm->_globals.Bob[v15]._oldX; - _vm->_globals.ZONEP[v1]._destY = _vm->_globals.Bob[v15]._oldHeight + _vm->_globals.Bob[v15]._oldY + 6; + _vm->_globals.ZONEP[v6]._destX = _vm->_globals._bob[v15]._oldWidth + _vm->_globals._bob[v15]._oldX; + _vm->_globals.ZONEP[v1]._destY = _vm->_globals._bob[v15]._oldHeight + _vm->_globals._bob[v15]._oldY + 6; _vm->_globals.ZONEP[v1].field4 = -1; } } @@ -4094,17 +4094,17 @@ void ObjectsManager::SPECIAL_JEU() { if (_vm->_globals.ECRAN == 57) { _vm->_globals._disableInventFl = true; if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { - BOBANIM_OFF(5); + stopBobAnimation(5); SET_BOBPOSI(5, 0); - BOBANIM_ON(6); + setBobAnimation(6); _vm->_globals.SAUVEGARDE->data[svField261] = 2; ZONE_OFF(15); _vm->_soundManager.PLAY_SOUND("SOUND75.WAV"); } if (_vm->_globals.SAUVEGARDE->data[svField261] == 2 && BOBPOSI(6) == 6) { - BOBANIM_OFF(6); + stopBobAnimation(6); SET_BOBPOSI(6, 0); - BOBANIM_ON(7); + setBobAnimation(7); ZONE_ON(14); _vm->_globals.SAUVEGARDE->data[svField261] = 3; } @@ -4117,7 +4117,7 @@ void ObjectsManager::SPECIAL_JEU() { while (BOBPOSI(8) != 3); _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); - BOBANIM_OFF(8); + stopBobAnimation(8); _vm->_globals.SAUVEGARDE->data[svField333] = 1; _vm->_globals._disableInventFl = false; } @@ -4367,22 +4367,24 @@ void ObjectsManager::ZONE_OFF(int idx) { } -void ObjectsManager::OPTI_ONE(int idx, int a2, int a3, int a4) { +void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { + // Set Hopkins animation and position if (a4 != 3) { - BOBANIM_ON(idx); - SET_BOBPOSI(idx, a2); + setBobAnimation(idx); + SET_BOBPOSI(idx, fromPosi); } + // Make Hopkins walk to the expected place do { _vm->_eventsManager.VBL(); - } while (a3 != BOBPOSI(idx)); + } while (destPosi != BOBPOSI(idx)); if (!a4) - BOBANIM_OFF(idx); - if (a4 == 4) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.Bob[idx]._spriteData, - _vm->_globals.Bob[idx]._oldX, _vm->_globals.Bob[idx]._oldY, _vm->_globals.Bob[idx]._frameIndex); - BOBANIM_OFF(idx); + stopBobAnimation(idx); + else if (a4 == 4) { + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals._bob[idx]._spriteData, + _vm->_globals._bob[idx]._oldX, _vm->_globals._bob[idx]._oldY, _vm->_globals._bob[idx]._frameIndex); + stopBobAnimation(idx); _vm->_eventsManager.VBL(); } } @@ -4396,40 +4398,48 @@ void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { } int ObjectsManager::BOBPOSI(int idx) { - return _vm->_globals.Bob[idx].field10 / 5; + return _vm->_globals._bob[idx].field10 / 5; } -void ObjectsManager::BOBANIM_ON(int idx) { - if (_vm->_globals.Bob[idx].field16) { - _vm->_globals.Bob[idx].field16 = false; - _vm->_globals.Bob[idx].field10 = 5; - _vm->_globals.Bob[idx]._frameIndex = 250; - _vm->_globals.Bob[idx].field12 = 0; - _vm->_globals.Bob[idx].field14 = 0; +/** + * Set Hopkins animation + */ +void ObjectsManager::setBobAnimation(int idx) { + if (_vm->_globals._bob[idx]._disabledAnimationFl) { + _vm->_globals._bob[idx]._disabledAnimationFl = false; + _vm->_globals._bob[idx].field10 = 5; + _vm->_globals._bob[idx]._frameIndex = 250; + _vm->_globals._bob[idx].field12 = 0; + _vm->_globals._bob[idx].field14 = 0; } } -void ObjectsManager::BOBANIM_OFF(int idx) { - _vm->_globals.Bob[idx].field16 = true; - +/** + * Stop Hopkins animation + */ +void ObjectsManager::stopBobAnimation(int idx) { + _vm->_globals._bob[idx]._disabledAnimationFl = true; } void ObjectsManager::SET_BOBPOSI(int idx, int a2) { - _vm->_globals.Bob[idx].field10 = 5 * a2; - _vm->_globals.Bob[idx].field12 = 0; - _vm->_globals.Bob[idx].field14 = 0; + _vm->_globals._bob[idx].field10 = 5 * a2; + _vm->_globals._bob[idx].field12 = 0; + _vm->_globals._bob[idx].field14 = 0; } -int ObjectsManager::BOBX(int idx) { - return _vm->_globals.Bob[idx]._xp; +/** + * Get X position + */ +int ObjectsManager::getBobPosX(int idx) { + return _vm->_globals._bob[idx]._xp; } int ObjectsManager::BOBY(int idx) { - return _vm->_globals.Bob[idx]._yp; + return _vm->_globals._bob[idx]._yp; } int ObjectsManager::BOBA(int idx) { - return _vm->_globals.Bob[idx]._frameIndex; + return _vm->_globals._bob[idx]._frameIndex; } void ObjectsManager::INILINK(const Common::String &file) { @@ -4664,7 +4674,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { } if (_vm->_globals.ECRAN == 93) { if (!_vm->_globals.SAUVEGARDE->data[svField333]) - BOBANIM_ON(8); + setBobAnimation(8); } if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { _vm->_eventsManager._mouseSpriteId = 4; @@ -4722,11 +4732,11 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { if (a1 != -1) - BOBANIM_ON(a1); + setBobAnimation(a1); if (a2 != -1) - BOBANIM_ON(a2); + setBobAnimation(a2); if (a3 != -1) - BOBANIM_ON(a3); + setBobAnimation(a3); if (!a7) { if (a1 != -1) SET_BOBPOSI(a1, a4); @@ -4742,7 +4752,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { _vm->_eventsManager._mouseButton = 0; if (a4 != 3) { - BOBANIM_ON(a1); + setBobAnimation(a1); SET_BOBPOSI(a1, a2); } @@ -4752,7 +4762,7 @@ void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { break; } while (a3 != BOBPOSI(a1)); if (!a4) - BOBANIM_OFF(a1); + stopBobAnimation(a1); } void ObjectsManager::VERBE_OFF(int idx, int a2) { @@ -5218,13 +5228,13 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) && a4 < getSpriteY(0) && a5 > getSpriteY(0)) { if (a6 == 1) - BOBANIM_ON(1); + setBobAnimation(1); if (a6 == 2) - BOBANIM_ON(2); + setBobAnimation(2); if (a6 == 3) - BOBANIM_ON(3); + setBobAnimation(3); if (a6 == 4) - BOBANIM_ON(4); + setBobAnimation(4); _vm->_globals.SAUVEGARDE->data[v6] = 1; } } @@ -5288,7 +5298,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.FADE_INW(); if (_vm->_globals.ECRAN == 61) { _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); - BOBANIM_OFF(3); + stopBobAnimation(3); _vm->_globals.NOT_VERIF = 1; g_old_x = getSpriteX(0); _vm->_globals.g_old_sens = -1; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 00eddfdd5e..623847124c 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -218,10 +218,10 @@ public: void OPTI_ONE(int a1, int a2, int a3, int a4); void AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img); int BOBPOSI(int idx); - void BOBANIM_ON(int idx); - void BOBANIM_OFF(int idx); + void setBobAnimation(int idx); + void stopBobAnimation(int idx); void SET_BOBPOSI(int idx, int a2); - int BOBX(int idx); + int getBobPosX(int idx); int BOBY(int idx); int BOBA(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1b6b1b89c0..1ec48259e8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -525,9 +525,9 @@ LABEL_1141: if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { int v75 = (int16)READ_LE_UINT16(a1 + 5); if (v75 <= 100) - _vm->_objectsManager.BOBANIM_ON(v75); + _vm->_objectsManager.setBobAnimation(v75); else - _vm->_objectsManager.BOBANIM_OFF(v75 - 100); + _vm->_objectsManager.stopBobAnimation(v75 - 100); v1 = 1; } if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { @@ -646,36 +646,36 @@ LABEL_1141: _vm->_globals.NBBLOC = 0; } if (v76 == 608) { - _vm->_objectsManager.BOBANIM_OFF(2); - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_OFF(4); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_OFF(11); - _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(11); + _vm->_objectsManager.stopBobAnimation(10); } if (v76 == 609) { - _vm->_objectsManager.BOBANIM_ON(2); - _vm->_objectsManager.BOBANIM_ON(3); - _vm->_objectsManager.BOBANIM_ON(4); - _vm->_objectsManager.BOBANIM_ON(6); - _vm->_objectsManager.BOBANIM_ON(11); - _vm->_objectsManager.BOBANIM_ON(10); + _vm->_objectsManager.setBobAnimation(2); + _vm->_objectsManager.setBobAnimation(3); + _vm->_objectsManager.setBobAnimation(4); + _vm->_objectsManager.setBobAnimation(6); + _vm->_objectsManager.setBobAnimation(11); + _vm->_objectsManager.setBobAnimation(10); } if (v76 == 611) { - _vm->_objectsManager.BOBANIM_ON(5); - _vm->_objectsManager.BOBANIM_ON(7); - _vm->_objectsManager.BOBANIM_ON(8); - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(12); - _vm->_objectsManager.BOBANIM_ON(13); + _vm->_objectsManager.setBobAnimation(5); + _vm->_objectsManager.setBobAnimation(7); + _vm->_objectsManager.setBobAnimation(8); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(12); + _vm->_objectsManager.setBobAnimation(13); } if (v76 == 610) { - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.BOBANIM_OFF(8); - _vm->_objectsManager.BOBANIM_OFF(9); - _vm->_objectsManager.BOBANIM_OFF(12); - _vm->_objectsManager.BOBANIM_OFF(13); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.stopBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(8); + _vm->_objectsManager.stopBobAnimation(9); + _vm->_objectsManager.stopBobAnimation(12); + _vm->_objectsManager.stopBobAnimation(13); } if (v76 == 10) _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); @@ -893,8 +893,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(9) != 36); _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(9); - _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_objectsManager.stopBobAnimation(9); + _vm->_objectsManager.stopBobAnimation(10); _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); } @@ -916,7 +916,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); int v18 = 0; _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); @@ -937,15 +937,15 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(7) == 19) v18 = 0; if (_vm->_objectsManager.BOBPOSI(7) == 19) - _vm->_objectsManager.BOBANIM_ON(3); + _vm->_objectsManager.setBobAnimation(3); _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_ON(6); - _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.setBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(3); } if (v76 == 50) { _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); @@ -985,14 +985,14 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(9) != v19); if (v19 == 12) { _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.stopBobAnimation(9); } _vm->_globals.CACHE_ON(); } if (v76 == 80) { _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(12); - _vm->_objectsManager.BOBANIM_ON(13); + _vm->_objectsManager.setBobAnimation(12); + _vm->_objectsManager.setBobAnimation(13); _vm->_objectsManager.SET_BOBPOSI(12, 0); _vm->_objectsManager.SET_BOBPOSI(13, 0); int v21 = 0; @@ -1015,16 +1015,16 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(4) == 6) v21 = 0; if (_vm->_objectsManager.BOBPOSI(13) == 8) { - _vm->_objectsManager.BOBANIM_OFF(13); - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.stopBobAnimation(13); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.setBobAnimation(4); _vm->_objectsManager.SET_BOBPOSI(4, 0); _vm->_objectsManager.SET_BOBPOSI(13, 0); } _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 16); - _vm->_objectsManager.BOBANIM_OFF(12); - _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.stopBobAnimation(12); + _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM27a"); @@ -1048,8 +1048,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(11); - _vm->_objectsManager.BOBANIM_ON(8); + _vm->_objectsManager.setBobAnimation(11); + _vm->_objectsManager.setBobAnimation(8); _vm->_objectsManager.SET_BOBPOSI(11, 0); _vm->_objectsManager.SET_BOBPOSI(8, 0); _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); @@ -1076,10 +1076,10 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(8) != 32); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(11); - _vm->_objectsManager.BOBANIM_OFF(8); - _vm->_objectsManager.BOBANIM_ON(5); - _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.stopBobAnimation(11); + _vm->_objectsManager.stopBobAnimation(8); + _vm->_objectsManager.setBobAnimation(5); + _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.SET_BOBPOSI(5, 0); _vm->_objectsManager.SET_BOBPOSI(6, 0); _vm->_soundManager.PLAY_WAV(3); @@ -1089,15 +1089,15 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 74); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(7); } if (v76 == 95) { - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(10); - _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(10); + _vm->_objectsManager.setBobAnimation(12); _vm->_objectsManager.SET_BOBPOSI(9, 0); _vm->_objectsManager.SET_BOBPOSI(10, 0); _vm->_objectsManager.SET_BOBPOSI(12, 0); @@ -1108,7 +1108,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(9) != 15); - _vm->_objectsManager.BOBANIM_OFF(9); + _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.SPRITE_ON(0); _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); do { @@ -1118,13 +1118,13 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 117); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); - _vm->_objectsManager.BOBANIM_OFF(12); - _vm->_objectsManager.BOBANIM_OFF(10); - _vm->_objectsManager.BOBANIM_ON(11); + _vm->_objectsManager.stopBobAnimation(12); + _vm->_objectsManager.stopBobAnimation(10); + _vm->_objectsManager.setBobAnimation(11); } if (v76 == 85) { - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.setBobAnimation(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); do { if (_vm->shouldQuit()) @@ -1132,8 +1132,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 6); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM24a"); _vm->_objectsManager.OBSSEUL = 0; @@ -1142,8 +1142,8 @@ LABEL_1141: if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(2, 0); - _vm->_objectsManager.BOBANIM_ON(1); - _vm->_objectsManager.BOBANIM_ON(2); + _vm->_objectsManager.setBobAnimation(1); + _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); int v25 = 0; do { @@ -1176,16 +1176,16 @@ LABEL_1141: v25 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(3, 0); - _vm->_objectsManager.BOBANIM_ON(1); - _vm->_objectsManager.BOBANIM_ON(3); + _vm->_objectsManager.setBobAnimation(1); + _vm->_objectsManager.setBobAnimation(3); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); int v26 = 0; do { @@ -1218,8 +1218,8 @@ LABEL_1141: v26 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.stopBobAnimation(3); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); _vm->_soundManager.DEL_SAMPLE(1); } @@ -1309,7 +1309,7 @@ LABEL_1141: _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.setBobAnimation(4); int v33 = 0; do { if (_vm->shouldQuit()) @@ -1335,10 +1335,10 @@ LABEL_1141: v33 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 72); - _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.stopBobAnimation(4); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { - _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.setBobAnimation(6); int v34 = 0; do { if (_vm->shouldQuit()) @@ -1364,10 +1364,10 @@ LABEL_1141: v34 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(6) != 72); - _vm->_objectsManager.BOBANIM_OFF(6); + _vm->_objectsManager.stopBobAnimation(6); } if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { - _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.setBobAnimation(5); int v35 = 0; do { if (_vm->shouldQuit()) @@ -1393,7 +1393,7 @@ LABEL_1141: v35 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 72); - _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.stopBobAnimation(5); } _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.ACTION_DOS(1); @@ -1401,7 +1401,7 @@ LABEL_1141: } if (v76 == 106) { _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.setBobAnimation(4); _vm->_objectsManager.SET_BOBPOSI(4, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); @@ -1433,12 +1433,12 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 77); - _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 107) { _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.setBobAnimation(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); @@ -1470,7 +1470,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 53); - _vm->_objectsManager.BOBANIM_OFF(5); + _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 210) { @@ -1479,7 +1479,7 @@ LABEL_1141: _vm->_animationManager.playSequence2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); - _vm->_objectsManager.BOBANIM_ON(9); + _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM73a"); _vm->_objectsManager.OBSSEUL = 0; @@ -1549,15 +1549,15 @@ LABEL_1141: _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(2, 0); _vm->_objectsManager.setSpriteIndex(0, 60); - _vm->_objectsManager.BOBANIM_OFF(4); - _vm->_objectsManager.BOBANIM_ON(1); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.setBobAnimation(1); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); - _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.stopBobAnimation(1); _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; @@ -1574,7 +1574,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); - _vm->_objectsManager.BOBANIM_ON(2); + _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); do { if (_vm->shouldQuit()) @@ -1582,24 +1582,24 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(2) != 10); - _vm->_objectsManager.BOBANIM_OFF(2); - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.setBobAnimation(4); } if (v76 == 201) { - _vm->_objectsManager.BOBANIM_ON(3); + _vm->_objectsManager.setBobAnimation(3); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 18); - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.setBobAnimation(4); } if (v76 == 203) { _vm->_globals.NO_VISU = true; _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.setBobAnimation(4); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1608,13 +1608,13 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(4) == 18) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); } while (_vm->_objectsManager.BOBPOSI(4) != 26); - _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.stopBobAnimation(4); _vm->_globals.NO_VISU = false; _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 204) { _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(3); + _vm->_objectsManager.setBobAnimation(3); _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); int v41 = 0; do { @@ -1629,12 +1629,12 @@ LABEL_1141: v41 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 50); - _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 205) { _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(4); + _vm->_objectsManager.setBobAnimation(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); int v42 = 0; do { @@ -1649,14 +1649,14 @@ LABEL_1141: v42 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 24); - _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 175) { _vm->_objectsManager.setSpriteIndex(0, 55); _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(9); - _vm->_objectsManager.BOBANIM_ON(10); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(10); _vm->_objectsManager.BOB_OFFSET(10, 300); _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); do { @@ -1665,8 +1665,8 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(10) != 7); - _vm->_objectsManager.BOBANIM_ON(6); - _vm->_objectsManager.BOBANIM_OFF(3); + _vm->_objectsManager.setBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(3); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1674,16 +1674,16 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(6) != 10); _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); - _vm->_objectsManager.BOBANIM_ON(7); - _vm->_objectsManager.BOBANIM_OFF(4); + _vm->_objectsManager.setBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(4); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(7) != 15); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_ON(8); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.setBobAnimation(8); _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); do { if (_vm->shouldQuit()) @@ -1691,11 +1691,11 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(8) != 76); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_OFF(7); - _vm->_objectsManager.BOBANIM_OFF(8); - _vm->_objectsManager.BOBANIM_OFF(9); - _vm->_objectsManager.BOBANIM_OFF(10); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(8); + _vm->_objectsManager.stopBobAnimation(9); + _vm->_objectsManager.stopBobAnimation(10); _vm->_objectsManager.SPRITE_ON(0); } if (v76 == 229) { @@ -1728,7 +1728,7 @@ LABEL_1141: } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); int v45 = 0; - _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.setBobAnimation(7); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1739,7 +1739,7 @@ LABEL_1141: } _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(7) != 15); - _vm->_objectsManager.BOBANIM_OFF(7); + _vm->_objectsManager.stopBobAnimation(7); _vm->_objectsManager.setSpriteX(0, 476); _vm->_objectsManager.setSpriteY(0, 278); _vm->_objectsManager.SPRITE_ON(0); @@ -1752,7 +1752,7 @@ LABEL_1141: if (v76 == 231) { _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(12); + _vm->_objectsManager.setBobAnimation(12); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1769,13 +1769,13 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 12); _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.BOBANIM_OFF(12); + _vm->_objectsManager.stopBobAnimation(12); _vm->_globals.CACHE_ON(); } if (v76 == 233) { _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.BOBANIM_ON(11); + _vm->_objectsManager.setBobAnimation(11); int v46 = 0; do { if (_vm->shouldQuit()) @@ -1785,9 +1785,9 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(11) == 10 && !v46) v46 = 1; } while (_vm->_objectsManager.BOBPOSI(11) != 13); - _vm->_objectsManager.BOBANIM_OFF(11); + _vm->_objectsManager.stopBobAnimation(11); _vm->_globals.CACHE_ON(); - _vm->_objectsManager.BOBANIM_ON(13); + _vm->_objectsManager.setBobAnimation(13); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1798,7 +1798,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals.NOPARLE = false; _vm->_graphicsManager.FADE_OUTW(); - _vm->_objectsManager.BOBANIM_OFF(13); + _vm->_objectsManager.stopBobAnimation(13); _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 94; } @@ -1903,7 +1903,7 @@ LABEL_1141: _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); } if (v76 == 240) { - _vm->_objectsManager.BOBANIM_ON(1); + _vm->_objectsManager.setBobAnimation(1); bool soundFlag = false; do { if (_vm->shouldQuit()) @@ -1923,8 +1923,8 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(1) == 25) soundFlag = false; } while (_vm->_objectsManager.BOBPOSI(1) != 32); - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_ON(2); + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); if (!_vm->_soundManager.TEXTOFF) { _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); @@ -2011,7 +2011,7 @@ LABEL_1141: } _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 34); - _vm->_objectsManager.BOBANIM_OFF(2); + _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 20; @@ -2208,9 +2208,9 @@ LABEL_1141: _vm->_globals.SORTIE = 100; } if (v76 == 55) { - _vm->_objectsManager.BOBANIM_OFF(1); + _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.OPTI_ONE(15, 0, 12, 0); - _vm->_objectsManager.BOBANIM_OFF(15); + _vm->_objectsManager.stopBobAnimation(15); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM19a"); _vm->_objectsManager.OBSSEUL = 0; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index c339b0e1ad..8394865e76 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -281,15 +281,15 @@ int TalkManager::DIALOGUE() { v0 = _characterBuffer; v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); if (v1) - _vm->_objectsManager.BOBANIM_ON(v1); + _vm->_objectsManager.setBobAnimation(v1); if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 1) - _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 49)); + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 49)); if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 2) - _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 50)); + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 50)); if ( (int16)READ_LE_UINT16((uint16 *)v0 + 48) != 3) - _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 51)); + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 51)); if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 4) - _vm->_objectsManager.BOBANIM_ON((int16)READ_LE_UINT16((uint16 *)v0 + 52)); + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 52)); } else { VISU_WAIT(); } @@ -354,19 +354,19 @@ int TalkManager::DIALOGUE() { v11 = _characterBuffer; v12 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); if (v12) - _vm->_objectsManager.BOBANIM_OFF(v12); + _vm->_objectsManager.stopBobAnimation(v12); v13 = (int16)READ_LE_UINT16((uint16 *)v11 + 49); if (v13 != 1) - _vm->_objectsManager.BOBANIM_OFF(v13); + _vm->_objectsManager.stopBobAnimation(v13); v14 = (int16)READ_LE_UINT16((uint16 *)v11 + 50); if (v14 != 2) - _vm->_objectsManager.BOBANIM_OFF(v14); + _vm->_objectsManager.stopBobAnimation(v14); v15 = (int16)READ_LE_UINT16((uint16 *)v11 + 51); if (v15 != 3) - _vm->_objectsManager.BOBANIM_OFF(v15); + _vm->_objectsManager.stopBobAnimation(v15); v16 = (int16)READ_LE_UINT16((uint16 *)v11 + 52); if (v16 != 4) - _vm->_objectsManager.BOBANIM_OFF(v16); + _vm->_objectsManager.stopBobAnimation(v16); } else { FIN_VISU_WAIT(); } @@ -435,19 +435,19 @@ int TalkManager::DIALOGUE_REP(int idx) { v8 = _characterBuffer; v9 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v9) - _vm->_objectsManager.BOBANIM_ON(v9); + _vm->_objectsManager.setBobAnimation(v9); v10 = (int16)READ_LE_UINT16((uint16 *)v8 + 44); if (v10) - _vm->_objectsManager.BOBANIM_ON(v10); + _vm->_objectsManager.setBobAnimation(v10); v11 = (int16)READ_LE_UINT16((uint16 *)v8 + 45); if (v11) - _vm->_objectsManager.BOBANIM_ON(v11); + _vm->_objectsManager.setBobAnimation(v11); v12 = (int16)READ_LE_UINT16((uint16 *)v8 + 46); if (v12) - _vm->_objectsManager.BOBANIM_ON(v12); + _vm->_objectsManager.setBobAnimation(v12); v13 = (int16)READ_LE_UINT16((uint16 *)v8 + 47); if (v13) - _vm->_objectsManager.BOBANIM_ON(v13); + _vm->_objectsManager.setBobAnimation(v13); } else { VISU_PARLE(); } @@ -491,19 +491,19 @@ int TalkManager::DIALOGUE_REP(int idx) { v15 = _characterBuffer; v16 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); if (v16) - _vm->_objectsManager.BOBANIM_OFF(v16); + _vm->_objectsManager.stopBobAnimation(v16); v17 = (int16)READ_LE_UINT16((uint16 *)v15 + 44); if (v17) - _vm->_objectsManager.BOBANIM_OFF(v17); + _vm->_objectsManager.stopBobAnimation(v17); v18 = (int16)READ_LE_UINT16((uint16 *)v15 + 45); if (v18) - _vm->_objectsManager.BOBANIM_OFF(v18); + _vm->_objectsManager.stopBobAnimation(v18); v19 = (int16)READ_LE_UINT16((uint16 *)v15 + 46); if (v19) - _vm->_objectsManager.BOBANIM_OFF(v19); + _vm->_objectsManager.stopBobAnimation(v19); v20 = (int16)READ_LE_UINT16((uint16 *)v15 + 47); if (v20) - _vm->_objectsManager.BOBANIM_OFF(v20); + _vm->_objectsManager.stopBobAnimation(v20); } else { FIN_VISU_PARLE(); } @@ -525,9 +525,7 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { v8 = 0; v4 = a1; for (;;) { - if ( *(_characterBuffer + v4) == 'P' - && *(_characterBuffer + v4 + 1) == 'A' - && *(_characterBuffer + v4 + 2) == 'L') { + if (_characterBuffer[v4] == 'P' && _characterBuffer[v4 + 1] == 'A' && _characterBuffer[v4 + 2] == 'L') { v8 = 1; v2 = v4; } @@ -724,24 +722,24 @@ void TalkManager::BOB_VISU_PARLE(int idx) { byte *v5; _vm->_objectsManager._priorityFl = true; - if (!_vm->_globals.Bob[idx].field0) { + if (!_vm->_globals._bob[idx].field0) { _vm->_objectsManager.BOB_ZERO(idx); v5 = _vm->_globals.Bqe_Anim[idx]._data; v4 = (int16)READ_LE_UINT16(v5 + 2); if (!v4) v4 = 1; if ((int16)READ_LE_UINT16(v5 + 24)) { - _vm->_globals.Bob[idx]._isSpriteFl = true; - _vm->_globals.Bob[idx].field36 = 0; - _vm->_globals.Bob[idx]._modeFlag = 0; - _vm->_globals.Bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; - _vm->_globals.Bob[idx].field0 = 10; + _vm->_globals._bob[idx]._isSpriteFl = true; + _vm->_globals._bob[idx].field36 = 0; + _vm->_globals._bob[idx]._modeFlag = 0; + _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _vm->_globals._bob[idx].field0 = 10; v5 = _characterSprite; - _vm->_globals.Bob[idx]._spriteData = _characterSprite; - _vm->_globals.Bob[idx].field1E = v4; - _vm->_globals.Bob[idx].field20 = -1; - _vm->_globals.Bob[idx].field22 = 0; - _vm->_globals.Bob[idx]._offsetY = 0; + _vm->_globals._bob[idx]._spriteData = _characterSprite; + _vm->_globals._bob[idx].field1E = v4; + _vm->_globals._bob[idx].field20 = -1; + _vm->_globals._bob[idx].field22 = 0; + _vm->_globals._bob[idx]._offsetY = 0; } } } @@ -760,11 +758,7 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { v3 = 0; v4 = a1; for (;;) { - if (*(_characterBuffer + v4) == 'A' - && *(_characterBuffer + v4 + 1) == 'N' - && *(_characterBuffer + v4 + 2) == 'I' - && *(_characterBuffer + v4 + 3) == 'M' - && *(_characterBuffer + v4 + 4) == 1) { + if (_characterBuffer[v4] == 'A' && _characterBuffer[v4 + 1] == 'N' && _characterBuffer[v4 + 2] == 'I' && _characterBuffer[v4 + 3] == 'M' && _characterBuffer[v4 + 4] == 1) { v3 = 1; v2 = v4; } @@ -990,7 +984,7 @@ LABEL_2: do { assert(v11 < 20); *(v11++ + v8) = v6[v7++]; - if (v6[v7] == 'F' && v6[v7] == 'F') { + if (v6[v7] == 'F' && v6[v7 + 1] == 'F') { v16 = 1; v8[v11] = 'F'; v8[v11 + 1] = 'F'; @@ -1049,22 +1043,22 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); if (a1 == 22) { - _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.BOBX(3)); - _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.BOBX(3)); + _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.getBobPosX(3)); + _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.getBobPosX(3)); } else { // a1 == 23 - _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.BOBX(4)); - _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.BOBX(4)); + _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.getBobPosX(4)); + _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.getBobPosX(4)); } - _vm->_objectsManager.BOBANIM_OFF(3); - _vm->_objectsManager.BOBANIM_OFF(4); - _vm->_objectsManager.BOBANIM_ON(6); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.setBobAnimation(6); _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(6) < 12); - _vm->_objectsManager.BOBANIM_OFF(6); - _vm->_objectsManager.BOBANIM_ON(8); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.setBobAnimation(8); switch (_vm->_globals.ECRAN) { case 35: @@ -1097,22 +1091,22 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); if (a1 == 20) { - _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.BOBX(1)); - _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.BOBX(1)); + _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.getBobPosX(1)); + _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.getBobPosX(1)); } else { // a1 == 21 - _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.BOBX(2)); - _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.BOBX(2)); + _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.getBobPosX(2)); + _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.getBobPosX(2)); } - _vm->_objectsManager.BOBANIM_OFF(1); - _vm->_objectsManager.BOBANIM_OFF(2); - _vm->_objectsManager.BOBANIM_ON(5); + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.setBobAnimation(5); _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) < 12); - _vm->_objectsManager.BOBANIM_OFF(5); - _vm->_objectsManager.BOBANIM_ON(7); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.setBobAnimation(7); switch (_vm->_globals.ECRAN) { case 35: indx = 200; -- cgit v1.2.3 From 2f77e933bab83b2415b623d2b594cee9daf4a2dc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 21 Dec 2012 01:26:11 +0100 Subject: HOPKINS: Remove some hex values --- engines/hopkins/graphics.cpp | 46 +++++++++++++++++++----------------- engines/hopkins/hopkins.cpp | 10 ++++---- engines/hopkins/objects.cpp | 56 ++++++++++++++++++++++---------------------- engines/hopkins/script.cpp | 10 ++++---- engines/hopkins/talk.cpp | 44 +++++++++++++++++----------------- 5 files changed, 84 insertions(+), 82 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a6992c0b23..793d2fe96c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -172,7 +172,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { unlockScreen(); _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); A_PCX320(_vesaScreen, _vm->_globals.NFICHIER, Palette); - memcpy(_vesaBuffer, _vesaScreen, 0xFA00u); + memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); max_x = 320; @@ -358,15 +358,15 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * filesize = f.size(); - f.read(surface, 0x80u); + f.read(surface, 128); v4 = filesize - 896; - ptr = _vm->_globals.allocMemory(0xFE00u); - if (v4 >= 0xFA00) { - v15 = v4 / 0xFA00 + 1; - v17 = 64000 * (v4 / 0xFA00) - v4; - if (((uint32)v17 & 0x80000000u) != 0) + ptr = _vm->_globals.allocMemory(65024); + if (v4 >= 64000) { + v15 = v4 / 64000 + 1; + v17 = 64000 * (v4 / 64000) - v4; + if (v17 < 0) v17 = -v17; - f.read(ptr, 0xFA00u); + f.read(ptr, 64000); v5 = 64000; } else { v15 = 1; @@ -388,7 +388,7 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * // i = v8; } v9 = *(ptr + v7++); - if (v9 > 0xC0u) { + if (v9 > 192) { v10 = v9 - 192; if (v7 == v5) { v7 = 0; @@ -835,7 +835,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) srcP = srcData; for (;;) { srcByte = *srcP; - if (*srcP < 0xDEu) + if (*srcP < 222) goto Video_Cont3_wVbe; if (srcByte == kByteStop) return; @@ -857,7 +857,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) srcP += 5; } Video_Cont3_wVbe: - if (srcByte > 0xD2u) { + if (srcByte > 210) { if (srcByte == (byte)-45) { destLen1 = *(srcP + 1); rleValue = *(srcP + 2); @@ -1571,7 +1571,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++spritePixelsP; if (!Agr_Flag_x) Agr_x = zoom2 + Agr_x; - if ((uint16)Agr_x < 0x64u) + if ((uint16)Agr_x < 100) break; Agr_x = Agr_x - 100; --spritePixelsP; @@ -1588,7 +1588,7 @@ R_Aff_Zoom_Larg_Cont1: ++Compteur_y; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; - if ((uint16)Agr_y < 0x64u) + if ((uint16)Agr_y < 100) break; Agr_y = Agr_y - 100; spritePixelsP = v46; @@ -1652,7 +1652,7 @@ R_Aff_Zoom_Larg_Cont1: ++spritePixelsP; if (!Agr_Flag_x) Agr_x = zoom2 + Agr_x; - if ((uint16)Agr_x < 0x64u) + if ((uint16)Agr_x < 100) break; Agr_x = Agr_x - 100; --spritePixelsP; @@ -1669,7 +1669,7 @@ Aff_Zoom_Larg_Cont1: dest1P = _lineNbr2 + v51; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; - if ((uint16)Agr_y < 0x64u) + if ((uint16)Agr_y < 100) break; Agr_y = Agr_y - 100; spritePixelsP = v45; @@ -1696,12 +1696,12 @@ Aff_Zoom_Larg_Cont1: int v65 = spriteHeight2; byte *v55 = v40; Red_y = Red + Red_y; - if ((uint16)Red_y < 0x64u) { + if ((uint16)Red_y < 100) { Red_x = 0; int v42 = v37; for (int v41 = _width; v41; v41--) { Red_x = Red + Red_x; - if ((uint16)Red_x < 0x64u) { + if ((uint16)Red_x < 100) { if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) *v40 = *spritePixelsP; --v40; @@ -1725,12 +1725,12 @@ Aff_Zoom_Larg_Cont1: int v64 = spriteHeight2; byte *v54 = dest1P; Red_y = Red + Red_y; - if ((uint16)Red_y < 0x64u) { + if ((uint16)Red_y < 100) { Red_x = 0; int v39 = 0; for (int v38 = _width; v38; v38--) { Red_x = Red + Red_x; - if ((uint16)Red_x < 0x64u) { + if ((uint16)Red_x < 100) { if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; @@ -2038,17 +2038,19 @@ void GraphicsManager::NB_SCREEN() { if (!_vm->_globals.NECESSAIRE) INIT_TABLE(50, 65, Palette); + if (_lineNbr == SCREEN_WIDTH) - Trans_bloc2(_vesaBuffer, TABLE_COUL, 307200); + Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT); else if (_lineNbr == (SCREEN_WIDTH * 2)) - Trans_bloc2(_vesaBuffer, TABLE_COUL, 614400); + Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT * 2); + lockScreen(); m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); unlockScreen(); destP = _vesaScreen; srcP = _vesaBuffer; - memcpy(_vesaScreen, _vesaBuffer, 0x95FFCu); + memcpy(_vesaScreen, _vesaBuffer, 614396); srcP = srcP + 614396; destP = destP + 614396; *destP = *srcP; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 68f0aa60a1..56b98ab950 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -747,8 +747,8 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.DD_VBL(); - memset(_graphicsManager._vesaBuffer, 0, 0x4B000u); - memset(_graphicsManager._vesaScreen, 0, 0x4B000u); + memset(_graphicsManager._vesaBuffer, 0, 307200); + memset(_graphicsManager._vesaScreen, 0, 307200); _graphicsManager.Cls_Pal(); _graphicsManager.RESET_SEGMENT_VESA(); break; @@ -848,7 +848,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 0x7CCu); + memset(_globals.SAUVEGARDE, 0, 1996); _globals.SORTIE = 0; for (;;) { @@ -3340,8 +3340,8 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.DD_VBL(); - memset(_graphicsManager._vesaBuffer, 0, 0x4B000u); - memset(_graphicsManager._vesaScreen, 0, 0x4B000u); + memset(_graphicsManager._vesaBuffer, 0, 307200); + memset(_graphicsManager._vesaScreen, 0, 307200); _graphicsManager.Cls_Pal(); _graphicsManager.RESET_SEGMENT_VESA(); break; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 42818b4e4a..bc79393f1d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1555,7 +1555,7 @@ void ObjectsManager::VERIFZONE() { if (_vm->_globals.PLAN_FLAG || _vm->_eventsManager._startPos.x >= v0 || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) - || (v1 = v2 - 1, (uint16)(v2 - 1) > 0x3Bu)) { + || (v1 = v2 - 1, (uint16)(v2 - 1) > 59)) { if (_visibleFl == true) FLAG_VISIBLE_EFFACE = 4; _visibleFl = false; @@ -1776,7 +1776,7 @@ LABEL_241: return; } if (_vm->_globals.g_old_sens == 3) { - if ((uint16)(_vm->_globals.g_old_anim - 24) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 24) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1815,7 +1815,7 @@ LABEL_23: } if (_vm->_globals.g_old_sens != 7) goto LABEL_43; - if ((uint16)(_vm->_globals.g_old_anim - 24) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 24) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1885,7 +1885,7 @@ LABEL_59: LABEL_60: if (_vm->_globals.g_old_sens != 5) goto LABEL_77; - if ((uint16)(_vm->_globals.g_old_anim - 48) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 48) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1917,7 +1917,7 @@ LABEL_76: LABEL_77: if (_vm->_globals.g_old_sens != 2) goto LABEL_96; - if ((uint16)(_vm->_globals.g_old_anim - 12) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 12) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1955,7 +1955,7 @@ LABEL_95: LABEL_96: if (_vm->_globals.g_old_sens != 8) goto LABEL_115; - if ((uint16)(_vm->_globals.g_old_anim - 12) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 12) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1993,7 +1993,7 @@ LABEL_114: LABEL_115: if (_vm->_globals.g_old_sens != 4) goto LABEL_134; - if ((uint16)(_vm->_globals.g_old_anim - 36) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 36) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2031,7 +2031,7 @@ LABEL_133: LABEL_134: if (_vm->_globals.g_old_sens != 6) goto LABEL_153; - if ((uint16)(_vm->_globals.g_old_anim - 36) > 0xBu) { + if ((uint16)(_vm->_globals.g_old_anim - 36) > 11) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2581,7 +2581,7 @@ void ObjectsManager::handleLeftButton() { destX = _vm->_eventsManager.getMouseX(); destY = _vm->_eventsManager.getMouseY(); - if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) { + if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 78) { v1 = _vm->_eventsManager._mouseCursorId; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); @@ -2595,30 +2595,30 @@ void ObjectsManager::handleLeftButton() { } if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 533) <= 0x1Au - && (uint16)(destY - 26) <= 0x21u) { + && (uint16)(destX - 533) <= 26 + && (uint16)(destY - 26) <= 33) { changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 533) <= 0x1Au - && (uint16)(destY - 26) <= 0x21u) { + && (uint16)(destX - 533) <= 26 + && (uint16)(destY - 26) <= 22) { changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { if (_vm->_globals.SAUVEGARDE->data[svField353] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 533) <= 0x1Au - && (uint16)(destY - 26) <= 0x21u) { + && (uint16)(destX - 533) <= 26 + && (uint16)(destY - 26) <= 33) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } if (_vm->_globals.SAUVEGARDE->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 567) <= 0x1Au - && (uint16)(destY - 26) <= 0x21u) { + && (uint16)(destX - 567) <= 26 + && (uint16)(destY - 26) <= 33) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); return; } @@ -3836,9 +3836,9 @@ void ObjectsManager::initBorder(int a1) { _borderPos.x = _vm->_graphicsManager.ofscroll + 374; if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u) _borderPos.x = _vm->_graphicsManager.ofscroll + 428; - if ((uint16)(a1 - 1) <= 0x1Cu) + if ((uint16)(a1 - 1) <= 28) _borderSpriteIndex = 0; - if ((uint16)(a1 - 30) <= 1u) + if ((uint16)(a1 - 30) <= 1) _borderSpriteIndex = 2; if (a1 == 30) _borderPos.y = 272; @@ -3856,11 +3856,11 @@ void ObjectsManager::initBorder(int a1) { _vm->_eventsManager._mouseCursorId = 2; if (a1 == 31) _vm->_eventsManager._mouseCursorId = 3; - if ((uint16)(a1 - 1) <= 0x1Cu) + if ((uint16)(a1 - 1) <= 28) _vm->_eventsManager._mouseCursorId = 8; if (a1 == 29) _vm->_eventsManager._mouseCursorId = 1; - if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals._inventory[a1]) { + if ((uint16)(a1 - 1) <= 27 && !_vm->_globals._inventory[a1]) { _vm->_eventsManager._mouseCursorId = 0; _borderPos = Common::Point(0, 0); _borderSpriteIndex = 0; @@ -4042,10 +4042,10 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); _vm->_globals.NOPARLE = false; if (!_vm->_globals.CENSURE) { - v1 = _vm->_globals.allocMemory(0x3E8u); - memcpy(v1, _vm->_graphicsManager.Palette, 0x301u); + v1 = _vm->_globals.allocMemory(1000); + memcpy(v1, _vm->_graphicsManager.Palette, 769); - _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -4065,7 +4065,7 @@ void ObjectsManager::SPECIAL_JEU() { g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); PERSO_ON = false; - memcpy(_vm->_graphicsManager.Palette, v1, 0x301u); + memcpy(_vm->_graphicsManager.Palette, v1, 769); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.freeMemory(v1); _vm->_graphicsManager.lockScreen(); @@ -4073,7 +4073,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_graphicsManager.unlockScreen(); v2 = _vm->_graphicsManager._vesaBuffer; v3 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu); + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); v3 = v3 + 614396; v2 = v2 + 614396; *v2 = *v3; @@ -4910,9 +4910,9 @@ int ObjectsManager::CALC_PROPRE(int idx) { v2 = 20 * (5 * v4 - 165) / -67; } if (v2 < 0) - return _vm->_graphicsManager.zoomOut(0x19u, -v2); + return _vm->_graphicsManager.zoomOut(25, -v2); if (v2 > 0) - return _vm->_graphicsManager.zoomIn(0x19u, v2); + return _vm->_graphicsManager.zoomIn(25, v2); return v1; } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1ec48259e8..e3fc59a990 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -587,7 +587,7 @@ LABEL_1141: else if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_graphicsManager.NOFADE = true; _vm->_globals.SORTIE = 151; } @@ -603,7 +603,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; - memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_globals.SORTIE = 151; } if (v76 == 605) { @@ -620,7 +620,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; - memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_globals.SORTIE = 151; } if (v76 == 606) { @@ -633,13 +633,13 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE3.ANM", 50, 14, 500); else if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); - memset(_vm->_graphicsManager._vesaBuffer, 0, 0x96000u); + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); } _vm->_globals.SORTIE = 6; } if (v76 == 607) { if (!_vm->_globals._internetFl) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 769); v1 = _vm->_graphicsManager.OLD_PAL[769]; _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 8394865e76..fb1d4c3c97 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -100,9 +100,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -162,11 +162,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.unlockScreen(); v8 = _vm->_graphicsManager._vesaBuffer; v9 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu); + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); v9 = v9 + 614396; v8 = v8 + 614396; *v8 = *v9; - v8 = v8 + 2; + v8 += 2; *v8 = *(v9 + 2); v10 = v8 + 1; _vm->_globals._disableInventFl = oldDisableInventFl; @@ -543,23 +543,23 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { *(palette + 762) = 0; *(palette + 763) = 0; *(palette + 764) = 0; - *(palette + 765) = 0xe0; - *(palette + 766) = 0xe0; - *(palette + 767) = 0xff; - *(palette + 759) = 0xff; - *(palette + 760) = 0xff; + *(palette + 765) = 224; + *(palette + 766) = 224; + *(palette + 767) = 255; + *(palette + 759) = 255; + *(palette + 760) = 255; *(palette + 761) = 86; *palette = 0; *(palette + 1) = 0; *(palette + 2) = 0; } if (a2 == 1) { - *(palette + 765) = 0xe0; - *(palette + 766) = 0xe0; - *(palette + 767) = 0xff; - *(palette + 759) = 0xff; - *(palette + 760) = 0xff; - *(palette + 761) = 0xff; + *(palette + 765) = 224; + *(palette + 766) = 224; + *(palette + 767) = 255; + *(palette + 759) = 255; + *(palette + 760) = 255; + *(palette + 761) = 255; *palette = 0; *(palette + 1) = 0; *(palette + 2) = 0; @@ -656,9 +656,9 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v19 = ptr; for (int i = 0; i < 2048; i++) { v13 = *v19; - if ((byte)(*v19 + 46) > 0x1Bu) { - if ((byte)(v13 + 80) > 0x1Bu) { - if ((byte)(v13 - 65) <= 0x19u || (byte)(v13 - 97) <= 0x19u) + if ((byte)(*v19 + 46) > 27) { + if ((byte)(v13 + 80) > 27) { + if ((byte)(v13 - 65) <= 25 || (byte)(v13 - 97) <= 25) v13 = 32; } else { v13 -= 79; @@ -1004,7 +1004,7 @@ LABEL_2: loopCond = false; v13 = 1; do { - v10 = _vm->_scriptManager.Traduction(ptr + 20 * v13); + v10 = _vm->_scriptManager.Traduction(ptr + 20 * v13); if (_vm->shouldQuit()) return; @@ -1189,9 +1189,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -1274,7 +1274,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); v14 = _vm->_graphicsManager._vesaBuffer; v15 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu); + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); v15 = v15 + 614396; v14 = v14 + 614396; WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15)); -- cgit v1.2.3 From d80790a8d848a69acc6809885a6d9663012cae05 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 21 Dec 2012 08:12:02 +0100 Subject: HOPKINS: Remove remaining hexa values --- engines/hopkins/anim.cpp | 104 ++++++++++++++++++++--------------------- engines/hopkins/computer.cpp | 12 ++--- engines/hopkins/dialogs.cpp | 30 ++++++------ engines/hopkins/events.cpp | 4 +- engines/hopkins/font.cpp | 22 ++++----- engines/hopkins/lines.cpp | 108 ++++++++++++++++++++----------------------- engines/hopkins/saveload.cpp | 2 +- 7 files changed, 137 insertions(+), 145 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a45c49e45e..d278f15a8d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -61,14 +61,14 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui hasScreenCopy = false; screenP = _vm->_graphicsManager._vesaScreen; - ptr = _vm->_globals.allocMemory(0x14u); + ptr = _vm->_globals.allocMemory(20); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) error("File not found - %s", _vm->_globals.NFICHIER.c_str()); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(_vm->_graphicsManager.Palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.skip(14); @@ -81,12 +81,12 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { hasScreenCopy = true; - screenCopy = _vm->_globals.allocMemory(0x4B000u); - memcpy(screenCopy, screenP, 0x4B000u); + screenCopy = _vm->_globals.allocMemory(307200); + memcpy(screenCopy, screenP, 307200); } if (NO_SEQ) { if (hasScreenCopy) - memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 0x4B000u); + memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); @@ -170,17 +170,17 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_soundManager.VERIF_SOUND(); EXIT: if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { - screenCopy = _vm->_globals.allocMemory(0x4B000u); + screenCopy = _vm->_globals.allocMemory(307200); f.seek(0); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(_vm->_graphicsManager.Palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.skip(14); f.read(screenP, nbytes); - memcpy(screenCopy, screenP, 0x4B000u); + memcpy(screenCopy, screenP, 307200); breakFlag = false; do { @@ -232,26 +232,26 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint v8 = 0; while (!_vm->shouldQuit()) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 0x301u); + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 769); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; v12 = _vm->_graphicsManager._vesaScreen; - v13 = _vm->_globals.allocMemory(0x14u); + v13 = _vm->_globals.allocMemory(20); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); f.read(&buf, 6); - f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(_vm->_graphicsManager.Palette, 800); f.read(&buf, 4); nbytes = f.readUint32LE(); f.readUint32LE(); @@ -273,12 +273,12 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.max_x = SCREEN_WIDTH; if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v8 = 1; - ptr = _vm->_globals.allocMemory(0x4B000u); - memcpy(ptr, v12, 0x4B000u); + ptr = _vm->_globals.allocMemory(307200); + memcpy(ptr, v12, 307200); } if (_vm->_animationManager.NO_SEQ) { if (v8 == 1) - memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 0x4B000u); + memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); @@ -314,7 +314,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -322,7 +322,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { - _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -345,10 +345,10 @@ LABEL_48: for (;;) { ++v15; _vm->_soundManager.playAnim_SOUND(v15); - memset(&buf, 0, 6u); - memset(v13, 0, 0x13u); + memset(&buf, 0, 6); + memset(v13, 0, 19); - if (f.read(v13, 0x10) != 0x10) + if (f.read(v13, 16) != 16) v5 = -1; if (strncmp((const char *)v13, "IMAGE=", 6)) @@ -388,7 +388,7 @@ LABEL_88: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -396,7 +396,7 @@ LABEL_88: _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { - _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -430,7 +430,7 @@ LABEL_88: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -438,7 +438,7 @@ LABEL_88: _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { - _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -462,12 +462,12 @@ LABEL_114: if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { byte *ptra; - ptra = _vm->_globals.allocMemory(0x4B000u); + ptra = _vm->_globals.allocMemory(307200); f.seek(0); f.read(&buf, 6); - f.read(_vm->_graphicsManager.Palette, 0x320u); - f.read(&buf, 4u); + f.read(_vm->_graphicsManager.Palette, 800); + f.read(&buf, 4); nbytes = f.readUint32LE(); f.readUint32LE(); @@ -478,12 +478,12 @@ LABEL_114: f.readUint16LE(); f.read(v12, nbytes); - memcpy(ptra, v12, 0x4B000u); + memcpy(ptra, v12, 307200); int v6 = 0; do { - memset(&buf, 0, 6u); - memset(v13, 0, 0x13u); + memset(&buf, 0, 6); + memset(v13, 0, 19); if (f.read(v13, 16) != 16) v6 = -1; if (strncmp((const char *)v13, "IMAGE=", 6)) @@ -509,7 +509,7 @@ LABEL_114: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 0x301u); + memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); _vm->_graphicsManager.Cls_Pal(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -517,7 +517,7 @@ LABEL_114: _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); if (_vm->_graphicsManager.DOUBLE_ECRAN) { - _vm->_graphicsManager.SCANLINE(0x500u); + _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -761,7 +761,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { } while (v8 != 1); _vm->_globals.Bqe_Anim[v19]._data = _vm->_globals.allocMemory(v7 + 50); _vm->_globals.Bqe_Anim[animIndex].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[v19]._data, v21 + data + 5, 0x14u); + memcpy(_vm->_globals.Bqe_Anim[v19]._data, v21 + data + 5, 20); byte *dataP = _vm->_globals.Bqe_Anim[v19]._data; v9 = dataP + 20; @@ -828,20 +828,20 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x4B000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 0x96000u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager._vesaScreen; - v10 = _vm->_globals.allocMemory(0x16u); + v10 = _vm->_globals.allocMemory(22); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(_vm->_graphicsManager.Palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.skip(14); @@ -849,12 +849,12 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v7 = 1; - ptr = _vm->_globals.allocMemory(0x4B000u); - memcpy(ptr, v9, 0x4B000u); + ptr = _vm->_globals.allocMemory(307200); + memcpy(ptr, v9, 307200); } if (_vm->_animationManager.NO_SEQ) { if (v7 == 1) - memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 0x4B000u); + memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); if (!_vm->getIsDemo()) { _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -910,7 +910,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui do { ++soundNumber; _vm->_soundManager.playAnim_SOUND(soundNumber); - memset(v10, 0, 0x13u); + memset(v10, 0, 19); if (f.read(v10, 16) != 16) readError = true; @@ -992,14 +992,14 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._mouseFl = false; v10 = _vm->_graphicsManager._vesaScreen; - v11 = _vm->_globals.allocMemory(0x16u); + v11 = _vm->_globals.allocMemory(22); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals.NFICHIER)) error("File not found - %s", _vm->_globals.NFICHIER.c_str()); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(_vm->_graphicsManager.Palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.readUint32LE(); @@ -1012,13 +1012,13 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { v7 = 1; - ptr = _vm->_globals.allocMemory(0x4B000u); - memcpy((void *)ptr, v10, 0x4B000u); + ptr = _vm->_globals.allocMemory(307200); + memcpy((void *)ptr, v10, 307200); } if (_vm->_animationManager.NO_SEQ) { if (v7 == 1) { assert(ptr != NULL); - memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 0x4B000u); + memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 307200); } _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); } else { @@ -1061,7 +1061,7 @@ LABEL_23: while (!_vm->shouldQuit()) { _vm->_soundManager.playAnim_SOUND(v13++); - memset(v11, 0, 0x13u); + memset(v11, 0, 19); if (f.read(v11, 16) != 16) v4 = true; @@ -1113,11 +1113,11 @@ LABEL_53: } LABEL_54: if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) { - byte *ptra = _vm->_globals.allocMemory(0x4B000u); + byte *ptra = _vm->_globals.allocMemory(307200); f.seek(0); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 0x320u); + f.read(_vm->_graphicsManager.Palette, 800); f.skip(4); nbytes = f.readUint32LE(); @@ -1130,10 +1130,10 @@ LABEL_54: f.read(v10, nbytes); - memcpy(ptra, v10, 0x4B000u); + memcpy(ptra, v10, 307200); bool v5 = false; do { - memset(v11, 0, 0x13u); + memset(v11, 0, 19); if (f.read(v11, 16) != 16) v5 = true; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 610629e439..1efc5fce66 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -297,7 +297,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(1000); - memset(_vm->_graphicsManager._vesaBuffer, 0, 0x4AFFFu); + memset(_vm->_graphicsManager._vesaBuffer, 0, 307199); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); @@ -674,7 +674,7 @@ void ComputerManager::setModeVGA256() { _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.Cls_Pal(); - _vm->_graphicsManager.SCANLINE(0x140u); + _vm->_graphicsManager.SCANLINE(320); } /** @@ -1077,8 +1077,8 @@ void ComputerManager::saveScore() { } while (!v3); } - ptr = _vm->_globals.allocMemory(0x64u); - memset(ptr, 0, 0x63u); + ptr = _vm->_globals.allocMemory(100); + memset(ptr, 0, 99); for (int v5 = 0; v5 <= 5; v5++) { v6 = 16 * v5; v14 = v16[v5]; @@ -1102,7 +1102,7 @@ void ComputerManager::saveScore() { } _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, ptr, 0x64u); + _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, ptr, 100); _vm->_globals.freeMemory(ptr); } @@ -1121,7 +1121,7 @@ void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) v5 = 0; if ((byte)(v4 - 48) <= 9u) v5 = (byte)v4 - 48; - if ((byte)(v4 - 65) <= 0x19u) + if ((byte)(v4 - 65) <= 25) v5 = (byte)v4 - 55; if (v4 == 32) v5 = 36; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 6efd7b7191..a22f01470b 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -236,7 +236,7 @@ void DialogsManager::showOptionsDialog() { _vm->_globals._speed = 2; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) _vm->_globals.SVGA = 2; - if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 0xD3u) + if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 211) doneFlag = true; } @@ -667,22 +667,22 @@ void DialogsManager::showSaveLoad(int a1) { switch (slotNumber) { case 1: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 112, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 112, 128, 87); break; case 2: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 112, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 112, 128, 87); break; case 3: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 203, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 203, 128, 87); break; case 4: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 203, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 203, 128, 87); break; case 5: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 294, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 294, 128, 87); break; case 6: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 294, 0x80u, 87); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 294, 128, 87); break; } @@ -692,7 +692,7 @@ void DialogsManager::showSaveLoad(int a1) { } } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 0x112u, 353); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); _vm->_objectsManager.SL_FLAG = true; _vm->_objectsManager.SL_MODE = a1; _vm->_objectsManager.SL_X = 0; @@ -708,25 +708,25 @@ int DialogsManager::searchSavegames() { int yp = _vm->_eventsManager.getMouseY(); _vm->_graphicsManager.ofscroll = _vm->_eventsManager._startPos.x; - if ((uint16)(yp - 112) <= 0x56u) { + if ((uint16)(yp - 112) <= 86) { if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) slotNumber = 1; - if ((uint16)(yp - 112) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 112) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) slotNumber = 2; } - if ((uint16)(yp - 203) <= 0x56u) { + if ((uint16)(yp - 203) <= 86) { if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) slotNumber = 3; - if ((uint16)(yp - 203) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 203) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) slotNumber = 4; } - if ((uint16)(yp - 294) <= 0x56u) { + if ((uint16)(yp - 294) <= 86) { if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) slotNumber = 5; - if ((uint16)(yp - 294) <= 0x56u && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 294) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) slotNumber = 6; } - if ((uint16)(yp - 388) <= 0x10u && xp > _vm->_graphicsManager.ofscroll + 273 && xp < _vm->_graphicsManager.ofscroll + 355) + if ((uint16)(yp - 388) <= 16 && xp > _vm->_graphicsManager.ofscroll + 273 && xp < _vm->_graphicsManager.ofscroll + 355) slotNumber = 7; switch (slotNumber) { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 2def49cfbf..4667577237 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -322,9 +322,9 @@ void EventsManager::VBL() { _vm->_graphicsManager.REDRAW = 0; } else { if (_vm->_globals.iRegul == 3) - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 50, 0x280u, 340, 0, 50); + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 50, 640, 340, 0, 50); else - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 20, 0x280u, 440, 0, 20); + _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 20, 640, 440, 0, 20); --_vm->_graphicsManager.REDRAW; } _vm->_graphicsManager.unlockScreen(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 03f513fa64..d4d6e8d770 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -194,23 +194,23 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in v69 = 2048; f.seek(_index[messageId]); - _tempText = _vm->_globals.allocMemory(0x80Au); + _tempText = _vm->_globals.allocMemory(2058); if (_tempText == g_PTRNUL) error("Error allocating text"); - Common::fill(&_tempText[0], &_tempText[0x80a], 0); - f.read(_tempText, 0x800u); + Common::fill(&_tempText[0], &_tempText[2058], 0); + f.read(_tempText, 2048); f.close(); _vm->_globals.texte_long = 2048; } else { v69 = 100; _vm->_globals.texte_long = 100; - v9 = _vm->_globals.allocMemory(0x6Eu); - Common::fill(&v9[0], &v9[0x6e], 0); + v9 = _vm->_globals.allocMemory(110); + Common::fill(&v9[0], &v9[110], 0); _tempText = v9; const byte *v10 = _vm->_globals.BUF_ZONE + _index[messageId]; - memcpy(v9, v10, 0x60u); + memcpy(v9, v10, 96); v11 = 0; WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } @@ -220,9 +220,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in goto LABEL_43; for (int v63 = 0; v63 < v69; v63++) { byte v13 = *v59; - if ((byte)(*v59 + 46) > 0x1Bu) { - if ((byte)(v13 + 80) > 0x1Bu) { - if ((byte)(v13 - 65) <= 0x19u || (byte)(v13 - 97) <= 0x19u) + if ((byte)(*v59 + 46) > 27) { + if ((byte)(v13 + 80) > 27) { + if ((byte)(v13 - 65) <= 25 || (byte)(v13 - 97) <= 25) v13 = 32; } else { v13 -= 79; @@ -254,9 +254,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (v64 + 1 > 0) { for (int v15 = 0; v15 < v64 + 1; v15++) { byte v16 = *(v60 + v15); - if ((byte)v16 <= 0x1Fu) + if (v16 <= 31) v16 = 32; - _vm->_globals.largeur_boite += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v16 - 32); + _vm->_globals.largeur_boite += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); } } _vm->_globals.largeur_boite += 2; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 63ea1ef8e5..5b8c930ed2 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -64,23 +64,23 @@ int LinesManager::ZONE_OBJET(int a1, int a2) { int v2; v2 = 0; - if ((uint)(a2 - 120) <= 0x21u) + if ((uint)(a2 - 120) <= 33) v2 = OPTI_ZONE(a1, 1, 0); - if ((uint)(a2 - 154) <= 0x25u) + if ((uint)(a2 - 154) <= 37) v2 = OPTI_ZONE(a1, 7, 0); - if ((uint)(a2 - 192) <= 0x25u) + if ((uint)(a2 - 192) <= 37) v2 = OPTI_ZONE(a1, 13, 0); - if ((uint)(a2 - 230) <= 0x25u) + if ((uint)(a2 - 230) <= 37) v2 = OPTI_ZONE(a1, 19, 0); - if ((uint)(a2 - 268) <= 0x25u) + if ((uint)(a2 - 268) <= 37) v2 = OPTI_ZONE(a1, 25, 1); - if ((uint)(a2 - 268) <= 0x14u && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(a2 - 268) <= 20 && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) v2 = 30; - if ((uint)(a2 - 290) <= 0x10u && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(a2 - 290) <= 16 && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) v2 = 31; if (a1 < _vm->_graphicsManager.ofscroll + 152 || a1 > _vm->_graphicsManager.ofscroll + 484) v2 = 32; - if ((uint)(a2 - 114) > 0xC0u) + if ((uint)(a2 - 114) > 192) v2 = 32; return v2; } @@ -313,15 +313,15 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, Ligne[idx].field8 = 4; } } - if (v11 == 1 && (unsigned int)(v37 - 251) <= 0x2EC) { + if (v11 == 1 && (unsigned int)(v37 - 251) <= 748) { Ligne[idx].field6 = 4; Ligne[idx].field8 = 8; } - if (v11 == -1 && (unsigned int)(v37 - 251) <= 0x2EC) { + if (v11 == -1 && (unsigned int)(v37 - 251) <= 748) { Ligne[idx].field6 = 6; Ligne[idx].field8 = 2; } - if (v11 == 1 && (unsigned int)(v37 + 999) <= 0x2EC) { + if (v11 == 1 && (unsigned int)(v37 + 999) <= 748) { Ligne[idx].field6 = 2; Ligne[idx].field8 = 6; } @@ -2458,27 +2458,27 @@ LABEL_150: v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; v91 = -1; - if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 0x96) + if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 150) v91 = 1; if (v13 == 1) { - if ((unsigned int)(v99 + 1) <= 0x97) + if ((unsigned int)(v99 + 1) <= 151) v91 = 3; - if ((unsigned int)v99 <= 0x96) + if ((unsigned int)v99 <= 150) v91 = 3; } if (v94 == 1) { - if ((unsigned int)v101 <= 0x96) + if ((unsigned int)v101 <= 150) v91 = 5; - if ((unsigned int)(v101 + 150) <= 0x96) + if ((unsigned int)(v101 + 150) <= 150) v91 = 5; } if (v13 == -1) { - if ((unsigned int)v99 <= 0x96) + if ((unsigned int)v99 <= 150) v91 = 7; - if ((unsigned int)(v99 + 150) <= 0x96) + if ((unsigned int)(v99 + 150) <= 150) v91 = 7; } - if (v94 == -1 && (unsigned int)(v101 + 150) <= 0x96) + if (v94 == -1 && (unsigned int)(v101 + 150) <= 150) v91 = 1; if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(v7, v109, a3, a4) != -1) break; @@ -2530,47 +2530,47 @@ LABEL_72: v91 = 8; LABEL_103: if (v96 == -1) { - if ((unsigned int)v102 <= 0x1FE) + if ((unsigned int)v102 <= 510) v91 = 1; - if ((unsigned int)(v102 - 510) <= 0x1EA) + if ((unsigned int)(v102 - 510) <= 490) v91 = 2; } } if (v22 == 1) { - if ((unsigned int)(v100 + 1) <= 0x1FF) + if ((unsigned int)(v100 + 1) <= 511) v91 = 2; - if ((unsigned int)(v100 + 510) <= 0x1FE) + if ((unsigned int)(v100 + 510) <= 510) v91 = 3; - if ((unsigned int)v100 <= 0x1FE) + if ((unsigned int)v100 <= 510) v91 = 3; - if ((unsigned int)(v100 - 510) <= 0x1EA) + if ((unsigned int)(v100 - 510) <= 490) v91 = 4; } if (v96 == 1) { - if ((unsigned int)(v102 - 510) <= 0x1EA) + if ((unsigned int)(v102 - 510) <= 490) v91 = 4; - if ((unsigned int)v102 <= 0x1FE) + if ((unsigned int)v102 <= 510) v91 = 5; // CHECKME: The two conditions on v102 are not compatible! if (v102 >= -1 && v102 <= -510) v91 = 6; - if ((unsigned int)(v102 + 510) <= 0x1FE) + if ((unsigned int)(v102 + 510) <= 510) v91 = 5; } if (v22 == -1) { - if ((unsigned int)(v100 - 510) <= 0x1EA) + if ((unsigned int)(v100 - 510) <= 490) v91 = 6; - if ((unsigned int)v100 <= 0x1FE) + if ((unsigned int)v100 <= 510) v91 = 7; - if ((unsigned int)(v100 + 1000) <= 0x1EA) + if ((unsigned int)(v100 + 1000) <= 490) v91 = 8; - if ((unsigned int)(v100 + 510) <= 0x1FE) + if ((unsigned int)(v100 + 510) <= 510) v91 = 7; } if (v96 == -1) { - if ((unsigned int)(v102 + 1000) <= 0x1EA) + if ((unsigned int)(v102 + 1000) <= 490) v91 = 8; - if ((unsigned int)(v102 + 510) <= 0x1FE) + if ((unsigned int)(v102 + 510) <= 510) v91 = 1; } v23 = 0; @@ -3133,10 +3133,8 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v15; int v16; int v17; - int v18; int v19; int v20; - int v21; int v22; int v23; int v24; @@ -3144,10 +3142,8 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v26; int v27; int v28; - int v29; int v30; int v31; - int v32; int v33; int v34; int v35; @@ -3200,10 +3196,9 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v48 = _vm->_globals.STAILLE[v63]; v45 = v63; v25 = _vm->_graphicsManager.zoomOut(v25, v28); - v29 = v27; - if ((v27 & 0x80000000u) != 0) - v29 = -v27; - v40 = _vm->_graphicsManager.zoomOut(v40, v29); + if (v27 < 0) + v27 = -v27; + v40 = _vm->_graphicsManager.zoomOut(v40, v27); v63 = v45; v26 = v48; } @@ -3214,10 +3209,9 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v31 = -v26; v46 = v63; v25 = _vm->_graphicsManager.zoomIn(v25, v31); - v32 = v30; - if ((v30 & 0x80000000u) != 0) - v32 = -v30; - v40 = _vm->_graphicsManager.zoomIn(v40, v32); + if (v30 < 0) + v30 = -v30; + v40 = _vm->_graphicsManager.zoomIn(v40, v30); v63 = v46; } v33 = v63 + v40; @@ -3263,10 +3257,9 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v47 = _vm->_globals.STAILLE[v63]; v43 = v63; v14 = _vm->_graphicsManager.zoomOut(v14, v17); - v18 = v16; - if ((v16 & 0x80000000u) != 0) - v18 = -v16; - v39 = _vm->_graphicsManager.zoomOut(v39, v18); + if (v16 < 0) + v16 = -v16; + v39 = _vm->_graphicsManager.zoomOut(v39, v16); v63 = v43; v15 = v47; } @@ -3277,10 +3270,9 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v20 = -v15; v44 = v63; v14 = _vm->_graphicsManager.zoomIn(v14, v20); - v21 = v19; - if ((v19 & 0x80000000u) != 0) - v21 = -v19; - v39 = _vm->_graphicsManager.zoomIn(v39, v21); + if (v19 < 0) + v19 = -v19; + v39 = _vm->_graphicsManager.zoomIn(v39, v19); v63 = v44; } v22 = v63 + v39; @@ -3317,8 +3309,8 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { do { v10 = _vm->_globals.Hopkins[v51].field2; v42 = v63; - v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 0x19u); - v38 = _vm->_graphicsManager.zoomOut(v10, 0x19u); + v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25); + v38 = _vm->_graphicsManager.zoomOut(v10, 25); v63 = v42; v12 = 0; if (v11 > 0) { @@ -3353,8 +3345,8 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { do { v6 = _vm->_globals.Hopkins[v50].field2; v41 = v63; - v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 0x19u); - v37 = _vm->_graphicsManager.zoomOut(v6, 0x19u); + v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 25); + v37 = _vm->_graphicsManager.zoomOut(v6, 25); v63 = v41; v8 = 0; if (v7 > 0) { diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 1510e8e248..0b95f11e5a 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -253,7 +253,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s) { - s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 0x802); + s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 2050); syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_cloneHopkins); syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_realHopkins); syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_samantha); -- cgit v1.2.3 From fcbcca45b1a3f5abd1961a2e68b41cd2d78c899c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 21 Dec 2012 18:19:15 +0100 Subject: HOPKINS: Fix a couple of regressions. Thanks fuzzie for the help --- engines/hopkins/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bc79393f1d..e3066f5e62 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2371,7 +2371,7 @@ void ObjectsManager::loadZone(const Common::String &file) { } v13 = v9 + 1010; for (int v14 = 0; v14 < 100; v14++) - _vm->_globals.ZONEP[v14].field12 = READ_LE_UINT16(v13 + 2 * v14); + _vm->_globals.ZONEP[v14 + 1].field12 = READ_LE_UINT16(v13 + 2 * v14); _vm->_globals.freeMemory(ptr); CARRE_ZONE(); @@ -5292,7 +5292,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_eventsManager.changeMouseCursor(4); _vm->_globals.BPP_NOAFF = true; - for (int v6 = 0; v6 < 4; v6++) + for (int v6 = 0; v6 <= 4; v6++) _vm->_eventsManager.VBL(); _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); -- cgit v1.2.3 From e44df7732925e42d52e5567185a16839e9ba2cfb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Dec 2012 01:28:31 +0100 Subject: HOPKINS: Remove useless IF statements --- engines/hopkins/anim.cpp | 33 +++-- engines/hopkins/events.cpp | 10 +- engines/hopkins/font.cpp | 54 ++++---- engines/hopkins/graphics.cpp | 22 ++-- engines/hopkins/hopkins.cpp | 6 +- engines/hopkins/lines.cpp | 263 ++++++++++++++++++-------------------- engines/hopkins/objects.cpp | 294 ++++++++++++++++++++----------------------- engines/hopkins/script.cpp | 10 +- 8 files changed, 313 insertions(+), 379 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index d278f15a8d..2f9d44a614 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -576,13 +576,13 @@ void AnimationManager::loadAnim(const Common::String &animName) { const char *files[6] = { &filename1[0], &filename2[0], &filename3[0], &filename4[0], &filename5[0], &filename6[0] }; - for (int idx = 1; idx <= 6; ++idx) { - if (files[idx - 1][0]) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, files[idx - 1]); + for (int idx = 0; idx <= 5; ++idx) { + if (files[idx][0]) { + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, files[idx]); if (!f.exists(_vm->_globals.NFICHIER)) error("File not found"); - if (loadSpriteBank(idx, files[idx - 1])) + if (loadSpriteBank(idx + 1, files[idx])) error("File not compatible with this soft."); } } @@ -591,9 +591,8 @@ void AnimationManager::loadAnim(const Common::String &animName) { f.read(data, nbytes); f.close(); - for (int idx = 1; idx <= 20; ++idx) { + for (int idx = 1; idx <= 20; ++idx) searchAnim(data, idx, nbytes); - } _vm->_globals.freeMemory(data); } @@ -676,19 +675,15 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { if (f.exists(_vm->_globals.NFICHIER)) { v19 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); v13 = v19; - - if (_vm->_globals.Bank[idx].field1A > 0) { - for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx) { - int x1 = (int16)READ_LE_UINT16(v13); - int y1 = (int16)READ_LE_UINT16(v13 + 2); - int x2 = (int16)READ_LE_UINT16(v13 + 4); - int y2 = (int16)READ_LE_UINT16(v13 + 6); - v13 += 8; - - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); - if (_vm->_globals.Bank[idx]._fileHeader == 2) - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); - } + for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) { + int x1 = (int16)READ_LE_UINT16(v13); + int y1 = (int16)READ_LE_UINT16(v13 + 2); + int x2 = (int16)READ_LE_UINT16(v13 + 4); + int y2 = (int16)READ_LE_UINT16(v13 + 6); + + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); + if (_vm->_globals.Bank[idx]._fileHeader == 2) + _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); } _vm->_globals.freeMemory(v19); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 4667577237..418f4de28e 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -446,13 +446,11 @@ LABEL_65: _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); - if (_vm->_globals.NBBLOC) { - int v10 = _vm->_globals.NBBLOC + 1; - for (int i = 1; i != v10; i++) { - if (_vm->_globals.BLOC[i]._activeFl) - _vm->_globals.BLOC[i]._activeFl = false; - } + for (int i = 1; i < _vm->_globals.NBBLOC + 1; i++) { + if (_vm->_globals.BLOC[i]._activeFl) + _vm->_globals.BLOC[i]._activeFl = false; } + _vm->_globals.NBBLOC = 0; _startPos.x = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index d4d6e8d770..28b13490f7 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -146,11 +146,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int textType = _text[idx]._textType; if (textType != 6 && textType != 1 && textType != 3 && textType != 5) { int yCurrent = yp + 5; - if (_text[idx]._lineCount > 0) { - for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { - displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); - yCurrent += _vm->_globals.police_h + 1; - } + for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { + displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); + yCurrent += _vm->_globals.police_h + 1; } } else { int height = _text[idx]._height; @@ -251,14 +249,13 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._field3FE = v64; _vm->_globals.largeur_boite = 0; - if (v64 + 1 > 0) { - for (int v15 = 0; v15 < v64 + 1; v15++) { - byte v16 = *(v60 + v15); - if (v16 <= 31) - v16 = 32; - _vm->_globals.largeur_boite += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); - } + for (int v15 = 0; v15 < v64 + 1; v15++) { + byte v16 = *(v60 + v15); + if (v16 <= 31) + v16 = 32; + _vm->_globals.largeur_boite += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); } + _vm->_globals.largeur_boite += 2; int v17 = _vm->_globals.largeur_boite / 2; if (v17 < 0) @@ -318,32 +315,25 @@ LABEL_57: } while (v21 != '%'); for (int i = 0; i <= 19; i++) { - int v22 = _textSortArray[i]; - if (v22 <= 0) { + if (_textSortArray[i] <= 0) { _textSortArray[i] = 0; } else { int ptrc = 0; - if (v22 - 1 > 0) { - for (int v23 = 0; v23 < _textSortArray[i] - 1; v23++) { - Common::String &line = _text[idx]._lines[i]; - byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; - if (v24 <= 32) - v24 = ' '; - ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); - } + for (int v23 = 0; v23 < _textSortArray[i] - 1; v23++) { + Common::String &line = _text[idx]._lines[i]; + byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; + if (v24 <= 32) + v24 = ' '; + ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); } _textSortArray[i] = ptrc; } } for (int i = 0; i <= 19; i++) { - int v25 = i; - do { - ++v25; - if (v25 == 20) - v25 = 0; + for (int v25 = i + 1; v25 != i; v25 = (v25 + 1) % 20) { if (_textSortArray[i] < _textSortArray[v25]) _textSortArray[i] = 0; - } while (v25 != i); + } }; for (int i = 0; i <= 19; i++) { @@ -407,11 +397,9 @@ LABEL_57: int v75 = v73 + 5; int v71 = v70 + 5; - if (lineCount > 0) { - for (int lineNum = 0; lineNum < lineCount; ++lineNum) { - displayText(v75, v71, _text[idx]._lines[lineNum], _text[idx]._color); - v71 += _vm->_globals.police_h + 1; - } + for (int lineNum = 0; lineNum < lineCount; ++lineNum) { + displayText(v75, v71, _text[idx]._lines[lineNum], _text[idx]._color); + v71 += _vm->_globals.police_h + 1; } int blockWidth = v53 + 1; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 793d2fe96c..8ed4c03bc6 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -662,19 +662,17 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); - if (palMax > 0) { - for (int palCtr3 = 0; palCtr3 < palMax; palCtr3++) { - for (int palCtr4 = 0; palCtr4 < PALETTE_BLOCK_SIZE; palCtr4++) { - int palCtr5 = palCtr4; - int palValue = tempPalette[palCtr4] - (palette[palCtr4] << 8) / palMax; - tempPalette[palCtr5] = palValue; - palData[palCtr5] = (palValue >> 8) & 0xff; - } - - setpal_vga256(palData); - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_VBL(); + for (int palCtr3 = 0; palCtr3 < palMax; palCtr3++) { + for (int palCtr4 = 0; palCtr4 < PALETTE_BLOCK_SIZE; palCtr4++) { + int palCtr5 = palCtr4; + int palValue = tempPalette[palCtr4] - (palette[palCtr4] << 8) / palMax; + tempPalette[palCtr5] = palValue; + palData[palCtr5] = (palValue >> 8) & 0xff; } + + setpal_vga256(palData); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + DD_VBL(); } for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 56b98ab950..d5faff1f91 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4386,15 +4386,13 @@ void HopkinsEngine::Charge_Credits() { _globals.Credit[idxLines]._colour = curPtr[1]; _globals.Credit[idxLines]._actvFl = true; _globals.Credit[idxLines]._linePosY = _globals.Credit_y + idxLines * _globals.Credit_step; + int idxBuf = 0; - for (;;) { + for(; idxBuf < 49; idxBuf++) { byte curChar = curPtr[idxBuf + 3]; if (curChar == '%' || curChar == 10) break; _globals.Credit[idxLines]._line[idxBuf] = curChar; - idxBuf++; - if (idxBuf >= 49) - break; } _globals.Credit[idxLines]._line[idxBuf] = 0; _globals.Credit[idxLines]._lineSize = idxBuf - 1; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 5b8c930ed2..8637a90449 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -177,16 +177,14 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in int v16 = 1000 * a3; int v17 = 1000 * a2 / 1000; int v21 = 1000 * a3 / 1000; - if (v20 > 0) { - for (int i = 0; i < v20; i++) { - *dataP++ = v17; - *dataP++ = v21; - - v13 += v23; - v16 += v22; - v17 = v13 / 1000; - v21 = v16 / 1000; - } + for (int i = 0; i < v20; i++) { + *dataP++ = v17; + *dataP++ = v21; + + v13 += v23; + v16 += v22; + v17 = v13 / 1000; + v21 = v16 / 1000; } *dataP++ = -1; *dataP++ = -1; @@ -201,7 +199,7 @@ void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, in void LinesManager::RESET_OBSTACLE() { - for (int idx =0; idx < 400; ++idx) { + for (int idx = 0; idx < 400; ++idx) { RETIRE_LIGNE(idx); Ligne[idx].field0 = 0; Ligne[idx].lineData = (int16 *)g_PTRNUL; @@ -341,17 +339,15 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v31 = 1000 * a3 / 1000; v30 = 1000 * a4 / 1000; v35 = v34 - 1; - if (v35 > 0) { - for (int v26 = 0; v26 < v35; v26++) { - v32[0] = v31; - v32[1] = v30; - v32 += 2; + for (int v26 = 0; v26 < v35; v26++) { + v32[0] = v31; + v32[1] = v30; + v32 += 2; - v24 += v40; - v25 += v38; - v31 = v24 / 1000; - v30 = v25 / 1000; - } + v24 += v40; + v25 += v38; + v31 = v24 / 1000; + v30 = v25 / 1000; } v32[0] = a5; v32[1] = a6; @@ -623,23 +619,20 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i v8 += a7; } - if ((int)(a1 + 1) < a4) { - for (int v34 = a1 + 1; v34 < a4; v34++) { - if (Ligne[v34].field0 > 0) { - for (int i = 0; i < Ligne[v34].field0; i++) { - int16 *v14 = Ligne[v34].lineData; - int v15 = v14[2 * i]; - v50 = v14[2 * i + 1]; - int v16 = v8; + for (int v34 = a1 + 1; v34 < a4; v34++) { + for (int i = 0; i < Ligne[v34].field0; i++) { + int16 *v14 = Ligne[v34].lineData; + int v15 = v14[2 * i]; + v50 = v14[2 * i + 1]; + int v16 = v8; - a6[v16] = v15; - a6[v16 + 1] = v50; - a6[v16 + 2] = Ligne[v34].field6; - v8 += a7; - } - } + a6[v16] = v15; + a6[v16 + 1] = v50; + a6[v16 + 2] = Ligne[v34].field6; + v8 += a7; } } + v7 = 0; v36 = a4; } @@ -676,18 +669,16 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if (v36 == a4) { if (a5 >= v7) { - if (a5 > v7) { - for (int i = v7; i > a5; i++) { - int16 *v30 = Ligne[a4].lineData; - int v31 = v30[2 * i]; - v50 = v30[2 * i + 1]; - - int v32 = v8; - a6[v32] = v31; - a6[v32 + 1] = v50; - a6[v32 + 2] = Ligne[a4].field6; - v8 += a7; - } + for (int i = v7; i > a5; i++) { + int16 *v30 = Ligne[a4].lineData; + int v31 = v30[2 * i]; + v50 = v30[2 * i + 1]; + + int v32 = v8; + a6[v32] = v31; + a6[v32 + 1] = v50; + a6[v32 + 2] = Ligne[a4].field6; + v8 += a7; } } else { for (int i = v7; i > a5; --i) { @@ -728,19 +719,17 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, if (a1 + 1 == a9 + 1) v15 = a8; while (a4 != v15) { - if (Ligne[v15].field0 > 0) { - for (int v16 = 0; v16 < Ligne[v15].field0; v16++) { - int16 *v17 = Ligne[v15].lineData; - int v18 = v17[2 * v16]; - v50 = v17[2 * v16 + 1]; - - int v19 = v40; - a6[v19] = v18; - a6[v19 + 1] = v50; - a6[v19 + 2] = Ligne[v15].field6; - v40 += a7; + for (int v16 = 0; v16 < Ligne[v15].field0; v16++) { + int16 *v17 = Ligne[v15].lineData; + int v18 = v17[2 * v16]; + v50 = v17[2 * v16 + 1]; + + int v19 = v40; + a6[v19] = v18; + a6[v19 + 1] = v50; + a6[v19 + 2] = Ligne[v15].field6; + v40 += a7; - } } ++v15; if (a9 + 1 == v15) @@ -1021,24 +1010,22 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v35 = v43; } if (v21 == 1) { - if (v39 > 0) { - for (int v22 = 0; v22 < v39; v22++) { - if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v46) { - v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); - if (v23 == -1) - return 0; - v7 = v23; - if (NVPY != -1) - v22 = NVPY - v40; - } - v24 = v7; - _vm->_globals.super_parcours[v24] = v41; - _vm->_globals.super_parcours[v24 + 1] = v40 - v22; - _vm->_globals.super_parcours[v24 + 2] = 1; - _vm->_globals.super_parcours[v24 + 3] = 0; - v7 += 4; + for (int v22 = 0; v22 < v39; v22++) { + if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); + if (v23 == -1) + return 0; + v7 = v23; + if (NVPY != -1) + v22 = NVPY - v40; } + v24 = v7; + _vm->_globals.super_parcours[v24] = v41; + _vm->_globals.super_parcours[v24 + 1] = v40 - v22; + _vm->_globals.super_parcours[v24 + 2] = 1; + _vm->_globals.super_parcours[v24 + 3] = 0; + v7 += 4; } LABEL_186: NV_LIGNEDEP = v36; @@ -1047,68 +1034,62 @@ LABEL_186: return 1; } if (v21 == 5) { - if (v37 > 0) { - for (int v25 = 0; v25 < v37; v25++) { - if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v46) { - v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); - if (v26 == -1) - return 0; - v7 = v26; - if (NVPY != -1) - v25 = v40 - NVPY; - } - v27 = v7; - _vm->_globals.super_parcours[v27] = v41; - _vm->_globals.super_parcours[v27 + 1] = v25 + v40; - _vm->_globals.super_parcours[v27 + 2] = 5; - _vm->_globals.super_parcours[v27 + 3] = 0; - v7 += 4; + for (int v25 = 0; v25 < v37; v25++) { + if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); + if (v26 == -1) + return 0; + v7 = v26; + if (NVPY != -1) + v25 = v40 - NVPY; } + v27 = v7; + _vm->_globals.super_parcours[v27] = v41; + _vm->_globals.super_parcours[v27 + 1] = v25 + v40; + _vm->_globals.super_parcours[v27 + 2] = 5; + _vm->_globals.super_parcours[v27 + 3] = 0; + v7 += 4; } goto LABEL_186; } if (v21 == 7) { - if (v18 > 0) { - for (int v28 = 0; v28 < v18; v28++) { - if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v46) { - v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); - if (v29 == -1) - return 0; - v7 = v29; - if (NVPX != -1) - v28 = v41 - NVPX; - } - v30 = v7; - _vm->_globals.super_parcours[v30] = v41 - v28; - _vm->_globals.super_parcours[v30 + 1] = v40; - _vm->_globals.super_parcours[v30 + 2] = 7; - _vm->_globals.super_parcours[v30 + 3] = 0; - v7 += 4; + for (int v28 = 0; v28 < v18; v28++) { + if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); + if (v29 == -1) + return 0; + v7 = v29; + if (NVPX != -1) + v28 = v41 - NVPX; } + v30 = v7; + _vm->_globals.super_parcours[v30] = v41 - v28; + _vm->_globals.super_parcours[v30 + 1] = v40; + _vm->_globals.super_parcours[v30 + 2] = 7; + _vm->_globals.super_parcours[v30 + 3] = 0; + v7 += 4; } goto LABEL_186; } if (v21 == 3) { - if (v38 > 0) { - for (int v31 = 0; v31 < v38; v31++) { - if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 - && _vm->_objectsManager.DERLIGNE < v46) { - v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); - if (v32 == -1) - return 0; - v7 = v32; - if (NVPX != -1) - v31 = NVPX - v41; - } - v33 = v7; - _vm->_globals.super_parcours[v33] = v31 + v41; - _vm->_globals.super_parcours[v33 + 1] = v40; - _vm->_globals.super_parcours[v33 + 2] = 3; - _vm->_globals.super_parcours[v33 + 3] = 0; - v7 += 4; + for (int v31 = 0; v31 < v38; v31++) { + if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + && _vm->_objectsManager.DERLIGNE < v46) { + v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); + if (v32 == -1) + return 0; + v7 = v32; + if (NVPX != -1) + v31 = NVPX - v41; } + v33 = v7; + _vm->_globals.super_parcours[v33] = v31 + v41; + _vm->_globals.super_parcours[v33 + 1] = v40; + _vm->_globals.super_parcours[v33 + 2] = 3; + _vm->_globals.super_parcours[v33 + 3] = 0; + v7 += 4; } goto LABEL_186; } @@ -1237,21 +1218,19 @@ LABEL_17: int v77 = 0; int v78 = 0; int v79 = 0; - if (v85 + 1 > 0) { - for (int v89 = v85 + 1; v89 > 0; v89--) { - int v96 = _vm->_globals.BufLig[v25]; - int v94 = _vm->_globals.BufLig[v25 + 1]; - if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { - v80 = v100; - v77 = v101; - v78 = v96; - v79 = v94; - loopCond = true; - } - if (loopCond) - break; - v25 -= 2; - } + for (int v89 = v85 + 1; v89 > 0; v89--) { + int v96 = _vm->_globals.BufLig[v25]; + int v94 = _vm->_globals.BufLig[v25 + 1]; + if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { + v80 = v100; + v77 = v101; + v78 = v96; + v79 = v94; + loopCond = true; + } + if (loopCond) + break; + v25 -= 2; } int v66 = 0; int v68 = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e3066f5e62..a960796d86 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -323,7 +323,6 @@ void ObjectsManager::displaySprite() { int y1_1; int y1_2; int v25; - int v26; int v27; int x1_1; int x1_2; @@ -410,9 +409,7 @@ void ObjectsManager::displaySprite() { do { v27 = 0; if (v25 > 1) { - v26 = _vm->_globals.NBTRI; - - for (int v34 = 1; v34 < v26; v34++) { + for (int v34 = 1; v34 < _vm->_globals.NBTRI; v34++) { v11 = arr[v34]; v12 = &arr[v34 + 1]; if (_vm->_globals.Tri[arr[v34]]._priority > _vm->_globals.Tri[*v12]._priority) { @@ -424,43 +421,39 @@ void ObjectsManager::displaySprite() { } } while (v27); - if (_vm->_globals.NBTRI + 1 > 1) { - for (int v35 = 1; v35 < _vm->_globals.NBTRI + 1; v35++) { - v13 = arr[v35]; - switch (_vm->_globals.Tri[v13]._triMode) { - case TRI_BOB: - DEF_BOB(_vm->_globals.Tri[v13]._index); - break; - case TRI_SPRITE: - DEF_SPRITE(_vm->_globals.Tri[v13]._index); - break; - case TRI_CACHE: - DEF_CACHE(_vm->_globals.Tri[v13]._index); - break; - default: - break; - } - _vm->_globals.Tri[v13]._triMode = TRI_NONE; + for (int v35 = 1; v35 < _vm->_globals.NBTRI + 1; v35++) { + v13 = arr[v35]; + switch (_vm->_globals.Tri[v13]._triMode) { + case TRI_BOB: + DEF_BOB(_vm->_globals.Tri[v13]._index); + break; + case TRI_SPRITE: + DEF_SPRITE(_vm->_globals.Tri[v13]._index); + break; + case TRI_CACHE: + DEF_CACHE(_vm->_globals.Tri[v13]._index); + break; + default: + break; } + _vm->_globals.Tri[v13]._triMode = TRI_NONE; } } else { - if (_vm->_globals.NBTRI + 1 > 1) { - for (int idx = 1; idx < (_vm->_globals.NBTRI + 1); ++idx) { - switch (_vm->_globals.Tri[idx]._triMode) { - case TRI_BOB: - DEF_BOB(_vm->_globals.Tri[idx]._index); - break; - case TRI_SPRITE: - DEF_SPRITE(_vm->_globals.Tri[idx]._index); - break; - case TRI_CACHE: - DEF_CACHE(_vm->_globals.Tri[idx]._index); - break; - default: - break; - } - _vm->_globals.Tri[idx]._triMode = TRI_NONE; + for (int idx = 1; idx < (_vm->_globals.NBTRI + 1); ++idx) { + switch (_vm->_globals.Tri[idx]._triMode) { + case TRI_BOB: + DEF_BOB(_vm->_globals.Tri[idx]._index); + break; + case TRI_SPRITE: + DEF_SPRITE(_vm->_globals.Tri[idx]._index); + break; + case TRI_CACHE: + DEF_CACHE(_vm->_globals.Tri[idx]._index); + break; + default: + break; } + _vm->_globals.Tri[idx]._triMode = TRI_NONE; } } @@ -3090,11 +3083,9 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { } if (v12 < v10) { v7 = v11; - if (v12 > 0) { - for (int v8 = 0; v8 < v12; v8++) { - a1[v7 + 2] = v14; - v7 += 4; - } + for (int v8 = 0; v8 < v12; v8++) { + a1[v7 + 2] = v14; + v7 += 4; } v15 = v14; } @@ -3413,16 +3404,14 @@ LABEL_88: 0) == 1) goto LABEL_88; - if ((_vm->_linesManager.Ligne[v48].field0 - 2) > 0) { - for (int v49 = _vm->_linesManager.Ligne[v48].field0 - 2; v49 > 0; v49 --) { - v50 = _vm->_linesManager.Ligne[l].lineData; - v52 = v67; - _vm->_globals.super_parcours[v52] = v50[2 * v49]; - _vm->_globals.super_parcours[v52 + 1] = v50[2 * v49 + 1]; - _vm->_globals.super_parcours[v52 + 2] = _vm->_linesManager.Ligne[l].field8; - _vm->_globals.super_parcours[v52 + 3] = 0; - v67 += 4; - } + for (int v49 = _vm->_linesManager.Ligne[v48].field0 - 2; v49 > 0; v49 --) { + v50 = _vm->_linesManager.Ligne[l].lineData; + v52 = v67; + _vm->_globals.super_parcours[v52] = v50[2 * v49]; + _vm->_globals.super_parcours[v52 + 1] = v50[2 * v49 + 1]; + _vm->_globals.super_parcours[v52 + 2] = _vm->_linesManager.Ligne[l].field8; + _vm->_globals.super_parcours[v52 + 3] = 0; + v67 += 4; } } v68 = _vm->_linesManager.Ligne[v73].field0 - 1; @@ -3430,15 +3419,13 @@ LABEL_88: } if (v69 == v73) { if (v68 <= v72) { - if (v68 < v72) { - for (int v57 = v68; v57 < v72; v57++) { - v58 = _vm->_linesManager.Ligne[v73].lineData; - _vm->_globals.super_parcours[v67] = v58[2 * v57]; - _vm->_globals.super_parcours[v67 + 1] = v58[2 * v57 + 1]; - _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field6; - _vm->_globals.super_parcours[v67 + 3] = 0; - v67 += 4; - } + for (int v57 = v68; v57 < v72; v57++) { + v58 = _vm->_linesManager.Ligne[v73].lineData; + _vm->_globals.super_parcours[v67] = v58[2 * v57]; + _vm->_globals.super_parcours[v67 + 1] = v58[2 * v57 + 1]; + _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field6; + _vm->_globals.super_parcours[v67 + 3] = 0; + v67 += 4; } } else { for (int v53 = v68; v53 > v72; v53--) { @@ -4544,101 +4531,98 @@ void ObjectsManager::INILINK(const Common::String &file) { } _vm->_linesManager.RESET_OBSTACLE(); - if (nbytes) { - for (size_t v41 = 0; v41 < nbytes; v41++) { - if (*(ptr + v41) == 'O' && *(ptr + v41 + 1) == 'B' && *(ptr + v41 + 2) == '2') { - v16 = ptr + v41 + 4; - v32 = 0; - v34 = 0; - _vm->_linesManager.TOTAL_LIGNES = 0; - do { - v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); - if (v27 != -1) { - _vm->_linesManager.AJOUTE_LIGNE( - v34, - v27, - (int16)READ_LE_UINT16(v16 + 2 * v32 + 2), - (int16)READ_LE_UINT16(v16 + 2 * v32 + 4), - (int16)READ_LE_UINT16(v16 + 2 * v32 + 6), - (int16)READ_LE_UINT16(v16 + 2 * v32 + 8), - 1); - ++_vm->_linesManager.TOTAL_LIGNES; - } - v32 += 5; - ++v34; - } while (v27 != -1); - _vm->_linesManager.INIPARCOURS(); - } + for (size_t v41 = 0; v41 < nbytes; v41++) { + if (*(ptr + v41) == 'O' && *(ptr + v41 + 1) == 'B' && *(ptr + v41 + 2) == '2') { + v16 = ptr + v41 + 4; + v32 = 0; + v34 = 0; + _vm->_linesManager.TOTAL_LIGNES = 0; + do { + v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); + if (v27 != -1) { + _vm->_linesManager.AJOUTE_LIGNE( + v34, + v27, + (int16)READ_LE_UINT16(v16 + 2 * v32 + 2), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 4), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 6), + (int16)READ_LE_UINT16(v16 + 2 * v32 + 8), + 1); + ++_vm->_linesManager.TOTAL_LIGNES; + } + v32 += 5; + ++v34; + } while (v27 != -1); + _vm->_linesManager.INIPARCOURS(); } } + if (!OBSSEUL) { - if (nbytes) { - for (size_t v42 = 0; v42 < nbytes; v42++) { - if (*(ptr + v42) == 'Z' && *(ptr + v42 + 1) == 'O' && *(ptr + v42 + 2) == '2') { - v17 = ptr + v42 + 4; - v33 = 0; - v35 = 0; - for (int v18 = 1; v18 <= 100; v18++) { - _vm->_globals.ZONEP[v18]._destX = 0; - _vm->_globals.ZONEP[v18]._destY = 0; - _vm->_globals.ZONEP[v18].field4 = 0; - _vm->_globals.ZONEP[v18].field6 = 0; - _vm->_globals.ZONEP[v18].field7 = 0; - _vm->_globals.ZONEP[v18].field8 = 0; - _vm->_globals.ZONEP[v18].field9 = 0; - _vm->_globals.ZONEP[v18].fieldA = 0; - _vm->_globals.ZONEP[v18].fieldB = 0; - _vm->_globals.ZONEP[v18].fieldC = 0; - _vm->_globals.ZONEP[v18].fieldD = 0; - _vm->_globals.ZONEP[v18].fieldE = 0; - _vm->_globals.ZONEP[v18].fieldF = 0; - _vm->_globals.ZONEP[v18].field12 = 0; - } + for (size_t v42 = 0; v42 < nbytes; v42++) { + if (*(ptr + v42) == 'Z' && *(ptr + v42 + 1) == 'O' && *(ptr + v42 + 2) == '2') { + v17 = ptr + v42 + 4; + v33 = 0; + v35 = 0; + for (int v18 = 1; v18 <= 100; v18++) { + _vm->_globals.ZONEP[v18]._destX = 0; + _vm->_globals.ZONEP[v18]._destY = 0; + _vm->_globals.ZONEP[v18].field4 = 0; + _vm->_globals.ZONEP[v18].field6 = 0; + _vm->_globals.ZONEP[v18].field7 = 0; + _vm->_globals.ZONEP[v18].field8 = 0; + _vm->_globals.ZONEP[v18].field9 = 0; + _vm->_globals.ZONEP[v18].fieldA = 0; + _vm->_globals.ZONEP[v18].fieldB = 0; + _vm->_globals.ZONEP[v18].fieldC = 0; + _vm->_globals.ZONEP[v18].fieldD = 0; + _vm->_globals.ZONEP[v18].fieldE = 0; + _vm->_globals.ZONEP[v18].fieldF = 0; + _vm->_globals.ZONEP[v18].field12 = 0; + } - v31 = 0; - do { - v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); - if (v28 != -1) { - _vm->_linesManager.AJOUTE_LIGNE_ZONE( - v35, - (int16)READ_LE_UINT16(v17 + 2 * v33 + 2), - (int16)READ_LE_UINT16(v17 + 2 * v33 + 4), - (int16)READ_LE_UINT16(v17 + 2 * v33 + 6), - (int16)READ_LE_UINT16(v17 + 2 * v33 + 8), - v28); - _vm->_globals.ZONEP[v28].field10 = 1; - } - v33 += 5; - ++v35; - ++v31; - } while (v28 != -1); - for (int v21 = 1; v21 <= 100; v21++) { - _vm->_globals.ZONEP[v21]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); - _vm->_globals.ZONEP[v21]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); - _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); - v33 += 3; + v31 = 0; + do { + v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); + if (v28 != -1) { + _vm->_linesManager.AJOUTE_LIGNE_ZONE( + v35, + (int16)READ_LE_UINT16(v17 + 2 * v33 + 2), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 4), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 6), + (int16)READ_LE_UINT16(v17 + 2 * v33 + 8), + v28); + _vm->_globals.ZONEP[v28].field10 = 1; } + v33 += 5; + ++v35; + ++v31; + } while (v28 != -1); + for (int v21 = 1; v21 <= 100; v21++) { + _vm->_globals.ZONEP[v21]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); + _vm->_globals.ZONEP[v21]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); + _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); + v33 += 3; + } - v22 = ptr + v42 + (10 * v31 + 606) + 4; - v29 = 0; - for (int v24 = 1; v24 <= 100; v24++) { - _vm->_globals.ZONEP[v24].field6 = *(v29 + v22); - _vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1); - _vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2); - _vm->_globals.ZONEP[v24].field9 = *(v22 + v29 + 3); - _vm->_globals.ZONEP[v24].fieldA = *(v22 + v29 + 4); - _vm->_globals.ZONEP[v24].fieldB = *(v22 + v29 + 5); - _vm->_globals.ZONEP[v24].fieldC = *(v22 + v29 + 6); - _vm->_globals.ZONEP[v24].fieldD = *(v22 + v29 + 7); - _vm->_globals.ZONEP[v24].fieldE = *(v22 + v29 + 8); - _vm->_globals.ZONEP[v24].fieldF = *(v22 + v29 + 9); - v29 += 10; - } - v30 = 0; - for (int v25 = 1; v25 <= 100; v25++) - _vm->_globals.ZONEP[v25].field12 = (int16)READ_LE_UINT16(v22 + 1010 + 2 * v30++); - CARRE_ZONE(); + v22 = ptr + v42 + (10 * v31 + 606) + 4; + v29 = 0; + for (int v24 = 1; v24 <= 100; v24++) { + _vm->_globals.ZONEP[v24].field6 = *(v29 + v22); + _vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1); + _vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2); + _vm->_globals.ZONEP[v24].field9 = *(v22 + v29 + 3); + _vm->_globals.ZONEP[v24].fieldA = *(v22 + v29 + 4); + _vm->_globals.ZONEP[v24].fieldB = *(v22 + v29 + 5); + _vm->_globals.ZONEP[v24].fieldC = *(v22 + v29 + 6); + _vm->_globals.ZONEP[v24].fieldD = *(v22 + v29 + 7); + _vm->_globals.ZONEP[v24].fieldE = *(v22 + v29 + 8); + _vm->_globals.ZONEP[v24].fieldF = *(v22 + v29 + 9); + v29 += 10; } + v30 = 0; + for (int v25 = 1; v25 <= 100; v25++) + _vm->_globals.ZONEP[v25].field12 = (int16)READ_LE_UINT16(v22 + 1010 + 2 * v30++); + CARRE_ZONE(); } } } @@ -5022,10 +5006,8 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = v13; } - if (v15 > 0) { - for (int v10 = 0; v10 < v15; v10++) - _vm->_eventsManager.VBL(); - } + for (int v10 = 0; v10 < v15; v10++) + _vm->_eventsManager.VBL(); if (v13 == -1) break; } @@ -5080,10 +5062,8 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int _sprite[0]._spriteData = a1; _sprite[0]._spriteIndex = spriteIndex; } - if (v14 > 0) { - for (int v10 = 0; v10 < v14; v10++) - _vm->_eventsManager.VBL(); - } + for (int v10 = 0; v10 < v14; v10++) + _vm->_eventsManager.VBL(); } while (spriteIndex != -1); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index e3fc59a990..818610c892 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -480,13 +480,11 @@ LABEL_1141: uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals._speed; if (!v74) v74 = 1; - if (v74 + 1 > 0) { - for (uint v10 = 0; v10 < v74 + 1; v10++) { - if (_vm->shouldQuit()) - return -1; // Exiting game + for (uint v10 = 0; v10 < v74 + 1; v10++) { + if (_vm->shouldQuit()) + return -1; // Exiting game - _vm->_eventsManager.VBL(); - } + _vm->_eventsManager.VBL(); } v1 = 1; } -- cgit v1.2.3 From 0120107a6d0884ddf4655b4c22d13f2b75319152 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Dec 2012 14:26:07 +0100 Subject: HOPKINS: Implement code for OS/2 version --- engines/hopkins/detection.cpp | 1 - engines/hopkins/files.cpp | 17 +- engines/hopkins/hopkins.cpp | 1085 ++++++++++++++++++++++++++++++++++++++--- engines/hopkins/hopkins.h | 1 + 4 files changed, 1017 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 9ebf6837ea..2e122a17a2 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -67,7 +67,6 @@ static const PlainGameDescriptor hopkinsGames[] = { #include "hopkins/detection_tables.h" const static char *directoryGlobs[] = { - "hopdata", "voice", 0 }; diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 8ab86bb180..c888bcbd67 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -71,15 +71,18 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes void FileManager::initCensorship() { _vm->_globals.CENSURE = false; - constructFilename(_vm->_globals.HOPSYSTEM, "BLOOD.DAT"); - char *data = (char *)loadFile(_vm->_globals.NFICHIER); + // If file doesn't exist, fallback to uncensored + if (!fileExists(_vm->_globals.HOPSYSTEM, "BLOOD.DAT")) { + constructFilename(_vm->_globals.HOPSYSTEM, "BLOOD.DAT"); + char *data = (char *)loadFile(_vm->_globals.NFICHIER); - if (*(data + 6) == 'u' && *(data + 7) == 'k') - _vm->_globals.CENSURE = true; - if (*(data + 6) == 'U' && *(data + 7) == 'K') - _vm->_globals.CENSURE = true; + if (*(data + 6) == 'u' && *(data + 7) == 'k') + _vm->_globals.CENSURE = true; + if (*(data + 6) == 'U' && *(data + 7) == 'K') + _vm->_globals.CENSURE = true; - free(data); + free(data); + } } /** diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d5faff1f91..cc66415a4b 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -118,8 +118,11 @@ Common::Error HopkinsEngine::run() { } else runBeOSFull(); } else { - warning("Unhandled version, switching to linux demo"); - runLinuxDemo(); + if (getIsDemo()) { + warning("Unhandled version, switching to linux demo"); + runLinuxDemo(); + } else + runOS2Full(); } return Common::kNoError; @@ -823,26 +826,30 @@ bool HopkinsEngine::runLinuxDemo() { return true; } -bool HopkinsEngine::runBeOSFull() { +bool HopkinsEngine::runOS2Full() { _globals.SVGA = 2; - warning("TODO: Init_Interrupt()"); _globals.CHARGE_OBJET(); _objectsManager.changeObject(14); _objectsManager.addObject(14); + warning("_graphicsManager.loadImage(\"VERSW\");"); + warning("_graphicsManager.FADE_INW();"); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _animationManager.playAnim("MP.ANM", 10, 0, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) INTRORUN(); - _graphicsManager.FADE_OUTS(); _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); - _graphicsManager.FADE_OUTW(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -850,21 +857,17 @@ bool HopkinsEngine::runBeOSFull() { _globals.PLANX = _globals.PLANY = 0; memset(_globals.SAUVEGARDE, 0, 1996); _globals.SORTIE = 0; - for (;;) { - if (_globals.SORTIE == 300) _globals.SORTIE = 0; if (!_globals.SORTIE) { _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - REST_SYSTEM(); - } + if (_globals.SORTIE == -1) + break; } if (g_system->getEventManager()->shouldQuit()) - return false; + break; switch (_globals.SORTIE) { case 1: @@ -876,15 +879,20 @@ bool HopkinsEngine::runBeOSFull() { break; case 3: - if (!_globals.SAUVEGARDE->data[svField170]) { + if (!_globals.SAUVEGARDE->data[170]) { _soundManager.WSOUND(3); - _graphicsManager.loadImage("FOND"); + _graphicsManager.loadImage("fond"); _graphicsManager.FADE_INW(); _eventsManager.delay(5000); _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); _soundManager.SPECIAL_SOUND = 0; @@ -893,7 +901,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[svField170] = 1; + _globals.SAUVEGARDE->data[170] = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -915,12 +923,12 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) + if (_globals.SAUVEGARDE->data[80]) { + if (_globals.SAUVEGARDE->data[80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); } + else + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); _globals.NOSPRECRAN = false; break; @@ -933,7 +941,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 7: - if (_globals.SAUVEGARDE->data[svField220]) + if (_globals.SAUVEGARDE->data[220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -952,9 +960,10 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!_globals.SAUVEGARDE->data[svField225]) + if (_globals.SAUVEGARDE->data[225]) + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + else BOOM(); - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); break; case 10: @@ -978,12 +987,11 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals.SAUVEGARDE->data[225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { + } else BOOM(); - } break; case 13: @@ -1013,10 +1021,11 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + if (_globals.SAUVEGARDE->data[113] == 1) + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7); + else { + if (!_globals.SAUVEGARDE->data[113]) + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } break; @@ -1025,22 +1034,27 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField117] == 1) { + if (_globals.SAUVEGARDE->data[117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!_globals.SAUVEGARDE->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + else { + if (!_globals.SAUVEGARDE->data[117]) + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); } if (_globals.SORTIE == 18) { _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); - _soundManager.WSOUND_OFF(); +// _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); _globals.iRegul = 0; } @@ -1060,7 +1074,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField123]) + if (_globals.SAUVEGARDE->data[123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); @@ -1074,8 +1088,13 @@ bool HopkinsEngine::runBeOSFull() { _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals.SORTIE == 17) { _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); + // _soundManager.WSOUND_OFF(); + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -1108,12 +1127,11 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField181]) { - if (_globals.SAUVEGARDE->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1); - } else { + if (_globals.SAUVEGARDE->data[181]) { + if (_globals.SAUVEGARDE->data[181] == 1 ) + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); + } else _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); - } break; case 25: @@ -1137,10 +1155,11 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField177] == 1) { + if (_globals.SAUVEGARDE->data[177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!_globals.SAUVEGARDE->data[svField177]) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + else { + if (!_globals.SAUVEGARDE->data[177]) + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); } break; @@ -1150,10 +1169,10 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + if (_globals.SAUVEGARDE->data[166] != 1 || _globals.SAUVEGARDE->data[167] != 1 ) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); else - _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); break; case 29: @@ -1210,7 +1229,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.FORET = 1; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -1219,10 +1238,9 @@ bool HopkinsEngine::runBeOSFull() { _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; - if ((_globals.SORTIE < 35) || (_globals.SORTIE > 49)) { + if (_globals.SORTIE < 35 || _globals.SORTIE > 49 ) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.FORET = false; _soundManager.DEL_SAMPLE(1); @@ -1315,7 +1333,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 61: - if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + if (_globals.SAUVEGARDE->data[311] == 1 && !_globals.SAUVEGARDE->data[312] ) INCENDIE(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); @@ -1422,10 +1440,11 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField318] == 1) { + if (_globals.SAUVEGARDE->data[318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!_globals.SAUVEGARDE->data[svField318]) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + else { + if (!_globals.SAUVEGARDE->data[318]) + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); } break; @@ -1434,55 +1453,55 @@ bool HopkinsEngine::runBeOSFull() { break; case 77: - OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + OCEAN(77, "OCEAN01", "OCEAN01", 3, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + OCEAN(78, "OCEAN02", "OCEAN01", 1, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + OCEAN(79, "OCEAN03", "OCEAN01", 7, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + OCEAN(80, "OCEAN04", "OCEAN01", 1, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + OCEAN(81, "OCEAN05", "OCEAN01", 1, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + OCEAN(82, "OCEAN06", "OCEAN01", 7, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + OCEAN(83, "OCEAN07", "OCEAN01", 1, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + OCEAN(84, "OCEAN08", "OCEAN01", 1, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + OCEAN(85, "OCEAN09", "OCEAN01", 1, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + OCEAN(86, "OCEAN10", "OCEAN01", 1, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + OCEAN(87, "OCEAN11", "OCEAN01", 3, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + OCEAN(88, "OCEAN12", "OCEAN01", 1, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + OCEAN(89, "OCEAN13", "OCEAN01", 3, 0, 83, 0, 0, 25); break; case 90: @@ -1490,7 +1509,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 91: - OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + OCEAN(91, "OCEAN15", "OCEAN01", 3, 78, 81, 86, 0, 25); break; case 93: @@ -1498,8 +1517,8 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); + if (_globals.SAUVEGARDE->data[330]) + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26); else _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); break; @@ -1539,15 +1558,19 @@ bool HopkinsEngine::runBeOSFull() { _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); if (_globals.SORTIE == 18) { _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); + // _soundManager.WSOUND_OFF(); + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); _globals.iRegul = 0; } @@ -1588,9 +1611,9 @@ bool HopkinsEngine::runBeOSFull() { case 113: _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.SAUVEGARDE->data[6] = _globals.ECRAN; _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = 113; + _globals.SAUVEGARDE->data[5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.setModeVesa(); break; @@ -1598,9 +1621,9 @@ bool HopkinsEngine::runBeOSFull() { case 114: _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.SAUVEGARDE->data[6] = _globals.ECRAN; _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = 114; + _globals.SAUVEGARDE->data[5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; @@ -1608,9 +1631,9 @@ bool HopkinsEngine::runBeOSFull() { case 115: _globals.SORTIE = 0; _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.SAUVEGARDE->data[6] = _globals.ECRAN; _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = 115; + _globals.SAUVEGARDE->data[5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.setModeVesa(); break; @@ -1618,7 +1641,12 @@ bool HopkinsEngine::runBeOSFull() { case 150: _soundManager.WSOUND(16); _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; @@ -1628,7 +1656,12 @@ bool HopkinsEngine::runBeOSFull() { case 151: _soundManager.WSOUND(16); _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; @@ -1638,7 +1671,901 @@ bool HopkinsEngine::runBeOSFull() { case 152: _soundManager.WSOUND(16); _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + _globals.PERSO = _globals.freeMemory(_globals.PERSO); + _globals.iRegul = 1; + // _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(23); + _globals.SORTIE = PWBASE(); + // _soundManager.WSOUND_OFF(); + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.iRegul = 0; + break; + } + } + _globals.PERSO = _globals.freeMemory(_globals.PERSO); + warning("sub_33C70(v18);"); + warning("sub_39460(v19);"); + warning("sub_44134();"); + REST_SYSTEM(); + return true; +} + +bool HopkinsEngine::runBeOSFull() { + _globals.SVGA = 2; + + warning("TODO: Init_Interrupt()"); + _globals.CHARGE_OBJET(); + _objectsManager.changeObject(14); + _objectsManager.addObject(14); + _eventsManager.delay(500); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("MP.ANM", 10, 0, 200); + _graphicsManager.FADE_OUTW(); + if (!_eventsManager._escKeyFl) + INTRORUN(); + _graphicsManager.FADE_OUTS(); + _graphicsManager.loadImage("H2"); + _graphicsManager.FADE_INW(); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 0; + _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO_TYPE = 0; + _globals.PLANX = _globals.PLANY = 0; + memset(_globals.SAUVEGARDE, 0, 1996); + _globals.SORTIE = 0; + + for (;;) { + + if (_globals.SORTIE == 300) + _globals.SORTIE = 0; + if (!_globals.SORTIE) { + _globals.SORTIE = _menuManager.MENU(); + if (_globals.SORTIE == -1) { + _globals.PERSO = _globals.freeMemory(_globals.PERSO); + REST_SYSTEM(); + } + } + + if (g_system->getEventManager()->shouldQuit()) + return false; + + switch (_globals.SORTIE) { + case 1: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + break; + + case 3: + if (!_globals.SAUVEGARDE->data[svField170]) { + _soundManager.WSOUND(3); + _graphicsManager.loadImage("FOND"); + _graphicsManager.FADE_INW(); + _eventsManager.delay(5000); + _graphicsManager.FADE_OUTW(); + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); + _soundManager.SPECIAL_SOUND = 0; + _soundManager.DEL_SAMPLE(1); + _soundManager.DEL_SAMPLE(2); + _soundManager.DEL_SAMPLE(3); + _soundManager.DEL_SAMPLE(4); + _graphicsManager.FADE_OUTW(); + _globals.SAUVEGARDE->data[svField170] = 1; + } + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + break; + + case 4: + _globals._disableInventFl = true; + _objectsManager.PLAN_BETA(); + _globals._disableInventFl = false; + break; + + case 5: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 455; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField80]) { + if (_globals.SAUVEGARDE->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + } else { + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + } + _globals.NOSPRECRAN = false; + break; + + case 6: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + break; + + case 7: + if (_globals.SAUVEGARDE->data[svField220]) + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + else + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + break; + + case 8: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + break; + + case 9: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + if (!_globals.SAUVEGARDE->data[svField225]) + BOOM(); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + break; + + case 10: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); + _globals.NOSPRECRAN = false; + break; + + case 11: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); + _globals.NOSPRECRAN = false; + break; + + case 12: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField225]) { + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + } else { + BOOM(); + } + break; + + case 13: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + break; + + case 14: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + break; + + case 15: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18); + _globals.NOSPRECRAN = false; + break; + + case 16: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField113] == 1) { + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + } else if (!_globals.SAUVEGARDE->data[svField113]) { + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + } + break; + + case 17: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField117] == 1) { + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + } else if (!_globals.SAUVEGARDE->data[svField117]) { + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + } + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND_OFF(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 18: + _globals.NOSPRECRAN = true; + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); + break; + + case 19: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField123]) + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + else + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + break; + + case 20: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 8; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + if (_globals.SORTIE == 17) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.playAnim("PURG2.ANM", 12, 18, 50); + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 22: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + break; + + case 23: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + break; + + case 24: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + if (_globals.SAUVEGARDE->data[svField181]) { + if (_globals.SAUVEGARDE->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1); + } else { + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + } + break; + + case 25: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); + break; + + case 26: + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); + break; + + case 27: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + if (_globals.SAUVEGARDE->data[svField177] == 1) { + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + } else if (!_globals.SAUVEGARDE->data[svField177]) { + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + } + break; + + case 28: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 450; + _globals.NOSPRECRAN = true; + if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + else + _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1); + break; + + case 29: + _globals.Max_Propre = 60; + _globals.Max_Ligne_Long = 50; + _globals.Max_Propre_Gen = 50; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + break; + + case 30: + _globals.Max_Propre = 10; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); + _globals.NOSPRECRAN = false; + break; + + case 31: + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + break; + + case 32: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 20; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + break; + + case 33: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); + _globals.NOSPRECRAN = false; + break; + + case 34: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); + _globals.NOSPRECRAN = false; + break; + + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: { + _globals.Max_Propre = 50; + _globals.Max_Ligne_Long = 40; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals._disableInventFl = false; + _globals.FORET = true; + _globals.NOSPRECRAN = true; + Common::String im = Common::String::format("IM%d", _globals.SORTIE); + _soundManager.WSOUND(13); + if (_globals.FORETSPR == g_PTRNUL) { + _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); + _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); + _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + } + + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); + _globals.NOSPRECRAN = false; + if ((_globals.SORTIE < 35) || (_globals.SORTIE > 49)) { + _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); + _globals.FORET = false; + _soundManager.DEL_SAMPLE(1); + } + break; + } + + case 50: + AVION(); + _globals.SORTIE = 51; + break; + + case 51: + _globals.Max_Propre = 20; + _globals.Max_Ligne_Long = 10; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + break; + + case 52: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + break; + + case 54: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + break; + + case 55: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + break; + + case 56: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + break; + + case 57: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + break; + + case 58: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + break; + + case 59: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); + _globals.NOSPRECRAN = false; + break; + + case 60: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 440; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); + _globals.NOSPRECRAN = false; + break; + + case 61: + if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + INCENDIE(); + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + break; + + case 62: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); + _globals.NOSPRECRAN = false; + break; + + case 63: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); + _globals.NOSPRECRAN = false; + break; + + case 64: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + break; + + case 65: + _globals.Max_Propre = 40; + _globals.Max_Ligne_Long = 30; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); + _globals.NOSPRECRAN = false; + break; + + case 66: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); + _globals.NOSPRECRAN = false; + break; + + case 67: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); + _globals.NOSPRECRAN = false; + break; + + case 68: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + break; + + case 69: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); + _globals.NOSPRECRAN = false; + break; + + case 70: + _globals.Max_Propre = 8; + _globals.Max_Ligne_Long = 8; + _globals.Max_Propre_Gen = 20; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); + _globals.NOSPRECRAN = false; + break; + + case 71: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); + _globals.NOSPRECRAN = false; + break; + + case 73: + _globals.Max_Propre = 15; + _globals.Max_Ligne_Long = 15; + _globals.Max_Propre_Gen = 10; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField318] == 1) { + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + } else if (!_globals.SAUVEGARDE->data[svField318]) { + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + } + break; + + case 75: + BASE(); + break; + + case 77: + OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + break; + + case 78: + OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + break; + + case 79: + OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + break; + + case 80: + OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + break; + + case 81: + OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + break; + + case 82: + OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + break; + + case 83: + OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + break; + + case 84: + OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + break; + + case 85: + OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + break; + + case 86: + OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + break; + + case 87: + OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + break; + + case 88: + OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + break; + + case 89: + OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + break; + + case 90: + BASED(); + break; + + case 91: + OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + break; + + case 93: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 445; + if (_globals.SAUVEGARDE->data[svField330]) + _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); + break; + + case 94: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 440; + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + break; + + case 95: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + break; + + case 96: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + break; + + case 97: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + if (_globals.SORTIE == 18) { + _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _soundManager.WSOUND(6); + if (_globals.SVGA == 2) + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + else if (_globals.SVGA == 1) + _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + + _graphicsManager.FADE_OUTS(); + _globals.iRegul = 0; + } + break; + + case 98: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + break; + + case 99: + _globals.Max_Propre = 5; + _globals.Max_Ligne_Long = 5; + _globals.Max_Propre_Gen = 5; + _globals.Max_Perso_Y = 435; + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + break; + + case 100: + JOUE_FIN(); + break; + + case 111: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); + _globals.NOSPRECRAN = false; + break; + + case 112: + _globals.NOSPRECRAN = true; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); + _globals.NOSPRECRAN = false; + break; + + case 113: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 113; + _globals.SAUVEGARDE->data[svField5] = 113; + _computerManager.showComputer(COMPUTER_HOPKINS); + _graphicsManager.setModeVesa(); + break; + + case 114: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 114; + _globals.SAUVEGARDE->data[svField5] = 114; + _computerManager.showComputer(COMPUTER_SAMANTHAS); + _graphicsManager.setModeVesa(); + break; + + case 115: + _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals.ECRAN; + _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; + _globals.ECRAN = 115; + _globals.SAUVEGARDE->data[svField5] = 115; + _computerManager.showComputer(COMPUTER_PUBLIC); + _graphicsManager.setModeVesa(); + break; + + case 150: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 151: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + + _graphicsManager.Cls_Pal(); + _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); + _globals.iRegul = 0; + _globals.SORTIE = 300; + break; + + case 152: + _soundManager.WSOUND(16); + _globals.iRegul = 1; + + // Added lock and unlock to avoid crash + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.Cls_Pal(); _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; @@ -4501,7 +5428,7 @@ void HopkinsEngine::Credits() { } else { _eventsManager.VBL(); } - if ( _globals.Credit[_globals.Credit_lignes - 1]._linePosY <= 39) { + if (_globals.Credit[_globals.Credit_lignes - 1]._linePosY <= 39) { _globals.Credit_y = 440; ++soundId; if (soundId > 31) diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 62f49d33e6..7d2463531b 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -116,6 +116,7 @@ private: bool runWin95full(); bool runLinuxFull(); bool runBeOSFull(); + bool runOS2Full(); /** * Show warning screen about the game being adults only. -- cgit v1.2.3 From 1f987a91ae9e7044fd1f6764d1232109028a8bd8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 23 Dec 2012 19:08:23 +0100 Subject: HOPKINS: Some more renaming. Remove 2 useless palettes --- engines/hopkins/anim.cpp | 48 +++++++------- engines/hopkins/computer.cpp | 4 +- engines/hopkins/graphics.cpp | 83 ++++++++----------------- engines/hopkins/graphics.h | 8 +-- engines/hopkins/hopkins.cpp | 145 ++++++++++++++++++++++--------------------- engines/hopkins/hopkins.h | 2 +- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 6 +- engines/hopkins/script.cpp | 10 +-- engines/hopkins/sound.cpp | 4 +- engines/hopkins/sound.h | 2 +- engines/hopkins/talk.cpp | 18 +++--- 12 files changed, 151 insertions(+), 181 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 2f9d44a614..5b8495c84c 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -68,7 +68,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui error("File not found - %s", _vm->_globals.NFICHIER.c_str()); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.skip(14); @@ -87,9 +87,9 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (NO_SEQ) { if (hasScreenCopy) memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); } else { - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -174,7 +174,7 @@ EXIT: f.seek(0); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.skip(14); @@ -232,7 +232,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint v8 = 0; while (!_vm->shouldQuit()) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 769); + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager._palette, 769); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -251,7 +251,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); f.read(&buf, 6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.read(&buf, 4); nbytes = f.readUint32LE(); f.readUint32LE(); @@ -263,7 +263,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint f.read(v12, nbytes); - _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.clearPalette(); v11 = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.scrollScreen(0); @@ -279,9 +279,9 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->_animationManager.NO_SEQ) { if (v8 == 1) memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); } else { - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); if (v8) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -314,8 +314,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); - _vm->_graphicsManager.Cls_Pal(); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); @@ -388,8 +388,8 @@ LABEL_88: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); - _vm->_graphicsManager.Cls_Pal(); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); @@ -430,8 +430,8 @@ LABEL_88: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); - _vm->_graphicsManager.Cls_Pal(); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); @@ -466,7 +466,7 @@ LABEL_114: f.seek(0); f.read(&buf, 6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.read(&buf, 4); nbytes = f.readUint32LE(); @@ -509,8 +509,8 @@ LABEL_114: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager.Palette, _vm->_graphicsManager.OLD_PAL, 769); - _vm->_graphicsManager.Cls_Pal(); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); @@ -836,7 +836,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.skip(14); @@ -856,7 +856,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); } - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); } else { _vm->_graphicsManager.lockScreen(); if (v7) @@ -994,7 +994,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u error("File not found - %s", _vm->_globals.NFICHIER.c_str()); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.skip(4); nbytes = f.readUint32LE(); f.readUint32LE(); @@ -1015,10 +1015,10 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u assert(ptr != NULL); memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 307200); } - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); } else { _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); if (v7) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else @@ -1112,7 +1112,7 @@ LABEL_54: f.seek(0); f.skip(6); - f.read(_vm->_graphicsManager.Palette, 800); + f.read(_vm->_graphicsManager._palette, 800); f.skip(4); nbytes = f.readUint32LE(); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 1efc5fce66..16cae046f6 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -70,7 +70,7 @@ void ComputerManager::setVideoMode() { * Sets up Textual entry mode */ void ComputerManager::setTextMode() { - _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); @@ -673,7 +673,7 @@ void ComputerManager::setModeVGA256() { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.Cls_Pal(); + _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.SCANLINE(320); } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8ed4c03bc6..18f0ec8bef 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -72,8 +72,7 @@ GraphicsManager::GraphicsManager() { Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_EXT_BLOCK_SIZE], 0); - Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); - Common::fill(&Palette[0], &Palette[PALETTE_EXT_BLOCK_SIZE], 0); + Common::fill(&_palette[0], &_palette[PALETTE_EXT_BLOCK_SIZE], 0); Common::fill(&OLD_PAL[0], &OLD_PAL[PALETTE_EXT_BLOCK_SIZE], 0); } @@ -117,7 +116,6 @@ void GraphicsManager::setGraphicalMode(int width, int height) { PAL_PIXELS = SD_PIXELS; _lineNbr = width; - Common::fill(&cmap[0], &cmap[256 * 3], 0); SDL_MODEYES = true; } else { error("Called SET_MODE multiple times"); @@ -159,7 +157,7 @@ void GraphicsManager::clearScreen() { void GraphicsManager::loadImage(const Common::String &file) { Common::String filename = Common::String::format("%s.PCX", file.c_str()); loadScreen(filename); - INIT_TABLE(165, 170, Palette); + INIT_TABLE(165, 170, _palette); } /** @@ -171,7 +169,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { clearScreen(); unlockScreen(); _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); - A_PCX320(_vesaScreen, _vm->_globals.NFICHIER, Palette); + A_PCX320(_vesaScreen, _vm->_globals.NFICHIER, _palette); memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); max_x = 320; @@ -201,11 +199,11 @@ void GraphicsManager::loadScreen(const Common::String &file) { } scrollScreen(0); - A_PCX640_480((byte *)_vesaScreen, file, Palette, flag); + A_PCX640_480((byte *)_vesaScreen, file, _palette, flag); SCROLL = 0; OLD_SCROLL = 0; - Cls_Pal(); + clearPalette(); if (!DOUBLE_ECRAN) { SCANLINE(SCREEN_WIDTH); @@ -418,8 +416,7 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * } // Clear Palette -void GraphicsManager::Cls_Pal() { - Common::fill(&cmap[0], &cmap[PALETTE_BLOCK_SIZE], 0); +void GraphicsManager::clearPalette() { SD_PIXELS[0] = 0; } @@ -694,22 +691,22 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac void GraphicsManager::FADE_INS() { FADESPD = 1; - fade_in(Palette, 1, (const byte *)_vesaBuffer); + fade_in(_palette, 1, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_OUTS() { FADESPD = 1; - fade_out(Palette, 1, (const byte *)_vesaBuffer); + fade_out(_palette, 1, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_INW() { FADESPD = 15; - fade_in(Palette, 20, (const byte *)_vesaBuffer); + fade_in(_palette, 20, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_OUTW() { FADESPD = 15; - fade_out(Palette, 20, (const byte *)_vesaBuffer); + fade_out(_palette, 20, (const byte *)_vesaBuffer); } void GraphicsManager::setpal_vga256(const byte *palette) { @@ -722,53 +719,27 @@ void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surfa DD_VBL(); } -void GraphicsManager::SETCOLOR(int palIndex, int r, int g, int b) { - Palette[palIndex * 3] = 255 * r / 100; - Palette[palIndex * 3 + 1] = 255 * g / 100; - Palette[palIndex * 3 + 2] = 255 * b / 100; - - setpal_vga256(Palette); -} - -void GraphicsManager::SETCOLOR2(int palIndex, int r, int g, int b) { - return SETCOLOR(palIndex, r, g, b); -} - void GraphicsManager::SETCOLOR3(int palIndex, int r, int g, int b) { - Palette[palIndex * 3] = 255 * r / 100; - Palette[palIndex * 3 + 1] = 255 * g / 100; - Palette[palIndex * 3 + 2] = 255 * b / 100; + int palOffset = 3 * palIndex; + _palette[palOffset] = 255 * r / 100; + _palette[palOffset + 1] = 255 * g / 100; + _palette[palOffset + 2] = 255 * b / 100; } void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { - int rv, gv, bv; - int palOffset; - int v8; - - rv = 255 * r / 100; - gv = 255 * g / 100; - bv = 255 * b / 100; - palOffset = 3 * palIndex; - Palette[palOffset] = 255 * r / 100; - Palette[palOffset + 1] = gv; - Palette[palOffset + 2] = bv; - - v8 = 4 * palIndex; - cmap[v8] = rv; - cmap[v8 + 1] = gv; - cmap[v8 + 2] = bv; + int rv = 255 * r / 100; + int gv = 255 * g / 100; + int bv = 255 * b / 100; + + int palOffset = 3 * palIndex; + _palette[palOffset] = rv; + _palette[palOffset + 1] = gv; + _palette[palOffset + 2] = bv; WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); } 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, -// since PALPCX is only used in SAVE_IMAGE, and cmap in the original was a RGBA -// array specifically intended just for passing to the SDL palette setter - Common::copy(&palette[0], &palette[PALETTE_BLOCK_SIZE], &PALPCX[0]); - Common::copy(&palette[0], &palette[PALETTE_BLOCK_SIZE], &cmap[0]); - const byte *srcP = &palette[0]; for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { *(uint16 *)&SD_PIXELS[2 * idx] = MapRGB(*srcP, *(srcP + 1), *(srcP + 2)); @@ -790,16 +761,16 @@ void GraphicsManager::DD_VBL() { void GraphicsManager::FADE_OUTW_LINUX(const byte *surface) { assert(surface); - fade_out(Palette, FADESPD, surface); + fade_out(_palette, FADESPD, surface); } void GraphicsManager::FADE_INW_LINUX(const byte *surface) { assert(surface); - fade_in(Palette, FADESPD, surface); + fade_in(_palette, FADESPD, surface); } void GraphicsManager::FADE_IN_CASSE() { - setpal_vga256(Palette); + setpal_vga256(_palette); lockScreen(); CopyAsm16(_vesaBuffer); unlockScreen(); @@ -2035,7 +2006,7 @@ void GraphicsManager::NB_SCREEN() { const byte *srcP; if (!_vm->_globals.NECESSAIRE) - INIT_TABLE(50, 65, Palette); + INIT_TABLE(50, 65, _palette); if (_lineNbr == SCREEN_WIDTH) Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT); @@ -2057,7 +2028,7 @@ void GraphicsManager::NB_SCREEN() { } void GraphicsManager::SHOW_PALETTE() { - setpal_vga256(Palette); + setpal_vga256(_palette); } void GraphicsManager::videkey() { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index b3b4e476a9..0e0963a08c 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -62,8 +62,7 @@ public: byte *PAL_PIXELS; int _lineNbr; byte TABLE_COUL[PALETTE_EXT_BLOCK_SIZE]; - byte cmap[PALETTE_BLOCK_SIZE]; - byte Palette[PALETTE_EXT_BLOCK_SIZE]; + byte _palette[PALETTE_EXT_BLOCK_SIZE]; byte OLD_PAL[PALETTE_EXT_BLOCK_SIZE]; bool Linear; Graphics::Surface *_videoPtr; @@ -81,7 +80,6 @@ public: int Agr_x, Agr_y; int Agr_Flag_x, Agr_Flag_y; int FADESPD; - byte PALPCX[PALETTE_EXT_BLOCK_SIZE]; int FADE_LINUX; bool _skipVideoLockFl; int no_scroll; @@ -117,7 +115,7 @@ public: void Trans_bloc2(byte *surface, byte *col, int size); void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); void A_PCX320(byte *surface, const Common::String &file, byte *palette); - void Cls_Pal(); + void clearPalette(); void SCANLINE(int pitch); void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); @@ -135,8 +133,6 @@ public: void FADE_OUT_CASSE(); void setpal_vga256(const byte *palette); void setpal_vga256_linux(const byte *palette, const byte *surface); - void SETCOLOR(int palIndex, int r, int g, int b); - void SETCOLOR2(int palIndex, int r, int g, int b); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); void CHANGE_PALETTE(const byte *palette); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index cc66415a4b..1d5691200e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -143,13 +143,13 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); if (!_eventsManager._escKeyFl) - INTRORUN(); + playIntro(); warning("TODO Fin_Interrupt()"); warning("TODO TEST = 1;"); @@ -231,7 +231,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); if (!_globals.CENSURE) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else @@ -419,7 +419,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -431,7 +431,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.loadImage("njour3a"); _graphicsManager.FADE_INW(); _eventsManager.delay(5000); @@ -446,7 +446,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -484,7 +484,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) - INTRORUN(); + playIntro(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); @@ -557,7 +557,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; if (!_globals.CENSURE) @@ -752,7 +752,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.DD_VBL(); memset(_graphicsManager._vesaBuffer, 0, 307200); memset(_graphicsManager._vesaScreen, 0, 307200); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.RESET_SEGMENT_VESA(); break; @@ -787,7 +787,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -801,7 +801,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -815,7 +815,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -843,11 +843,11 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("MP.ANM", 10, 0, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) - INTRORUN(); + playIntro(); _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); _globals.iRegul = 0; @@ -893,7 +893,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); @@ -1048,7 +1048,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); // _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -1095,7 +1095,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); @@ -1565,7 +1565,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); @@ -1647,7 +1647,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -1662,7 +1662,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -1677,7 +1677,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -1726,11 +1726,11 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("MP.ANM", 10, 0, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) - INTRORUN(); + playIntro(); _graphicsManager.FADE_OUTS(); _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); @@ -1782,7 +1782,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); @@ -1935,7 +1935,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) @@ -1983,7 +1983,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); @@ -2453,7 +2453,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); @@ -2536,7 +2536,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -2551,7 +2551,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -2566,7 +2566,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -2610,12 +2610,12 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("MP.ANM", 10, 16, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) - INTRORUN(); + playIntro(); _graphicsManager.loadImage("H2"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); @@ -2669,7 +2669,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); if (!_globals.CENSURE) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else @@ -2824,7 +2824,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); if (_globals.SVGA == 2) @@ -2868,7 +2868,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); @@ -3334,7 +3334,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); @@ -3413,7 +3413,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -3425,7 +3425,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -3437,7 +3437,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; _globals.SORTIE = 300; @@ -3496,7 +3496,7 @@ bool HopkinsEngine::runLinuxFull() { _animationManager.playAnim("MP.ANM", 10, 16, 200); if (!_eventsManager._escKeyFl) - INTRORUN(); + playIntro(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); @@ -3548,7 +3548,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; if (!_globals.CENSURE) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); @@ -3702,7 +3702,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); _graphicsManager.FADE_LINUX = 2; @@ -3745,7 +3745,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); _graphicsManager.FADE_LINUX = 2; @@ -4213,7 +4213,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _soundManager.WSOUND(6); if (_globals.SVGA == 2) _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); @@ -4269,7 +4269,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.DD_VBL(); memset(_graphicsManager._vesaBuffer, 0, 307200); memset(_graphicsManager._vesaScreen, 0, 307200); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.RESET_SEGMENT_VESA(); break; @@ -4303,7 +4303,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -4316,7 +4316,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -4329,7 +4329,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; @@ -4440,7 +4440,10 @@ void HopkinsEngine::INIT_SYSTEM() { _eventsManager._mouseOffset.y = 0; } -void HopkinsEngine::INTRORUN() { +/** + * Play the intro of the game + */ +void HopkinsEngine::playIntro() { // Win95 EN demo doesn't include the intro if ((getLanguage() == Common::EN_ANY) && (getPlatform() == Common::kPlatformWindows) && (getIsDemo())) return; @@ -4457,19 +4460,19 @@ void HopkinsEngine::INTRORUN() { _animationManager._clearAnimationFl = true; _animationManager.playAnim("J1.anm", 12, 12, 50); if (!_eventsManager._escKeyFl) { - _soundManager.VOICE_MIX(1, 3); + _soundManager.mixVoice(1, 3); _animationManager.playAnim("J2.anm", 12, 12, 50); if (!_eventsManager._escKeyFl) { - _soundManager.VOICE_MIX(2, 3); + _soundManager.mixVoice(2, 3); _animationManager.playAnim("J3.anm", 12, 12, 50); if (!_eventsManager._escKeyFl) { - _soundManager.VOICE_MIX(3, 3); + _soundManager.mixVoice(3, 3); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _graphicsManager.DD_VBL(); _soundManager.WSOUND(11); _graphicsManager.loadImage("intro1"); @@ -4510,7 +4513,7 @@ void HopkinsEngine::INTRORUN() { return; } - _soundManager.VOICE_MIX(4, 3); + _soundManager.mixVoice(4, 3); _graphicsManager.FADE_OUTW(); _graphicsManager.no_scroll = 0; _graphicsManager.loadImage("intro2"); @@ -4537,10 +4540,10 @@ void HopkinsEngine::INTRORUN() { _eventsManager.VBL(); _objectsManager.setBobAnimation(3); - _soundManager.VOICE_MIX(5, 3); + _soundManager.mixVoice(5, 3); _objectsManager.stopBobAnimation(3); _eventsManager.VBL(); - memcpy(&paletteData2, _graphicsManager.Palette, 796); + memcpy(&paletteData2, _graphicsManager._palette, 796); // CHECKME: Useless variables? // v21 = *(uint16 *)&_graphicsManager.Palette[796]; @@ -4587,21 +4590,21 @@ void HopkinsEngine::INTRORUN() { if (v9 == 12) { _objectsManager.setBobAnimation(3); _eventsManager.VBL(); - _soundManager.VOICE_MIX(6, 3); + _soundManager.mixVoice(6, 3); _eventsManager.VBL(); _objectsManager.stopBobAnimation(3); } - Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); for (int i = 1, v12 = 4 * v9; i <= PALETTE_BLOCK_SIZE; i++) { - if (_graphicsManager.Palette[i] > v12) - _graphicsManager.Palette[i] -= v12; + if (_graphicsManager._palette[i] > v12) + _graphicsManager._palette[i] -= v12; } - _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager._vesaBuffer); + _graphicsManager.setpal_vga256_linux(_graphicsManager._palette, _graphicsManager._vesaBuffer); if (2 * v9 > 1) { @@ -4622,7 +4625,7 @@ void HopkinsEngine::INTRORUN() { _eventsManager.VBL(); _objectsManager.setBobAnimation(3); - _soundManager.VOICE_MIX(7, 3); + _soundManager.mixVoice(7, 3); _objectsManager.stopBobAnimation(3); for (uint k = 1; k < 60 / _globals._speed; ++k) @@ -4631,13 +4634,13 @@ void HopkinsEngine::INTRORUN() { for (uint l = 0; l < 20 / _globals._speed; ++l) _eventsManager.VBL(); - Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); - _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager._vesaBuffer); + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); + _graphicsManager.setpal_vga256_linux(_graphicsManager._palette, _graphicsManager._vesaBuffer); for (uint m = 0; m < 50 / _globals._speed; ++m) { if (m == 30 / _globals._speed) { _objectsManager.setBobAnimation(3); - _soundManager.VOICE_MIX(8, 3); + _soundManager.mixVoice(8, 3); _objectsManager.stopBobAnimation(3); } @@ -4699,7 +4702,7 @@ void HopkinsEngine::PASS() { if (_soundManager.VOICEOFF) _eventsManager.delay(500); else - _soundManager.VOICE_MIX(628, 4); + _soundManager.mixVoice(628, 4); _graphicsManager.FADE_OUTW(); _globals.SORTIE = 4; @@ -4731,7 +4734,7 @@ void HopkinsEngine::BOOM() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 199; @@ -4856,7 +4859,7 @@ void HopkinsEngine::BASE() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager._clearAnimationFl = true; _soundManager.WSOUND(25); if (_globals.SVGA == 1) { @@ -4923,7 +4926,7 @@ void HopkinsEngine::BASED() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.NO_SEQ = false; _soundManager.WSOUND(26); _globals.iRegul = 1; @@ -5064,7 +5067,7 @@ void HopkinsEngine::JOUE_FIN() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager.playAnim("FF1a.anm", 18, 18, 9); _animationManager.playAnim("FF1a.anm", 9, 18, 9); _animationManager.playAnim("FF1a.anm", 9, 18, 18); @@ -5120,7 +5123,7 @@ void HopkinsEngine::AVION() { _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); - _graphicsManager.Cls_Pal(); + _graphicsManager.clearPalette(); _animationManager._clearAnimationFl = false; if (_globals.SVGA == 1) { diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 7d2463531b..a895054286 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -167,7 +167,7 @@ public: /** * Run the introduction sequence */ - void INTRORUN(); + void playIntro(); /** * Synchronises the sound settings from ScummVM into the engine diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 0e05136bf0..b48409e6b7 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -216,7 +216,7 @@ int MenuManager::MENU() { _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - _vm->INTRORUN(); + _vm->playIntro(); continue; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a960796d86..5658371c03 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4030,7 +4030,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NOPARLE = false; if (!_vm->_globals.CENSURE) { v1 = _vm->_globals.allocMemory(1000); - memcpy(v1, _vm->_graphicsManager.Palette, 769); + memcpy(v1, _vm->_graphicsManager._palette, 769); _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200); @@ -4052,7 +4052,7 @@ void ObjectsManager::SPECIAL_JEU() { g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); PERSO_ON = false; - memcpy(_vm->_graphicsManager.Palette, v1, 769); + memcpy(_vm->_graphicsManager._palette, v1, 769); _vm->_graphicsManager.SHOW_PALETTE(); _vm->_globals.freeMemory(v1); _vm->_graphicsManager.lockScreen(); @@ -4697,7 +4697,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(383, 4); + _vm->_soundManager.mixVoice(383, 4); _vm->_globals.SAUVEGARDE->data[svField270] = 1; _vm->_globals.SAUVEGARDE->data[svField300] = 1; _vm->_globals.SAUVEGARDE->data[svField320] = 1; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 818610c892..3c865755ec 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -139,7 +139,7 @@ int ScriptManager::Traduction(byte *a1) { _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(v3, 4); + _vm->_soundManager.mixVoice(v3, 4); } if (TRAVAILOBJET == 1) { if (_vm->_globals.SAUVEGARDE->data[svField356]) { @@ -147,7 +147,7 @@ int ScriptManager::Traduction(byte *a1) { if (!_vm->_soundManager.TEXTOFF) _vm->_fontManager.showText(9); if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(635, 4); + _vm->_soundManager.mixVoice(635, 4); goto LABEL_104; } if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) @@ -158,7 +158,7 @@ int ScriptManager::Traduction(byte *a1) { if (_vm->_soundManager.TEXTOFF) { LABEL_98: if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(v3, 5); + _vm->_soundManager.mixVoice(v3, 5); goto LABEL_104; } _vm->_fontManager.initTextBuffers(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); @@ -637,7 +637,7 @@ LABEL_1141: } if (v76 == 607) { if (!_vm->_globals._internetFl) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager.Palette, 769); + memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager._palette, 769); v1 = _vm->_graphicsManager.OLD_PAL[769]; _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } @@ -1929,7 +1929,7 @@ LABEL_1141: _vm->_fontManager.showText(9); } if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.VOICE_MIX(617, 4); + _vm->_soundManager.mixVoice(617, 4); for (int i = 0; i <= 29; i++) { if (_vm->shouldQuit()) return -1; // Exiting game diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 1e24346f60..22c4f04f3b 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -148,7 +148,7 @@ void SoundManager::LOAD_ANM_SOUND() { LOAD_WAV("SOUND22.WAV", 1); break; case 200: - VOICE_MIX(682, 1); + mixVoice(682, 1); break; case 208: LOAD_WAV("SOUND77.WAV", 1); @@ -500,7 +500,7 @@ void SoundManager::DEL_MSAMPLE(int mwavIndex) { } } -bool SoundManager::VOICE_MIX(int voiceId, int voiceMode) { +bool SoundManager::mixVoice(int voiceId, int voiceMode) { int fileNumber; int oldMusicVol; bool breakFlag; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 8a151531b2..fe2e52172a 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -153,7 +153,7 @@ public: void DEL_MUSIC(); - bool VOICE_MIX(int voiceId, int voiceMode); + bool mixVoice(int voiceId, int voiceMode); void DEL_SAMPLE(int soundIndex); void PLAY_SOUND(const Common::String &file); void PLAY_SOUND2(const Common::String &file2); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index fb1d4c3c97..1e4c228577 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -155,8 +155,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { if (_vm->getIsDemo() == false) _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager._palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); @@ -243,8 +243,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager._mouseCursorId = v8; _vm->_eventsManager.changeMouseCursor(v8); - _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager._palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_objectsManager._disableCursorFl = false; _vm->_globals._disableInventFl = v7; STATI = 0; @@ -344,7 +344,7 @@ int TalkManager::DIALOGUE() { v6 = 0; } while (!_vm->shouldQuit() && v6 != 1); - _vm->_soundManager.VOICE_MIX(v5, 1); + _vm->_soundManager.mixVoice(v5, 1); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(6); _vm->_fontManager.hideText(7); @@ -456,7 +456,7 @@ int TalkManager::DIALOGUE_REP(int idx) { _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 20, 25, 5, v23, 252); _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICE_MIX(v22, 1)) { + if (!_vm->_soundManager.mixVoice(v22, 1)) { v14 = 0; _vm->_eventsManager._curMouseButton = 0; _vm->_eventsManager._mouseButton = 0; @@ -1266,12 +1266,12 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!_vm->getIsDemo()) _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager._palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); v14 = _vm->_graphicsManager._vesaBuffer; v15 = _vm->_graphicsManager._vesaScreen; memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); -- cgit v1.2.3 From 3f8085f6542a1ef5a8fd0b1b3588b31114ac28c5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 23 Dec 2012 20:36:08 +0100 Subject: HOPKINS: Some more renaming, remove useless variable --- engines/hopkins/anim.cpp | 10 ++++----- engines/hopkins/font.cpp | 2 +- engines/hopkins/graphics.cpp | 52 +++++++++++++++++++++----------------------- engines/hopkins/graphics.h | 13 +++++------ engines/hopkins/script.cpp | 4 ++-- engines/hopkins/talk.cpp | 8 +++---- 6 files changed, 43 insertions(+), 46 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 5b8495c84c..83f039341c 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -232,7 +232,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint v8 = 0; while (!_vm->shouldQuit()) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager._palette, 769); + memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); @@ -314,7 +314,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -388,7 +388,7 @@ LABEL_88: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -430,7 +430,7 @@ LABEL_88: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); @@ -509,7 +509,7 @@ LABEL_114: _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager.OLD_PAL, 769); + memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); _vm->_graphicsManager.clearPalette(); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 28b13490f7..8c0239db13 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -384,7 +384,7 @@ LABEL_57: error("Cutting a block for text box (%d)", v49); } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); - _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager.TABLE_COUL, v49); + _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, v49); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); _vm->_globals.freeMemory(ptrd); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 18f0ec8bef..638a1a2719 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -40,7 +40,6 @@ GraphicsManager::GraphicsManager() { WinScan = 0; PAL_PIXELS = NULL; _lineNbr = 0; - Linear = false; _videoPtr = NULL; ofscroll = 0; SCROLL = 0; @@ -71,9 +70,9 @@ GraphicsManager::GraphicsManager() { spec_largeur = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); - Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_EXT_BLOCK_SIZE], 0); + Common::fill(&_colorTable[0], &_colorTable[PALETTE_EXT_BLOCK_SIZE], 0); Common::fill(&_palette[0], &_palette[PALETTE_EXT_BLOCK_SIZE], 0); - Common::fill(&OLD_PAL[0], &OLD_PAL[PALETTE_EXT_BLOCK_SIZE], 0); + Common::fill(&_oldPalette[0], &_oldPalette[PALETTE_EXT_BLOCK_SIZE], 0); } GraphicsManager::~GraphicsManager() { @@ -110,7 +109,6 @@ void GraphicsManager::setGraphicalMode(int width, int height) { XSCREEN = width; YSCREEN = height; - Linear = true; WinScan = width * 2; // Refactor me PAL_PIXELS = SD_PIXELS; @@ -157,7 +155,7 @@ void GraphicsManager::clearScreen() { void GraphicsManager::loadImage(const Common::String &file) { Common::String filename = Common::String::format("%s.PCX", file.c_str()); loadScreen(filename); - INIT_TABLE(165, 170, _palette); + initColorTable(165, 170, _palette); } /** @@ -229,21 +227,21 @@ void GraphicsManager::loadScreen(const Common::String &file) { memcpy(_vesaBuffer, _vesaScreen, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); } -void GraphicsManager::INIT_TABLE(int minIndex, int maxIndex, byte *palette) { +void GraphicsManager::initColorTable(int minIndex, int maxIndex, byte *palette) { for (int idx = 0; idx < 256; ++idx) - TABLE_COUL[idx] = idx; + _colorTable[idx] = idx; - Trans_bloc(TABLE_COUL, palette, 256, minIndex, maxIndex); + Trans_bloc(_colorTable, palette, 256, minIndex, maxIndex); for (int idx = 0; idx < 256; ++idx) { - byte v = TABLE_COUL[idx]; + byte v = _colorTable[idx]; if (v > 27) - TABLE_COUL[idx] = 0; + _colorTable[idx] = 0; if (!v) - TABLE_COUL[idx] = 0; + _colorTable[idx] = 0; } - TABLE_COUL[0] = 1; + _colorTable[0] = 1; } /** @@ -588,7 +586,7 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, } while (yCtr != 1); } -void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface) { +void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) { uint16 palData1[PALETTE_BLOCK_SIZE * 2]; byte palData2[PALETTE_BLOCK_SIZE]; @@ -639,7 +637,7 @@ void GraphicsManager::fade_in(const byte *palette, int step, const byte *surface DD_VBL(); } -void GraphicsManager::fade_out(const byte *palette, int step, const byte *surface) { +void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface) { int palByte; uint16 palMax; byte palData[PALETTE_BLOCK_SIZE]; @@ -691,30 +689,30 @@ void GraphicsManager::fade_out(const byte *palette, int step, const byte *surfac void GraphicsManager::FADE_INS() { FADESPD = 1; - fade_in(_palette, 1, (const byte *)_vesaBuffer); + fadeIn(_palette, 1, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_OUTS() { - FADESPD = 1; - fade_out(_palette, 1, (const byte *)_vesaBuffer); + FADESPD = 1; + fadeOut(_palette, 1, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_INW() { FADESPD = 15; - fade_in(_palette, 20, (const byte *)_vesaBuffer); + fadeIn(_palette, 20, (const byte *)_vesaBuffer); } void GraphicsManager::FADE_OUTW() { FADESPD = 15; - fade_out(_palette, 20, (const byte *)_vesaBuffer); + fadeOut(_palette, 20, (const byte *)_vesaBuffer); } void GraphicsManager::setpal_vga256(const byte *palette) { - CHANGE_PALETTE(palette); + changePalette(palette); } void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { - CHANGE_PALETTE(palette); + changePalette(palette); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); } @@ -739,7 +737,7 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); } -void GraphicsManager::CHANGE_PALETTE(const byte *palette) { +void GraphicsManager::changePalette(const byte *palette) { const byte *srcP = &palette[0]; for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { *(uint16 *)&SD_PIXELS[2 * idx] = MapRGB(*srcP, *(srcP + 1), *(srcP + 2)); @@ -761,12 +759,12 @@ void GraphicsManager::DD_VBL() { void GraphicsManager::FADE_OUTW_LINUX(const byte *surface) { assert(surface); - fade_out(_palette, FADESPD, surface); + fadeOut(_palette, FADESPD, surface); } void GraphicsManager::FADE_INW_LINUX(const byte *surface) { assert(surface); - fade_in(_palette, FADESPD, surface); + fadeIn(_palette, FADESPD, surface); } void GraphicsManager::FADE_IN_CASSE() { @@ -2006,12 +2004,12 @@ void GraphicsManager::NB_SCREEN() { const byte *srcP; if (!_vm->_globals.NECESSAIRE) - INIT_TABLE(50, 65, _palette); + initColorTable(50, 65, _palette); if (_lineNbr == SCREEN_WIDTH) - Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT); + Trans_bloc2(_vesaBuffer, _colorTable, SCREEN_WIDTH * SCREEN_HEIGHT); else if (_lineNbr == (SCREEN_WIDTH * 2)) - Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT * 2); + Trans_bloc2(_vesaBuffer, _colorTable, SCREEN_WIDTH * SCREEN_HEIGHT * 2); lockScreen(); m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 0e0963a08c..cadcd1dce8 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -61,10 +61,9 @@ public: byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; int _lineNbr; - byte TABLE_COUL[PALETTE_EXT_BLOCK_SIZE]; + byte _colorTable[PALETTE_EXT_BLOCK_SIZE]; byte _palette[PALETTE_EXT_BLOCK_SIZE]; - byte OLD_PAL[PALETTE_EXT_BLOCK_SIZE]; - bool Linear; + byte _oldPalette[PALETTE_EXT_BLOCK_SIZE]; Graphics::Surface *_videoPtr; byte *_vesaScreen; byte *_vesaBuffer; @@ -109,7 +108,7 @@ public: void clearScreen(); void loadImage(const Common::String &file); void loadVgaImage(const Common::String &file); - void INIT_TABLE(int minIndex, int maxIndex, byte *palette); + void initColorTable(int minIndex, int maxIndex, byte *palette); void scrollScreen(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); @@ -121,8 +120,8 @@ public: void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); - void fade_in(const byte *palette, int step, const byte *surface); - void fade_out(const byte *palette, int step, const byte *surface); + void fadeIn(const byte *palette, int step, const byte *surface); + void fadeOut(const byte *palette, int step, const byte *surface); void FADE_INS(); void FADE_OUTS(); void FADE_INW(); @@ -135,7 +134,7 @@ public: void setpal_vga256_linux(const byte *palette, const byte *surface); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); - void CHANGE_PALETTE(const byte *palette); + void changePalette(const byte *palette); uint16 MapRGB(byte r, byte g, byte b); void DD_VBL(); void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3c865755ec..f6cf8567db 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -637,8 +637,8 @@ LABEL_1141: } if (v76 == 607) { if (!_vm->_globals._internetFl) { - memcpy(_vm->_graphicsManager.OLD_PAL, _vm->_graphicsManager._palette, 769); - v1 = _vm->_graphicsManager.OLD_PAL[769]; + memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); + v1 = _vm->_graphicsManager._oldPalette[769]; _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } _vm->_globals.NBBLOC = 0; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 1e4c228577..b55e0814f2 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -155,7 +155,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { if (_vm->getIsDemo() == false) _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager._palette); + _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -243,7 +243,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager._mouseCursorId = v8; _vm->_eventsManager.changeMouseCursor(v8); - _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager._palette); + _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_objectsManager._disableCursorFl = false; _vm->_globals._disableInventFl = v7; @@ -569,7 +569,7 @@ void TalkManager::CHERCHE_PAL(int a1, int a2) { } _vm->_graphicsManager.setpal_vga256(palette); - _vm->_graphicsManager.INIT_TABLE(145, 150, palette); + _vm->_graphicsManager.initColorTable(145, 150, palette); } void TalkManager::VISU_WAIT() { @@ -1266,7 +1266,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!_vm->getIsDemo()) _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager._palette); + _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); -- cgit v1.2.3 From 8cce2721177422a65e73c9f178746403c801f242 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 01:43:37 +0100 Subject: HOPKINS: Some more renaming --- engines/hopkins/computer.cpp | 6 +-- engines/hopkins/font.cpp | 6 +-- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 114 +++++++++++++++++++++---------------------- engines/hopkins/hopkins.h | 20 ++++---- engines/hopkins/script.cpp | 18 +++---- engines/hopkins/sound.cpp | 12 ++--- engines/hopkins/sound.h | 2 +- 11 files changed, 93 insertions(+), 93 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 16cae046f6..c3ab69c3ad 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -607,9 +607,9 @@ void ComputerManager::displayGamesSubMenu() { _vm->_graphicsManager.min_y = 0; _vm->_graphicsManager.max_x = 320; _vm->_graphicsManager.max_y = 200; - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND37.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND38.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND39.WAV"); + _vm->_soundManager.loadSample(1, "SOUND37.WAV"); + _vm->_soundManager.loadSample(2, "SOUND38.WAV"); + _vm->_soundManager.loadSample(3, "SOUND39.WAV"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "CASSE.SPR"); _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); loadHiscore(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 8c0239db13..c5a580fab0 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -440,7 +440,7 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, break; if (currChar >= 32) { charIndex = currChar - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, currentX, yp, currChar - 32, col); currentX += _vm->_objectsManager.getWidth(_vm->_globals.police, charIndex); } @@ -458,7 +458,7 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, xp, yp, characterIndex, col); xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); } @@ -490,7 +490,7 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col break; if (v7 >= 32) { v5 = v7 - 32; - _vm->_graphicsManager.Affiche_Fonte(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, v9, yp, v7 - 32, fontCol); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, v9, yp, v7 - 32, fontCol); v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5); v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5); _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2650018c58..b5c2d44d4d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -480,7 +480,7 @@ void Globals::CLEAR_VBOB() { } // Load Object -void Globals::CHARGE_OBJET() { +void Globals::loadObjects() { _vm->_fileManager.constructFilename(HOPSYSTEM, "OBJET.DAT"); byte *data = _vm->_fileManager.loadFile(NFICHIER); byte *srcP = data; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7817eced0b..e00796ea23 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -481,7 +481,7 @@ public: void INIT_ANIM(); void INIT_VBOB(); void CLEAR_VBOB(); - void CHARGE_OBJET(); + void loadObjects(); byte *allocMemory(int count); byte *freeMemory(byte *p); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 638a1a2719..d4ad9cc30b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1882,7 +1882,7 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned } // Display Font -void GraphicsManager::Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, +void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour) { const byte *spriteDataP; int i; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index cadcd1dce8..2a49604c75 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -168,7 +168,7 @@ public: void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); - void Affiche_Fonte(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); + void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); void INI_ECRAN(const Common::String &file); void INI_ECRAN2(const Common::String &file); void OPTI_INI(const Common::String &file, int mode); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1d5691200e..ea715001ac 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -131,7 +131,7 @@ Common::Error HopkinsEngine::run() { bool HopkinsEngine::runWin95Demo() { _globals.SVGA = 1; - _globals.CHARGE_OBJET(); + _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); @@ -188,7 +188,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.PASSWORD = true; if (getLanguage() != Common::PL_POL) - if (!ADULT()) + if (!displayAdultDisclaimer()) return Common::kNoError; for (;;) { @@ -199,7 +199,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); - REST_SYSTEM(); + restoreSystem(); return false; } } @@ -306,7 +306,7 @@ bool HopkinsEngine::runWin95Demo() { if (_globals.SAUVEGARDE->data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else - BOOM(); + bombExplosion(); break; case 10: @@ -341,9 +341,9 @@ bool HopkinsEngine::runWin95Demo() { _eventsManager.VBL(); while (_eventsManager.getMouseButton() != 1); _graphicsManager.FADE_OUTW(); - REST_SYSTEM(); + restoreSystem(); } - BOOM(); + bombExplosion(); break; case 13: @@ -457,7 +457,7 @@ bool HopkinsEngine::runWin95Demo() { } bool HopkinsEngine::runLinuxDemo() { - _globals.CHARGE_OBJET(); + _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); @@ -505,7 +505,7 @@ bool HopkinsEngine::runLinuxDemo() { if (!g_system->getEventManager()->shouldQuit()) PUBQUIT(); _globals.PERSO = _globals.freeMemory(_globals.PERSO); - REST_SYSTEM(); + restoreSystem(); } } @@ -632,7 +632,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Perso_Y = 440; if (!_globals.SAUVEGARDE->data[svField225]) - BOOM(); + bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); break; @@ -662,7 +662,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { - BOOM(); + bombExplosion(); } break; @@ -723,7 +723,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 35: - ENDEMO(); + displayEndDemo(); break; case 111: @@ -829,7 +829,7 @@ bool HopkinsEngine::runLinuxDemo() { bool HopkinsEngine::runOS2Full() { _globals.SVGA = 2; - _globals.CHARGE_OBJET(); + _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); warning("_graphicsManager.loadImage(\"VERSW\");"); @@ -963,7 +963,7 @@ bool HopkinsEngine::runOS2Full() { if (_globals.SAUVEGARDE->data[225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else - BOOM(); + bombExplosion(); break; case 10: @@ -991,7 +991,7 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else - BOOM(); + bombExplosion(); break; case 13: @@ -1236,7 +1236,7 @@ bool HopkinsEngine::runOS2Full() { if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); - _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; @@ -1249,7 +1249,7 @@ bool HopkinsEngine::runOS2Full() { } case 50: - AVION(); + displayPlane(); _globals.SORTIE = 51; break; @@ -1593,7 +1593,7 @@ bool HopkinsEngine::runOS2Full() { break; case 100: - JOUE_FIN(); + playEnding(); break; case 111: @@ -1693,7 +1693,7 @@ bool HopkinsEngine::runOS2Full() { _globals.iRegul = 1; // _soundManager.WSOUND_OFF(); _soundManager.WSOUND(23); - _globals.SORTIE = PWBASE(); + _globals.SORTIE = handleBaseMap(); // _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -1706,7 +1706,7 @@ bool HopkinsEngine::runOS2Full() { warning("sub_33C70(v18);"); warning("sub_39460(v19);"); warning("sub_44134();"); - REST_SYSTEM(); + restoreSystem(); return true; } @@ -1714,7 +1714,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.SVGA = 2; warning("TODO: Init_Interrupt()"); - _globals.CHARGE_OBJET(); + _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); _eventsManager.delay(500); @@ -1751,7 +1751,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); - REST_SYSTEM(); + restoreSystem(); } } @@ -1850,7 +1850,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals.SAUVEGARDE->data[svField225]) - BOOM(); + bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); break; @@ -1879,7 +1879,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { - BOOM(); + bombExplosion(); } break; @@ -2124,7 +2124,7 @@ bool HopkinsEngine::runBeOSFull() { if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); - _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); @@ -2138,7 +2138,7 @@ bool HopkinsEngine::runBeOSFull() { } case 50: - AVION(); + displayPlane(); _globals.SORTIE = 51; break; @@ -2482,7 +2482,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 100: - JOUE_FIN(); + playEnding(); break; case 111: @@ -2582,7 +2582,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); _soundManager.WSOUND(23); - _globals.SORTIE = PWBASE(); + _globals.SORTIE = handleBaseMap(); _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -2599,7 +2599,7 @@ bool HopkinsEngine::runWin95full() { warning("TODO: Init_Interrupt_()"); - _globals.CHARGE_OBJET(); + _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); _globals.HELICO = 0; @@ -2637,7 +2637,7 @@ bool HopkinsEngine::runWin95full() { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); - REST_SYSTEM(); + restoreSystem(); return false; } } @@ -2743,7 +2743,7 @@ bool HopkinsEngine::runWin95full() { if (_globals.SAUVEGARDE->data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else - BOOM(); + bombExplosion(); break; case 10: @@ -2771,7 +2771,7 @@ bool HopkinsEngine::runWin95full() { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { - BOOM(); + bombExplosion(); } break; @@ -3010,7 +3010,7 @@ bool HopkinsEngine::runWin95full() { if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); - _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; @@ -3022,7 +3022,7 @@ bool HopkinsEngine::runWin95full() { break; } case 50: - AVION(); + displayPlane(); _globals.SORTIE = 51; break; @@ -3362,7 +3362,7 @@ bool HopkinsEngine::runWin95full() { break; case 100: - JOUE_FIN(); + playEnding(); break; case 111: @@ -3474,7 +3474,7 @@ bool HopkinsEngine::runWin95full() { bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(16); - _globals.CHARGE_OBJET(); + _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); @@ -3514,7 +3514,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.SORTIE = _menuManager.MENU(); if (_globals.SORTIE == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); - REST_SYSTEM(); + restoreSystem(); return true; } } @@ -3620,7 +3620,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals.SAUVEGARDE->data[svField225]) - BOOM(); + bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); break; @@ -3649,7 +3649,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { - BOOM(); + bombExplosion(); } break; @@ -3888,7 +3888,7 @@ bool HopkinsEngine::runLinuxFull() { if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); - _soundManager.CHARGE_SAMPLE(1, "SOUND41.WAV"); + _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; @@ -3901,7 +3901,7 @@ bool HopkinsEngine::runLinuxFull() { } case 50: - AVION(); + displayPlane(); _globals.SORTIE = 51; break; @@ -4241,7 +4241,7 @@ bool HopkinsEngine::runLinuxFull() { break; case 100: - JOUE_FIN(); + playEnding(); break; case 111: @@ -4345,7 +4345,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; _soundManager.WSOUND(23); - _globals.SORTIE = PWBASE(); + _globals.SORTIE = handleBaseMap(); _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -4715,7 +4715,7 @@ void HopkinsEngine::NO_DISPO(int sortie) { _globals.SORTIE = sortie; } -void HopkinsEngine::ENDEMO() { +void HopkinsEngine::displayEndDemo() { _soundManager.WSOUND(28); if (_globals.FR == 1) _graphicsManager.loadImage("endfr"); @@ -4728,7 +4728,7 @@ void HopkinsEngine::ENDEMO() { _globals.SORTIE = 0; } -void HopkinsEngine::BOOM() { +void HopkinsEngine::bombExplosion() { _graphicsManager._lineNbr = SCREEN_WIDTH; _graphicsManager.SCANLINE(SCREEN_WIDTH); _graphicsManager.lockScreen(); @@ -4778,7 +4778,7 @@ void HopkinsEngine::BOOM() { _globals.SORTIE = 151; } -void HopkinsEngine::REST_SYSTEM() { +void HopkinsEngine::restoreSystem() { quitGame(); _eventsManager.refreshEvents(); } @@ -4960,7 +4960,7 @@ void HopkinsEngine::BASED() { _globals.iRegul = 0; } -void HopkinsEngine::JOUE_FIN() { +void HopkinsEngine::playEnding() { _globals.PERSO = _globals.freeMemory(_globals.PERSO); _dialogsManager._removeInventFl = true; _globals._disableInventFl = true; @@ -4973,7 +4973,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.SORTIE = 0; _globals.AFFLI = false; _globals.AFFIVBL = false; - _soundManager.CHARGE_SAMPLE(1, "SOUND90.WAV"); + _soundManager.loadSample(1, "SOUND90.WAV"); _graphicsManager.loadImage("IM100"); _animationManager.loadAnim("ANIM100"); _graphicsManager.VISU_ALL(); @@ -5073,7 +5073,7 @@ void HopkinsEngine::JOUE_FIN() { _animationManager.playAnim("FF1a.anm", 9, 18, 18); _animationManager.playAnim("FF1a.anm", 9, 18, 9); _animationManager.playAnim("FF2a.anm", 24, 24, 100); - Credits(); + displayCredits(); _globals.iRegul = 0; _globals.SORTIE = 300; _dialogsManager._removeInventFl = false; @@ -5116,7 +5116,7 @@ void HopkinsEngine::JOUE_FIN() { _globals.iRegul = 0; } -void HopkinsEngine::AVION() { +void HopkinsEngine::displayPlane() { _soundManager.WSOUND(28); _globals.iRegul = 1; _globals.nbrligne = SCREEN_WIDTH; @@ -5196,7 +5196,7 @@ void HopkinsEngine::AVION() { _animationManager._clearAnimationFl = false; } -int HopkinsEngine::PWBASE() { +int HopkinsEngine::handleBaseMap() { _globals._disableInventFl = true; _graphicsManager.loadImage("PBASE"); _graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -5283,7 +5283,7 @@ int HopkinsEngine::WBASE() { return 300; } -void HopkinsEngine::Charge_Credits() { +void HopkinsEngine::loadCredits() { _globals.Credit_y = 440; _globals.Credit_l = 10; _globals.Credit_h = 40; @@ -5345,7 +5345,7 @@ void HopkinsEngine::Charge_Credits() { _globals.freeMemory(bufPtr); } -void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { +void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { byte *bufPtr = buffer; int strWidth = 0; byte curChar; @@ -5380,14 +5380,14 @@ void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) { - _graphicsManager.Affiche_Fonte(_graphicsManager._vesaBuffer, _globals.police, startPosX, startPosY, curChar - 32, colour); + _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals.police, startPosX, startPosY, curChar - 32, colour); startPosX += _objectsManager.getWidth(_globals.police, curChar - 32); } } } -void HopkinsEngine::Credits() { - Charge_Credits(); +void HopkinsEngine::displayCredits() { + loadCredits(); _globals.Credit_y = 436; _graphicsManager.loadImage("GENERIC"); _graphicsManager.FADE_INW(); @@ -5420,7 +5420,7 @@ void HopkinsEngine::Credits() { break; } if (_globals.Credit[i]._lineSize != -1) - CREDIT_AFFICHE(nextY, _globals.Credit[i]._line, col); + displayCredits(nextY, _globals.Credit[i]._line, col); } } } @@ -5749,7 +5749,7 @@ void HopkinsEngine::syncSoundSettings() { _soundManager.syncSoundSettings(); } -bool HopkinsEngine::ADULT() { +bool HopkinsEngine::displayAdultDisclaimer() { int xp, yp; int buttonIndex; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index a895054286..7a58777241 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -83,20 +83,20 @@ private: void INIT_SYSTEM(); void PASS(); - void REST_SYSTEM(); + void restoreSystem(); void PUBQUIT(); - void ENDEMO(); - void BOOM(); + void displayEndDemo(); + void bombExplosion(); void INCENDIE(); void BASE(); void BASED(); - void JOUE_FIN(); - void AVION(); + void playEnding(); + void displayPlane(); /** * Displays the map screen in the underground base. */ - int PWBASE(); + int handleBaseMap(); /** * Runs the Wolf3D-like in the underground base. @@ -106,9 +106,9 @@ private: void BTOCEAN(); void OCEAN_HOME(); void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9); - void Charge_Credits(); - void CREDIT_AFFICHE(int startPosY, byte *buffer, char colour); - void Credits(); + void loadCredits(); + void displayCredits(int startPosY, byte *buffer, char colour); + void displayCredits(); void NO_DISPO(int sortie); bool runWin95Demo(); @@ -121,7 +121,7 @@ private: /** * Show warning screen about the game being adults only. */ - bool ADULT(); + bool displayAdultDisclaimer(); protected: // Engine APIs virtual Common::Error run(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index f6cf8567db..3269ed5c93 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -787,9 +787,9 @@ LABEL_1141: _vm->_graphicsManager.NOFADE = true; } if (v76 == 38) { - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND42.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(3, "SOUND41.WAV"); + _vm->_soundManager.loadSample(1, "SOUND44.WAV"); + _vm->_soundManager.loadSample(2, "SOUND42.WAV"); + _vm->_soundManager.loadSample(3, "SOUND41.WAV"); _vm->_soundManager.SPECIAL_SOUND = 17; _vm->_animationManager.playSequence("grenade.SEQ", 1, 32, 100); _vm->_soundManager.SPECIAL_SOUND = 0; @@ -838,8 +838,8 @@ LABEL_1141: } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_globals.NOT_VERIF = 1; - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND44.WAV"); - _vm->_soundManager.CHARGE_SAMPLE(2, "SOUND45.WAV"); + _vm->_soundManager.loadSample(1, "SOUND44.WAV"); + _vm->_soundManager.loadSample(2, "SOUND45.WAV"); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); int v15 = 0; do { @@ -917,7 +917,7 @@ LABEL_1141: _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); int v18 = 0; - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + _vm->_soundManager.loadSample(1, "SOUND40.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1142,7 +1142,7 @@ LABEL_1141: _vm->_objectsManager.SET_BOBPOSI(2, 0); _vm->_objectsManager.setBobAnimation(1); _vm->_objectsManager.setBobAnimation(2); - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + _vm->_soundManager.loadSample(1, "SOUND40.WAV"); int v25 = 0; do { if (_vm->shouldQuit()) @@ -1184,7 +1184,7 @@ LABEL_1141: _vm->_objectsManager.SET_BOBPOSI(3, 0); _vm->_objectsManager.setBobAnimation(1); _vm->_objectsManager.setBobAnimation(3); - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND40.WAV"); + _vm->_soundManager.loadSample(1, "SOUND40.WAV"); int v26 = 0; do { if (_vm->shouldQuit()) @@ -1305,7 +1305,7 @@ LABEL_1141: } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); - _vm->_soundManager.CHARGE_SAMPLE(1, "SOUND63.WAV"); + _vm->_soundManager.loadSample(1, "SOUND63.WAV"); if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { _vm->_objectsManager.setBobAnimation(4); int v33 = 0; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 22c4f04f3b..2ed7482084 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -126,11 +126,11 @@ void SoundManager::VERIF_SOUND() { void SoundManager::LOAD_ANM_SOUND() { switch (SPECIAL_SOUND) { case 2: - CHARGE_SAMPLE(5, "mitra1.wav"); - CHARGE_SAMPLE(1, "tir2.wav"); - CHARGE_SAMPLE(2, "sound6.wav"); - CHARGE_SAMPLE(3, "sound5.WAV"); - CHARGE_SAMPLE(4, "sound4.WAV"); + loadSample(5, "mitra1.wav"); + loadSample(1, "tir2.wav"); + loadSample(2, "sound6.wav"); + loadSample(3, "sound5.WAV"); + loadSample(4, "sound4.WAV"); break; case 5: LOAD_WAV("CRIE.WAV", 1); @@ -670,7 +670,7 @@ void SoundManager::MODSetMusicVolume(int volume) { // No implementatoin needed } -void SoundManager::CHARGE_SAMPLE(int wavIndex, const Common::String &file) { +void SoundManager::loadSample(int wavIndex, const Common::String &file) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); SOUND[wavIndex]._active = true; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index fe2e52172a..9e2c8cd8e7 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -160,7 +160,7 @@ public: void MODSetSampleVolume(); void MODSetVoiceVolume(); void MODSetMusicVolume(int volume); - void CHARGE_SAMPLE(int wavIndex, const Common::String &file); + void loadSample(int wavIndex, const Common::String &file); void PLAY_SAMPLE(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); void PLAY_WAV(int wavIndex); -- cgit v1.2.3 From 8c1f422bd68fe23c4e73ba3d3b13de028c905134 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 11:36:53 +0100 Subject: HOPKINS: Remove magic values used to check language, some renaming and refactoring --- engines/hopkins/computer.cpp | 6 +- engines/hopkins/dialogs.cpp | 42 +++++----- engines/hopkins/files.cpp | 8 +- engines/hopkins/globals.cpp | 20 ++--- engines/hopkins/globals.h | 6 +- engines/hopkins/hopkins.cpp | 84 ++++++++++--------- engines/hopkins/hopkins.h | 2 +- engines/hopkins/menu.cpp | 14 ++-- engines/hopkins/objects.cpp | 12 +-- engines/hopkins/script.cpp | 189 +++++++++++++++++++++---------------------- engines/hopkins/script.h | 2 +- engines/hopkins/sound.cpp | 24 +++--- engines/hopkins/sound.h | 4 +- engines/hopkins/talk.cpp | 18 ++--- 14 files changed, 216 insertions(+), 215 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index c3ab69c3ad..a0354e84ff 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -526,11 +526,11 @@ void ComputerManager::readText(int idx) { _vm->_eventsManager._escKeyFl = false; - if (_vm->_globals.FR == 0) + if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKAN.TXT"); - else if (_vm->_globals.FR == 1) + else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPK.TXT"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKES.TXT"); ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index a22f01470b..0e2dee7446 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -59,11 +59,11 @@ void DialogsManager::showOptionsDialog() { doneFlag = false; _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); - if (_vm->_globals.FR == 1) + if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIFR.SPR"); - else if (!_vm->_globals.FR) + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIAN.SPR"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -129,7 +129,7 @@ void DialogsManager::showOptionsDialog() { } } - if (!_vm->_soundManager.VOICEOFF) { + if (!_vm->_soundManager._voiceOffFl) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { ++_vm->_soundManager.VOICEVOL; @@ -143,7 +143,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager.VOICEOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { --_vm->_soundManager.VOICEVOL; if (_vm->_soundManager.VOICEVOL >= 0) _vm->_soundManager.PLAY_SOUND("bruit2.wav"); @@ -158,11 +158,11 @@ void DialogsManager::showOptionsDialog() { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) - _vm->_soundManager.TEXTOFF = _vm->_soundManager.TEXTOFF != 1; + _vm->_soundManager._textOffFl = !_vm->_soundManager._textOffFl; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) { - _vm->_soundManager.VOICEOFF = _vm->_soundManager.VOICEOFF != 1; + _vm->_soundManager._voiceOffFl = !_vm->_soundManager._voiceOffFl; _vm->_soundManager.updateScummVMSoundSettings(); } @@ -252,8 +252,8 @@ void DialogsManager::showOptionsDialog() { else if (_vm->_globals._speed == 3) _vm->_globals.opt_vitesse = 4; - _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; - _vm->_globals.opt_voice = !_vm->_soundManager.VOICEOFF ? 7 : 8; + _vm->_globals.opt_txt = !_vm->_soundManager._textOffFl ? 7 : 8; + _vm->_globals.opt_voice = !_vm->_soundManager._voiceOffFl ? 7 : 8; _vm->_globals.opt_sound = !_vm->_soundManager.SOUNDOFF ? 7 : 8; _vm->_globals.opt_music = !_vm->_soundManager.MUSICOFF ? 7 : 8; @@ -320,14 +320,14 @@ LABEL_7: _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTAN.SPR"); break; - case 1: + case LANG_FR: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTFR.SPR"); break; - case 2: + case LANG_SP: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTES.SPR"); break; } @@ -405,14 +405,14 @@ LABEL_7: if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; if (!v20) { - _vm->_scriptManager.TRAVAILOBJET = 1; + _vm->_scriptManager.TRAVAILOBJET = true; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals._inventory[v13]; _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = 0; + _vm->_scriptManager.TRAVAILOBJET = false; - if (_vm->_soundManager.VOICEOFF == 1) { + if (_vm->_soundManager._voiceOffFl) { do _vm->_eventsManager.VBL(); while (!_vm->_globals.SORTIE && _vm->_eventsManager.getMouseButton() != 1); @@ -629,14 +629,14 @@ void DialogsManager::showSaveLoad(int a1) { hopkinsSavegameHeader header; byte *thumb; - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEAN.SPR"); break; - case 1: + case LANG_FR: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEFR.SPR"); break; - case 2: + case LANG_SP: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEES.SPR"); break; } @@ -646,7 +646,7 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); - if (_vm->_globals.FR) { + if (_vm->_globals._language == LANG_FR) { if (a1 == 1) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 525, 375, 1); if (a1 == 2) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index c888bcbd67..6fefd1eb22 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -221,14 +221,14 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { break; case 9: - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: constructFilename(_vm->_globals.HOPLINK, "RES_VAN.CAT"); break; - case 1: + case LANG_FR: constructFilename(_vm->_globals.HOPLINK, "RES_VFR.CAT"); break; - case 2: + case LANG_SP: constructFilename(_vm->_globals.HOPLINK, "RES_VES.CAT"); break; } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index b5c2d44d4d..dc9254b6e6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -114,7 +114,7 @@ Globals::Globals() { Common::fill((byte *)&Tri[i], (byte *)&Tri[i] + sizeof(TriItem), 0); // Initialise fields - FR = 0; + _language = LANG_EN; SVGA = 2; _internetFl = true; @@ -137,7 +137,7 @@ Globals::Globals() { nbrligne = 0; largeur_boite = 0; hauteur_boite = 0; - FORET = false; + forest = false; _objectWidth = _objectHeight = 0; HELICO = 0; _catalogPos = 0; @@ -303,13 +303,13 @@ void Globals::setConfig() { switch (_vm->getLanguage()) { case Common::EN_ANY: case Common::PL_POL: - FR = 0; + _language = LANG_EN; break; case Common::FR_FRA: - FR = 1; + _language = LANG_FR; break; case Common::ES_ESP: - FR = 2; + _language = LANG_SP; break; default: warning("Unknown language in internal language mapping"); @@ -322,16 +322,16 @@ void Globals::setConfig() { _internetFl = false; // End of CHECKME - switch (FR) { - case 0: + switch (_language) { + case LANG_EN: FICH_ZONE = "ZONEAN.TXT"; FICH_TEXTE = "TEXTEAN.TXT"; break; - case 1: + case LANG_FR: FICH_ZONE = "ZONE01.TXT"; FICH_TEXTE = "TEXTE01.TXT"; break; - case 2: + case LANG_SP: FICH_ZONE = "ZONEES.TXT"; FICH_TEXTE = "TEXTEES.TXT"; break; @@ -418,7 +418,7 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; FORETSPR = g_PTRNUL; - FORET = false; + forest = false; cache_souris = allocMemory(2500); GESTE = g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e00796ea23..5daf982456 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -295,6 +295,8 @@ struct CreditItem { byte _line[50]; }; +enum Language { LANG_EN = 0, LANG_FR = 1, LANG_SP = 2}; + class HopkinsEngine; /** @@ -326,7 +328,7 @@ public: HopkinsItem Hopkins[70]; int _inventory[36]; TriItem Tri[51]; - int FR; + Language _language; int SVGA; bool _internetFl; bool PUBEXIT; @@ -384,7 +386,7 @@ public: int hauteur_boite; int GESTE_FLAG; byte *FORETSPR; - bool FORET; + bool forest; byte *COUCOU; int16 *chemin; byte *cache_souris; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ea715001ac..d13633d5b4 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -97,7 +97,7 @@ Common::Error HopkinsEngine::run() { _globals.setConfig(); _fileManager.initCensorship(); - INIT_SYSTEM(); + initializeSystem(); _soundManager.WSOUND_INIT(); @@ -219,10 +219,12 @@ bool HopkinsEngine::runWin95Demo() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -331,9 +333,9 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Perso_Y = 450; _globals.Max_Ligne_Long = 20; if (_globals.SAUVEGARDE->data[svField225]) { - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); - else if (!_globals.FR) + else _graphicsManager.loadImage("ENDUK"); _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); @@ -542,11 +544,11 @@ bool HopkinsEngine::runLinuxDemo() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); - if (_globals.FR == 2) + else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); @@ -1229,7 +1231,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = 1; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -1242,7 +1244,7 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49 ) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -2117,7 +2119,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -2131,7 +2133,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = false; if ((_globals.SORTIE < 35) || (_globals.SORTIE > 49)) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -2657,10 +2659,12 @@ bool HopkinsEngine::runWin95full() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - else if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -3003,7 +3007,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -3016,7 +3020,7 @@ bool HopkinsEngine::runWin95full() { _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -3534,11 +3538,11 @@ bool HopkinsEngine::runLinuxFull() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - else if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); - else if (_globals.FR == 2) + else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); @@ -3881,7 +3885,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -3894,7 +3898,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -4366,7 +4370,7 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } -void HopkinsEngine::INIT_SYSTEM() { +void HopkinsEngine::initializeSystem() { // Set graphics mode _graphicsManager.setGraphicalMode(SCREEN_WIDTH, SCREEN_HEIGHT); @@ -4378,20 +4382,20 @@ void HopkinsEngine::INIT_SYSTEM() { else _eventsManager._mouseLinuxFl = false; - switch (_globals.FR) { - case 0: + switch (_globals._language) { + case LANG_EN: if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUAN.SPR"); else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUAN.SPR"); break; - case 1: + case LANG_FR: if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUFR.SPR"); else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUFR.SPR"); break; - case 2: + case LANG_SP: _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUES.SPR"); break; } @@ -4416,16 +4420,16 @@ void HopkinsEngine::INIT_SYSTEM() { _fileManager.constructFilename(_globals.HOPSYSTEM, "TETE.SPR"); _globals.TETE = _fileManager.loadFile(_globals.NFICHIER); - switch (_globals.FR) { - case 0: + switch (_globals._language) { + case LANG_EN: _fileManager.constructFilename(_globals.HOPLINK, "ZONEAN.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; - case 1: + case LANG_FR: _fileManager.constructFilename(_globals.HOPLINK, "ZONE01.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; - case 2: + case LANG_SP: _fileManager.constructFilename(_globals.HOPLINK, "ZONEES.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; @@ -4693,13 +4697,13 @@ void HopkinsEngine::PASS() { if (!getIsDemo()) return; - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("ndfr"); else _graphicsManager.loadImage("nduk"); _graphicsManager.FADE_INW(); - if (_soundManager.VOICEOFF) + if (_soundManager._voiceOffFl) _eventsManager.delay(500); else _soundManager.mixVoice(628, 4); @@ -4717,7 +4721,7 @@ void HopkinsEngine::NO_DISPO(int sortie) { void HopkinsEngine::displayEndDemo() { _soundManager.WSOUND(28); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("endfr"); else _graphicsManager.loadImage("enduk"); @@ -4786,7 +4790,7 @@ void HopkinsEngine::restoreSystem() { void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); - _globals.FORET = false; + _globals.forest = false; _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _globals.FLAG_VISIBLE = false; @@ -5288,18 +5292,18 @@ void HopkinsEngine::loadCredits() { _globals.Credit_l = 10; _globals.Credit_h = 40; _globals.Credit_step = 45; - switch (_globals.FR) { - case 0: + switch (_globals._language) { + case LANG_EN: _fileManager.constructFilename(_globals.HOPLINK, "CREAN.TXT"); break; - case 1: + case LANG_FR: _fileManager.constructFilename(_globals.HOPLINK, "CREFR.TXT"); break; - case 2: + case LANG_SP: _fileManager.constructFilename(_globals.HOPLINK, "CREES.TXT"); break; default: - error("Charge_Credits(): Unhandled language"); + error("Unhandled language"); break; } @@ -5758,7 +5762,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { _graphicsManager.max_x = SCREEN_WIDTH; _graphicsManager.max_y = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; - _globals.FORET = false; + _globals.forest = false; _globals.FLAG_VISIBLE = false; _globals._disableInventFl = true; _globals.SORTIE = 0; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 7a58777241..5b62bb28ab 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -80,7 +80,7 @@ private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; - void INIT_SYSTEM(); + void initializeSystem(); void PASS(); void restoreSystem(); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b48409e6b7..c192bc80ce 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -57,7 +57,7 @@ int MenuManager::MENU() { result = 0; while (!g_system->getEventManager()->shouldQuit()) { - _vm->_globals.FORET = false; + _vm->_globals.forest = false; _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; _vm->_globals.FLAG_VISIBLE = false; @@ -75,19 +75,19 @@ int MenuManager::MENU() { frame1Index = 0; - if (_vm->_globals.FR == 0) + if (_vm->_globals._language == LANG_EN) _vm->_graphicsManager.loadImage("MENUAN"); - else if (_vm->_globals.FR == 1) + else if (_vm->_globals._language == LANG_FR) _vm->_graphicsManager.loadImage("MENUFR"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_graphicsManager.loadImage("MENUES"); _vm->_graphicsManager.FADE_INW(); - if (_vm->_globals.FR == 0) + if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUAN.SPR"); - else if (_vm->_globals.FR == 1) + else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUFR.SPR"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); spriteData = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5658371c03..e870ff72c9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2661,7 +2661,7 @@ LABEL_38: _vm->_globals.GOACTION = false; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { + if (_vm->_globals.forest && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { v10 = getSpriteX(0); v11 = getSpriteY(0); @@ -2752,7 +2752,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); - if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { + if (!_vm->_globals.forest || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) @@ -4691,17 +4691,17 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_eventsManager.VBL(); VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); _vm->_fontManager.hideText(9); - if (!_vm->_soundManager.TEXTOFF) { + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICEOFF) + if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(383, 4); _vm->_globals.SAUVEGARDE->data[svField270] = 1; _vm->_globals.SAUVEGARDE->data[svField300] = 1; _vm->_globals.SAUVEGARDE->data[svField320] = 1; - if (_vm->_soundManager.VOICEOFF == 1) { + if (_vm->_soundManager._voiceOffFl) { for (int v6 = 0; v6 <= 199; v6++) _vm->_eventsManager.VBL(); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3269ed5c93..d55cfe3ffd 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -35,7 +35,7 @@ namespace Hopkins { ScriptManager::ScriptManager() { - TRAVAILOBJET = 0; + TRAVAILOBJET = false; } void ScriptManager::setParent(HopkinsEngine *vm) { @@ -53,78 +53,76 @@ int ScriptManager::Traduction(byte *a1) { int v69 = *(a1 + 8); int v67 = (int16)READ_LE_UINT16(a1 + 9); int v65 = (int16)READ_LE_UINT16(a1 + 11); - int v3 = (int16)READ_LE_UINT16(a1 + 13); + int mesgId = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { - if (v3 == 53) - v3 = 644; - if (v3 == 624) - v3 = 639; - if (v3 == 627) - v3 = 630; - if (v3 == 625) - v3 = 639; - if (v3 == 8) - v3 = 637; - if (v3 == 53) - v3 = 644; - if (v3 == 557) - v3 = 636; - if (v3 == 51) - v3 = 644; - if (v3 == 287) - v3 = 636; - if (v3 == 619) - v3 = 633; - if (v3 == 620) - v3 = 634; - if (v3 == 622) - v3 = 644; - if (v3 == 297) - v3 = 636; - if (v3 == 612) - v3 = 636; - if ((uint16)(v3 - 613) <= 1u || v3 == 134) - v3 = 636; - if (v3 == 615) - v3 = 635; - if (v3 == 618) - v3 = 632; - if (v3 == 611) - v3 = 642; - if (v3 == 610) - v3 = 641; - if (v3 == 18) - v3 = 643; - if (v3 == 602) - v3 = 645; - if (v3 == 603) - v3 = 646; - if (v3 == 604) - v3 = 647; - if (v3 == 51) - v3 = 644; - if (v3 == 607) - v3 = 650; - if (v3 == 605) - v3 = 648; - if (v3 == 606) - v3 = 649; - if (v3 == 601) - v3 = 652; - if (v3 == 37) - v3 = 636; - if (v3 == 595) - v3 = 633; - if (v3 == 596) - v3 = 634; - if (v3 == 532) - v3 = 636; - if (v3 == 599) - v3 = 636; - if (v3 == 363) - v3 = 636; + if (mesgId == 53) + mesgId = 644; + if (mesgId == 624) + mesgId = 639; + if (mesgId == 627) + mesgId = 630; + if (mesgId == 625) + mesgId = 639; + if (mesgId == 8) + mesgId = 637; + if (mesgId == 53) + mesgId = 644; + if (mesgId == 557) + mesgId = 636; + if (mesgId == 51) + mesgId = 644; + if (mesgId == 287) + mesgId = 636; + if (mesgId == 619) + mesgId = 633; + if (mesgId == 620) + mesgId = 634; + if (mesgId == 622) + mesgId = 644; + if (mesgId == 297) + mesgId = 636; + if (mesgId == 612 || mesgId == 613 || mesgId == 614 || mesgId == 134) + mesgId = 636; + if (mesgId == 615) + mesgId = 635; + if (mesgId == 618) + mesgId = 632; + if (mesgId == 611) + mesgId = 642; + if (mesgId == 610) + mesgId = 641; + if (mesgId == 18) + mesgId = 643; + if (mesgId == 602) + mesgId = 645; + if (mesgId == 603) + mesgId = 646; + if (mesgId == 604) + mesgId = 647; + if (mesgId == 51) + mesgId = 644; + if (mesgId == 607) + mesgId = 650; + if (mesgId == 605) + mesgId = 648; + if (mesgId == 606) + mesgId = 649; + if (mesgId == 601) + mesgId = 652; + if (mesgId == 37) + mesgId = 636; + if (mesgId == 595) + mesgId = 633; + if (mesgId == 596) + mesgId = 634; + if (mesgId == 532) + mesgId = 636; + if (mesgId == 599) + mesgId = 636; + if (mesgId == 363) + mesgId = 636; } if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { do { @@ -133,42 +131,39 @@ int ScriptManager::Traduction(byte *a1) { _vm->_eventsManager.VBL(); } while (_vm->_soundManager.SOUND_FLAG); } - if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.initTextBuffers(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) { + _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.mixVoice(v3, 4); + if (!_vm->_soundManager._voiceOffFl) + _vm->_soundManager.mixVoice(mesgId, 4); } - if (TRAVAILOBJET == 1) { + if (TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); - if (!_vm->_soundManager.VOICEOFF) + if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(635, 4); - goto LABEL_104; - } - if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.initTextBuffers(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - else if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.initTextBuffers(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - else if (_vm->_globals.FR == 2) { - if (_vm->_soundManager.TEXTOFF) { -LABEL_98: - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.mixVoice(v3, 5); - goto LABEL_104; + } else { + if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl) + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + else if (_vm->_globals._language == LANG_EN && !_vm->_soundManager._textOffFl) + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + else if (_vm->_globals._language == LANG_SP && !_vm->_soundManager._textOffFl) { + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); } - _vm->_fontManager.initTextBuffers(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + + if (!_vm->_soundManager._textOffFl) + _vm->_fontManager.showText(9); + + if (!_vm->_soundManager._voiceOffFl) + _vm->_soundManager.mixVoice(mesgId, 5); } - if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.showText(9); - goto LABEL_98; } } -LABEL_104: + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { if (_vm->_objectsManager.DESACTIVE != true) { int v72 = *(a1 + 5); @@ -1924,11 +1919,11 @@ LABEL_1141: _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); - if (!_vm->_soundManager.TEXTOFF) { + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICEOFF) + if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(617, 4); for (int i = 0; i <= 29; i++) { if (_vm->shouldQuit()) diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index 27f167ae1b..d3edf98975 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -34,7 +34,7 @@ class ScriptManager { private: HopkinsEngine *_vm; public: - int TRAVAILOBJET; + bool TRAVAILOBJET; public: ScriptManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 2ed7482084..e6e17e8521 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -80,8 +80,8 @@ SoundManager::SoundManager() { OLD_VOICEVOL = 0; SOUNDOFF = true; MUSICOFF = true; - VOICEOFF = true; - TEXTOFF = false; + _voiceOffFl = true; + _textOffFl = false; SOUND_FLAG = false; VBL_MERDE = false; SOUND_NUM = 0; @@ -510,7 +510,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { size_t catPos, catLen; fileNumber = voiceId; - if (VOICEOFF == 1) + if (_voiceOffFl) return false; if ((unsigned int)(voiceMode - 1) <= 1 @@ -570,21 +570,21 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { - if (_vm->_globals.FR == 1) + if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); - else if (!_vm->_globals.FR) + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { - if (_vm->_globals.FR == 1) + if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); - else if (!_vm->_globals.FR) + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals._catalogPos; @@ -853,7 +853,7 @@ void SoundManager::syncSoundSettings() { // Update the mute settings MUSICOFF = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); SOUNDOFF = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); - VOICEOFF = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); + _voiceOffFl = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); // Update the volume levels MUSICVOL = MIN(255, ConfMan.getInt("music_volume")) * 16 / 255; @@ -875,10 +875,10 @@ void SoundManager::syncSoundSettings() { } void SoundManager::updateScummVMSoundSettings() { - ConfMan.setBool("mute", MUSICOFF && SOUNDOFF && VOICEOFF); + ConfMan.setBool("mute", MUSICOFF && SOUNDOFF && _voiceOffFl); ConfMan.setBool("music_mute", MUSICOFF); ConfMan.setBool("sfx_mute", SOUNDOFF); - ConfMan.setBool("speech_mute", VOICEOFF); + ConfMan.setBool("speech_mute", _voiceOffFl); ConfMan.setInt("music_volume", MUSICVOL * 255 / 16); ConfMan.setInt("sfx_volume", SOUNDVOL * 255 / 16); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 9e2c8cd8e7..7eb5cc600c 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -121,8 +121,8 @@ public: int OLD_VOICEVOL; bool SOUNDOFF; bool MUSICOFF; - bool VOICEOFF; - bool TEXTOFF; + bool _voiceOffFl; + bool _textOffFl; bool SOUND_FLAG; bool VBL_MERDE; int SOUND_NUM; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index b55e0814f2..2961e3eba2 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -80,11 +80,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer); RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); - if (_vm->_globals.FR == 1) { + if (_vm->_globals._language == LANG_FR) { _answersFilename = _questionsFilename = "RUE.TXT"; - } else if (!_vm->_globals.FR) { + } else if (_vm->_globals._language == LANG_EN) { _answersFilename = _questionsFilename = "RUEAN.TXT"; - } else if (_vm->_globals.FR == 2) { + } else if (_vm->_globals._language == LANG_SP) { _answersFilename = _questionsFilename = "RUEES.TXT"; } v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); @@ -193,16 +193,16 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: _questionsFilename = "RUEAN.TXT"; _answersFilename = "RUEAN.TXT"; break; - case 1: + case LANG_FR: _questionsFilename = "RUE.TXT"; _answersFilename = "RUE.TXT"; break; - case 2: + case LANG_SP: _questionsFilename = "RUEES.TXT"; _answersFilename = "RUEES.TXT"; break; @@ -452,7 +452,7 @@ int TalkManager::DIALOGUE_REP(int idx) { VISU_PARLE(); } - if (!_vm->_soundManager.TEXTOFF) { + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 20, 25, 5, v23, 252); _vm->_fontManager.showText(9); } @@ -485,7 +485,7 @@ int TalkManager::DIALOGUE_REP(int idx) { } } - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.hideText(9); if (STATI) { v15 = _characterBuffer; -- cgit v1.2.3 From 4ab60c43c0834d568b7c21ed9b45a2beab9e5815 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 13:32:39 +0100 Subject: HOPKINS: Refactor handleGoto and handleIf, some renaming --- engines/hopkins/computer.cpp | 6 +- engines/hopkins/dialogs.cpp | 29 +- engines/hopkins/globals.cpp | 14 +- engines/hopkins/globals.h | 6 +- engines/hopkins/graphics.cpp | 4 +- engines/hopkins/hopkins.cpp | 626 +++++++++++++++++++++---------------------- engines/hopkins/menu.cpp | 12 +- engines/hopkins/objects.cpp | 282 +++++++++---------- engines/hopkins/saveload.cpp | 24 +- engines/hopkins/script.cpp | 378 ++++++++++++-------------- engines/hopkins/script.h | 4 +- engines/hopkins/talk.cpp | 30 +-- 12 files changed, 687 insertions(+), 728 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index a0354e84ff..cc0f407ff2 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -280,7 +280,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { readText(9); if (v12 == 54) { readText(10); - _vm->_globals.SAUVEGARDE->data[svField270] = 4; + _vm->_globals._saveData->data[svField270] = 4; } } } @@ -306,9 +306,9 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_eventsManager.mouseOff(); } if (mode == 1) - _vm->_globals.SORTIE = 13; + _vm->_globals._exitId = 13; if ((uint16)(mode - 2) <= 1u) - _vm->_globals.SORTIE = 14; + _vm->_globals._exitId = 14; _vm->_graphicsManager.RESET_SEGMENT_VESA(); } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0e2dee7446..7480d34523 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -189,7 +189,7 @@ void DialogsManager::showOptionsDialog() { } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { - _vm->_globals.SORTIE = 300; + _vm->_globals._exitId = 300; doneFlag = true; } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) @@ -406,22 +406,22 @@ LABEL_7: v20 = true; if (!v20) { _vm->_scriptManager.TRAVAILOBJET = true; - _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; - _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals._inventory[v13]; - _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager._mouseCursorId; + _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[v13]; + _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); _vm->_scriptManager.TRAVAILOBJET = false; if (_vm->_soundManager._voiceOffFl) { do _vm->_eventsManager.VBL(); - while (!_vm->_globals.SORTIE && _vm->_eventsManager.getMouseButton() != 1); + while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); _vm->_fontManager.hideText(9); } - if (_vm->_globals.SORTIE) { - if (_vm->_globals.SORTIE == 2) + if (_vm->_globals._exitId) { + if (_vm->_globals._exitId == 2) v20 = true; - _vm->_globals.SORTIE = 0; + _vm->_globals._exitId = 0; if (!v20) { _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); @@ -437,13 +437,12 @@ LABEL_7: if (v20) break; _vm->_eventsManager.VBL(); - if ((uint16)(_vm->_globals.ECRAN - 35) <= 5u) + if ((uint16)(_vm->_globals._screenId - 35) <= 5u) _vm->_objectsManager.SPECIAL_JEU(); } _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { _inventDisplayedFl = false; -// v9 = 114; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, v19, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, v19, 114); _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; @@ -494,20 +493,20 @@ void DialogsManager::inventAnim() { _vm->_objectsManager.I_old_x = v0; } - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField353] == 1) + if (_vm->_globals._saveData->data[svField357] == 1) { + if (_vm->_globals._saveData->data[svField353] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - if (_vm->_globals.SAUVEGARDE->data[svField355] == 1) + if (_vm->_globals._saveData->data[svField355] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { + if (_vm->_globals._saveData->data[svField356] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } - if (_vm->_globals.SAUVEGARDE->data[svField354] == 1) { + if (_vm->_globals._saveData->data[svField354] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index dc9254b6e6..a52c1badf8 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -144,12 +144,12 @@ Globals::Globals() { _catalogSize = 0; _newObjectFl = false; iRegul = 0; - SORTIE = 0; + _exitId = 0; PLANX = PLANY = 0; PLANI = 0; PERSO = 0; PASSWORD = false; - ECRAN = 0; + _screenId = 0; NOSPRECRAN = false; OLD_ECRAN = 0; Max_Propre_Gen = 0; @@ -199,7 +199,7 @@ Globals::Globals() { CACHE_BANQUE[6] = NULL; texte_tmp = NULL; SPRITE_ECRAN = NULL; - SAUVEGARDE = NULL; + _saveData = NULL; BUFFERTAPE = NULL; essai0 = NULL; essai1 = NULL; @@ -262,7 +262,7 @@ Globals::~Globals() { freeMemory(CACHE_BANQUE[6]); freeMemory(texte_tmp); freeMemory(SPRITE_ECRAN); - freeMemory((byte *)SAUVEGARDE); + freeMemory((byte *)_saveData); freeMemory(BUFFERTAPE); freeMemory(inventaire2); freeMemory(GESTE); @@ -367,7 +367,7 @@ void Globals::clearAll() { _vm->_dialogsManager._inventBuf2 = g_PTRNUL; COUCOU = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; - SAUVEGARDE = (Sauvegarde *)g_PTRNUL; + _saveData = (Sauvegarde *)g_PTRNUL; _curObjectIndex = 0; for (int idx = 0; idx < 105; ++idx) { @@ -403,8 +403,8 @@ void Globals::clearAll() { texte_tmp = g_PTRNUL; BUFFERTAPE = allocMemory(85000); - SAUVEGARDE = (Sauvegarde *)malloc(sizeof(Sauvegarde)); - memset(SAUVEGARDE, 0, sizeof(Sauvegarde)); + _saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde)); + memset(_saveData, 0, sizeof(Sauvegarde)); essai0 = (int16 *)BUFFERTAPE; essai1 = (int16 *)(BUFFERTAPE + 25000); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5daf982456..c80d523b4a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -371,7 +371,7 @@ public: int texte_long; int TEXTE_FORMATE; byte *SPRITE_ECRAN; - Sauvegarde *SAUVEGARDE; + Sauvegarde *_saveData; byte *BUFFERTAPE; int16 *essai0; int16 *essai1; @@ -401,12 +401,12 @@ public: uint32 _catalogSize; int iRegul; bool BPP_NOAFF; - int SORTIE; + int _exitId; int PLANX, PLANY; int PLANI; bool PASSWORD; // CHECKME: Useless variable? bool NOSPRECRAN; - int ECRAN; + int _screenId; int OLD_ECRAN; int fmusic; int Max_Propre; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index d4ad9cc30b..cb4abd9d9d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1971,9 +1971,9 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { return; if (dataVal1 == 2) - dataOffset = _vm->_scriptManager.Control_Goto((ptr + 20 * dataOffset)); + dataOffset = _vm->_scriptManager.handleGoto((ptr + 20 * dataOffset)); if (dataVal1 == 3) - dataOffset = _vm->_scriptManager.Control_If(ptr, dataOffset); + dataOffset = _vm->_scriptManager.handleIf(ptr, dataOffset); if (dataOffset == -1) error("Error, defective IFF"); if (dataVal1 == 1 || dataVal1 == 4) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d13633d5b4..10a18c7f97 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -68,14 +68,14 @@ Common::String HopkinsEngine::generateSaveName(int slot) { * Returns true if it is currently okay to restore a game */ bool HopkinsEngine::canLoadGameStateCurrently() { - return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager._mouseFl; + return !_globals._exitId && !_globals.PLAN_FLAG && _eventsManager._mouseFl; } /** * Returns true if it is currently okay to save the game */ bool HopkinsEngine::canSaveGameStateCurrently() { - return !_globals.SORTIE && !_globals.PLAN_FLAG && _eventsManager._mouseFl; + return !_globals._exitId && !_globals.PLAN_FLAG && _eventsManager._mouseFl; } /** @@ -183,8 +183,8 @@ bool HopkinsEngine::runWin95Demo() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 2000); - _globals.SORTIE = 0; + memset(_globals._saveData, 0, 2000); + _globals._exitId = 0; _globals.PASSWORD = true; if (getLanguage() != Common::PL_POL) @@ -192,12 +192,12 @@ bool HopkinsEngine::runWin95Demo() { return Common::kNoError; for (;;) { - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; + if (_globals._exitId == 300) + _globals._exitId = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { + if (!_globals._exitId) { + _globals._exitId = _menuManager.MENU(); + if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); return false; @@ -207,7 +207,7 @@ bool HopkinsEngine::runWin95Demo() { if (g_system->getEventManager()->shouldQuit()) return false; - switch (_globals.SORTIE) { + switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; @@ -217,7 +217,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 3: - if (!_globals.SAUVEGARDE->data[svField170]) { + if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); @@ -244,7 +244,7 @@ bool HopkinsEngine::runWin95Demo() { _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[svField170] = 1; + _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -267,8 +267,8 @@ bool HopkinsEngine::runWin95Demo() { _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) + if (_globals._saveData->data[svField80]) { + if (_globals._saveData->data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); @@ -286,7 +286,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 7: - if (_globals.SAUVEGARDE->data[svField220]) + if (_globals._saveData->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -305,7 +305,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; _globals.Max_Ligne_Long = 20; - if (_globals.SAUVEGARDE->data[svField225]) + if (_globals._saveData->data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else bombExplosion(); @@ -332,7 +332,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre = 15; _globals.Max_Perso_Y = 450; _globals.Max_Ligne_Long = 20; - if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals._saveData->data[svField225]) { if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); else @@ -386,31 +386,31 @@ bool HopkinsEngine::runWin95Demo() { break; case 113: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 113; + _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.setModeVesa(); break; case 114: - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 114; + _globals._saveData->data[svField5] = _globals._screenId; + _globals._exitId = 0; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 115; + _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.setModeVesa(); break; @@ -424,7 +424,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 151: @@ -438,7 +438,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.FADE_INW(); _eventsManager.delay(5000); _graphicsManager.FADE_OUTW(); - _globals.SORTIE = 300; + _globals._exitId = 300; _globals.iRegul = 0; break; @@ -451,7 +451,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; } } @@ -493,17 +493,17 @@ bool HopkinsEngine::runLinuxDemo() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 2000); - _globals.SORTIE = 0; + memset(_globals._saveData, 0, 2000); + _globals._exitId = 0; _globals.PASSWORD = true; for (;;) { - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; + if (_globals._exitId == 300) + _globals._exitId = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { + if (!_globals._exitId) { + _globals._exitId = _menuManager.MENU(); + if (_globals._exitId == -1) { if (!g_system->getEventManager()->shouldQuit()) PUBQUIT(); _globals.PERSO = _globals.freeMemory(_globals.PERSO); @@ -514,7 +514,7 @@ bool HopkinsEngine::runLinuxDemo() { if (g_system->getEventManager()->shouldQuit()) return false; - switch (_globals.SORTIE) { + switch (_globals._exitId) { case 17: case 18: case 19: @@ -542,7 +542,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 3: - if (!_globals.SAUVEGARDE->data[svField170]) { + if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); @@ -571,7 +571,7 @@ bool HopkinsEngine::runLinuxDemo() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _globals.SAUVEGARDE->data[svField170] = 1; + _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; @@ -594,8 +594,8 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) + if (_globals._saveData->data[svField80]) { + if (_globals._saveData->data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); @@ -613,7 +613,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 7: - if (_globals.SAUVEGARDE->data[svField220]) + if (_globals._saveData->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -633,7 +633,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!_globals.SAUVEGARDE->data[svField225]) + if (!_globals._saveData->data[svField225]) bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); @@ -660,7 +660,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { @@ -696,9 +696,9 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField113] == 1) { + if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { + } else if (!_globals._saveData->data[svField113]) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } break; @@ -741,11 +741,11 @@ bool HopkinsEngine::runLinuxDemo() { break; case 113: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = 113; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 113; + _globals._saveData->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.lockScreen(); @@ -759,11 +759,11 @@ bool HopkinsEngine::runLinuxDemo() { break; case 114: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = 114; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 114; + _globals._saveData->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -771,11 +771,11 @@ bool HopkinsEngine::runLinuxDemo() { break; case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = 115; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 115; + _globals._saveData->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -793,7 +793,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 151: @@ -807,7 +807,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 152: @@ -821,7 +821,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; } } @@ -857,21 +857,21 @@ bool HopkinsEngine::runOS2Full() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 1996); - _globals.SORTIE = 0; + memset(_globals._saveData, 0, 1996); + _globals._exitId = 0; for (;;) { - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) + if (_globals._exitId == 300) + _globals._exitId = 0; + if (!_globals._exitId) { + _globals._exitId = _menuManager.MENU(); + if (_globals._exitId == -1) break; } if (g_system->getEventManager()->shouldQuit()) break; - switch (_globals.SORTIE) { + switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; @@ -881,7 +881,7 @@ bool HopkinsEngine::runOS2Full() { break; case 3: - if (!_globals.SAUVEGARDE->data[170]) { + if (!_globals._saveData->data[170]) { _soundManager.WSOUND(3); _graphicsManager.loadImage("fond"); _graphicsManager.FADE_INW(); @@ -903,7 +903,7 @@ bool HopkinsEngine::runOS2Full() { _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[170] = 1; + _globals._saveData->data[170] = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -925,8 +925,8 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[80]) { - if (_globals.SAUVEGARDE->data[80] == 1) + if (_globals._saveData->data[80]) { + if (_globals._saveData->data[80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else @@ -943,7 +943,7 @@ bool HopkinsEngine::runOS2Full() { break; case 7: - if (_globals.SAUVEGARDE->data[220]) + if (_globals._saveData->data[220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -962,7 +962,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[225]) + if (_globals._saveData->data[225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else bombExplosion(); @@ -989,7 +989,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[225]) { + if (_globals._saveData->data[225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else @@ -1023,10 +1023,10 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[113] == 1) + if (_globals._saveData->data[113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7); else { - if (!_globals.SAUVEGARDE->data[113]) + if (!_globals._saveData->data[113]) _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } break; @@ -1036,13 +1036,13 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[117] == 1) + if (_globals._saveData->data[117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); else { - if (!_globals.SAUVEGARDE->data[117]) + if (!_globals._saveData->data[117]) _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); } - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; // Added lock and unlock to avoid crash @@ -1076,7 +1076,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[123]) + if (_globals._saveData->data[123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); @@ -1088,7 +1088,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); - if (_globals.SORTIE == 17) { + if (_globals._exitId == 17) { _globals.iRegul = 1; // _soundManager.WSOUND_OFF(); @@ -1129,8 +1129,8 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[181]) { - if (_globals.SAUVEGARDE->data[181] == 1 ) + if (_globals._saveData->data[181]) { + if (_globals._saveData->data[181] == 1 ) _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); } else _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); @@ -1157,10 +1157,10 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[177] == 1) + if (_globals._saveData->data[177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); else { - if (!_globals.SAUVEGARDE->data[177]) + if (!_globals._saveData->data[177]) _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); } break; @@ -1171,7 +1171,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[166] != 1 || _globals.SAUVEGARDE->data[167] != 1 ) + if (_globals._saveData->data[166] != 1 || _globals._saveData->data[167] != 1 ) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); else _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); @@ -1233,7 +1233,7 @@ bool HopkinsEngine::runOS2Full() { _globals._disableInventFl = false; _globals.forest = true; _globals.NOSPRECRAN = true; - Common::String im = Common::String::format("IM%d", _globals.SORTIE); + Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); @@ -1242,7 +1242,7 @@ bool HopkinsEngine::runOS2Full() { } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; - if (_globals.SORTIE < 35 || _globals.SORTIE > 49 ) { + if (_globals._exitId < 35 || _globals._exitId > 49 ) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.forest = false; _soundManager.DEL_SAMPLE(1); @@ -1252,7 +1252,7 @@ bool HopkinsEngine::runOS2Full() { case 50: displayPlane(); - _globals.SORTIE = 51; + _globals._exitId = 51; break; case 51: @@ -1335,7 +1335,7 @@ bool HopkinsEngine::runOS2Full() { break; case 61: - if (_globals.SAUVEGARDE->data[311] == 1 && !_globals.SAUVEGARDE->data[312] ) + if (_globals._saveData->data[311] == 1 && !_globals._saveData->data[312] ) INCENDIE(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); @@ -1442,10 +1442,10 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[318] == 1) + if (_globals._saveData->data[318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); else { - if (!_globals.SAUVEGARDE->data[318]) + if (!_globals._saveData->data[318]) _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); } break; @@ -1519,7 +1519,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[330]) + if (_globals._saveData->data[330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26); else _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); @@ -1558,7 +1558,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; // _soundManager.WSOUND_OFF(); @@ -1611,31 +1611,31 @@ bool HopkinsEngine::runOS2Full() { break; case 113: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[5] = 113; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[6] = _globals._screenId; + _globals._screenId = 113; + _globals._saveData->data[5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.setModeVesa(); break; case 114: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[5] = 114; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[6] = _globals._screenId; + _globals._screenId = 114; + _globals._saveData->data[5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[5] = 115; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[6] = _globals._screenId; + _globals._screenId = 115; + _globals._saveData->data[5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.setModeVesa(); break; @@ -1652,7 +1652,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 151: @@ -1667,7 +1667,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 152: @@ -1682,7 +1682,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 194: @@ -1695,7 +1695,7 @@ bool HopkinsEngine::runOS2Full() { _globals.iRegul = 1; // _soundManager.WSOUND_OFF(); _soundManager.WSOUND(23); - _globals.SORTIE = handleBaseMap(); + _globals._exitId = handleBaseMap(); // _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -1742,16 +1742,16 @@ bool HopkinsEngine::runBeOSFull() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 1996); - _globals.SORTIE = 0; + memset(_globals._saveData, 0, 1996); + _globals._exitId = 0; for (;;) { - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { + if (_globals._exitId == 300) + _globals._exitId = 0; + if (!_globals._exitId) { + _globals._exitId = _menuManager.MENU(); + if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); } @@ -1760,7 +1760,7 @@ bool HopkinsEngine::runBeOSFull() { if (g_system->getEventManager()->shouldQuit()) return false; - switch (_globals.SORTIE) { + switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; @@ -1770,7 +1770,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 3: - if (!_globals.SAUVEGARDE->data[svField170]) { + if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); _graphicsManager.loadImage("FOND"); _graphicsManager.FADE_INW(); @@ -1792,7 +1792,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[svField170] = 1; + _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -1814,8 +1814,8 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) + if (_globals._saveData->data[svField80]) { + if (_globals._saveData->data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); @@ -1832,7 +1832,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 7: - if (_globals.SAUVEGARDE->data[svField220]) + if (_globals._saveData->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -1851,7 +1851,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!_globals.SAUVEGARDE->data[svField225]) + if (!_globals._saveData->data[svField225]) bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); break; @@ -1877,7 +1877,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { @@ -1912,9 +1912,9 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField113] == 1) { + if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { + } else if (!_globals._saveData->data[svField113]) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } break; @@ -1924,12 +1924,12 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField117] == 1) { + if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!_globals.SAUVEGARDE->data[svField117]) { + } else if (!_globals._saveData->data[svField117]) { _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); } - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; // Added lock and unlock to avoid crash @@ -1964,7 +1964,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField123]) + if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); @@ -1976,7 +1976,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); - if (_globals.SORTIE == 17) { + if (_globals._exitId == 17) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -2017,8 +2017,8 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField181]) { - if (_globals.SAUVEGARDE->data[svField181] == 1) + if (_globals._saveData->data[svField181]) { + if (_globals._saveData->data[svField181] == 1) _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1); } else { _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); @@ -2046,9 +2046,9 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField177] == 1) { + if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!_globals.SAUVEGARDE->data[svField177]) { + } else if (!_globals._saveData->data[svField177]) { _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); } break; @@ -2059,7 +2059,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); else _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1); @@ -2121,7 +2121,7 @@ bool HopkinsEngine::runBeOSFull() { _globals._disableInventFl = false; _globals.forest = true; _globals.NOSPRECRAN = true; - Common::String im = Common::String::format("IM%d", _globals.SORTIE); + Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); @@ -2131,7 +2131,7 @@ bool HopkinsEngine::runBeOSFull() { _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; - if ((_globals.SORTIE < 35) || (_globals.SORTIE > 49)) { + if ((_globals._exitId < 35) || (_globals._exitId > 49)) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.forest = false; _soundManager.DEL_SAMPLE(1); @@ -2141,7 +2141,7 @@ bool HopkinsEngine::runBeOSFull() { case 50: displayPlane(); - _globals.SORTIE = 51; + _globals._exitId = 51; break; case 51: @@ -2224,7 +2224,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 61: - if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) INCENDIE(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); @@ -2331,9 +2331,9 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField318] == 1) { + if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!_globals.SAUVEGARDE->data[svField318]) { + } else if (!_globals._saveData->data[svField318]) { _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); } break; @@ -2407,7 +2407,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField330]) + if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); else _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); @@ -2446,7 +2446,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -2500,31 +2500,31 @@ bool HopkinsEngine::runBeOSFull() { break; case 113: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = 113; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 113; + _globals._saveData->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.setModeVesa(); break; case 114: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = 114; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 114; + _globals._saveData->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = 115; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 115; + _globals._saveData->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.setModeVesa(); break; @@ -2541,7 +2541,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 151: @@ -2556,7 +2556,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 152: @@ -2571,7 +2571,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 194: @@ -2584,7 +2584,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); _soundManager.WSOUND(23); - _globals.SORTIE = handleBaseMap(); + _globals._exitId = handleBaseMap(); _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -2628,16 +2628,16 @@ bool HopkinsEngine::runWin95full() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 2000); - _globals.SORTIE = 0; + memset(_globals._saveData, 0, 2000); + _globals._exitId = 0; _globals.PASSWORD = true; for (;;) { - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; + if (_globals._exitId == 300) + _globals._exitId = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { + if (!_globals._exitId) { + _globals._exitId = _menuManager.MENU(); + if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); return false; @@ -2647,7 +2647,7 @@ bool HopkinsEngine::runWin95full() { if (g_system->getEventManager()->shouldQuit()) return false; - switch (_globals.SORTIE) { + switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; @@ -2657,7 +2657,7 @@ bool HopkinsEngine::runWin95full() { break; case 3: - if (!_globals.SAUVEGARDE->data[svField170]) { + if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); @@ -2684,7 +2684,7 @@ bool HopkinsEngine::runWin95full() { _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); _graphicsManager.FADE_OUTW(); - _globals.SAUVEGARDE->data[svField170] = 1; + _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -2706,8 +2706,8 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre_Gen = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) + if (_globals._saveData->data[svField80]) { + if (_globals._saveData->data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); @@ -2725,7 +2725,7 @@ bool HopkinsEngine::runWin95full() { break; case 7: - if (_globals.SAUVEGARDE->data[svField220]) + if (_globals._saveData->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -2744,7 +2744,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField225]) + if (_globals._saveData->data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else bombExplosion(); @@ -2771,7 +2771,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 20; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; - if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { @@ -2806,9 +2806,9 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; - if (_globals.SAUVEGARDE->data[svField113] == 1) { + if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { + } else if (!_globals._saveData->data[svField113]) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } break; @@ -2818,12 +2818,12 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.Max_Ligne_Long = 40; - if (_globals.SAUVEGARDE->data[svField117] == 1) { + if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!_globals.SAUVEGARDE->data[svField117]) { + } else if (!_globals._saveData->data[svField117]) { _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); } - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -2854,7 +2854,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre_Gen = 20; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - if (_globals.SAUVEGARDE->data[svField123]) + if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); @@ -2866,7 +2866,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); - if (_globals.SORTIE == 17) { + if (_globals._exitId == 17) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); _graphicsManager.lockScreen(); @@ -2904,8 +2904,8 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField181]) { - if (_globals.SAUVEGARDE->data[svField181] == 1) + if (_globals._saveData->data[svField181]) { + if (_globals._saveData->data[svField181] == 1) _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); } else { _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); @@ -2933,9 +2933,9 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre_Gen = 20; _globals.Max_Ligne_Long = 15; _globals.Max_Propre = 10; - if (_globals.SAUVEGARDE->data[svField177] == 1) { + if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!_globals.SAUVEGARDE->data[svField177]) { + } else if (!_globals._saveData->data[svField177]) { _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); } break; @@ -2946,7 +2946,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); else _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); @@ -3009,7 +3009,7 @@ bool HopkinsEngine::runWin95full() { _globals._disableInventFl = false; _globals.forest = true; _globals.NOSPRECRAN = true; - Common::String im = Common::String::format("IM%d", _globals.SORTIE); + Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); @@ -3018,7 +3018,7 @@ bool HopkinsEngine::runWin95full() { } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; - if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { + if (_globals._exitId < 35 || _globals._exitId > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.forest = false; _soundManager.DEL_SAMPLE(1); @@ -3027,7 +3027,7 @@ bool HopkinsEngine::runWin95full() { } case 50: displayPlane(); - _globals.SORTIE = 51; + _globals._exitId = 51; break; case 51: @@ -3110,7 +3110,7 @@ bool HopkinsEngine::runWin95full() { break; case 61: - if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) INCENDIE(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); @@ -3217,9 +3217,9 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField318] == 1) { + if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!_globals.SAUVEGARDE->data[svField318]) { + } else if (!_globals._saveData->data[svField318]) { _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); } break; @@ -3293,7 +3293,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField330]) + if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); else _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); @@ -3332,7 +3332,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); _graphicsManager.lockScreen(); @@ -3382,31 +3382,31 @@ bool HopkinsEngine::runWin95full() { break; case 113: - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._screenId = 113; + _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField5] = _globals._screenId; + _globals._exitId = 0; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.setModeVesa(); break; case 114: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._screenId = 114; + _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; case 115: - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField6] = _globals.OLD_ECRAN; - _globals.SAUVEGARDE->data[svField5] = _globals.ECRAN; - _globals.SORTIE = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._screenId = 115; + _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField5] = _globals._screenId; + _globals._exitId = 0; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.setModeVesa(); break; @@ -3420,7 +3420,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 151: @@ -3432,7 +3432,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 152: @@ -3444,7 +3444,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.clearPalette(); _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 194: @@ -3458,7 +3458,7 @@ bool HopkinsEngine::runWin95full() { _soundManager.WSOUND_OFF(); warning("TODO: heapshrink();"); _soundManager.WSOUND(23); - _globals.SORTIE = WBASE(); + _globals._exitId = WBASE(); _soundManager.WSOUND_OFF(); warning("TODO: heapshrink();"); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); @@ -3467,7 +3467,7 @@ bool HopkinsEngine::runWin95full() { _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; _graphicsManager.setModeVesa(); - if (_globals.SORTIE == -1) + if (_globals._exitId == -1) error("FIN BASE SOUS MARINE"); break; } @@ -3507,16 +3507,16 @@ bool HopkinsEngine::runLinuxFull() { _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; - memset(_globals.SAUVEGARDE, 0, 2000); - _globals.SORTIE = 0; + memset(_globals._saveData, 0, 2000); + _globals._exitId = 0; _globals.PASSWORD = false; for (;;) { - if (_globals.SORTIE == 300) - _globals.SORTIE = 0; - if (!_globals.SORTIE) { - _globals.SORTIE = _menuManager.MENU(); - if (_globals.SORTIE == -1) { + if (_globals._exitId == 300) + _globals._exitId = 0; + if (!_globals._exitId) { + _globals._exitId = _menuManager.MENU(); + if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); return true; @@ -3526,7 +3526,7 @@ bool HopkinsEngine::runLinuxFull() { if (g_system->getEventManager()->shouldQuit()) return false; - switch (_globals.SORTIE) { + switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; @@ -3536,7 +3536,7 @@ bool HopkinsEngine::runLinuxFull() { break; case 3: - if (!_globals.SAUVEGARDE->data[svField170]) { + if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); @@ -3563,7 +3563,7 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _globals.SAUVEGARDE->data[svField170] = 1; + _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; @@ -3586,8 +3586,8 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField80]) { - if (_globals.SAUVEGARDE->data[svField80] == 1) + if (_globals._saveData->data[svField80]) { + if (_globals._saveData->data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); @@ -3604,7 +3604,7 @@ bool HopkinsEngine::runLinuxFull() { break; case 7: - if (_globals.SAUVEGARDE->data[svField220]) + if (_globals._saveData->data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); @@ -3623,7 +3623,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; - if (!_globals.SAUVEGARDE->data[svField225]) + if (!_globals._saveData->data[svField225]) bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); break; @@ -3649,7 +3649,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 20; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField225]) { + if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); } else { @@ -3684,9 +3684,9 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField113] == 1) { + if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals.SAUVEGARDE->data[svField113]) { + } else if (!_globals._saveData->data[svField113]) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); } break; @@ -3696,12 +3696,12 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField117] == 1) { + if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!_globals.SAUVEGARDE->data[svField117]) { + } else if (!_globals._saveData->data[svField117]) { _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); } - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3732,7 +3732,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 40; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField123]) + if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); @@ -3744,7 +3744,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); - if (_globals.SORTIE == 17) { + if (_globals._exitId == 17) { _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3782,8 +3782,8 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; - if (_globals.SAUVEGARDE->data[svField181]) { - if (_globals.SAUVEGARDE->data[svField181] == 1) + if (_globals._saveData->data[svField181]) { + if (_globals._saveData->data[svField181] == 1) _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); } else { _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); @@ -3811,9 +3811,9 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; - if (_globals.SAUVEGARDE->data[svField177] == 1) { + if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!_globals.SAUVEGARDE->data[svField177]) { + } else if (!_globals._saveData->data[svField177]) { _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); } break; @@ -3824,7 +3824,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - if (_globals.SAUVEGARDE->data[svField166] != 1 || _globals.SAUVEGARDE->data[svField167] != 1) + if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); else _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); @@ -3887,7 +3887,7 @@ bool HopkinsEngine::runLinuxFull() { _globals._disableInventFl = false; _globals.forest = true; _globals.NOSPRECRAN = true; - Common::String im = Common::String::format("IM%d", _globals.SORTIE); + Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals.FORETSPR == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); @@ -3896,7 +3896,7 @@ bool HopkinsEngine::runLinuxFull() { } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; - if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { + if (_globals._exitId < 35 || _globals._exitId > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); _globals.forest = false; _soundManager.DEL_SAMPLE(1); @@ -3906,7 +3906,7 @@ bool HopkinsEngine::runLinuxFull() { case 50: displayPlane(); - _globals.SORTIE = 51; + _globals._exitId = 51; break; case 51: @@ -3989,7 +3989,7 @@ bool HopkinsEngine::runLinuxFull() { break; case 61: - if (_globals.SAUVEGARDE->data[svField311] == 1 && !_globals.SAUVEGARDE->data[svField312]) + if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) INCENDIE(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); @@ -4096,9 +4096,9 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 15; _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField318] == 1) { + if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!_globals.SAUVEGARDE->data[svField318]) { + } else if (!_globals._saveData->data[svField318]) { _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); } break; @@ -4172,7 +4172,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Ligne_Long = 5; _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; - if (_globals.SAUVEGARDE->data[svField330]) + if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); else _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); @@ -4211,7 +4211,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); - if (_globals.SORTIE == 18) { + if (_globals._exitId == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); _graphicsManager.lockScreen(); @@ -4261,11 +4261,11 @@ bool HopkinsEngine::runLinuxFull() { break; case 113: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 113; - _globals.SAUVEGARDE->data[svField5] = 113; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 113; + _globals._saveData->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -4278,11 +4278,11 @@ bool HopkinsEngine::runLinuxFull() { break; case 114: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 114; - _globals.SAUVEGARDE->data[svField5] = 114; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 114; + _globals._saveData->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -4290,11 +4290,11 @@ bool HopkinsEngine::runLinuxFull() { break; case 115: - _globals.SORTIE = 0; - _globals.OLD_ECRAN = _globals.ECRAN; - _globals.SAUVEGARDE->data[svField6] = _globals.ECRAN; - _globals.ECRAN = 115; - _globals.SAUVEGARDE->data[svField5] = 115; + _globals._exitId = 0; + _globals.OLD_ECRAN = _globals._screenId; + _globals._saveData->data[svField6] = _globals._screenId; + _globals._screenId = 115; + _globals._saveData->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -4311,7 +4311,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 151: @@ -4324,7 +4324,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 152: @@ -4337,7 +4337,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; break; case 194: @@ -4349,7 +4349,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; _soundManager.WSOUND(23); - _globals.SORTIE = handleBaseMap(); + _globals._exitId = handleBaseMap(); _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -4709,14 +4709,14 @@ void HopkinsEngine::PASS() { _soundManager.mixVoice(628, 4); _graphicsManager.FADE_OUTW(); - _globals.SORTIE = 4; + _globals._exitId = 4; } void HopkinsEngine::NO_DISPO(int sortie) { // Use the code of the linux demo instead of the code of the Windows demo. // The behavior is somewhat better, and common code is easier to maintain. PASS(); - _globals.SORTIE = sortie; + _globals._exitId = sortie; } void HopkinsEngine::displayEndDemo() { @@ -4729,7 +4729,7 @@ void HopkinsEngine::displayEndDemo() { _graphicsManager.FADE_INW(); _eventsManager.delay(1500); _graphicsManager.FADE_OUTW(); - _globals.SORTIE = 0; + _globals._exitId = 0; } void HopkinsEngine::bombExplosion() { @@ -4779,7 +4779,7 @@ void HopkinsEngine::bombExplosion() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); _globals.iRegul = 0; - _globals.SORTIE = 151; + _globals._exitId = 151; } void HopkinsEngine::restoreSystem() { @@ -4853,7 +4853,7 @@ void HopkinsEngine::INCENDIE() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - _globals.SAUVEGARDE->data[svField312] = 1; + _globals._saveData->data[svField312] = 1; _globals._disableInventFl = false; } @@ -4923,7 +4923,7 @@ void HopkinsEngine::BASE() { _eventsManager._escKeyFl = false; _animationManager._clearAnimationFl = false; - _globals.SORTIE = 85; + _globals._exitId = 85; } void HopkinsEngine::BASED() { @@ -4960,7 +4960,7 @@ void HopkinsEngine::BASED() { _graphicsManager.FIN_VISU(); _globals.RESET_CACHE(); _globals._disableInventFl = false; - _globals.SORTIE = 93; + _globals._exitId = 93; _globals.iRegul = 0; } @@ -4974,7 +4974,7 @@ void HopkinsEngine::playEnding() { _soundManager.WSOUND(26); _globals.chemin = (int16 *)g_PTRNUL; _globals.NOMARCHE = true; - _globals.SORTIE = 0; + _globals._exitId = 0; _globals.AFFLI = false; _globals.AFFIVBL = false; _soundManager.loadSample(1, "SOUND90.WAV"); @@ -5045,7 +5045,7 @@ void HopkinsEngine::playEnding() { while (_objectsManager.BOBPOSI(7) != 120); _objectsManager.stopBobAnimation(7); - if (_globals.SAUVEGARDE->data[svField135] == 1) { + if (_globals._saveData->data[svField135] == 1) { _soundManager.SPECIAL_SOUND = 200; _soundManager.VBL_MERDE = true; _graphicsManager.FADE_LINUX = 2; @@ -5079,7 +5079,7 @@ void HopkinsEngine::playEnding() { _animationManager.playAnim("FF2a.anm", 24, 24, 100); displayCredits(); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; _dialogsManager._removeInventFl = false; _globals._disableInventFl = false; } else { @@ -5112,7 +5112,7 @@ void HopkinsEngine::playEnding() { _globals._disableInventFl = false; _animationManager.playAnim("JOUR4A.anm", 12, 12, 1000); _globals.iRegul = 0; - _globals.SORTIE = 300; + _globals._exitId = 300; } _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); @@ -5468,7 +5468,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals.OCEAN_SENS == 5) _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 7; - _globals.SORTIE = 1; + _globals._exitId = 1; int oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) @@ -5500,7 +5500,7 @@ LABEL_22: else if (_globals.OCEAN_SENS == 5) _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 3; - _globals.SORTIE = 2; + _globals._exitId = 2; int oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) @@ -5578,7 +5578,7 @@ LABEL_72: if (_globals.OCEAN_SENS == 5) _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 1; - _globals.SORTIE = 3; + _globals._exitId = 3; } if (_objectsManager.NUMZONE == 4) { if (_globals.OCEAN_SENS == 3) { @@ -5634,7 +5634,7 @@ LABEL_91: if (_globals.OCEAN_SENS == 1) _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, 0); _globals.OCEAN_SENS = 5; - _globals.SORTIE = 4; + _globals._exitId = 4; } } } @@ -5655,7 +5655,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _globals.PLAN_FLAG = false; _graphicsManager.NOFADE = false; _globals.NOMARCHE = false; - _globals.SORTIE = 0; + _globals._exitId = 0; _globals.AFFLI = false; _globals.AFFIVBL = true; _globals._disableInventFl = true; @@ -5726,18 +5726,18 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _objectsManager.VERIFZONE(); OCEAN_HOME(); _eventsManager.VBL(); - if (_globals.SORTIE) + if (_globals._exitId) loopCond = true; } while (!loopCond); - if (_globals.SORTIE == 1) - _globals.SORTIE = exit1; - if (_globals.SORTIE == 2) - _globals.SORTIE = exit2; - if (_globals.SORTIE == 3) - _globals.SORTIE = exit3; - if (_globals.SORTIE == 4) - _globals.SORTIE = exit4; + if (_globals._exitId == 1) + _globals._exitId = exit1; + if (_globals._exitId == 2) + _globals._exitId = exit2; + if (_globals._exitId == 3) + _globals._exitId = exit3; + if (_globals._exitId == 4) + _globals._exitId = exit4; _graphicsManager.FADE_OUTW(); _objectsManager.removeSprite(0); _globals.AFFLI = false; @@ -5765,7 +5765,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { _globals.forest = false; _globals.FLAG_VISIBLE = false; _globals._disableInventFl = true; - _globals.SORTIE = 0; + _globals._exitId = 0; _graphicsManager.loadImage("ADULT"); _graphicsManager.FADE_INW(); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index c192bc80ce..b0f6c27422 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -61,12 +61,12 @@ int MenuManager::MENU() { _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; _vm->_globals.FLAG_VISIBLE = false; - _vm->_globals.SORTIE = 0; + _vm->_globals._exitId = 0; for (int idx = 0; idx < 31; ++idx) _vm->_globals._inventory[idx] = 0; - memset(_vm->_globals.SAUVEGARDE, 0, 2000); + memset(_vm->_globals._saveData, 0, 2000); _vm->_objectsManager.addObject(14); frame5Index = 0; frame4Index = 0; @@ -191,14 +191,14 @@ int MenuManager::MENU() { _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - _vm->_globals.SORTIE = -1; + _vm->_globals._exitId = -1; _vm->_dialogsManager.showLoadGame(); - if (_vm->_globals.SORTIE != -1) { - result = _vm->_globals.SORTIE; + if (_vm->_globals._exitId != -1) { + result = _vm->_globals._exitId; break; } - _vm->_globals.SORTIE = 0; + _vm->_globals._exitId = 0; } if (menuIndex != OPTIONS) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e870ff72c9..cb054842c6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1735,7 +1735,7 @@ void ObjectsManager::GOHOME() { setSpriteIndex(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; if (_vm->_globals.GOACTION) - v54 = _vm->_globals.SAUVEGARDE->data[svField2]; + v54 = _vm->_globals._saveData->data[svField2]; else v54 = NUMZONE; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2076,7 +2076,7 @@ LABEL_153: if (nouveau_x == -1 && v48 == -1) { if (_vm->_globals.GOACTION) - v49 = _vm->_globals.SAUVEGARDE->data[svField2]; + v49 = _vm->_globals._saveData->data[svField2]; else v49 = NUMZONE; setSpriteIndex(0, _vm->_globals.g_old_sens + 59); @@ -2449,7 +2449,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; _spritePtr = g_PTRNUL; - _vm->_globals.SORTIE = 0; + _vm->_globals._exitId = 0; _vm->_globals.AFFLI = false; _vm->_globals.AFFIVBL = false; _vm->_globals.NOT_VERIF = 1; @@ -2502,15 +2502,15 @@ void ObjectsManager::PLAN_BETA() { do { v5 = _vm->_eventsManager.getMouseButton(); if (v5) { - if (_vm->_globals.SAUVEGARDE->data[svField170] == 1 && !_vm->_globals.SAUVEGARDE->data[svField171]) { - _vm->_globals.SAUVEGARDE->data[svField171] = 1; + if (_vm->_globals._saveData->data[svField170] == 1 && !_vm->_globals._saveData->data[svField171]) { + _vm->_globals._saveData->data[svField171] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); _vm->_globals.NOPARLE = false; v5 = 0; } - if (_vm->_globals.SAUVEGARDE->data[svField80] == 1 && !_vm->_globals.SAUVEGARDE->data[svField172]) { - _vm->_globals.SAUVEGARDE->data[svField172] = 1; + if (_vm->_globals._saveData->data[svField80] == 1 && !_vm->_globals._saveData->data[svField172]) { + _vm->_globals._saveData->data[svField172] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); _vm->_globals.NOPARLE = false; @@ -2528,7 +2528,7 @@ void ObjectsManager::PLAN_BETA() { PARADISE(); _vm->_eventsManager.VBL(); - if (_vm->_globals.SORTIE) + if (_vm->_globals._exitId) v1 = 1; } while (!_vm->shouldQuit() && v1 != 1); @@ -2580,35 +2580,35 @@ void ObjectsManager::handleLeftButton() { _vm->_dialogsManager.showInventory(); _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; - if (!_vm->_globals.SORTIE) { + if (!_vm->_globals._exitId) { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._mouseCursorId = v1; } return; } - if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 + if (_vm->_globals._saveData->data[svField354] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 26 && (uint16)(destY - 26) <= 33) { changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 + if (_vm->_globals._saveData->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 26 && (uint16)(destY - 26) <= 22) { changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField353] == 1 + if (_vm->_globals._saveData->data[svField357] == 1) { + if (_vm->_globals._saveData->data[svField353] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 533) <= 26 && (uint16)(destY - 26) <= 33) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } - if (_vm->_globals.SAUVEGARDE->data[svField355] == 1 + if (_vm->_globals._saveData->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG && (uint16)(destX - 567) <= 26 && (uint16)(destY - 26) <= 33) { @@ -2639,8 +2639,8 @@ void ObjectsManager::handleLeftButton() { if (_vm->_globals.GOACTION) { VERIFZONE(); _vm->_globals.GOACTION = false; - _vm->_globals.SAUVEGARDE->data[svField1] = 0; - _vm->_globals.SAUVEGARDE->data[svField2] = 0; + _vm->_globals._saveData->data[svField1] = 0; + _vm->_globals._saveData->data[svField2] = 0; } LABEL_38: if (_vm->_globals.PLAN_FLAG == true && (_vm->_eventsManager._mouseCursorId != 4 || NUMZONE <= 0)) @@ -2715,12 +2715,12 @@ LABEL_65: } if ((uint16)(NUMZONE + 1) > 1u) { // TODO: Reformat the weird if statement generated by the decompiler - if (_vm->_eventsManager._mouseCursorId == 23 || (_vm->_globals.SAUVEGARDE->data[svField1] = _vm->_eventsManager._mouseCursorId, _vm->_eventsManager._mouseCursorId == 23)) - _vm->_globals.SAUVEGARDE->data[svField1] = 5; + if (_vm->_eventsManager._mouseCursorId == 23 || (_vm->_globals._saveData->data[svField1] = _vm->_eventsManager._mouseCursorId, _vm->_eventsManager._mouseCursorId == 23)) + _vm->_globals._saveData->data[svField1] = 5; if (_vm->_globals.PLAN_FLAG == true) - _vm->_globals.SAUVEGARDE->data[svField1] = 6; - _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; - _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->data[svField1] = 6; + _vm->_globals._saveData->data[svField2] = NUMZONE; + _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; _vm->_globals.GOACTION = true; } _vm->_fontManager.hideText(5); @@ -2730,7 +2730,7 @@ LABEL_65: ARRET_PERSO_FLAG = 1; ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; } - if (_vm->_globals.ECRAN == 20 && _vm->_globals.SAUVEGARDE->data[svField132] == 1 + if (_vm->_globals._screenId == 20 && _vm->_globals._saveData->data[svField132] == 1 && _vm->_globals._curObjectIndex == 20 && NUMZONE == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move @@ -2749,8 +2749,8 @@ void ObjectsManager::PARADISE() { v1 = 0; ARRET_PERSO_FLAG = 0; ARRET_PERSO_NUM = 0; - result = _vm->_globals.SAUVEGARDE->data[svField1]; - if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { + result = _vm->_globals._saveData->data[svField1]; + if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); if (!_vm->_globals.forest || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN) { @@ -2809,20 +2809,20 @@ LABEL_64: _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 0; } - _vm->_talkManager.REPONSE(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); + _vm->_talkManager.REPONSE(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } else { - _vm->_talkManager.REPONSE2(_vm->_globals.SAUVEGARDE->data[svField2], _vm->_globals.SAUVEGARDE->data[svField1]); + _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { NUMZONE = -1; _forceZoneFl = true; } - if (NUMZONE != _vm->_globals.SAUVEGARDE->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals._saveData->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { _vm->_eventsManager._mouseCursorId = 4; _changeVerbFl = false; } else { - _vm->_eventsManager._mouseCursorId = _vm->_globals.SAUVEGARDE->data[svField1]; + _vm->_eventsManager._mouseCursorId = _vm->_globals._saveData->data[svField1]; if (_changeVerbFl) { VERBEPLUS(); _changeVerbFl = false; @@ -2833,8 +2833,8 @@ LABEL_64: if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); NUMZONE = 0; - _vm->_globals.SAUVEGARDE->data[svField1] = 0; - _vm->_globals.SAUVEGARDE->data[svField2] = 0; + _vm->_globals._saveData->data[svField1] = 0; + _vm->_globals._saveData->data[svField2] = 0; } if (_vm->_globals.PLAN_FLAG == true) { _vm->_eventsManager._mouseCursorId = 0; @@ -2883,8 +2883,8 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager._mouseSpriteId = 0; Vold_taille = 200; - _vm->_globals.SAUVEGARDE->data[svField1] = 0; - _vm->_globals.SAUVEGARDE->data[svField2] = 0; + _vm->_globals._saveData->data[svField1] = 0; + _vm->_globals._saveData->data[svField2] = 0; _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; @@ -2914,13 +2914,13 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals.chemin = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS - && _vm->_globals.SAUVEGARDE->_realHopkins._location == _vm->_globals.ECRAN) { + && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { CH_TETE = 0; - loc = &_vm->_globals.SAUVEGARDE->_samantha; + loc = &_vm->_globals._saveData->_samantha; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); loc->field2 = 64; - loc->_location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals._screenId; loc->field4 = _sprite[0]._animationType; removeSprite(1); @@ -2928,12 +2928,12 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha SPRITE_ON(1); removeSprite(0); - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField357] = 1; + _vm->_globals._saveData->data[svField354] = 0; + _vm->_globals._saveData->data[svField356] = 0; + _vm->_globals._saveData->data[svField357] = 1; T_RECTIF = 0; - loc = &_vm->_globals.SAUVEGARDE->_realHopkins; + loc = &_vm->_globals._saveData->_realHopkins; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; @@ -2941,13 +2941,13 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha SPRITE_ON(0); _vm->_globals.HOPKINS_DATA(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA - && _vm->_globals.SAUVEGARDE->_samantha._location == _vm->_globals.ECRAN) { + && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { CH_TETE = 0; - loc = &_vm->_globals.SAUVEGARDE->_realHopkins; + loc = &_vm->_globals._saveData->_realHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); loc->field2 = 64; - loc->_location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals._screenId; loc->field4 = _sprite[0].fieldC; removeSprite(1); @@ -2955,11 +2955,11 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha SPRITE_ON(1); removeSprite(0); - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 1; - _vm->_globals.SAUVEGARDE->data[svField357] = 0; + _vm->_globals._saveData->data[svField354] = 0; + _vm->_globals._saveData->data[svField356] = 1; + _vm->_globals._saveData->data[svField357] = 0; - loc = &_vm->_globals.SAUVEGARDE->_samantha; + loc = &_vm->_globals._saveData->_samantha; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 2; @@ -2969,27 +2969,27 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha } else { switch (oldCharacter) { case CHARACTER_HOPKINS: - loc = &_vm->_globals.SAUVEGARDE->_realHopkins; + loc = &_vm->_globals._saveData->_realHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); loc->field2 = 64; - loc->_location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals._screenId; loc->field4 = _sprite[0].fieldC; break; case CHARACTER_HOPKINS_CLONE: - loc = &_vm->_globals.SAUVEGARDE->_cloneHopkins; + loc = &_vm->_globals._saveData->_cloneHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); loc->field2 = 64; - loc->_location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals._screenId; loc->field4 = _sprite[0].fieldC; break; case CHARACTER_SAMANTHA: - loc = &_vm->_globals.SAUVEGARDE->_samantha; + loc = &_vm->_globals._saveData->_samantha; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); loc->field2 = 64; - loc->_location = _vm->_globals.ECRAN; + loc->_location = _vm->_globals._screenId; loc->field4 = _sprite[0].fieldC; break; default: @@ -2998,25 +2998,25 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha switch (newCharacter) { case CHARACTER_HOPKINS: - _vm->_globals.SAUVEGARDE->data[svField121] = 0; - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->_realHopkins._location; + _vm->_globals._saveData->data[svField121] = 0; + _vm->_globals._saveData->data[svField354] = 0; + _vm->_globals._saveData->data[svField356] = 0; + _vm->_globals._saveData->data[svField357] = 1; + _vm->_globals._exitId = _vm->_globals._saveData->_realHopkins._location; break; case CHARACTER_HOPKINS_CLONE: - _vm->_globals.SAUVEGARDE->data[svField121] = 1; - _vm->_globals.SAUVEGARDE->data[svField354] = 1; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->_cloneHopkins._location; + _vm->_globals._saveData->data[svField121] = 1; + _vm->_globals._saveData->data[svField354] = 1; + _vm->_globals._saveData->data[svField356] = 0; + _vm->_globals._saveData->data[svField357] = 0; + _vm->_globals._exitId = _vm->_globals._saveData->_cloneHopkins._location; break; case CHARACTER_SAMANTHA: - _vm->_globals.SAUVEGARDE->data[svField121] = 0; - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 1; - _vm->_globals.SAUVEGARDE->data[svField357] = 0; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->_samantha._location; + _vm->_globals._saveData->data[svField121] = 0; + _vm->_globals._saveData->data[svField354] = 0; + _vm->_globals._saveData->data[svField356] = 1; + _vm->_globals._saveData->data[svField357] = 0; + _vm->_globals._exitId = _vm->_globals._saveData->_samantha._location; break; } } @@ -3972,9 +3972,9 @@ void ObjectsManager::OPTI_OBJET() { return; if (v5 == 2) - v0 = _vm->_scriptManager.Control_Goto(data + 20 * v0); + v0 = _vm->_scriptManager.handleGoto(data + 20 * v0); if (v5 == 3) - v0 = _vm->_scriptManager.Control_If(data, v0); + v0 = _vm->_scriptManager.handleIf(data, v0); if (v0 == -1) error("defective IFF function"); if (v5 == 1 || v5 == 4) @@ -3991,40 +3991,40 @@ void ObjectsManager::SPECIAL_JEU() { byte *v2; byte *v3; - if ((uint16)(_vm->_globals.ECRAN - 35) <= 6u) { - if (_vm->_globals.OLD_ECRAN == 16 && _vm->_globals.ECRAN == 35) + if ((uint16)(_vm->_globals._screenId - 35) <= 6u) { + if (_vm->_globals.OLD_ECRAN == 16 && _vm->_globals._screenId == 35) TEST_FORET(35, 500, 555, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals.ECRAN == 35) + if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals._screenId == 35) TEST_FORET(35, 6, 84, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 35 && _vm->_globals.ECRAN == 36) + if (_vm->_globals.OLD_ECRAN == 35 && _vm->_globals._screenId == 36) TEST_FORET(36, 551, 633, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals.ECRAN == 36) + if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals._screenId == 36) TEST_FORET(36, 6, 84, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals.ECRAN == 37) + if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals._screenId == 37) TEST_FORET(37, 551, 633, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals.ECRAN == 37) + if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals._screenId == 37) TEST_FORET(37, 392, 529, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals.ECRAN == 38) + if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals._screenId == 38) TEST_FORET(38, 133, 252, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals.ECRAN == 38) + if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals._screenId == 38) TEST_FORET(38, 6, 84, 100, 440, 3); - if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals.ECRAN == 39) + if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals._screenId == 39) TEST_FORET(39, 551, 633, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals.ECRAN == 39) + if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals._screenId == 39) TEST_FORET(39, 6, 84, 100, 440, 3); - if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals.ECRAN == 40) + if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals._screenId == 40) TEST_FORET(40, 133, 252, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 41 && _vm->_globals.ECRAN == 40) + if (_vm->_globals.OLD_ECRAN == 41 && _vm->_globals._screenId == 40) TEST_FORET(40, 392, 529, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals.ECRAN == 41) + if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals._screenId == 41) TEST_FORET(41, 551, 633, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 17 && _vm->_globals.ECRAN == 41) + if (_vm->_globals.OLD_ECRAN == 17 && _vm->_globals._screenId == 41) TEST_FORET(41, 6, 84, 100, 440, 3); } - if (_vm->_globals.ECRAN == 5) { + if (_vm->_globals._screenId == 5) { if (getSpriteY(0) <= 399) { - if (!_vm->_globals.SAUVEGARDE->data[svField173]) { - _vm->_globals.SAUVEGARDE->data[svField173] = 1; + if (!_vm->_globals._saveData->data[svField173]) { + _vm->_globals._saveData->data[svField173] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); _vm->_globals.NOPARLE = false; @@ -4073,31 +4073,31 @@ void ObjectsManager::SPECIAL_JEU() { } } } - if (_vm->_globals.ECRAN == 20) - _vm->_globals.SAUVEGARDE->data[svField132] = getSpriteX(0) > 65 + if (_vm->_globals._screenId == 20) + _vm->_globals._saveData->data[svField132] = getSpriteX(0) > 65 && getSpriteX(0) <= 124 && getSpriteY(0) > 372 && getSpriteY(0) <= 398; - if (_vm->_globals.ECRAN == 57) { + if (_vm->_globals._screenId == 57) { _vm->_globals._disableInventFl = true; - if (_vm->_globals.SAUVEGARDE->data[svField261] == 1 && BOBPOSI(5) == 37) { + if (_vm->_globals._saveData->data[svField261] == 1 && BOBPOSI(5) == 37) { stopBobAnimation(5); SET_BOBPOSI(5, 0); setBobAnimation(6); - _vm->_globals.SAUVEGARDE->data[svField261] = 2; + _vm->_globals._saveData->data[svField261] = 2; ZONE_OFF(15); _vm->_soundManager.PLAY_SOUND("SOUND75.WAV"); } - if (_vm->_globals.SAUVEGARDE->data[svField261] == 2 && BOBPOSI(6) == 6) { + if (_vm->_globals._saveData->data[svField261] == 2 && BOBPOSI(6) == 6) { stopBobAnimation(6); SET_BOBPOSI(6, 0); setBobAnimation(7); ZONE_ON(14); - _vm->_globals.SAUVEGARDE->data[svField261] = 3; + _vm->_globals._saveData->data[svField261] = 3; } _vm->_globals._disableInventFl = false; } - if (_vm->_globals.ECRAN == 93 && !_vm->_globals.SAUVEGARDE->data[svField333]) { + if (_vm->_globals._screenId == 93 && !_vm->_globals._saveData->data[svField333]) { _vm->_globals._disableInventFl = true; do _vm->_eventsManager.VBL(); @@ -4105,7 +4105,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); stopBobAnimation(8); - _vm->_globals.SAUVEGARDE->data[svField333] = 1; + _vm->_globals._saveData->data[svField333] = 1; _vm->_globals._disableInventFl = false; } } @@ -4630,11 +4630,11 @@ void ObjectsManager::INILINK(const Common::String &file) { } void ObjectsManager::SPECIAL_INI(const Common::String &a1) { - if (_vm->_globals.ECRAN == 73 && !_vm->_globals.SAUVEGARDE->data[svField318]) { + if (_vm->_globals._screenId == 73 && !_vm->_globals._saveData->data[svField318]) { _vm->_globals.CACHE_SUB(0); _vm->_globals.CACHE_SUB(1); } - if ((uint16)(_vm->_globals.ECRAN - 35) <= 6u) { + if ((uint16)(_vm->_globals._screenId - 35) <= 6u) { _vm->_globals.BOBZONE[20] = 1; _vm->_globals.BOBZONE[21] = 2; _vm->_globals.BOBZONE[22] = 3; @@ -4652,15 +4652,15 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.ZONEP[22].field12 = 30; _vm->_globals.ZONEP[23].field12 = 30; for (int v2 = 200; v2 <= 214; v2++) { - if (_vm->_globals.SAUVEGARDE->data[v2] != 2) - _vm->_globals.SAUVEGARDE->data[v2] = 0; + if (_vm->_globals._saveData->data[v2] != 2) + _vm->_globals._saveData->data[v2] = 0; } } - if (_vm->_globals.ECRAN == 93) { - if (!_vm->_globals.SAUVEGARDE->data[svField333]) + if (_vm->_globals._screenId == 93) { + if (!_vm->_globals._saveData->data[svField333]) setBobAnimation(8); } - if (_vm->_globals.ECRAN == 18 && _vm->_globals.OLD_ECRAN == 17) { + if (_vm->_globals._screenId == 18 && _vm->_globals.OLD_ECRAN == 17) { _vm->_eventsManager._mouseSpriteId = 4; _vm->_globals.BPP_NOAFF = true; for (int v3 = 0; v3 <= 4; v3++) @@ -4675,7 +4675,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_graphicsManager.NOFADE = true; _vm->_globals._disableInventFl = false; } - if (_vm->_globals.ECRAN == 17 && _vm->_globals.OLD_ECRAN == 20) { + if (_vm->_globals._screenId == 17 && _vm->_globals.OLD_ECRAN == 20) { _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -4698,9 +4698,9 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { } if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(383, 4); - _vm->_globals.SAUVEGARDE->data[svField270] = 1; - _vm->_globals.SAUVEGARDE->data[svField300] = 1; - _vm->_globals.SAUVEGARDE->data[svField320] = 1; + _vm->_globals._saveData->data[svField270] = 1; + _vm->_globals._saveData->data[svField300] = 1; + _vm->_globals._saveData->data[svField320] = 1; if (_vm->_soundManager._voiceOffFl) { for (int v6 = 0; v6 <= 199; v6++) _vm->_eventsManager.VBL(); @@ -5128,75 +5128,75 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) char v7; v6 = a1; - if (_vm->_globals.ECRAN == a1) { + if (_vm->_globals._screenId == a1) { if (a1 == 35) { if (a6 > 2 || (v6 = 200, a6 > 2)) v6 = 201; } - if (_vm->_globals.ECRAN == 36) { + if (_vm->_globals._screenId == 36) { if (a6 > 2 || (v6 = 202, a6 > 2)) v6 = 203; } - if (_vm->_globals.ECRAN == 37) { + if (_vm->_globals._screenId == 37) { if (a6 > 2 || (v6 = 204, a6 > 2)) v6 = 205; } - if (_vm->_globals.ECRAN == 38) { + if (_vm->_globals._screenId == 38) { if (a6 > 2 || (v6 = 206, a6 > 2)) v6 = 207; } - if (_vm->_globals.ECRAN == 39) { + if (_vm->_globals._screenId == 39) { if (a6 > 2 || (v6 = 208, a6 > 2)) v6 = 209; } - if (_vm->_globals.ECRAN == 40) { + if (_vm->_globals._screenId == 40) { if (a6 > 2 || (v6 = 210, a6 > 2)) v6 = 211; } - if (_vm->_globals.ECRAN == 41) { + if (_vm->_globals._screenId == 41) { if (a6 > 2 || (v6 = 212, a6 > 2)) v6 = 213; } - v7 = _vm->_globals.SAUVEGARDE->data[v6]; + v7 = _vm->_globals._saveData->data[v6]; if (v7 != 2) { if (v7) { if (v7 == 1) { if (a6 == 1 && BOBPOSI(1) == 26) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals.SAUVEGARDE->data[v6] = 4; + _vm->_globals._saveData->data[v6] = 4; } if (a6 == 2 && BOBPOSI(2) == 26) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals.SAUVEGARDE->data[v6] = 4; + _vm->_globals._saveData->data[v6] = 4; } if (a6 == 3 && BOBPOSI(3) == 27) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals.SAUVEGARDE->data[v6] = 4; + _vm->_globals._saveData->data[v6] = 4; } if (a6 == 4 && BOBPOSI(4) == 27) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_dialogsManager._removeInventFl = true; - _vm->_globals.SAUVEGARDE->data[v6] = 4; + _vm->_globals._saveData->data[v6] = 4; } } - if (_vm->_globals.SAUVEGARDE->data[v6] == 4) { + if (_vm->_globals._saveData->data[v6] == 4) { if (a6 == 1 && (signed int)BOBPOSI(1) > 30) - _vm->_globals.SAUVEGARDE->data[v6] = 3; + _vm->_globals._saveData->data[v6] = 3; if (a6 == 2 && (signed int)BOBPOSI(2) > 30) - _vm->_globals.SAUVEGARDE->data[v6] = 3; + _vm->_globals._saveData->data[v6] = 3; if (a6 == 3 && (signed int)BOBPOSI(3) > 30) - _vm->_globals.SAUVEGARDE->data[v6] = 3; + _vm->_globals._saveData->data[v6] = 3; if (a6 == 4 && (signed int)BOBPOSI(4) > 30) - _vm->_globals.SAUVEGARDE->data[v6] = 3; + _vm->_globals._saveData->data[v6] = 3; } - if (_vm->_globals.SAUVEGARDE->data[v6] == 3) { + if (_vm->_globals._saveData->data[v6] == 3) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); - _vm->_globals.SORTIE = 150; + _vm->_globals._exitId = 150; _vm->_graphicsManager.NOFADE = true; BOB_OFF(1); BOB_OFF(2); @@ -5215,7 +5215,7 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) setBobAnimation(3); if (a6 == 4) setBobAnimation(4); - _vm->_globals.SAUVEGARDE->data[v6] = 1; + _vm->_globals._saveData->data[v6] = 1; } } } @@ -5243,7 +5243,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_soundManager.WSOUND(v); _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = true; - _vm->_globals.SORTIE = 0; + _vm->_globals._exitId = 0; _vm->_globals.AFFLI = false; _vm->_globals.AFFIVBL = false; if (!backgroundFile.empty()) @@ -5260,7 +5260,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.INI_ECRAN2(s4); } _vm->_eventsManager.mouseOn(); - if (_vm->_globals.ECRAN == 61) { + if (_vm->_globals._screenId == 61) { SPRITE(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, 0, 34, 190); SPRITE_ON(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -5276,7 +5276,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_eventsManager.VBL(); _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); - if (_vm->_globals.ECRAN == 61) { + if (_vm->_globals._screenId == 61) { _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); stopBobAnimation(3); _vm->_globals.NOT_VERIF = 1; @@ -5306,9 +5306,9 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo VERIFZONE(); if (_vm->_globals.GOACTION) PARADISE(); - if (!_vm->_globals.SORTIE) { + if (!_vm->_globals._exitId) { _vm->_eventsManager.VBL(); - if (!_vm->_globals.SORTIE) + if (!_vm->_globals._exitId) continue; } v5 = 1; @@ -5319,7 +5319,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.FADE_OUTW(); if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); - if (_vm->_globals.ECRAN == 61) + if (_vm->_globals._screenId == 61) removeSprite(0); CLEAR_ECRAN(); _vm->_globals.iRegul = 0; @@ -5340,7 +5340,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.PLAN_FLAG = false; _vm->_graphicsManager.NOFADE = false; _vm->_globals.NOMARCHE = false; - _vm->_globals.SORTIE = 0; + _vm->_globals._exitId = 0; _vm->_globals.AFFLI = false; _vm->_globals.AFFIVBL = false; _vm->_globals.NOT_VERIF = 1; @@ -5368,20 +5368,20 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); if (!_vm->_globals.PERSO_TYPE) goto LABEL_70; - if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; } if (!_vm->_globals.PERSO_TYPE) { LABEL_70: - if (_vm->_globals.SAUVEGARDE->data[svField122] == 1) { + if (_vm->_globals._saveData->data[svField122] == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 1; } } - if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals.SAUVEGARDE->data[svField356] == 1) { + if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->data[svField356] == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 2; @@ -5436,7 +5436,7 @@ LABEL_70: if (yCheck == yp) { _vm->_globals.chemin = (int16 *)g_PTRNUL; PARADISE(); - if (_vm->_globals.SORTIE) + if (_vm->_globals._exitId) breakFlag = true; } } @@ -5448,7 +5448,7 @@ LABEL_70: handleRightButton(); } } - if (!_vm->_globals.SORTIE) { + if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL @@ -5458,13 +5458,13 @@ LABEL_70: } SPECIAL_JEU(); _vm->_eventsManager.VBL(); - if (!_vm->_globals.SORTIE) + if (!_vm->_globals._exitId) continue; } breakFlag = true; } - if (_vm->_globals.SORTIE != 8 || _vm->_globals.ECRAN != 5 || _vm->_globals.HELICO != 1) { + if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || _vm->_globals.HELICO != 1) { if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = false; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 0b95f11e5a..dafde79dc5 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -140,11 +140,11 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName) { /* Pack any necessary data into the savegame data structure */ // Set the selected slot number - _vm->_globals.SAUVEGARDE->data[svField10] = slot; + _vm->_globals._saveData->data[svField10] = slot; // Set up the inventory for (int i = 0; i < 35; ++i) - _vm->_globals.SAUVEGARDE->_inventory[i] = _vm->_globals._inventory[i]; + _vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i]; /* Create the savegame */ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( @@ -196,13 +196,13 @@ Common::Error SaveLoadManager::loadGame(int slot) { // Unpack the inventory for (int i = 0; i < 35; ++i) - _vm->_globals._inventory[i] = _vm->_globals.SAUVEGARDE->_inventory[i]; + _vm->_globals._inventory[i] = _vm->_globals._saveData->_inventory[i]; // Set variables from loaded data as necessary - _vm->_globals.SAUVEGARDE->data[svField10] = slot; - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField5]; - _vm->_globals.SAUVEGARDE->data[svField6] = 0; - _vm->_globals.ECRAN = 0; + _vm->_globals._saveData->data[svField10] = slot; + _vm->_globals._exitId = _vm->_globals._saveData->data[svField5]; + _vm->_globals._saveData->data[svField6] = 0; + _vm->_globals._screenId = 0; return Common::kNoError; } @@ -253,13 +253,13 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s) { - s.syncBytes(&_vm->_globals.SAUVEGARDE->data[0], 2050); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_cloneHopkins); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_realHopkins); - syncCharacterLocation(s, _vm->_globals.SAUVEGARDE->_samantha); + s.syncBytes(&_vm->_globals._saveData->data[0], 2050); + syncCharacterLocation(s, _vm->_globals._saveData->_cloneHopkins); + syncCharacterLocation(s, _vm->_globals._saveData->_realHopkins); + syncCharacterLocation(s, _vm->_globals._saveData->_samantha); for (int i = 0; i < 35; ++i) - s.syncAsSint16LE(_vm->_globals.SAUVEGARDE->_inventory[i]); + s.syncAsSint16LE(_vm->_globals._saveData->_inventory[i]); } void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLocation &item) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d55cfe3ffd..febc293016 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -56,7 +56,7 @@ int ScriptManager::Traduction(byte *a1) { int mesgId = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { + if (_vm->_globals._saveData->data[svField356] == 1) { if (mesgId == 53) mesgId = 644; if (mesgId == 624) @@ -140,7 +140,7 @@ int ScriptManager::Traduction(byte *a1) { _vm->_soundManager.mixVoice(mesgId, 4); } if (TRAVAILOBJET) { - if (_vm->_globals.SAUVEGARDE->data[svField356]) { + if (_vm->_globals._saveData->data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); @@ -207,52 +207,52 @@ LABEL_1141: _vm->_objectsManager.PERY = v6; _vm->_objectsManager.PERI = v5; if (_vm->_objectsManager.CH_TETE == 1) { - if (_vm->_globals.SAUVEGARDE->data[svField354] == 1 - && _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.x && _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.y - && _vm->_globals.SAUVEGARDE->_cloneHopkins.field2 && _vm->_globals.SAUVEGARDE->_cloneHopkins._location) { + if (_vm->_globals._saveData->data[svField354] == 1 + && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y + && _vm->_globals._saveData->_cloneHopkins.field2 && _vm->_globals._saveData->_cloneHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.x; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->_cloneHopkins._pos.y; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->_cloneHopkins.field2; + _vm->_objectsManager.PERX = _vm->_globals._saveData->_cloneHopkins._pos.x; + _vm->_objectsManager.PERY = _vm->_globals._saveData->_cloneHopkins._pos.y; + _vm->_objectsManager.PERI = _vm->_globals._saveData->_cloneHopkins.field2; } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->_samantha._pos.x && _vm->_globals.SAUVEGARDE->_samantha._pos.y - && _vm->_globals.SAUVEGARDE->_samantha.field2 && _vm->_globals.SAUVEGARDE->_samantha._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->_samantha._pos.x; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->_samantha._pos.y; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->_samantha.field2; + if (_vm->_globals._saveData->data[svField356] == 1 + && _vm->_globals._saveData->_samantha._pos.x && _vm->_globals._saveData->_samantha._pos.y + && _vm->_globals._saveData->_samantha.field2 && _vm->_globals._saveData->_samantha._location) { + _vm->_objectsManager.PERX = _vm->_globals._saveData->_samantha._pos.x; + _vm->_objectsManager.PERY = _vm->_globals._saveData->_samantha._pos.y; + _vm->_objectsManager.PERI = _vm->_globals._saveData->_samantha.field2; } - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->_realHopkins._pos.x && _vm->_globals.SAUVEGARDE->_realHopkins._pos.y - && _vm->_globals.SAUVEGARDE->_realHopkins.field2 && _vm->_globals.SAUVEGARDE->_realHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals.SAUVEGARDE->_realHopkins._pos.x; - _vm->_objectsManager.PERY = _vm->_globals.SAUVEGARDE->_realHopkins._pos.y; - _vm->_objectsManager.PERI = _vm->_globals.SAUVEGARDE->_realHopkins.field2; + if (_vm->_globals._saveData->data[svField357] == 1 + && _vm->_globals._saveData->_realHopkins._pos.x && _vm->_globals._saveData->_realHopkins._pos.y + && _vm->_globals._saveData->_realHopkins.field2 && _vm->_globals._saveData->_realHopkins._location) { + _vm->_objectsManager.PERX = _vm->_globals._saveData->_realHopkins._pos.x; + _vm->_objectsManager.PERY = _vm->_globals._saveData->_realHopkins._pos.y; + _vm->_objectsManager.PERI = _vm->_globals._saveData->_realHopkins.field2; } } - if (_vm->_globals.SAUVEGARDE->data[svField356] == 1 - && _vm->_globals.SAUVEGARDE->_realHopkins._location == _vm->_globals.ECRAN) { + if (_vm->_globals._saveData->data[svField356] == 1 + && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->_realHopkins._pos, + _vm->_globals._saveData->_realHopkins._pos, 1, 2, - _vm->_globals.SAUVEGARDE->_realHopkins.field4, + _vm->_globals._saveData->_realHopkins.field4, 0, 34, 190); _vm->_objectsManager.SPRITE_ON(1); _vm->_objectsManager.DEUXPERSO = true; } - if (_vm->_globals.SAUVEGARDE->data[svField357] == 1 - && _vm->_globals.SAUVEGARDE->data[svField355] == 1 - && _vm->_globals.SAUVEGARDE->_samantha._location == _vm->_globals.ECRAN) { + if (_vm->_globals._saveData->data[svField357] == 1 + && _vm->_globals._saveData->data[svField355] == 1 + && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { _vm->_objectsManager.SPRITE( _vm->_globals.TETE, - _vm->_globals.SAUVEGARDE->_samantha._pos, + _vm->_globals._saveData->_samantha._pos, 1, 3, - _vm->_globals.SAUVEGARDE->_samantha.field4, + _vm->_globals._saveData->_samantha.field4, 0, 20, 127); @@ -270,10 +270,10 @@ LABEL_1141: int v8 = *(a1 + 7); int v9 = *(a1 + 8); _vm->_objectsManager.RECALL = 0; - _vm->_globals.OLD_ECRAN = _vm->_globals.ECRAN; - _vm->_globals.SAUVEGARDE->data[svField6] = _vm->_globals.ECRAN; - _vm->_globals.ECRAN = v7; - _vm->_globals.SAUVEGARDE->data[svField5] = v7; + _vm->_globals.OLD_ECRAN = _vm->_globals._screenId; + _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; + _vm->_globals._screenId = v7; + _vm->_globals._saveData->data[svField5] = v7; _vm->_objectsManager.PTAILLE = v70; _vm->_objectsManager.PEROFX = v8; _vm->_objectsManager.PEROFY = v9; @@ -288,7 +288,7 @@ LABEL_1141: } if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { int v73 = (int16)READ_LE_UINT16(a1 + 5); - if (!_vm->_globals.SAUVEGARDE->data[svField122] && !_vm->_globals.SAUVEGARDE->data[svField356]) { + if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { v70 = 0; if ((int16)READ_LE_UINT16(a1 + 5) == 14) v73 = 1; @@ -508,7 +508,7 @@ LABEL_1141: if (*(a1 + 2) == 'E' && *(a1 + 3) == 'X' && *(a1 + 4) == 'I') v1 = 5; if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'R') { - _vm->_globals.SORTIE = (int16)READ_LE_UINT16(a1 + 5); + _vm->_globals._exitId = (int16)READ_LE_UINT16(a1 + 5); v1 = 5; } if (*(a1 + 2) == 'B' && *(a1 + 3) == 'C' && *(a1 + 4) == 'A') { @@ -582,7 +582,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 0; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_graphicsManager.NOFADE = true; - _vm->_globals.SORTIE = 151; + _vm->_globals._exitId = 151; } if (v76 == 604) { _vm->_globals.NO_VISU = true; @@ -597,7 +597,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - _vm->_globals.SORTIE = 151; + _vm->_globals._exitId = 151; } if (v76 == 605) { _vm->_globals.NO_VISU = true; @@ -614,7 +614,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.NOFADE = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - _vm->_globals.SORTIE = 151; + _vm->_globals._exitId = 151; } if (v76 == 606) { _vm->_globals.NO_VISU = true; @@ -628,7 +628,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); } - _vm->_globals.SORTIE = 6; + _vm->_globals._exitId = 6; } if (v76 == 607) { if (!_vm->_globals._internetFl) { @@ -761,19 +761,19 @@ LABEL_1141: _vm->_globals.HELICO = 1; } if (v76 == 36) { - if (_vm->_globals.SAUVEGARDE->data[svField270] == 2 && _vm->_globals.SAUVEGARDE->data[svField94] == 1 && _vm->_globals.SAUVEGARDE->data[svField95] == 1) - _vm->_globals.SAUVEGARDE->data[svField270] = 3; - if (!_vm->_globals.SAUVEGARDE->data[svField270]) + if (_vm->_globals._saveData->data[svField270] == 2 && _vm->_globals._saveData->data[svField94] == 1 && _vm->_globals._saveData->data[svField95] == 1) + _vm->_globals._saveData->data[svField270] = 3; + if (!_vm->_globals._saveData->data[svField270]) _vm->_talkManager.PARLER_PERSO2("PATRON0.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] == 1) + if (_vm->_globals._saveData->data[svField270] == 1) _vm->_talkManager.PARLER_PERSO2("PATRON1.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] == 2) + if (_vm->_globals._saveData->data[svField270] == 2) _vm->_talkManager.PARLER_PERSO2("PATRON2.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] == 3) + if (_vm->_globals._saveData->data[svField270] == 3) _vm->_talkManager.PARLER_PERSO2("PATRON3.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField270] > 3) { + if (_vm->_globals._saveData->data[svField270] > 3) { _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); - _vm->_globals.SAUVEGARDE->data[svField270] = 5; + _vm->_globals._saveData->data[svField270] = 5; } } if (v76 == 37) { @@ -949,7 +949,7 @@ LABEL_1141: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); int v19 = 12; - if (_vm->_globals.SAUVEGARDE->data[svField133] == 1) + if (_vm->_globals._saveData->data[svField133] == 1) v19 = 41; int v20 = 0; do { @@ -1132,7 +1132,7 @@ LABEL_1141: _vm->_objectsManager.OBSSEUL = 0; } if (v76 == 88) { - if (_vm->_globals.SAUVEGARDE->data[svField183] == 1) { + if (_vm->_globals._saveData->data[svField183] == 1) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(2, 0); _vm->_objectsManager.setBobAnimation(1); @@ -1174,7 +1174,7 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } - if (_vm->_globals.SAUVEGARDE->data[svField183] == 2) { + if (_vm->_globals._saveData->data[svField183] == 2) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(3, 0); _vm->_objectsManager.setBobAnimation(1); @@ -1219,11 +1219,11 @@ LABEL_1141: } if (v76 == 90) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField186]) { + if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } - if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { + if (_vm->_globals._saveData->data[svField186] == 1) { _vm->_animationManager.playSequence("CIB5C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); @@ -1231,11 +1231,11 @@ LABEL_1141: } if (v76 == 91) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField186]) { + if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } - if (_vm->_globals.SAUVEGARDE->data[svField186] == 1) { + if (_vm->_globals._saveData->data[svField186] == 1) { _vm->_animationManager.playSequence("CIB5D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); @@ -1243,11 +1243,11 @@ LABEL_1141: } if (v76 == 92) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField184]) { + if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } - if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { + if (_vm->_globals._saveData->data[svField184] == 1) { _vm->_animationManager.playSequence("CIB6C.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); @@ -1255,11 +1255,11 @@ LABEL_1141: } if (v76 == 93) { _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); - if (!_vm->_globals.SAUVEGARDE->data[svField184]) { + if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } - if (_vm->_globals.SAUVEGARDE->data[svField184] == 1) { + if (_vm->_globals._saveData->data[svField184] == 1) { _vm->_animationManager.playSequence("CIB6D.SEQ", 1, 12, 1); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); @@ -1275,17 +1275,17 @@ LABEL_1141: _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { + if (_vm->_globals._saveData->data[svField253] == 1) { int v27 = _vm->_objectsManager.getSpriteY(0); int v28 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); } - if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { + if (_vm->_globals._saveData->data[svField253] == 2) { int v29 = _vm->_objectsManager.getSpriteY(0); int v30 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); } - if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { + if (_vm->_globals._saveData->data[svField253] > 2) { int v31 = _vm->_objectsManager.getSpriteY(0); int v32 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); @@ -1301,7 +1301,7 @@ LABEL_1141: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.loadSample(1, "SOUND63.WAV"); - if (_vm->_globals.SAUVEGARDE->data[svField253] > 2) { + if (_vm->_globals._saveData->data[svField253] > 2) { _vm->_objectsManager.setBobAnimation(4); int v33 = 0; do { @@ -1330,7 +1330,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(4) != 72); _vm->_objectsManager.stopBobAnimation(4); } - if (_vm->_globals.SAUVEGARDE->data[svField253] == 1) { + if (_vm->_globals._saveData->data[svField253] == 1) { _vm->_objectsManager.setBobAnimation(6); int v34 = 0; do { @@ -1359,7 +1359,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(6) != 72); _vm->_objectsManager.stopBobAnimation(6); } - if (_vm->_globals.SAUVEGARDE->data[svField253] == 2) { + if (_vm->_globals._saveData->data[svField253] == 2) { _vm->_objectsManager.setBobAnimation(5); int v35 = 0; do { @@ -1513,7 +1513,7 @@ LABEL_1141: _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); if (v76 == 208) { _vm->_globals._disableInventFl = true; - if (_vm->_globals.SAUVEGARDE->data[svField6] != _vm->_globals.SAUVEGARDE->data[svField401]) { + if (_vm->_globals._saveData->data[svField6] != _vm->_globals._saveData->data[svField401]) { _vm->_soundManager.SPECIAL_SOUND = 208; _vm->_eventsManager._disableEscKeyFl = true; _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); @@ -1535,7 +1535,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); - _vm->_globals.SORTIE = _vm->_globals.SAUVEGARDE->data[svField401]; + _vm->_globals._exitId = _vm->_globals._saveData->data[svField401]; _vm->_globals._disableInventFl = false; } if (v76 == 209) { @@ -1793,7 +1793,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.stopBobAnimation(13); _vm->_graphicsManager.NOFADE = true; - _vm->_globals.SORTIE = 94; + _vm->_globals._exitId = 94; } if (v76 == 52) { _vm->_globals.NOPARLE = true; @@ -1807,7 +1807,7 @@ LABEL_1141: if (v76 == 40) _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); if (v76 == 236) { - char v47 = _vm->_globals.SAUVEGARDE->data[svField341]; + char v47 = _vm->_globals._saveData->data[svField341]; if (v47) { if (v47 == 2) v70 = 5; @@ -1817,25 +1817,25 @@ LABEL_1141: v70 = 6; _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + if (_vm->_globals._saveData->data[svField341] == 1) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + if (_vm->_globals._saveData->data[svField341] == 2) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + if (_vm->_globals._saveData->data[svField341] == 3) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_globals.SAUVEGARDE->data[svField338] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_globals.SAUVEGARDE->data[svField339] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_globals.SAUVEGARDE->data[svField340] = 0; + if (_vm->_globals._saveData->data[svField341] == 1) + _vm->_globals._saveData->data[svField338] = 0; + if (_vm->_globals._saveData->data[svField341] == 2) + _vm->_globals._saveData->data[svField339] = 0; + if (_vm->_globals._saveData->data[svField341] == 3) + _vm->_globals._saveData->data[svField340] = 0; } _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); } if (v76 == 237) { - char v48 = _vm->_globals.SAUVEGARDE->data[svField341]; + char v48 = _vm->_globals._saveData->data[svField341]; if (v48) { if (v48 == 2) v70 = 5; @@ -1845,25 +1845,25 @@ LABEL_1141: v70 = 6; _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + if (_vm->_globals._saveData->data[svField341] == 1) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + if (_vm->_globals._saveData->data[svField341] == 2) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + if (_vm->_globals._saveData->data[svField341] == 3) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_globals.SAUVEGARDE->data[svField338] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_globals.SAUVEGARDE->data[svField339] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_globals.SAUVEGARDE->data[svField340] = 0; + if (_vm->_globals._saveData->data[svField341] == 1) + _vm->_globals._saveData->data[svField338] = 0; + if (_vm->_globals._saveData->data[svField341] == 2) + _vm->_globals._saveData->data[svField339] = 0; + if (_vm->_globals._saveData->data[svField341] == 3) + _vm->_globals._saveData->data[svField340] = 0; } _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); } if (v76 == 238) { - char v49 = _vm->_globals.SAUVEGARDE->data[svField341]; + char v49 = _vm->_globals._saveData->data[svField341]; if (v49) { if (v49 == 2) v70 = 5; @@ -1873,18 +1873,18 @@ LABEL_1141: v70 = 6; _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) + if (_vm->_globals._saveData->data[svField341] == 1) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) + if (_vm->_globals._saveData->data[svField341] == 2) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) + if (_vm->_globals._saveData->data[svField341] == 3) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 1) - _vm->_globals.SAUVEGARDE->data[svField338] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) - _vm->_globals.SAUVEGARDE->data[svField339] = 0; - if (_vm->_globals.SAUVEGARDE->data[svField341] == 3) - _vm->_globals.SAUVEGARDE->data[svField340] = 0; + if (_vm->_globals._saveData->data[svField341] == 1) + _vm->_globals._saveData->data[svField338] = 0; + if (_vm->_globals._saveData->data[svField341] == 2) + _vm->_globals._saveData->data[svField339] = 0; + if (_vm->_globals._saveData->data[svField341] == 3) + _vm->_globals._saveData->data[svField340] = 0; } _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); @@ -1931,21 +1931,21 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - CharacterLocation *v51 = &_vm->_globals.SAUVEGARDE->_realHopkins; + CharacterLocation *v51 = &_vm->_globals._saveData->_realHopkins; v51->_pos.x = _vm->_objectsManager.getSpriteX(0); v51->_pos.y = _vm->_objectsManager.getSpriteY(0); v51->field2 = 57; v51->_location = 97; - _vm->_globals.SAUVEGARDE->data[svField121] = 1; - _vm->_globals.SAUVEGARDE->data[svField352] = 1; - _vm->_globals.SAUVEGARDE->data[svField353] = 1; - _vm->_globals.SAUVEGARDE->data[svField354] = 1; + _vm->_globals._saveData->data[svField121] = 1; + _vm->_globals._saveData->data[svField352] = 1; + _vm->_globals._saveData->data[svField353] = 1; + _vm->_globals._saveData->data[svField354] = 1; } if (v76 == 56) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 1; - _vm->_globals.SAUVEGARDE->data[svField122] = 1; + _vm->_globals._saveData->data[svField122] = 1; _vm->_globals.HOPKINS_DATA(); _vm->_objectsManager._sprite[0].field12 = 28; _vm->_objectsManager._sprite[0].field14 = 155; @@ -1955,7 +1955,7 @@ LABEL_1141: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _vm->_globals.PERSO_TYPE = 0; - _vm->_globals.SAUVEGARDE->data[svField122] = 0; + _vm->_globals._saveData->data[svField122] = 0; _vm->_globals.HOPKINS_DATA(); _vm->_objectsManager._sprite[0].field12 = 34; _vm->_objectsManager._sprite[0].field14 = 190; @@ -1966,13 +1966,13 @@ LABEL_1141: if (v76 == 26) _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); if (v76 == 87) { - if (_vm->_globals.SAUVEGARDE->data[svField188]) + if (_vm->_globals._saveData->data[svField188]) _vm->_talkManager.PARLER_PERSO("stand2.pe2"); else _vm->_talkManager.PARLER_PERSO("stand1.pe2"); } if (v76 == 86) { - if (_vm->_globals.SAUVEGARDE->data[svField231] == 1) { + if (_vm->_globals._saveData->data[svField231] == 1) { _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); } else { _vm->_globals.NOPARLE = true; @@ -2007,7 +2007,7 @@ LABEL_1141: _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = true; - _vm->_globals.SORTIE = 20; + _vm->_globals._exitId = 20; } if (v76 == 41) _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); @@ -2026,13 +2026,13 @@ LABEL_1141: if (v76 == 21) _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); if (v76 == 94) { - if (!_vm->_globals.SAUVEGARDE->data[svField228]) + if (!_vm->_globals._saveData->data[svField228]) _vm->_talkManager.PARLER_PERSO("flicn.pe2"); - if (_vm->_globals.SAUVEGARDE->data[svField228] == 1) + if (_vm->_globals._saveData->data[svField228] == 1) _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); } if (v76 == 27) { - if (_vm->_globals.SAUVEGARDE->data[svField94] != 1 || _vm->_globals.SAUVEGARDE->data[svField95] != 1) + if (_vm->_globals._saveData->data[svField94] != 1 || _vm->_globals._saveData->data[svField95] != 1) _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); else _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); @@ -2040,8 +2040,8 @@ LABEL_1141: if (v76 == 58) { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); - _vm->_globals.SAUVEGARDE->data[svField176] = 1; - _vm->_globals.SAUVEGARDE->data[svField270] = 2; + _vm->_globals._saveData->data[svField176] = 1; + _vm->_globals._saveData->data[svField270] = 2; _vm->_globals.NOPARLE = false; } if (v76 == 200) { @@ -2146,7 +2146,7 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); if (v76 == 243) { _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); - if (_vm->_globals.SAUVEGARDE->data[svField341] == 2) { + if (_vm->_globals._saveData->data[svField341] == 2) { _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); _vm->_animationManager.NO_SEQ = false; @@ -2159,21 +2159,21 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; - CharacterLocation *v53 = &_vm->_globals.SAUVEGARDE->_samantha; + CharacterLocation *v53 = &_vm->_globals._saveData->_samantha; v53->_pos.x = 404; v53->_pos.y = 395; v53->field2 = 64; - v53->_location = _vm->_globals.ECRAN; + v53->_location = _vm->_globals._screenId; int v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; v76 = -(100 * (67 - (100 - v54)) / 67); v53->field4 = v76; - _vm->_globals.SAUVEGARDE->data[svField357] = 1; - _vm->_globals.SAUVEGARDE->data[svField354] = 0; - _vm->_globals.SAUVEGARDE->data[svField356] = 0; - _vm->_globals.SAUVEGARDE->data[svField355] = 1; + _vm->_globals._saveData->data[svField357] = 1; + _vm->_globals._saveData->data[svField354] = 0; + _vm->_globals._saveData->data[svField356] = 0; + _vm->_globals._saveData->data[svField355] = 1; _vm->_objectsManager.DEUXPERSO = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); @@ -2185,7 +2185,7 @@ LABEL_1141: _vm->_globals.ZONEP[4]._destX = 276; _vm->_objectsManager.VERBE_ON(4, 19); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); - _vm->_globals.SAUVEGARDE->data[svField399] = 1; + _vm->_globals._saveData->data[svField399] = 1; } if (v76 == 246) { _vm->_objectsManager.removeSprite(0); @@ -2198,7 +2198,7 @@ LABEL_1141: _vm->_graphicsManager.NOFADE = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.PERSO_ON = false; - _vm->_globals.SORTIE = 100; + _vm->_globals._exitId = 100; } if (v76 == 55) { _vm->_objectsManager.stopBobAnimation(1); @@ -2232,7 +2232,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_globals.SORTIE = 59; + _vm->_globals._exitId = 59; } if (v76 == 173) { _vm->_globals.NOPARLE = true; @@ -2256,7 +2256,7 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_globals.SORTIE = 59; + _vm->_globals._exitId = 59; } if (v76 == 174) _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); @@ -2271,11 +2271,11 @@ LABEL_1141: v1 = 4; if (*(a1 + 2) == 'V' && *(a1 + 3) == 'A' && *(a1 + 4) == 'L') { v1 = 1; - _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] = (int16)READ_LE_UINT16(a1 + 7); + _vm->_globals._saveData->data[(int16)READ_LE_UINT16(a1 + 5)] = (int16)READ_LE_UINT16(a1 + 7); } if (*(a1 + 2) == 'A' && *(a1 + 3) == 'D' && *(a1 + 4) == 'D') { v1 = 1; - _vm->_globals.SAUVEGARDE->data[(int16)READ_LE_UINT16(a1 + 5)] += *(a1 + 7); + _vm->_globals._saveData->data[(int16)READ_LE_UINT16(a1 + 5)] += *(a1 + 7); } if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'S') { v1 = 1; @@ -2314,28 +2314,16 @@ LABEL_1141: } -int ScriptManager::Control_Goto(const byte *dataP) { +int ScriptManager::handleGoto(const byte *dataP) { return (int16)READ_LE_UINT16(dataP + 5); } -int ScriptManager::Control_If(const byte *dataP, int a2) { +int ScriptManager::handleIf(const byte *dataP, int a2) { int v2; int v3; int v4; - int v5; int v6; - int v7; - const byte *v8; - int v9; - int v10; - int v11; - int v12; - int v14; - int v15; - int v16; - int v17; - int v18; - int v19; + bool v7; int v20; v2 = a2; @@ -2347,99 +2335,71 @@ LABEL_2: ++v3; v4 = Traduction2(dataP + 20 * v3); - if (v3 > 400) { - v5 = v4; + if (v3 > 400) error("Control if failed"); - v4 = v5; - } } while (v4 != 4); v20 = v3; v6 = v2; - v7 = 0; + v7 = false; do { if (_vm->shouldQuit()) return 0; // Exiting game ++v6; if (Traduction2(dataP + 20 * v6) == 3) - v7 = 1; + v7 = true; if (v6 > 400) error("Control if failed "); - if (v7 == 1) { + if (v7) { v2 = v20; goto LABEL_2; } } while (v20 != v6); - v8 = dataP + 20 * a2; - v9 = *(v8 + 13); - v17 = *(v8 + 14); - v16 = *(v8 + 15); - v10 = (int16)READ_LE_UINT16(v8 + 5); - v11 = (int16)READ_LE_UINT16(v8 + 7); - v19 = (int16)READ_LE_UINT16(v8 + 9); - v18 = (int16)READ_LE_UINT16(v8 + 11); - v14 = 0; - v15 = 0; - if (v9 == 1 && _vm->_globals.SAUVEGARDE->data[v10] == v11) - v14 = 1; - if (v9 == 2 && _vm->_globals.SAUVEGARDE->data[v10] != v11) - v14 = 1; - if (v9 == 3 && _vm->_globals.SAUVEGARDE->data[v10] <= v11) - v14 = 1; - if (v9 == 4 && _vm->_globals.SAUVEGARDE->data[v10] >= v11) - v14 = 1; - if (v9 == 5 && _vm->_globals.SAUVEGARDE->data[v10] > v11) - v14 = 1; - if (v9 == 6 && _vm->_globals.SAUVEGARDE->data[v10] < v11) - v14 = 1; - if (v16 == 3) - goto LABEL_68; - if (v17 == 1 && v18 == _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 2 && v18 != _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 3 && v18 >= _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 4 && v18 <= _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 5 && v18 < _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v17 == 6 && v18 > _vm->_globals.SAUVEGARDE->data[v19]) - v15 = 1; - if (v16 == 3) { -LABEL_68: - if (v14 == 1) { - v12 = a2; - return (v12 + 1); - } - if (!v14) { -LABEL_63: - v12 = v20; - return (v12 + 1); - } - } - if (v16 == 1) { - if (v14 == 1 && v15 == 1) { - v12 = a2; - return (v12 + 1); - } - goto LABEL_63; + + const byte *buf = dataP + 20 * a2; + byte oper = buf[13]; + byte oper2 = buf[14]; + byte operType = buf[15]; + int saveDataIdx1 = (int16)READ_LE_UINT16(buf + 5); + int compVal1 = (int16)READ_LE_UINT16(buf + 7); + bool check1Fl = false; + if ((oper == 1 && _vm->_globals._saveData->data[saveDataIdx1] == compVal1) || + (oper == 2 && _vm->_globals._saveData->data[saveDataIdx1] != compVal1) || + (oper == 3 && _vm->_globals._saveData->data[saveDataIdx1] <= compVal1) || + (oper == 4 && _vm->_globals._saveData->data[saveDataIdx1] >= compVal1) || + (oper == 5 && _vm->_globals._saveData->data[saveDataIdx1] > compVal1) || + (oper == 6 && _vm->_globals._saveData->data[saveDataIdx1] < compVal1)) + check1Fl = true; + + bool check2Fl = false; + if (operType != 3) { + int saveDataIdx2 = (int16)READ_LE_UINT16(buf + 9); + int compVal2 = (int16)READ_LE_UINT16(buf + 11); + if ((oper2 == 1 && compVal2 == _vm->_globals._saveData->data[saveDataIdx2]) || + (oper2 == 2 && compVal2 != _vm->_globals._saveData->data[saveDataIdx2]) || + (oper2 == 3 && compVal2 >= _vm->_globals._saveData->data[saveDataIdx2]) || + (oper2 == 4 && compVal2 <= _vm->_globals._saveData->data[saveDataIdx2]) || + (oper2 == 5 && compVal2 < _vm->_globals._saveData->data[saveDataIdx2]) || + (oper2 == 6 && compVal2 > _vm->_globals._saveData->data[saveDataIdx2])) + check2Fl = true; } - if (v16 == 2) { - if (v14 == 1 || v15 == 1) { - v12 = a2; - return (v12 + 1); - } - goto LABEL_63; + + if ((operType == 3) && check1Fl) { + return (a2 + 1); + } else if ((operType == 1) && check1Fl && check2Fl) { + return (a2 + 1); + } else if ((operType == 2) && (check1Fl || check2Fl)) { + return (a2 + 1); } - return -1; + + return (v20 + 1); } int ScriptManager::Traduction2(const byte *dataP) { int16 result; result = 0; - if (*dataP != 'F' || *(dataP + 1) != 'C') { + if (dataP[0] != 'F' || dataP[1] != 'C') { result = 0; } else { if (*(dataP + 'T') == 84 && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index d3edf98975..50b74e778f 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -41,8 +41,8 @@ public: int Traduction(byte *a1); int Traduction2(const byte *dataP); - int Control_Goto(const byte *dataP); - int Control_If(const byte *dataP, int a2); + int handleGoto(const byte *dataP); + int handleIf(const byte *dataP, int a2); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2961e3eba2..add8ecface 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -76,7 +76,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } - _vm->_globals.SAUVEGARDE->data[svField4] = 0; + _vm->_globals._saveData->data[svField4] = 0; RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer); RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); @@ -189,7 +189,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } - _vm->_globals.SAUVEGARDE->data[svField4] = 0; + _vm->_globals._saveData->data[svField4] = 0; RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); @@ -427,7 +427,7 @@ int TalkManager::DIALOGUE_REP(int idx) { v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9); if (v7) - _vm->_globals.SAUVEGARDE->data[svField4] = v7; + _vm->_globals._saveData->data[svField4] = v7; if (!v6) v6 = 10; @@ -1009,9 +1009,9 @@ LABEL_2: return; if (v10 == 2) - v13 = _vm->_scriptManager.Control_Goto(ptr + 20 * v13); + v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); else if (v10 == 3) - v13 = _vm->_scriptManager.Control_If(ptr, v13); + v13 = _vm->_scriptManager.handleIf(ptr, v13); if (v13 == -1) error("Invalid IFF function"); @@ -1028,7 +1028,7 @@ LABEL_2: } } while (!loopCond); _vm->_globals.freeMemory(ptr); - _vm->_globals.SAUVEGARDE->data[svField2] = 0; + _vm->_globals._saveData->data[svField2] = 0; return; } } @@ -1037,7 +1037,7 @@ LABEL_2: void TalkManager::REPONSE2(int a1, int a2) { int indx = 0; - if (a2 == 5 && _vm->_globals.SAUVEGARDE->data[svField3] == 4) { + if (a2 == 5 && _vm->_globals._saveData->data[svField3] == 4) { if (a1 == 22 || a1 == 23) { _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); @@ -1060,7 +1060,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.stopBobAnimation(6); _vm->_objectsManager.setBobAnimation(8); - switch (_vm->_globals.ECRAN) { + switch (_vm->_globals._screenId) { case 35: indx = 201; break; @@ -1083,7 +1083,7 @@ void TalkManager::REPONSE2(int a1, int a2) { indx = 213; break; } - _vm->_globals.SAUVEGARDE->data[indx] = 2; + _vm->_globals._saveData->data[indx] = 2; _vm->_objectsManager.ZONE_OFF(22); _vm->_objectsManager.ZONE_OFF(23); } else if (a1 == 20 || a1 == 21) { @@ -1107,7 +1107,7 @@ void TalkManager::REPONSE2(int a1, int a2) { while (_vm->_objectsManager.BOBPOSI(5) < 12); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(7); - switch (_vm->_globals.ECRAN) { + switch (_vm->_globals._screenId) { case 35: indx = 200; break; @@ -1130,7 +1130,7 @@ void TalkManager::REPONSE2(int a1, int a2) { indx = 212; break; } - _vm->_globals.SAUVEGARDE->data[indx] = 2; + _vm->_globals._saveData->data[indx] = 2; _vm->_objectsManager.ZONE_OFF(21); _vm->_objectsManager.ZONE_OFF(20); } @@ -1177,7 +1177,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { v5 = 5; if (v20 == "NULL") - v20 = Common::String::format("IM%d", _vm->_globals.ECRAN); + v20 = Common::String::format("IM%d", _vm->_globals._screenId); _characterSprite = _vm->_fileManager.searchCat(v23, 7); if (_characterSprite) @@ -1228,7 +1228,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (_vm->_globals.GOACTION) _vm->_objectsManager.PARADISE(); _vm->_eventsManager.VBL(); - } while (!_vm->_globals.SORTIE); + } while (!_vm->_globals._exitId); FIN_VISU_PARLE(); FIN_VISU_WAIT(); clearCharacterAnim(); @@ -1252,8 +1252,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.INI_ECRAN2(v20); _vm->_objectsManager.DESACTIVE = false; _vm->_globals.NOMARCHE = false; - if (_vm->_globals.SORTIE == 101) - _vm->_globals.SORTIE = 0; + if (_vm->_globals._exitId == 101) + _vm->_globals._exitId = 0; _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); -- cgit v1.2.3 From 9333f6628a71fd24c82832aa629fa02ab8b11d07 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 13:45:29 +0100 Subject: HOPKINS: Fix very old bug in traduction2 --- engines/hopkins/script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index febc293016..9dba2ea849 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2402,7 +2402,7 @@ int ScriptManager::Traduction2(const byte *dataP) { if (dataP[0] != 'F' || dataP[1] != 'C') { result = 0; } else { - if (*(dataP + 'T') == 84 && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') + if (*(dataP + 2) == 'T' && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') result = 1; if (*(dataP + 2) == 'B') { if (*(dataP + 3) == 'O' && *(dataP + 4) == 'B') -- cgit v1.2.3 From 74e3e45732aede72dbf171a890f013646c8ef95b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 14:42:47 +0100 Subject: HOPKINS: Refactor checkSignature --- engines/hopkins/script.cpp | 117 +++++++++++++++++---------------------------- engines/hopkins/script.h | 2 +- 2 files changed, 46 insertions(+), 73 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 9dba2ea849..8b6642da46 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2334,10 +2334,10 @@ LABEL_2: return 0; // Exiting game ++v3; - v4 = Traduction2(dataP + 20 * v3); + v4 = checkSignature(dataP + 20 * v3); if (v3 > 400) error("Control if failed"); - } while (v4 != 4); + } while (v4 != 4); // EIF v20 = v3; v6 = v2; v7 = false; @@ -2346,7 +2346,7 @@ LABEL_2: return 0; // Exiting game ++v6; - if (Traduction2(dataP + 20 * v6) == 3) + if (checkSignature(dataP + 20 * v6) == 3) // IIF v7 = true; if (v6 > 400) error("Control if failed "); @@ -2395,76 +2395,49 @@ LABEL_2: return (v20 + 1); } -int ScriptManager::Traduction2(const byte *dataP) { - int16 result; - - result = 0; +int ScriptManager::checkSignature(const byte *dataP) { if (dataP[0] != 'F' || dataP[1] != 'C') { - result = 0; - } else { - if (*(dataP + 2) == 'T' && *(dataP + 3) == 'X' && *(dataP + 4) == 'T') - result = 1; - if (*(dataP + 2) == 'B') { - if (*(dataP + 3) == 'O' && *(dataP + 4) == 'B') - result = 1; - if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') - result = 1; - } - if (*(dataP + 2) == 'P' && *(dataP + 3) == 'E' && *(dataP + 4) == 'R') - result = 1; - if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'U') - result = 1; - if (*(dataP + 2) == 'M' && *(dataP + 3) == 'U' && *(dataP + 4) == 'S') - result = 1; - if (*(dataP + 2) == 'O') { - if (*(dataP + 3) == 'B' && *(dataP + 4) == 'P') - result = 1; - if (*(dataP + 2) == 'O' && *(dataP + 3) == 'B' && *(dataP + 4) == 'M') - result = 1; - } - if (*(dataP + 2) == 'G' && *(dataP + 3) == 'O' && *(dataP + 4) == 'T') - result = 2; - if (*(dataP + 2) == 'Z') { - if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') - result = 1; - if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') - result = 1; - } - if (*(dataP + 2) == 'E' && *(dataP + 3) == 'X' && *(dataP + 4) == 'I') - result = 5; - if (*(dataP + 2) == 'S' && *(dataP + 3) == 'O' && *(dataP + 4) == 'R') - result = 5; - if (*(dataP + 2) == 'A' && *(dataP + 3) == 'N' && *(dataP + 4) == 'I') - result = 1; - if (*(dataP + 2) == 'S' && *(dataP + 3) == 'P' && *(dataP + 4) == 'E') - result = 1; - if (*(dataP + 2) == 'E' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') - result = 4; - if (*(dataP + 2) == 'V') { - if (*(dataP + 3) == 'A' && *(dataP + 4) == 'L') - result = 1; - if (*(dataP + 2) == 'V') { - if (*(dataP + 3) == 'O' && *(dataP + 4) == 'N') - result = 1; - if (*(dataP + 2) == 'V' && *(dataP + 3) == 'O' && *(dataP + 4) == 'F') - result = 1; - } - } - if (*(dataP + 2) == 'I' && *(dataP + 3) == 'I' && *(dataP + 4) == 'F') - result = 3; - if (*(dataP + 2) == 'J' && *(dataP + 3) == 'U' && *(dataP + 4) == 'M') - result = 6; - if (*(dataP + 2) == 'B') { - if (*(dataP + 3) == 'C' && *(dataP + 4) == 'A') - result = 1; - if (*(dataP + 2) == 'B' && *(dataP + 3) == 'O' && *(dataP + 4) == 'S') - result = 1; - } - if (*(dataP + 2) == 'Z' && *(dataP + 3) == 'C') { - if (*(dataP + 4) == 'H') - result = 1; - } - } + return 0; + } + + int result = 0; + + if ((dataP[2] == 'A' && dataP[3] == 'N' && dataP[4] == 'I') || + (dataP[2] == 'B' && dataP[3] == 'C' && dataP[4] == 'A') || + (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') || + (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') || + (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') || + (dataP[2] == 'M' && dataP[3] == 'U' && dataP[4] == 'S') || + (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'M') || + (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'P') || + (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') || + (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') || + (dataP[2] == 'S' && dataP[3] == 'P' && dataP[4] == 'E') || + (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') || + (dataP[2] == 'V' && dataP[3] == 'A' && dataP[4] == 'L') || + (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') || + (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'N') || + (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') || + (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') || + (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N')) + result = 1; + + if (dataP[2] == 'G' && dataP[3] == 'O' && dataP[4] == 'T') + result = 2; + + if (dataP[2] == 'I' && dataP[3] == 'I' && dataP[4] == 'F') + result = 3; + + if (dataP[2] == 'E' && dataP[3] == 'I' && dataP[4] == 'F') + result = 4; + + if ((dataP[2] == 'E' && dataP[3] == 'X' && dataP[4] == 'I') || + (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'R')) + result = 5; + + if (dataP[2] == 'J' && dataP[3] == 'U' && dataP[4] == 'M') + result = 6; + return result; } diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index 50b74e778f..9bb9c3e1fa 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -40,7 +40,7 @@ public: void setParent(HopkinsEngine *vm); int Traduction(byte *a1); - int Traduction2(const byte *dataP); + int checkSignature(const byte *dataP); int handleGoto(const byte *dataP); int handleIf(const byte *dataP, int a2); }; -- cgit v1.2.3 From 1c5a6f8c74a794e9a913c9b2c0bebfd59ac0fd9e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 18:24:08 +0100 Subject: HOPKINS: Start refactoring handleOpcode --- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/objects.cpp | 2 +- engines/hopkins/script.cpp | 2010 +++++++++++++++++++++++------------------- engines/hopkins/script.h | 4 +- engines/hopkins/talk.cpp | 2 +- 5 files changed, 1085 insertions(+), 935 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index cb4abd9d9d..832f0c97d4 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1966,7 +1966,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { int dataOffset = 1; do { - int dataVal1 = _vm->_scriptManager.Traduction(ptr + 20 * dataOffset); + int dataVal1 = _vm->_scriptManager.handleOpcode(ptr + 20 * dataOffset); if (_vm->shouldQuit()) return; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index cb054842c6..118fcc3419 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3967,7 +3967,7 @@ void ObjectsManager::OPTI_OBJET() { } else { v7 = 0; do { - v5 = _vm->_scriptManager.Traduction(data + 20 * v0); + v5 = _vm->_scriptManager.handleOpcode(data + 20 * v0); if (_vm->shouldQuit()) return; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 8b6642da46..a93133fa13 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -42,19 +42,20 @@ void ScriptManager::setParent(HopkinsEngine *vm) { _vm = vm; } -int ScriptManager::Traduction(byte *a1) { - int v1 = 0; - int v70 = 0; - if (*a1 != 'F' || *(a1 + 1) != 'C') +int ScriptManager::handleOpcode(byte *dataP) { + if (dataP[0] != 'F' || dataP[1] != 'C') return 0; - if (*(a1 + 2) == 'T' && *(a1 + 3) == 'X' && *(a1 + 4) == 'T') { - v70 = *(a1 + 6); - int v2 = *(a1 + 7); - int v69 = *(a1 + 8); - int v67 = (int16)READ_LE_UINT16(a1 + 9); - int v65 = (int16)READ_LE_UINT16(a1 + 11); - int mesgId = (int16)READ_LE_UINT16(a1 + 13); - v1 = 1; + + int opcodeType = 0; + int v70 = 0; + if (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') { + v70 = *(dataP + 6); + byte v2 = dataP[7]; + byte v69 = dataP[8]; + int v67 = (int16)READ_LE_UINT16(dataP + 9); + int v65 = (int16)READ_LE_UINT16(dataP + 11); + int mesgId = (int16)READ_LE_UINT16(dataP + 13); + opcodeType = 1; if (!TRAVAILOBJET) { if (_vm->_globals._saveData->data[svField356] == 1) { if (mesgId == 53) @@ -162,17 +163,15 @@ int ScriptManager::Traduction(byte *a1) { _vm->_soundManager.mixVoice(mesgId, 5); } } - } - - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { + } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') { if (_vm->_objectsManager.DESACTIVE != true) { - int v72 = *(a1 + 5); - v70 = *(a1 + 6); - int v4 = *(a1 + 7); - int v68 = (int16)READ_LE_UINT16(a1 + 8); - int v66 = (int16)READ_LE_UINT16(a1 + 10); + int v72 = *(dataP + 5); + v70 = *(dataP + 6); + int v4 = *(dataP + 7); + int v68 = (int16)READ_LE_UINT16(dataP + 8); + int v66 = (int16)READ_LE_UINT16(dataP + 10); if (v72 == 52) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(a1 + 10), v70); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(dataP + 10), v70); } else if (v72 == 51) { _vm->_objectsManager.BOB_VIVANT(v70); } else { @@ -195,15 +194,13 @@ LABEL_1141: _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); } } - v1 = 1; - } - if (*(a1 + 2) == 'S') { - if (*(a1 + 3) == 'T' && *(a1 + 4) == 'P') { - if (_vm->_objectsManager.DESACTIVE != true) { + opcodeType = 1; + } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { + if (!_vm->_objectsManager.DESACTIVE) { _vm->_objectsManager.DEUXPERSO = false; - int v5 = *(a1 + 5); - int v6 = (int16)READ_LE_UINT16(a1 + 8); - _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(a1 + 6); + int v5 = *(dataP + 5); + int v6 = (int16)READ_LE_UINT16(dataP + 8); + _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(dataP + 6); _vm->_objectsManager.PERY = v6; _vm->_objectsManager.PERI = v5; if (_vm->_objectsManager.CH_TETE == 1) { @@ -260,37 +257,33 @@ LABEL_1141: _vm->_objectsManager.DEUXPERSO = true; } } - v1 = 1; + opcodeType = 1; _vm->_objectsManager.CH_TETE = 0; - } - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'T' && *(a1 + 4) == 'E') { - if (_vm->_objectsManager.DESACTIVE != true) { - int v7 = *(a1 + 5); - v70 = *(a1 + 6); - int v8 = *(a1 + 7); - int v9 = *(a1 + 8); - _vm->_objectsManager.RECALL = 0; - _vm->_globals.OLD_ECRAN = _vm->_globals._screenId; - _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; - _vm->_globals._screenId = v7; - _vm->_globals._saveData->data[svField5] = v7; - _vm->_objectsManager.PTAILLE = v70; - _vm->_objectsManager.PEROFX = v8; - _vm->_objectsManager.PEROFY = v9; - } - v1 = 1; - } - } - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { + } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { + if (_vm->_objectsManager.DESACTIVE != true) { + int v7 = *(dataP + 5); + v70 = *(dataP + 6); + int v8 = *(dataP + 7); + int v9 = *(dataP + 8); + _vm->_objectsManager.RECALL = 0; + _vm->_globals.OLD_ECRAN = _vm->_globals._screenId; + _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; + _vm->_globals._screenId = v7; + _vm->_globals._saveData->data[svField5] = v7; + _vm->_objectsManager.PTAILLE = v70; + _vm->_objectsManager.PEROFX = v8; + _vm->_objectsManager.PEROFY = v9; + } + opcodeType = 1; + } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') { if (_vm->_objectsManager.DESACTIVE != true) - _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - if (*(a1 + 2) == 'P' && *(a1 + 3) == 'E' && *(a1 + 4) == 'R') { - int v73 = (int16)READ_LE_UINT16(a1 + 5); + _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(dataP + 5)); + opcodeType = 1; + } else if (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') { + int v73 = (int16)READ_LE_UINT16(dataP + 5); if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { v70 = 0; - if ((int16)READ_LE_UINT16(a1 + 5) == 14) + if ((int16)READ_LE_UINT16(dataP + 5) == 14) v73 = 1; if (v73 == 17) v73 = 7; @@ -467,12 +460,11 @@ LABEL_1141: _vm->_objectsManager.ACTION_GAUCHE(8); } } - v1 = 1; - } - if (*(a1 + 2) == 'M' && *(a1 + 3) == 'U' && *(a1 + 4) == 'S') - v1 = 1; - if (*(a1 + 2) == 'W' && *(a1 + 3) == 'A' && *(a1 + 4) == 'I') { - uint v74 = READ_LE_UINT16(a1 + 5) / _vm->_globals._speed; + opcodeType = 1; + } else if (dataP[2] == 'M' && dataP[3] == 'U' && dataP[4] == 'S') { + opcodeType = 1; + } else if (dataP[2] == 'W' && dataP[3] == 'A' && dataP[4] == 'I') { + uint v74 = READ_LE_UINT16(dataP + 5) / _vm->_globals._speed; if (!v74) v74 = 1; for (uint v10 = 0; v10 < v74 + 1; v10++) { @@ -481,206 +473,67 @@ LABEL_1141: _vm->_eventsManager.VBL(); } - v1 = 1; - } - if (*(a1 + 2) == 'O') { - if (*(a1 + 3) == 'B' && *(a1 + 4) == 'P') { - v1 = 1; - _vm->_objectsManager.addObject((int16)READ_LE_UINT16(a1 + 5)); - } - if (*(a1 + 2) == 'O' && *(a1 + 3) == 'B' && *(a1 + 4) == 'M') { - v1 = 1; - _vm->_objectsManager.removeObject((int16)READ_LE_UINT16(a1 + 5)); - } - } - if (*(a1 + 2) == 'G' && *(a1 + 3) == 'O' && *(a1 + 4) == 'T') - v1 = 2; - if (*(a1 + 2) == 'Z') { - if (*(a1 + 3) == 'O' && *(a1 + 4) == 'N') { - _vm->_objectsManager.ZONE_ON((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - _vm->_objectsManager.ZONE_OFF((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - } - if (*(a1 + 2) == 'E' && *(a1 + 3) == 'X' && *(a1 + 4) == 'I') - v1 = 5; - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'R') { - _vm->_globals._exitId = (int16)READ_LE_UINT16(a1 + 5); - v1 = 5; - } - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'C' && *(a1 + 4) == 'A') { - _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(a1 + 5)); - v1 = 1; - } - if (*(a1 + 2) == 'A' && *(a1 + 3) == 'N' && *(a1 + 4) == 'I') { - int v75 = (int16)READ_LE_UINT16(a1 + 5); + opcodeType = 1; + } else if (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'P') { + opcodeType = 1; + _vm->_objectsManager.addObject((int16)READ_LE_UINT16(dataP + 5)); + } else if (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'M') { + opcodeType = 1; + _vm->_objectsManager.removeObject((int16)READ_LE_UINT16(dataP + 5)); + } else if (dataP[2] == 'G' && dataP[3] == 'O' && dataP[4] == 'T') { + opcodeType = 2; + } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N') { + _vm->_objectsManager.ZONE_ON((int16)READ_LE_UINT16(dataP + 5)); + opcodeType = 1; + } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') { + _vm->_objectsManager.ZONE_OFF((int16)READ_LE_UINT16(dataP + 5)); + opcodeType = 1; + } else if (dataP[2] == 'E' && dataP[3] == 'X' && dataP[4] == 'I') { + opcodeType = 5; + } else if (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'R') { + _vm->_globals._exitId = (int16)READ_LE_UINT16(dataP + 5); + opcodeType = 5; + } else if (dataP[2] == 'B' && dataP[3] == 'C' && dataP[4] == 'A') { + _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(dataP + 5)); + opcodeType = 1; + } else if (dataP[2] == 'A' && dataP[3] == 'N' && dataP[4] == 'I') { + int v75 = (int16)READ_LE_UINT16(dataP + 5); if (v75 <= 100) _vm->_objectsManager.setBobAnimation(v75); else _vm->_objectsManager.stopBobAnimation(v75 - 100); - v1 = 1; - } - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'P' && *(a1 + 4) == 'E') { - int v76 = (int16)READ_LE_UINT16(a1 + 5); - if (v76 == 7) - _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); - if (v76 == 8) - _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); - if (v76 == 6) { + opcodeType = 1; + } else if (dataP[2] == 'S' && dataP[3] == 'P' && dataP[4] == 'E') { + switch ((int16)READ_LE_UINT16(dataP + 5)) { + case 6: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_ONE(20, 0, 14, 4); - } - if (v76 == 12) { + break; + + case 7: + _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); + break; + + case 8: + _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); + break; + + case 10: + _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); + break; + + case 11: + _vm->_talkManager.PARLER_PERSO("bqeflic2.pe2"); + break; + + case 12: _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); - } - if (v76 == 600) { - if (!_vm->_globals._internetFl) { - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_graphicsManager.FADESPD = 1; - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); - else if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE1.ANM", 100, 18, 100); - } - _vm->_graphicsManager.loadImage("BOMBEB"); - _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.OPTI_INI("BOMBE", 2); - _vm->_graphicsManager.FADE_INS(); - } - if (v76 == 601) { - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.OPTI_ONE(2, 0, 16, 4); - } - if (v76 == 602) { - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.OPTI_ONE(4, 0, 16, 4); - } - if (v76 == 603) { - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); - _vm->_soundManager.SPECIAL_SOUND = 199; - _vm->_graphicsManager.FADE_LINUX = 2; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - _vm->_graphicsManager.NOFADE = true; - _vm->_globals._exitId = 151; - } - if (v76 == 604) { - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); - _vm->_soundManager.SPECIAL_SOUND = 199; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = true; - memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - _vm->_globals._exitId = 151; - } - if (v76 == 605) { - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); - _vm->_graphicsManager.FADE_OUTS(); - _vm->_soundManager.SPECIAL_SOUND = 199; - _vm->_graphicsManager.FADE_LINUX = 2; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = true; - memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - _vm->_globals._exitId = 151; - } - if (v76 == 606) { - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); - if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE3.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); - memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - } - _vm->_globals._exitId = 6; - } - if (v76 == 607) { - if (!_vm->_globals._internetFl) { - memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); - v1 = _vm->_graphicsManager._oldPalette[769]; - _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); - } - _vm->_globals.NBBLOC = 0; - } - if (v76 == 608) { - _vm->_objectsManager.stopBobAnimation(2); - _vm->_objectsManager.stopBobAnimation(3); - _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.stopBobAnimation(6); - _vm->_objectsManager.stopBobAnimation(11); - _vm->_objectsManager.stopBobAnimation(10); - } - if (v76 == 609) { - _vm->_objectsManager.setBobAnimation(2); - _vm->_objectsManager.setBobAnimation(3); - _vm->_objectsManager.setBobAnimation(4); - _vm->_objectsManager.setBobAnimation(6); - _vm->_objectsManager.setBobAnimation(11); - _vm->_objectsManager.setBobAnimation(10); - } - if (v76 == 611) { - _vm->_objectsManager.setBobAnimation(5); - _vm->_objectsManager.setBobAnimation(7); - _vm->_objectsManager.setBobAnimation(8); - _vm->_objectsManager.setBobAnimation(9); - _vm->_objectsManager.setBobAnimation(12); - _vm->_objectsManager.setBobAnimation(13); - } - if (v76 == 610) { - _vm->_objectsManager.stopBobAnimation(5); - _vm->_objectsManager.stopBobAnimation(7); - _vm->_objectsManager.stopBobAnimation(8); - _vm->_objectsManager.stopBobAnimation(9); - _vm->_objectsManager.stopBobAnimation(12); - _vm->_objectsManager.stopBobAnimation(13); - } - if (v76 == 10) - _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); - if (v76 == 11) - _vm->_talkManager.PARLER_PERSO("bqeflic2.pe2"); - if (v76 == 16) - _vm->_talkManager.PARLER_PERSO("ftoubib.pe2"); - if (v76 == 17) - _vm->_talkManager.PARLER_PERSO("flic2b.pe2"); - if (v76 == 18) - _vm->_talkManager.PARLER_PERSO("fjour.pe2"); - if (v76 == 13) { + break; + + case 13: _vm->_eventsManager._mouseButton = _vm->_eventsManager._curMouseButton; _vm->_globals._disableInventFl = true; _vm->_graphicsManager.FADE_OUTW(); @@ -759,8 +612,74 @@ LABEL_1141: _vm->_globals._disableInventFl = false; _vm->_globals.HELICO = 1; - } - if (v76 == 36) { + break; + + case 16: + _vm->_talkManager.PARLER_PERSO("ftoubib.pe2"); + break; + + case 17: + _vm->_talkManager.PARLER_PERSO("flic2b.pe2"); + break; + + case 18: + _vm->_talkManager.PARLER_PERSO("fjour.pe2"); + break; + + case 20: + _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); + break; + + case 21: + _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); + break; + + case 22: + _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); + break; + + case 23: + _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); + break; + + case 25: + _vm->_talkManager.PARLER_PERSO("AGENT1.pe2"); + break; + + case 26: + _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); + break; + + case 27: + if (_vm->_globals._saveData->data[svField94] != 1 || _vm->_globals._saveData->data[svField95] != 1) + _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); + else + _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); + break; + + case 29: + _vm->_globals._disableInventFl = true; + _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); + _vm->_globals._disableInventFl = false; + break; + + case 32: + _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); + break; + + case 35: + if (!_vm->_soundManager.SOUNDOFF) { + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + _vm->_eventsManager.VBL(); + } while (_vm->_soundManager.SOUND_FLAG); + } + _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); + break; + + case 36: if (_vm->_globals._saveData->data[svField270] == 2 && _vm->_globals._saveData->data[svField94] == 1 && _vm->_globals._saveData->data[svField95] == 1) _vm->_globals._saveData->data[svField270] = 3; if (!_vm->_globals._saveData->data[svField270]) @@ -775,13 +694,15 @@ LABEL_1141: _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); _vm->_globals._saveData->data[svField270] = 5; } - } - if (v76 == 37) { + break; + + case 37: _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playSequence2("corde.SEQ", 32, 32, 100); _vm->_graphicsManager.NOFADE = true; - } - if (v76 == 38) { + break; + + case 38: _vm->_soundManager.loadSample(1, "SOUND44.WAV"); _vm->_soundManager.loadSample(2, "SOUND42.WAV"); _vm->_soundManager.loadSample(3, "SOUND41.WAV"); @@ -794,30 +715,33 @@ LABEL_1141: _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); _vm->_graphicsManager.NOFADE = true; - } - if (v76 == 29) { - _vm->_globals._disableInventFl = true; - _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); - _vm->_globals._disableInventFl = false; - } - if (v76 == 22) - _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); - if (v76 == 20) - _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); - if (v76 == 23) - _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); - if (v76 == 35) { - if (!_vm->_soundManager.SOUNDOFF) { - do { - if (_vm->shouldQuit()) - return -1; // Exiting game + break; - _vm->_eventsManager.VBL(); - } while (_vm->_soundManager.SOUND_FLAG); - } - _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); - } - if (v76 == 46) { + case 40: + _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); + break; + + case 41: + _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); + break; + + case 42: + _vm->_talkManager.PARLER_PERSO("MORT2.pe2"); + break; + + case 43: + _vm->_talkManager.PARLER_PERSO("MORT1.pe2"); + break; + + case 44: + _vm->_talkManager.PARLER_PERSO("MORT3A.pe2"); + break; + + case 45: + _vm->_talkManager.PARLER_PERSO("FEM3.pe2"); + break; + + case 46: { _vm->_globals.NOT_VERIF = 1; _vm->_globals.chemin = (int16 *)g_PTRNUL; int v13 = _vm->_objectsManager.getSpriteY(0); @@ -836,47 +760,47 @@ LABEL_1141: _vm->_soundManager.loadSample(1, "SOUND44.WAV"); _vm->_soundManager.loadSample(2, "SOUND45.WAV"); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - int v15 = 0; + bool v15 = false; do { if (_vm->shouldQuit()) return -1; // Exiting game if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); - v15 = 1; + v15 = true; } if (_vm->_objectsManager.BOBPOSI(9) == 5) - v15 = 0; + v15 = false; if (_vm->_objectsManager.BOBPOSI(9) == 16 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); - v15 = 1; + v15 = true; } if (_vm->_objectsManager.BOBPOSI(9) == 17) - v15 = 0; + v15 = false; if (_vm->_objectsManager.BOBPOSI(9) == 28 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); - v15 = 1; + v15 = true; } if (_vm->_objectsManager.BOBPOSI(9) == 29) - v15 = 0; + v15 = false; if (_vm->_objectsManager.BOBPOSI(10) == 10 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); - v15 = 1; + v15 = true; } if (_vm->_objectsManager.BOBPOSI(10) == 11) - v15 = 0; + v15 = false; if (_vm->_objectsManager.BOBPOSI(10) == 22 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); - v15 = 1; + v15 = true; } if (_vm->_objectsManager.BOBPOSI(10) == 23) - v15 = 0; + v15 = false; if (_vm->_objectsManager.BOBPOSI(10) == 33 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); - v15 = 1; + v15 = true; } if (_vm->_objectsManager.BOBPOSI(10) == 34) - v15 = 0; + v15 = false; if (_vm->_objectsManager.BOBPOSI(10) == 12) _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); if (_vm->_objectsManager.BOBPOSI(10) == 23) @@ -890,17 +814,156 @@ LABEL_1141: _vm->_objectsManager.stopBobAnimation(10); _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); - } - if (v76 == 59) { - _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v16 = _vm->_objectsManager.getSpriteY(0); - int v17 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); - _vm->_globals.NOT_VERIF = 1; + break; + } + + case 47: + _vm->_talkManager.PARLER_PERSO("BARMAN.pe2"); + break; + + case 48: + _vm->_talkManager.PARLER_PERSO("SAMAN2.pe2"); + break; + + case 49: { + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + int v19 = 12; + if (_vm->_globals._saveData->data[svField133] == 1) + v19 = 41; + int v20 = 0; + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); + v20 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 5) + v20 = 0; + if (_vm->_objectsManager.BOBPOSI(9) == 18 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); + v20 = 1; + } + if (_vm->_objectsManager.BOBPOSI(9) == 19) + v20 = 0; + if (_vm->_objectsManager.BOBPOSI(10) == 11 && !v20) { + _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); + v20 = 1; + } + if (_vm->_objectsManager.BOBPOSI(10) == 12) + v20 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(9) != v19); + if (v19 == 12) { + _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.stopBobAnimation(9); + } + _vm->_globals.CACHE_ON(); + break; + } + + case 50: + _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); + _vm->_objectsManager.OPTI_ONE(11, 0, 23, 0); + break; + + case 51: { + _vm->_graphicsManager.FADE_OUTW(); + _vm->_globals.CACHE_OFF(); + _vm->_objectsManager.removeSprite(0); + _vm->_fontManager.hideText(5); + _vm->_fontManager.hideText(9); + _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.loadImage("IM20f"); + _vm->_animationManager.loadAnim("ANIM20f"); + _vm->_graphicsManager.VISU_ALL(); + _vm->_eventsManager.mouseOff(); + _vm->_graphicsManager.FADE_INW(); + bool v52 = false; + _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { + _vm->_soundManager.PLAY_WAV(1); + v52 = true; + } + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(12) != 34); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.NOFADE = true; + _vm->_globals._exitId = 20; + break; + } + + case 52: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); + _vm->_globals.NOPARLE = false; + break; + + case 53: + _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); + break; + + case 54: + _vm->_talkManager.PARLER_PERSO("GARDE2.pe2"); + break; + + case 55: + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.OPTI_ONE(15, 0, 12, 0); + _vm->_objectsManager.stopBobAnimation(15); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM19a"); + _vm->_objectsManager.OBSSEUL = 0; + break; + + case 56: + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO_TYPE = 1; + _vm->_globals._saveData->data[svField122] = 1; + _vm->_globals.HOPKINS_DATA(); + _vm->_objectsManager._sprite[0].field12 = 28; + _vm->_objectsManager._sprite[0].field14 = 155; + _vm->_objectsManager.VERIFTAILLE(); + break; + + case 57: + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO_TYPE = 0; + _vm->_globals._saveData->data[svField122] = 0; + _vm->_globals.HOPKINS_DATA(); + _vm->_objectsManager._sprite[0].field12 = 34; + _vm->_objectsManager._sprite[0].field14 = 190; + _vm->_objectsManager.VERIFTAILLE(); + break; + + case 58: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); + _vm->_globals._saveData->data[svField176] = 1; + _vm->_globals._saveData->data[svField270] = 2; + _vm->_globals.NOPARLE = false; + break; + + case 59: { + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + int v16 = _vm->_objectsManager.getSpriteY(0); + int v17 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); + _vm->_globals.NOT_VERIF = 1; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -939,50 +1002,18 @@ LABEL_1141: _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.stopBobAnimation(7); _vm->_objectsManager.stopBobAnimation(3); - } - if (v76 == 50) { - _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); - _vm->_objectsManager.OPTI_ONE(11, 0, 23, 0); - } - if (v76 == 49) { - _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); - int v19 = 12; - if (_vm->_globals._saveData->data[svField133] == 1) - v19 = 41; - int v20 = 0; - do { - if (_vm->shouldQuit()) - return -1; // Exiting game - - if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); - v20 = 1; - } - if (_vm->_objectsManager.BOBPOSI(9) == 5) - v20 = 0; - if (_vm->_objectsManager.BOBPOSI(9) == 18 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); - v20 = 1; - } - if (_vm->_objectsManager.BOBPOSI(9) == 19) - v20 = 0; - if (_vm->_objectsManager.BOBPOSI(10) == 11 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); - v20 = 1; - } - if (_vm->_objectsManager.BOBPOSI(10) == 12) - v20 = 0; - _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(9) != v19); - if (v19 == 12) { - _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.stopBobAnimation(9); + break; } - _vm->_globals.CACHE_ON(); - } - if (v76 == 80) { + + case 62: + _vm->_talkManager.OBJET_VIVANT("SBCADA.pe2"); + break; + + case 65: + _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); + break; + + case 80: { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(12); _vm->_objectsManager.setBobAnimation(13); @@ -1022,8 +1053,10 @@ LABEL_1141: _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM27a"); _vm->_objectsManager.OBSSEUL = 0; - } - if (v76 == 81) { + break; + } + + case 81: { _vm->_globals.NOT_VERIF = 1; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; @@ -1086,36 +1119,20 @@ LABEL_1141: _vm->_objectsManager.stopBobAnimation(6); _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.setBobAnimation(7); - } - if (v76 == 95) { - _vm->_objectsManager.setBobAnimation(9); - _vm->_objectsManager.setBobAnimation(10); - _vm->_objectsManager.setBobAnimation(12); - _vm->_objectsManager.SET_BOBPOSI(9, 0); - _vm->_objectsManager.SET_BOBPOSI(10, 0); - _vm->_objectsManager.SET_BOBPOSI(12, 0); - _vm->_objectsManager.removeSprite(0); - do { - if (_vm->shouldQuit()) - return -1; // Exiting game + break; + } - _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(9) != 15); - _vm->_objectsManager.stopBobAnimation(9); - _vm->_objectsManager.SPRITE_ON(0); - _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); - do { - if (_vm->shouldQuit()) - return -1; // Exiting game + case 83: + _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); + break; - _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(12) != 117); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); - _vm->_objectsManager.stopBobAnimation(12); - _vm->_objectsManager.stopBobAnimation(10); - _vm->_objectsManager.setBobAnimation(11); - } - if (v76 == 85) { + case 84: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); + _vm->_globals.NOPARLE = false; + break; + + case 85: _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.setBobAnimation(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); @@ -1130,8 +1147,26 @@ LABEL_1141: _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM24a"); _vm->_objectsManager.OBSSEUL = 0; - } - if (v76 == 88) { + break; + + case 86: + if (_vm->_globals._saveData->data[svField231] == 1) { + _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); + } else { + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); + _vm->_globals.NOPARLE = false; + } + break; + + case 87: + if (_vm->_globals._saveData->data[svField188]) + _vm->_talkManager.PARLER_PERSO("stand2.pe2"); + else + _vm->_talkManager.PARLER_PERSO("stand1.pe2"); + break; + + case 88: if (_vm->_globals._saveData->data[svField183] == 1) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(2, 0); @@ -1216,8 +1251,9 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); _vm->_soundManager.DEL_SAMPLE(1); } - } - if (v76 == 90) { + break; + + case 90: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); @@ -1228,8 +1264,9 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); } - } - if (v76 == 91) { + break; + + case 91: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); @@ -1240,8 +1277,9 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); } - } - if (v76 == 92) { + break; + + case 92: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); @@ -1252,8 +1290,9 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); } - } - if (v76 == 93) { + break; + + case 93: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); @@ -1264,43 +1303,112 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); } - } - if (v76 == 62) - _vm->_talkManager.OBJET_VIVANT("SBCADA.pe2"); - if (v76 == 65) - _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); - if (v76 == 105) { - _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals._saveData->data[svField253] == 1) { - int v27 = _vm->_objectsManager.getSpriteY(0); - int v28 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); - } - if (_vm->_globals._saveData->data[svField253] == 2) { - int v29 = _vm->_objectsManager.getSpriteY(0); - int v30 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); - } - if (_vm->_globals._saveData->data[svField253] > 2) { - int v31 = _vm->_objectsManager.getSpriteY(0); - int v32 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); - } - _vm->_globals.NOT_VERIF = 1; + break; + + case 94: + if (!_vm->_globals._saveData->data[svField228]) + _vm->_talkManager.PARLER_PERSO("flicn.pe2"); + if (_vm->_globals._saveData->data[svField228] == 1) + _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); + break; + + case 95: + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(10); + _vm->_objectsManager.setBobAnimation(12); + _vm->_objectsManager.SET_BOBPOSI(9, 0); + _vm->_objectsManager.SET_BOBPOSI(10, 0); + _vm->_objectsManager.SET_BOBPOSI(12, 0); + _vm->_objectsManager.removeSprite(0); do { if (_vm->shouldQuit()) return -1; // Exiting game - _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.setSpriteIndex(0, 60); - _vm->_soundManager.loadSample(1, "SOUND63.WAV"); + } while (_vm->_objectsManager.BOBPOSI(9) != 15); + _vm->_objectsManager.stopBobAnimation(9); + _vm->_objectsManager.SPRITE_ON(0); + _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(12) != 117); + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); + _vm->_objectsManager.stopBobAnimation(12); + _vm->_objectsManager.stopBobAnimation(10); + _vm->_objectsManager.setBobAnimation(11); + break; + + case 98: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); + _vm->_globals.NOPARLE = false; + break; + + case 100: + _vm->_talkManager.PARLER_PERSO("tourist.pe2"); + break; + + case 101: + _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); + break; + + case 103: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); + _vm->_globals.NOPARLE = false; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); + else if (_vm->_globals.SVGA == 2) + _vm->_animationManager.playAnim2("T421a.ANM", 100, 14, 500); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_eventsManager.VBL(); + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 104: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 105: + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + if (_vm->_globals._saveData->data[svField253] == 1) { + int v27 = _vm->_objectsManager.getSpriteY(0); + int v28 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); + } + if (_vm->_globals._saveData->data[svField253] == 2) { + int v29 = _vm->_objectsManager.getSpriteY(0); + int v30 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); + } + if (_vm->_globals._saveData->data[svField253] > 2) { + int v31 = _vm->_objectsManager.getSpriteY(0); + int v32 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); + } + _vm->_globals.NOT_VERIF = 1; + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + _vm->_objectsManager.GOHOME(); + _vm->_eventsManager.VBL(); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.setSpriteIndex(0, 60); + _vm->_soundManager.loadSample(1, "SOUND63.WAV"); if (_vm->_globals._saveData->data[svField253] > 2) { _vm->_objectsManager.setBobAnimation(4); int v33 = 0; @@ -1391,8 +1499,9 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.ACTION_DOS(1); _vm->_soundManager.DEL_SAMPLE(1); - } - if (v76 == 106) { + break; + + case 106: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(4); _vm->_objectsManager.SET_BOBPOSI(4, 0); @@ -1428,8 +1537,9 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(4) != 77); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.SPRITE_ON(0); - } - if (v76 == 107) { + break; + + case 107: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); @@ -1465,68 +1575,73 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(5) != 53); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.SPRITE_ON(0); - } - if (v76 == 210) { - _vm->_animationManager.NO_SEQ = true; - _vm->_soundManager.SPECIAL_SOUND = 210; - _vm->_animationManager.playSequence2("SECRET1.SEQ", 1, 12, 1); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); - _vm->_objectsManager.setBobAnimation(9); - _vm->_objectsManager.OBSSEUL = 1; - _vm->_objectsManager.INILINK("IM73a"); - _vm->_objectsManager.OBSSEUL = 0; - _vm->_globals.CACHE_ON(); - _vm->_animationManager.NO_SEQ = false; - _vm->_globals.CACHE_ADD(0); - _vm->_globals.CACHE_ADD(1); - _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); - } - if (v76 == 211) { - _vm->_objectsManager.removeSprite(0); - _vm->_globals.CACHE_OFF(); - _vm->_animationManager.NO_SEQ = true; - _vm->_globals.NO_VISU = false; - _vm->_soundManager.SPECIAL_SOUND = 211; - _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_animationManager.NO_SEQ = false; - _vm->_graphicsManager.NOFADE = true; - _vm->_graphicsManager.FADE_OUTW(); + break; - for (int i = 1; i <= 39; i++) { - if (_vm->shouldQuit()) - return -1; // Exiting game + case 108: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("peche1.pe2"); + _vm->_globals.NOPARLE = false; + break; - _vm->_eventsManager.VBL(); - } + case 109: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("peche2.pe2"); + _vm->_globals.NOPARLE = false; + break; - _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); - } - if (v76 == 207) - _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); - if (v76 == 208) { - _vm->_globals._disableInventFl = true; - if (_vm->_globals._saveData->data[svField6] != _vm->_globals._saveData->data[svField401]) { - _vm->_soundManager.SPECIAL_SOUND = 208; - _vm->_eventsManager._disableEscKeyFl = true; - _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); - _vm->_eventsManager._disableEscKeyFl = false; - _vm->_soundManager.SPECIAL_SOUND = 0; - } + case 110: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("peche3.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 111: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("peche4.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 112: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("teint1.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 113: + _vm->_talkManager.PARLER_PERSO("teint.pe2"); + break; + + case 114: + _vm->_talkManager.PARLER_PERSO("tahibar.pe2"); + break; + + case 115: + _vm->_talkManager.PARLER_PERSO("ilebar.pe2"); + break; + + case 116: + _vm->_talkManager.PARLER_PERSO("Profred.pe2"); + break; + + case 170: + _vm->_talkManager.PARLER_PERSO("GRED.pe2"); + break; + + case 171: { + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("gred1.pe2"); + _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v37 = _vm->_objectsManager.getSpriteY(0); - int v38 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = 0; + int v55 = _vm->_objectsManager.getSpriteY(0); + int v56 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = -1; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1534,31 +1649,29 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.setSpriteIndex(0, 64); - _vm->_globals._exitId = _vm->_globals._saveData->data[svField401]; - _vm->_globals._disableInventFl = false; - } - if (v76 == 209) { - _vm->_objectsManager.SET_BOBPOSI(1, 0); - _vm->_objectsManager.SET_BOBPOSI(2, 0); - _vm->_objectsManager.setSpriteIndex(0, 60); - _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.setBobAnimation(1); - do { - if (_vm->shouldQuit()) - return -1; // Exiting game + _vm->_globals._exitId = 59; + break; + } - _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(1) != 9); - _vm->_objectsManager.stopBobAnimation(1); - _vm->_globals.NO_VISU = true; + case 172: + _vm->_talkManager.PARLER_PERSO("GBLEU.pe2"); + break; + + case 173: { + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); + _vm->_globals.NOPARLE = false; + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.g_old_sens = -1; + _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = 1; - int v39 = _vm->_objectsManager.getSpriteY(0); - int v40 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); - _vm->_objectsManager.NUMZONE = 0; + int v57 = _vm->_objectsManager.getSpriteY(0); + int v58 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = -1; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1566,66 +1679,137 @@ LABEL_1141: _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_objectsManager.setSpriteIndex(0, 64); - _vm->_objectsManager.setBobAnimation(2); - _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); + _vm->_globals._exitId = 59; + break; + } + + case 174: + _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); + break; + + case 175: + _vm->_objectsManager.setSpriteIndex(0, 55); + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(10); + _vm->_objectsManager.BOB_OFFSET(10, 300); + _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(2) != 10); - _vm->_objectsManager.stopBobAnimation(2); - _vm->_objectsManager.setBobAnimation(4); - } - if (v76 == 201) { - _vm->_objectsManager.setBobAnimation(3); + } while (_vm->_objectsManager.BOBPOSI(10) != 7); + _vm->_objectsManager.setBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(3); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(3) != 18); - _vm->_objectsManager.stopBobAnimation(3); - _vm->_objectsManager.setBobAnimation(4); - } - if (v76 == 203) { - _vm->_globals.NO_VISU = true; - _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.setBobAnimation(4); + } while (_vm->_objectsManager.BOBPOSI(6) != 10); + _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); + _vm->_objectsManager.setBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(4); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - if (_vm->_objectsManager.BOBPOSI(4) == 18) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); - } while (_vm->_objectsManager.BOBPOSI(4) != 26); - _vm->_objectsManager.stopBobAnimation(4); - _vm->_globals.NO_VISU = false; - _vm->_objectsManager.SPRITE_ON(0); - } - if (v76 == 204) { - _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.setBobAnimation(3); - _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); - int v41 = 0; + } while (_vm->_objectsManager.BOBPOSI(7) != 15); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.setBobAnimation(8); + _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { - _vm->_soundManager.PLAY_WAV(1); - v41 = 1; - } - if (_vm->_objectsManager.BOBPOSI(3) == 11) - v41 = 0; + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(8) != 76); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(8); + _vm->_objectsManager.stopBobAnimation(9); + _vm->_objectsManager.stopBobAnimation(10); + _vm->_objectsManager.SPRITE_ON(0); + break; + + case 176: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("gred2.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 177: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 200: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); + _vm->_globals.NOPARLE = false; + break; + + case 201: + _vm->_objectsManager.setBobAnimation(3); + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + _vm->_eventsManager.VBL(); + } while (_vm->_objectsManager.BOBPOSI(3) != 18); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.setBobAnimation(4); + break; + + case 202: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); + _vm->_globals.NOPARLE = false; + break; + + case 203: + _vm->_globals.NO_VISU = true; + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.setBobAnimation(4); + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + _vm->_eventsManager.VBL(); + if (_vm->_objectsManager.BOBPOSI(4) == 18) + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); + } while (_vm->_objectsManager.BOBPOSI(4) != 26); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.SPRITE_ON(0); + break; + + case 204: { + _vm->_objectsManager.removeSprite(0); + _vm->_objectsManager.setBobAnimation(3); + _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); + int v41 = 0; + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { + _vm->_soundManager.PLAY_WAV(1); + v41 = 1; + } + if (_vm->_objectsManager.BOBPOSI(3) == 11) + v41 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 50); _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.SPRITE_ON(0); - } - if (v76 == 205) { + break; + } + + case 205: { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(4); _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); @@ -1644,60 +1828,149 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(4) != 24); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.SPRITE_ON(0); - } - if (v76 == 175) { - _vm->_objectsManager.setSpriteIndex(0, 55); - _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.setBobAnimation(9); - _vm->_objectsManager.setBobAnimation(10); - _vm->_objectsManager.BOB_OFFSET(10, 300); - _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); + break; + } + + case 207: + _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); + break; + + case 208: { + _vm->_globals._disableInventFl = true; + if (_vm->_globals._saveData->data[svField6] != _vm->_globals._saveData->data[svField401]) { + _vm->_soundManager.SPECIAL_SOUND = 208; + _vm->_eventsManager._disableEscKeyFl = true; + _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); + _vm->_eventsManager._disableEscKeyFl = false; + _vm->_soundManager.SPECIAL_SOUND = 0; + } + _vm->_globals.NOT_VERIF = 1; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + int v37 = _vm->_objectsManager.getSpriteY(0); + int v38 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); + _vm->_globals.NOT_VERIF = 1; + _vm->_objectsManager.NUMZONE = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(10) != 7); - _vm->_objectsManager.setBobAnimation(6); - _vm->_objectsManager.stopBobAnimation(3); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.setSpriteIndex(0, 64); + _vm->_globals._exitId = _vm->_globals._saveData->data[svField401]; + _vm->_globals._disableInventFl = false; + break; + } + + case 209: { + _vm->_objectsManager.SET_BOBPOSI(1, 0); + _vm->_objectsManager.SET_BOBPOSI(2, 0); + _vm->_objectsManager.setSpriteIndex(0, 60); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.setBobAnimation(1); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(6) != 10); - _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); - _vm->_objectsManager.setBobAnimation(7); - _vm->_objectsManager.stopBobAnimation(4); + } while (_vm->_objectsManager.BOBPOSI(1) != 9); + _vm->_objectsManager.stopBobAnimation(1); + _vm->_globals.NO_VISU = true; + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.NOT_VERIF = 1; + int v39 = _vm->_objectsManager.getSpriteY(0); + int v40 = _vm->_objectsManager.getSpriteX(0); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); + _vm->_objectsManager.NUMZONE = 0; + _vm->_globals.NOT_VERIF = 1; do { if (_vm->shouldQuit()) return -1; // Exiting game + _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(7) != 15); - _vm->_objectsManager.stopBobAnimation(5); - _vm->_objectsManager.setBobAnimation(8); - _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); + } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + _vm->_objectsManager.setSpriteIndex(0, 64); + _vm->_objectsManager.setBobAnimation(2); + _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(8) != 76); - _vm->_objectsManager.stopBobAnimation(6); - _vm->_objectsManager.stopBobAnimation(7); - _vm->_objectsManager.stopBobAnimation(8); - _vm->_objectsManager.stopBobAnimation(9); - _vm->_objectsManager.stopBobAnimation(10); - _vm->_objectsManager.SPRITE_ON(0); - } - if (v76 == 229) { + } while (_vm->_objectsManager.BOBPOSI(2) != 10); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.setBobAnimation(4); + break; + } + + case 210: + _vm->_animationManager.NO_SEQ = true; + _vm->_soundManager.SPECIAL_SOUND = 210; + _vm->_animationManager.playSequence2("SECRET1.SEQ", 1, 12, 1); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.INILINK("IM73a"); + _vm->_objectsManager.OBSSEUL = 0; + _vm->_globals.CACHE_ON(); + _vm->_animationManager.NO_SEQ = false; + _vm->_globals.CACHE_ADD(0); + _vm->_globals.CACHE_ADD(1); + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); + break; + + case 211: + _vm->_objectsManager.removeSprite(0); + _vm->_globals.CACHE_OFF(); + _vm->_animationManager.NO_SEQ = true; + _vm->_globals.NO_VISU = false; + _vm->_soundManager.SPECIAL_SOUND = 211; + _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_animationManager.NO_SEQ = false; + _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager.FADE_OUTW(); + + for (int i = 1; i <= 39; i++) { + if (_vm->shouldQuit()) + return -1; // Exiting game + + _vm->_eventsManager.VBL(); + } + + _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR4(254, 0, 0, 0); + break; + + case 215: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("aviat.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 216: + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); + _vm->_globals.NOPARLE = false; + break; + + case 229: _vm->_soundManager.SPECIAL_SOUND = 229; _vm->_animationManager.playSequence("MUR.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); - } - if (v76 == 230) { + break; + + case 230: { _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM93a"); _vm->_objectsManager.OBSSEUL = 0; @@ -1741,8 +2014,10 @@ LABEL_1141: _vm->_objectsManager.INILINK("IM93c"); _vm->_objectsManager.OBSSEUL = 0; _vm->_globals.CACHE_ON(); - } - if (v76 == 231) { + break; + } + + case 231: _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(12); @@ -1764,8 +2039,9 @@ LABEL_1141: _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.stopBobAnimation(12); _vm->_globals.CACHE_ON(); - } - if (v76 == 233) { + break; + + case 233: { _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); @@ -1794,19 +2070,10 @@ LABEL_1141: _vm->_objectsManager.stopBobAnimation(13); _vm->_graphicsManager.NOFADE = true; _vm->_globals._exitId = 94; - } - if (v76 == 52) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 53) - _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); - if (v76 == 54) - _vm->_talkManager.PARLER_PERSO("GARDE2.pe2"); - if (v76 == 40) - _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); - if (v76 == 236) { + break; + } + + case 236: { char v47 = _vm->_globals._saveData->data[svField341]; if (v47) { if (v47 == 2) @@ -1833,8 +2100,10 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); - } - if (v76 == 237) { + break; + } + + case 237: { char v48 = _vm->_globals._saveData->data[svField341]; if (v48) { if (v48 == 2) @@ -1861,8 +2130,10 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); - } - if (v76 == 238) { + break; + } + + case 238: { char v49 = _vm->_globals._saveData->data[svField341]; if (v49) { if (v49 == 2) @@ -1889,13 +2160,16 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); - } - if (v76 == 239) { + break; + } + + case 239: _vm->_objectsManager.removeSprite(0); _vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); - } - if (v76 == 240) { + break; + + case 240: { _vm->_objectsManager.setBobAnimation(1); bool soundFlag = false; do { @@ -1940,221 +2214,14 @@ LABEL_1141: _vm->_globals._saveData->data[svField352] = 1; _vm->_globals._saveData->data[svField353] = 1; _vm->_globals._saveData->data[svField354] = 1; - } - if (v76 == 56) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.PERSO_TYPE = 1; - _vm->_globals._saveData->data[svField122] = 1; - _vm->_globals.HOPKINS_DATA(); - _vm->_objectsManager._sprite[0].field12 = 28; - _vm->_objectsManager._sprite[0].field14 = 155; - _vm->_objectsManager.VERIFTAILLE(); - } - if (v76 == 57) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.PERSO_TYPE = 0; - _vm->_globals._saveData->data[svField122] = 0; - _vm->_globals.HOPKINS_DATA(); - _vm->_objectsManager._sprite[0].field12 = 34; - _vm->_objectsManager._sprite[0].field14 = 190; - _vm->_objectsManager.VERIFTAILLE(); - } - if (v76 == 25) - _vm->_talkManager.PARLER_PERSO("AGENT1.pe2"); - if (v76 == 26) - _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); - if (v76 == 87) { - if (_vm->_globals._saveData->data[svField188]) - _vm->_talkManager.PARLER_PERSO("stand2.pe2"); - else - _vm->_talkManager.PARLER_PERSO("stand1.pe2"); - } - if (v76 == 86) { - if (_vm->_globals._saveData->data[svField231] == 1) { - _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); - } else { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); - _vm->_globals.NOPARLE = false; + break; } - } - if (v76 == 51) { - _vm->_graphicsManager.FADE_OUTW(); - _vm->_globals.CACHE_OFF(); - _vm->_objectsManager.removeSprite(0); - _vm->_fontManager.hideText(5); - _vm->_fontManager.hideText(9); - _vm->_graphicsManager.FIN_VISU(); - _vm->_graphicsManager.loadImage("IM20f"); - _vm->_animationManager.loadAnim("ANIM20f"); - _vm->_graphicsManager.VISU_ALL(); - _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_INW(); - bool v52 = false; - _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); - do { - if (_vm->shouldQuit()) - return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { - _vm->_soundManager.PLAY_WAV(1); - v52 = true; - } - _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(12) != 34); - _vm->_objectsManager.stopBobAnimation(2); - _vm->_graphicsManager.FADE_OUTW(); - _vm->_graphicsManager.NOFADE = true; - _vm->_globals._exitId = 20; - } - if (v76 == 41) - _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); - if (v76 == 44) - _vm->_talkManager.PARLER_PERSO("MORT3A.pe2"); - if (v76 == 42) - _vm->_talkManager.PARLER_PERSO("MORT2.pe2"); - if (v76 == 43) - _vm->_talkManager.PARLER_PERSO("MORT1.pe2"); - if (v76 == 47) - _vm->_talkManager.PARLER_PERSO("BARMAN.pe2"); - if (v76 == 45) - _vm->_talkManager.PARLER_PERSO("FEM3.pe2"); - if (v76 == 48) - _vm->_talkManager.PARLER_PERSO("SAMAN2.pe2"); - if (v76 == 21) - _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); - if (v76 == 94) { - if (!_vm->_globals._saveData->data[svField228]) - _vm->_talkManager.PARLER_PERSO("flicn.pe2"); - if (_vm->_globals._saveData->data[svField228] == 1) - _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); - } - if (v76 == 27) { - if (_vm->_globals._saveData->data[svField94] != 1 || _vm->_globals._saveData->data[svField95] != 1) - _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); - else - _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); - } - if (v76 == 58) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); - _vm->_globals._saveData->data[svField176] = 1; - _vm->_globals._saveData->data[svField270] = 2; - _vm->_globals.NOPARLE = false; - } - if (v76 == 200) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 84) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 98) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 83) - _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); - if (v76 == 32) - _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); - if (v76 == 215) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("aviat.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 216) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 170) - _vm->_talkManager.PARLER_PERSO("GRED.pe2"); - if (v76 == 172) - _vm->_talkManager.PARLER_PERSO("GBLEU.pe2"); - if (v76 == 100) - _vm->_talkManager.PARLER_PERSO("tourist.pe2"); - if (v76 == 103) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); - _vm->_globals.NOPARLE = false; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim2("T421a.ANM", 100, 14, 500); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.VBL(); - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 104) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 108) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("peche1.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 109) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("peche2.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 110) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("peche3.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 111) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("peche4.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 112) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("teint1.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 176) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("gred2.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 177) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); - _vm->_globals.NOPARLE = false; - } - if (v76 == 113) - _vm->_talkManager.PARLER_PERSO("teint.pe2"); - if (v76 == 114) - _vm->_talkManager.PARLER_PERSO("tahibar.pe2"); - if (v76 == 115) - _vm->_talkManager.PARLER_PERSO("ilebar.pe2"); - if (v76 == 116) - _vm->_talkManager.PARLER_PERSO("Profred.pe2"); - if (v76 == 101) - _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); - if (v76 == 243) { - _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); - if (_vm->_globals._saveData->data[svField341] == 2) { - _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); - _vm->_animationManager.NO_SEQ = false; - } else { - _vm->_objectsManager.OPTI_ONE(7, 0, 14, 0); - } - } - if (v76 == 242) { + case 241: + _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); + break; + + case 242: { _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); @@ -2168,8 +2235,7 @@ LABEL_1141: int v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; - v76 = -(100 * (67 - (100 - v54)) / 67); - v53->field4 = v76; + v53->field4 = 242 - (100 * (67 - (100 - v54)) / 67); _vm->_globals._saveData->data[svField357] = 1; _vm->_globals._saveData->data[svField354] = 0; _vm->_globals._saveData->data[svField356] = 0; @@ -2178,16 +2244,30 @@ LABEL_1141: _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); _vm->_objectsManager.SPRITE_ON(1); - } - if (v76 == 245) { + break; + } + + case 243: + _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); + if (_vm->_globals._saveData->data[svField341] == 2) { + _vm->_animationManager.NO_SEQ = true; + _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); + _vm->_animationManager.NO_SEQ = false; + } else { + _vm->_objectsManager.OPTI_ONE(7, 0, 14, 0); + } + break; + + case 245: _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); _vm->_globals.ZONEP[4]._destX = 276; _vm->_objectsManager.VERBE_ON(4, 19); _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals._saveData->data[svField399] = 1; - } - if (v76 == 246) { + break; + + case 246: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_ONE(6, 0, 15, 0); _vm->_objectsManager.PERSO_ON = true; @@ -2199,118 +2279,188 @@ LABEL_1141: _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.PERSO_ON = false; _vm->_globals._exitId = 100; - } - if (v76 == 55) { - _vm->_objectsManager.stopBobAnimation(1); - _vm->_objectsManager.OPTI_ONE(15, 0, 12, 0); - _vm->_objectsManager.stopBobAnimation(15); - _vm->_objectsManager.OBSSEUL = 1; - _vm->_objectsManager.INILINK("IM19a"); - _vm->_objectsManager.OBSSEUL = 0; - } - if (v76 == 241) - _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); - if (v76 == 171) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("gred1.pe2"); - _vm->_globals.NOPARLE = false; - _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; - int v55 = _vm->_objectsManager.getSpriteY(0); - int v56 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); - _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; - do { - if (_vm->shouldQuit()) - return -1; // Exiting game + break; - _vm->_objectsManager.GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_globals._exitId = 59; - } - if (v76 == 173) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); - _vm->_globals.NOPARLE = false; - _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; - _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; - int v57 = _vm->_objectsManager.getSpriteY(0); - int v58 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); - _vm->_globals.NOT_VERIF = 1; - _vm->_objectsManager.NUMZONE = -1; - do { - if (_vm->shouldQuit()) - return -1; // Exiting game + case 600: + if (!_vm->_globals._internetFl) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_graphicsManager.FADESPD = 1; + if (_vm->_globals.SVGA == 2) + _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); + else if (_vm->_globals.SVGA == 1) + _vm->_animationManager.playAnim("BOMBE1.ANM", 100, 18, 100); + } + _vm->_graphicsManager.loadImage("BOMBEB"); + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_graphicsManager.OPTI_INI("BOMBE", 2); + _vm->_graphicsManager.FADE_INS(); + break; - _vm->_objectsManager.GOHOME(); - _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); - _vm->_globals._exitId = 59; - } - if (v76 == 174) - _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); - if (v76 == 202) { - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); - _vm->_globals.NOPARLE = false; - } - v1 = 1; - } - if (*(a1 + 2) == 'E' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') - v1 = 4; - if (*(a1 + 2) == 'V' && *(a1 + 3) == 'A' && *(a1 + 4) == 'L') { - v1 = 1; - _vm->_globals._saveData->data[(int16)READ_LE_UINT16(a1 + 5)] = (int16)READ_LE_UINT16(a1 + 7); - } - if (*(a1 + 2) == 'A' && *(a1 + 3) == 'D' && *(a1 + 4) == 'D') { - v1 = 1; - _vm->_globals._saveData->data[(int16)READ_LE_UINT16(a1 + 5)] += *(a1 + 7); - } - if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'S') { - v1 = 1; - _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); - } - if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'N') { - _vm->_objectsManager.VERBE_ON((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); - v1 = 1; - } - if (*(a1 + 2) == 'Z' && *(a1 + 3) == 'C' && *(a1 + 4) == 'H') { - _vm->_globals.ZONEP[(int16)READ_LE_UINT16(a1 + 5)].field12 = (int16)READ_LE_UINT16(a1 + 7); - v1 = 1; - } - if (*(a1 + 2) == 'J' && *(a1 + 3) == 'U' && *(a1 + 4) == 'M') { - int v59 = (int16)READ_LE_UINT16(a1 + 7); - _vm->_objectsManager.NVZONE = (int16)READ_LE_UINT16(a1 + 5); + case 601: + _vm->_globals.NO_VISU = true; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.OPTI_ONE(2, 0, 16, 4); + break; + + case 602: + _vm->_globals.NO_VISU = true; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.OPTI_ONE(4, 0, 16, 4); + break; + + case 603: + _vm->_globals.NO_VISU = true; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); + _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_graphicsManager.FADE_LINUX = 2; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); + else if (_vm->_globals.SVGA == 2) + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); + _vm->_graphicsManager.NOFADE = true; + _vm->_globals._exitId = 151; + break; + + case 604: + _vm->_globals.NO_VISU = true; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); + _vm->_soundManager.SPECIAL_SOUND = 199; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); + else if (_vm->_globals.SVGA == 2) + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.NOFADE = true; + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); + _vm->_globals._exitId = 151; + break; + + case 605: + _vm->_globals.NO_VISU = true; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); + _vm->_graphicsManager.FADE_OUTS(); + _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_graphicsManager.FADE_LINUX = 2; + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); + else if (_vm->_globals.SVGA == 2) + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_graphicsManager.NOFADE = true; + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); + _vm->_globals._exitId = 151; + break; + + case 606: + _vm->_globals.NO_VISU = true; + _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_globals.NO_VISU = false; + _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); + if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { + if (_vm->_globals.SVGA == 1) + _vm->_animationManager.playAnim("BOMBE3.ANM", 50, 14, 500); + else if (_vm->_globals.SVGA == 2) + _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); + memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); + } + _vm->_globals._exitId = 6; + break; + + case 607: + if (!_vm->_globals._internetFl) { + memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); + _vm->_graphicsManager._oldPalette[769]; + _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); + } + _vm->_globals.NBBLOC = 0; + break; + + case 608: + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.stopBobAnimation(11); + _vm->_objectsManager.stopBobAnimation(10); + break; + + case 609: + _vm->_objectsManager.setBobAnimation(2); + _vm->_objectsManager.setBobAnimation(3); + _vm->_objectsManager.setBobAnimation(4); + _vm->_objectsManager.setBobAnimation(6); + _vm->_objectsManager.setBobAnimation(11); + _vm->_objectsManager.setBobAnimation(10); + break; + + case 610: + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.stopBobAnimation(7); + _vm->_objectsManager.stopBobAnimation(8); + _vm->_objectsManager.stopBobAnimation(9); + _vm->_objectsManager.stopBobAnimation(12); + _vm->_objectsManager.stopBobAnimation(13); + break; + + case 611: + _vm->_objectsManager.setBobAnimation(5); + _vm->_objectsManager.setBobAnimation(7); + _vm->_objectsManager.setBobAnimation(8); + _vm->_objectsManager.setBobAnimation(9); + _vm->_objectsManager.setBobAnimation(12); + _vm->_objectsManager.setBobAnimation(13); + break; + } + opcodeType = 1; + } else if (dataP[2] == 'E' && dataP[3] == 'I' && dataP[4] == 'F') { + opcodeType = 4; + } else if (dataP[2] == 'V' && dataP[3] == 'A' && dataP[4] == 'L') { + opcodeType = 1; + _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] = (int16)READ_LE_UINT16(dataP + 7); + } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { + opcodeType = 1; + _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += *(dataP + 7); + } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') { + opcodeType = 1; + _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'N') { + _vm->_objectsManager.VERBE_ON((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + opcodeType = 1; + } else if (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') { + _vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); + opcodeType = 1; + } else if (dataP[2] == 'J' && dataP[3] == 'U' && dataP[4] == 'M') { + int v59 = (int16)READ_LE_UINT16(dataP + 7); + _vm->_objectsManager.NVZONE = (int16)READ_LE_UINT16(dataP + 5); _vm->_objectsManager.NVVERBE = v59; - v1 = 6; - } - if (*(a1 + 2) == 'S' && *(a1 + 3) == 'O' && *(a1 + 4) == 'U') { - int v60 = (int16)READ_LE_UINT16(a1 + 5); + opcodeType = 6; + } else if (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') { + int v60 = (int16)READ_LE_UINT16(dataP + 5); Common::String file = Common::String::format("SOUND%d.WAV", v60); _vm->_soundManager.PLAY_SOUND(file); - v1 = 1; - } - if (*(a1 + 2) == 'V' && *(a1 + 3) == 'O' && *(a1 + 4) == 'F') { - _vm->_objectsManager.VERBE_OFF((int16)READ_LE_UINT16(a1 + 5), (int16)READ_LE_UINT16(a1 + 7)); - v1 = 1; - } - if (*(a1 + 2) == 'I' && *(a1 + 3) == 'I' && *(a1 + 4) == 'F') { - v1 = 3; + opcodeType = 1; + } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') { + _vm->_objectsManager.VERBE_OFF((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + opcodeType = 1; + } else if (dataP[2] == 'I' && dataP[3] == 'I' && dataP[4] == 'F') { + opcodeType = 3; } - return v1; + return opcodeType; } @@ -2334,7 +2484,7 @@ LABEL_2: return 0; // Exiting game ++v3; - v4 = checkSignature(dataP + 20 * v3); + v4 = checkOpcode(dataP + 20 * v3); if (v3 > 400) error("Control if failed"); } while (v4 != 4); // EIF @@ -2346,7 +2496,7 @@ LABEL_2: return 0; // Exiting game ++v6; - if (checkSignature(dataP + 20 * v6) == 3) // IIF + if (checkOpcode(dataP + 20 * v6) == 3) // IIF v7 = true; if (v6 > 400) error("Control if failed "); @@ -2395,7 +2545,7 @@ LABEL_2: return (v20 + 1); } -int ScriptManager::checkSignature(const byte *dataP) { +int ScriptManager::checkOpcode(const byte *dataP) { if (dataP[0] != 'F' || dataP[1] != 'C') { return 0; } @@ -2403,23 +2553,23 @@ int ScriptManager::checkSignature(const byte *dataP) { int result = 0; if ((dataP[2] == 'A' && dataP[3] == 'N' && dataP[4] == 'I') || - (dataP[2] == 'B' && dataP[3] == 'C' && dataP[4] == 'A') || + (dataP[2] == 'B' && dataP[3] == 'C' && dataP[4] == 'A') || (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') || (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') || - (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') || - (dataP[2] == 'M' && dataP[3] == 'U' && dataP[4] == 'S') || - (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'M') || - (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'P') || + (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') || + (dataP[2] == 'M' && dataP[3] == 'U' && dataP[4] == 'S') || + (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'M') || + (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'P') || (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') || (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') || - (dataP[2] == 'S' && dataP[3] == 'P' && dataP[4] == 'E') || - (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') || + (dataP[2] == 'S' && dataP[3] == 'P' && dataP[4] == 'E') || + (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') || (dataP[2] == 'V' && dataP[3] == 'A' && dataP[4] == 'L') || - (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') || + (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') || (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'N') || - (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') || - (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') || - (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N')) + (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') || + (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') || + (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N')) result = 1; if (dataP[2] == 'G' && dataP[3] == 'O' && dataP[4] == 'T') diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index 9bb9c3e1fa..f37baffdac 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -39,8 +39,8 @@ public: ScriptManager(); void setParent(HopkinsEngine *vm); - int Traduction(byte *a1); - int checkSignature(const byte *dataP); + int handleOpcode(byte *dataP); + int checkOpcode(const byte *dataP); int handleGoto(const byte *dataP); int handleIf(const byte *dataP, int a2); }; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index add8ecface..4d6c880b7f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1004,7 +1004,7 @@ LABEL_2: loopCond = false; v13 = 1; do { - v10 = _vm->_scriptManager.Traduction(ptr + 20 * v13); + v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13); if (_vm->shouldQuit()) return; -- cgit v1.2.3 From 48f997ccb5de5c947f063742e46f6f9c2dcb6db1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 18:43:49 +0100 Subject: HOPKINS: More refactoring in handleOpcode, some renaming --- engines/hopkins/globals.cpp | 6 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 8 +- engines/hopkins/objects.cpp | 22 ++--- engines/hopkins/objects.h | 4 +- engines/hopkins/script.cpp | 218 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 4 +- 7 files changed, 132 insertions(+), 134 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a52c1badf8..fbfad43665 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -139,7 +139,7 @@ Globals::Globals() { hauteur_boite = 0; forest = false; _objectWidth = _objectHeight = 0; - HELICO = 0; + _helicopterFl = false; _catalogPos = 0; _catalogSize = 0; _newObjectFl = false; @@ -174,8 +174,8 @@ Globals::Globals() { GOACTION = false; NECESSAIRE = false; Compteur = 0; - ACTION_SENS = 0; - ACTION_SENS = 0; + _actionDirection = 0; + _actionDirection = 0; SegmentEnCours = 0; STOP_BUG = 0; MAX_COMPTE = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c80d523b4a..0505ccea2a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -396,7 +396,7 @@ public: byte *PERSO; int _objectWidth, _objectHeight; bool _newObjectFl; - int HELICO; + bool _helicopterFl; uint32 _catalogPos; uint32 _catalogSize; int iRegul; @@ -439,7 +439,7 @@ public: bool NECESSAIRE; bool GOACTION; int Compteur; - int ACTION_SENS; + int _actionDirection; int SegmentEnCours; int couleur_40; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 10a18c7f97..0c34bb4d93 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -135,7 +135,7 @@ bool HopkinsEngine::runWin95Demo() { _objectsManager.changeObject(14); _objectsManager.addObject(14); - _globals.HELICO = 0; + _globals._helicopterFl = false; _globals.iRegul = 1; warning("TODO Affiche_Version(1)"); @@ -463,7 +463,7 @@ bool HopkinsEngine::runLinuxDemo() { _objectsManager.changeObject(14); _objectsManager.addObject(14); - _globals.HELICO = 0; + _globals._helicopterFl = false; _eventsManager.mouseOff(); _graphicsManager.lockScreen(); @@ -2604,7 +2604,7 @@ bool HopkinsEngine::runWin95full() { _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); - _globals.HELICO = 0; + _globals._helicopterFl = false; _globals.iRegul = 1; warning("TODO: Affiche_Version();"); @@ -3482,7 +3482,7 @@ bool HopkinsEngine::runLinuxFull() { _objectsManager.changeObject(14); _objectsManager.addObject(14); - _globals.HELICO = 0; + _globals._helicopterFl = false; _eventsManager.mouseOff(); _graphicsManager.lockScreen(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 118fcc3419..ac8e5fc43b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -77,8 +77,8 @@ ObjectsManager::ObjectsManager() { MAX_DEPA1 = 0; CH_TETE = 0; T_RECTIF = 0; - DESACTIVE = false; - DEUXPERSO = false; + _disableFl = false; + _twoCharactersFl = false; PERX = PERY = 0; PERI = 0; RECALL = 0; @@ -1733,7 +1733,7 @@ void ObjectsManager::GOHOME() { g_old_y = nouveau_y; } else { setSpriteIndex(0, _vm->_globals.g_old_sens + 59); - _vm->_globals.ACTION_SENS = 0; + _vm->_globals._actionDirection = 0; if (_vm->_globals.GOACTION) v54 = _vm->_globals._saveData->data[svField2]; else @@ -1757,7 +1757,7 @@ void ObjectsManager::GOHOME() { _vm->_globals.ZONEP[v55].field4 = 0; } else { setSpriteIndex(0, v57); - _vm->_globals.ACTION_SENS = _vm->_globals.ZONEP[v55].field4 - 59; + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v55].field4 - 59; } } } @@ -2080,7 +2080,7 @@ LABEL_153: else v49 = NUMZONE; setSpriteIndex(0, _vm->_globals.g_old_sens + 59); - _vm->_globals.ACTION_SENS = 0; + _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); setFlipSprite(0, false); @@ -2102,7 +2102,7 @@ LABEL_153: _vm->_globals.ZONEP[v50].field4 = 0; } else { setSpriteIndex(0, v52); - _vm->_globals.ACTION_SENS = _vm->_globals.ZONEP[v50].field4 - 59; + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v50].field4 - 59; } } } @@ -2682,7 +2682,7 @@ LABEL_64: } _vm->_globals.chemin = (int16 *)g_PTRNUL; setSpriteIndex(0, _vm->_globals.g_old_sens2 + 59); - _vm->_globals.ACTION_SENS = 0; + _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); setFlipSprite(0, false); @@ -5464,21 +5464,21 @@ LABEL_70: breakFlag = true; } - if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || _vm->_globals.HELICO != 1) { + if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_vm->_globals._helicopterFl) { if (!_vm->_graphicsManager.NOFADE) _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager.NOFADE = false; removeSprite(0); _vm->_globals.AFFLI = false; - if (DEUXPERSO == true) { + if (_twoCharactersFl) { removeSprite(1); - DEUXPERSO = false; + _twoCharactersFl = false; } if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); CLEAR_ECRAN(); } else { - _vm->_globals.HELICO = 0; + _vm->_globals._helicopterFl = false; } _vm->_globals.iRegul = 0; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 623847124c..8ad87ede17 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -102,8 +102,8 @@ public: int MAX_DEPA1; int CH_TETE; int T_RECTIF; - bool DESACTIVE; - bool DEUXPERSO; + bool _disableFl; + bool _twoCharactersFl; int PERX, PERY; int PERI; int RECALL; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a93133fa13..a3dfa3a746 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -164,7 +164,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } } } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') { - if (_vm->_objectsManager.DESACTIVE != true) { + if (!_vm->_objectsManager._disableFl) { int v72 = *(dataP + 5); v70 = *(dataP + 6); int v4 = *(dataP + 7); @@ -196,8 +196,8 @@ LABEL_1141: } opcodeType = 1; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { - if (!_vm->_objectsManager.DESACTIVE) { - _vm->_objectsManager.DEUXPERSO = false; + if (!_vm->_objectsManager._disableFl) { + _vm->_objectsManager._twoCharactersFl = false; int v5 = *(dataP + 5); int v6 = (int16)READ_LE_UINT16(dataP + 8); _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(dataP + 6); @@ -239,7 +239,7 @@ LABEL_1141: 34, 190); _vm->_objectsManager.SPRITE_ON(1); - _vm->_objectsManager.DEUXPERSO = true; + _vm->_objectsManager._twoCharactersFl = true; } if (_vm->_globals._saveData->data[svField357] == 1 && _vm->_globals._saveData->data[svField355] == 1 @@ -254,13 +254,13 @@ LABEL_1141: 20, 127); _vm->_objectsManager.SPRITE_ON(1); - _vm->_objectsManager.DEUXPERSO = true; + _vm->_objectsManager._twoCharactersFl = true; } } opcodeType = 1; _vm->_objectsManager.CH_TETE = 0; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { - if (_vm->_objectsManager.DESACTIVE != true) { + if (!_vm->_objectsManager._disableFl) { int v7 = *(dataP + 5); v70 = *(dataP + 6); int v8 = *(dataP + 7); @@ -276,7 +276,7 @@ LABEL_1141: } opcodeType = 1; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') { - if (_vm->_objectsManager.DESACTIVE != true) + if (!_vm->_objectsManager._disableFl) _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; } else if (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') { @@ -285,179 +285,177 @@ LABEL_1141: v70 = 0; if ((int16)READ_LE_UINT16(dataP + 5) == 14) v73 = 1; - if (v73 == 17) - v73 = 7; - if (v73 == 18) - v73 = 8; - if (v73 == 19) - v73 = 4; - if (v73 == 15) - v73 = 11; - if (v73 == 16) - v73 = 12; - if (v73 == 1) { - if (_vm->_globals.ACTION_SENS == 1) + + switch (v73) { + case 1: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(4); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(4); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(4); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(4); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(4); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(4); - } - if (v73 == 2) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 2: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(7); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(7); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(7); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(7); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(7); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(7); - if (_vm->_globals.ACTION_SENS == 1) + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(8); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(8); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(8); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(8); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(8); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(8); - } - if (v73 == 4) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 19: + case 4: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(1); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(1); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(1); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(1); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(1); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(1); - } - if (v73 == 5) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 5: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(5); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(5); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(5); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(5); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(5); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(5); - if (_vm->_globals.ACTION_SENS == 1) + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(6); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(6); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(6); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(6); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(6); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(6); - } - if (v73 == 7) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 17: + case 7: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(2); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(2); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(2); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(2); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(2); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(2); - } - if (v73 == 8) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 18: + case 8: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(3); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(3); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(3); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(3); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(3); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(3); - } - if (v73 == 9) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 9: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(5); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(5); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(5); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(5); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(5); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(5); - } - if (v73 == 10) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 10: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(6); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(6); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(6); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(6); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(6); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(6); - } - if (v73 == 11) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 15: + case 11: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(7); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(7); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(7); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(7); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(7); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(7); - } - if (v73 == 12) { - if (_vm->_globals.ACTION_SENS == 1) + break; + case 16: + case 12: + if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(8); - if (_vm->_globals.ACTION_SENS == 3) + if (_vm->_globals._actionDirection == 3) _vm->_objectsManager.ACTION_DROITE(8); - if (_vm->_globals.ACTION_SENS == 2) + if (_vm->_globals._actionDirection == 2) _vm->_objectsManager.Q_DROITE(8); - if (_vm->_globals.ACTION_SENS == 5) + if (_vm->_globals._actionDirection == 5) _vm->_objectsManager.ACTION_FACE(8); - if (_vm->_globals.ACTION_SENS == 8) + if (_vm->_globals._actionDirection == 8) _vm->_objectsManager.Q_GAUCHE(8); - if (_vm->_globals.ACTION_SENS == 7) + if (_vm->_globals._actionDirection == 7) _vm->_objectsManager.ACTION_GAUCHE(8); + break; } } opcodeType = 1; @@ -611,7 +609,7 @@ LABEL_1141: _vm->_graphicsManager.FADE_OUTW(); _vm->_globals._disableInventFl = false; - _vm->_globals.HELICO = 1; + _vm->_globals._helicopterFl = true; break; case 16: @@ -2240,7 +2238,7 @@ LABEL_1141: _vm->_globals._saveData->data[svField354] = 0; _vm->_globals._saveData->data[svField356] = 0; _vm->_globals._saveData->data[svField355] = 1; - _vm->_objectsManager.DEUXPERSO = true; + _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); _vm->_objectsManager.SPRITE_ON(1); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 4d6c880b7f..339646a491 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1247,10 +1247,10 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.freeMemory(_vm->_globals.COUCOU); _vm->_globals.COUCOU = v11; - _vm->_objectsManager.DESACTIVE = true; + _vm->_objectsManager._disableFl = true; _vm->_objectsManager.INILINK(v20); _vm->_graphicsManager.INI_ECRAN2(v20); - _vm->_objectsManager.DESACTIVE = false; + _vm->_objectsManager._disableFl = false; _vm->_globals.NOMARCHE = false; if (_vm->_globals._exitId == 101) _vm->_globals._exitId = 0; -- cgit v1.2.3 From 093f397e98c68ac2be8ef9e9fb29760eb2d23fdc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 18:48:13 +0100 Subject: HOPKINS: Remove useless variables --- engines/hopkins/globals.cpp | 8 -------- engines/hopkins/globals.h | 4 ---- 2 files changed, 12 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fbfad43665..53385f484a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -131,7 +131,6 @@ Globals::Globals() { police_l = police_h = 0; TETE = NULL; texte_long = 0; - TEXTE_FORMATE = 0; _curObjectIndex = 0; NUM_FICHIER_OBJ = 0; nbrligne = 0; @@ -219,12 +218,6 @@ Globals::Globals() { OPTION_SPR = NULL; // Reset flags - MUSICOFF = false; - SOUNDOFF = false; - VOICEOFF = false; - SOUNDOFF = false; - MUSICOFF = false; - VOICEOFF = false; CENSURE = false; GESTE_FLAG = false; BPP_NOAFF = false; @@ -411,7 +404,6 @@ void Globals::clearAll() { essai2 = (int16 *)(BUFFERTAPE + 50000); BufLig = (int16 *)(BUFFERTAPE + 75000); largeur_boite = 240; - TEXTE_FORMATE = 300; _vm->_eventsManager._objectBuf = allocMemory(2500); INVENTAIRE_OBJET = allocMemory(2500); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 0505ccea2a..572822bc58 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -354,9 +354,6 @@ public: int SOUNDVOL; int MUSICVOL; int VOICEVOL; - bool SOUNDOFF; - bool MUSICOFF; - bool VOICEOFF; bool CENSURE; int g_old_anim; int g_old_sens, g_old_sens2; @@ -369,7 +366,6 @@ public: byte *BUF_ZONE; byte *texte_tmp; int texte_long; - int TEXTE_FORMATE; byte *SPRITE_ECRAN; Sauvegarde *_saveData; byte *BUFFERTAPE; -- cgit v1.2.3 From 40cd508ea749faaabe305f9f5a85c11f109d7fab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Dec 2012 18:49:51 +0100 Subject: HOPKINS: Remove one more useless flag --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 3 --- engines/hopkins/menu.cpp | 2 -- 4 files changed, 7 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 53385f484a..1fc3d41082 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -222,7 +222,6 @@ Globals::Globals() { GESTE_FLAG = false; BPP_NOAFF = false; _disableInventFl = false; - FLAG_VISIBLE = false; netscape = false; NOMARCHE = false; NO_VISU = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 572822bc58..bea32c80ef 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -410,7 +410,6 @@ public: int Max_Ligne_Long; int Max_Perso_Y; bool _disableInventFl; - bool FLAG_VISIBLE; bool netscape; // CHECKME: Useless variable? bool NOMARCHE; int NBBLOC; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0c34bb4d93..d228f0ca97 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4793,7 +4793,6 @@ void HopkinsEngine::PUBQUIT() { _globals.forest = false; _eventsManager._breakoutFl = false; _globals._disableInventFl = true; - _globals.FLAG_VISIBLE = false; _graphicsManager.loadImage("BOX"); _soundManager.WSOUND(28); _graphicsManager.FADE_INW(); @@ -5763,7 +5762,6 @@ bool HopkinsEngine::displayAdultDisclaimer() { _graphicsManager.max_y = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; _globals.forest = false; - _globals.FLAG_VISIBLE = false; _globals._disableInventFl = true; _globals._exitId = 0; @@ -5788,7 +5786,6 @@ bool HopkinsEngine::displayAdultDisclaimer() { } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.getMouseButton() != 1)); _globals._disableInventFl = false; - _globals.FLAG_VISIBLE = false; _graphicsManager.FADE_OUTW(); if (buttonIndex != 2) { diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b0f6c27422..2252a45d06 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -60,7 +60,6 @@ int MenuManager::MENU() { _vm->_globals.forest = false; _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; - _vm->_globals.FLAG_VISIBLE = false; _vm->_globals._exitId = 0; for (int idx = 0; idx < 31; ++idx) @@ -231,7 +230,6 @@ int MenuManager::MENU() { _vm->_globals.freeMemory(spriteData); _vm->_globals._disableInventFl = false; - _vm->_globals.FLAG_VISIBLE = false; _vm->_graphicsManager.FADE_OUTW(); return result; } -- cgit v1.2.3 From 657dfdaa6d99c7173094f4d85a75ca67ea0c46a4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Dec 2012 02:25:13 +0100 Subject: HOPKINS: Remove useless variable in MenuManager, some renaming --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 32 ++++++++-------- engines/hopkins/menu.cpp | 26 ++++++------- engines/hopkins/menu.h | 3 +- engines/hopkins/objects.cpp | 10 ++--- engines/hopkins/script.cpp | 88 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 2 +- 10 files changed, 84 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1fc3d41082..ee96b2a0f7 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -136,7 +136,7 @@ Globals::Globals() { nbrligne = 0; largeur_boite = 0; hauteur_boite = 0; - forest = false; + _forestFl = false; _objectWidth = _objectHeight = 0; _helicopterFl = false; _catalogPos = 0; @@ -409,7 +409,7 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; FORETSPR = g_PTRNUL; - forest = false; + _forestFl = false; cache_souris = allocMemory(2500); GESTE = g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index bea32c80ef..91486aa0a2 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -382,7 +382,7 @@ public: int hauteur_boite; int GESTE_FLAG; byte *FORETSPR; - bool forest; + bool _forestFl; byte *COUCOU; int16 *chemin; byte *cache_souris; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 832f0c97d4..e83622ab57 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1805,7 +1805,7 @@ Aff_Zoom_Larg_Cont1: } // Display Speed -void GraphicsManager::AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex) { +void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex) { int width, height; width = _vm->_objectsManager.getWidth(spriteData, spriteIndex); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 2a49604c75..a4e8312ca0 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -165,7 +165,7 @@ public: int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag); - void AFFICHE_SPEED(const byte *spriteData, int xp, int yp, int spriteIndex); + void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d228f0ca97..1da267d896 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -196,7 +196,7 @@ bool HopkinsEngine::runWin95Demo() { _globals._exitId = 0; if (!_globals._exitId) { - _globals._exitId = _menuManager.MENU(); + _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); @@ -502,7 +502,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals._exitId = 0; if (!_globals._exitId) { - _globals._exitId = _menuManager.MENU(); + _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) { if (!g_system->getEventManager()->shouldQuit()) PUBQUIT(); @@ -863,7 +863,7 @@ bool HopkinsEngine::runOS2Full() { if (_globals._exitId == 300) _globals._exitId = 0; if (!_globals._exitId) { - _globals._exitId = _menuManager.MENU(); + _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) break; } @@ -1231,7 +1231,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.forest = true; + _globals._forestFl = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); @@ -1244,7 +1244,7 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = false; if (_globals._exitId < 35 || _globals._exitId > 49 ) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.forest = false; + _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } break; @@ -1750,7 +1750,7 @@ bool HopkinsEngine::runBeOSFull() { if (_globals._exitId == 300) _globals._exitId = 0; if (!_globals._exitId) { - _globals._exitId = _menuManager.MENU(); + _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); @@ -2119,7 +2119,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.forest = true; + _globals._forestFl = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); @@ -2133,7 +2133,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = false; if ((_globals._exitId < 35) || (_globals._exitId > 49)) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.forest = false; + _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } break; @@ -2636,7 +2636,7 @@ bool HopkinsEngine::runWin95full() { _globals._exitId = 0; if (!_globals._exitId) { - _globals._exitId = _menuManager.MENU(); + _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); @@ -3007,7 +3007,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.forest = true; + _globals._forestFl = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); @@ -3020,7 +3020,7 @@ bool HopkinsEngine::runWin95full() { _globals.NOSPRECRAN = false; if (_globals._exitId < 35 || _globals._exitId > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.forest = false; + _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } break; @@ -3515,7 +3515,7 @@ bool HopkinsEngine::runLinuxFull() { if (_globals._exitId == 300) _globals._exitId = 0; if (!_globals._exitId) { - _globals._exitId = _menuManager.MENU(); + _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); @@ -3885,7 +3885,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.forest = true; + _globals._forestFl = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); @@ -3898,7 +3898,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = false; if (_globals._exitId < 35 || _globals._exitId > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.forest = false; + _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } break; @@ -4790,7 +4790,7 @@ void HopkinsEngine::restoreSystem() { void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); - _globals.forest = false; + _globals._forestFl = false; _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _graphicsManager.loadImage("BOX"); @@ -5761,7 +5761,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { _graphicsManager.max_x = SCREEN_WIDTH; _graphicsManager.max_y = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; - _globals.forest = false; + _globals._forestFl = false; _globals._disableInventFl = true; _globals._exitId = 0; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 2252a45d06..ca23ac0263 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -41,7 +41,7 @@ void MenuManager::setParent(HopkinsEngine *vm) { enum MenuSelection { MENU_NONE = 0, PLAY_GAME = 1, LOAD_GAME = 2, OPTIONS = 3, INTRODUCTION = 4, QUIT = 5 }; -int MenuManager::MENU() { +int MenuManager::menu() { byte *spriteData = NULL; MenuSelection menuIndex; Common::Point mousePos; @@ -57,7 +57,7 @@ int MenuManager::MENU() { result = 0; while (!g_system->getEventManager()->shouldQuit()) { - _vm->_globals.forest = false; + _vm->_globals._forestFl = false; _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; _vm->_globals._exitId = 0; @@ -166,11 +166,11 @@ int MenuManager::MENU() { frame5Index = 1; } - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, frame1Index); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, frame2Index + 2); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, frame3Index + 4); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, frame4Index + 6); - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, frame5Index + 8); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 259, frame1Index); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 291, frame2Index + 2); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 322, frame3Index + 4); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 354, frame4Index + 6); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 386, frame5Index + 8); _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) @@ -178,7 +178,7 @@ int MenuManager::MENU() { } while (!selectionMade); if (menuIndex == PLAY_GAME) { - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 259, 10); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); result = 1; @@ -186,7 +186,7 @@ int MenuManager::MENU() { if (menuIndex != LOAD_GAME) break; - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 291, 11); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); @@ -204,7 +204,7 @@ int MenuManager::MENU() { break; // Options menu item selected - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 322, 12); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 322, 12); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); @@ -212,7 +212,7 @@ int MenuManager::MENU() { _vm->_dialogsManager.showOptionsDialog(); } if (menuIndex == INTRODUCTION) { - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 354, 13); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); _vm->playIntro(); @@ -220,7 +220,7 @@ int MenuManager::MENU() { } if ( menuIndex == QUIT) { - _vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 386, 14); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); result = -1; @@ -234,6 +234,4 @@ int MenuManager::MENU() { return result; } - - } // End of namespace Hopkins diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h index 5c174815ff..aeb3aa17cd 100644 --- a/engines/hopkins/menu.h +++ b/engines/hopkins/menu.h @@ -35,11 +35,10 @@ class MenuManager { private: HopkinsEngine *_vm; - byte MenuTxt[10600]; public: void setParent(HopkinsEngine *vm); - int MENU(); + int menu(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ac8e5fc43b..2d04998d5f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2661,7 +2661,7 @@ LABEL_38: _vm->_globals.GOACTION = false; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals.forest && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { + if (_vm->_globals._forestFl && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { v10 = getSpriteX(0); v11 = getSpriteY(0); @@ -2752,7 +2752,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals._saveData->data[svField1]; if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); - if (!_vm->_globals.forest || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { + if (!_vm->_globals._forestFl || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) @@ -4122,11 +4122,11 @@ void ObjectsManager::BOB_VIVANT(int idx) { v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager._characterSprite, + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, _vm->_graphicsManager.ofscroll + v2, v3, *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); if (_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_talkManager._characterSprite, v2, v3, v4); + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, v2, v3, v4); } } @@ -4369,7 +4369,7 @@ void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { if (!a4) stopBobAnimation(idx); else if (a4 == 4) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals._bob[idx]._spriteData, + _vm->_graphicsManager.fastDisplay(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._oldX, _vm->_globals._bob[idx]._oldY, _vm->_globals._bob[idx]._frameIndex); stopBobAnimation(idx); _vm->_eventsManager.VBL(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a3dfa3a746..7a336d00f0 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -171,7 +171,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v68 = (int16)READ_LE_UINT16(dataP + 8); int v66 = (int16)READ_LE_UINT16(dataP + 10); if (v72 == 52) { - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(dataP + 10), v70); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(dataP + 10), v70); } else if (v72 == 51) { _vm->_objectsManager.BOB_VIVANT(v70); } else { @@ -800,11 +800,11 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(10) == 34) v15 = false; if (_vm->_objectsManager.BOBPOSI(10) == 12) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); if (_vm->_objectsManager.BOBPOSI(10) == 23) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); if (_vm->_objectsManager.BOBPOSI(10) == 34) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(9) != 36); _vm->_objectsManager.SPRITE_ON(0); @@ -1098,7 +1098,7 @@ LABEL_1141: v24 = 0; _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(8) != 32); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.stopBobAnimation(11); _vm->_objectsManager.stopBobAnimation(8); @@ -1204,7 +1204,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(2); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } if (_vm->_globals._saveData->data[svField183] == 2) { @@ -1246,7 +1246,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(3); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); _vm->_soundManager.DEL_SAMPLE(1); } break; @@ -1255,12 +1255,12 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals._saveData->data[svField186] == 1) { _vm->_animationManager.playSequence("CIB5C.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); } break; @@ -1268,12 +1268,12 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals._saveData->data[svField186] == 1) { _vm->_animationManager.playSequence("CIB5D.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); } break; @@ -1281,12 +1281,12 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } if (_vm->_globals._saveData->data[svField184] == 1) { _vm->_animationManager.playSequence("CIB6C.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); } break; @@ -1294,12 +1294,12 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } if (_vm->_globals._saveData->data[svField184] == 1) { _vm->_animationManager.playSequence("CIB6D.SEQ", 1, 12, 1); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); } break; @@ -1333,7 +1333,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 117); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); _vm->_objectsManager.stopBobAnimation(12); _vm->_objectsManager.stopBobAnimation(10); _vm->_objectsManager.setBobAnimation(11); @@ -1778,7 +1778,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(4) == 18) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); } while (_vm->_objectsManager.BOBPOSI(4) != 26); _vm->_objectsManager.stopBobAnimation(4); _vm->_globals.NO_VISU = false; @@ -1909,7 +1909,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 210; _vm->_animationManager.playSequence2("SECRET1.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM73a"); @@ -1965,7 +1965,7 @@ LABEL_1141: _vm->_soundManager.SPECIAL_SOUND = 229; _vm->_animationManager.playSequence("MUR.SEQ", 1, 12, 1); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); break; case 230: { @@ -2007,7 +2007,7 @@ LABEL_1141: _vm->_objectsManager.setSpriteX(0, 476); _vm->_objectsManager.setSpriteY(0, 278); _vm->_objectsManager.SPRITE_ON(0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM93c"); _vm->_objectsManager.OBSSEUL = 0; @@ -2083,11 +2083,11 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals._saveData->data[svField341] == 1) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); if (_vm->_globals._saveData->data[svField341] == 2) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); if (_vm->_globals._saveData->data[svField341] == 3) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); if (_vm->_globals._saveData->data[svField341] == 1) _vm->_globals._saveData->data[svField338] = 0; if (_vm->_globals._saveData->data[svField341] == 2) @@ -2097,7 +2097,7 @@ LABEL_1141: } _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); break; } @@ -2113,11 +2113,11 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals._saveData->data[svField341] == 1) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); if (_vm->_globals._saveData->data[svField341] == 2) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); if (_vm->_globals._saveData->data[svField341] == 3) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); if (_vm->_globals._saveData->data[svField341] == 1) _vm->_globals._saveData->data[svField338] = 0; if (_vm->_globals._saveData->data[svField341] == 2) @@ -2127,7 +2127,7 @@ LABEL_1141: } _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); break; } @@ -2143,11 +2143,11 @@ LABEL_1141: _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals._saveData->data[svField341] == 1) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); if (_vm->_globals._saveData->data[svField341] == 2) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); if (_vm->_globals._saveData->data[svField341] == 3) - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); if (_vm->_globals._saveData->data[svField341] == 1) _vm->_globals._saveData->data[svField338] = 0; if (_vm->_globals._saveData->data[svField341] == 2) @@ -2157,7 +2157,7 @@ LABEL_1141: } _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); break; } @@ -2239,7 +2239,7 @@ LABEL_1141: _vm->_globals._saveData->data[svField356] = 0; _vm->_globals._saveData->data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); _vm->_objectsManager.SPRITE_ON(1); break; @@ -2261,7 +2261,7 @@ LABEL_1141: _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); _vm->_globals.ZONEP[4]._destX = 276; _vm->_objectsManager.VERBE_ON(4, 19); - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals._saveData->data[svField399] = 1; break; @@ -2299,21 +2299,21 @@ LABEL_1141: case 601: _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(2, 0, 16, 4); break; case 602: _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(4, 0, 16, 4); break; case 603: _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; @@ -2330,7 +2330,7 @@ LABEL_1141: case 604: _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; @@ -2346,7 +2346,7 @@ LABEL_1141: case 605: _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); _vm->_graphicsManager.FADE_OUTS(); @@ -2364,7 +2364,7 @@ LABEL_1141: case 606: _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.AFFICHE_SPEED(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 339646a491..0209f0f737 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -777,7 +777,7 @@ void TalkManager::CHERCHE_ANIM0(int a1, int a2) { do { v7 = (int16)READ_LE_UINT16(&v8[2 * v6 + 4]); if (v7 && _vm->_globals._speed != 501) - _vm->_graphicsManager.AFFICHE_SPEED(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), + _vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), (int16)READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); v6 += 5; } while (_vm->_globals._speed != 501 && v7); -- cgit v1.2.3 From f89001d75c73750a67ff6c8bc392c5b526fb803c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Dec 2012 22:48:11 +0100 Subject: HOPKINS: Renaming --- engines/hopkins/anim.cpp | 9 ++-- engines/hopkins/dialogs.cpp | 32 ++++++------ engines/hopkins/font.cpp | 26 +++++----- engines/hopkins/globals.cpp | 23 +++++---- engines/hopkins/globals.h | 9 ++-- engines/hopkins/hopkins.cpp | 38 +++++++-------- engines/hopkins/hopkins.h | 2 +- engines/hopkins/objects.cpp | 6 +-- engines/hopkins/script.cpp | 88 ++++++++++++++++----------------- engines/hopkins/sound.cpp | 115 ++++++++++++++++++++++---------------------- engines/hopkins/sound.h | 18 +++---- engines/hopkins/talk.cpp | 8 +-- 12 files changed, 183 insertions(+), 191 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 83f039341c..763f19cd2f 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -805,7 +805,6 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { */ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool readError; - int v7; byte *ptr = NULL; byte *v9; byte *v10; @@ -816,7 +815,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->shouldQuit()) return; - v7 = 0; + bool v7 = false; _vm->_eventsManager._mouseFl = false; if (!NO_COUL) { _vm->_eventsManager.VBL(); @@ -843,12 +842,12 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.read(v9, nbytes); if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { - v7 = 1; + v7 = true; ptr = _vm->_globals.allocMemory(307200); memcpy(ptr, v9, 307200); } if (_vm->_animationManager.NO_SEQ) { - if (v7 == 1) + if (v7) memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); if (!_vm->getIsDemo()) { _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -962,7 +961,7 @@ LABEL_59: _vm->_eventsManager._mouseFl = true; } - if (v7 == 1) + if (v7) _vm->_globals.freeMemory(ptr); _vm->_globals.freeMemory(v10); } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7480d34523..0cd53bb9b0 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -75,14 +75,14 @@ void DialogsManager::showOptionsDialog() { mousePos.x = _vm->_eventsManager.getMouseX(); mousePos.y = _vm->_eventsManager.getMouseY(); - if (!_vm->_soundManager.MUSICOFF) { + if (!_vm->_soundManager._musicOff) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { // Change the music volume ++_vm->_soundManager.MUSICVOL; _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; if (_vm->_soundManager.MUSICVOL <= 12) - _vm->_soundManager.PLAY_SOUND("bruit2.wav"); + _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.MUSICVOL = 12; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); @@ -90,10 +90,10 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager.MUSICOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + if (!_vm->_soundManager._musicOff && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { --_vm->_soundManager.MUSICVOL; if (_vm->_soundManager.MUSICVOL >= 0) - _vm->_soundManager.PLAY_SOUND("bruit2.wav"); + _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.MUSICVOL = 0; @@ -103,11 +103,11 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } } - if (!_vm->_soundManager.SOUNDOFF) { + if (!_vm->_soundManager._soundOffFl) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { ++_vm->_soundManager.SOUNDVOL; if (_vm->_soundManager.SOUNDVOL <= 16) - _vm->_soundManager.PLAY_SOUND("bruit2.wav"); + _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.SOUNDVOL = 16; _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; @@ -116,10 +116,10 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager.SOUNDOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { + if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { --_vm->_soundManager.SOUNDVOL; if (_vm->_soundManager.SOUNDVOL >= 0) - _vm->_soundManager.PLAY_SOUND("bruit2.wav"); + _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.SOUNDVOL = 0; _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; @@ -134,7 +134,7 @@ void DialogsManager::showOptionsDialog() { ++_vm->_soundManager.VOICEVOL; if (_vm->_soundManager.VOICEVOL <= 16) - _vm->_soundManager.PLAY_SOUND("bruit2.wav"); + _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.VOICEVOL = 16; _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; @@ -146,7 +146,7 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { --_vm->_soundManager.VOICEVOL; if (_vm->_soundManager.VOICEVOL >= 0) - _vm->_soundManager.PLAY_SOUND("bruit2.wav"); + _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.VOICEVOL = 0; _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; @@ -168,11 +168,11 @@ void DialogsManager::showOptionsDialog() { } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { - if (_vm->_soundManager.MUSICOFF == 1) { - _vm->_soundManager.MUSICOFF = 0; + if (_vm->_soundManager._musicOff) { + _vm->_soundManager._musicOff = false; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); } else { - _vm->_soundManager.MUSICOFF = 1; + _vm->_soundManager._musicOff = true; _vm->_soundManager.MODSetMusicVolume(0); } @@ -180,7 +180,7 @@ void DialogsManager::showOptionsDialog() { } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) { - _vm->_soundManager.SOUNDOFF = _vm->_soundManager.SOUNDOFF != 1; + _vm->_soundManager._soundOffFl = !_vm->_soundManager._soundOffFl; _vm->_soundManager.updateScummVMSoundSettings(); } @@ -254,8 +254,8 @@ void DialogsManager::showOptionsDialog() { _vm->_globals.opt_txt = !_vm->_soundManager._textOffFl ? 7 : 8; _vm->_globals.opt_voice = !_vm->_soundManager._voiceOffFl ? 7 : 8; - _vm->_globals.opt_sound = !_vm->_soundManager.SOUNDOFF ? 7 : 8; - _vm->_globals.opt_music = !_vm->_soundManager.MUSICOFF ? 7 : 8; + _vm->_globals.opt_sound = !_vm->_soundManager._soundOffFl ? 7 : 8; + _vm->_globals.opt_music = !_vm->_soundManager._musicOff ? 7 : 8; if (_vm->_globals.SVGA == 1) _vm->_globals.opt_anm = 10; diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index c5a580fab0..484745347e 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -141,7 +141,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in error("Bad number for text"); _vm->_globals.police_l = 11; - _vm->_globals.largeur_boite = 11 * _text[idx]._field3FE; + _vm->_globals._boxWidth = 11 * _text[idx]._field3FE; if (_text[idx]._textLoadedFl) { int textType = _text[idx]._textType; if (textType != 6 && textType != 1 && textType != 3 && textType != 5) { @@ -247,17 +247,17 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in goto LABEL_43; } _text[idx]._field3FE = v64; - _vm->_globals.largeur_boite = 0; + _vm->_globals._boxWidth = 0; for (int v15 = 0; v15 < v64 + 1; v15++) { byte v16 = *(v60 + v15); if (v16 <= 31) v16 = 32; - _vm->_globals.largeur_boite += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); + _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); } - _vm->_globals.largeur_boite += 2; - int v17 = _vm->_globals.largeur_boite / 2; + _vm->_globals._boxWidth += 2; + int v17 = _vm->_globals._boxWidth / 2; if (v17 < 0) v17 = -v17; _text[idx]._pos.x = 320 - v17; @@ -268,15 +268,15 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } } else { LABEL_43: - if (!_vm->_globals.largeur_boite) - _vm->_globals.largeur_boite = 240; + if (!_vm->_globals._boxWidth) + _vm->_globals._boxWidth = 240; int v65 = 0; byte *v61 = _tempText; int v21; int lineSize; do { int v19 = 0; - int ptrb = _vm->_globals.largeur_boite - 4; + int ptrb = _vm->_globals._boxWidth - 4; for (;;) { lineSize = v19; do @@ -338,22 +338,22 @@ LABEL_57: for (int i = 0; i <= 19; i++) { if (_textSortArray[i]) - _vm->_globals.largeur_boite = _textSortArray[i]; + _vm->_globals._boxWidth = _textSortArray[i]; } if ((_text[idx]._textType < 2) || (_text[idx]._textType > 3)) { int i; - for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals.largeur_boite + i > 638 && i > -2 && _text[idx]._textType; i -= 2) + for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals._boxWidth + i > 638 && i > -2 && _text[idx]._textType; i -= 2) ; _text[idx]._pos.x = i; v73 = _vm->_eventsManager._startPos.x + i; } else { if (_vm->_globals.nbrligne == (SCREEN_WIDTH - 1)) { - while (_vm->_globals.largeur_boite + v73 > 638 && v73 > -2) + while (_vm->_globals._boxWidth + v73 > 638 && v73 > -2) v73 -= 2; } if (_vm->_globals.nbrligne == (SCREEN_WIDTH * 2)) { - while (_vm->_globals.largeur_boite + v73 > 1278 && v73 > -2) + while (_vm->_globals._boxWidth + v73 > 1278 && v73 > -2) v73 -= 2; } _text[idx]._pos.x = v73; @@ -362,7 +362,7 @@ LABEL_57: _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; int v56 = v73; int v55 = yp; - int v53 = _vm->_globals.largeur_boite + 10; + int v53 = _vm->_globals._boxWidth + 10; int v51 = (_vm->_globals.police_h + 1) * lineCount + 12; if (_text[idx]._textType == 6) { int v27 = v53 / 2; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ee96b2a0f7..3abc7b7ada 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -134,7 +134,7 @@ Globals::Globals() { _curObjectIndex = 0; NUM_FICHIER_OBJ = 0; nbrligne = 0; - largeur_boite = 0; + _boxWidth = 0; hauteur_boite = 0; _forestFl = false; _objectWidth = _objectHeight = 0; @@ -147,7 +147,6 @@ Globals::Globals() { PLANX = PLANY = 0; PLANI = 0; PERSO = 0; - PASSWORD = false; _screenId = 0; NOSPRECRAN = false; OLD_ECRAN = 0; @@ -205,8 +204,8 @@ Globals::Globals() { essai2 = NULL; inventaire2 = NULL; GESTE = NULL; - INVENTAIRE_OBJET = NULL; - FORETSPR = NULL; + _inventoryObject = NULL; + _forestSprite = NULL; COUCOU = NULL; chemin = NULL; cache_souris = NULL; @@ -219,7 +218,7 @@ Globals::Globals() { // Reset flags CENSURE = false; - GESTE_FLAG = false; + GESTE_FLAG = 0; BPP_NOAFF = false; _disableInventFl = false; netscape = false; @@ -258,8 +257,8 @@ Globals::~Globals() { freeMemory(BUFFERTAPE); freeMemory(inventaire2); freeMemory(GESTE); - freeMemory(INVENTAIRE_OBJET); - freeMemory(FORETSPR); + freeMemory(_inventoryObject); + freeMemory(_forestSprite); freeMemory(COUCOU); freeMemory(cache_souris); freeMemory(Bufferdecor); @@ -346,7 +345,7 @@ void Globals::clearAll() { police_h = 0; police_l = 0; hauteur_boite = 0; - largeur_boite = 0; + _boxWidth = 0; _vm->_fontManager.clearAll(); @@ -402,18 +401,18 @@ void Globals::clearAll() { essai1 = (int16 *)(BUFFERTAPE + 25000); essai2 = (int16 *)(BUFFERTAPE + 50000); BufLig = (int16 *)(BUFFERTAPE + 75000); - largeur_boite = 240; + _boxWidth = 240; _vm->_eventsManager._objectBuf = allocMemory(2500); - INVENTAIRE_OBJET = allocMemory(2500); + _inventoryObject = allocMemory(2500); ADR_FICHIER_OBJ = g_PTRNUL; - FORETSPR = g_PTRNUL; + _forestSprite = g_PTRNUL; _forestFl = false; cache_souris = allocMemory(2500); GESTE = g_PTRNUL; - GESTE_FLAG = false; + GESTE_FLAG = 0; } void Globals::HOPKINS_DATA() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 91486aa0a2..2689b59c01 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -376,12 +376,12 @@ public: byte *GESTE; int _curObjectIndex; int NUM_FICHIER_OBJ; - int nbrligne; - int largeur_boite; - byte *INVENTAIRE_OBJET; + int nbrligne; // Useless variable? + int _boxWidth; + byte *_inventoryObject; int hauteur_boite; int GESTE_FLAG; - byte *FORETSPR; + byte *_forestSprite; bool _forestFl; byte *COUCOU; int16 *chemin; @@ -400,7 +400,6 @@ public: int _exitId; int PLANX, PLANY; int PLANI; - bool PASSWORD; // CHECKME: Useless variable? bool NOSPRECRAN; int _screenId; int OLD_ECRAN; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1da267d896..ea67f57f63 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -185,7 +185,6 @@ bool HopkinsEngine::runWin95Demo() { _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; - _globals.PASSWORD = true; if (getLanguage() != Common::PL_POL) if (!displayAdultDisclaimer()) @@ -495,7 +494,6 @@ bool HopkinsEngine::runLinuxDemo() { _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; - _globals.PASSWORD = true; for (;;) { if (_globals._exitId == 300) @@ -1235,15 +1233,15 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); - if (_globals.FORETSPR == g_PTRNUL) { + if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; if (_globals._exitId < 35 || _globals._exitId > 49 ) { - _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); + _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } @@ -1336,7 +1334,7 @@ bool HopkinsEngine::runOS2Full() { case 61: if (_globals._saveData->data[311] == 1 && !_globals._saveData->data[312] ) - INCENDIE(); + handleConflagration(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); break; @@ -2123,16 +2121,16 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); - if (_globals.FORETSPR == g_PTRNUL) { + if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; if ((_globals._exitId < 35) || (_globals._exitId > 49)) { - _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); + _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } @@ -2225,7 +2223,7 @@ bool HopkinsEngine::runBeOSFull() { case 61: if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) - INCENDIE(); + handleConflagration(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); break; @@ -2630,7 +2628,6 @@ bool HopkinsEngine::runWin95full() { _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; - _globals.PASSWORD = true; for (;;) { if (_globals._exitId == 300) _globals._exitId = 0; @@ -3011,15 +3008,15 @@ bool HopkinsEngine::runWin95full() { _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); - if (_globals.FORETSPR == g_PTRNUL) { + if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; if (_globals._exitId < 35 || _globals._exitId > 49) { - _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); + _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } @@ -3111,7 +3108,7 @@ bool HopkinsEngine::runWin95full() { case 61: if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) - INCENDIE(); + handleConflagration(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); break; @@ -3509,7 +3506,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; - _globals.PASSWORD = false; for (;;) { if (_globals._exitId == 300) @@ -3889,15 +3885,15 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); - if (_globals.FORETSPR == g_PTRNUL) { + if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals.FORETSPR = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); _globals.NOSPRECRAN = false; if (_globals._exitId < 35 || _globals._exitId > 49) { - _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); + _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; _soundManager.DEL_SAMPLE(1); } @@ -3990,7 +3986,7 @@ bool HopkinsEngine::runLinuxFull() { case 61: if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) - INCENDIE(); + handleConflagration(); _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); break; @@ -4821,7 +4817,7 @@ void HopkinsEngine::PUBQUIT() { _graphicsManager.FADE_OUTW(); } -void HopkinsEngine::INCENDIE() { +void HopkinsEngine::handleConflagration() { _globals._disableInventFl = true; _globals.iRegul = 1; _graphicsManager.loadImage("IM71"); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 5b62bb28ab..ce73c6a0c2 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -87,7 +87,7 @@ private: void PUBQUIT(); void displayEndDemo(); void bombExplosion(); - void INCENDIE(); + void handleConflagration(); void BASE(); void BASED(); void playEnding(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2d04998d5f..9ef7b5dd76 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -147,8 +147,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { break; case 3: - capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals.INVENTAIRE_OBJET, val2); - dataP = _vm->_globals.INVENTAIRE_OBJET; + capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals._inventoryObject, val2); + dataP = _vm->_globals._inventoryObject; break; default: @@ -4086,7 +4086,7 @@ void ObjectsManager::SPECIAL_JEU() { setBobAnimation(6); _vm->_globals._saveData->data[svField261] = 2; ZONE_OFF(15); - _vm->_soundManager.PLAY_SOUND("SOUND75.WAV"); + _vm->_soundManager.playSound("SOUND75.WAV"); } if (_vm->_globals._saveData->data[svField261] == 2 && BOBPOSI(6) == 6) { stopBobAnimation(6); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 7a336d00f0..89c6d531ac 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -125,12 +125,12 @@ int ScriptManager::handleOpcode(byte *dataP) { if (mesgId == 363) mesgId = 636; } - if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { + if (!_vm->_soundManager._soundOffFl && _vm->_soundManager._soundFl) { do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_soundManager.SOUND_FLAG); + } while (_vm->_soundManager._soundFl); } if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); @@ -545,7 +545,7 @@ LABEL_1141: if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { _vm->_graphicsManager.FADE_OUTW(); } else { - _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); + _vm->_soundManager.playSound("SOUND17.WAV"); _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playSequence2("HELICO.SEQ", 10, 4, 10); } @@ -598,7 +598,7 @@ LABEL_1141: _vm->_graphicsManager.FIN_VISU(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) - _vm->_soundManager.PLAY_SOUND("SOUND17.WAV"); + _vm->_soundManager.playSound("SOUND17.WAV"); _vm->_soundManager.SPECIAL_SOUND = 14; _vm->_graphicsManager.FADE_LINUX = 2; @@ -666,13 +666,13 @@ LABEL_1141: break; case 35: - if (!_vm->_soundManager.SOUNDOFF) { + if (!_vm->_soundManager._soundOffFl) { do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_soundManager.SOUND_FLAG); + } while (_vm->_soundManager._soundFl); } _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); break; @@ -864,7 +864,7 @@ LABEL_1141: } case 50: - _vm->_soundManager.PLAY_SOUND("SOUND46.WAv"); + _vm->_soundManager.playSound("SOUND46.WAv"); _vm->_objectsManager.OPTI_ONE(11, 0, 23, 0); break; @@ -887,7 +887,7 @@ LABEL_1141: return -1; // Exiting game if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); v52 = true; } _vm->_eventsManager.VBL(); @@ -1025,13 +1025,13 @@ LABEL_1141: return -1; // Exiting game if (_vm->_objectsManager.BOBPOSI(12) == 4 && !v21) { - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); v21 = 1; } if (_vm->_objectsManager.BOBPOSI(12) == 5) v21 = 0; if (_vm->_objectsManager.BOBPOSI(4) == 5 && !v21) { - _vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.playWav(2); v21 = 1; } if (_vm->_objectsManager.BOBPOSI(4) == 6) @@ -1085,13 +1085,13 @@ LABEL_1141: return -1; // Exiting game if (_vm->_objectsManager.BOBPOSI(11) == 4 && !v24) { - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); v24 = 1; } if (_vm->_objectsManager.BOBPOSI(11) == 5) v24 = 0; if (_vm->_objectsManager.BOBPOSI(8) == 11 && !v24) { - _vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.playWav(2); v24 = 1; } if (_vm->_objectsManager.BOBPOSI(8) == 12) @@ -1106,7 +1106,7 @@ LABEL_1141: _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.SET_BOBPOSI(5, 0); _vm->_objectsManager.SET_BOBPOSI(6, 0); - _vm->_soundManager.PLAY_WAV(3); + _vm->_soundManager.playWav(3); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1252,7 +1252,7 @@ LABEL_1141: break; case 90: - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + _vm->_soundManager.playSound("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); @@ -1265,7 +1265,7 @@ LABEL_1141: break; case 91: - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + _vm->_soundManager.playSound("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField186]) { _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); @@ -1278,7 +1278,7 @@ LABEL_1141: break; case 92: - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + _vm->_soundManager.playSound("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); @@ -1291,7 +1291,7 @@ LABEL_1141: break; case 93: - _vm->_soundManager.PLAY_SOUND("SOUND52.WAV"); + _vm->_soundManager.playSound("SOUND52.WAV"); if (!_vm->_globals._saveData->data[svField184]) { _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); @@ -1326,7 +1326,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(9) != 15); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.SPRITE_ON(0); - _vm->_soundManager.PLAY_SOUND("SOUND50.WAV"); + _vm->_soundManager.playSound("SOUND50.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1512,21 +1512,21 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 10); - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 18); - _vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.playWav(2); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 62); - _vm->_soundManager.PLAY_WAV(3); + _vm->_soundManager.playWav(3); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1550,21 +1550,21 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 10); - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 18); - _vm->_soundManager.PLAY_WAV(2); + _vm->_soundManager.playWav(2); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 38); - _vm->_soundManager.PLAY_WAV(3); + _vm->_soundManager.playWav(3); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1691,7 +1691,7 @@ LABEL_1141: _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.setBobAnimation(10); _vm->_objectsManager.BOB_OFFSET(10, 300); - _vm->_soundManager.PLAY_SOUND("SOUND44.WAV"); + _vm->_soundManager.playSound("SOUND44.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1706,7 +1706,7 @@ LABEL_1141: _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(6) != 10); - _vm->_soundManager.PLAY_SOUND("SOUND71.WAV"); + _vm->_soundManager.playSound("SOUND71.WAV"); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.stopBobAnimation(4); do { @@ -1717,7 +1717,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(7) != 15); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(8); - _vm->_soundManager.PLAY_SOUND("SOUND70.WAV"); + _vm->_soundManager.playSound("SOUND70.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1795,7 +1795,7 @@ LABEL_1141: return -1; // Exiting game if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); v41 = 1; } if (_vm->_objectsManager.BOBPOSI(3) == 11) @@ -1817,7 +1817,7 @@ LABEL_1141: return -1; // Exiting game if (_vm->_objectsManager.BOBPOSI(4) == 10 && !v42) { - _vm->_soundManager.PLAY_WAV(1); + _vm->_soundManager.playWav(1); v42 = 1; } if (_vm->_objectsManager.BOBPOSI(4) == 11) @@ -1892,7 +1892,7 @@ LABEL_1141: } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.setBobAnimation(2); - _vm->_soundManager.PLAY_SOUND("SOUND66.WAV"); + _vm->_soundManager.playSound("SOUND66.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1999,7 +1999,7 @@ LABEL_1141: if (_vm->_objectsManager.BOBPOSI(7) == 9 && !v45) { v45 = 1; - _vm->_soundManager.PLAY_SOUND("SOUND81.WAV"); + _vm->_soundManager.playSound("SOUND81.WAV"); } _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(7) != 15); @@ -2080,7 +2080,7 @@ LABEL_1141: v70 = 4; if (v47 == 1) v70 = 6; - _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals._saveData->data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -2095,7 +2095,7 @@ LABEL_1141: if (_vm->_globals._saveData->data[svField341] == 3) _vm->_globals._saveData->data[svField340] = 0; } - _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); break; @@ -2110,7 +2110,7 @@ LABEL_1141: v70 = 4; if (v48 == 1) v70 = 6; - _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals._saveData->data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -2125,7 +2125,7 @@ LABEL_1141: if (_vm->_globals._saveData->data[svField341] == 3) _vm->_globals._saveData->data[svField340] = 0; } - _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); break; @@ -2140,7 +2140,7 @@ LABEL_1141: v70 = 4; if (v49 == 1) v70 = 6; - _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); if (_vm->_globals._saveData->data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -2155,7 +2155,7 @@ LABEL_1141: if (_vm->_globals._saveData->data[svField341] == 3) _vm->_globals._saveData->data[svField340] = 0; } - _vm->_soundManager.PLAY_SOUND("SOUND83.WAV"); + _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); break; @@ -2163,7 +2163,7 @@ LABEL_1141: case 239: _vm->_objectsManager.removeSprite(0); - _vm->_soundManager.PLAY_SOUND("SOUND84.WAV"); + _vm->_soundManager.playSound("SOUND84.WAV"); _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); break; @@ -2176,13 +2176,13 @@ LABEL_1141: _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(1) == 12 && !soundFlag) { - _vm->_soundManager.PLAY_SOUND("SOUND86.WAV"); + _vm->_soundManager.playSound("SOUND86.WAV"); soundFlag = true; } if (_vm->_objectsManager.BOBPOSI(1) == 13) soundFlag = false; if (_vm->_objectsManager.BOBPOSI(1) == 25 && !soundFlag) { - _vm->_soundManager.PLAY_SOUND("SOUND85.WAV"); + _vm->_soundManager.playSound("SOUND85.WAV"); soundFlag = true; } if (_vm->_objectsManager.BOBPOSI(1) == 25) @@ -2220,7 +2220,7 @@ LABEL_1141: break; case 242: { - _vm->_soundManager.PLAY_SOUND("SOUND87.WAV"); + _vm->_soundManager.playSound("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; @@ -2246,7 +2246,7 @@ LABEL_1141: } case 243: - _vm->_soundManager.PLAY_SOUND("SOUND88.WAV"); + _vm->_soundManager.playSound("SOUND88.WAV"); if (_vm->_globals._saveData->data[svField341] == 2) { _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); @@ -2257,7 +2257,7 @@ LABEL_1141: break; case 245: - _vm->_soundManager.PLAY_SOUND("SOUND89.WAV"); + _vm->_soundManager.playSound("SOUND89.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); _vm->_globals.ZONEP[4]._destX = 276; _vm->_objectsManager.VERBE_ON(4, 19); @@ -2449,7 +2449,7 @@ LABEL_1141: int v60 = (int16)READ_LE_UINT16(dataP + 5); Common::String file = Common::String::format("SOUND%d.WAV", v60); - _vm->_soundManager.PLAY_SOUND(file); + _vm->_soundManager.playSound(file); opcodeType = 1; } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') { _vm->_objectsManager.VERBE_OFF((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e6e17e8521..66de0356ac 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -78,11 +78,11 @@ SoundManager::SoundManager() { OLD_SOUNDVOL = 0; OLD_MUSICVOL = 0; OLD_VOICEVOL = 0; - SOUNDOFF = true; - MUSICOFF = true; + _soundOffFl = true; + _musicOff = true; _voiceOffFl = true; _textOffFl = false; - SOUND_FLAG = false; + _soundFl = false; VBL_MERDE = false; SOUND_NUM = 0; old_music = 0; @@ -100,8 +100,8 @@ SoundManager::SoundManager() { } SoundManager::~SoundManager() { - STOP_MUSIC(); - DEL_MUSIC(); + stopMusic(); + delMusic(); MOD_FLAG = false; } @@ -115,7 +115,7 @@ void SoundManager::WSOUND_INIT() { } void SoundManager::VERIF_SOUND() { - if (!SOUNDOFF && SOUND_FLAG) { + if (!_soundOffFl && _soundFl) { if (!VOICE_STAT(1)) { STOP_VOICE(1); DEL_NWAV(SOUND_NUM); @@ -188,13 +188,13 @@ void SoundManager::playAnim_SOUND(int soundNumber) { break; } } else if (SPECIAL_SOUND == 1 && soundNumber == 17) - PLAY_SOUND("SOUND42.WAV"); + playSound("SOUND42.WAV"); else if (SPECIAL_SOUND == 5 && soundNumber == 19) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 14 && soundNumber == 625) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 16 && soundNumber == 25) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 17) { if (soundNumber == 6) PLAY_SAMPLE2(1); @@ -203,26 +203,26 @@ void SoundManager::playAnim_SOUND(int soundNumber) { else if (soundNumber == 67) PLAY_SAMPLE2(3); } else if (SPECIAL_SOUND == 198 && soundNumber == 15) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 199 && soundNumber == 72) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 208 && soundNumber == 40) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 210 && soundNumber == 2) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 211 && soundNumber == 22) - PLAY_WAV(1); + playWav(1); else if (SPECIAL_SOUND == 229) { if (soundNumber == 15) - PLAY_WAV(1); + playWav(1); else if (soundNumber == 91) - PLAY_WAV(2); + playWav(2); } } void SoundManager::WSOUND(int soundNumber) { if (old_music != soundNumber || !MOD_FLAG) { - if (MOD_FLAG == 1) + if (MOD_FLAG) WSOUND_OFF(); switch (soundNumber) { @@ -329,37 +329,37 @@ void SoundManager::WSOUND_OFF() { STOP_VOICE(0); STOP_VOICE(1); STOP_VOICE(2); - if (_vm->_soundManager.SOUND_FLAG) + if (_vm->_soundManager._soundFl) DEL_NWAV(SOUND_NUM); for (int i = 1; i <= 48; ++i) DEL_SAMPLE_SDL(i); if (MOD_FLAG) { - STOP_MUSIC(); - DEL_MUSIC(); + stopMusic(); + delMusic(); MOD_FLAG = false; } } void SoundManager::PLAY_MOD(const Common::String &file) { - if (!MUSICOFF) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, file); - if (MOD_FLAG) { - STOP_MUSIC(); - DEL_MUSIC(); - MOD_FLAG = false; - } - - LOAD_MUSIC(_vm->_globals.NFICHIER); - PLAY_MUSIC(); - MOD_FLAG = true; + if (_musicOff) + return; + _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, file); + if (MOD_FLAG) { + stopMusic(); + delMusic(); + MOD_FLAG = false; } + + loadMusic(_vm->_globals.NFICHIER); + playMusic(); + MOD_FLAG = true; } -void SoundManager::LOAD_MUSIC(const Common::String &file) { +void SoundManager::loadMusic(const Common::String &file) { if (Music._active) - DEL_MUSIC(); + delMusic(); Common::File f; Common::String filename = Common::String::format("%s.TWA", file.c_str()); @@ -392,7 +392,6 @@ void SoundManager::LOAD_MUSIC(const Common::String &file) { Music._mwavIndexes[destIndex++] = mwavIndex; } } while (!breakFlag); - f.close(); Music._active = true; @@ -400,17 +399,17 @@ void SoundManager::LOAD_MUSIC(const Common::String &file) { Music._currentIndex = -1; } -void SoundManager::PLAY_MUSIC() { +void SoundManager::playMusic() { if (Music._active) Music._isPlaying = true; } -void SoundManager::STOP_MUSIC() { +void SoundManager::stopMusic() { if (Music._active) Music._isPlaying = false; } -void SoundManager::DEL_MUSIC() { +void SoundManager::delMusic() { if (Music._active) { for (int i = 0; i < 50; ++i) { DEL_MSAMPLE(i); @@ -468,8 +467,8 @@ void SoundManager::checkVoices() { hasActiveVoice |= Voice[i]._status != 0; } - if (!hasActiveVoice && SOUND_FLAG) { - SOUND_FLAG = false; + if (!hasActiveVoice && _soundFl) { + _soundFl = false; SOUND_NUM = 0; } } @@ -603,7 +602,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { SDL_LVOICE(catPos, catLen); oldMusicVol = MUSICVOL; - if (!MUSICOFF && MUSICVOL > 2) + if (!_musicOff && MUSICVOL > 2) MUSICVOL = (signed int)((long double)MUSICVOL - (long double)MUSICVOL / 100.0 * 45.0); PLAY_VOICE_SDL(); @@ -642,9 +641,9 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { SOUND[soundIndex]._active = false; } -void SoundManager::PLAY_SOUND(const Common::String &file) { - if (!SOUNDOFF) { - if (SOUND_FLAG) +void SoundManager::playSound(const Common::String &file) { + if (!_soundOffFl) { + if (_soundFl) DEL_NWAV(SOUND_NUM); LOAD_NWAV(file, 1); PLAY_NWAV(1); @@ -652,7 +651,7 @@ void SoundManager::PLAY_SOUND(const Common::String &file) { } void SoundManager::PLAY_SOUND2(const Common::String &file) { - if (!SOUNDOFF) { + if (!_soundOffFl) { LOAD_NWAV(file, 1); PLAY_NWAV(1); } @@ -677,8 +676,8 @@ void SoundManager::loadSample(int wavIndex, const Common::String &file) { } void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { - if (!SOUNDOFF && SOUND[wavIndex]._active) { - if (SOUND_FLAG) + if (!_soundOffFl && SOUND[wavIndex]._active) { + if (_soundFl) DEL_NWAV(SOUND_NUM); if (voiceMode == 5) { if (VOICE_STAT(1) == 1) @@ -704,8 +703,8 @@ void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { } void SoundManager::PLAY_SAMPLE2(int idx) { - if (!SOUNDOFF && SOUND[idx]._active) { - if (SOUND_FLAG) + if (!_soundOffFl && SOUND[idx]._active) { + if (_soundFl) DEL_NWAV(SOUND_NUM); if (VOICE_STAT(1) == 1) STOP_VOICE(1); @@ -717,7 +716,7 @@ void SoundManager::LOAD_WAV(const Common::String &file, int wavIndex) { LOAD_NWAV(file, wavIndex); } -void SoundManager::PLAY_WAV(int wavIndex) { +void SoundManager::playWav(int wavIndex) { PLAY_NWAV(wavIndex); } @@ -808,8 +807,8 @@ void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { } void SoundManager::PLAY_NWAV(int wavIndex) { - if (!SOUND_FLAG && !SOUNDOFF) { - SOUND_FLAG = true; + if (!_soundFl && !_soundOffFl) { + _soundFl = true; SOUND_NUM = wavIndex; PLAY_SAMPLE_SDL(1, wavIndex); } @@ -821,7 +820,7 @@ void SoundManager::DEL_NWAV(int wavIndex) { STOP_VOICE(1); SOUND_NUM = 0; - SOUND_FLAG = false; + _soundFl = false; } } @@ -851,8 +850,8 @@ void SoundManager::syncSoundSettings() { muteAll = ConfMan.getBool("mute"); // Update the mute settings - MUSICOFF = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); - SOUNDOFF = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); + _musicOff = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); + _soundOffFl = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); _voiceOffFl = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); // Update the volume levels @@ -875,9 +874,9 @@ void SoundManager::syncSoundSettings() { } void SoundManager::updateScummVMSoundSettings() { - ConfMan.setBool("mute", MUSICOFF && SOUNDOFF && _voiceOffFl); - ConfMan.setBool("music_mute", MUSICOFF); - ConfMan.setBool("sfx_mute", SOUNDOFF); + ConfMan.setBool("mute", _musicOff && _soundOffFl && _voiceOffFl); + ConfMan.setBool("music_mute", _musicOff); + ConfMan.setBool("sfx_mute", _soundOffFl); ConfMan.setBool("speech_mute", _voiceOffFl); ConfMan.setInt("music_volume", MUSICVOL * 255 / 16); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 7eb5cc600c..c67e9e0987 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -119,11 +119,11 @@ public: int OLD_SOUNDVOL; int OLD_MUSICVOL; int OLD_VOICEVOL; - bool SOUNDOFF; - bool MUSICOFF; + bool _soundOffFl; + bool _musicOff; bool _voiceOffFl; bool _textOffFl; - bool SOUND_FLAG; + bool _soundFl; bool VBL_MERDE; int SOUND_NUM; bool MOD_FLAG; @@ -147,15 +147,15 @@ public: void WSOUND(int soundNumber); void WSOUND_OFF(); void PLAY_MOD(const Common::String &file); - void LOAD_MUSIC(const Common::String &file); - void PLAY_MUSIC(); - void STOP_MUSIC(); - void DEL_MUSIC(); + void loadMusic(const Common::String &file); + void playMusic(); + void stopMusic(); + void delMusic(); bool mixVoice(int voiceId, int voiceMode); void DEL_SAMPLE(int soundIndex); - void PLAY_SOUND(const Common::String &file); + void playSound(const Common::String &file); void PLAY_SOUND2(const Common::String &file2); void MODSetSampleVolume(); void MODSetVoiceVolume(); @@ -163,7 +163,7 @@ public: void loadSample(int wavIndex, const Common::String &file); void PLAY_SAMPLE(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); - void PLAY_WAV(int wavIndex); + void playWav(int wavIndex); void syncSoundSettings(); void updateScummVMSoundSettings(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0209f0f737..e15beb3306 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1041,7 +1041,7 @@ void TalkManager::REPONSE2(int a1, int a2) { if (a1 == 22 || a1 == 23) { _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); if (a1 == 22) { _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.getBobPosX(3)); _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.getBobPosX(3)); @@ -1053,7 +1053,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.setBobAnimation(6); _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(6) < 12); @@ -1089,7 +1089,7 @@ void TalkManager::REPONSE2(int a1, int a2) { } else if (a1 == 20 || a1 == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals.FORETSPR, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); if (a1 == 20) { _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.getBobPosX(1)); _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.getBobPosX(1)); @@ -1101,7 +1101,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.stopBobAnimation(2); _vm->_objectsManager.setBobAnimation(5); _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals.FORETSPR, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.BOBPOSI(5) < 12); -- cgit v1.2.3 From 2b665c67cb85feec4e273162a38275f86d26f08e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Dec 2012 23:53:45 +0100 Subject: HOPKINS: Add MOD file support --- engines/hopkins/dialogs.cpp | 6 -- engines/hopkins/sound.cpp | 131 ++++++++++++++++++++++++++++++-------------- engines/hopkins/sound.h | 4 +- 3 files changed, 90 insertions(+), 51 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0cd53bb9b0..19934f01df 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -79,7 +79,6 @@ void DialogsManager::showOptionsDialog() { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { // Change the music volume ++_vm->_soundManager.MUSICVOL; - _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; if (_vm->_soundManager.MUSICVOL <= 12) _vm->_soundManager.playSound("bruit2.wav"); @@ -97,7 +96,6 @@ void DialogsManager::showOptionsDialog() { else _vm->_soundManager.MUSICVOL = 0; - _vm->_soundManager.OLD_MUSICVOL = _vm->_soundManager.MUSICVOL; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); _vm->_soundManager.updateScummVMSoundSettings(); @@ -110,7 +108,6 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.SOUNDVOL = 16; - _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; _vm->_soundManager.MODSetSampleVolume(); _vm->_soundManager.updateScummVMSoundSettings(); @@ -122,7 +119,6 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.SOUNDVOL = 0; - _vm->_soundManager.OLD_SOUNDVOL = _vm->_soundManager.SOUNDVOL; _vm->_soundManager.MODSetSampleVolume(); _vm->_soundManager.updateScummVMSoundSettings(); @@ -137,7 +133,6 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.VOICEVOL = 16; - _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; _vm->_soundManager.MODSetVoiceVolume(); _vm->_soundManager.updateScummVMSoundSettings(); @@ -149,7 +144,6 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSound("bruit2.wav"); else _vm->_soundManager.VOICEVOL = 0; - _vm->_soundManager.OLD_VOICEVOL = _vm->_soundManager.VOICEVOL; _vm->_soundManager.MODSetVoiceVolume(); _vm->_soundManager.updateScummVMSoundSettings(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 66de0356ac..87a588509f 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -28,6 +28,8 @@ #include "hopkins/sound.h" #include "hopkins/globals.h" #include "hopkins/hopkins.h" +#include "audio/audiostream.h" +#include "audio/mods/protracker.h" namespace Audio { @@ -75,9 +77,6 @@ SoundManager::SoundManager() { SOUNDVOL = 0; VOICEVOL = 0; MUSICVOL = 0; - OLD_SOUNDVOL = 0; - OLD_MUSICVOL = 0; - OLD_VOICEVOL = 0; _soundOffFl = true; _musicOff = true; _voiceOffFl = true; @@ -102,6 +101,7 @@ SoundManager::SoundManager() { SoundManager::~SoundManager() { stopMusic(); delMusic(); + _vm->_mixer->stopHandle(_modHandle); MOD_FLAG = false; } @@ -227,7 +227,10 @@ void SoundManager::WSOUND(int soundNumber) { switch (soundNumber) { case 1: - PLAY_MOD("appar"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("appart"); + else + PLAY_MOD("appar"); break; case 2: PLAY_MOD("ville"); @@ -236,31 +239,52 @@ void SoundManager::WSOUND(int soundNumber) { PLAY_MOD("Rock"); break; case 4: - PLAY_MOD("polic"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("police"); + else + PLAY_MOD("polic"); break; case 5: PLAY_MOD("deep"); break; case 6: - PLAY_MOD("purga"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("purgat"); + else + PLAY_MOD("purga"); break; case 7: - PLAY_MOD("rivie"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("riviere"); + else + PLAY_MOD("rivie"); break; case 8: - PLAY_MOD("SUSPE"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("SUSPENS"); + else + PLAY_MOD("SUSPE"); break; case 9: PLAY_MOD("labo"); break; case 10: - PLAY_MOD("cadav"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("cadavre"); + else + PLAY_MOD("cadav"); break; case 11: - PLAY_MOD("caban"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("cabane"); + else + PLAY_MOD("caban"); break; case 12: - PLAY_MOD("purg2"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("purgat2"); + else + PLAY_MOD("purg2"); break; case 13: PLAY_MOD("foret"); @@ -272,19 +296,28 @@ void SoundManager::WSOUND(int soundNumber) { PLAY_MOD("ile2"); break; case 16: - PLAY_MOD("hopki"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("hopkins"); + else + PLAY_MOD("hopki"); break; case 17: PLAY_MOD("peur"); break; case 18: - PLAY_MOD("peur"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("URAVOLGA"); + else + PLAY_MOD("peur"); break; case 19: PLAY_MOD("BASE"); break; case 20: - PLAY_MOD("cada2"); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + PLAY_MOD("cadavre2"); + else + PLAY_MOD("cada2"); break; case 21: PLAY_MOD("usine"); @@ -362,37 +395,48 @@ void SoundManager::loadMusic(const Common::String &file) { delMusic(); Common::File f; - Common::String filename = Common::String::format("%s.TWA", file.c_str()); - - if (!f.open(filename)) - error("Error opening file %s", filename.c_str()); + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { + Common::String filename = Common::String::format("%s.MOD", file.c_str()); - char s[8]; - int destIndex = 0; - int mwavIndex; + if (!f.open(filename)) + error("Error opening file %s", filename.c_str()); - bool breakFlag = false; - do { - f.read(&s[0], 3); + Audio::AudioStream *modStream = Audio::makeProtrackerStream(&f); + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_modHandle, modStream); - if (s[0] == 'x') { - // End of list reached - Music._mwavIndexes[destIndex] = -1; - breakFlag = true; - } else { - // Convert two digits to a number - s[2] = '\0'; - mwavIndex = atol(&s[0]); - - filename = Common::String::format("%s_%s.%s", file.c_str(), &s[0], - (_vm->getPlatform() == Common::kPlatformWindows) ? "APC" : "WAV"); - LOAD_MSAMPLE(mwavIndex, filename); - - assert(destIndex < MUSIC_WAVE_COUNT); - Music._mwavIndexes[destIndex++] = mwavIndex; - } - } while (!breakFlag); - f.close(); + } else { + Common::String filename = Common::String::format("%s.TWA", file.c_str()); + + if (!f.open(filename)) + error("Error opening file %s", filename.c_str()); + + char s[8]; + int destIndex = 0; + int mwavIndex; + + bool breakFlag = false; + do { + f.read(&s[0], 3); + + if (s[0] == 'x') { + // End of list reached + Music._mwavIndexes[destIndex] = -1; + breakFlag = true; + } else { + // Convert two digits to a number + s[2] = '\0'; + mwavIndex = atol(&s[0]); + + filename = Common::String::format("%s_%s.%s", file.c_str(), &s[0], + (_vm->getPlatform() == Common::kPlatformWindows) ? "APC" : "WAV"); + LOAD_MSAMPLE(mwavIndex, filename); + + assert(destIndex < MUSIC_WAVE_COUNT); + Music._mwavIndexes[destIndex++] = mwavIndex; + } + } while (!breakFlag); + f.close(); + } Music._active = true; Music._isPlaying = false; @@ -428,6 +472,9 @@ void SoundManager::checkSounds() { } void SoundManager::checkMusic() { + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + return; + if (Music._active && Music._isPlaying) { int mwavIndex = Music._mwavIndexes[Music._currentIndex]; if (mwavIndex == -1) diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index c67e9e0987..23fac3f705 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -112,13 +112,11 @@ private: */ Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); public: + Audio::SoundHandle _modHandle; int SPECIAL_SOUND; int SOUNDVOL; int VOICEVOL; int MUSICVOL; - int OLD_SOUNDVOL; - int OLD_MUSICVOL; - int OLD_VOICEVOL; bool _soundOffFl; bool _musicOff; bool _voiceOffFl; -- cgit v1.2.3 From 59e85997b3debece5e920d7612fe33ccc9931934 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Dec 2012 00:31:42 +0100 Subject: HOPKINS: Load correct voice ressource file in BeOS and OS/2 versions --- engines/hopkins/files.cpp | 25 +++++++++++++++---------- engines/hopkins/sound.cpp | 43 +++++++++++++++++++++++++------------------ engines/hopkins/sound.h | 2 +- 3 files changed, 41 insertions(+), 29 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 6fefd1eb22..1971b82a2a 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -221,16 +221,21 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { break; case 9: - switch (_vm->_globals._language) { - case LANG_EN: - constructFilename(_vm->_globals.HOPLINK, "RES_VAN.CAT"); - break; - case LANG_FR: - constructFilename(_vm->_globals.HOPLINK, "RES_VFR.CAT"); - break; - case LANG_SP: - constructFilename(_vm->_globals.HOPLINK, "RES_VES.CAT"); - break; + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "ENG_VOI.RES"); + // Win95 and Linux versions uses another set of names + else { + switch (_vm->_globals._language) { + case LANG_EN: + constructFilename(_vm->_globals.HOPLINK, "RES_VAN.CAT"); + break; + case LANG_FR: + constructFilename(_vm->_globals.HOPLINK, "RES_VFR.CAT"); + break; + case LANG_SP: + constructFilename(_vm->_globals.HOPLINK, "RES_VES.CAT"); + break; + } } if (!f.exists(_vm->_globals.NFICHIER)) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 87a588509f..e742b50be9 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -117,7 +117,7 @@ void SoundManager::WSOUND_INIT() { void SoundManager::VERIF_SOUND() { if (!_soundOffFl && _soundFl) { if (!VOICE_STAT(1)) { - STOP_VOICE(1); + stopVoice(1); DEL_NWAV(SOUND_NUM); } } @@ -359,9 +359,9 @@ void SoundManager::WSOUND(int soundNumber) { } void SoundManager::WSOUND_OFF() { - STOP_VOICE(0); - STOP_VOICE(1); - STOP_VOICE(2); + stopVoice(0); + stopVoice(1); + stopVoice(2); if (_vm->_soundManager._soundFl) DEL_NWAV(SOUND_NUM); @@ -472,6 +472,7 @@ void SoundManager::checkSounds() { } void SoundManager::checkMusic() { + // OS2 and BeOS versions use MOD files. if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) return; @@ -616,7 +617,10 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { - if (_vm->_globals._language == LANG_FR) + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "ENG_VOI.RES"); + // Win95 and Linux versions uses another set of names + else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); @@ -626,7 +630,10 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { - if (_vm->_globals._language == LANG_FR) + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "ENG_VOI.RES"); + // Win95 and Linux versions uses another set of names + else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); @@ -669,7 +676,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { } while (!_vm->shouldQuit() && !breakFlag); - STOP_VOICE(2); + stopVoice(2); DEL_SAMPLE_SDL(20); MUSICVOL = oldMusicVol; _vm->_eventsManager._escKeyFl = false; @@ -679,11 +686,11 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { void SoundManager::DEL_SAMPLE(int soundIndex) { if (VOICE_STAT(1) == 1) - STOP_VOICE(1); + stopVoice(1); if (VOICE_STAT(2) == 2) - STOP_VOICE(2); + stopVoice(2); if (VOICE_STAT(3) == 3) - STOP_VOICE(3); + stopVoice(3); DEL_SAMPLE_SDL(soundIndex); SOUND[soundIndex]._active = false; } @@ -728,22 +735,22 @@ void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { DEL_NWAV(SOUND_NUM); if (voiceMode == 5) { if (VOICE_STAT(1) == 1) - STOP_VOICE(1); + stopVoice(1); PLAY_SAMPLE_SDL(1, wavIndex); } if (voiceMode == 6) { if (VOICE_STAT(2) == 1) - STOP_VOICE(1); + stopVoice(1); PLAY_SAMPLE_SDL(2, wavIndex); } if (voiceMode == 7) { if (VOICE_STAT(3) == 1) - STOP_VOICE(1); + stopVoice(1); PLAY_SAMPLE_SDL(3, wavIndex); } if (voiceMode == 8) { if (VOICE_STAT(1) == 1) - STOP_VOICE(1); + stopVoice(1); PLAY_SAMPLE_SDL(1, wavIndex); } } @@ -754,7 +761,7 @@ void SoundManager::PLAY_SAMPLE2(int idx) { if (_soundFl) DEL_NWAV(SOUND_NUM); if (VOICE_STAT(1) == 1) - STOP_VOICE(1); + stopVoice(1); PLAY_SAMPLE_SDL(1, idx); } } @@ -771,13 +778,13 @@ int SoundManager::VOICE_STAT(int voiceIndex) { if (Voice[voiceIndex]._status) { int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._audioStream != NULL && Swav[wavIndex]._audioStream->endOfStream()) - STOP_VOICE(voiceIndex); + stopVoice(voiceIndex); } return Voice[voiceIndex]._status; } -void SoundManager::STOP_VOICE(int voiceIndex) { +void SoundManager::stopVoice(int voiceIndex) { if (Voice[voiceIndex]._status) { Voice[voiceIndex]._status = 0; int wavIndex = Voice[voiceIndex]._wavIndex; @@ -864,7 +871,7 @@ void SoundManager::PLAY_NWAV(int wavIndex) { void SoundManager::DEL_NWAV(int wavIndex) { if (DEL_SAMPLE_SDL(wavIndex)) { if (VOICE_STAT(1) == 1) - STOP_VOICE(1); + stopVoice(1); SOUND_NUM = 0; _soundFl = false; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 23fac3f705..2fa4670d48 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -83,7 +83,7 @@ private: HopkinsEngine *_vm; int VOICE_STAT(int voiceIndex); - void STOP_VOICE(int voiceIndex); + void stopVoice(int voiceIndex); void SDL_LVOICE(size_t filePosition, size_t entryLength); void PLAY_VOICE_SDL(); bool DEL_SAMPLE_SDL(int wavIndex); -- cgit v1.2.3 From 1efe969b66392db757818d7cee13e7e47e67338f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Dec 2012 07:55:56 +0100 Subject: HOPKINS: Fix menu in BeOS and OS2 versions --- engines/hopkins/menu.cpp | 10 +++++++--- engines/hopkins/sound.cpp | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index ca23ac0263..aaf7f8be5a 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -73,8 +73,9 @@ int MenuManager::menu() { frame2Index = 0; frame1Index = 0; - - if (_vm->_globals._language == LANG_EN) + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + _vm->_graphicsManager.loadImage("MENU"); + else if (_vm->_globals._language == LANG_EN) _vm->_graphicsManager.loadImage("MENUAN"); else if (_vm->_globals._language == LANG_FR) _vm->_graphicsManager.loadImage("MENUFR"); @@ -82,7 +83,10 @@ int MenuManager::menu() { _vm->_graphicsManager.loadImage("MENUES"); _vm->_graphicsManager.FADE_INW(); - if (_vm->_globals._language == LANG_EN) + + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENU.SPR"); + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUAN.SPR"); else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUFR.SPR"); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e742b50be9..3672e29880 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -221,6 +221,11 @@ void SoundManager::playAnim_SOUND(int soundNumber) { } void SoundManager::WSOUND(int soundNumber) { + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { + if (soundNumber > 27) + return; + } + if (old_music != soundNumber || !MOD_FLAG) { if (MOD_FLAG) WSOUND_OFF(); -- cgit v1.2.3 From c7b49ac8838cfe7931752ceb635f39fbf29c43ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Dec 2012 07:56:26 +0100 Subject: HOPKINS: Renaming --- engines/hopkins/events.cpp | 7 +++++++ engines/hopkins/events.h | 1 + engines/hopkins/hopkins.cpp | 24 ++++++++++++------------ engines/hopkins/hopkins.h | 2 +- engines/hopkins/objects.cpp | 30 +++++++++++++++--------------- engines/hopkins/objects.h | 6 +++--- engines/hopkins/script.cpp | 15 ++++++--------- engines/hopkins/talk.cpp | 10 +++++----- 8 files changed, 50 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 418f4de28e..b56ce17e18 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -85,6 +85,13 @@ void EventsManager::setMouseOn() { setMouseXY(150, 100); } +/** + * Set Mouse position + */ +void EventsManager::setMouseXY(Common::Point pos) { + g_system->warpMouse(pos.x, pos.y); +} + /** * Set Mouse position */ diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 530a3f8121..8aa9a862d3 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -72,6 +72,7 @@ public: ~EventsManager(); void setParent(HopkinsEngine *vm); void setMouseOn(); + void setMouseXY(Common::Point pos); void setMouseXY(int xp, int yp); int getMouseX(); int getMouseY(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ea67f57f63..0e40572838 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -5646,7 +5646,7 @@ void HopkinsEngine::OCEAN_HOME() { _objectsManager.setSpriteIndex(0, 9); } -void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9) { +void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { _globals.PLAN_FLAG = false; _graphicsManager.NOFADE = false; _globals.NOMARCHE = false; @@ -5654,7 +5654,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _globals.AFFLI = false; _globals.AFFIVBL = true; _globals._disableInventFl = true; - _soundManager.WSOUND(a9); + _soundManager.WSOUND(soundId); _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); if (a2.size()) @@ -5670,32 +5670,32 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _objectsManager.INILINK("IM91"); if (!exit1) - _objectsManager.ZONE_OFF(1); + _objectsManager.disableZone(1); if (!exit2) - _objectsManager.ZONE_OFF(2); + _objectsManager.disableZone(2); if (!exit3) - _objectsManager.ZONE_OFF(3); + _objectsManager.disableZone(3); if (!exit4) - _objectsManager.ZONE_OFF(4); + _objectsManager.disableZone(4); if (!_globals.OCEAN_SENS) _globals.OCEAN_SENS = a4; if (_globals.OCEAN_SENS == 5) { - _objectsManager.PERX = 236; + _objectsManager._characterPos.x = 236; _objectsManager.PERI = 9; } if (_globals.OCEAN_SENS == 1) { - _objectsManager.PERX = 236; + _objectsManager._characterPos.x = 236; _objectsManager.PERI = 27; } if (_globals.OCEAN_SENS == 7) { - _objectsManager.PERX = 415; + _objectsManager._characterPos.x = 415; _objectsManager.PERI = 18; } if (_globals.OCEAN_SENS == 3) { - _objectsManager.PERX = -20; + _objectsManager._characterPos.x = -20; _objectsManager.PERI = 0; } - _objectsManager.SPRITE(_globals.PERSO, Common::Point(_objectsManager.PERX, 110), 0, _objectsManager.PERI, 0, 0, 0, 0); + _objectsManager.SPRITE(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager.PERI, 0, 0, 0, 0); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -5718,7 +5718,7 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 int mouseButton = _eventsManager.getMouseButton(); if (mouseButton && mouseButton == 1) BTOCEAN(); - _objectsManager.VERIFZONE(); + _objectsManager.checkZone(); OCEAN_HOME(); _eventsManager.VBL(); if (_globals._exitId) diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index ce73c6a0c2..0c3011d952 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -105,7 +105,7 @@ private: void BTOCEAN(); void OCEAN_HOME(); - void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 a9); + void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); void loadCredits(); void displayCredits(int startPosY, byte *buffer, char colour); void displayCredits(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9ef7b5dd76..6beccf4db9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -79,7 +79,7 @@ ObjectsManager::ObjectsManager() { T_RECTIF = 0; _disableFl = false; _twoCharactersFl = false; - PERX = PERY = 0; + _characterPos = Common::Point(0, 0); PERI = 0; RECALL = 0; PTAILLE = 0; @@ -1535,7 +1535,7 @@ void ObjectsManager::setFlipSprite(int idx, bool flip) { } } -void ObjectsManager::VERIFZONE() { +void ObjectsManager::checkZone() { int v0; int v1; int v2; @@ -2521,7 +2521,7 @@ void ObjectsManager::PLAN_BETA() { handleLeftButton(); } - VERIFZONE(); + checkZone(); GOHOME2(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) @@ -2619,7 +2619,7 @@ void ObjectsManager::handleLeftButton() { if (_vm->_globals.PLAN_FLAG == true) { if (!_vm->_globals.GOACTION) goto LABEL_38; - VERIFZONE(); + checkZone(); if (NUMZONE <= 0) return; v2 = 0; @@ -2637,7 +2637,7 @@ void ObjectsManager::handleLeftButton() { v5[v2 + 3] = -1; } if (_vm->_globals.GOACTION) { - VERIFZONE(); + checkZone(); _vm->_globals.GOACTION = false; _vm->_globals._saveData->data[svField1] = 0; _vm->_globals._saveData->data[svField2] = 0; @@ -4085,7 +4085,7 @@ void ObjectsManager::SPECIAL_JEU() { SET_BOBPOSI(5, 0); setBobAnimation(6); _vm->_globals._saveData->data[svField261] = 2; - ZONE_OFF(15); + disableZone(15); _vm->_soundManager.playSound("SOUND75.WAV"); } if (_vm->_globals._saveData->data[svField261] == 2 && BOBPOSI(6) == 6) { @@ -4345,7 +4345,7 @@ void ObjectsManager::ZONE_ON(int idx) { } } -void ObjectsManager::ZONE_OFF(int idx) { +void ObjectsManager::disableZone(int idx) { if (_vm->_globals.BOBZONE[idx]) { _vm->_globals.BOBZONE_FLAG[idx] = false; } else { @@ -5303,7 +5303,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (v9 == 2) handleRightButton(); _vm->_dialogsManager.testDialogOpening(); - VERIFZONE(); + checkZone(); if (_vm->_globals.GOACTION) PARADISE(); if (!_vm->_globals._exitId) { @@ -5388,12 +5388,12 @@ LABEL_70: } _vm->_globals.HOPKINS_DATA(); if (!_vm->_globals.PERSO_TYPE) - SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 34, 190); + SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190); if (_vm->_globals.PERSO_TYPE == 1) - SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 28, 155); + SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 28, 155); if (_vm->_globals.PERSO_TYPE == 2) - SPRITE(_vm->_globals.PERSO, Common::Point(PERX, PERY), 0, PERI, 0, 0, 20, 127); - _vm->_eventsManager.setMouseXY(PERX, PERY); + SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 20, 127); + _vm->_eventsManager.setMouseXY(_characterPos); if (_vm->_graphicsManager.DOUBLE_ECRAN) _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; VERIFTAILLE(); @@ -5403,8 +5403,8 @@ LABEL_70: VERIFTAILLE(); SPECIAL_INI(linkFile); _vm->_eventsManager._mouseSpriteId = 4; - g_old_x = PERX; - g_old_y = PERY; + g_old_x = _characterPos.x; + g_old_y = _characterPos.y; _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.BPP_NOAFF = true; @@ -5450,7 +5450,7 @@ LABEL_70: } if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); - VERIFZONE(); + checkZone(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { if (_vm->_globals.GOACTION) diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 8ad87ede17..e4081d7eac 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -104,7 +104,7 @@ public: int T_RECTIF; bool _disableFl; bool _twoCharactersFl; - int PERX, PERY; + Common::Point _characterPos; int PERI; int RECALL; int PTAILLE; @@ -174,7 +174,7 @@ public: void SETTAILLESPR(int idx, int a2); void setFlipSprite(int idx, bool flip); - void VERIFZONE(); + void checkZone(); void GOHOME(); void GOHOME2(); void CHARGE_OBSTACLE(const Common::String &file); @@ -214,7 +214,7 @@ public: void ACTION_GAUCHE(int idx); void ZONE_ON(int idx); - void ZONE_OFF(int idx); + void disableZone(int idx); void OPTI_ONE(int a1, int a2, int a3, int a4); void AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img); int BOBPOSI(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 89c6d531ac..a519f81bdc 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -200,30 +200,27 @@ LABEL_1141: _vm->_objectsManager._twoCharactersFl = false; int v5 = *(dataP + 5); int v6 = (int16)READ_LE_UINT16(dataP + 8); - _vm->_objectsManager.PERX = (int16)READ_LE_UINT16(dataP + 6); - _vm->_objectsManager.PERY = v6; + _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); + _vm->_objectsManager._characterPos.y = v6; _vm->_objectsManager.PERI = v5; if (_vm->_objectsManager.CH_TETE == 1) { if (_vm->_globals._saveData->data[svField354] == 1 && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y && _vm->_globals._saveData->_cloneHopkins.field2 && _vm->_globals._saveData->_cloneHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals._saveData->_cloneHopkins._pos.x; - _vm->_objectsManager.PERY = _vm->_globals._saveData->_cloneHopkins._pos.y; + _vm->_objectsManager._characterPos = _vm->_globals._saveData->_cloneHopkins._pos; _vm->_objectsManager.PERI = _vm->_globals._saveData->_cloneHopkins.field2; } if (_vm->_globals._saveData->data[svField356] == 1 && _vm->_globals._saveData->_samantha._pos.x && _vm->_globals._saveData->_samantha._pos.y && _vm->_globals._saveData->_samantha.field2 && _vm->_globals._saveData->_samantha._location) { - _vm->_objectsManager.PERX = _vm->_globals._saveData->_samantha._pos.x; - _vm->_objectsManager.PERY = _vm->_globals._saveData->_samantha._pos.y; + _vm->_objectsManager._characterPos = _vm->_globals._saveData->_samantha._pos; _vm->_objectsManager.PERI = _vm->_globals._saveData->_samantha.field2; } if (_vm->_globals._saveData->data[svField357] == 1 && _vm->_globals._saveData->_realHopkins._pos.x && _vm->_globals._saveData->_realHopkins._pos.y && _vm->_globals._saveData->_realHopkins.field2 && _vm->_globals._saveData->_realHopkins._location) { - _vm->_objectsManager.PERX = _vm->_globals._saveData->_realHopkins._pos.x; - _vm->_objectsManager.PERY = _vm->_globals._saveData->_realHopkins._pos.y; + _vm->_objectsManager._characterPos = _vm->_globals._saveData->_realHopkins._pos; _vm->_objectsManager.PERI = _vm->_globals._saveData->_realHopkins.field2; } } @@ -484,7 +481,7 @@ LABEL_1141: _vm->_objectsManager.ZONE_ON((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') { - _vm->_objectsManager.ZONE_OFF((int16)READ_LE_UINT16(dataP + 5)); + _vm->_objectsManager.disableZone((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; } else if (dataP[2] == 'E' && dataP[3] == 'X' && dataP[4] == 'I') { opcodeType = 5; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e15beb3306..6c63fc8015 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1084,8 +1084,8 @@ void TalkManager::REPONSE2(int a1, int a2) { break; } _vm->_globals._saveData->data[indx] = 2; - _vm->_objectsManager.ZONE_OFF(22); - _vm->_objectsManager.ZONE_OFF(23); + _vm->_objectsManager.disableZone(22); + _vm->_objectsManager.disableZone(23); } else if (a1 == 20 || a1 == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); @@ -1131,8 +1131,8 @@ void TalkManager::REPONSE2(int a1, int a2) { break; } _vm->_globals._saveData->data[indx] = 2; - _vm->_objectsManager.ZONE_OFF(21); - _vm->_objectsManager.ZONE_OFF(20); + _vm->_objectsManager.disableZone(21); + _vm->_objectsManager.disableZone(20); } } } @@ -1224,7 +1224,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { } if (v12 == 2) _vm->_objectsManager.handleRightButton(); - _vm->_objectsManager.VERIFZONE(); + _vm->_objectsManager.checkZone(); if (_vm->_globals.GOACTION) _vm->_objectsManager.PARADISE(); _vm->_eventsManager.VBL(); -- cgit v1.2.3 From 145b593e22c04c9b29d306c39428346fb6205808 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Dec 2012 08:27:32 +0100 Subject: HOPKINS: Some refactoring in OCEAN() --- engines/hopkins/computer.cpp | 14 ++-- engines/hopkins/graphics.cpp | 80 ++------------------- engines/hopkins/graphics.h | 9 +-- engines/hopkins/hopkins.cpp | 161 ++++++++++++++++++++++--------------------- engines/hopkins/hopkins.h | 2 +- 5 files changed, 100 insertions(+), 166 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index cc0f407ff2..8809dc3145 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -804,7 +804,7 @@ void ComputerManager::playBreakout() { _vm->_objectsManager.setSpriteX(1, _ballPosition.x); _vm->_graphicsManager.RESET_SEGMENT_VESA(); _vm->_eventsManager.VBL(); - _vm->_graphicsManager.FADE_IN_CASSE(); + _vm->_graphicsManager.fadeInBreakout(); // Wait for mouse press to start playing do { @@ -839,7 +839,7 @@ void ComputerManager::playBreakout() { } while (!_vm->shouldQuit() && !v1); if (v1 != 1) break; - _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_graphicsManager.fateOutBreakout(); --_breakoutLives; if (_breakoutLives) { @@ -868,7 +868,7 @@ void ComputerManager::playBreakout() { } if (v1 != 2) return; - _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_graphicsManager.fateOutBreakout(); newLevel(); } } @@ -907,7 +907,7 @@ int ComputerManager::displayHiscores() { displayHiscoreLine(ptr, 9 * i + 199, yp, _score[scoreIndex]._score[i]); } - _vm->_graphicsManager.FADE_IN_CASSE(); + _vm->_graphicsManager.fadeInBreakout(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); buttonIndex = 0; do { @@ -924,7 +924,7 @@ int ComputerManager::displayHiscores() { } while (!buttonIndex && !_vm->shouldQuit()); _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_graphicsManager.fateOutBreakout(); _vm->_globals.freeMemory(ptr); return buttonIndex; } @@ -943,7 +943,7 @@ void ComputerManager::getScoreName() { _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_graphicsManager.FADE_IN_CASSE(); + _vm->_graphicsManager.fadeInBreakout(); for (int strPos = 0; strPos <= 4; strPos++) { displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); @@ -973,7 +973,7 @@ void ComputerManager::getScoreName() { if (i <= -1) break; } - _vm->_graphicsManager.FADE_OUT_CASSE(); + _vm->_graphicsManager.fateOutBreakout(); _vm->_globals.freeMemory(ptr); saveScore(); } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index e83622ab57..fdbffe8456 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -176,7 +176,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { CopyAsm16(_vesaBuffer); unlockScreen(); - FADE_IN_CASSE(); + fadeInBreakout(); } /** @@ -734,17 +734,17 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { _palette[palOffset + 1] = gv; _palette[palOffset + 2] = bv; - WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], MapRGB(rv, gv, bv)); + WRITE_LE_UINT16(&SD_PIXELS[2 * palIndex], mapRGB(rv, gv, bv)); } void GraphicsManager::changePalette(const byte *palette) { const byte *srcP = &palette[0]; for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { - *(uint16 *)&SD_PIXELS[2 * idx] = MapRGB(*srcP, *(srcP + 1), *(srcP + 2)); + *(uint16 *)&SD_PIXELS[2 * idx] = mapRGB(*srcP, *(srcP + 1), *(srcP + 2)); } } -uint16 GraphicsManager::MapRGB(byte r, byte g, byte b) { +uint16 GraphicsManager::mapRGB(byte r, byte g, byte b) { Graphics::PixelFormat format = g_system->getScreenFormat(); return (r >> format.rLoss) << format.rShift @@ -767,7 +767,7 @@ void GraphicsManager::FADE_INW_LINUX(const byte *surface) { fadeIn(_palette, FADESPD, surface); } -void GraphicsManager::FADE_IN_CASSE() { +void GraphicsManager::fadeInBreakout() { setpal_vga256(_palette); lockScreen(); CopyAsm16(_vesaBuffer); @@ -775,7 +775,7 @@ void GraphicsManager::FADE_IN_CASSE() { DD_VBL(); } -void GraphicsManager::FADE_OUT_CASSE() { +void GraphicsManager::fateOutBreakout() { byte palette[PALETTE_EXT_BLOCK_SIZE]; memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); @@ -845,67 +845,6 @@ Video_Cont3_wVbe: ++srcP; ++destOffset; } - }} - -void GraphicsManager::Copy_Video_Vbe3(const byte *srcData) { - int rleValue; - int destOffset; - const byte *srcP; - uint8 srcByte; - int destLen1; - byte *destSlice1P; - int destLen2; - byte *destSlice2P; - - assert(_videoPtr); - rleValue = 0; - destOffset = 0; - srcP = srcData; - for (;;) { - srcByte = *srcP; - if (*srcP < 222) - goto Video_Cont3_Vbe; - - if (srcByte == kByteStop) - return; - if (srcByte < kSetOffset) { - destOffset += *srcP + 35; - srcByte = *(srcP++ + 1); - } else if (srcByte == k8bVal) { - destOffset += *(srcP + 1); - srcByte = *(srcP + 2); - srcP += 2; - } else if (srcByte == k16bVal) { - destOffset += READ_LE_UINT16(srcP + 1); - srcByte = *(srcP + 3); - srcP += 3; - } else { - destOffset += READ_LE_UINT32(srcP + 1); - srcByte = *(srcP + 5); - srcP += 5; - } -Video_Cont3_Vbe: - if (srcByte > 210) { - if (srcByte == 211) { - destLen1 = *(srcP + 1); - rleValue = *(srcP + 2); - destSlice1P = destOffset + (byte *)_videoPtr->pixels; - destOffset += destLen1; - memset(destSlice1P, rleValue, destLen1); - srcP += 3; - } else { - destLen2 = (byte)(*srcP + 45); - rleValue = *(srcP + 1); - destSlice2P = (byte *)(destOffset + (byte *)_videoPtr->pixels); - destOffset += destLen2; - memset(destSlice2P, rleValue, destLen2); - srcP += 2; - } - } else { - *(destOffset + (byte *)_videoPtr->pixels) = srcByte; - ++srcP; - ++destOffset; - } } } @@ -2029,10 +1968,6 @@ void GraphicsManager::SHOW_PALETTE() { setpal_vga256(_palette); } -void GraphicsManager::videkey() { - // Empty in original -} - void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { int result; int destOffset; @@ -2116,9 +2051,6 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int Red_x = 0; Red_y = 0; if (zoom < 100) { - Reduc_Ecran_L = zoomOut(width, Red); - Reduc_Ecran_H = zoomOut(height, Red); - for (int yCtr = 0; yCtr < height; ++yCtr, srcP += _lineNbr2) { Red_y += Red; if (Red_y < 100) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index a4e8312ca0..379d83018f 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -96,7 +96,6 @@ public: int Compteur_y; int spec_largeur; bool NOFADE; - int Reduc_Ecran_L, Reduc_Ecran_H; public: GraphicsManager(); ~GraphicsManager(); @@ -128,17 +127,16 @@ public: void FADE_OUTW(); void FADE_OUTW_LINUX(const byte *surface); void FADE_INW_LINUX(const byte *surface); - void FADE_IN_CASSE(); - void FADE_OUT_CASSE(); + void fadeInBreakout(); + void fateOutBreakout(); 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 SETCOLOR4(int palIndex, int r, int g, int b); void changePalette(const byte *palette); - uint16 MapRGB(byte r, byte g, byte b); + uint16 mapRGB(byte r, byte g, byte b); void DD_VBL(); void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); - void Copy_Video_Vbe3(const byte *srcData); void Copy_Video_Vbe16(const byte *srcData); void Copy_Video_Vbe16a(const byte *srcData); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height); @@ -174,7 +172,6 @@ public: void OPTI_INI(const Common::String &file, int mode); void NB_SCREEN(); void SHOW_PALETTE(); - void videkey(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0e40572838..3652a36391 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1453,55 +1453,55 @@ bool HopkinsEngine::runOS2Full() { break; case 77: - OCEAN(77, "OCEAN01", "OCEAN01", 3, 0, 84, 0, 0, 25); + OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", "OCEAN01", 1, 0, 91, 84, 0, 25); + OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", "OCEAN01", 7, 87, 0, 0, 83, 25); + OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", "OCEAN01", 1, 86, 88, 0, 81, 25); + OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", "OCEAN01", 1, 91, 82, 80, 85, 25); + OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", "OCEAN01", 7, 81, 0, 88, 0, 25); + OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", "OCEAN01", 1, 89, 0, 79, 88, 25); + OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", "OCEAN01", 1, 77, 0, 0, 78, 25); + OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", "OCEAN01", 1, 0, 0, 81, 0, 25); + OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", "OCEAN01", 1, 0, 80, 0, 91, 25); + OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", "OCEAN01", 3, 0, 79, 90, 0, 25); + OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", "OCEAN01", 1, 80, 0, 83, 82, 25); + OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", "OCEAN01", 3, 0, 83, 0, 0, 25); + OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); break; case 90: @@ -1509,7 +1509,7 @@ bool HopkinsEngine::runOS2Full() { break; case 91: - OCEAN(91, "OCEAN15", "OCEAN01", 3, 78, 81, 86, 0, 25); + OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); break; case 93: @@ -2341,55 +2341,55 @@ bool HopkinsEngine::runBeOSFull() { break; case 77: - OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); break; case 90: @@ -2397,7 +2397,7 @@ bool HopkinsEngine::runBeOSFull() { break; case 91: - OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); break; case 93: @@ -3226,55 +3226,55 @@ bool HopkinsEngine::runWin95full() { break; case 77: - OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); + OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); break; case 90: @@ -3282,7 +3282,7 @@ bool HopkinsEngine::runWin95full() { break; case 91: - OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); break; case 93: @@ -4104,65 +4104,65 @@ bool HopkinsEngine::runLinuxFull() { break; case 77: - OCEAN(77, "OCEAN01", "OCEAN1", 3, 0, 84, 0, 0, 25); + OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", "OCEAN1", 1, 0, 91, 84, 0, 25); + OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", "OCEAN1", 7, 87, 0, 0, 83, 25); + OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", "OCEAN1", 1, 86, 88, 0, 81, 25); + OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", "OCEAN1", 1, 91, 82, 80, 85, 25); + OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", "OCEAN1", 7, 81, 0, 88, 0, 25); + OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", "OCEAN1", 1, 89, 0, 79, 88, 25); + OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", "OCEAN1", 1, 77, 0, 0, 78, 25); + OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", "OCEAN1", 1, 0, 0, 81, 0, 25); + OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", "OCEAN1", 1, 0, 80, 0, 91, 25); + OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", "OCEAN1", 3, 0, 79, 90, 0, 25); + OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", "OCEAN1", 1, 80, 0, 83, 82, 25); + OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", "OCEAN1", 3, 0, 83, 0, 0, 25); - break; - - case 91: - OCEAN(91, "OCEAN15", "OCEAN1", 3, 78, 81, 86, 0, 25); + OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); break; case 90: BASED(); break; + case 91: + OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); + break; + case 93: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; @@ -5646,7 +5646,7 @@ void HopkinsEngine::OCEAN_HOME() { _objectsManager.setSpriteIndex(0, 9); } -void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { +void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { _globals.PLAN_FLAG = false; _graphicsManager.NOFADE = false; _globals.NOMARCHE = false; @@ -5657,16 +5657,16 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _soundManager.WSOUND(soundId); _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); - if (a2.size()) - _graphicsManager.loadImage(a2); + if (backgroundFilename.size()) + _graphicsManager.loadImage(backgroundFilename); - if ((a1 != 77) && (a1 != 84) && (a1 != 91)) + if ((curExitId != 77) && (curExitId != 84) && (curExitId != 91)) _objectsManager.INILINK("ocean"); - else if (a1 == 77) + else if (curExitId == 77) _objectsManager.INILINK("IM77"); - else if (a1 == 84) + else if (curExitId == 84) _objectsManager.INILINK("IM84"); - else if (a1 == 91) + else if (curExitId == 91) _objectsManager.INILINK("IM91"); if (!exit1) @@ -5677,24 +5677,29 @@ void HopkinsEngine::OCEAN(int16 a1, Common::String a2, Common::String a3, int16 _objectsManager.disableZone(3); if (!exit4) _objectsManager.disableZone(4); + if (!_globals.OCEAN_SENS) - _globals.OCEAN_SENS = a4; - if (_globals.OCEAN_SENS == 5) { - _objectsManager._characterPos.x = 236; - _objectsManager.PERI = 9; - } - if (_globals.OCEAN_SENS == 1) { + _globals.OCEAN_SENS = defaultDirection; + + switch (_globals.OCEAN_SENS) { + case 1: _objectsManager._characterPos.x = 236; _objectsManager.PERI = 27; - } - if (_globals.OCEAN_SENS == 7) { - _objectsManager._characterPos.x = 415; - _objectsManager.PERI = 18; - } - if (_globals.OCEAN_SENS == 3) { + break; + case 3: _objectsManager._characterPos.x = -20; _objectsManager.PERI = 0; + break; + case 5: + _objectsManager._characterPos.x = 236; + _objectsManager.PERI = 9; + break; + case 7: + _objectsManager._characterPos.x = 415; + _objectsManager.PERI = 18; + break; } + _objectsManager.SPRITE(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager.PERI, 0, 0, 0, 0); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 0c3011d952..8d25f37240 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -105,7 +105,7 @@ private: void BTOCEAN(); void OCEAN_HOME(); - void OCEAN(int16 a1, Common::String a2, Common::String a3, int16 a4, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); + void OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); void loadCredits(); void displayCredits(int startPosY, byte *buffer, char colour); void displayCredits(); -- cgit v1.2.3 From 10a61a8124413eee2523bcb57c0e23f2a49973d5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Dec 2012 21:30:51 +0100 Subject: HOPKINS: Some renaming and refactoring --- engines/hopkins/hopkins.cpp | 8 +++-- engines/hopkins/objects.cpp | 41 +++++++++++----------- engines/hopkins/talk.cpp | 85 +++++++++++++++++++-------------------------- engines/hopkins/talk.h | 2 +- 4 files changed, 64 insertions(+), 72 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 3652a36391..1cda13c3c7 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -844,7 +844,9 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _animationManager.playAnim("MP.ANM", 10, 0, 200); + + // Add 16ms delay in order to match the Linux and Win95 versions + _animationManager.playAnim("MP.ANM", 10, 16, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) playIntro(); @@ -1727,7 +1729,9 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _animationManager.playAnim("MP.ANM", 10, 0, 200); + + // Add 16ms delay in order to match the Linux and Win95 versions + _animationManager.playAnim("MP.ANM", 10, 16, 200); _graphicsManager.FADE_OUTW(); if (!_eventsManager._escKeyFl) playIntro(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6beccf4db9..c42fb5b825 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -5357,7 +5357,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!s4.empty()) { if (!_vm->_globals.NOSPRECRAN) _vm->_graphicsManager.INI_ECRAN(s4); - if (!s4.empty() && _vm->_globals.NOSPRECRAN) + else _vm->_graphicsManager.INI_ECRAN2(s4); } _vm->_eventsManager.mouseOn(); @@ -5366,15 +5366,14 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - if (!_vm->_globals.PERSO_TYPE) - goto LABEL_70; - if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _vm->_globals.PERSO_TYPE = 0; + if (_vm->_globals.PERSO_TYPE) { + if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO_TYPE = 0; + } } if (!_vm->_globals.PERSO_TYPE) { -LABEL_70: if (_vm->_globals._saveData->data[svField122] == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -5387,12 +5386,17 @@ LABEL_70: _vm->_globals.PERSO_TYPE = 2; } _vm->_globals.HOPKINS_DATA(); - if (!_vm->_globals.PERSO_TYPE) + switch (_vm->_globals.PERSO_TYPE) { + case 0: SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190); - if (_vm->_globals.PERSO_TYPE == 1) + break; + case 1: SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 28, 155); - if (_vm->_globals.PERSO_TYPE == 2) + break; + case 2: SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 20, 127); + break; + } _vm->_eventsManager.setMouseXY(_characterPos); if (_vm->_graphicsManager.DOUBLE_ECRAN) _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; @@ -5409,9 +5413,8 @@ LABEL_70: _vm->_globals.Compteur = 0; _vm->_globals.BPP_NOAFF = true; - for (int idx = 0; idx < 5; ++idx) { + for (int idx = 0; idx < 5; ++idx) _vm->_eventsManager.VBL(); - } _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; @@ -5432,13 +5435,11 @@ LABEL_70: xp = _vm->_eventsManager.getMouseX(); yp = _vm->_eventsManager.getMouseY(); - if (xCheck == xp) { - if (yCheck == yp) { - _vm->_globals.chemin = (int16 *)g_PTRNUL; - PARADISE(); - if (_vm->_globals._exitId) - breakFlag = true; - } + if ((xCheck == xp) && (yCheck == yp)) { + _vm->_globals.chemin = (int16 *)g_PTRNUL; + PARADISE(); + if (_vm->_globals._exitId) + breakFlag = true; } xCheck = xp; yCheck = yp; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 6c63fc8015..6fa89fb02e 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -50,19 +50,15 @@ void TalkManager::setParent(HopkinsEngine *vm) { } void TalkManager::PARLER_PERSO(const Common::String &filename) { - int v2; - int v3; - int v4; int v5; int v7; byte *v8; byte *v9; byte *v10; int v14; - int v15; - Common::String v16; + Common::String spriteFilename; - v15 = 0; + int answer = 0; _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); @@ -77,9 +73,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } _vm->_globals._saveData->data[svField4] = 0; - RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer); - RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); - RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); + getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); + getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); + getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); if (_vm->_globals._language == LANG_FR) { _answersFilename = _questionsFilename = "RUE.TXT"; } else if (_vm->_globals._language == LANG_EN) { @@ -87,12 +83,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } else if (_vm->_globals._language == LANG_SP) { _answersFilename = _questionsFilename = "RUEES.TXT"; } - v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); - v3 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; - _characterSprite = _vm->_fileManager.searchCat(v16, 7); + _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v16); + _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, spriteFilename); } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } @@ -108,28 +103,26 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; - CHERCHE_PAL(v3, 0); - CHERCHE_ANIM0(v3, 0); + CHERCHE_PAL(PCHERCHE, 0); + CHERCHE_ANIM0(PCHERCHE, 0); initCharacterAnim(); - PLIGNE1 = v2; - PLIGNE2 = v2 + 1; - PLIGNE3 = v2 + 2; - PLIGNE4 = v2 + 3; + PLIGNE2 = PLIGNE1 + 1; + PLIGNE3 = PLIGNE1 + 2; + PLIGNE4 = PLIGNE1 + 3; v14 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { - v4 = v2 + 3; do { v5 = DIALOGUE(); - if (v5 != v4) - v15 = DIALOGUE_REP(v5); - if (v15 == -1) - v5 = v2 + 3; + if (v5 != PLIGNE4) + answer = DIALOGUE_REP(v5); + if (answer == -1) + v5 = PLIGNE4; _vm->_eventsManager.VBL(); - } while (v5 != v4); + } while (v5 != PLIGNE4); } - if (_vm->_globals.NOPARLE == true) { + if (_vm->_globals.NOPARLE) { int v6 = 1; do v7 = DIALOGUE_REP(v6++); @@ -190,8 +183,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { } _vm->_globals._saveData->data[svField4] = 0; - RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); - RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); + getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); + getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); switch (_vm->_globals._language) { case LANG_EN: @@ -208,27 +201,25 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { break; } - int v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; CHERCHE_PAL(PCHERCHE, 0); - PLIGNE1 = v1; - PLIGNE2 = v1 + 1; - PLIGNE3 = v1 + 2; - PLIGNE4 = v1 + 3; + PLIGNE2 = PLIGNE1 + 1; + PLIGNE3 = PLIGNE1 + 2; + PLIGNE4 = PLIGNE1 + 3; int v8 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { - int v2 = v1 + 3; int v3; do { v3 = DIALOGUE(); - if (v3 != v2) { + if (v3 != PLIGNE4) { if (DIALOGUE_REP(v3) == -1) - v3 = v1 + 3; + v3 = PLIGNE4; } - } while (v3 != v2); + } while (v3 != PLIGNE4); } if (_vm->_globals.NOPARLE) { @@ -250,7 +241,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { STATI = 0; } -void TalkManager::RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData) { +void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData) { dest = Common::String(srcData + srcStart); } @@ -1141,10 +1132,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { int v5; int v10; byte *v11; - int v12; byte *v14; byte *v15; - byte *v16; Common::String s; Common::String v20; Common::String v22; @@ -1171,9 +1160,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); } - RENVOIE_FICHIER(40, v23, (const char *)_characterBuffer); - RENVOIE_FICHIER(0, v22, (const char *)_characterBuffer); - RENVOIE_FICHIER(20, v20, (const char *)_characterBuffer); + getStringFromBuffer(40, v23, (const char *)_characterBuffer); + getStringFromBuffer(0, v22, (const char *)_characterBuffer); + getStringFromBuffer(20, v20, (const char *)_characterBuffer); v5 = 5; if (v20 == "NULL") @@ -1217,13 +1206,12 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager.NUMZONE = -1; do { - v12 = _vm->_eventsManager.getMouseButton(); - if (v12 == 1) { + int mouseButton = _vm->_eventsManager.getMouseButton(); + if (mouseButton == 1) _vm->_objectsManager.handleLeftButton(); - v12 = 1; - } - if (v12 == 2) + else if (mouseButton == 2) _vm->_objectsManager.handleRightButton(); + _vm->_objectsManager.checkZone(); if (_vm->_globals.GOACTION) _vm->_objectsManager.PARADISE(); @@ -1280,7 +1268,6 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15)); v14 = v14 + 2; *v14 = *(v15 + 2); - v16 = v14 + 1; _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 65b06bf8a4..e1f089dedd 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -51,7 +51,7 @@ public: void PARLER_PERSO2(const Common::String &filename); void PARLER_PERSO(const Common::String &filename); - void RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData); + void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData); int DIALOGUE(); int DIALOGUE_REP(int idx); void CHERCHE_PAL(int a1, int a2); -- cgit v1.2.3 From 55478fd11b669487cc2047954b855f51458fa1cd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Dec 2012 22:02:48 +0100 Subject: HOPKINS: Some more renaming, remove '== true' statements --- engines/hopkins/anim.cpp | 38 +++++++++---------- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/events.cpp | 6 +-- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 52 ++++++++++++------------- engines/hopkins/objects.cpp | 92 ++++++++++++++++++++++----------------------- engines/hopkins/script.cpp | 18 ++++----- 9 files changed, 108 insertions(+), 110 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 763f19cd2f..d495ed0d75 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -296,15 +296,15 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->_globals.iRegul != 1) break; for (;;) { - if (_vm->_eventsManager._escKeyFl == true) + if (_vm->_eventsManager._escKeyFl) goto LABEL_114; - if (redrawAnim() == true) + if (redrawAnim()) break; _vm->_eventsManager.refreshEvents(); if (_vm->_eventsManager._rateCounter >= a2) goto LABEL_48; } - if (_vm->_graphicsManager._skipVideoLockFl == true) + if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_114; if (v8 == 1) ptr = _vm->_globals.freeMemory(ptr); @@ -376,9 +376,9 @@ LABEL_77: LABEL_88: if (v5 == -1) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager._escKeyFl != true) { - if (redrawAnim() == true) { - if (_vm->_graphicsManager._skipVideoLockFl == true) + while (!_vm->_eventsManager._escKeyFl) { + if (redrawAnim()) { + if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_114; if (v8 == 1) ptr = _vm->_globals.freeMemory(ptr); @@ -418,9 +418,9 @@ LABEL_88: goto LABEL_114; } } - while (_vm->_eventsManager._escKeyFl != true) { - if (redrawAnim() == true) { - if (_vm->_graphicsManager._skipVideoLockFl == true) + while (!_vm->_eventsManager._escKeyFl) { + if (redrawAnim()) { + if (_vm->_graphicsManager._skipVideoLockFl) break; if (v8 == 1) ptr = _vm->_globals.freeMemory(ptr); @@ -871,7 +871,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_soundManager.LOAD_ANM_SOUND(); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager._escKeyFl == true) { + if (_vm->_eventsManager._escKeyFl) { if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; _vm->_eventsManager._escKeyFl = false; @@ -914,7 +914,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.read(v9, READ_LE_UINT32(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager._escKeyFl == true) { + if (_vm->_eventsManager._escKeyFl) { if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; _vm->_eventsManager._escKeyFl = false; @@ -941,7 +941,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager._escKeyFl == true) { + if (_vm->_eventsManager._escKeyFl) { if (!_vm->_eventsManager._disableEscKeyFl) goto LABEL_59; _vm->_eventsManager._escKeyFl = false; @@ -1031,9 +1031,9 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->_globals.iRegul != 1) break; while (!_vm->shouldQuit()) { - if (_vm->_eventsManager._escKeyFl == true) + if (_vm->_eventsManager._escKeyFl) goto LABEL_54; - if (redrawAnim() == true) + if (redrawAnim()) break; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); @@ -1041,7 +1041,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u goto LABEL_23; } LABEL_48: - if (_vm->_graphicsManager._skipVideoLockFl == true) + if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_54; if (v7 == 1) ptr = _vm->_globals.freeMemory(ptr); @@ -1083,8 +1083,8 @@ LABEL_33: LABEL_44: if (v4) { if (_vm->_globals.iRegul == 1) { - while (_vm->_eventsManager._escKeyFl != true) { - if (redrawAnim() == true) + while (!_vm->_eventsManager._escKeyFl) { + if (redrawAnim()) goto LABEL_48; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); @@ -1098,9 +1098,9 @@ LABEL_53: goto LABEL_54; } } - while (_vm->_eventsManager._escKeyFl != true) { + while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); - if (redrawAnim() == true) + if (redrawAnim()) goto LABEL_48; if (_vm->_eventsManager._rateCounter >= rate2) goto LABEL_33; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 19934f01df..1f1a009e1b 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -426,7 +426,7 @@ LABEL_7: } } } - if (_removeInventFl == true) + if (_removeInventFl) v20 = true; if (v20) break; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index b56ce17e18..702da52a42 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -336,7 +336,7 @@ void EventsManager::VBL() { } _vm->_graphicsManager.unlockScreen(); } - if (_mouseFl == true) { + if (_mouseFl) { v1 = 20; if (!_mouseLinuxFl) v1 = 10; @@ -382,7 +382,7 @@ LABEL_34: LABEL_35: if (!_vm->_globals.PUBEXIT) _vm->_objectsManager.displaySprite(); - if (_mouseFl != true) { + if (!_mouseFl) { updateCursor(); goto LABEL_54; } @@ -415,7 +415,7 @@ LABEL_54: while (_breakoutFl || _vm->_globals.iRegul != 1) { checkForNextFrameCounter(); - if (_breakoutFl != true) + if (!_breakoutFl) goto LABEL_63; if (_rateCounter > 1) goto LABEL_65; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 3abc7b7ada..15f5abcd29 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -127,7 +127,7 @@ Globals::Globals() { g_old_anim = 0; g_old_sens = 0; g_old_sens2 = 0; - last_sens = 0; + _lastDirection = 0; police_l = police_h = 0; TETE = NULL; texte_long = 0; @@ -189,7 +189,7 @@ Globals::Globals() { Credit_l = 0; Credit_h = 0; - OCEAN_SENS = 0; + _oceanDirection = 0; // Initialise pointers ICONE = NULL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 2689b59c01..a2104a6fbd 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -357,7 +357,7 @@ public: bool CENSURE; int g_old_anim; int g_old_sens, g_old_sens2; - int last_sens; + int _lastDirection; byte *police; int police_l; int police_h; @@ -465,7 +465,7 @@ public: int Credit_l; int Credit_h; - int OCEAN_SENS; + int _oceanDirection; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 379d83018f..1ad0fae97c 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -95,7 +95,7 @@ public: int _width; int Compteur_y; int spec_largeur; - bool NOFADE; + bool _noFadingFl; public: GraphicsManager(); ~GraphicsManager(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1cda13c3c7..30d7f502dd 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -5460,13 +5460,13 @@ void HopkinsEngine::BTOCEAN() { int oldPosY = _eventsManager.getMouseY(); bool displAnim = false; if (_objectsManager.NUMZONE == 1) { - if (_globals.OCEAN_SENS == 3) + if (_globals._oceanDirection == 3) _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, 0); - else if (_globals.OCEAN_SENS == 1) + else if (_globals._oceanDirection == 1) _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, 0); - else if (_globals.OCEAN_SENS == 5) + else if (_globals._oceanDirection == 5) _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, 0); - _globals.OCEAN_SENS = 7; + _globals._oceanDirection = 7; _globals._exitId = 1; int oldX = _objectsManager.getSpriteX(0); for (;;) { @@ -5492,13 +5492,13 @@ void HopkinsEngine::BTOCEAN() { } LABEL_22: if (_objectsManager.NUMZONE == 2) { - if (_globals.OCEAN_SENS == 7) + if (_globals._oceanDirection == 7) _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); - else if (_globals.OCEAN_SENS == 1) + else if (_globals._oceanDirection == 1) _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); - else if (_globals.OCEAN_SENS == 5) + else if (_globals._oceanDirection == 5) _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, 0); - _globals.OCEAN_SENS = 3; + _globals._oceanDirection = 3; _globals._exitId = 2; int oldX = _objectsManager.getSpriteX(0); for (;;) { @@ -5524,7 +5524,7 @@ LABEL_22: } LABEL_41: if (_objectsManager.NUMZONE == 3) { - if (_globals.OCEAN_SENS == 3) { + if (_globals._oceanDirection == 3) { int oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) @@ -5549,7 +5549,7 @@ LABEL_41: _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, 0); } LABEL_57: - if (_globals.OCEAN_SENS == 7) { + if (_globals._oceanDirection == 7) { int oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) @@ -5574,13 +5574,13 @@ LABEL_57: _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); } LABEL_72: - if (_globals.OCEAN_SENS == 5) + if (_globals._oceanDirection == 5) _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); - _globals.OCEAN_SENS = 1; + _globals._oceanDirection = 1; _globals._exitId = 3; } if (_objectsManager.NUMZONE == 4) { - if (_globals.OCEAN_SENS == 3) { + if (_globals._oceanDirection == 3) { int oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) @@ -5605,7 +5605,7 @@ LABEL_72: _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, 0); } LABEL_91: - if (_globals.OCEAN_SENS == 7) { + if (_globals._oceanDirection == 7) { int oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) @@ -5630,9 +5630,9 @@ LABEL_91: } } } - if (_globals.OCEAN_SENS == 1) + if (_globals._oceanDirection == 1) _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, 0); - _globals.OCEAN_SENS = 5; + _globals._oceanDirection = 5; _globals._exitId = 4; } } @@ -5640,19 +5640,19 @@ LABEL_91: } void HopkinsEngine::OCEAN_HOME() { - if (_globals.OCEAN_SENS == 3) + if (_globals._oceanDirection == 3) _objectsManager.setSpriteIndex(0, 0); - if (_globals.OCEAN_SENS == 7) + else if (_globals._oceanDirection == 7) _objectsManager.setSpriteIndex(0, 18); - if (_globals.OCEAN_SENS == 1) + else if (_globals._oceanDirection == 1) _objectsManager.setSpriteIndex(0, 27); - if (_globals.OCEAN_SENS == 5) + else if (_globals._oceanDirection == 5) _objectsManager.setSpriteIndex(0, 9); } void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { _globals.PLAN_FLAG = false; - _graphicsManager.NOFADE = false; + _graphicsManager._noFadingFl = false; _globals.NOMARCHE = false; _globals._exitId = 0; _globals.AFFLI = false; @@ -5682,10 +5682,10 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in if (!exit4) _objectsManager.disableZone(4); - if (!_globals.OCEAN_SENS) - _globals.OCEAN_SENS = defaultDirection; + if (!_globals._oceanDirection) + _globals._oceanDirection = defaultDirection; - switch (_globals.OCEAN_SENS) { + switch (_globals._oceanDirection) { case 1: _objectsManager._characterPos.x = 236; _objectsManager.PERI = 27; @@ -5717,9 +5717,9 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - if (!_graphicsManager.NOFADE) + if (!_graphicsManager._noFadingFl) _graphicsManager.FADE_INW(); - _graphicsManager.NOFADE = false; + _graphicsManager._noFadingFl = false; _globals.iRegul = 1; bool loopCond = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c42fb5b825..b4f803551a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -474,7 +474,7 @@ void ObjectsManager::displaySprite() { _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } - if (SL_FLAG == true) { + if (SL_FLAG) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); if (SL_X && SL_Y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); @@ -1145,7 +1145,7 @@ void ObjectsManager::AFF_BOB_ANIM() { int idx = 0; do { ++idx; - if (idx <= 20 && PERSO_ON == true) { + if (idx <= 20 && PERSO_ON) { _vm->_globals._bob[idx].field1C = false; continue; } @@ -1173,7 +1173,7 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals._bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; - if ( PERSO_ON == true && idx > 20 ) + if ( PERSO_ON && idx > 20 ) _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); @@ -1212,7 +1212,7 @@ LABEL_38: if (_vm->_globals.BL_ANIM[idx].v1 == 1) _vm->_globals._bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; - if (PERSO_ON == true && idx > 20) + if (PERSO_ON && idx > 20) _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); @@ -1237,7 +1237,7 @@ LABEL_38: } } while (idx != 35); - if (!PERSO_ON && BOBTOUS == true) { + if (!PERSO_ON && BOBTOUS) { for (int v26 = 0; v26 != 35; v26++) { if (_vm->_globals._bob[v26].field0 == 10 && !_vm->_globals._bob[v26]._disabledAnimationFl) _vm->_globals._bob[v26].field1C = true; @@ -1247,7 +1247,7 @@ LABEL_38: BOBTOUS = false; for (int v27 = 1; v27 < 35; v27++) { - if (v27 > 20 || PERSO_ON != true) { + if (v27 > 20 || !PERSO_ON) { if ((_vm->_globals._bob[v27].field0 == 10) && (_vm->_globals._bob[v27].field1C)) { v14 = _vm->_globals._bob[v27].field1E; @@ -1549,7 +1549,7 @@ void ObjectsManager::checkZone() { || _vm->_eventsManager._startPos.x >= v0 || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) || (v1 = v2 - 1, (uint16)(v2 - 1) > 59)) { - if (_visibleFl == true) + if (_visibleFl) FLAG_VISIBLE_EFFACE = 4; _visibleFl = false; } else { @@ -1625,14 +1625,14 @@ LABEL_54: _vm->_globals.old_x_69 = v0; _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; - if (_vm->_globals.NOMARCHE == true) { + if (_vm->_globals.NOMARCHE) { if (_vm->_eventsManager._mouseCursorId == 4) { v1 = v4 + 1; if ((uint16)(v4 + 1) > 1u) handleRightButton(); } } - if ((_vm->_globals.PLAN_FLAG == true && v4 == -1) || !v4) { + if ((_vm->_globals.PLAN_FLAG && v4 == -1) || !v4) { _verb = 0; _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); @@ -2208,13 +2208,13 @@ void ObjectsManager::GOHOME2() { if (_vm->_globals.j_104 >= v0) goto LABEL_19; } - if (_vm->_globals.last_sens == 1) + if (_vm->_globals._lastDirection == 1) setSpriteIndex(0, 0); - if (_vm->_globals.last_sens == 3) + if (_vm->_globals._lastDirection == 3) setSpriteIndex(0, 1); - if (_vm->_globals.last_sens == 5) + if (_vm->_globals._lastDirection == 5) setSpriteIndex(0, 2); - if (_vm->_globals.last_sens == 7) + if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 3); _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2223,16 +2223,16 @@ void ObjectsManager::GOHOME2() { A_DEPA = 0; } else { LABEL_19: - _vm->_globals.last_sens = nouveau_sens; + _vm->_globals._lastDirection = nouveau_sens; setSpriteX(0, nouveau_x); setSpriteY(0, nouveau_y); - if (_vm->_globals.last_sens == 1) + if (_vm->_globals._lastDirection == 1) setSpriteIndex(0, 4); - if (_vm->_globals.last_sens == 3) + if (_vm->_globals._lastDirection == 3) setSpriteIndex(0, 5); - if (_vm->_globals.last_sens == 5) + if (_vm->_globals._lastDirection == 5) setSpriteIndex(0, 6); - if (_vm->_globals.last_sens == 7) + if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 7); if (my_anim++ > 1) @@ -2446,7 +2446,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.Max_Perso_Y = 440; _vm->_globals.NOSPRECRAN = true; _vm->_globals.PLAN_FLAG = true; - _vm->_graphicsManager.NOFADE = false; + _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; _spritePtr = g_PTRNUL; _vm->_globals._exitId = 0; @@ -2497,7 +2497,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.iRegul = 1; _vm->_graphicsManager.FADE_INW(); _vm->_eventsManager.changeMouseCursor(4); - _vm->_graphicsManager.NOFADE = false; + _vm->_graphicsManager._noFadingFl = false; do { v5 = _vm->_eventsManager.getMouseButton(); @@ -2532,10 +2532,10 @@ void ObjectsManager::PLAN_BETA() { v1 = 1; } while (!_vm->shouldQuit() && v1 != 1); - if (!_vm->_graphicsManager.NOFADE) + if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.FADE_OUTW(); _vm->_globals.iRegul = 0; - _vm->_graphicsManager.NOFADE = false; + _vm->_graphicsManager._noFadingFl = false; _vm->_globals.PLANX = getSpriteX(0); _vm->_globals.PLANY = getSpriteY(0); _vm->_globals.PLANI = 1; @@ -2616,7 +2616,7 @@ void ObjectsManager::handleLeftButton() { return; } } - if (_vm->_globals.PLAN_FLAG == true) { + if (_vm->_globals.PLAN_FLAG) { if (!_vm->_globals.GOACTION) goto LABEL_38; checkZone(); @@ -2643,7 +2643,7 @@ void ObjectsManager::handleLeftButton() { _vm->_globals._saveData->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG == true && (_vm->_eventsManager._mouseCursorId != 4 || NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || NUMZONE <= 0)) return; if ((uint16)(NUMZONE + 1) > 1u) { zoneCount = NUMZONE; @@ -2674,7 +2674,6 @@ LABEL_38: g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) { -LABEL_64: _vm->_globals.g_old_sens = -1; goto LABEL_65; } @@ -2702,12 +2701,13 @@ LABEL_64: g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) - goto LABEL_64; + _vm->_globals.g_old_sens = -1; + else LABEL_63: - _vm->_globals.chemin = v9; + _vm->_globals.chemin = v9; } LABEL_65: - if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG == true) { + if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) { v17 = getSpriteY(0); v18 = getSpriteX(0); _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); @@ -2717,7 +2717,7 @@ LABEL_65: // TODO: Reformat the weird if statement generated by the decompiler if (_vm->_eventsManager._mouseCursorId == 23 || (_vm->_globals._saveData->data[svField1] = _vm->_eventsManager._mouseCursorId, _vm->_eventsManager._mouseCursorId == 23)) _vm->_globals._saveData->data[svField1] = 5; - if (_vm->_globals.PLAN_FLAG == true) + if (_vm->_globals.PLAN_FLAG) _vm->_globals._saveData->data[svField1] = 6; _vm->_globals._saveData->data[svField2] = NUMZONE; _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; @@ -2836,11 +2836,11 @@ LABEL_64: _vm->_globals._saveData->data[svField1] = 0; _vm->_globals._saveData->data[svField2] = 0; } - if (_vm->_globals.PLAN_FLAG == true) { + if (_vm->_globals.PLAN_FLAG) { _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } - if (_vm->_globals.NOMARCHE == true) { + if (_vm->_globals.NOMARCHE) { if (_vm->_eventsManager._mouseCursorId == 4) { result = NUMZONE + 1; if ((uint16)(NUMZONE + 1) > 1u) @@ -3026,15 +3026,13 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha void ObjectsManager::VERIFTAILLE() { int v0 = _vm->_globals.STAILLE[getSpriteY(0)]; if (_vm->_globals.PERSO_TYPE == 1) { - int v1 = v0; if (v0 < 0) - v1 = -v0; - v0 = 20 * (5 * v1 - 100) / -80; + v0 = -v0; + v0 = 20 * (5 * v0 - 100) / -80; } else if (_vm->_globals.PERSO_TYPE == 2) { - int v2 = v0; if (v0 < 0) - v2 = -v0; - v0 = 20 * (5 * v2 - 165) / -67; + v0 = -v0; + v0 = 20 * (5 * v0 - 165) / -67; } SETTAILLESPR(0, v0); } @@ -3502,7 +3500,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager._mouseCursorId = 4; LABEL_24: - if (_vm->_globals.NOMARCHE != true || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { + if (!_vm->_globals.NOMARCHE || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { if (_vm->_eventsManager._mouseCursorId == 4) return; } else { @@ -4669,10 +4667,10 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_graphicsManager.FADE_INW(); _vm->_globals.iRegul = 1; _vm->_globals._disableInventFl = false; - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_globals._disableInventFl = false; } if (_vm->_globals._screenId == 17 && _vm->_globals.OLD_ECRAN == 20) { @@ -4709,7 +4707,7 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { VBOB_OFF(5); for (int v7 = 0; v7 <= 3; v7++) _vm->_eventsManager.VBL(); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_globals._disableInventFl = false; } } @@ -5197,7 +5195,7 @@ void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); _vm->_globals._exitId = 150; - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; BOB_OFF(1); BOB_OFF(2); BOB_OFF(3); @@ -5338,7 +5336,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.ofscroll = 0; _vm->_dialogsManager._removeInventFl = false; _vm->_globals.PLAN_FLAG = false; - _vm->_graphicsManager.NOFADE = false; + _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; _vm->_globals._exitId = 0; _vm->_globals.AFFLI = false; @@ -5418,9 +5416,9 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; - if (!_vm->_graphicsManager.NOFADE) + if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.FADE_INW(); - _vm->_graphicsManager.NOFADE = false; + _vm->_graphicsManager._noFadingFl = false; _vm->_eventsManager.changeMouseCursor(4); int xCheck = 0; @@ -5466,9 +5464,9 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm } if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_vm->_globals._helicopterFl) { - if (!_vm->_graphicsManager.NOFADE) + if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.FADE_OUTW(); - _vm->_graphicsManager.NOFADE = false; + _vm->_graphicsManager._noFadingFl = false; removeSprite(0); _vm->_globals.AFFLI = false; if (_twoCharactersFl) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a519f81bdc..4d98cfbcca 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -694,7 +694,7 @@ LABEL_1141: case 37: _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playSequence2("corde.SEQ", 32, 32, 100); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; break; case 38: @@ -709,7 +709,7 @@ LABEL_1141: _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); _vm->_soundManager.DEL_SAMPLE(3); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; break; case 40: @@ -891,7 +891,7 @@ LABEL_1141: } while (_vm->_objectsManager.BOBPOSI(12) != 34); _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.FADE_OUTW(); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_globals._exitId = 20; break; } @@ -1930,7 +1930,7 @@ LABEL_1141: _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_animationManager.NO_SEQ = false; - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_graphicsManager.FADE_OUTW(); for (int i = 1; i <= 39; i++) { @@ -2063,7 +2063,7 @@ LABEL_1141: _vm->_globals.NOPARLE = false; _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.stopBobAnimation(13); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_globals._exitId = 94; break; } @@ -2270,7 +2270,7 @@ LABEL_1141: _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = false; - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_graphicsManager.FADE_OUTW(); _vm->_objectsManager.PERSO_ON = false; _vm->_globals._exitId = 100; @@ -2321,7 +2321,7 @@ LABEL_1141: _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; _vm->_globals._exitId = 151; break; @@ -2336,7 +2336,7 @@ LABEL_1141: else if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_globals._exitId = 151; break; @@ -2354,7 +2354,7 @@ LABEL_1141: else if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_graphicsManager.NOFADE = true; + _vm->_graphicsManager._noFadingFl = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_globals._exitId = 151; break; -- cgit v1.2.3 From 7e3be3c2d803d583807988d42ead2a22412716bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Dec 2012 07:52:37 +0100 Subject: HOPKINS: Some refactoring in TalkManager --- engines/hopkins/objects.cpp | 10 +-- engines/hopkins/talk.cpp | 144 ++++++++++++++++---------------------------- engines/hopkins/talk.h | 8 +-- 3 files changed, 62 insertions(+), 100 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b4f803551a..5ea08150ed 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4115,14 +4115,14 @@ void ObjectsManager::BOB_VIVANT(int idx) { int v4; v1 = 5 * idx; - v2 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1); - v3 = (int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 2); - v4 = *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8); - if ((int16)READ_LE_UINT16(_vm->_talkManager.ADR_ANIM + 2 * v1 + 4)) { + v2 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + 2 * v1); + v3 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + 2 * v1 + 2); + v4 = *(_vm->_talkManager._characterAnim + 2 * v1 + 8); + if ((int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + 2 * v1 + 4)) { if (!_vm->_globals.NO_OFFSET) _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, _vm->_graphicsManager.ofscroll + v2, v3, - *(_vm->_talkManager.ADR_ANIM + 2 * v1 + 8)); + *(_vm->_talkManager._characterAnim + 2 * v1 + 8)); if (_vm->_globals.NO_OFFSET) _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, v2, v3, v4); } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 6fa89fb02e..09165e5e36 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -37,12 +37,12 @@ TalkManager::TalkManager() { _characterBuffer = NULL; _characterPalette = NULL; _characterSprite = NULL; - ADR_ANIM = NULL; + _characterAnim = NULL; _characterSize = 0; STATI = 0; PLIGNE1 = PLIGNE2 = 0; PLIGNE3 = PLIGNE4 = 0; - PCHERCHE = 0; + _paletteBufferIdx = 0; } void TalkManager::setParent(HopkinsEngine *vm) { @@ -84,7 +84,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _answersFilename = _questionsFilename = "RUEES.TXT"; } PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, spriteFilename); @@ -103,8 +103,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; - CHERCHE_PAL(PCHERCHE, 0); - CHERCHE_ANIM0(PCHERCHE, 0); + searchCharacterPalette(_paletteBufferIdx, false); + startCharacterAnim0(_paletteBufferIdx, false); initCharacterAnim(); PLIGNE2 = PLIGNE1 + 1; PLIGNE3 = PLIGNE1 + 2; @@ -202,8 +202,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { } PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; - CHERCHE_PAL(PCHERCHE, 0); + _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + searchCharacterPalette(_paletteBufferIdx, false); PLIGNE2 = PLIGNE1 + 1; PLIGNE3 = PLIGNE1 + 2; PLIGNE4 = PLIGNE1 + 3; @@ -505,62 +505,39 @@ int TalkManager::DIALOGUE_REP(int idx) { return v21; } -void TalkManager::CHERCHE_PAL(int a1, int a2) { - int v2; - size_t v4; - unsigned int v5; - byte *palette; - int v8; - - v2 = 0; - v8 = 0; - v4 = a1; +void TalkManager::searchCharacterPalette(int startIdx, bool dark) { + int palettePos = 0; + size_t curIdx = startIdx; for (;;) { - if (_characterBuffer[v4] == 'P' && _characterBuffer[v4 + 1] == 'A' && _characterBuffer[v4 + 2] == 'L') { - v8 = 1; - v2 = v4; - } - ++v4; - if (v8 == 1) + if (_characterBuffer[curIdx] == 'P' && _characterBuffer[curIdx + 1] == 'A' && _characterBuffer[curIdx + 2] == 'L') { + palettePos = curIdx; break; - if (_characterSize == v4) + } + ++curIdx; + if (_characterSize == curIdx) return; } - v5 = v2 + 5; - palette = _characterBuffer + v5; - _characterPalette = _characterBuffer + v5; - if (a2 == 0) { - *(palette + 762) = 0; - *(palette + 763) = 0; - *(palette + 764) = 0; - *(palette + 765) = 224; - *(palette + 766) = 224; - *(palette + 767) = 255; - *(palette + 759) = 255; - *(palette + 760) = 255; - *(palette + 761) = 86; - *palette = 0; - *(palette + 1) = 0; - *(palette + 2) = 0; - } - if (a2 == 1) { - *(palette + 765) = 224; - *(palette + 766) = 224; - *(palette + 767) = 255; - *(palette + 759) = 255; - *(palette + 760) = 255; - *(palette + 761) = 255; - *palette = 0; - *(palette + 1) = 0; - *(palette + 2) = 0; - *(palette + 762) = 0; - *(palette + 763) = 0; - *(palette + 764) = 0; - } + _characterPalette = _characterBuffer + palettePos + 5; + _characterPalette[0] = 0; + _characterPalette[1] = 0; + _characterPalette[2] = 0; + _characterPalette[759] = 255; + _characterPalette[760] = 255; + _characterPalette[762] = 0; + _characterPalette[763] = 0; + _characterPalette[764] = 0; + _characterPalette[765] = 224; + _characterPalette[766] = 224; + _characterPalette[767] = 255; + + if (!dark) + _characterPalette[761] = 86; + else + _characterPalette[761] = 255; - _vm->_graphicsManager.setpal_vga256(palette); - _vm->_graphicsManager.initColorTable(145, 150, palette); + _vm->_graphicsManager.setpal_vga256(_characterPalette); + _vm->_graphicsManager.initColorTable(145, 150, _characterPalette); } void TalkManager::VISU_WAIT() { @@ -735,42 +712,28 @@ void TalkManager::BOB_VISU_PARLE(int idx) { } } -void TalkManager::CHERCHE_ANIM0(int a1, int a2) { - size_t v2; - int v3; - size_t v4; - unsigned int v5; - unsigned int v6; - int v7; - byte *v8; - byte *v9; - - v2 = 0; - v3 = 0; - v4 = a1; +void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { + int animIdx = 0; + size_t curIdx = startIdx; for (;;) { - if (_characterBuffer[v4] == 'A' && _characterBuffer[v4 + 1] == 'N' && _characterBuffer[v4 + 2] == 'I' && _characterBuffer[v4 + 3] == 'M' && _characterBuffer[v4 + 4] == 1) { - v3 = 1; - v2 = v4; - } - ++v4; - if (v3 == 1) + if (_characterBuffer[curIdx] == 'A' && _characterBuffer[curIdx + 1] == 'N' && _characterBuffer[curIdx + 2] == 'I' && _characterBuffer[curIdx + 3] == 'M' && _characterBuffer[curIdx + 4] == 1) { + animIdx = curIdx; break; - if (_characterSize == v4) + } + ++curIdx; + if (_characterSize == curIdx) return; } - v5 = v2 + 25; - v9 = _characterBuffer + v5; - v8 = _characterBuffer + v5; - ADR_ANIM = _characterBuffer + v5; - if (!a2) { - v6 = 0; + _characterAnim = _characterBuffer + animIdx + 25; + if (!readOnlyFl) { + int idx = 0; + int v7; do { - v7 = (int16)READ_LE_UINT16(&v8[2 * v6 + 4]); + v7 = (int16)READ_LE_UINT16(&_characterAnim[2 * idx + 4]); if (v7 && _vm->_globals._speed != 501) - _vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&v8[2 * v6]), - (int16)READ_LE_UINT16(&v8[2 * v6 + 2]), v9[2 * v6 + 8]); - v6 += 5; + _vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&_characterAnim[2 * idx]), + (int16)READ_LE_UINT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]); + idx += 5; } while (_vm->_globals._speed != 501 && v7); } } @@ -1185,12 +1148,11 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; _vm->_graphicsManager.NB_SCREEN(); - v10 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; - PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; - CHERCHE_PAL(v10, 1); - CHERCHE_ANIM0(v10, 0); + searchCharacterPalette(_paletteBufferIdx, true); + startCharacterAnim0(_paletteBufferIdx, false); v11 = _vm->_globals.COUCOU; _vm->_globals.COUCOU = g_PTRNUL; _vm->_globals.NOMARCHE = true; diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index e1f089dedd..a3a695d66a 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -39,12 +39,12 @@ public: byte *_characterBuffer; byte *_characterPalette; byte *_characterSprite; - byte *ADR_ANIM; + byte *_characterAnim; size_t _characterSize; int STATI; int PLIGNE1, PLIGNE2; int PLIGNE3, PLIGNE4; - int PCHERCHE; + int _paletteBufferIdx; public: TalkManager(); void setParent(HopkinsEngine *vm); @@ -54,14 +54,14 @@ public: void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData); int DIALOGUE(); int DIALOGUE_REP(int idx); - void CHERCHE_PAL(int a1, int a2); + void searchCharacterPalette(int startIdx, bool dark); void VISU_WAIT(); void FIN_VISU_WAIT(); void FIN_VISU_PARLE(); int VERIF_BOITE(int a1, const Common::String &a2, int a3); void VISU_PARLE(); void BOB_VISU_PARLE(int idx); - void CHERCHE_ANIM0(int a1, int a2); + void startCharacterAnim0(int startIndedx, bool readOnlyFl); void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int a1, const byte *a2, int a3, int a4); -- cgit v1.2.3 From dc02df8cd27e9284247166a4d33fe5bb7bcd4a43 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Dec 2012 08:13:29 +0100 Subject: HOPKINS: Remove forgotten useless variable --- engines/hopkins/talk.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 09165e5e36..978fd1ef1a 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1093,7 +1093,6 @@ void TalkManager::REPONSE2(int a1, int a2) { void TalkManager::OBJET_VIVANT(const Common::String &a2) { int v5; - int v10; byte *v11; byte *v14; byte *v15; -- cgit v1.2.3 From 9a88c748fecddcf4d10856b7a58f6ec0ac4303df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Dec 2012 18:41:20 +0100 Subject: HOPKINS: Stop music properly when using the MOD player --- engines/hopkins/sound.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 3672e29880..b35a3d801d 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -456,6 +456,9 @@ void SoundManager::playMusic() { void SoundManager::stopMusic() { if (Music._active) Music._isPlaying = false; + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + _vm->_mixer->stopHandle(_modHandle); + } void SoundManager::delMusic() { -- cgit v1.2.3 From 7997011d2f93051b4d01efb3ff71f883fe242da9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Dec 2012 18:41:52 +0100 Subject: HOPKINS: Some renaming in TalkManager --- engines/hopkins/talk.cpp | 18 +++++++++--------- engines/hopkins/talk.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 978fd1ef1a..4bdc0d567d 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -282,7 +282,7 @@ int TalkManager::DIALOGUE() { if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 4) _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 52)); } else { - VISU_WAIT(); + dialogWait(); } v19 = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); @@ -359,7 +359,7 @@ int TalkManager::DIALOGUE() { if (v16 != 4) _vm->_objectsManager.stopBobAnimation(v16); } else { - FIN_VISU_WAIT(); + dialogTalk(); } _vm->_eventsManager.VBL(); @@ -496,7 +496,7 @@ int TalkManager::DIALOGUE_REP(int idx) { if (v20) _vm->_objectsManager.stopBobAnimation(v20); } else { - FIN_VISU_PARLE(); + dialogEndTalk(); } v21 = 0; if (!PLIGNE1) @@ -540,14 +540,14 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) { _vm->_graphicsManager.initColorTable(145, 150, _characterPalette); } -void TalkManager::VISU_WAIT() { +void TalkManager::dialogWait() { for (int idx = 26; idx <= 30; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) BOB_VISU_PARLE(idx); } } -void TalkManager::FIN_VISU_WAIT() { +void TalkManager::dialogTalk() { for (int idx = 26; idx <= 30; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) _vm->_objectsManager.BOB_OFF(idx); @@ -559,7 +559,7 @@ void TalkManager::FIN_VISU_WAIT() { } } -void TalkManager::FIN_VISU_PARLE() { +void TalkManager::dialogEndTalk() { for (int idx = 21; idx <= 25; ++idx) { if (_vm->_globals.Bqe_Anim[idx].field4 == 1) _vm->_objectsManager.BOB_OFF(idx); @@ -1161,7 +1161,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.NUMZONE = -1; initCharacterAnim(); VISU_PARLE(); - VISU_WAIT(); + dialogWait(); _vm->_graphicsManager.INI_ECRAN2(v22); _vm->_globals.NOMARCHE = true; _vm->_objectsManager._forceZoneFl = true; @@ -1178,8 +1178,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PARADISE(); _vm->_eventsManager.VBL(); } while (!_vm->_globals._exitId); - FIN_VISU_PARLE(); - FIN_VISU_WAIT(); + dialogEndTalk(); + dialogTalk(); clearCharacterAnim(); clearCharacterAnim(); _vm->_globals.NOPARLE = false; diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index a3a695d66a..0cf3e07292 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -55,9 +55,9 @@ public: int DIALOGUE(); int DIALOGUE_REP(int idx); void searchCharacterPalette(int startIdx, bool dark); - void VISU_WAIT(); - void FIN_VISU_WAIT(); - void FIN_VISU_PARLE(); + void dialogWait(); + void dialogTalk(); + void dialogEndTalk(); int VERIF_BOITE(int a1, const Common::String &a2, int a3); void VISU_PARLE(); void BOB_VISU_PARLE(int idx); -- cgit v1.2.3 From c07beb64455b3d30300176a99aed7140c0a090e0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Dec 2012 19:08:10 +0100 Subject: HOPKINS: Some refactoring in showComputer --- engines/hopkins/computer.cpp | 87 +++++++++++++++----------------------------- engines/hopkins/dialogs.cpp | 54 +++++++++++++-------------- engines/hopkins/sound.cpp | 44 +++++++++++----------- engines/hopkins/sound.h | 8 ++-- 4 files changed, 83 insertions(+), 110 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 8809dc3145..668bd53c85 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -119,17 +119,10 @@ void ComputerManager::setTextPosition(int yp, int xp) { * @param mode Which computer to display */ void ComputerManager::showComputer(ComputerEnum mode) { - bool passwordMatch; - char *v3; - char s[12]; - const char *s2; - _vm->_eventsManager._escKeyFl = false; - passwordMatch = false; _vm->_graphicsManager.RESET_SEGMENT_VESA(); setVideoMode(); setTextColor(4); - setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) outText(Common::String(_menuText[0]._line)); @@ -147,48 +140,16 @@ void ComputerManager::showComputer(ComputerEnum mode) { outText(Common::String(_menuText[4]._line)); setTextPosition(14, 35); - memset(s, 0, 12); TXT4(280, 224, 8); - strcpy(s, _inputBuf); - v3 = &s[0]; - + bool passwordMatch = false; if (mode == COMPUTER_HOPKINS) { - s2 = "HOPKINS"; - int v4 = 8; - char v5 = 1; - do { - if (!v4) - break; - v5 = *v3++ == *s2++; - --v4; - } while (v5); - if (v5) + if (!strcmp(_inputBuf, "HOPKINS")) passwordMatch = true; } else if (mode == COMPUTER_SAMANTHAS) { - char *v6 = &s[0]; - s2 = "328MHZA"; - int v7 = 8; - bool v8 = true; - do { - if (!v7) - break; - v8 = (*v6++ == *s2++); - --v7; - } while (v8); - if (v8) + if (!strcmp(_inputBuf, "328MHZA")) passwordMatch = true; } else if (mode == COMPUTER_PUBLIC) { - char *v9 = &s[0]; - s2 = "ALLFREE"; - int v10 = 8; - bool v11 = true; - do { - if (!v10) - break; - v11 = (*v9++ == *s2++); - --v10; - } while (v11); - if (v11) + if (!strcmp(_inputBuf, "ALLFREE")) passwordMatch = true; } @@ -234,21 +195,21 @@ void ComputerManager::showComputer(ComputerEnum mode) { } bool numericFlag = false; - char v12; + char keyPressed; do { - v12 = _vm->_eventsManager.waitKeyPress(); + keyPressed = _vm->_eventsManager.waitKeyPress(); if (_vm->shouldQuit()) return; - if ((uint16)(v12 - 48) <= 8u) + if ((keyPressed >= '0') && (keyPressed <= '9')) numericFlag = true; } while (!numericFlag); // 0 - Quit - if (v12 == '0') + if (keyPressed == '0') break; // 1 - Games - if (v12 == '1') { + if (keyPressed == '1') { displayGamesSubMenu(); } else if (mode == COMPUTER_HOPKINS) { clearScreen(); @@ -256,31 +217,43 @@ void ComputerManager::showComputer(ComputerEnum mode) { setTextPosition(2, 4); outText(Common::String(_menuText[0]._line)); setTextColor(15); - if (v12 == 50) + switch (keyPressed) { + case '2': readText(1); - if (v12 == 51) + break; + case '3': readText(2); - if (v12 == 52) + break; + case '4': readText(3); - if (v12 == 53) + break; + case '5': readText(4); + break; + } } else if (mode == COMPUTER_SAMANTHAS) { clearScreen(); setTextColor(4); setTextPosition(2, 4); outText(Common::String(_menuText[1]._line)); setTextColor(15); - if (v12 == 50) + switch (keyPressed) { + case '2': readText(6); - if (v12 == 51) + break; + case '3': readText(7); - if (v12 == 52) + break; + case '4': readText(8); - if (v12 == 53) + break; + case '5': readText(9); - if (v12 == 54) { + break; + case '6': readText(10); _vm->_globals._saveData->data[svField270] = 4; + break; } } } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 1f1a009e1b..1260f92b7d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -75,50 +75,50 @@ void DialogsManager::showOptionsDialog() { mousePos.x = _vm->_eventsManager.getMouseX(); mousePos.y = _vm->_eventsManager.getMouseY(); - if (!_vm->_soundManager._musicOff) { + if (!_vm->_soundManager._musicOffFl) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { // Change the music volume - ++_vm->_soundManager.MUSICVOL; + ++_vm->_soundManager._musicVolume; - if (_vm->_soundManager.MUSICVOL <= 12) + if (_vm->_soundManager._musicVolume <= 12) _vm->_soundManager.playSound("bruit2.wav"); else - _vm->_soundManager.MUSICVOL = 12; - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); + _vm->_soundManager._musicVolume = 12; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._musicOff && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { - --_vm->_soundManager.MUSICVOL; - if (_vm->_soundManager.MUSICVOL >= 0) + if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + --_vm->_soundManager._musicVolume; + if (_vm->_soundManager._musicVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); else - _vm->_soundManager.MUSICVOL = 0; + _vm->_soundManager._musicVolume = 0; - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); _vm->_soundManager.updateScummVMSoundSettings(); } } if (!_vm->_soundManager._soundOffFl) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { - ++_vm->_soundManager.SOUNDVOL; - if (_vm->_soundManager.SOUNDVOL <= 16) + ++_vm->_soundManager._soundVolume; + if (_vm->_soundManager._soundVolume <= 16) _vm->_soundManager.playSound("bruit2.wav"); else - _vm->_soundManager.SOUNDVOL = 16; + _vm->_soundManager._soundVolume = 16; _vm->_soundManager.MODSetSampleVolume(); _vm->_soundManager.updateScummVMSoundSettings(); } if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { - --_vm->_soundManager.SOUNDVOL; - if (_vm->_soundManager.SOUNDVOL >= 0) + --_vm->_soundManager._soundVolume; + if (_vm->_soundManager._soundVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); else - _vm->_soundManager.SOUNDVOL = 0; + _vm->_soundManager._soundVolume = 0; _vm->_soundManager.MODSetSampleVolume(); _vm->_soundManager.updateScummVMSoundSettings(); @@ -127,23 +127,23 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_soundManager._voiceOffFl) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { - ++_vm->_soundManager.VOICEVOL; + ++_vm->_soundManager._voiceVolume; - if (_vm->_soundManager.VOICEVOL <= 16) + if (_vm->_soundManager._voiceVolume <= 16) _vm->_soundManager.playSound("bruit2.wav"); else - _vm->_soundManager.VOICEVOL = 16; + _vm->_soundManager._voiceVolume = 16; _vm->_soundManager.MODSetVoiceVolume(); _vm->_soundManager.updateScummVMSoundSettings(); } if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { - --_vm->_soundManager.VOICEVOL; - if (_vm->_soundManager.VOICEVOL >= 0) + --_vm->_soundManager._voiceVolume; + if (_vm->_soundManager._voiceVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); else - _vm->_soundManager.VOICEVOL = 0; + _vm->_soundManager._voiceVolume = 0; _vm->_soundManager.MODSetVoiceVolume(); _vm->_soundManager.updateScummVMSoundSettings(); @@ -162,11 +162,11 @@ void DialogsManager::showOptionsDialog() { } if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { - if (_vm->_soundManager._musicOff) { - _vm->_soundManager._musicOff = false; - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager.MUSICVOL); + if (_vm->_soundManager._musicOffFl) { + _vm->_soundManager._musicOffFl = false; + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); } else { - _vm->_soundManager._musicOff = true; + _vm->_soundManager._musicOffFl = true; _vm->_soundManager.MODSetMusicVolume(0); } @@ -249,7 +249,7 @@ void DialogsManager::showOptionsDialog() { _vm->_globals.opt_txt = !_vm->_soundManager._textOffFl ? 7 : 8; _vm->_globals.opt_voice = !_vm->_soundManager._voiceOffFl ? 7 : 8; _vm->_globals.opt_sound = !_vm->_soundManager._soundOffFl ? 7 : 8; - _vm->_globals.opt_music = !_vm->_soundManager._musicOff ? 7 : 8; + _vm->_globals.opt_music = !_vm->_soundManager._musicOffFl ? 7 : 8; if (_vm->_globals.SVGA == 1) _vm->_globals.opt_anm = 10; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index b35a3d801d..f09c89252a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -74,11 +74,11 @@ namespace Hopkins { SoundManager::SoundManager() { SPECIAL_SOUND = 0; - SOUNDVOL = 0; - VOICEVOL = 0; - MUSICVOL = 0; + _soundVolume = 0; + _voiceVolume = 0; + _musicVolume = 0; _soundOffFl = true; - _musicOff = true; + _musicOffFl = true; _voiceOffFl = true; _textOffFl = false; _soundFl = false; @@ -381,7 +381,7 @@ void SoundManager::WSOUND_OFF() { } void SoundManager::PLAY_MOD(const Common::String &file) { - if (_musicOff) + if (_musicOffFl) return; _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, file); if (MOD_FLAG) { @@ -507,7 +507,7 @@ void SoundManager::checkMusic() { mwavIndex = Music._mwavIndexes[Music._currentIndex]; } - int volume = MUSICVOL * 255 / 16; + int volume = _musicVolume * 255 / 16; Mwav[mwavIndex]._audioStream->rewind(); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, @@ -663,9 +663,9 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { } SDL_LVOICE(catPos, catLen); - oldMusicVol = MUSICVOL; - if (!_musicOff && MUSICVOL > 2) - MUSICVOL = (signed int)((long double)MUSICVOL - (long double)MUSICVOL / 100.0 * 45.0); + oldMusicVol = _musicVolume; + if (!_musicOffFl && _musicVolume > 2) + _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); PLAY_VOICE_SDL(); @@ -686,7 +686,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { stopVoice(2); DEL_SAMPLE_SDL(20); - MUSICVOL = oldMusicVol; + _musicVolume = oldMusicVol; _vm->_eventsManager._escKeyFl = false; VBL_MERDE = 0; return true; @@ -898,7 +898,7 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { Voice[voiceIndex].field14 = 4; Voice[voiceIndex]._wavIndex = wavIndex; - int volume = (voiceIndex == 2) ? VOICEVOL * 255 / 16 : SOUNDVOL * 255 / 16; + int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16; // Start the voice playing Swav[wavIndex]._audioStream->rewind(); @@ -912,38 +912,38 @@ void SoundManager::syncSoundSettings() { muteAll = ConfMan.getBool("mute"); // Update the mute settings - _musicOff = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); + _musicOffFl = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); _soundOffFl = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); _voiceOffFl = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); // Update the volume levels - MUSICVOL = MIN(255, ConfMan.getInt("music_volume")) * 16 / 255; - SOUNDVOL = MIN(255, ConfMan.getInt("sfx_volume")) * 16 / 255; - VOICEVOL = MIN(255, ConfMan.getInt("speech_volume")) * 16 / 255; + _musicVolume = MIN(255, ConfMan.getInt("music_volume")) * 16 / 255; + _soundVolume = MIN(255, ConfMan.getInt("sfx_volume")) * 16 / 255; + _voiceVolume = MIN(255, ConfMan.getInt("speech_volume")) * 16 / 255; // Update any active sounds for (int idx = 0; idx < SWAV_COUNT; ++idx) { if (Swav[idx]._active) { - int volume = (idx == 20) ? (VOICEVOL * 255 / 16) : (SOUNDVOL * 255 / 16); + int volume = (idx == 20) ? (_voiceVolume * 255 / 16) : (_soundVolume * 255 / 16); _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); } } for (int idx = 0; idx < MWAV_COUNT; ++idx) { if (Mwav[idx]._active) { - _vm->_mixer->setChannelVolume(Mwav[idx]._soundHandle, MUSICVOL * 255 / 16); + _vm->_mixer->setChannelVolume(Mwav[idx]._soundHandle, _musicVolume * 255 / 16); } } } void SoundManager::updateScummVMSoundSettings() { - ConfMan.setBool("mute", _musicOff && _soundOffFl && _voiceOffFl); - ConfMan.setBool("music_mute", _musicOff); + ConfMan.setBool("mute", _musicOffFl && _soundOffFl && _voiceOffFl); + ConfMan.setBool("music_mute", _musicOffFl); ConfMan.setBool("sfx_mute", _soundOffFl); ConfMan.setBool("speech_mute", _voiceOffFl); - ConfMan.setInt("music_volume", MUSICVOL * 255 / 16); - ConfMan.setInt("sfx_volume", SOUNDVOL * 255 / 16); - ConfMan.setInt("speech_volume", VOICEVOL * 255 / 16); + ConfMan.setInt("music_volume", _musicVolume * 255 / 16); + ConfMan.setInt("sfx_volume", _soundVolume * 255 / 16); + ConfMan.setInt("speech_volume", _voiceVolume * 255 / 16); ConfMan.flushToDisk(); } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 2fa4670d48..4a02f915f7 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -114,11 +114,11 @@ private: public: Audio::SoundHandle _modHandle; int SPECIAL_SOUND; - int SOUNDVOL; - int VOICEVOL; - int MUSICVOL; + int _soundVolume; + int _voiceVolume; + int _musicVolume; bool _soundOffFl; - bool _musicOff; + bool _musicOffFl; bool _voiceOffFl; bool _textOffFl; bool _soundFl; -- cgit v1.2.3 From c9343637902ed94f0a511ff9fa0d1bffe346d5e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Dec 2012 08:26:27 +0100 Subject: HOPKINS: Some more renaming and refactoring --- engines/hopkins/anim.cpp | 38 +-- engines/hopkins/computer.cpp | 24 +- engines/hopkins/dialogs.cpp | 12 +- engines/hopkins/files.cpp | 44 +-- engines/hopkins/font.cpp | 2 +- engines/hopkins/globals.cpp | 8 +- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 651 +++++++++++++++++++++---------------------- engines/hopkins/hopkins.cpp | 50 ++-- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 42 +-- engines/hopkins/script.cpp | 4 +- engines/hopkins/sound.cpp | 14 +- engines/hopkins/talk.cpp | 26 +- 14 files changed, 454 insertions(+), 465 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index d495ed0d75..af3ee8aa05 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -64,8 +64,8 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui ptr = _vm->_globals.allocMemory(20); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); - if (!f.open(_vm->_globals.NFICHIER)) - error("File not found - %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("File not found - %s", _vm->_globals._curFilename.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); @@ -237,9 +237,9 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -247,8 +247,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint v13 = _vm->_globals.allocMemory(20); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); - if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("Error opening file - %s", _vm->_globals._curFilename.c_str()); f.read(&buf, 6); f.read(_vm->_graphicsManager._palette, 800); @@ -556,8 +556,8 @@ void AnimationManager::loadAnim(const Common::String &animName) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); Common::File f; - if (!f.open(_vm->_globals.NFICHIER)) - error("Failed to open %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("Failed to open %s", _vm->_globals._curFilename.c_str()); int filesize = f.size(); int nbytes = filesize - 115; @@ -580,7 +580,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { if (files[idx][0]) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, files[idx]); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) error("File not found"); if (loadSpriteBank(idx + 1, files[idx])) error("File not compatible with this soft."); @@ -626,11 +626,11 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *v19; int result = 0; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals._curFilename); _vm->_globals.Bank[idx].field4 = 1; _vm->_globals.Bank[idx]._filename = filename; - v3 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + v3 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v4 = v3; _vm->_globals.Bank[idx]._fileHeader = 0; @@ -672,8 +672,8 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, ofsFilename); Common::File f; - if (f.exists(_vm->_globals.NFICHIER)) { - v19 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + if (f.exists(_vm->_globals._curFilename)) { + v19 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v13 = v19; for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) { int x1 = (int16)READ_LE_UINT16(v13); @@ -822,17 +822,17 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; } v9 = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(22); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); - if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("Error opening file - %s", _vm->_globals._curFilename.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); @@ -989,8 +989,8 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u v11 = _vm->_globals.allocMemory(22); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); - if (!f.open(_vm->_globals.NFICHIER)) - error("File not found - %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("File not found - %s", _vm->_globals._curFilename.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 668bd53c85..0079d7f234 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -79,7 +79,7 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "STFONT.SPR"); _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; _vm->_graphicsManager.loadImage("WINTEXT"); @@ -291,7 +291,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { */ void ComputerManager::loadMenu() { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); - byte *ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); byte *tmpPtr = ptr; int lineNum = 0; int strPos; @@ -472,7 +472,7 @@ void ComputerManager::outText2(const Common::String &msg) { void ComputerManager::restoreFBIRoom() { _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FONTE3.SPR"); - _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.police_l = 12; _vm->_globals.police_h = 21; @@ -506,8 +506,8 @@ void ComputerManager::readText(int idx) { else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKES.TXT"); - ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - v1 = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + v1 = _vm->_fileManager.fileSize(_vm->_globals._curFilename); v2 = 0; v3 = 0; if (v1 > 0u) { @@ -584,7 +584,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_soundManager.loadSample(2, "SOUND38.WAV"); _vm->_soundManager.loadSample(3, "SOUND39.WAV"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "CASSE.SPR"); - _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); loadHiscore(); setModeVGA256(); newLevel(); @@ -617,7 +617,7 @@ void ComputerManager::loadHiscore() { _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); ptr = _vm->_globals.allocMemory(100); - _vm->_saveLoadManager.load(_vm->_globals.NFICHIER, ptr); + _vm->_saveLoadManager.load(_vm->_globals._curFilename, ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { @@ -671,14 +671,14 @@ void ComputerManager::newLevel() { file = Common::String::format("TAB%d.TAB", _breakoutLevelNbr); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, file); - if (f.open(_vm->_globals.NFICHIER)) + if (f.open(_vm->_globals._curFilename)) break; _breakoutLevelNbr = 1; } f.close(); - _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); displayBricks(); _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); @@ -860,7 +860,7 @@ int ComputerManager::displayHiscores() { loadHiscore(); _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); - ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -915,7 +915,7 @@ void ComputerManager::getScoreName() { _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); - ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_graphicsManager.fadeInBreakout(); for (int strPos = 0; strPos <= 4; strPos++) { displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); @@ -1075,7 +1075,7 @@ void ComputerManager::saveScore() { } _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, ptr, 100); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, ptr, 100); _vm->_globals.freeMemory(ptr); } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 1260f92b7d..2899cb030f 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -66,7 +66,7 @@ void DialogsManager::showOptionsDialog() { else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); - _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals._optionDialogFl = true; do { @@ -327,8 +327,8 @@ LABEL_7: } Common::File f; - if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("Error opening file - %s", _vm->_globals._curFilename.c_str()); size_t filesize = f.size(); _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); @@ -336,7 +336,7 @@ LABEL_7: f.close(); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); - _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; _inventY = 114; @@ -634,9 +634,9 @@ void DialogsManager::showSaveLoad(int a1) { break; } - _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVE2.SPR"); - _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); if (_vm->_globals._language == LANG_FR) { diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 1971b82a2a..6c792017ef 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -74,7 +74,7 @@ void FileManager::initCensorship() { // If file doesn't exist, fallback to uncensored if (!fileExists(_vm->_globals.HOPSYSTEM, "BLOOD.DAT")) { constructFilename(_vm->_globals.HOPSYSTEM, "BLOOD.DAT"); - char *data = (char *)loadFile(_vm->_globals.NFICHIER); + char *data = (char *)loadFile(_vm->_globals._curFilename); if (*(data + 6) == 'u' && *(data + 7) == 'k') _vm->_globals.CENSURE = true; @@ -118,14 +118,14 @@ void FileManager::constructFilename(const Common::String &folder, const Common:: } } - _vm->_globals.NFICHIER = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); + _vm->_globals._curFilename = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); } /** * Construct Linux filename */ Common::String FileManager::constructLinuxFilename(const Common::String &file) { - _vm->_globals.NFICHIER = file; + _vm->_globals._curFilename = file; return file; } @@ -153,71 +153,71 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { switch (a2) { case 1: constructFilename(_vm->_globals.HOPLINK, "RES_INI.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); constructFilename(_vm->_globals.HOPLINK, "RES_INI.RES"); break; case 2: constructFilename(_vm->_globals.HOPLINK, "RES_REP.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); constructFilename(_vm->_globals.HOPLINK, "RES_REP.RES"); break; case 3: constructFilename(_vm->_globals.HOPLINK, "RES_LIN.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); constructFilename(_vm->_globals.HOPLINK, "RES_LIN.RES"); break; case 4: constructFilename(_vm->_globals.HOPANIM, "RES_ANI.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); constructFilename(_vm->_globals.HOPANIM, "RES_ANI.RES"); break; case 5: constructFilename(_vm->_globals.HOPANIM, "RES_PER.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); constructFilename(_vm->_globals.HOPANIM, "RES_PER.RES"); break; case 6: constructFilename(_vm->_globals.HOPIMAGE, "PIC.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); break; case 7: constructFilename(_vm->_globals.HOPANIM, "RES_SAN.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); break; case 8: constructFilename(_vm->_globals.HOPLINK, "RES_SLI.CAT"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); break; case 9: @@ -238,10 +238,10 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { } } - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals.NFICHIER); + ptr = loadFile(_vm->_globals._curFilename); break; // Deliberate fall-through to default: @@ -276,7 +276,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { // TODO: Double check whether this really should be an unsigned int comparison if ((uint16)(a2 - 6) > 1 && (uint16)(a2 - 8) > 1) { - if (!f.open(_vm->_globals.NFICHIER)) + if (!f.open(_vm->_globals._curFilename)) error("CHARGE_FICHIER"); f.seek(_vm->_globals._catalogPos); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 484745347e..f1415506fe 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -170,7 +170,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._textLoadedFl = true; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); - file = _vm->_globals.NFICHIER; + file = _vm->_globals._curFilename; if (strncmp(file.c_str(), _oldName.c_str(), strlen(file.c_str())) != 0) { // Starting to access a new file, so read in the index file for the file _oldName = file; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 15f5abcd29..99eaadee28 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -472,7 +472,7 @@ void Globals::CLEAR_VBOB() { // Load Object void Globals::loadObjects() { _vm->_fileManager.constructFilename(HOPSYSTEM, "OBJET.DAT"); - byte *data = _vm->_fileManager.loadFile(NFICHIER); + byte *data = _vm->_fileManager.loadFile(_curFilename); byte *srcP = data; for (int idx = 0; idx < 300; ++idx) { @@ -551,13 +551,13 @@ void Globals::loadCache(const Common::String &file) { RESET_CACHE(); _vm->_fileManager.constructFilename(HOPLINK, file); - ptr = _vm->_fileManager.loadFile(NFICHIER); + ptr = _vm->_fileManager.loadFile(_curFilename); v16 = Common::String((const char *)ptr); _vm->_fileManager.constructFilename(HOPLINK, v16); - if (f.exists(NFICHIER)) { - spriteData = _vm->_fileManager.loadFile(NFICHIER); + if (f.exists(_curFilename)) { + spriteData = _vm->_fileManager.loadFile(_curFilename); CACHE_BANQUE[1] = spriteData; int v15 = 60; for (int i = 0; i <= 21; i++) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a2104a6fbd..c524cf616f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -350,7 +350,7 @@ public: Common::String HOPSYSTEM; Common::String FICH_ZONE; Common::String FICH_TEXTE; - Common::String NFICHIER; + Common::String _curFilename; int SOUNDVOL; int MUSICVOL; int VOICEVOL; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index fdbffe8456..0facdf85d4 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -167,7 +167,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { clearScreen(); unlockScreen(); _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); - A_PCX320(_vesaScreen, _vm->_globals.NFICHIER, _palette); + A_PCX320(_vesaScreen, _vm->_globals._curFilename, _palette); memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); max_x = 320; @@ -188,7 +188,7 @@ void GraphicsManager::loadScreen(const Common::String &file) { bool flag = true; if (_vm->_fileManager.searchCat(file, 6) == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); - if (!f.open(_vm->_globals.NFICHIER)) + if (!f.open(_vm->_globals._curFilename)) error("loadScreen - %s", file.c_str()); f.seek(0, SEEK_END); @@ -305,14 +305,14 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by if (typeFlag) { // Load PCX from within the PIC resource _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, "PIC.RES"); - if (!f.open(_vm->_globals.NFICHIER)) + if (!f.open(_vm->_globals._curFilename)) error("(nom)Erreur en cours de lecture."); f.seek(_vm->_globals._catalogPos); } else { // Load stand alone PCX file _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); - if (!f.open(_vm->_globals.NFICHIER)) + if (!f.open(_vm->_globals._curFilename)) error("(nom)Erreur en cours de lecture."); } @@ -1406,349 +1406,338 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp clip_y = 0; clip_x1 = 0; clip_y1 = 0; - if ((uint16)xp300 > min_x) { - if ((uint16)xp300 < (uint16)(min_x + 300)) - clip_x = min_x + 300 - xp300; - if ((uint16)yp300 > min_y) { - if ((uint16)yp300 < (uint16)(min_y + 300)) - clip_y = min_y + 300 - yp300; - if ((uint16)xp300 < (uint16)(max_x + 300)) { - clip_x1 = max_x + 300 - xp300; - if ((uint16)yp300 < (uint16)(max_y + 300)) { - clip_y1 = max_y + 300 - yp300; - dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; - if (zoom2) { - Compteur_y = 0; - Agr_x = 0; - Agr_y = 0; - Agr_Flag_y = 0; + if ((xp300 <= min_x) || (yp300 <= min_y) || (xp300 >= max_x + 300) || (yp300 >= max_y + 300)) + return; + + if ((uint16)xp300 < (uint16)(min_x + 300)) + clip_x = min_x + 300 - xp300; + + if ((uint16)yp300 < (uint16)(min_y + 300)) + clip_y = min_y + 300 - yp300; + + clip_x1 = max_x + 300 - xp300; + clip_y1 = max_y + 300 - yp300; + dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; + if (zoom2) { + Compteur_y = 0; + Agr_x = 0; + Agr_y = 0; + Agr_Flag_y = 0; + Agr_Flag_x = 0; + _width = spriteWidth; + int v20 = zoomIn(spriteWidth, zoom2); + int v22 = zoomIn(spriteHeight1, zoom2); + if (modeFlag) { + v29 = v20 + dest1P; + if (clip_y) { + if ((uint16)clip_y >= v22) + return; + int v30 = 0; + while (zoomIn(v30 + 1, zoom2) < (uint16)clip_y) + ; + spritePixelsP += _width * v30; + v29 += _lineNbr2 * (uint16)clip_y; + v22 = v22 - (uint16)clip_y; + } + if (v22 > (uint16)clip_y1) + v22 = (uint16)clip_y1; + if (clip_x) { + if ((uint16)clip_x >= v20) + return; + v20 -= (uint16)clip_x; + } + if (v20 > (uint16)clip_x1) { + int v32 = v20 - (uint16)clip_x1; + v29 -= v32; + int v62 = v22; + int v33 = 0; + while (zoomIn(v33 + 1, zoom2) < v32) + ; + int v34 = v33; + v22 = v62; + spritePixelsP += v34; + v20 = (uint16)clip_x1; + } + int v63; + do { + for (;;) { + v63 = v22; + byte *v53 = v29; + v46 = spritePixelsP; + Agr_Flag_x = 0; + Agr_x = 0; + for (int v35 = v20; v35; v35--) { + for (;;) { + if (*spritePixelsP) + *v29 = *spritePixelsP; + --v29; + ++spritePixelsP; + if (!Agr_Flag_x) + Agr_x = zoom2 + Agr_x; + if ((uint16)Agr_x < 100) + break; + Agr_x = Agr_x - 100; + --spritePixelsP; + Agr_Flag_x = 1; + --v35; + if (!v35) + goto R_Aff_Zoom_Larg_Cont1; + } Agr_Flag_x = 0; - _width = spriteWidth; - int v20 = zoomIn(spriteWidth, zoom2); - int v22 = zoomIn(spriteHeight1, zoom2); - if (modeFlag) { - v29 = v20 + dest1P; - if (clip_y) { - if ((uint16)clip_y >= v22) - return; - int v61 = v22; - int v52 = v20; - int v30 = 0; - int v31 = (uint16)clip_y; - while (zoomIn(v30 + 1, zoom2) < v31) - ; - v20 = v52; - spritePixelsP += _width * v30; - v29 += _lineNbr2 * (uint16)clip_y; - v22 = v61 - (uint16)clip_y; - } - if (v22 > (uint16)clip_y1) - v22 = (uint16)clip_y1; - if (clip_x) { - if ((uint16)clip_x >= v20) - return; - v20 -= (uint16)clip_x; - } - if (v20 > (uint16)clip_x1) { - int v32 = v20 - (uint16)clip_x1; - v29 -= v32; - int v62 = v22; - int v33 = 0; - while (zoomIn(v33 + 1, zoom2) < v32) - ; - int v34 = v33; - v22 = v62; - spritePixelsP += v34; - v20 = (uint16)clip_x1; - } - int v63; - do { - for (;;) { - v63 = v22; - byte *v53 = v29; - v46 = spritePixelsP; - Agr_Flag_x = 0; - Agr_x = 0; - for (int v35 = v20; v35; v35--) { - for (;;) { - if (*spritePixelsP) - *v29 = *spritePixelsP; - --v29; - ++spritePixelsP; - if (!Agr_Flag_x) - Agr_x = zoom2 + Agr_x; - if ((uint16)Agr_x < 100) - break; - Agr_x = Agr_x - 100; - --spritePixelsP; - Agr_Flag_x = 1; - --v35; - if (!v35) - goto R_Aff_Zoom_Larg_Cont1; - } - Agr_Flag_x = 0; - } + } R_Aff_Zoom_Larg_Cont1: - spritePixelsP = _width + v46; - v29 = _lineNbr2 + v53; - ++Compteur_y; - if (!Agr_Flag_y) - Agr_y = zoom2 + Agr_y; - if ((uint16)Agr_y < 100) - break; - Agr_y = Agr_y - 100; - spritePixelsP = v46; - Agr_Flag_y = 1; - v22 = v63 - 1; - if (v63 == 1) - return; - } - Agr_Flag_y = 0; - v22 = v63 - 1; - } while (v63 != 1); - } else { - if (clip_y) { - if ((uint16)clip_y >= v22) - return; - int v58 = v22; - int v49 = v20; - int v23 = 0; - int v24 = (uint16)clip_y; - while (zoomIn(v23 + 1, zoom2) < v24) - ; - v20 = v49; - spritePixelsP += _width * v23; - dest1P += _lineNbr2 * (uint16)clip_y; - v22 = v58 - (uint16)clip_y; - } - if (v22 > (uint16)clip_y1) - v22 = (uint16)clip_y1; - if (clip_x) { - if ((uint16)clip_x >= v20) - return; - int v59 = v22; - int v50 = v20; - int v25 = (uint16)clip_x; - int v26 = 0; - while (zoomIn(v26 + 1, zoom2) < v25) - ; - int v27 = v26; - v22 = v59; - spritePixelsP += v27; - dest1P += (uint16)clip_x; - v20 = v50 - (uint16)clip_x; - } - if (v20 > (uint16)clip_x1) - v20 = (uint16)clip_x1; - - int v60; - do { - for (;;) { - v60 = v22; - byte *v51 = dest1P; - v45 = spritePixelsP; - int v28 = v20; - Agr_Flag_x = 0; - Agr_x = 0; - do { - for (;;) { - if (*spritePixelsP) - *dest1P = *spritePixelsP; - ++dest1P; - ++spritePixelsP; - if (!Agr_Flag_x) - Agr_x = zoom2 + Agr_x; - if ((uint16)Agr_x < 100) - break; - Agr_x = Agr_x - 100; - --spritePixelsP; - Agr_Flag_x = 1; - --v28; - if (!v28) - goto Aff_Zoom_Larg_Cont1; - } - Agr_Flag_x = 0; - --v28; - } while (v28); -Aff_Zoom_Larg_Cont1: - spritePixelsP = _width + v45; - dest1P = _lineNbr2 + v51; - if (!Agr_Flag_y) - Agr_y = zoom2 + Agr_y; - if ((uint16)Agr_y < 100) - break; - Agr_y = Agr_y - 100; - spritePixelsP = v45; - Agr_Flag_y = 1; - v22 = v60 - 1; - if (v60 == 1) - return; - } - Agr_Flag_y = 0; - v22 = v60 - 1; - } while (v60 != 1); + spritePixelsP = _width + v46; + v29 = _lineNbr2 + v53; + ++Compteur_y; + if (!Agr_Flag_y) + Agr_y = zoom2 + Agr_y; + if ((uint16)Agr_y < 100) + break; + Agr_y = Agr_y - 100; + spritePixelsP = v46; + Agr_Flag_y = 1; + v22 = v63 - 1; + if (v63 == 1) + return; + } + Agr_Flag_y = 0; + v22 = v63 - 1; + } while (v63 != 1); + } else { + if (clip_y) { + if ((uint16)clip_y >= v22) + return; + int v58 = v22; + int v49 = v20; + int v23 = 0; + int v24 = (uint16)clip_y; + while (zoomIn(v23 + 1, zoom2) < v24) + ; + v20 = v49; + spritePixelsP += _width * v23; + dest1P += _lineNbr2 * (uint16)clip_y; + v22 = v58 - (uint16)clip_y; + } + if (v22 > (uint16)clip_y1) + v22 = (uint16)clip_y1; + if (clip_x) { + if ((uint16)clip_x >= v20) + return; + int v26 = 0; + while (zoomIn(v26 + 1, zoom2) < (uint16)clip_x) + ; + spritePixelsP += v26; + dest1P += (uint16)clip_x; + v20 = v20 - (uint16)clip_x; + } + if (v20 > (uint16)clip_x1) + v20 = (uint16)clip_x1; + + int v60; + do { + for (;;) { + v60 = v22; + byte *v51 = dest1P; + v45 = spritePixelsP; + int v28 = v20; + Agr_Flag_x = 0; + Agr_x = 0; + do { + for (;;) { + if (*spritePixelsP) + *dest1P = *spritePixelsP; + ++dest1P; + ++spritePixelsP; + if (!Agr_Flag_x) + Agr_x = zoom2 + Agr_x; + if ((uint16)Agr_x < 100) + break; + Agr_x = Agr_x - 100; + --spritePixelsP; + Agr_Flag_x = 1; + --v28; + if (!v28) + goto Aff_Zoom_Larg_Cont1; } - } else if (zoom1) { - Compteur_y = 0; + Agr_Flag_x = 0; + --v28; + } while (v28); +Aff_Zoom_Larg_Cont1: + spritePixelsP = _width + v45; + dest1P = _lineNbr2 + v51; + if (!Agr_Flag_y) + Agr_y = zoom2 + Agr_y; + if ((uint16)Agr_y < 100) + break; + Agr_y = Agr_y - 100; + spritePixelsP = v45; + Agr_Flag_y = 1; + v22 = v60 - 1; + if (v60 == 1) + return; + } + Agr_Flag_y = 0; + v22 = v60 - 1; + } while (v60 != 1); + } + } else if (zoom1) { + Compteur_y = 0; + Red_x = 0; + Red_y = 0; + _width = spriteWidth; + Red = zoom1; + if (zoom1 < 100) { + int v37 = zoomOut(spriteWidth, Red); + if (modeFlag) { + v40 = v37 + dest1P; + do { + int v65 = spriteHeight2; + byte *v55 = v40; + Red_y = Red + Red_y; + if ((uint16)Red_y < 100) { Red_x = 0; - Red_y = 0; - _width = spriteWidth; - Red = zoom1; - if (zoom1 < 100) { - int v37 = zoomOut(spriteWidth, Red); - if (modeFlag) { - v40 = v37 + dest1P; - do { - int v65 = spriteHeight2; - byte *v55 = v40; - Red_y = Red + Red_y; - if ((uint16)Red_y < 100) { - Red_x = 0; - int v42 = v37; - for (int v41 = _width; v41; v41--) { - Red_x = Red + Red_x; - if ((uint16)Red_x < 100) { - if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) - *v40 = *spritePixelsP; - --v40; - ++spritePixelsP; - --v42; - } else { - Red_x = Red_x - 100; - ++spritePixelsP; - } - } - spriteHeight2 = v65; - v40 = _lineNbr2 + v55; - } else { - Red_y = Red_y - 100; - spritePixelsP += _width; - } - --spriteHeight2; - } while (spriteHeight2); + int v42 = v37; + for (int v41 = _width; v41; v41--) { + Red_x = Red + Red_x; + if ((uint16)Red_x < 100) { + if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) + *v40 = *spritePixelsP; + --v40; + ++spritePixelsP; + --v42; } else { - do { - int v64 = spriteHeight2; - byte *v54 = dest1P; - Red_y = Red + Red_y; - if ((uint16)Red_y < 100) { - Red_x = 0; - int v39 = 0; - for (int v38 = _width; v38; v38--) { - Red_x = Red + Red_x; - if ((uint16)Red_x < 100) { - if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) - *dest1P = *spritePixelsP; - ++dest1P; - ++spritePixelsP; - ++v39; - } else { - Red_x = Red_x - 100; - ++spritePixelsP; - } - } - spriteHeight2 = v64; - dest1P = _lineNbr2 + v54; - } else { - Red_y = Red_y - 100; - spritePixelsP += _width; - } - --spriteHeight2; - } while (spriteHeight2); + Red_x = Red_x - 100; + ++spritePixelsP; } } + spriteHeight2 = v65; + v40 = _lineNbr2 + v55; } else { - _width = spriteWidth; - Compteur_y = 0; - if (modeFlag) { - dest2P = spriteWidth + dest1P; - spec_largeur = spriteWidth; - if (clip_y) { - if ((uint16)clip_y >= (unsigned int)spriteHeight1) - return; - spritePixelsP += spriteWidth * (uint16)clip_y; - dest2P += _lineNbr2 * (uint16)clip_y; - spriteHeight1 -= (uint16)clip_y; - } - int xLeft = (uint16)clip_y1; - if (spriteHeight1 > clip_y1) - spriteHeight1 = clip_y1; - xLeft = clip_x; - if (clip_x) { - if (xLeft >= spriteWidth) - return; - spriteWidth -= xLeft; - } - if (spriteWidth > (uint16)clip_x1) { - int clippedWidth = spriteWidth - (uint16)clip_x1; - spritePixelsP += clippedWidth; - dest2P -= clippedWidth; - spriteWidth = (uint16)clip_x1; - } - int yCtr2; - do { - yCtr2 = spriteHeight1; - byte *destCopy2P = dest2P; - const byte *spritePixelsCopy2P = spritePixelsP; - for (int xCtr2 = spriteWidth; xCtr2; xCtr2--) { - if (*spritePixelsP) - *dest2P = *spritePixelsP; - ++spritePixelsP; - --dest2P; - } - spritePixelsP = spec_largeur + spritePixelsCopy2P; - dest2P = _lineNbr2 + destCopy2P; - spriteHeight1 = yCtr2 - 1; - } while (yCtr2 != 1); - } else { - spec_largeur = spriteWidth; - if (clip_y) { - if ((uint16)clip_y >= (unsigned int)spriteHeight1) - return; - spritePixelsP += spriteWidth * (uint16)clip_y; - dest1P += _lineNbr2 * (uint16)clip_y; - spriteHeight1 -= (uint16)clip_y; - } - if (spriteHeight1 > clip_y1) - spriteHeight1 = clip_y1; - if (clip_x) { - if ((uint16)clip_x >= spriteWidth) - return; - spritePixelsP += (uint16)clip_x; - dest1P += (uint16)clip_x; - spriteWidth -= (uint16)clip_x; + Red_y = Red_y - 100; + spritePixelsP += _width; + } + --spriteHeight2; + } while (spriteHeight2); + } else { + do { + int v64 = spriteHeight2; + byte *v54 = dest1P; + Red_y = Red + Red_y; + if ((uint16)Red_y < 100) { + Red_x = 0; + int v39 = 0; + for (int v38 = _width; v38; v38--) { + Red_x = Red + Red_x; + if ((uint16)Red_x < 100) { + if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) + *dest1P = *spritePixelsP; + ++dest1P; + ++spritePixelsP; + ++v39; + } else { + Red_x = Red_x - 100; + ++spritePixelsP; } - if (spriteWidth > (uint16)clip_x1) - spriteWidth = (uint16)clip_x1; - int yCtr1; - do { - yCtr1 = spriteHeight1; - byte *dest1CopyP = dest1P; - const byte *spritePixelsCopyP = spritePixelsP; - for (int xCtr1 = spriteWidth; xCtr1; xCtr1--) { - if (*spritePixelsP) - *dest1P = *spritePixelsP; - ++dest1P; - ++spritePixelsP; - } - spritePixelsP = spec_largeur + spritePixelsCopyP; - dest1P = _lineNbr2 + dest1CopyP; - spriteHeight1 = yCtr1 - 1; - } while (yCtr1 != 1); } + spriteHeight2 = v64; + dest1P = _lineNbr2 + v54; + } else { + Red_y = Red_y - 100; + spritePixelsP += _width; } + --spriteHeight2; + } while (spriteHeight2); + } + } + } else { + _width = spriteWidth; + Compteur_y = 0; + if (modeFlag) { + dest2P = spriteWidth + dest1P; + spec_largeur = spriteWidth; + if (clip_y) { + if ((uint16)clip_y >= (unsigned int)spriteHeight1) + return; + spritePixelsP += spriteWidth * (uint16)clip_y; + dest2P += _lineNbr2 * (uint16)clip_y; + spriteHeight1 -= (uint16)clip_y; + } + int xLeft = (uint16)clip_y1; + if (spriteHeight1 > clip_y1) + spriteHeight1 = clip_y1; + xLeft = clip_x; + if (clip_x) { + if (xLeft >= spriteWidth) + return; + spriteWidth -= xLeft; + } + if (spriteWidth > (uint16)clip_x1) { + int clippedWidth = spriteWidth - (uint16)clip_x1; + spritePixelsP += clippedWidth; + dest2P -= clippedWidth; + spriteWidth = (uint16)clip_x1; + } + int yCtr2; + do { + yCtr2 = spriteHeight1; + byte *destCopy2P = dest2P; + const byte *spritePixelsCopy2P = spritePixelsP; + for (int xCtr2 = spriteWidth; xCtr2; xCtr2--) { + if (*spritePixelsP) + *dest2P = *spritePixelsP; + ++spritePixelsP; + --dest2P; } + spritePixelsP = spec_largeur + spritePixelsCopy2P; + dest2P = _lineNbr2 + destCopy2P; + spriteHeight1 = yCtr2 - 1; + } while (yCtr2 != 1); + } else { + spec_largeur = spriteWidth; + if (clip_y) { + if ((uint16)clip_y >= (unsigned int)spriteHeight1) + return; + spritePixelsP += spriteWidth * (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)clip_y; + spriteHeight1 -= (uint16)clip_y; + } + if (spriteHeight1 > clip_y1) + spriteHeight1 = clip_y1; + if (clip_x) { + if ((uint16)clip_x >= spriteWidth) + return; + spritePixelsP += (uint16)clip_x; + dest1P += (uint16)clip_x; + spriteWidth -= (uint16)clip_x; } + if (spriteWidth > (uint16)clip_x1) + spriteWidth = (uint16)clip_x1; + int yCtr1; + do { + yCtr1 = spriteHeight1; + byte *dest1CopyP = dest1P; + const byte *spritePixelsCopyP = spritePixelsP; + for (int xCtr1 = spriteWidth; xCtr1; xCtr1--) { + if (*spritePixelsP) + *dest1P = *spritePixelsP; + ++dest1P; + ++spritePixelsP; + } + spritePixelsP = spec_largeur + spritePixelsCopyP; + dest1P = _lineNbr2 + dest1CopyP; + spriteHeight1 = yCtr1 - 1; + } while (yCtr1 != 1); } } } -// Display Speed +/** + * Fast Display + */ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex) { - int width, height; + int width = _vm->_objectsManager.getWidth(spriteData, spriteIndex); + int height = _vm->_objectsManager.getHeight(spriteData, spriteIndex); - width = _vm->_objectsManager.getWidth(spriteData, spriteIndex); - height = _vm->_objectsManager.getHeight(spriteData, spriteIndex); if (*spriteData == 78) { Affiche_Perfect(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); Affiche_Perfect(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); @@ -1883,7 +1872,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (ptr == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); - ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (!mode) { filename = file + ".spr"; @@ -1895,7 +1884,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } } if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { @@ -1930,7 +1919,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_globals.COUCOU = dataP; if (g_PTRNUL == dataP) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); - dataP = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + dataP = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.COUCOU = dataP; } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 30d7f502dd..9c80f56f3f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -180,7 +180,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.FADE_OUTW(); _globals.iRegul = 1; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -489,7 +489,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -854,7 +854,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.FADE_INW(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 1996); @@ -1237,7 +1237,7 @@ bool HopkinsEngine::runOS2Full() { _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); @@ -1698,7 +1698,7 @@ bool HopkinsEngine::runOS2Full() { _globals._exitId = handleBaseMap(); // _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; break; @@ -1741,7 +1741,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.FADE_OUTW(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 1996); @@ -2127,7 +2127,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } @@ -2589,7 +2589,7 @@ bool HopkinsEngine::runBeOSFull() { _globals._exitId = handleBaseMap(); _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; break; @@ -2627,7 +2627,7 @@ bool HopkinsEngine::runWin95full() { _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -3014,7 +3014,7 @@ bool HopkinsEngine::runWin95full() { _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); @@ -3463,7 +3463,7 @@ bool HopkinsEngine::runWin95full() { _soundManager.WSOUND_OFF(); warning("TODO: heapshrink();"); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; @@ -3505,7 +3505,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -3891,7 +3891,7 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals.NFICHIER); + _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); @@ -4352,7 +4352,7 @@ bool HopkinsEngine::runLinuxFull() { _globals._exitId = handleBaseMap(); _soundManager.WSOUND_OFF(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; @@ -4407,31 +4407,31 @@ void HopkinsEngine::initializeSystem() { _eventsManager._mouseSizeX = 34; _eventsManager._mouseSizeY = 20; } - _eventsManager._mouseCursor = _fileManager.loadFile(_globals.NFICHIER); + _eventsManager._mouseCursor = _fileManager.loadFile(_globals._curFilename); _globals.clearAll(); _fileManager.constructFilename(_globals.HOPSYSTEM, "FONTE3.SPR"); - _globals.police = _fileManager.loadFile(_globals.NFICHIER); + _globals.police = _fileManager.loadFile(_globals._curFilename); _globals.police_l = 12; _globals.police_h = 21; _fileManager.constructFilename(_globals.HOPSYSTEM, "ICONE.SPR"); - _globals.ICONE = _fileManager.loadFile(_globals.NFICHIER); + _globals.ICONE = _fileManager.loadFile(_globals._curFilename); _fileManager.constructFilename(_globals.HOPSYSTEM, "TETE.SPR"); - _globals.TETE = _fileManager.loadFile(_globals.NFICHIER); + _globals.TETE = _fileManager.loadFile(_globals._curFilename); switch (_globals._language) { case LANG_EN: _fileManager.constructFilename(_globals.HOPLINK, "ZONEAN.TXT"); - _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); + _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); break; case LANG_FR: _fileManager.constructFilename(_globals.HOPLINK, "ZONE01.TXT"); - _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); + _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); break; case LANG_SP: _fileManager.constructFilename(_globals.HOPLINK, "ZONEES.TXT"); - _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); + _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); break; } @@ -5114,7 +5114,7 @@ void HopkinsEngine::playEnding() { _globals._exitId = 300; } _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; } @@ -5306,7 +5306,7 @@ void HopkinsEngine::loadCredits() { break; } - byte *bufPtr = _fileManager.loadFile(_globals.NFICHIER); + byte *bufPtr = _fileManager.loadFile(_globals._curFilename); byte *curPtr = bufPtr; int idxLines = 0; bool loopCond = false; @@ -5660,7 +5660,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._disableInventFl = true; _soundManager.WSOUND(soundId); _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); if (backgroundFilename.size()) _graphicsManager.loadImage(backgroundFilename); @@ -5747,7 +5747,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals.AFFLI = false; _objectsManager.CLEAR_ECRAN(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals.NFICHIER); + _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; } diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index aaf7f8be5a..9c9e66d5a2 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -93,7 +93,7 @@ int MenuManager::menu() { else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); - spriteData = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + spriteData = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_eventsManager.mouseOn(); _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager._mouseCursorId = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5ea08150ed..c3d564600d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -122,7 +122,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OBJET1.SPR"); - _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite(_vm->_globals.NFICHIER); + _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite(_vm->_globals._curFilename); } _vm->_globals.NUM_FICHIER_OBJ = val1; } @@ -2252,7 +2252,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_linesManager.TOTAL_LIGNES = 0; DERLIGNE = 0; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); - ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v4 = 0; v5 = 0; do { @@ -2311,10 +2311,10 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); Common::File f; - if (!f.exists(_vm->_globals.NFICHIER)) - error("File not found : %s", _vm->_globals.NFICHIER.c_str()); + if (!f.exists(_vm->_globals._curFilename)) + error("File not found : %s", _vm->_globals._curFilename.c_str()); - ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v4 = 0; v18 = 0; v17 = 0; @@ -2460,7 +2460,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.loadCache("PLAN.CA2"); loadZone("PLAN.ZO2"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "VOITURE.SPR"); - _spritePtr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _spritePtr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN"); @@ -2935,7 +2935,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); @@ -2961,7 +2961,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 2; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); SPRITE_ON(0); @@ -3957,7 +3957,7 @@ void ObjectsManager::OPTI_OBJET() { data = _vm->_fileManager.searchCat(file, 1); if (data == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); - data = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + data = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if ((data == g_PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { @@ -4172,7 +4172,7 @@ void ObjectsManager::ACTION_DOS(int idx) { _vm->_globals.GESTE_FLAG = 1; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "DOS.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4207,7 +4207,7 @@ void ObjectsManager::ACTION_DROITE(int idx) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); @@ -4236,7 +4236,7 @@ void ObjectsManager::Q_DROITE(int idx) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4265,7 +4265,7 @@ void ObjectsManager::ACTION_FACE(int idx) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FACE.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4282,7 +4282,7 @@ void ObjectsManager::Q_GAUCHE(int idx) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); @@ -4311,7 +4311,7 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 1); @@ -4466,8 +4466,8 @@ void ObjectsManager::INILINK(const Common::String &file) { if (ptr == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); - if (!f.open(_vm->_globals.NFICHIER)) - error("Error opening file - %s", _vm->_globals.NFICHIER.c_str()); + if (!f.open(_vm->_globals._curFilename)) + error("Error opening file - %s", _vm->_globals._curFilename.c_str()); nbytes = f.size(); ptr = _vm->_globals.allocMemory(nbytes); @@ -4492,7 +4492,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); } - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v36 = 60; v37 = ptr + 1000; for (int v40 = 0; v40 <= 21; v40++) { @@ -5367,20 +5367,20 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (_vm->_globals.PERSO_TYPE) { if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; } } if (!_vm->_globals.PERSO_TYPE) { if (_vm->_globals._saveData->data[svField122] == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 1; } } if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->data[svField356] == 1) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 2; } _vm->_globals.HOPKINS_DATA(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 4d98cfbcca..ae2dea2c25 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -921,7 +921,7 @@ LABEL_1141: case 56: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 1; _vm->_globals._saveData->data[svField122] = 1; _vm->_globals.HOPKINS_DATA(); @@ -932,7 +932,7 @@ LABEL_1141: case 57: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); + _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; _vm->_globals._saveData->data[svField122] = 0; _vm->_globals.HOPKINS_DATA(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index f09c89252a..eda7ea0b88 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -390,7 +390,7 @@ void SoundManager::PLAY_MOD(const Common::String &file) { MOD_FLAG = false; } - loadMusic(_vm->_globals.NFICHIER); + loadMusic(_vm->_globals._curFilename); playMusic(); MOD_FLAG = true; } @@ -652,9 +652,9 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { catLen = _vm->_globals._catalogSize; } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".WAV"); - if (!f.exists(_vm->_globals.NFICHIER)) { + if (!f.exists(_vm->_globals._curFilename)) { _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".APC"); - if (!f.exists(_vm->_globals.NFICHIER)) + if (!f.exists(_vm->_globals._curFilename)) return false; } @@ -733,7 +733,7 @@ void SoundManager::MODSetMusicVolume(int volume) { void SoundManager::loadSample(int wavIndex, const Common::String &file) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); - LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 0); + LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals._curFilename, 0); SOUND[wavIndex]._active = true; } @@ -807,8 +807,8 @@ void SoundManager::stopVoice(int voiceIndex) { } void SoundManager::SDL_LVOICE(size_t filePosition, size_t entryLength) { - if (!SDL_LoadVoice(_vm->_globals.NFICHIER, filePosition, entryLength, Swav[20])) - error("Couldn't load the sample %s", _vm->_globals.NFICHIER.c_str()); + if (!SDL_LoadVoice(_vm->_globals._curFilename, filePosition, entryLength, Swav[20])) + error("Couldn't load the sample %s", _vm->_globals._curFilename.c_str()); Swav[20]._active = true; } @@ -865,7 +865,7 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); - LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals.NFICHIER, 1); + LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals._curFilename, 1); } void SoundManager::PLAY_NWAV(int wavIndex) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 4bdc0d567d..9a28adbd8f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -69,8 +69,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); } _vm->_globals._saveData->data[svField4] = 0; getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); @@ -91,13 +91,13 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } else { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); } - _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; @@ -178,8 +178,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); - _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); } _vm->_globals._saveData->data[svField4] = 0; @@ -597,7 +597,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); // Build up the filename - filename = dest = _vm->_globals.NFICHIER; + filename = dest = _vm->_globals._curFilename; while (filename.lastChar() != '.') filename.deleteLastChar(); filename += "IND"; @@ -1119,8 +1119,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, a2); - _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); - _characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER); + _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); } getStringFromBuffer(40, v23, (const char *)_characterBuffer); getStringFromBuffer(0, v22, (const char *)_characterBuffer); @@ -1136,13 +1136,13 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { else _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); - _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); + _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals.NFICHIER, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager.ofscroll = 0; -- cgit v1.2.3 From 0adb2a31da83003038531b2a7b14448af7736fc5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Dec 2012 08:51:25 +0100 Subject: HOPKINS: More renaming and refactoring --- engines/hopkins/anim.cpp | 59 ++++++++++++------------------- engines/hopkins/computer.cpp | 84 +++++++++++++++++++++++--------------------- engines/hopkins/computer.h | 2 +- 3 files changed, 67 insertions(+), 78 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index af3ee8aa05..e0e64b4b72 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -276,7 +276,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint ptr = _vm->_globals.allocMemory(307200); memcpy(ptr, v12, 307200); } - if (_vm->_animationManager.NO_SEQ) { + if (NO_SEQ) { if (v8 == 1) memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); @@ -708,11 +708,8 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { * Search Animation */ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { - int v3; - const byte *v5; int v6; int v7; - int v8; byte *v9; int v10; int v11; @@ -720,58 +717,49 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { int v13; int v15; int v16; - int v17; - int v19; - int v20; int v21; int v22; const byte *v23; int v; v21 = 0; - v3 = 0; - v19 = animIndex; + bool loopCond = false; do { - v20 = *(v21 + data); - if (v20 == 'A' && *(data + v21 + 1) == 'N' && *(data + v21 + 2) == 'I' && *(data + v21 + 3) == 'M') { - int entryIndex = *(data + v21 + 4); + if (data[v21] == 'A' && data[v21 + 1] == 'N' && data[v21 + 2] == 'I' && data[v21 + 3] == 'M') { + int entryIndex = data[v21 + 4]; if (animIndex == entryIndex) { - v5 = v21 + data + 5; v6 = v21 + 5; v7 = 0; - v8 = 0; + bool innerLoopCond = false; do { - if (*v5 == 'A' && *(v5 + 1) == 'N' && *(v5 + 2) == 'I' && *(v5 + 3) == 'M') - v8 = 1; - if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') - v8 = 1; + if ((data[v6] == 'A' && data[v6 + 1] == 'N' && data[v6 + 2] == 'I' && data[v6 + 3] == 'M') || + (data[v6] == 'F' && data[v6 + 1] == 'I' && data[v6 + 2] == 'N')) + innerLoopCond = true; if (count < v6) { _vm->_globals.Bqe_Anim[animIndex].field4 = 0; - _vm->_globals.Bqe_Anim[v19]._data = g_PTRNUL; + _vm->_globals.Bqe_Anim[animIndex]._data = g_PTRNUL; return; } ++v6; ++v7; - ++v5; - } while (v8 != 1); - _vm->_globals.Bqe_Anim[v19]._data = _vm->_globals.allocMemory(v7 + 50); + } while (!innerLoopCond); + _vm->_globals.Bqe_Anim[animIndex]._data = _vm->_globals.allocMemory(v7 + 50); _vm->_globals.Bqe_Anim[animIndex].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[v19]._data, v21 + data + 5, 20); + memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, v21 + data + 5, 20); - byte *dataP = _vm->_globals.Bqe_Anim[v19]._data; + byte *dataP = _vm->_globals.Bqe_Anim[animIndex]._data; v9 = dataP + 20; v23 = v21 + data + 25; v10 = READ_LE_UINT16(v21 + data + 25); v11 = READ_LE_UINT16(v21 + data + 27); v22 = READ_LE_UINT16(v21 + data + 29); v12 = READ_LE_UINT16(v21 + data + 31); - v13 = *(v21 + data + 33); - *(dataP + 29) = *(v21 + data + 34); WRITE_LE_UINT16(dataP + 20, v10); WRITE_LE_UINT16(dataP + 22, v11); WRITE_LE_UINT16(dataP + 24, v22); WRITE_LE_UINT16(dataP + 26, v12); - *(dataP + 28) = v13; + *(dataP + 28) = *(v21 + data + 33); + *(dataP + 29) = *(v21 + data + 34); for (int v14 = 1; v14 <= 4999; v14++) { v9 += 10; @@ -783,21 +771,20 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { v15 = READ_LE_UINT16(v23 + 2); v22 = READ_LE_UINT16(v23 + 4); v16 = READ_LE_UINT16(v23 + 6); - v17 = *(v23 + 8); - *(v9 + 9) = *(v23 + 9); WRITE_LE_UINT16(v9, v); WRITE_LE_UINT16(v9 + 2, v15); WRITE_LE_UINT16(v9 + 4, v22); WRITE_LE_UINT16(v9 + 6, v16); - *(v9 + 8) = v17; + *(v9 + 8) = *(v23 + 8); + *(v9 + 9) = *(v23 + 9); } - v3 = 1; + loopCond = true; } } - if (v20 == 'F' && *(data + v21 + 1) == 'I' && *(data + v21 + 2) == 'N') - v3 = 1; + if (data[v21] == 'F' && data[v21 + 1] == 'I' && data[v21 + 2] == 'N') + loopCond = true; ++v21; - } while (v21 <= count && v3 != 1); + } while (v21 <= count && !loopCond); } /** @@ -846,7 +833,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui ptr = _vm->_globals.allocMemory(307200); memcpy(ptr, v9, 307200); } - if (_vm->_animationManager.NO_SEQ) { + if (NO_SEQ) { if (v7) memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); if (!_vm->getIsDemo()) { @@ -1009,7 +996,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u ptr = _vm->_globals.allocMemory(307200); memcpy((void *)ptr, v10, 307200); } - if (_vm->_animationManager.NO_SEQ) { + if (NO_SEQ) { if (v7 == 1) { assert(ptr != NULL); memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 307200); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 0079d7f234..7513902fd3 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -49,7 +49,7 @@ ComputerManager::ComputerManager() { _ballRightFl = false; _ballUpFl = false; _breakoutLevelNbr = 0; - RAQX = 0; + _padPositionX = 0; CASSEP1 = 0; CASSEP2 = 0; CASSDER = 0; @@ -683,7 +683,7 @@ void ComputerManager::newLevel() { _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); _ballPosition = Common::Point(164, 187); - RAQX = 150; + _padPositionX = 150; _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.SPRITE_ON(1); _vm->_eventsManager.mouseOn(); @@ -772,7 +772,7 @@ void ComputerManager::playBreakout() { while (!_vm->shouldQuit()) { // Set up the racket and ball _vm->_eventsManager.mouseOff(); - _ballPosition = Common::Point(RAQX + 14, 187); + _ballPosition = Common::Point(_padPositionX + 14, 187); _vm->_objectsManager.setSpriteY(1, 187); _vm->_objectsManager.setSpriteX(1, _ballPosition.x); _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -781,32 +781,32 @@ void ComputerManager::playBreakout() { // Wait for mouse press to start playing do { - RAQX = _vm->_eventsManager.getMouseX(); + _padPositionX = _vm->_eventsManager.getMouseX(); if (_vm->_eventsManager._mousePos.x <= 4) - RAQX = 5; - if (RAQX > 282) - RAQX = 282; - _vm->_objectsManager.setSpriteX(0, RAQX); - _vm->_objectsManager.setSpriteX(1, RAQX + 14); + _padPositionX = 5; + if (_padPositionX > 282) + _padPositionX = 282; + _vm->_objectsManager.setSpriteX(0, _padPositionX); + _vm->_objectsManager.setSpriteX(1, _padPositionX + 14); _vm->_objectsManager.setSpriteY(1, 187); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && _vm->_eventsManager.getMouseButton() != 1); _breakoutSpeed = 1; - _ballPosition = Common::Point(RAQX + 14, 187); - _ballRightFl = (RAQX > 135); + _ballPosition = Common::Point(_padPositionX + 14, 187); + _ballRightFl = (_padPositionX > 135); _ballUpFl = false; // Play loop do { _vm->_soundManager.checkSounds(); - RAQX = _vm->_eventsManager.getMouseX(); + _padPositionX = _vm->_eventsManager.getMouseX(); if (_vm->_eventsManager._mousePos.x <= 4) - RAQX = 5; - if (RAQX > 282) - RAQX = 282; - _vm->_objectsManager.setSpriteX(0, RAQX); + _padPositionX = 5; + if (_padPositionX > 282) + _padPositionX = 282; + _vm->_objectsManager.setSpriteX(0, _padPositionX); v1 = moveBall(); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && !v1); @@ -1107,28 +1107,30 @@ void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) * Handle ball moves */ int ComputerManager::moveBall() { - int16 v1; - int16 v4 = 0; + int16 retVal = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; // TODO: Figure out random number - int v0 = _vm->getRandomNumber(6); - if (_breakoutSpeed == 1) { + int randVal = _vm->getRandomNumber(6); + switch (_breakoutSpeed) { + case 1: CASSEP1 = 1; CASSEP2 = 1; - } - if (_breakoutSpeed == 2) { + break; + case 2: CASSEP1 = 1; CASSEP2 = 2; - } - if (_breakoutSpeed == 3) { + break; + case 3: CASSEP1 = 2; CASSEP2 = 2; - } - if (_breakoutSpeed == 4) { + break; + case 4: CASSEP1 = 3; CASSEP2 = 2; + break; } - v1 = CASSEP1; + + int v1 = CASSEP1; if (CASSDER == CASSEP1) v1 = CASSEP2; @@ -1145,50 +1147,50 @@ int ComputerManager::moveBall() { CASSDER = v1; if (_ballPosition.x <= 6) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - _ballPosition.x = v0 + 6; + _ballPosition.x = randVal + 6; _ballRightFl = !_ballRightFl; } if (_ballPosition.x > 307) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - _ballPosition.x = 307 - v0; + _ballPosition.x = 307 - randVal; _ballRightFl = !_ballRightFl; } if (_ballPosition.y <= 6) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - _ballPosition.y = v0 + 7; + _ballPosition.y = randVal + 7; _ballUpFl = !_ballUpFl; } if ((uint16)(_ballPosition.y - 186) <= 8u) { _vm->_soundManager.PLAY_SAMPLE(2, 6); - if (_ballPosition.x > RAQX - 2) { + if (_ballPosition.x > _padPositionX - 2) { int v2 = _ballPosition.x + 6; - if (v2 < RAQX + 36) { + if (v2 < _padPositionX + 36) { _ballUpFl = false; - if (v2 <= RAQX + 15) { + if (v2 <= _padPositionX + 15) { _ballRightFl = false; - if (_ballPosition.x >= RAQX && v2 <= RAQX + 5) + if (_ballPosition.x >= _padPositionX && v2 <= _padPositionX + 5) _ballPosition.x -= 4; - if (_ballPosition.x >= RAQX + 5 && _ballPosition.x + 6 <= RAQX + 10) + if (_ballPosition.x >= _padPositionX + 5 && _ballPosition.x + 6 <= _padPositionX + 10) _ballPosition.x -= 2; } - if (_ballPosition.x >= RAQX + 19 && _ballPosition.x + 6 <= RAQX + 36) { + if (_ballPosition.x >= _padPositionX + 19 && _ballPosition.x + 6 <= _padPositionX + 36) { _ballRightFl = true; - if (_ballPosition.x >= RAQX + 29) + if (_ballPosition.x >= _padPositionX + 29) _ballPosition.x += 4; - if (_ballPosition.x >= RAQX + 24 && _ballPosition.x + 6 <= RAQX + 29) + if (_ballPosition.x >= _padPositionX + 24 && _ballPosition.x + 6 <= _padPositionX + 29) _ballPosition.x += 2; } } } } if (_ballPosition.y > 194) - v4 = 1; + retVal = 1; checkBallCollisions(); _vm->_objectsManager.setSpriteX(1, _ballPosition.x); _vm->_objectsManager.setSpriteY(1, _ballPosition.y); if (!_breakoutBrickNbr) - v4 = 2; - return v4; + retVal = 2; + return retVal; } /** diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index dfa7529633..6bad921451 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -62,7 +62,7 @@ private: bool _ballRightFl; bool _ballUpFl; int _breakoutLevelNbr; - int RAQX; + int _padPositionX; int _breakoutHiscore; int CASSEP1; int CASSEP2; -- cgit v1.2.3 From b284338d6778775ab755af487dfd52d05b953e45 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Dec 2012 14:20:34 +0100 Subject: HOPKINS: Some refactoring in ObjectManager, some renaming --- engines/hopkins/anim.cpp | 6 +- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 10 +- engines/hopkins/graphics.cpp | 10 +- engines/hopkins/objects.cpp | 227 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 8 +- engines/hopkins/talk.cpp | 72 +++++++------- engines/hopkins/talk.h | 2 +- 8 files changed, 164 insertions(+), 175 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index e0e64b4b72..c2027a777d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -603,7 +603,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { void AnimationManager::clearAnim() { for (int idx = 0; idx < 35; ++idx) { _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx]._data); - _vm->_globals.Bqe_Anim[idx].field4 = 0; + _vm->_globals.Bqe_Anim[idx]._enabledFl = false; } for (int idx = 0; idx < 8; ++idx) { @@ -736,7 +736,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { (data[v6] == 'F' && data[v6 + 1] == 'I' && data[v6 + 2] == 'N')) innerLoopCond = true; if (count < v6) { - _vm->_globals.Bqe_Anim[animIndex].field4 = 0; + _vm->_globals.Bqe_Anim[animIndex]._enabledFl = false; _vm->_globals.Bqe_Anim[animIndex]._data = g_PTRNUL; return; } @@ -744,7 +744,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { ++v7; } while (!innerLoopCond); _vm->_globals.Bqe_Anim[animIndex]._data = _vm->_globals.allocMemory(v7 + 50); - _vm->_globals.Bqe_Anim[animIndex].field4 = 1; + _vm->_globals.Bqe_Anim[animIndex]._enabledFl = true; memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, v21 + data + 5, 20); byte *dataP = _vm->_globals.Bqe_Anim[animIndex]._data; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 99eaadee28..c97277ce61 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -83,7 +83,7 @@ Globals::Globals() { for (int i = 0; i < 35; ++i) Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(Liste2Item), 0); for (int i = 0; i < 30; ++i) - Common::fill((byte *)&BL_ANIM[i], (byte *)&BL_ANIM[i] + sizeof(BlAnimItem), 0); + Common::fill((byte *)&_lockedAnims[i], (byte *)&_lockedAnims[i] + sizeof(LockAnimItem), 0); for (int i = 0; i < 30; ++i) Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0); for (int i = 0; i < 300; ++i) @@ -433,7 +433,7 @@ void Globals::HOPKINS_DATA() { void Globals::INIT_ANIM() { for (int idx = 0; idx < 35; ++idx) { Bqe_Anim[idx]._data = g_PTRNUL; - Bqe_Anim[idx].field4 = 0; + Bqe_Anim[idx]._enabledFl = false; } for (int idx = 0; idx < 8; ++idx) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c524cf616f..1a613b8958 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -61,7 +61,7 @@ struct CarreZoneItem { struct BqeAnimItem { byte *_data; - int field4; + bool _enabledFl; }; struct BankItem { @@ -121,9 +121,9 @@ struct BobItem { int field4A; }; -struct BlAnimItem { - uint32 v1; - uint32 v2; +struct LockAnimItem { + bool _enableFl; + int _posX; }; struct VBobItem { @@ -314,7 +314,7 @@ public: BobItem _bob[36]; ListeItem Liste[6]; Liste2Item Liste2[35]; - BlAnimItem BL_ANIM[30]; + LockAnimItem _lockedAnims[30]; VBobItem VBob[30]; ObjetWItem ObjetW[300]; BlocItem BLOC[250]; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0facdf85d4..455c3c41b9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1107,7 +1107,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, void GraphicsManager::FIN_VISU() { for (int idx = 1; idx <= 20; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_OFF(idx); } @@ -1115,22 +1115,22 @@ void GraphicsManager::FIN_VISU() { _vm->_eventsManager.VBL(); for (int idx = 1; idx <= 20; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_ZERO(idx); } for (int idx = 1; idx <= 29; ++idx) { - _vm->_globals.BL_ANIM[idx].v1 = 0; + _vm->_globals._lockedAnims[idx]._enableFl = false; } for (int idx = 1; idx <= 20; ++idx) { - _vm->_globals.Bqe_Anim[idx].field4 = 0; + _vm->_globals.Bqe_Anim[idx]._enabledFl = false; } } void GraphicsManager::VISU_ALL() { for (int idx = 1; idx <= 20; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_VISU(idx); } } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c3d564600d..690bfdc8eb 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1171,8 +1171,8 @@ void ObjectsManager::AFF_BOB_ANIM() { v20 = _vm->_globals._bob[idx]._animData + 20; v24 = _vm->_globals._bob[idx].field10; _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); - if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals._bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; + if (_vm->_globals._lockedAnims[idx]._enableFl) + _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if ( PERSO_ON && idx > 20 ) _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; @@ -1210,8 +1210,8 @@ LABEL_38: v21 = _vm->_globals._bob[idx]._animData + 20; _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); - if (_vm->_globals.BL_ANIM[idx].v1 == 1) - _vm->_globals._bob[idx]._xp = _vm->_globals.BL_ANIM[idx].v2; + if (_vm->_globals._lockedAnims[idx]._enableFl) + _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if (PERSO_ON && idx > 20) _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; @@ -4712,39 +4712,39 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { } } -void ObjectsManager::OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { - if (a1 != -1) - setBobAnimation(a1); - if (a2 != -1) - setBobAnimation(a2); - if (a3 != -1) - setBobAnimation(a3); +void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6, int a7) { + if (idx1 != -1) + setBobAnimation(idx1); + if (idx2 != -1) + setBobAnimation(idx2); + if (idx3 != -1) + setBobAnimation(idx3); if (!a7) { - if (a1 != -1) - SET_BOBPOSI(a1, a4); - if (a2 != -1) - SET_BOBPOSI(a2, a5); - if (a3 != -1) - SET_BOBPOSI(a3, a6); + if (idx1 != -1) + SET_BOBPOSI(idx1, a4); + if (idx2 != -1) + SET_BOBPOSI(idx2, a5); + if (idx3 != -1) + SET_BOBPOSI(idx3, a6); } } -void ObjectsManager::SCI_OPTI_ONE(int a1, int a2, int a3, int a4) { +void ObjectsManager::SCI_OPTI_ONE(int idx, int a2, int a3, int a4) { _vm->_eventsManager._curMouseButton = 0; _vm->_eventsManager._mouseButton = 0; if (a4 != 3) { - setBobAnimation(a1); - SET_BOBPOSI(a1, a2); + setBobAnimation(idx); + SET_BOBPOSI(idx, a2); } do { _vm->_eventsManager.VBL(); if (_vm->_eventsManager._curMouseButton) break; - } while (a3 != BOBPOSI(a1)); + } while (a3 != BOBPOSI(idx)); if (!a4) - stopBobAnimation(a1); + stopBobAnimation(idx); } void ObjectsManager::VERBE_OFF(int idx, int a2) { @@ -5121,107 +5121,102 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a } } -void ObjectsManager::TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6) { - signed int v6; - char v7; +void ObjectsManager::TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int a6) { + int v6 = screenId; + if (_vm->_globals._screenId != screenId) + return; - v6 = a1; - if (_vm->_globals._screenId == a1) { - if (a1 == 35) { - if (a6 > 2 || (v6 = 200, a6 > 2)) - v6 = 201; - } - if (_vm->_globals._screenId == 36) { - if (a6 > 2 || (v6 = 202, a6 > 2)) - v6 = 203; - } - if (_vm->_globals._screenId == 37) { - if (a6 > 2 || (v6 = 204, a6 > 2)) - v6 = 205; - } - if (_vm->_globals._screenId == 38) { - if (a6 > 2 || (v6 = 206, a6 > 2)) - v6 = 207; - } - if (_vm->_globals._screenId == 39) { - if (a6 > 2 || (v6 = 208, a6 > 2)) - v6 = 209; - } - if (_vm->_globals._screenId == 40) { - if (a6 > 2 || (v6 = 210, a6 > 2)) - v6 = 211; + switch (_vm->_globals._screenId) { + case 35: + if (a6 > 2) + v6 = 201; + else + v6 = 200; + break; + case 36: + if (a6 > 2) + v6 = 203; + else + v6 = 202; + break; + case 37: + if (a6 > 2) + v6 = 205; + else + v6 = 204; + break; + case 38: + if (a6 > 2) + v6 = 207; + else + v6 = 206; + break; + case 39: + if (a6 > 2) + v6 = 209; + else + v6 = 208; + break; + case 40: + if (a6 > 2) + v6 = 211; + else + v6 = 210; + break; + case 41: + if (a6 > 2) + v6 = 213; + else + v6 = 212; + break; + } + + if (_vm->_globals._saveData->data[v6] == 2) + return; + + if (_vm->_globals._saveData->data[v6]) { + if (_vm->_globals._saveData->data[v6] == 1) { + if ((a6 == 1 && BOBPOSI(1) == 26) || (a6 == 2 && BOBPOSI(2) == 26) || + (a6 == 3 && BOBPOSI(3) == 27) || (a6 == 4 && BOBPOSI(4) == 27)) { + _vm->_dialogsManager._removeInventFl = true; + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_globals._saveData->data[v6] = 4; + } } - if (_vm->_globals._screenId == 41) { - if (a6 > 2 || (v6 = 212, a6 > 2)) - v6 = 213; + if (_vm->_globals._saveData->data[v6] == 4) { + if ((a6 == 1 && BOBPOSI(1) > 30) || (a6 == 2 && BOBPOSI(2) > 30) || + (a6 == 3 && BOBPOSI(3) > 30) || (a6 == 4 && BOBPOSI(4) > 30)) + _vm->_globals._saveData->data[v6] = 3; } - v7 = _vm->_globals._saveData->data[v6]; - if (v7 != 2) { - if (v7) { - if (v7 == 1) { - if (a6 == 1 && BOBPOSI(1) == 26) { - _vm->_dialogsManager._removeInventFl = true; - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals._saveData->data[v6] = 4; - } - if (a6 == 2 && BOBPOSI(2) == 26) { - _vm->_dialogsManager._removeInventFl = true; - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals._saveData->data[v6] = 4; - } - if (a6 == 3 && BOBPOSI(3) == 27) { - _vm->_dialogsManager._removeInventFl = true; - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals._saveData->data[v6] = 4; - } - if (a6 == 4 && BOBPOSI(4) == 27) { - _vm->_dialogsManager._removeInventFl = true; - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_dialogsManager._removeInventFl = true; - _vm->_globals._saveData->data[v6] = 4; - } - } - if (_vm->_globals._saveData->data[v6] == 4) { - if (a6 == 1 && (signed int)BOBPOSI(1) > 30) - _vm->_globals._saveData->data[v6] = 3; - if (a6 == 2 && (signed int)BOBPOSI(2) > 30) - _vm->_globals._saveData->data[v6] = 3; - if (a6 == 3 && (signed int)BOBPOSI(3) > 30) - _vm->_globals._saveData->data[v6] = 3; - if (a6 == 4 && (signed int)BOBPOSI(4) > 30) - _vm->_globals._saveData->data[v6] = 3; - } - if (_vm->_globals._saveData->data[v6] == 3) { - _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); - _vm->_globals._exitId = 150; - _vm->_graphicsManager._noFadingFl = true; - BOB_OFF(1); - BOB_OFF(2); - BOB_OFF(3); - BOB_OFF(4); - } - } else if (a2 < getSpriteX(0) - && a3 > getSpriteX(0) - && a4 < getSpriteY(0) - && a5 > getSpriteY(0)) { - if (a6 == 1) - setBobAnimation(1); - if (a6 == 2) - setBobAnimation(2); - if (a6 == 3) - setBobAnimation(3); - if (a6 == 4) - setBobAnimation(4); - _vm->_globals._saveData->data[v6] = 1; - } + if (_vm->_globals._saveData->data[v6] == 3) { + _vm->_graphicsManager.FADE_LINUX = 2; + _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); + _vm->_globals._exitId = 150; + _vm->_graphicsManager._noFadingFl = true; + BOB_OFF(1); + BOB_OFF(2); + BOB_OFF(3); + BOB_OFF(4); } + } else if (minX < getSpriteX(0) + && maxX > getSpriteX(0) + && minY < getSpriteY(0) + && maxY > getSpriteY(0)) { + if (a6 == 1) + setBobAnimation(1); + else if (a6 == 2) + setBobAnimation(2); + else if (a6 == 3) + setBobAnimation(3); + else if (a6 == 4) + setBobAnimation(4); + _vm->_globals._saveData->data[v6] = 1; } } -void ObjectsManager::BLOQUE_ANIMX(int idx, int a2) { - _vm->_globals.BL_ANIM[idx].v1 = 1; - _vm->_globals.BL_ANIM[idx].v2 = a2; +void ObjectsManager::lockAnimX(int idx, int a2) { + _vm->_globals._lockedAnims[idx]._enableFl; + _vm->_globals._lockedAnims[idx]._posX = a2; } void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index e4081d7eac..98037067d9 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -227,8 +227,8 @@ public: void INILINK(const Common::String &file); void SPECIAL_INI(const Common::String &a1); - void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7); - void SCI_OPTI_ONE(int a1, int a2, int a3, int a4); + void OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6, int a7); + void SCI_OPTI_ONE(int idx, int a2, int a3, int a4); void VERBE_OFF(int idx, int a2); void VERBE_ON(int idx, int a2); int CALC_PROPRE(int idx); @@ -237,8 +237,8 @@ public: void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6); void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); - void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6); - void BLOQUE_ANIMX(int idx, int a2); + void TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int a6); + void lockAnimX(int idx, int a2); /** * Game scene control method diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 9a28adbd8f..f21abe03f8 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -542,26 +542,26 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) { void TalkManager::dialogWait() { for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) BOB_VISU_PARLE(idx); } } void TalkManager::dialogTalk() { for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_OFF(idx); } for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_ZERO(idx); } } void TalkManager::dialogEndTalk() { for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_OFF(idx); } @@ -569,7 +569,7 @@ void TalkManager::dialogEndTalk() { _vm->_eventsManager.VBL(); for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) _vm->_objectsManager.BOB_ZERO(idx); } } @@ -680,7 +680,7 @@ LABEL_33: void TalkManager::VISU_PARLE() { for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_globals.Bqe_Anim[idx].field4 == 1) + if (_vm->_globals.Bqe_Anim[idx]._enabledFl) BOB_VISU_PARLE(idx); } } @@ -792,11 +792,11 @@ void TalkManager::initCharacterAnim() { void TalkManager::clearCharacterAnim() { for (int idx = 21; idx <= 34; ++idx) { _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx]._data); - _vm->_globals.Bqe_Anim[idx].field4 = 0; + _vm->_globals.Bqe_Anim[idx]._enabledFl = false; } } -bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int a4) { +bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int a4) { bool result; const byte *v5; int v6; @@ -812,7 +812,6 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int int v16; char v17; int v18; - int v20; int v22; int v23; const byte *v24; @@ -820,32 +819,29 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int v22 = 0; result = false; - v20 = a1; do { - if (*(v22 + bufPerso) == 'A' && *(bufPerso + v22 + 1) == 'N' && *(bufPerso + v22 + 2) == 'I' && *(bufPerso + v22 + 3) == 'M' - && *(bufPerso + v22 + 4) == a3) { + if (bufPerso[v22] == 'A' && bufPerso[v22 + 1] == 'N' && bufPerso[v22 + 2] == 'I' && bufPerso[v22 + 3] == 'M' && bufPerso[v22 + 4] == a3) { v5 = v22 + bufPerso + 5; v18 = v22 + 5; v6 = 0; v7 = 0; do { - if (*v5 == 'A' && *(v5 + 1) == 'N' && *(v5 + 2) == 'I' && *(v5 + 3) == 'M') - v7 = 1; - if (*v5 == 'F' && *(v5 + 1) == 'I' && *(v5 + 2) == 'N') + if ((v5[0] == 'A' && v5[1] == 'N' && v5[2] == 'I' && v5[3] == 'M') || + (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N')) v7 = 1; if (v18 > a4) { - _vm->_globals.Bqe_Anim[a1].field4 = 0; - result = g_PTRNUL; - _vm->_globals.Bqe_Anim[v20]._data = g_PTRNUL; + _vm->_globals.Bqe_Anim[idx]._enabledFl = false; + result = false; + _vm->_globals.Bqe_Anim[idx]._data = g_PTRNUL; } ++v18; ++v6; ++v5; } while (v7 != 1); - _vm->_globals.Bqe_Anim[v20]._data = _vm->_globals.allocMemory(v6 + 50); - _vm->_globals.Bqe_Anim[a1].field4 = 1; - memcpy(_vm->_globals.Bqe_Anim[v20]._data, (const byte *)(v22 + bufPerso + 5), 20); - v8 = _vm->_globals.Bqe_Anim[v20]._data; + _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(v6 + 50); + _vm->_globals.Bqe_Anim[idx]._enabledFl = true; + memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(v22 + bufPerso + 5), 20); + v8 = _vm->_globals.Bqe_Anim[idx]._data; v9 = v8 + 20; v24 = v22 + bufPerso + 25; @@ -853,13 +849,12 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int v11 = (int16)READ_LE_UINT16(v22 + bufPerso + 27); v23 = (int16)READ_LE_UINT16(v22 + bufPerso + 29); v12 = (int16)READ_LE_UINT16(v22 + bufPerso + 31); - v13 = *(v22 + bufPerso + 33); - *(v8 + 29) = *(v22 + bufPerso + 34); + v8[28] = bufPerso[v22 + 33]; + v8[29] = bufPerso[v22 + 34]; WRITE_LE_UINT16(v8 + 20, v10); WRITE_LE_UINT16(v8 + 22, v11); WRITE_LE_UINT16(v8 + 24, v23); WRITE_LE_UINT16(v8 + 26, v12); - *(v8 + 28) = v13; for (int i = 1; i < 5000; i++) { v9 += 10; v24 += 10; @@ -869,20 +864,19 @@ bool TalkManager::searchCharacterAnim(int a1, const byte *bufPerso, int a3, int v15 = (int16)READ_LE_UINT16(v24 + 2); v23 = (int16)READ_LE_UINT16(v24 + 4); v16 = (int16)READ_LE_UINT16(v24 + 6); - v17 = *(v24 + 8); - *(v9 + 9) = *(v24 + 9); + v9[8] = v24[8]; + v9[9] = v24[9]; WRITE_LE_UINT16(v9, v14); WRITE_LE_UINT16(v9 + 2, v15); WRITE_LE_UINT16(v9 + 4, v23); WRITE_LE_UINT16(v9 + 6, v16); - *(v9 + 8) = v17; } - result = 1; + result = true; } - if (*(bufPerso + v22) == 'F' && *(bufPerso + v22 + 1) == 'I' && *(bufPerso + v22 + 2) == 'N') + if (bufPerso[v22] == 'F' && bufPerso[v22 + 1] == 'I' && bufPerso[v22 + 2] == 'N') result = true; ++v22; - } while (v22 <= a4 && result != 1); + } while (v22 <= a4 && !result); return result; } @@ -997,11 +991,11 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); if (a1 == 22) { - _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.getBobPosX(3)); - _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.getBobPosX(3)); + _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); + _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); } else { // a1 == 23 - _vm->_objectsManager.BLOQUE_ANIMX(6, _vm->_objectsManager.getBobPosX(4)); - _vm->_objectsManager.BLOQUE_ANIMX(8, _vm->_objectsManager.getBobPosX(4)); + _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(4)); + _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(4)); } _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.stopBobAnimation(4); @@ -1045,11 +1039,11 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); if (a1 == 20) { - _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.getBobPosX(1)); - _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.getBobPosX(1)); + _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); + _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); } else { // a1 == 21 - _vm->_objectsManager.BLOQUE_ANIMX(5, _vm->_objectsManager.getBobPosX(2)); - _vm->_objectsManager.BLOQUE_ANIMX(7, _vm->_objectsManager.getBobPosX(2)); + _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(2)); + _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(2)); } _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(2); diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 0cf3e07292..88fb11ed08 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -64,7 +64,7 @@ public: void startCharacterAnim0(int startIndedx, bool readOnlyFl); void initCharacterAnim(); void clearCharacterAnim(); - bool searchCharacterAnim(int a1, const byte *a2, int a3, int a4); + bool searchCharacterAnim(int idx, const byte *bufPerso, int a3, int a4); void REPONSE(int a1, int a2); void REPONSE2(int a1, int a2); void OBJET_VIVANT(const Common::String &a2); -- cgit v1.2.3 From f7b62d555782385f11a2367da4ba5192716668ad Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Dec 2012 19:58:37 +0100 Subject: HOPKINS: Refactor ObjectsManager --- engines/hopkins/anim.cpp | 1 - engines/hopkins/objects.cpp | 524 ++++++++++++++++++++++---------------------- engines/hopkins/objects.h | 8 +- engines/hopkins/script.cpp | 6 +- engines/hopkins/talk.cpp | 2 - 5 files changed, 263 insertions(+), 278 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index c2027a777d..58b22ec0ff 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -714,7 +714,6 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { int v10; int v11; int v12; - int v13; int v15; int v16; int v21; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 690bfdc8eb..5c6eb723f5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4443,8 +4443,6 @@ void ObjectsManager::INILINK(const Common::String &file) { byte *v22; int16 v27; int16 v28; - int v29; - int v30; int v31; int v32; int v33; @@ -4529,9 +4527,9 @@ void ObjectsManager::INILINK(const Common::String &file) { } _vm->_linesManager.RESET_OBSTACLE(); - for (size_t v41 = 0; v41 < nbytes; v41++) { - if (*(ptr + v41) == 'O' && *(ptr + v41 + 1) == 'B' && *(ptr + v41 + 2) == '2') { - v16 = ptr + v41 + 4; + for (size_t idx = 0; idx < nbytes; idx++) { + if (ptr[idx] == 'O' && ptr[idx + 1] == 'B' && ptr[idx + 2] == '2') { + v16 = ptr + idx + 4; v32 = 0; v34 = 0; _vm->_linesManager.TOTAL_LIGNES = 0; @@ -4556,26 +4554,26 @@ void ObjectsManager::INILINK(const Common::String &file) { } if (!OBSSEUL) { - for (size_t v42 = 0; v42 < nbytes; v42++) { - if (*(ptr + v42) == 'Z' && *(ptr + v42 + 1) == 'O' && *(ptr + v42 + 2) == '2') { - v17 = ptr + v42 + 4; + for (size_t idx = 0; idx < nbytes; idx++) { + if (ptr[idx] == 'Z' && ptr[idx + 1] == 'O' && ptr[idx + 2] == '2') { + v17 = &ptr[idx + 4]; v33 = 0; v35 = 0; - for (int v18 = 1; v18 <= 100; v18++) { - _vm->_globals.ZONEP[v18]._destX = 0; - _vm->_globals.ZONEP[v18]._destY = 0; - _vm->_globals.ZONEP[v18].field4 = 0; - _vm->_globals.ZONEP[v18].field6 = 0; - _vm->_globals.ZONEP[v18].field7 = 0; - _vm->_globals.ZONEP[v18].field8 = 0; - _vm->_globals.ZONEP[v18].field9 = 0; - _vm->_globals.ZONEP[v18].fieldA = 0; - _vm->_globals.ZONEP[v18].fieldB = 0; - _vm->_globals.ZONEP[v18].fieldC = 0; - _vm->_globals.ZONEP[v18].fieldD = 0; - _vm->_globals.ZONEP[v18].fieldE = 0; - _vm->_globals.ZONEP[v18].fieldF = 0; - _vm->_globals.ZONEP[v18].field12 = 0; + for (int i = 1; i <= 100; i++) { + _vm->_globals.ZONEP[i]._destX = 0; + _vm->_globals.ZONEP[i]._destY = 0; + _vm->_globals.ZONEP[i].field4 = 0; + _vm->_globals.ZONEP[i].field6 = 0; + _vm->_globals.ZONEP[i].field7 = 0; + _vm->_globals.ZONEP[i].field8 = 0; + _vm->_globals.ZONEP[i].field9 = 0; + _vm->_globals.ZONEP[i].fieldA = 0; + _vm->_globals.ZONEP[i].fieldB = 0; + _vm->_globals.ZONEP[i].fieldC = 0; + _vm->_globals.ZONEP[i].fieldD = 0; + _vm->_globals.ZONEP[i].fieldE = 0; + _vm->_globals.ZONEP[i].fieldF = 0; + _vm->_globals.ZONEP[i].field12 = 0; } v31 = 0; @@ -4595,31 +4593,32 @@ void ObjectsManager::INILINK(const Common::String &file) { ++v35; ++v31; } while (v28 != -1); - for (int v21 = 1; v21 <= 100; v21++) { - _vm->_globals.ZONEP[v21]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); - _vm->_globals.ZONEP[v21]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); - _vm->_globals.ZONEP[v21].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); + for (int i = 1; i <= 100; i++) { + _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); + _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); + _vm->_globals.ZONEP[i].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; } - v22 = ptr + v42 + (10 * v31 + 606) + 4; - v29 = 0; - for (int v24 = 1; v24 <= 100; v24++) { - _vm->_globals.ZONEP[v24].field6 = *(v29 + v22); - _vm->_globals.ZONEP[v24].field7 = *(v22 + v29 + 1); - _vm->_globals.ZONEP[v24].field8 = *(v22 + v29 + 2); - _vm->_globals.ZONEP[v24].field9 = *(v22 + v29 + 3); - _vm->_globals.ZONEP[v24].fieldA = *(v22 + v29 + 4); - _vm->_globals.ZONEP[v24].fieldB = *(v22 + v29 + 5); - _vm->_globals.ZONEP[v24].fieldC = *(v22 + v29 + 6); - _vm->_globals.ZONEP[v24].fieldD = *(v22 + v29 + 7); - _vm->_globals.ZONEP[v24].fieldE = *(v22 + v29 + 8); - _vm->_globals.ZONEP[v24].fieldF = *(v22 + v29 + 9); - v29 += 10; + v22 = ptr + idx + (10 * v31 + 606) + 4; + for (int i = 1; i <= 100; i++) { + int j = (i - 1) * 10; + _vm->_globals.ZONEP[i].field6 = v22[j]; + _vm->_globals.ZONEP[i].field7 = v22[j + 1]; + _vm->_globals.ZONEP[i].field8 = v22[j + 2]; + _vm->_globals.ZONEP[i].field9 = v22[j + 3]; + _vm->_globals.ZONEP[i].fieldA = v22[j + 4]; + _vm->_globals.ZONEP[i].fieldB = v22[j + 5]; + _vm->_globals.ZONEP[i].fieldC = v22[j + 6]; + _vm->_globals.ZONEP[i].fieldD = v22[j + 7]; + _vm->_globals.ZONEP[i].fieldE = v22[j + 8]; + _vm->_globals.ZONEP[i].fieldF = v22[j + 9]; + } + int dep = 1010; + for (int i = 1; i <= 100; i++) { + _vm->_globals.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep); + dep += 2; } - v30 = 0; - for (int v25 = 1; v25 <= 100; v25++) - _vm->_globals.ZONEP[v25].field12 = (int16)READ_LE_UINT16(v22 + 1010 + 2 * v30++); CARRE_ZONE(); } } @@ -4627,12 +4626,73 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.freeMemory(ptr); } -void ObjectsManager::SPECIAL_INI(const Common::String &a1) { - if (_vm->_globals._screenId == 73 && !_vm->_globals._saveData->data[svField318]) { - _vm->_globals.CACHE_SUB(0); - _vm->_globals.CACHE_SUB(1); - } - if ((uint16)(_vm->_globals._screenId - 35) <= 6u) { +void ObjectsManager::SPECIAL_INI() { + switch (_vm->_globals._screenId) { + case 17: + if (_vm->_globals.OLD_ECRAN == 20) { + _vm->_globals._disableInventFl = true; + _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); + _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + _vm->_globals.BPP_NOAFF = true; + for (int i = 0; i <= 4; i++) + _vm->_eventsManager.VBL(); + _vm->_globals.BPP_NOAFF = false; + _vm->_graphicsManager.FADE_INW(); + SPRITE_ON(0); + for (int i = 0; i <= 4; i++) + _vm->_eventsManager.VBL(); + VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); + _vm->_fontManager.hideText(9); + if (!_vm->_soundManager._textOffFl) { + _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); + if (!_vm->_soundManager._textOffFl) + _vm->_fontManager.showText(9); + } + if (!_vm->_soundManager._voiceOffFl) + _vm->_soundManager.mixVoice(383, 4); + _vm->_globals._saveData->data[svField270] = 1; + _vm->_globals._saveData->data[svField300] = 1; + _vm->_globals._saveData->data[svField320] = 1; + if (_vm->_soundManager._voiceOffFl) { + for (int i = 0; i <= 199; i++) + _vm->_eventsManager.VBL(); + } + _vm->_fontManager.hideText(9); + VBOB_OFF(5); + for (int i = 0; i <= 3; i++) + _vm->_eventsManager.VBL(); + _vm->_graphicsManager._noFadingFl = true; + _vm->_globals._disableInventFl = false; + } + break; + + case 18: + if (_vm->_globals.OLD_ECRAN == 17) { + _vm->_eventsManager._mouseSpriteId = 4; + _vm->_globals.BPP_NOAFF = true; + for (int i = 0; i <= 4; i++) + _vm->_eventsManager.VBL(); + _vm->_globals.BPP_NOAFF = false; + _vm->_graphicsManager.FADE_INW(); + _vm->_globals.iRegul = 1; + _vm->_globals._disableInventFl = false; + _vm->_graphicsManager._noFadingFl = true; + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); + _vm->_graphicsManager._noFadingFl = true; + _vm->_globals._disableInventFl = false; + } + break; + + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: _vm->_globals.BOBZONE[20] = 1; _vm->_globals.BOBZONE[21] = 2; _vm->_globals.BOBZONE[22] = 3; @@ -4641,74 +4701,31 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_globals.BOBZONE_FLAG[21] = true; _vm->_globals.BOBZONE_FLAG[22] = true; _vm->_globals.BOBZONE_FLAG[23] = true; - VERBE_ON(20, 5); - VERBE_ON(21, 5); - VERBE_ON(22, 5); - VERBE_ON(23, 5); + enableVerb(20, 5); + enableVerb(21, 5); + enableVerb(22, 5); + enableVerb(23, 5); _vm->_globals.ZONEP[20].field12 = 30; _vm->_globals.ZONEP[21].field12 = 30; _vm->_globals.ZONEP[22].field12 = 30; _vm->_globals.ZONEP[23].field12 = 30; - for (int v2 = 200; v2 <= 214; v2++) { - if (_vm->_globals._saveData->data[v2] != 2) - _vm->_globals._saveData->data[v2] = 0; + for (int i = 200; i <= 214; i++) { + if (_vm->_globals._saveData->data[i] != 2) + _vm->_globals._saveData->data[i] = 0; } - } - if (_vm->_globals._screenId == 93) { + break; + + case 73: + if (!_vm->_globals._saveData->data[svField318]) { + _vm->_globals.CACHE_SUB(0); + _vm->_globals.CACHE_SUB(1); + } + break; + + case 93: if (!_vm->_globals._saveData->data[svField333]) setBobAnimation(8); - } - if (_vm->_globals._screenId == 18 && _vm->_globals.OLD_ECRAN == 17) { - _vm->_eventsManager._mouseSpriteId = 4; - _vm->_globals.BPP_NOAFF = true; - for (int v3 = 0; v3 <= 4; v3++) - _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; - _vm->_graphicsManager.FADE_INW(); - _vm->_globals.iRegul = 1; - _vm->_globals._disableInventFl = false; - _vm->_graphicsManager._noFadingFl = true; - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); - _vm->_graphicsManager._noFadingFl = true; - _vm->_globals._disableInventFl = false; - } - if (_vm->_globals._screenId == 17 && _vm->_globals.OLD_ECRAN == 20) { - _vm->_globals._disableInventFl = true; - _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); - _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_globals.BPP_NOAFF = true; - for (int v4 = 0; v4 <= 4; v4++) - _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; - _vm->_graphicsManager.FADE_INW(); - SPRITE_ON(0); - for (int v5 = 0; v5 <= 4; v5++) - _vm->_eventsManager.VBL(); - VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); - _vm->_fontManager.hideText(9); - if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); - if (!_vm->_soundManager._textOffFl) - _vm->_fontManager.showText(9); - } - if (!_vm->_soundManager._voiceOffFl) - _vm->_soundManager.mixVoice(383, 4); - _vm->_globals._saveData->data[svField270] = 1; - _vm->_globals._saveData->data[svField300] = 1; - _vm->_globals._saveData->data[svField320] = 1; - if (_vm->_soundManager._voiceOffFl) { - for (int v6 = 0; v6 <= 199; v6++) - _vm->_eventsManager.VBL(); - } - _vm->_fontManager.hideText(9); - VBOB_OFF(5); - for (int v7 = 0; v7 <= 3; v7++) - _vm->_eventsManager.VBL(); - _vm->_graphicsManager._noFadingFl = true; - _vm->_globals._disableInventFl = false; + break; } } @@ -4747,156 +4764,135 @@ void ObjectsManager::SCI_OPTI_ONE(int idx, int a2, int a3, int a4) { stopBobAnimation(idx); } -void ObjectsManager::VERBE_OFF(int idx, int a2) { - if (a2 == 6) { +void ObjectsManager::disableVerb(int idx, int a2) { + switch (a2) { + case 6: + case 16: _vm->_globals.ZONEP[idx].field6 = 0; - } - if (a2 == 7) { + break; + case 7: _vm->_globals.ZONEP[idx].field7 = 0; - } - if (a2 == 8) { + break; + case 5: + case 8: _vm->_globals.ZONEP[idx].field8 = 0; - } - if (a2 == 9) { + break; + case 9: + case 17: + case 24: _vm->_globals.ZONEP[idx].field9 = 0; - } - if (a2 == 10) { + break; + case 10: + case 18: _vm->_globals.ZONEP[idx].fieldA = 0; - } - if (a2 == 11) { + break; + case 11: + case 19: _vm->_globals.ZONEP[idx].fieldB = 0; - } - if (a2 == 12) { + break; + case 12: + case 20: _vm->_globals.ZONEP[idx].fieldC = 0; - } - if (a2 == 13) { + break; + case 13: + case 22: _vm->_globals.ZONEP[idx].fieldD = 0; - } - if (a2 == 14 || a2 == 25) { + case 14: + case 21: + case 25: _vm->_globals.ZONEP[idx].fieldE = 0; - } - if (a2 == 15) { + break; + case 15: _vm->_globals.ZONEP[idx].fieldF = 0; - } - if (a2 == 16) { - _vm->_globals.ZONEP[idx].field6 = 0; - } - if (a2 == 5) { - _vm->_globals.ZONEP[idx].field8 = 0; - } - if (a2 == 17) { - _vm->_globals.ZONEP[idx].field9 = 0; - } - if (a2 == 18) { - _vm->_globals.ZONEP[idx].fieldA = 0; - } - if (a2 == 19) { - _vm->_globals.ZONEP[idx].fieldB = 0; - } - if (a2 == 20) { - _vm->_globals.ZONEP[idx].fieldC = 0; - } - if (a2 == 22) { - _vm->_globals.ZONEP[idx].fieldD = 0; - } - if (a2 == 21) { - _vm->_globals.ZONEP[idx].fieldE = 0; - } - if (a2 == 24) { - _vm->_globals.ZONEP[idx].field9 = 0; + break; } _changeVerbFl = true; } -void ObjectsManager::VERBE_ON(int idx, int a2) { - if (a2 == 6) { +void ObjectsManager::enableVerb(int idx, int a2) { + switch (a2) { + case 5: + _vm->_globals.ZONEP[idx].field8 = 2; + break; + case 6: _vm->_globals.ZONEP[idx].field6 = 1; - } - if (a2 == 7) { + break; + case 7: _vm->_globals.ZONEP[idx].field7 = 1; - } - if (a2 == 8) { + break; + case 8: _vm->_globals.ZONEP[idx].field8 = 1; - } - if (a2 == 9) { + break; + case 9: _vm->_globals.ZONEP[idx].field9 = 1; - } - if (a2 == 10) { + break; + case 10: _vm->_globals.ZONEP[idx].fieldA = 1; - } - if (a2 == 11) { + break; + case 11: _vm->_globals.ZONEP[idx].fieldB = 1; - } - if (a2 == 12) { + break; + case 12: _vm->_globals.ZONEP[idx].fieldC = 1; - } - if (a2 == 13) { + break; + case 13: _vm->_globals.ZONEP[idx].fieldD = 1; - } - if (a2 == 14) { + break; + case 14: _vm->_globals.ZONEP[idx].fieldD = 1; - } - if (a2 == 15) { + break; + case 15: _vm->_globals.ZONEP[idx].fieldE = 1; - } - if (a2 == 16) { + break; + case 16: _vm->_globals.ZONEP[idx].field6 = 2; - } - if (a2 == 5) { - _vm->_globals.ZONEP[idx].field8 = 2; - } - if (a2 == 17) { + break; + case 17: _vm->_globals.ZONEP[idx].field9 = 2; - } - if (a2 == 18) { + break; + case 18: _vm->_globals.ZONEP[idx].fieldA = 2; - } - if (a2 == 19) { + break; + case 19: _vm->_globals.ZONEP[idx].fieldB = 2; - } - if (a2 == 20) { + break; + case 20: _vm->_globals.ZONEP[idx].fieldC = 2; - } - if (a2 == 22) { - _vm->_globals.ZONEP[idx].fieldD = 2; - } - if (a2 == 21) { + break; + case 21: _vm->_globals.ZONEP[idx].fieldE = 2; - } - if (a2 == 24) { + break; + case 22: + _vm->_globals.ZONEP[idx].fieldD = 2; + break; + case 24: _vm->_globals.ZONEP[idx].field9 = 3; - } - if (a2 == 25) { + break; + case 25: _vm->_globals.ZONEP[idx].fieldE = 2; + break; } } int ObjectsManager::CALC_PROPRE(int idx) { - int v1; - int v2; - int v3; - int v4; - - v1 = 25; - v2 = _vm->_globals.STAILLE[idx]; + int retVal = 25; + int size = _vm->_globals.STAILLE[idx]; if (_vm->_globals.PERSO_TYPE == 1) { - v3 = _vm->_globals.STAILLE[idx]; - if (v2 < 0) - v3 = -v2; - v2 = 20 * (5 * v3 - 100) / -80; - } - if (_vm->_globals.PERSO_TYPE == 2) { - v4 = v2; - if (v2 < 0) - v4 = -v2; - v2 = 20 * (5 * v4 - 165) / -67; - } - if (v2 < 0) - return _vm->_graphicsManager.zoomOut(25, -v2); - if (v2 > 0) - return _vm->_graphicsManager.zoomIn(25, v2); - - return v1; + if (size < 0) + size = -size; + size = 20 * (5 * size - 100) / -80; + } else if (_vm->_globals.PERSO_TYPE == 2) { + if (size < 0) + size = -size; + size = 20 * (5 * size - 165) / -67; + } + + if (size < 0) + retVal = _vm->_graphicsManager.zoomOut(25, -size); + else if (size > 0) + retVal = _vm->_graphicsManager.zoomIn(25, size); + + return retVal; } int ObjectsManager::colision(int xp, int yp) { @@ -5121,74 +5117,72 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a } } -void ObjectsManager::TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int a6) { - int v6 = screenId; +void ObjectsManager::TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx) { + int savegameIdx = screenId; if (_vm->_globals._screenId != screenId) return; switch (_vm->_globals._screenId) { case 35: - if (a6 > 2) - v6 = 201; + if (idx > 2) + savegameIdx = 201; else - v6 = 200; + savegameIdx = 200; break; case 36: - if (a6 > 2) - v6 = 203; + if (idx > 2) + savegameIdx = 203; else - v6 = 202; + savegameIdx = 202; break; case 37: - if (a6 > 2) - v6 = 205; + if (idx > 2) + savegameIdx = 205; else - v6 = 204; + savegameIdx = 204; break; case 38: - if (a6 > 2) - v6 = 207; + if (idx > 2) + savegameIdx = 207; else - v6 = 206; + savegameIdx = 206; break; case 39: - if (a6 > 2) - v6 = 209; + if (idx > 2) + savegameIdx = 209; else - v6 = 208; + savegameIdx = 208; break; case 40: - if (a6 > 2) - v6 = 211; + if (idx > 2) + savegameIdx = 211; else - v6 = 210; + savegameIdx = 210; break; case 41: - if (a6 > 2) - v6 = 213; + if (idx > 2) + savegameIdx = 213; else - v6 = 212; + savegameIdx = 212; break; } - if (_vm->_globals._saveData->data[v6] == 2) + if (_vm->_globals._saveData->data[savegameIdx] == 2) return; - if (_vm->_globals._saveData->data[v6]) { - if (_vm->_globals._saveData->data[v6] == 1) { - if ((a6 == 1 && BOBPOSI(1) == 26) || (a6 == 2 && BOBPOSI(2) == 26) || - (a6 == 3 && BOBPOSI(3) == 27) || (a6 == 4 && BOBPOSI(4) == 27)) { + if (_vm->_globals._saveData->data[savegameIdx]) { + if (_vm->_globals._saveData->data[savegameIdx] == 1) { + if (((idx == 1 || idx == 2) && BOBPOSI(idx) == 26) || ((idx == 3 || idx == 4) && BOBPOSI(idx) == 27)) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals._saveData->data[v6] = 4; + _vm->_globals._saveData->data[savegameIdx] = 4; } } - if (_vm->_globals._saveData->data[v6] == 4) { - if ((a6 == 1 && BOBPOSI(1) > 30) || (a6 == 2 && BOBPOSI(2) > 30) || - (a6 == 3 && BOBPOSI(3) > 30) || (a6 == 4 && BOBPOSI(4) > 30)) - _vm->_globals._saveData->data[v6] = 3; + if (_vm->_globals._saveData->data[savegameIdx] == 4) { + if (idx >= 1 && idx <= 4 && BOBPOSI(idx) > 30) + _vm->_globals._saveData->data[savegameIdx] = 3; } - if (_vm->_globals._saveData->data[v6] == 3) { + if (_vm->_globals._saveData->data[savegameIdx] == 3) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); _vm->_globals._exitId = 150; @@ -5202,15 +5196,9 @@ void ObjectsManager::TEST_FORET(int screenId, int minX, int maxX, int minY, int && maxX > getSpriteX(0) && minY < getSpriteY(0) && maxY > getSpriteY(0)) { - if (a6 == 1) - setBobAnimation(1); - else if (a6 == 2) - setBobAnimation(2); - else if (a6 == 3) - setBobAnimation(3); - else if (a6 == 4) - setBobAnimation(4); - _vm->_globals._saveData->data[v6] = 1; + if (idx >= 1 && idx <= 4) + setBobAnimation(idx); + _vm->_globals._saveData->data[savegameIdx] = 1; } } @@ -5398,7 +5386,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.CACHE_ON(); _vm->_globals.chemin = (int16 *)g_PTRNUL; VERIFTAILLE(); - SPECIAL_INI(linkFile); + SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; g_old_x = _characterPos.x; g_old_y = _characterPos.y; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 98037067d9..45fc8def74 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -226,18 +226,18 @@ public: int BOBA(int idx); void INILINK(const Common::String &file); - void SPECIAL_INI(const Common::String &a1); + void SPECIAL_INI(); void OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6, int a7); void SCI_OPTI_ONE(int idx, int a2, int a3, int a4); - void VERBE_OFF(int idx, int a2); - void VERBE_ON(int idx, int a2); + void disableVerb(int idx, int a2); + void enableVerb(int idx, int a2); int CALC_PROPRE(int idx); int colision(int xp, int yp); void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6); void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); - void TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int a6); + void TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int a2); /** diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index ae2dea2c25..64d2147fbb 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2257,7 +2257,7 @@ LABEL_1141: _vm->_soundManager.playSound("SOUND89.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); _vm->_globals.ZONEP[4]._destX = 276; - _vm->_objectsManager.VERBE_ON(4, 19); + _vm->_objectsManager.enableVerb(4, 19); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals._saveData->data[svField399] = 1; break; @@ -2432,7 +2432,7 @@ LABEL_1141: opcodeType = 1; _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'N') { - _vm->_objectsManager.VERBE_ON((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + _vm->_objectsManager.enableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); opcodeType = 1; } else if (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') { _vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); @@ -2449,7 +2449,7 @@ LABEL_1141: _vm->_soundManager.playSound(file); opcodeType = 1; } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') { - _vm->_objectsManager.VERBE_OFF((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + _vm->_objectsManager.disableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); opcodeType = 1; } else if (dataP[2] == 'I' && dataP[3] == 'I' && dataP[4] == 'F') { opcodeType = 3; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f21abe03f8..ca1fb34ef4 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -806,11 +806,9 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int int v10; int v11; int v12; - char v13; int v14; int v15; int v16; - char v17; int v18; int v22; int v23; -- cgit v1.2.3 From ea235f71a5b860a36be4c97cdb7c3842fb7003ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Dec 2012 23:57:50 +0100 Subject: HOPKINS: More refactoring of ObjectsManager --- engines/hopkins/anim.cpp | 32 ++-- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 4 +- engines/hopkins/objects.cpp | 437 ++++++++++++++++++++------------------------ engines/hopkins/objects.h | 18 +- 5 files changed, 222 insertions(+), 271 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 58b22ec0ff..5c02b21b91 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -608,7 +608,7 @@ void AnimationManager::clearAnim() { for (int idx = 0; idx < 8; ++idx) { _vm->_globals.Bank[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bank[idx]._data); - _vm->_globals.Bank[idx].field4 = 0; + _vm->_globals.Bank[idx]._loadedFl = false; _vm->_globals.Bank[idx]._filename = ""; _vm->_globals.Bank[idx]._fileHeader = 0; _vm->_globals.Bank[idx].field1C = 0; @@ -619,41 +619,35 @@ void AnimationManager::clearAnim() { * Load Sprite Bank */ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { - byte *v3; - byte *v4; byte *v13; - byte *ptr; byte *v19; int result = 0; _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals._curFilename); - _vm->_globals.Bank[idx].field4 = 1; + _vm->_globals.Bank[idx]._loadedFl = true; _vm->_globals.Bank[idx]._filename = filename; - v3 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - v4 = v3; + byte *fileDataPtr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.Bank[idx]._fileHeader = 0; - if (*(v3 + 1) == 'L' && *(v3 + 2) == 'E') + if (fileDataPtr[1] == 'L' && fileDataPtr[2] == 'E') _vm->_globals.Bank[idx]._fileHeader = 1; - if (*(v3 + 1) == 'O' && *(v3 + 2) == 'R') + else if (fileDataPtr[1] == 'O' && fileDataPtr[2] == 'R') _vm->_globals.Bank[idx]._fileHeader = 2; if (_vm->_globals.Bank[idx]._fileHeader) { - _vm->_globals.Bank[idx]._data = v3; + _vm->_globals.Bank[idx]._data = fileDataPtr; bool loopCond = false; int v8 = 0; int width; int height; do { - ptr = v4; - width = _vm->_objectsManager.getWidth(v4, v8); - height = _vm->_objectsManager.getHeight(ptr, v8); - v4 = ptr; + width = _vm->_objectsManager.getWidth(fileDataPtr, v8); + height = _vm->_objectsManager.getHeight(fileDataPtr, v8); if (!width && !height) loopCond = true; - if (!loopCond) + else ++v8; if (v8 > 249) loopCond = true; @@ -691,13 +685,13 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { result = 0; } else { - _vm->_globals.freeMemory(ptr); - _vm->_globals.Bank[idx].field4 = 0; + _vm->_globals.freeMemory(fileDataPtr); + _vm->_globals.Bank[idx]._loadedFl = false; result = -2; } } else { - _vm->_globals.freeMemory(v3); - _vm->_globals.Bank[idx].field4 = 0; + _vm->_globals.freeMemory(fileDataPtr); + _vm->_globals.Bank[idx]._loadedFl = false; result = -1; } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index c97277ce61..d3eeaf8071 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -438,7 +438,7 @@ void Globals::INIT_ANIM() { for (int idx = 0; idx < 8; ++idx) { Bank[idx]._data = g_PTRNUL; - Bank[idx].field4 = 0; + Bank[idx]._loadedFl = false; Bank[idx]._filename = ""; Bank[idx]._fileHeader = 0; Bank[idx].field1C = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 1a613b8958..db51f8aa73 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -66,7 +66,7 @@ struct BqeAnimItem { struct BankItem { byte *_data; - int8 field4; + bool _loadedFl; Common::String _filename; int _fileHeader; int field1A; @@ -74,7 +74,7 @@ struct BankItem { }; struct ListeItem { - int field0; + bool field0; int field2; int field4; int _width; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5c6eb723f5..c4f520fe7e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -116,7 +116,8 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { int val2 = _vm->_globals.ObjetW[objIndex]._idx; if (mode == 1) - ++val2; + ++val2; + if (val1 != _vm->_globals.NUM_FICHIER_OBJ) { if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); @@ -201,7 +202,7 @@ void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSi } } -int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool isSize) { +int ObjectsManager::getOffsetX(const byte *spriteData, int spriteIndex, bool isSize) { const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) v3 += READ_LE_UINT32(v3) + 16; @@ -214,7 +215,7 @@ int ObjectsManager::get_offsetx(const byte *spriteData, int spriteIndex, bool is return result; } -int ObjectsManager::get_offsety(const byte *spriteData, int spriteIndex, bool isSize) { +int ObjectsManager::getOffsetY(const byte *spriteData, int spriteIndex, bool isSize) { const byte *v3 = spriteData + 3; for (int i = spriteIndex; i; --i) v3 += READ_LE_UINT32(v3) + 16; @@ -378,7 +379,7 @@ void ObjectsManager::displaySprite() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, x1_2, y1_2, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, _vm->_graphicsManager._vesaBuffer, v8, v9); - _vm->_globals.Liste[idx].field0 = 0; + _vm->_globals.Liste[idx].field0 = false; } } } @@ -389,11 +390,11 @@ void ObjectsManager::displaySprite() { if (!PERSO_ON) { // Handle drawing characters on the screen for (int idx = 0; idx < MAX_SPRITE; ++idx) { - _vm->_globals.Liste[idx].field0 = 0; + _vm->_globals.Liste[idx].field0 = false; if (_sprite[idx]._animationType == 1) { - CALCUL_SPRITE(idx); - if (_sprite[idx].field2A == 1) - AvantTri(TRI_SPRITE, idx, _sprite[idx].field32 + _sprite[idx].field2E); + computeSprite(idx); + if (_sprite[idx].field2A) + AvantTri(TRI_SPRITE, idx, _sprite[idx]._height + _sprite[idx].field2E); } } @@ -583,56 +584,53 @@ void ObjectsManager::BOB_ZERO(int idx) { } void ObjectsManager::DEF_BOB(int idx) { - if (_vm->_globals._bob[idx]._activeFl) { - int xp = _vm->_globals._bob[idx]._oldX; - int yp = _vm->_globals._bob[idx]._oldY; + if (!_vm->_globals._bob[idx]._activeFl) + return; - if (_vm->_globals._bob[idx]._isSpriteFl) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._bob[idx]._spriteData, - xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex); - else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, - _vm->_globals._bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex, - _vm->_globals._bob[idx].field4A, _vm->_globals._bob[idx]._oldY2, - _vm->_globals._bob[idx]._modeFlag); + int xp = _vm->_globals._bob[idx]._oldX; + int yp = _vm->_globals._bob[idx]._oldY; - _vm->_globals.Liste2[idx]._visibleFl = true; - _vm->_globals.Liste2[idx]._xp = xp; - _vm->_globals.Liste2[idx]._yp = yp; + if (_vm->_globals._bob[idx]._isSpriteFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._bob[idx]._spriteData, + xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex); + else + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, + _vm->_globals._bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex, + _vm->_globals._bob[idx].field4A, _vm->_globals._bob[idx]._oldY2, + _vm->_globals._bob[idx]._modeFlag); - _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; - _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; + _vm->_globals.Liste2[idx]._visibleFl = true; + _vm->_globals.Liste2[idx]._xp = xp; + _vm->_globals.Liste2[idx]._yp = yp; - int v5 = _vm->_globals.Liste2[idx]._xp; - if (v5 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager.min_x - v5; - _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager.min_x; - } + _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; + _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; - int v7 = _vm->_globals.Liste2[idx]._yp; - if (v7 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager.min_y - v7; - _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager.min_y; - } + if (_vm->_globals.Liste2[idx]._xp < _vm->_graphicsManager.min_x) { + _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste2[idx]._xp; + _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager.min_x; + } - int v9 = _vm->_globals.Liste2[idx]._xp; - if (_vm->_globals.Liste2[idx]._width + v9 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager.max_x - v9; + if (_vm->_globals.Liste2[idx]._yp < _vm->_graphicsManager.min_y) { + _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste2[idx]._yp; + _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager.min_y; + } - int v10 = _vm->_globals.Liste2[idx]._yp; - if (_vm->_globals.Liste2[idx]._height + v10 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager.max_y - v10; + if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._xp > _vm->_graphicsManager.max_x) + _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste2[idx]._xp; - if (_vm->_globals.Liste2[idx]._width <= 0 || _vm->_globals.Liste2[idx]._height <= 0) - _vm->_globals.Liste2[idx]._visibleFl = false; + if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._yp > _vm->_graphicsManager.max_y) + _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste2[idx]._yp; - if (_vm->_globals.Liste2[idx]._visibleFl) - _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.Liste2[idx]._xp, - _vm->_globals.Liste2[idx]._yp, - _vm->_globals.Liste2[idx]._xp + _vm->_globals.Liste2[idx]._width, - _vm->_globals.Liste2[idx]._yp + _vm->_globals.Liste2[idx]._height); - } + if (_vm->_globals.Liste2[idx]._width <= 0 || _vm->_globals.Liste2[idx]._height <= 0) + _vm->_globals.Liste2[idx]._visibleFl = false; + + if (_vm->_globals.Liste2[idx]._visibleFl) + _vm->_graphicsManager.Ajoute_Segment_Vesa( + _vm->_globals.Liste2[idx]._xp, + _vm->_globals.Liste2[idx]._yp, + _vm->_globals.Liste2[idx]._xp + _vm->_globals.Liste2[idx]._width, + _vm->_globals.Liste2[idx]._yp + _vm->_globals.Liste2[idx]._height); } void ObjectsManager::BOB_VISU(int idx) { @@ -648,7 +646,7 @@ void ObjectsManager::BOB_VISU(int idx) { int16 offsetY = (int16)READ_LE_UINT16(data + 6); int16 v6 = (int16)READ_LE_UINT16(data + 8); if ((int16)READ_LE_UINT16(data)) { - if (_vm->_globals.Bank[v1].field4) { + if (_vm->_globals.Bank[v1]._loadedFl) { if (!v9) v9 = 1; if (!v6) @@ -752,11 +750,11 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (result != 250) { int v5, v15, v22; if (_vm->_globals._bob[idx]._modeFlag) { - v22 = v15 = get_offsetx(_vm->_globals._bob[idx]._spriteData, result, 1); - v5 = get_offsety(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); + v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); + v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); } else { - v22 = v15 = get_offsetx(_vm->_globals._bob[idx]._spriteData, result, 0); - v5 = get_offsety(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); + v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); + v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); } int v17 = v5; @@ -858,8 +856,8 @@ void ObjectsManager::VERIFCACHE() { if (_sprite[v10]._animationType == 1) { if (_sprite[v10]._spriteIndex != 250) { v1 = _sprite[v10].field2C; - v11 = _sprite[v10].field30 + v1; - v2 = _sprite[v10].field32 + _sprite[v10].field2E; + v11 = _sprite[v10]._width + v1; + v2 = _sprite[v10]._height + _sprite[v10].field2E; v6 = _vm->_globals.Cache[v8]._x; v3 = _vm->_globals.Cache[v8]._y; v9 = _vm->_globals.Cache[v8]._width + v6; @@ -918,65 +916,44 @@ void ObjectsManager::VERIFCACHE() { } void ObjectsManager::DEF_SPRITE(int idx) { - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; + if (!_sprite[idx].field2A) + return; - v2 = idx; - if (_sprite[v2].field2A) { - v3 = _sprite[v2].field2C; - v4 = _sprite[v2].field2E; - if (_sprite[v2].field28) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[v2]._spriteData, - v3 + 300, v4 + 300, _sprite[v2]._spriteIndex); + if (_sprite[idx]._rleFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, + _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[v2]._spriteData, - v3 + 300, v4 + 300, _sprite[v2]._spriteIndex, _sprite[v2].field36, _sprite[v2].field34, _sprite[v2].fieldE); - - v5 = idx; - v6 = idx; - _vm->_globals.Liste[v5]._width = _sprite[v6].field30; - _vm->_globals.Liste[v5]._height = _sprite[v6].field32; - v7 = _vm->_globals.Liste[v5].field2; - v8 = _vm->_graphicsManager.min_x; - - if (v7 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste[v5]._width -= _vm->_graphicsManager.min_x - v7; - _vm->_globals.Liste[v5].field2 = v8; + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, + _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); + + _vm->_globals.Liste[idx]._width = _sprite[idx]._width; + _vm->_globals.Liste[idx]._height = _sprite[idx]._height; + + if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager.min_x) { + _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste[idx].field2; + _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager.min_x; } - v9 = _vm->_globals.Liste[v5].field4; - v10 = _vm->_graphicsManager.min_y; - if (v9 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste[v5]._height -= _vm->_graphicsManager.min_y - v9; - _vm->_globals.Liste[v5].field4 = v10; + if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager.min_y) { + _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste[idx].field4; + _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager.min_y; } - v11 = _vm->_globals.Liste[v5].field2; - if (_vm->_globals.Liste[v5]._width + v11 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste[v5]._width = _vm->_graphicsManager.max_x - v11; - v12 = _vm->_globals.Liste[v5].field4; - if ( _vm->_globals.Liste[v5]._height + v12 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste[v5]._height = _vm->_graphicsManager.max_y - v12; - if ( _vm->_globals.Liste[v5]._width <= 0 || _vm->_globals.Liste[v5]._height <= 0) - _vm->_globals.Liste[v5].field0 = 0; - - v13 = idx; - if (_vm->_globals.Liste[v13].field0 == 1) + + if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste[idx].field2; + + if ( _vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste[idx].field4; + + if ( _vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) + _vm->_globals.Liste[idx].field0 = false; + + if (_vm->_globals.Liste[idx].field0) _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.Liste[v13].field2, - _vm->_globals.Liste[v13].field4, - _vm->_globals.Liste[v13].field2 + _vm->_globals.Liste[v13]._width, - _vm->_globals.Liste[v13].field4 + _vm->_globals.Liste[v13]._height); - } + _vm->_globals.Liste[idx].field2, + _vm->_globals.Liste[idx].field4, + _vm->_globals.Liste[idx].field2 + _vm->_globals.Liste[idx]._width, + _vm->_globals.Liste[idx].field4 + _vm->_globals.Liste[idx]._height); } void ObjectsManager::DEF_CACHE(int idx) { @@ -991,125 +968,95 @@ void ObjectsManager::DEF_CACHE(int idx) { } // Compute Sprite -void ObjectsManager::CALCUL_SPRITE(int idx) { - int width, height; - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v15; - int v16; - int v17; - int v22; - - _sprite[idx].field2A = 0; +void ObjectsManager::computeSprite(int idx) { + _sprite[idx].field2A = false; int spriteIndex = _sprite[idx]._spriteIndex; - if (spriteIndex != 250) { - if (_sprite[idx].fieldE) { - v5 = get_offsetx(_sprite[idx]._spriteData, spriteIndex, 1); - v22 = _sprite[idx].field12 + v5; - v4 = _sprite[idx].field12 + v5; - v6 = get_offsety(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 1); + if (spriteIndex == 250) + return; + + int offX; + int offY; + if (_sprite[idx].fieldE) { + offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, 1); + offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 1); + } else { + offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, 0); + offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 0); + } + + int tmpX = _sprite[idx].field12 + offX; + int deltaX = tmpX; + int tmpY = _sprite[idx].field14 + offY; + int deltaY = tmpY; + int zoomPercent = 0; + int reducePercent = 0; + + if (_sprite[idx].fieldC < 0) { + reducePercent = -_sprite[idx].fieldC; + if (reducePercent > 95) + reducePercent = 95; + } else + zoomPercent = _sprite[idx].fieldC; + + if (zoomPercent) { + if (tmpX >= 0) + deltaX = _vm->_graphicsManager.zoomIn(tmpX, zoomPercent); + else + deltaX = -_vm->_graphicsManager.zoomIn(-tmpX, zoomPercent); + + if (tmpY >= 0) { + deltaY = _vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } else { - v3 = get_offsetx(_sprite[idx]._spriteData, spriteIndex, 0); - v22 = _sprite[idx].field12 + v3; - v4 = _sprite[idx].field12 + v3; - v6 = get_offsety(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 0); - } + if (tmpX < 0) + tmpY = -tmpX; + else + tmpY = tmpX; - v9 = _sprite[idx].field14 + v6; - v7 = v9; - v8 = v9; - int zoomPercent = 0; - int reducePercent = 0; - - v9 = _sprite[idx].fieldC; - if (v9 < 0) { - v9 = -v9; - reducePercent = v9; - if (v9 > 95) - reducePercent = 95; + deltaY = -_vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } - if (_sprite[idx].fieldC > 0) - zoomPercent = _sprite[idx].fieldC; - - if (zoomPercent) { - if (v4 >= 0) { - v22 = _vm->_graphicsManager.zoomIn(v4, zoomPercent); - } else { - v10 = v4; + } else if (reducePercent) { + if (tmpX >= 0) + deltaX = _vm->_graphicsManager.zoomOut(tmpX, reducePercent); + else + deltaX = -_vm->_graphicsManager.zoomOut(-tmpX, reducePercent); - if (v4 < 0) - v10 = -v4; - v4 = v10; - v22 = -_vm->_graphicsManager.zoomIn(v10, zoomPercent); - } + if (tmpY >= 0) { + deltaY = _vm->_graphicsManager.zoomOut(tmpY, reducePercent); + } else { + if (tmpX < 0) + tmpY = -tmpX; + else + tmpY = tmpX; - if (v8 >= 0) { - v7 = _vm->_graphicsManager.zoomIn(v8, zoomPercent); - } else { - v11 = v4; - if (v4 < 0) - v11 = -v4; - v8 = v11; - v7 = -_vm->_graphicsManager.zoomIn(v11, zoomPercent); - } - } - if (reducePercent) { - if (v4 >= 0) { - v22 = _vm->_graphicsManager.zoomOut(v4, reducePercent); - } else { - v12 = v4; - if (v4 < 0) - v12 = -v4; - v4 = v12; - v22 = -_vm->_graphicsManager.zoomOut(v12, reducePercent); - } - if (v8 >= 0) { - v7 = _vm->_graphicsManager.zoomOut(v8, reducePercent); - } else { - v13 = v4; - if (v4 < 0) - v13 = -v4; - v7 = -_vm->_graphicsManager.zoomOut(v13, reducePercent); - } + deltaY = -_vm->_graphicsManager.zoomOut(tmpY, reducePercent); } + } - v15 = _sprite[idx]._spritePos.x - v22; - v16 = _sprite[idx]._spritePos.y - v7; - _sprite[idx].field2C = v15; - _sprite[idx].field2E = v16; - _sprite[idx].field2A = 1; - _sprite[idx].field34 = zoomPercent; - _sprite[idx].field36 = reducePercent; - - v17 = idx; - _vm->_globals.Liste[v17].field0 = 1; - _vm->_globals.Liste[v17].field2 = v15; - _vm->_globals.Liste[v17].field4 = v16; - width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); - height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); - - if (zoomPercent) { - width = _vm->_graphicsManager.zoomIn(width, zoomPercent); - height = _vm->_graphicsManager.zoomIn(height, zoomPercent); - } + int v15 = _sprite[idx]._spritePos.x - deltaX; + int v16 = _sprite[idx]._spritePos.y - deltaY; + _sprite[idx].field2C = v15; + _sprite[idx].field2E = v16; + _sprite[idx].field2A = true; + _sprite[idx]._zoomPct = zoomPercent; + _sprite[idx]._reducePct = reducePercent; - if (reducePercent) { - height = _vm->_graphicsManager.zoomOut(height, reducePercent); - width = _vm->_graphicsManager.zoomOut(width, reducePercent); - } + _vm->_globals.Liste[idx].field0 = true; + _vm->_globals.Liste[idx].field2 = v15; + _vm->_globals.Liste[idx].field4 = v16; + + int width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); + int height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); - _sprite[idx].field30 = width; - _sprite[idx].field32 = height; + if (zoomPercent) { + width = _vm->_graphicsManager.zoomIn(width, zoomPercent); + height = _vm->_graphicsManager.zoomIn(height, zoomPercent); + } else if (reducePercent) { + height = _vm->_graphicsManager.zoomOut(height, reducePercent); + width = _vm->_graphicsManager.zoomOut(width, reducePercent); } + + _sprite[idx]._width = width; + _sprite[idx]._height = height; } // Before Sort @@ -1155,8 +1102,13 @@ void ObjectsManager::AFF_BOB_ANIM() { v1 = _vm->_globals._bob[idx].field20; if (v1 == -1) v1 = 50; - if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) - goto LABEL_38; + if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) { + v12 = idx; + + if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) + _vm->_globals._bob[v12].field1C = true; + continue; + } if (_vm->_globals._bob[idx].field12 == _vm->_globals._bob[idx].field14) { _vm->_globals._bob[idx].field1C = true; @@ -1165,8 +1117,13 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals._bob[idx].field1C = false; } - if (!_vm->_globals._bob[idx].field1C) - goto LABEL_38; + if (!_vm->_globals._bob[idx].field1C) { + v12 = idx; + + if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) + _vm->_globals._bob[v12].field1C = true; + continue; + } v20 = _vm->_globals._bob[idx]._animData + 20; v24 = _vm->_globals._bob[idx].field10; @@ -1179,8 +1136,8 @@ void ObjectsManager::AFF_BOB_ANIM() { _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); - _vm->_globals._bob[idx]._frameIndex = *(v20 + 2 * v24 + 8); - _vm->_globals._bob[idx]._modeFlag = *(v20 + 2 * v24 + 9); + _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; + _vm->_globals._bob[idx]._modeFlag = v20[2 * v24 + 9]; _vm->_globals._bob[idx].field10 += 5; v5 = _vm->_globals._bob[idx].field12; @@ -1188,12 +1145,10 @@ void ObjectsManager::AFF_BOB_ANIM() { v6 = v5 / _vm->_globals._speed; _vm->_globals._bob[idx].field12 = v5 / _vm->_globals._speed; if (v6 > 0) { -LABEL_37: _vm->_globals._bob[idx].field14 = 1; -LABEL_38: v12 = idx; - if ((unsigned int)(_vm->_globals._bob[v12].field1E - 1) <= 1u) + if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) _vm->_globals._bob[v12].field1C = true; continue; } @@ -1233,7 +1188,12 @@ LABEL_38: } } - goto LABEL_37; + _vm->_globals._bob[idx].field14 = 1; + v12 = idx; + + if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) + _vm->_globals._bob[v12].field1C = true; + continue; } } while (idx != 35); @@ -1429,7 +1389,7 @@ void ObjectsManager::clearSprite() { } for (int idx = 0; idx < MAX_SPRITE; idx++) { - _vm->_globals.Liste[idx].field0 = 0; + _vm->_globals.Liste[idx].field0 = false; _vm->_globals.Liste[idx].field2 = 0; _vm->_globals.Liste[idx].field4 = 0; _vm->_globals.Liste[idx]._width = 0; @@ -1449,6 +1409,7 @@ void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, _sprite[idx]._spritePos = pos; _sprite[idx]._spriteIndex = spriteIndex; _sprite[idx].fieldC = a6; + _sprite[idx].fieldE = a7; _sprite[idx].field12 = a8; _sprite[idx].field14 = a9; _sprite[idx].field1C = g_PTRNUL; @@ -1457,12 +1418,10 @@ void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, _sprite[idx].field26 = 0; _sprite[idx].field22 = 0; _sprite[idx]._animationType = 0; - _sprite[idx].field28 = false; - _sprite[idx].fieldE = a7; - if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') - _sprite[idx].field28 = true; - if (_sprite[idx].field28) { + _sprite[idx]._rleFl = false; + if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { + _sprite[idx]._rleFl = true; _sprite[idx].fieldC = 0; _sprite[idx].fieldE = 0; } @@ -1479,12 +1438,10 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, _sprite[idx]._animationType = 1; _sprite[idx].field22 = 0; _sprite[idx].field14 = a5; - if (*spriteData == 'R' && *(spriteData + 1) == 'L' && *(spriteData + 2) == 'E') - _sprite[idx].field28 = true; - if (_sprite[idx].field28) { - _sprite[idx].fieldC = 0; - _sprite[idx].fieldE = 0; + _sprite[idx]._rleFl = false; + if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { + _sprite[idx]._rleFl = true; } } @@ -1524,12 +1481,12 @@ void ObjectsManager::setSpriteIndex(int idx, int spriteIndex) { // Set Sprite Size void ObjectsManager::SETTAILLESPR(int idx, int a2) { assert (idx <= MAX_SPRITE); - if (!_sprite[idx].field28) + if (!_sprite[idx]._rleFl) _sprite[idx].fieldC = a2; } void ObjectsManager::setFlipSprite(int idx, bool flip) { - if (!_sprite[idx].field28) { + if (!_sprite[idx]._rleFl) { assert (idx <= MAX_SPRITE); _sprite[idx].fieldE = flip; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 45fc8def74..9fbaaced76 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -45,14 +45,14 @@ struct SpriteItem { int field22; int field24; int field26; - bool field28; - int field2A; + bool _rleFl; + bool field2A; int field2C; int field2E; - int field30; - int field32; - int field34; - int field36; + int _width; + int _height; + int _zoomPct; + int _reducePct; }; class HopkinsEngine; @@ -133,8 +133,8 @@ public: byte *loadSprite(const Common::String &file); void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); - int get_offsetx(const byte *spriteData, int spriteIndex, bool isSize); - int get_offsety(const byte *spriteData, int spriteIndex, bool isSize); + int getOffsetX(const byte *spriteData, int spriteIndex, bool isSize); + int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize); void displaySprite(); int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); @@ -154,7 +154,7 @@ public: void VERIFCACHE(); void DEF_SPRITE(int idx); void DEF_CACHE(int idx); - void CALCUL_SPRITE(int idx); + void computeSprite(int idx); int AvantTri(TriMode triMode, int index, int priority); void AFF_BOB_ANIM(); void AFF_VBOB(); -- cgit v1.2.3 From 5e4b8b0cb17fedfaf6414e37ed57b934559007d3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Dec 2012 01:21:43 +0100 Subject: HOPKINS: More refactoring in ObjectsManager --- engines/hopkins/objects.cpp | 776 +++++++++++++++++++++----------------------- 1 file changed, 365 insertions(+), 411 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c4f520fe7e..0a2fd37404 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -636,50 +636,50 @@ void ObjectsManager::DEF_BOB(int idx) { void ObjectsManager::BOB_VISU(int idx) { _priorityFl = true; - if (!_vm->_globals._bob[idx].field0) { - BOB_ZERO(idx); + if (_vm->_globals._bob[idx].field0) + return; - const byte *data = _vm->_globals.Bqe_Anim[idx]._data; - int v1 = (int16)READ_LE_UINT16(data); - int16 v9 = (int16)READ_LE_UINT16(data + 2); - int16 v8 = (int16)READ_LE_UINT16(data + 4); - int16 offsetY = (int16)READ_LE_UINT16(data + 6); - int16 v6 = (int16)READ_LE_UINT16(data + 8); - if ((int16)READ_LE_UINT16(data)) { - if (_vm->_globals.Bank[v1]._loadedFl) { - if (!v9) - v9 = 1; - if (!v6) - v6 = -1; - - if ((int16)READ_LE_UINT16(data + 24)) { - _vm->_globals._bob[idx]._isSpriteFl = false; - - if (_vm->_globals.Bank[v1]._fileHeader == 1) { - _vm->_globals._bob[idx]._isSpriteFl = true; - _vm->_globals._bob[idx].field36 = 0; - _vm->_globals._bob[idx]._modeFlag = 0; - } + BOB_ZERO(idx); - _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; - _vm->_globals._bob[idx].field0 = 10; - _vm->_globals._bob[idx]._spriteData = _vm->_globals.Bank[v1]._data; + const byte *data = _vm->_globals.Bqe_Anim[idx]._data; + int bankIdx = (int16)READ_LE_UINT16(data); + if (!bankIdx) + return; + if ((!_vm->_globals.Bank[bankIdx]._loadedFl) || (!READ_LE_UINT16(data + 24))) + return; - _vm->_globals._bob[idx].field1E = v9; - _vm->_globals._bob[idx].field20 = v6; - _vm->_globals._bob[idx].field22 = v8; - _vm->_globals._bob[idx]._offsetY = offsetY; - } - } - } + + int16 v9 = (int16)READ_LE_UINT16(data + 2); + int16 v8 = (int16)READ_LE_UINT16(data + 4); + int16 offsetY = (int16)READ_LE_UINT16(data + 6); + int16 v6 = (int16)READ_LE_UINT16(data + 8); + + if (!v9) + v9 = 1; + if (!v6) + v6 = -1; + + _vm->_globals._bob[idx]._isSpriteFl = false; + + if (_vm->_globals.Bank[bankIdx]._fileHeader == 1) { + _vm->_globals._bob[idx]._isSpriteFl = true; + _vm->_globals._bob[idx].field36 = 0; + _vm->_globals._bob[idx]._modeFlag = 0; } + + _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _vm->_globals._bob[idx].field0 = 10; + _vm->_globals._bob[idx]._spriteData = _vm->_globals.Bank[bankIdx]._data; + + _vm->_globals._bob[idx].field1E = v9; + _vm->_globals._bob[idx].field20 = v6; + _vm->_globals._bob[idx].field22 = v8; + _vm->_globals._bob[idx]._offsetY = offsetY; } void ObjectsManager::BOB_OFF(int idx) { - if (_vm->_globals._bob[idx].field0 == 3) - _vm->_globals._bob[idx].field0 = 4; - else if (_vm->_globals._bob[idx].field0 == 10) - _vm->_globals._bob[idx].field0 = 11; + if ((_vm->_globals._bob[idx].field0 == 3) || (_vm->_globals._bob[idx].field0 == 10)) + _vm->_globals._bob[idx].field0++; } void ObjectsManager::BOB_OFFSET(int idx, int v) { @@ -747,95 +747,98 @@ void ObjectsManager::CALCUL_BOB(int idx) { } int result = _vm->_globals._bob[idx]._frameIndex; - if (result != 250) { - int v5, v15, v22; - if (_vm->_globals._bob[idx]._modeFlag) { - v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); - v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); - } else { - v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); - v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); - } + if (result == 250) + return; - int v17 = v5; - int v6 = v5; - int v21 = 0; - int v20 = 0; - int v7 = _vm->_globals._bob[idx].field36; - - if (v7 < 0) { - v7 = -v7; - v20 = v7; - if (v7 > 95) - v20 = 95; - } - if (_vm->_globals._bob[idx].field36 > 0) - v21 = _vm->_globals._bob[idx].field36; - if (v21) { - if (v15 >= 0) { - v22 = _vm->_graphicsManager.zoomIn(v15, v21); - } else { - if (v15 < 0) - v15 = -v15; - v22 = -_vm->_graphicsManager.zoomIn(v15, v21); - } - if (v6 >= 0) { - v17 = _vm->_graphicsManager.zoomIn(v6, v21); - } else { - int v9 = v15; - if (v15 < 0) - v9 = -v15; - v6 = v9; - v17 = -_vm->_graphicsManager.zoomIn(v9, v21); - } - } + int v5, v15, v22; + if (_vm->_globals._bob[idx]._modeFlag) { + v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); + v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); + } else { + v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); + v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); + } - if (v20) { - if (v15 >= 0) { - v22 = _vm->_graphicsManager.zoomOut(v15, v20); - } else { - v15 = -v15; - v22 = -_vm->_graphicsManager.zoomOut(v15, v20); - } - if (v6 >= 0) { - v17 = _vm->_graphicsManager.zoomOut(v6, v20); - } else { - int v11 = v15; - if (v15 < 0) - v11 = -v15; - v17 = -_vm->_graphicsManager.zoomOut(v11, v20); - } - } + int v17 = v5; + int v6 = v5; + int v20 = 0; + int v7 = _vm->_globals._bob[idx].field36; - int v13 = _vm->_globals._bob[idx]._xp - v22; - int v14 = _vm->_globals._bob[idx]._yp - v17; - _vm->_globals._bob[idx]._activeFl = true; - _vm->_globals._bob[idx]._oldX = v13; - _vm->_globals._bob[idx]._oldY = v14; - _vm->_globals._bob[idx]._oldY2 = v21; - _vm->_globals._bob[idx].field4A = v20; + if (v7 < 0) { + v7 = -v7; + v20 = v7; + if (v7 > 95) + v20 = 95; + } - _vm->_globals.Liste2[idx]._visibleFl = true; - _vm->_globals.Liste2[idx]._xp = v13; - _vm->_globals.Liste2[idx]._yp = v14; + int v21 = 0; + if (_vm->_globals._bob[idx].field36 > 0) + v21 = _vm->_globals._bob[idx].field36; - int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); - int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); + if (v21) { + if (v15 >= 0) { + v22 = _vm->_graphicsManager.zoomIn(v15, v21); + } else { + if (v15 < 0) + v15 = -v15; + v22 = -_vm->_graphicsManager.zoomIn(v15, v21); + } + if (v6 >= 0) { + v17 = _vm->_graphicsManager.zoomIn(v6, v21); + } else { + int v9 = v15; + if (v15 < 0) + v9 = -v15; + v6 = v9; + v17 = -_vm->_graphicsManager.zoomIn(v9, v21); + } + } - if (v21) { - width = _vm->_graphicsManager.zoomIn(width, v21); - height = _vm->_graphicsManager.zoomIn(height, v21); + if (v20) { + if (v15 >= 0) { + v22 = _vm->_graphicsManager.zoomOut(v15, v20); + } else { + v15 = -v15; + v22 = -_vm->_graphicsManager.zoomOut(v15, v20); } - if (v20) { - height = _vm->_graphicsManager.zoomOut(height, v20); - width = _vm->_graphicsManager.zoomOut(width, v20); + if (v6 >= 0) { + v17 = _vm->_graphicsManager.zoomOut(v6, v20); + } else { + int v11 = v15; + if (v15 < 0) + v11 = -v15; + v17 = -_vm->_graphicsManager.zoomOut(v11, v20); } + } + + int v13 = _vm->_globals._bob[idx]._xp - v22; + int v14 = _vm->_globals._bob[idx]._yp - v17; + _vm->_globals._bob[idx]._activeFl = true; + _vm->_globals._bob[idx]._oldX = v13; + _vm->_globals._bob[idx]._oldY = v14; + _vm->_globals._bob[idx]._oldY2 = v21; + _vm->_globals._bob[idx].field4A = v20; + + _vm->_globals.Liste2[idx]._visibleFl = true; + _vm->_globals.Liste2[idx]._xp = v13; + _vm->_globals.Liste2[idx]._yp = v14; + + int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); + int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); - _vm->_globals.Liste2[idx]._width = width; - _vm->_globals.Liste2[idx]._height = height; - _vm->_globals._bob[idx]._oldWidth = width; - _vm->_globals._bob[idx]._oldHeight = height; + if (v21) { + width = _vm->_graphicsManager.zoomIn(width, v21); + height = _vm->_graphicsManager.zoomIn(height, v21); + } + if (v20) { + height = _vm->_graphicsManager.zoomOut(height, v20); + width = _vm->_graphicsManager.zoomOut(width, v20); } + + _vm->_globals.Liste2[idx]._width = width; + _vm->_globals.Liste2[idx]._height = height; + _vm->_globals._bob[idx]._oldWidth = width; + _vm->_globals._bob[idx]._oldHeight = height; } void ObjectsManager::VERIFCACHE() { @@ -919,52 +922,47 @@ void ObjectsManager::DEF_SPRITE(int idx) { if (!_sprite[idx].field2A) return; - if (_sprite[idx]._rleFl) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex); - else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); + if (_sprite[idx]._rleFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, + _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex); + else + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, + _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); - _vm->_globals.Liste[idx]._width = _sprite[idx]._width; - _vm->_globals.Liste[idx]._height = _sprite[idx]._height; + _vm->_globals.Liste[idx]._width = _sprite[idx]._width; + _vm->_globals.Liste[idx]._height = _sprite[idx]._height; - if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste[idx].field2; - _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager.min_x; - } + if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager.min_x) { + _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste[idx].field2; + _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager.min_x; + } - if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste[idx].field4; - _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager.min_y; - } + if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager.min_y) { + _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste[idx].field4; + _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager.min_y; + } - if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste[idx].field2; + if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager.max_x) + _vm->_globals.Liste[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste[idx].field2; - if ( _vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste[idx].field4; + if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager.max_y) + _vm->_globals.Liste[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste[idx].field4; - if ( _vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) - _vm->_globals.Liste[idx].field0 = false; + if (_vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) + _vm->_globals.Liste[idx].field0 = false; - if (_vm->_globals.Liste[idx].field0) - _vm->_graphicsManager.Ajoute_Segment_Vesa( - _vm->_globals.Liste[idx].field2, - _vm->_globals.Liste[idx].field4, - _vm->_globals.Liste[idx].field2 + _vm->_globals.Liste[idx]._width, - _vm->_globals.Liste[idx].field4 + _vm->_globals.Liste[idx]._height); + if (_vm->_globals.Liste[idx].field0) + _vm->_graphicsManager.Ajoute_Segment_Vesa( _vm->_globals.Liste[idx].field2, _vm->_globals.Liste[idx].field4, + _vm->_globals.Liste[idx].field2 + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx].field4 + _vm->_globals.Liste[idx]._height); } void ObjectsManager::DEF_CACHE(int idx) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1], - _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, - _vm->_globals.Cache[idx]._spriteIndex); + _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, + _vm->_globals.Cache[idx]._spriteIndex); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx]._x, - _vm->_globals.Cache[idx]._y, - _vm->_globals.Cache[idx]._x + _vm->_globals.Cache[idx]._width, - _vm->_globals.Cache[idx]._y + _vm->_globals.Cache[idx]._height); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx]._x, _vm->_globals.Cache[idx]._y, + _vm->_globals.Cache[idx]._x + _vm->_globals.Cache[idx]._width, _vm->_globals.Cache[idx]._y + _vm->_globals.Cache[idx]._height); } // Compute Sprite @@ -1082,7 +1080,6 @@ void ObjectsManager::AFF_BOB_ANIM() { uint v6; int v10; int v11; - int v12; int v14; int v19; byte *v20; @@ -1097,104 +1094,97 @@ void ObjectsManager::AFF_BOB_ANIM() { continue; } - if (_vm->_globals._bob[idx].field0 == 10) { - _vm->_globals._bob[idx].field1C = false; - v1 = _vm->_globals._bob[idx].field20; - if (v1 == -1) - v1 = 50; - if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) { - v12 = idx; - - if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) - _vm->_globals._bob[v12].field1C = true; - continue; - } + if (_vm->_globals._bob[idx].field0 != 10) + continue; - if (_vm->_globals._bob[idx].field12 == _vm->_globals._bob[idx].field14) { + _vm->_globals._bob[idx].field1C = false; + v1 = _vm->_globals._bob[idx].field20; + if (v1 == -1) + v1 = 50; + if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) { + if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) _vm->_globals._bob[idx].field1C = true; - } else { - _vm->_globals._bob[idx].field14++; - _vm->_globals._bob[idx].field1C = false; - } + continue; + } - if (!_vm->_globals._bob[idx].field1C) { - v12 = idx; + if (_vm->_globals._bob[idx].field12 == _vm->_globals._bob[idx].field14) { + _vm->_globals._bob[idx].field1C = true; + } else { + _vm->_globals._bob[idx].field14++; + _vm->_globals._bob[idx].field1C = false; + } + + if (!_vm->_globals._bob[idx].field1C) { + if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) + _vm->_globals._bob[idx].field1C = true; + continue; + } - if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) - _vm->_globals._bob[v12].field1C = true; + v20 = _vm->_globals._bob[idx]._animData + 20; + v24 = _vm->_globals._bob[idx].field10; + _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); + if (_vm->_globals._lockedAnims[idx]._enableFl) + _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; + if ( PERSO_ON && idx > 20 ) + _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; + + _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); + _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); + _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); + _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; + _vm->_globals._bob[idx]._modeFlag = v20[2 * v24 + 9]; + _vm->_globals._bob[idx].field10 += 5; + v5 = _vm->_globals._bob[idx].field12; + + if (v5 > 0) { + v6 = v5 / _vm->_globals._speed; + _vm->_globals._bob[idx].field12 = v5 / _vm->_globals._speed; + if (v6 > 0) { + _vm->_globals._bob[idx].field14 = 1; + if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) + _vm->_globals._bob[idx].field1C = true; continue; } - v20 = _vm->_globals._bob[idx]._animData + 20; - v24 = _vm->_globals._bob[idx].field10; - _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); - if (_vm->_globals._lockedAnims[idx]._enableFl) - _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; - if ( PERSO_ON && idx > 20 ) - _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; - - _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); - _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); - _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); - _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; - _vm->_globals._bob[idx]._modeFlag = v20[2 * v24 + 9]; - _vm->_globals._bob[idx].field10 += 5; - v5 = _vm->_globals._bob[idx].field12; - - if (v5 > 0) { - v6 = v5 / _vm->_globals._speed; - _vm->_globals._bob[idx].field12 = v5 / _vm->_globals._speed; - if (v6 > 0) { - _vm->_globals._bob[idx].field14 = 1; - v12 = idx; - - if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) - _vm->_globals._bob[v12].field1C = true; - continue; - } - - _vm->_globals._bob[idx].field12 = 1; - } - if (!_vm->_globals._bob[idx].field12) { - if (_vm->_globals._bob[idx].field20 > 0) - _vm->_globals._bob[idx].field20--; - if (_vm->_globals._bob[idx].field20 != -1 && _vm->_globals._bob[idx].field20 <= 0) { - _vm->_globals._bob[idx].field0 = 11; - } else { - _vm->_globals._bob[idx].field10 = 0; - v21 = _vm->_globals._bob[idx]._animData + 20; - _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); - - if (_vm->_globals._lockedAnims[idx]._enableFl) - _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; - if (PERSO_ON && idx > 20) - _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; - - _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); - _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); - _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); - _vm->_globals._bob[idx]._frameIndex = v21[8]; - _vm->_globals._bob[idx]._modeFlag = v21[9]; - _vm->_globals._bob[idx].field10 += 5; - v10 = _vm->_globals._bob[idx].field12; - - if (v10 > 0) { - v11 = v10 / _vm->_globals._speed; - _vm->_globals._bob[idx].field12 = v10 / _vm->_globals._speed; - // Original code. It can't be negative, so the check is on == 0 - if (v11 <= 0) - _vm->_globals._bob[idx].field12 = 1; - } + _vm->_globals._bob[idx].field12 = 1; + } + if (!_vm->_globals._bob[idx].field12) { + if (_vm->_globals._bob[idx].field20 > 0) + _vm->_globals._bob[idx].field20--; + if (_vm->_globals._bob[idx].field20 != -1 && _vm->_globals._bob[idx].field20 <= 0) { + _vm->_globals._bob[idx].field0 = 11; + } else { + _vm->_globals._bob[idx].field10 = 0; + v21 = _vm->_globals._bob[idx]._animData + 20; + _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); + + if (_vm->_globals._lockedAnims[idx]._enableFl) + _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; + if (PERSO_ON && idx > 20) + _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; + + _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); + _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); + _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); + _vm->_globals._bob[idx]._frameIndex = v21[8]; + _vm->_globals._bob[idx]._modeFlag = v21[9]; + _vm->_globals._bob[idx].field10 += 5; + v10 = _vm->_globals._bob[idx].field12; + + if (v10 > 0) { + v11 = v10 / _vm->_globals._speed; + _vm->_globals._bob[idx].field12 = v10 / _vm->_globals._speed; + // Original code. It can't be negative, so the check is on == 0 + if (v11 <= 0) + _vm->_globals._bob[idx].field12 = 1; } } - - _vm->_globals._bob[idx].field14 = 1; - v12 = idx; - - if (_vm->_globals._bob[v12].field1E == 1 || _vm->_globals._bob[v12].field1E == 2) - _vm->_globals._bob[v12].field1C = true; - continue; } + + _vm->_globals._bob[idx].field14 = 1; + if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) + _vm->_globals._bob[idx].field1C = true; + continue; } while (idx != 35); if (!PERSO_ON && BOBTOUS) { @@ -1440,9 +1430,9 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, _sprite[idx].field14 = a5; _sprite[idx]._rleFl = false; - if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { + if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') _sprite[idx]._rleFl = true; - } + } /** @@ -1486,10 +1476,9 @@ void ObjectsManager::SETTAILLESPR(int idx, int a2) { } void ObjectsManager::setFlipSprite(int idx, bool flip) { - if (!_sprite[idx]._rleFl) { - assert (idx <= MAX_SPRITE); + assert (idx <= MAX_SPRITE); + if (!_sprite[idx]._rleFl) _sprite[idx].fieldE = flip; - } } void ObjectsManager::checkZone() { @@ -1521,79 +1510,70 @@ void ObjectsManager::checkZone() { } v3 = _vm->_globals.compteur_71 + 1; _vm->_globals.compteur_71 = v3; - if (v3 > 1u) { - if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || v3 > 4u) { - _vm->_globals.compteur_71 = 0; - if (_vm->_globals.old_x_69 != v0 || _vm->_globals.old_y_70 != v2) { - v4 = MZONE(); - } else { - v4 = _vm->_globals.old_zone_68; - } - if (_vm->_globals.old_zone_68 != v4) { - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_eventsManager._mouseCursorId = 4; - _vm->_eventsManager.changeMouseCursor(4); - if (_vm->_globals.zozo_73 == 1) { - _vm->_fontManager.hideText(5); - _vm->_globals.zozo_73 = 0; - return; - } - if (_vm->_globals.old_zone_68 != v4) - goto LABEL_54; + + if (v3 <= 1) + return; + + if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || v3 > 4u) { + _vm->_globals.compteur_71 = 0; + if (_vm->_globals.old_x_69 != v0 || _vm->_globals.old_y_70 != v2) { + v4 = MZONE(); + } else { + v4 = _vm->_globals.old_zone_68; + } + if (_vm->_globals.old_zone_68 != v4) { + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_eventsManager._mouseCursorId = 4; + _vm->_eventsManager.changeMouseCursor(4); + if (_vm->_globals.zozo_73 == 1) { + _vm->_fontManager.hideText(5); + _vm->_globals.zozo_73 = 0; + return; } - if (v4 != -1) { -LABEL_54: - if (v4 != -1 - && ((_vm->_globals.ZONEP[v4].field6) - || _vm->_globals.ZONEP[v4].field7 - || _vm->_globals.ZONEP[v4].field8 - || _vm->_globals.ZONEP[v4].field9 - || _vm->_globals.ZONEP[v4].fieldA - || _vm->_globals.ZONEP[v4].fieldB - || _vm->_globals.ZONEP[v4].fieldC - || _vm->_globals.ZONEP[v4].fieldD - || _vm->_globals.ZONEP[v4].fieldE - || _vm->_globals.ZONEP[v4].fieldF)) { - if (_vm->_globals.old_zone_68 != v4) { - _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 20, 25, 0, 0, 252); - _vm->_fontManager.showText(5); - _vm->_globals.zozo_73 = 1; - } - _vm->_globals.force_to_data_0 += 25; - if (_vm->_globals.force_to_data_0 > 100) - _vm->_globals.force_to_data_0 = 0; - _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, - _vm->_globals.force_to_data_0); - if (_vm->_eventsManager._mouseCursorId == 4) { - v1 = 5 * v4; - if (_vm->_globals.ZONEP[v4].field6 == 2) { - _vm->_eventsManager.changeMouseCursor(16); - _vm->_eventsManager._mouseCursorId = 16; - _verb = 16; - } - } - } else { - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_eventsManager._mouseCursorId = 4; - _vm->_eventsManager.changeMouseCursor(4); + } + if (v4 != -1) { + if (_vm->_globals.ZONEP[v4].field6 || _vm->_globals.ZONEP[v4].field7 || + _vm->_globals.ZONEP[v4].field8 || _vm->_globals.ZONEP[v4].field9 || + _vm->_globals.ZONEP[v4].fieldA || _vm->_globals.ZONEP[v4].fieldB || + _vm->_globals.ZONEP[v4].fieldC || _vm->_globals.ZONEP[v4].fieldD || + _vm->_globals.ZONEP[v4].fieldE || _vm->_globals.ZONEP[v4].fieldF) { + if (_vm->_globals.old_zone_68 != v4) { + _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 20, 25, 0, 0, 252); + _vm->_fontManager.showText(5); + _vm->_globals.zozo_73 = 1; } - } - NUMZONE = v4; - _vm->_globals.old_x_69 = v0; - _vm->_globals.old_y_70 = v2; - _vm->_globals.old_zone_68 = v4; - if (_vm->_globals.NOMARCHE) { + _vm->_globals.force_to_data_0 += 25; + if (_vm->_globals.force_to_data_0 > 100) + _vm->_globals.force_to_data_0 = 0; + _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, + _vm->_globals.force_to_data_0); if (_vm->_eventsManager._mouseCursorId == 4) { - v1 = v4 + 1; - if ((uint16)(v4 + 1) > 1u) - handleRightButton(); + v1 = 5 * v4; + if (_vm->_globals.ZONEP[v4].field6 == 2) { + _vm->_eventsManager.changeMouseCursor(16); + _vm->_eventsManager._mouseCursorId = 16; + _verb = 16; + } } + } else { + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_eventsManager._mouseCursorId = 4; + _vm->_eventsManager.changeMouseCursor(4); } - if ((_vm->_globals.PLAN_FLAG && v4 == -1) || !v4) { - _verb = 0; - _vm->_eventsManager._mouseCursorId = 0; - _vm->_eventsManager.changeMouseCursor(0); - } + } + NUMZONE = v4; + _vm->_globals.old_x_69 = v0; + _vm->_globals.old_y_70 = v2; + _vm->_globals.old_zone_68 = v4; + if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) { + v1 = v4 + 1; + if ((uint16)(v4 + 1) > 1u) + handleRightButton(); + } + if ((_vm->_globals.PLAN_FLAG && v4 == -1) || !v4) { + _verb = 0; + _vm->_eventsManager._mouseCursorId = 0; + _vm->_eventsManager.changeMouseCursor(0); } } } @@ -1663,10 +1643,12 @@ void ObjectsManager::GOHOME() { if (_vm->_globals.chemin == (int16 *)g_PTRNUL) return; + if (_vm->_globals.Compteur > 1) { --_vm->_globals.Compteur; return; } + _vm->_globals.Compteur = 0; if (_vm->_globals.g_old_sens == -1) { VERIFTAILLE(); @@ -2069,61 +2051,31 @@ LABEL_153: } if (_vm->_globals.g_old_sens != nouveau_sens) break; - if (nouveau_sens == 3 && nouveau_x >= v0) - v47 = 1; - if (_vm->_globals.g_old_sens == 7 && nouveau_x <= v0) - v47 = 1; - if (_vm->_globals.g_old_sens == 1 && nouveau_y <= v58) - v47 = 1; - if (_vm->_globals.g_old_sens == 5 && nouveau_y >= v58) - v47 = 1; - if (_vm->_globals.g_old_sens == 2 && nouveau_x >= v0) - v47 = 1; - if (_vm->_globals.g_old_sens == 8 && nouveau_x <= v0) - v47 = 1; - if (_vm->_globals.g_old_sens == 4 && nouveau_x >= v0) - v47 = 1; - if (_vm->_globals.g_old_sens == 6 && nouveau_x <= v0) + if ((nouveau_sens == 3 && nouveau_x >= v0) || (_vm->_globals.g_old_sens == 7 && nouveau_x <= v0) || + (_vm->_globals.g_old_sens == 1 && nouveau_y <= v58) || (_vm->_globals.g_old_sens == 5 && nouveau_y >= v58) || + (_vm->_globals.g_old_sens == 2 && nouveau_x >= v0) || (_vm->_globals.g_old_sens == 8 && nouveau_x <= v0) || + (_vm->_globals.g_old_sens == 4 && nouveau_x >= v0) || (_vm->_globals.g_old_sens == 6 && nouveau_x <= v0)) v47 = 1; } while (v47 != 1); if (v47 == 1) { VERIFTAILLE(); - if (_vm->_globals.g_old_sens == 7) + if ((_vm->_globals.g_old_sens == 6) || (_vm->_globals.g_old_sens == 7) || (_vm->_globals.g_old_sens == 8)) setFlipSprite(0, true); - if (_vm->_globals.g_old_sens == 3) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 1) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 5) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 2) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 8) - setFlipSprite(0, true); - if (_vm->_globals.g_old_sens == 4) + + if ((_vm->_globals.g_old_sens == 1) || (_vm->_globals.g_old_sens == 2) || (_vm->_globals.g_old_sens == 3) || + (_vm->_globals.g_old_sens == 4) || (_vm->_globals.g_old_sens == 5)) setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 6) - setFlipSprite(0, true); + setSpriteX(0, nouveau_x); setSpriteY(0, nouveau_y); setSpriteIndex(0, v1); } else { - if (_vm->_globals.g_old_sens == 7) + if ((_vm->_globals.g_old_sens == 6) || (_vm->_globals.g_old_sens == 7) || (_vm->_globals.g_old_sens == 8)) setFlipSprite(0, true); - if (_vm->_globals.g_old_sens == 3) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 1) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 5) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 2) - setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 8) - setFlipSprite(0, true); - if (_vm->_globals.g_old_sens == 4) + + if ((_vm->_globals.g_old_sens == 1) || (_vm->_globals.g_old_sens == 2) || (_vm->_globals.g_old_sens == 3) || + (_vm->_globals.g_old_sens == 4) || (_vm->_globals.g_old_sens == 5)) setFlipSprite(0, false); - if (_vm->_globals.g_old_sens == 6) - setFlipSprite(0, true); _vm->_globals.Compteur = 0; } _vm->_globals.g_old_sens = nouveau_sens; @@ -2136,65 +2088,67 @@ LABEL_153: void ObjectsManager::GOHOME2() { int16 v2; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL) { - int v0 = 2; - if (_vm->_globals._speed == 2) - v0 = 4; - else if (_vm->_globals._speed == 3) - v0 = 6; - _vm->_globals.j_104 = 0; - if (v0) { - for (;;) { - nouveau_x = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - v2 = *_vm->_globals.chemin; - nouveau_y = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - nouveau_sens = *_vm->_globals.chemin; - _vm->_globals.chemin++; - nouveau_anim = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - if (nouveau_x == -1) { - if (v2 == -1) - break; - } - ++_vm->_globals.j_104; - if (_vm->_globals.j_104 >= v0) - goto LABEL_19; + if (_vm->_globals.chemin == (int16 *)g_PTRNUL) + return; + + int v0 = 2; + if (_vm->_globals._speed == 2) + v0 = 4; + else if (_vm->_globals._speed == 3) + v0 = 6; + + _vm->_globals.j_104 = 0; + if (v0) { + for (;;) { + nouveau_x = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + v2 = *_vm->_globals.chemin; + nouveau_y = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_sens = *_vm->_globals.chemin; + _vm->_globals.chemin++; + nouveau_anim = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + if (nouveau_x == -1) { + if (v2 == -1) + break; } - if (_vm->_globals._lastDirection == 1) - setSpriteIndex(0, 0); - if (_vm->_globals._lastDirection == 3) - setSpriteIndex(0, 1); - if (_vm->_globals._lastDirection == 5) - setSpriteIndex(0, 2); - if (_vm->_globals._lastDirection == 7) - setSpriteIndex(0, 3); + ++_vm->_globals.j_104; + if (_vm->_globals.j_104 >= v0) + goto LABEL_19; + } + if (_vm->_globals._lastDirection == 1) + setSpriteIndex(0, 0); + else if (_vm->_globals._lastDirection == 3) + setSpriteIndex(0, 1); + else if (_vm->_globals._lastDirection == 5) + setSpriteIndex(0, 2); + else if (_vm->_globals._lastDirection == 7) + setSpriteIndex(0, 3); - _vm->_globals.chemin = (int16 *)g_PTRNUL; - my_anim = 0; - A_ANIM = 0; - A_DEPA = 0; - } else { + _vm->_globals.chemin = (int16 *)g_PTRNUL; + my_anim = 0; + A_ANIM = 0; + A_DEPA = 0; + } else { LABEL_19: - _vm->_globals._lastDirection = nouveau_sens; - setSpriteX(0, nouveau_x); - setSpriteY(0, nouveau_y); - if (_vm->_globals._lastDirection == 1) - setSpriteIndex(0, 4); - if (_vm->_globals._lastDirection == 3) - setSpriteIndex(0, 5); - if (_vm->_globals._lastDirection == 5) - setSpriteIndex(0, 6); - if (_vm->_globals._lastDirection == 7) - setSpriteIndex(0, 7); - - if (my_anim++ > 1) - my_anim = 0; - } + _vm->_globals._lastDirection = nouveau_sens; + setSpriteX(0, nouveau_x); + setSpriteY(0, nouveau_y); + if (_vm->_globals._lastDirection == 1) + setSpriteIndex(0, 4); + if (_vm->_globals._lastDirection == 3) + setSpriteIndex(0, 5); + if (_vm->_globals._lastDirection == 5) + setSpriteIndex(0, 6); + if (_vm->_globals._lastDirection == 7) + setSpriteIndex(0, 7); + + if (my_anim++ > 1) + my_anim = 0; } } -- cgit v1.2.3 From 583204603bef7e713bc1ee9ea0efbde347c65e44 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Dec 2012 01:54:43 +0100 Subject: HOPKINS: Some more refactoring in ObjectsManager --- engines/hopkins/objects.cpp | 177 ++++++++++++++++++++++---------------------- 1 file changed, 87 insertions(+), 90 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0a2fd37404..04bfee6b09 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2086,8 +2086,6 @@ LABEL_153: } void ObjectsManager::GOHOME2() { - int16 v2; - if (_vm->_globals.chemin == (int16 *)g_PTRNUL) return; @@ -2098,58 +2096,56 @@ void ObjectsManager::GOHOME2() { v0 = 6; _vm->_globals.j_104 = 0; - if (v0) { - for (;;) { - nouveau_x = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - v2 = *_vm->_globals.chemin; - nouveau_y = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - nouveau_sens = *_vm->_globals.chemin; - _vm->_globals.chemin++; - nouveau_anim = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - if (nouveau_x == -1) { - if (v2 == -1) - break; - } - ++_vm->_globals.j_104; - if (_vm->_globals.j_104 >= v0) - goto LABEL_19; - } - if (_vm->_globals._lastDirection == 1) - setSpriteIndex(0, 0); - else if (_vm->_globals._lastDirection == 3) - setSpriteIndex(0, 1); - else if (_vm->_globals._lastDirection == 5) - setSpriteIndex(0, 2); - else if (_vm->_globals._lastDirection == 7) - setSpriteIndex(0, 3); - _vm->_globals.chemin = (int16 *)g_PTRNUL; - my_anim = 0; - A_ANIM = 0; - A_DEPA = 0; - } else { -LABEL_19: - _vm->_globals._lastDirection = nouveau_sens; - setSpriteX(0, nouveau_x); - setSpriteY(0, nouveau_y); - if (_vm->_globals._lastDirection == 1) - setSpriteIndex(0, 4); - if (_vm->_globals._lastDirection == 3) - setSpriteIndex(0, 5); - if (_vm->_globals._lastDirection == 5) - setSpriteIndex(0, 6); - if (_vm->_globals._lastDirection == 7) - setSpriteIndex(0, 7); - - if (my_anim++ > 1) - my_anim = 0; + for (;;) { + nouveau_x = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_y = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_sens = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + nouveau_anim = *_vm->_globals.chemin; + _vm->_globals.chemin++; + + if ((nouveau_x == -1) && (nouveau_y == -1)) + break; + + ++_vm->_globals.j_104; + if (_vm->_globals.j_104 >= v0) { + _vm->_globals._lastDirection = nouveau_sens; + setSpriteX(0, nouveau_x); + setSpriteY(0, nouveau_y); + if (_vm->_globals._lastDirection == 1) + setSpriteIndex(0, 4); + else if (_vm->_globals._lastDirection == 3) + setSpriteIndex(0, 5); + else if (_vm->_globals._lastDirection == 5) + setSpriteIndex(0, 6); + else if (_vm->_globals._lastDirection == 7) + setSpriteIndex(0, 7); + + if (my_anim++ > 1) + my_anim = 0; + + return; + } } + if (_vm->_globals._lastDirection == 1) + setSpriteIndex(0, 0); + else if (_vm->_globals._lastDirection == 3) + setSpriteIndex(0, 1); + else if (_vm->_globals._lastDirection == 5) + setSpriteIndex(0, 2); + else if (_vm->_globals._lastDirection == 7) + setSpriteIndex(0, 3); + + _vm->_globals.chemin = (int16 *)g_PTRNUL; + my_anim = 0; + A_ANIM = 0; + A_DEPA = 0; } // Load Obstacle @@ -2968,50 +2964,51 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { v14 = -1; v2 = a1[1]; v15 = a1[2]; - if (a1[0] != -1 || v2 != -1) { - for (;;) { - if (v14 != -1 && v15 != v14) { - v11 = v1; - v12 = 0; - v10 = CALC_PROPRE(v2); + if (a1[0] == -1 && v2 == -1) + return; + + for (;;) { + if (v14 != -1 && v15 != v14) { + v11 = v1; + v12 = 0; + v10 = CALC_PROPRE(v2); + v4 = a1[v1]; + v9 = a1[v1]; + v5 = a1[v1 + 1]; + v6 = 0; + while (v4 != -1 || v5 != -1) { + int idx = v1; + v1 += 4; + ++v12; + if (a1[idx + 2] != v15) + v6 = 1; + if (v6 == 1) + break; v4 = a1[v1]; v9 = a1[v1]; v5 = a1[v1 + 1]; - v6 = 0; - while (v4 != -1 || v5 != -1) { - int idx = v1; - v1 += 4; - ++v12; - if (a1[idx + 2] != v15) - v6 = 1; - if (v6 == 1) - break; - v4 = a1[v1]; - v9 = a1[v1]; - v5 = a1[v1 + 1]; - } - if (v12 < v10) { - v7 = v11; - for (int v8 = 0; v8 < v12; v8++) { - a1[v7 + 2] = v14; - v7 += 4; - } - v15 = v14; + } + if (v12 < v10) { + v7 = v11; + for (int v8 = 0; v8 < v12; v8++) { + a1[v7 + 2] = v14; + v7 += 4; } - v1 = v11; - if (v9 == -1 && v5 == -1) - v13 = 1; + v15 = v14; } - v1 += 4; - if (v13 == 1) + v1 = v11; + if (v9 == -1 && v5 == -1) + v13 = 1; + } + v1 += 4; + if (v13 == 1) + break; + v14 = v15; + v2 = a1[v1 + 1]; + v15 = a1[v1 + 2]; + if (a1[v1] == -1) { + if (v2 == -1) break; - v14 = v15; - v2 = a1[v1 + 1]; - v15 = a1[v1 + 2]; - if (a1[v1] == -1) { - if (v2 == -1) - break; - } } } } -- cgit v1.2.3 From aedb1609c6a1bbcadf57fe402f0cd621351c51bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Dec 2012 14:28:24 +0100 Subject: HOPKINS: Remove redrawAnim() and all associated code --- engines/hopkins/anim.cpp | 85 +++------------------------------------------ engines/hopkins/anim.h | 1 - engines/hopkins/globals.cpp | 71 ++++++++++++++++++------------------- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 2 +- 5 files changed, 42 insertions(+), 119 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 5c02b21b91..ad967087f3 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -298,8 +298,6 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint for (;;) { if (_vm->_eventsManager._escKeyFl) goto LABEL_114; - if (redrawAnim()) - break; _vm->_eventsManager.refreshEvents(); if (_vm->_eventsManager._rateCounter >= a2) goto LABEL_48; @@ -333,7 +331,6 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } -LABEL_112: _vm->_graphicsManager.unlockScreen(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.FADE_INS(); @@ -377,38 +374,6 @@ LABEL_88: if (v5 == -1) { if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl) { - if (redrawAnim()) { - if (_vm->_graphicsManager._skipVideoLockFl) - goto LABEL_114; - if (v8 == 1) - ptr = _vm->_globals.freeMemory(ptr); - _vm->_globals.freeMemory(v13); - f.close(); - - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); - g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); - _vm->_graphicsManager.clearPalette(); - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.clearScreen(); - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.scrollScreen(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN) { - _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager.max_x = 1280; - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } else { - _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.clearScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - goto LABEL_112; - } _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); if (_vm->_eventsManager._rateCounter >= a4) @@ -419,38 +384,6 @@ LABEL_88: } } while (!_vm->_eventsManager._escKeyFl) { - if (redrawAnim()) { - if (_vm->_graphicsManager._skipVideoLockFl) - break; - if (v8 == 1) - ptr = _vm->_globals.freeMemory(ptr); - _vm->_globals.freeMemory(v13); - f.close(); - - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); - g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); - _vm->_graphicsManager.clearPalette(); - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.clearScreen(); - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.scrollScreen(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN) { - _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager.max_x = 1280; - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } else { - _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.clearScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - goto LABEL_112; - } _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); if (_vm->_eventsManager._rateCounter >= a3) @@ -533,10 +466,6 @@ LABEL_114: _vm->_graphicsManager.DD_VBL(); } -bool AnimationManager::redrawAnim() { - return false; -} - /** * Load Animation */ @@ -1013,14 +942,11 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u while (!_vm->shouldQuit()) { if (_vm->_eventsManager._escKeyFl) goto LABEL_54; - if (redrawAnim()) - break; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); if (_vm->_eventsManager._rateCounter >= rate1) goto LABEL_23; } -LABEL_48: if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_54; if (v7 == 1) @@ -1064,15 +990,14 @@ LABEL_44: if (v4) { if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl) { - if (redrawAnim()) - goto LABEL_48; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.VERIF_SOUND(); - if (_vm->_eventsManager._rateCounter >= rate3) - goto LABEL_53; + if (_vm->_eventsManager._rateCounter >= rate3) { + _vm->_eventsManager._rateCounter = 0; + break; + } } } else { -LABEL_53: _vm->_eventsManager._rateCounter = 0; } goto LABEL_54; @@ -1080,8 +1005,6 @@ LABEL_53: } while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); - if (redrawAnim()) - goto LABEL_48; if (_vm->_eventsManager._rateCounter >= rate2) goto LABEL_33; } diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 1c7c97b89f..181a0cf327 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -46,7 +46,6 @@ public: void playAnim(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); void playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); - bool redrawAnim(); void loadAnim(const Common::String &animName); void clearAnim(); void searchAnim(const byte *data, int animIndex, int count); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index d3eeaf8071..bc22e42fb5 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -82,10 +82,10 @@ Globals::Globals() { Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0); for (int i = 0; i < 35; ++i) Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(Liste2Item), 0); - for (int i = 0; i < 30; ++i) + for (int i = 0; i < 30; ++i) { Common::fill((byte *)&_lockedAnims[i], (byte *)&_lockedAnims[i] + sizeof(LockAnimItem), 0); - for (int i = 0; i < 30; ++i) Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0); + } for (int i = 0; i < 300; ++i) Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0); for (int i = 0; i < 250; ++i) @@ -225,7 +225,7 @@ Globals::Globals() { NOMARCHE = false; NO_VISU = false; _optionDialogFl = false; - CACHEFLAG = false; + _cacheFl = false; NOPARLE = false; couleur_40 = 50; @@ -521,16 +521,16 @@ void Globals::RESET_CACHE() { Cache[idx].field14 = 0; } - CACHEFLAG = false; + _cacheFl = false; } void Globals::CACHE_ON() { - CACHEFLAG = true; + _cacheFl = true; } // TODO: Find why some calls have a parameter value void Globals::CACHE_OFF(int v1) { - CACHEFLAG = false; + _cacheFl = false; } void Globals::CACHE_SUB(int idx) { @@ -556,37 +556,38 @@ void Globals::loadCache(const Common::String &file) { _vm->_fileManager.constructFilename(HOPLINK, v16); - if (f.exists(_curFilename)) { - spriteData = _vm->_fileManager.loadFile(_curFilename); - CACHE_BANQUE[1] = spriteData; - int v15 = 60; - for (int i = 0; i <= 21; i++) { - int v11 = (int16)READ_LE_UINT16((uint16 *)ptr + v15); - int v4 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); - int v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); - int v6 = i; - Cache[v6].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); - Cache[v6]._spriteIndex = v11; - Cache[v6]._x = v4; - Cache[v6]._y = v5; - if (spriteData == g_PTRNUL) { - Cache[i].fieldA = 0; - } else { - int v8 = _vm->_objectsManager.getWidth(spriteData, v11); - int v9 = _vm->_objectsManager.getHeight(spriteData, v11); - Cache[i]._spriteData = spriteData; - Cache[i]._width = v8; - Cache[i]._height = v9; - Cache[i].fieldA = 1; - } - - if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) - Cache[i].fieldA = 0; - v15 += 5; + if (!f.exists(_curFilename)) + return; + + spriteData = _vm->_fileManager.loadFile(_curFilename); + CACHE_BANQUE[1] = spriteData; + int v15 = 60; + for (int i = 0; i <= 21; i++) { + int v11 = (int16)READ_LE_UINT16((uint16 *)ptr + v15); + int v4 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); + int v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); + int v6 = i; + Cache[v6].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); + Cache[v6]._spriteIndex = v11; + Cache[v6]._x = v4; + Cache[v6]._y = v5; + if (spriteData == g_PTRNUL) { + Cache[i].fieldA = 0; + } else { + int v8 = _vm->_objectsManager.getWidth(spriteData, v11); + int v9 = _vm->_objectsManager.getHeight(spriteData, v11); + Cache[i]._spriteData = spriteData; + Cache[i]._width = v8; + Cache[i]._height = v9; + Cache[i].fieldA = 1; } - CACHE_ON(); - v2 = ptr; + + if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) + Cache[i].fieldA = 0; + v15 += 5; } + CACHE_ON(); + v2 = ptr; freeMemory(v2); } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index db51f8aa73..af039bdf1f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -427,7 +427,7 @@ public: bool AFFLI; // CHECKME: Useless variable? bool AFFIVBL; // CHECKME: Useless variable? int NOT_VERIF; - bool CACHEFLAG; + bool _cacheFl; bool NOPARLE; bool PLAN_FLAG; bool NECESSAIRE; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 04bfee6b09..81b68c8207 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -398,7 +398,7 @@ void ObjectsManager::displaySprite() { } } - if (_vm->_globals.CACHEFLAG) + if (_vm->_globals._cacheFl) VERIFCACHE(); } -- cgit v1.2.3 From ad360142c11b4f700b0bbf74d68cdaa9708fd9f1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Dec 2012 14:48:38 +0100 Subject: HOPKINS: Some refactoring in ComputerManager --- engines/hopkins/computer.cpp | 104 +++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 58 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 7513902fd3..52ca3af693 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -263,7 +263,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_graphicsManager.DD_VBL(); restoreFBIRoom(); } else { - // Access Denied + // Password doesn't match - Access Denied setTextColor(4); setTextPosition(16, 25); outText(Common::String(_menuText[5]._line)); @@ -301,24 +301,22 @@ void ComputerManager::loadMenu() { if (tmpPtr[0] == '%') { if (tmpPtr[1] == '%') { loopCond = true; - goto LABEL_13; + break; } _menuText[lineNum]._actvFl = 1; strPos = 0; - for (;;) { + while (strPos <= 89) { byte curChar = tmpPtr[strPos + 2]; if (curChar == '%' || curChar == 10) break; _menuText[lineNum]._line[strPos++] = curChar; - if (strPos > 89) - goto LABEL_11; } - _menuText[lineNum]._line[strPos] = 0; - _menuText[lineNum]._lineSize = strPos - 1; - LABEL_11: + if (strPos <= 89) { + _menuText[lineNum]._line[strPos] = 0; + _menuText[lineNum]._lineSize = strPos - 1; + } ++lineNum; } - LABEL_13: tmpPtr = tmpPtr + 1; } while (!loopCond); ptr = _vm->_globals.freeMemory(ptr); @@ -737,27 +735,16 @@ void ComputerManager::displayBricks() { * Display Lives in breakout game */ void ComputerManager::displayLives() { - int v3; - int v4; - - int v0 = _breakoutLives - 1; - int v1 = 10; - + int xp = 10; for (int i = 0; i <= 11; i++) { - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v1, 10, 15); - v1 += 7; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 10, 15); + xp += 7; } - if (v0) { - v3 = 10; - v4 = 0; - if (v0 > 0) { - do { - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v3, 10, 14); - v3 += 7; - ++v4; - } while (v4 < v0); - } + xp = 10; + for (int i = 0; i < _breakoutLives - 1; i++) { + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 10, 14); + xp += 7; } } @@ -974,40 +961,41 @@ void ComputerManager::displayScore() { } void ComputerManager::IMPSCORE(int a1, int a2) { - int16 v2 = 203; - int16 v3 = 3; + int16 xp = 203; + int16 idx = 3; if (a1 == 1) - v2 = 193; - if (a1 == 2) - v2 = 183; - if (a1 == 3) - v2 = 170; - if (a1 == 4) - v2 = 160; - if (a1 == 5) - v2 = 150; - if (a1 == 9) - v2 = 137; + xp = 193; + else if (a1 == 2) + xp = 183; + else if (a1 == 3) + xp = 170; + else if (a1 == 4) + xp = 160; + else if (a1 == 5) + xp = 150; + else if (a1 == 9) + xp = 137; + if (a2 == 49) - v3 = 4; - if (a2 == 50) - v3 = 5; - if (a2 == 51) - v3 = 6; - if (a2 == 52) - v3 = 7; - if (a2 == 53) - v3 = 8; - if (a2 == 54) - v3 = 9; - if (a2 == 55) - v3 = 10; - if (a2 == 56) - v3 = 11; - if (a2 == 57) - v3 = 12; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v2 - 3, 11, v3); + idx = 4; + else if (a2 == 50) + idx = 5; + else if (a2 == 51) + idx = 6; + else if (a2 == 52) + idx = 7; + else if (a2 == 53) + idx = 8; + else if (a2 == 54) + idx = 9; + else if (a2 == 55) + idx = 10; + else if (a2 == 56) + idx = 11; + else if (a2 == 57) + idx = 12; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp - 3, 11, idx); } /** -- cgit v1.2.3 From 3629fd80837035f01dbc475593d97593adee7461 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Dec 2012 18:51:47 +0100 Subject: HOPKINS: More renaming, some refactoring in DialogsManager --- engines/hopkins/dialogs.cpp | 559 +++++++++++++++++++++---------------------- engines/hopkins/events.cpp | 4 +- engines/hopkins/globals.cpp | 16 +- engines/hopkins/globals.h | 16 +- engines/hopkins/graphics.cpp | 4 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/objects.cpp | 18 +- 7 files changed, 309 insertions(+), 310 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 2899cb030f..c5126527d2 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -189,99 +189,101 @@ void DialogsManager::showOptionsDialog() { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) doneFlag = true; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { - switch (_vm->_graphicsManager.SPEED_SCROLL) { + switch (_vm->_graphicsManager._scrollSpeed) { case 1: - _vm->_graphicsManager.SPEED_SCROLL = 2; + _vm->_graphicsManager._scrollSpeed = 2; break; case 2: - _vm->_graphicsManager.SPEED_SCROLL = 4; + _vm->_graphicsManager._scrollSpeed = 4; break; case 4: - _vm->_graphicsManager.SPEED_SCROLL = 8; + _vm->_graphicsManager._scrollSpeed = 8; break; case 8: - _vm->_graphicsManager.SPEED_SCROLL = 16; + _vm->_graphicsManager._scrollSpeed = 16; break; case 16: - _vm->_graphicsManager.SPEED_SCROLL = 32; + _vm->_graphicsManager._scrollSpeed = 32; break; case 32: - _vm->_graphicsManager.SPEED_SCROLL = 48; + _vm->_graphicsManager._scrollSpeed = 48; break; case 48: - _vm->_graphicsManager.SPEED_SCROLL = 64; + _vm->_graphicsManager._scrollSpeed = 64; break; case 64: - _vm->_graphicsManager.SPEED_SCROLL = 128; + _vm->_graphicsManager._scrollSpeed = 128; break; case 128: - _vm->_graphicsManager.SPEED_SCROLL = 160; + _vm->_graphicsManager._scrollSpeed = 160; break; case 160: - _vm->_graphicsManager.SPEED_SCROLL = 320; + _vm->_graphicsManager._scrollSpeed = 320; break; case 320: - _vm->_graphicsManager.SPEED_SCROLL = 1; + _vm->_graphicsManager._scrollSpeed = 1; break; } } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) - _vm->_globals._speed = 2; - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) - _vm->_globals.SVGA = 2; + // Values are blocked, thus handling the zone is useless + //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) + // _vm->_globals._speed = 2; + //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) + // _vm->_globals.SVGA = 2; + if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 211) doneFlag = true; } if (_vm->_graphicsManager.MANU_SCROLL) - _vm->_globals.opt_scrtype = 1; + _vm->_globals._menuScrollType = 1; else - _vm->_globals.opt_scrtype = 2; + _vm->_globals._menuScrollType = 2; if (_vm->_globals._speed == 1) - _vm->_globals.opt_vitesse = 6; + _vm->_globals._menuSpeed = 6; else if (_vm->_globals._speed == 2) - _vm->_globals.opt_vitesse = 5; + _vm->_globals._menuSpeed = 5; else if (_vm->_globals._speed == 3) - _vm->_globals.opt_vitesse = 4; + _vm->_globals._menuSpeed = 4; - _vm->_globals.opt_txt = !_vm->_soundManager._textOffFl ? 7 : 8; - _vm->_globals.opt_voice = !_vm->_soundManager._voiceOffFl ? 7 : 8; - _vm->_globals.opt_sound = !_vm->_soundManager._soundOffFl ? 7 : 8; - _vm->_globals.opt_music = !_vm->_soundManager._musicOffFl ? 7 : 8; + _vm->_globals._menuTextOff = !_vm->_soundManager._textOffFl ? 7 : 8; + _vm->_globals._menuVoiceOff = !_vm->_soundManager._voiceOffFl ? 7 : 8; + _vm->_globals._menuSoundOff = !_vm->_soundManager._soundOffFl ? 7 : 8; + _vm->_globals._menuMusicOff = !_vm->_soundManager._musicOffFl ? 7 : 8; if (_vm->_globals.SVGA == 1) - _vm->_globals.opt_anm = 10; + _vm->_globals._menuDisplayType = 10; else if (_vm->_globals.SVGA == 2) - _vm->_globals.opt_anm = 9; + _vm->_globals._menuDisplayType = 9; else if (_vm->_globals.SVGA == 3) - _vm->_globals.opt_anm = 11; - - if (_vm->_graphicsManager.SPEED_SCROLL == 1) - _vm->_globals.opt_scrspeed = 12; - else if (_vm->_graphicsManager.SPEED_SCROLL == 2) - _vm->_globals.opt_scrspeed = 13; - else if (_vm->_graphicsManager.SPEED_SCROLL == 4) - _vm->_globals.opt_scrspeed = 14; - else if (_vm->_graphicsManager.SPEED_SCROLL == 8) - _vm->_globals.opt_scrspeed = 15; - else if (_vm->_graphicsManager.SPEED_SCROLL == 16) - _vm->_globals.opt_scrspeed = 16; - else if (_vm->_graphicsManager.SPEED_SCROLL == 32) - _vm->_globals.opt_scrspeed = 17; - else if (_vm->_graphicsManager.SPEED_SCROLL == 48) - _vm->_globals.opt_scrspeed = 18; - else if (_vm->_graphicsManager.SPEED_SCROLL == 64) - _vm->_globals.opt_scrspeed = 19; - else if (_vm->_graphicsManager.SPEED_SCROLL == 128) - _vm->_globals.opt_scrspeed = 20; - else if (_vm->_graphicsManager.SPEED_SCROLL == 160) - _vm->_globals.opt_scrspeed = 21; - else if (_vm->_graphicsManager.SPEED_SCROLL == 320) - _vm->_globals.opt_scrspeed = 22; - else if (_vm->_graphicsManager.SPEED_SCROLL == 640) - _vm->_globals.opt_scrspeed = 23; + _vm->_globals._menuDisplayType = 11; + + if (_vm->_graphicsManager._scrollSpeed == 1) + _vm->_globals._menuScrollSpeed = 12; + else if (_vm->_graphicsManager._scrollSpeed == 2) + _vm->_globals._menuScrollSpeed = 13; + else if (_vm->_graphicsManager._scrollSpeed == 4) + _vm->_globals._menuScrollSpeed = 14; + else if (_vm->_graphicsManager._scrollSpeed == 8) + _vm->_globals._menuScrollSpeed = 15; + else if (_vm->_graphicsManager._scrollSpeed == 16) + _vm->_globals._menuScrollSpeed = 16; + else if (_vm->_graphicsManager._scrollSpeed == 32) + _vm->_globals._menuScrollSpeed = 17; + else if (_vm->_graphicsManager._scrollSpeed == 48) + _vm->_globals._menuScrollSpeed = 18; + else if (_vm->_graphicsManager._scrollSpeed == 64) + _vm->_globals._menuScrollSpeed = 19; + else if (_vm->_graphicsManager._scrollSpeed == 128) + _vm->_globals._menuScrollSpeed = 20; + else if (_vm->_graphicsManager._scrollSpeed == 160) + _vm->_globals._menuScrollSpeed = 21; + else if (_vm->_graphicsManager._scrollSpeed == 320) + _vm->_globals._menuScrollSpeed = 22; + else if (_vm->_graphicsManager._scrollSpeed == 640) + _vm->_globals._menuScrollSpeed = 23; _vm->_eventsManager.VBL(); } while (!doneFlag); @@ -296,214 +298,216 @@ void DialogsManager::showOptionsDialog() { } void DialogsManager::showInventory() { - if (!_removeInventFl && !_inventDisplayedFl && !_vm->_globals._disableInventFl) { - _vm->_graphicsManager.no_scroll = 1; - _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; - _vm->_objectsManager._visibleFl = false; - for (int v1 = 0; v1 <= 1; v1++) { - inventAnim(); - _vm->_eventsManager.getMouseX(); - _vm->_eventsManager.getMouseY(); - _vm->_eventsManager.VBL(); - } - _vm->_dialogsManager._inventWin1 = g_PTRNUL; + if (_removeInventFl || _inventDisplayedFl || _vm->_globals._disableInventFl) + return; + + _vm->_graphicsManager.no_scroll = 1; + _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; + _vm->_objectsManager._visibleFl = false; + for (int v1 = 0; v1 <= 1; v1++) { + inventAnim(); + _vm->_eventsManager.getMouseX(); + _vm->_eventsManager.getMouseY(); + _vm->_eventsManager.VBL(); + } + _vm->_dialogsManager._inventWin1 = g_PTRNUL; LABEL_7: - _vm->_eventsManager._curMouseButton = 0; - _vm->_eventsManager._mouseButton = 0; - _vm->_globals._disableInventFl = true; - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - - switch (_vm->_globals._language) { - case LANG_EN: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTAN.SPR"); - break; - case LANG_FR: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTFR.SPR"); - break; - case LANG_SP: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTES.SPR"); - break; - } + _vm->_eventsManager._curMouseButton = 0; + _vm->_eventsManager._mouseButton = 0; + _vm->_globals._disableInventFl = true; + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - Common::File f; - if (!f.open(_vm->_globals._curFilename)) - error("Error opening file - %s", _vm->_globals._curFilename.c_str()); - - size_t filesize = f.size(); - _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); - _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); - f.close(); - - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); - _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - - int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; - _inventY = 114; - int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); - int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, - v19 + 300, 414, 0, 0, 0, 0); - int v15 = 0; - int v4 = 0; - for (int v14 = 1; v14 <= 5; v14++) { - int v16 = 0; - for (int v5 = 1; v5 <= 6; v5++) { - ++v4; - int v6 = _vm->_globals._inventory[v4]; - if (v6 && v4 <= 29) { - byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, - v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); - _vm->_globals.freeMemory(v7); - } - v16 += 54; - }; - v15 += 38; - } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); - _vm->_eventsManager._curMouseButton = 0; - bool v20 = false; - int v13 = 0; - - // Main loop to select an inventory item - while (!_vm->shouldQuit()) { - // Turn on drawing the inventory dialog in the event manager - _inventDisplayedFl = true; - - int v8 = _vm->_eventsManager.getMouseX(); - int v9 = _vm->_eventsManager.getMouseY(); - int v12 = _vm->_eventsManager.getMouseButton(); - int v10 = v13; - int v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); - v13 = v11; - if (v11 != v10) - _vm->_objectsManager.initBorder(v11); - if (_vm->_eventsManager._mouseCursorId != 16) { - if ((uint16)(_vm->_eventsManager._mouseCursorId - 1) > 1u) { - if (_vm->_eventsManager._mouseCursorId != 3) { - if (v12 == 2) { - _vm->_objectsManager.OBJETPLUS(v13); - if (_vm->_eventsManager._mouseCursorId != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); - } + switch (_vm->_globals._language) { + case LANG_EN: + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTAN.SPR"); + break; + case LANG_FR: + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTFR.SPR"); + break; + case LANG_SP: + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTES.SPR"); + break; + } + + Common::File f; + if (!f.open(_vm->_globals._curFilename)) + error("Error opening file - %s", _vm->_globals._curFilename.c_str()); + + size_t filesize = f.size(); + _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); + _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); + f.close(); + + _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); + _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + + int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; + _inventY = 114; + int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); + int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); + + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, + v19 + 300, 414, 0, 0, 0, 0); + int v15 = 0; + int v4 = 0; + for (int v14 = 1; v14 <= 5; v14++) { + int v16 = 0; + for (int v5 = 1; v5 <= 6; v5++) { + ++v4; + int v6 = _vm->_globals._inventory[v4]; + if (v6 && v4 <= 29) { + byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, + v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); + _vm->_globals.freeMemory(v7); + } + v16 += 54; + }; + v15 += 38; + } + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); + _vm->_eventsManager._curMouseButton = 0; + bool v20 = false; + int v13 = 0; + + // Main loop to select an inventory item + while (!_vm->shouldQuit()) { + // Turn on drawing the inventory dialog in the event manager + _inventDisplayedFl = true; + + int v8 = _vm->_eventsManager.getMouseX(); + int v9 = _vm->_eventsManager.getMouseY(); + int v12 = _vm->_eventsManager.getMouseButton(); + int v10 = v13; + int v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); + v13 = v11; + if (v11 != v10) + _vm->_objectsManager.initBorder(v11); + if (_vm->_eventsManager._mouseCursorId != 16) { + if ((uint16)(_vm->_eventsManager._mouseCursorId - 1) > 1u) { + if (_vm->_eventsManager._mouseCursorId != 3) { + if (v12 == 2) { + _vm->_objectsManager.OBJETPLUS(v13); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); } } } - if (v12 == 1) { - if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) - break; - v9 = v13; - _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); - if (_vm->_eventsManager._mouseCursorId == 8) - v20 = true; - if (!v20) { - _vm->_scriptManager.TRAVAILOBJET = true; - _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; - _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[v13]; - _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; - _vm->_objectsManager.OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = false; - - if (_vm->_soundManager._voiceOffFl) { - do - _vm->_eventsManager.VBL(); - while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); - _vm->_fontManager.hideText(9); - } - if (_vm->_globals._exitId) { - if (_vm->_globals._exitId == 2) - v20 = true; - _vm->_globals._exitId = 0; - if (!v20) { - _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); - _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); - goto LABEL_7; - } - } else if (!v20) { - _inventDisplayedFl = true; + } + if (v12 == 1) { + if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) + break; + v9 = v13; + _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); + if (_vm->_eventsManager._mouseCursorId == 8) + v20 = true; + if (!v20) { + _vm->_scriptManager.TRAVAILOBJET = true; + _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[v13]; + _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; + _vm->_objectsManager.OPTI_OBJET(); + _vm->_scriptManager.TRAVAILOBJET = false; + + if (_vm->_soundManager._voiceOffFl) { + do + _vm->_eventsManager.VBL(); + while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); + _vm->_fontManager.hideText(9); + } + if (_vm->_globals._exitId) { + if (_vm->_globals._exitId == 2) + v20 = true; + _vm->_globals._exitId = 0; + if (!v20) { + _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); + _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + goto LABEL_7; } + } else if (!v20) { + _inventDisplayedFl = true; } } - if (_removeInventFl) - v20 = true; - if (v20) - break; - _vm->_eventsManager.VBL(); - if ((uint16)(_vm->_globals._screenId - 35) <= 5u) - _vm->_objectsManager.SPECIAL_JEU(); } - _vm->_fontManager.hideText(9); - if (_inventDisplayedFl) { - _inventDisplayedFl = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, v19, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, v19, 114); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); - _vm->_objectsManager.BOBTOUS = true; - } - - _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); - _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); - - if (_vm->_eventsManager._mouseCursorId == 1) - showOptionsDialog(); - else if (_vm->_eventsManager._mouseCursorId == 3) - _vm->_dialogsManager.showLoadGame(); - else if (_vm->_eventsManager._mouseCursorId == 2) - _vm->_dialogsManager.showSaveGame(); - - _vm->_eventsManager._mouseCursorId = 4; - _vm->_eventsManager.changeMouseCursor(4); - _vm->_objectsManager._oldBorderPos = Common::Point(0, 0); - _vm->_objectsManager._borderPos = Common::Point(0, 0); - _vm->_globals._disableInventFl = false; - _vm->_graphicsManager.no_scroll = 0; + if (_removeInventFl) + v20 = true; + if (v20) + break; + _vm->_eventsManager.VBL(); + if ((uint16)(_vm->_globals._screenId - 35) <= 5u) + _vm->_objectsManager.SPECIAL_JEU(); } + _vm->_fontManager.hideText(9); + if (_inventDisplayedFl) { + _inventDisplayedFl = false; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, v19, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, v19, 114); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); + _vm->_objectsManager.BOBTOUS = true; + } + + _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); + + if (_vm->_eventsManager._mouseCursorId == 1) + showOptionsDialog(); + else if (_vm->_eventsManager._mouseCursorId == 3) + _vm->_dialogsManager.showLoadGame(); + else if (_vm->_eventsManager._mouseCursorId == 2) + _vm->_dialogsManager.showSaveGame(); + + _vm->_eventsManager._mouseCursorId = 4; + _vm->_eventsManager.changeMouseCursor(4); + _vm->_objectsManager._oldBorderPos = Common::Point(0, 0); + _vm->_objectsManager._borderPos = Common::Point(0, 0); + _vm->_globals._disableInventFl = false; + _vm->_graphicsManager.no_scroll = 0; } /** * Inventory Animations */ void DialogsManager::inventAnim() { - if (!_vm->_globals._disableInventFl) { - if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, - _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; - } + if (_vm->_globals._disableInventFl) + return; + + if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; + } - if (_vm->_objectsManager._visibleFl) { - if (_vm->_objectsManager.I_old_x <= 1) - _vm->_objectsManager.I_old_x = 2; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, - _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); - - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - int v0 = _vm->_graphicsManager.ofscroll + 2; - int v1 = _vm->_graphicsManager.ofscroll + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); - _vm->_objectsManager.I_old_x = v0; - } + if (_vm->_objectsManager._visibleFl) { + if (_vm->_objectsManager.I_old_x <= 1) + _vm->_objectsManager.I_old_x = 2; + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); + + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + int v0 = _vm->_graphicsManager.ofscroll + 2; + int v1 = _vm->_graphicsManager.ofscroll + 2; + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); + _vm->_objectsManager.I_old_x = v0; + } - if (_vm->_globals._saveData->data[svField357] == 1) { - if (_vm->_globals._saveData->data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - if (_vm->_globals._saveData->data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); - } - if (_vm->_globals._saveData->data[svField356] == 1) { + if (_vm->_globals._saveData->data[svField357] == 1) { + if (_vm->_globals._saveData->data[svField353] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - } + if (_vm->_globals._saveData->data[svField355] == 1) + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); + } + if (_vm->_globals._saveData->data[svField356] == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + } - if (_vm->_globals._saveData->data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - } + if (_vm->_globals._saveData->data[svField354] == 1) { + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); } } @@ -514,39 +518,38 @@ void DialogsManager::testDialogOpening() { if (_vm->_globals.PLAN_FLAG) _vm->_eventsManager._gameKey = KEY_NONE; - if (_vm->_eventsManager._gameKey != KEY_NONE) { - if (!_inventFl) { - DIALOG_KEY key = _vm->_eventsManager._gameKey; - _vm->_eventsManager._gameKey = KEY_NONE; - _inventFl = true; + if ((_vm->_eventsManager._gameKey == KEY_NONE) || _inventFl) + return; - switch (key) { - case KEY_INVENTORY: - _vm->_dialogsManager.showInventory(); - break; - case KEY_OPTIONS: - _vm->_graphicsManager.no_scroll = 1; - _vm->_dialogsManager.showOptionsDialog(); - _vm->_graphicsManager.no_scroll = 0; - break; - case KEY_LOAD: - _vm->_graphicsManager.no_scroll = 1; - _vm->_dialogsManager.showLoadGame(); - _vm->_graphicsManager.no_scroll = 0; - break; - case KEY_SAVE: - _vm->_graphicsManager.no_scroll = 1; - _vm->_dialogsManager.showSaveGame(); - _vm->_graphicsManager.no_scroll = 0; - break; - default: - break; - } + DIALOG_KEY key = _vm->_eventsManager._gameKey; + _vm->_eventsManager._gameKey = KEY_NONE; + _inventFl = true; - _inventFl = false; - _vm->_eventsManager._gameKey = KEY_NONE; - } + switch (key) { + case KEY_INVENTORY: + _vm->_dialogsManager.showInventory(); + break; + case KEY_OPTIONS: + _vm->_graphicsManager.no_scroll = 1; + _vm->_dialogsManager.showOptionsDialog(); + _vm->_graphicsManager.no_scroll = 0; + break; + case KEY_LOAD: + _vm->_graphicsManager.no_scroll = 1; + _vm->_dialogsManager.showLoadGame(); + _vm->_graphicsManager.no_scroll = 0; + break; + case KEY_SAVE: + _vm->_graphicsManager.no_scroll = 1; + _vm->_dialogsManager.showSaveGame(); + _vm->_graphicsManager.no_scroll = 0; + break; + default: + break; } + + _inventFl = false; + _vm->_eventsManager._gameKey = KEY_NONE; } /** @@ -558,11 +561,9 @@ void DialogsManager::showLoadGame() { _vm->_eventsManager.VBL(); showSaveLoad(2); do { - do { - slotNumber = searchSavegames(); - _vm->_eventsManager.VBL(); - } while (_vm->_eventsManager.getMouseButton() != 1); - } while (!slotNumber); + slotNumber = searchSavegames(); + _vm->_eventsManager.VBL(); + } while (!_vm->shouldQuit() && (!slotNumber || _vm->_eventsManager.getMouseButton() != 1)); _vm->_objectsManager.SL_FLAG = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); @@ -590,11 +591,9 @@ void DialogsManager::showSaveGame() { showSaveLoad(1); do { - do { - slotNumber = searchSavegames(); - _vm->_eventsManager.VBL(); - } while (!_vm->shouldQuit() && _vm->_eventsManager.getMouseButton() != 1); - } while (!_vm->shouldQuit() && !slotNumber); + slotNumber = searchSavegames(); + _vm->_eventsManager.VBL(); + } while (!_vm->shouldQuit() && (!slotNumber || _vm->_eventsManager.getMouseButton() != 1)); _vm->_objectsManager.SL_FLAG = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 702da52a42..e76d71d62b 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -436,9 +436,9 @@ LABEL_65: } else { if (_vm->_graphicsManager.no_scroll != 2) { if (getMouseX() > _vm->_graphicsManager.SCROLL + 620) - _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; + _vm->_graphicsManager.SCROLL += _vm->_graphicsManager._scrollSpeed; if (getMouseX() < _vm->_graphicsManager.SCROLL + 10) - _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager._scrollSpeed; } if (_vm->_graphicsManager.SCROLL < 0) _vm->_graphicsManager.SCROLL = 0; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index bc22e42fb5..b33651fc16 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -156,14 +156,14 @@ Globals::Globals() { Max_Propre = 0; fmusic = 0; NBBLOC = 0; - opt_scrtype = 0; - opt_scrspeed = 0; - opt_vitesse = 0; - opt_sound = 0; - opt_voice = 0; - opt_music = 0; - opt_txt = 0; - opt_anm = 0; + _menuScrollType = 0; + _menuScrollSpeed = 0; + _menuSpeed = 0; + _menuSoundOff = 0; + _menuVoiceOff = 0; + _menuMusicOff = 0; + _menuTextOff = 0; + _menuDisplayType = 0; NBTRI = 0; AFFLI = false; AFFIVBL = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index af039bdf1f..b6b1a9a513 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -415,14 +415,14 @@ public: bool NO_VISU; byte *OPTION_SPR; bool _optionDialogFl; - int opt_anm; - int opt_vitesse; - int opt_scrtype; - int opt_scrspeed; - int opt_sound; - int opt_voice; - int opt_music; - int opt_txt; + int _menuDisplayType; + int _menuSpeed; + int _menuScrollType; + int _menuScrollSpeed; + int _menuSoundOff; + int _menuVoiceOff; + int _menuMusicOff; + int _menuTextOff; int NBTRI; bool AFFLI; // CHECKME: Useless variable? bool AFFIVBL; // CHECKME: Useless variable? diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 455c3c41b9..abe2abe85b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -89,10 +89,10 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { MANU_SCROLL = true; else MANU_SCROLL = false; - SPEED_SCROLL = 16; + _scrollSpeed = 16; } else { MANU_SCROLL = false; - SPEED_SCROLL = 32; + _scrollSpeed = 32; } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 1ad0fae97c..e239344b46 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -74,7 +74,7 @@ public: bool DOUBLE_ECRAN; int OLD_SCROLL; bool MANU_SCROLL; - int SPEED_SCROLL; + int _scrollSpeed; int _lineNbr2; int Agr_x, Agr_y; int Agr_Flag_x, Agr_Flag_y; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 81b68c8207..cc52a17eb4 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -488,19 +488,19 @@ void ObjectsManager::displaySprite() { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 464, 407, 0); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 657, 556, _vm->_globals.opt_vitesse); + _vm->_eventsManager._startPos.x + 657, 556, _vm->_globals._menuSpeed); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 731, 495, _vm->_globals.opt_txt); + _vm->_eventsManager._startPos.x + 731, 495, _vm->_globals._menuTextOff); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 731, 468, _vm->_globals.opt_voice); + _vm->_eventsManager._startPos.x + 731, 468, _vm->_globals._menuVoiceOff); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 731, 441, _vm->_globals.opt_sound); + _vm->_eventsManager._startPos.x + 731, 441, _vm->_globals._menuSoundOff); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 731, 414, _vm->_globals.opt_music); + _vm->_eventsManager._startPos.x + 731, 414, _vm->_globals._menuMusicOff); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals.opt_anm); + _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals._menuDisplayType); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, - _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals.opt_scrspeed); + _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals._menuScrollSpeed); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); } @@ -2676,7 +2676,7 @@ LABEL_64: if (v5 > 160) { _vm->_graphicsManager.no_scroll = 2; do { - _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager.SPEED_SCROLL; + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager._scrollSpeed; if (_vm->_graphicsManager.SCROLL < 0) { _vm->_graphicsManager.SCROLL = 0; v1 = 1; @@ -2694,7 +2694,7 @@ LABEL_64: } } else { do { - _vm->_graphicsManager.SCROLL += _vm->_graphicsManager.SPEED_SCROLL; + _vm->_graphicsManager.SCROLL += _vm->_graphicsManager._scrollSpeed; if (_vm->_graphicsManager.SCROLL < 0) { _vm->_graphicsManager.SCROLL = 0; v1 = 1; -- cgit v1.2.3 From 17b5a57c6b686a7e1ad12b92c92ab79f8b8035fc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Dec 2012 19:33:53 +0100 Subject: HOPKINS: Remove REDRAW counter, as it's always equal to 0 and therefore useless --- engines/hopkins/events.cpp | 35 +++++++++++------------------------ engines/hopkins/graphics.cpp | 1 - engines/hopkins/graphics.h | 1 - 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index e76d71d62b..cac6b83a20 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -150,18 +150,19 @@ void EventsManager::mouseOn() { void EventsManager::changeMouseCursor(int id) { int cursorId = id; - if (_mouseCursorId != 23) { - if (id == 4 && _mouseCursorId == 4 && _vm->_globals.NOMARCHE) - cursorId = 0; - if (cursorId == 25) - cursorId = 5; + if (_mouseCursorId == 23) + return; - if (_oldIconId != cursorId || !cursorId) { - _oldIconId = cursorId; - _mouseSpriteId = cursorId; + if (id == 4 && _mouseCursorId == 4 && _vm->_globals.NOMARCHE) + cursorId = 0; + if (cursorId == 25) + cursorId = 5; - updateCursor(); - } + if (_oldIconId != cursorId || !cursorId) { + _oldIconId = cursorId; + _mouseSpriteId = cursorId; + + updateCursor(); } } @@ -322,20 +323,6 @@ void EventsManager::VBL() { int v15 = 0; int yp = 0; - if (_vm->_graphicsManager.REDRAW) { - _vm->_graphicsManager.lockScreen(); - if (_breakoutFl) { - _vm->_graphicsManager.CopyAsm(_vm->_graphicsManager._vesaBuffer); - _vm->_graphicsManager.REDRAW = 0; - } else { - if (_vm->_globals.iRegul == 3) - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 50, 640, 340, 0, 50); - else - _vm->_graphicsManager.m_scroll(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll, 20, 640, 440, 0, 20); - --_vm->_graphicsManager.REDRAW; - } - _vm->_graphicsManager.unlockScreen(); - } if (_mouseFl) { v1 = 20; if (!_mouseLinuxFl) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index abe2abe85b..8264b6ba70 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -54,7 +54,6 @@ GraphicsManager::GraphicsManager() { FADE_LINUX = 0; _skipVideoLockFl = false; no_scroll = 0; - REDRAW = false; min_x = 0; min_y = 20; max_x = SCREEN_WIDTH * 2; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e239344b46..40bbd67cb5 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -83,7 +83,6 @@ public: bool _skipVideoLockFl; int no_scroll; Common::Rect dstrect[50]; - int REDRAW; int min_x, min_y; int max_x, max_y; int clip_x, clip_y; -- cgit v1.2.3 From f59f7dafc3f6a5bc9210acf87a9355fadba6510a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 31 Dec 2012 00:18:08 +0100 Subject: HOPKINS: Refactoring in FontManager and LinesManager --- engines/hopkins/dialogs.cpp | 7 +- engines/hopkins/files.cpp | 8 +- engines/hopkins/font.cpp | 21 +- engines/hopkins/font.h | 4 +- engines/hopkins/globals.cpp | 13 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 10 +- engines/hopkins/lines.cpp | 483 ++++++++++++++++++++------------------------ engines/hopkins/lines.h | 12 +- engines/hopkins/objects.cpp | 60 +++--- engines/hopkins/script.cpp | 18 +- engines/hopkins/sound.cpp | 2 +- engines/hopkins/talk.cpp | 10 +- 13 files changed, 286 insertions(+), 366 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index c5126527d2..0e1be64b8f 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -376,11 +376,11 @@ LABEL_7: // Turn on drawing the inventory dialog in the event manager _inventDisplayedFl = true; - int v8 = _vm->_eventsManager.getMouseX(); - int v9 = _vm->_eventsManager.getMouseY(); + int mousePosX = _vm->_eventsManager.getMouseX(); + int mousePosY = _vm->_eventsManager.getMouseY(); int v12 = _vm->_eventsManager.getMouseButton(); int v10 = v13; - int v11 = _vm->_linesManager.ZONE_OBJET(v8, v9); + int v11 = _vm->_linesManager.ZONE_OBJET(mousePosX, mousePosY); v13 = v11; if (v11 != v10) _vm->_objectsManager.initBorder(v11); @@ -398,7 +398,6 @@ LABEL_7: if (v12 == 1) { if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) break; - v9 = v13; _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 6c792017ef..30570939d2 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -69,17 +69,15 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes * Initialize censorship based on blood.dat file */ void FileManager::initCensorship() { - _vm->_globals.CENSURE = false; + _vm->_globals._censorshipFl = false; // If file doesn't exist, fallback to uncensored if (!fileExists(_vm->_globals.HOPSYSTEM, "BLOOD.DAT")) { constructFilename(_vm->_globals.HOPSYSTEM, "BLOOD.DAT"); char *data = (char *)loadFile(_vm->_globals._curFilename); - if (*(data + 6) == 'u' && *(data + 7) == 'k') - _vm->_globals.CENSURE = true; - if (*(data + 6) == 'U' && *(data + 7) == 'K') - _vm->_globals.CENSURE = true; + if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K')) + _vm->_globals._censorshipFl = true; free(data); } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index f1415506fe..9ac2446548 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -110,7 +110,7 @@ void FontManager::setOptimalColor(int idx1, int idx2, int idx3, int idx4) { /** * Init text structure */ -void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int textType, int a9, int color) { +void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color) { if ((idx - 5) > MAX_TEXT) error("Attempted to display text > MAX_TEXT."); @@ -120,8 +120,6 @@ void FontManager::initTextBuffers(int idx, int messageId, const Common::String & txt._pos.x = xp; txt._pos.y = yp; txt._messageId = messageId; - txt._fieldE = a6; // Useless variable - txt._field10 = a7; // Useless variable txt._textType = textType; txt._field3FE = a9; txt._color = color; @@ -236,9 +234,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (v69) { int v64 = 0; for (;;) { - byte v14 = *(v60 + v64); + byte v14 = v60[v64]; if (v14 == '\r' || v14 == '\n') { - *(v60 + v64) = 0; + v60[v64] = 0; if (!_text[idx]._field3FE) break; } @@ -250,9 +248,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _vm->_globals._boxWidth = 0; for (int v15 = 0; v15 < v64 + 1; v15++) { - byte v16 = *(v60 + v15); + byte v16 = v60[v15]; if (v16 <= 31) - v16 = 32; + v16 = ' '; _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); } @@ -272,7 +270,6 @@ LABEL_43: _vm->_globals._boxWidth = 240; int v65 = 0; byte *v61 = _tempText; - int v21; int lineSize; do { int v19 = 0; @@ -280,7 +277,7 @@ LABEL_43: for (;;) { lineSize = v19; do - v11 = *(v61 + v65 + v19++); + v11 = v61[v65 + v19++]; while (v11 != ' ' && v11 != '%'); if (v19 >= ptrb / _vm->_globals.police_l) break; @@ -298,21 +295,19 @@ LABEL_55: lineSize = v19; LABEL_57: int v20 = lineCount; - v21 = v11; // WORKAROUND: Perhaps due to the usage of ScummVM strings here, recalculate what the // actual length of the line to be copied will be. Otherwise, you can see artifacts, // such as a single character beyond the end of string NULL. int actualSize = 0; - while (actualSize < lineSize && *(v61 + v65 + actualSize)) + while (actualSize < lineSize && v61[v65 + actualSize]) ++actualSize; _text[idx]._lines[v20] = Common::String((const char *)v61 + v65, actualSize); _textSortArray[lineCount++] = lineSize; v65 += lineSize; - v11 = v21; - } while (v21 != '%'); + } while (v11 != '%'); for (int i = 0; i <= 19; i++) { if (_textSortArray[i] <= 0) { diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 1b9bd3404f..8970b9c8e8 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -39,8 +39,6 @@ struct TxtItem { Common::String _filename; Common::Point _pos; int _messageId; - int _fieldE; // Useless variable - int _field10; // Useless variable int _lineCount; Common::String _lines[10]; int _textType; @@ -79,7 +77,7 @@ public: void hideText(int idx); void setTextColor(int idx, byte colByte); void setOptimalColor(int idx1, int idx2, int idx3, int idx4); - void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int a6, int a7, int textType, int a9, int a10); + void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color); void box(int idx, int messageId, const Common::String &filename, int xp, int yp); void displayTextVesa(int xp, int yp, const Common::String &message, int col); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index b33651fc16..41f5ce355c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -217,7 +217,7 @@ Globals::Globals() { OPTION_SPR = NULL; // Reset flags - CENSURE = false; + _censorshipFl = false; GESTE_FLAG = 0; BPP_NOAFF = false; _disableInventFl = false; @@ -330,9 +330,6 @@ void Globals::setConfig() { } void Globals::clearAll() { - // TODO: The original allocated an explicit memory block for the null pointer - // to point to. For now, we're seeing if the NULL value will do as well - for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = g_PTRNUL; @@ -381,9 +378,9 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field8 = 0; _vm->_linesManager.Ligne[idx].lineData = (int16 *)g_PTRNUL; - _vm->_linesManager.LigneZone[idx].count = 0; - _vm->_linesManager.LigneZone[idx].field2 = 0; - _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)g_PTRNUL; + _vm->_linesManager._zoneLine[idx].count = 0; + _vm->_linesManager._zoneLine[idx].field2 = 0; + _vm->_linesManager._zoneLine[idx].zoneData = (int16 *)g_PTRNUL; } for (int idx = 0; idx < 100; ++idx) { @@ -415,7 +412,7 @@ void Globals::clearAll() { GESTE_FLAG = 0; } -void Globals::HOPKINS_DATA() { +void Globals::loadCharacterData() { assert(PERSO_TYPE >= 0 && PERSO_TYPE <= 2); const int *srcList[] = { HOPKINS_PERSO_0, HOPKINS_PERSO_1, HOPKINS_PERSO_2 }; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index b6b1a9a513..f0c1af22dc 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -354,7 +354,7 @@ public: int SOUNDVOL; int MUSICVOL; int VOICEVOL; - bool CENSURE; + bool _censorshipFl; int g_old_anim; int g_old_sens, g_old_sens2; int _lastDirection; @@ -473,7 +473,7 @@ public: void setConfig(); void clearAll(); - void HOPKINS_DATA(); + void loadCharacterData(); void INIT_ANIM(); void INIT_VBOB(); void CLEAR_VBOB(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 9c80f56f3f..dbd97bc657 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -233,7 +233,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - if (!_globals.CENSURE) + if (!_globals._censorshipFl) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); @@ -560,7 +560,7 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; - if (!_globals.CENSURE) + if (!_globals._censorshipFl) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); @@ -2675,7 +2675,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - if (!_globals.CENSURE) + if (!_globals._censorshipFl) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); @@ -3554,7 +3554,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _graphicsManager.FADE_LINUX = 2; - if (!_globals.CENSURE) + if (!_globals._censorshipFl) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); @@ -4438,7 +4438,7 @@ void HopkinsEngine::initializeSystem() { _eventsManager.setMouseOn(); _eventsManager._mouseFl = false; - _globals.HOPKINS_DATA(); + _globals.loadCharacterData(); _eventsManager._mouseOffset.x = 0; _eventsManager._mouseOffset.y = 0; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 8637a90449..4d10fbea6d 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -30,7 +30,7 @@ namespace Hopkins { LinesManager::LinesManager() { for (int i = 0; i < 400; ++i) { - Common::fill((byte *)&LigneZone[i], (byte *)&LigneZone[i] + sizeof(LigneZoneItem), 0); + Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0); Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0); } for (int i = 0; i < 4000; ++i) { @@ -54,146 +54,132 @@ void LinesManager::setParent(HopkinsEngine *vm) { void LinesManager::CLEAR_ZONE() { for (int idx = 0; idx < 400; ++idx) - RETIRE_LIGNE_ZONE(idx); + removeZoneLine(idx); next_ligne = 0; } // Object Zone -int LinesManager::ZONE_OBJET(int a1, int a2) { - int v2; - - v2 = 0; - if ((uint)(a2 - 120) <= 33) - v2 = OPTI_ZONE(a1, 1, 0); - if ((uint)(a2 - 154) <= 37) - v2 = OPTI_ZONE(a1, 7, 0); - if ((uint)(a2 - 192) <= 37) - v2 = OPTI_ZONE(a1, 13, 0); - if ((uint)(a2 - 230) <= 37) - v2 = OPTI_ZONE(a1, 19, 0); - if ((uint)(a2 - 268) <= 37) - v2 = OPTI_ZONE(a1, 25, 1); - if ((uint)(a2 - 268) <= 20 && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) +int LinesManager::ZONE_OBJET(int posX, int posY) { + int v2 = 0; + if ((uint)(posY - 120) <= 33) + v2 = OPTI_ZONE(posX, 1, false); + if ((uint)(posY - 154) <= 37) + v2 = OPTI_ZONE(posX, 7, false); + if ((uint)(posY - 192) <= 37) + v2 = OPTI_ZONE(posX, 13, false); + if ((uint)(posY - 230) <= 37) + v2 = OPTI_ZONE(posX, 19, false); + if ((uint)(posY - 268) <= 37) + v2 = OPTI_ZONE(posX, 25, true); + if ((uint)(posY - 268) <= 20 && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) v2 = 30; - if ((uint)(a2 - 290) <= 16 && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(posY - 290) <= 16 && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) v2 = 31; - if (a1 < _vm->_graphicsManager.ofscroll + 152 || a1 > _vm->_graphicsManager.ofscroll + 484) + if (posX < _vm->_graphicsManager.ofscroll + 152 || posX > _vm->_graphicsManager.ofscroll + 484) v2 = 32; - if ((uint)(a2 - 114) > 192) + if ((uint)(posY - 114) > 192) v2 = 32; return v2; } -int LinesManager::OPTI_ZONE(int a1, int a2, int a3) { - int v3; - signed int v4; - - v3 = a2; - v4 = 0; - if (a1 >= _vm->_graphicsManager.ofscroll + 158 && a1 <= _vm->_graphicsManager.ofscroll + 208) - v4 = 1; - if (!v4) { - if (a1 >= _vm->_graphicsManager.ofscroll + 208 && a1 <= _vm->_graphicsManager.ofscroll + 266) { - v3 = a2 + 1; - v4 = 1; - } - if (!v4) { - if (a1 >= _vm->_graphicsManager.ofscroll + 266 && a1 <= _vm->_graphicsManager.ofscroll + 320) { - v3 += 2; - v4 = 1; - } - if (!v4) { - if (a1 >= _vm->_graphicsManager.ofscroll + 320 && a1 <= _vm->_graphicsManager.ofscroll + 370) { - v3 += 3; - v4 = 1; - } - if (!v4) { - if (a1 >= _vm->_graphicsManager.ofscroll + 370 && a1 <= _vm->_graphicsManager.ofscroll + 424) { - v3 += 4; - v4 = 1; - } - if (!v4) { - if (!a3 && a1 >= _vm->_graphicsManager.ofscroll + 424 && a1 <= _vm->_graphicsManager.ofscroll + 478) { - v3 += 5; - v4 = 1; - } - if (!v4) - v3 = 0; - } - } - } - } +int LinesManager::OPTI_ZONE(int posX, int minZoneNum, bool lastRow) { + int result = minZoneNum; + if (posX >= _vm->_graphicsManager.ofscroll + 158 && posX <= _vm->_graphicsManager.ofscroll + 208) + return result; + + if (posX >= _vm->_graphicsManager.ofscroll + 208 && posX <= _vm->_graphicsManager.ofscroll + 266) { + result += 1; + return result; + } + + if (posX >= _vm->_graphicsManager.ofscroll + 266 && posX <= _vm->_graphicsManager.ofscroll + 320) { + result += 2; + return result; + } + + if (posX >= _vm->_graphicsManager.ofscroll + 320 && posX <= _vm->_graphicsManager.ofscroll + 370) { + result += 3; + return result; + } + + if (posX >= _vm->_graphicsManager.ofscroll + 370 && posX <= _vm->_graphicsManager.ofscroll + 424) { + result += 4; + return result; + } + + if (!lastRow && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) { + result += 5; + return result; } - return v3; + + return 0; } -// Remove Line Zone -void LinesManager::RETIRE_LIGNE_ZONE(int idx) { +/** + * Remove Zone Line + */ +void LinesManager::removeZoneLine(int idx) { if (idx > 400) - error("Attempting to add a line obstacle > MAX_LIGNE."); + error("Attempting to remove a line obstacle > MAX_LIGNE."); - _vm->_linesManager.LigneZone[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager.LigneZone[idx].zoneData); + _vm->_linesManager._zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager._zoneLine[idx].zoneData); } -// Add Line Zone -void LinesManager::AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6) { +/** + * Add Zone Line + */ +void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx) { int16 *zoneData; - if (a2 != a3 || a3 != a4 || a3 != a5) { + if (a2 == a3 && a3 == a4 && a3 == a5) { + _vm->_globals.BOBZONE_FLAG[bobZoneIdx] = true; + _vm->_globals.BOBZONE[bobZoneIdx] = a3; + } else { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - LigneZone[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)LigneZone[idx].zoneData); + _zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx].zoneData); int v8 = a2 - a4; if (a2 - a4 < 0) v8 = -v8; - int v19 = v8; int v9 = a3 - a5; if (a3 - a5 < 0) v9 = -v9; - int v18 = v9; int v20 = 1; - if (v19 <= v9) + if (v8 <= v9) v20 += v9; else - v20 += v19; + v20 += v8; zoneData = (int16 *)_vm->_globals.allocMemory(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); int v11 = idx; - LigneZone[v11].zoneData = zoneData; + _zoneLine[v11].zoneData = zoneData; if (zoneData == (int16 *)g_PTRNUL) error("AJOUTE LIGNE ZONE"); int16 *dataP = zoneData; - int v23 = 1000 * v19 / v20; - int v22 = 1000 * v18 / v20; + int v23 = 1000 * v8 / v20; + int v22 = 1000 * v9 / v20; if (a4 < a2) v23 = -v23; if (a5 < a3) v22 = -v22; int v13 = 1000 * a2; int v16 = 1000 * a3; - int v17 = 1000 * a2 / 1000; - int v21 = 1000 * a3 / 1000; for (int i = 0; i < v20; i++) { - *dataP++ = v17; - *dataP++ = v21; + *dataP++ = v13 / 1000; + *dataP++ = v16 / 1000; v13 += v23; v16 += v22; - v17 = v13 / 1000; - v21 = v16 / 1000; } *dataP++ = -1; *dataP++ = -1; - LigneZone[idx].count = v20; - LigneZone[idx].field2 = a6; - } else { - _vm->_globals.BOBZONE_FLAG[a6] = true; - _vm->_globals.BOBZONE[a6] = a3; + _zoneLine[idx].count = v20; + _zoneLine[idx].field2 = bobZoneIdx; } } @@ -363,84 +349,80 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, // Line Collision 2 // TODO: Should return a bool -int LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { +bool LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { int16 *v7; int16 *v13; - int result; int v24 = a5; int v6 = a5; - if (a5 >= a6 + 1) { -LABEL_29: - result = 0; - } else { - int v11; - int v22 = a1 + 4; - int v21 = a1 - 4; - int v20 = a2 + 4; - int v19 = a2 - 4; - int v17; - for (;;) { - v7 = Ligne[v6].lineData; + if (a5 >= a6 + 1) + return false; - if (v7 != (int16 *)g_PTRNUL) { - int v23 = 1; - int v8 = 2 * Ligne[v6].field0; - int v9 = v7[0]; - int v16 = v7[1]; - int v10 = v7[v8 - 2]; - int v18 = v7[v8 - 1]; - if (v7[0] >= v10) - goto LABEL_32; - if (v22 < v9 || v21 > v10) - v23 = 0; - if (v9 >= v10) { + int v11; + int v22 = a1 + 4; + int v21 = a1 - 4; + int v20 = a2 + 4; + int v19 = a2 - 4; + int v17; + for (;;) { + v7 = Ligne[v6].lineData; + + if (v7 != (int16 *)g_PTRNUL) { + int v23 = 1; + int v8 = 2 * Ligne[v6].field0; + int v9 = v7[0]; + int v16 = v7[1]; + int v10 = v7[v8 - 2]; + int v18 = v7[v8 - 1]; + if (v7[0] >= v10) + goto LABEL_32; + if (v22 < v9 || v21 > v10) + v23 = 0; + if (v9 >= v10) { LABEL_32: - if (v21 > v9 || v22 < v10) - v23 = 0; - } - if (v16 >= v18) - goto LABEL_33; - if (v20 < v16 || v19 > v18) + if (v21 > v9 || v22 < v10) v23 = 0; - if (v16 >= v18) { + } + if (v16 >= v18) + goto LABEL_33; + if (v20 < v16 || v19 > v18) + v23 = 0; + if (v16 >= v18) { LABEL_33: - if (v19 > v16 || v20 < v18) - v23 = 0; - } - if (v23 == 1) { - v11 = 0; - v17 = Ligne[v24].field0; - if (v17 > 0) - break; - } + if (v19 > v16 || v20 < v18) + v23 = 0; + } + if (v23 == 1) { + v11 = 0; + v17 = Ligne[v24].field0; + if (v17 > 0) + break; } -LABEL_28: - ++v24; - v6 = v24; - if (v24 >= a6 + 1) - goto LABEL_29; } - for (;;) { - int v12 = v7[0]; +LABEL_28: + ++v24; + v6 = v24; + if (v24 >= a6 + 1) + return false; + } + for (;;) { + int v12 = v7[0]; - v13 = v7 + 1; - int v14 = v13[0]; - v7 = v13 + 1; + v13 = v7 + 1; + int v14 = v13[0]; + v7 = v13 + 1; - if (a1 == v12 || a1 + 1 == v12) { - if (a2 == v14 || a2 + 1 == v14) - break; - } - ++v11; - if (v17 <= v11) - goto LABEL_28; + if (a1 == v12 || a1 + 1 == v12) { + if (a2 == v14 || a2 + 1 == v14) + break; } - *a3 = v11; - *a4 = v24; - result = 1; + ++v11; + if (v17 <= v11) + goto LABEL_28; } - return result; + *a3 = v11; + *a4 = v24; + return true; } int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { @@ -854,7 +836,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v6 = a2; v50 = a3; v7 = a5; - if (colision2_ligne(a1, a2, &v51, &v50, 0, TOTAL_LIGNES) == 1) { + if (colision2_ligne(a1, a2, &v51, &v50, 0, TOTAL_LIGNES)) { v8 = Ligne[v50].field4; if (v8 == 1) v6 = a2 - 2; @@ -1011,7 +993,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 1) { for (int v22 = 0; v22 < v39; v22++) { - if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v46) { v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); if (v23 == -1) @@ -1035,7 +1017,7 @@ LABEL_186: } if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { - if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v46) { v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); if (v26 == -1) @@ -1055,7 +1037,7 @@ LABEL_186: } if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { - if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v46) { v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v29 == -1) @@ -1075,7 +1057,7 @@ LABEL_186: } if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { - if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v46) { v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v32 == -1) @@ -1221,7 +1203,7 @@ LABEL_17: for (int v89 = v85 + 1; v89 > 0; v89--) { int v96 = _vm->_globals.BufLig[v25]; int v94 = _vm->_globals.BufLig[v25 + 1]; - if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) == 1 && _vm->_objectsManager.DERLIGNE < v100) { + if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) && _vm->_objectsManager.DERLIGNE < v100) { v80 = v100; v77 = v101; v78 = v96; @@ -1286,48 +1268,48 @@ LABEL_17: if (a5 >= v69 && a5 <= v67 && a6 >= v73 && a6 <= v71) { int v34 = a6; int v76 = -1; - int v60 = 0; + loopCond = false; do { --v34; - v60 = colision2_ligne(a5, v34, &v101, &v100, v92, v91); - if (v60 == 1) + loopCond = colision2_ligne(a5, v34, &v101, &v100, v92, v91); + if (loopCond) v76 = v100; if (!v34 || v73 > v34) - v60 = 1; - } while (v60 != 1); + loopCond = true; + } while (!loopCond); int v35 = a6; int v75 = -1; - int v61 = 0; + loopCond = false; do { ++v35; - v61 = colision2_ligne(a5, v35, &v101, &v100, v92, v91); - if (v61 == 1) + loopCond = colision2_ligne(a5, v35, &v101, &v100, v92, v91); + if (loopCond) v75 = v100; if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) - v61 = 1; - } while (v61 != 1); + loopCond = true; + } while (!loopCond); int v36 = a5; int v74 = -1; - int v62 = 0; + loopCond = false; do { ++v36; - v62 = colision2_ligne(v36, a6, &v101, &v100, v92, v91); - if (v62 == 1) + loopCond = colision2_ligne(v36, a6, &v101, &v100, v92, v91); + if (loopCond) v74 = v100; if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) - v62 = 1; - } while (v62 != 1); + loopCond = true; + } while (!loopCond); int v37 = a5; int v38 = -1; - int v63 = 0; + loopCond = false; do { --v37; - v63 = colision2_ligne(v37, a6, &v101, &v100, v92, v91); - if (v63 == 1) + loopCond = colision2_ligne(v37, a6, &v101, &v100, v92, v91); + if (loopCond) v38 = v100; if (v37 <= 0 || v69 >= v37) - v63 = 1; - } while (v63 != 1); + loopCond = true; + } while (!loopCond); if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) { v9 = a7; goto LABEL_112; @@ -1410,10 +1392,10 @@ LABEL_17: } if (a1 == v80) v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); - int v64 = 0; + loopCond = false; do { - v64 = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); - if (v64 == 1) { + loopCond = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); + if (loopCond) { int v50 = v100; if (Ligne[v50].field4 == 1) --NVPY; @@ -1440,7 +1422,7 @@ LABEL_17: --NVPX; } } - } while (v64); + } while (loopCond); } else { NVPX = -1; NVPY = -1; @@ -1462,36 +1444,28 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v14; int v15; int v16; - int v17; int v18; int v19; int v20; - int v21; int v22; int v23; int v24; - int v25; int v26; int v27; int v28; - int v29; int v31; int v34; int v35; int v36; - int v37; int v38; int v39; int v40; - int v41; int v42; int v43; int v44; - int v45; int v46; int v47; int v48; - int v49; int v50; int v51; int v52; @@ -1659,9 +1633,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v16 = 5; do { v101 = v16; - v17 = colision2_ligne(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE); v16 = v101; - if (v17 == 1 && v141[v101] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE) && v141[v101] <= _vm->_objectsManager.DERLIGNE) break; v136[v101] = 0; v141[v101] = -1; @@ -1676,9 +1649,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v20 = 1; do { v102 = v20; - v21 = colision2_ligne(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE); v20 = v102; - if (v21 == 1 && v141[v102] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE) && v141[v102] <= _vm->_objectsManager.DERLIGNE) break; v136[v102] = 0; v141[v102] = -1; @@ -1697,9 +1669,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v24 = 3; do { v103 = v24; - v25 = colision2_ligne(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v24 = v103; - if (v25 == 1 && v141[v103] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE) && v141[v103] <= _vm->_objectsManager.DERLIGNE) break; v136[v103] = 0; v141[v103] = -1; @@ -1720,9 +1691,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v28 = 7; do { v104 = v28; - v29 = colision2_ligne(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE); v28 = v104; - if (v29 == 1 && v141[v104] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE) && v141[v104] <= _vm->_objectsManager.DERLIGNE) break; v136[v104] = 0; v141[v104] = -1; @@ -1791,9 +1761,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v36 = 5; do { v105 = v36; - v37 = colision2_ligne(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE); v36 = v105; - if (v37 == 1 && v141[v105] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE) && v141[v105] <= _vm->_objectsManager.DERLIGNE) break; v136[v105] = 0; v141[v105] = -1; @@ -1808,9 +1777,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v40 = 1; do { v106 = v40; - v41 = colision2_ligne(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE); v40 = v106; - if (v41 == 1 && v141[v106] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE) && v141[v106] <= _vm->_objectsManager.DERLIGNE) break; v136[v106] = 0; v141[v106] = -1; @@ -1829,9 +1797,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v44 = 3; do { v107 = v44; - v45 = colision2_ligne(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE); v44 = v107; - if (v45 == 1 && v141[v107] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE) && v141[v107] <= _vm->_objectsManager.DERLIGNE) break; v136[v107] = 0; v141[v107] = -1; @@ -1850,9 +1817,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v48 = 7; do { v108 = v48; - v49 = colision2_ligne(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE); v48 = v108; - if (v49 == 1 && v141[v108] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE) && v141[v108] <= _vm->_objectsManager.DERLIGNE) break; v136[v108] = 0; v141[v108] = -1; @@ -1935,7 +1901,7 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v58 = GENIAL(v124, v125, srcX, srcY - v56, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); @@ -1959,7 +1925,7 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v61 = GENIAL(v124, v125, srcX, v60 + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); @@ -1983,7 +1949,7 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v64 = GENIAL(v124, v125, srcX - v63, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); @@ -2007,7 +1973,7 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if (colision2_ligne(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) == 1 + if (colision2_ligne(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) && _vm->_objectsManager.DERLIGNE < v124) { v57 = v112; v67 = GENIAL(v124, v125, v66 + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); @@ -2240,7 +2206,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int16 *v42; int v43; int v44; - int v45; + bool v45; int v46; int16 *v47; int v48; @@ -2262,7 +2228,6 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int16 *v64; int v65; int v66; - int v67; int v68; int16 *v69; int v70; @@ -2340,7 +2305,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v143; int v144; int v145; - int colResult = 0; + bool colResult = false; int v7 = a1; v90 = a2; @@ -2349,7 +2314,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int if (a5 == -1 && a6 == -1) v136 = 1; v144 = a5; - if (colision2_ligne(a1, a2, &v145, &v144, 0, TOTAL_LIGNES) == 1) { + if (colision2_ligne(a1, a2, &v145, &v144, 0, TOTAL_LIGNES)) { int v8 = Ligne[v144].field4; if (v8 == 1) v90 = a2 - 2; @@ -2555,7 +2520,7 @@ LABEL_103: v23 = 0; if (v108 + 1 <= 0) goto LABEL_149; - while (colision2_ligne(v104, v103, &v143, &v142, 0, TOTAL_LIGNES) != 1) { + while (!colision2_ligne(v104, v103, &v143, &v142, 0, TOTAL_LIGNES)) { v25 = v115; v26 = _vm->_globals.essai0; v26[v25] = v104; @@ -2595,7 +2560,7 @@ LABEL_67: v126 = 1; goto LABEL_70; } - if (colision2_ligne(v15, v110, &v143, &v142, 0, TOTAL_LIGNES) == 1) + if (colision2_ligne(v15, v110, &v143, &v142, 0, TOTAL_LIGNES)) break; v16 = v115; @@ -2633,7 +2598,7 @@ LABEL_158: LABEL_165: if (v113 > a3) { v36 = v113; - while (colision2_ligne(v36, v92, &v141, &v140, 0, TOTAL_LIGNES) != 1) { + while (!colision2_ligne(v36, v92, &v141, &v140, 0, TOTAL_LIGNES)) { v37 = v117; v38 = _vm->_globals.essai1; v38[v37] = v36; @@ -2652,7 +2617,7 @@ LABEL_181: if (v92 > a4) { v43 = v92; do { - if (colision2_ligne(a3, v43, &v141, &v140, 0, TOTAL_LIGNES) == 1) { + if (colision2_ligne(a3, v43, &v141, &v140, 0, TOTAL_LIGNES)) { if (_vm->_objectsManager.DERLIGNE < v140) { v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); if (v44 == -1) @@ -2706,7 +2671,7 @@ LABEL_195: } v39 = v92; for (;;) { - if (colision2_ligne(a3, v39, &v141, &v140, 0, TOTAL_LIGNES) == 1) { + if (colision2_ligne(a3, v39, &v141, &v140, 0, TOTAL_LIGNES)) { if (_vm->_objectsManager.DERLIGNE < v140) { v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3); if (v40 == -1) @@ -2718,7 +2683,7 @@ LABEL_195: v92 = NVPY; v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager.DERLIGNE); LABEL_189: - if (v45 == 1 && v140 <= _vm->_objectsManager.DERLIGNE) + if (v45 && v140 <= _vm->_objectsManager.DERLIGNE) goto LABEL_202; goto LABEL_158; } @@ -2739,7 +2704,7 @@ LABEL_189: goto LABEL_181; } } - while (colision2_ligne(v33, v92, &v141, &v140, 0, TOTAL_LIGNES) != 1) { + while (!colision2_ligne(v33, v92, &v141, &v140, 0, TOTAL_LIGNES)) { v34 = v117; v35 = _vm->_globals.essai1; v35[v34] = v33; @@ -2768,7 +2733,7 @@ LABEL_203: goto LABEL_241; if (v93 < a4) { v55 = v93; - while (colision2_ligne(v114, v55, &v139, &v138, 0, TOTAL_LIGNES) != 1) { + while (!colision2_ligne(v114, v55, &v139, &v138, 0, TOTAL_LIGNES)) { v56 = v117; v57 = _vm->_globals.essai2; v57[v56] = v114; @@ -2784,7 +2749,7 @@ LABEL_203: LABEL_211: if (v93 > a4) { v58 = v93; - while (colision2_ligne(v114, v58, &v139, &v138, 0, TOTAL_LIGNES) != 1) { + while (!colision2_ligne(v114, v58, &v139, &v138, 0, TOTAL_LIGNES)) { v59 = v117; v60 = _vm->_globals.essai2; v60[v59] = v114; @@ -2950,7 +2915,7 @@ LABEL_217: if (v114 < a3) { v61 = v114; do { - if (colision2_ligne(v61, a4, &v139, &v138, 0, TOTAL_LIGNES) == 1) { + if (colision2_ligne(v61, a4, &v139, &v138, 0, TOTAL_LIGNES)) { if (_vm->_objectsManager.DERLIGNE < v138) { v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v62 == -1) @@ -2962,7 +2927,7 @@ LABEL_217: v93 = NVPY; colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); LABEL_235: - if (colResult == 1 && v138 <= _vm->_objectsManager.DERLIGNE) + if (colResult && v138 <= _vm->_objectsManager.DERLIGNE) goto LABEL_249; goto LABEL_203; } @@ -2984,7 +2949,7 @@ LABEL_235: if (v114 > a3) { v65 = v114; do { - if (colision2_ligne(v65, a4, &v139, &v138, 0, TOTAL_LIGNES) == 1) { + if (colision2_ligne(v65, a4, &v139, &v138, 0, TOTAL_LIGNES)) { if (_vm->_objectsManager.DERLIGNE < v138) { v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v66 == -1) @@ -2994,7 +2959,7 @@ LABEL_235: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - v67 = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); + colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); goto LABEL_235; } } @@ -3085,7 +3050,7 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { v12 = 1000 * a2 / 1000; v14 = 0; if (v13 + 1 > 0) { - while (colision2_ligne(v9, v12, &v18, &v17, 0, TOTAL_LIGNES) != 1 || v17 > _vm->_objectsManager.DERLIGNE) { + while (!colision2_ligne(v9, v12, &v18, &v17, 0, TOTAL_LIGNES) || v17 > _vm->_objectsManager.DERLIGNE) { v7 += v16; v8 += v15; v9 = v7 / 1000; @@ -3102,11 +3067,9 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v6; int v7; - int v8; int v9; int v10; int v11; - int v12; int v13; int v14; int v15; @@ -3115,7 +3078,6 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v19; int v20; int v22; - int v23; int v24; int v25; int v26; @@ -3124,7 +3086,6 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v30; int v31; int v33; - int v34; int v35; int v37; int v38; @@ -3194,16 +3155,12 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v63 = v46; } v33 = v63 + v40; - v34 = 0; - if (v25 > 0) { - do { - --v62; - SMOOTH[v61].field0 = v62; - if (v63 != v33) - v63 = v63 + 1; - SMOOTH[v61++].field2 = v63; - ++v34; - } while (v34 < v25); + for (int v34 = 0; v34 < v25; v34++) { + --v62; + SMOOTH[v61].field0 = v62; + if (v63 != v33) + v63++; + SMOOTH[v61++].field2 = v63; } ++v53; if (v53 == 48) @@ -3255,16 +3212,12 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v63 = v44; } v22 = v63 + v39; - v23 = 0; - if (v14 > 0) { - do { - ++v62; - SMOOTH[v60].field0 = v62; - if (v63 != v22) - v63 = v63 + 1; - SMOOTH[v60++].field2 = v63; - ++v23; - } while (v23 < v14); + for (int v23 = 0; v23 < v14; v23++) { + ++v62; + SMOOTH[v60].field0 = v62; + if (v63 != v22) + v63++; + SMOOTH[v60++].field2 = v63; } ++v52; if (v52 == 48) @@ -3291,16 +3244,12 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25); v38 = _vm->_graphicsManager.zoomOut(v10, 25); v63 = v42; - v12 = 0; - if (v11 > 0) { - do { - --v62; - SMOOTH[v59].field0 = v62; - if ((uint16)v63 != (uint16)v42 + v38) - v63 = v63 - 1; - SMOOTH[v59++].field2 = v63; - ++v12; - } while (v12 < v11); + for (int v12 = 0; v12 < v11; v12++) { + --v62; + SMOOTH[v59].field0 = v62; + if ((uint16)v63 != (uint16)v42 + v38) + v63--; + SMOOTH[v59++].field2 = v63; } ++v51; if (v51 == 24) @@ -3327,16 +3276,12 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 25); v37 = _vm->_graphicsManager.zoomOut(v6, 25); v63 = v41; - v8 = 0; - if (v7 > 0) { - do { - ++v62; - SMOOTH[v58].field0 = v62; - if ((uint16)v63 != (uint16)v41 + v37) - v63 = v63 - 1; - SMOOTH[v58++].field2 = v63; - ++v8; - } while (v8 < v7); + for (int v8 = 0; v8 < v7; v8++) { + ++v62; + SMOOTH[v58].field0 = v62; + if ((uint16)v63 != (uint16)v41 + v37) + v63--; + SMOOTH[v58++].field2 = v63; } ++v50; if (v50 == 24) diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index d029aaa9b0..92b465fd96 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -54,7 +54,7 @@ class LinesManager { private: HopkinsEngine *_vm; public: - LigneZoneItem LigneZone[401]; + LigneZoneItem _zoneLine[401]; LigneItem Ligne[400]; SmoothItem SMOOTH[4000]; int next_ligne; @@ -71,14 +71,14 @@ public: void setParent(HopkinsEngine *vm); void CLEAR_ZONE(); - int ZONE_OBJET(int a1, int a2); - int OPTI_ZONE(int a1, int a2, int a3); - void RETIRE_LIGNE_ZONE(int idx); - void AJOUTE_LIGNE_ZONE(int idx, int a2, int a3, int a4, int a5, int a6); + int ZONE_OBJET(int posX, int posY); + int OPTI_ZONE(int posX, int minZoneNum, bool lastRow); + void removeZoneLine(int idx); + void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); void RESET_OBSTACLE(); void RETIRE_LIGNE(int idx); void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); - int colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); + bool colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); int Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); void INIPARCOURS(); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index cc52a17eb4..85e5784dc5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1538,7 +1538,7 @@ void ObjectsManager::checkZone() { _vm->_globals.ZONEP[v4].fieldC || _vm->_globals.ZONEP[v4].fieldD || _vm->_globals.ZONEP[v4].fieldE || _vm->_globals.ZONEP[v4].fieldF) { if (_vm->_globals.old_zone_68 != v4) { - _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 20, 25, 0, 0, 252); + _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); _vm->_fontManager.showText(5); _vm->_globals.zozo_73 = 1; } @@ -2230,7 +2230,7 @@ void ObjectsManager::loadZone(const Common::String &file) { if (v3 != -1) { v5 = v3; v6 = v3; - _vm->_linesManager.AJOUTE_LIGNE_ZONE( + _vm->_linesManager.addZoneLine( v18, READ_LE_UINT16((uint16 *)ptr + v4 + 1), READ_LE_UINT16((uint16 *)ptr + v4 + 2), @@ -2299,16 +2299,16 @@ void ObjectsManager::CARRE_ZONE() { } for (int idx = 0; idx < 400; ++idx) { - dataP = _vm->_linesManager.LigneZone[idx].zoneData; + dataP = _vm->_linesManager._zoneLine[idx].zoneData; if (dataP != (int16 *)g_PTRNUL) { - v4 = _vm->_linesManager.LigneZone[idx].field2; + v4 = _vm->_linesManager._zoneLine[idx].field2; _vm->_globals.CarreZone[v4].field0 = 1; if (_vm->_globals.CarreZone[v4].fieldC < idx) _vm->_globals.CarreZone[v4].fieldC = idx; if (_vm->_globals.CarreZone[v4].fieldA > idx) _vm->_globals.CarreZone[v4].fieldA = idx; - v12 = _vm->_linesManager.LigneZone[idx].count; + v12 = _vm->_linesManager._zoneLine[idx].count; if (v12 > 0) { for (int v13 = 0; v13 < v12; v13++) { v5 = *dataP++; @@ -2846,7 +2846,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); - _vm->_globals.HOPKINS_DATA(); + _vm->_globals.loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { CH_TETE = 0; @@ -2872,7 +2872,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals.PERSO_TYPE = 2; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); SPRITE_ON(0); - _vm->_globals.HOPKINS_DATA(); + _vm->_globals.loadCharacterData(); } else { switch (oldCharacter) { case CHARACTER_HOPKINS: @@ -3019,26 +3019,20 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v6; int v7; int v8; - int v9; int v10; int v11; int v12; - int v13; int v14; int v15; int v16; - int v17; int v18; int v19; int v20; - int v21; int16 *result; int v23; - int v26; int v27; int v28; int v29; - int v31; int v32; int16 *v33; int v34; @@ -3093,9 +3087,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v8 = 5; do { v62 = v8; - v9 = _vm->_linesManager.colision2_ligne(v75, v7, &v82[5], &v87[5], 0, DERLIGNE); v8 = v62; - if (v9 == 1 && v87[v62] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v75, v7, &v82[5], &v87[5], 0, DERLIGNE) && v87[v62] <= DERLIGNE) break; v82[v62] = 0; v87[v62] = -1; @@ -3110,9 +3103,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v12 = 1; do { v63 = v12; - v13 = _vm->_linesManager.colision2_ligne(v75, v11, &v82[1], &v87[1], 0, DERLIGNE); v12 = v63; - if (v13 == 1 && v87[v63] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v75, v11, &v82[1], &v87[1], 0, DERLIGNE) && v87[v63] <= DERLIGNE) break; v82[v63] = 0; v87[v63] = -1; @@ -3131,9 +3123,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v16 = 3; do { v64 = v16; - v17 = _vm->_linesManager.colision2_ligne(v15, v74, &v82[3], &v87[3], 0, DERLIGNE); v16 = v64; - if (v17 == 1 && v87[v64] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v15, v74, &v82[3], &v87[3], 0, DERLIGNE) && v87[v64] <= DERLIGNE) break; v82[v64] = 0; v87[v64] = -1; @@ -3154,9 +3145,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v20 = 7; do { v65 = v20; - v21 = _vm->_linesManager.colision2_ligne(v19, v74, &v82[7], &v87[7], 0, DERLIGNE); v20 = v65; - if (v21 == 1 && v87[v65] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v19, v74, &v82[7], &v87[7], 0, DERLIGNE) && v87[v65] <= DERLIGNE) break; v82[v65] = 0; v87[v65] = -1; @@ -3208,20 +3198,18 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v77[v24] = 1300; v76[v24] = 1300; } - v26 = _vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, DERLIGNE); - if (v26 == 1) { + if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, DERLIGNE)) { v69 = v87[1]; v68 = v82[1]; - } else if (!v26) { - if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager.TOTAL_LIGNES) == 1) { + } else { + if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager.TOTAL_LIGNES)) { v27 = 0; for (;;) { v28 = _vm->_globals.essai2[v27]; v29 = _vm->_globals.essai2[v27 + 1]; v66 = _vm->_globals.essai2[v27 + 2]; v27 += 4; - v31 = _vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, DERLIGNE); - if (v31) + if (_vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, DERLIGNE)) break; v32 = v67; _vm->_globals.super_parcours[v32] = v28; @@ -3645,7 +3633,7 @@ int ObjectsManager::MZONE() { && _vm->_globals.CarreZone[v7].field6 <= yp && _vm->_globals.CarreZone[v7].field8 >= yp) { if (_vm->_globals.CarreZone[v7].fieldE == 1) { - _vm->_globals.oldzone_46 = _vm->_linesManager.LigneZone[_vm->_globals.CarreZone[v7].fieldA].field2; + _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7].fieldA].field2; return _vm->_globals.oldzone_46; } v9 = _vm->_globals.SegmentEnCours; @@ -3934,7 +3922,7 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); _vm->_globals.NOPARLE = false; - if (!_vm->_globals.CENSURE) { + if (!_vm->_globals._censorshipFl) { v1 = _vm->_globals.allocMemory(1000); memcpy(v1, _vm->_graphicsManager._palette, 769); @@ -4488,7 +4476,7 @@ void ObjectsManager::INILINK(const Common::String &file) { do { v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); if (v28 != -1) { - _vm->_linesManager.AJOUTE_LIGNE_ZONE( + _vm->_linesManager.addZoneLine( v35, (int16)READ_LE_UINT16(v17 + 2 * v33 + 2), (int16)READ_LE_UINT16(v17 + 2 * v33 + 4), @@ -4554,7 +4542,7 @@ void ObjectsManager::SPECIAL_INI() { VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); _vm->_fontManager.hideText(9); if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); + _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 6, 36, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } @@ -4819,9 +4807,9 @@ int ObjectsManager::colision(int xp, int yp) { int yMin = yp - 4; do { - int16 *dataP = _vm->_linesManager.LigneZone[field2].zoneData; + int16 *dataP = _vm->_linesManager._zoneLine[field2].zoneData; if (dataP != (int16 *)g_PTRNUL) { - int count = _vm->_linesManager.LigneZone[field2].count; + int count = _vm->_linesManager._zoneLine[field2].count; int v1 = *dataP; int v2 = *(dataP + 1); int v3 = *(dataP + count * 2 - 2); @@ -4837,13 +4825,13 @@ int ObjectsManager::colision(int xp, int yp) { if (v2 >= v4 && (yMin > v2 || yMax < v4)) flag = false; - if (flag && _vm->_linesManager.LigneZone[field2].count > 0) { + if (flag && _vm->_linesManager._zoneLine[field2].count > 0) { for (int v5 = 0; v5 < count; ++v5) { int xCheck = *dataP++; int yCheck = *dataP++; if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) - return _vm->_linesManager.LigneZone[field2].field2; + return _vm->_linesManager._zoneLine[field2].field2; } } } @@ -5274,7 +5262,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 2; } - _vm->_globals.HOPKINS_DATA(); + _vm->_globals.loadCharacterData(); switch (_vm->_globals.PERSO_TYPE) { case 0: SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 64d2147fbb..217f1f15f2 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -133,7 +133,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_soundManager._soundFl); } if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 6, v2, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } @@ -142,18 +142,18 @@ int ScriptManager::handleOpcode(byte *dataP) { } if (TRAVAILOBJET) { if (_vm->_globals._saveData->data[svField356]) { - _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); + _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, v69, 35, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(635, 4); } else { if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl) - _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * v67, 60, 6, v2, 253); else if (_vm->_globals._language == LANG_EN && !_vm->_soundManager._textOffFl) - _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * v67, 60, 6, v2, 253); else if (_vm->_globals._language == LANG_SP && !_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * v67, 60, 6, v2, 253); } if (!_vm->_soundManager._textOffFl) @@ -570,7 +570,7 @@ LABEL_1141: _vm->_graphicsManager.FIN_VISU(); // If uncensored, rip the throat of the hostage - if (!_vm->_globals.CENSURE) { + if (!_vm->_globals._censorshipFl) { _vm->_soundManager.SPECIAL_SOUND = 16; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("EGORGE.ANM", 50, 28, 500); @@ -924,7 +924,7 @@ LABEL_1141: _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 1; _vm->_globals._saveData->data[svField122] = 1; - _vm->_globals.HOPKINS_DATA(); + _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 28; _vm->_objectsManager._sprite[0].field14 = 155; _vm->_objectsManager.VERIFTAILLE(); @@ -935,7 +935,7 @@ LABEL_1141: _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; _vm->_globals._saveData->data[svField122] = 0; - _vm->_globals.HOPKINS_DATA(); + _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 34; _vm->_objectsManager._sprite[0].field14 = 190; _vm->_objectsManager.VERIFTAILLE(); @@ -2189,7 +2189,7 @@ LABEL_1141: _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); + _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 3, 30, 253); _vm->_fontManager.showText(9); } if (!_vm->_soundManager._voiceOffFl) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index eda7ea0b88..90aa78127a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -167,7 +167,7 @@ void SoundManager::LOAD_ANM_SOUND() { } void SoundManager::playAnim_SOUND(int soundNumber) { - if (!_vm->_globals.CENSURE && SPECIAL_SOUND == 2) { + if (!_vm->_globals._censorshipFl && SPECIAL_SOUND == 2) { switch (soundNumber) { case 20: PLAY_SAMPLE2(5); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ca1fb34ef4..626bbef4f2 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -292,10 +292,10 @@ int TalkManager::DIALOGUE() { v21 = v20 - 20 * v3; v18 = v20 - 20 * v3 - 1; v4 = v20 - 20 * v3 - 20 * v2; - _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, v4 - 20 * v19, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, v4, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, v21, 0, 0, 0, 65, 255); - _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, v20, 0, 0, 0, 65, 255); + _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, v4 - 20 * v19, 0, 65, 255); + _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, v4, 0, 65, 255); + _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, v21, 0, 65, 255); + _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, v20, 0, 65, 255); _vm->_fontManager.showText(5); _vm->_fontManager.showText(6); _vm->_fontManager.showText(7); @@ -444,7 +444,7 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 20, 25, 5, v23, 252); + _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 5, v23, 252); _vm->_fontManager.showText(9); } if (!_vm->_soundManager.mixVoice(v22, 1)) { -- cgit v1.2.3 From a57e859d14de78bc06e9b47804d9c2b59acb830c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 31 Dec 2012 01:09:06 +0100 Subject: HOPKINS: Some more refactoring --- engines/hopkins/lines.cpp | 124 +++----------------------------- engines/hopkins/lines.h | 1 - engines/hopkins/objects.cpp | 167 +++++++++++++++++++++----------------------- engines/hopkins/objects.h | 2 +- engines/hopkins/script.cpp | 4 +- 5 files changed, 94 insertions(+), 204 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4d10fbea6d..29657d9505 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -425,108 +425,8 @@ LABEL_28: return true; } -int LinesManager::Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int16 *v7; - int16 *v13; - int result; - - int v24 = a5; - int v6 = a5; - - if (a5 >= a6 + 1) { -LABEL_47: - result = 0; - } else { - int v22 = a1 + 10; - int v21 = a1 - 10; - int v20 = a2 + 10; - int v19 = a2 - 10; - int v11, v18; - for (;;) { - v7 = Ligne[v6].lineData; - - if (v7 != (int16 *)g_PTRNUL) { - int v23 = 1; - int v8 = 2 * Ligne[v6].field0; - int v9 = v7[0]; - int v15 = v7[1]; - int v10 = v7[v8 - 2]; - int v17 = v7[v8 - 1]; - if (v7[0] >= v10) - goto LABEL_50; - if (v22 < v9 || v21 > v10) - v23 = 0; - if (v9 >= v10) { -LABEL_50: - if (v21 > v9 || v22 < v10) - v23 = 0; - } - if (v15 >= v17) - goto LABEL_51; - if (v20 < v15 || v19 > v17) - v23 = 0; - if (v15 >= v17) { -LABEL_51: - if (v19 > v15 || v20 < v17) - v23 = 0; - } - if (v23 == 1) { - v11 = 0; - v18 = Ligne[v24].field0; - if (v18 > 0) - break; - } - } -LABEL_46: - ++v24; - v6 = v24; - if (v24 >= a6 + 1) - goto LABEL_47; - } - for (;;) { - int v12 = v7[0]; - v13 = v7 + 1; - int v16 = v13[0]; - v7 = v13 + 1; - if (a1 == v12 - || v12 == a1 + 1 - || v12 == a1 + 2 - || v12 == a1 + 3 - || v12 == a1 + 4 - || v12 == a1 + 5 - || v12 == a1 + 6 - || v12 == a1 + 7 - || v12 == a1 + 8 - || v12 == a1 + 9 - || a1 + 10 == v12) { - if (v16 == a2 - || v16 == a2 + 1 - || v16 == a2 + 2 - || v16 == a2 + 3 - || v16 == a2 + 4 - || v16 == a2 + 5 - || v16 == a2 + 6 - || v16 == a2 + 7 - || v16 == a2 + 8 - || v16 == a2 + 9 - || a2 + 10 == v16) - break; - } - ++v11; - if (v18 <= v11) - goto LABEL_46; - } - *a3 = v11; - *a4 = v24; - result = 1; - } - return result; -} - // Init route void LinesManager::INIPARCOURS() { - int v0; - int v1; int v2; int16 *v3; int v4; @@ -536,14 +436,12 @@ void LinesManager::INIPARCOURS() { int v11; int v12; int v13; - int v14; - int v15; - v15 = Ligne[0].lineData[0]; - v14 = Ligne[0].lineData[1]; + int v15 = Ligne[0].lineData[0]; + int v14 = Ligne[0].lineData[1]; - v0 = 1; - v1 = 0; + int v0 = 1; + bool v1 = false; do { v2 = Ligne[v0].field0; v3 = Ligne[v0].lineData; @@ -552,20 +450,18 @@ void LinesManager::INIPARCOURS() { v5 = v3[2 * v2 - 1]; if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 || _vm->_graphicsManager.min_y == v5) - v1 = 1; + v1 = true; if (v15 == v4 && v14 == v5) - v1 = 1; - if (v0 == 400) { -// v6 = v1; + v1 = true; + if (v0 == 400) error("ERROR - LAST LINE NOT FOUND"); -// v1 = v6; - } + v7 = Ligne[v0 + 1].lineData; if (v7[0] != v4 && v7[1] != v5) - v1 = 1; + v1 = true; if (!v1) ++v0; - } while (v1 != 1); + } while (!v1); _vm->_objectsManager.DERLIGNE = v0; v13 = _vm->_globals.Max_Ligne_Long; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 92b465fd96..ab32a28f8a 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -79,7 +79,6 @@ public: void RETIRE_LIGNE(int idx); void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); bool colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); - int Scolision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); void INIPARCOURS(); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 85e5784dc5..5c2a27788b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -75,7 +75,7 @@ ObjectsManager::ObjectsManager() { A_DEPA = 0; MAX_DEPA = 0; MAX_DEPA1 = 0; - CH_TETE = 0; + CH_TETE = false; T_RECTIF = 0; _disableFl = false; _twoCharactersFl = false; @@ -109,9 +109,7 @@ void ObjectsManager::changeObject(int objIndex) { } byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { - byte *dataP; - - dataP = NULL; + byte *dataP = NULL; int val1 = _vm->_globals.ObjetW[objIndex].field0; int val2 = _vm->_globals.ObjetW[objIndex]._idx; @@ -2186,10 +2184,8 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { * Load Zone */ void ObjectsManager::loadZone(const Common::String &file) { - int v3; + int bobZoneIdx; int v4; - int v5; - int v6; byte *v9; int v10; byte *v13; @@ -2197,22 +2193,22 @@ void ObjectsManager::loadZone(const Common::String &file) { int16 v18; byte *ptr; - for (int v1 = 1; v1 <= 100; v1++) { - _vm->_globals.ZONEP[v1]._destX = 0; - _vm->_globals.ZONEP[v1]._destY = 0; - _vm->_globals.ZONEP[v1].field4 = 0; - _vm->_globals.ZONEP[v1].field6 = 0; - _vm->_globals.ZONEP[v1].field7 = 0; - _vm->_globals.ZONEP[v1].field8 = 0; - _vm->_globals.ZONEP[v1].field9 = 0; - _vm->_globals.ZONEP[v1].fieldA = 0; - _vm->_globals.ZONEP[v1].fieldB = 0; - _vm->_globals.ZONEP[v1].fieldC = 0; - _vm->_globals.ZONEP[v1].fieldD = 0; - _vm->_globals.ZONEP[v1].fieldE = 0; - _vm->_globals.ZONEP[v1].fieldF = 0; - _vm->_globals.ZONEP[v1].field12 = 0; - _vm->_globals.ZONEP[v1].field10 = 0; + for (int i = 1; i <= 100; i++) { + _vm->_globals.ZONEP[i]._destX = 0; + _vm->_globals.ZONEP[i]._destY = 0; + _vm->_globals.ZONEP[i].field4 = 0; + _vm->_globals.ZONEP[i].field6 = 0; + _vm->_globals.ZONEP[i].field7 = 0; + _vm->_globals.ZONEP[i].field8 = 0; + _vm->_globals.ZONEP[i].field9 = 0; + _vm->_globals.ZONEP[i].fieldA = 0; + _vm->_globals.ZONEP[i].fieldB = 0; + _vm->_globals.ZONEP[i].fieldC = 0; + _vm->_globals.ZONEP[i].fieldD = 0; + _vm->_globals.ZONEP[i].fieldE = 0; + _vm->_globals.ZONEP[i].fieldF = 0; + _vm->_globals.ZONEP[i].field12 = 0; + _vm->_globals.ZONEP[i].field10 = 0; } _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); @@ -2226,46 +2222,43 @@ void ObjectsManager::loadZone(const Common::String &file) { v18 = 0; v17 = 0; do { - v3 = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - if (v3 != -1) { - v5 = v3; - v6 = v3; + bobZoneIdx = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + if (bobZoneIdx != -1) { _vm->_linesManager.addZoneLine( v18, - READ_LE_UINT16((uint16 *)ptr + v4 + 1), + READ_LE_UINT16((uint16 *)ptr + v4 + 1), // CHECKME: Shouldn't it be a byte? READ_LE_UINT16((uint16 *)ptr + v4 + 2), READ_LE_UINT16((uint16 *)ptr + v4 + 3), READ_LE_UINT16((uint16 *)ptr + v4 + 4), - v3); - _vm->_globals.ZONEP[v5].field10 = 1; - v3 = v6; + bobZoneIdx); + _vm->_globals.ZONEP[bobZoneIdx].field10 = 1; } v4 += 5; ++v18; ++v17; - } while (v3 != -1); + } while (bobZoneIdx != -1); - for (int v7 = 1; v7 <= 100; v7++) { - // CHECKME: Shouldn't it be READ_LE_UINT8? - _vm->_globals.ZONEP[v7]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - _vm->_globals.ZONEP[v7]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); - _vm->_globals.ZONEP[v7].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); + for (int i = 1; i <= 100; i++) { + // CHECKME: Shouldn't it be a byte? + _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); + _vm->_globals.ZONEP[i].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); v4 += 3; } v9 = (ptr + 10 * v17 + 606); v10 = 0; - for (int v11 = 1; v11 <= 100; v11++) { - _vm->_globals.ZONEP[v11].field6 = v9[v10]; - _vm->_globals.ZONEP[v11].field7 = v9[v10 + 1]; - _vm->_globals.ZONEP[v11].field8 = v9[v10 + 2]; - _vm->_globals.ZONEP[v11].field9 = v9[v10 + 3]; - _vm->_globals.ZONEP[v11].fieldA = v9[v10 + 4]; - _vm->_globals.ZONEP[v11].fieldB = v9[v10 + 5]; - _vm->_globals.ZONEP[v11].fieldC = v9[v10 + 6]; - _vm->_globals.ZONEP[v11].fieldD = v9[v10 + 7]; - _vm->_globals.ZONEP[v11].fieldE = v9[v10 + 8]; - _vm->_globals.ZONEP[v11].fieldF = v9[v10 + 9]; + for (int i = 1; i <= 100; i++) { + _vm->_globals.ZONEP[i].field6 = v9[v10]; + _vm->_globals.ZONEP[i].field7 = v9[v10 + 1]; + _vm->_globals.ZONEP[i].field8 = v9[v10 + 2]; + _vm->_globals.ZONEP[i].field9 = v9[v10 + 3]; + _vm->_globals.ZONEP[i].fieldA = v9[v10 + 4]; + _vm->_globals.ZONEP[i].fieldB = v9[v10 + 5]; + _vm->_globals.ZONEP[i].fieldC = v9[v10 + 6]; + _vm->_globals.ZONEP[i].fieldD = v9[v10 + 7]; + _vm->_globals.ZONEP[i].fieldE = v9[v10 + 8]; + _vm->_globals.ZONEP[i].fieldF = v9[v10 + 9]; v10 += 10; } @@ -2814,7 +2807,7 @@ void ObjectsManager::CLEAR_ECRAN() { void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { CharacterLocation *loc; - CH_TETE = 1; + CH_TETE = true; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); _vm->_globals.NOT_VERIF = 1; @@ -2822,7 +2815,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { - CH_TETE = 0; + CH_TETE = false; loc = &_vm->_globals._saveData->_samantha; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); @@ -2849,7 +2842,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals.loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { - CH_TETE = 0; + CH_TETE = false; loc = &_vm->_globals._saveData->_realHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); @@ -3847,36 +3840,37 @@ void ObjectsManager::OPTI_OBJET() { Common::String file; int v0 = 1; int v5; - int v7; file = "OBJET1.ini"; data = _vm->_fileManager.searchCat(file, 1); if (data == g_PTRNUL) { _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); data = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + if (data == g_PTRNUL) + error("INI file %s not found", file.c_str()); } - if ((data == g_PTRNUL) || *data != 'I' || *(data + 1) != 'N' || *(data + 2) != 'I') { - error("Not an INI file"); - } else { - v7 = 0; - do { - v5 = _vm->_scriptManager.handleOpcode(data + 20 * v0); - if (_vm->shouldQuit()) - return; + if (data[0] != 'I' || data[1] != 'N' || data[2] != 'I') + error("File %s is not an INI file"); + + bool v7 = false; + do { + v5 = _vm->_scriptManager.handleOpcode(data + 20 * v0); + if (_vm->shouldQuit()) + return; + + if (v5 == 2) + v0 = _vm->_scriptManager.handleGoto(data + 20 * v0); + if (v5 == 3) + v0 = _vm->_scriptManager.handleIf(data, v0); + if (v0 == -1) + error("defective IFF function"); + if (v5 == 1 || v5 == 4) + ++v0; + if (!v5 || v5 == 5) + v7 = true; + } while (!v7); - if (v5 == 2) - v0 = _vm->_scriptManager.handleGoto(data + 20 * v0); - if (v5 == 3) - v0 = _vm->_scriptManager.handleIf(data, v0); - if (v0 == -1) - error("defective IFF function"); - if (v5 == 1 || v5 == 4) - ++v0; - if (!v5 || v5 == 5) - v7 = 1; - } while (v7 != 1); - } _vm->_globals.freeMemory(data); } @@ -3959,7 +3953,7 @@ void ObjectsManager::SPECIAL_JEU() { v2 = v2 + 614396; *v2 = *v3; v2 = v2 + 2; - *v2 = *(v3 + 2); + *v2 = v3[2]; _vm->_graphicsManager.no_scroll = 0; _vm->_graphicsManager.DD_VBL(); @@ -4010,15 +4004,15 @@ void ObjectsManager::BOB_VIVANT(int idx) { int v3; int v4; - v1 = 5 * idx; - v2 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + 2 * v1); - v3 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + 2 * v1 + 2); - v4 = *(_vm->_talkManager._characterAnim + 2 * v1 + 8); - if ((int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + 2 * v1 + 4)) { + v1 = 10 * idx; + v2 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1); + v3 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1 + 2); + v4 = _vm->_talkManager._characterAnim[v1 + 8]; + if ((int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1 + 4)) { if (!_vm->_globals.NO_OFFSET) _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, _vm->_graphicsManager.ofscroll + v2, v3, - *(_vm->_talkManager._characterAnim + 2 * v1 + 8)); + _vm->_talkManager._characterAnim[v1 + 8]); if (_vm->_globals.NO_OFFSET) _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, v2, v3, v4); } @@ -4286,13 +4280,14 @@ int ObjectsManager::BOBPOSI(int idx) { * Set Hopkins animation */ void ObjectsManager::setBobAnimation(int idx) { - if (_vm->_globals._bob[idx]._disabledAnimationFl) { - _vm->_globals._bob[idx]._disabledAnimationFl = false; - _vm->_globals._bob[idx].field10 = 5; - _vm->_globals._bob[idx]._frameIndex = 250; - _vm->_globals._bob[idx].field12 = 0; - _vm->_globals._bob[idx].field14 = 0; - } + if (!_vm->_globals._bob[idx]._disabledAnimationFl) + return; + + _vm->_globals._bob[idx]._disabledAnimationFl = false; + _vm->_globals._bob[idx].field10 = 5; + _vm->_globals._bob[idx]._frameIndex = 250; + _vm->_globals._bob[idx].field12 = 0; + _vm->_globals._bob[idx].field14 = 0; } /** diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 9fbaaced76..5f31b3a72a 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -100,7 +100,7 @@ public: int A_DEPA; int MAX_DEPA; int MAX_DEPA1; - int CH_TETE; + bool CH_TETE; int T_RECTIF; bool _disableFl; bool _twoCharactersFl; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 217f1f15f2..43b65d006e 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -203,7 +203,7 @@ LABEL_1141: _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); _vm->_objectsManager._characterPos.y = v6; _vm->_objectsManager.PERI = v5; - if (_vm->_objectsManager.CH_TETE == 1) { + if (_vm->_objectsManager.CH_TETE) { if (_vm->_globals._saveData->data[svField354] == 1 && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y && _vm->_globals._saveData->_cloneHopkins.field2 && _vm->_globals._saveData->_cloneHopkins._location) { @@ -255,7 +255,7 @@ LABEL_1141: } } opcodeType = 1; - _vm->_objectsManager.CH_TETE = 0; + _vm->_objectsManager.CH_TETE = false; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { if (!_vm->_objectsManager._disableFl) { int v7 = *(dataP + 5); -- cgit v1.2.3 From a8bc62fc0fb2ea5df8c08175c232af05ed898e38 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 31 Dec 2012 17:03:43 +0100 Subject: HOPKINS: Some renaming in ObjectManager, fix animation speed --- engines/hopkins/objects.cpp | 44 +++++++++++++++++++------------------------- engines/hopkins/objects.h | 2 +- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5c2a27788b..b9034ee246 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -4952,38 +4952,33 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int } while (spriteIndex != -1); } -void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5) { - int v5; +void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int a5) { int v6; char v7; - int v8; - int spriteIndex; - int v13; - int v14; - Common::String v15; - v14 = 0; - v5 = 0; - spriteIndex = 0; - v15 = " "; - v13 = a5; + int v14 = 0; + int v5 = 0; + int spriteIndex = 0; + Common::String tmpStr = " "; + int v13; if (_vm->_globals._speed == 2) v13 = a5 / 2; else if (_vm->_globals._speed == 3) v13 = a5 / 3; + else + v13 = a5; + for (;;) { v6 = 0; - v7 = a2[v14]; - if (v7 == 44) { - v8 = atoi(v15.c_str()); - spriteIndex = v8; + v7 = animString[v14]; + if (v7 == ',') { + spriteIndex = atoi(tmpStr.c_str()); v5 = 0; - v15 = " "; + tmpStr = " "; v6 = 1; } else { - v8 = v5; - v15.setChar(v7, v5); - v5 = v5 + 1; + tmpStr.setChar(v7, v5); + v5++; } ++v14; if (v6 == 1) { @@ -4994,14 +4989,13 @@ void ObjectsManager::SPACTION1(byte *a1, const Common::String &a2, int a3, int a _sprite[0].field14 -= a4; _sprite[0].fieldE = S_old_ret; } else { - _sprite[0]._spriteData = a1; + _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = spriteIndex; } - if (v13 > 0) { - for (int v9 = 0; v9 < v8; v9++) - _vm->_eventsManager.VBL(); - } + for (int v9 = 0; v9 < v13; v9++) + _vm->_eventsManager.VBL(); + if (spriteIndex == -1) break; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 5f31b3a72a..a0b15a38ee 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -236,7 +236,7 @@ public: void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6); - void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5); + void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int a5); void TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int a2); -- cgit v1.2.3 From cb363aafd5ed1d912e5b211e06c823307fb00489 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Jan 2013 13:53:07 +0100 Subject: HOPKINS: Refactoring in ObjectsManager, renaming --- engines/hopkins/anim.cpp | 8 +- engines/hopkins/dialogs.cpp | 86 +++++---- engines/hopkins/events.cpp | 4 +- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 4 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 50 +++--- engines/hopkins/lines.cpp | 18 +- engines/hopkins/objects.cpp | 413 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 12 +- engines/hopkins/script.cpp | 2 +- engines/hopkins/talk.cpp | 4 +- 13 files changed, 296 insertions(+), 311 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index ad967087f3..8b9945a429 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -241,7 +241,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; v12 = _vm->_graphicsManager._vesaScreen; v13 = _vm->_globals.allocMemory(20); @@ -604,9 +604,9 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { int x2 = (int16)READ_LE_UINT16(v13 + 4); int y2 = (int16)READ_LE_UINT16(v13 + 6); - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); + _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); if (_vm->_globals.Bank[idx]._fileHeader == 2) - _vm->_objectsManager.set_offsetxy(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); + _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); } _vm->_globals.freeMemory(v19); @@ -735,7 +735,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; } v9 = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(22); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0e1be64b8f..6f734f589d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -76,7 +76,7 @@ void DialogsManager::showOptionsDialog() { mousePos.y = _vm->_eventsManager.getMouseY(); if (!_vm->_soundManager._musicOffFl) { - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 138) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 138) { // Change the music volume ++_vm->_soundManager._musicVolume; @@ -89,7 +89,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 138) { + if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 138) { --_vm->_soundManager._musicVolume; if (_vm->_soundManager._musicVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); @@ -102,7 +102,7 @@ void DialogsManager::showOptionsDialog() { } } if (!_vm->_soundManager._soundOffFl) { - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 165) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 165) { ++_vm->_soundManager._soundVolume; if (_vm->_soundManager._soundVolume <= 16) _vm->_soundManager.playSound("bruit2.wav"); @@ -113,7 +113,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 165) { + if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 165) { --_vm->_soundManager._soundVolume; if (_vm->_soundManager._soundVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); @@ -126,7 +126,7 @@ void DialogsManager::showOptionsDialog() { } if (!_vm->_soundManager._voiceOffFl) { - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 192) { ++_vm->_soundManager._voiceVolume; if (_vm->_soundManager._voiceVolume <= 16) @@ -138,7 +138,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 192) { --_vm->_soundManager._voiceVolume; if (_vm->_soundManager._voiceVolume >= 0) _vm->_soundManager.playSound("bruit2.wav"); @@ -150,18 +150,18 @@ void DialogsManager::showOptionsDialog() { } } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) { + if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 219) _vm->_soundManager._textOffFl = !_vm->_soundManager._textOffFl; - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) { + if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 192) { _vm->_soundManager._voiceOffFl = !_vm->_soundManager._voiceOffFl; _vm->_soundManager.updateScummVMSoundSettings(); } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { - if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 138) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) { + if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 138) { if (_vm->_soundManager._musicOffFl) { _vm->_soundManager._musicOffFl = false; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); @@ -173,7 +173,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 165) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 165) { _vm->_soundManager._soundOffFl = !_vm->_soundManager._soundOffFl; _vm->_soundManager.updateScummVMSoundSettings(); @@ -182,13 +182,13 @@ void DialogsManager::showOptionsDialog() { } } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 281 && mousePos.y <= 310) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 281 && mousePos.y <= 310) { _vm->_globals._exitId = 300; doneFlag = true; } - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager.ofscroll + 490 && mousePos.y <= 310) + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 490 && mousePos.y <= 310) doneFlag = true; - if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 219) { + if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 219) { switch (_vm->_graphicsManager._scrollSpeed) { case 1: _vm->_graphicsManager._scrollSpeed = 2; @@ -232,7 +232,7 @@ void DialogsManager::showOptionsDialog() { //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) // _vm->_globals.SVGA = 2; - if (mousePos.x < _vm->_graphicsManager.ofscroll + 165 || mousePos.x > _vm->_graphicsManager.ofscroll + 496 || (uint)(mousePos.y - 107) > 211) + if (mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 || (uint)(mousePos.y - 107) > 211) doneFlag = true; } @@ -288,10 +288,10 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.VBL(); } while (!doneFlag); - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager.ofscroll + 164, - 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.ofscroll + 164, 107); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager.ofscroll + 164, 107, - _vm->_graphicsManager.ofscroll + 498, 320); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager._scrollOffset + 164, + 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollOffset + 164, 107); + _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager._scrollOffset + 164, 107, + _vm->_graphicsManager._scrollOffset + 498, 320); _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR); _vm->_globals._optionDialogFl = false; @@ -342,7 +342,7 @@ LABEL_7: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - int v19 = _inventX = _vm->_graphicsManager.ofscroll + 152; + int v19 = _inventX = _vm->_graphicsManager._scrollOffset + 152; _inventY = 114; int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); @@ -378,25 +378,21 @@ LABEL_7: int mousePosX = _vm->_eventsManager.getMouseX(); int mousePosY = _vm->_eventsManager.getMouseY(); - int v12 = _vm->_eventsManager.getMouseButton(); + int mouseButton = _vm->_eventsManager.getMouseButton(); int v10 = v13; int v11 = _vm->_linesManager.ZONE_OBJET(mousePosX, mousePosY); v13 = v11; if (v11 != v10) _vm->_objectsManager.initBorder(v11); - if (_vm->_eventsManager._mouseCursorId != 16) { - if ((uint16)(_vm->_eventsManager._mouseCursorId - 1) > 1u) { - if (_vm->_eventsManager._mouseCursorId != 3) { - if (v12 == 2) { - _vm->_objectsManager.OBJETPLUS(v13); - if (_vm->_eventsManager._mouseCursorId != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); - } - } + if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { + if (mouseButton == 2) { + _vm->_objectsManager.OBJETPLUS(v13); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); } } - if (v12 == 1) { - if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId || (uint16)(_vm->_eventsManager._mouseCursorId - 2) <= 1u) + if (mouseButton == 1) { + if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId) break; _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); if (_vm->_eventsManager._mouseCursorId == 8) @@ -434,8 +430,8 @@ LABEL_7: if (v20) break; _vm->_eventsManager.VBL(); - if ((uint16)(_vm->_globals._screenId - 35) <= 5u) - _vm->_objectsManager.SPECIAL_JEU(); + if (_vm->_globals._screenId >= 35 && _vm->_globals._screenId <= 40) + _vm->_objectsManager.handleSpecialGames(); } _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { @@ -484,8 +480,8 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - int v0 = _vm->_graphicsManager.ofscroll + 2; - int v1 = _vm->_graphicsManager.ofscroll + 2; + int v0 = _vm->_graphicsManager._scrollOffset + 2; + int v1 = _vm->_graphicsManager._scrollOffset + 2; _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); _vm->_objectsManager.I_old_x = v0; @@ -698,26 +694,26 @@ int DialogsManager::searchSavegames() { int xp = _vm->_eventsManager.getMouseX(); int yp = _vm->_eventsManager.getMouseY(); - _vm->_graphicsManager.ofscroll = _vm->_eventsManager._startPos.x; + _vm->_graphicsManager._scrollOffset = _vm->_eventsManager._startPos.x; if ((uint16)(yp - 112) <= 86) { if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) slotNumber = 1; - if ((uint16)(yp - 112) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 112) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) slotNumber = 2; } if ((uint16)(yp - 203) <= 86) { - if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) + if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) slotNumber = 3; - if ((uint16)(yp - 203) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 203) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) slotNumber = 4; } if ((uint16)(yp - 294) <= 86) { - if (xp > _vm->_graphicsManager.ofscroll + 189 && xp < _vm->_graphicsManager.ofscroll + 318) + if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) slotNumber = 5; - if ((uint16)(yp - 294) <= 86 && xp > _vm->_graphicsManager.ofscroll + 322 && xp < _vm->_graphicsManager.ofscroll + 452) + if ((uint16)(yp - 294) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) slotNumber = 6; } - if ((uint16)(yp - 388) <= 16 && xp > _vm->_graphicsManager.ofscroll + 273 && xp < _vm->_graphicsManager.ofscroll + 355) + if ((uint16)(yp - 388) <= 16 && xp > _vm->_graphicsManager._scrollOffset + 273 && xp < _vm->_graphicsManager._scrollOffset + 355) slotNumber = 7; switch (slotNumber) { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index cac6b83a20..1f85e3eeda 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -447,12 +447,12 @@ LABEL_65: _vm->_globals.NBBLOC = 0; _startPos.x = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.SCROLL = _vm->_graphicsManager.SCROLL; } _vm->_graphicsManager.OLD_SCROLL = _vm->_graphicsManager.SCROLL; _startPos.x = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager.ofscroll = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager.SCROLL; } _curMouseButton = _mouseButton; _mouseButton = 0; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 41f5ce355c..cef2f9686d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -149,7 +149,7 @@ Globals::Globals() { PERSO = 0; _screenId = 0; NOSPRECRAN = false; - OLD_ECRAN = 0; + _prevScreenId = 0; Max_Propre_Gen = 0; Max_Ligne_Long = 0; Max_Perso_Y = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f0c1af22dc..86524ea3e8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -402,7 +402,7 @@ public: int PLANI; bool NOSPRECRAN; int _screenId; - int OLD_ECRAN; + int _prevScreenId; int fmusic; int Max_Propre; int Max_Propre_Gen; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8264b6ba70..b7cbd55694 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -41,7 +41,7 @@ GraphicsManager::GraphicsManager() { PAL_PIXELS = NULL; _lineNbr = 0; _videoPtr = NULL; - ofscroll = 0; + _scrollOffset = 0; SCROLL = 0; PCX_L = PCX_H = 0; DOUBLE_ECRAN = false; @@ -249,7 +249,7 @@ void GraphicsManager::initColorTable(int minIndex, int maxIndex, byte *palette) void GraphicsManager::scrollScreen(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); _vm->_eventsManager._startPos.x = result; - ofscroll = result; + _scrollOffset = result; SCROLL = result; } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 40bbd67cb5..6215e16cc3 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -67,7 +67,7 @@ public: Graphics::Surface *_videoPtr; byte *_vesaScreen; byte *_vesaBuffer; - int ofscroll; + int _scrollOffset; int SCROLL; byte HEADER_PCX[128]; int PCX_L, PCX_H; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dbd97bc657..827b548bf0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -386,7 +386,7 @@ bool HopkinsEngine::runWin95Demo() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = _globals._screenId; @@ -395,7 +395,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 114: - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = _globals._screenId; @@ -406,7 +406,7 @@ bool HopkinsEngine::runWin95Demo() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = _globals._screenId; @@ -740,7 +740,7 @@ bool HopkinsEngine::runLinuxDemo() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = 113; @@ -758,7 +758,7 @@ bool HopkinsEngine::runLinuxDemo() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; @@ -770,7 +770,7 @@ bool HopkinsEngine::runLinuxDemo() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = 115; @@ -1612,7 +1612,7 @@ bool HopkinsEngine::runOS2Full() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[5] = 113; @@ -1622,7 +1622,7 @@ bool HopkinsEngine::runOS2Full() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[5] = 114; @@ -1632,7 +1632,7 @@ bool HopkinsEngine::runOS2Full() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[5] = 115; @@ -2503,7 +2503,7 @@ bool HopkinsEngine::runBeOSFull() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = 113; @@ -2513,7 +2513,7 @@ bool HopkinsEngine::runBeOSFull() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; @@ -2523,7 +2523,7 @@ bool HopkinsEngine::runBeOSFull() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = 115; @@ -3383,9 +3383,9 @@ bool HopkinsEngine::runWin95full() { break; case 113: - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._screenId = 113; - _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_HOPKINS); @@ -3394,18 +3394,18 @@ bool HopkinsEngine::runWin95full() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._screenId = 114; - _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.setModeVesa(); break; case 115: - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._screenId = 115; - _globals._saveData->data[svField6] = _globals.OLD_ECRAN; + _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_PUBLIC); @@ -4262,7 +4262,7 @@ bool HopkinsEngine::runLinuxFull() { case 113: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; _globals._saveData->data[svField5] = 113; @@ -4279,7 +4279,7 @@ bool HopkinsEngine::runLinuxFull() { case 114: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; @@ -4291,7 +4291,7 @@ bool HopkinsEngine::runLinuxFull() { case 115: _globals._exitId = 0; - _globals.OLD_ECRAN = _globals._screenId; + _globals._prevScreenId = _globals._screenId; _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; _globals._saveData->data[svField5] = 115; @@ -4481,7 +4481,7 @@ void HopkinsEngine::playIntro() { _soundManager.WSOUND(11); _graphicsManager.loadImage("intro1"); _graphicsManager.scrollScreen(0); - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4527,7 +4527,7 @@ void HopkinsEngine::playIntro() { _soundManager.WSOUND(23); _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4575,7 +4575,7 @@ void HopkinsEngine::playIntro() { _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); _objectsManager.stopBobAnimation(1); - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -4967,7 +4967,7 @@ void HopkinsEngine::playEnding() { _globals.PERSO = _globals.freeMemory(_globals.PERSO); _dialogsManager._removeInventFl = true; _globals._disableInventFl = true; - _graphicsManager.ofscroll = 0; + _graphicsManager._scrollOffset = 0; _globals.PLAN_FLAG = false; _globals.iRegul = 1; _soundManager.WSOUND(26); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 29657d9505..fb15142dc1 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -72,11 +72,11 @@ int LinesManager::ZONE_OBJET(int posX, int posY) { v2 = OPTI_ZONE(posX, 19, false); if ((uint)(posY - 268) <= 37) v2 = OPTI_ZONE(posX, 25, true); - if ((uint)(posY - 268) <= 20 && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(posY - 268) <= 20 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) v2 = 30; - if ((uint)(posY - 290) <= 16 && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) + if ((uint)(posY - 290) <= 16 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) v2 = 31; - if (posX < _vm->_graphicsManager.ofscroll + 152 || posX > _vm->_graphicsManager.ofscroll + 484) + if (posX < _vm->_graphicsManager._scrollOffset + 152 || posX > _vm->_graphicsManager._scrollOffset + 484) v2 = 32; if ((uint)(posY - 114) > 192) v2 = 32; @@ -85,30 +85,30 @@ int LinesManager::ZONE_OBJET(int posX, int posY) { int LinesManager::OPTI_ZONE(int posX, int minZoneNum, bool lastRow) { int result = minZoneNum; - if (posX >= _vm->_graphicsManager.ofscroll + 158 && posX <= _vm->_graphicsManager.ofscroll + 208) + if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX <= _vm->_graphicsManager._scrollOffset + 208) return result; - if (posX >= _vm->_graphicsManager.ofscroll + 208 && posX <= _vm->_graphicsManager.ofscroll + 266) { + if (posX >= _vm->_graphicsManager._scrollOffset + 208 && posX <= _vm->_graphicsManager._scrollOffset + 266) { result += 1; return result; } - if (posX >= _vm->_graphicsManager.ofscroll + 266 && posX <= _vm->_graphicsManager.ofscroll + 320) { + if (posX >= _vm->_graphicsManager._scrollOffset + 266 && posX <= _vm->_graphicsManager._scrollOffset + 320) { result += 2; return result; } - if (posX >= _vm->_graphicsManager.ofscroll + 320 && posX <= _vm->_graphicsManager.ofscroll + 370) { + if (posX >= _vm->_graphicsManager._scrollOffset + 320 && posX <= _vm->_graphicsManager._scrollOffset + 370) { result += 3; return result; } - if (posX >= _vm->_graphicsManager.ofscroll + 370 && posX <= _vm->_graphicsManager.ofscroll + 424) { + if (posX >= _vm->_graphicsManager._scrollOffset + 370 && posX <= _vm->_graphicsManager._scrollOffset + 424) { result += 4; return result; } - if (!lastRow && posX >= _vm->_graphicsManager.ofscroll + 424 && posX <= _vm->_graphicsManager.ofscroll + 478) { + if (!lastRow && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) { result += 5; return result; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b9034ee246..8c01f53364 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -182,7 +182,7 @@ void ObjectsManager::removeObject(int objIndex) { /** * Set Offset XY */ -void ObjectsManager::set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize) { +void ObjectsManager::setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize) { byte *startP = data + 3; for (int i = idx; i; --i) startP += READ_LE_UINT32(startP) + 16; @@ -1491,7 +1491,7 @@ void ObjectsManager::checkZone() { v2 = v1; if (_vm->_globals.PLAN_FLAG || _vm->_eventsManager._startPos.x >= v0 - || (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1) + || (v1 = _vm->_graphicsManager._scrollOffset + 54, v0 >= v1) || (v1 = v2 - 1, (uint16)(v2 - 1) > 59)) { if (_visibleFl) FLAG_VISIBLE_EFFACE = 4; @@ -2381,7 +2381,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager.mouseOn(); v3 = getSpriteX(0); _vm->_graphicsManager.scrollScreen(v3 - 320); - _vm->_graphicsManager.ofscroll = getSpriteX(0) - 320; + _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; SPRITE_ON(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -2474,7 +2474,7 @@ void ObjectsManager::handleLeftButton() { destX = _vm->_eventsManager.getMouseX(); destY = _vm->_eventsManager.getMouseY(); - if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 78) { + if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 && (uint16)(destY + 29) <= 78) { v1 = _vm->_eventsManager._mouseCursorId; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); @@ -3699,17 +3699,17 @@ void ObjectsManager::initBorder(int a1) { if ((uint16)(a1 - 25) <= 4u) _borderPos.y = 272; if (a1 == 1 || a1 == 7 || a1 == 13 || a1 == 19 || a1 == 25) - _borderPos.x = _vm->_graphicsManager.ofscroll + 158; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 158; if (a1 == 2 || a1 == 8 || a1 == 14 || a1 == 20 || a1 == 26) - _borderPos.x = _vm->_graphicsManager.ofscroll + 212; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 212; if (a1 == 3 || a1 == 9 || a1 == 15 || a1 == 21 || a1 == 27) - _borderPos.x = _vm->_graphicsManager.ofscroll + 266; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 266; if (a1 == 4 || a1 == 10 || a1 == 16 || a1 == 22 || a1 == 28) - _borderPos.x = _vm->_graphicsManager.ofscroll + 320; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 320; if (a1 == 5 || a1 == 11 || a1 == 17 || a1 == 23 || a1 == 29) - _borderPos.x = _vm->_graphicsManager.ofscroll + 374; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 374; if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u) - _borderPos.x = _vm->_graphicsManager.ofscroll + 428; + _borderPos.x = _vm->_graphicsManager._scrollOffset + 428; if ((uint16)(a1 - 1) <= 28) _borderSpriteIndex = 0; if ((uint16)(a1 - 30) <= 1) @@ -3874,99 +3874,111 @@ void ObjectsManager::OPTI_OBJET() { _vm->_globals.freeMemory(data); } -void ObjectsManager::SPECIAL_JEU() { - byte *v1; +void ObjectsManager::handleSpecialGames() { + byte *oldPalette; byte *v2; byte *v3; - if ((uint16)(_vm->_globals._screenId - 35) <= 6u) { - if (_vm->_globals.OLD_ECRAN == 16 && _vm->_globals._screenId == 35) - TEST_FORET(35, 500, 555, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals._screenId == 35) - TEST_FORET(35, 6, 84, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 35 && _vm->_globals._screenId == 36) - TEST_FORET(36, 551, 633, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals._screenId == 36) - TEST_FORET(36, 6, 84, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 36 && _vm->_globals._screenId == 37) - TEST_FORET(37, 551, 633, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals._screenId == 37) - TEST_FORET(37, 392, 529, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 37 && _vm->_globals._screenId == 38) - TEST_FORET(38, 133, 252, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals._screenId == 38) - TEST_FORET(38, 6, 84, 100, 440, 3); - if (_vm->_globals.OLD_ECRAN == 38 && _vm->_globals._screenId == 39) - TEST_FORET(39, 551, 633, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals._screenId == 39) - TEST_FORET(39, 6, 84, 100, 440, 3); - if (_vm->_globals.OLD_ECRAN == 39 && _vm->_globals._screenId == 40) - TEST_FORET(40, 133, 252, 100, 440, 4); - if (_vm->_globals.OLD_ECRAN == 41 && _vm->_globals._screenId == 40) - TEST_FORET(40, 392, 529, 100, 440, 2); - if (_vm->_globals.OLD_ECRAN == 40 && _vm->_globals._screenId == 41) - TEST_FORET(41, 551, 633, 100, 440, 1); - if (_vm->_globals.OLD_ECRAN == 17 && _vm->_globals._screenId == 41) - TEST_FORET(41, 6, 84, 100, 440, 3); - } - if (_vm->_globals._screenId == 5) { - if (getSpriteY(0) <= 399) { - if (!_vm->_globals._saveData->data[svField173]) { - _vm->_globals._saveData->data[svField173] = 1; - _vm->_globals.NOPARLE = true; - _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); - _vm->_globals.NOPARLE = false; - if (!_vm->_globals._censorshipFl) { - v1 = _vm->_globals.allocMemory(1000); - memcpy(v1, _vm->_graphicsManager._palette, 769); - - _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200); - - if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; - _vm->_graphicsManager.NB_SCREEN(); - _vm->_soundManager.SPECIAL_SOUND = 198; - PERSO_ON = true; - _vm->_animationManager.NO_SEQ = true; - _vm->_animationManager._clearAnimationFl = false; - _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); - _vm->_animationManager.NO_SEQ = false; - _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_globals.NECESSAIRE = true; - _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = false; - - _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); - g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); - - PERSO_ON = false; - memcpy(_vm->_graphicsManager._palette, v1, 769); - _vm->_graphicsManager.SHOW_PALETTE(); - _vm->_globals.freeMemory(v1); - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager.unlockScreen(); - v2 = _vm->_graphicsManager._vesaBuffer; - v3 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v3 = v3 + 614396; - v2 = v2 + 614396; - *v2 = *v3; - v2 = v2 + 2; - *v2 = v3[2]; - - _vm->_graphicsManager.no_scroll = 0; - _vm->_graphicsManager.DD_VBL(); - } - } - } - } - if (_vm->_globals._screenId == 20) - _vm->_globals._saveData->data[svField132] = getSpriteX(0) > 65 - && getSpriteX(0) <= 124 - && getSpriteY(0) > 372 - && getSpriteY(0) <= 398; - if (_vm->_globals._screenId == 57) { + switch (_vm->_globals._screenId) { + case 5: + if ((getSpriteY(0) > 399) || _vm->_globals._saveData->data[svField173]) + break; + + _vm->_globals._saveData->data[svField173] = 1; + _vm->_globals.NOPARLE = true; + _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); + _vm->_globals.NOPARLE = false; + + if (_vm->_globals._censorshipFl) + break; + + oldPalette = _vm->_globals.allocMemory(1000); + memcpy(oldPalette, _vm->_graphicsManager._palette, 769); + + _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200); + + if (!_vm->_graphicsManager._lineNbr) + _vm->_graphicsManager._scrollOffset = 0; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_soundManager.SPECIAL_SOUND = 198; + PERSO_ON = true; + _vm->_animationManager.NO_SEQ = true; + _vm->_animationManager._clearAnimationFl = false; + _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); + _vm->_animationManager.NO_SEQ = false; + _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_globals.NECESSAIRE = true; + _vm->_graphicsManager.NB_SCREEN(); + _vm->_globals.NECESSAIRE = false; + + _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); + g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); + + PERSO_ON = false; + memcpy(_vm->_graphicsManager._palette, oldPalette, 769); + _vm->_graphicsManager.SHOW_PALETTE(); + _vm->_globals.freeMemory(oldPalette); + _vm->_graphicsManager.lockScreen(); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.unlockScreen(); + v2 = _vm->_graphicsManager._vesaBuffer; + v3 = _vm->_graphicsManager._vesaScreen; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); + v3 = v3 + 614396; + v2 = v2 + 614396; + *v2 = *v3; + v2 = v2 + 2; + *v2 = v3[2]; + + _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager.DD_VBL(); + break; + case 20: + _vm->_globals._saveData->data[svField132] = (getSpriteX(0) > 65 && getSpriteX(0) <= 124 && getSpriteY(0) > 372 && getSpriteY(0) <= 398) ? 1 : 0; + break; + case 35: + if (_vm->_globals._prevScreenId == 16) + handleForest(35, 500, 555, 100, 440, 1); + else if (_vm->_globals._prevScreenId == 36) + handleForest(35, 6, 84, 100, 440, 4); + break; + case 36: + if (_vm->_globals._prevScreenId == 35) + handleForest(36, 551, 633, 100, 440, 2); + else if (_vm->_globals._prevScreenId == 37) + handleForest(36, 6, 84, 100, 440, 4); + break; + case 37: + if (_vm->_globals._prevScreenId == 36) + handleForest(37, 551, 633, 100, 440, 1); + else if (_vm->_globals._prevScreenId == 38) + handleForest(37, 392, 529, 100, 440, 2); + break; + case 38: + if (_vm->_globals._prevScreenId == 37) + handleForest(38, 133, 252, 100, 440, 4); + else if (_vm->_globals._prevScreenId == 39) + handleForest(38, 6, 84, 100, 440, 3); + break; + case 39: + if (_vm->_globals._prevScreenId == 38) + handleForest(39, 551, 633, 100, 440, 2); + else if (_vm->_globals._prevScreenId == 40) + handleForest(39, 6, 84, 100, 440, 3); + break; + case 40: + if (_vm->_globals._prevScreenId == 39) + handleForest(40, 133, 252, 100, 440, 4); + else if (_vm->_globals._prevScreenId == 41) + handleForest(40, 392, 529, 100, 440, 2); + break; + case 41: + if (_vm->_globals._prevScreenId == 40) + handleForest(41, 551, 633, 100, 440, 1); + else if (_vm->_globals._prevScreenId == 17) + handleForest(41, 6, 84, 100, 440, 3); + break; + case 57: _vm->_globals._disableInventFl = true; if (_vm->_globals._saveData->data[svField261] == 1 && BOBPOSI(5) == 37) { stopBobAnimation(5); @@ -3984,8 +3996,11 @@ void ObjectsManager::SPECIAL_JEU() { _vm->_globals._saveData->data[svField261] = 3; } _vm->_globals._disableInventFl = false; - } - if (_vm->_globals._screenId == 93 && !_vm->_globals._saveData->data[svField333]) { + break; + case 93: + if (_vm->_globals._saveData->data[svField333]) + break; + _vm->_globals._disableInventFl = true; do _vm->_eventsManager.VBL(); @@ -3995,27 +4010,23 @@ void ObjectsManager::SPECIAL_JEU() { stopBobAnimation(8); _vm->_globals._saveData->data[svField333] = 1; _vm->_globals._disableInventFl = false; + break; } } void ObjectsManager::BOB_VIVANT(int idx) { - int v1; - int v2; - int v3; - int v4; + int startPos = 10 * idx; + if (!READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 4)) + return; - v1 = 10 * idx; - v2 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1); - v3 = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1 + 2); - v4 = _vm->_talkManager._characterAnim[v1 + 8]; - if ((int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + v1 + 4)) { - if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, - _vm->_graphicsManager.ofscroll + v2, v3, - _vm->_talkManager._characterAnim[v1 + 8]); - if (_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, v2, v3, v4); - } + int xp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos); + int yp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 2); + int spriteIndex = _vm->_talkManager._characterAnim[startPos + 8]; + + if (!_vm->_globals.NO_OFFSET) + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, _vm->_graphicsManager._scrollOffset + xp, yp, spriteIndex); + else + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, xp, yp, spriteIndex); } void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { @@ -4520,7 +4531,7 @@ void ObjectsManager::INILINK(const Common::String &file) { void ObjectsManager::SPECIAL_INI() { switch (_vm->_globals._screenId) { case 17: - if (_vm->_globals.OLD_ECRAN == 20) { + if (_vm->_globals._prevScreenId == 20) { _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -4560,7 +4571,7 @@ void ObjectsManager::SPECIAL_INI() { break; case 18: - if (_vm->_globals.OLD_ECRAN == 17) { + if (_vm->_globals._prevScreenId == 17) { _vm->_eventsManager._mouseSpriteId = 4; _vm->_globals.BPP_NOAFF = true; for (int i = 0; i <= 4; i++) @@ -4836,85 +4847,67 @@ int ObjectsManager::colision(int xp, int yp) { return -1; } -void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6) { - int v6; - int v7; - char v8; - int v9; - int v13; - const byte *v14; - char v15; - int v16; +void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, int a6) { + bool tokenCompleteFl; + char curChar; int spriteIndex; - int v18; - Common::String v19; - v18 = 0; - v6 = 0; - v13 = 0; - v15 = a5; - v19 = " "; + int strPos = 0; + int idx = 0; + Common::String tmpStr = ""; + int realSpeed = speed; if (_vm->_globals._speed == 2) - v15 = a5 / 2; + realSpeed = speed / 2; else if (_vm->_globals._speed == 3) - v15 = a5 / 3; - v14 = _sprite[0]._spriteData; + realSpeed = speed / 3; + const byte *oldSpriteData = _sprite[0]._spriteData; spriteIndex = _sprite[0]._spriteIndex; - v16 = _sprite[0].fieldE; + int oldFieldE = _sprite[0].fieldE; _sprite[0].field12 += a3; _sprite[0].field14 += a4; _sprite[0].fieldE = a6; for (;;) { - v7 = 0; - v8 = a2[v18]; - if (v8 == ',') { - v9 = atoi(v19.c_str()); - v13 = v9; - v6 = 0; - v19 = " "; - v7 = 1; + tokenCompleteFl = false; + curChar = a2[strPos]; + if (curChar == ',') { + idx = atoi(tmpStr.c_str()); + tmpStr = ""; + tokenCompleteFl = true; } else { - v9 = v6; - v19 += v8; - v6 = v6 + 1; + tmpStr += curChar; } - ++v18; - if (v7 == 1) { - if (v13 == -1) { - _sprite[0]._spriteData = v14; + ++strPos; + + if (tokenCompleteFl) { + if (idx == -1) { + _sprite[0]._spriteData = oldSpriteData; _sprite[0]._spriteIndex = spriteIndex; _sprite[0].field12 -= a3; _sprite[0].field14 -= a4; - _sprite[0].fieldE = v16; + _sprite[0].fieldE = oldFieldE; } else { _sprite[0]._spriteData = spriteData; - _sprite[0]._spriteIndex = v13; + _sprite[0]._spriteIndex = idx; } - for (int v10 = 0; v10 < v15; v10++) + for (int v10 = 0; v10 < realSpeed; v10++) _vm->_eventsManager.VBL(); - if (v13 == -1) + if (idx == -1) break; } } } -void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6) { - int v6; - char v8; - int v9; - int spriteIndex; - char v14; - Common::String v16; +void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, int a6) { + int spriteIndex = 0; + Common::String tmpStr = ""; - v6 = 0; - spriteIndex = 0; - v16 = " "; - v14 = a5; + int realSpeed = speed; if (_vm->_globals._speed == 2) - v14 = a5 / 2; + realSpeed = speed / 2; else if (_vm->_globals._speed == 3) - v14 = a5 / 3; + realSpeed = speed / 3; + S_old_spr = _sprite[0]._spriteData; S_old_ani = _sprite[0]._spriteIndex; S_old_ret = _sprite[0].fieldE; @@ -4923,65 +4916,61 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int _sprite[0].fieldE = a6; uint strPos = 0; + char nextChar; do { - bool loopCond = false; + bool completeTokenFl = false; do { - v8 = animationSeq[strPos]; + nextChar = animationSeq[strPos]; if ((animationSeq[strPos] == ',') || (strPos == animationSeq.size() - 1)) { // Safeguard: if the sequence doesn't end with a coma, simulate it's present. if (animationSeq[strPos] != ',') - v16.setChar(v8, v6); - v9 = atoi(v16.c_str()); - spriteIndex = v9; - v6 = 0; - v16 = " "; - loopCond = true; + tmpStr += nextChar; + spriteIndex = atoi(tmpStr.c_str()); + tmpStr = ""; + completeTokenFl = true; } else { - v9 = v6; - v16.setChar(v8, v6); - v6 = v6 + 1; + tmpStr += nextChar; } ++strPos; - } while (!loopCond); + } while (!completeTokenFl); + if (spriteIndex != -1) { _sprite[0]._spriteData = a1; _sprite[0]._spriteIndex = spriteIndex; } - for (int v10 = 0; v10 < v14; v10++) + for (int i = 0; i < realSpeed; i++) _vm->_eventsManager.VBL(); } while (spriteIndex != -1); } -void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int a5) { - int v6; - char v7; - - int v14 = 0; - int v5 = 0; - int spriteIndex = 0; - Common::String tmpStr = " "; - int v13; +void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed) { + Common::String tmpStr = ""; + int realSpeed; if (_vm->_globals._speed == 2) - v13 = a5 / 2; + realSpeed = speed / 2; else if (_vm->_globals._speed == 3) - v13 = a5 / 3; + realSpeed = speed / 3; else - v13 = a5; + realSpeed = speed; + + int idx = 0; + int spriteIndex = 0; + bool completeTokenFl; + char nextChar; for (;;) { - v6 = 0; - v7 = animString[v14]; - if (v7 == ',') { + completeTokenFl = false; + nextChar = animString[idx]; + if (nextChar == ',') { spriteIndex = atoi(tmpStr.c_str()); - v5 = 0; - tmpStr = " "; - v6 = 1; + tmpStr = ""; + completeTokenFl = true; } else { - tmpStr.setChar(v7, v5); - v5++; + tmpStr += nextChar; } - ++v14; - if (v6 == 1) { + ++idx; + + if (completeTokenFl) { if (spriteIndex == -1) { _sprite[0]._spriteData = S_old_spr; _sprite[0]._spriteIndex = S_old_ani; @@ -4993,7 +4982,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin _sprite[0]._spriteIndex = spriteIndex; } - for (int v9 = 0; v9 < v13; v9++) + for (int i = 0; i < realSpeed; i++) _vm->_eventsManager.VBL(); if (spriteIndex == -1) @@ -5002,7 +4991,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin } } -void ObjectsManager::TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx) { +void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx) { int savegameIdx = screenId; if (_vm->_globals._screenId != screenId) return; @@ -5103,7 +5092,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_dialogsManager._removeInventFl = false; - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); @@ -5201,7 +5190,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_eventsManager._gameKey = KEY_NONE; _verb = 4; _vm->_globals.MAX_COMPTE = 6; - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_dialogsManager._removeInventFl = false; _vm->_globals.PLAN_FLAG = false; _vm->_graphicsManager._noFadingFl = false; @@ -5323,7 +5312,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (_vm->_globals.GOACTION) PARADISE(); } - SPECIAL_JEU(); + handleSpecialGames(); _vm->_eventsManager.VBL(); if (!_vm->_globals._exitId) continue; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index a0b15a38ee..7394bb6cac 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -132,7 +132,7 @@ public: void DEL_FICHIER_OBJ(); byte *loadSprite(const Common::String &file); - void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize); + void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize); int getOffsetX(const byte *spriteData, int spriteIndex, bool isSize); int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize); void displaySprite(); @@ -202,7 +202,7 @@ public: void OBJETPLUS(int a1); void VALID_OBJET(int a1); void OPTI_OBJET(); - void SPECIAL_JEU(); + void handleSpecialGames(); void BOB_VIVANT(int a1); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); @@ -234,10 +234,10 @@ public: int CALC_PROPRE(int idx); int colision(int xp, int yp); - void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6); - void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6); - void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int a5); - void TEST_FORET(int screenId, int minX, int maxX, int minY, int maxY, int idx); + void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, int a6); + void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, int a6); + void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); + void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int a2); /** diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 43b65d006e..7ec1804bd8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -263,7 +263,7 @@ LABEL_1141: int v8 = *(dataP + 7); int v9 = *(dataP + 8); _vm->_objectsManager.RECALL = 0; - _vm->_globals.OLD_ECRAN = _vm->_globals._screenId; + _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; _vm->_globals._screenId = v7; _vm->_globals._saveData->data[svField5] = v7; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 626bbef4f2..dee18f050d 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -100,7 +100,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_graphicsManager.NB_SCREEN(); _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, false); @@ -1137,7 +1137,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) - _vm->_graphicsManager.ofscroll = 0; + _vm->_graphicsManager._scrollOffset = 0; _vm->_graphicsManager.NB_SCREEN(); _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _vm->_graphicsManager.NB_SCREEN(); -- cgit v1.2.3 From d6f72071a42559299139fd2f162c98c7f01a0b51 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Jan 2013 21:03:24 +0100 Subject: HOPKINS: Some more refactoring and renaming --- engines/hopkins/anim.cpp | 12 +- engines/hopkins/computer.cpp | 47 +++---- engines/hopkins/events.cpp | 2 +- engines/hopkins/font.cpp | 52 ++++--- engines/hopkins/graphics.cpp | 149 ++++++++------------ engines/hopkins/graphics.h | 4 +- engines/hopkins/hopkins.cpp | 5 +- engines/hopkins/objects.cpp | 317 ++++++++++++++++++------------------------- engines/hopkins/objects.h | 6 +- engines/hopkins/script.cpp | 50 ++++--- engines/hopkins/talk.cpp | 49 ++----- 11 files changed, 281 insertions(+), 412 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 8b9945a429..36466a2090 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -319,7 +319,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN) { + if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); @@ -449,7 +449,7 @@ LABEL_114: _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN) { + if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); @@ -680,8 +680,8 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { WRITE_LE_UINT16(dataP + 22, v11); WRITE_LE_UINT16(dataP + 24, v22); WRITE_LE_UINT16(dataP + 26, v12); - *(dataP + 28) = *(v21 + data + 33); - *(dataP + 29) = *(v21 + data + 34); + dataP[28] = data[v21 + 33]; + dataP[29] = data[v21 + 34]; for (int v14 = 1; v14 <= 4999; v14++) { v9 += 10; @@ -697,8 +697,8 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { WRITE_LE_UINT16(v9 + 2, v15); WRITE_LE_UINT16(v9 + 4, v22); WRITE_LE_UINT16(v9 + 6, v16); - *(v9 + 8) = *(v23 + 8); - *(v9 + 9) = *(v23 + 9); + v9[8] = v23[8]; + v9[9] = v23[9]; } loopCond = true; } diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 52ca3af693..068792d7a4 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -240,7 +240,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { switch (keyPressed) { case '2': readText(6); - break; + break; case '3': readText(7); break; @@ -482,8 +482,7 @@ void ComputerManager::restoreFBIRoom() { */ void ComputerManager::readText(int idx) { uint16 v1; - int v2; - uint16 v3; + bool foundFl; int v4; int v5; int v6; @@ -506,21 +505,18 @@ void ComputerManager::readText(int idx) { ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v1 = _vm->_fileManager.fileSize(_vm->_globals._curFilename); - v2 = 0; - v3 = 0; - if (v1 > 0u) { - do { - if (*(ptr + v3) == '%') { - numStr = Common::String::format("%c%c", *(ptr + v3 + 1), *(ptr + v3 + 2)); - num = atol(numStr.c_str()); + foundFl = false; + int v3; + for (v3 = 0; v3 < v1; v3++) { + if (ptr[v3] == '%') { + numStr = Common::String::format("%c%c", ptr[v3 + 1], ptr[v3 + 2]); + num = atol(numStr.c_str()); - if (num == idx) - v2 = 1; - } - if (v2 == 1) - break; - ++v3; - } while (v3 < v1); + if (num == idx) + foundFl = true; + } + if (foundFl) + break; } v4 = v3; if (v3 > v1 - 1) @@ -531,10 +527,8 @@ void ComputerManager::readText(int idx) { v6 = 5; v7 = 0; do { - v4 = *(ptr + v10); + v4 = ptr[v10]; if (v4 == 13) { -// v12[v7] = 0; -// v7 = 0; v8 = v4; setTextPosition(v6, v5); outText(v12); @@ -545,7 +539,6 @@ void ComputerManager::readText(int idx) { v4 = v8; v12 = ""; } else if (v4 != '%') { - //v12[v7++] = v4; v12 += v4; ++v7; } @@ -619,14 +612,14 @@ void ComputerManager::loadHiscore() { for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { - nextChar = *(ptr + i + (16 * scoreIndex)); + nextChar = ptr[i + (16 * scoreIndex)]; if (!nextChar) nextChar = ' '; _score[scoreIndex]._name += nextChar; } for (int i = 0; i < 9; ++i) { - nextChar = *(ptr + i + scoreIndex * 16 + 6); + nextChar = ptr[i + scoreIndex * 16 + 6]; if (!nextChar) nextChar = '0'; _score[scoreIndex]._score += nextChar; @@ -1047,19 +1040,19 @@ void ComputerManager::saveScore() { v8 = _score[v14]._name[v7]; if (!v8) v8 = 32; - *(ptr + (16 * v5) + v7) = v8; + ptr[(16 * v5) + v7] = v8; }; - *(ptr + v6 + 5) = 0; + ptr[v6 + 5] = 0; v9 = v6 + 6; for (int v10 = 0; v10 <= 8; v10++) { v11 = _score[v14]._score[v10]; if (!v11) v11 = 48; - *(ptr + v9 + v10) = v11; + ptr[v9 + v10] = v11; }; - *(ptr + v9 + 9) = 0; + ptr[v9 + 9] = 0; } _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 1f85e3eeda..18f0aa420c 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -418,7 +418,7 @@ LABEL_63: LABEL_65: _vm->_globals._speed = 2; _rateCounter = 0; - if (!_vm->_graphicsManager.DOUBLE_ECRAN || _vm->_graphicsManager.no_scroll == 1) { + if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { if (_vm->_graphicsManager.no_scroll != 2) { diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 9ac2446548..0282e88cc4 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -355,12 +355,12 @@ LABEL_57: } } _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; - int v56 = v73; - int v55 = yp; - int v53 = _vm->_globals._boxWidth + 10; - int v51 = (_vm->_globals.police_h + 1) * lineCount + 12; + int posX = v73; + int posY = yp; + int saveWidth = _vm->_globals._boxWidth + 10; + int saveHeight = (_vm->_globals.police_h + 1) * lineCount + 12; if (_text[idx]._textType == 6) { - int v27 = v53 / 2; + int v27 = saveWidth / 2; if (v27 < 0) v27 = -v27; _text[idx]._pos.x = 315 - v27; @@ -368,37 +368,36 @@ LABEL_57: v73 = _vm->_eventsManager._startPos.x + 315 - v27; _text[idx]._pos.y = 50; v70 = 50; - v55 = 50; - v56 = v28; + posY = 50; + posX = v28; } int textType = _text[idx]._textType; if (textType == 1 || textType == 3 || textType == 5 || textType == 6) { - int v49 = v51 * v53; - byte *ptrd = _vm->_globals.allocMemory(v49); - if (ptrd == g_PTRNUL) { - error("Cutting a block for text box (%d)", v49); - } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); - _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, v49); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); + int size = saveHeight * saveWidth; + byte *ptrd = _vm->_globals.allocMemory(size); + if (ptrd == g_PTRNUL) + error("Cutting a block for text box (%d)", size); + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); + _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, size); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); _vm->_globals.freeMemory(ptrd); - _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, v56, v55, v53, (byte)-2); - _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, v56, v51 + v55, v53, (byte)-2); - _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, v56, v70, v51, (byte)-2); - _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, v53 + v56, v70, v51, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, posY, saveWidth, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, saveHeight + posY, saveWidth, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, posX, posY, saveHeight, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, saveWidth + posX, posY, saveHeight, (byte)-2); } _text[idx]._lineCount = lineCount; - int v75 = v73 + 5; - int v71 = v70 + 5; + int v71 = posY + 5; for (int lineNum = 0; lineNum < lineCount; ++lineNum) { - displayText(v75, v71, _text[idx]._lines[lineNum], _text[idx]._color); + displayText(v73 + 5, v71, _text[idx]._lines[lineNum], _text[idx]._color); v71 += _vm->_globals.police_h + 1; } - int blockWidth = v53 + 1; - int blockHeight = v51 + 1; + int blockWidth = saveWidth + 1; + int blockHeight = saveHeight + 1; _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; @@ -413,7 +412,7 @@ LABEL_57: _text[idx]._textBlock = ptre; _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, v56, v55, _text[idx]._width, blockHeight); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, posX, posY, _text[idx]._width, blockHeight); } _tempText = _vm->_globals.freeMemory(_tempText); } @@ -423,12 +422,11 @@ LABEL_57: * Directly display text (using a VESA segment) */ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, int col) { - const char *srcP; char currChar; int charIndex; int currentX = xp; - srcP = message.c_str(); + const char *srcP = message.c_str(); for (;;) { currChar = *srcP++; if (!currChar) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b7cbd55694..0d4073d67d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -43,8 +43,7 @@ GraphicsManager::GraphicsManager() { _videoPtr = NULL; _scrollOffset = 0; SCROLL = 0; - PCX_L = PCX_H = 0; - DOUBLE_ECRAN = false; + _largeScreenFl = false; OLD_SCROLL = 0; _lineNbr2 = 0; @@ -196,13 +195,13 @@ void GraphicsManager::loadScreen(const Common::String &file) { } scrollScreen(0); - A_PCX640_480((byte *)_vesaScreen, file, _palette, flag); + A_PCX640_480(_vesaScreen, file, _palette, flag); SCROLL = 0; OLD_SCROLL = 0; clearPalette(); - if (!DOUBLE_ECRAN) { + if (!_largeScreenFl) { SCANLINE(SCREEN_WIDTH); max_x = SCREEN_WIDTH; lockScreen(); @@ -254,20 +253,19 @@ void GraphicsManager::scrollScreen(int amount) { } void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold) { - byte *destPosP; int palIndex; int srcOffset; int col1, col2; - destPosP = destP; + byte *destPosP = destP; for (int idx = 0; idx < count; ++idx) { - palIndex = *(byte *)destPosP++; + palIndex = *destPosP; srcOffset = 3 * palIndex; - col1 = *(srcP + srcOffset) + *(srcP + srcOffset + 1) + *(srcP + srcOffset + 2); + col1 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; for (int idx2 = 0; idx2 < 38; ++idx2) { srcOffset = 3 * idx2; - col2 = *(srcP + srcOffset) + *(srcP + srcOffset + 1) + *(srcP + srcOffset + 2); + col2 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; col2 += minThreshold; if (col2 < col1) @@ -277,9 +275,10 @@ void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int m if (col2 > col1) continue; - *(destPosP - 1) = (idx2 == 0) ? 1 : idx2; + *destPosP = (idx2 == 0) ? 1 : idx2; break; } + destPosP++; } } @@ -288,12 +287,12 @@ void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { byte *dataP = surface; for (int count = size - 1; count; count--){ - dataVal = *dataP++; - *(dataP - 1) = *(dataVal + col); + dataVal = *dataP; + *dataP = col[dataVal]; + dataP++; } } -// TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { Common::File f; Graphics::PCXDecoder pcxDecoder; @@ -322,9 +321,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by const Graphics::Surface *s = pcxDecoder.getSurface(); // Copy out the dimensions and pixels of the decoded surface - DOUBLE_ECRAN = s->w > SCREEN_WIDTH; - PCX_L = s->w; - PCX_H = s->h; + _largeScreenFl = s->w > SCREEN_WIDTH; Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface); // Copy out the palette @@ -378,11 +375,9 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * v5 = 64000; if (!v16) v5 = v17; -// v8 = i; f.read(ptr, v5); -// i = v8; } - v9 = *(ptr + v7++); + v9 = ptr[v7++]; if (v9 > 192) { v10 = v9 - 192; if (v7 == v5) { @@ -391,17 +386,15 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * v5 = 64000; if (v16 == 1) v5 = v17; -// v11 = i; f.read(ptr, v5); -// i = v11; } - v12 = *(ptr + v7++); + v12 = ptr[v7++]; do { - *(surface + i++) = v12; + surface[i++] = v12; --v10; } while (v10); } else { - *(surface + i++) = v9; + surface[i++] = v9; } } @@ -421,32 +414,6 @@ void GraphicsManager::SCANLINE(int pitch) { _lineNbr = _lineNbr2 = pitch; } -void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *srcP; - byte *destP; - int yNext; - int yCtr; - byte *dest2P; - const byte *src2P; - unsigned int widthRemaining; - - assert(_videoPtr); - srcP = xs + _lineNbr2 * ys + surface; - destP = destX + WinScan * destY + (byte *)_videoPtr->pixels; - yNext = height; - do { - yCtr = yNext; - memcpy((byte *)destP, (const byte *)srcP, 4 * (width >> 2)); - src2P = (const byte *)(srcP + 4 * (width >> 2)); - dest2P = (byte *)(destP + 4 * (width >> 2)); - widthRemaining = width - 4 * (width >> 2); - memcpy(dest2P, src2P, widthRemaining); - destP = dest2P + widthRemaining + WinScan - width; - srcP = src2P + widthRemaining + _lineNbr2 - width; - yNext = yCtr - 1; - } while (yCtr != 1); -} - /** * Copies data from a 8-bit palette surface into the 16-bit screen */ @@ -807,40 +774,41 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) return; if (srcByte < kSetOffset) { - destOffset += (byte)(*srcP + 35); - srcByte = *(srcP++ + 1); + destOffset += srcP[35]; + srcByte = srcP[1]; + srcP++; } else if (srcByte == k8bVal) { - destOffset += *(srcP + 1); - srcByte = *(srcP + 2); + destOffset += srcP[1]; + srcByte = srcP[2]; srcP += 2; } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - srcByte = *(srcP + 3); + srcByte = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - srcByte = *(srcP + 5); + srcByte = srcP[5]; srcP += 5; } Video_Cont3_wVbe: if (srcByte > 210) { - if (srcByte == (byte)-45) { - destLen1 = *(srcP + 1); - rleValue = *(srcP + 2); + if (srcByte == -45) { + destLen1 = srcP[1]; + rleValue = srcP[2]; destSlice1P = destOffset + destSurface; destOffset += destLen1; memset(destSlice1P, rleValue, destLen1); srcP += 3; } else { - destLen2 = (byte)(*srcP + 45); - rleValue = *(srcP + 1); + destLen2 = srcP[45]; + rleValue = srcP[1]; destSlice2P = destOffset + destSurface; destOffset += destLen2; memset(destSlice2P, rleValue, destLen2); srcP += 2; } } else { - *(destOffset + destSurface) = srcByte; + destSurface[destOffset] = srcByte; ++srcP; ++destOffset; } @@ -861,16 +829,16 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { destOffset += srcByte - 221; srcByte = *++srcP; } else if (srcByte == k8bVal) { - destOffset += *(const byte *)(srcP + 1); - srcByte = *(const byte *)(srcP + 2); + destOffset += srcP[1]; + srcByte = srcP[2]; srcP += 2; } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - srcByte = *(const byte *)(srcP + 3); + srcByte = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - srcByte = *(const byte *)(srcP + 5); + srcByte = srcP[5]; srcP += 5; } } @@ -882,8 +850,8 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { if (srcByte > 210) { if (srcByte == 211) { - int pixelCount = *(srcP + 1); - int pixelIndex = *(srcP + 2); + 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; @@ -894,7 +862,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { srcP += 3; } else { int pixelCount = srcByte - 211; - int pixelIndex = *(srcP + 1); + int pixelIndex = srcP[1]; uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destOffset * 2); uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex); destOffset += pixelCount; @@ -926,16 +894,16 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { if (pixelIndex == kByteStop) return; if (pixelIndex == k8bVal) { - destOffset += *(srcP + 1); - pixelIndex = *(srcP + 2); + destOffset += srcP[1]; + pixelIndex = srcP[2]; srcP += 2; } else if (pixelIndex == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - pixelIndex = *(srcP + 3); + pixelIndex = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - pixelIndex = *(srcP + 5); + pixelIndex = srcP[5]; srcP += 5; } Video_Cont_Vbe16a: @@ -1313,10 +1281,10 @@ void GraphicsManager::CopyAsm16(const byte *surface) { v6 = (uint16 *)(v5 + 2 * *v1); v = *v6; *v2 = *v6; - *(v2 + 1) = v; + v2[1] = v; v8 = (uint16 *)(WinScan + v2); *v8 = v; - *(v8 + 1) = v; + v8[1] = v; ++v1; v2 = (byte *)v8 - WinScan + 4; } @@ -1886,7 +1854,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } } - if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { + if (ptr[0] != 'I' || ptr[1] != 'N' || ptr[2] != 'I') { error("Error, file not ini"); } else { bool doneFlag = false; @@ -1927,9 +1895,6 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { } void GraphicsManager::NB_SCREEN() { - byte *destP; - const byte *srcP; - if (!_vm->_globals.NECESSAIRE) initColorTable(50, 65, _palette); @@ -1942,13 +1907,7 @@ void GraphicsManager::NB_SCREEN() { m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); unlockScreen(); - destP = _vesaScreen; - srcP = _vesaBuffer; - memcpy(_vesaScreen, _vesaBuffer, 614396); - srcP = srcP + 614396; - destP = destP + 614396; - *destP = *srcP; - *(destP + 2) = *(srcP + 2); + memcpy(_vesaScreen, _vesaBuffer, 614399); DD_VBL(); } @@ -1972,20 +1931,20 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { if (byteVal == kByteStop) return; if (byteVal == k8bVal) { - destOffset += *(srcPtr + 1); - byteVal = *(srcPtr + 2); + destOffset += srcPtr[1]; + byteVal = srcPtr[2]; srcPtr += 2; } else if (byteVal == k16bVal) { destOffset += READ_LE_UINT16(srcPtr + 1); - byteVal = *(srcPtr + 3); + byteVal = srcPtr[3]; srcPtr += 3; } else { destOffset += READ_LE_UINT32(srcPtr + 1); - byteVal = *(srcPtr + 5); + byteVal = srcPtr[5]; srcPtr += 5; } Video_Cont_wVbe: - *(dest + destOffset) = byteVal; + dest[destOffset] = byteVal; ++srcPtr; ++destOffset; } @@ -2007,16 +1966,16 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { if (byteVal == kByteStop) return; if (byteVal == k8bVal) { - destOffset += *(srcP + 1); - byteVal = *(srcP + 2); + destOffset += srcP[1]; + byteVal = srcP[2]; srcP += 2; } else if (byteVal == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - byteVal = *(srcP + 3); + byteVal = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - byteVal = *(srcP + 5); + byteVal = srcP[5]; srcP += 5; } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 6215e16cc3..f62fcb5026 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -70,8 +70,7 @@ public: int _scrollOffset; int SCROLL; byte HEADER_PCX[128]; - int PCX_L, PCX_H; - bool DOUBLE_ECRAN; + bool _largeScreenFl; int OLD_SCROLL; bool MANU_SCROLL; int _scrollSpeed; @@ -114,7 +113,6 @@ public: void A_PCX320(byte *surface, const Common::String &file, byte *palette); void clearPalette(); void SCANLINE(int pitch); - void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 827b548bf0..efb1ce24fb 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4493,7 +4493,7 @@ void HopkinsEngine::playIntro() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - if (_graphicsManager.DOUBLE_ECRAN) { + if (_graphicsManager._largeScreenFl) { _graphicsManager.no_scroll = 2; bool v3 = false; _graphicsManager.SCROLL = 0; @@ -4549,9 +4549,6 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager._palette, 796); - // CHECKME: Useless variables? - // v21 = *(uint16 *)&_graphicsManager.Palette[796]; - // v22 = _graphicsManager.Palette[798]; _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager._vesaBuffer); _graphicsManager.FIN_VISU(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8c01f53364..818f8c6535 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -382,8 +382,8 @@ void ObjectsManager::displaySprite() { } } - AFF_BOB_ANIM(); - AFF_VBOB(); + displayBobAnim(); + displayVBob(); if (!PERSO_ON) { // Handle drawing characters on the screen @@ -698,39 +698,32 @@ void ObjectsManager::SCBOB(int idx) { for (int v8 = 0; v8 <= 20; v8++) { if ((_vm->_globals._bob[v8].field0) && (!_vm->_globals._bob[v8]._disabledAnimationFl) && (!_vm->_globals._bob[v8].field34) && (_vm->_globals._bob[v8]._frameIndex != 250)) { - int v2 = _vm->_globals._bob[v8]._oldWidth; int v9 = _vm->_globals._bob[v8]._oldX + _vm->_globals._bob[v8]._oldWidth; int v6 = _vm->_globals._bob[v8]._oldY + _vm->_globals._bob[v8]._oldHeight; - int v3 =_vm->_globals.Cache[idx]._x; - int v4 =_vm->_globals.Cache[idx]._y; - int v7 =_vm->_globals.Cache[idx]._width + v3; - int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + v4; - - if ((v6 > v4) && (v6 < v1)) { - v1 = 0; - if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx]._width + v3)) { + int v7 = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x; + + if ((v6 > _vm->_globals.Cache[idx]._y) && (v6 < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) { + bool checkFl = false; + if (v9 >= _vm->_globals.Cache[idx]._x && v9 <= v7) { ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; + checkFl = true; } - if (!(uint16)v1) { - if (v2 >= v3 && v7 >= v2) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } + if (!checkFl && v7 >= _vm->_globals._bob[v8]._oldWidth && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x) { + ++_vm->_globals.Cache[idx].fieldA; + checkFl = true; } - if (!(uint16)v1) { - if ( v7 >= v2 && v2 >= v3 ) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } + + if (!checkFl && v7 >= _vm->_globals._bob[v8]._oldWidth && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x ) { + ++_vm->_globals.Cache[idx].fieldA; + checkFl = true; } - if (!(uint16)v1) { - if (v2 >= v3 && v9 <= v7) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } + + if (!checkFl && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x && v9 <= v7) { + ++_vm->_globals.Cache[idx].fieldA; + checkFl = true; } - if (!(uint16)v1 && v2 <= v3 && v9 >= v7) + + if (!checkFl && _vm->_globals._bob[v8]._oldWidth <= _vm->_globals.Cache[idx]._x && v9 >= v7) ++_vm->_globals.Cache[idx].fieldA; } } @@ -748,69 +741,58 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (result == 250) return; - int v5, v15, v22; + int deltaY, deltaX; if (_vm->_globals._bob[idx]._modeFlag) { - v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); - v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); + deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); + deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); } else { - v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); - v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); + deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); + deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); } - int v17 = v5; - int v6 = v5; int v20 = 0; - int v7 = _vm->_globals._bob[idx].field36; - - if (v7 < 0) { - v7 = -v7; - v20 = v7; - if (v7 > 95) - v20 = 95; - } - int v21 = 0; - if (_vm->_globals._bob[idx].field36 > 0) + if (_vm->_globals._bob[idx].field36 < 0) { + v20 = -_vm->_globals._bob[idx].field36; + if (v20 > 95) + v20 = 95; + } else v21 = _vm->_globals._bob[idx].field36; if (v21) { - if (v15 >= 0) { - v22 = _vm->_graphicsManager.zoomIn(v15, v21); - } else { - if (v15 < 0) - v15 = -v15; - v22 = -_vm->_graphicsManager.zoomIn(v15, v21); - } - if (v6 >= 0) { - v17 = _vm->_graphicsManager.zoomIn(v6, v21); + if (deltaX >= 0) + deltaX = _vm->_graphicsManager.zoomIn(deltaX, v21); + else + deltaX = -_vm->_graphicsManager.zoomIn(deltaX, v21); + + if (deltaY >= 0) { + deltaY = _vm->_graphicsManager.zoomIn(deltaY, v21); } else { - int v9 = v15; - if (v15 < 0) - v9 = -v15; - v6 = v9; - v17 = -_vm->_graphicsManager.zoomIn(v9, v21); + int deltaY = deltaX; + if (deltaX < 0) + deltaY = -deltaX; + deltaY = -_vm->_graphicsManager.zoomIn(deltaY, v21); } } if (v20) { - if (v15 >= 0) { - v22 = _vm->_graphicsManager.zoomOut(v15, v20); - } else { - v15 = -v15; - v22 = -_vm->_graphicsManager.zoomOut(v15, v20); - } - if (v6 >= 0) { - v17 = _vm->_graphicsManager.zoomOut(v6, v20); + if (deltaX >= 0) + deltaX = _vm->_graphicsManager.zoomOut(deltaX, v20); + else + deltaX = -_vm->_graphicsManager.zoomOut(-deltaX, v20); + + if (deltaY >= 0) { + deltaY = _vm->_graphicsManager.zoomOut(deltaY, v20); } else { - int v11 = v15; - if (v15 < 0) - v11 = -v15; - v17 = -_vm->_graphicsManager.zoomOut(v11, v20); + if (deltaX < 0) + deltaY = -_vm->_graphicsManager.zoomOut(-deltaX, v20); + else + deltaY = -_vm->_graphicsManager.zoomOut(deltaX, v20); } } - int v13 = _vm->_globals._bob[idx]._xp - v22; - int v14 = _vm->_globals._bob[idx]._yp - v17; + int v13 = _vm->_globals._bob[idx]._xp - deltaX; + int v14 = _vm->_globals._bob[idx]._yp - deltaY; _vm->_globals._bob[idx]._activeFl = true; _vm->_globals._bob[idx]._oldX = v13; _vm->_globals._bob[idx]._oldY = v14; @@ -840,78 +822,59 @@ void ObjectsManager::CALCUL_BOB(int idx) { } void ObjectsManager::VERIFCACHE() { - int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - int v9; - int v11; - for (int v8 = 0; v8 <= 19; v8++) { - if (_vm->_globals.Cache[v8].fieldA > 0) { - v7 = _vm->_globals.Cache[v8].fieldA; - for (int v10 = 0; v10 <= 4; v10++) { - if (_sprite[v10]._animationType == 1) { - if (_sprite[v10]._spriteIndex != 250) { - v1 = _sprite[v10].field2C; - v11 = _sprite[v10]._width + v1; - v2 = _sprite[v10]._height + _sprite[v10].field2E; - v6 = _vm->_globals.Cache[v8]._x; - v3 = _vm->_globals.Cache[v8]._y; - v9 = _vm->_globals.Cache[v8]._width + v6; - - if (v2 > v3) { - if (v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + v3)) { - v4 = 0; - if (v11 >= v6 && v11 <= v9) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4) { - if (v6 <= v1 && v9 >= v1) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4) { - if (v9 >= v1 && v6 <= v1) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4) { - if (v6 <= v1 && v11 <= v9) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4 && v6 >= v1 && v11 >= v9) - ++_vm->_globals.Cache[v8].fieldA; - } - } - } - } - } + if (_vm->_globals.Cache[v8].fieldA <= 0) + continue; + + int oldFieldA = _vm->_globals.Cache[v8].fieldA; + for (int v10 = 0; v10 <= 4; v10++) { + if (_sprite[v10]._animationType == 1 && _sprite[v10]._spriteIndex != 250) { + int v11 = _sprite[v10]._width + _sprite[v10].field2C; + int v2 = _sprite[v10]._height + _sprite[v10].field2E; + int v9 = _vm->_globals.Cache[v8]._width + _vm->_globals.Cache[v8]._x; + + if (v2 > _vm->_globals.Cache[v8]._y && v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + _vm->_globals.Cache[v8]._y)) { + bool v4 = false; + if (v11 >= _vm->_globals.Cache[v8]._x && v11 <= v9) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; + } + + if (!v4 && v9 >= _sprite[v10].field2C && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; } - } - } - SCBOB(v8); - if (_vm->_globals.Cache[v8].fieldA == v7) { - if (_vm->_globals.Cache[v8].field10) { - _vm->_globals.Cache[v8].field10 = false; - _vm->_globals.Cache[v8].fieldA = 1; + if (!v4 && v9 >= _sprite[v10].field2C && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; + } + + if (!v4 && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C && v11 <= v9) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; + } + + if (!v4 && _vm->_globals.Cache[v8]._x >= _sprite[v10].field2C && v11 >= v9) + ++_vm->_globals.Cache[v8].fieldA; } - } else { - v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + - _vm->_globals.Cache[v8]._y; - if (v5 > 440) - v5 = 500; + } + } - AvantTri(TRI_CACHE, v8, v5); + SCBOB(v8); + if (_vm->_globals.Cache[v8].fieldA == oldFieldA) { + if (_vm->_globals.Cache[v8].field10) { + _vm->_globals.Cache[v8].field10 = false; _vm->_globals.Cache[v8].fieldA = 1; - _vm->_globals.Cache[v8].field10 = true; } + } else { + int v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + _vm->_globals.Cache[v8]._y; + if (v5 > 440) + v5 = 500; + + AvantTri(TRI_CACHE, v8, v5); + _vm->_globals.Cache[v8].fieldA = 1; + _vm->_globals.Cache[v8].field10 = true; } } } @@ -1072,14 +1035,13 @@ int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { } // Display BOB Anim -void ObjectsManager::AFF_BOB_ANIM() { +void ObjectsManager::displayBobAnim() { int v1; int v5; uint v6; int v10; int v11; int v14; - int v19; byte *v20; byte *v21; int v24; @@ -1194,56 +1156,55 @@ void ObjectsManager::AFF_BOB_ANIM() { BOBTOUS = false; - for (int v27 = 1; v27 < 35; v27++) { - if (v27 > 20 || !PERSO_ON) { - if ((_vm->_globals._bob[v27].field0 == 10) && (_vm->_globals._bob[v27].field1C)) { - v14 = _vm->_globals._bob[v27].field1E; + for (int i = 1; i < 35; i++) { + if (i > 20 || !PERSO_ON) { + if ((_vm->_globals._bob[i].field0 == 10) && (_vm->_globals._bob[i].field1C)) { + v14 = _vm->_globals._bob[i].field1E; if ((v14 != 2) && (v14 != 4)) { - if (_vm->_globals.Liste2[v27]._visibleFl) { + if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, - _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, - _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[v27]._xp, - _vm->_globals.Liste2[v27]._yp); - _vm->_globals.Liste2[v27]._visibleFl = false; + _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp, + _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, + _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[i]._xp, + _vm->_globals.Liste2[i]._yp); + _vm->_globals.Liste2[i]._visibleFl = false; } } } - if (_vm->_globals._bob[v27].field0 == 11) { - if (_vm->_globals.Liste2[v27]._visibleFl) { + if (_vm->_globals._bob[i].field0 == 11) { + if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, - _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, + _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp, + _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, _vm->_graphicsManager._vesaBuffer, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp); - _vm->_globals.Liste2[v27]._visibleFl = false; + _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp); + _vm->_globals.Liste2[i]._visibleFl = false; } - _vm->_globals._bob[v27].field0 = 0; + _vm->_globals._bob[i].field0 = 0; } } } - for (int v28 = 1; v28 < 25; v28++) { - _vm->_globals._bob[v28]._oldY = 0; - if (_vm->_globals._bob[v28].field0 == 10 && !_vm->_globals._bob[v28]._disabledAnimationFl && _vm->_globals._bob[v28].field1C) { - CALCUL_BOB(v28); - int v = _vm->_globals._bob[v28]._oldHeight + _vm->_globals._bob[v28]._oldY; - v19 = _vm->_globals._bob[v28]._oldX2 + v; + for (int i = 1; i < 25; i++) { + _vm->_globals._bob[i]._oldY = 0; + if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl && _vm->_globals._bob[i].field1C) { + CALCUL_BOB(i); + int v19 = _vm->_globals._bob[i]._oldX2 + _vm->_globals._bob[i]._oldHeight + _vm->_globals._bob[i]._oldY; if (v19 > 450) v19 = 600; - if (_vm->_globals._bob[v28]._activeFl) - AvantTri(TRI_BOB, v28, v19); + if (_vm->_globals._bob[i]._activeFl) + AvantTri(TRI_BOB, i, v19); } } } // Display VBOB -void ObjectsManager::AFF_VBOB() { +void ObjectsManager::displayVBob() { int width, height; for (int idx = 0; idx <= 29; idx++) { @@ -1362,10 +1323,6 @@ int ObjectsManager::getSpriteY(int idx) { return _sprite[idx]._spritePos.y; } -void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, spriteData, a2, a3, a5, a6, a7, a8); -} - /** * Clear sprite structure */ @@ -2653,7 +2610,7 @@ void ObjectsManager::PARADISE() { if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); if (!_vm->_globals._forestFl || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { - if (_vm->_graphicsManager.DOUBLE_ECRAN) { + if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) goto LABEL_64; @@ -4082,13 +4039,7 @@ void ObjectsManager::ACTION_DOS(int idx) { if (idx == 3) SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); if (idx == 4) - ACTION( - _vm->_globals.GESTE, - "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", - 0, - 0, - 8, - 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); if (idx == 5) SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); if (idx == 6) @@ -4816,10 +4767,10 @@ int ObjectsManager::colision(int xp, int yp) { int16 *dataP = _vm->_linesManager._zoneLine[field2].zoneData; if (dataP != (int16 *)g_PTRNUL) { int count = _vm->_linesManager._zoneLine[field2].count; - int v1 = *dataP; - int v2 = *(dataP + 1); - int v3 = *(dataP + count * 2 - 2); - int v4 = *(dataP + count * 2 - 1); + int v1 = dataP[0]; + int v2 = dataP[1]; + int v3 = dataP[count * 2 - 2]; + int v4 = dataP[count * 2 - 1]; bool flag = true; if (v1 < v3 && (xMax < v1 || xMin > v3)) @@ -5253,7 +5204,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm break; } _vm->_eventsManager.setMouseXY(_characterPos); - if (_vm->_graphicsManager.DOUBLE_ECRAN) + if (_vm->_graphicsManager._largeScreenFl) _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; VERIFTAILLE(); SPRITE_ON(0); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7394bb6cac..7f50a20232 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -156,13 +156,11 @@ public: void DEF_CACHE(int idx); void computeSprite(int idx); int AvantTri(TriMode triMode, int index, int priority); - void AFF_BOB_ANIM(); - void AFF_VBOB(); + void displayBobAnim(); + void displayVBob(); int getSpriteX(int idx); int getSpriteY(int idx); - void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8); - void clearSprite(); void SPRITE_ON(int idx); void SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 7ec1804bd8..e1e0ac70b6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -49,7 +49,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int opcodeType = 0; int v70 = 0; if (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') { - v70 = *(dataP + 6); + v70 = dataP[6]; byte v2 = dataP[7]; byte v69 = dataP[8]; int v67 = (int16)READ_LE_UINT16(dataP + 9); @@ -165,9 +165,9 @@ int ScriptManager::handleOpcode(byte *dataP) { } } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') { if (!_vm->_objectsManager._disableFl) { - int v72 = *(dataP + 5); - v70 = *(dataP + 6); - int v4 = *(dataP + 7); + int v72 = dataP[5]; + v70 = dataP[6]; + int v4 = dataP[7]; int v68 = (int16)READ_LE_UINT16(dataP + 8); int v66 = (int16)READ_LE_UINT16(dataP + 10); if (v72 == 52) { @@ -175,22 +175,20 @@ int ScriptManager::handleOpcode(byte *dataP) { } else if (v72 == 51) { _vm->_objectsManager.BOB_VIVANT(v70); } else { - if (v72 == 50) - goto LABEL_1141; - _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); - if (v4) - v4 /= _vm->_globals._speed; - if (v4 > 1) { - do { - if (_vm->shouldQuit()) - return -1; // Exiting game - - --v4; - _vm->_eventsManager.VBL(); - } while (v4); - } - if (v72 == 50) -LABEL_1141: + if (v72 != 50) { + _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); + if (v4) + v4 /= _vm->_globals._speed; + if (v4 > 1) { + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + --v4; + _vm->_eventsManager.VBL(); + } while (v4); + } + } else _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); } } @@ -198,7 +196,7 @@ LABEL_1141: } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { if (!_vm->_objectsManager._disableFl) { _vm->_objectsManager._twoCharactersFl = false; - int v5 = *(dataP + 5); + int v5 = dataP[5]; int v6 = (int16)READ_LE_UINT16(dataP + 8); _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); _vm->_objectsManager._characterPos.y = v6; @@ -258,10 +256,10 @@ LABEL_1141: _vm->_objectsManager.CH_TETE = false; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { if (!_vm->_objectsManager._disableFl) { - int v7 = *(dataP + 5); - v70 = *(dataP + 6); - int v8 = *(dataP + 7); - int v9 = *(dataP + 8); + int v7 = dataP[5]; + v70 = dataP[6]; + int v8 = dataP[7]; + int v9 = dataP[8]; _vm->_objectsManager.RECALL = 0; _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; @@ -2427,7 +2425,7 @@ LABEL_1141: _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] = (int16)READ_LE_UINT16(dataP + 7); } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { opcodeType = 1; - _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += *(dataP + 7); + _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') { opcodeType = 1; _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index dee18f050d..b2ead64e87 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -50,12 +50,6 @@ void TalkManager::setParent(HopkinsEngine *vm) { } void TalkManager::PARLER_PERSO(const Common::String &filename) { - int v5; - int v7; - byte *v8; - byte *v9; - byte *v10; - int v14; Common::String spriteFilename; int answer = 0; @@ -109,10 +103,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PLIGNE2 = PLIGNE1 + 1; PLIGNE3 = PLIGNE1 + 2; PLIGNE4 = PLIGNE1 + 3; - v14 = _vm->_eventsManager._mouseCursorId; + int v14 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { + int v5; do { v5 = DIALOGUE(); if (v5 != PLIGNE4) @@ -124,6 +119,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } if (_vm->_globals.NOPARLE) { int v6 = 1; + int v7; do v7 = DIALOGUE_REP(v6++); while (v7 != -1); @@ -153,15 +149,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); - v8 = _vm->_graphicsManager._vesaBuffer; - v9 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v9 = v9 + 614396; - v8 = v8 + 614396; - *v8 = *v9; - v8 += 2; - *v8 = *(v9 + 2); - v10 = v8 + 1; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); _vm->_globals._disableInventFl = oldDisableInventFl; _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) @@ -651,24 +639,24 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { for (;;) { v17 = v10; do { - v11 = *(ptr + v9 + v10); + v11 = ptr[v9 + v10]; v14 = v11; ++v10; - } while (v11 != 32 && v11 != 37); + } while (v11 != ' ' && v11 != '%'); if (v10 >= v15 / _vm->_globals.police_l) break; - if (v11 == 37) { + if (v11 == '%') { if (v10 < v15 / _vm->_globals.police_l) goto LABEL_31; break; } } - if (v11 != 37) + if (v11 != '%') goto LABEL_33; - v14 = 32; + v14 = ' '; LABEL_31: - if (v14 == 37) + if (v14 == '%') v17 = v10; LABEL_33: ++v18; @@ -929,7 +917,7 @@ LABEL_2: v11 = 0; do { assert(v11 < 20); - *(v11++ + v8) = v6[v7++]; + v8[v11++] = v6[v7++]; if (v6[v7] == 'F' && v6[v7 + 1] == 'F') { v16 = 1; v8[v11] = 'F'; @@ -939,9 +927,7 @@ LABEL_2: } while (v16 != 1); } if (v16 != 1) { - if (v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') - loopCond = true; - if (v16 != 1 && v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N') + if ((v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') || (v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N')) loopCond = true; } v6 += v7 + 1; @@ -1086,8 +1072,6 @@ void TalkManager::REPONSE2(int a1, int a2) { void TalkManager::OBJET_VIVANT(const Common::String &a2) { int v5; byte *v11; - byte *v14; - byte *v15; Common::String s; Common::String v20; Common::String v22; @@ -1213,14 +1197,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); - v14 = _vm->_graphicsManager._vesaBuffer; - v15 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v15 = v15 + 614396; - v14 = v14 + 614396; - WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15)); - v14 = v14 + 2; - *v14 = *(v15 + 2); + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) -- cgit v1.2.3 From 13063aeb3f93daddaa2a0664b79eb400c851ea8c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Jan 2013 23:10:21 +0100 Subject: HOPKINS: Refactoring in ComputerManager --- engines/hopkins/computer.cpp | 390 ++++++++++++++++++++----------------------- engines/hopkins/computer.h | 10 +- engines/hopkins/sound.cpp | 2 +- engines/hopkins/sound.h | 2 +- 4 files changed, 185 insertions(+), 219 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 068792d7a4..ae49caa3da 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -50,9 +50,9 @@ ComputerManager::ComputerManager() { _ballUpFl = false; _breakoutLevelNbr = 0; _padPositionX = 0; - CASSEP1 = 0; - CASSEP2 = 0; - CASSDER = 0; + _minBreakoutMoveSpeed = 0; + _maxBreakoutMoveSpeed = 0; + _lastBreakoutMoveSpeed = 0; } void ComputerManager::setParent(HopkinsEngine *vm) { @@ -678,7 +678,7 @@ void ComputerManager::newLevel() { _vm->_objectsManager.SPRITE_ON(0); _vm->_objectsManager.SPRITE_ON(1); _vm->_eventsManager.mouseOn(); - _vm->_soundManager.PLAY_SAMPLE(3, 5); + _vm->_soundManager.playSample(3, 5); } /** @@ -935,60 +935,40 @@ void ComputerManager::getScoreName() { * Display current score */ void ComputerManager::displayScore() { - int16 v0; - int16 v1; - int16 i; char s[40]; sprintf(s, "%d", _breakoutScore); - v0 = 0; + int v0 = 0; do ++v0; while (s[v0]); - v1 = 0; - for (i = v0; ; IMPSCORE(v1++, (byte)s[i])) { - --i; - if (i <= -1) - break; + int v1 = 0; + for (int i = v0; i > -1; i--) { + IMPSCORE(v1++, (byte)s[i]); } } -void ComputerManager::IMPSCORE(int a1, int a2) { - int16 xp = 203; +void ComputerManager::IMPSCORE(int charPos, int charDisp) { + int16 xp = 200; int16 idx = 3; - if (a1 == 1) - xp = 193; - else if (a1 == 2) - xp = 183; - else if (a1 == 3) - xp = 170; - else if (a1 == 4) - xp = 160; - else if (a1 == 5) - xp = 150; - else if (a1 == 9) - xp = 137; - - if (a2 == 49) - idx = 4; - else if (a2 == 50) - idx = 5; - else if (a2 == 51) - idx = 6; - else if (a2 == 52) - idx = 7; - else if (a2 == 53) - idx = 8; - else if (a2 == 54) - idx = 9; - else if (a2 == 55) - idx = 10; - else if (a2 == 56) - idx = 11; - else if (a2 == 57) - idx = 12; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp - 3, 11, idx); + if (charPos == 1) + xp = 190; + else if (charPos == 2) + xp = 180; + else if (charPos == 3) + xp = 167; + else if (charPos == 4) + xp = 157; + else if (charPos == 5) + xp = 147; + else if (charPos == 9) + xp = 134; + + if (charDisp >= 48 && charDisp <= 57) + idx = charDisp - 45 + + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 11, idx); } /** @@ -999,11 +979,8 @@ void ComputerManager::saveScore() { int v2; int v4; int v6; - char v8; int v9; - char v11; int v14; - byte *ptr; int v16[6]; int v17[6]; @@ -1036,21 +1013,21 @@ void ComputerManager::saveScore() { for (int v5 = 0; v5 <= 5; v5++) { v6 = 16 * v5; v14 = v16[v5]; - for (int v7 = 0; v7 <= 4; v7++) { - v8 = _score[v14]._name[v7]; - if (!v8) - v8 = 32; - ptr[(16 * v5) + v7] = v8; + for (int namePos = 0; namePos <= 4; namePos++) { + char curChar = _score[v14]._name[namePos]; + if (!curChar) + curChar = ' '; + ptr[v6 + namePos] = curChar; }; ptr[v6 + 5] = 0; v9 = v6 + 6; - for (int v10 = 0; v10 <= 8; v10++) { - v11 = _score[v14]._score[v10]; - if (!v11) - v11 = 48; - ptr[v9 + v10] = v11; + for (int scorePos = 0; scorePos <= 8; scorePos++) { + char curChar = _score[v14]._score[scorePos]; + if (!curChar) + curChar = '0'; + ptr[v9 + scorePos] = curChar; }; ptr[v9 + 9] = 0; } @@ -1063,25 +1040,18 @@ void ComputerManager::saveScore() { /** * Display parts of the hiscore line */ -void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int a4) { - char v4; - int v5; - - v4 = a4; - v5 = 36; - if (!a4) - v4 = 32; - if (v4 == 100) - v5 = 0; - if ((byte)(v4 - 48) <= 9u) - v5 = (byte)v4 - 48; - if ((byte)(v4 - 65) <= 25) - v5 = (byte)v4 - 55; - if (v4 == 32) - v5 = 36; - if (v4 == 1) - v5 = 37; - _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, x, y, v5); +void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int curChar) { + int idx = 36; + + if (curChar == 100) + idx = 0; + else if (curChar >= '0' && curChar <= '9') + idx = curChar - '0'; + else if (curChar >= 'A' && curChar <= 'Z') + idx = curChar - 'A' + 10; + else if (curChar == 1) + idx = 37; + _vm->_graphicsManager.AFFICHE_SPEEDVGA(objectData, x, y, idx); } /** @@ -1094,55 +1064,55 @@ int ComputerManager::moveBall() { int randVal = _vm->getRandomNumber(6); switch (_breakoutSpeed) { case 1: - CASSEP1 = 1; - CASSEP2 = 1; + _minBreakoutMoveSpeed = 1; + _maxBreakoutMoveSpeed = 1; break; case 2: - CASSEP1 = 1; - CASSEP2 = 2; + _minBreakoutMoveSpeed = 1; + _maxBreakoutMoveSpeed = 2; break; case 3: - CASSEP1 = 2; - CASSEP2 = 2; + _minBreakoutMoveSpeed = 2; + _maxBreakoutMoveSpeed = 2; break; case 4: - CASSEP1 = 3; - CASSEP2 = 2; + _minBreakoutMoveSpeed = 3; + _maxBreakoutMoveSpeed = 2; break; } - int v1 = CASSEP1; - if (CASSDER == CASSEP1) - v1 = CASSEP2; + int moveSpeed = _minBreakoutMoveSpeed; + if (_lastBreakoutMoveSpeed == _minBreakoutMoveSpeed) + moveSpeed = _maxBreakoutMoveSpeed; if (_ballUpFl) - _ballPosition.y += v1; + _ballPosition.y += moveSpeed; else - _ballPosition.y -= v1; + _ballPosition.y -= moveSpeed; if (_ballRightFl) - _ballPosition.x += v1; + _ballPosition.x += moveSpeed; else - _ballPosition.x -= v1; + _ballPosition.x -= moveSpeed; - CASSDER = v1; + _lastBreakoutMoveSpeed = moveSpeed; if (_ballPosition.x <= 6) { - _vm->_soundManager.PLAY_SAMPLE(2, 6); + _vm->_soundManager.playSample(2, 6); _ballPosition.x = randVal + 6; _ballRightFl = !_ballRightFl; } if (_ballPosition.x > 307) { - _vm->_soundManager.PLAY_SAMPLE(2, 6); + _vm->_soundManager.playSample(2, 6); _ballPosition.x = 307 - randVal; _ballRightFl = !_ballRightFl; } if (_ballPosition.y <= 6) { - _vm->_soundManager.PLAY_SAMPLE(2, 6); + _vm->_soundManager.playSample(2, 6); _ballPosition.y = randVal + 7; _ballUpFl = !_ballUpFl; } - if ((uint16)(_ballPosition.y - 186) <= 8u) { - _vm->_soundManager.PLAY_SAMPLE(2, 6); + if (_ballPosition.y >= 186 && _ballPosition.y <= 194) { + _vm->_soundManager.playSample(2, 6); if (_ballPosition.x > _padPositionX - 2) { int v2 = _ballPosition.x + 6; if (v2 < _padPositionX + 36) { @@ -1178,140 +1148,136 @@ int ComputerManager::moveBall() { * Check ball collision with bricks */ void ComputerManager::checkBallCollisions() { - int v1; - int v2; - int v3; - int v4; - int v10; - int v11; - - int v7 = 0; - //v6 = (signed int)(6.0 * (long double)rand() / 2147483648.0) + 1; + int cellLeft; + int cellRight; + int cellType; + bool collisionFl; + int cellBottom; + int cellUp; + + bool v7 = false; // TODO: Check if correct - int v6 = _vm->getRandomNumber(6) + 1; - int v0 = _ballPosition.x; - int v13 = _ballPosition.y; - int v5 = _ballPosition.x + 6; - int v12 = _ballPosition.y + 6; - int16 *v9 = _breakoutLevel; + int randVal = _vm->getRandomNumber(6) + 1; + int ballLeft = _ballPosition.x; + int ballTop = _ballPosition.y; + int ballRight = _ballPosition.x + 6; + int ballBottom = _ballPosition.y + 6; + int16 *level = _breakoutLevel; uint16 v8 = 0; do { - v1 = v9[v8]; - v11 = v9[v8 + 1]; - v2 = v9[v8 + 2]; - v10 = v9[v8 + 3]; - v3 = v9[v8 + 4]; - if (v9[v8 + 5] != 1 || v1 == -1) - goto LABEL_60; - v4 = 0; - if (v13 <= v10 && v12 >= v10) { - if (v0 >= v1 && v5 <= v2) { - v4 = 1; - _ballUpFl = true; - } - if (v5 >= v1) { - if (v0 <= v1) { - ++v4; + cellLeft = level[v8]; + cellUp = level[v8 + 1]; + cellRight = level[v8 + 2]; + cellBottom = level[v8 + 3]; + cellType = level[v8 + 4]; + if (level[v8 + 5] == 1 && cellLeft != -1) { + collisionFl = false; + if (ballTop <= cellBottom && ballBottom >= cellBottom) { + if (ballLeft >= cellLeft && ballRight <= cellRight) { + collisionFl = true; _ballUpFl = true; - _ballRightFl = false; - if (v3 == 31) - _ballPosition.x -= v6; } - } - if (v0 <= v2) { - if (v5 >= v2) { - ++v4; - _ballUpFl = true; - _ballRightFl = true; - if (v3 == 31) - _ballPosition.x += v6; + if (ballRight >= cellLeft) { + if (ballLeft <= cellLeft) { + collisionFl = true; + _ballUpFl = true; + _ballRightFl = false; + if (cellType == 31) + _ballPosition.x -= randVal; + } } - } - } - if (v12 >= v11) { - if (v13 > v11) - goto LABEL_31; - if (v0 >= v1 && v5 <= v2) { - ++v4; - _ballUpFl = false; - } - if (v5 >= v1) { - if (v0 <= v1) { - ++v4; - _ballUpFl = false; - _ballRightFl = false; - if (v3 == 31) - _ballPosition.x -= 2; + if (ballLeft <= cellRight) { + if (ballRight >= cellRight) { + collisionFl = true; + _ballUpFl = true; + _ballRightFl = true; + if (cellType == 31) + _ballPosition.x += randVal; + } } } - if (v0 <= v2) { - if (v5 >= v2) { - ++v4; + if (ballBottom >= cellUp && ballTop <= cellUp) { + if (ballLeft >= cellLeft && ballRight <= cellRight) { + collisionFl = true; _ballUpFl = false; - _ballRightFl = true; - if (v3 == 31) - _ballPosition.x += v6; } - } - } - if (v13 >= v11) { -LABEL_31: - if (v12 <= v10) { - if (v5 >= v1) { - if (v0 <= v1) { - ++v4; + if (ballRight >= cellLeft) { + if (ballLeft <= cellLeft) { + collisionFl = true; + _ballUpFl = false; _ballRightFl = false; - if (v3 == 31) - _ballPosition.x -= v6; + if (cellType == 31) + _ballPosition.x -= 2; } } - if (v0 <= v2) { - if (v5 >= v2) { - ++v4; + if (ballLeft <= cellRight) { + if (ballRight >= cellRight) { + collisionFl = true; + _ballUpFl = false; _ballRightFl = true; - if (v3 == 31) - _ballPosition.x += v6; + if (cellType == 31) + _ballPosition.x += randVal; } } } - } - if (v4) { - if (v3 == 31) { - _vm->_soundManager.PLAY_SAMPLE(2, 6); - } else { - _vm->_soundManager.PLAY_SAMPLE(1, 5); - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, v1, v11, 16); - if (v3 == 1) - _breakoutScore += 10; - if (v3 == 2) - _breakoutScore += 5; - if (v3 == 3) { - _breakoutScore += 50; - if (_breakoutSpeed <= 1) - _breakoutSpeed = 2; - if (_breakoutBrickNbr <= 19) - _breakoutSpeed = 3; + if (ballTop >= cellUp) { + if (ballBottom <= cellBottom) { + if (ballRight >= cellLeft) { + if (ballLeft <= cellLeft) { + collisionFl = true; + _ballRightFl = false; + if (cellType == 31) + _ballPosition.x -= randVal; + } + } + if (ballLeft <= cellRight) { + if (ballRight >= cellRight) { + collisionFl = true; + _ballRightFl = true; + if (cellType == 31) + _ballPosition.x += randVal; + } + } } - if (v3 == 4) - _breakoutScore += 20; - if (v3 == 5) { - _breakoutScore += 30; - if (_breakoutSpeed <= 1) - _breakoutSpeed = 2; + } + if (collisionFl) { + if (cellType == 31) { + _vm->_soundManager.playSample(2, 6); + } else { + _vm->_soundManager.playSample(1, 5); + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellUp, 16); + if (cellType == 1) + _breakoutScore += 10; + if (cellType == 2) + _breakoutScore += 5; + if (cellType == 3) { + _breakoutScore += 50; + if (_breakoutSpeed <= 1) + _breakoutSpeed = 2; + if (_breakoutBrickNbr <= 19) + _breakoutSpeed = 3; + } + if (cellType == 4) + _breakoutScore += 20; + if (cellType == 5) { + _breakoutScore += 30; + if (_breakoutSpeed <= 1) + _breakoutSpeed = 2; + } + if (cellType == 6) + _breakoutScore += 40; + displayScore(); + --_breakoutBrickNbr; + *((uint16 *)level + v8 + 5) = 0; + v7 = true; } - if (v3 == 6) - _breakoutScore += 40; - displayScore(); - --_breakoutBrickNbr; - *((uint16 *)v9 + v8 + 5) = 0; - v7 = 1; } } -LABEL_60: - if (v7 == 1) - v1 = -1; + + if (v7) + cellLeft = -1; v8 += 6; - } while (v1 != -1); + } while (cellLeft != -1); } } // End of namespace Hopkins diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 6bad921451..d52cc28799 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -64,9 +64,9 @@ private: int _breakoutLevelNbr; int _padPositionX; int _breakoutHiscore; - int CASSEP1; - int CASSEP2; - int CASSDER; + int _minBreakoutMoveSpeed; + int _maxBreakoutMoveSpeed; + int _lastBreakoutMoveSpeed; void loadMenu(); void restoreFBIRoom(); @@ -86,7 +86,7 @@ private: void displayGamesSubMenu(); void displayScore(); int displayHiscores(); - void displayHiscoreLine(byte *objectData, int x, int y, int a4); + void displayHiscoreLine(byte *objectData, int x, int y, int curChar); void playBreakout(); void saveScore(); int moveBall(); @@ -95,7 +95,7 @@ private: void TXT4(int xp, int yp, int textIdx); - void IMPSCORE(int a1, int a2); + void IMPSCORE(int charPos, int charDisp); public: ComputerManager(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 90aa78127a..e1a917318d 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -737,7 +737,7 @@ void SoundManager::loadSample(int wavIndex, const Common::String &file) { SOUND[wavIndex]._active = true; } -void SoundManager::PLAY_SAMPLE(int wavIndex, int voiceMode) { +void SoundManager::playSample(int wavIndex, int voiceMode) { if (!_soundOffFl && SOUND[wavIndex]._active) { if (_soundFl) DEL_NWAV(SOUND_NUM); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 4a02f915f7..e19d51c690 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -159,7 +159,7 @@ public: void MODSetVoiceVolume(); void MODSetMusicVolume(int volume); void loadSample(int wavIndex, const Common::String &file); - void PLAY_SAMPLE(int wavIndex, int voiceMode); + void playSample(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); void playWav(int wavIndex); -- cgit v1.2.3 From b21000901a95c3def2f7cd48ae9f6c1ec5bdd3fb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Jan 2013 23:16:07 +0100 Subject: HOPKINS: Missing modifications in previous commit --- engines/hopkins/computer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index ae49caa3da..b3accfa3e3 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -966,7 +966,7 @@ void ComputerManager::IMPSCORE(int charPos, int charDisp) { xp = 134; if (charDisp >= 48 && charDisp <= 57) - idx = charDisp - 45 + idx = charDisp - 45; _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 11, idx); } @@ -1008,7 +1008,7 @@ void ComputerManager::saveScore() { } while (!v3); } - ptr = _vm->_globals.allocMemory(100); + byte *ptr = _vm->_globals.allocMemory(100); memset(ptr, 0, 99); for (int v5 = 0; v5 <= 5; v5++) { v6 = 16 * v5; -- cgit v1.2.3 From 682e70623ac864037e9b81b4215202cdece09bed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Jan 2013 00:57:00 +0100 Subject: HOPKINS: More refactoring and renaming, remove several useless variables --- engines/hopkins/computer.cpp | 6 +- engines/hopkins/dialogs.cpp | 68 +++++------ engines/hopkins/events.cpp | 6 +- engines/hopkins/font.cpp | 6 +- engines/hopkins/globals.cpp | 14 +-- engines/hopkins/globals.h | 20 ++-- engines/hopkins/graphics.cpp | 16 +-- engines/hopkins/graphics.h | 5 +- engines/hopkins/hopkins.cpp | 28 +---- engines/hopkins/lines.cpp | 154 ++++++++++++------------ engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 273 +++++++++++++++++-------------------------- engines/hopkins/objects.h | 12 +- engines/hopkins/script.cpp | 42 +++---- engines/hopkins/talk.cpp | 4 +- 15 files changed, 277 insertions(+), 379 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b3accfa3e3..c243dc6261 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -424,13 +424,13 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { x1 -= _vm->_globals.police_l; x2 = x1 + 2 * _vm->_globals.police_l; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, x2, yp + 12); + _vm->_graphicsManager.addVesaSegment(x1, yp, x2, yp + 12); _vm->_fontManager.displayTextVesa(x1, yp, "_", -4); } if (mappedChar != '*') { newChar = mappedChar; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); @@ -443,7 +443,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.Ajoute_Segment_Vesa(x1, yp, _vm->_globals.police_l + x1, yp + 12); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 6f734f589d..77258a8274 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -290,7 +290,7 @@ void DialogsManager::showOptionsDialog() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager._scrollOffset + 164, 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollOffset + 164, 107); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_graphicsManager._scrollOffset + 164, 107, + _vm->_graphicsManager.addVesaSegment(_vm->_graphicsManager._scrollOffset + 164, 107, _vm->_graphicsManager._scrollOffset + 498, 320); _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR); @@ -437,7 +437,7 @@ LABEL_7: if (_inventDisplayedFl) { _inventDisplayedFl = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, v19, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, v19, 114); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v19, 114, v19 + v18, v18 + 114); + _vm->_graphicsManager.addVesaSegment(v19, 114, v19 + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; } @@ -469,7 +469,7 @@ void DialogsManager::inventAnim() { if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; } @@ -479,11 +479,11 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); int v0 = _vm->_graphicsManager._scrollOffset + 2; int v1 = _vm->_graphicsManager._scrollOffset + 2; _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v1, 27, v1 + 45, 62); + _vm->_graphicsManager.addVesaSegment(v1, 27, v1 + 45, 62); _vm->_objectsManager.I_old_x = v0; } @@ -492,17 +492,17 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); if (_vm->_globals._saveData->data[svField355] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(566, 25, 594, 60); + _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); + _vm->_graphicsManager.addVesaSegment(566, 25, 594, 60); } if (_vm->_globals._saveData->data[svField356] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } if (_vm->_globals._saveData->data[svField354] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 560, 60); + _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } } @@ -559,14 +559,14 @@ void DialogsManager::showLoadGame() { slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && (!slotNumber || _vm->_eventsManager.getMouseButton() != 1)); - _vm->_objectsManager.SL_FLAG = false; + _vm->_objectsManager._saveLoadFl = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); + _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); _vm->_objectsManager.SL_SPR2 = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR2); - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; + _vm->_objectsManager._saveLoadX = 0; + _vm->_objectsManager._saveLoadY = 0; if (slotNumber != 7) { _vm->_saveLoadManager.loadGame(slotNumber); @@ -590,14 +590,14 @@ void DialogsManager::showSaveGame() { _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && (!slotNumber || _vm->_eventsManager.getMouseButton() != 1)); - _vm->_objectsManager.SL_FLAG = false; + _vm->_objectsManager._saveLoadFl = false; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); + _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); _vm->_objectsManager.SL_SPR2 = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR2); - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; + _vm->_objectsManager._saveLoadX = 0; + _vm->_objectsManager._saveLoadY = 0; if (slotNumber != 7) { // Since the original GUI doesn't support save names, use a default name @@ -680,10 +680,10 @@ void DialogsManager::showSaveLoad(int a1) { } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); - _vm->_objectsManager.SL_FLAG = true; + _vm->_objectsManager._saveLoadFl = true; _vm->_objectsManager.SL_MODE = a1; - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; + _vm->_objectsManager._saveLoadX = 0; + _vm->_objectsManager._saveLoadY = 0; } /** @@ -718,33 +718,33 @@ int DialogsManager::searchSavegames() { switch (slotNumber) { case 1: - _vm->_objectsManager.SL_X = 189; - _vm->_objectsManager.SL_Y = 111; + _vm->_objectsManager._saveLoadX = 189; + _vm->_objectsManager._saveLoadY = 111; break; case 2: - _vm->_objectsManager.SL_X = 322; - _vm->_objectsManager.SL_Y = 111; + _vm->_objectsManager._saveLoadX = 322; + _vm->_objectsManager._saveLoadY = 111; break; case 3: - _vm->_objectsManager.SL_X = 189; - _vm->_objectsManager.SL_Y = 202; + _vm->_objectsManager._saveLoadX = 189; + _vm->_objectsManager._saveLoadY = 202; break; case 4: - _vm->_objectsManager.SL_X = 322; - _vm->_objectsManager.SL_Y = 202; + _vm->_objectsManager._saveLoadX = 322; + _vm->_objectsManager._saveLoadY = 202; break; case 5: - _vm->_objectsManager.SL_X = 189; - _vm->_objectsManager.SL_Y = 293; + _vm->_objectsManager._saveLoadX = 189; + _vm->_objectsManager._saveLoadY = 293; break; case 6: - _vm->_objectsManager.SL_X = 322; - _vm->_objectsManager.SL_Y = 293; + _vm->_objectsManager._saveLoadX = 322; + _vm->_objectsManager._saveLoadY = 293; break; case 0: case 7: - _vm->_objectsManager.SL_X = 0; - _vm->_objectsManager.SL_Y = 0; + _vm->_objectsManager._saveLoadX = 0; + _vm->_objectsManager._saveLoadY = 0; break; } return slotNumber; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 18f0aa420c..1b4e02a386 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -392,7 +392,7 @@ LABEL_45: } _vm->_eventsManager.updateCursor(); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v15, yp, v12, v11); + _vm->_graphicsManager.addVesaSegment(v15, yp, v12, v11); LABEL_54: _vm->_globals._speed = 2; do { @@ -419,7 +419,7 @@ LABEL_65: _vm->_globals._speed = 2; _rateCounter = 0; if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager.no_scroll == 1) { - _vm->_graphicsManager.Affiche_Segment_Vesa(); + _vm->_graphicsManager.displayVesaSegment(); } else { if (_vm->_graphicsManager.no_scroll != 2) { if (getMouseX() > _vm->_graphicsManager.SCROLL + 620) @@ -432,7 +432,7 @@ LABEL_65: if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; if (_vm->_graphicsManager.OLD_SCROLL == _vm->_graphicsManager.SCROLL) { - _vm->_graphicsManager.Affiche_Segment_Vesa(); + _vm->_graphicsManager.displayVesaSegment(); } else { _vm->_fontManager.hideText(9); _vm->_graphicsManager.lockScreen(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 0282e88cc4..069c9dc714 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -158,7 +158,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in yp, _text[idx]._width, _text[idx]._height); - _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); + _vm->_graphicsManager.addVesaSegment(xp, yp, xp + width, yp + height); } } else { int lineCount = 0; @@ -439,7 +439,7 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, } } - _vm->_graphicsManager.Ajoute_Segment_Vesa(xp, yp, currentX, yp + 12); + _vm->_graphicsManager.addVesaSegment(xp, yp, currentX, yp + 12); } /** @@ -486,7 +486,7 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, v9, yp, v7 - 32, fontCol); v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5); v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5); - _vm->_graphicsManager.Ajoute_Segment_Vesa(v9 - v6, yp, v9, yp + 12); + _vm->_graphicsManager.addVesaSegment(v9 - v6, yp, v9, yp + 12); if (_vm->_eventsManager._escKeyFl) { _vm->_globals.iRegul = 1; _vm->_eventsManager.VBL(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index cef2f9686d..becb8a2767 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -111,7 +111,7 @@ Globals::Globals() { for (int i = 0; i < 36; ++i) _inventory[i] = 0; for (int i = 0; i < 51; ++i) - Common::fill((byte *)&Tri[i], (byte *)&Tri[i] + sizeof(TriItem), 0); + Common::fill((byte *)&_sortedDisplay[i], (byte *)&_sortedDisplay[i] + sizeof(SortItem), 0); // Initialise fields _language = LANG_EN; @@ -164,10 +164,8 @@ Globals::Globals() { _menuMusicOff = 0; _menuTextOff = 0; _menuDisplayType = 0; - NBTRI = 0; - AFFLI = false; - AFFIVBL = false; - NOT_VERIF = 0; + _sortedDisplayCount = 0; + NOT_VERIF = false; PERSO_TYPE = 0; GOACTION = false; NECESSAIRE = false; @@ -219,9 +217,7 @@ Globals::Globals() { // Reset flags _censorshipFl = false; GESTE_FLAG = 0; - BPP_NOAFF = false; _disableInventFl = false; - netscape = false; NOMARCHE = false; NO_VISU = false; _optionDialogFl = false; @@ -500,7 +496,7 @@ byte *Globals::freeMemory(byte *p) { } // Reset Cache -void Globals::RESET_CACHE() { +void Globals::resetCache() { for (int idx = 1; idx <= 5; ++idx) { CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); @@ -546,7 +542,7 @@ void Globals::loadCache(const Common::String &file) { Common::String v16; Common::File f; - RESET_CACHE(); + resetCache(); _vm->_fileManager.constructFilename(HOPLINK, file); ptr = _vm->_fileManager.loadFile(_curFilename); v16 = Common::String((const char *)ptr); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 86524ea3e8..5dc5ef66d1 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -159,15 +159,15 @@ struct BlocItem { }; /** - * Mode for TriItem records + * Mode for SortItem records */ -enum TriMode { TRI_NONE = 0, TRI_BOB = 1, TRI_SPRITE = 2, TRI_CACHE = 3 }; +enum SortMode { SORT_NONE = 0, SORT_BOB = 1, SORT_SPRITE = 2, SORT_CACHE = 3 }; /** * Structure to represent a pending display of either a Bob, Sprite, or Cache Item. */ -struct TriItem { - TriMode _triMode; +struct SortItem { + SortMode _sortMode; int _index; int _priority; }; @@ -327,7 +327,7 @@ public: int Param[2100]; HopkinsItem Hopkins[70]; int _inventory[36]; - TriItem Tri[51]; + SortItem _sortedDisplay[51]; Language _language; int SVGA; bool _internetFl; @@ -396,7 +396,6 @@ public: uint32 _catalogPos; uint32 _catalogSize; int iRegul; - bool BPP_NOAFF; int _exitId; int PLANX, PLANY; int PLANI; @@ -409,7 +408,6 @@ public: int Max_Ligne_Long; int Max_Perso_Y; bool _disableInventFl; - bool netscape; // CHECKME: Useless variable? bool NOMARCHE; int NBBLOC; bool NO_VISU; @@ -423,10 +421,8 @@ public: int _menuVoiceOff; int _menuMusicOff; int _menuTextOff; - int NBTRI; - bool AFFLI; // CHECKME: Useless variable? - bool AFFIVBL; // CHECKME: Useless variable? - int NOT_VERIF; + int _sortedDisplayCount; + bool NOT_VERIF; bool _cacheFl; bool NOPARLE; bool PLAN_FLAG; @@ -481,7 +477,7 @@ public: byte *allocMemory(int count); byte *freeMemory(byte *p); - void RESET_CACHE(); + void resetCache(); void CACHE_ON(); void CACHE_OFF(int v1 = 0); void CACHE_SUB(int idx); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0d4073d67d..27d86d21a3 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -60,7 +60,6 @@ GraphicsManager::GraphicsManager() { clip_x = clip_y = 0; clip_x1 = clip_y1 = 0; clip_flag = false; - SDL_NBLOCS = 0; Red_x = Red_y = 0; Red = 0; _width = 0; @@ -1112,7 +1111,7 @@ void GraphicsManager::RESET_SEGMENT_VESA() { } // Add VESA Segment -void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { +void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { int tempX; int blocCount; bool addFlag; @@ -1156,11 +1155,10 @@ void GraphicsManager::Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2) { } // Display VESA Segment -void GraphicsManager::Affiche_Segment_Vesa() { +void GraphicsManager::displayVesaSegment() { if (_vm->_globals.NBBLOC == 0) return; - SDL_NBLOCS = _vm->_globals.NBBLOC; lockScreen(); for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { @@ -1198,10 +1196,6 @@ void GraphicsManager::Affiche_Segment_Vesa() { _vm->_globals.NBBLOC = 0; unlockScreen(); - if (!_vm->_globals.BPP_NOAFF) { -// SDL_UpdateRects(LinuxScr, SDL_NBLOCS, dstrect); - } - SDL_NBLOCS = 0; } void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx) { @@ -1217,7 +1211,7 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i Sprite_Vesa(_vesaScreen, objectData, xp + 300, yp + 300, idx); } if (!_vm->_globals.NO_VISU) - Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); + addVesaSegment(xp, yp, xp + width, yp + height); } void GraphicsManager::CopyAsm(const byte *surface) { @@ -1713,7 +1707,7 @@ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int sp Sprite_Vesa(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex); } if (!_vm->_globals.NO_VISU) - Ajoute_Segment_Vesa(xp, yp, xp + width, yp + height); + addVesaSegment(xp, yp, xp + width, yp + height); } void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { @@ -1747,7 +1741,7 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int if (croppedWidth > 0 && croppedHeight > 0) { int height2 = croppedHeight; Copy_Mem(surface, left, top2, croppedWidth, croppedHeight, destSurface, destX, destY); - Ajoute_Segment_Vesa(left, top2, left + croppedWidth, top2 + height2); + addVesaSegment(left, top2, left + croppedWidth, top2 + height2); } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index f62fcb5026..ad05f1aa6b 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -87,7 +87,6 @@ public: int clip_x, clip_y; int clip_x1, clip_y1; bool clip_flag; - int SDL_NBLOCS; int Red_x, Red_y; int Red; int _width; @@ -151,8 +150,8 @@ public: void FIN_VISU(); void VISU_ALL(); void RESET_SEGMENT_VESA(); - void Ajoute_Segment_Vesa(int x1, int y1, int x2, int y2); - void Affiche_Segment_Vesa(); + void addVesaSegment(int x1, int y1, int x2, int y2); + void displayVesaSegment(); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); void CopyAsm16(const byte *surface); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index efb1ce24fb..34bd068f18 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4486,11 +4486,9 @@ void HopkinsEngine::playIntro() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _globals.BPP_NOAFF = true; for (int i = 0; i <= 4; i++) _eventsManager.VBL(); - _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); if (_graphicsManager._largeScreenFl) { @@ -4532,12 +4530,10 @@ void HopkinsEngine::playIntro() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _globals.BPP_NOAFF = true; for (int i = 0; i <= 4; i++) _eventsManager.VBL(); - _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); for (uint i = 0; i < 200 / _globals._speed; ++i) @@ -4577,12 +4573,10 @@ void HopkinsEngine::playIntro() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _globals.BPP_NOAFF = true; for (int i = 0; i <= 3; i++) _eventsManager.VBL(); - _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager._vesaBuffer); @@ -4750,13 +4744,11 @@ void HopkinsEngine::bombExplosion() { _animationManager.loadAnim("ANIM15"); _graphicsManager.VISU_ALL(); _objectsManager.stopBobAnimation(7); - _globals.BPP_NOAFF = true; for (int idx = 0; idx < 5; ++idx) { _eventsManager.VBL(); } - _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _eventsManager.mouseOff(); @@ -4797,15 +4789,10 @@ void HopkinsEngine::PUBQUIT() { _eventsManager.changeMouseCursor(0); _eventsManager._mouseCursorId = 0; _eventsManager._mouseSpriteId = 0; - _globals.netscape = true; bool mouseClicked = false; - // CHECKME: Useless variables ? - // int xp, yp; do { -// xp = _eventsManager.XMOUSE(); -// yp = _eventsManager.YMOUSE(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1) @@ -4813,7 +4800,7 @@ void HopkinsEngine::PUBQUIT() { } while (!mouseClicked && !g_system->getEventManager()->shouldQuit()); // Original tried to open a web browser link here. Since ScummVM doesn't support - // that, it's being skipped in favour of simply exitting + // that, it's being skipped in favor of simply exiting _graphicsManager.FADE_OUTW(); } @@ -4828,12 +4815,10 @@ void HopkinsEngine::handleConflagration() { _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _graphicsManager.VISU_ALL(); - _globals.BPP_NOAFF = true; for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _globals.iRegul = 1; @@ -4939,12 +4924,10 @@ void HopkinsEngine::BASED() { _animationManager.loadAnim("ANIM92"); _graphicsManager.VISU_ALL(); _objectsManager.INILINK("IM92"); - _globals.BPP_NOAFF = true; for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _globals.CACHE_ON(); @@ -4954,7 +4937,7 @@ void HopkinsEngine::BASED() { _graphicsManager.FADE_OUTW(); _graphicsManager.FIN_VISU(); - _globals.RESET_CACHE(); + _globals.resetCache(); _globals._disableInventFl = false; _globals._exitId = 93; _globals.iRegul = 0; @@ -4971,8 +4954,6 @@ void HopkinsEngine::playEnding() { _globals.chemin = (int16 *)g_PTRNUL; _globals.NOMARCHE = true; _globals._exitId = 0; - _globals.AFFLI = false; - _globals.AFFIVBL = false; _soundManager.loadSample(1, "SOUND90.WAV"); _graphicsManager.loadImage("IM100"); _animationManager.loadAnim("ANIM100"); @@ -4986,12 +4967,10 @@ void HopkinsEngine::playEnding() { _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _eventsManager.changeMouseCursor(0); - _globals.BPP_NOAFF = true; for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - _globals.BPP_NOAFF = false; _graphicsManager.FADE_INW(); _globals.iRegul = 1; @@ -5652,8 +5631,6 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager._noFadingFl = false; _globals.NOMARCHE = false; _globals._exitId = 0; - _globals.AFFLI = false; - _globals.AFFIVBL = true; _globals._disableInventFl = true; _soundManager.WSOUND(soundId); _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); @@ -5741,7 +5718,6 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._exitId = exit4; _graphicsManager.FADE_OUTW(); _objectsManager.removeSprite(0); - _globals.AFFLI = false; _objectsManager.CLEAR_ECRAN(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index fb15142dc1..710ff6c3ab 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -38,7 +38,7 @@ LinesManager::LinesManager() { } next_ligne = 0; - TOTAL_LIGNES = 0; + _linesNumb = 0; NV_LIGNEDEP = 0; NV_LIGNEOFS = 0; NV_POSI = 0; @@ -225,8 +225,8 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - if (TOTAL_LIGNES < idx) - TOTAL_LIGNES = idx; + if (_linesNumb < idx) + _linesNumb = idx; Ligne[idx].lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx].lineData); v7 = a3 - a5; @@ -463,9 +463,9 @@ void LinesManager::INIPARCOURS() { ++v0; } while (!v1); - _vm->_objectsManager.DERLIGNE = v0; + _vm->_objectsManager._lastLine = v0; v13 = _vm->_globals.Max_Ligne_Long; - v9 = _vm->_objectsManager.DERLIGNE + 1; + v9 = _vm->_objectsManager._lastLine + 1; for (int v8 = 1; v8 != 400; v8++) { v11 = v8; if (Ligne[v11].field0 < v13) { @@ -732,7 +732,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v6 = a2; v50 = a3; v7 = a5; - if (colision2_ligne(a1, a2, &v51, &v50, 0, TOTAL_LIGNES)) { + if (colision2_ligne(a1, a2, &v51, &v50, 0, _linesNumb)) { v8 = Ligne[v50].field4; if (v8 == 1) v6 = a2 - 2; @@ -764,7 +764,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v9 = 0; v10 = v40; for (i = v40; v40 + 200 > v10; i = v10) { - if (colision2_ligne(v41, i, &v49, &v48, 0, _vm->_objectsManager.DERLIGNE) == 1 && v48 <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v41, i, &v49, &v48, 0, _vm->_objectsManager._lastLine) == 1 && v48 <= _vm->_objectsManager._lastLine) break; v49 = 0; v48 = -1; @@ -775,7 +775,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v12 = 0; v13 = v40; for (j = v40; v40 - 200 < v13; j = v13) { - if (colision2_ligne(v41, j, &v47, &v46, 0, _vm->_objectsManager.DERLIGNE) == 1 && v46 <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v41, j, &v47, &v46, 0, _vm->_objectsManager._lastLine) == 1 && v46 <= _vm->_objectsManager._lastLine) break; v47 = 0; v46 = -1; @@ -786,7 +786,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v15 = 0; v16 = v41; for (k = v41; v41 + 200 > v16; k = v16) { - if (colision2_ligne(k, v40, &v45, &v44, 0, _vm->_objectsManager.DERLIGNE) == 1 && v44 <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(k, v40, &v45, &v44, 0, _vm->_objectsManager._lastLine) == 1 && v44 <= _vm->_objectsManager._lastLine) break; v45 = 0; v44 = -1; @@ -797,7 +797,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v18 = 0; v19 = v41; for (l = v41; v41 - 200 < v19; l = v19) { - if (colision2_ligne(l, v40, &v43, &v42, 0, _vm->_objectsManager.DERLIGNE) == 1 && v42 <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(l, v40, &v43, &v42, 0, _vm->_objectsManager._lastLine) == 1 && v42 <= _vm->_objectsManager._lastLine) break; v43 = 0; v42 = -1; @@ -889,8 +889,8 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 1) { for (int v22 = 0; v22 < v39; v22++) { - if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v46) { + if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v46) { v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); if (v23 == -1) return 0; @@ -913,8 +913,8 @@ LABEL_186: } if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { - if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v46) { + if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v46) { v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); if (v26 == -1) return 0; @@ -933,8 +933,8 @@ LABEL_186: } if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { - if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v46) { + if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v46) { v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v29 == -1) return 0; @@ -953,8 +953,8 @@ LABEL_186: } if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { - if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v46) { + if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v46) { v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v32 == -1) return 0; @@ -1004,7 +1004,7 @@ LABEL_112: break; while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) { --v86; - if (_vm->_objectsManager.DERLIGNE - 1 != v86) { + if (_vm->_objectsManager._lastLine - 1 != v86) { v11 = 2 * Ligne[v86].field0; v12 = Ligne[v86].lineData; if (v12 != (int16 *)g_PTRNUL) @@ -1039,7 +1039,7 @@ LABEL_11: break; } ++v87; - if (v87 != TOTAL_LIGNES + 1) { + if (v87 != _linesNumb + 1) { v15 = 2 * Ligne[v87].field0; v16 = Ligne[v87].lineData; if (v16 != (int16 *)g_PTRNUL) @@ -1099,7 +1099,7 @@ LABEL_17: for (int v89 = v85 + 1; v89 > 0; v89--) { int v96 = _vm->_globals.BufLig[v25]; int v94 = _vm->_globals.BufLig[v25 + 1]; - if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) && _vm->_objectsManager.DERLIGNE < v100) { + if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) { v80 = v100; v77 = v101; v78 = v96; @@ -1290,7 +1290,7 @@ LABEL_17: v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); loopCond = false; do { - loopCond = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES); + loopCond = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb); if (loopCond) { int v50 = v100; if (Ligne[v50].field4 == 1) @@ -1487,7 +1487,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) return (int16 *)g_PTRNUL; } - _vm->_globals.NOT_VERIF = 0; + _vm->_globals.NOT_VERIF = false; _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; _vm->_globals.old_x1_65 = srcX; _vm->_globals.old_x2_67 = destX; @@ -1530,7 +1530,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v101 = v16; v16 = v101; - if (colision2_ligne(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE) && v141[v101] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v101] <= _vm->_objectsManager._lastLine) break; v136[v101] = 0; v141[v101] = -1; @@ -1546,7 +1546,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v102 = v20; v20 = v102; - if (colision2_ligne(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE) && v141[v102] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v102] <= _vm->_objectsManager._lastLine) break; v136[v102] = 0; v141[v102] = -1; @@ -1566,7 +1566,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v103 = v24; v24 = v103; - if (colision2_ligne(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE) && v141[v103] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v103] <= _vm->_objectsManager._lastLine) break; v136[v103] = 0; v141[v103] = -1; @@ -1588,7 +1588,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v104 = v28; v28 = v104; - if (colision2_ligne(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE) && v141[v104] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v104] <= _vm->_objectsManager._lastLine) break; v136[v104] = 0; v141[v104] = -1; @@ -1605,13 +1605,13 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } while (_vm->_graphicsManager.min_x < v27); } v131[7] = v26; - if (v141[1] < 0 || _vm->_objectsManager.DERLIGNE < v141[1]) + if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) v141[1] = -1; - if (v141[3] < 0 || _vm->_objectsManager.DERLIGNE < v141[3]) + if (v141[3] < 0 || _vm->_objectsManager._lastLine < v141[3]) v141[3] = -1; - if (v141[5] < 0 || _vm->_objectsManager.DERLIGNE < v141[5]) + if (v141[5] < 0 || _vm->_objectsManager._lastLine < v141[5]) v141[5] = -1; - if (v141[7] < 0 || _vm->_objectsManager.DERLIGNE < v141[7]) + if (v141[7] < 0 || _vm->_objectsManager._lastLine < v141[7]) v141[7] = -1; if (v141[1] < 0) v131[1] = 1300; @@ -1658,7 +1658,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v105 = v36; v36 = v105; - if (colision2_ligne(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager.DERLIGNE) && v141[v105] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v105] <= _vm->_objectsManager._lastLine) break; v136[v105] = 0; v141[v105] = -1; @@ -1674,7 +1674,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v106 = v40; v40 = v106; - if (colision2_ligne(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager.DERLIGNE) && v141[v106] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v106] <= _vm->_objectsManager._lastLine) break; v136[v106] = 0; v141[v106] = -1; @@ -1694,7 +1694,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v107 = v44; v44 = v107; - if (colision2_ligne(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager.DERLIGNE) && v141[v107] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v107] <= _vm->_objectsManager._lastLine) break; v136[v107] = 0; v141[v107] = -1; @@ -1714,7 +1714,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v108 = v48; v48 = v108; - if (colision2_ligne(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager.DERLIGNE) && v141[v108] <= _vm->_objectsManager.DERLIGNE) + if (colision2_ligne(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v108] <= _vm->_objectsManager._lastLine) break; v136[v108] = 0; v141[v108] = -1; @@ -1797,8 +1797,8 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v124) { + if (colision2_ligne(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { v57 = v112; v58 = GENIAL(v124, v125, srcX, srcY - v56, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); if (v58 == -1) @@ -1821,8 +1821,8 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v124) { + if (colision2_ligne(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { v57 = v112; v61 = GENIAL(v124, v125, srcX, v60 + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) @@ -1845,8 +1845,8 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v124) { + if (colision2_ligne(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { v57 = v112; v64 = GENIAL(v124, v125, srcX - v63, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v64 == -1) @@ -1869,8 +1869,8 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if (colision2_ligne(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager.DERLIGNE + 1, TOTAL_LIGNES) - && _vm->_objectsManager.DERLIGNE < v124) { + if (colision2_ligne(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { v57 = v112; v67 = GENIAL(v124, v125, v66 + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v67 == -1) @@ -2210,7 +2210,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int if (a5 == -1 && a6 == -1) v136 = 1; v144 = a5; - if (colision2_ligne(a1, a2, &v145, &v144, 0, TOTAL_LIGNES)) { + if (colision2_ligne(a1, a2, &v145, &v144, 0, _linesNumb)) { int v8 = Ligne[v144].field4; if (v8 == 1) v90 = a2 - 2; @@ -2416,7 +2416,7 @@ LABEL_103: v23 = 0; if (v108 + 1 <= 0) goto LABEL_149; - while (!colision2_ligne(v104, v103, &v143, &v142, 0, TOTAL_LIGNES)) { + while (!colision2_ligne(v104, v103, &v143, &v142, 0, _linesNumb)) { v25 = v115; v26 = _vm->_globals.essai0; v26[v25] = v104; @@ -2431,7 +2431,7 @@ LABEL_103: if (v23 >= v108 + 1) goto LABEL_149; } - if (_vm->_objectsManager.DERLIGNE >= v142) + if (_vm->_objectsManager._lastLine >= v142) goto LABEL_157; v24 = GENIAL(v142, v143, v104, v103, a3, a4, v115, _vm->_globals.essai0, 3); if (v24 == -1) @@ -2456,7 +2456,7 @@ LABEL_67: v126 = 1; goto LABEL_70; } - if (colision2_ligne(v15, v110, &v143, &v142, 0, TOTAL_LIGNES)) + if (colision2_ligne(v15, v110, &v143, &v142, 0, _linesNumb)) break; v16 = v115; @@ -2474,7 +2474,7 @@ LABEL_70: goto LABEL_72; } } - if (v142 > _vm->_objectsManager.DERLIGNE) + if (v142 > _vm->_objectsManager._lastLine) goto LABEL_67; LABEL_157: v31 = v115; @@ -2494,7 +2494,7 @@ LABEL_158: LABEL_165: if (v113 > a3) { v36 = v113; - while (!colision2_ligne(v36, v92, &v141, &v140, 0, TOTAL_LIGNES)) { + while (!colision2_ligne(v36, v92, &v141, &v140, 0, _linesNumb)) { v37 = v117; v38 = _vm->_globals.essai1; v38[v37] = v36; @@ -2513,8 +2513,8 @@ LABEL_181: if (v92 > a4) { v43 = v92; do { - if (colision2_ligne(a3, v43, &v141, &v140, 0, TOTAL_LIGNES)) { - if (_vm->_objectsManager.DERLIGNE < v140) { + if (colision2_ligne(a3, v43, &v141, &v140, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < v140) { v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); if (v44 == -1) goto LABEL_195; @@ -2523,12 +2523,12 @@ LABEL_181: if (NVPY != -1) { v33 = NVPX; v92 = NVPY; - v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager.DERLIGNE); + v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); goto LABEL_189; } } } - if (v140 <= _vm->_objectsManager.DERLIGNE) + if (v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; } v46 = v117; @@ -2567,8 +2567,8 @@ LABEL_195: } v39 = v92; for (;;) { - if (colision2_ligne(a3, v39, &v141, &v140, 0, TOTAL_LIGNES)) { - if (_vm->_objectsManager.DERLIGNE < v140) { + if (colision2_ligne(a3, v39, &v141, &v140, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < v140) { v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3); if (v40 == -1) goto LABEL_195; @@ -2577,15 +2577,15 @@ LABEL_195: if (NVPY != -1) { v33 = NVPX; v92 = NVPY; - v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager.DERLIGNE); + v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); LABEL_189: - if (v45 && v140 <= _vm->_objectsManager.DERLIGNE) + if (v45 && v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; goto LABEL_158; } } } - if (v140 <= _vm->_objectsManager.DERLIGNE) + if (v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; } v41 = v117; @@ -2600,7 +2600,7 @@ LABEL_189: goto LABEL_181; } } - while (!colision2_ligne(v33, v92, &v141, &v140, 0, TOTAL_LIGNES)) { + while (!colision2_ligne(v33, v92, &v141, &v140, 0, _linesNumb)) { v34 = v117; v35 = _vm->_globals.essai1; v35[v34] = v33; @@ -2612,7 +2612,7 @@ LABEL_189: goto LABEL_165; } LABEL_168: - if (v140 > _vm->_objectsManager.DERLIGNE) + if (v140 > _vm->_objectsManager._lastLine) v140 = -1; LABEL_202: v52 = v117; @@ -2629,7 +2629,7 @@ LABEL_203: goto LABEL_241; if (v93 < a4) { v55 = v93; - while (!colision2_ligne(v114, v55, &v139, &v138, 0, TOTAL_LIGNES)) { + while (!colision2_ligne(v114, v55, &v139, &v138, 0, _linesNumb)) { v56 = v117; v57 = _vm->_globals.essai2; v57[v56] = v114; @@ -2645,7 +2645,7 @@ LABEL_203: LABEL_211: if (v93 > a4) { v58 = v93; - while (!colision2_ligne(v114, v58, &v139, &v138, 0, TOTAL_LIGNES)) { + while (!colision2_ligne(v114, v58, &v139, &v138, 0, _linesNumb)) { v59 = v117; v60 = _vm->_globals.essai2; v60[v59] = v114; @@ -2657,7 +2657,7 @@ LABEL_211: goto LABEL_217; } LABEL_214: - if (v138 > _vm->_objectsManager.DERLIGNE) + if (v138 > _vm->_objectsManager._lastLine) v138 = -1; LABEL_249: v76 = v117; @@ -2811,8 +2811,8 @@ LABEL_217: if (v114 < a3) { v61 = v114; do { - if (colision2_ligne(v61, a4, &v139, &v138, 0, TOTAL_LIGNES)) { - if (_vm->_objectsManager.DERLIGNE < v138) { + if (colision2_ligne(v61, a4, &v139, &v138, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < v138) { v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v62 == -1) goto LABEL_195; @@ -2821,15 +2821,15 @@ LABEL_217: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); + colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); LABEL_235: - if (colResult && v138 <= _vm->_objectsManager.DERLIGNE) + if (colResult && v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; goto LABEL_203; } } } - if (v138 <= _vm->_objectsManager.DERLIGNE) + if (v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; } v63 = v117; @@ -2845,8 +2845,8 @@ LABEL_235: if (v114 > a3) { v65 = v114; do { - if (colision2_ligne(v65, a4, &v139, &v138, 0, TOTAL_LIGNES)) { - if (_vm->_objectsManager.DERLIGNE < v138) { + if (colision2_ligne(v65, a4, &v139, &v138, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < v138) { v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v66 == -1) goto LABEL_242; @@ -2855,12 +2855,12 @@ LABEL_235: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager.DERLIGNE); + colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); goto LABEL_235; } } } - if (v138 <= _vm->_objectsManager.DERLIGNE) + if (v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; } v68 = v117; @@ -2946,7 +2946,7 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { v12 = 1000 * a2 / 1000; v14 = 0; if (v13 + 1 > 0) { - while (!colision2_ligne(v9, v12, &v18, &v17, 0, TOTAL_LIGNES) || v17 > _vm->_objectsManager.DERLIGNE) { + while (!colision2_ligne(v9, v12, &v18, &v17, 0, _linesNumb) || v17 > _vm->_objectsManager._lastLine) { v7 += v16; v8 += v15; v9 = v7 / 1000; @@ -3439,8 +3439,8 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { int v28; v26 = 0; - v25 = _vm->_objectsManager.DERLIGNE + 1; - for (i = (int)(_vm->_objectsManager.DERLIGNE + 1); i < _vm->_linesManager.TOTAL_LIGNES + 1; i = v25) { + v25 = _vm->_objectsManager._lastLine + 1; + for (i = (int)(_vm->_objectsManager._lastLine + 1); i < _vm->_linesManager._linesNumb + 1; i = v25) { v6 = i; v7 = Ligne[i].lineData; v8 = Ligne[v6].field0; @@ -3475,7 +3475,7 @@ LABEL_12: v16 = v24; if (Ligne[v16].field6 == 3 || Ligne[v16].field8 == 7) v13 += 2; - if (!colision2_ligne(v13, v14, &v28, &v27, 0, _vm->_objectsManager.DERLIGNE)) + if (!colision2_ligne(v13, v14, &v28, &v27, 0, _vm->_objectsManager._lastLine)) error("error"); *a4 = v27; *a5 = v28; @@ -3490,7 +3490,7 @@ LABEL_12: v21 = v24; if (Ligne[v21].field6 == 3 || Ligne[v21].field8 == 7) v18 -= 2; - if (!colision2_ligne(v18, v19, &v28, &v27, 0, _vm->_objectsManager.DERLIGNE)) + if (!colision2_ligne(v18, v19, &v28, &v27, 0, _vm->_objectsManager._lastLine)) error("erreure"); *a4 = v27; *a5 = v28; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index ab32a28f8a..e951fcd4a2 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -58,7 +58,7 @@ public: LigneItem Ligne[400]; SmoothItem SMOOTH[4000]; int next_ligne; - int TOTAL_LIGNES; + int _linesNumb; int NV_LIGNEDEP; int NV_LIGNEOFS; int NV_POSI; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 818f8c6535..8cc859be78 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -43,7 +43,7 @@ ObjectsManager::ObjectsManager() { _oldBorderSpriteIndex = 0; _borderPos = Common::Point(0, 0); _borderSpriteIndex = 0; - SL_X = SL_Y = 0; + _saveLoadX = _saveLoadY = 0; I_old_x = I_old_y = 0; g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; @@ -52,15 +52,13 @@ ObjectsManager::ObjectsManager() { _spritePtr = g_PTRNUL; S_old_spr = g_PTRNUL; PERSO_ON = false; - SL_FLAG = false; + _saveLoadFl = false; SL_MODE = false; _visibleFl = false; _disableCursorFl = false; BOBTOUS = false; my_anim = 0; NUMZONE = 0; - ARRET_PERSO_FLAG = 0; - ARRET_PERSO_NUM = 0; _forceZoneFl = false; _changeVerbFl = false; _verb = 0; @@ -68,7 +66,7 @@ ObjectsManager::ObjectsManager() { SPEED_X = SPEED_Y = 0; SPEED_IMAGE = 0; SPEED_PTR = g_PTRNUL; - DERLIGNE = 0; + _lastLine = 0; A_ANIM = 0; MA_ANIM = 0; MA_ANIM1 = 0; @@ -308,50 +306,27 @@ int ObjectsManager::addObject(int objIndex) { * Display Sprite */ void ObjectsManager::displaySprite() { - int v1; - int v2; - int destX; - int destY; - int v6; - int v7; - int v8; - int v9; - int v11; - uint16 *v12; - int v13; - int y1_1; - int y1_2; - int v25; - int v27; - int x1_1; - int x1_2; + int clipX; + int clipY; + bool loopCondFl; uint16 arr[50]; // Handle copying any background areas that text are going to be drawn on - _vm->_globals.NBTRI = 0; + _vm->_globals._sortedDisplayCount = 0; for (int idx = 0; idx <= 10; ++idx) { if (_vm->_fontManager._textList[idx]._enabledFl && _vm->_fontManager._text[idx]._textType != 2) { - v1 = _vm->_fontManager._textList[idx]._pos.x; - x1_1 = v1 - 2; - - if ((int16)(v1 - 2) < _vm->_graphicsManager.min_x) - x1_1 = _vm->_graphicsManager.min_x; - v2 = _vm->_fontManager._textList[idx]._pos.y; - y1_1 = v2 - 2; - - if ((int16)(v2 - 2) < _vm->_graphicsManager.min_y) - y1_1 = _vm->_graphicsManager.min_y; - destX = v1 - 2; - if (destX < _vm->_graphicsManager.min_x) - destX = _vm->_graphicsManager.min_x; - destY = v2 - 2; - if (destY < _vm->_graphicsManager.min_y) - destY = _vm->_graphicsManager.min_y; - - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, x1_1, y1_1, + clipX = _vm->_fontManager._textList[idx]._pos.x - 2; + + if (clipX < _vm->_graphicsManager.min_x) + clipX = _vm->_graphicsManager.min_x; + + clipY = _vm->_fontManager._textList[idx]._pos.y - 2; + if (clipY < _vm->_graphicsManager.min_y) + clipY = _vm->_graphicsManager.min_y; + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, - _vm->_graphicsManager._vesaBuffer, - destX, destY); + _vm->_graphicsManager._vesaBuffer, clipX, clipY); _vm->_fontManager._textList[idx]._enabledFl = false; } } @@ -359,24 +334,17 @@ void ObjectsManager::displaySprite() { if (!PERSO_ON) { for (int idx = 0; idx < MAX_SPRITE; ++idx) { if (_vm->_globals.Liste[idx].field0) { - v6 = _vm->_globals.Liste[idx].field2; - x1_2 = v6 - 2; - if ((int16)(v6 - 2) < _vm->_graphicsManager.min_x) - x1_2 = _vm->_graphicsManager.min_x; - v7 = _vm->_globals.Liste[idx].field4; - y1_2 = v7 - 2; - if ((int16)(v7 - 2) < _vm->_graphicsManager.min_y) - y1_2 = _vm->_graphicsManager.min_y; - v8 = v6 - 2; - if (v8 < _vm->_graphicsManager.min_x) - v8 = _vm->_graphicsManager.min_x; - v9 = v7 - 2; - if (v9 < _vm->_graphicsManager.min_y) - v9 = _vm->_graphicsManager.min_y; - - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, x1_2, y1_2, + clipX = _vm->_globals.Liste[idx].field2 - 2; + if (clipX < _vm->_graphicsManager.min_x) + clipX = _vm->_graphicsManager.min_x; + + clipY = _vm->_globals.Liste[idx].field4 - 2; + if (clipY < _vm->_graphicsManager.min_y) + clipY = _vm->_graphicsManager.min_y; + + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, - _vm->_graphicsManager._vesaBuffer, v8, v9); + _vm->_graphicsManager._vesaBuffer, clipX, clipY); _vm->_globals.Liste[idx].field0 = false; } } @@ -392,93 +360,89 @@ void ObjectsManager::displaySprite() { if (_sprite[idx]._animationType == 1) { computeSprite(idx); if (_sprite[idx].field2A) - AvantTri(TRI_SPRITE, idx, _sprite[idx]._height + _sprite[idx].field2E); + beforeSort(SORT_SPRITE, idx, _sprite[idx]._height + _sprite[idx].field2E); } } if (_vm->_globals._cacheFl) - VERIFCACHE(); + checkCache(); } - if (_priorityFl && _vm->_globals.NBTRI) { + if (_priorityFl && _vm->_globals._sortedDisplayCount) { for (int v33 = 1; v33 <= 48; v33++) arr[v33] = v33; - v25 = _vm->_globals.NBTRI; do { - v27 = 0; - if (v25 > 1) { - for (int v34 = 1; v34 < _vm->_globals.NBTRI; v34++) { - v11 = arr[v34]; - v12 = &arr[v34 + 1]; - if (_vm->_globals.Tri[arr[v34]]._priority > _vm->_globals.Tri[*v12]._priority) { - arr[v34] = *v12; - *v12 = v11; - ++v27; - } + loopCondFl = false; + for (int v34 = 1; v34 < _vm->_globals._sortedDisplayCount; v34++) { + if (_vm->_globals._sortedDisplay[arr[v34]]._priority > _vm->_globals._sortedDisplay[arr[v34 + 1]]._priority) { + int oldIdx = arr[v34]; + arr[v34] = arr[v34 + 1]; + arr[v34 + 1] = oldIdx; + loopCondFl = true; } } - } while (v27); + } while (loopCondFl); - for (int v35 = 1; v35 < _vm->_globals.NBTRI + 1; v35++) { - v13 = arr[v35]; - switch (_vm->_globals.Tri[v13]._triMode) { - case TRI_BOB: - DEF_BOB(_vm->_globals.Tri[v13]._index); + for (int sortIdx = 1; sortIdx < _vm->_globals._sortedDisplayCount + 1; sortIdx++) { + int idx = arr[sortIdx]; + switch (_vm->_globals._sortedDisplay[idx]._sortMode) { + case SORT_BOB: + DEF_BOB(_vm->_globals._sortedDisplay[idx]._index); break; - case TRI_SPRITE: - DEF_SPRITE(_vm->_globals.Tri[v13]._index); + case SORT_SPRITE: + DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; - case TRI_CACHE: - DEF_CACHE(_vm->_globals.Tri[v13]._index); + case SORT_CACHE: + DEF_CACHE(_vm->_globals._sortedDisplay[idx]._index); break; default: break; } - _vm->_globals.Tri[v13]._triMode = TRI_NONE; + _vm->_globals._sortedDisplay[idx]._sortMode = SORT_NONE; } } else { - for (int idx = 1; idx < (_vm->_globals.NBTRI + 1); ++idx) { - switch (_vm->_globals.Tri[idx]._triMode) { - case TRI_BOB: - DEF_BOB(_vm->_globals.Tri[idx]._index); + for (int idx = 1; idx < (_vm->_globals._sortedDisplayCount + 1); ++idx) { + switch (_vm->_globals._sortedDisplay[idx]._sortMode) { + case SORT_BOB: + DEF_BOB(_vm->_globals._sortedDisplay[idx]._index); break; - case TRI_SPRITE: - DEF_SPRITE(_vm->_globals.Tri[idx]._index); + case SORT_SPRITE: + DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; - case TRI_CACHE: - DEF_CACHE(_vm->_globals.Tri[idx]._index); + case SORT_CACHE: + DEF_CACHE(_vm->_globals._sortedDisplay[idx]._index); break; default: break; } - _vm->_globals.Tri[idx]._triMode = TRI_NONE; + _vm->_globals._sortedDisplay[idx]._sortMode = SORT_NONE; } } // Reset the Tri array for (int idx = 0; idx < 50; ++idx) { - _vm->_globals.Tri[idx]._triMode = TRI_NONE; - _vm->_globals.Tri[idx]._index = 0; - _vm->_globals.Tri[idx]._priority = 0; + _vm->_globals._sortedDisplay[idx]._sortMode = SORT_NONE; + _vm->_globals._sortedDisplay[idx]._index = 0; + _vm->_globals._sortedDisplay[idx]._priority = 0; } - _vm->_globals.NBTRI = 0; + _vm->_globals._sortedDisplayCount = 0; if (_vm->_dialogsManager._inventDisplayedFl) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); if (_oldBorderPos.x && _oldBorderPos.y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventBuf2, _oldBorderPos.x + 300, _oldBorderPos.y + 300, _oldBorderSpriteIndex + 1); if (_borderPos.x && _borderPos.y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventBuf2, _borderPos.x + 300, _borderPos.y + 300, _borderSpriteIndex); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); + _vm->_graphicsManager.addVesaSegment(_vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventX + _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventY + _vm->_dialogsManager._inventHeight); } - if (SL_FLAG) { + if (_saveLoadFl) { _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); - if (SL_X && SL_Y) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, SL_SPR2, SL_X + _vm->_eventsManager._startPos.x + 300, SL_Y + 300, 0); + if (_saveLoadX && _saveLoadY) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, SL_SPR2, _saveLoadX + _vm->_eventsManager._startPos.x + 300, _saveLoadY + 300, 0); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); + _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); } // If the Options dialog is activated, draw the elements @@ -499,7 +463,7 @@ void ObjectsManager::displaySprite() { _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals._menuDisplayType); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals._menuScrollSpeed); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); + _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); } // Loop to draw any on-screen text @@ -624,7 +588,7 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx]._visibleFl = false; if (_vm->_globals.Liste2[idx]._visibleFl) - _vm->_graphicsManager.Ajoute_Segment_Vesa( + _vm->_graphicsManager.addVesaSegment( _vm->_globals.Liste2[idx]._xp, _vm->_globals.Liste2[idx]._yp, _vm->_globals.Liste2[idx]._xp + _vm->_globals.Liste2[idx]._width, @@ -821,7 +785,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals._bob[idx]._oldHeight = height; } -void ObjectsManager::VERIFCACHE() { +void ObjectsManager::checkCache() { for (int v8 = 0; v8 <= 19; v8++) { if (_vm->_globals.Cache[v8].fieldA <= 0) continue; @@ -872,7 +836,7 @@ void ObjectsManager::VERIFCACHE() { if (v5 > 440) v5 = 500; - AvantTri(TRI_CACHE, v8, v5); + beforeSort(SORT_CACHE, v8, v5); _vm->_globals.Cache[v8].fieldA = 1; _vm->_globals.Cache[v8].field10 = true; } @@ -913,7 +877,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx].field0 = false; if (_vm->_globals.Liste[idx].field0) - _vm->_graphicsManager.Ajoute_Segment_Vesa( _vm->_globals.Liste[idx].field2, _vm->_globals.Liste[idx].field4, + _vm->_graphicsManager.addVesaSegment( _vm->_globals.Liste[idx].field2, _vm->_globals.Liste[idx].field4, _vm->_globals.Liste[idx].field2 + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx].field4 + _vm->_globals.Liste[idx]._height); } @@ -922,7 +886,7 @@ void ObjectsManager::DEF_CACHE(int idx) { _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, _vm->_globals.Cache[idx]._spriteIndex); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.Cache[idx]._x, _vm->_globals.Cache[idx]._y, + _vm->_graphicsManager.addVesaSegment(_vm->_globals.Cache[idx]._x, _vm->_globals.Cache[idx]._y, _vm->_globals.Cache[idx]._x + _vm->_globals.Cache[idx]._width, _vm->_globals.Cache[idx]._y + _vm->_globals.Cache[idx]._height); } @@ -1019,17 +983,17 @@ void ObjectsManager::computeSprite(int idx) { } // Before Sort -int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { +int ObjectsManager::beforeSort(SortMode triMode, int index, int priority) { int result; - ++_vm->_globals.NBTRI; - if (_vm->_globals.NBTRI > 48) + ++_vm->_globals._sortedDisplayCount; + if (_vm->_globals._sortedDisplayCount > 48) error("NBTRI too high"); - result = _vm->_globals.NBTRI; - _vm->_globals.Tri[result]._triMode = triMode; - _vm->_globals.Tri[result]._index = index; - _vm->_globals.Tri[result]._priority = priority; + result = _vm->_globals._sortedDisplayCount; + _vm->_globals._sortedDisplay[result]._sortMode = triMode; + _vm->_globals._sortedDisplay[result]._index = index; + _vm->_globals._sortedDisplay[result]._priority = priority; return result; } @@ -1198,7 +1162,7 @@ void ObjectsManager::displayBobAnim() { v19 = 600; if (_vm->_globals._bob[i]._activeFl) - AvantTri(TRI_BOB, i, v19); + beforeSort(SORT_BOB, i, v19); } } } @@ -1221,7 +1185,7 @@ void ObjectsManager::displayVBob() { _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); - _vm->_graphicsManager.Ajoute_Segment_Vesa( + _vm->_graphicsManager.addVesaSegment( _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, _vm->_globals.VBob[idx]._xp + width, height + _vm->_globals.VBob[idx]._yp); @@ -1251,7 +1215,7 @@ void ObjectsManager::displayVBob() { _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, _vm->_globals.VBob[idx]._oldY, width, height); - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx]._oldX, + _vm->_graphicsManager.addVesaSegment(_vm->_globals.VBob[idx]._oldX, _vm->_globals.VBob[idx]._oldY, _vm->_globals.VBob[idx]._oldX + width, _vm->_globals.VBob[idx]._oldY + height); @@ -1299,7 +1263,7 @@ void ObjectsManager::displayVBob() { _vm->_globals.VBob[idx]._frameIndex); } - _vm->_graphicsManager.Ajoute_Segment_Vesa(_vm->_globals.VBob[idx]._xp, + _vm->_graphicsManager.addVesaSegment(_vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp , _vm->_globals.VBob[idx]._xp + width, _vm->_globals.VBob[idx]._yp + height); _vm->_globals.VBob[idx].field4 = 2; @@ -2111,8 +2075,8 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { int16 v5; _vm->_linesManager.RESET_OBSTACLE(); - _vm->_linesManager.TOTAL_LIGNES = 0; - DERLIGNE = 0; + _vm->_linesManager._linesNumb = 0; + _lastLine = 0; _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v4 = 0; @@ -2128,7 +2092,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 3), (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 4), 1); - ++_vm->_linesManager.TOTAL_LIGNES; + ++_vm->_linesManager._linesNumb; } v4 += 5; ++v5; @@ -2307,9 +2271,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.NOMARCHE = false; _spritePtr = g_PTRNUL; _vm->_globals._exitId = 0; - _vm->_globals.AFFLI = false; - _vm->_globals.AFFIVBL = false; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_soundManager.WSOUND(31); _vm->_globals.iRegul = 1; _vm->_graphicsManager.loadImage("PLAN"); @@ -2345,12 +2307,10 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_globals.BPP_NOAFF = true; for (int v4 = 0; v4 <= 4; v4++) _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; _vm->_graphicsManager.FADE_INW(); _vm->_eventsManager.changeMouseCursor(4); @@ -2397,7 +2357,6 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANY = getSpriteY(0); _vm->_globals.PLANI = 1; removeSprite(0); - _vm->_globals.AFFLI = false; _spritePtr = _vm->_globals.freeMemory(_spritePtr); CLEAR_ECRAN(); _vm->_globals.NOSPRECRAN = false; @@ -2582,11 +2541,6 @@ LABEL_65: } _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - ARRET_PERSO_FLAG = 0; - if (_vm->_eventsManager._mouseCursorId == 21 && _vm->_globals.BOBZONE[NUMZONE]) { - ARRET_PERSO_FLAG = 1; - ARRET_PERSO_NUM = _vm->_globals.BOBZONE[NUMZONE]; - } if (_vm->_globals._screenId == 20 && _vm->_globals._saveData->data[svField132] == 1 && _vm->_globals._curObjectIndex == 20 && NUMZONE == 12 && _vm->_eventsManager._mouseCursorId == 23) { @@ -2604,8 +2558,6 @@ void ObjectsManager::PARADISE() { int v5; v1 = 0; - ARRET_PERSO_FLAG = 0; - ARRET_PERSO_NUM = 0; result = _vm->_globals._saveData->data[svField1]; if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); @@ -2717,7 +2669,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_animationManager.clearAnim(); _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); - _vm->_globals.RESET_CACHE(); + _vm->_globals.resetCache(); for (int v1 = 0; v1 <= 48; v1++) { _vm->_globals.BOBZONE[v1] = 0; @@ -2732,8 +2684,8 @@ void ObjectsManager::CLEAR_ECRAN() { SPEED_Y = 0; SPEED_IMAGE = 0; _forceZoneFl = true; - _vm->_linesManager.TOTAL_LIGNES = 0; - DERLIGNE = 0; + _vm->_linesManager._linesNumb = 0; + _lastLine = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); @@ -2766,8 +2718,8 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha CH_TETE = true; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); - _vm->_graphicsManager.Ajoute_Segment_Vesa(532, 25, 597, 65); - _vm->_globals.NOT_VERIF = 1; + _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); + _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS @@ -3038,7 +2990,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v62 = v8; v8 = v62; - if (_vm->_linesManager.colision2_ligne(v75, v7, &v82[5], &v87[5], 0, DERLIGNE) && v87[v62] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v75, v7, &v82[5], &v87[5], 0, _lastLine) && v87[v62] <= _lastLine) break; v82[v62] = 0; v87[v62] = -1; @@ -3054,7 +3006,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v63 = v12; v12 = v63; - if (_vm->_linesManager.colision2_ligne(v75, v11, &v82[1], &v87[1], 0, DERLIGNE) && v87[v63] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v75, v11, &v82[1], &v87[1], 0, _lastLine) && v87[v63] <= _lastLine) break; v82[v63] = 0; v87[v63] = -1; @@ -3074,7 +3026,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v64 = v16; v16 = v64; - if (_vm->_linesManager.colision2_ligne(v15, v74, &v82[3], &v87[3], 0, DERLIGNE) && v87[v64] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v15, v74, &v82[3], &v87[3], 0, _lastLine) && v87[v64] <= _lastLine) break; v82[v64] = 0; v87[v64] = -1; @@ -3096,7 +3048,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v65 = v20; v20 = v65; - if (_vm->_linesManager.colision2_ligne(v19, v74, &v82[7], &v87[7], 0, DERLIGNE) && v87[v65] <= DERLIGNE) + if (_vm->_linesManager.colision2_ligne(v19, v74, &v82[7], &v87[7], 0, _lastLine) && v87[v65] <= _lastLine) break; v82[v65] = 0; v87[v65] = -1; @@ -3148,18 +3100,18 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v77[v24] = 1300; v76[v24] = 1300; } - if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, DERLIGNE)) { + if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _lastLine)) { v69 = v87[1]; v68 = v82[1]; } else { - if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager.TOTAL_LIGNES)) { + if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager._linesNumb)) { v27 = 0; for (;;) { v28 = _vm->_globals.essai2[v27]; v29 = _vm->_globals.essai2[v27 + 1]; v66 = _vm->_globals.essai2[v27 + 2]; v27 += 4; - if (_vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, DERLIGNE)) + if (_vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, _lastLine)) break; v32 = v67; _vm->_globals.super_parcours[v32] = v28; @@ -4331,7 +4283,7 @@ void ObjectsManager::INILINK(const Common::String &file) { for (int idx = 0; idx < 500; ++idx) _vm->_globals.STAILLE[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx); - _vm->_globals.RESET_CACHE(); + _vm->_globals.resetCache(); filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { @@ -4385,7 +4337,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v16 = ptr + idx + 4; v32 = 0; v34 = 0; - _vm->_linesManager.TOTAL_LIGNES = 0; + _vm->_linesManager._linesNumb = 0; do { v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { @@ -4397,7 +4349,7 @@ void ObjectsManager::INILINK(const Common::String &file) { (int16)READ_LE_UINT16(v16 + 2 * v32 + 6), (int16)READ_LE_UINT16(v16 + 2 * v32 + 8), 1); - ++_vm->_linesManager.TOTAL_LIGNES; + ++_vm->_linesManager._linesNumb; } v32 += 5; ++v34; @@ -4488,10 +4440,8 @@ void ObjectsManager::SPECIAL_INI() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_globals.BPP_NOAFF = true; for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); SPRITE_ON(0); for (int i = 0; i <= 4; i++) @@ -4524,10 +4474,8 @@ void ObjectsManager::SPECIAL_INI() { case 18: if (_vm->_globals._prevScreenId == 17) { _vm->_eventsManager._mouseSpriteId = 4; - _vm->_globals.BPP_NOAFF = true; for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); _vm->_globals.iRegul = 1; _vm->_globals._disableInventFl = false; @@ -5050,8 +4998,6 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals._exitId = 0; - _vm->_globals.AFFLI = false; - _vm->_globals.AFFIVBL = false; if (!backgroundFile.empty()) _vm->_graphicsManager.loadImage(backgroundFile); if (!linkFile.empty()) @@ -5077,15 +5023,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_eventsManager.changeMouseCursor(4); - _vm->_globals.BPP_NOAFF = true; for (int v6 = 0; v6 <= 4; v6++) _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; _vm->_graphicsManager.FADE_INW(); if (_vm->_globals._screenId == 61) { _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); stopBobAnimation(3); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; g_old_x = getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; @@ -5093,7 +5037,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo v7 = getSpriteY(0); v8 = getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -5147,9 +5091,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; _vm->_globals._exitId = 0; - _vm->_globals.AFFLI = false; - _vm->_globals.AFFIVBL = false; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_soundManager.WSOUND(v); _vm->_globals.iRegul = 1; if (!backgroundFile.empty()) @@ -5217,12 +5159,10 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm g_old_y = _characterPos.y; _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; - _vm->_globals.BPP_NOAFF = true; for (int idx = 0; idx < 5; ++idx) _vm->_eventsManager.VBL(); - _vm->_globals.BPP_NOAFF = false; _vm->_globals.iRegul = 1; if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.FADE_INW(); @@ -5276,7 +5216,6 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.FADE_OUTW(); _vm->_graphicsManager._noFadingFl = false; removeSprite(0); - _vm->_globals.AFFLI = false; if (_twoCharactersFl) { removeSprite(1); _twoCharactersFl = false; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7f50a20232..5067e8f0ec 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -68,7 +68,7 @@ public: int _oldBorderSpriteIndex; Common::Point _borderPos; int _borderSpriteIndex; - int SL_X, SL_Y; + int _saveLoadX, _saveLoadY; int I_old_x, I_old_y; int g_old_x, g_old_y; int FLAG_VISIBLE_EFFACE; @@ -77,15 +77,13 @@ public: byte *_spritePtr; const byte *S_old_spr; bool PERSO_ON; - bool SL_FLAG; + bool _saveLoadFl; int SL_MODE; bool _visibleFl; bool _disableCursorFl; bool BOBTOUS; int my_anim; int NUMZONE; - int ARRET_PERSO_FLAG; - int ARRET_PERSO_NUM; bool _forceZoneFl; bool _changeVerbFl; int _verb; @@ -93,7 +91,7 @@ public: int SPEED_X, SPEED_Y; int SPEED_IMAGE; byte *SPEED_PTR; - int DERLIGNE; + int _lastLine; int A_ANIM; int MA_ANIM; int MA_ANIM1; @@ -151,11 +149,11 @@ public: void SCBOB(int idx); void CALCUL_BOB(int idx); - void VERIFCACHE(); + void checkCache(); void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void computeSprite(int idx); - int AvantTri(TriMode triMode, int index, int priority); + int beforeSort(SortMode triMode, int index, int priority); void displayBobAnim(); void displayVBob(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index e1e0ac70b6..1add672380 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -735,7 +735,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 46: { - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; int v13 = _vm->_objectsManager.getSpriteY(0); int v14 = _vm->_objectsManager.getSpriteX(0); @@ -749,7 +749,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); _vm->_soundManager.loadSample(2, "SOUND45.WAV"); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); @@ -948,7 +948,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 59: { - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; @@ -956,7 +956,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v16 = _vm->_objectsManager.getSpriteY(0); int v17 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1050,7 +1050,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 81: { - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; @@ -1058,7 +1058,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v22 = _vm->_objectsManager.getSpriteY(0); int v23 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1371,7 +1371,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 105: - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; @@ -1391,7 +1391,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v32 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); } - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1624,16 +1624,16 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("gred1.pe2"); _vm->_globals.NOPARLE = false; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; int v55 = _vm->_objectsManager.getSpriteY(0); int v56 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.NUMZONE = -1; do { if (_vm->shouldQuit()) @@ -1654,16 +1654,16 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); _vm->_globals.NOPARLE = false; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; int v57 = _vm->_objectsManager.getSpriteY(0); int v58 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.NUMZONE = -1; do { if (_vm->shouldQuit()) @@ -1837,12 +1837,12 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager._disableEscKeyFl = false; _vm->_soundManager.SPECIAL_SOUND = 0; } - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; int v37 = _vm->_objectsManager.getSpriteY(0); int v38 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.NUMZONE = 0; do { if (_vm->shouldQuit()) @@ -1872,12 +1872,12 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(1); _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; int v39 = _vm->_objectsManager.getSpriteY(0); int v40 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); _vm->_objectsManager.NUMZONE = 0; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1968,16 +1968,16 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.INILINK("IM93a"); _vm->_objectsManager.OBSSEUL = 0; _vm->_globals.CACHE_ON(); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals.g_old_sens = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; int v43 = _vm->_objectsManager.getSpriteY(0); int v44 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); - _vm->_globals.NOT_VERIF = 1; + _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) return -1; // Exiting game diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index b2ead64e87..1a1778913e 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1083,7 +1083,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.no_scroll = 1; _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); - _vm->_globals.RESET_CACHE(); + _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) _vm->_globals.BOBZONE[i] = 0; @@ -1166,7 +1166,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.NECESSAIRE = false; _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); - _vm->_globals.RESET_CACHE(); + _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) _vm->_globals.BOBZONE[i] = 0; -- cgit v1.2.3 From 74d1e3e0137bfdc49936054999c2b3bd9d011e8a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Jan 2013 15:04:12 +0100 Subject: HOPKINS: fix errors in ajoute_ligne, add comments on the impossible check --- engines/hopkins/lines.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 710ff6c3ab..78096fcf38 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -225,6 +225,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); + if (_linesNumb < idx) _linesNumb = idx; @@ -297,19 +298,20 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, Ligne[idx].field8 = 4; } } - if (v11 == 1 && (unsigned int)(v37 - 251) <= 748) { + if (v11 == 1 && v37 > 250 && v37 <= 999) { Ligne[idx].field6 = 4; Ligne[idx].field8 = 8; } - if (v11 == -1 && (unsigned int)(v37 - 251) <= 748) { + if (v11 == -1 && v37 > 250 && v37 <= 999) { Ligne[idx].field6 = 6; Ligne[idx].field8 = 2; } - if (v11 == 1 && (unsigned int)(v37 + 999) <= 748) { + if (v11 == 1 && v37 < -250 && v37 > -1000) { Ligne[idx].field6 = 2; Ligne[idx].field8 = 6; } - // CHECKME: v37 conditions are impossible to meet! + // This copndition is impossible to meet! + // Code present in the Linux and BeOS executables if (v11 == -1 && v37 <= 249 && v37 > 1000) { Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; @@ -348,7 +350,6 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, } // Line Collision 2 -// TODO: Should return a bool bool LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { int16 *v7; int16 *v13; @@ -374,24 +375,29 @@ bool LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int int v16 = v7[1]; int v10 = v7[v8 - 2]; int v18 = v7[v8 - 1]; - if (v7[0] >= v10) - goto LABEL_32; - if (v22 < v9 || v21 > v10) - v23 = 0; - if (v9 >= v10) { -LABEL_32: + if (v7[0] >= v10) { if (v21 > v9 || v22 < v10) v23 = 0; + } else { + if (v22 < v9 || v21 > v10) + v23 = 0; + if (v9 >= v10) { + if (v21 > v9 || v22 < v10) + v23 = 0; + } } - if (v16 >= v18) - goto LABEL_33; - if (v20 < v16 || v19 > v18) - v23 = 0; if (v16 >= v18) { -LABEL_33: if (v19 > v16 || v20 < v18) v23 = 0; + } else { + if (v20 < v16 || v19 > v18) + v23 = 0; + if (v16 >= v18) { + if (v19 > v16 || v20 < v18) + v23 = 0; + } } + if (v23 == 1) { v11 = 0; v17 = Ligne[v24].field0; -- cgit v1.2.3 From 7c88b9c54e8e5f45132b6211f2ef5c0268f1f532 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Jan 2013 16:04:15 +0100 Subject: HOPKINS: Silence some GCC warning (thanks to eriktorbjorn) --- engines/hopkins/anim.cpp | 18 +++++------ engines/hopkins/font.cpp | 2 -- engines/hopkins/globals.cpp | 6 ++-- engines/hopkins/lines.cpp | 3 +- engines/hopkins/objects.cpp | 73 +++++++++++++++++++------------------------- engines/hopkins/saveload.cpp | 23 +++++++------- engines/hopkins/script.cpp | 1 - engines/hopkins/talk.cpp | 7 +---- 8 files changed, 59 insertions(+), 74 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 36466a2090..1a7f29c965 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -218,10 +218,10 @@ EXIT: void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { int v5; int v8; - byte *ptr; - int v11; - byte *v12; - byte *v13; + byte *ptr = NULL; + int oldScrollVal; + byte *v12 = NULL; + byte *v13 = NULL; int v15; size_t nbytes; byte buf[6]; @@ -264,7 +264,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint f.read(v12, nbytes); _vm->_graphicsManager.clearPalette(); - v11 = _vm->_graphicsManager.SCROLL; + oldScrollVal = _vm->_graphicsManager.SCROLL; _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.scrollScreen(0); _vm->_graphicsManager.lockScreen(); @@ -317,8 +317,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.scrollScreen(v11); + _vm->_graphicsManager.SCROLL = oldScrollVal; + _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; @@ -447,8 +447,8 @@ LABEL_114: _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.SCROLL = v11; - _vm->_graphicsManager.scrollScreen(v11); + _vm->_graphicsManager.SCROLL = oldScrollVal; + _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 069c9dc714..4d0aa14dfe 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -134,7 +134,6 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in Common::File f; int v73 = xp; - int v70 = yp; if (idx < 0) error("Bad number for text"); _vm->_globals.police_l = 11; @@ -367,7 +366,6 @@ LABEL_57: int v28 = _vm->_eventsManager._startPos.x + 315 - v27; v73 = _vm->_eventsManager._startPos.x + 315 - v27; _text[idx]._pos.y = 50; - v70 = 50; posY = 50; posX = v28; } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index becb8a2767..a8385f34a9 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -192,7 +192,8 @@ Globals::Globals() { // Initialise pointers ICONE = NULL; BUF_ZONE = NULL; - CACHE_BANQUE[6] = NULL; + for (int idx = 0; idx < 6; ++idx) + CACHE_BANQUE[idx] = NULL; texte_tmp = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; @@ -246,7 +247,8 @@ Globals::~Globals() { freeMemory(TETE); freeMemory(police); freeMemory(BUF_ZONE); - freeMemory(CACHE_BANQUE[6]); + for (int idx = 0; idx < 6; ++idx) + CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); freeMemory(texte_tmp); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 78096fcf38..c3a3d617cb 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -310,8 +310,9 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, Ligne[idx].field6 = 2; Ligne[idx].field8 = 6; } - // This copndition is impossible to meet! + // This condition is impossible to meet! // Code present in the Linux and BeOS executables + // CHECKME: maybe it should be checking negative values? if (v11 == -1 && v37 <= 249 && v37 > 1000) { Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8cc859be78..549f131f9b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -732,7 +732,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (deltaY >= 0) { deltaY = _vm->_graphicsManager.zoomIn(deltaY, v21); } else { - int deltaY = deltaX; + deltaY = deltaX; if (deltaX < 0) deltaY = -deltaX; deltaY = -_vm->_graphicsManager.zoomIn(deltaY, v21); @@ -2965,7 +2965,6 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v73; int v74; int v75; - int v76[10]; int v77[10]; int v82[10]; int v87[10]; @@ -3098,43 +3097,40 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v87[v24] = -1; v82[v24] = 0; v77[v24] = 1300; - v76[v24] = 1300; } if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _lastLine)) { v69 = v87[1]; v68 = v82[1]; - } else { - if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager._linesNumb)) { - v27 = 0; - for (;;) { - v28 = _vm->_globals.essai2[v27]; - v29 = _vm->_globals.essai2[v27 + 1]; - v66 = _vm->_globals.essai2[v27 + 2]; - v27 += 4; - if (_vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, _lastLine)) - break; - v32 = v67; - _vm->_globals.super_parcours[v32] = v28; - _vm->_globals.super_parcours[v32 + 1] = v29; - _vm->_globals.super_parcours[v32 + 2] = v66; - _vm->_globals.super_parcours[v32 + 3] = 0; - - v33 = _vm->_globals.essai0; - _vm->_globals.essai0[v32] = v28; - v33[v32 + 1] = v29; - v33[v32 + 2] = v66; - v33[v32 + 3] = 0; - v67 += 4; - if (v28 == -1) - goto LABEL_90; - } - v69 = v87[1]; - v68 = v82[1]; - } else { - v69 = 1; - v68 = 1; - v67 = 0; + } else if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager._linesNumb)) { + v27 = 0; + for (;;) { + v28 = _vm->_globals.essai2[v27]; + v29 = _vm->_globals.essai2[v27 + 1]; + v66 = _vm->_globals.essai2[v27 + 2]; + v27 += 4; + if (_vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, _lastLine)) + break; + v32 = v67; + _vm->_globals.super_parcours[v32] = v28; + _vm->_globals.super_parcours[v32 + 1] = v29; + _vm->_globals.super_parcours[v32 + 2] = v66; + _vm->_globals.super_parcours[v32 + 3] = 0; + + v33 = _vm->_globals.essai0; + _vm->_globals.essai0[v32] = v28; + v33[v32 + 1] = v29; + v33[v32 + 2] = v66; + v33[v32 + 3] = 0; + v67 += 4; + if (v28 == -1) + goto LABEL_90; } + v69 = v87[1]; + v68 = v82[1]; + } else { + v69 = 1; + v68 = 1; + v67 = 0; } LABEL_90: if (v69 < v73) { @@ -3760,7 +3756,7 @@ void ObjectsManager::OPTI_OBJET() { } if (data[0] != 'I' || data[1] != 'N' || data[2] != 'I') - error("File %s is not an INI file"); + error("File %s is not an INI file", file.c_str()); bool v7 = false; do { @@ -4233,8 +4229,6 @@ int ObjectsManager::BOBA(int idx) { } void ObjectsManager::INILINK(const Common::String &file) { - int v1; - int v2; int v8; int v9; int v10; @@ -4260,9 +4254,6 @@ void ObjectsManager::INILINK(const Common::String &file) { Common::String filename, filename2; Common::File f; - v1 = 0; - v2 = 0; - filename = file + ".LNK"; ptr = _vm->_fileManager.searchCat(filename, 3); nbytes = _vm->_globals._catalogSize; @@ -4976,7 +4967,7 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in } void ObjectsManager::lockAnimX(int idx, int a2) { - _vm->_globals._lockedAnims[idx]._enableFl; + _vm->_globals._lockedAnims[idx]._enableFl = true; _vm->_globals._lockedAnims[idx]._posX = a2; } diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index dafde79dc5..bed7a0d6b6 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -147,43 +147,42 @@ Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName _vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i]; /* Create the savegame */ - Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( - _vm->generateSaveName(slot)); - if (!saveFile) + Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot)); + if (!savefile) return Common::kCreatingFileFailed; // Set up the serializer - Common::Serializer serializer(NULL, saveFile); + Common::Serializer serializer(NULL, savefile); // Write out the savegame header hopkinsSavegameHeader header; header._saveName = saveName; header._version = HOPKINS_SAVEGAME_VERSION; - writeSavegameHeader(saveFile, header); + writeSavegameHeader(savefile, header); // Write out the savegame data syncSavegameData(serializer); // Save file complete - saveFile->finalize(); - delete saveFile; + savefile->finalize(); + delete savefile; return Common::kNoError; } Common::Error SaveLoadManager::loadGame(int slot) { // Try and open the save file for reading - Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading( _vm->generateSaveName(slot)); - if (!saveFile) + if (!savefile) return Common::kReadingFailed; // Set up the serializer - Common::Serializer serializer(saveFile, NULL); + Common::Serializer serializer(savefile, NULL); // Read in the savegame header hopkinsSavegameHeader header; - readSavegameHeader(saveFile, header); + readSavegameHeader(savefile, header); if (header._thumbnail) header._thumbnail->free(); delete header._thumbnail; @@ -192,7 +191,7 @@ Common::Error SaveLoadManager::loadGame(int slot) { syncSavegameData(serializer); // Loading save file complete - delete saveFile; + delete savefile; // Unpack the inventory for (int i = 0; i < 35; ++i) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1add672380..ced66cd628 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2375,7 +2375,6 @@ int ScriptManager::handleOpcode(byte *dataP) { case 607: if (!_vm->_globals._internetFl) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); - _vm->_graphicsManager._oldPalette[769]; _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } _vm->_globals.NBBLOC = 0; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 1a1778913e..c321b82334 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -358,7 +358,6 @@ int TalkManager::DIALOGUE_REP(int idx) { int v1; int v2; byte *v3; - int i; int v6; int v7; byte *v8; @@ -383,13 +382,12 @@ int TalkManager::DIALOGUE_REP(int idx) { v1 = 0; v2 = 0; v3 = _characterBuffer + 110; - for (i = idx; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) { + for (; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) { ++v1; if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < v1) v2 = 1; if (v2 == 1) return -1; -// HIWORD(i) = HIWORD(BUFFERPERSO); } if (v2 == 1) return -1; @@ -397,7 +395,6 @@ int TalkManager::DIALOGUE_REP(int idx) { v22 = (int16)READ_LE_UINT16((uint16 *)v3 + 1); v25 = (int16)READ_LE_UINT16((uint16 *)v3 + 2); v24 = (int16)READ_LE_UINT16((uint16 *)v3 + 3); - i = (int16)READ_LE_UINT16((uint16 *)v3 + 4); v23 = (int16)READ_LE_UINT16((uint16 *)v3 + 4); PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)v3 + 5); PLIGNE2 = (int16)READ_LE_UINT16((uint16 *)v3 + 6); @@ -453,7 +450,6 @@ int TalkManager::DIALOGUE_REP(int idx) { if (_vm->_eventsManager._mouseButton || _vm->_eventsManager._curMouseButton) v14 = v6; if (_vm->_eventsManager.getMouseButton()) { - i = 5; tmpVal = v6 / 5; if (tmpVal < 0) tmpVal = -tmpVal; @@ -1070,7 +1066,6 @@ void TalkManager::REPONSE2(int a1, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - int v5; byte *v11; Common::String s; Common::String v20; -- cgit v1.2.3 From 3eae64cf25546945d5000989077d5cf9a458c88d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Jan 2013 17:28:50 +0100 Subject: HOPKINS: Missing modification in previous commit --- engines/hopkins/talk.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index c321b82334..8b20fa7e09 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1096,7 +1096,6 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { getStringFromBuffer(40, v23, (const char *)_characterBuffer); getStringFromBuffer(0, v22, (const char *)_characterBuffer); getStringFromBuffer(20, v20, (const char *)_characterBuffer); - v5 = 5; if (v20 == "NULL") v20 = Common::String::format("IM%d", _vm->_globals._screenId); -- cgit v1.2.3 From a4b7b29157125ad6240888186dde70ac64ee6088 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 2 Jan 2013 20:12:32 +0100 Subject: HOPKINS: Silence some warnings reported by GCC. Thanks Eriktorbjorn for reporting those --- engines/hopkins/anim.cpp | 2 +- engines/hopkins/graphics.cpp | 10 ++-------- engines/hopkins/lines.cpp | 4 ++-- engines/hopkins/objects.cpp | 25 ++++++++++++------------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 1a7f29c965..38852f38dd 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -219,7 +219,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint int v5; int v8; byte *ptr = NULL; - int oldScrollVal; + int oldScrollVal = 0; byte *v12 = NULL; byte *v13 = NULL; int v15; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 27d86d21a3..0ea89b07bc 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -705,7 +705,7 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { void GraphicsManager::changePalette(const byte *palette) { const byte *srcP = &palette[0]; for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { - *(uint16 *)&SD_PIXELS[2 * idx] = mapRGB(*srcP, *(srcP + 1), *(srcP + 2)); + WRITE_LE_UINT16(&SD_PIXELS[2 * idx], mapRGB(*srcP, *(srcP + 1), *(srcP + 2))); } } @@ -791,7 +791,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) } Video_Cont3_wVbe: if (srcByte > 210) { - if (srcByte == -45) { + if (srcByte == 211) { destLen1 = srcP[1]; rleValue = srcP[2]; destSlice1P = destOffset + destSurface; @@ -1113,7 +1113,6 @@ void GraphicsManager::RESET_SEGMENT_VESA() { // Add VESA Segment void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { int tempX; - int blocCount; bool addFlag; tempX = x1; @@ -1127,9 +1126,7 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { if (y1 < min_y) y1 = min_y; - blocCount = _vm->_globals.NBBLOC; if (_vm->_globals.NBBLOC > 1) { - int16 blocIndex = 0; do { BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; @@ -1138,7 +1135,6 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { && y1 >= bloc._y1 && y2 <= bloc._y2) addFlag = false; ++blocIndex; - blocCount = blocIndex; } while (_vm->_globals.NBBLOC + 1 != blocIndex); } @@ -1910,12 +1906,10 @@ void GraphicsManager::SHOW_PALETTE() { } void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { - int result; int destOffset; const byte *srcPtr; byte byteVal; - result = 0; destOffset = 0; srcPtr = src; for (;;) { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c3a3d617cb..5b4a26c71d 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1437,8 +1437,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v115; int v116; int v117; - int v118; - int v119; + int v118 = 0; + int v119 = 0; int v120; int v121; int v122; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 549f131f9b..507c46d65f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2939,11 +2939,9 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int16 *v33; int v34; int v35; - int i; int16 *v37; int v39; int16 *v41; - int k; int16 *v45; int v47; int v48; @@ -2957,12 +2955,11 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v65; int v66; int v67; - int v68; - int v69; + int v68 = 0; + int v69 = 0; int j; - int l; - int v72; - int v73; + int v72 = 0; + int v73 = 0; int v74; int v75; int v77[10]; @@ -3123,10 +3120,12 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v33[v32 + 3] = 0; v67 += 4; if (v28 == -1) - goto LABEL_90; + break;; + } + if (v28 != -1) { + v69 = v87[1]; + v68 = v82[1]; } - v69 = v87[1]; - v68 = v82[1]; } else { v69 = 1; v68 = 1; @@ -3136,7 +3135,7 @@ LABEL_90: if (v69 < v73) { v34 = v68; v35 = v68; - for (i = _vm->_linesManager.Ligne[v69].field0; v35 < i - 2; i = _vm->_linesManager.Ligne[v69].field0) { + for (int i = _vm->_linesManager.Ligne[v69].field0; v35 < i - 2; i = _vm->_linesManager.Ligne[v69].field0) { v37 = _vm->_linesManager.Ligne[v69].lineData; v39 = v67; _vm->_globals.super_parcours[v39] = v37[2 * v35]; @@ -3176,7 +3175,7 @@ LABEL_88: v69 = v73; } if (v69 > v73) { - for (k = v68; k > 0; --k) { + for (int k = v68; k > 0; --k) { v45 = _vm->_linesManager.Ligne[v69].lineData; v47 = v67; _vm->_globals.super_parcours[v47] = v45[2 * k]; @@ -3185,7 +3184,7 @@ LABEL_88: _vm->_globals.super_parcours[v47 + 3] = 0; v67 += 4; } - for (l = v69 - 1; l > v73; --l) { + for (int l = v69 - 1; l > v73; --l) { v48 = l; if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[l].lineData[2 * _vm->_linesManager.Ligne[v48].field0 - 2], -- cgit v1.2.3 From 3ab4446a1ba6b60f149b10587cacaf4a8f33aedd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Jan 2013 01:33:26 +0100 Subject: HOPKINS: Fix remaining GCC warnings (on behalf of Eriktorbjorn) --- engines/hopkins/graphics.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0ea89b07bc..8650c06f5e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -442,14 +442,14 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, // TODO: See if PAL_PIXELS can be converted to a uint16 array void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { const byte *srcP; - const byte *destP; + byte *destP; int yNext; int xCtr; const byte *palette; int pixelWord; int yCtr; const byte *srcCopyP; - const byte *destCopyP; + byte *destCopyP; assert(_videoPtr); srcP = xs + _lineNbr2 * ys + surface; @@ -469,7 +469,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width Agr_x = 0; do { - pixelWord = *(uint16 *)(palette + 2 * *srcP); + pixelWord = *(const uint16 *)(palette + 2 * *srcP); *(uint16 *)destP = pixelWord; ++srcP; destP += 2; @@ -508,7 +508,7 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int xCount; int xCtr; const byte *palette; - uint16 *tempSrcP; + const uint16 *tempSrcP; uint16 srcByte; uint16 *tempDestP; int savedXCount; @@ -531,7 +531,7 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, palette = PAL_PIXELS; do { - tempSrcP = (uint16 *)(palette + 2 * *srcP); + tempSrcP = (const uint16 *)(palette + 2 * *srcP); srcByte = *tempSrcP; *destP = *tempSrcP; *(destP + 1) = srcByte; @@ -932,7 +932,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int destP += width; } else if (width & 2) { for (i = width >> 1; i; --i) { - *(uint16 *)destP = *(uint16 *)srcP; + *(uint16 *)destP = *(const uint16 *)srcP; srcP += 2; destP += 2; } @@ -1302,7 +1302,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in destP += width; } else if (width & 2) { for (i = width >> 1; i; --i) { - *(uint16 *)destP = *(uint16 *)srcP; + *(uint16 *)destP = *(const uint16 *)srcP; srcP += 2; destP += 2; } -- cgit v1.2.3 From 6ff4c4c79b9908ee7b7c1e4e5b86197c13987f16 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Jan 2013 16:29:35 +0100 Subject: HOPKINS: Commit by Eriktorbjorn : New way of playing music --- engines/hopkins/sound.cpp | 221 ++++++++++++++++++++++------------------------ engines/hopkins/sound.h | 26 +----- 2 files changed, 108 insertions(+), 139 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e1a917318d..65619bee69 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -66,6 +66,106 @@ Audio::RewindableAudioStream *makeAPCStream(Common::SeekableReadStream *stream, return new APC_ADPCMStream(stream, disposeAfterUse, rate, stereo ? 2 : 1); } +class TwaAudioStream : public AudioStream { +public: + TwaAudioStream(Common::String name, Common::SeekableReadStream *stream) { + _name = name; + _cueSheet.clear(); + _cueStream = NULL; + _cue = 0; + + for (;;) { + char buf[3]; + stream->read(buf, 3); + + if (buf[0] == 'x' || stream->eos()) + break; + + _cueSheet.push_back(atol(buf)); + } + + for (_cue = 0; _cue < _cueSheet.size(); _cue++) { + if (loadCue(_cue)) + break; + } + } + + ~TwaAudioStream() { + delete _cueStream; + _cueStream = NULL; + } + + virtual bool isStereo() const { + return _cueStream ? _cueStream->isStereo() : true; + } + + virtual int getRate() const { + return _cueStream ? _cueStream->getRate() : 22050; + } + + virtual bool endOfData() const { + return _cueStream == NULL; + } + + virtual int readBuffer(int16 *buffer, const int numSamples) { + if (!_cueStream) + return 0; + + int16 *buf = buffer; + int samplesLeft = numSamples; + + while (samplesLeft) { + if (_cueStream) { + int readSamples = _cueStream->readBuffer(buf, samplesLeft); + buf += readSamples; + samplesLeft -= readSamples; + } + + if (samplesLeft > 0) { + if (++_cue >= _cueSheet.size()) { + _cue = 0; + } + loadCue(_cue); + } + } + + return numSamples; + } + +protected: + bool loadCue(int nr) { + delete _cueStream; + _cueStream = NULL; + + Common::String filename = Common::String::format("%s_%02d", _name.c_str(), _cueSheet[nr]); + Common::File *file = new Common::File(); + + if (file->open(filename + ".APC")) { + _cueStream = Audio::makeAPCStream(file, DisposeAfterUse::NO); + return true; + } + + if (file->open(filename + ".WAV")) { + _cueStream = Audio::makeWAVStream(file, DisposeAfterUse::NO); + return true; + } + + warning("TwaAudioStream::loadCue: Missing cue %d (%s)", nr, filename.c_str()); + delete file; + return false; + } + +private: + Common::String _name; + Common::Array _cueSheet; + Audio::AudioStream *_cueStream; + uint _cue; +}; + +Audio::AudioStream *makeTwaStream(Common::String name, Common::SeekableReadStream *stream) { + return new TwaAudioStream(name, stream); +} + } /*------------------------------------------------------------------------*/ @@ -91,8 +191,6 @@ SoundManager::SoundManager() { Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); for (int i = 0; i < SWAV_COUNT; ++i) Common::fill((byte *)&Swav[i], (byte *)&Swav[i] + sizeof(SwavItem), 0); - for (int i = 0; i < MWAV_COUNT; ++i) - Common::fill((byte *)&Mwav[i], (byte *)&Mwav[i] + sizeof(MwavItem), 0); for (int i = 0; i < SOUND_COUNT; ++i) Common::fill((byte *)&SOUND[i], (byte *)&SOUND[i] + sizeof(SoundItem), 0); Common::fill((byte *)&Music, (byte *)&Music + sizeof(MusicItem), 0); @@ -101,7 +199,7 @@ SoundManager::SoundManager() { SoundManager::~SoundManager() { stopMusic(); delMusic(); - _vm->_mixer->stopHandle(_modHandle); + _vm->_mixer->stopHandle(_musicHandle); MOD_FLAG = false; } @@ -407,7 +505,7 @@ void SoundManager::loadMusic(const Common::String &file) { error("Error opening file %s", filename.c_str()); Audio::AudioStream *modStream = Audio::makeProtrackerStream(&f); - _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_modHandle, modStream); + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, modStream); } else { Common::String filename = Common::String::format("%s.TWA", file.c_str()); @@ -415,106 +513,29 @@ void SoundManager::loadMusic(const Common::String &file) { if (!f.open(filename)) error("Error opening file %s", filename.c_str()); - char s[8]; - int destIndex = 0; - int mwavIndex; - - bool breakFlag = false; - do { - f.read(&s[0], 3); - - if (s[0] == 'x') { - // End of list reached - Music._mwavIndexes[destIndex] = -1; - breakFlag = true; - } else { - // Convert two digits to a number - s[2] = '\0'; - mwavIndex = atol(&s[0]); - - filename = Common::String::format("%s_%s.%s", file.c_str(), &s[0], - (_vm->getPlatform() == Common::kPlatformWindows) ? "APC" : "WAV"); - LOAD_MSAMPLE(mwavIndex, filename); - - assert(destIndex < MUSIC_WAVE_COUNT); - Music._mwavIndexes[destIndex++] = mwavIndex; - } - } while (!breakFlag); + Audio::AudioStream *twaStream = Audio::makeTwaStream(file.c_str(), &f); + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, twaStream); f.close(); } Music._active = true; - Music._isPlaying = false; - Music._currentIndex = -1; } void SoundManager::playMusic() { - if (Music._active) - Music._isPlaying = true; } void SoundManager::stopMusic() { - if (Music._active) - Music._isPlaying = false; - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_mixer->stopHandle(_modHandle); - + _vm->_mixer->stopHandle(_musicHandle); } void SoundManager::delMusic() { - if (Music._active) { - for (int i = 0; i < 50; ++i) { - DEL_MSAMPLE(i); - } - } - Music._active = false; - Music._isPlaying = false; - Music._string = " "; - Music._currentIndex = -1; } void SoundManager::checkSounds() { - checkMusic(); checkVoices(); } -void SoundManager::checkMusic() { - // OS2 and BeOS versions use MOD files. - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - return; - - if (Music._active && Music._isPlaying) { - int mwavIndex = Music._mwavIndexes[Music._currentIndex]; - if (mwavIndex == -1) - return; - - if (Music._currentIndex >= 0 && Music._currentIndex < MWAV_COUNT) { - if (mwavIndex != -1 && !Mwav[mwavIndex]._audioStream->endOfStream()) - // Currently playing wav has not finished, so exit - return; - - _vm->_mixer->stopHandle(Mwav[mwavIndex]._soundHandle); - } - - // Time to move to the next index - if (++Music._currentIndex >= MWAV_COUNT) - return; - - mwavIndex = Music._mwavIndexes[Music._currentIndex]; - if (mwavIndex == -1) { - Music._currentIndex = 0; - mwavIndex = Music._mwavIndexes[Music._currentIndex]; - } - - int volume = _musicVolume * 255 / 16; - - Mwav[mwavIndex]._audioStream->rewind(); - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Mwav[mwavIndex]._soundHandle, - Mwav[mwavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); - } -} - void SoundManager::checkVoices() { // Check the status of each voice. bool hasActiveVoice = false; @@ -529,32 +550,6 @@ void SoundManager::checkVoices() { } } -void SoundManager::LOAD_MSAMPLE(int mwavIndex, const Common::String &file) { - if (!Mwav[mwavIndex]._active) { - Common::File f; - if (!f.open(file)) { - // Fallback from WAV to APC... - if (!f.open(setExtension(file, ".APC"))) - error("Could not open %s for reading", file.c_str()); - } - - Mwav[mwavIndex]._audioStream = makeSoundStream(f.readStream(f.size())); - Mwav[mwavIndex]._active = true; - - f.close(); - } -} - -void SoundManager::DEL_MSAMPLE(int mwavIndex) { - if (Mwav[mwavIndex]._active) { - Mwav[mwavIndex]._active = false; - _vm->_mixer->stopHandle(Mwav[mwavIndex]._soundHandle); - - delete Mwav[mwavIndex]._audioStream; - Mwav[mwavIndex]._audioStream = NULL; - } -} - bool SoundManager::mixVoice(int voiceId, int voiceMode) { int fileNumber; int oldMusicVol; @@ -928,10 +923,8 @@ void SoundManager::syncSoundSettings() { _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); } } - for (int idx = 0; idx < MWAV_COUNT; ++idx) { - if (Mwav[idx]._active) { - _vm->_mixer->setChannelVolume(Mwav[idx]._soundHandle, _musicVolume * 255 / 16); - } + if (_vm->_mixer->isSoundHandleActive(_musicHandle)) { + _vm->_mixer->setChannelVolume(_musicHandle, _musicVolume * 255 / 16); } } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index e19d51c690..15efc85c4d 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -47,23 +47,9 @@ public: bool freeSample; }; -class MwavItem { -public: - bool _active; - Audio::RewindableAudioStream *_audioStream; - Audio::SoundHandle _soundHandle; -}; - -#define MUSIC_WAVE_COUNT 50 - class MusicItem { public: bool _active; - bool _isPlaying; - Common::String _string; - int _mwavIndexes[MUSIC_WAVE_COUNT]; - byte unused_mb[100]; - int _currentIndex; }; class SoundItem { @@ -73,7 +59,6 @@ public: #define VOICE_COUNT 3 #define SWAV_COUNT 50 -#define MWAV_COUNT 50 #define SOUND_COUNT 10 class HopkinsEngine; @@ -93,14 +78,6 @@ private: void PLAY_NWAV(int wavIndex); void DEL_NWAV(int wavIndex); void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); - void LOAD_MSAMPLE(int mwavIndex, const Common::String &file); - void DEL_MSAMPLE(int mwavIndex); - - /** - * Checks the music structure to see if music playback is active, and whether - * it needs to move to the next WAV file - */ - void checkMusic(); /** * Checks voices to see if they're finished @@ -112,7 +89,7 @@ private: */ Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); public: - Audio::SoundHandle _modHandle; + Audio::SoundHandle _musicHandle; int SPECIAL_SOUND; int _soundVolume; int _voiceVolume; @@ -129,7 +106,6 @@ public: VoiceItem Voice[VOICE_COUNT]; SwavItem Swav[SWAV_COUNT]; - MwavItem Mwav[MWAV_COUNT]; SoundItem SOUND[SOUND_COUNT]; MusicItem Music; public: -- cgit v1.2.3 From 079994d35c2d366a255c66a8cddd55a6cb5b7150 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Jan 2013 16:30:53 +0100 Subject: HOPKINS: Rewrite fade in, add a delay --- engines/hopkins/graphics.cpp | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8650c06f5e..b6a6501c98 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -552,46 +552,28 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, } void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) { - uint16 palData1[PALETTE_BLOCK_SIZE * 2]; byte palData2[PALETTE_BLOCK_SIZE]; // Initialise temporary palettes - Common::fill(&palData1[0], &palData1[PALETTE_BLOCK_SIZE], 0); Common::fill(&palData2[0], &palData2[PALETTE_BLOCK_SIZE], 0); // Set current palette to black setpal_vga256(palData2); // Loop through fading in the palette - uint16 *pTemp1 = &palData1[1]; for (int fadeIndex = 0; fadeIndex < FADESPD; ++fadeIndex) { - uint16 *pTemp2 = &palData1[2]; - for (int palOffset = 0; palOffset < PALETTE_BLOCK_SIZE; palOffset += 3) { - if (palData2[palOffset] < palette[palOffset]) { - uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD; - palData1[palOffset] = v; - palData2[palOffset] = (v >> 8) & 0xff; - } - - if (palData2[palOffset + 1] < palette[palOffset + 1]) { - uint16 *pDest = &pTemp1[palOffset]; - uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; - *pDest = v; - palData2[palOffset + 1] = (v >> 8) & 0xff; - } - - if (palData2[palOffset + 2] < palette[palOffset + 2]) { - uint16 *pDest = &pTemp2[palOffset]; - uint16 v = (palette[palOffset] & 0xff) * 256 / FADESPD + *pDest; - *pDest = v; - palData2[palOffset + 2] = (v >> 8) & 0xff; - } + palData2[palOffset + 0] = fadeIndex * palette[palOffset + 0] / (FADESPD - 1); + palData2[palOffset + 1] = fadeIndex * palette[palOffset + 1] / (FADESPD - 1); + palData2[palOffset + 2] = fadeIndex * palette[palOffset + 2] / (FADESPD - 1); } setpal_vga256(palData2); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); + + // Added a delay in order to see the fading + _vm->_eventsManager.delay(20); } // Set the final palette -- cgit v1.2.3 From 6976be7438ef842e08c8b4587c7e323d4af21109 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Jan 2013 22:32:22 +0100 Subject: HOPKINS: Rename functions related to fade in/out. Fix a potential issue for short fadings --- engines/hopkins/anim.cpp | 18 ++--- engines/hopkins/computer.cpp | 4 +- engines/hopkins/graphics.cpp | 97 ++++++++++++++------------- engines/hopkins/graphics.h | 14 ++-- engines/hopkins/hopkins.cpp | 154 +++++++++++++++++++++---------------------- engines/hopkins/menu.cpp | 4 +- engines/hopkins/objects.cpp | 16 ++--- engines/hopkins/script.cpp | 32 ++++----- 8 files changed, 172 insertions(+), 167 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 38852f38dd..bce08a3773 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -197,12 +197,12 @@ EXIT: _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); } } while (breakFlag); - _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); + _vm->_graphicsManager.fadeOutDefaultLength(screenCopy); screenCopy = _vm->_globals.freeMemory(screenCopy); } if (hasScreenCopy) { if (_vm->_graphicsManager.FADE_LINUX == 2) - _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy); + _vm->_graphicsManager.fadeOutDefaultLength(screenCopy); screenCopy = _vm->_globals.freeMemory(screenCopy); } @@ -333,7 +333,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint } _vm->_graphicsManager.unlockScreen(); _vm->_eventsManager.VBL(); - _vm->_graphicsManager.FADE_INS(); + _vm->_graphicsManager.fadeInShort(); } LABEL_48: _vm->_eventsManager._rateCounter = 0; @@ -428,12 +428,12 @@ LABEL_114: _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptra); } } while (v6 != -1); - _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); + _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } if (v8 == 1) { if (_vm->_graphicsManager.FADE_LINUX == 2) - _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); + _vm->_graphicsManager.fadeOutDefaultLength(ptr); _vm->_globals.freeMemory(ptr); } _vm->_graphicsManager.FADE_LINUX = 0; @@ -462,7 +462,7 @@ LABEL_114: _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.FADE_INS(); + _vm->_graphicsManager.fadeInShort(); _vm->_graphicsManager.DD_VBL(); } @@ -791,7 +791,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } } else { if (NO_COUL) - _vm->_graphicsManager.FADE_INW_LINUX(v9); + _vm->_graphicsManager.fadeInDefaultLength(v9); _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); @@ -1042,12 +1042,12 @@ LABEL_54: _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); } } while (!v5); - _vm->_graphicsManager.FADE_OUTW_LINUX(ptra); + _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } if (v7 == 1) { if (_vm->_graphicsManager.FADE_LINUX == 2) - _vm->_graphicsManager.FADE_OUTW_LINUX(ptr); + _vm->_graphicsManager.fadeOutDefaultLength(ptr); _vm->_globals.freeMemory(ptr); } _vm->_graphicsManager.FADE_LINUX = 0; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index c243dc6261..b8ac7d209c 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -83,7 +83,7 @@ void ComputerManager::setTextMode() { _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; _vm->_graphicsManager.loadImage("WINTEXT"); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); loadMenu(); _vm->_eventsManager._mouseFl = false; } @@ -93,7 +93,7 @@ void ComputerManager::setTextMode() { */ void ComputerManager::clearScreen() { _vm->_graphicsManager.loadImage("WINTEXT"); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); } /** diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b6a6501c98..517c496944 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -49,7 +49,7 @@ GraphicsManager::GraphicsManager() { _lineNbr2 = 0; Agr_x = Agr_y = 0; Agr_Flag_x = Agr_Flag_y = 0; - FADESPD = 15; + _fadeDefaultSpeed = 15; FADE_LINUX = 0; _skipVideoLockFl = false; no_scroll = 0; @@ -553,21 +553,26 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) { byte palData2[PALETTE_BLOCK_SIZE]; - - // Initialise temporary palettes + int fadeStep; + if (step > 1) + fadeStep = step; + else + fadeStep = 2; + // Initialize temporary palette Common::fill(&palData2[0], &palData2[PALETTE_BLOCK_SIZE], 0); // Set current palette to black setpal_vga256(palData2); // Loop through fading in the palette - for (int fadeIndex = 0; fadeIndex < FADESPD; ++fadeIndex) { + for (int fadeIndex = 0; fadeIndex < fadeStep; ++fadeIndex) { for (int palOffset = 0; palOffset < PALETTE_BLOCK_SIZE; palOffset += 3) { - palData2[palOffset + 0] = fadeIndex * palette[palOffset + 0] / (FADESPD - 1); - palData2[palOffset + 1] = fadeIndex * palette[palOffset + 1] / (FADESPD - 1); - palData2[palOffset + 2] = fadeIndex * palette[palOffset + 2] / (FADESPD - 1); + palData2[palOffset + 0] = fadeIndex * palette[palOffset + 0] / (fadeStep - 1); + palData2[palOffset + 1] = fadeIndex * palette[palOffset + 1] / (fadeStep - 1); + palData2[palOffset + 2] = fadeIndex * palette[palOffset + 2] / (fadeStep - 1); } + // Set the transition palette and refresh the screen setpal_vga256(palData2); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); @@ -590,7 +595,7 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface byte palData[PALETTE_BLOCK_SIZE]; int tempPalette[PALETTE_BLOCK_SIZE]; - palMax = palByte = FADESPD; + palMax = palByte = _fadeDefaultSpeed; if (palette) { for (int palIndex = 0; palIndex < PALETTE_BLOCK_SIZE; palIndex++) { int palDataIndex = palIndex; @@ -634,26 +639,56 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface } } -void GraphicsManager::FADE_INS() { - FADESPD = 1; +void GraphicsManager::fadeInShort() { + _fadeDefaultSpeed = 1; fadeIn(_palette, 1, (const byte *)_vesaBuffer); } -void GraphicsManager::FADE_OUTS() { - FADESPD = 1; +void GraphicsManager::fadeOutShort() { + _fadeDefaultSpeed = 1; fadeOut(_palette, 1, (const byte *)_vesaBuffer); } -void GraphicsManager::FADE_INW() { - FADESPD = 15; +void GraphicsManager::fadeInLong() { + _fadeDefaultSpeed = 15; fadeIn(_palette, 20, (const byte *)_vesaBuffer); } -void GraphicsManager::FADE_OUTW() { - FADESPD = 15; +void GraphicsManager::fadeOutLong() { + _fadeDefaultSpeed = 15; fadeOut(_palette, 20, (const byte *)_vesaBuffer); } +void GraphicsManager::fadeOutDefaultLength(const byte *surface) { + assert(surface); + fadeOut(_palette, _fadeDefaultSpeed, surface); +} + +void GraphicsManager::fadeInDefaultLength(const byte *surface) { + assert(surface); + fadeIn(_palette, _fadeDefaultSpeed, surface); +} + +void GraphicsManager::fadeInBreakout() { + setpal_vga256(_palette); + lockScreen(); + CopyAsm16(_vesaBuffer); + unlockScreen(); + DD_VBL(); +} + +void GraphicsManager::fateOutBreakout() { + byte palette[PALETTE_EXT_BLOCK_SIZE]; + + memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); + setpal_vga256(palette); + + lockScreen(); + CopyAsm16(_vesaBuffer); + unlockScreen(); + DD_VBL(); +} + void GraphicsManager::setpal_vga256(const byte *palette) { changePalette(palette); } @@ -704,36 +739,6 @@ void GraphicsManager::DD_VBL() { g_system->updateScreen(); } -void GraphicsManager::FADE_OUTW_LINUX(const byte *surface) { - assert(surface); - fadeOut(_palette, FADESPD, surface); -} - -void GraphicsManager::FADE_INW_LINUX(const byte *surface) { - assert(surface); - fadeIn(_palette, FADESPD, surface); -} - -void GraphicsManager::fadeInBreakout() { - setpal_vga256(_palette); - lockScreen(); - CopyAsm16(_vesaBuffer); - unlockScreen(); - DD_VBL(); -} - -void GraphicsManager::fateOutBreakout() { - byte palette[PALETTE_EXT_BLOCK_SIZE]; - - memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); - setpal_vga256(palette); - - lockScreen(); - CopyAsm16(_vesaBuffer); - unlockScreen(); - DD_VBL(); -} - void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { int rleValue; int destOffset; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index ad05f1aa6b..4ab447b5ba 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -77,7 +77,7 @@ public: int _lineNbr2; int Agr_x, Agr_y; int Agr_Flag_x, Agr_Flag_y; - int FADESPD; + int _fadeDefaultSpeed; int FADE_LINUX; bool _skipVideoLockFl; int no_scroll; @@ -117,12 +117,12 @@ public: void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); void fadeIn(const byte *palette, int step, const byte *surface); void fadeOut(const byte *palette, int step, const byte *surface); - void FADE_INS(); - void FADE_OUTS(); - void FADE_INW(); - void FADE_OUTW(); - void FADE_OUTW_LINUX(const byte *surface); - void FADE_INW_LINUX(const byte *surface); + void fadeInShort(); + void fadeOutShort(); + void fadeInLong(); + void fadeOutLong(); + void fadeOutDefaultLength(const byte *surface); + void fadeInDefaultLength(const byte *surface); void fadeInBreakout(); void fateOutBreakout(); void setpal_vga256(const byte *palette); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 34bd068f18..35ba7541ee 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -146,7 +146,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.clearPalette(); _graphicsManager.loadImage("H2"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); if (!_eventsManager._escKeyFl) playIntro(); @@ -177,7 +177,7 @@ bool HopkinsEngine::runWin95Demo() { _globals._speed = 3; warning("TODO Fin_Interrupt_();"); warning("TODO Init_Interrupt_();"); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); @@ -224,9 +224,9 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.loadImage("fondan"); else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; _graphicsManager.lockScreen(); @@ -242,7 +242,7 @@ bool HopkinsEngine::runWin95Demo() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; @@ -336,12 +336,12 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.loadImage("ENDFR"); else _graphicsManager.loadImage("ENDUK"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.mouseOn(); do _eventsManager.VBL(); while (_eventsManager.getMouseButton() != 1); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); restoreSystem(); } bombExplosion(); @@ -434,9 +434,9 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _graphicsManager.loadImage("njour3a"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(5000); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._exitId = 300; _globals.iRegul = 0; break; @@ -470,9 +470,9 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.unlockScreen(); _graphicsManager.loadImage("LINUX"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(1500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); if (!_globals._internetFl) { _graphicsManager.FADE_LINUX = 2; @@ -480,9 +480,9 @@ bool HopkinsEngine::runLinuxDemo() { } _graphicsManager.loadImage("H2"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); if (!_eventsManager._escKeyFl) playIntro(); @@ -548,9 +548,9 @@ bool HopkinsEngine::runLinuxDemo() { _graphicsManager.loadImage("fondan"); else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; @@ -835,7 +835,7 @@ bool HopkinsEngine::runOS2Full() { warning("_graphicsManager.loadImage(\"VERSW\");"); warning("_graphicsManager.FADE_INW();"); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; // Added lock and unlock to avoid crash @@ -847,11 +847,11 @@ bool HopkinsEngine::runOS2Full() { // Add 16ms delay in order to match the Linux and Win95 versions _animationManager.playAnim("MP.ANM", 10, 16, 200); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); if (!_eventsManager._escKeyFl) playIntro(); _graphicsManager.loadImage("H2"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); @@ -884,9 +884,9 @@ bool HopkinsEngine::runOS2Full() { if (!_globals._saveData->data[170]) { _soundManager.WSOUND(3); _graphicsManager.loadImage("fond"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(5000); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; @@ -902,7 +902,7 @@ bool HopkinsEngine::runOS2Full() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._saveData->data[170] = 1; } _globals.Max_Propre = 5; @@ -1057,7 +1057,7 @@ bool HopkinsEngine::runOS2Full() { _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -1103,7 +1103,7 @@ bool HopkinsEngine::runOS2Full() { _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG2.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -1573,7 +1573,7 @@ bool HopkinsEngine::runOS2Full() { _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -1720,7 +1720,7 @@ bool HopkinsEngine::runBeOSFull() { _objectsManager.changeObject(14); _objectsManager.addObject(14); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; // Added lock and unlock to avoid crash @@ -1732,13 +1732,13 @@ bool HopkinsEngine::runBeOSFull() { // Add 16ms delay in order to match the Linux and Win95 versions _animationManager.playAnim("MP.ANM", 10, 16, 200); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); if (!_eventsManager._escKeyFl) playIntro(); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _graphicsManager.loadImage("H2"); - _graphicsManager.FADE_INW(); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeInLong(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); @@ -1775,9 +1775,9 @@ bool HopkinsEngine::runBeOSFull() { if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); _graphicsManager.loadImage("FOND"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(5000); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; @@ -1793,7 +1793,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; @@ -1947,7 +1947,7 @@ bool HopkinsEngine::runBeOSFull() { else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -1993,7 +1993,7 @@ bool HopkinsEngine::runBeOSFull() { _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG2.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -2464,7 +2464,7 @@ bool HopkinsEngine::runBeOSFull() { else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -2617,13 +2617,13 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.clearPalette(); _animationManager.playAnim("MP.ANM", 10, 16, 200); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); if (!_eventsManager._escKeyFl) playIntro(); _graphicsManager.loadImage("H2"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 0; _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); @@ -2666,9 +2666,9 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.loadImage("fondan"); else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _soundManager.SPECIAL_SOUND = 2; _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -2684,7 +2684,7 @@ bool HopkinsEngine::runWin95full() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; @@ -2836,7 +2836,7 @@ bool HopkinsEngine::runWin95full() { _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -2879,7 +2879,7 @@ bool HopkinsEngine::runWin95full() { _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG2.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -3345,7 +3345,7 @@ bool HopkinsEngine::runWin95full() { _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -3491,9 +3491,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.unlockScreen(); _graphicsManager.loadImage("H2"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._speed = 2; _globals.iRegul = 1; @@ -3544,9 +3544,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.loadImage("fondan"); else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 2; _graphicsManager.lockScreen(); @@ -4223,7 +4223,7 @@ bool HopkinsEngine::runLinuxFull() { _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); else if (_globals.SVGA == 1) _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - _graphicsManager.FADE_OUTS(); + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -4490,7 +4490,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); _globals.iRegul = 1; - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); if (_graphicsManager._largeScreenFl) { _graphicsManager.no_scroll = 2; bool v3 = false; @@ -4516,7 +4516,7 @@ void HopkinsEngine::playIntro() { } _soundManager.mixVoice(4, 3); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _graphicsManager.no_scroll = 0; _graphicsManager.loadImage("intro2"); _graphicsManager.scrollScreen(0); @@ -4535,7 +4535,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); _globals.iRegul = 1; - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); for (uint i = 0; i < 200 / _globals._speed; ++i) _eventsManager.VBL(); @@ -4642,7 +4642,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); } - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); _animationManager._clearAnimationFl = true; _soundManager.WSOUND(3); @@ -4693,13 +4693,13 @@ void HopkinsEngine::PASS() { else _graphicsManager.loadImage("nduk"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); if (_soundManager._voiceOffFl) _eventsManager.delay(500); else _soundManager.mixVoice(628, 4); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._exitId = 4; } @@ -4717,9 +4717,9 @@ void HopkinsEngine::displayEndDemo() { else _graphicsManager.loadImage("enduk"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.delay(1500); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals._exitId = 0; } @@ -4749,7 +4749,7 @@ void HopkinsEngine::bombExplosion() { _eventsManager.VBL(); } - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.mouseOff(); for (int idx = 0; idx < 20; ++idx) { @@ -4765,7 +4765,7 @@ void HopkinsEngine::bombExplosion() { _eventsManager.VBL(); } - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); _globals.iRegul = 0; _globals._exitId = 151; @@ -4784,7 +4784,7 @@ void HopkinsEngine::PUBQUIT() { _globals._disableInventFl = true; _graphicsManager.loadImage("BOX"); _soundManager.WSOUND(28); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(0); _eventsManager._mouseCursorId = 0; @@ -4802,7 +4802,7 @@ void HopkinsEngine::PUBQUIT() { // Original tried to open a web browser link here. Since ScummVM doesn't support // that, it's being skipped in favor of simply exiting - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); } void HopkinsEngine::handleConflagration() { @@ -4819,7 +4819,7 @@ void HopkinsEngine::handleConflagration() { for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _globals.iRegul = 1; for (int cpt = 0; cpt <= 249; cpt++) @@ -4832,7 +4832,7 @@ void HopkinsEngine::handleConflagration() { for (int cpt = 0; cpt <= 49; cpt++) _eventsManager.VBL(); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); _globals._saveData->data[svField312] = 1; _globals._disableInventFl = false; @@ -4928,14 +4928,14 @@ void HopkinsEngine::BASED() { for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _globals.CACHE_ON(); do _eventsManager.VBL(); while (_objectsManager.BOBPOSI(8) != 22); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); _globals.resetCache(); _globals._disableInventFl = false; @@ -4971,7 +4971,7 @@ void HopkinsEngine::playEnding() { for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _globals.iRegul = 1; do @@ -5028,7 +5028,7 @@ void HopkinsEngine::playEnding() { _graphicsManager.FIN_VISU(); _soundManager.DEL_SAMPLE(1); _graphicsManager.loadImage("PLAN3"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager._rateCounter = 0; if (!_eventsManager._escKeyFl) { @@ -5037,7 +5037,7 @@ void HopkinsEngine::playEnding() { while (_eventsManager._rateCounter < 2000 / _globals._speed && !_eventsManager._escKeyFl); } _eventsManager._escKeyFl = false; - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 0; _graphicsManager.FADE_LINUX = 2; @@ -5077,7 +5077,7 @@ void HopkinsEngine::playEnding() { _eventsManager.VBL(); while (_objectsManager.BOBPOSI(8) != 21); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); _soundManager.DEL_SAMPLE(1); _soundManager.WSOUND(16); @@ -5183,7 +5183,7 @@ int HopkinsEngine::handleBaseMap() { _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _eventsManager.changeMouseCursor(0); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); bool loopCond = false; int zone; do { @@ -5228,7 +5228,7 @@ int HopkinsEngine::handleBaseMap() { } while (!loopCond); _globals._disableInventFl = false; - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); int result; switch (zone) { @@ -5369,7 +5369,7 @@ void HopkinsEngine::displayCredits() { loadCredits(); _globals.Credit_y = 436; _graphicsManager.loadImage("GENERIC"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _soundManager.WSOUND(28); _eventsManager._mouseFl = false; _globals.iRegul = 3; @@ -5422,7 +5422,7 @@ void HopkinsEngine::displayCredits() { _globals.Credit_by = -1; _globals.Credit_by1 = -1; } while ((_eventsManager.getMouseButton() != 1) && (!g_system->getEventManager()->shouldQuit())); - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _eventsManager._mouseFl = true; } @@ -5692,7 +5692,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _eventsManager.VBL(); if (!_graphicsManager._noFadingFl) - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _graphicsManager._noFadingFl = false; _globals.iRegul = 1; @@ -5716,7 +5716,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._exitId = exit3; if (_globals._exitId == 4) _globals._exitId = exit4; - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); _objectsManager.removeSprite(0); _objectsManager.CLEAR_ECRAN(); _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); @@ -5744,7 +5744,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { _globals._exitId = 0; _graphicsManager.loadImage("ADULT"); - _graphicsManager.FADE_INW(); + _graphicsManager.fadeInLong(); _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(0); _eventsManager._mouseCursorId = 0; @@ -5764,7 +5764,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { } while (!shouldQuit() && (buttonIndex == 0 || _eventsManager.getMouseButton() != 1)); _globals._disableInventFl = false; - _graphicsManager.FADE_OUTW(); + _graphicsManager.fadeOutLong(); if (buttonIndex != 2) { // Quit game diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 9c9e66d5a2..c39518c7fd 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -82,7 +82,7 @@ int MenuManager::menu() { else if (_vm->_globals._language == LANG_SP) _vm->_graphicsManager.loadImage("MENUES"); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENU.SPR"); @@ -234,7 +234,7 @@ int MenuManager::menu() { _vm->_globals.freeMemory(spriteData); _vm->_globals._disableInventFl = false; - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); return result; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 507c46d65f..38e86be093 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2312,7 +2312,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager.VBL(); _vm->_globals.iRegul = 1; - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager._noFadingFl = false; @@ -2350,7 +2350,7 @@ void ObjectsManager::PLAN_BETA() { } while (!_vm->shouldQuit() && v1 != 1); if (!_vm->_graphicsManager._noFadingFl) - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_globals.iRegul = 0; _vm->_graphicsManager._noFadingFl = false; _vm->_globals.PLANX = getSpriteX(0); @@ -4432,7 +4432,7 @@ void ObjectsManager::SPECIAL_INI() { _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); SPRITE_ON(0); for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); @@ -4466,7 +4466,7 @@ void ObjectsManager::SPECIAL_INI() { _vm->_eventsManager._mouseSpriteId = 4; for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); _vm->_globals.iRegul = 1; _vm->_globals._disableInventFl = false; _vm->_graphicsManager._noFadingFl = true; @@ -5015,7 +5015,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_eventsManager.changeMouseCursor(4); for (int v6 = 0; v6 <= 4; v6++) _vm->_eventsManager.VBL(); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); if (_vm->_globals._screenId == 61) { _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); stopBobAnimation(3); @@ -5056,7 +5056,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->shouldQuit()) return; - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); if (_vm->_globals._screenId == 61) @@ -5155,7 +5155,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.iRegul = 1; if (!_vm->_graphicsManager._noFadingFl) - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); _vm->_graphicsManager._noFadingFl = false; _vm->_eventsManager.changeMouseCursor(4); @@ -5203,7 +5203,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_vm->_globals._helicopterFl) { if (!_vm->_graphicsManager._noFadingFl) - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_graphicsManager._noFadingFl = false; removeSprite(0); if (_twoCharactersFl) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index ced66cd628..2ab68d844d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -529,7 +529,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 13: _vm->_eventsManager._mouseButton = _vm->_eventsManager._curMouseButton; _vm->_globals._disableInventFl = true; - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); @@ -538,7 +538,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.CLEAR_ECRAN(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); } else { _vm->_soundManager.playSound("SOUND17.WAV"); _vm->_graphicsManager.FADE_LINUX = 2; @@ -557,14 +557,14 @@ int ScriptManager::handleOpcode(byte *dataP) { } _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager._vesaBuffer); + _vm->_graphicsManager.fadeInDefaultLength(_vm->_graphicsManager._vesaBuffer); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 100); - _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager._vesaBuffer); + _vm->_graphicsManager.fadeOutDefaultLength(_vm->_graphicsManager._vesaBuffer); _vm->_graphicsManager.FIN_VISU(); // If uncensored, rip the throat of the hostage @@ -587,9 +587,9 @@ int ScriptManager::handleOpcode(byte *dataP) { } _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_INW_LINUX(_vm->_graphicsManager._vesaBuffer); + _vm->_graphicsManager.fadeInDefaultLength(_vm->_graphicsManager._vesaBuffer); _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); - _vm->_graphicsManager.FADE_OUTW_LINUX(_vm->_graphicsManager._vesaBuffer); + _vm->_graphicsManager.fadeOutDefaultLength(_vm->_graphicsManager._vesaBuffer); _vm->_graphicsManager.FIN_VISU(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) @@ -601,7 +601,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.SPECIAL_SOUND = 0; if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_globals._disableInventFl = false; _vm->_globals._helicopterFl = true; @@ -864,7 +864,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 51: { - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); @@ -874,7 +874,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_animationManager.loadAnim("ANIM20f"); _vm->_graphicsManager.VISU_ALL(); _vm->_eventsManager.mouseOff(); - _vm->_graphicsManager.FADE_INW(); + _vm->_graphicsManager.fadeInLong(); bool v52 = false; _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); do { @@ -888,7 +888,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 34); _vm->_objectsManager.stopBobAnimation(2); - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_graphicsManager._noFadingFl = true; _vm->_globals._exitId = 20; break; @@ -1929,7 +1929,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager._noFadingFl = true; - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); for (int i = 1; i <= 39; i++) { if (_vm->shouldQuit()) @@ -2059,7 +2059,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals.NOPARLE = false; - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_objectsManager.stopBobAnimation(13); _vm->_graphicsManager._noFadingFl = true; _vm->_globals._exitId = 94; @@ -2269,7 +2269,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_animationManager.playSequence2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager._noFadingFl = true; - _vm->_graphicsManager.FADE_OUTW(); + _vm->_graphicsManager.fadeOutLong(); _vm->_objectsManager.PERSO_ON = false; _vm->_globals._exitId = 100; break; @@ -2277,7 +2277,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 600: if (!_vm->_globals._internetFl) { _vm->_graphicsManager.FADE_LINUX = 2; - _vm->_graphicsManager.FADESPD = 1; + _vm->_graphicsManager._fadeDefaultSpeed = 1; if (_vm->_globals.SVGA == 2) _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); else if (_vm->_globals.SVGA == 1) @@ -2289,7 +2289,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_graphicsManager.OPTI_INI("BOMBE", 2); - _vm->_graphicsManager.FADE_INS(); + _vm->_graphicsManager.fadeInShort(); break; case 601: @@ -2344,7 +2344,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); - _vm->_graphicsManager.FADE_OUTS(); + _vm->_graphicsManager.fadeOutShort(); _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; if (_vm->_globals.SVGA == 1) -- cgit v1.2.3 From 0958eaddc5da2beac94b5611f356a67f3d8a0620 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Jan 2013 23:01:00 +0100 Subject: HOPKINS: Rewrite fade out --- engines/hopkins/graphics.cpp | 73 ++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 517c496944..c6af572428 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -551,6 +551,9 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, } while (yCtr != 1); } +/** + * Fade in. the step number is determine by parameter. + */ void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) { byte palData2[PALETTE_BLOCK_SIZE]; int fadeStep; @@ -589,44 +592,36 @@ void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) DD_VBL(); } +/** + * Fade out. the step number is determine by parameter. + */ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface) { - int palByte; - uint16 palMax; byte palData[PALETTE_BLOCK_SIZE]; - int tempPalette[PALETTE_BLOCK_SIZE]; + int fadeStep; + if (step > 1) + fadeStep = step; + else + fadeStep = 2; - palMax = palByte = _fadeDefaultSpeed; if (palette) { - for (int palIndex = 0; palIndex < PALETTE_BLOCK_SIZE; palIndex++) { - int palDataIndex = palIndex; - palByte = palette[palIndex]; - palByte <<= 8; - tempPalette[palDataIndex] = palByte; - palData[palDataIndex] = palette[palIndex]; - } - - setpal_vga256(palData); - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - DD_VBL(); - - for (int palCtr3 = 0; palCtr3 < palMax; palCtr3++) { - for (int palCtr4 = 0; palCtr4 < PALETTE_BLOCK_SIZE; palCtr4++) { - int palCtr5 = palCtr4; - int palValue = tempPalette[palCtr4] - (palette[palCtr4] << 8) / palMax; - tempPalette[palCtr5] = palValue; - palData[palCtr5] = (palValue >> 8) & 0xff; + for (int f = 0; f < fadeStep; f++) { + for (int32 i = 0; i < 256; i++) { + palData[i * 3 + 0] = (fadeStep - f - 1) * palette[i * 3 + 0] / (fadeStep - 1); + palData[i * 3 + 1] = (fadeStep - f - 1) * palette[i * 3 + 1] / (fadeStep - 1); + palData[i * 3 + 2] = (fadeStep - f - 1) * palette[i * 3 + 2] / (fadeStep - 1); } setpal_vga256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); + + _vm->_eventsManager.delay(100); } for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) palData[i] = 0; setpal_vga256(palData); - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } else { @@ -639,36 +634,57 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface } } +/** + * Short fade in. The step number is 1, the default step number is also set to 1. + */ void GraphicsManager::fadeInShort() { _fadeDefaultSpeed = 1; fadeIn(_palette, 1, (const byte *)_vesaBuffer); } +/** + * Short fade out. The step number is 1, the default step number is also set to 1. + */ void GraphicsManager::fadeOutShort() { _fadeDefaultSpeed = 1; fadeOut(_palette, 1, (const byte *)_vesaBuffer); } +/** + * Long fade in. The step number is 20, the default step number is also set to 15. + */ void GraphicsManager::fadeInLong() { _fadeDefaultSpeed = 15; fadeIn(_palette, 20, (const byte *)_vesaBuffer); } +/** + * Long fade out. The step number is 20, the default step number is also set to 15. + */ void GraphicsManager::fadeOutLong() { _fadeDefaultSpeed = 15; fadeOut(_palette, 20, (const byte *)_vesaBuffer); } -void GraphicsManager::fadeOutDefaultLength(const byte *surface) { +/** + * Fade in. The step number used is the default step number. + */ +void GraphicsManager::fadeInDefaultLength(const byte *surface) { assert(surface); - fadeOut(_palette, _fadeDefaultSpeed, surface); + fadeIn(_palette, _fadeDefaultSpeed, surface); } -void GraphicsManager::fadeInDefaultLength(const byte *surface) { +/** + * Fade out. The step number used is the default step number. + */ +void GraphicsManager::fadeOutDefaultLength(const byte *surface) { assert(surface); - fadeIn(_palette, _fadeDefaultSpeed, surface); + fadeOut(_palette, _fadeDefaultSpeed, surface); } +/** + * Fade in used by for the breakout mini-game + */ void GraphicsManager::fadeInBreakout() { setpal_vga256(_palette); lockScreen(); @@ -677,6 +693,9 @@ void GraphicsManager::fadeInBreakout() { DD_VBL(); } +/** + * Fade out used by for the breakout mini-game + */ void GraphicsManager::fateOutBreakout() { byte palette[PALETTE_EXT_BLOCK_SIZE]; -- cgit v1.2.3 From 9a089929b261e600a753b83bd2393ad7ba23612a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 3 Jan 2013 23:20:54 +0100 Subject: HOPKINS: Simplify a bit more fade out function. Reduce fade out delay time. --- engines/hopkins/graphics.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c6af572428..03181cf8ca 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -604,34 +604,28 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface fadeStep = 2; if (palette) { - for (int f = 0; f < fadeStep; f++) { - for (int32 i = 0; i < 256; i++) { - palData[i * 3 + 0] = (fadeStep - f - 1) * palette[i * 3 + 0] / (fadeStep - 1); - palData[i * 3 + 1] = (fadeStep - f - 1) * palette[i * 3 + 1] / (fadeStep - 1); - palData[i * 3 + 2] = (fadeStep - f - 1) * palette[i * 3 + 2] / (fadeStep - 1); + for (int fadeIndex = 0; fadeIndex < fadeStep; fadeIndex++) { + for (int palOffset = 0; palOffset < PALETTE_BLOCK_SIZE; palOffset += 3) { + palData[palOffset + 0] = (fadeStep - fadeIndex - 1) * palette[palOffset + 0] / (fadeStep - 1); + palData[palOffset + 1] = (fadeStep - fadeIndex - 1) * palette[palOffset + 1] / (fadeStep - 1); + palData[palOffset + 2] = (fadeStep - fadeIndex - 1) * palette[palOffset + 2] / (fadeStep - 1); } setpal_vga256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); - _vm->_eventsManager.delay(100); + _vm->_eventsManager.delay(20); } + } - for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) - palData[i] = 0; - - setpal_vga256(palData); - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); - } else { - for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) - palData[i] = 0; + // No initial palette, or end of fading + for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) + palData[i] = 0; - setpal_vga256(palData); - m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); - } + setpal_vga256(palData); + m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + return DD_VBL(); } /** -- cgit v1.2.3 From 668cba5bea190f7475ee6ed982cd9f028ae74421 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Jan 2013 14:17:51 +0100 Subject: HOPKINS: Fix regressions in d6f72071a42559299139fd2f162c98c7f01a0b51 --- engines/hopkins/graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 03181cf8ca..d777517402 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -773,7 +773,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) return; if (srcByte < kSetOffset) { - destOffset += srcP[35]; + destOffset += (byte)(srcP[0] + 35); srcByte = srcP[1]; srcP++; } else if (srcByte == k8bVal) { @@ -799,7 +799,7 @@ Video_Cont3_wVbe: memset(destSlice1P, rleValue, destLen1); srcP += 3; } else { - destLen2 = srcP[45]; + destLen2 = (byte)(srcP[0] + 45); rleValue = srcP[1]; destSlice2P = destOffset + destSurface; destOffset += destLen2; -- cgit v1.2.3 From de2c2b7bdb9b1bd3800576241ab9f320ce03bc9f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Jan 2013 16:43:44 +0100 Subject: HOPKINS: Refactor Copy_WinScan_Vbe3 --- engines/hopkins/graphics.cpp | 53 ++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index d777517402..33b8bedaea 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -766,51 +766,42 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) destOffset = 0; srcP = srcData; for (;;) { - srcByte = *srcP; - if (*srcP < 222) - goto Video_Cont3_wVbe; + srcByte = srcP[0]; if (srcByte == kByteStop) return; - - if (srcByte < kSetOffset) { + if (srcByte == 211) { + destLen1 = srcP[1]; + rleValue = srcP[2]; + destSlice1P = destOffset + destSurface; + destOffset += destLen1; + memset(destSlice1P, rleValue, destLen1); + srcP += 3; + } else if (srcByte < 222) { + if (srcByte > 211) { + destLen2 = (byte)(srcP[0] + 45); + rleValue = srcP[1]; + destSlice2P = destOffset + destSurface; + destOffset += destLen2; + memset(destSlice2P, rleValue, destLen2); + srcP += 2; + } else { + destSurface[destOffset] = srcByte; + ++srcP; + ++destOffset; + } + } else if (srcByte < kSetOffset) { destOffset += (byte)(srcP[0] + 35); - srcByte = srcP[1]; srcP++; } else if (srcByte == k8bVal) { destOffset += srcP[1]; - srcByte = srcP[2]; srcP += 2; } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - srcByte = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - srcByte = srcP[5]; srcP += 5; } -Video_Cont3_wVbe: - if (srcByte > 210) { - if (srcByte == 211) { - destLen1 = srcP[1]; - rleValue = srcP[2]; - destSlice1P = destOffset + destSurface; - destOffset += destLen1; - memset(destSlice1P, rleValue, destLen1); - srcP += 3; - } else { - destLen2 = (byte)(srcP[0] + 45); - rleValue = srcP[1]; - destSlice2P = destOffset + destSurface; - destOffset += destLen2; - memset(destSlice2P, rleValue, destLen2); - srcP += 2; - } - } else { - destSurface[destOffset] = srcByte; - ++srcP; - ++destOffset; - } } } -- cgit v1.2.3 From b97154e6f49f69269432a1ff595ca791957df1e5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Jan 2013 21:45:52 +0100 Subject: HOPKINS: Add computer texts for the French and English versions for the Win95 versions. The Polish version is handled by an external file, just like most of the existing versions --- engines/hopkins/computer.cpp | 20 +++++++++++++++----- engines/hopkins/computer.h | 38 ++++++++++++++++++++++++++++++++++++++ engines/hopkins/files.h | 5 ++--- 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b8ac7d209c..f15f292372 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -290,9 +290,19 @@ void ComputerManager::showComputer(ComputerEnum mode) { * Load Menu data */ void ComputerManager::loadMenu() { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); - byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - byte *tmpPtr = ptr; + char *ptr; + if (!_vm->_fileManager.fileExists(_vm->_globals.HOPLINK, "COMPUTAN.TXT")) { + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); + ptr = (char *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); + } else if (_vm->_globals._language == LANG_FR) { + ptr = (char *)_vm->_globals.allocMemory(sizeof(_frenchText)); + strcpy(ptr, _frenchText); + } else { + ptr = (char *)_vm->_globals.allocMemory(sizeof(_englishText)); + strcpy(ptr, _englishText); + } + + char *tmpPtr = ptr; int lineNum = 0; int strPos; bool loopCond = false; @@ -306,7 +316,7 @@ void ComputerManager::loadMenu() { _menuText[lineNum]._actvFl = 1; strPos = 0; while (strPos <= 89) { - byte curChar = tmpPtr[strPos + 2]; + char curChar = tmpPtr[strPos + 2]; if (curChar == '%' || curChar == 10) break; _menuText[lineNum]._line[strPos++] = curChar; @@ -319,7 +329,7 @@ void ComputerManager::loadMenu() { } tmpPtr = tmpPtr + 1; } while (!loopCond); - ptr = _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory((byte *)ptr); } void ComputerManager::TXT4(int xp, int yp, int textIdx) { diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index d52cc28799..2d82b56f15 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -31,6 +31,44 @@ namespace Hopkins { class HopkinsEngine; +static char _englishText[] = + "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" + "% PASSWORD IS: ALLFREE\n% ENTER CURRENT PASSWORD\n" + "% ****** ACCES DENIED ******\n" + "% 1) *** GAME ***\n" + "% 0) QUIT COMPUTER\n" + "% 2) STRANGE CADAVER\n" + "% 3) STRANGE CADAVER\n" + "% 4) SENATOR FERGUSSON\n" + "% 5) DOG KILLER\n" + "% 2) SCIENTIST KIDNAPPED.\n" + "% 3) SCIENTIST KIDNAPPED (next).\n" + "% 4) SCIENTIST KIDNAPPED (next).\n" + "% 5) SCIENTIST KIDNAPPED (next).\n" + "% 6) SCIENTIST KIDNAPPED (next).\n" + "%% fin\n"; +static char _frenchText[] = + "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" + "% PASSWORD IS: ALLFREE\n" + "% ENTER CURRENT PASSWORD\n" + "% ****** ACCES DENIED ******\n" + "% 1) *** CASSE BRIQUE ***\n" + "% 0) QUITTER L'ORDINATEUR\n" + "% 2) CADAVRE SANS TETE\n" + "% 3) CADAVRE SANS TETE\n" + "% 4) AGRESSION DU SENATEUR\n" + "% 5) LES CHIENS TUEURS\n" + "% 2) DISPARITIONS DE CHERCHEURS.\n" + "% 3) DISPARITIONS (suite).\n" + "% 4) DISPARITIONS (suite).\n" + "% 5) DISPARITIONS (suite).\n" + "% 6) DISPARITIONS (suite).\n" + "%% fin\n"; + struct MenuItem { bool _actvFl; int _lineSize; diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 3328a66ace..427d61e183 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -33,14 +33,13 @@ namespace Hopkins { class HopkinsEngine; class FileManager { -private: - bool fileExists(const Common::String &folder, const Common::String &file); public: HopkinsEngine *_vm; -public: + FileManager(); void setParent(HopkinsEngine *vm); + bool fileExists(const Common::String &folder, const Common::String &file); byte *loadFile(const Common::String &file); int readStream(Common::ReadStream &stream, void *buf, size_t nbytes); void initCensorship(); -- cgit v1.2.3 From e43ddb09e98205fe74f78dce71d96acf96550c74 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Jan 2013 21:59:51 +0100 Subject: HOPKINS: Fix crash in exotic versions when leaving the computer --- engines/hopkins/hopkins.cpp | 68 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 35ba7541ee..7686c7a733 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -391,7 +391,14 @@ bool HopkinsEngine::runWin95Demo() { _globals._screenId = 113; _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager._vesaBuffer, 0, 307200); + memset(_graphicsManager._vesaScreen, 0, 307200); + _graphicsManager.clearPalette(); + _graphicsManager.RESET_SEGMENT_VESA(); break; case 114: @@ -401,7 +408,9 @@ bool HopkinsEngine::runWin95Demo() { _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 115: @@ -411,7 +420,9 @@ bool HopkinsEngine::runWin95Demo() { _globals._screenId = 115; _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 150: @@ -1617,7 +1628,14 @@ bool HopkinsEngine::runOS2Full() { _globals._screenId = 113; _globals._saveData->data[5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager._vesaBuffer, 0, 307200); + memset(_graphicsManager._vesaScreen, 0, 307200); + _graphicsManager.clearPalette(); + _graphicsManager.RESET_SEGMENT_VESA(); break; case 114: @@ -1627,7 +1645,9 @@ bool HopkinsEngine::runOS2Full() { _globals._screenId = 114; _globals._saveData->data[5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 115: @@ -1637,7 +1657,9 @@ bool HopkinsEngine::runOS2Full() { _globals._screenId = 115; _globals._saveData->data[5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 150: @@ -2508,7 +2530,14 @@ bool HopkinsEngine::runBeOSFull() { _globals._screenId = 113; _globals._saveData->data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager._vesaBuffer, 0, 307200); + memset(_graphicsManager._vesaScreen, 0, 307200); + _graphicsManager.clearPalette(); + _graphicsManager.RESET_SEGMENT_VESA(); break; case 114: @@ -2518,7 +2547,9 @@ bool HopkinsEngine::runBeOSFull() { _globals._screenId = 114; _globals._saveData->data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 115: @@ -2528,7 +2559,9 @@ bool HopkinsEngine::runBeOSFull() { _globals._screenId = 115; _globals._saveData->data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 150: @@ -3389,7 +3422,14 @@ bool HopkinsEngine::runWin95full() { _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.DD_VBL(); + memset(_graphicsManager._vesaBuffer, 0, 307200); + memset(_graphicsManager._vesaScreen, 0, 307200); + _graphicsManager.clearPalette(); + _graphicsManager.RESET_SEGMENT_VESA(); break; case 114: @@ -3399,7 +3439,9 @@ bool HopkinsEngine::runWin95full() { _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 115: @@ -3409,7 +3451,9 @@ bool HopkinsEngine::runWin95full() { _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.setModeVesa(); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); break; case 150: -- cgit v1.2.3 From ccef9fb3ea700663c19870cfe53660fd05320085 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Jan 2013 22:41:11 +0100 Subject: HOPKINS: Remove setModeVesa() --- engines/hopkins/graphics.cpp | 4 ---- engines/hopkins/graphics.h | 1 - engines/hopkins/hopkins.cpp | 1 - 3 files changed, 6 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 33b8bedaea..f955b91514 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -2018,8 +2018,4 @@ void GraphicsManager::drawVerticalLine(byte *surface, int xp, int yp, int height } } -void GraphicsManager::setModeVesa() { - setGraphicalMode(640, 480); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 4ab447b5ba..3a8d35bd63 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -173,7 +173,6 @@ public: void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col); void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); - void setModeVesa(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 7686c7a733..8f50044b96 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -3511,7 +3511,6 @@ bool HopkinsEngine::runWin95full() { _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; - _graphicsManager.setModeVesa(); if (_globals._exitId == -1) error("FIN BASE SOUS MARINE"); break; -- cgit v1.2.3 From e3494642498ec5067d7beef7cc7610873404ddb3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 4 Jan 2013 23:53:54 +0100 Subject: HOPKINS: Fix regression introduced in fbd2c0e9182cf6a3ff90cf83b47347dfdd4de564 --- engines/hopkins/graphics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f955b91514..734e16ccaa 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -392,8 +392,9 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * surface[i++] = v12; --v10; } while (v10); + --i; } else { - surface[i++] = v9; + surface[i] = v9; } } -- cgit v1.2.3 From 0a25776dcac993f09ce2eaeb6c14b480b429d85b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 01:14:27 +0100 Subject: HOPKINS: Get rid of NO_OFFSET which isn't initialized properly in the original game... --- engines/hopkins/globals.h | 1 - engines/hopkins/objects.cpp | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5dc5ef66d1..4aac3247ee 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -434,7 +434,6 @@ public: int couleur_40; int STOP_BUG; - bool NO_OFFSET; int MAX_COMPTE; int force_to_data_0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 38e86be093..ec2dd6a546 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3927,10 +3927,7 @@ void ObjectsManager::BOB_VIVANT(int idx) { int yp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 2); int spriteIndex = _vm->_talkManager._characterAnim[startPos + 8]; - if (!_vm->_globals.NO_OFFSET) - _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, _vm->_graphicsManager._scrollOffset + xp, yp, spriteIndex); - else - _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, xp, yp, spriteIndex); + _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, xp, yp, spriteIndex); } void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { -- cgit v1.2.3 From 3ee199ad7a4cbd4b70064f3546c26e4cc0f4a8db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 02:19:55 +0100 Subject: HOPKINS: Fix display in breakout game. Get rid of any int16 cast to make sure it's endian safe. --- engines/hopkins/graphics.cpp | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 734e16ccaa..8521e3bf53 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1240,40 +1240,25 @@ void GraphicsManager::CopyAsm(const byte *surface) { void GraphicsManager::CopyAsm16(const byte *surface) { const byte *v1; byte *v2; - int v3; - byte *v5; - uint16 *v6; + byte *v6; int v; - uint16 *v8; - int v9; byte *v10; - const byte *v11; assert(_videoPtr); v1 = surface; v2 = 30 * WinScan + (byte *)_videoPtr->pixels; - v3 = 200; - do { - v11 = v1; + for (int y = 200; y; y--) { v10 = v2; - v9 = v3; - v5 = PAL_PIXELS; - for (int v4 = 320; v4; v4--) { + for (int x = 320; x; x--) { v = 2 * *v1; - v6 = (uint16 *)(v5 + 2 * *v1); - v = *v6; - *v2 = *v6; - v2[1] = v; - v8 = (uint16 *)(WinScan + v2); - *v8 = v; - v8[1] = v; + v6 = PAL_PIXELS + v; + v2[0] = v2[2] = v2[WinScan] = v2[WinScan + 2] = v6[0]; + v2[1] = v2[3] = v2[WinScan + 1] = v2[WinScan + 3] = v6[1]; ++v1; - v2 = (byte *)v8 - WinScan + 4; + v2 += 4; } - v1 = v11 + 320; v2 = WinScan * 2 + v10; - v3 = v9 - 1; - } while (v9 != 1); + } } void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { -- cgit v1.2.3 From 907d705c1e725e5df0a7a4b378d0c237f1df2961 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 12:12:40 +0100 Subject: HOPKINS: (on Behalf of Eriktorbjorn) dispose music after use in order to avoid a memory leak --- engines/hopkins/sound.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 65619bee69..1925bac1b3 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -141,12 +141,12 @@ protected: Common::File *file = new Common::File(); if (file->open(filename + ".APC")) { - _cueStream = Audio::makeAPCStream(file, DisposeAfterUse::NO); + _cueStream = Audio::makeAPCStream(file, DisposeAfterUse::YES); return true; } if (file->open(filename + ".WAV")) { - _cueStream = Audio::makeWAVStream(file, DisposeAfterUse::NO); + _cueStream = Audio::makeWAVStream(file, DisposeAfterUse::YES); return true; } -- cgit v1.2.3 From c9f342f4ce3fd3f1e400d1a9ea35b2e1868119e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 13:10:58 +0100 Subject: HOPKINS: Remove 8b CopyAsm, rename the 16b one --- engines/hopkins/graphics.cpp | 46 +++++++------------------------------------- engines/hopkins/graphics.h | 2 +- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8521e3bf53..5e45098998 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -170,7 +170,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { max_x = 320; lockScreen(); - CopyAsm16(_vesaBuffer); + copy16bToSurfaceScaleX2(_vesaBuffer); unlockScreen(); fadeInBreakout(); @@ -683,7 +683,7 @@ void GraphicsManager::fadeOutDefaultLength(const byte *surface) { void GraphicsManager::fadeInBreakout() { setpal_vga256(_palette); lockScreen(); - CopyAsm16(_vesaBuffer); + copy16bToSurfaceScaleX2(_vesaBuffer); unlockScreen(); DD_VBL(); } @@ -698,7 +698,7 @@ void GraphicsManager::fateOutBreakout() { setpal_vga256(palette); lockScreen(); - CopyAsm16(_vesaBuffer); + copy16bToSurfaceScaleX2(_vesaBuffer); unlockScreen(); DD_VBL(); } @@ -1202,42 +1202,10 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i addVesaSegment(xp, yp, xp + width, yp + height); } -void GraphicsManager::CopyAsm(const byte *surface) { - const byte *srcP; - byte srcByte; - byte *destP; - byte *dest1P; - byte *dest2P; - byte *dest3P; - byte *destPitch; - const byte *srcPitch; - - assert(_videoPtr); - srcP = surface; - srcByte = 30 * WinScan; - destP = (byte *)_videoPtr->pixels + 30 * WinScan; - for (int yCtr = 200; yCtr != 0; yCtr--) { - srcPitch = srcP; - destPitch = destP; - for (int xCtr = 320; xCtr != 0; xCtr--) { - srcByte = *srcP; - *destP = *srcP; - dest1P = WinScan + destP; - *dest1P = srcByte; - dest2P = dest1P - WinScan + 1; - *dest2P = srcByte; - dest3P = WinScan + dest2P; - *dest3P = srcByte; - destP = dest3P - WinScan + 1; - ++srcP; - } - - srcP = srcPitch + 320; - destP = WinScan + WinScan + destPitch; - } -} - -void GraphicsManager::CopyAsm16(const byte *surface) { +/** + * Copy to surface to video buffer, scale 2x. + */ +void GraphicsManager::copy16bToSurfaceScaleX2(const byte *surface) { const byte *v1; byte *v2; byte *v6; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 3a8d35bd63..513e9eea05 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -154,7 +154,7 @@ public: void displayVesaSegment(); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); - void CopyAsm16(const byte *surface); + void copy16bToSurfaceScaleX2(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); -- cgit v1.2.3 From 45020d301289168d9269c4969dd1489e5e51ef54 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 16:02:25 +0100 Subject: HOPKINS: Refactor copy16bFromSurfaceScaleX2 --- engines/hopkins/graphics.cpp | 37 +++++++++++++++++-------------------- engines/hopkins/graphics.h | 2 +- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 5e45098998..3820dbb5c1 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -170,7 +170,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { max_x = 320; lockScreen(); - copy16bToSurfaceScaleX2(_vesaBuffer); + copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); fadeInBreakout(); @@ -683,7 +683,7 @@ void GraphicsManager::fadeOutDefaultLength(const byte *surface) { void GraphicsManager::fadeInBreakout() { setpal_vga256(_palette); lockScreen(); - copy16bToSurfaceScaleX2(_vesaBuffer); + copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); DD_VBL(); } @@ -698,7 +698,7 @@ void GraphicsManager::fateOutBreakout() { setpal_vga256(palette); lockScreen(); - copy16bToSurfaceScaleX2(_vesaBuffer); + copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); DD_VBL(); } @@ -1203,29 +1203,26 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i } /** - * Copy to surface to video buffer, scale 2x. + * Copy from surface to video buffer, scale 2x. */ -void GraphicsManager::copy16bToSurfaceScaleX2(const byte *surface) { - const byte *v1; - byte *v2; - byte *v6; - int v; - byte *v10; +void GraphicsManager::copy16bFromSurfaceScaleX2(const byte *surface) { + byte *palPtr; + int curPixel; assert(_videoPtr); - v1 = surface; - v2 = 30 * WinScan + (byte *)_videoPtr->pixels; + const byte *curSurface = surface; + byte *destPtr = 30 * WinScan + (byte *)_videoPtr->pixels; for (int y = 200; y; y--) { - v10 = v2; + byte *oldDestPtr = destPtr; for (int x = 320; x; x--) { - v = 2 * *v1; - v6 = PAL_PIXELS + v; - v2[0] = v2[2] = v2[WinScan] = v2[WinScan + 2] = v6[0]; - v2[1] = v2[3] = v2[WinScan + 1] = v2[WinScan + 3] = v6[1]; - ++v1; - v2 += 4; + curPixel = 2 * *curSurface; + palPtr = PAL_PIXELS + curPixel; + destPtr[0] = destPtr[2] = destPtr[WinScan] = destPtr[WinScan + 2] = palPtr[0]; + destPtr[1] = destPtr[3] = destPtr[WinScan + 1] = destPtr[WinScan + 3] = palPtr[1]; + ++curSurface; + destPtr += 4; } - v2 = WinScan * 2 + v10; + destPtr = WinScan * 2 + oldDestPtr; } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 513e9eea05..c0faa466f8 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -154,7 +154,7 @@ public: void displayVesaSegment(); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); - void copy16bToSurfaceScaleX2(const byte *surface); + void copy16bFromSurfaceScaleX2(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); -- cgit v1.2.3 From eaecc37d081751bbfa4f48d432fd53ee2d11366b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 17:42:21 +0100 Subject: HOPKINS: Silence GCC warnings related to the computer manu --- engines/hopkins/computer.cpp | 39 +++++++++++++++++++++++++++++++++++++++ engines/hopkins/computer.h | 38 -------------------------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index f15f292372..fb9ca799cd 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -286,6 +286,45 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } +static char _englishText[] = +"% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" +"% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" +"% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" +"% PASSWORD IS: ALLFREE\n% ENTER CURRENT PASSWORD\n" +"% ****** ACCES DENIED ******\n" +"% 1) *** GAME ***\n" +"% 0) QUIT COMPUTER\n" +"% 2) STRANGE CADAVER\n" +"% 3) STRANGE CADAVER\n" +"% 4) SENATOR FERGUSSON\n" +"% 5) DOG KILLER\n" +"% 2) SCIENTIST KIDNAPPED.\n" +"% 3) SCIENTIST KIDNAPPED (next).\n" +"% 4) SCIENTIST KIDNAPPED (next).\n" +"% 5) SCIENTIST KIDNAPPED (next).\n" +"% 6) SCIENTIST KIDNAPPED (next).\n" +"%% fin\n"; + +static char _frenchText[] = +"% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" +"% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" +"% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" +"% PASSWORD IS: ALLFREE\n" +"% ENTER CURRENT PASSWORD\n" +"% ****** ACCES DENIED ******\n" +"% 1) *** CASSE BRIQUE ***\n" +"% 0) QUITTER L'ORDINATEUR\n" +"% 2) CADAVRE SANS TETE\n" +"% 3) CADAVRE SANS TETE\n" +"% 4) AGRESSION DU SENATEUR\n" +"% 5) LES CHIENS TUEURS\n" +"% 2) DISPARITIONS DE CHERCHEURS.\n" +"% 3) DISPARITIONS (suite).\n" +"% 4) DISPARITIONS (suite).\n" +"% 5) DISPARITIONS (suite).\n" +"% 6) DISPARITIONS (suite).\n" +"%% fin\n"; + /** * Load Menu data */ diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 2d82b56f15..d52cc28799 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -31,44 +31,6 @@ namespace Hopkins { class HopkinsEngine; -static char _englishText[] = - "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" - "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" - "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" - "% PASSWORD IS: ALLFREE\n% ENTER CURRENT PASSWORD\n" - "% ****** ACCES DENIED ******\n" - "% 1) *** GAME ***\n" - "% 0) QUIT COMPUTER\n" - "% 2) STRANGE CADAVER\n" - "% 3) STRANGE CADAVER\n" - "% 4) SENATOR FERGUSSON\n" - "% 5) DOG KILLER\n" - "% 2) SCIENTIST KIDNAPPED.\n" - "% 3) SCIENTIST KIDNAPPED (next).\n" - "% 4) SCIENTIST KIDNAPPED (next).\n" - "% 5) SCIENTIST KIDNAPPED (next).\n" - "% 6) SCIENTIST KIDNAPPED (next).\n" - "%% fin\n"; -static char _frenchText[] = - "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" - "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" - "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" - "% PASSWORD IS: ALLFREE\n" - "% ENTER CURRENT PASSWORD\n" - "% ****** ACCES DENIED ******\n" - "% 1) *** CASSE BRIQUE ***\n" - "% 0) QUITTER L'ORDINATEUR\n" - "% 2) CADAVRE SANS TETE\n" - "% 3) CADAVRE SANS TETE\n" - "% 4) AGRESSION DU SENATEUR\n" - "% 5) LES CHIENS TUEURS\n" - "% 2) DISPARITIONS DE CHERCHEURS.\n" - "% 3) DISPARITIONS (suite).\n" - "% 4) DISPARITIONS (suite).\n" - "% 5) DISPARITIONS (suite).\n" - "% 6) DISPARITIONS (suite).\n" - "%% fin\n"; - struct MenuItem { bool _actvFl; int _lineSize; -- cgit v1.2.3 From 792b00b7905464ad02ad3053b9ea25b8c2c54e2c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 18:36:24 +0100 Subject: HOPKINS: Some refactoring in ComputerManager. --- engines/hopkins/computer.cpp | 95 ++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 60 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index fb9ca799cd..0efa1a0c26 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -128,7 +128,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { outText(Common::String(_menuText[0]._line)); else if (mode == COMPUTER_SAMANTHAS) outText(Common::String(_menuText[1]._line)); - else if (mode == COMPUTER_PUBLIC) + else // COMPUTER_PUBLIC outText(Common::String(_menuText[2]._line)); setTextColor(1); @@ -142,16 +142,12 @@ void ComputerManager::showComputer(ComputerEnum mode) { TXT4(280, 224, 8); bool passwordMatch = false; - if (mode == COMPUTER_HOPKINS) { - if (!strcmp(_inputBuf, "HOPKINS")) - passwordMatch = true; - } else if (mode == COMPUTER_SAMANTHAS) { - if (!strcmp(_inputBuf, "328MHZA")) - passwordMatch = true; - } else if (mode == COMPUTER_PUBLIC) { - if (!strcmp(_inputBuf, "ALLFREE")) - passwordMatch = true; - } + if ((mode == COMPUTER_HOPKINS) && !strcmp(_inputBuf, "HOPKINS")) + passwordMatch = true; + else if ((mode == COMPUTER_SAMANTHAS) && !strcmp(_inputBuf, "328MHZA")) + passwordMatch = true; + else if ((mode == COMPUTER_PUBLIC) && !strcmp(_inputBuf, "ALLFREE")) + passwordMatch = true; if (passwordMatch) { while (!_vm->shouldQuit()) { @@ -278,9 +274,10 @@ void ComputerManager::showComputer(ComputerEnum mode) { restoreFBIRoom(); _vm->_eventsManager.mouseOff(); } - if (mode == 1) + + if (mode == COMPUTER_HOPKINS) _vm->_globals._exitId = 13; - if ((uint16)(mode - 2) <= 1u) + else // Free access or Samantha _vm->_globals._exitId = 14; _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -530,19 +527,6 @@ void ComputerManager::restoreFBIRoom() { * Display texts for the given menu entry */ void ComputerManager::readText(int idx) { - uint16 v1; - bool foundFl; - int v4; - int v5; - int v6; - int v7; - int v8; - uint16 v10; - byte *ptr; - Common::String v12; - Common::String numStr; - int num; - _vm->_eventsManager._escKeyFl = false; if (_vm->_globals._language == LANG_EN) @@ -552,47 +536,38 @@ void ComputerManager::readText(int idx) { else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKES.TXT"); - ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - v1 = _vm->_fileManager.fileSize(_vm->_globals._curFilename); - foundFl = false; - int v3; - for (v3 = 0; v3 < v1; v3++) { - if (ptr[v3] == '%') { - numStr = Common::String::format("%c%c", ptr[v3 + 1], ptr[v3 + 2]); - num = atol(numStr.c_str()); - - if (num == idx) - foundFl = true; + byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + uint16 fileSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); + int pos; + for (pos = 0; pos < fileSize; pos++) { + if (ptr[pos] == '%') { + Common::String numStr = Common::String::format("%c%c", ptr[pos + 1], ptr[pos + 2]); + if (idx == atol(numStr.c_str())) + break; } - if (foundFl) - break; } - v4 = v3; - if (v3 > v1 - 1) + if (pos > fileSize - 3) error("Error with Hopkins computer file"); - v10 = v3 + 3; - v5 = 1; - v6 = 5; - v7 = 0; + pos += 3; + int lineNum = 5; + Common::String curStr = ""; + byte curChar; do { - v4 = ptr[v10]; - if (v4 == 13) { - v8 = v4; - setTextPosition(v6, v5); - outText(v12); - - ++v6; - v5 = 1; + curChar = ptr[pos]; + if (curChar == 13) { + setTextPosition(lineNum, 1); + outText(curStr); + + ++lineNum; _vm->_eventsManager.VBL(); - v4 = v8; - v12 = ""; - } else if (v4 != '%') { - v12 += v4; - ++v7; + curStr = ""; + } else if (curChar != '%') { + curStr += curChar; } - ++v10; - } while (v4 != '%'); + ++pos; + assert(pos <= fileSize); + } while (curChar != '%'); _vm->_eventsManager.waitKeyPress(); ptr = _vm->_globals.freeMemory(ptr); -- cgit v1.2.3 From 2e331ee630d941d0a3625c7a497900598b1854b7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Jan 2013 18:55:43 +0100 Subject: HOPKINS: Simplify character mapping in ComputerManager --- engines/hopkins/computer.cpp | 85 ++++---------------------------------------- 1 file changed, 7 insertions(+), 78 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 0efa1a0c26..9b8f6063b5 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -389,80 +389,10 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { mappedChar = '*'; - if (curChar == '-') - mappedChar = 45; - else if (curChar == '0') - mappedChar = 48; - else if (curChar == '1') - mappedChar = 49; - else if (curChar == '2') - mappedChar = 50; - else if (curChar == '3') - mappedChar = 51; - else if (curChar == '4') - mappedChar = 52; - else if (curChar == '5') - mappedChar = 53; - else if (curChar == '6') - mappedChar = 54; - else if (curChar == '7') - mappedChar = 55; - else if (curChar == '8') - mappedChar = 56; - else if (curChar == '9') - mappedChar = 57; - else if (curChar == 'A' || curChar == 'a') - mappedChar = 65; - else if (curChar == 'B' || curChar == 'b') - mappedChar = 66; - else if (curChar == 'C' || curChar == 'c') - mappedChar = 67; - else if (curChar == 'D' || curChar == 'd') - mappedChar = 68; - else if (curChar == 'E' || curChar == 'e') - mappedChar = 69; - else if (curChar == 'F' || curChar == 'f') - mappedChar = 70; - else if (curChar == 'G' || curChar == 'g') - mappedChar = 71; - else if (curChar == 'H' || curChar == 'h') - mappedChar = 72; - else if (curChar == 'I' || curChar == 'i') - mappedChar = 73; - else if (curChar == 'J' || curChar == 'j') - mappedChar = 74; - else if (curChar == 'K' || curChar == 'k') - mappedChar = 75; - else if (curChar == 'L' || curChar == 'l') - mappedChar = 76; - else if (curChar == 'M' || curChar == 'm') - mappedChar = 77; - else if (curChar == 'N' || curChar == 'n') - mappedChar = 78; - else if (curChar == 'O' || curChar == 'o') - mappedChar = 79; - else if (curChar == 'P' || curChar == 'p') - mappedChar = 80; - else if (curChar == 'Q' || curChar == 'q') - mappedChar = 81; - else if (curChar == 'R' || curChar == 'r') - mappedChar = 82; - else if (curChar == 'S' || curChar == 's') - mappedChar = 83; - else if (curChar == 'T' || curChar == 't') - mappedChar = 84; - else if (curChar == 'U' || curChar == 'u') - mappedChar = 85; - else if (curChar == 'V' || curChar == 'v') - mappedChar = 86; - else if (curChar == 'W' || curChar == 'w') - mappedChar = 87; - else if (curChar == 'X' || curChar == 'x') - mappedChar = 88; - else if (curChar == 'Y' || curChar == 'y') - mappedChar = 89; - else if (curChar == 'Z' || curChar == 'z') - mappedChar = 90; + if ((curChar == '-') || ((curChar >= '0') && (curChar <= '9')) || ((curChar >= 'A') && (curChar <= 'Z'))) + mappedChar = curChar; + else if ((curChar >= 'a') && (curChar <= 'z')) + mappedChar = curChar - 32; // BackSpace if (curChar == 8 && textIndex > 0) { @@ -487,8 +417,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, - 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); _vm->_eventsManager.VBL(); @@ -577,7 +506,7 @@ void ComputerManager::readText(int idx) { * Display breakout when Games sub-menu is selected */ void ComputerManager::displayGamesSubMenu() { - const byte *v1 = _vm->_objectsManager._sprite[0]._spriteData; + const byte *oldSpriteData = _vm->_objectsManager._sprite[0]._spriteData; uint oldSpeed = _vm->_globals._speed; _vm->_globals._speed = 1; @@ -608,7 +537,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); _breakoutSpr = _vm->_globals.freeMemory(_breakoutSpr); _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); - _vm->_objectsManager._sprite[0]._spriteData = v1; + _vm->_objectsManager._sprite[0]._spriteData = oldSpriteData; _vm->_soundManager.DEL_SAMPLE(1); _vm->_soundManager.DEL_SAMPLE(2); -- cgit v1.2.3 From 117d99f22b5d90b411055b0657036f2932e6ff82 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Jan 2013 11:33:12 +0100 Subject: HOPKINS: Remove a GOTO in Copy_WinScan_Vbe --- engines/hopkins/graphics.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3820dbb5c1..03617fc08f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1856,24 +1856,23 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { srcPtr = src; for (;;) { byteVal = *srcPtr; - if (*srcPtr < kByteStop) - goto Video_Cont_wVbe; if (byteVal == kByteStop) return; - if (byteVal == k8bVal) { - destOffset += srcPtr[1]; - byteVal = srcPtr[2]; - srcPtr += 2; - } else if (byteVal == k16bVal) { - destOffset += READ_LE_UINT16(srcPtr + 1); - byteVal = srcPtr[3]; - srcPtr += 3; - } else { - destOffset += READ_LE_UINT32(srcPtr + 1); - byteVal = srcPtr[5]; - srcPtr += 5; + if (*srcPtr > kByteStop) { + if (byteVal == k8bVal) { + destOffset += srcPtr[1]; + byteVal = srcPtr[2]; + srcPtr += 2; + } else if (byteVal == k16bVal) { + destOffset += READ_LE_UINT16(srcPtr + 1); + byteVal = srcPtr[3]; + srcPtr += 3; + } else { + destOffset += READ_LE_UINT32(srcPtr + 1); + byteVal = srcPtr[5]; + srcPtr += 5; + } } -Video_Cont_wVbe: dest[destOffset] = byteVal; ++srcPtr; ++destOffset; -- cgit v1.2.3 From a91eaeb4f78608bf511b5d3c39f54646263365aa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 6 Jan 2013 23:12:34 +0100 Subject: HOPKINS: Remove uint16 casting in m_scroll16 in order to avoid endian issue --- engines/hopkins/anim.cpp | 35 ++++++++++++++++------------------- engines/hopkins/graphics.cpp | 15 +++++++++------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index bce08a3773..55e9fe17f1 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -880,7 +880,6 @@ LABEL_59: */ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool v4; - int v7; byte *ptr = NULL; byte *v10; byte *v11 = NULL; @@ -888,7 +887,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u size_t nbytes; Common::File f; - v7 = 0; + bool multiScreenFl = false; for (;;) { if (_vm->shouldQuit()) return; @@ -914,12 +913,12 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u f.read(v10, nbytes); if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { - v7 = 1; + multiScreenFl = true; ptr = _vm->_globals.allocMemory(307200); memcpy((void *)ptr, v10, 307200); } if (NO_SEQ) { - if (v7 == 1) { + if (multiScreenFl) { assert(ptr != NULL); memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 307200); } @@ -927,7 +926,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u } else { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); - if (v7) + if (multiScreenFl) _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -949,7 +948,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u } if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_54; - if (v7 == 1) + if (multiScreenFl) ptr = _vm->_globals.freeMemory(ptr); _vm->_globals.freeMemory(v11); f.close(); @@ -975,7 +974,7 @@ LABEL_23: LABEL_33: _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.lockScreen(); - if (v7) { + if (multiScreenFl) { if (*v10 != kByteStop) { _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -1009,7 +1008,7 @@ LABEL_44: goto LABEL_33; } LABEL_54: - if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) { + if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) { byte *ptra = _vm->_globals.allocMemory(307200); f.seek(0); @@ -1028,24 +1027,22 @@ LABEL_54: f.read(v10, nbytes); memcpy(ptra, v10, 307200); - bool v5 = false; - do { + for (;;) { memset(v11, 0, 19); if (f.read(v11, 16) != 16) - v5 = true; + break; if (strncmp((const char *)v11, "IMAGE=", 6)) - v5 = true; - if (!v5) { - f.read(v10, READ_LE_UINT32(v11 + 8)); - if (*v10 != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); - } - } while (!v5); + break; + + f.read(v10, READ_LE_UINT32(v11 + 8)); + if (*v10 != kByteStop) + _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); + } _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } - if (v7 == 1) { + if (multiScreenFl) { if (_vm->_graphicsManager.FADE_LINUX == 2) _vm->_graphicsManager.fadeOutDefaultLength(ptr); _vm->_globals.freeMemory(ptr); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 03617fc08f..057d120405 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -422,19 +422,22 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, assert(_videoPtr); const byte *srcP = xs + _lineNbr2 * ys + surface; - uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destX * 2 + WinScan * destY); + byte *destP = (byte *)_videoPtr->pixels + destX * 2 + WinScan * destY; for (int yp = 0; yp < height; ++yp) { // Copy over the line, using the source pixels as lookups into the pixels palette const byte *lineSrcP = srcP; - uint16 *lineDestP = destP; - - for (int xp = 0; xp < width; ++xp) - *lineDestP++ = *(uint16 *)&PAL_PIXELS[*lineSrcP++ * 2]; + byte *lineDestP = destP; + for (int xp = 0; xp < width; ++xp) { + lineDestP[0] = PAL_PIXELS[lineSrcP[0] * 2]; + lineDestP[1] = PAL_PIXELS[(lineSrcP[0] * 2) + 1]; + lineDestP += 2; + lineSrcP++; + } // Move to the start of the next line srcP += _lineNbr2; - destP += WinScan / 2; + destP += WinScan; } unlockScreen(); -- cgit v1.2.3 From 9b8b1d63318546d9f4196730025ed00abce5ebcc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Jan 2013 00:30:21 +0100 Subject: HOPKINS: Simplify Copy_vga16, get rid of unsafe uint16 casts --- engines/hopkins/graphics.cpp | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 057d120405..48d68aeb8b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -450,14 +450,13 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width int yNext; int xCtr; const byte *palette; - int pixelWord; int yCtr; const byte *srcCopyP; byte *destCopyP; assert(_videoPtr); srcP = xs + _lineNbr2 * ys + surface; - destP = destX + destX + WinScan * destY + (byte *)_videoPtr->pixels; + destP = (byte *)_videoPtr->pixels + destX + destX + WinScan * destY; yNext = height; Agr_x = 0; Agr_y = 0; @@ -473,16 +472,16 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width Agr_x = 0; do { - pixelWord = *(const uint16 *)(palette + 2 * *srcP); - *(uint16 *)destP = pixelWord; - ++srcP; + destP[0] = palette[2 * srcP[0]]; + destP[1] = palette[(2 * srcP[0]) + 1]; destP += 2; if ((unsigned int)Agr_x >= 100) { Agr_x -= 100; - *(uint16 *)destP = pixelWord; + destP[0] = palette[2 * srcP[0]]; + destP[1] = palette[(2 * srcP[0]) + 1]; destP += 2; } - + ++srcP; --xCtr; } while (xCtr); @@ -506,23 +505,18 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - const byte *srcP; - uint16 *destP; int yCount; int xCount; int xCtr; const byte *palette; - const uint16 *tempSrcP; - uint16 srcByte; - uint16 *tempDestP; int savedXCount; - uint16 *loopDestP; + byte *loopDestP; const byte *loopSrcP; int yCtr; assert(_videoPtr); - srcP = xp + 320 * yp + surface; - destP = (uint16 *)(30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY + (byte *)_videoPtr->pixels); + const byte *srcP = surface + xp + 320 * yp; + byte *destP = (byte *)_videoPtr->pixels + 30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY; yCount = height; xCount = width; @@ -535,21 +529,15 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, palette = PAL_PIXELS; do { - tempSrcP = (const uint16 *)(palette + 2 * *srcP); - srcByte = *tempSrcP; - *destP = *tempSrcP; - *(destP + 1) = srcByte; - - tempDestP = (uint16 *)((byte *)destP + WinScan); - *tempDestP = srcByte; - *(tempDestP + 1) = srcByte; + destP[0] = destP[2] = destP[WinScan] = destP[WinScan + 2] = palette[2 * srcP[0]]; + destP[1] = destP[3] = destP[WinScan + 1] = destP[WinScan + 3] = palette[(2 * srcP[0]) + 1]; ++srcP; - destP = (uint16 *)((byte *)tempDestP - WinScan + 4); + destP += 4; --xCtr; } while (xCtr); xCount = savedXCount; - destP = (uint16 *)((byte *)loopDestP + WinScan * 2); + destP = loopDestP + WinScan * 2; srcP = loopSrcP + 320; yCount = yCtr - 1; } while (yCtr != 1); -- cgit v1.2.3 From b7f5c7ae8d9b7aad15dc9f43f82860f74e4abb00 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Jan 2013 01:03:58 +0100 Subject: HOPKINS: More 16b refactoring --- engines/hopkins/computer.cpp | 2 +- engines/hopkins/graphics.cpp | 78 ++++++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 9b8f6063b5..f76a709a58 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -1221,7 +1221,7 @@ void ComputerManager::checkBallCollisions() { _breakoutScore += 40; displayScore(); --_breakoutBrickNbr; - *((uint16 *)level + v8 + 5) = 0; + level[v8 + 5] = 0; v7 = true; } } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 48d68aeb8b..3c07d5946c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -727,7 +727,7 @@ void GraphicsManager::SETCOLOR4(int palIndex, int r, int g, int b) { void GraphicsManager::changePalette(const byte *palette) { const byte *srcP = &palette[0]; for (int idx = 0; idx < PALETTE_SIZE; ++idx, srcP += 3) { - WRITE_LE_UINT16(&SD_PIXELS[2 * idx], mapRGB(*srcP, *(srcP + 1), *(srcP + 2))); + WRITE_LE_UINT16(&SD_PIXELS[2 * idx], mapRGB(srcP[0], srcP[1], srcP[2])); } } @@ -803,7 +803,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { assert(_videoPtr); for (;;) { - byte srcByte = *srcP; + byte srcByte = srcP[0]; if (srcByte >= 222) { if (srcByte == kByteStop) return; @@ -834,28 +834,34 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { 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); + byte *destP = (byte *)_videoPtr->pixels + destOffset * 2; destOffset += pixelCount; - while (pixelCount--) - *destP++ = pixelValue; + while (pixelCount--) { + destP[0] = PAL_PIXELS[2 * pixelIndex]; + destP[1] = PAL_PIXELS[(2 * pixelIndex) + 1]; + destP += 2; + } 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); + byte *destP = (byte *)_videoPtr->pixels + destOffset * 2; destOffset += pixelCount; - while (pixelCount--) - *destP++ = pixelValue; + while (pixelCount--) { + destP[0] = PAL_PIXELS[2 * pixelIndex]; + destP[1] = PAL_PIXELS[(2 * pixelIndex) + 1]; + destP += 2; + } srcP += 2; } } else { - *((uint16 *)_videoPtr->pixels + destOffset) = *(uint16 *)(PAL_PIXELS + 2 * srcByte); + byte *destP = (byte *)_videoPtr->pixels + destOffset * 2; + destP[0] = PAL_PIXELS[2 * srcByte]; + destP[1] = PAL_PIXELS[(2 * srcByte) + 1]; ++srcP; ++destOffset; } @@ -863,33 +869,31 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { - int destOffset; - const byte *srcP; - byte pixelIndex; + byte srcByte; + int destOffset = 0; + const byte *srcP = srcData; - destOffset = 0; - srcP = srcData; for (;;) { - pixelIndex = *srcP; - if (*srcP < kByteStop) - goto Video_Cont_Vbe16a; - if (pixelIndex == kByteStop) + srcByte = srcP[0]; + if (srcByte == kByteStop) return; - if (pixelIndex == k8bVal) { - destOffset += srcP[1]; - pixelIndex = srcP[2]; - srcP += 2; - } else if (pixelIndex == k16bVal) { - destOffset += READ_LE_UINT16(srcP + 1); - pixelIndex = srcP[3]; - srcP += 3; - } else { - destOffset += READ_LE_UINT32(srcP + 1); - pixelIndex = srcP[5]; - srcP += 5; + if (srcP[0] > kByteStop) { + if (srcByte == k8bVal) { + destOffset += srcP[1]; + srcByte = srcP[2]; + srcP += 2; + } else if (srcByte == k16bVal) { + destOffset += READ_LE_UINT16(srcP + 1); + srcByte = srcP[3]; + srcP += 3; + } else { + destOffset += READ_LE_UINT32(srcP + 1); + srcByte = srcP[5]; + srcP += 5; + } } -Video_Cont_Vbe16a: - WRITE_LE_UINT16((byte *)_videoPtr->pixels + destOffset * 2, READ_LE_UINT16(PAL_PIXELS + 2 * pixelIndex)); + + WRITE_LE_UINT16((byte *)_videoPtr->pixels + destOffset * 2, READ_LE_UINT16(PAL_PIXELS + 2 * srcByte)); ++srcP; ++destOffset; } @@ -915,7 +919,8 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int destP += width; } else if (width & 2) { for (i = width >> 1; i; --i) { - *(uint16 *)destP = *(const uint16 *)srcP; + destP[0] = srcP[0]; + destP[1] = srcP[1]; srcP += 2; destP += 2; } @@ -1235,7 +1240,8 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in destP += width; } else if (width & 2) { for (i = width >> 1; i; --i) { - *(uint16 *)destP = *(const uint16 *)srcP; + destP[0] = srcP[0]; + destP[1] = srcP[1]; srcP += 2; destP += 2; } -- cgit v1.2.3 From 7c815f2ca709c68cab5cfdb531e2740f92541794 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Jan 2013 08:02:19 +0100 Subject: HOPKINS: Some refactoring in ComputerManager --- engines/hopkins/computer.cpp | 234 ++++++++++++++++++++----------------------- engines/hopkins/computer.h | 4 +- engines/hopkins/font.cpp | 3 +- engines/hopkins/graphics.cpp | 2 +- 4 files changed, 113 insertions(+), 130 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index f76a709a58..3df0455536 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -23,6 +23,7 @@ #include "common/system.h" #include "common/file.h" #include "common/textconsole.h" +#include "hopkins/computer.h" #include "hopkins/font.h" #include "hopkins/files.h" #include "hopkins/globals.h" @@ -381,7 +382,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { bool oldMouseFlag = _vm->_eventsManager._mouseFl; _vm->_eventsManager._mouseFl = false; - _vm->_fontManager.displayTextVesa(xp, yp, "_", -4); + _vm->_fontManager.displayTextVesa(xp, yp, "_", 252); do { curChar = _vm->_eventsManager.waitKeyPress(); if (_vm->shouldQuit()) @@ -401,7 +402,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { x2 = x1 + 2 * _vm->_globals.police_l; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, x2, yp + 12); - _vm->_fontManager.displayTextVesa(x1, yp, "_", -4); + _vm->_fontManager.displayTextVesa(x1, yp, "_", 252); } if (mappedChar != '*') { newChar = mappedChar; @@ -410,7 +411,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); - _vm->_fontManager.displayTextVesa(x1, yp, charString, -4); + _vm->_fontManager.displayTextVesa(x1, yp, charString, 252); ++textIndex; x1 += _vm->_globals.police_l; } @@ -638,41 +639,39 @@ void ComputerManager::newLevel() { * Display bricks in breakout game */ void ComputerManager::displayBricks() { - int xp; - int yp; - int v2; - uint16 v3; - int16 *v4; - _breakoutBrickNbr = 0; _breakoutSpeed = 1; - v4 = _breakoutLevel; - v3 = 0; + int16 *level = _breakoutLevel; + int levelIdx = 0; + + int cellLeft; + int cellTop; + int cellType; do { - xp = v4[v3]; - yp = v4[v3 + 1]; - v2 = v4[v3 + 4]; - if (xp != -1) { - if (v2 <= 6) + cellLeft = level[levelIdx]; + cellTop = level[levelIdx + 1]; + cellType = level[levelIdx + 4]; + if (cellLeft != -1) { + if (cellType <= 6) ++_breakoutBrickNbr; - if (v2 == 3) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 17); - else if (v2 == 6) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 18); - else if (v2 == 5) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 19); - else if (v2 == 4) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 20); - else if (v2 == 1) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 21); - else if (v2 == 2) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 22); - else if (v2 == 31) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, yp, 23); + if (cellType == 3) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 17); + else if (cellType == 6) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 18); + else if (cellType == 5) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 19); + else if (cellType == 4) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 20); + else if (cellType == 1) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 21); + else if (cellType == 2) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 22); + else if (cellType == 31) + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 23); } - v3 += 6; - } while (xp != -1); + levelIdx += 6; + } while (cellLeft != -1); displayScore(); } @@ -785,15 +784,13 @@ void ComputerManager::playBreakout() { */ int ComputerManager::displayHiscores() { int yp; - int buttonIndex; int xp; - byte *ptr; _vm->_graphicsManager.RESET_SEGMENT_VESA(); loadHiscore(); _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); - ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -815,7 +812,7 @@ int ComputerManager::displayHiscores() { _vm->_graphicsManager.fadeInBreakout(); _vm->_graphicsManager.RESET_SEGMENT_VESA(); - buttonIndex = 0; + int buttonIndex = 0; do { _vm->_eventsManager.refreshEvents(); xp = _vm->_eventsManager.getMouseX(); @@ -839,24 +836,21 @@ int ComputerManager::displayHiscores() { * Display a screen to enter player name in the case of a new hiscore */ void ComputerManager::getScoreName() { - char curChar; - byte *ptr; - _vm->_graphicsManager.loadVgaImage("NAME.PCX"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); - ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_graphicsManager.fadeInBreakout(); for (int strPos = 0; strPos <= 4; strPos++) { displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); - curChar = toupper(_vm->_eventsManager.waitKeyPress()); - if ((curChar <= '/') || (curChar > 'Z')) + char curChar = toupper(_vm->_eventsManager.waitKeyPress()); + if ((curChar < '0') && (curChar > 'Z')) curChar = ' '; - if ((uint16)(curChar - ':') <= 6u) + if ((curChar > '9') && (curChar < 'A')) curChar = ' '; _score[5]._name.setChar(curChar, strPos); @@ -888,20 +882,18 @@ void ComputerManager::getScoreName() { * Display current score */ void ComputerManager::displayScore() { - char s[40]; - - sprintf(s, "%d", _breakoutScore); - int v0 = 0; - do - ++v0; - while (s[v0]); - int v1 = 0; - for (int i = v0; i > -1; i--) { - IMPSCORE(v1++, (byte)s[i]); + Common::String scoreStr = Common::String::format("%d", _breakoutScore); + int strSize = scoreStr.size(); + int idx = 0; + for (int i = strSize; i > -1; i--) { + displayScoreChar(idx++, scoreStr[i]); } } -void ComputerManager::IMPSCORE(int charPos, int charDisp) { +/** + * Display a character of the score + */ +void ComputerManager::displayScoreChar(int charPos, int charDisp) { int16 xp = 200; int16 idx = 3; @@ -918,7 +910,7 @@ void ComputerManager::IMPSCORE(int charPos, int charDisp) { else if (charPos == 9) xp = 134; - if (charDisp >= 48 && charDisp <= 57) + if (charDisp >= '0' && charDisp <= '9') idx = charDisp - 45; _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 11, idx); @@ -1108,7 +1100,7 @@ void ComputerManager::checkBallCollisions() { int cellBottom; int cellUp; - bool v7 = false; + bool brickDestroyedFl = false; // TODO: Check if correct int randVal = _vm->getRandomNumber(6) + 1; int ballLeft = _ballPosition.x; @@ -1116,37 +1108,33 @@ void ComputerManager::checkBallCollisions() { int ballRight = _ballPosition.x + 6; int ballBottom = _ballPosition.y + 6; int16 *level = _breakoutLevel; - uint16 v8 = 0; + uint16 levelIdx = 0; do { - cellLeft = level[v8]; - cellUp = level[v8 + 1]; - cellRight = level[v8 + 2]; - cellBottom = level[v8 + 3]; - cellType = level[v8 + 4]; - if (level[v8 + 5] == 1 && cellLeft != -1) { + cellLeft = level[levelIdx]; + cellUp = level[levelIdx + 1]; + cellRight = level[levelIdx + 2]; + cellBottom = level[levelIdx + 3]; + cellType = level[levelIdx + 4]; + if (level[levelIdx + 5] == 1 && cellLeft != -1) { collisionFl = false; if (ballTop <= cellBottom && ballBottom >= cellBottom) { if (ballLeft >= cellLeft && ballRight <= cellRight) { collisionFl = true; _ballUpFl = true; } - if (ballRight >= cellLeft) { - if (ballLeft <= cellLeft) { - collisionFl = true; - _ballUpFl = true; - _ballRightFl = false; - if (cellType == 31) - _ballPosition.x -= randVal; - } + if ((ballRight >= cellLeft) && (ballLeft <= cellLeft)) { + collisionFl = true; + _ballUpFl = true; + _ballRightFl = false; + if (cellType == 31) + _ballPosition.x -= randVal; } - if (ballLeft <= cellRight) { - if (ballRight >= cellRight) { - collisionFl = true; - _ballUpFl = true; - _ballRightFl = true; - if (cellType == 31) - _ballPosition.x += randVal; - } + if ((ballLeft <= cellRight) && (ballRight >= cellRight)) { + collisionFl = true; + _ballUpFl = true; + _ballRightFl = true; + if (cellType == 31) + _ballPosition.x += randVal; } } if (ballBottom >= cellUp && ballTop <= cellUp) { @@ -1154,43 +1142,33 @@ void ComputerManager::checkBallCollisions() { collisionFl = true; _ballUpFl = false; } - if (ballRight >= cellLeft) { - if (ballLeft <= cellLeft) { - collisionFl = true; - _ballUpFl = false; - _ballRightFl = false; - if (cellType == 31) - _ballPosition.x -= 2; - } + if ((ballRight >= cellLeft) && (ballLeft <= cellLeft)) { + collisionFl = true; + _ballUpFl = false; + _ballRightFl = false; + if (cellType == 31) + _ballPosition.x -= 2; } - if (ballLeft <= cellRight) { - if (ballRight >= cellRight) { - collisionFl = true; - _ballUpFl = false; - _ballRightFl = true; - if (cellType == 31) - _ballPosition.x += randVal; - } + if ((ballLeft <= cellRight) && (ballRight >= cellRight)) { + collisionFl = true; + _ballUpFl = false; + _ballRightFl = true; + if (cellType == 31) + _ballPosition.x += randVal; } } - if (ballTop >= cellUp) { - if (ballBottom <= cellBottom) { - if (ballRight >= cellLeft) { - if (ballLeft <= cellLeft) { - collisionFl = true; - _ballRightFl = false; - if (cellType == 31) - _ballPosition.x -= randVal; - } - } - if (ballLeft <= cellRight) { - if (ballRight >= cellRight) { - collisionFl = true; - _ballRightFl = true; - if (cellType == 31) - _ballPosition.x += randVal; - } - } + if ((ballTop >= cellUp) && (ballBottom <= cellBottom)) { + if ((ballRight >= cellLeft) && (ballLeft <= cellLeft)) { + collisionFl = true; + _ballRightFl = false; + if (cellType == 31) + _ballPosition.x -= randVal; + } + if ((ballLeft <= cellRight) && (ballRight >= cellRight)) { + collisionFl = true; + _ballRightFl = true; + if (cellType == 31) + _ballPosition.x += randVal; } } if (collisionFl) { @@ -1199,37 +1177,43 @@ void ComputerManager::checkBallCollisions() { } else { _vm->_soundManager.playSample(1, 5); _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellUp, 16); - if (cellType == 1) + switch (cellType) { + case 1: _breakoutScore += 10; - if (cellType == 2) + break; + case 2: _breakoutScore += 5; - if (cellType == 3) { + break; + case 3: _breakoutScore += 50; if (_breakoutSpeed <= 1) _breakoutSpeed = 2; if (_breakoutBrickNbr <= 19) _breakoutSpeed = 3; - } - if (cellType == 4) + break; + case 4: _breakoutScore += 20; - if (cellType == 5) { + break; + case 5: _breakoutScore += 30; if (_breakoutSpeed <= 1) _breakoutSpeed = 2; - } - if (cellType == 6) + break; + case 6: _breakoutScore += 40; + break; + } displayScore(); --_breakoutBrickNbr; - level[v8 + 5] = 0; - v7 = true; + level[levelIdx + 5] = 0; + brickDestroyedFl = true; } } } - if (v7) + if (brickDestroyedFl) cellLeft = -1; - v8 += 6; + levelIdx += 6; } while (cellLeft != -1); } diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index d52cc28799..c5f92f35bf 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -24,8 +24,8 @@ #define HOPKINS_COMPUTER_H #include "common/scummsys.h" -#include "common/rect.h" #include "common/str.h" +#include "common/rect.h" namespace Hopkins { @@ -95,7 +95,7 @@ private: void TXT4(int xp, int yp, int textIdx); - void IMPSCORE(int charPos, int charDisp); + void displayScoreChar(int charPos, int charDisp); public: ComputerManager(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 4d0aa14dfe..4e2fda8d63 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -449,8 +449,7 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, - xp, yp, characterIndex, col); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, xp, yp, characterIndex, col); xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); } } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3c07d5946c..88b576ac00 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1739,7 +1739,7 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, for (int xCtr = spriteWidth; xCtr; xCtr--) { destByte = *spritePixelsP; if (*spritePixelsP) { - if (destByte == (byte)-4) + if (destByte == 252) destByte = colour; *destP = destByte; } -- cgit v1.2.3 From b26f25455f642e31762c3ab2fb2e894b93044688 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Jan 2013 08:33:55 +0100 Subject: HOPKINS: Some renaming --- engines/hopkins/anim.cpp | 234 ++++++++++++++++++++----------------------- engines/hopkins/graphics.cpp | 20 ++-- engines/hopkins/graphics.h | 4 +- engines/hopkins/hopkins.cpp | 12 +-- engines/hopkins/talk.cpp | 10 +- 5 files changed, 134 insertions(+), 146 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 55e9fe17f1..302c2f7913 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -47,21 +47,16 @@ AnimationManager::AnimationManager() { * @param rate3 Delay amount after animation finishes */ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { - bool breakFlag; - bool hasScreenCopy; byte *screenCopy = NULL; - byte *screenP = NULL; int frameNumber; - byte *ptr = NULL; - size_t nbytes; Common::File f; if (_vm->shouldQuit()) return; - hasScreenCopy = false; - screenP = _vm->_graphicsManager._vesaScreen; - ptr = _vm->_globals.allocMemory(20); + bool hasScreenCopy = false; + byte *screenP = _vm->_graphicsManager._vesaScreen; + byte *ptr = _vm->_globals.allocMemory(20); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals._curFilename)) @@ -70,7 +65,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui f.skip(6); f.read(_vm->_graphicsManager._palette, 800); f.skip(4); - nbytes = f.readUint32LE(); + size_t nbytes = f.readUint32LE(); f.skip(14); f.read(screenP, nbytes); @@ -87,9 +82,9 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (NO_SEQ) { if (hasScreenCopy) memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); } else { - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -113,7 +108,6 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } _vm->_eventsManager._rateCounter = 0; - breakFlag = false; frameNumber = 0; while (!_vm->shouldQuit()) { ++frameNumber; @@ -121,11 +115,9 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui // Read frame header if (f.read(ptr, 16) != 16) - breakFlag = true; + break; if (strncmp((char *)ptr, "IMAGE=", 6)) - breakFlag = true; - if (breakFlag) break; f.read(screenP, READ_LE_UINT32(ptr + 8)); @@ -182,21 +174,18 @@ EXIT: memcpy(screenCopy, screenP, 307200); - breakFlag = false; - do { + for (;;) { memset(ptr, 0, 20); if (f.read(ptr, 16) != 16) - breakFlag = true; + break; if (strncmp((char *)ptr, "IMAGE=", 6)) - breakFlag = true; + break; - if (!breakFlag) { - f.read(screenP, READ_LE_UINT32(ptr + 8)); - if (*screenP != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); - } - } while (breakFlag); + f.read(screenP, READ_LE_UINT32(ptr + 8)); + if (*screenP != kByteStop) + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + } _vm->_graphicsManager.fadeOutDefaultLength(screenCopy); screenCopy = _vm->_globals.freeMemory(screenCopy); } @@ -217,12 +206,11 @@ EXIT: */ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { int v5; - int v8; - byte *ptr = NULL; + byte *screenCopy = NULL; int oldScrollVal = 0; - byte *v12 = NULL; - byte *v13 = NULL; - int v15; + byte *screenP = NULL; + byte *ptr = NULL; + int frameNumber; size_t nbytes; byte buf[6]; Common::File f; @@ -230,7 +218,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->shouldQuit()) return; - v8 = 0; + bool hasScreenCopy = false; while (!_vm->shouldQuit()) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); @@ -243,8 +231,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; - v12 = _vm->_graphicsManager._vesaScreen; - v13 = _vm->_globals.allocMemory(20); + screenP = _vm->_graphicsManager._vesaScreen; + ptr = _vm->_globals.allocMemory(20); _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); if (!f.open(_vm->_globals._curFilename)) @@ -261,7 +249,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint f.readUint16LE(); f.readUint16LE(); - f.read(v12, nbytes); + f.read(screenP, nbytes); _vm->_graphicsManager.clearPalette(); oldScrollVal = _vm->_graphicsManager.SCROLL; @@ -272,21 +260,21 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.max_x = SCREEN_WIDTH; if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { - v8 = 1; - ptr = _vm->_globals.allocMemory(307200); - memcpy(ptr, v12, 307200); + hasScreenCopy = true; + screenCopy = _vm->_globals.allocMemory(307200); + memcpy(screenCopy, screenP, 307200); } if (NO_SEQ) { - if (v8 == 1) - memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + if (hasScreenCopy) + memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); } else { - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); - if (v8) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (hasScreenCopy) + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(v12, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } @@ -304,9 +292,9 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint } if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_114; - if (v8 == 1) - ptr = _vm->_globals.freeMemory(ptr); - _vm->_globals.freeMemory(v13); + if (hasScreenCopy) + screenCopy = _vm->_globals.freeMemory(screenCopy); + _vm->_globals.freeMemory(ptr); f.close(); _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); @@ -338,34 +326,34 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint LABEL_48: _vm->_eventsManager._rateCounter = 0; v5 = 0; - v15 = 0; + frameNumber = 0; for (;;) { - ++v15; - _vm->_soundManager.playAnim_SOUND(v15); + ++frameNumber; + _vm->_soundManager.playAnim_SOUND(frameNumber); memset(&buf, 0, 6); - memset(v13, 0, 19); + memset(ptr, 0, 19); - if (f.read(v13, 16) != 16) + if (f.read(ptr, 16) != 16) v5 = -1; - if (strncmp((const char *)v13, "IMAGE=", 6)) + if (strncmp((const char *)ptr, "IMAGE=", 6)) v5 = -1; if (v5) goto LABEL_88; - f.read(v12, READ_LE_UINT32(v13 + 8)); + f.read(screenP, READ_LE_UINT32(ptr + 8)); if (_vm->_globals.iRegul == 1) break; LABEL_77: _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.lockScreen(); - if (v8) { - if (*v12 != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptr); - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (hasScreenCopy) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v12 != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16(v12); + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); @@ -393,7 +381,7 @@ LABEL_114: _vm->_graphicsManager._skipVideoLockFl = false; f.close(); - if (_vm->_graphicsManager.FADE_LINUX == 2 && !v8) { + if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { byte *ptra; ptra = _vm->_globals.allocMemory(307200); @@ -410,34 +398,34 @@ LABEL_114: f.readUint16LE(); f.readUint16LE(); - f.read(v12, nbytes); - memcpy(ptra, v12, 307200); + f.read(screenP, nbytes); + memcpy(ptra, screenP, 307200); int v6 = 0; do { memset(&buf, 0, 6); - memset(v13, 0, 19); - if (f.read(v13, 16) != 16) + memset(ptr, 0, 19); + if (f.read(ptr, 16) != 16) v6 = -1; - if (strncmp((const char *)v13, "IMAGE=", 6)) + if (strncmp((const char *)ptr, "IMAGE=", 6)) v6 = -1; if (!v6) { - f.read(v12, READ_LE_UINT32(v13 + 8)); - if (*v12 != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe3(v12, ptra); + f.read(screenP, READ_LE_UINT32(ptr + 8)); + if (*screenP != kByteStop) + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, ptra); } } while (v6 != -1); _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } - if (v8 == 1) { + if (hasScreenCopy) { if (_vm->_graphicsManager.FADE_LINUX == 2) - _vm->_graphicsManager.fadeOutDefaultLength(ptr); - _vm->_globals.freeMemory(ptr); + _vm->_graphicsManager.fadeOutDefaultLength(screenCopy); + _vm->_globals.freeMemory(screenCopy); } _vm->_graphicsManager.FADE_LINUX = 0; - _vm->_globals.freeMemory(v13); + _vm->_globals.freeMemory(ptr); _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); @@ -714,8 +702,8 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { */ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool readError; - byte *ptr = NULL; - byte *v9; + byte *screenCopy = NULL; + byte *screenP; byte *v10; int soundNumber; size_t nbytes; @@ -724,7 +712,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->shouldQuit()) return; - bool v7 = false; + bool hasScreenCopy = false; _vm->_eventsManager._mouseFl = false; if (!NO_COUL) { _vm->_eventsManager.VBL(); @@ -737,7 +725,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; } - v9 = _vm->_graphicsManager._vesaScreen; + screenP = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(22); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); if (!f.open(_vm->_globals._curFilename)) @@ -748,29 +736,29 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.skip(4); nbytes = f.readUint32LE(); f.skip(14); - f.read(v9, nbytes); + f.read(screenP, nbytes); if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { - v7 = true; - ptr = _vm->_globals.allocMemory(307200); - memcpy(ptr, v9, 307200); + hasScreenCopy = true; + screenCopy = _vm->_globals.allocMemory(307200); + memcpy(screenCopy, screenP, 307200); } if (NO_SEQ) { - if (v7) - memcpy(ptr, _vm->_graphicsManager._vesaBuffer, 307200); + if (hasScreenCopy) + memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200); if (!_vm->getIsDemo()) { _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); } - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); } else { _vm->_graphicsManager.lockScreen(); - if (v7) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (hasScreenCopy) + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(v9, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } @@ -791,7 +779,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } } else { if (NO_COUL) - _vm->_graphicsManager.fadeInDefaultLength(v9); + _vm->_graphicsManager.fadeInDefaultLength(screenP); _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.LOAD_ANM_SOUND(); @@ -820,7 +808,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (strncmp((const char *)v10, "IMAGE=", 6)) readError = true; if (!readError) { - f.read(v9, READ_LE_UINT32(v10 + 8)); + f.read(screenP, READ_LE_UINT32(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager._escKeyFl) { @@ -834,13 +822,13 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.lockScreen(); - if (v7) { - if (*v9 != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(v9, ptr); - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (hasScreenCopy) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v9 != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(v9); + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); @@ -870,8 +858,8 @@ LABEL_59: _vm->_eventsManager._mouseFl = true; } - if (v7) - _vm->_globals.freeMemory(ptr); + if (hasScreenCopy) + _vm->_globals.freeMemory(screenCopy); _vm->_globals.freeMemory(v10); } @@ -880,8 +868,8 @@ LABEL_59: */ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { bool v4; - byte *ptr = NULL; - byte *v10; + byte *screenCopy = NULL; + byte *screenP; byte *v11 = NULL; int v13; size_t nbytes; @@ -893,7 +881,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u return; _vm->_eventsManager._mouseFl = false; - v10 = _vm->_graphicsManager._vesaScreen; + screenP = _vm->_graphicsManager._vesaScreen; v11 = _vm->_globals.allocMemory(22); _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); @@ -910,26 +898,26 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u f.readUint16LE(); f.readUint16LE(); f.readUint16LE(); - f.read(v10, nbytes); + f.read(screenP, nbytes); if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { multiScreenFl = true; - ptr = _vm->_globals.allocMemory(307200); - memcpy((void *)ptr, v10, 307200); + screenCopy = _vm->_globals.allocMemory(307200); + memcpy((void *)screenCopy, screenP, 307200); } if (NO_SEQ) { if (multiScreenFl) { - assert(ptr != NULL); - memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 307200); + assert(screenCopy != NULL); + memcpy((void *)screenCopy, _vm->_graphicsManager._vesaBuffer, 307200); } - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); } else { _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); if (multiScreenFl) - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); else - _vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } @@ -949,7 +937,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->_graphicsManager._skipVideoLockFl) goto LABEL_54; if (multiScreenFl) - ptr = _vm->_globals.freeMemory(ptr); + screenCopy = _vm->_globals.freeMemory(screenCopy); _vm->_globals.freeMemory(v11); f.close(); } @@ -968,19 +956,19 @@ LABEL_23: v4 = true; if (v4) goto LABEL_44; - f.read(v10, READ_LE_UINT32(v11 + 8)); + f.read(screenP, READ_LE_UINT32(v11 + 8)); if (_vm->_globals.iRegul == 1) break; LABEL_33: _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.lockScreen(); if (multiScreenFl) { - if (*v10 != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr); - _vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else if (*v10 != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(v10); + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); @@ -1024,9 +1012,9 @@ LABEL_54: f.readUint16LE(); f.readUint16LE(); - f.read(v10, nbytes); + f.read(screenP, nbytes); - memcpy(ptra, v10, 307200); + memcpy(ptra, screenP, 307200); for (;;) { memset(v11, 0, 19); if (f.read(v11, 16) != 16) @@ -1035,17 +1023,17 @@ LABEL_54: if (strncmp((const char *)v11, "IMAGE=", 6)) break; - f.read(v10, READ_LE_UINT32(v11 + 8)); - if (*v10 != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra); + f.read(screenP, READ_LE_UINT32(v11 + 8)); + if (*screenP != kByteStop) + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, ptra); } _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } if (multiScreenFl) { if (_vm->_graphicsManager.FADE_LINUX == 2) - _vm->_graphicsManager.fadeOutDefaultLength(ptr); - _vm->_globals.freeMemory(ptr); + _vm->_graphicsManager.fadeOutDefaultLength(screenCopy); + _vm->_globals.freeMemory(screenCopy); } _vm->_graphicsManager.FADE_LINUX = 0; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 88b576ac00..d8d44a4641 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -557,7 +557,7 @@ void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) Common::fill(&palData2[0], &palData2[PALETTE_BLOCK_SIZE], 0); // Set current palette to black - setpal_vga256(palData2); + setPaletteVGA256(palData2); // Loop through fading in the palette for (int fadeIndex = 0; fadeIndex < fadeStep; ++fadeIndex) { @@ -568,7 +568,7 @@ void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) } // Set the transition palette and refresh the screen - setpal_vga256(palData2); + setPaletteVGA256(palData2); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); @@ -577,7 +577,7 @@ void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) } // Set the final palette - setpal_vga256(palette); + setPaletteVGA256(palette); // Refresh the screen m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -603,7 +603,7 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface palData[palOffset + 2] = (fadeStep - fadeIndex - 1) * palette[palOffset + 2] / (fadeStep - 1); } - setpal_vga256(palData); + setPaletteVGA256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); @@ -615,7 +615,7 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface for (int i = 0; i < PALETTE_BLOCK_SIZE; i++) palData[i] = 0; - setpal_vga256(palData); + setPaletteVGA256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); return DD_VBL(); } @@ -672,7 +672,7 @@ void GraphicsManager::fadeOutDefaultLength(const byte *surface) { * Fade in used by for the breakout mini-game */ void GraphicsManager::fadeInBreakout() { - setpal_vga256(_palette); + setPaletteVGA256(_palette); lockScreen(); copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); @@ -686,7 +686,7 @@ void GraphicsManager::fateOutBreakout() { byte palette[PALETTE_EXT_BLOCK_SIZE]; memset(palette, 0, PALETTE_EXT_BLOCK_SIZE); - setpal_vga256(palette); + setPaletteVGA256(palette); lockScreen(); copy16bFromSurfaceScaleX2(_vesaBuffer); @@ -694,11 +694,11 @@ void GraphicsManager::fateOutBreakout() { DD_VBL(); } -void GraphicsManager::setpal_vga256(const byte *palette) { +void GraphicsManager::setPaletteVGA256(const byte *palette) { changePalette(palette); } -void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { +void GraphicsManager::setPaletteVGA256WithRefresh(const byte *palette, const byte *surface) { changePalette(palette); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); DD_VBL(); @@ -1841,7 +1841,7 @@ void GraphicsManager::NB_SCREEN() { } void GraphicsManager::SHOW_PALETTE() { - setpal_vga256(_palette); + setPaletteVGA256(_palette); } void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index c0faa466f8..e77c105a12 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -125,8 +125,8 @@ public: void fadeInDefaultLength(const byte *surface); void fadeInBreakout(); void fateOutBreakout(); - void setpal_vga256(const byte *palette); - void setpal_vga256_linux(const byte *palette, const byte *surface); + void setPaletteVGA256(const byte *palette); + void setPaletteVGA256WithRefresh(const byte *palette, const byte *surface); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); void changePalette(const byte *palette); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 8f50044b96..77f755971a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4588,7 +4588,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager._palette, 796); - _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager._vesaBuffer); + _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); _graphicsManager.FIN_VISU(); if (shouldQuit()) @@ -4621,7 +4621,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); _globals.iRegul = 1; - _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager._vesaBuffer); + _graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer); int v9 = 0; while (!shouldQuit() && !_eventsManager._escKeyFl) { @@ -4642,7 +4642,7 @@ void HopkinsEngine::playIntro() { _graphicsManager._palette[i] -= v12; } - _graphicsManager.setpal_vga256_linux(_graphicsManager._palette, _graphicsManager._vesaBuffer); + _graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer); if (2 * v9 > 1) { @@ -4650,7 +4650,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); } - _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager._vesaBuffer); + _graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer); if (20 - v9 > 1) { for (int i = 1; i < 20 - v9; i++) _eventsManager.VBL(); @@ -4658,7 +4658,7 @@ void HopkinsEngine::playIntro() { v9 += 2; if (v9 > 15) { - _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager._vesaBuffer); + _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); for (uint j = 1; j < 100 / _globals._speed; ++j) _eventsManager.VBL(); @@ -4673,7 +4673,7 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); - _graphicsManager.setpal_vga256_linux(_graphicsManager._palette, _graphicsManager._vesaBuffer); + _graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer); for (uint m = 0; m < 50 / _globals._speed; ++m) { if (m == 30 / _globals._speed) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 8b20fa7e09..c87fcd7601 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -145,7 +145,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); @@ -223,7 +223,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager.changeMouseCursor(v8); _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); _vm->_objectsManager._disableCursorFl = false; _vm->_globals._disableInventFl = v7; STATI = 0; @@ -520,7 +520,7 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) { else _characterPalette[761] = 255; - _vm->_graphicsManager.setpal_vga256(_characterPalette); + _vm->_graphicsManager.setPaletteVGA256(_characterPalette); _vm->_graphicsManager.initColorTable(145, 150, _characterPalette); } @@ -1186,11 +1186,11 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); -- cgit v1.2.3 From aa0f860442aa3ed80b235c49ebe474fe3caafdc8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 12:58:32 +0200 Subject: HOPKINS: Remove unused variables --- engines/hopkins/globals.cpp | 3 --- engines/hopkins/globals.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a8385f34a9..10414beb9e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -121,9 +121,6 @@ Globals::Globals() { PUBEXIT = false; _speed = 1; INSTALL_TYPE = 1; - MUSICVOL = 6; - SOUNDVOL = 6; - VOICEVOL = 6; g_old_anim = 0; g_old_sens = 0; g_old_sens2 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 4aac3247ee..e4a407f755 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -351,9 +351,6 @@ public: Common::String FICH_ZONE; Common::String FICH_TEXTE; Common::String _curFilename; - int SOUNDVOL; - int MUSICVOL; - int VOICEVOL; bool _censorshipFl; int g_old_anim; int g_old_sens, g_old_sens2; -- cgit v1.2.3 From 30eeb9163d43ab3c0cd78dbc9f2b249b58699a0d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 13:24:04 +0200 Subject: HOPKINS: Get rid of more unused/unnecessary globals --- engines/hopkins/font.cpp | 1 - engines/hopkins/globals.cpp | 3 --- engines/hopkins/globals.h | 2 -- engines/hopkins/graphics.cpp | 4 ++-- engines/hopkins/graphics.h | 2 +- engines/hopkins/objects.cpp | 6 ++---- engines/hopkins/script.cpp | 2 +- engines/hopkins/talk.cpp | 14 +++++--------- 8 files changed, 11 insertions(+), 23 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 4e2fda8d63..7d98742be3 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -353,7 +353,6 @@ LABEL_57: _text[idx]._pos.x = v73; } } - _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; int posX = v73; int posY = yp; int saveWidth = _vm->_globals._boxWidth + 10; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 10414beb9e..1e46ef34f2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -132,7 +132,6 @@ Globals::Globals() { NUM_FICHIER_OBJ = 0; nbrligne = 0; _boxWidth = 0; - hauteur_boite = 0; _forestFl = false; _objectWidth = _objectHeight = 0; _helicopterFl = false; @@ -165,7 +164,6 @@ Globals::Globals() { NOT_VERIF = false; PERSO_TYPE = 0; GOACTION = false; - NECESSAIRE = false; Compteur = 0; _actionDirection = 0; _actionDirection = 0; @@ -336,7 +334,6 @@ void Globals::clearAll() { police = g_PTRNUL; police_h = 0; police_l = 0; - hauteur_boite = 0; _boxWidth = 0; _vm->_fontManager.clearAll(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e4a407f755..6c79091537 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -376,7 +376,6 @@ public: int nbrligne; // Useless variable? int _boxWidth; byte *_inventoryObject; - int hauteur_boite; int GESTE_FLAG; byte *_forestSprite; bool _forestFl; @@ -423,7 +422,6 @@ public: bool _cacheFl; bool NOPARLE; bool PLAN_FLAG; - bool NECESSAIRE; bool GOACTION; int Compteur; int _actionDirection; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index d8d44a4641..828fc2d3ad 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1823,8 +1823,8 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_objectsManager._changeVerbFl = false; } -void GraphicsManager::NB_SCREEN() { - if (!_vm->_globals.NECESSAIRE) +void GraphicsManager::NB_SCREEN(bool initPalette) { + if (initPalette) initColorTable(50, 65, _palette); if (_lineNbr == SCREEN_WIDTH) diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e77c105a12..dd1df3c6e1 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -166,7 +166,7 @@ public: void INI_ECRAN(const Common::String &file); void INI_ECRAN2(const Common::String &file); void OPTI_INI(const Common::String &file, int mode); - void NB_SCREEN(); + void NB_SCREEN(bool initPalette); void SHOW_PALETTE(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ec2dd6a546..8918924c23 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3803,7 +3803,7 @@ void ObjectsManager::handleSpecialGames() { if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; - _vm->_graphicsManager.NB_SCREEN(); + _vm->_graphicsManager.NB_SCREEN(true); _vm->_soundManager.SPECIAL_SOUND = 198; PERSO_ON = true; _vm->_animationManager.NO_SEQ = true; @@ -3811,9 +3811,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); _vm->_animationManager.NO_SEQ = false; _vm->_soundManager.SPECIAL_SOUND = 0; - _vm->_globals.NECESSAIRE = true; - _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = false; + _vm->_graphicsManager.NB_SCREEN(false); _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 2ab68d844d..941abebe22 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2264,7 +2264,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_ONE(6, 0, 15, 0); _vm->_objectsManager.PERSO_ON = true; - _vm->_graphicsManager.NB_SCREEN(); + _vm->_graphicsManager.NB_SCREEN(true); _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence2("TUNNEL.SEQ", 1, 18, 20); _vm->_animationManager.NO_SEQ = false; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index c87fcd7601..930e87df6c 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -95,7 +95,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; - _vm->_graphicsManager.NB_SCREEN(); + _vm->_graphicsManager.NB_SCREEN(true); _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, false); startCharacterAnim0(_paletteBufferIdx, false); @@ -126,11 +126,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } clearCharacterAnim(); _vm->_globals.NOPARLE = false; - _vm->_globals.NECESSAIRE = true; _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); - _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = false; + _vm->_graphicsManager.NB_SCREEN(false); _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); @@ -1116,9 +1114,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; - _vm->_graphicsManager.NB_SCREEN(); + _vm->_graphicsManager.NB_SCREEN(true); _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; - _vm->_graphicsManager.NB_SCREEN(); + _vm->_graphicsManager.NB_SCREEN(true); _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, true); startCharacterAnim0(_paletteBufferIdx, false); @@ -1153,11 +1151,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { clearCharacterAnim(); clearCharacterAnim(); _vm->_globals.NOPARLE = false; - _vm->_globals.NECESSAIRE = true; _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); - _vm->_graphicsManager.NB_SCREEN(); - _vm->_globals.NECESSAIRE = false; + _vm->_graphicsManager.NB_SCREEN(false); _vm->_linesManager.CLEAR_ZONE(); _vm->_linesManager.RESET_OBSTACLE(); _vm->_globals.resetCache(); -- cgit v1.2.3 From cdad3b605d3b112a16e91ab312b1dd93f5bc8f03 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 13:49:41 +0200 Subject: HOPKINS: Simplify SoundManager::WSOUND() --- engines/hopkins/sound.cpp | 159 +++++++++------------------------------------- 1 file changed, 29 insertions(+), 130 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 1925bac1b3..a35fae5285 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -318,6 +318,16 @@ void SoundManager::playAnim_SOUND(int soundNumber) { } } +static const char *modSounds[] = { + "appart", "ville", "Rock", "police", "deep" + "purgat", "riviere", "SUSPENS", "labo", "cadavre", + "cabane", "purgat2", "foret", "ile", "ile2", + "hopkins", "peur", "URAVOLGA", "BASE", "cadavre2", + "usine", "chien", "coeur", "stand", "ocean", + "base3", "gloop", "cant", "feel", "lost", + "tobac" +}; + void SoundManager::WSOUND(int soundNumber) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { if (soundNumber > 27) @@ -328,135 +338,7 @@ void SoundManager::WSOUND(int soundNumber) { if (MOD_FLAG) WSOUND_OFF(); - switch (soundNumber) { - case 1: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("appart"); - else - PLAY_MOD("appar"); - break; - case 2: - PLAY_MOD("ville"); - break; - case 3: - PLAY_MOD("Rock"); - break; - case 4: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("police"); - else - PLAY_MOD("polic"); - break; - case 5: - PLAY_MOD("deep"); - break; - case 6: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("purgat"); - else - PLAY_MOD("purga"); - break; - case 7: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("riviere"); - else - PLAY_MOD("rivie"); - break; - case 8: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("SUSPENS"); - else - PLAY_MOD("SUSPE"); - break; - case 9: - PLAY_MOD("labo"); - break; - case 10: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("cadavre"); - else - PLAY_MOD("cadav"); - break; - case 11: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("cabane"); - else - PLAY_MOD("caban"); - break; - case 12: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("purgat2"); - else - PLAY_MOD("purg2"); - break; - case 13: - PLAY_MOD("foret"); - break; - case 14: - PLAY_MOD("ile"); - break; - case 15: - PLAY_MOD("ile2"); - break; - case 16: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("hopkins"); - else - PLAY_MOD("hopki"); - break; - case 17: - PLAY_MOD("peur"); - break; - case 18: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("URAVOLGA"); - else - PLAY_MOD("peur"); - break; - case 19: - PLAY_MOD("BASE"); - break; - case 20: - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - PLAY_MOD("cadavre2"); - else - PLAY_MOD("cada2"); - break; - case 21: - PLAY_MOD("usine"); - break; - case 22: - PLAY_MOD("chien"); - break; - case 23: - PLAY_MOD("coeur"); - break; - case 24: - PLAY_MOD("stand"); - break; - case 25: - PLAY_MOD("ocean"); - break; - case 26: - PLAY_MOD("base3"); - break; - case 27: - PLAY_MOD("gloop"); - break; - case 28: - PLAY_MOD("cant"); - break; - case 29: - PLAY_MOD("feel"); - break; - case 30: - PLAY_MOD("lost"); - break; - case 31: - PLAY_MOD("tobac"); - break; - } - + PLAY_MOD(modSounds[soundNumber - 1]); old_music = soundNumber; } } @@ -481,7 +363,24 @@ void SoundManager::WSOUND_OFF() { void SoundManager::PLAY_MOD(const Common::String &file) { if (_musicOffFl) return; - _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, file); + Common::String modFile = file; + + // HACK + if (modFile == "URAVOLGA" && (_vm->getPlatform() == Common::kPlatformWindows || _vm->getPlatform() == Common::kPlatformLinux)) + modFile = "peur"; + + // The Windows/Linux version chops off the music file names to 5 characters + if (modFile.size() > 5 && (_vm->getPlatform() == Common::kPlatformWindows || _vm->getPlatform() == Common::kPlatformLinux)) { + if (!modFile.hasSuffix("2")) { + while (modFile.size() > 5) + modFile.deleteLastChar(); + } else { + while (modFile.size() > 4) + modFile.deleteLastChar(); + modFile += "2"; + } + } + _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, modFile); if (MOD_FLAG) { stopMusic(); delMusic(); -- cgit v1.2.3 From be83708ef5b65db4ea3893b61d189f30c92685b6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 13:58:54 +0200 Subject: HOPKINS: Fix typo --- engines/hopkins/files.cpp | 2 +- engines/hopkins/sound.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 30570939d2..f0238205fd 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -92,7 +92,7 @@ void FileManager::constructFilename(const Common::String &folder, const Common:: Common::String folderToUse = folder; // A lot of the code in the original engine based on COPIE_SEQ was used to determine - // whether a file resided on the CD or hard disk. Since the ScummVM implementatoin + // whether a file resided on the CD or hard disk. Since the ScummVM implementation // requires all the files in the same location, we only need to do a somewhat simpler // check for animations that don't exist in the ANM folder, but rather in special // sub-folders depending on the physical screen resolution being used. diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index a35fae5285..cf06046bbe 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -614,15 +614,15 @@ void SoundManager::PLAY_SOUND2(const Common::String &file) { } void SoundManager::MODSetSampleVolume() { - // No implementatoin needed + // No implementation needed } void SoundManager::MODSetVoiceVolume() { - // No implementatoin needed + // No implementation needed } void SoundManager::MODSetMusicVolume(int volume) { - // No implementatoin needed + // No implementation needed } void SoundManager::loadSample(int wavIndex, const Common::String &file) { -- cgit v1.2.3 From 5c39cd95e1db33d040ac97c8574006011c3b0a62 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 13:59:10 +0200 Subject: HOPKINS: Remove another unused global --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - 2 files changed, 2 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1e46ef34f2..3fe096be2c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -120,7 +120,6 @@ Globals::Globals() { PUBEXIT = false; _speed = 1; - INSTALL_TYPE = 1; g_old_anim = 0; g_old_sens = 0; g_old_sens2 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 6c79091537..598a5cfcad 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -334,7 +334,6 @@ public: bool PUBEXIT; int PERSO_TYPE; uint _speed; - int INSTALL_TYPE; Common::String HOPIMAGE; Common::String HOPANIM; Common::String HOPLINK; -- cgit v1.2.3 From 6629fa7cc5a2a124b4507bb93ae6dea918036040 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 14:05:03 +0200 Subject: HOPKINS: Remove another unused global variable --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 235 +------------------------------------------- engines/hopkins/objects.cpp | 1 - 4 files changed, 1 insertion(+), 237 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 3fe096be2c..7d1786a0fd 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -145,7 +145,6 @@ Globals::Globals() { _screenId = 0; NOSPRECRAN = false; _prevScreenId = 0; - Max_Propre_Gen = 0; Max_Ligne_Long = 0; Max_Perso_Y = 0; Max_Propre = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 598a5cfcad..ddc64df078 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -399,7 +399,6 @@ public: int _prevScreenId; int fmusic; int Max_Propre; - int Max_Propre_Gen; int Max_Ligne_Long; int Max_Perso_Y; bool _disableInventFl; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 77f755971a..1b181bee52 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -210,7 +210,6 @@ bool HopkinsEngine::runWin95Demo() { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2); break; @@ -247,7 +246,6 @@ bool HopkinsEngine::runWin95Demo() { } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -262,7 +260,6 @@ bool HopkinsEngine::runWin95Demo() { case 5: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; @@ -279,7 +276,6 @@ bool HopkinsEngine::runWin95Demo() { case 6: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -294,13 +290,11 @@ bool HopkinsEngine::runWin95Demo() { case 8: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; case 9: - _globals.Max_Propre_Gen = 10; _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; _globals.Max_Ligne_Long = 20; @@ -319,7 +313,6 @@ bool HopkinsEngine::runWin95Demo() { case 11: _globals.NOSPRECRAN = true; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); @@ -327,7 +320,6 @@ bool HopkinsEngine::runWin95Demo() { break; case 12: - _globals.Max_Propre_Gen = 10; _globals.Max_Propre = 15; _globals.Max_Perso_Y = 450; _globals.Max_Ligne_Long = 20; @@ -545,7 +537,6 @@ bool HopkinsEngine::runLinuxDemo() { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -585,7 +576,6 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -600,7 +590,6 @@ bool HopkinsEngine::runLinuxDemo() { case 5: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { @@ -616,7 +605,6 @@ bool HopkinsEngine::runLinuxDemo() { case 6: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -631,7 +619,6 @@ bool HopkinsEngine::runLinuxDemo() { case 8: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; @@ -639,7 +626,6 @@ bool HopkinsEngine::runLinuxDemo() { case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) @@ -658,7 +644,6 @@ bool HopkinsEngine::runLinuxDemo() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -667,7 +652,6 @@ bool HopkinsEngine::runLinuxDemo() { case 12: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; @@ -680,7 +664,6 @@ bool HopkinsEngine::runLinuxDemo() { case 13: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; @@ -688,7 +671,6 @@ bool HopkinsEngine::runLinuxDemo() { case 14: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -702,7 +684,6 @@ bool HopkinsEngine::runLinuxDemo() { case 16: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { @@ -715,7 +696,6 @@ bool HopkinsEngine::runLinuxDemo() { case 25: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); break; @@ -723,7 +703,6 @@ bool HopkinsEngine::runLinuxDemo() { case 26: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); @@ -886,7 +865,6 @@ bool HopkinsEngine::runOS2Full() { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -918,7 +896,6 @@ bool HopkinsEngine::runOS2Full() { } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -933,7 +910,6 @@ bool HopkinsEngine::runOS2Full() { case 5: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[80]) { @@ -948,7 +924,6 @@ bool HopkinsEngine::runOS2Full() { case 6: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -963,7 +938,6 @@ bool HopkinsEngine::runOS2Full() { case 8: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; @@ -971,7 +945,6 @@ bool HopkinsEngine::runOS2Full() { case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); @@ -989,7 +962,6 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -998,7 +970,6 @@ bool HopkinsEngine::runOS2Full() { case 12: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[225]) { _globals.NOSPRECRAN = true; @@ -1010,7 +981,6 @@ bool HopkinsEngine::runOS2Full() { case 13: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; @@ -1018,7 +988,6 @@ bool HopkinsEngine::runOS2Full() { case 14: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -1032,7 +1001,6 @@ bool HopkinsEngine::runOS2Full() { case 16: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7); @@ -1045,7 +1013,6 @@ bool HopkinsEngine::runOS2Full() { case 17: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); @@ -1077,7 +1044,6 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); break; @@ -1085,7 +1051,6 @@ bool HopkinsEngine::runOS2Full() { case 19: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); @@ -1096,7 +1061,6 @@ bool HopkinsEngine::runOS2Full() { case 20: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -1122,7 +1086,6 @@ bool HopkinsEngine::runOS2Full() { case 22: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; @@ -1130,7 +1093,6 @@ bool HopkinsEngine::runOS2Full() { case 23: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; @@ -1138,7 +1100,6 @@ bool HopkinsEngine::runOS2Full() { case 24: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[181]) { if (_globals._saveData->data[181] == 1 ) @@ -1150,7 +1111,6 @@ bool HopkinsEngine::runOS2Full() { case 25: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); break; @@ -1158,7 +1118,6 @@ bool HopkinsEngine::runOS2Full() { case 26: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); break; @@ -1166,7 +1125,6 @@ bool HopkinsEngine::runOS2Full() { case 27: _globals.Max_Propre = 10; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -1179,7 +1137,6 @@ bool HopkinsEngine::runOS2Full() { case 28: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[166] != 1 || _globals._saveData->data[167] != 1 ) @@ -1191,7 +1148,6 @@ bool HopkinsEngine::runOS2Full() { case 29: _globals.Max_Propre = 60; _globals.Max_Ligne_Long = 50; - _globals.Max_Propre_Gen = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; @@ -1199,7 +1155,6 @@ bool HopkinsEngine::runOS2Full() { case 30: _globals.Max_Propre = 10; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -1213,7 +1168,6 @@ bool HopkinsEngine::runOS2Full() { case 32: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -1239,7 +1193,6 @@ bool HopkinsEngine::runOS2Full() { case 41: { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -1269,7 +1222,6 @@ bool HopkinsEngine::runOS2Full() { case 51: _globals.Max_Propre = 20; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); break; @@ -1277,7 +1229,6 @@ bool HopkinsEngine::runOS2Full() { case 52: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; @@ -1285,7 +1236,6 @@ bool HopkinsEngine::runOS2Full() { case 54: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; @@ -1293,7 +1243,6 @@ bool HopkinsEngine::runOS2Full() { case 55: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); @@ -1302,7 +1251,6 @@ bool HopkinsEngine::runOS2Full() { case 56: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -1311,7 +1259,6 @@ bool HopkinsEngine::runOS2Full() { case 57: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; @@ -1319,7 +1266,6 @@ bool HopkinsEngine::runOS2Full() { case 58: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -1328,7 +1274,6 @@ bool HopkinsEngine::runOS2Full() { case 59: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -1338,7 +1283,6 @@ bool HopkinsEngine::runOS2Full() { case 60: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -1355,7 +1299,6 @@ bool HopkinsEngine::runOS2Full() { case 62: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -1365,7 +1308,6 @@ bool HopkinsEngine::runOS2Full() { case 63: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -1375,7 +1317,6 @@ bool HopkinsEngine::runOS2Full() { case 64: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; @@ -1383,7 +1324,6 @@ bool HopkinsEngine::runOS2Full() { case 65: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -1393,7 +1333,6 @@ bool HopkinsEngine::runOS2Full() { case 66: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -1403,7 +1342,6 @@ bool HopkinsEngine::runOS2Full() { case 67: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -1413,7 +1351,6 @@ bool HopkinsEngine::runOS2Full() { case 68: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; @@ -1421,7 +1358,6 @@ bool HopkinsEngine::runOS2Full() { case 69: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -1431,7 +1367,6 @@ bool HopkinsEngine::runOS2Full() { case 70: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); @@ -1441,7 +1376,6 @@ bool HopkinsEngine::runOS2Full() { case 71: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -1451,7 +1385,6 @@ bool HopkinsEngine::runOS2Full() { case 73: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -1528,7 +1461,6 @@ bool HopkinsEngine::runOS2Full() { case 93: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26); @@ -1539,7 +1471,6 @@ bool HopkinsEngine::runOS2Full() { case 94: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; @@ -1547,7 +1478,6 @@ bool HopkinsEngine::runOS2Full() { case 95: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -1556,7 +1486,6 @@ bool HopkinsEngine::runOS2Full() { case 96: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -1565,7 +1494,6 @@ bool HopkinsEngine::runOS2Full() { case 97: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); @@ -1592,7 +1520,6 @@ bool HopkinsEngine::runOS2Full() { case 98: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; @@ -1600,7 +1527,6 @@ bool HopkinsEngine::runOS2Full() { case 99: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; @@ -1788,7 +1714,6 @@ bool HopkinsEngine::runBeOSFull() { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -1820,7 +1745,6 @@ bool HopkinsEngine::runBeOSFull() { } _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -1835,7 +1759,6 @@ bool HopkinsEngine::runBeOSFull() { case 5: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { @@ -1850,7 +1773,6 @@ bool HopkinsEngine::runBeOSFull() { case 6: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -1865,7 +1787,6 @@ bool HopkinsEngine::runBeOSFull() { case 8: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; @@ -1873,7 +1794,6 @@ bool HopkinsEngine::runBeOSFull() { case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) bombExplosion(); @@ -1890,7 +1810,6 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -1899,7 +1818,6 @@ bool HopkinsEngine::runBeOSFull() { case 12: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; @@ -1912,7 +1830,6 @@ bool HopkinsEngine::runBeOSFull() { case 13: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; @@ -1920,7 +1837,6 @@ bool HopkinsEngine::runBeOSFull() { case 14: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -1934,7 +1850,6 @@ bool HopkinsEngine::runBeOSFull() { case 16: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); @@ -1946,7 +1861,6 @@ bool HopkinsEngine::runBeOSFull() { case 17: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); @@ -1978,7 +1892,6 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); break; @@ -1986,7 +1899,6 @@ bool HopkinsEngine::runBeOSFull() { case 19: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); @@ -1997,7 +1909,6 @@ bool HopkinsEngine::runBeOSFull() { case 20: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -2023,7 +1934,6 @@ bool HopkinsEngine::runBeOSFull() { case 22: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; @@ -2031,7 +1941,6 @@ bool HopkinsEngine::runBeOSFull() { case 23: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; @@ -2039,7 +1948,6 @@ bool HopkinsEngine::runBeOSFull() { case 24: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) @@ -2052,7 +1960,6 @@ bool HopkinsEngine::runBeOSFull() { case 25: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); break; @@ -2060,7 +1967,6 @@ bool HopkinsEngine::runBeOSFull() { case 26: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); break; @@ -2068,7 +1974,6 @@ bool HopkinsEngine::runBeOSFull() { case 27: _globals.Max_Propre = 10; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -2080,7 +1985,6 @@ bool HopkinsEngine::runBeOSFull() { case 28: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) @@ -2092,7 +1996,6 @@ bool HopkinsEngine::runBeOSFull() { case 29: _globals.Max_Propre = 60; _globals.Max_Ligne_Long = 50; - _globals.Max_Propre_Gen = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; @@ -2100,7 +2003,6 @@ bool HopkinsEngine::runBeOSFull() { case 30: _globals.Max_Propre = 10; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -2114,7 +2016,6 @@ bool HopkinsEngine::runBeOSFull() { case 32: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -2140,7 +2041,6 @@ bool HopkinsEngine::runBeOSFull() { case 41: { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -2171,7 +2071,6 @@ bool HopkinsEngine::runBeOSFull() { case 51: _globals.Max_Propre = 20; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); break; @@ -2179,7 +2078,6 @@ bool HopkinsEngine::runBeOSFull() { case 52: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; @@ -2187,7 +2085,6 @@ bool HopkinsEngine::runBeOSFull() { case 54: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; @@ -2195,7 +2092,6 @@ bool HopkinsEngine::runBeOSFull() { case 55: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); @@ -2204,7 +2100,6 @@ bool HopkinsEngine::runBeOSFull() { case 56: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -2213,7 +2108,6 @@ bool HopkinsEngine::runBeOSFull() { case 57: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; @@ -2221,7 +2115,6 @@ bool HopkinsEngine::runBeOSFull() { case 58: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -2230,7 +2123,6 @@ bool HopkinsEngine::runBeOSFull() { case 59: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -2240,7 +2132,6 @@ bool HopkinsEngine::runBeOSFull() { case 60: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -2257,7 +2148,6 @@ bool HopkinsEngine::runBeOSFull() { case 62: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -2267,7 +2157,6 @@ bool HopkinsEngine::runBeOSFull() { case 63: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -2277,7 +2166,6 @@ bool HopkinsEngine::runBeOSFull() { case 64: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; @@ -2285,7 +2173,6 @@ bool HopkinsEngine::runBeOSFull() { case 65: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -2295,7 +2182,6 @@ bool HopkinsEngine::runBeOSFull() { case 66: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -2305,7 +2191,6 @@ bool HopkinsEngine::runBeOSFull() { case 67: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -2315,7 +2200,6 @@ bool HopkinsEngine::runBeOSFull() { case 68: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; @@ -2323,7 +2207,6 @@ bool HopkinsEngine::runBeOSFull() { case 69: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -2333,7 +2216,6 @@ bool HopkinsEngine::runBeOSFull() { case 70: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); @@ -2343,7 +2225,6 @@ bool HopkinsEngine::runBeOSFull() { case 71: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -2353,7 +2234,6 @@ bool HopkinsEngine::runBeOSFull() { case 73: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -2429,7 +2309,6 @@ bool HopkinsEngine::runBeOSFull() { case 93: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); @@ -2440,7 +2319,6 @@ bool HopkinsEngine::runBeOSFull() { case 94: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; @@ -2448,7 +2326,6 @@ bool HopkinsEngine::runBeOSFull() { case 95: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -2457,7 +2334,6 @@ bool HopkinsEngine::runBeOSFull() { case 96: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -2466,7 +2342,6 @@ bool HopkinsEngine::runBeOSFull() { case 97: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); @@ -2494,7 +2369,6 @@ bool HopkinsEngine::runBeOSFull() { case 98: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; @@ -2502,7 +2376,6 @@ bool HopkinsEngine::runBeOSFull() { case 99: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; @@ -2686,7 +2559,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -2724,7 +2596,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 450; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); break; @@ -2737,7 +2608,6 @@ bool HopkinsEngine::runWin95full() { case 5: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; if (_globals._saveData->data[svField80]) { @@ -2752,7 +2622,6 @@ bool HopkinsEngine::runWin95full() { case 6: _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 460; _globals.Max_Ligne_Long = 20; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); @@ -2768,7 +2637,6 @@ bool HopkinsEngine::runWin95full() { case 8: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; @@ -2776,7 +2644,6 @@ bool HopkinsEngine::runWin95full() { case 9: _globals.Max_Ligne_Long = 20; _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); @@ -2792,7 +2659,6 @@ bool HopkinsEngine::runWin95full() { case 11: _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; @@ -2801,7 +2667,6 @@ bool HopkinsEngine::runWin95full() { break; case 12: - _globals.Max_Propre_Gen = 10; _globals.Max_Ligne_Long = 20; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; @@ -2817,7 +2682,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; @@ -2825,7 +2689,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -2839,7 +2702,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Perso_Y = 450; _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!_globals._saveData->data[svField113]) { @@ -2849,7 +2711,6 @@ bool HopkinsEngine::runWin95full() { case 17: _globals.Max_Propre = 50; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.Max_Ligne_Long = 40; if (_globals._saveData->data[svField117] == 1) { @@ -2879,13 +2740,11 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); break; case 19: _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; if (_globals._saveData->data[svField123]) @@ -2897,7 +2756,6 @@ bool HopkinsEngine::runWin95full() { case 20: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -2919,7 +2777,6 @@ bool HopkinsEngine::runWin95full() { case 22: _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _globals.Max_Ligne_Long = 20; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); @@ -2927,7 +2784,6 @@ bool HopkinsEngine::runWin95full() { case 23: _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _globals.Max_Ligne_Long = 20; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); @@ -2936,7 +2792,6 @@ bool HopkinsEngine::runWin95full() { case 24: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) @@ -2948,7 +2803,6 @@ bool HopkinsEngine::runWin95full() { case 25: _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _globals.Max_Ligne_Long = 20; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); @@ -2958,13 +2812,11 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); break; case 27: _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; _globals.Max_Ligne_Long = 15; _globals.Max_Propre = 10; if (_globals._saveData->data[svField177] == 1) { @@ -2977,7 +2829,6 @@ bool HopkinsEngine::runWin95full() { case 28: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) @@ -2989,7 +2840,6 @@ bool HopkinsEngine::runWin95full() { case 29: _globals.Max_Propre = 60; _globals.Max_Ligne_Long = 50; - _globals.Max_Propre_Gen = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; @@ -2999,7 +2849,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 15; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); _globals.NOSPRECRAN = false; break; @@ -3010,7 +2859,6 @@ bool HopkinsEngine::runWin95full() { case 32: _globals.Max_Propre = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _globals.Max_Ligne_Long = 20; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); @@ -3035,8 +2883,7 @@ bool HopkinsEngine::runWin95full() { case 39: case 40: case 41: { - _globals.Max_Propre_Gen = 20; - _globals.fmusic = 13; + _globals.fmusic = 13; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; @@ -3066,7 +2913,6 @@ bool HopkinsEngine::runWin95full() { case 51: _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _globals.Max_Propre = 20; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); @@ -3075,7 +2921,6 @@ bool HopkinsEngine::runWin95full() { case 52: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; @@ -3084,7 +2929,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; @@ -3093,7 +2937,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Perso_Y = 460; _globals.Max_Ligne_Long = 30; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); break; @@ -3102,7 +2945,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); break; @@ -3110,7 +2952,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; @@ -3119,7 +2960,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); break; @@ -3128,7 +2968,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); _globals.NOSPRECRAN = false; break; @@ -3138,7 +2977,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); _globals.NOSPRECRAN = false; break; @@ -3155,7 +2993,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); _globals.NOSPRECRAN = false; break; @@ -3165,7 +3002,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); _globals.NOSPRECRAN = false; break; @@ -3174,7 +3010,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; @@ -3183,7 +3018,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); _globals.NOSPRECRAN = false; break; @@ -3193,7 +3027,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); _globals.NOSPRECRAN = false; break; @@ -3203,7 +3036,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); _globals.NOSPRECRAN = false; break; @@ -3212,7 +3044,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; @@ -3221,7 +3052,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); _globals.NOSPRECRAN = false; break; @@ -3231,7 +3061,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 8; _globals.NOSPRECRAN = true; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); _globals.NOSPRECRAN = false; break; @@ -3241,7 +3070,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); _globals.NOSPRECRAN = false; break; @@ -3249,7 +3077,6 @@ bool HopkinsEngine::runWin95full() { case 73: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -3325,7 +3152,6 @@ bool HopkinsEngine::runWin95full() { case 93: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); @@ -3337,7 +3163,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 440; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; @@ -3346,7 +3171,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = false; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); break; @@ -3355,7 +3179,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); break; @@ -3364,7 +3187,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals.NOSPRECRAN = true; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -3387,7 +3209,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; @@ -3395,7 +3216,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; _globals.Max_Perso_Y = 435; - _globals.Max_Propre_Gen = 5; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; @@ -3573,7 +3393,6 @@ bool HopkinsEngine::runLinuxFull() { case 1: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -3611,7 +3430,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -3626,7 +3444,6 @@ bool HopkinsEngine::runLinuxFull() { case 5: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { @@ -3641,7 +3458,6 @@ bool HopkinsEngine::runLinuxFull() { case 6: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -3656,7 +3472,6 @@ bool HopkinsEngine::runLinuxFull() { case 8: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; @@ -3664,7 +3479,6 @@ bool HopkinsEngine::runLinuxFull() { case 9: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) bombExplosion(); @@ -3681,7 +3495,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -3690,7 +3503,6 @@ bool HopkinsEngine::runLinuxFull() { case 12: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; @@ -3703,7 +3515,6 @@ bool HopkinsEngine::runLinuxFull() { case 13: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; @@ -3711,7 +3522,6 @@ bool HopkinsEngine::runLinuxFull() { case 14: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -3725,7 +3535,6 @@ bool HopkinsEngine::runLinuxFull() { case 16: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); @@ -3737,7 +3546,6 @@ bool HopkinsEngine::runLinuxFull() { case 17: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); @@ -3765,7 +3573,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); break; @@ -3773,7 +3580,6 @@ bool HopkinsEngine::runLinuxFull() { case 19: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); @@ -3784,7 +3590,6 @@ bool HopkinsEngine::runLinuxFull() { case 20: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 8; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -3807,7 +3612,6 @@ bool HopkinsEngine::runLinuxFull() { case 22: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; @@ -3815,7 +3619,6 @@ bool HopkinsEngine::runLinuxFull() { case 23: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; @@ -3823,7 +3626,6 @@ bool HopkinsEngine::runLinuxFull() { case 24: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) @@ -3836,7 +3638,6 @@ bool HopkinsEngine::runLinuxFull() { case 25: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); break; @@ -3844,7 +3645,6 @@ bool HopkinsEngine::runLinuxFull() { case 26: _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); break; @@ -3852,7 +3652,6 @@ bool HopkinsEngine::runLinuxFull() { case 27: _globals.Max_Propre = 10; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -3864,7 +3663,6 @@ bool HopkinsEngine::runLinuxFull() { case 28: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) @@ -3876,7 +3674,6 @@ bool HopkinsEngine::runLinuxFull() { case 29: _globals.Max_Propre = 60; _globals.Max_Ligne_Long = 50; - _globals.Max_Propre_Gen = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; @@ -3884,7 +3681,6 @@ bool HopkinsEngine::runLinuxFull() { case 30: _globals.Max_Propre = 10; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -3898,7 +3694,6 @@ bool HopkinsEngine::runLinuxFull() { case 32: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 20; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -3925,7 +3720,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.fmusic = 13; _globals.Max_Propre = 50; _globals.Max_Ligne_Long = 40; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -3955,7 +3749,6 @@ bool HopkinsEngine::runLinuxFull() { case 51: _globals.Max_Propre = 20; _globals.Max_Ligne_Long = 10; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); break; @@ -3963,7 +3756,6 @@ bool HopkinsEngine::runLinuxFull() { case 52: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; @@ -3971,7 +3763,6 @@ bool HopkinsEngine::runLinuxFull() { case 54: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; @@ -3979,7 +3770,6 @@ bool HopkinsEngine::runLinuxFull() { case 55: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 460; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); @@ -3988,7 +3778,6 @@ bool HopkinsEngine::runLinuxFull() { case 56: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -3997,7 +3786,6 @@ bool HopkinsEngine::runLinuxFull() { case 57: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; @@ -4005,7 +3793,6 @@ bool HopkinsEngine::runLinuxFull() { case 58: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -4014,7 +3801,6 @@ bool HopkinsEngine::runLinuxFull() { case 59: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -4024,7 +3810,6 @@ bool HopkinsEngine::runLinuxFull() { case 60: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -4041,7 +3826,6 @@ bool HopkinsEngine::runLinuxFull() { case 62: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -4051,7 +3835,6 @@ bool HopkinsEngine::runLinuxFull() { case 63: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -4061,7 +3844,6 @@ bool HopkinsEngine::runLinuxFull() { case 64: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; @@ -4069,7 +3851,6 @@ bool HopkinsEngine::runLinuxFull() { case 65: _globals.Max_Propre = 40; _globals.Max_Ligne_Long = 30; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -4079,7 +3860,6 @@ bool HopkinsEngine::runLinuxFull() { case 66: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -4089,7 +3869,6 @@ bool HopkinsEngine::runLinuxFull() { case 67: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -4099,7 +3878,6 @@ bool HopkinsEngine::runLinuxFull() { case 68: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; @@ -4107,7 +3885,6 @@ bool HopkinsEngine::runLinuxFull() { case 69: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -4117,7 +3894,6 @@ bool HopkinsEngine::runLinuxFull() { case 70: _globals.Max_Propre = 8; _globals.Max_Ligne_Long = 8; - _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); @@ -4127,7 +3903,6 @@ bool HopkinsEngine::runLinuxFull() { case 71: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -4137,7 +3912,6 @@ bool HopkinsEngine::runLinuxFull() { case 73: _globals.Max_Propre = 15; _globals.Max_Ligne_Long = 15; - _globals.Max_Propre_Gen = 10; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -4213,7 +3987,6 @@ bool HopkinsEngine::runLinuxFull() { case 93: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); @@ -4224,7 +3997,6 @@ bool HopkinsEngine::runLinuxFull() { case 94: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; @@ -4232,7 +4004,6 @@ bool HopkinsEngine::runLinuxFull() { case 95: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -4241,7 +4012,6 @@ bool HopkinsEngine::runLinuxFull() { case 96: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -4250,7 +4020,6 @@ bool HopkinsEngine::runLinuxFull() { case 97: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); @@ -4274,7 +4043,6 @@ bool HopkinsEngine::runLinuxFull() { case 98: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; @@ -4282,7 +4050,6 @@ bool HopkinsEngine::runLinuxFull() { case 99: _globals.Max_Propre = 5; _globals.Max_Ligne_Long = 5; - _globals.Max_Propre_Gen = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8918924c23..9d2cae2cda 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2263,7 +2263,6 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager._gameKey = KEY_NONE; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; - _vm->_globals.Max_Propre_Gen = 1; _vm->_globals.Max_Perso_Y = 440; _vm->_globals.NOSPRECRAN = true; _vm->_globals.PLAN_FLAG = true; -- cgit v1.2.3 From b270942f6e6aa8a84cf48a0d77a4e822cc26c79e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 15:27:05 +0200 Subject: HOPKINS: Remove more unused global variables --- engines/hopkins/font.cpp | 2 -- engines/hopkins/globals.cpp | 7 ------- engines/hopkins/globals.h | 2 -- 3 files changed, 11 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 7d98742be3..b3222716e7 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -196,10 +196,8 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in Common::fill(&_tempText[0], &_tempText[2058], 0); f.read(_tempText, 2048); f.close(); - _vm->_globals.texte_long = 2048; } else { v69 = 100; - _vm->_globals.texte_long = 100; v9 = _vm->_globals.allocMemory(110); Common::fill(&v9[0], &v9[110], 0); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 7d1786a0fd..83658b6c14 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -126,7 +126,6 @@ Globals::Globals() { _lastDirection = 0; police_l = police_h = 0; TETE = NULL; - texte_long = 0; _curObjectIndex = 0; NUM_FICHIER_OBJ = 0; nbrligne = 0; @@ -187,7 +186,6 @@ Globals::Globals() { BUF_ZONE = NULL; for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = NULL; - texte_tmp = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; BUFFERTAPE = NULL; @@ -242,7 +240,6 @@ Globals::~Globals() { freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); - freeMemory(texte_tmp); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); freeMemory(BUFFERTAPE); @@ -327,8 +324,6 @@ void Globals::clearAll() { nbrligne = 80; INIT_ANIM(); - texte_tmp = g_PTRNUL; - texte_long = 0; police = g_PTRNUL; police_h = 0; police_l = 0; @@ -377,8 +372,6 @@ void Globals::clearAll() { CarreZone[idx].field0 = 0; } - texte_long = 0; - texte_tmp = g_PTRNUL; BUFFERTAPE = allocMemory(85000); _saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde)); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index ddc64df078..c72abe983e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -360,8 +360,6 @@ public: byte *TETE; byte *ICONE; byte *BUF_ZONE; - byte *texte_tmp; - int texte_long; byte *SPRITE_ECRAN; Sauvegarde *_saveData; byte *BUFFERTAPE; -- cgit v1.2.3 From bd865d9741878b56a86c1389e66dfdee24ba1e39 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 16:17:27 +0200 Subject: HOPKINS: Remove static game directory configuration options Also, remove the unused VGA folder. This is the first step to remove constructFilename() and associated functions. --- engines/hopkins/anim.cpp | 16 ++++++------ engines/hopkins/computer.cpp | 22 ++++++++-------- engines/hopkins/dialogs.cpp | 22 ++++++++-------- engines/hopkins/files.cpp | 48 ++++++++++++++++------------------ engines/hopkins/font.cpp | 2 +- engines/hopkins/globals.cpp | 20 +++----------- engines/hopkins/globals.h | 13 ---------- engines/hopkins/graphics.cpp | 20 +++++++------- engines/hopkins/hopkins.cpp | 62 ++++++++++++++++++++++---------------------- engines/hopkins/menu.cpp | 8 +++--- engines/hopkins/objects.cpp | 38 +++++++++++++-------------- engines/hopkins/script.cpp | 4 +-- engines/hopkins/sound.cpp | 26 +++++++++---------- engines/hopkins/talk.cpp | 16 ++++++------ 14 files changed, 143 insertions(+), 174 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 302c2f7913..1630de3fe7 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -58,7 +58,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui byte *screenP = _vm->_graphicsManager._vesaScreen; byte *ptr = _vm->_globals.allocMemory(20); - _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); + _vm->_fileManager.constructFilename("ANM", filename); if (!f.open(_vm->_globals._curFilename)) error("File not found - %s", _vm->_globals._curFilename.c_str()); @@ -233,7 +233,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint screenP = _vm->_graphicsManager._vesaScreen; ptr = _vm->_globals.allocMemory(20); - _vm->_fileManager.constructFilename(_vm->_globals.HOPANM, filename); + _vm->_fileManager.constructFilename("ANM", filename); if (!f.open(_vm->_globals._curFilename)) error("Error opening file - %s", _vm->_globals._curFilename.c_str()); @@ -470,7 +470,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { clearAnim(); Common::String filename = animName + ".ANI"; - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + _vm->_fileManager.constructFilename("ANIM", filename); Common::File f; if (!f.open(_vm->_globals._curFilename)) @@ -495,7 +495,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { for (int idx = 0; idx <= 5; ++idx) { if (files[idx][0]) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, files[idx]); + _vm->_fileManager.constructFilename("ANIM", files[idx]); if (!f.exists(_vm->_globals._curFilename)) error("File not found"); @@ -539,7 +539,7 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *v13; byte *v19; int result = 0; - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + _vm->_fileManager.constructFilename("ANIM", filename); _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals._curFilename); _vm->_globals.Bank[idx]._loadedFl = true; _vm->_globals.Bank[idx]._filename = filename; @@ -581,7 +581,7 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { } while (ch != '.'); ofsFilename += ".OFS"; - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, ofsFilename); + _vm->_fileManager.constructFilename("ANIM", ofsFilename); Common::File f; if (f.exists(_vm->_globals._curFilename)) { v19 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); @@ -727,7 +727,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } screenP = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(22); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); + _vm->_fileManager.constructFilename("SEQ", file); if (!f.open(_vm->_globals._curFilename)) error("Error opening file - %s", _vm->_globals._curFilename.c_str()); @@ -883,7 +883,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._mouseFl = false; screenP = _vm->_graphicsManager._vesaScreen; v11 = _vm->_globals.allocMemory(22); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSEQ, file); + _vm->_fileManager.constructFilename("SEQ", file); if (!f.open(_vm->_globals._curFilename)) error("File not found - %s", _vm->_globals._curFilename.c_str()); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 3df0455536..7aa17c9788 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -78,7 +78,7 @@ void ComputerManager::setTextMode() { //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "STFONT.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "STFONT.SPR"); _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.police_l = 8; @@ -328,8 +328,8 @@ static char _frenchText[] = */ void ComputerManager::loadMenu() { char *ptr; - if (!_vm->_fileManager.fileExists(_vm->_globals.HOPLINK, "COMPUTAN.TXT")) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); + if (!_vm->_fileManager.fileExists("LINK", "COMPUTAN.TXT")) { + _vm->_fileManager.constructFilename("LINK", "COMPUTAN.TXT"); ptr = (char *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); } else if (_vm->_globals._language == LANG_FR) { ptr = (char *)_vm->_globals.allocMemory(sizeof(_frenchText)); @@ -445,7 +445,7 @@ void ComputerManager::outText2(const Common::String &msg) { */ void ComputerManager::restoreFBIRoom() { _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FONTE3.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "FONTE3.SPR"); _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.police_l = 12; @@ -460,11 +460,11 @@ void ComputerManager::readText(int idx) { _vm->_eventsManager._escKeyFl = false; if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKAN.TXT"); + _vm->_fileManager.constructFilename("LINK", "THOPKAN.TXT"); else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPK.TXT"); + _vm->_fileManager.constructFilename("LINK", "THOPK.TXT"); else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKES.TXT"); + _vm->_fileManager.constructFilename("LINK", "THOPKES.TXT"); byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); uint16 fileSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); @@ -528,7 +528,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_soundManager.loadSample(1, "SOUND37.WAV"); _vm->_soundManager.loadSample(2, "SOUND38.WAV"); _vm->_soundManager.loadSample(3, "SOUND39.WAV"); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "CASSE.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "CASSE.SPR"); _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); loadHiscore(); setModeVGA256(); @@ -615,7 +615,7 @@ void ComputerManager::newLevel() { while (!_vm->shouldQuit()) { file = Common::String::format("TAB%d.TAB", _breakoutLevelNbr); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, file); + _vm->_fileManager.constructFilename("SYSTEM", file); if (f.open(_vm->_globals._curFilename)) break; @@ -789,7 +789,7 @@ int ComputerManager::displayHiscores() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); loadHiscore(); _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "ALPHA.SPR"); byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -841,7 +841,7 @@ void ComputerManager::getScoreName() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "ALPHA.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "ALPHA.SPR"); byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_graphicsManager.fadeInBreakout(); for (int strPos = 0; strPos <= 4; strPos++) { diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 77258a8274..055664db23 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -60,11 +60,11 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIFR.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "OPTIFR.SPR"); else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIAN.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "OPTIAN.SPR"); else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "OPTIES.SPR"); _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals._optionDialogFl = true; @@ -320,13 +320,13 @@ LABEL_7: switch (_vm->_globals._language) { case LANG_EN: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTAN.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "INVENTAN.SPR"); break; case LANG_FR: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTFR.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "INVENTFR.SPR"); break; case LANG_SP: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTES.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "INVENTES.SPR"); break; } @@ -339,7 +339,7 @@ LABEL_7: _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); f.close(); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENT2.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "INVENT2.SPR"); _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); int v19 = _inventX = _vm->_graphicsManager._scrollOffset + 152; @@ -618,18 +618,18 @@ void DialogsManager::showSaveLoad(int a1) { switch (_vm->_globals._language) { case LANG_EN: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEAN.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "SAVEAN.SPR"); break; case LANG_FR: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEFR.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "SAVEFR.SPR"); break; case LANG_SP: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEES.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "SAVEES.SPR"); break; } _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVE2.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "SAVE2.SPR"); _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index f0238205fd..e061b9c2d4 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -72,8 +72,8 @@ void FileManager::initCensorship() { _vm->_globals._censorshipFl = false; // If file doesn't exist, fallback to uncensored - if (!fileExists(_vm->_globals.HOPSYSTEM, "BLOOD.DAT")) { - constructFilename(_vm->_globals.HOPSYSTEM, "BLOOD.DAT"); + if (!fileExists("SYSTEM", "BLOOD.DAT")) { + constructFilename("SYSTEM", "BLOOD.DAT"); char *data = (char *)loadFile(_vm->_globals._curFilename); if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K')) @@ -97,19 +97,15 @@ void FileManager::constructFilename(const Common::String &folder, const Common:: // check for animations that don't exist in the ANM folder, but rather in special // sub-folders depending on the physical screen resolution being used. - if (folder == _vm->_globals.HOPANM) { + if (folder == "ANM") { switch (_vm->_globals.SVGA) { case 1: if (fileExists(folderToUse, file)) - folderToUse = _vm->_globals.HOPTSVGA; + folderToUse = "TSVGA"; break; case 2: if (fileExists(folderToUse, file)) - folderToUse = _vm->_globals.HOPSVGA; - break; - case 3: - if (fileExists(folderToUse, file)) - folderToUse = _vm->_globals.HOPVGA; + folderToUse = "SVGA"; break; default: break; @@ -150,52 +146,52 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { switch (a2) { case 1: - constructFilename(_vm->_globals.HOPLINK, "RES_INI.CAT"); + constructFilename("LINK", "RES_INI.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; ptr = loadFile(_vm->_globals._curFilename); - constructFilename(_vm->_globals.HOPLINK, "RES_INI.RES"); + constructFilename("LINK", "RES_INI.RES"); break; case 2: - constructFilename(_vm->_globals.HOPLINK, "RES_REP.CAT"); + constructFilename("LINK", "RES_REP.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; ptr = loadFile(_vm->_globals._curFilename); - constructFilename(_vm->_globals.HOPLINK, "RES_REP.RES"); + constructFilename("LINK", "RES_REP.RES"); break; case 3: - constructFilename(_vm->_globals.HOPLINK, "RES_LIN.CAT"); + constructFilename("LINK", "RES_LIN.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; ptr = loadFile(_vm->_globals._curFilename); - constructFilename(_vm->_globals.HOPLINK, "RES_LIN.RES"); + constructFilename("LINK", "RES_LIN.RES"); break; case 4: - constructFilename(_vm->_globals.HOPANIM, "RES_ANI.CAT"); + constructFilename("ANIM", "RES_ANI.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; ptr = loadFile(_vm->_globals._curFilename); - constructFilename(_vm->_globals.HOPANIM, "RES_ANI.RES"); + constructFilename("ANIM", "RES_ANI.RES"); break; case 5: - constructFilename(_vm->_globals.HOPANIM, "RES_PER.CAT"); + constructFilename("ANIM", "RES_PER.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; ptr = loadFile(_vm->_globals._curFilename); - constructFilename(_vm->_globals.HOPANIM, "RES_PER.RES"); + constructFilename("ANIM", "RES_PER.RES"); break; case 6: - constructFilename(_vm->_globals.HOPIMAGE, "PIC.CAT"); + constructFilename("BUFFER", "PIC.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; @@ -203,7 +199,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { break; case 7: - constructFilename(_vm->_globals.HOPANIM, "RES_SAN.CAT"); + constructFilename("ANIM", "RES_SAN.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; @@ -211,7 +207,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { break; case 8: - constructFilename(_vm->_globals.HOPLINK, "RES_SLI.CAT"); + constructFilename("LINK", "RES_SLI.CAT"); if (!f.exists(_vm->_globals._curFilename)) return g_PTRNUL; @@ -220,18 +216,18 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { case 9: if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "ENG_VOI.RES"); + _vm->_fileManager.constructFilename("VOICE", "ENG_VOI.RES"); // Win95 and Linux versions uses another set of names else { switch (_vm->_globals._language) { case LANG_EN: - constructFilename(_vm->_globals.HOPLINK, "RES_VAN.CAT"); + constructFilename("LINK", "RES_VAN.CAT"); break; case LANG_FR: - constructFilename(_vm->_globals.HOPLINK, "RES_VFR.CAT"); + constructFilename("LINK", "RES_VFR.CAT"); break; case LANG_SP: - constructFilename(_vm->_globals.HOPLINK, "RES_VES.CAT"); + constructFilename("LINK", "RES_VES.CAT"); break; } } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index b3222716e7..da81b7bf03 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -165,7 +165,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _textSortArray[v62] = 0; _text[idx]._textLoadedFl = true; - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename("LINK", filename); file = _vm->_globals._curFilename; if (strncmp(file.c_str(), _oldName.c_str(), strlen(file.c_str())) != 0) { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 83658b6c14..f3ee56be87 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -263,20 +263,6 @@ void Globals::setParent(HopkinsEngine *vm) { } void Globals::setConfig() { - HOPIMAGE = "BUFFER"; - HOPANIM = "ANIM"; - HOPLINK = "LINK"; - HOPSAVE = "SAVE"; - HOPSOUND = "SOUND"; - HOPMUSIC = "MUSIC"; - HOPVOICE = "VOICE"; - HOPANM = "ANM"; - HOPTSVGA = "TSVGA"; - HOPSVGA = "SVGA"; - HOPVGA = "VGA"; - HOPSEQ = "SEQ"; - HOPSYSTEM = "SYSTEM"; - // CHECKME: Should be in Globals() but it doesn't work // The Polish version is a translation of the English version. The filenames are the same. switch (_vm->getLanguage()) { @@ -451,7 +437,7 @@ void Globals::CLEAR_VBOB() { // Load Object void Globals::loadObjects() { - _vm->_fileManager.constructFilename(HOPSYSTEM, "OBJET.DAT"); + _vm->_fileManager.constructFilename("SYSTEM", "OBJET.DAT"); byte *data = _vm->_fileManager.loadFile(_curFilename); byte *srcP = data; @@ -530,11 +516,11 @@ void Globals::loadCache(const Common::String &file) { Common::File f; resetCache(); - _vm->_fileManager.constructFilename(HOPLINK, file); + _vm->_fileManager.constructFilename("LINK", file); ptr = _vm->_fileManager.loadFile(_curFilename); v16 = Common::String((const char *)ptr); - _vm->_fileManager.constructFilename(HOPLINK, v16); + _vm->_fileManager.constructFilename("LINK", v16); if (!f.exists(_curFilename)) return; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c72abe983e..fdf1b4e866 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -334,19 +334,6 @@ public: bool PUBEXIT; int PERSO_TYPE; uint _speed; - Common::String HOPIMAGE; - Common::String HOPANIM; - Common::String HOPLINK; - Common::String HOPSAVE; - Common::String HOPSOUND; - Common::String HOPMUSIC; - Common::String HOPVOICE; - Common::String HOPANM; - Common::String HOPTSVGA; - Common::String HOPSVGA; - Common::String HOPVGA; - Common::String HOPSEQ; - Common::String HOPSYSTEM; Common::String FICH_ZONE; Common::String FICH_TEXTE; Common::String _curFilename; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 828fc2d3ad..f66b4882a8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -163,7 +163,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { lockScreen(); clearScreen(); unlockScreen(); - _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); + _vm->_fileManager.constructFilename("BUFFER", file); A_PCX320(_vesaScreen, _vm->_globals._curFilename, _palette); memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); @@ -184,7 +184,7 @@ void GraphicsManager::loadScreen(const Common::String &file) { bool flag = true; if (_vm->_fileManager.searchCat(file, 6) == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); + _vm->_fileManager.constructFilename("BUFFER", file); if (!f.open(_vm->_globals._curFilename)) error("loadScreen - %s", file.c_str()); @@ -301,16 +301,16 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by if (typeFlag) { // Load PCX from within the PIC resource - _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, "PIC.RES"); + _vm->_fileManager.constructFilename("BUFFER", "PIC.RES"); if (!f.open(_vm->_globals._curFilename)) - error("(nom)Erreur en cours de lecture."); + error("Error opening PIC.RES."); f.seek(_vm->_globals._catalogPos); } else { // Load stand alone PCX file - _vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file); + _vm->_fileManager.constructFilename("BUFFER", file); if (!f.open(_vm->_globals._curFilename)) - error("(nom)Erreur en cours de lecture."); + error("Error opening PCX %s.", file.c_str()); } // Decode the PCX @@ -1767,7 +1767,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { byte *ptr = _vm->_fileManager.searchCat(filename, 1); if (ptr == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename("LINK", filename); ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (!mode) { @@ -1776,9 +1776,9 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (!_vm->_globals.NOSPRECRAN) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename("LINK", filename); } else { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); + _vm->_fileManager.constructFilename("LINK", "RES_SLI.RES"); } _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } @@ -1814,7 +1814,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { byte *dataP = _vm->_fileManager.searchCat(filename, 2); _vm->_globals.COUCOU = dataP; if (g_PTRNUL == dataP) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename("LINK", filename); dataP = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.COUCOU = dataP; } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1b181bee52..536220caa3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -179,7 +179,7 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Init_Interrupt_();"); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; @@ -491,7 +491,7 @@ bool HopkinsEngine::runLinuxDemo() { playIntro(); _globals.iRegul = 0; - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; @@ -843,7 +843,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.loadImage("H2"); _graphicsManager.fadeInLong(); _globals.iRegul = 0; - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; @@ -1200,7 +1200,7 @@ bool HopkinsEngine::runOS2Full() { Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); + _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } @@ -1645,7 +1645,7 @@ bool HopkinsEngine::runOS2Full() { _soundManager.WSOUND(23); _globals._exitId = handleBaseMap(); // _soundManager.WSOUND_OFF(); - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; @@ -1688,7 +1688,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.fadeInLong(); _graphicsManager.fadeOutLong(); _globals.iRegul = 0; - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; @@ -2048,7 +2048,7 @@ bool HopkinsEngine::runBeOSFull() { Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); + _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } @@ -2494,7 +2494,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.WSOUND(23); _globals._exitId = handleBaseMap(); _soundManager.WSOUND_OFF(); - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; @@ -2531,7 +2531,7 @@ bool HopkinsEngine::runWin95full() { _eventsManager.delay(500); _graphicsManager.fadeOutLong(); _globals.iRegul = 0; - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; @@ -2893,7 +2893,7 @@ bool HopkinsEngine::runWin95full() { Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); + _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } @@ -3326,7 +3326,7 @@ bool HopkinsEngine::runWin95full() { _globals._exitId = WBASE(); _soundManager.WSOUND_OFF(); warning("TODO: heapshrink();"); - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; @@ -3367,7 +3367,7 @@ bool HopkinsEngine::runLinuxFull() { playIntro(); _globals.iRegul = 0; - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; @@ -3727,7 +3727,7 @@ bool HopkinsEngine::runLinuxFull() { Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename(_globals.HOPSYSTEM, "HOPDEG.SPR"); + _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } @@ -4161,7 +4161,7 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND(23); _globals._exitId = handleBaseMap(); _soundManager.WSOUND_OFF(); - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; @@ -4195,18 +4195,18 @@ void HopkinsEngine::initializeSystem() { switch (_globals._language) { case LANG_EN: if (!_eventsManager._mouseLinuxFl) - _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUAN.SPR"); + _fileManager.constructFilename("SYSTEM", "SOUAN.SPR"); else - _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUAN.SPR"); + _fileManager.constructFilename("SYSTEM", "LSOUAN.SPR"); break; case LANG_FR: if (!_eventsManager._mouseLinuxFl) - _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUFR.SPR"); + _fileManager.constructFilename("SYSTEM", "SOUFR.SPR"); else - _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUFR.SPR"); + _fileManager.constructFilename("SYSTEM", "LSOUFR.SPR"); break; case LANG_SP: - _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUES.SPR"); + _fileManager.constructFilename("SYSTEM", "SOUES.SPR"); break; } @@ -4221,26 +4221,26 @@ void HopkinsEngine::initializeSystem() { _globals.clearAll(); - _fileManager.constructFilename(_globals.HOPSYSTEM, "FONTE3.SPR"); + _fileManager.constructFilename("SYSTEM", "FONTE3.SPR"); _globals.police = _fileManager.loadFile(_globals._curFilename); _globals.police_l = 12; _globals.police_h = 21; - _fileManager.constructFilename(_globals.HOPSYSTEM, "ICONE.SPR"); + _fileManager.constructFilename("SYSTEM", "ICONE.SPR"); _globals.ICONE = _fileManager.loadFile(_globals._curFilename); - _fileManager.constructFilename(_globals.HOPSYSTEM, "TETE.SPR"); + _fileManager.constructFilename("SYSTEM", "TETE.SPR"); _globals.TETE = _fileManager.loadFile(_globals._curFilename); switch (_globals._language) { case LANG_EN: - _fileManager.constructFilename(_globals.HOPLINK, "ZONEAN.TXT"); + _fileManager.constructFilename("LINK", "ZONEAN.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); break; case LANG_FR: - _fileManager.constructFilename(_globals.HOPLINK, "ZONE01.TXT"); + _fileManager.constructFilename("LINK", "ZONE01.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); break; case LANG_SP: - _fileManager.constructFilename(_globals.HOPLINK, "ZONEES.TXT"); + _fileManager.constructFilename("LINK", "ZONEES.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); break; } @@ -4899,7 +4899,7 @@ void HopkinsEngine::playEnding() { _globals.iRegul = 0; _globals._exitId = 300; } - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; @@ -5079,13 +5079,13 @@ void HopkinsEngine::loadCredits() { _globals.Credit_step = 45; switch (_globals._language) { case LANG_EN: - _fileManager.constructFilename(_globals.HOPLINK, "CREAN.TXT"); + _fileManager.constructFilename("LINK", "CREAN.TXT"); break; case LANG_FR: - _fileManager.constructFilename(_globals.HOPLINK, "CREFR.TXT"); + _fileManager.constructFilename("LINK", "CREFR.TXT"); break; case LANG_SP: - _fileManager.constructFilename(_globals.HOPLINK, "CREES.TXT"); + _fileManager.constructFilename("LINK", "CREES.TXT"); break; default: error("Unhandled language"); @@ -5443,7 +5443,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._exitId = 0; _globals._disableInventFl = true; _soundManager.WSOUND(soundId); - _fileManager.constructFilename(_globals.HOPSYSTEM, "VAISSEAU.SPR"); + _fileManager.constructFilename("SYSTEM", "VAISSEAU.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); if (backgroundFilename.size()) _graphicsManager.loadImage(backgroundFilename); @@ -5529,7 +5529,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager.fadeOutLong(); _objectsManager.removeSprite(0); _objectsManager.CLEAR_ECRAN(); - _fileManager.constructFilename(_globals.HOPSYSTEM, "PERSO.SPR"); + _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; } diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index c39518c7fd..582b7a16f9 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -85,13 +85,13 @@ int MenuManager::menu() { _vm->_graphicsManager.fadeInLong(); if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENU.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "MENU.SPR"); else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUAN.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "MENUAN.SPR"); else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUFR.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "MENUFR.SPR"); else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "MENUES.SPR"); spriteData = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_eventsManager.mouseOn(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9d2cae2cda..9fc3461270 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -118,7 +118,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OBJET1.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "OBJET1.SPR"); _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite(_vm->_globals._curFilename); } _vm->_globals.NUM_FICHIER_OBJ = val1; @@ -2077,7 +2077,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager._linesNumb = 0; _lastLine = 0; - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); + _vm->_fileManager.constructFilename("LINK", file); ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v4 = 0; v5 = 0; @@ -2132,7 +2132,7 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_globals.ZONEP[i].field10 = 0; } - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); + _vm->_fileManager.constructFilename("LINK", file); Common::File f; if (!f.exists(_vm->_globals._curFilename)) @@ -2277,7 +2277,7 @@ void ObjectsManager::PLAN_BETA() { CHARGE_OBSTACLE("PLAN.OB2"); _vm->_globals.loadCache("PLAN.CA2"); loadZone("PLAN.ZO2"); - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "VOITURE.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "VOITURE.SPR"); _spritePtr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); @@ -2742,7 +2742,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha T_RECTIF = 0; loc = &_vm->_globals._saveData->_realHopkins; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); @@ -2768,7 +2768,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals._saveData->data[svField357] = 0; loc = &_vm->_globals._saveData->_samantha; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PSAMAN.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 2; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); @@ -3747,7 +3747,7 @@ void ObjectsManager::OPTI_OBJET() { file = "OBJET1.ini"; data = _vm->_fileManager.searchCat(file, 1); if (data == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); + _vm->_fileManager.constructFilename("LINK", file); data = _vm->_fileManager.loadFile(_vm->_globals._curFilename); if (data == g_PTRNUL) error("INI file %s not found", file.c_str()); @@ -3970,7 +3970,7 @@ void ObjectsManager::ACTION_DOS(int idx) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 1; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "DOS.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "DOS.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) @@ -3999,7 +3999,7 @@ void ObjectsManager::ACTION_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PROFIL.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) @@ -4028,7 +4028,7 @@ void ObjectsManager::Q_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "3Q.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) @@ -4057,7 +4057,7 @@ void ObjectsManager::ACTION_FACE(int idx) { if (_vm->_globals.GESTE_FLAG != 2) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "FACE.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "FACE.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) @@ -4074,7 +4074,7 @@ void ObjectsManager::Q_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "3Q.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "3Q.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) @@ -4103,7 +4103,7 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PROFIL.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PROFIL.SPR"); _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } if (idx == 1) @@ -4251,7 +4251,7 @@ void ObjectsManager::INILINK(const Common::String &file) { ptr = _vm->_fileManager.searchCat(filename, 3); nbytes = _vm->_globals._catalogSize; if (ptr == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename); + _vm->_fileManager.constructFilename("LINK", filename); if (!f.open(_vm->_globals._curFilename)) error("Error opening file - %s", _vm->_globals._curFilename.c_str()); @@ -4274,9 +4274,9 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, filename2); + _vm->_fileManager.constructFilename("LINK", filename2); } else { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "RES_SLI.RES"); + _vm->_fileManager.constructFilename("LINK", "RES_SLI.RES"); } _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals._curFilename); @@ -5100,20 +5100,20 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); if (_vm->_globals.PERSO_TYPE) { if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; } } if (!_vm->_globals.PERSO_TYPE) { if (_vm->_globals._saveData->data[svField122] == 1) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "HOPFEM.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 1; } } if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->data[svField356] == 1) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PSAMAN.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PSAMAN.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 2; } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 941abebe22..3077393d61 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -918,7 +918,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 56: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "HOPFEM.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 1; _vm->_globals._saveData->data[svField122] = 1; @@ -929,7 +929,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 57: - _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR"); + _vm->_fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_globals.PERSO_TYPE = 0; _vm->_globals._saveData->data[svField122] = 0; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index cf06046bbe..a55ef4d442 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -380,7 +380,7 @@ void SoundManager::PLAY_MOD(const Common::String &file) { modFile += "2"; } } - _vm->_fileManager.constructFilename(_vm->_globals.HOPMUSIC, modFile); + _vm->_fileManager.constructFilename("MUSIC", modFile); if (MOD_FLAG) { stopMusic(); delMusic(); @@ -520,34 +520,34 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "ENG_VOI.RES"); + _vm->_fileManager.constructFilename("VOICE", "ENG_VOI.RES"); // Win95 and Linux versions uses another set of names else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); + _vm->_fileManager.constructFilename("VOICE", "RES_VFR.RES"); else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); + _vm->_fileManager.constructFilename("VOICE", "RES_VAN.RES"); else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); + _vm->_fileManager.constructFilename("VOICE", "RES_VES.RES"); catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "ENG_VOI.RES"); + _vm->_fileManager.constructFilename("VOICE", "ENG_VOI.RES"); // Win95 and Linux versions uses another set of names else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); + _vm->_fileManager.constructFilename("VOICE", "RES_VFR.RES"); else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); + _vm->_fileManager.constructFilename("VOICE", "RES_VAN.RES"); else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); + _vm->_fileManager.constructFilename("VOICE", "RES_VES.RES"); catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else { - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".WAV"); + _vm->_fileManager.constructFilename("VOICE", filename + ".WAV"); if (!f.exists(_vm->_globals._curFilename)) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, filename + ".APC"); + _vm->_fileManager.constructFilename("VOICE", filename + ".APC"); if (!f.exists(_vm->_globals._curFilename)) return false; } @@ -626,7 +626,7 @@ void SoundManager::MODSetMusicVolume(int volume) { } void SoundManager::loadSample(int wavIndex, const Common::String &file) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); + _vm->_fileManager.constructFilename("SOUND", file); LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals._curFilename, 0); SOUND[wavIndex]._active = true; } @@ -758,7 +758,7 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPSOUND, file); + _vm->_fileManager.constructFilename("SOUND", file); LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals._curFilename, 1); } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 930e87df6c..38677d5fff 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -62,7 +62,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterBuffer = _vm->_fileManager.searchCat(filename, 5); _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + _vm->_fileManager.constructFilename("ANIM", filename); _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); } @@ -81,9 +81,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, spriteFilename); + _vm->_fileManager.constructFilename("ANIM", spriteFilename); } else { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); + _vm->_fileManager.constructFilename("ANIM", "RES_SAN.RES"); } _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); @@ -163,7 +163,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _characterBuffer = _vm->_fileManager.searchCat(filename, 5); _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, filename); + _vm->_fileManager.constructFilename("ANIM", filename); _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); } @@ -576,7 +576,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v18 = 0; _vm->_globals.police_l = 11; - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, file); + _vm->_fileManager.constructFilename("LINK", file); // Build up the filename filename = dest = _vm->_globals._curFilename; @@ -1087,7 +1087,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterBuffer = _vm->_fileManager.searchCat(a2, 5); _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, a2); + _vm->_fileManager.constructFilename("ANIM", a2); _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); } @@ -1100,9 +1100,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterSprite = _vm->_fileManager.searchCat(v23, 7); if (_characterSprite) - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v23); + _vm->_fileManager.constructFilename("ANIM", v23); else - _vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES"); + _vm->_fileManager.constructFilename("ANIM", "RES_SAN.RES"); _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); -- cgit v1.2.3 From 87385740befe7e5325032a8a468fa595b4621ccf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 16:21:55 +0200 Subject: HOPKINS: The return value of constructLinuxFilename is unused --- engines/hopkins/files.cpp | 3 +-- engines/hopkins/files.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index e061b9c2d4..279ca4c0d3 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -118,9 +118,8 @@ void FileManager::constructFilename(const Common::String &folder, const Common:: /** * Construct Linux filename */ -Common::String FileManager::constructLinuxFilename(const Common::String &file) { +void FileManager::constructLinuxFilename(const Common::String &file) { _vm->_globals._curFilename = file; - return file; } /** diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 427d61e183..b2001e2a0c 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -46,7 +46,7 @@ public: void constructFilename(const Common::String &folder, const Common::String &file); byte *searchCat(const Common::String &file, int a2); - Common::String constructLinuxFilename(const Common::String &file); + void constructLinuxFilename(const Common::String &file); uint32 fileSize(const Common::String &filename); }; -- cgit v1.2.3 From f1dafa025c6aab93b8cf6b4707c075be3336c3e4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 17:01:24 +0200 Subject: HOPKINS: Fix regression (typo) --- engines/hopkins/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index a55ef4d442..1628268eca 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -319,7 +319,7 @@ void SoundManager::playAnim_SOUND(int soundNumber) { } static const char *modSounds[] = { - "appart", "ville", "Rock", "police", "deep" + "appart", "ville", "Rock", "police", "deep", "purgat", "riviere", "SUSPENS", "labo", "cadavre", "cabane", "purgat2", "foret", "ile", "ile2", "hopkins", "peur", "URAVOLGA", "BASE", "cadavre2", -- cgit v1.2.3 From 55337fa93b8a8abd9ccaec63d44415d50beb6a18 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 17:40:41 +0200 Subject: HOPKINS: Get rid of the checks for the interlaced videos inside the TSVGA folder --- engines/hopkins/anim.cpp | 8 +- engines/hopkins/dialogs.cpp | 9 +- engines/hopkins/files.cpp | 16 +-- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 248 ++++++++++++-------------------------------- engines/hopkins/script.cpp | 30 ++---- 7 files changed, 84 insertions(+), 229 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 1630de3fe7..539586c433 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -58,7 +58,13 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui byte *screenP = _vm->_graphicsManager._vesaScreen; byte *ptr = _vm->_globals.allocMemory(20); - _vm->_fileManager.constructFilename("ANM", filename); + // The Windows 95 demo only contains the interlaced version of the BOMBE1 and BOMBE2 videos + if (_vm->getPlatform() == Common::kPlatformWindows && _vm->getIsDemo() && filename == "BOMBE1A.ANM") + _vm->_fileManager.constructFilename("ANM", "BOMBE1.ANM"); + else if (_vm->getPlatform() == Common::kPlatformWindows && _vm->getIsDemo() && filename == "BOMBE2A.ANM") + _vm->_fileManager.constructFilename("ANM", "BOMBE2.ANM"); + else + _vm->_fileManager.constructFilename("ANM", filename); if (!f.open(_vm->_globals._curFilename)) error("File not found - %s", _vm->_globals._curFilename.c_str()); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 055664db23..42abaa8ad9 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -229,8 +229,6 @@ void DialogsManager::showOptionsDialog() { // Values are blocked, thus handling the zone is useless //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) // _vm->_globals._speed = 2; - //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 221 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 246) - // _vm->_globals.SVGA = 2; if (mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 || (uint)(mousePos.y - 107) > 211) doneFlag = true; @@ -253,12 +251,7 @@ void DialogsManager::showOptionsDialog() { _vm->_globals._menuSoundOff = !_vm->_soundManager._soundOffFl ? 7 : 8; _vm->_globals._menuMusicOff = !_vm->_soundManager._musicOffFl ? 7 : 8; - if (_vm->_globals.SVGA == 1) - _vm->_globals._menuDisplayType = 10; - else if (_vm->_globals.SVGA == 2) - _vm->_globals._menuDisplayType = 9; - else if (_vm->_globals.SVGA == 3) - _vm->_globals._menuDisplayType = 11; + _vm->_globals._menuDisplayType = 9; if (_vm->_graphicsManager._scrollSpeed == 1) _vm->_globals._menuScrollSpeed = 12; diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 279ca4c0d3..4aeba02a74 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -97,20 +97,8 @@ void FileManager::constructFilename(const Common::String &folder, const Common:: // check for animations that don't exist in the ANM folder, but rather in special // sub-folders depending on the physical screen resolution being used. - if (folder == "ANM") { - switch (_vm->_globals.SVGA) { - case 1: - if (fileExists(folderToUse, file)) - folderToUse = "TSVGA"; - break; - case 2: - if (fileExists(folderToUse, file)) - folderToUse = "SVGA"; - break; - default: - break; - } - } + if (folder == "ANM" && fileExists("SVGA", file)) + folderToUse = "SVGA"; _vm->_globals._curFilename = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f3ee56be87..c0803d8f95 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -115,7 +115,6 @@ Globals::Globals() { // Initialise fields _language = LANG_EN; - SVGA = 2; _internetFl = true; PUBEXIT = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index fdf1b4e866..18cbf95318 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -329,7 +329,6 @@ public: int _inventory[36]; SortItem _sortedDisplay[51]; Language _language; - int SVGA; bool _internetFl; bool PUBEXIT; int PERSO_TYPE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 536220caa3..13eceff46a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -129,8 +129,6 @@ Common::Error HopkinsEngine::run() { } bool HopkinsEngine::runWin95Demo() { - _globals.SVGA = 1; - _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); @@ -817,8 +815,6 @@ bool HopkinsEngine::runLinuxDemo() { } bool HopkinsEngine::runOS2Full() { - _globals.SVGA = 2; - _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); @@ -1031,10 +1027,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearPalette(); // _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -1074,10 +1067,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG2.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -1508,10 +1498,7 @@ bool HopkinsEngine::runOS2Full() { _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -1661,8 +1648,6 @@ bool HopkinsEngine::runOS2Full() { } bool HopkinsEngine::runBeOSFull() { - _globals.SVGA = 2; - warning("TODO: Init_Interrupt()"); _globals.loadObjects(); _objectsManager.changeObject(14); @@ -1878,11 +1863,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -1922,10 +1903,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG2.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -2356,11 +2334,7 @@ bool HopkinsEngine::runBeOSFull() { _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); - + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -2505,8 +2479,6 @@ bool HopkinsEngine::runBeOSFull() { } bool HopkinsEngine::runWin95full() { - _globals.SVGA = 2; - warning("TODO: Init_Interrupt_()"); _globals.loadObjects(); @@ -2726,10 +2698,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -2766,10 +2735,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG2.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -3196,10 +3162,7 @@ bool HopkinsEngine::runWin95full() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -3561,10 +3524,7 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND_OFF(); _soundManager.WSOUND(29); _graphicsManager.FADE_LINUX = 2; - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _globals.iRegul = 0; } break; @@ -3601,10 +3561,7 @@ bool HopkinsEngine::runLinuxFull() { _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); _graphicsManager.FADE_LINUX = 2; - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG2.ANM", 12, 18, 50); + _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); _globals.iRegul = 0; } break; @@ -4031,10 +3988,7 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _soundManager.WSOUND(6); - if (_globals.SVGA == 2) - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - else if (_globals.SVGA == 1) - _animationManager.playAnim("PURG1.ANM", 12, 18, 50); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } @@ -4544,11 +4498,7 @@ void HopkinsEngine::bombExplosion() { _globals.iRegul = 1; _soundManager.SPECIAL_SOUND = 199; _graphicsManager.FADE_LINUX = 2; - if (_globals.SVGA == 1) - _animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_globals.SVGA == 2) - _animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - + _animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _soundManager.SPECIAL_SOUND = 0; _graphicsManager.loadImage("IM15"); _animationManager.loadAnim("ANIM15"); @@ -4657,59 +4607,31 @@ void HopkinsEngine::BASE() { _graphicsManager.clearPalette(); _animationManager._clearAnimationFl = true; _soundManager.WSOUND(25); - if (_globals.SVGA == 1) { - _animationManager.playAnim("base00.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base05.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base10.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base20.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base30.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base40.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base50.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC00.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC05.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC10.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC20.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("OC30.anm", 10, 18, 18); - } - } else if (_globals.SVGA == 2) { - _animationManager.playAnim("base00a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base05a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base10a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base20a.anm", 10, 18, 18); - // CHECKME: The original code was doing the opposite test, which looks like a bug. - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base30a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base40a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("base50a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC00a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC05a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC10a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("OC20a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("OC30a.anm", 10, 18, 18); - } + _animationManager.playAnim("base00a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("base05a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("base10a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("base20a.anm", 10, 18, 18); + // CHECKME: The original code was doing the opposite test, which looks like a bug. + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("base30a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("base40a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("base50a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("OC00a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("OC05a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("OC10a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("OC20a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("OC30a.anm", 10, 18, 18); } _eventsManager._escKeyFl = false; @@ -4915,70 +4837,36 @@ void HopkinsEngine::displayPlane() { _graphicsManager.clearPalette(); _animationManager._clearAnimationFl = false; - if (_globals.SVGA == 1) { - _animationManager.playAnim("aerop00.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop10.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop20.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop30.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop40.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop50.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop60.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop70.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans00.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans10.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans15.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans20.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans30.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans40.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("PARA00.anm", 9, 9, 9); - } - } else if (_globals.SVGA == 2) { - _animationManager.playAnim("aerop00a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("serop10a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop20a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop30a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop40a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop50a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop60a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("aerop70a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans00a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans10a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans15a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans20a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans30a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) - _animationManager.playAnim("trans40a.anm", 10, 18, 18); - if (!_eventsManager._escKeyFl) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("PARA00a.anm", 9, 9, 9); - } + _animationManager.playAnim("aerop00a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("serop10a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("aerop20a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("aerop30a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("aerop40a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("aerop50a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("aerop60a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("aerop70a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("trans00a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("trans10a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("trans15a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("trans20a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("trans30a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) + _animationManager.playAnim("trans40a.anm", 10, 18, 18); + if (!_eventsManager._escKeyFl) { + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("PARA00a.anm", 9, 9, 9); } _eventsManager._escKeyFl = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3077393d61..10ed19016c 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1352,10 +1352,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); _vm->_globals.NOPARLE = false; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim2("T421a.ANM", 100, 14, 500); + _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); @@ -2278,10 +2275,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (!_vm->_globals._internetFl) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_graphicsManager._fadeDefaultSpeed = 1; - if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); - else if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE1.ANM", 100, 18, 100); + _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); } _vm->_graphicsManager.loadImage("BOMBEB"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -2313,10 +2307,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_graphicsManager._noFadingFl = true; @@ -2329,10 +2320,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager._noFadingFl = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); @@ -2347,10 +2335,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fadeOutShort(); _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE2.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager._noFadingFl = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); @@ -2363,10 +2348,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NO_VISU = false; _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { - if (_vm->_globals.SVGA == 1) - _vm->_animationManager.playAnim("BOMBE3.ANM", 50, 14, 500); - else if (_vm->_globals.SVGA == 2) - _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); + _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); } _vm->_globals._exitId = 6; -- cgit v1.2.3 From 5f171c51bf9bf297459245a1f0abcfaac055f8a9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 17:53:17 +0200 Subject: HOPKINS: Remove useless globals and rename some variables --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 468 ++++++++++++++++++++++---------------------- engines/hopkins/lines.cpp | 2 +- engines/hopkins/objects.cpp | 3 +- 5 files changed, 237 insertions(+), 244 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index c0803d8f95..92e2cf68c0 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -134,7 +134,6 @@ Globals::Globals() { _helicopterFl = false; _catalogPos = 0; _catalogSize = 0; - _newObjectFl = false; iRegul = 0; _exitId = 0; PLANX = PLANY = 0; @@ -143,10 +142,9 @@ Globals::Globals() { _screenId = 0; NOSPRECRAN = false; _prevScreenId = 0; - Max_Ligne_Long = 0; + _maxLineLength = 0; Max_Perso_Y = 0; Max_Propre = 0; - fmusic = 0; NBBLOC = 0; _menuScrollType = 0; _menuScrollSpeed = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 18cbf95318..114a4df640 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -370,7 +370,6 @@ public: byte *ADR_FICHIER_OBJ; byte *PERSO; int _objectWidth, _objectHeight; - bool _newObjectFl; bool _helicopterFl; uint32 _catalogPos; uint32 _catalogSize; @@ -381,9 +380,8 @@ public: bool NOSPRECRAN; int _screenId; int _prevScreenId; - int fmusic; int Max_Propre; - int Max_Ligne_Long; + int _maxLineLength; int Max_Perso_Y; bool _disableInventFl; bool NOMARCHE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 13eceff46a..be28b38edc 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -207,7 +207,7 @@ bool HopkinsEngine::runWin95Demo() { switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2); break; @@ -243,7 +243,7 @@ bool HopkinsEngine::runWin95Demo() { _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -257,7 +257,7 @@ bool HopkinsEngine::runWin95Demo() { case 5: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; @@ -273,7 +273,7 @@ bool HopkinsEngine::runWin95Demo() { case 6: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -287,7 +287,7 @@ bool HopkinsEngine::runWin95Demo() { case 8: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; @@ -295,7 +295,7 @@ bool HopkinsEngine::runWin95Demo() { case 9: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; if (_globals._saveData->data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); else @@ -310,7 +310,7 @@ bool HopkinsEngine::runWin95Demo() { case 11: _globals.NOSPRECRAN = true; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); @@ -320,7 +320,7 @@ bool HopkinsEngine::runWin95Demo() { case 12: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 450; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; if (_globals._saveData->data[svField225]) { if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); @@ -534,7 +534,7 @@ bool HopkinsEngine::runLinuxDemo() { case 1: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -573,7 +573,7 @@ bool HopkinsEngine::runLinuxDemo() { } _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -587,7 +587,7 @@ bool HopkinsEngine::runLinuxDemo() { case 5: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { @@ -602,7 +602,7 @@ bool HopkinsEngine::runLinuxDemo() { case 6: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -616,14 +616,14 @@ bool HopkinsEngine::runLinuxDemo() { case 8: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; case 9: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) @@ -641,7 +641,7 @@ bool HopkinsEngine::runLinuxDemo() { case 11: _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -649,7 +649,7 @@ bool HopkinsEngine::runLinuxDemo() { case 12: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; @@ -661,14 +661,14 @@ bool HopkinsEngine::runLinuxDemo() { case 13: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -681,7 +681,7 @@ bool HopkinsEngine::runLinuxDemo() { case 16: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { @@ -693,14 +693,14 @@ bool HopkinsEngine::runLinuxDemo() { case 25: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); break; case 26: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); @@ -860,7 +860,7 @@ bool HopkinsEngine::runOS2Full() { switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -891,7 +891,7 @@ bool HopkinsEngine::runOS2Full() { _globals._saveData->data[170] = 1; } _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -905,7 +905,7 @@ bool HopkinsEngine::runOS2Full() { case 5: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[80]) { @@ -919,7 +919,7 @@ bool HopkinsEngine::runOS2Full() { case 6: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -933,14 +933,14 @@ bool HopkinsEngine::runOS2Full() { case 8: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; case 9: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); @@ -957,7 +957,7 @@ bool HopkinsEngine::runOS2Full() { case 11: _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -965,7 +965,7 @@ bool HopkinsEngine::runOS2Full() { case 12: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[225]) { _globals.NOSPRECRAN = true; @@ -976,14 +976,14 @@ bool HopkinsEngine::runOS2Full() { case 13: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -996,7 +996,7 @@ bool HopkinsEngine::runOS2Full() { case 16: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7); @@ -1008,7 +1008,7 @@ bool HopkinsEngine::runOS2Full() { case 17: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); @@ -1036,14 +1036,14 @@ bool HopkinsEngine::runOS2Full() { case 18: _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); break; case 19: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); @@ -1053,7 +1053,7 @@ bool HopkinsEngine::runOS2Full() { case 20: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -1075,21 +1075,21 @@ bool HopkinsEngine::runOS2Full() { case 22: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; case 23: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; case 24: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[181]) { if (_globals._saveData->data[181] == 1 ) @@ -1100,21 +1100,21 @@ bool HopkinsEngine::runOS2Full() { case 25: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); break; case 26: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); break; case 27: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -1126,7 +1126,7 @@ bool HopkinsEngine::runOS2Full() { case 28: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[166] != 1 || _globals._saveData->data[167] != 1 ) @@ -1137,14 +1137,14 @@ bool HopkinsEngine::runOS2Full() { case 29: _globals.Max_Propre = 60; - _globals.Max_Ligne_Long = 50; + _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; case 30: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -1157,7 +1157,7 @@ bool HopkinsEngine::runOS2Full() { case 32: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -1182,7 +1182,7 @@ bool HopkinsEngine::runOS2Full() { case 40: case 41: { _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -1211,28 +1211,28 @@ bool HopkinsEngine::runOS2Full() { case 51: _globals.Max_Propre = 20; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); break; case 52: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; case 54: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; case 55: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); @@ -1240,7 +1240,7 @@ bool HopkinsEngine::runOS2Full() { case 56: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -1248,14 +1248,14 @@ bool HopkinsEngine::runOS2Full() { case 57: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; case 58: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -1263,7 +1263,7 @@ bool HopkinsEngine::runOS2Full() { case 59: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -1272,7 +1272,7 @@ bool HopkinsEngine::runOS2Full() { case 60: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -1288,7 +1288,7 @@ bool HopkinsEngine::runOS2Full() { case 62: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -1297,7 +1297,7 @@ bool HopkinsEngine::runOS2Full() { case 63: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -1306,14 +1306,14 @@ bool HopkinsEngine::runOS2Full() { case 64: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; case 65: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -1322,7 +1322,7 @@ bool HopkinsEngine::runOS2Full() { case 66: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -1331,7 +1331,7 @@ bool HopkinsEngine::runOS2Full() { case 67: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -1340,14 +1340,14 @@ bool HopkinsEngine::runOS2Full() { case 68: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; case 69: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -1356,7 +1356,7 @@ bool HopkinsEngine::runOS2Full() { case 70: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); @@ -1365,7 +1365,7 @@ bool HopkinsEngine::runOS2Full() { case 71: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -1374,7 +1374,7 @@ bool HopkinsEngine::runOS2Full() { case 73: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -1450,7 +1450,7 @@ bool HopkinsEngine::runOS2Full() { case 93: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26); @@ -1460,14 +1460,14 @@ bool HopkinsEngine::runOS2Full() { case 94: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; case 95: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -1475,7 +1475,7 @@ bool HopkinsEngine::runOS2Full() { case 96: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -1483,7 +1483,7 @@ bool HopkinsEngine::runOS2Full() { case 97: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); @@ -1506,14 +1506,14 @@ bool HopkinsEngine::runOS2Full() { case 98: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; case 99: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; @@ -1698,7 +1698,7 @@ bool HopkinsEngine::runBeOSFull() { switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -1729,7 +1729,7 @@ bool HopkinsEngine::runBeOSFull() { _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -1743,7 +1743,7 @@ bool HopkinsEngine::runBeOSFull() { case 5: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { @@ -1757,7 +1757,7 @@ bool HopkinsEngine::runBeOSFull() { case 6: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -1771,14 +1771,14 @@ bool HopkinsEngine::runBeOSFull() { case 8: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; case 9: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) bombExplosion(); @@ -1794,7 +1794,7 @@ bool HopkinsEngine::runBeOSFull() { case 11: _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -1802,7 +1802,7 @@ bool HopkinsEngine::runBeOSFull() { case 12: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; @@ -1814,14 +1814,14 @@ bool HopkinsEngine::runBeOSFull() { case 13: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -1834,7 +1834,7 @@ bool HopkinsEngine::runBeOSFull() { case 16: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); @@ -1845,7 +1845,7 @@ bool HopkinsEngine::runBeOSFull() { case 17: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); @@ -1872,14 +1872,14 @@ bool HopkinsEngine::runBeOSFull() { case 18: _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); break; case 19: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); @@ -1889,7 +1889,7 @@ bool HopkinsEngine::runBeOSFull() { case 20: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -1911,21 +1911,21 @@ bool HopkinsEngine::runBeOSFull() { case 22: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; case 23: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; case 24: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) @@ -1937,21 +1937,21 @@ bool HopkinsEngine::runBeOSFull() { case 25: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); break; case 26: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); break; case 27: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -1962,7 +1962,7 @@ bool HopkinsEngine::runBeOSFull() { case 28: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) @@ -1973,14 +1973,14 @@ bool HopkinsEngine::runBeOSFull() { case 29: _globals.Max_Propre = 60; - _globals.Max_Ligne_Long = 50; + _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; case 30: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -1993,7 +1993,7 @@ bool HopkinsEngine::runBeOSFull() { case 32: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -2018,7 +2018,7 @@ bool HopkinsEngine::runBeOSFull() { case 40: case 41: { _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -2048,28 +2048,28 @@ bool HopkinsEngine::runBeOSFull() { case 51: _globals.Max_Propre = 20; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); break; case 52: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; case 54: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; case 55: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); @@ -2077,7 +2077,7 @@ bool HopkinsEngine::runBeOSFull() { case 56: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -2085,14 +2085,14 @@ bool HopkinsEngine::runBeOSFull() { case 57: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; case 58: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -2100,7 +2100,7 @@ bool HopkinsEngine::runBeOSFull() { case 59: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -2109,7 +2109,7 @@ bool HopkinsEngine::runBeOSFull() { case 60: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -2125,7 +2125,7 @@ bool HopkinsEngine::runBeOSFull() { case 62: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -2134,7 +2134,7 @@ bool HopkinsEngine::runBeOSFull() { case 63: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -2143,14 +2143,14 @@ bool HopkinsEngine::runBeOSFull() { case 64: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; case 65: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -2159,7 +2159,7 @@ bool HopkinsEngine::runBeOSFull() { case 66: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -2168,7 +2168,7 @@ bool HopkinsEngine::runBeOSFull() { case 67: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -2177,14 +2177,14 @@ bool HopkinsEngine::runBeOSFull() { case 68: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; case 69: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -2193,7 +2193,7 @@ bool HopkinsEngine::runBeOSFull() { case 70: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); @@ -2202,7 +2202,7 @@ bool HopkinsEngine::runBeOSFull() { case 71: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -2211,7 +2211,7 @@ bool HopkinsEngine::runBeOSFull() { case 73: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -2286,7 +2286,7 @@ bool HopkinsEngine::runBeOSFull() { case 93: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); @@ -2296,14 +2296,14 @@ bool HopkinsEngine::runBeOSFull() { case 94: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; case 95: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -2311,7 +2311,7 @@ bool HopkinsEngine::runBeOSFull() { case 96: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -2319,7 +2319,7 @@ bool HopkinsEngine::runBeOSFull() { case 97: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); @@ -2342,14 +2342,14 @@ bool HopkinsEngine::runBeOSFull() { case 98: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; case 99: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; @@ -2529,7 +2529,7 @@ bool HopkinsEngine::runWin95full() { switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -2565,7 +2565,7 @@ bool HopkinsEngine::runWin95full() { _globals._saveData->data[svField170] = 1; } _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -2579,7 +2579,7 @@ bool HopkinsEngine::runWin95full() { case 5: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; if (_globals._saveData->data[svField80]) { @@ -2595,7 +2595,7 @@ bool HopkinsEngine::runWin95full() { case 6: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 460; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -2608,13 +2608,13 @@ bool HopkinsEngine::runWin95full() { case 8: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; case 9: - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField225]) @@ -2633,13 +2633,13 @@ bool HopkinsEngine::runWin95full() { _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; break; case 12: - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; if (_globals._saveData->data[svField225]) { @@ -2652,14 +2652,14 @@ bool HopkinsEngine::runWin95full() { case 13: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -2673,7 +2673,7 @@ bool HopkinsEngine::runWin95full() { case 16: _globals.Max_Perso_Y = 450; _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); } else if (!_globals._saveData->data[svField113]) { @@ -2684,7 +2684,7 @@ bool HopkinsEngine::runWin95full() { case 17: _globals.Max_Propre = 50; _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); } else if (!_globals._saveData->data[svField117]) { @@ -2706,7 +2706,7 @@ bool HopkinsEngine::runWin95full() { case 18: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); @@ -2715,7 +2715,7 @@ bool HopkinsEngine::runWin95full() { case 19: _globals.Max_Perso_Y = 440; _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); else @@ -2724,7 +2724,7 @@ bool HopkinsEngine::runWin95full() { case 20: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -2744,20 +2744,20 @@ bool HopkinsEngine::runWin95full() { case 22: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 445; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; case 23: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; case 24: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) @@ -2770,20 +2770,20 @@ bool HopkinsEngine::runWin95full() { case 25: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 445; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); break; case 26: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); break; case 27: _globals.Max_Perso_Y = 440; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Propre = 10; if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -2794,7 +2794,7 @@ bool HopkinsEngine::runWin95full() { case 28: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) @@ -2805,14 +2805,14 @@ bool HopkinsEngine::runWin95full() { case 29: _globals.Max_Propre = 60; - _globals.Max_Ligne_Long = 50; + _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; case 30: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -2826,7 +2826,7 @@ bool HopkinsEngine::runWin95full() { case 32: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 445; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -2849,9 +2849,8 @@ bool HopkinsEngine::runWin95full() { case 39: case 40: case 41: { - _globals.fmusic = 13; _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -2878,7 +2877,7 @@ bool HopkinsEngine::runWin95full() { break; case 51: - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _globals.Max_Propre = 20; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); @@ -2886,14 +2885,14 @@ bool HopkinsEngine::runWin95full() { case 52: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; case 54: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; @@ -2901,14 +2900,14 @@ bool HopkinsEngine::runWin95full() { case 55: _globals.Max_Propre = 40; _globals.Max_Perso_Y = 460; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); break; case 56: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -2916,14 +2915,14 @@ bool HopkinsEngine::runWin95full() { case 57: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; case 58: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -2931,7 +2930,7 @@ bool HopkinsEngine::runWin95full() { case 59: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -2940,7 +2939,7 @@ bool HopkinsEngine::runWin95full() { case 60: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -2956,7 +2955,7 @@ bool HopkinsEngine::runWin95full() { case 62: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -2965,7 +2964,7 @@ bool HopkinsEngine::runWin95full() { case 63: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -2974,14 +2973,14 @@ bool HopkinsEngine::runWin95full() { case 64: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; case 65: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -2990,7 +2989,7 @@ bool HopkinsEngine::runWin95full() { case 66: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -2999,7 +2998,7 @@ bool HopkinsEngine::runWin95full() { case 67: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -3008,14 +3007,14 @@ bool HopkinsEngine::runWin95full() { case 68: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; case 69: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -3026,14 +3025,14 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Perso_Y = 435; _globals.Max_Propre = 8; _globals.NOSPRECRAN = true; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); _globals.NOSPRECRAN = false; break; case 71: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -3042,7 +3041,7 @@ bool HopkinsEngine::runWin95full() { case 73: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -3117,7 +3116,7 @@ bool HopkinsEngine::runWin95full() { case 93: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); @@ -3127,14 +3126,14 @@ bool HopkinsEngine::runWin95full() { case 94: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; case 95: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = false; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -3142,7 +3141,7 @@ bool HopkinsEngine::runWin95full() { case 96: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -3152,7 +3151,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Perso_Y = 435; _globals.Max_Propre = 5; _globals.NOSPRECRAN = true; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -3170,14 +3169,14 @@ bool HopkinsEngine::runWin95full() { case 98: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; case 99: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; @@ -3355,7 +3354,7 @@ bool HopkinsEngine::runLinuxFull() { switch (_globals._exitId) { case 1: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); break; @@ -3392,7 +3391,7 @@ bool HopkinsEngine::runLinuxFull() { } _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); @@ -3406,7 +3405,7 @@ bool HopkinsEngine::runLinuxFull() { case 5: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { @@ -3420,7 +3419,7 @@ bool HopkinsEngine::runLinuxFull() { case 6: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); break; @@ -3434,14 +3433,14 @@ bool HopkinsEngine::runLinuxFull() { case 8: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); break; case 9: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) bombExplosion(); @@ -3457,7 +3456,7 @@ bool HopkinsEngine::runLinuxFull() { case 11: _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); _globals.NOSPRECRAN = false; @@ -3465,7 +3464,7 @@ bool HopkinsEngine::runLinuxFull() { case 12: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { _globals.NOSPRECRAN = true; @@ -3477,14 +3476,14 @@ bool HopkinsEngine::runLinuxFull() { case 13: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); break; case 14: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); break; @@ -3497,7 +3496,7 @@ bool HopkinsEngine::runLinuxFull() { case 16: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); @@ -3508,7 +3507,7 @@ bool HopkinsEngine::runLinuxFull() { case 17: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField117] == 1) { _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); @@ -3532,14 +3531,14 @@ bool HopkinsEngine::runLinuxFull() { case 18: _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); break; case 19: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); @@ -3549,7 +3548,7 @@ bool HopkinsEngine::runLinuxFull() { case 20: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); if (_globals._exitId == 17) { @@ -3568,21 +3567,21 @@ bool HopkinsEngine::runLinuxFull() { case 22: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); break; case 23: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); break; case 24: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) @@ -3594,21 +3593,21 @@ bool HopkinsEngine::runLinuxFull() { case 25: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); break; case 26: _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); break; case 27: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField177] == 1) { _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); @@ -3619,7 +3618,7 @@ bool HopkinsEngine::runLinuxFull() { case 28: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) @@ -3630,14 +3629,14 @@ bool HopkinsEngine::runLinuxFull() { case 29: _globals.Max_Propre = 60; - _globals.Max_Ligne_Long = 50; + _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); break; case 30: _globals.Max_Propre = 10; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); @@ -3650,7 +3649,7 @@ bool HopkinsEngine::runLinuxFull() { case 32: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 20; + _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); break; @@ -3674,9 +3673,8 @@ bool HopkinsEngine::runLinuxFull() { case 39: case 40: case 41: { - _globals.fmusic = 13; _globals.Max_Propre = 50; - _globals.Max_Ligne_Long = 40; + _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -3705,28 +3703,28 @@ bool HopkinsEngine::runLinuxFull() { case 51: _globals.Max_Propre = 20; - _globals.Max_Ligne_Long = 10; + _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); break; case 52: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); break; case 54: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); break; case 55: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 460; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); @@ -3734,7 +3732,7 @@ bool HopkinsEngine::runLinuxFull() { case 56: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); @@ -3742,14 +3740,14 @@ bool HopkinsEngine::runLinuxFull() { case 57: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); break; case 58: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); @@ -3757,7 +3755,7 @@ bool HopkinsEngine::runLinuxFull() { case 59: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); @@ -3766,7 +3764,7 @@ bool HopkinsEngine::runLinuxFull() { case 60: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); @@ -3782,7 +3780,7 @@ bool HopkinsEngine::runLinuxFull() { case 62: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); @@ -3791,7 +3789,7 @@ bool HopkinsEngine::runLinuxFull() { case 63: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); @@ -3800,14 +3798,14 @@ bool HopkinsEngine::runLinuxFull() { case 64: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); break; case 65: _globals.Max_Propre = 40; - _globals.Max_Ligne_Long = 30; + _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); @@ -3816,7 +3814,7 @@ bool HopkinsEngine::runLinuxFull() { case 66: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); @@ -3825,7 +3823,7 @@ bool HopkinsEngine::runLinuxFull() { case 67: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); @@ -3834,14 +3832,14 @@ bool HopkinsEngine::runLinuxFull() { case 68: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); break; case 69: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); @@ -3850,7 +3848,7 @@ bool HopkinsEngine::runLinuxFull() { case 70: _globals.Max_Propre = 8; - _globals.Max_Ligne_Long = 8; + _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); @@ -3859,7 +3857,7 @@ bool HopkinsEngine::runLinuxFull() { case 71: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); @@ -3868,7 +3866,7 @@ bool HopkinsEngine::runLinuxFull() { case 73: _globals.Max_Propre = 15; - _globals.Max_Ligne_Long = 15; + _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); @@ -3943,7 +3941,7 @@ bool HopkinsEngine::runLinuxFull() { case 93: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); @@ -3953,14 +3951,14 @@ bool HopkinsEngine::runLinuxFull() { case 94: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); break; case 95: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); @@ -3968,7 +3966,7 @@ bool HopkinsEngine::runLinuxFull() { case 96: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); @@ -3976,7 +3974,7 @@ bool HopkinsEngine::runLinuxFull() { case 97: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _globals.NOSPRECRAN = true; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); @@ -3996,14 +3994,14 @@ bool HopkinsEngine::runLinuxFull() { case 98: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); break; case 99: _globals.Max_Propre = 5; - _globals.Max_Ligne_Long = 5; + _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); break; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 5b4a26c71d..c2a56fa46d 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -471,7 +471,7 @@ void LinesManager::INIPARCOURS() { } while (!v1); _vm->_objectsManager._lastLine = v0; - v13 = _vm->_globals.Max_Ligne_Long; + v13 = _vm->_globals._maxLineLength; v9 = _vm->_objectsManager._lastLine + 1; for (int v8 = 1; v8 != 400; v8++) { v11 = v8; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 9fc3461270..7f4be30db3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -102,7 +102,6 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { */ void ObjectsManager::changeObject(int objIndex) { _vm->_eventsManager._objectBuf = CAPTURE_OBJET(objIndex, 1); - _vm->_globals._newObjectFl = true; _vm->_globals._curObjectIndex = objIndex; } @@ -2262,7 +2261,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_globals.Max_Propre = 1; - _vm->_globals.Max_Ligne_Long = 1; + _vm->_globals._maxLineLength = 1; _vm->_globals.Max_Perso_Y = 440; _vm->_globals.NOSPRECRAN = true; _vm->_globals.PLAN_FLAG = true; -- cgit v1.2.3 From 60e11931ba4e4bec8e6e38eb8e946ca71624c274 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 19:42:46 +0200 Subject: HOPKINS: Fix fileExists() --- engines/hopkins/computer.cpp | 2 +- engines/hopkins/files.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 7aa17c9788..bc67ccf23f 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -328,7 +328,7 @@ static char _frenchText[] = */ void ComputerManager::loadMenu() { char *ptr; - if (!_vm->_fileManager.fileExists("LINK", "COMPUTAN.TXT")) { + if (_vm->_fileManager.fileExists("LINK", "COMPUTAN.TXT")) { _vm->_fileManager.constructFilename("LINK", "COMPUTAN.TXT"); ptr = (char *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); } else if (_vm->_globals._language == LANG_FR) { diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 4aeba02a74..0ff2668d07 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -72,7 +72,7 @@ void FileManager::initCensorship() { _vm->_globals._censorshipFl = false; // If file doesn't exist, fallback to uncensored - if (!fileExists("SYSTEM", "BLOOD.DAT")) { + if (fileExists("SYSTEM", "BLOOD.DAT")) { constructFilename("SYSTEM", "BLOOD.DAT"); char *data = (char *)loadFile(_vm->_globals._curFilename); @@ -117,8 +117,7 @@ bool FileManager::fileExists(const Common::String &folder, const Common::String Common::String filename = folder.empty() ? file : Common::String::format("%s/%s", folder.c_str(), file.c_str()); - Common::File f; - return !f.exists(filename); + return Common::File::exists(filename); } /** -- cgit v1.2.3 From e57c82f9dae625aec53530e6e1e8e06d6a13b533 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 19:43:24 +0200 Subject: HOPKINS: Get rid of the NOSPRECRAN global variable --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/graphics.cpp | 12 +- engines/hopkins/graphics.h | 6 +- engines/hopkins/hopkins.cpp | 932 ++++++++++++++++--------------------------- engines/hopkins/objects.cpp | 23 +- engines/hopkins/objects.h | 4 +- engines/hopkins/script.cpp | 2 +- engines/hopkins/talk.cpp | 4 +- 9 files changed, 367 insertions(+), 618 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 92e2cf68c0..1fdcccfd6a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -140,7 +140,6 @@ Globals::Globals() { PLANI = 0; PERSO = 0; _screenId = 0; - NOSPRECRAN = false; _prevScreenId = 0; _maxLineLength = 0; Max_Perso_Y = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 114a4df640..a4f60e1cfd 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -377,7 +377,6 @@ public: int _exitId; int PLANX, PLANY; int PLANI; - bool NOSPRECRAN; int _screenId; int _prevScreenId; int Max_Propre; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index f66b4882a8..0021f3539e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1753,16 +1753,16 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, } // Init Screen -void GraphicsManager::INI_ECRAN(const Common::String &file) { - OPTI_INI(file, 0); +void GraphicsManager::INI_ECRAN(const Common::String &file, bool initializeScreen) { + OPTI_INI(file, 0, initializeScreen); } // Init Screen 2 -void GraphicsManager::INI_ECRAN2(const Common::String &file) { - OPTI_INI(file, 2); +void GraphicsManager::INI_ECRAN2(const Common::String &file, bool initializeScreen) { + OPTI_INI(file, 2, initializeScreen); } -void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { +void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initializeScreen) { Common::String filename = file + ".ini"; byte *ptr = _vm->_fileManager.searchCat(filename, 1); @@ -1773,7 +1773,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { if (!mode) { filename = file + ".spr"; _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); - if (!_vm->_globals.NOSPRECRAN) { + if (initializeScreen) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { _vm->_fileManager.constructFilename("LINK", filename); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index dd1df3c6e1..57405773ca 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -163,9 +163,9 @@ public: void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); - void INI_ECRAN(const Common::String &file); - void INI_ECRAN2(const Common::String &file); - void OPTI_INI(const Common::String &file, int mode); + void INI_ECRAN(const Common::String &file, bool initializeScreen); + void INI_ECRAN2(const Common::String &file, bool initializeScreen); + void OPTI_INI(const Common::String &file, int mode, bool initializeScreen); void NB_SCREEN(bool initPalette); void SHOW_PALETTE(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index be28b38edc..2fd9293d51 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -209,7 +209,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2, true); break; case 3: @@ -245,8 +245,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; case 4: @@ -258,38 +257,35 @@ bool HopkinsEngine::runWin95Demo() { case 5: _globals.Max_Propre = 5; _globals._maxLineLength = 5; - _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; if (_globals._saveData->data[svField80]) { if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); } - - _globals.NOSPRECRAN = false; break; case 6: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; case 7: if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); break; case 8: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: @@ -297,24 +293,20 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Perso_Y = 440; _globals._maxLineLength = 20; if (_globals._saveData->data[svField225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else bombExplosion(); break; case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); break; case 11: - _globals.NOSPRECRAN = true; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: @@ -363,15 +355,11 @@ bool HopkinsEngine::runWin95Demo() { break; case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); break; case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); break; case 113: @@ -536,7 +524,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; case 3: @@ -575,8 +563,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; case 4: @@ -589,36 +576,31 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = true; - if (_globals._saveData->data[svField80]) { - if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - } - - _globals.NOSPRECRAN = false; + if (_globals._saveData->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); + else + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); break; case 6: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; case 7: if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); break; case 8: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: @@ -629,54 +611,46 @@ bool HopkinsEngine::runLinuxDemo() { if (!_globals._saveData->data[svField225]) bombExplosion(); - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); break; case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); break; case 11: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { + if (_globals._saveData->data[svField225]) + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); + else bombExplosion(); - } break; case 13: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; case 15: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false); break; case 16: @@ -685,9 +659,9 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); } else if (!_globals._saveData->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); } break; @@ -695,19 +669,17 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); break; case 26: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); break; case 35: @@ -715,15 +687,11 @@ bool HopkinsEngine::runLinuxDemo() { break; case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); break; case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); break; case 113: @@ -862,7 +830,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; case 3: @@ -893,8 +861,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; case 4: @@ -907,35 +874,33 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[80]) { if (_globals._saveData->data[80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); } else - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); break; case 6: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; case 7: if (_globals._saveData->data[220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); break; case 8: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: @@ -943,34 +908,29 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else bombExplosion(); break; case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); break; case 11: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else + if (_globals._saveData->data[225]) + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); + else bombExplosion(); break; @@ -978,20 +938,18 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; case 15: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18, false); break; case 16: @@ -999,10 +957,10 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[113] == 1) - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7, true); else { if (!_globals._saveData->data[113]) - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); } break; @@ -1011,10 +969,10 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[117] == 1) - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); else { if (!_globals._saveData->data[117]) - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); } if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -1034,11 +992,10 @@ bool HopkinsEngine::runOS2Full() { break; case 18: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6, false); break; case 19: @@ -1046,16 +1003,16 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); break; case 20: _globals.Max_Propre = 8; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; // _soundManager.WSOUND_OFF(); @@ -1077,14 +1034,14 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); break; case 23: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); break; case 24: @@ -1093,23 +1050,23 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Perso_Y = 450; if (_globals._saveData->data[181]) { if (_globals._saveData->data[181] == 1 ) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1, true); } else - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); break; case 25: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8, true); break; case 26: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8, true); break; case 27: @@ -1117,10 +1074,10 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[177] == 1) - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); else { if (!_globals._saveData->data[177]) - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); } break; @@ -1128,50 +1085,43 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[166] != 1 || _globals._saveData->data[167] != 1 ) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1, false); break; case 29: _globals.Max_Propre = 60; _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); break; case 30: _globals.Max_Propre = 10; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); break; case 32: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); break; case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); break; case 34: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); break; case 35: @@ -1186,7 +1136,6 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; - _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { @@ -1194,8 +1143,7 @@ bool HopkinsEngine::runOS2Full() { _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); if (_globals._exitId < 35 || _globals._exitId > 49 ) { _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; @@ -1213,163 +1161,139 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 20; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); break; case 52: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); break; case 54: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); break; case 55: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); break; case 56: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); break; case 57: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); break; case 58: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); break; case 59: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); break; case 60: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); break; case 61: if (_globals._saveData->data[311] == 1 && !_globals._saveData->data[312] ) handleConflagration(); - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); break; case 62: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); break; case 63: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); break; case 64: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); break; case 65: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); break; case 66: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); break; case 67: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); break; case 68: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); break; case 69: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); break; case 70: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); break; case 71: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); break; case 73: @@ -1377,10 +1301,10 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[318] == 1) - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); else { if (!_globals._saveData->data[318]) - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); } break; @@ -1453,40 +1377,37 @@ bool HopkinsEngine::runOS2Full() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26); + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26, true); else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26, true); break; case 94: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); break; case 95: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); break; case 96: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); break; case 97: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { _globals.iRegul = 1; // _soundManager.WSOUND_OFF(); @@ -1508,14 +1429,14 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); break; case 99: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); break; case 100: @@ -1523,15 +1444,11 @@ bool HopkinsEngine::runOS2Full() { break; case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); break; case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); break; case 113: @@ -1700,7 +1617,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; case 3: @@ -1731,8 +1648,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; case 4: @@ -1745,35 +1661,33 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); } - _globals.NOSPRECRAN = false; break; case 6: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; case 7: if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); break; case 8: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: @@ -1782,22 +1696,18 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) bombExplosion(); - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); break; case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); break; case 11: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: @@ -1805,8 +1715,7 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); } else { bombExplosion(); } @@ -1816,20 +1725,18 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; case 15: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18, false); break; case 16: @@ -1837,9 +1744,9 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); } else if (!_globals._saveData->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); } break; @@ -1848,9 +1755,9 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField117] == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); } else if (!_globals._saveData->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); } if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -1870,11 +1777,10 @@ bool HopkinsEngine::runBeOSFull() { break; case 18: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6); + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6, false); break; case 19: @@ -1882,16 +1788,16 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); break; case 20: _globals.Max_Propre = 8; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -1913,14 +1819,14 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); break; case 23: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); break; case 24: @@ -1929,9 +1835,9 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1); + _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true); } else { - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); } break; @@ -1939,14 +1845,14 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8, true); break; case 26: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8, true); break; case 27: @@ -1954,9 +1860,9 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField177] == 1) { - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); } else if (!_globals._saveData->data[svField177]) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); } break; @@ -1964,50 +1870,43 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else - _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1, false); break; case 29: _globals.Max_Propre = 60; _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); break; case 30: _globals.Max_Propre = 10; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); break; case 32: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); break; case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); break; case 34: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); break; case 35: @@ -2022,7 +1921,6 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; - _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { @@ -2031,8 +1929,7 @@ bool HopkinsEngine::runBeOSFull() { _soundManager.loadSample(1, "SOUND41.WAV"); } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); if ((_globals._exitId < 35) || (_globals._exitId > 49)) { _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; @@ -2050,163 +1947,139 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 20; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); break; case 52: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); break; case 54: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); break; case 55: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); break; case 56: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); break; case 57: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); break; case 58: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); break; case 59: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); break; case 60: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); break; case 61: if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) handleConflagration(); - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); break; case 62: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); break; case 63: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); break; case 64: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); break; case 65: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); break; case 66: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); break; case 67: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); break; case 68: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); break; case 69: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); break; case 70: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); break; case 71: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); break; case 73: @@ -2214,9 +2087,9 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); } else if (!_globals._saveData->data[svField318]) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); } break; @@ -2289,40 +2162,37 @@ bool HopkinsEngine::runBeOSFull() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26); + _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26, true); else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26); + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26, true); break; case 94: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); break; case 95: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); break; case 96: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); break; case 97: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -2344,14 +2214,14 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); break; case 99: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); break; case 100: @@ -2359,15 +2229,11 @@ bool HopkinsEngine::runBeOSFull() { break; case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); break; case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); break; case 113: @@ -2531,7 +2397,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; case 3: @@ -2566,9 +2432,8 @@ bool HopkinsEngine::runWin95full() { } _globals.Max_Propre = 5; _globals._maxLineLength = 5; - _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; case 4: @@ -2580,37 +2445,32 @@ bool HopkinsEngine::runWin95full() { case 5: _globals.Max_Propre = 5; _globals._maxLineLength = 5; - _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80]) { - if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); - } - - _globals.NOSPRECRAN = false; + if (_globals._saveData->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); + else + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); break; case 6: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 460; _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; case 7: if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); break; case 8: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: @@ -2618,56 +2478,48 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else bombExplosion(); break; case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); break; case 11: - _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; _globals.Max_Propre = 15; - if (_globals._saveData->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); - } else { + if (_globals._saveData->data[svField225]) + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); + else bombExplosion(); - } break; case 13: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; case 15: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false); break; case 16: @@ -2675,9 +2527,9 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; if (_globals._saveData->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); } else if (!_globals._saveData->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); } break; @@ -2686,9 +2538,9 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Perso_Y = 440; _globals._maxLineLength = 40; if (_globals._saveData->data[svField117] == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); } else if (!_globals._saveData->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); } if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -2708,8 +2560,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); break; case 19: @@ -2717,16 +2568,16 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; if (_globals._saveData->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); break; case 20: _globals.Max_Propre = 8; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -2745,101 +2596,91 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 15; _globals.Max_Perso_Y = 445; _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); break; case 23: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); break; case 24: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField181]) { - if (_globals._saveData->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); - } else { - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); - } + if (_globals._saveData->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1, true); + else + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); break; case 25: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 445; _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); break; case 26: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); break; case 27: _globals.Max_Perso_Y = 440; _globals._maxLineLength = 15; _globals.Max_Propre = 10; - if (_globals._saveData->data[svField177] == 1) { - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); - } else if (!_globals._saveData->data[svField177]) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); - } + if (_globals._saveData->data[svField177] == 1) + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); + else if (!_globals._saveData->data[svField177]) + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); break; case 28: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1, false); break; case 29: _globals.Max_Propre = 60; _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); break; case 30: _globals.Max_Propre = 10; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); break; case 32: _globals.Max_Propre = 15; _globals.Max_Perso_Y = 445; _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); break; case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); break; case 34: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); break; case 35: @@ -2854,7 +2695,6 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; - _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { @@ -2862,8 +2702,7 @@ bool HopkinsEngine::runWin95full() { _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); if (_globals._exitId < 35 || _globals._exitId > 49) { _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; @@ -2880,174 +2719,149 @@ bool HopkinsEngine::runWin95full() { _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; _globals.Max_Propre = 20; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); break; case 52: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); break; case 54: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); break; case 55: _globals.Max_Propre = 40; _globals.Max_Perso_Y = 460; _globals._maxLineLength = 30; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); break; case 56: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); break; case 57: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); break; case 58: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); break; case 59: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); break; case 60: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); break; case 61: if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) handleConflagration(); - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); break; case 62: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); break; case 63: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); break; case 64: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); break; case 65: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); break; case 66: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); break; case 67: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); break; case 68: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); break; case 69: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); break; case 70: _globals.Max_Perso_Y = 435; _globals.Max_Propre = 8; - _globals.NOSPRECRAN = true; _globals._maxLineLength = 8; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); break; case 71: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); break; case 73: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField318] == 1) { - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); - } else if (!_globals._saveData->data[svField318]) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); - } + if (_globals._saveData->data[svField318] == 1) + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); + else if (!_globals._saveData->data[svField318]) + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); break; case 75: @@ -3119,40 +2933,37 @@ bool HopkinsEngine::runWin95full() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29, true); else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29, true); break; case 94: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); break; case 95: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = false; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, true); break; case 96: _globals.Max_Propre = 5; _globals._maxLineLength = 5; - _globals.NOSPRECRAN = true; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); break; case 97: _globals.Max_Perso_Y = 435; _globals.Max_Propre = 5; - _globals.NOSPRECRAN = true; _globals._maxLineLength = 5; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -3171,14 +2982,14 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); break; case 99: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); break; case 100: @@ -3186,15 +2997,11 @@ bool HopkinsEngine::runWin95full() { break; case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); break; case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); break; case 113: @@ -3356,7 +3163,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1); + _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; case 3: @@ -3393,8 +3200,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2); + _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; case 4: @@ -3407,35 +3213,33 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField80]) { if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3); + _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); } - _globals.NOSPRECRAN = false; break; case 6: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 460; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2); + _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; case 7: if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2); + _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); break; case 8: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2); + _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: @@ -3444,22 +3248,18 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Perso_Y = 440; if (!_globals._saveData->data[svField225]) bombExplosion(); - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10); + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); break; case 10: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); break; case 11: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: @@ -3467,8 +3267,7 @@ bool HopkinsEngine::runLinuxFull() { _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField225]) { - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1); + _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); } else { bombExplosion(); } @@ -3478,42 +3277,38 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1); + _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1); + _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; case 15: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false); break; case 16: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7); - } else if (!_globals._saveData->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7); - } + if (_globals._saveData->data[svField113] == 1) + _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); + else if (!_globals._saveData->data[svField113]) + _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); break; case 17: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField117] == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11); - } else if (!_globals._saveData->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11); - } + if (_globals._saveData->data[svField117] == 1) + _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); + else if (!_globals._saveData->data[svField117]) + _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); if (_globals._exitId == 18) { _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -3529,11 +3324,10 @@ bool HopkinsEngine::runLinuxFull() { break; case 18: - _globals.NOSPRECRAN = true; _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29); + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); break; case 19: @@ -3541,16 +3335,16 @@ bool HopkinsEngine::runLinuxFull() { _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6); + _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); break; case 20: _globals.Max_Propre = 8; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6); + _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -3569,14 +3363,14 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6); + _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); break; case 23: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6); + _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); break; case 24: @@ -3585,9 +3379,9 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField181]) { if (_globals._saveData->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1); + _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1, true); } else { - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1); + _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); } break; @@ -3595,14 +3389,14 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30); + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); break; case 26: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30); + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); break; case 27: @@ -3610,9 +3404,9 @@ bool HopkinsEngine::runLinuxFull() { _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; if (_globals._saveData->data[svField177] == 1) { - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27); + _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); } else if (!_globals._saveData->data[svField177]) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27); + _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); } break; @@ -3620,50 +3414,43 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _globals.NOSPRECRAN = true; if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1); + _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1, false); break; case 29: _globals.Max_Propre = 60; _globals._maxLineLength = 50; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1); + _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); break; case 30: _globals.Max_Propre = 10; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10); + _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); break; case 32: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2); + _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); break; case 33: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); break; case 34: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); break; case 35: @@ -3678,7 +3465,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; _globals._forestFl = true; - _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { @@ -3686,8 +3472,7 @@ bool HopkinsEngine::runLinuxFull() { _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); _soundManager.loadSample(1, "SOUND41.WAV"); } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); if (_globals._exitId < 35 || _globals._exitId > 49) { _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); _globals._forestFl = false; @@ -3705,163 +3490,139 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 20; _globals._maxLineLength = 10; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14); + _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); break; case 52: _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14); + _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); break; case 54: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14); + _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); break; case 55: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 460; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14); + _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); break; case 56: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14); + _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); break; case 57: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14); + _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); break; case 58: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14); + _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); break; case 59: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); break; case 60: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 440; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); break; case 61: if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) handleConflagration(); - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21); + _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); break; case 62: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); break; case 63: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); break; case 64: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21); + _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); break; case 65: _globals.Max_Propre = 40; _globals._maxLineLength = 30; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); break; case 66: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); break; case 67: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); break; case 68: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21); + _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); break; case 69: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); break; case 70: _globals.Max_Propre = 8; _globals._maxLineLength = 8; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); break; case 71: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); break; case 73: @@ -3869,9 +3630,9 @@ bool HopkinsEngine::runLinuxFull() { _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField318] == 1) { - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21); + _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); } else if (!_globals._saveData->data[svField318]) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21); + _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); } break; @@ -3944,40 +3705,37 @@ bool HopkinsEngine::runLinuxFull() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; if (_globals._saveData->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29); + _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29, true); else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29); + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29, true); break; case 94: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19); + _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); break; case 95: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19); + _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); break; case 96: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19); + _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); break; case 97: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19); + _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { _globals.iRegul = 1; _soundManager.WSOUND_OFF(); @@ -3996,14 +3754,14 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19); + _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); break; case 99: _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19); + _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); break; case 100: @@ -4011,15 +3769,11 @@ bool HopkinsEngine::runLinuxFull() { break; case 111: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); break; case 112: - _globals.NOSPRECRAN = true; - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10); - _globals.NOSPRECRAN = false; + _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); break; case 113: diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7f4be30db3..25c6fe1968 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2263,7 +2263,6 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.Max_Propre = 1; _vm->_globals._maxLineLength = 1; _vm->_globals.Max_Perso_Y = 440; - _vm->_globals.NOSPRECRAN = true; _vm->_globals.PLAN_FLAG = true; _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; @@ -2280,7 +2279,7 @@ void ObjectsManager::PLAN_BETA() { _spritePtr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); - _vm->_graphicsManager.INI_ECRAN2("PLAN"); + _vm->_graphicsManager.INI_ECRAN2("PLAN", false); for (int v2 = 0; v2 <= 15; v2++) _vm->_globals.CACHE_OFF(v2); _vm->_globals.CACHE_OFF(19); @@ -2357,7 +2356,6 @@ void ObjectsManager::PLAN_BETA() { removeSprite(0); _spritePtr = _vm->_globals.freeMemory(_spritePtr); CLEAR_ECRAN(); - _vm->_globals.NOSPRECRAN = false; _vm->_globals.PLAN_FLAG = false; } @@ -2695,7 +2693,6 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; - _vm->_globals.NOSPRECRAN = false; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.g_old_sens = -1; my_anim = 1; @@ -4964,7 +4961,7 @@ void ObjectsManager::lockAnimX(int idx, int a2) { } void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v) { + const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { int v5; int v7; int v8; @@ -4989,10 +4986,10 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_animationManager.loadAnim(animFile); _vm->_graphicsManager.VISU_ALL(); if (!s4.empty()) { - if (!_vm->_globals.NOSPRECRAN) - _vm->_graphicsManager.INI_ECRAN(s4); - if (!s4.empty() && _vm->_globals.NOSPRECRAN) - _vm->_graphicsManager.INI_ECRAN2(s4); + if (initializeScreen) + _vm->_graphicsManager.INI_ECRAN(s4, initializeScreen); + if (!s4.empty() && !initializeScreen) + _vm->_graphicsManager.INI_ECRAN2(s4, initializeScreen); } _vm->_eventsManager.mouseOn(); if (_vm->_globals._screenId == 61) { @@ -5059,7 +5056,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v) { + const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { int mouseButtons; bool breakFlag; int xp, yp; @@ -5086,10 +5083,10 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.VISU_ALL(); } if (!s4.empty()) { - if (!_vm->_globals.NOSPRECRAN) - _vm->_graphicsManager.INI_ECRAN(s4); + if (initializeScreen) + _vm->_graphicsManager.INI_ECRAN(s4, initializeScreen); else - _vm->_graphicsManager.INI_ECRAN2(s4); + _vm->_graphicsManager.INI_ECRAN2(s4, initializeScreen); } _vm->_eventsManager.mouseOn(); _vm->_eventsManager._mouseCursorId = 4; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 5067e8f0ec..db9b85a0d0 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -240,13 +240,13 @@ public: * Game scene control method */ void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v); + const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); /** * Game scene control method */ void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v); + const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); }; } // End of namespace Hopkins diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 10ed19016c..dae57bd47d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2282,7 +2282,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.OPTI_INI("BOMBE", 2); + _vm->_graphicsManager.OPTI_INI("BOMBE", 2, true); _vm->_graphicsManager.fadeInShort(); break; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 38677d5fff..94efcbe5db 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1130,7 +1130,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { initCharacterAnim(); VISU_PARLE(); dialogWait(); - _vm->_graphicsManager.INI_ECRAN2(v22); + _vm->_graphicsManager.INI_ECRAN2(v22, true); _vm->_globals.NOMARCHE = true; _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager.NUMZONE = -1; @@ -1164,7 +1164,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.COUCOU = v11; _vm->_objectsManager._disableFl = true; _vm->_objectsManager.INILINK(v20); - _vm->_graphicsManager.INI_ECRAN2(v20); + _vm->_graphicsManager.INI_ECRAN2(v20, true); _vm->_objectsManager._disableFl = false; _vm->_globals.NOMARCHE = false; if (_vm->_globals._exitId == 101) -- cgit v1.2.3 From 416463c3dab090b888bc13cecf8262470872e411 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Jan 2013 19:59:38 +0200 Subject: HOPKINS: Get rid of _disableCursorFl --- engines/hopkins/objects.cpp | 1 - engines/hopkins/objects.h | 1 - engines/hopkins/talk.cpp | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 25c6fe1968..ebc83520bd 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -55,7 +55,6 @@ ObjectsManager::ObjectsManager() { _saveLoadFl = false; SL_MODE = false; _visibleFl = false; - _disableCursorFl = false; BOBTOUS = false; my_anim = 0; NUMZONE = 0; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index db9b85a0d0..38f09d3548 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -80,7 +80,6 @@ public: bool _saveLoadFl; int SL_MODE; bool _visibleFl; - bool _disableCursorFl; bool BOBTOUS; int my_anim; int NUMZONE; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 94efcbe5db..3d00c441fd 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -156,7 +156,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } void TalkManager::PARLER_PERSO2(const Common::String &filename) { - _vm->_objectsManager._disableCursorFl = true; + // TODO: The original disables the mouse cursor here STATI = 1; bool v7 = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; @@ -222,7 +222,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager.changeMouseCursor(v8); _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); - _vm->_objectsManager._disableCursorFl = false; + // TODO: The original reenables the mouse cursor here _vm->_globals._disableInventFl = v7; STATI = 0; } -- cgit v1.2.3 From 991f999069219d45efec8f8df3ac791fa19f4ffd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Jan 2013 20:32:08 +0100 Subject: HOPKINS: Add detection for Hopkins Spanish --- engines/hopkins/detection_tables.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index 5c24935acf..a5a0242402 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -105,6 +105,22 @@ static const HopkinsGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { + // Hopkins FBI Win95 Spanish + { + "hopkins", + 0, + { + {"Hopkins.exe", 0, "31c837378bb2e0b2573befea44956d3f", 421386}, + {"RES_VES.RES", 0, "77ee08896466ae88cc1af3bf1a0bf78c", 32882302}, + AD_LISTEND + }, + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, { // Hopkins FBI Win95, provided by Strangerke { -- cgit v1.2.3 From 337c5d0e8d5d3f7fe20150aff0ee1703dc230455 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Jan 2013 00:38:00 +0200 Subject: HOPKINS: Merge all the different full version logic handlers --- engines/hopkins/hopkins.cpp | 2554 +++---------------------------------------- engines/hopkins/hopkins.h | 10 +- 2 files changed, 148 insertions(+), 2416 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2fd9293d51..85ffc6e2f6 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -105,24 +105,24 @@ Common::Error HopkinsEngine::run() { if (getIsDemo()) runLinuxDemo(); else - runLinuxFull(); + runFull(); } else if (getPlatform() == Common::kPlatformWindows) { if (getIsDemo()) runWin95Demo(); else - runWin95full(); + runFull(); } else if (getPlatform() == Common::kPlatformBeOS) { if (getIsDemo()) { warning("Unhandled version, switching to linux demo"); runLinuxDemo(); } else - runBeOSFull(); + runFull(); } else { if (getIsDemo()) { warning("Unhandled version, switching to linux demo"); runLinuxDemo(); } else - runOS2Full(); + runFull(); } return Common::kNoError; @@ -782,2359 +782,59 @@ bool HopkinsEngine::runLinuxDemo() { return true; } -bool HopkinsEngine::runOS2Full() { - _globals.loadObjects(); - _objectsManager.changeObject(14); - _objectsManager.addObject(14); - warning("_graphicsManager.loadImage(\"VERSW\");"); - warning("_graphicsManager.FADE_INW();"); - _eventsManager.delay(500); - _graphicsManager.fadeOutLong(); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - - // Add 16ms delay in order to match the Linux and Win95 versions - _animationManager.playAnim("MP.ANM", 10, 16, 200); - _graphicsManager.fadeOutLong(); - if (!_eventsManager._escKeyFl) - playIntro(); - _graphicsManager.loadImage("H2"); - _graphicsManager.fadeInLong(); - _globals.iRegul = 0; - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); - _globals.PERSO_TYPE = 0; - _globals.PLANX = _globals.PLANY = 0; - memset(_globals._saveData, 0, 1996); - _globals._exitId = 0; - for (;;) { - if (_globals._exitId == 300) - _globals._exitId = 0; - if (!_globals._exitId) { - _globals._exitId = _menuManager.menu(); - if (_globals._exitId == -1) - break; - } - - if (g_system->getEventManager()->shouldQuit()) - break; - - switch (_globals._exitId) { - case 1: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); - break; - - case 3: - if (!_globals._saveData->data[170]) { - _soundManager.WSOUND(3); - _graphicsManager.loadImage("fond"); - _graphicsManager.fadeInLong(); - _eventsManager.delay(5000); - _graphicsManager.fadeOutLong(); - _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _graphicsManager.fadeOutLong(); - _globals._saveData->data[170] = 1; - } - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); - break; - - case 4: - _globals._disableInventFl = true; - _objectsManager.PLAN_BETA(); - _globals._disableInventFl = false; - break; - - case 5: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[80]) { - if (_globals._saveData->data[80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); - } - else - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); - break; - - case 6: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); - break; - - case 7: - if (_globals._saveData->data[220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); - else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); - break; - - case 8: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); - break; - - case 9: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); - else - bombExplosion(); - break; - - case 10: - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); - break; - - case 11: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); - break; - - case 12: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[225]) - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); - else - bombExplosion(); - break; - - case 13: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); - break; - - case 14: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); - break; - - case 15: - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18, false); - break; - - case 16: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[113] == 1) - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM", "IM16", 7, true); - else { - if (!_globals._saveData->data[113]) - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); - } - break; - - case 17: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[117] == 1) - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); - else { - if (!_globals._saveData->data[117]) - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); - } - if (_globals._exitId == 18) { - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); -// _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 18: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6, false); - break; - - case 19: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); - else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); - break; - - case 20: - _globals.Max_Propre = 8; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); - if (_globals._exitId == 17) { - _globals.iRegul = 1; - // _soundManager.WSOUND_OFF(); - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 22: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); - break; - - case 23: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); - break; - - case 24: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[181]) { - if (_globals._saveData->data[181] == 1 ) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1, true); - } else - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); - break; - - case 25: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8, true); - break; - - case 26: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8, true); - break; - - case 27: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[177] == 1) - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); - else { - if (!_globals._saveData->data[177]) - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); - } - break; - - case 28: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[166] != 1 || _globals._saveData->data[167] != 1 ) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); - else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1, false); - break; - - case 29: - _globals.Max_Propre = 60; - _globals._maxLineLength = 50; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); - break; - - case 30: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); - break; - - case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); - break; - - case 32: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); - break; - - case 33: - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); - break; - - case 34: - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); - break; - - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: { - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _globals._disableInventFl = false; - _globals._forestFl = true; - Common::String im = Common::String::format("IM%d", _globals._exitId); - _soundManager.WSOUND(13); - if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); - _soundManager.loadSample(1, "SOUND41.WAV"); - } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); - if (_globals._exitId < 35 || _globals._exitId > 49 ) { - _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); - _globals._forestFl = false; - _soundManager.DEL_SAMPLE(1); - } - break; - } - - case 50: - displayPlane(); - _globals._exitId = 51; - break; - - case 51: - _globals.Max_Propre = 20; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); - break; - - case 52: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); - break; - - case 54: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); - break; - - case 55: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); - break; - - case 56: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); - break; - - case 57: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); - break; - - case 58: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); - break; - - case 59: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); - break; - - case 60: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); - break; - - case 61: - if (_globals._saveData->data[311] == 1 && !_globals._saveData->data[312] ) - handleConflagration(); - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); - break; - - case 62: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); - break; - - case 63: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); - break; - - case 64: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); - break; - - case 65: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); - break; - - case 66: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); - break; - - case 67: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); - break; - - case 68: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); - break; - - case 69: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); - break; - - case 70: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); - break; - - case 71: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); - break; - - case 73: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[318] == 1) - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); - else { - if (!_globals._saveData->data[318]) - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); - } - break; - - case 75: - BASE(); - break; - - case 77: - OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); - break; - - case 78: - OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); - break; - - case 79: - OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); - break; - - case 80: - OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); - break; - - case 81: - OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); - break; - - case 82: - OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); - break; - - case 83: - OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); - break; - - case 84: - OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); - break; - - case 85: - OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); - break; - - case 86: - OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); - break; - - case 87: - OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); - break; - - case 88: - OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); - break; - - case 89: - OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); - break; - - case 90: - BASED(); - break; - - case 91: - OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); - break; - - case 93: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 26, true); - else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26, true); - break; - - case 94: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); - break; - - case 95: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); - break; - - case 96: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); - break; - - case 97: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); - if (_globals._exitId == 18) { - _globals.iRegul = 1; - // _soundManager.WSOUND_OFF(); - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 98: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); - break; - - case 99: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); - break; - - case 100: - playEnding(); - break; - - case 111: - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); - break; - - case 112: - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); - break; - - case 113: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[6] = _globals._screenId; - _globals._screenId = 113; - _globals._saveData->data[5] = 113; - _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager._vesaBuffer, 0, 307200); - memset(_graphicsManager._vesaScreen, 0, 307200); - _graphicsManager.clearPalette(); - _graphicsManager.RESET_SEGMENT_VESA(); - break; - - case 114: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[6] = _globals._screenId; - _globals._screenId = 114; - _globals._saveData->data[5] = 114; - _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - break; - - case 115: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[6] = _globals._screenId; - _globals._screenId = 115; - _globals._saveData->data[5] = 115; - _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - break; - - case 150: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 151: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 152: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 194: - case 195: - case 196: - case 197: - case 198: - case 199: - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - _globals.iRegul = 1; - // _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(23); - _globals._exitId = handleBaseMap(); - // _soundManager.WSOUND_OFF(); - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); - _globals.PERSO_TYPE = 0; - _globals.iRegul = 0; - break; - } - } - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - warning("sub_33C70(v18);"); - warning("sub_39460(v19);"); - warning("sub_44134();"); - restoreSystem(); - return true; -} - -bool HopkinsEngine::runBeOSFull() { - warning("TODO: Init_Interrupt()"); - _globals.loadObjects(); - _objectsManager.changeObject(14); - _objectsManager.addObject(14); - _eventsManager.delay(500); - _graphicsManager.fadeOutLong(); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - - // Add 16ms delay in order to match the Linux and Win95 versions - _animationManager.playAnim("MP.ANM", 10, 16, 200); - _graphicsManager.fadeOutLong(); - if (!_eventsManager._escKeyFl) - playIntro(); - _graphicsManager.fadeOutShort(); - _graphicsManager.loadImage("H2"); - _graphicsManager.fadeInLong(); - _graphicsManager.fadeOutLong(); - _globals.iRegul = 0; - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); - _globals.PERSO_TYPE = 0; - _globals.PLANX = _globals.PLANY = 0; - memset(_globals._saveData, 0, 1996); - _globals._exitId = 0; - - for (;;) { - - if (_globals._exitId == 300) - _globals._exitId = 0; - if (!_globals._exitId) { - _globals._exitId = _menuManager.menu(); - if (_globals._exitId == -1) { - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - restoreSystem(); - } - } - - if (g_system->getEventManager()->shouldQuit()) - return false; - - switch (_globals._exitId) { - case 1: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); - break; - - case 3: - if (!_globals._saveData->data[svField170]) { - _soundManager.WSOUND(3); - _graphicsManager.loadImage("FOND"); - _graphicsManager.fadeInLong(); - _eventsManager.delay(5000); - _graphicsManager.fadeOutLong(); - _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _graphicsManager.fadeOutLong(); - _globals._saveData->data[svField170] = 1; - } - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); - break; - - case 4: - _globals._disableInventFl = true; - _objectsManager.PLAN_BETA(); - _globals._disableInventFl = false; - break; - - case 5: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80]) { - if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); - } else { - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); - } - break; - - case 6: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); - break; - - case 7: - if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); - else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); - break; - - case 8: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); - break; - - case 9: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; - if (!_globals._saveData->data[svField225]) - bombExplosion(); - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); - break; - - case 10: - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); - break; - - case 11: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); - break; - - case 12: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField225]) { - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); - } else { - bombExplosion(); - } - break; - - case 13: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); - break; - - case 14: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); - break; - - case 15: - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18, false); - break; - - case 16: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); - } else if (!_globals._saveData->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); - } - break; - - case 17: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField117] == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); - } else if (!_globals._saveData->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); - } - if (_globals._exitId == 18) { - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 18: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6, false); - break; - - case 19: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); - else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); - break; - - case 20: - _globals.Max_Propre = 8; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); - if (_globals._exitId == 17) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 22: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); - break; - - case 23: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); - break; - - case 24: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField181]) { - if (_globals._saveData->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true); - } else { - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); - } - break; - - case 25: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8, true); - break; - - case 26: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8, true); - break; - - case 27: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField177] == 1) { - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); - } else if (!_globals._saveData->data[svField177]) { - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); - } - break; - - case 28: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); - else - _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1, false); - break; - - case 29: - _globals.Max_Propre = 60; - _globals._maxLineLength = 50; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); - break; - - case 30: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); - break; - - case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); - break; - - case 32: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); - break; - - case 33: - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); - break; - - case 34: - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); - break; - - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: { - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _globals._disableInventFl = false; - _globals._forestFl = true; - Common::String im = Common::String::format("IM%d", _globals._exitId); - _soundManager.WSOUND(13); - if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); - _soundManager.loadSample(1, "SOUND41.WAV"); - } - - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); - if ((_globals._exitId < 35) || (_globals._exitId > 49)) { - _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); - _globals._forestFl = false; - _soundManager.DEL_SAMPLE(1); - } - break; - } - - case 50: - displayPlane(); - _globals._exitId = 51; - break; - - case 51: - _globals.Max_Propre = 20; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); - break; - - case 52: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); - break; - - case 54: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); - break; - - case 55: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); - break; - - case 56: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); - break; - - case 57: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); - break; - - case 58: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); - break; - - case 59: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); - break; - - case 60: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); - break; - - case 61: - if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) - handleConflagration(); - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); - break; - - case 62: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); - break; - - case 63: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); - break; - - case 64: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); - break; - - case 65: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); - break; - - case 66: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); - break; - - case 67: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); - break; - - case 68: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); - break; - - case 69: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); - break; - - case 70: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); - break; - - case 71: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); - break; - - case 73: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField318] == 1) { - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); - } else if (!_globals._saveData->data[svField318]) { - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); - } - break; - - case 75: - BASE(); - break; - - case 77: - OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); - break; - - case 78: - OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); - break; - - case 79: - OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); - break; - - case 80: - OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); - break; - - case 81: - OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); - break; - - case 82: - OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); - break; - - case 83: - OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); - break; - - case 84: - OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); - break; - - case 85: - OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); - break; - - case 86: - OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); - break; - - case 87: - OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); - break; - - case 88: - OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); - break; - - case 89: - OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); - break; - - case 90: - BASED(); - break; - - case 91: - OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); - break; - - case 93: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26, true); - else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26, true); - break; - - case 94: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); - break; - - case 95: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); - break; - - case 96: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); - break; - - case 97: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); - if (_globals._exitId == 18) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 98: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); - break; - - case 99: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); - break; - - case 100: - playEnding(); - break; - - case 111: - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); - break; - - case 112: - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); - break; - - case 113: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; - _globals._screenId = 113; - _globals._saveData->data[svField5] = 113; - _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager._vesaBuffer, 0, 307200); - memset(_graphicsManager._vesaScreen, 0, 307200); - _graphicsManager.clearPalette(); - _graphicsManager.RESET_SEGMENT_VESA(); - break; - - case 114: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; - _globals._screenId = 114; - _globals._saveData->data[svField5] = 114; - _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - break; - - case 115: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; - _globals._screenId = 115; - _globals._saveData->data[svField5] = 115; - _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - break; - - case 150: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 151: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 152: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - - // Added lock and unlock to avoid crash - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 194: - case 195: - case 196: - case 197: - case 198: - case 199: - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(23); - _globals._exitId = handleBaseMap(); - _soundManager.WSOUND_OFF(); - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); - _globals.PERSO_TYPE = 0; - _globals.iRegul = 0; - break; - } - } - return true; -} - -bool HopkinsEngine::runWin95full() { - warning("TODO: Init_Interrupt_()"); - - _globals.loadObjects(); - _objectsManager.changeObject(14); - _objectsManager.addObject(14); - _globals._helicopterFl = false; - _globals.iRegul = 1; - - warning("TODO: Affiche_Version();"); - - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - - _animationManager.playAnim("MP.ANM", 10, 16, 200); - _graphicsManager.fadeOutLong(); - if (!_eventsManager._escKeyFl) - playIntro(); - _graphicsManager.loadImage("H2"); - _graphicsManager.fadeInLong(); - _eventsManager.delay(500); - _graphicsManager.fadeOutLong(); - _globals.iRegul = 0; - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); - _globals.PERSO_TYPE = 0; - _globals.PLANX = _globals.PLANY = 0; - memset(_globals._saveData, 0, 2000); - _globals._exitId = 0; - for (;;) { - if (_globals._exitId == 300) - _globals._exitId = 0; - - if (!_globals._exitId) { - _globals._exitId = _menuManager.menu(); - if (_globals._exitId == -1) { - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - restoreSystem(); - return false; - } - } - - if (g_system->getEventManager()->shouldQuit()) - return false; - - switch (_globals._exitId) { - case 1: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); - break; - - case 3: - if (!_globals._saveData->data[svField170]) { - _soundManager.WSOUND(3); - if (_globals._language == LANG_FR) - _graphicsManager.loadImage("fondfr"); - else if (_globals._language == LANG_EN) - _graphicsManager.loadImage("fondan"); - else if (_globals._language == LANG_SP) - _graphicsManager.loadImage("fondes"); - _graphicsManager.fadeInLong(); - _eventsManager.delay(500); - _graphicsManager.fadeOutLong(); - _soundManager.SPECIAL_SOUND = 2; - _globals.iRegul = 1; - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - if (!_globals._censorshipFl) - _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); - else - _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); - _graphicsManager.fadeOutLong(); - _globals._saveData->data[svField170] = 1; - } - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); - break; - - case 4: - _globals._disableInventFl = true; - _objectsManager.PLAN_BETA(); - _globals._disableInventFl = false; - break; - - case 5: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); - else - _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); - break; - - case 6: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 460; - _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); - break; - - case 7: - if (_globals._saveData->data[svField220]) - _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); - else - _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); - break; - - case 8: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); - break; - - case 9: - _globals._maxLineLength = 20; - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField225]) - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); - else - bombExplosion(); - break; - - case 10: - _objectsManager.PERSONAGE("IM10", "IM10", "ANIM10", "IM10", 9, false); - break; - - case 11: - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); - break; - - case 12: - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 15; - if (_globals._saveData->data[svField225]) - _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); - else - bombExplosion(); - break; - - case 13: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); - break; - - case 14: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); - break; - - case 15: - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false); - break; - - case 16: - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - if (_globals._saveData->data[svField113] == 1) { - _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); - } else if (!_globals._saveData->data[svField113]) { - _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); - } - break; - - case 17: - _globals.Max_Propre = 50; - _globals.Max_Perso_Y = 440; - _globals._maxLineLength = 40; - if (_globals._saveData->data[svField117] == 1) { - _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); - } else if (!_globals._saveData->data[svField117]) { - _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); - } - if (_globals._exitId == 18) { - _globals.iRegul = 1; - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(29); - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 18: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); - break; - - case 19: - _globals.Max_Perso_Y = 440; - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - if (_globals._saveData->data[svField123]) - _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); - else - _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); - break; - - case 20: - _globals.Max_Propre = 8; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); - if (_globals._exitId == 17) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 22: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 445; - _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); - break; - - case 23: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 440; - _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); - break; - - case 24: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1, true); - else - _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); - break; - - case 25: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 445; - _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); - break; - - case 26: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); - break; - - case 27: - _globals.Max_Perso_Y = 440; - _globals._maxLineLength = 15; - _globals.Max_Propre = 10; - if (_globals._saveData->data[svField177] == 1) - _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); - else if (!_globals._saveData->data[svField177]) - _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); - break; - - case 28: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) - _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); - else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1, false); - break; - - case 29: - _globals.Max_Propre = 60; - _globals._maxLineLength = 50; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); - break; - - case 30: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); - break; - - case 31: - _objectsManager.PERSONAGE("IM31", "IM31", "ANIM31", "IM31", 10, true); - break; - - case 32: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 445; - _globals._maxLineLength = 20; - _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); - break; - - case 33: - _objectsManager.PERSONAGE("IM33", "IM33", "ANIM33", "IM33", 8, false); - break; - - case 34: - _objectsManager.PERSONAGE("IM34", "IM34", "ANIM34", "IM34", 2, false); - break; - - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: { - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; - _globals._disableInventFl = false; - _globals._forestFl = true; - Common::String im = Common::String::format("IM%d", _globals._exitId); - _soundManager.WSOUND(13); - if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); - _soundManager.loadSample(1, "SOUND41.WAV"); - } - _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); - if (_globals._exitId < 35 || _globals._exitId > 49) { - _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); - _globals._forestFl = false; - _soundManager.DEL_SAMPLE(1); - } - break; - } - case 50: - displayPlane(); - _globals._exitId = 51; - break; - - case 51: - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; - _globals.Max_Propre = 20; - _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); - break; - - case 52: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); - break; - - case 54: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); - break; - - case 55: - _globals.Max_Propre = 40; - _globals.Max_Perso_Y = 460; - _globals._maxLineLength = 30; - _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); - break; - - case 56: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); - break; - - case 57: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); - break; - - case 58: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); - break; - - case 59: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); - break; - - case 60: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); - break; - - case 61: - if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) - handleConflagration(); - _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); - break; - - case 62: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); - break; - - case 63: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); - break; - - case 64: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); - break; - - case 65: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); - break; - - case 66: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); - break; - - case 67: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); - break; - - case 68: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); - break; - - case 69: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); - break; - - case 70: - _globals.Max_Perso_Y = 435; - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); - break; - - case 71: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); - break; - - case 73: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField318] == 1) - _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); - else if (!_globals._saveData->data[svField318]) - _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); - break; - - case 75: - BASE(); - break; - - case 77: - OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); - break; - - case 78: - OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); - break; - - case 79: - OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); - break; - - case 80: - OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); - break; - - case 81: - OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); - break; - - case 82: - OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); - break; - - case 83: - OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); - break; - - case 84: - OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); - break; - - case 85: - OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); - break; - - case 86: - OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); - break; - - case 87: - OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); - break; - - case 88: - OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); - break; - - case 89: - OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); - break; - - case 90: - BASED(); - break; - - case 91: - OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); - break; - - case 93: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29, true); - else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29, true); - break; - - case 94: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 440; - _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); - break; - - case 95: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, true); - break; - - case 96: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); - break; - - case 97: - _globals.Max_Perso_Y = 435; - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); - if (_globals._exitId == 18) { - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); - _graphicsManager.fadeOutShort(); - _globals.iRegul = 0; - } - break; - - case 98: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); - break; - - case 99: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); - break; - - case 100: - playEnding(); - break; - - case 111: - _objectsManager.PERSONAGE("IM111", "IM111", "ANIM111", "IM111", 10, false); - break; - - case 112: - _objectsManager.PERSONAGE("IM112", "IM112", "ANIM112", "IM112", 10, false); - break; - - case 113: - _globals._prevScreenId = _globals._screenId; - _globals._screenId = 113; - _globals._saveData->data[svField6] = _globals._prevScreenId; - _globals._saveData->data[svField5] = _globals._screenId; - _globals._exitId = 0; - _computerManager.showComputer(COMPUTER_HOPKINS); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.DD_VBL(); - memset(_graphicsManager._vesaBuffer, 0, 307200); - memset(_graphicsManager._vesaScreen, 0, 307200); - _graphicsManager.clearPalette(); - _graphicsManager.RESET_SEGMENT_VESA(); - break; - - case 114: - _globals._exitId = 0; - _globals._prevScreenId = _globals._screenId; - _globals._screenId = 114; - _globals._saveData->data[svField6] = _globals._prevScreenId; - _globals._saveData->data[svField5] = _globals._screenId; - _computerManager.showComputer(COMPUTER_SAMANTHAS); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - break; - - case 115: - _globals._prevScreenId = _globals._screenId; - _globals._screenId = 115; - _globals._saveData->data[svField6] = _globals._prevScreenId; - _globals._saveData->data[svField5] = _globals._screenId; - _globals._exitId = 0; - _computerManager.showComputer(COMPUTER_PUBLIC); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - break; - - case 150: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 151: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 152: - _soundManager.WSOUND(16); - _globals.iRegul = 1; - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); - _globals.iRegul = 0; - _globals._exitId = 300; - break; - - case 194: - case 195: - case 196: - case 197: - case 198: - case 199: - _globals.PERSO = _globals.freeMemory(_globals.PERSO); - _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - warning("TODO: heapshrink();"); - _soundManager.WSOUND(23); - _globals._exitId = WBASE(); - _soundManager.WSOUND_OFF(); - warning("TODO: heapshrink();"); - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); - _globals.PERSO_TYPE = 0; - _globals.iRegul = 0; - _graphicsManager._lineNbr = SCREEN_WIDTH; - if (_globals._exitId == -1) - error("FIN BASE SOUS MARINE"); - break; - } - } - return true; -} - -bool HopkinsEngine::runLinuxFull() { - _soundManager.WSOUND(16); +bool HopkinsEngine::runFull() { + //warning("TODO: Init_Interrupt()"); // BeOS / Windows + if (getPlatform() == Common::kPlatformLinux) + _soundManager.WSOUND(16); _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); - _globals._helicopterFl = false; - _eventsManager.mouseOff(); + if (getPlatform() == Common::kPlatformLinux) { + _globals._helicopterFl = false; + _eventsManager.mouseOff(); + } else if (getPlatform() == Common::kPlatformWindows) { + _globals._helicopterFl = false; + _globals.iRegul = 1; + // warning("TODO: Affiche_Version();"); + } else { + //warning("_graphicsManager.loadImage(\"VERSW\");"); // OS/2 + //warning("_graphicsManager.FADE_INW();"); // OS/2 + _eventsManager.delay(500); + _graphicsManager.fadeOutLong(); + _globals.iRegul = 1; + } _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); + _graphicsManager.clearPalette(); - _graphicsManager.loadImage("H2"); - _graphicsManager.fadeInLong(); - _eventsManager.delay(500); - _graphicsManager.fadeOutLong(); + if (getPlatform() == Common::kPlatformLinux) { + _graphicsManager.loadImage("H2"); + _graphicsManager.fadeInLong(); + _eventsManager.delay(500); + _graphicsManager.fadeOutLong(); - _globals._speed = 2; - _globals.iRegul = 1; - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("MP.ANM", 10, 16, 200); + _globals._speed = 2; + _globals.iRegul = 1; + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("MP.ANM", 10, 16, 200); + } else { + _animationManager.playAnim("MP.ANM", 10, 16, 200); + _graphicsManager.fadeOutLong(); + } if (!_eventsManager._escKeyFl) playIntro(); - + if (getPlatform() != Common::kPlatformLinux) { + _graphicsManager.fadeOutShort(); + _graphicsManager.loadImage("H2"); + _graphicsManager.fadeInLong(); + _eventsManager.delay(500); + _graphicsManager.fadeOutLong(); + } _globals.iRegul = 0; _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); @@ -3142,7 +842,6 @@ bool HopkinsEngine::runLinuxFull() { _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; - for (;;) { if (_globals._exitId == 300) _globals._exitId = 0; @@ -3151,7 +850,7 @@ bool HopkinsEngine::runLinuxFull() { if (_globals._exitId == -1) { _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); - return true; + return false; } } @@ -3184,19 +883,25 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _graphicsManager.FADE_LINUX = 2; - if (!_globals._censorshipFl) - _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); - else - _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) { + if (getPlatform() == Common::kPlatformLinux) + _graphicsManager.FADE_LINUX = 2; + if (!_globals._censorshipFl) + _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); + else + _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); + } else { + _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); + } _soundManager.SPECIAL_SOUND = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); + if (getPlatform() != Common::kPlatformLinux) + _graphicsManager.fadeOutLong(); _globals._saveData->data[svField170] = 1; } - _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; @@ -3213,12 +918,10 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80]) { - if (_globals._saveData->data[svField80] == 1) - _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); - } else { + if (_globals._saveData->data[svField80] == 1) + _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); + else _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); - } break; case 6: @@ -3246,9 +949,10 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; - if (!_globals._saveData->data[svField225]) + if (_globals._saveData->data[svField225]) + _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); + else bombExplosion(); - _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); break; case 10: @@ -3266,11 +970,10 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField225]) { + if (_globals._saveData->data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); - } else { + else bombExplosion(); - } break; case 13: @@ -3288,7 +991,10 @@ bool HopkinsEngine::runLinuxFull() { break; case 15: - _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false); + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 29, false); + else + _objectsManager.PERSONAGE("IM15", "IM15", "ANIM15", "IM15", 18, false); break; case 16: @@ -3297,7 +1003,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Perso_Y = 450; if (_globals._saveData->data[svField113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); - else if (!_globals._saveData->data[svField113]) + else _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); break; @@ -3316,9 +1022,19 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(29); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + if (getPlatform() == Common::kPlatformLinux) { + _soundManager.WSOUND(29); + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + } else if (getPlatform() == Common::kPlatformWindows) { + _soundManager.WSOUND(29); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + _graphicsManager.fadeOutShort(); + } else { + _soundManager.WSOUND(6); + _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); + _graphicsManager.fadeOutShort(); + } _globals.iRegul = 0; } break; @@ -3327,7 +1043,10 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); + else + _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 6, false); break; case 19: @@ -3347,14 +1066,17 @@ bool HopkinsEngine::runLinuxFull() { _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _soundManager.WSOUND_OFF(); _soundManager.WSOUND(6); - _graphicsManager.FADE_LINUX = 2; + if (getPlatform() == Common::kPlatformLinux) + _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); + if (getPlatform() != Common::kPlatformLinux) + _graphicsManager.fadeOutShort(); _globals.iRegul = 0; } break; @@ -3377,37 +1099,40 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField181]) { - if (_globals._saveData->data[svField181] == 1) - _objectsManager.PERSONAGE2("IM24", "IM24a", "ANIM24", "IM24", 1, true); - } else { + if (_globals._saveData->data[svField181] == 1) + _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true); + else _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); - } break; case 25: _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 445; - _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); + else + _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 8, true); break; case 26: _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 435; - _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); + else + _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 8, true); break; case 27: _globals.Max_Propre = 10; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField177] == 1) { + if (_globals._saveData->data[svField177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); - } else if (!_globals._saveData->data[svField177]) { + else _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); - } break; case 28: @@ -3417,7 +1142,7 @@ bool HopkinsEngine::runLinuxFull() { if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else - _objectsManager.PERSONAGE2("IM28a", "IM28", "ANIM28", "IM28", 1, false); + _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1, false); break; case 29: @@ -3629,11 +1354,10 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField318] == 1) { + if (_globals._saveData->data[svField318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); - } else if (!_globals._saveData->data[svField318]) { + else _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); - } break; case 75: @@ -3704,10 +1428,17 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField330]) - _objectsManager.PERSONAGE2("IM93", "IM93c", "ANIM93", "IM93", 29, true); - else - _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29, true); + if (_globals._saveData->data[svField330]) { + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) + _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 29, true); + else + _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 26, true); + } else { + if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 29, true); + else + _objectsManager.PERSONAGE2("IM93", "IM93", "ANIM93", "IM93", 26, true); + } break; case 94: @@ -3777,11 +1508,11 @@ bool HopkinsEngine::runLinuxFull() { break; case 113: - _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 113; - _globals._saveData->data[svField5] = 113; + _globals._saveData->data[svField6] = _globals._prevScreenId; + _globals._saveData->data[svField5] = _globals._screenId; + _globals._exitId = 0; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3796,9 +1527,9 @@ bool HopkinsEngine::runLinuxFull() { case 114: _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; - _globals._saveData->data[svField5] = 114; + _globals._saveData->data[svField6] = _globals._prevScreenId; + _globals._saveData->data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_SAMANTHAS); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3806,11 +1537,11 @@ bool HopkinsEngine::runLinuxFull() { break; case 115: - _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 115; - _globals._saveData->data[svField5] = 115; + _globals._saveData->data[svField6] = _globals._prevScreenId; + _globals._saveData->data[svField5] = _globals._screenId; + _globals._exitId = 0; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -3824,8 +1555,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("JOUR1A.anm", 12, 12, 2000); + if (getPlatform() == Common::kPlatformLinux) + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("JOUR1A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals._exitId = 300; break; @@ -3837,8 +1569,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("JOUR3A.anm", 12, 12, 2000); + if (getPlatform() == Common::kPlatformLinux) + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("JOUR3A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals._exitId = 300; break; @@ -3850,8 +1583,9 @@ bool HopkinsEngine::runLinuxFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("JOUR4A.anm", 12, 12, 2000); + if (getPlatform() == Common::kPlatformLinux) + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("JOUR4A.ANM", 12, 12, 2000); _globals.iRegul = 0; _globals._exitId = 300; break; @@ -3864,17 +1598,28 @@ bool HopkinsEngine::runLinuxFull() { case 199: _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; + _soundManager.WSOUND_OFF(); + //warning("TODO: heapshrink();"); // Windows _soundManager.WSOUND(23); - _globals._exitId = handleBaseMap(); + _globals._exitId = handleBaseMap(); // Handles the base map (non-Windows) + //_globals._exitId = WBASE(); // Handles the 3D Doom level (Windows) _soundManager.WSOUND_OFF(); + //warning("TODO: heapshrink();"); // Windows _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); _globals.PERSO = _fileManager.loadFile(_globals._curFilename); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; + //if (_globals._exitId == -1) + // error("FIN BASE SOUS MARINE"); break; } } + _globals.PERSO = _globals.freeMemory(_globals.PERSO); + //warning("sub_33C70(v18);"); // OS/2 + //warning("sub_39460(v19);"); // OS/2 + //warning("sub_44134();"); // OS/2 + restoreSystem(); return true; } @@ -4707,11 +2452,6 @@ int HopkinsEngine::handleBaseMap() { return result; } -int HopkinsEngine::WBASE() { - warning("STUB: WBASE()"); - return 300; -} - void HopkinsEngine::loadCredits() { _globals.Credit_y = 440; _globals.Credit_l = 10; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 8d25f37240..18c7414827 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -98,11 +98,6 @@ private: */ int handleBaseMap(); - /** - * Runs the Wolf3D-like in the underground base. - */ - int WBASE(); - void BTOCEAN(); void OCEAN_HOME(); void OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); @@ -113,10 +108,7 @@ private: bool runWin95Demo(); bool runLinuxDemo(); - bool runWin95full(); - bool runLinuxFull(); - bool runBeOSFull(); - bool runOS2Full(); + bool runFull(); /** * Show warning screen about the game being adults only. -- cgit v1.2.3 From 495ecaafbcf1620901d270a65394ca312f2b5a37 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Jan 2013 23:56:39 +0100 Subject: HOPKINS: Remove global filename and constructFilename --- engines/hopkins/anim.cpp | 57 +++++++++------------- engines/hopkins/computer.cpp | 48 ++++++++---------- engines/hopkins/dialogs.cpp | 35 +++++++------- engines/hopkins/files.cpp | 113 +++++++++++++++---------------------------- engines/hopkins/files.h | 6 +-- engines/hopkins/font.cpp | 4 +- engines/hopkins/globals.cpp | 12 ++--- engines/hopkins/globals.h | 1 - engines/hopkins/graphics.cpp | 24 +++------ engines/hopkins/hopkins.cpp | 92 +++++++++++++++++------------------ engines/hopkins/menu.cpp | 9 ++-- engines/hopkins/objects.cpp | 65 +++++++++---------------- engines/hopkins/script.cpp | 6 +-- engines/hopkins/sound.cpp | 43 ++++++++-------- engines/hopkins/sound.h | 2 +- engines/hopkins/talk.cpp | 39 ++++++--------- 16 files changed, 224 insertions(+), 332 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 539586c433..780fdd9eca 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -58,15 +58,16 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui byte *screenP = _vm->_graphicsManager._vesaScreen; byte *ptr = _vm->_globals.allocMemory(20); + Common::String tmpStr; // The Windows 95 demo only contains the interlaced version of the BOMBE1 and BOMBE2 videos if (_vm->getPlatform() == Common::kPlatformWindows && _vm->getIsDemo() && filename == "BOMBE1A.ANM") - _vm->_fileManager.constructFilename("ANM", "BOMBE1.ANM"); + tmpStr = "BOMBE1.ANM"; else if (_vm->getPlatform() == Common::kPlatformWindows && _vm->getIsDemo() && filename == "BOMBE2A.ANM") - _vm->_fileManager.constructFilename("ANM", "BOMBE2.ANM"); + tmpStr = "BOMBE2.ANM"; else - _vm->_fileManager.constructFilename("ANM", filename); - if (!f.open(_vm->_globals._curFilename)) - error("File not found - %s", _vm->_globals._curFilename.c_str()); + tmpStr = filename; + if (!f.open(tmpStr)) + error("File not found - %s", tmpStr.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); @@ -228,21 +229,18 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint while (!_vm->shouldQuit()) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); - _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); - if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; screenP = _vm->_graphicsManager._vesaScreen; ptr = _vm->_globals.allocMemory(20); - _vm->_fileManager.constructFilename("ANM", filename); - if (!f.open(_vm->_globals._curFilename)) - error("Error opening file - %s", _vm->_globals._curFilename.c_str()); + if (!f.open(filename)) + error("Error opening file - %s", filename.c_str()); f.read(&buf, 6); f.read(_vm->_graphicsManager._palette, 800); @@ -476,11 +474,9 @@ void AnimationManager::loadAnim(const Common::String &animName) { clearAnim(); Common::String filename = animName + ".ANI"; - _vm->_fileManager.constructFilename("ANIM", filename); - Common::File f; - if (!f.open(_vm->_globals._curFilename)) - error("Failed to open %s", _vm->_globals._curFilename.c_str()); + if (!f.open(filename)) + error("Failed to open %s", filename.c_str()); int filesize = f.size(); int nbytes = filesize - 115; @@ -501,9 +497,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { for (int idx = 0; idx <= 5; ++idx) { if (files[idx][0]) { - _vm->_fileManager.constructFilename("ANIM", files[idx]); - - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists(files[idx])) error("File not found"); if (loadSpriteBank(idx + 1, files[idx])) error("File not compatible with this soft."); @@ -545,12 +539,11 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *v13; byte *v19; int result = 0; - _vm->_fileManager.constructFilename("ANIM", filename); - _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(_vm->_globals._curFilename); + _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(filename); _vm->_globals.Bank[idx]._loadedFl = true; _vm->_globals.Bank[idx]._filename = filename; - byte *fileDataPtr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + byte *fileDataPtr = _vm->_fileManager.loadFile(filename); _vm->_globals.Bank[idx]._fileHeader = 0; if (fileDataPtr[1] == 'L' && fileDataPtr[2] == 'E') @@ -587,10 +580,9 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { } while (ch != '.'); ofsFilename += ".OFS"; - _vm->_fileManager.constructFilename("ANIM", ofsFilename); Common::File f; - if (f.exists(_vm->_globals._curFilename)) { - v19 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + if (f.exists(ofsFilename)) { + v19 = _vm->_fileManager.loadFile(ofsFilename); v13 = v19; for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) { int x1 = (int16)READ_LE_UINT16(v13); @@ -723,19 +715,17 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (!NO_COUL) { _vm->_eventsManager.VBL(); - _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; } screenP = _vm->_graphicsManager._vesaScreen; v10 = _vm->_globals.allocMemory(22); - _vm->_fileManager.constructFilename("SEQ", file); - if (!f.open(_vm->_globals._curFilename)) - error("Error opening file - %s", _vm->_globals._curFilename.c_str()); + if (!f.open(file)) + error("Error opening file - %s", file.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); @@ -889,10 +879,9 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._mouseFl = false; screenP = _vm->_graphicsManager._vesaScreen; v11 = _vm->_globals.allocMemory(22); - _vm->_fileManager.constructFilename("SEQ", file); - if (!f.open(_vm->_globals._curFilename)) - error("File not found - %s", _vm->_globals._curFilename.c_str()); + if (!f.open(file)) + error("File not found - %s", file.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index bc67ccf23f..039dc563b3 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -78,9 +78,8 @@ void ComputerManager::setTextMode() { //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; - _vm->_fileManager.constructFilename("SYSTEM", "STFONT.SPR"); _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.police = _vm->_fileManager.loadFile("STFONT.SPR"); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; _vm->_graphicsManager.loadImage("WINTEXT"); @@ -328,9 +327,8 @@ static char _frenchText[] = */ void ComputerManager::loadMenu() { char *ptr; - if (_vm->_fileManager.fileExists("LINK", "COMPUTAN.TXT")) { - _vm->_fileManager.constructFilename("LINK", "COMPUTAN.TXT"); - ptr = (char *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); + if (_vm->_fileManager.fileExists("COMPUTAN.TXT")) { + ptr = (char *)_vm->_fileManager.loadFile("COMPUTAN.TXT"); } else if (_vm->_globals._language == LANG_FR) { ptr = (char *)_vm->_globals.allocMemory(sizeof(_frenchText)); strcpy(ptr, _frenchText); @@ -444,9 +442,8 @@ void ComputerManager::outText2(const Common::String &msg) { * Restores the scene for the FBI headquarters room */ void ComputerManager::restoreFBIRoom() { - _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_fileManager.constructFilename("SYSTEM", "FONTE3.SPR"); - _vm->_globals.police = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.freeMemory(_vm->_globals.police); + _vm->_globals.police = _vm->_fileManager.loadFile("FONTE3.SPR"); _vm->_globals.police_l = 12; _vm->_globals.police_h = 21; @@ -458,16 +455,18 @@ void ComputerManager::restoreFBIRoom() { */ void ComputerManager::readText(int idx) { _vm->_eventsManager._escKeyFl = false; + byte *ptr; + Common::String filename; if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename("LINK", "THOPKAN.TXT"); + filename = "THOPKAN.TXT"; else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename("LINK", "THOPK.TXT"); + filename = "THOPK.TXT"; else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename("LINK", "THOPKES.TXT"); + filename = "THOPKES.TXT"; - byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - uint16 fileSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); + ptr = _vm->_fileManager.loadFile(filename); + uint16 fileSize = _vm->_fileManager.fileSize(filename); int pos; for (pos = 0; pos < fileSize; pos++) { if (ptr[pos] == '%') { @@ -528,8 +527,7 @@ void ComputerManager::displayGamesSubMenu() { _vm->_soundManager.loadSample(1, "SOUND37.WAV"); _vm->_soundManager.loadSample(2, "SOUND38.WAV"); _vm->_soundManager.loadSample(3, "SOUND39.WAV"); - _vm->_fileManager.constructFilename("SYSTEM", "CASSE.SPR"); - _breakoutSpr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _breakoutSpr = _vm->_fileManager.loadFile("CASSE.SPR"); loadHiscore(); setModeVGA256(); newLevel(); @@ -560,9 +558,8 @@ void ComputerManager::loadHiscore() { char nextChar; byte *ptr; - _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); ptr = _vm->_globals.allocMemory(100); - _vm->_saveLoadManager.load(_vm->_globals._curFilename, ptr); + _vm->_saveLoadManager.load("HISCORE.DAT", ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { @@ -614,16 +611,14 @@ void ComputerManager::newLevel() { ++_breakoutLevelNbr; while (!_vm->shouldQuit()) { file = Common::String::format("TAB%d.TAB", _breakoutLevelNbr); - - _vm->_fileManager.constructFilename("SYSTEM", file); - if (f.open(_vm->_globals._curFilename)) + if (f.open(file)) break; _breakoutLevelNbr = 1; } f.close(); - _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); + _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(file); displayBricks(); _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); @@ -789,8 +784,7 @@ int ComputerManager::displayHiscores() { _vm->_graphicsManager.RESET_SEGMENT_VESA(); loadHiscore(); _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); - _vm->_fileManager.constructFilename("SYSTEM", "ALPHA.SPR"); - byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + byte *ptr = _vm->_fileManager.loadFile("ALPHA.SPR"); _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -841,8 +835,7 @@ void ComputerManager::getScoreName() { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_fileManager.constructFilename("SYSTEM", "ALPHA.SPR"); - byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + byte *ptr = _vm->_fileManager.loadFile("ALPHA.SPR"); _vm->_graphicsManager.fadeInBreakout(); for (int strPos = 0; strPos <= 4; strPos++) { displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); @@ -885,7 +878,7 @@ void ComputerManager::displayScore() { Common::String scoreStr = Common::String::format("%d", _breakoutScore); int strSize = scoreStr.size(); int idx = 0; - for (int i = strSize; i > -1; i--) { + for (int i = strSize - 1; i > -1; i--) { displayScoreChar(idx++, scoreStr[i]); } } @@ -977,8 +970,7 @@ void ComputerManager::saveScore() { ptr[v9 + 9] = 0; } - _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, ptr, 100); + _vm->_saveLoadManager.saveFile("HISCORE.DAT", ptr, 100); _vm->_globals.freeMemory(ptr); } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 42abaa8ad9..b062bda538 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -59,14 +59,15 @@ void DialogsManager::showOptionsDialog() { doneFlag = false; _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); + Common::String filename; if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename("SYSTEM", "OPTIFR.SPR"); + filename = "OPTIFR.SPR"; else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename("SYSTEM", "OPTIAN.SPR"); + filename = "OPTIAN.SPR"; else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename("SYSTEM", "OPTIES.SPR"); + filename = "OPTIES.SPR"; - _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(filename); _vm->_globals._optionDialogFl = true; do { @@ -311,29 +312,29 @@ LABEL_7: _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + Common::String filename; switch (_vm->_globals._language) { case LANG_EN: - _vm->_fileManager.constructFilename("SYSTEM", "INVENTAN.SPR"); + filename = "INVENTAN.SPR"; break; case LANG_FR: - _vm->_fileManager.constructFilename("SYSTEM", "INVENTFR.SPR"); + filename = "INVENTFR.SPR"; break; case LANG_SP: - _vm->_fileManager.constructFilename("SYSTEM", "INVENTES.SPR"); + filename = "INVENTES.SPR"; break; } Common::File f; - if (!f.open(_vm->_globals._curFilename)) - error("Error opening file - %s", _vm->_globals._curFilename.c_str()); + if (!f.open(filename)) + error("Error opening file - %s", filename.c_str()); size_t filesize = f.size(); _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); f.close(); - _vm->_fileManager.constructFilename("SYSTEM", "INVENT2.SPR"); - _inventBuf2 = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _inventBuf2 = _vm->_fileManager.loadFile("INVENT2.SPR"); int v19 = _inventX = _vm->_graphicsManager._scrollOffset + 152; _inventY = 114; @@ -609,21 +610,21 @@ void DialogsManager::showSaveLoad(int a1) { hopkinsSavegameHeader header; byte *thumb; + Common::String filename; switch (_vm->_globals._language) { case LANG_EN: - _vm->_fileManager.constructFilename("SYSTEM", "SAVEAN.SPR"); + filename = "SAVEAN.SPR"; break; case LANG_FR: - _vm->_fileManager.constructFilename("SYSTEM", "SAVEFR.SPR"); + filename = "SAVEFR.SPR"; break; case LANG_SP: - _vm->_fileManager.constructFilename("SYSTEM", "SAVEES.SPR"); + filename = "SAVEES.SPR"; break; } - _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); - _vm->_fileManager.constructFilename("SYSTEM", "SAVE2.SPR"); - _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); + _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(filename); + _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite("SAVE2.SPR"); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); if (_vm->_globals._language == LANG_FR) { diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 0ff2668d07..dbb33576bc 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -72,9 +72,8 @@ void FileManager::initCensorship() { _vm->_globals._censorshipFl = false; // If file doesn't exist, fallback to uncensored - if (fileExists("SYSTEM", "BLOOD.DAT")) { - constructFilename("SYSTEM", "BLOOD.DAT"); - char *data = (char *)loadFile(_vm->_globals._curFilename); + if (fileExists("BLOOD.DAT")) { + char *data = (char *)loadFile("BLOOD.DAT"); if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K')) _vm->_globals._censorshipFl = true; @@ -84,40 +83,12 @@ void FileManager::initCensorship() { } /** - * Construct a filename based on a suggested folder and filename. - * @param folder Folder to use. May be overriden for animations. - * @param file Filename + * Check if a file is present */ -void FileManager::constructFilename(const Common::String &folder, const Common::String &file) { - Common::String folderToUse = folder; - - // A lot of the code in the original engine based on COPIE_SEQ was used to determine - // whether a file resided on the CD or hard disk. Since the ScummVM implementation - // requires all the files in the same location, we only need to do a somewhat simpler - // check for animations that don't exist in the ANM folder, but rather in special - // sub-folders depending on the physical screen resolution being used. - - if (folder == "ANM" && fileExists("SVGA", file)) - folderToUse = "SVGA"; - - _vm->_globals._curFilename = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); -} - -/** - * Construct Linux filename - */ -void FileManager::constructLinuxFilename(const Common::String &file) { - _vm->_globals._curFilename = file; -} - -/** - * Check if a file is present in a given (optional) folder - */ -bool FileManager::fileExists(const Common::String &folder, const Common::String &file) { - Common::String filename = folder.empty() ? file : - Common::String::format("%s/%s", folder.c_str(), file.c_str()); +bool FileManager::fileExists(const Common::String &file) { + Common::File f; - return Common::File::exists(filename); + return f.exists(file); } /** @@ -128,101 +99,96 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { Common::File f; Common::String filename = file; + Common::String secondaryFilename = ""; filename.toUppercase(); switch (a2) { case 1: - constructFilename("LINK", "RES_INI.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_INI.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); - constructFilename("LINK", "RES_INI.RES"); + ptr = loadFile("RES_INI.CAT"); + secondaryFilename = "RES_INI.RES"; break; case 2: - constructFilename("LINK", "RES_REP.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_REP.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); - constructFilename("LINK", "RES_REP.RES"); + ptr = loadFile("RES_REP.CAT"); + secondaryFilename = "RES_REP.RES"; break; case 3: - constructFilename("LINK", "RES_LIN.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_LIN.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); - constructFilename("LINK", "RES_LIN.RES"); + ptr = loadFile("RES_LIN.CAT"); + secondaryFilename = "RES_LIN.RES"; break; case 4: - constructFilename("ANIM", "RES_ANI.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_ANI.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); - constructFilename("ANIM", "RES_ANI.RES"); + ptr = loadFile("RES_ANI.CAT"); + secondaryFilename = "RES_ANI.RES"; break; case 5: - constructFilename("ANIM", "RES_PER.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_PER.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); - constructFilename("ANIM", "RES_PER.RES"); + ptr = loadFile("RES_PER.CAT"); + secondaryFilename = "RES_PER.RES"; break; case 6: - constructFilename("BUFFER", "PIC.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("PIC.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); + ptr = loadFile("PIC.CAT"); break; case 7: - constructFilename("ANIM", "RES_SAN.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_SAN.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); + ptr = loadFile("RES_SAN.CAT"); break; case 8: - constructFilename("LINK", "RES_SLI.CAT"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists("RES_SLI.CAT")) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); + ptr = loadFile("RES_SLI.CAT"); break; - case 9: + case 9: { + Common::String tmpFilename; if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename("VOICE", "ENG_VOI.RES"); + tmpFilename = "ENG_VOI.RES"; // Win95 and Linux versions uses another set of names else { switch (_vm->_globals._language) { case LANG_EN: - constructFilename("LINK", "RES_VAN.CAT"); + tmpFilename = "RES_VAN.CAT"; break; case LANG_FR: - constructFilename("LINK", "RES_VFR.CAT"); + tmpFilename = "RES_VFR.CAT"; break; case LANG_SP: - constructFilename("LINK", "RES_VES.CAT"); + tmpFilename = "RES_VES.CAT"; break; } } - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists(tmpFilename)) return g_PTRNUL; - ptr = loadFile(_vm->_globals._curFilename); + ptr = loadFile(tmpFilename); break; + } // Deliberate fall-through to default: break; @@ -254,9 +220,8 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { _vm->_globals.freeMemory(ptr); - // TODO: Double check whether this really should be an unsigned int comparison - if ((uint16)(a2 - 6) > 1 && (uint16)(a2 - 8) > 1) { - if (!f.open(_vm->_globals._curFilename)) + if (secondaryFilename != "") { + if (!f.open(secondaryFilename)) error("CHARGE_FICHIER"); f.seek(_vm->_globals._catalogPos); diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index b2001e2a0c..55a57955b2 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -39,15 +39,11 @@ public: FileManager(); void setParent(HopkinsEngine *vm); - bool fileExists(const Common::String &folder, const Common::String &file); + bool fileExists(const Common::String &file); byte *loadFile(const Common::String &file); int readStream(Common::ReadStream &stream, void *buf, size_t nbytes); void initCensorship(); - void constructFilename(const Common::String &folder, const Common::String &file); - byte *searchCat(const Common::String &file, int a2); - void constructLinuxFilename(const Common::String &file); - uint32 fileSize(const Common::String &filename); }; diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index da81b7bf03..8b2bc51b90 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -165,9 +165,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _textSortArray[v62] = 0; _text[idx]._textLoadedFl = true; - _vm->_fileManager.constructFilename("LINK", filename); - - file = _vm->_globals._curFilename; + file = filename; if (strncmp(file.c_str(), _oldName.c_str(), strlen(file.c_str())) != 0) { // Starting to access a new file, so read in the index file for the file _oldName = file; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1fdcccfd6a..baafaeb975 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -433,8 +433,7 @@ void Globals::CLEAR_VBOB() { // Load Object void Globals::loadObjects() { - _vm->_fileManager.constructFilename("SYSTEM", "OBJET.DAT"); - byte *data = _vm->_fileManager.loadFile(_curFilename); + byte *data = _vm->_fileManager.loadFile("OBJET.DAT"); byte *srcP = data; for (int idx = 0; idx < 300; ++idx) { @@ -512,16 +511,13 @@ void Globals::loadCache(const Common::String &file) { Common::File f; resetCache(); - _vm->_fileManager.constructFilename("LINK", file); - ptr = _vm->_fileManager.loadFile(_curFilename); + ptr = _vm->_fileManager.loadFile(file); v16 = Common::String((const char *)ptr); - _vm->_fileManager.constructFilename("LINK", v16); - - if (!f.exists(_curFilename)) + if (!f.exists(v16)) return; - spriteData = _vm->_fileManager.loadFile(_curFilename); + spriteData = _vm->_fileManager.loadFile(v16); CACHE_BANQUE[1] = spriteData; int v15 = 60; for (int i = 0; i <= 21; i++) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a4f60e1cfd..877683d850 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -335,7 +335,6 @@ public: uint _speed; Common::String FICH_ZONE; Common::String FICH_TEXTE; - Common::String _curFilename; bool _censorshipFl; int g_old_anim; int g_old_sens, g_old_sens2; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0021f3539e..aaf5962cac 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -163,8 +163,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { lockScreen(); clearScreen(); unlockScreen(); - _vm->_fileManager.constructFilename("BUFFER", file); - A_PCX320(_vesaScreen, _vm->_globals._curFilename, _palette); + A_PCX320(_vesaScreen, file, _palette); memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); max_x = 320; @@ -184,8 +183,7 @@ void GraphicsManager::loadScreen(const Common::String &file) { bool flag = true; if (_vm->_fileManager.searchCat(file, 6) == g_PTRNUL) { - _vm->_fileManager.constructFilename("BUFFER", file); - if (!f.open(_vm->_globals._curFilename)) + if (!f.open(file)) error("loadScreen - %s", file.c_str()); f.seek(0, SEEK_END); @@ -301,15 +299,12 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by if (typeFlag) { // Load PCX from within the PIC resource - _vm->_fileManager.constructFilename("BUFFER", "PIC.RES"); - if (!f.open(_vm->_globals._curFilename)) + if (!f.open("PIC.RES")) error("Error opening PIC.RES."); f.seek(_vm->_globals._catalogPos); - } else { // Load stand alone PCX file - _vm->_fileManager.constructFilename("BUFFER", file); - if (!f.open(_vm->_globals._curFilename)) + if (!f.open(file)) error("Error opening PCX %s.", file.c_str()); } @@ -1767,8 +1762,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia byte *ptr = _vm->_fileManager.searchCat(filename, 1); if (ptr == g_PTRNUL) { - _vm->_fileManager.constructFilename("LINK", filename); - ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + ptr = _vm->_fileManager.loadFile(filename); } if (!mode) { filename = file + ".spr"; @@ -1776,11 +1770,10 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia if (initializeScreen) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.searchCat(filename, 8); if (_vm->_globals.SPRITE_ECRAN) { - _vm->_fileManager.constructFilename("LINK", filename); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(filename); } else { - _vm->_fileManager.constructFilename("LINK", "RES_SLI.RES"); + _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile("RES_SLI.RES"); } - _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } } if (ptr[0] != 'I' || ptr[1] != 'N' || ptr[2] != 'I') { @@ -1814,8 +1807,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia byte *dataP = _vm->_fileManager.searchCat(filename, 2); _vm->_globals.COUCOU = dataP; if (g_PTRNUL == dataP) { - _vm->_fileManager.constructFilename("LINK", filename); - dataP = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + dataP = _vm->_fileManager.loadFile(filename); _vm->_globals.COUCOU = dataP; } } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 85ffc6e2f6..94bfa239db 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -177,8 +177,7 @@ bool HopkinsEngine::runWin95Demo() { warning("TODO Init_Interrupt_();"); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -477,8 +476,7 @@ bool HopkinsEngine::runLinuxDemo() { playIntro(); _globals.iRegul = 0; - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -836,8 +834,7 @@ bool HopkinsEngine::runFull() { _graphicsManager.fadeOutLong(); } _globals.iRegul = 0; - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.PLANX = _globals.PLANY = 0; memset(_globals._saveData, 0, 2000); @@ -1193,8 +1190,7 @@ bool HopkinsEngine::runFull() { Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); if (_globals._forestSprite == g_PTRNUL) { - _fileManager.constructFilename("SYSTEM", "HOPDEG.SPR"); - _globals._forestSprite = _objectsManager.loadSprite(_globals._curFilename); + _globals._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR"); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); @@ -1605,8 +1601,7 @@ bool HopkinsEngine::runFull() { //_globals._exitId = WBASE(); // Handles the 3D Doom level (Windows) _soundManager.WSOUND_OFF(); //warning("TODO: heapshrink();"); // Windows - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; @@ -1638,61 +1633,69 @@ void HopkinsEngine::initializeSystem() { // Synchronise the sound settings from ScummVM _soundManager.syncSoundSettings(); + const Common::FSNode gameDataDir(ConfMan.get("path")); + SearchMan.addSubDirectoryMatching(gameDataDir, "SYSTEM"); + SearchMan.addSubDirectoryMatching(gameDataDir, "BUFFER"); + SearchMan.addSubDirectoryMatching(gameDataDir, "ANIM"); + SearchMan.addSubDirectoryMatching(gameDataDir, "ANM"); + SearchMan.addSubDirectoryMatching(gameDataDir, "BASE"); + SearchMan.addSubDirectoryMatching(gameDataDir, "LINK"); + SearchMan.addSubDirectoryMatching(gameDataDir, "MUSIC"); + SearchMan.addSubDirectoryMatching(gameDataDir, "SEQ"); + SearchMan.addSubDirectoryMatching(gameDataDir, "SAVE"); + SearchMan.addSubDirectoryMatching(gameDataDir, "SOUND"); + SearchMan.addSubDirectoryMatching(gameDataDir, "SVGA"); + SearchMan.addSubDirectoryMatching(gameDataDir, "VOICE"); + SearchMan.addSubDirectoryMatching(gameDataDir, "TSVGA"); + if (getPlatform() == Common::kPlatformLinux) _eventsManager._mouseLinuxFl = true; else _eventsManager._mouseLinuxFl = false; + if (_eventsManager._mouseLinuxFl) { + _eventsManager._mouseSizeX = 52; + _eventsManager._mouseSizeY = 32; + } else { + _eventsManager._mouseSizeX = 34; + _eventsManager._mouseSizeY = 20; + } + switch (_globals._language) { case LANG_EN: if (!_eventsManager._mouseLinuxFl) - _fileManager.constructFilename("SYSTEM", "SOUAN.SPR"); + _eventsManager._mouseCursor = _fileManager.loadFile("SOUAN.SPR"); else - _fileManager.constructFilename("SYSTEM", "LSOUAN.SPR"); + _eventsManager._mouseCursor = _fileManager.loadFile("LSOUAN.SPR"); break; case LANG_FR: if (!_eventsManager._mouseLinuxFl) - _fileManager.constructFilename("SYSTEM", "SOUFR.SPR"); + _eventsManager._mouseCursor = _fileManager.loadFile("SOUFR.SPR"); else - _fileManager.constructFilename("SYSTEM", "LSOUFR.SPR"); + _eventsManager._mouseCursor = _fileManager.loadFile("LSOUFR.SPR"); break; case LANG_SP: - _fileManager.constructFilename("SYSTEM", "SOUES.SPR"); + _eventsManager._mouseCursor = _fileManager.loadFile("SOUES.SPR"); break; } - if (_eventsManager._mouseLinuxFl) { - _eventsManager._mouseSizeX = 52; - _eventsManager._mouseSizeY = 32; - } else { - _eventsManager._mouseSizeX = 34; - _eventsManager._mouseSizeY = 20; - } - _eventsManager._mouseCursor = _fileManager.loadFile(_globals._curFilename); - _globals.clearAll(); - _fileManager.constructFilename("SYSTEM", "FONTE3.SPR"); - _globals.police = _fileManager.loadFile(_globals._curFilename); + _globals.police = _fileManager.loadFile("FONTE3.SPR"); _globals.police_l = 12; _globals.police_h = 21; - _fileManager.constructFilename("SYSTEM", "ICONE.SPR"); - _globals.ICONE = _fileManager.loadFile(_globals._curFilename); - _fileManager.constructFilename("SYSTEM", "TETE.SPR"); - _globals.TETE = _fileManager.loadFile(_globals._curFilename); + _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); + _globals.TETE = _fileManager.loadFile("TETE.SPR"); switch (_globals._language) { case LANG_EN: - _fileManager.constructFilename("LINK", "ZONEAN.TXT"); - _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); + _globals.BUF_ZONE = _fileManager.loadFile("ZONEAN.TXT"); break; case LANG_FR: - _fileManager.constructFilename("LINK", "ZONE01.TXT"); - _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); + _globals.BUF_ZONE = _fileManager.loadFile("ZONE01.TXT"); break; case LANG_SP: - _fileManager.constructFilename("LINK", "ZONEES.TXT"); - _globals.BUF_ZONE = _fileManager.loadFile(_globals._curFilename); + _globals.BUF_ZONE = _fileManager.loadFile("ZONEES.TXT"); break; } @@ -2318,8 +2321,7 @@ void HopkinsEngine::playEnding() { _globals.iRegul = 0; _globals._exitId = 300; } - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; } @@ -2457,22 +2459,22 @@ void HopkinsEngine::loadCredits() { _globals.Credit_l = 10; _globals.Credit_h = 40; _globals.Credit_step = 45; + byte *bufPtr; switch (_globals._language) { case LANG_EN: - _fileManager.constructFilename("LINK", "CREAN.TXT"); + bufPtr = _fileManager.loadFile("CREAN.TXT"); break; case LANG_FR: - _fileManager.constructFilename("LINK", "CREFR.TXT"); + bufPtr = _fileManager.loadFile("CREFR.TXT"); break; case LANG_SP: - _fileManager.constructFilename("LINK", "CREES.TXT"); + bufPtr = _fileManager.loadFile("CREES.TXT"); break; default: error("Unhandled language"); break; } - byte *bufPtr = _fileManager.loadFile(_globals._curFilename); byte *curPtr = bufPtr; int idxLines = 0; bool loopCond = false; @@ -2823,8 +2825,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._exitId = 0; _globals._disableInventFl = true; _soundManager.WSOUND(soundId); - _fileManager.constructFilename("SYSTEM", "VAISSEAU.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("VAISSEAU.SPR"); if (backgroundFilename.size()) _graphicsManager.loadImage(backgroundFilename); @@ -2909,8 +2910,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager.fadeOutLong(); _objectsManager.removeSprite(0); _objectsManager.CLEAR_ECRAN(); - _fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _globals.PERSO = _fileManager.loadFile(_globals._curFilename); + _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; } diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 582b7a16f9..9598f60a94 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -85,15 +85,14 @@ int MenuManager::menu() { _vm->_graphicsManager.fadeInLong(); if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename("SYSTEM", "MENU.SPR"); + spriteData = _vm->_objectsManager.loadSprite("MENU.SPR"); else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename("SYSTEM", "MENUAN.SPR"); + spriteData = _vm->_objectsManager.loadSprite("MENUAN.SPR"); else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename("SYSTEM", "MENUFR.SPR"); + spriteData = _vm->_objectsManager.loadSprite("MENUFR.SPR"); else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename("SYSTEM", "MENUES.SPR"); + spriteData = _vm->_objectsManager.loadSprite("MENUES.SPR"); - spriteData = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); _vm->_eventsManager.mouseOn(); _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager._mouseCursorId = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ebc83520bd..42b13040df 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -116,8 +116,7 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) ObjectsManager::DEL_FICHIER_OBJ(); if (val1 == 1) { - _vm->_fileManager.constructFilename("SYSTEM", "OBJET1.SPR"); - _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite(_vm->_globals._curFilename); + _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite("OBJET1.SPR"); } _vm->_globals.NUM_FICHIER_OBJ = val1; } @@ -2075,8 +2074,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager._linesNumb = 0; _lastLine = 0; - _vm->_fileManager.constructFilename("LINK", file); - ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + ptr = _vm->_fileManager.loadFile(file); v4 = 0; v5 = 0; do { @@ -2130,13 +2128,11 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_globals.ZONEP[i].field10 = 0; } - _vm->_fileManager.constructFilename("LINK", file); - Common::File f; - if (!f.exists(_vm->_globals._curFilename)) - error("File not found : %s", _vm->_globals._curFilename.c_str()); + if (!f.exists(file)) + error("File not found : %s", file.c_str()); - ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + ptr = _vm->_fileManager.loadFile(file); v4 = 0; v18 = 0; v17 = 0; @@ -2274,8 +2270,7 @@ void ObjectsManager::PLAN_BETA() { CHARGE_OBSTACLE("PLAN.OB2"); _vm->_globals.loadCache("PLAN.CA2"); loadZone("PLAN.ZO2"); - _vm->_fileManager.constructFilename("SYSTEM", "VOITURE.SPR"); - _spritePtr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR"); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN", false); @@ -2737,8 +2732,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha T_RECTIF = 0; loc = &_vm->_globals._saveData->_realHopkins; - _vm->_fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); SPRITE_ON(0); @@ -2763,8 +2757,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals._saveData->data[svField357] = 0; loc = &_vm->_globals._saveData->_samantha; - _vm->_fileManager.constructFilename("SYSTEM", "PSAMAN.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); _vm->_globals.PERSO_TYPE = 2; SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); SPRITE_ON(0); @@ -3742,8 +3735,7 @@ void ObjectsManager::OPTI_OBJET() { file = "OBJET1.ini"; data = _vm->_fileManager.searchCat(file, 1); if (data == g_PTRNUL) { - _vm->_fileManager.constructFilename("LINK", file); - data = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + data = _vm->_fileManager.loadFile(file); if (data == g_PTRNUL) error("INI file %s not found", file.c_str()); } @@ -3964,9 +3956,7 @@ void ObjectsManager::ACTION_DOS(int idx) { if (_vm->_globals.GESTE_FLAG != 1) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 1; - - _vm->_fileManager.constructFilename("SYSTEM", "DOS.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.GESTE = _vm->_fileManager.loadFile("DOS.SPR"); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -3994,8 +3984,7 @@ void ObjectsManager::ACTION_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.constructFilename("SYSTEM", "PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); @@ -4023,8 +4012,7 @@ void ObjectsManager::Q_DROITE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.constructFilename("SYSTEM", "3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4052,8 +4040,7 @@ void ObjectsManager::ACTION_FACE(int idx) { if (_vm->_globals.GESTE_FLAG != 2) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 2; - _vm->_fileManager.constructFilename("SYSTEM", "FACE.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.GESTE = _vm->_fileManager.loadFile("FACE.SPR"); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); @@ -4069,8 +4056,7 @@ void ObjectsManager::Q_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 4) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 4; - _vm->_fileManager.constructFilename("SYSTEM", "3Q.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); } if (idx == 1) ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); @@ -4098,8 +4084,7 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { if (_vm->_globals.GESTE_FLAG != 3) { _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); _vm->_globals.GESTE_FLAG = 3; - _vm->_fileManager.constructFilename("SYSTEM", "PROFIL.SPR"); - _vm->_globals.GESTE = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); } if (idx == 1) ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 1); @@ -4246,10 +4231,8 @@ void ObjectsManager::INILINK(const Common::String &file) { ptr = _vm->_fileManager.searchCat(filename, 3); nbytes = _vm->_globals._catalogSize; if (ptr == g_PTRNUL) { - _vm->_fileManager.constructFilename("LINK", filename); - - if (!f.open(_vm->_globals._curFilename)) - error("Error opening file - %s", _vm->_globals._curFilename.c_str()); + if (!f.open(filename)) + error("Error opening file - %s", filename.c_str()); nbytes = f.size(); ptr = _vm->_globals.allocMemory(nbytes); @@ -4269,12 +4252,11 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { - _vm->_fileManager.constructFilename("LINK", filename2); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(filename2); } else { - _vm->_fileManager.constructFilename("LINK", "RES_SLI.RES"); + _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile("RES_SLI.RES"); } - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v36 = 60; v37 = ptr + 1000; for (int v40 = 0; v40 <= 21; v40++) { @@ -5095,21 +5077,18 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); if (_vm->_globals.PERSO_TYPE) { if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { - _vm->_fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; } } if (!_vm->_globals.PERSO_TYPE) { if (_vm->_globals._saveData->data[svField122] == 1) { - _vm->_fileManager.constructFilename("SYSTEM", "HOPFEM.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("HOPFEM.SPR"); _vm->_globals.PERSO_TYPE = 1; } } if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->data[svField356] == 1) { - _vm->_fileManager.constructFilename("SYSTEM", "PSAMAN.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); _vm->_globals.PERSO_TYPE = 2; } _vm->_globals.loadCharacterData(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index dae57bd47d..f98ce3a5c0 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -918,8 +918,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 56: - _vm->_fileManager.constructFilename("SYSTEM", "HOPFEM.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("HOPFEM.SPR"); _vm->_globals.PERSO_TYPE = 1; _vm->_globals._saveData->data[svField122] = 1; _vm->_globals.loadCharacterData(); @@ -929,8 +928,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 57: - _vm->_fileManager.constructFilename("SYSTEM", "PERSO.SPR"); - _vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals._curFilename); + _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; _vm->_globals._saveData->data[svField122] = 0; _vm->_globals.loadCharacterData(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 1628268eca..9fb45fa9fe 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -380,14 +380,13 @@ void SoundManager::PLAY_MOD(const Common::String &file) { modFile += "2"; } } - _vm->_fileManager.constructFilename("MUSIC", modFile); if (MOD_FLAG) { stopMusic(); delMusic(); MOD_FLAG = false; } - loadMusic(_vm->_globals._curFilename); + loadMusic(modFile); playMusic(); MOD_FLAG = true; } @@ -520,43 +519,43 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename("VOICE", "ENG_VOI.RES"); + filename = "ENG_VOI.RES"; // Win95 and Linux versions uses another set of names else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename("VOICE", "RES_VFR.RES"); + filename = "RES_VFR.RES"; else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename("VOICE", "RES_VAN.RES"); + filename = "RES_VAN.RES"; else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename("VOICE", "RES_VES.RES"); + filename = "RES_VES.RES"; catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - _vm->_fileManager.constructFilename("VOICE", "ENG_VOI.RES"); + filename = "ENG_VOI.RES"; // Win95 and Linux versions uses another set of names else if (_vm->_globals._language == LANG_FR) - _vm->_fileManager.constructFilename("VOICE", "RES_VFR.RES"); + filename = "RES_VFR.RES"; else if (_vm->_globals._language == LANG_EN) - _vm->_fileManager.constructFilename("VOICE", "RES_VAN.RES"); + filename = "RES_VAN.RES"; else if (_vm->_globals._language == LANG_SP) - _vm->_fileManager.constructFilename("VOICE", "RES_VES.RES"); + filename = "RES_VES.RES"; catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else { - _vm->_fileManager.constructFilename("VOICE", filename + ".WAV"); - if (!f.exists(_vm->_globals._curFilename)) { - _vm->_fileManager.constructFilename("VOICE", filename + ".APC"); - if (!f.exists(_vm->_globals._curFilename)) + if (!f.exists(filename + ".WAV")) { + if (!f.exists(filename + ".APC")) return false; - } + filename = filename + ".APC"; + } else + filename = filename + ".WAV"; catPos = 0; catLen = 0; } - SDL_LVOICE(catPos, catLen); + SDL_LVOICE(filename, catPos, catLen); oldMusicVol = _musicVolume; if (!_musicOffFl && _musicVolume > 2) _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); @@ -626,8 +625,7 @@ void SoundManager::MODSetMusicVolume(int volume) { } void SoundManager::loadSample(int wavIndex, const Common::String &file) { - _vm->_fileManager.constructFilename("SOUND", file); - LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals._curFilename, 0); + LOAD_SAMPLE2_SDL(wavIndex, file, 0); SOUND[wavIndex]._active = true; } @@ -700,9 +698,9 @@ void SoundManager::stopVoice(int voiceIndex) { Voice[voiceIndex].field14 = 0; } -void SoundManager::SDL_LVOICE(size_t filePosition, size_t entryLength) { - if (!SDL_LoadVoice(_vm->_globals._curFilename, filePosition, entryLength, Swav[20])) - error("Couldn't load the sample %s", _vm->_globals._curFilename.c_str()); +void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength) { + if (!SDL_LoadVoice(filename, filePosition, entryLength, Swav[20])) + error("Couldn't load the sample %s", filename.c_str()); Swav[20]._active = true; } @@ -758,8 +756,7 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { - _vm->_fileManager.constructFilename("SOUND", file); - LOAD_SAMPLE2_SDL(wavIndex, _vm->_globals._curFilename, 1); + LOAD_SAMPLE2_SDL(wavIndex, file, 1); } void SoundManager::PLAY_NWAV(int wavIndex) { diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 15efc85c4d..c6563209c9 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -69,7 +69,7 @@ private: int VOICE_STAT(int voiceIndex); void stopVoice(int voiceIndex); - void SDL_LVOICE(size_t filePosition, size_t entryLength); + void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); void PLAY_VOICE_SDL(); bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 3d00c441fd..ff4642c18e 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -62,9 +62,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterBuffer = _vm->_fileManager.searchCat(filename, 5); _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { - _vm->_fileManager.constructFilename("ANIM", filename); - _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); + _characterBuffer = _vm->_fileManager.loadFile(filename); + _characterSize = _vm->_fileManager.fileSize(filename); } _vm->_globals._saveData->data[svField4] = 0; getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); @@ -81,17 +80,15 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) { - _vm->_fileManager.constructFilename("ANIM", spriteFilename); + _characterSprite = _vm->_objectsManager.loadSprite(spriteFilename); } else { - _vm->_fileManager.constructFilename("ANIM", "RES_SAN.RES"); + _characterSprite = _vm->_objectsManager.loadSprite("RES_SAN.RES"); } - _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); - _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; @@ -163,9 +160,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _characterBuffer = _vm->_fileManager.searchCat(filename, 5); _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { - _vm->_fileManager.constructFilename("ANIM", filename); - _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); + _characterBuffer = _vm->_fileManager.loadFile(filename); + _characterSize = _vm->_fileManager.fileSize(filename); } _vm->_globals._saveData->data[svField4] = 0; @@ -576,10 +572,9 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v18 = 0; _vm->_globals.police_l = 11; - _vm->_fileManager.constructFilename("LINK", file); // Build up the filename - filename = dest = _vm->_globals._curFilename; + filename = dest = file; while (filename.lastChar() != '.') filename.deleteLastChar(); filename += "IND"; @@ -1087,9 +1082,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterBuffer = _vm->_fileManager.searchCat(a2, 5); _characterSize = _vm->_globals._catalogSize; if (_characterBuffer == g_PTRNUL) { - _vm->_fileManager.constructFilename("ANIM", a2); - _characterBuffer = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - _characterSize = _vm->_fileManager.fileSize(_vm->_globals._curFilename); + _characterBuffer = _vm->_fileManager.loadFile(a2); + _characterSize = _vm->_fileManager.fileSize(a2); } getStringFromBuffer(40, v23, (const char *)_characterBuffer); getStringFromBuffer(0, v22, (const char *)_characterBuffer); @@ -1100,17 +1094,14 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterSprite = _vm->_fileManager.searchCat(v23, 7); if (_characterSprite) - _vm->_fileManager.constructFilename("ANIM", v23); + _characterSprite = _vm->_objectsManager.loadSprite(v23); else - _vm->_fileManager.constructFilename("ANIM", "RES_SAN.RES"); + _characterSprite = _vm->_objectsManager.loadSprite("RES_SAN.RES"); - _characterSprite = _vm->_objectsManager.loadSprite(_vm->_globals._curFilename); - - _vm->_fileManager.constructLinuxFilename("TEMP.SCR"); if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 307200); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile(_vm->_globals._curFilename, _vm->_graphicsManager._vesaScreen, 614400); + _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400); if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; -- cgit v1.2.3 From e67e84dfe75cffd1ed363c4f81054d6a1a62b868 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Jan 2013 00:38:05 +0100 Subject: HOPKINS: Some renaming and refactoring in showInventory and changeObject --- engines/hopkins/dialogs.cpp | 34 +++++++++++++++++----------------- engines/hopkins/objects.cpp | 26 +++++++------------------- engines/hopkins/objects.h | 2 +- 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index b062bda538..246bd88455 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -298,7 +298,7 @@ void DialogsManager::showInventory() { _vm->_graphicsManager.no_scroll = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; _vm->_objectsManager._visibleFl = false; - for (int v1 = 0; v1 <= 1; v1++) { + for (int i = 0; i <= 1; i++) { inventAnim(); _vm->_eventsManager.getMouseX(); _vm->_eventsManager.getMouseY(); @@ -344,14 +344,15 @@ LABEL_7: _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, v19 + 300, 414, 0, 0, 0, 0); int v15 = 0; - int v4 = 0; - for (int v14 = 1; v14 <= 5; v14++) { + int inventCount = 0; + for (int inventLine = 1; inventLine <= 5; inventLine++) { int v16 = 0; - for (int v5 = 1; v5 <= 6; v5++) { - ++v4; - int v6 = _vm->_globals._inventory[v4]; - if (v6 && v4 <= 29) { - byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(v6, 0); + for (int inventCol = 1; inventCol <= 6; inventCol++) { + ++inventCount; + int inventIdx = _vm->_globals._inventory[inventCount]; + // The last two zones are not reserved for the inventory: Options and Save/Load + if (inventIdx && inventCount <= 29) { + byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); _vm->_globals.freeMemory(v7); @@ -363,7 +364,7 @@ LABEL_7: _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager._curMouseButton = 0; bool v20 = false; - int v13 = 0; + int newInventoryItem = 0; // Main loop to select an inventory item while (!_vm->shouldQuit()) { @@ -373,14 +374,13 @@ LABEL_7: int mousePosX = _vm->_eventsManager.getMouseX(); int mousePosY = _vm->_eventsManager.getMouseY(); int mouseButton = _vm->_eventsManager.getMouseButton(); - int v10 = v13; - int v11 = _vm->_linesManager.ZONE_OBJET(mousePosX, mousePosY); - v13 = v11; - if (v11 != v10) - _vm->_objectsManager.initBorder(v11); + int oldInventoryItem = newInventoryItem; + newInventoryItem = _vm->_linesManager.ZONE_OBJET(mousePosX, mousePosY); + if (newInventoryItem != oldInventoryItem) + _vm->_objectsManager.initBorder(newInventoryItem); if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { if (mouseButton == 2) { - _vm->_objectsManager.OBJETPLUS(v13); + _vm->_objectsManager.OBJETPLUS(newInventoryItem); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); } @@ -388,13 +388,13 @@ LABEL_7: if (mouseButton == 1) { if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId) break; - _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[v13]); + _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[newInventoryItem]); if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; if (!v20) { _vm->_scriptManager.TRAVAILOBJET = true; _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; - _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[v13]; + _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[newInventoryItem]; _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); _vm->_scriptManager.TRAVAILOBJET = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 42b13040df..23b7778165 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -100,16 +100,16 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { * Change Object */ void ObjectsManager::changeObject(int objIndex) { - _vm->_eventsManager._objectBuf = CAPTURE_OBJET(objIndex, 1); + _vm->_eventsManager._objectBuf = CAPTURE_OBJET(objIndex, true); _vm->_globals._curObjectIndex = objIndex; } -byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { +byte *ObjectsManager::CAPTURE_OBJET(int objIndex, bool mode) { byte *dataP = NULL; int val1 = _vm->_globals.ObjetW[objIndex].field0; int val2 = _vm->_globals.ObjetW[objIndex]._idx; - if (mode == 1) + if (mode) ++val2; if (val1 != _vm->_globals.NUM_FICHIER_OBJ) { @@ -126,27 +126,15 @@ byte *ObjectsManager::CAPTURE_OBJET(int objIndex, int mode) { _vm->_globals._objectWidth = width; _vm->_globals._objectHeight = height; - switch (mode) { - case 0: + if (mode) { + sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_eventsManager._objectBuf, val2); + dataP = _vm->_eventsManager._objectBuf; + } else { dataP = _vm->_globals.allocMemory(height * width); if (dataP == g_PTRNUL) error("CAPTURE_OBJET"); capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); - break; - - case 1: - sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_eventsManager._objectBuf, val2); - dataP = _vm->_eventsManager._objectBuf; - break; - - case 3: - capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, _vm->_globals._inventoryObject, val2); - dataP = _vm->_globals._inventoryObject; - break; - - default: - break; } return dataP; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 38f09d3548..4acb0174a3 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -120,7 +120,7 @@ public: void setParent(HopkinsEngine *vm); void changeObject(int objIndex); - byte *CAPTURE_OBJET(int objIndex, int mode); + byte *CAPTURE_OBJET(int objIndex, bool mode); void removeObject(int objIndex); int getWidth(const byte *objectData, int idx); -- cgit v1.2.3 From 5a961b104fb22ce1c32f46a112a185c1fc08b45c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Jan 2013 08:37:42 +0100 Subject: HOPKINS: Refactor nextObjectIcon --- engines/hopkins/dialogs.cpp | 4 +- engines/hopkins/objects.cpp | 157 +++++++++++++++++++------------------------- engines/hopkins/objects.h | 4 +- 3 files changed, 71 insertions(+), 94 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 246bd88455..81ef831dde 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -380,7 +380,7 @@ LABEL_7: _vm->_objectsManager.initBorder(newInventoryItem); if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { if (mouseButton == 2) { - _vm->_objectsManager.OBJETPLUS(newInventoryItem); + _vm->_objectsManager.nextObjectIcon(newInventoryItem); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); } @@ -388,7 +388,7 @@ LABEL_7: if (mouseButton == 1) { if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId) break; - _vm->_objectsManager.VALID_OBJET(_vm->_globals._inventory[newInventoryItem]); + _vm->_objectsManager.takeInventoryObject(_vm->_globals._inventory[newInventoryItem]); if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; if (!v20) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 23b7778165..a5659bca6f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -273,15 +273,12 @@ int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int * Add Object */ int ObjectsManager::addObject(int objIndex) { - bool flag = false; int arrIndex = 0; - do { + for (;;) { ++arrIndex; - if (!_vm->_globals._inventory[arrIndex]) - flag = true; - if (arrIndex == 32) - flag = true; - } while (!flag); + if ((!_vm->_globals._inventory[arrIndex]) || (arrIndex == 32)) + break;; + } _vm->_globals._inventory[arrIndex] = objIndex; return arrIndex; @@ -3624,94 +3621,74 @@ void ObjectsManager::initBorder(int a1) { _vm->_eventsManager.getMouseY(); } -void ObjectsManager::OBJETPLUS(int idx) { - int v1; - int v2; - int v3; +/** + * Get next icon for an object in the inventory + */ +void ObjectsManager::nextObjectIcon(int idx) { + if (_vm->_eventsManager._mouseCursorId == 0 || _vm->_eventsManager._mouseCursorId == 16 || _vm->_eventsManager._mouseCursorId == 3 || + _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 7) + return; + + int nextCursorId = _vm->_eventsManager._mouseCursorId + 1; + do { + if (nextCursorId == 6) { + _vm->_eventsManager._mouseCursorId = 6; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field2 == 1) + return; + nextCursorId++; + } + if (nextCursorId == 7) { + _vm->_eventsManager._mouseCursorId = 7; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field3 == 1) + return; + nextCursorId++; + } + if (nextCursorId == 8) { + _vm->_eventsManager._mouseCursorId = 8; + return; + } + if (nextCursorId == 9 || nextCursorId == 10) { + _vm->_eventsManager._mouseCursorId = 10; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 == 1) + return; + nextCursorId = 11; + } - v1 = _vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId && _vm->_eventsManager._mouseCursorId != 16 && (uint16)(_vm->_eventsManager._mouseCursorId - 2) > 1u) { - v2 = _vm->_eventsManager._mouseCursorId++ + 1; - if (v1 == 5) - goto LABEL_24; - if (v2 == 7) - goto LABEL_26; - if (v2 != 8) { - if (v2 == 9) - _vm->_eventsManager._mouseCursorId = 10; - if (_vm->_eventsManager._mouseCursorId == 10) - goto LABEL_29; - if (_vm->_eventsManager._mouseCursorId == 11) - goto LABEL_31; - if (_vm->_eventsManager._mouseCursorId == 12) - _vm->_eventsManager._mouseCursorId = 13; - if (_vm->_eventsManager._mouseCursorId == 13) - goto LABEL_33; - if (_vm->_eventsManager._mouseCursorId == 14) - _vm->_eventsManager._mouseCursorId = 15; - if (_vm->_eventsManager._mouseCursorId == 15) - goto LABEL_35; - if ((uint16)(_vm->_eventsManager._mouseCursorId - 16) <= 6u) - _vm->_eventsManager._mouseCursorId = 23; - if (_vm->_eventsManager._mouseCursorId == 23) - goto LABEL_37; - if (_vm->_eventsManager._mouseCursorId == 24) - _vm->_eventsManager._mouseCursorId = 25; - if (_vm->_eventsManager._mouseCursorId == 25) - goto LABEL_39; - do { - _vm->_eventsManager._mouseCursorId = 6; -LABEL_24: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field2 == 1) - break; - ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 7) { -LABEL_26: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field3 == 1) - return; - } - v3 = _vm->_eventsManager._mouseCursorId++; - if (_vm->_eventsManager._mouseCursorId == 8) - break; - _vm->_eventsManager._mouseCursorId = v3 + 3; - if (v3 == 7) { -LABEL_29: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 == 1) - return; - } - ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 11) { -LABEL_31: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field4 == 1) - return; - } - _vm->_eventsManager._mouseCursorId += 2; - if (_vm->_eventsManager._mouseCursorId == 13) { -LABEL_33: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field5 == 1) - return; - } - _vm->_eventsManager._mouseCursorId += 2; - if (_vm->_eventsManager._mouseCursorId == 15) { -LABEL_35: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 1) - return; - } - _vm->_eventsManager._mouseCursorId = 23; -LABEL_37: - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 2) - break; - _vm->_eventsManager._mouseCursorId = 25; -LABEL_39: - ; - } while (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 != 2); + if (nextCursorId == 11) { + _vm->_eventsManager._mouseCursorId = 11; + ++_vm->_eventsManager._mouseCursorId; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field4 == 1) + return; + nextCursorId++; } - } + + if (nextCursorId == 12 || nextCursorId == 13) { + _vm->_eventsManager._mouseCursorId = 13; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field5 == 1) + return; + nextCursorId = 14; + } + + if (nextCursorId == 14 || nextCursorId == 15) { + _vm->_eventsManager._mouseCursorId = 15; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 1) + return; + nextCursorId = 23; + } + + if (nextCursorId >= 16 && nextCursorId <= 23) { + _vm->_eventsManager._mouseCursorId = 23; + if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 2) + return; + } + + nextCursorId = 6; + } while (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 != 2); } -void ObjectsManager::VALID_OBJET(int a1) { +void ObjectsManager::takeInventoryObject(int idx) { if (_vm->_eventsManager._mouseCursorId == 8) - changeObject(a1); + changeObject(idx); } void ObjectsManager::OPTI_OBJET() { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 4acb0174a3..8b7ed924e1 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -194,8 +194,8 @@ public: void handleRightButton(); int MZONE(); void initBorder(int a1); - void OBJETPLUS(int a1); - void VALID_OBJET(int a1); + void nextObjectIcon(int idx); + void takeInventoryObject(int idx); void OPTI_OBJET(); void handleSpecialGames(); void BOB_VIVANT(int a1); -- cgit v1.2.3 From fddc6497bf316e6e44b258b1c7fd9adc0749bd72 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Jan 2013 13:12:49 +0200 Subject: HOPKINS: Clean up the menu code --- engines/hopkins/menu.cpp | 183 ++++++++++++++--------------------------------- 1 file changed, 53 insertions(+), 130 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 9598f60a94..f607f2c15c 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -46,11 +46,7 @@ int MenuManager::menu() { MenuSelection menuIndex; Common::Point mousePos; signed int result; - int frame5Index; - int frame4Index; - int frame3Index; - int frame2Index; - int frame1Index; + int frameIndex[] = { 0, 0, 0, 0, 0 }; if (g_system->getEventManager()->shouldQuit()) return -1; @@ -67,11 +63,7 @@ int MenuManager::menu() { memset(_vm->_globals._saveData, 0, 2000); _vm->_objectsManager.addObject(14); - frame5Index = 0; - frame4Index = 0; - frame3Index = 0; - frame2Index = 0; - frame1Index = 0; + memset(frameIndex, 0, sizeof(int) * ARRAYSIZE(frameIndex)); if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) _vm->_graphicsManager.loadImage("MENU"); @@ -98,137 +90,68 @@ int MenuManager::menu() { _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager._mouseSpriteId = 0; - for (;;) { - for (;;) { - _vm->_soundManager.WSOUND(28); - - // Loop to make menu selection - bool selectionMade = false; - do { - if (g_system->getEventManager()->shouldQuit()) - return -1; - - menuIndex = MENU_NONE; - mousePos = Common::Point(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); - - if ((uint16)(mousePos.x - 232) <= 176) { - if ((uint16)(mousePos.y - 261) <= 23) - menuIndex = PLAY_GAME; - if ((uint16)(mousePos.y - 293) <= 23) - menuIndex = LOAD_GAME; - if ((uint16)(mousePos.y - 325) <= 22) - menuIndex = OPTIONS; - if ((uint16)(mousePos.y - 356) <= 23) - menuIndex = INTRODUCTION; - - if ((uint16)(mousePos.y - 388) <= 23) - menuIndex = QUIT; - } - - switch (menuIndex) { - case MENU_NONE: - frame1Index = 0; - frame2Index = 0; - frame3Index = 0; - frame4Index = 0; - frame5Index = 0; - break; - case PLAY_GAME: - frame1Index = 1; - frame2Index = 0; - frame3Index = 0; - frame4Index = 0; - frame5Index = 0; - break; - case LOAD_GAME: - frame1Index = 0; - frame2Index = 1; - frame3Index = 0; - frame4Index = 0; - frame5Index = 0; - break; - case OPTIONS: - frame1Index = 0; - frame2Index = 0; - frame3Index = 1; - frame4Index = 0; - frame5Index = 0; - break; - case INTRODUCTION: - frame1Index = 0; - frame2Index = 0; - frame3Index = 0; - frame4Index = 1; - frame5Index = 0; - break; - case QUIT: - frame1Index = 0; - frame2Index = 0; - frame3Index = 0; - frame4Index = 0; - frame5Index = 1; - } - - _vm->_graphicsManager.fastDisplay(spriteData, 230, 259, frame1Index); - _vm->_graphicsManager.fastDisplay(spriteData, 230, 291, frame2Index + 2); - _vm->_graphicsManager.fastDisplay(spriteData, 230, 322, frame3Index + 4); - _vm->_graphicsManager.fastDisplay(spriteData, 230, 354, frame4Index + 6); - _vm->_graphicsManager.fastDisplay(spriteData, 230, 386, frame5Index + 8); - _vm->_eventsManager.VBL(); - - if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) - selectionMade = true; - } while (!selectionMade); - - if (menuIndex == PLAY_GAME) { - _vm->_graphicsManager.fastDisplay(spriteData, 230, 259, 10); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.delay(200); - result = 1; - } - if (menuIndex != LOAD_GAME) - break; - - _vm->_graphicsManager.fastDisplay(spriteData, 230, 291, 11); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.delay(200); - - _vm->_globals._exitId = -1; - _vm->_dialogsManager.showLoadGame(); - - if (_vm->_globals._exitId != -1) { - result = _vm->_globals._exitId; - break; - } - _vm->_globals._exitId = 0; + _vm->_soundManager.WSOUND(28); + + // Loop to make menu selection + bool selectionMade = false; + do { + if (g_system->getEventManager()->shouldQuit()) + return -1; + + menuIndex = MENU_NONE; + mousePos = Common::Point(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); + + if ((uint16)(mousePos.x - 232) <= 176) { + if ((uint16)(mousePos.y - 261) <= 23) + menuIndex = PLAY_GAME; + if ((uint16)(mousePos.y - 293) <= 23) + menuIndex = LOAD_GAME; + if ((uint16)(mousePos.y - 325) <= 22) + menuIndex = OPTIONS; + if ((uint16)(mousePos.y - 356) <= 23) + menuIndex = INTRODUCTION; + if ((uint16)(mousePos.y - 388) <= 23) + menuIndex = QUIT; } - if (menuIndex != OPTIONS) - break; + memset(frameIndex, 0, sizeof(int) * ARRAYSIZE(frameIndex)); + if (menuIndex > MENU_NONE) + frameIndex[menuIndex - 1] = 1; - // Options menu item selected - _vm->_graphicsManager.fastDisplay(spriteData, 230, 322, 12); + for (int i = 0; i < 5; i++) + _vm->_graphicsManager.fastDisplay(spriteData, 230, 259 + 32 * i, frameIndex[i] + 2 * i); _vm->_eventsManager.VBL(); - _vm->_eventsManager.delay(200); - // Show the options dialog - _vm->_dialogsManager.showOptionsDialog(); - } - if (menuIndex == INTRODUCTION) { - _vm->_graphicsManager.fastDisplay(spriteData, 230, 354, 13); + if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) + selectionMade = true; + } while (!selectionMade); + + if (menuIndex > MENU_NONE) { + _vm->_graphicsManager.fastDisplay(spriteData, 230, 259 + 32 * (menuIndex - 1), 10 + (menuIndex - 1)); _vm->_eventsManager.VBL(); _vm->_eventsManager.delay(200); - _vm->playIntro(); - continue; } - if ( menuIndex == QUIT) { - _vm->_graphicsManager.fastDisplay(spriteData, 230, 386, 14); - _vm->_eventsManager.VBL(); - _vm->_eventsManager.delay(200); + if (menuIndex == PLAY_GAME) { + result = 1; + break; + } else if (menuIndex == LOAD_GAME) { + _vm->_globals._exitId = -1; + _vm->_dialogsManager.showLoadGame(); + + if (_vm->_globals._exitId != -1) { + result = _vm->_globals._exitId; + break; + } + _vm->_globals._exitId = 0; + } else if (menuIndex == OPTIONS) { + _vm->_dialogsManager.showOptionsDialog(); + } else if (menuIndex == INTRODUCTION) { + _vm->playIntro(); + } else if (menuIndex == QUIT) { result = -1; + break; } - break; } _vm->_globals.freeMemory(spriteData); -- cgit v1.2.3 From 7462978be5d01dce90b046cb633db46b135fb19d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Jan 2013 13:30:33 +0200 Subject: HOPKINS: Get rid of more useless global variables --- engines/hopkins/globals.cpp | 13 ------------- engines/hopkins/globals.h | 4 ---- engines/hopkins/hopkins.cpp | 13 ------------- engines/hopkins/objects.cpp | 1 - engines/hopkins/script.cpp | 4 ++-- 5 files changed, 2 insertions(+), 33 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index baafaeb975..a4d03f5794 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -115,7 +115,6 @@ Globals::Globals() { // Initialise fields _language = LANG_EN; - _internetFl = true; PUBEXIT = false; _speed = 1; @@ -162,7 +161,6 @@ Globals::Globals() { _actionDirection = 0; SegmentEnCours = 0; STOP_BUG = 0; - MAX_COMPTE = 0; Credit_bx = -1; Credit_bx1 = -1; @@ -194,9 +192,7 @@ Globals::Globals() { _forestSprite = NULL; COUCOU = NULL; chemin = NULL; - cache_souris = NULL; BufLig = NULL; - Bufferdecor = NULL; ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; @@ -244,8 +240,6 @@ Globals::~Globals() { freeMemory(_inventoryObject); freeMemory(_forestSprite); freeMemory(COUCOU); - freeMemory(cache_souris); - freeMemory(Bufferdecor); freeMemory(ADR_FICHIER_OBJ); freeMemory(PERSO); @@ -276,11 +270,6 @@ void Globals::setConfig() { warning("Unknown language in internal language mapping"); break; } - - if (_vm->getIsDemo()) - _internetFl = true; - else - _internetFl = false; // End of CHECKME switch (_language) { @@ -316,7 +305,6 @@ void Globals::clearAll() { INIT_VBOB(); ADR_FICHIER_OBJ = g_PTRNUL; NUM_FICHIER_OBJ = 0; - Bufferdecor = g_PTRNUL; _vm->_eventsManager._objectBuf = g_PTRNUL; _vm->_dialogsManager._inventWin1 = g_PTRNUL; _vm->_dialogsManager._inventBuf2 = g_PTRNUL; @@ -372,7 +360,6 @@ void Globals::clearAll() { _forestSprite = g_PTRNUL; _forestFl = false; - cache_souris = allocMemory(2500); GESTE = g_PTRNUL; GESTE_FLAG = 0; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 877683d850..4f3e9598bb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -329,7 +329,6 @@ public: int _inventory[36]; SortItem _sortedDisplay[51]; Language _language; - bool _internetFl; bool PUBEXIT; int PERSO_TYPE; uint _speed; @@ -363,9 +362,7 @@ public: bool _forestFl; byte *COUCOU; int16 *chemin; - byte *cache_souris; int16 *BufLig; - byte *Bufferdecor; byte *ADR_FICHIER_OBJ; byte *PERSO; int _objectWidth, _objectHeight; @@ -407,7 +404,6 @@ public: int couleur_40; int STOP_BUG; - int MAX_COMPTE; int force_to_data_0; int oldzone_46; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 94bfa239db..8c8b53a5a5 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -462,11 +462,6 @@ bool HopkinsEngine::runLinuxDemo() { _eventsManager.delay(1500); _graphicsManager.fadeOutLong(); - if (!_globals._internetFl) { - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("MP.ANM", 10, 16, 200); - } - _graphicsManager.loadImage("H2"); _graphicsManager.fadeInLong(); _eventsManager.delay(500); @@ -2505,14 +2500,6 @@ void HopkinsEngine::loadCredits() { _globals.Credit_lignes = idxLines; } while (!loopCond); -/* Useless - v5 = 0; - if (_globals.Credit_lignes > 0) { - do - ++v5; - while (v5 < _globals.Credit_lignes); - } -*/ _globals.freeMemory(bufPtr); } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a5659bca6f..99b992bb23 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -5010,7 +5010,6 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _verb = 4; - _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager._scrollOffset = 0; _vm->_dialogsManager._removeInventFl = false; _vm->_globals.PLAN_FLAG = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index f98ce3a5c0..4bd280a355 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2270,7 +2270,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 600: - if (!_vm->_globals._internetFl) { + if (!_vm->getIsDemo()) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_graphicsManager._fadeDefaultSpeed = 1; _vm->_animationManager.playAnim("BOMBE1A.ANM", 100, 18, 100); @@ -2353,7 +2353,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 607: - if (!_vm->_globals._internetFl) { + if (!_vm->getIsDemo()) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } -- cgit v1.2.3 From 2b1b6689086e73b77041ec36a8337f044486ad73 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Jan 2013 13:39:14 +0200 Subject: HOPKINS: Get rid of the NO_VISU global variable --- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - engines/hopkins/graphics.cpp | 8 ++++---- engines/hopkins/graphics.h | 4 ++-- engines/hopkins/script.cpp | 30 +++++++----------------------- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a4d03f5794..7d93e31af7 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -203,7 +203,6 @@ Globals::Globals() { GESTE_FLAG = 0; _disableInventFl = false; NOMARCHE = false; - NO_VISU = false; _optionDialogFl = false; _cacheFl = false; NOPARLE = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 4f3e9598bb..700670563d 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -381,7 +381,6 @@ public: bool _disableInventFl; bool NOMARCHE; int NBBLOC; - bool NO_VISU; byte *OPTION_SPR; bool _optionDialogFl; int _menuDisplayType; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index aaf5962cac..93c96ab1d9 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1177,7 +1177,7 @@ void GraphicsManager::displayVesaSegment() { unlockScreen(); } -void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx) { +void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment) { int height, width; width = _vm->_objectsManager.getWidth(objectData, idx); @@ -1189,7 +1189,7 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i Sprite_Vesa(_vesaBuffer, objectData, xp + 300, yp + 300, idx); Sprite_Vesa(_vesaScreen, objectData, xp + 300, yp + 300, idx); } - if (!_vm->_globals.NO_VISU) + if (addSegment) addVesaSegment(xp, yp, xp + width, yp + height); } @@ -1625,7 +1625,7 @@ Aff_Zoom_Larg_Cont1: /** * Fast Display */ -void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex) { +void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment) { int width = _vm->_objectsManager.getWidth(spriteData, spriteIndex); int height = _vm->_objectsManager.getHeight(spriteData, spriteIndex); @@ -1636,7 +1636,7 @@ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int sp Sprite_Vesa(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex); Sprite_Vesa(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex); } - if (!_vm->_globals.NO_VISU) + if (addSegment) addVesaSegment(xp, yp, xp + width, yp + height); } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 57405773ca..2796deb685 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -152,14 +152,14 @@ public: void RESET_SEGMENT_VESA(); void addVesaSegment(int x1, int y1, int x2, int y2); void displayVesaSegment(); - void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); + void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true); void CopyAsm(const byte *surface); void copy16bFromSurfaceScaleX2(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag); - void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex); + void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 4bd280a355..1f94d4b997 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1759,7 +1759,6 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 203: - _vm->_globals.NO_VISU = true; _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(4); do { @@ -1768,10 +1767,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); if (_vm->_objectsManager.BOBPOSI(4) == 18) - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 18, 334, 0); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 18, 334, 0, false); } while (_vm->_objectsManager.BOBPOSI(4) != 26); _vm->_objectsManager.stopBobAnimation(4); - _vm->_globals.NO_VISU = false; _vm->_objectsManager.SPRITE_ON(0); break; @@ -1865,7 +1863,6 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.stopBobAnimation(1); - _vm->_globals.NO_VISU = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; int v39 = _vm->_objectsManager.getSpriteY(0); @@ -1918,7 +1915,6 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_globals.CACHE_OFF(); _vm->_animationManager.NO_SEQ = true; - _vm->_globals.NO_VISU = false; _vm->_soundManager.SPECIAL_SOUND = 211; _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); _vm->_soundManager.SPECIAL_SOUND = 0; @@ -2285,23 +2281,17 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 601: - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(2, 0, 16, 4); break; case 602: - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(4, 0, 16, 4); break; case 603: - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_graphicsManager.FADE_LINUX = 2; @@ -2313,9 +2303,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 604: - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); _vm->_soundManager.SPECIAL_SOUND = 199; _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); @@ -2326,9 +2314,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 605: - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); _vm->_graphicsManager.fadeOutShort(); _vm->_soundManager.SPECIAL_SOUND = 199; @@ -2341,9 +2327,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 606: - _vm->_globals.NO_VISU = true; - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7); - _vm->_globals.NO_VISU = false; + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(6, 0, 16, 4); if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { _vm->_animationManager.playAnim("BOMBE3A.ANM", 50, 14, 500); -- cgit v1.2.3 From 0376c6bcb8266275aefca3540489a92a402c5b06 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Jan 2013 23:45:15 +0100 Subject: HOPKINS: Remove some nasty casts from menuManager and ObjectManager --- engines/hopkins/menu.cpp | 12 +++--- engines/hopkins/objects.cpp | 103 ++++++++++++++++++++++---------------------- 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index f607f2c15c..3368afa6c3 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -101,16 +101,16 @@ int MenuManager::menu() { menuIndex = MENU_NONE; mousePos = Common::Point(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); - if ((uint16)(mousePos.x - 232) <= 176) { - if ((uint16)(mousePos.y - 261) <= 23) + if (mousePos.x >= 232 && mousePos.x <= 408) { + if (mousePos.y >= 261 && mousePos.y <= 284) menuIndex = PLAY_GAME; - if ((uint16)(mousePos.y - 293) <= 23) + else if (mousePos.y >= 293 && mousePos.y <= 316) menuIndex = LOAD_GAME; - if ((uint16)(mousePos.y - 325) <= 22) + else if (mousePos.y >= 325 && mousePos.y <= 347) menuIndex = OPTIONS; - if ((uint16)(mousePos.y - 356) <= 23) + else if (mousePos.y >= 356 && mousePos.y <= 379) menuIndex = INTRODUCTION; - if ((uint16)(mousePos.y - 388) <= 23) + else if (mousePos.y >= 388 && mousePos.y <= 411) menuIndex = QUIT; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 99b992bb23..43a5dd7888 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2365,7 +2365,9 @@ void ObjectsManager::handleLeftButton() { destX = _vm->_eventsManager.getMouseX(); destY = _vm->_eventsManager.getMouseY(); - if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 && (uint16)(destY + 29) <= 78) { + if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && + destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 && + destY > -30 && destY < 50) { v1 = _vm->_eventsManager._mouseCursorId; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); @@ -2377,32 +2379,24 @@ void ObjectsManager::handleLeftButton() { } return; } - if (_vm->_globals._saveData->data[svField354] == 1 - && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 533) <= 26 - && (uint16)(destY - 26) <= 33) { + if (_vm->_globals._saveData->data[svField354] == 1 && !_vm->_globals.PLAN_FLAG + && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } - if (_vm->_globals._saveData->data[svField356] == 1 - && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 533) <= 26 - && (uint16)(destY - 26) <= 22) { + if (_vm->_globals._saveData->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG + && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 48) { changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } if (_vm->_globals._saveData->data[svField357] == 1) { - if (_vm->_globals._saveData->data[svField353] == 1 - && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 533) <= 26 - && (uint16)(destY - 26) <= 33) { + if (_vm->_globals._saveData->data[svField353] == 1 && !_vm->_globals.PLAN_FLAG + && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } - if (_vm->_globals._saveData->data[svField355] == 1 - && !_vm->_globals.PLAN_FLAG - && (uint16)(destX - 567) <= 26 - && (uint16)(destY - 26) <= 33) { + if (_vm->_globals._saveData->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG + && destX >= 567 && destX <= 593 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); return; } @@ -2452,7 +2446,7 @@ LABEL_38: _vm->_globals.GOACTION = false; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals._forestFl && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { + if (_vm->_globals._forestFl && NUMZONE >= 20 && NUMZONE <= 23) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { v10 = getSpriteX(0); v11 = getSpriteY(0); @@ -2504,10 +2498,12 @@ LABEL_65: _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); } } - if ((uint16)(NUMZONE + 1) > 1u) { - // TODO: Reformat the weird if statement generated by the decompiler - if (_vm->_eventsManager._mouseCursorId == 23 || (_vm->_globals._saveData->data[svField1] = _vm->_eventsManager._mouseCursorId, _vm->_eventsManager._mouseCursorId == 23)) + if (NUMZONE < -1 || NUMZONE > 0) { + if (_vm->_eventsManager._mouseCursorId == 23) _vm->_globals._saveData->data[svField1] = 5; + else + _vm->_globals._saveData->data[svField1] = _vm->_eventsManager._mouseCursorId; + if (_vm->_globals.PLAN_FLAG) _vm->_globals._saveData->data[svField1] = 6; _vm->_globals._saveData->data[svField2] = NUMZONE; @@ -2536,7 +2532,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals._saveData->data[svField1]; if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); - if (!_vm->_globals._forestFl || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { + if (!_vm->_globals._forestFl || NUMZONE < 20 || NUMZONE > 23) { if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) @@ -2602,7 +2598,7 @@ LABEL_64: NUMZONE = -1; _forceZoneFl = true; } - if (NUMZONE != _vm->_globals._saveData->data[svField2] || (uint16)(NUMZONE + 1) <= 1u) { + if (NUMZONE != _vm->_globals._saveData->data[svField2] || NUMZONE == -1 || NUMZONE == 0) { _vm->_eventsManager._mouseCursorId = 4; _changeVerbFl = false; } else { @@ -2627,7 +2623,7 @@ LABEL_64: if (_vm->_globals.NOMARCHE) { if (_vm->_eventsManager._mouseCursorId == 4) { result = NUMZONE + 1; - if ((uint16)(NUMZONE + 1) > 1u) + if (NUMZONE < -1 || NUMZONE > 0) handleRightButton(); } } @@ -3417,7 +3413,7 @@ LABEL_67: * Handle Right button */ void ObjectsManager::handleRightButton() { - if ((uint16)(NUMZONE + 1) > 1u) { + if (NUMZONE < -1 || NUMZONE > 0) { VERBEPLUS(); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); @@ -3561,60 +3557,65 @@ LABEL_58: * Prepare border used to highlight the place below mouse cursor, in the inventory. * Also set the mouse cursor */ -void ObjectsManager::initBorder(int a1) { +void ObjectsManager::initBorder(int zoneIdx) { _oldBorderPos = _borderPos; _oldBorderSpriteIndex = _borderSpriteIndex; - if ((uint16)(a1 - 1) <= 5u) + if (zoneIdx >= 1 && zoneIdx <= 6) _borderPos.y = 120; - if ((uint16)(a1 - 7) <= 5u) + else if (zoneIdx >= 7 && zoneIdx <= 12) _borderPos.y = 158; - if ((uint16)(a1 - 13) <= 5u) + else if (zoneIdx >= 13 && zoneIdx <= 18) _borderPos.y = 196; - if ((uint16)(a1 - 19) <= 5u) + else if (zoneIdx >= 19 && zoneIdx <= 24) _borderPos.y = 234; - if ((uint16)(a1 - 25) <= 4u) + else if (zoneIdx >= 25 && zoneIdx <= 29) _borderPos.y = 272; - if (a1 == 1 || a1 == 7 || a1 == 13 || a1 == 19 || a1 == 25) + else if (zoneIdx == 30) + _borderPos.y = 272; + else if (zoneIdx == 31) + _borderPos.y = 290; + + if (zoneIdx == 1 || zoneIdx == 7 || zoneIdx == 13 || zoneIdx == 19 || zoneIdx == 25) _borderPos.x = _vm->_graphicsManager._scrollOffset + 158; - if (a1 == 2 || a1 == 8 || a1 == 14 || a1 == 20 || a1 == 26) + else if (zoneIdx == 2 || zoneIdx == 8 || zoneIdx == 14 || zoneIdx == 20 || zoneIdx == 26) _borderPos.x = _vm->_graphicsManager._scrollOffset + 212; - if (a1 == 3 || a1 == 9 || a1 == 15 || a1 == 21 || a1 == 27) + else if (zoneIdx == 3 || zoneIdx == 9 || zoneIdx == 15 || zoneIdx == 21 || zoneIdx == 27) _borderPos.x = _vm->_graphicsManager._scrollOffset + 266; - if (a1 == 4 || a1 == 10 || a1 == 16 || a1 == 22 || a1 == 28) + else if (zoneIdx == 4 || zoneIdx == 10 || zoneIdx == 16 || zoneIdx == 22 || zoneIdx == 28) _borderPos.x = _vm->_graphicsManager._scrollOffset + 320; - if (a1 == 5 || a1 == 11 || a1 == 17 || a1 == 23 || a1 == 29) + else if (zoneIdx == 5 || zoneIdx == 11 || zoneIdx == 17 || zoneIdx == 23 || zoneIdx == 29) _borderPos.x = _vm->_graphicsManager._scrollOffset + 374; - if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u) + else if (zoneIdx == 6 || zoneIdx == 12 || zoneIdx == 18 || zoneIdx == 24 || zoneIdx == 30 || zoneIdx == 31) _borderPos.x = _vm->_graphicsManager._scrollOffset + 428; - if ((uint16)(a1 - 1) <= 28) + + if (zoneIdx >= 1 && zoneIdx <= 29) _borderSpriteIndex = 0; - if ((uint16)(a1 - 30) <= 1) + else if (zoneIdx == 30 || zoneIdx == 31) _borderSpriteIndex = 2; - if (a1 == 30) - _borderPos.y = 272; - if (a1 == 31) - _borderPos.y = 290; - if (!a1 || a1 == 32) { + else if (!zoneIdx || zoneIdx == 32) { _borderPos = Common::Point(0, 0); _borderSpriteIndex = 0; } - if (!a1) + + if (!zoneIdx) _vm->_eventsManager._mouseCursorId = 0; - if (a1 == 32) + else if (zoneIdx == 32) _vm->_eventsManager._mouseCursorId = 16; - if (a1 == 30) + else if (zoneIdx == 30) _vm->_eventsManager._mouseCursorId = 2; - if (a1 == 31) + else if (zoneIdx == 31) _vm->_eventsManager._mouseCursorId = 3; - if ((uint16)(a1 - 1) <= 28) + else if (zoneIdx >= 1 && zoneIdx <= 28) _vm->_eventsManager._mouseCursorId = 8; - if (a1 == 29) + else if (zoneIdx == 29) _vm->_eventsManager._mouseCursorId = 1; - if ((uint16)(a1 - 1) <= 27 && !_vm->_globals._inventory[a1]) { + + if (zoneIdx >= 1 && zoneIdx <= 28 && !_vm->_globals._inventory[zoneIdx]) { _vm->_eventsManager._mouseCursorId = 0; _borderPos = Common::Point(0, 0); _borderSpriteIndex = 0; } + if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); _vm->_eventsManager.getMouseX(); -- cgit v1.2.3 From 96d1247e4af6aff101888daaa6a24592d27209ce Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Jan 2013 00:22:34 +0100 Subject: HOPKINS: Get rid of some more casts in objectManager --- engines/hopkins/objects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 43a5dd7888..3a080ab092 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1468,7 +1468,7 @@ void ObjectsManager::checkZone() { _vm->_globals.old_zone_68 = v4; if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) { v1 = v4 + 1; - if ((uint16)(v4 + 1) > 1u) + if (v4 != -1 && v4 != 0) handleRightButton(); } if ((_vm->_globals.PLAN_FLAG && v4 == -1) || !v4) { @@ -2430,7 +2430,7 @@ void ObjectsManager::handleLeftButton() { LABEL_38: if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || NUMZONE <= 0)) return; - if ((uint16)(NUMZONE + 1) > 1u) { + if (NUMZONE != -1 && NUMZONE != 0) { zoneCount = NUMZONE; zoneX = _vm->_globals.ZONEP[zoneCount]._destX; if (zoneX) { @@ -2498,7 +2498,7 @@ LABEL_65: _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); } } - if (NUMZONE < -1 || NUMZONE > 0) { + if (NUMZONE != -1 && NUMZONE != 0) { if (_vm->_eventsManager._mouseCursorId == 23) _vm->_globals._saveData->data[svField1] = 5; else @@ -2623,7 +2623,7 @@ LABEL_64: if (_vm->_globals.NOMARCHE) { if (_vm->_eventsManager._mouseCursorId == 4) { result = NUMZONE + 1; - if (NUMZONE < -1 || NUMZONE > 0) + if (NUMZONE != -1 && NUMZONE != 0) handleRightButton(); } } @@ -3413,7 +3413,7 @@ LABEL_67: * Handle Right button */ void ObjectsManager::handleRightButton() { - if (NUMZONE < -1 || NUMZONE > 0) { + if (NUMZONE != -1 && NUMZONE != 0) { VERBEPLUS(); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); -- cgit v1.2.3 From e4fcd5c406465d2058f8e69ff7601cfae9a53019 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Jan 2013 00:22:34 +0100 Subject: HOPKINS: Get rid of some more casts in objectManager --- engines/hopkins/objects.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3a080ab092..8c3cde71fa 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1395,7 +1395,7 @@ void ObjectsManager::checkZone() { if (_vm->_globals.PLAN_FLAG || _vm->_eventsManager._startPos.x >= v0 || (v1 = _vm->_graphicsManager._scrollOffset + 54, v0 >= v1) - || (v1 = v2 - 1, (uint16)(v2 - 1) > 59)) { + || (v1 = v2 - 1, v1 < 0 || v1 > 59)) { if (_visibleFl) FLAG_VISIBLE_EFFACE = 4; _visibleFl = false; @@ -1609,7 +1609,7 @@ LABEL_241: return; } if (_vm->_globals.g_old_sens == 3) { - if ((uint16)(_vm->_globals.g_old_anim - 24) > 11) { + if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1648,7 +1648,7 @@ LABEL_23: } if (_vm->_globals.g_old_sens != 7) goto LABEL_43; - if ((uint16)(_vm->_globals.g_old_anim - 24) > 11) { + if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1718,13 +1718,11 @@ LABEL_59: LABEL_60: if (_vm->_globals.g_old_sens != 5) goto LABEL_77; - if ((uint16)(_vm->_globals.g_old_anim - 48) > 11) { + if (_vm->_globals.g_old_anim < 48 || _vm->_globals.g_old_anim > 59) { v0 = g_old_x; v58 = g_old_y; } else { - v19 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (v19 < 0) - v19 = -v19; + v19 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); v20 = v19; if (_sprite[0].fieldC < 0) { v21 = _sprite[0].fieldC; @@ -1750,7 +1748,7 @@ LABEL_76: LABEL_77: if (_vm->_globals.g_old_sens != 2) goto LABEL_96; - if ((uint16)(_vm->_globals.g_old_anim - 12) > 11) { + if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1788,7 +1786,7 @@ LABEL_95: LABEL_96: if (_vm->_globals.g_old_sens != 8) goto LABEL_115; - if ((uint16)(_vm->_globals.g_old_anim - 12) > 11) { + if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1826,7 +1824,7 @@ LABEL_114: LABEL_115: if (_vm->_globals.g_old_sens != 4) goto LABEL_134; - if ((uint16)(_vm->_globals.g_old_anim - 36) > 11) { + if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { v0 = g_old_x; v58 = g_old_y; } else { @@ -1864,7 +1862,7 @@ LABEL_133: LABEL_134: if (_vm->_globals.g_old_sens != 6) goto LABEL_153; - if ((uint16)(_vm->_globals.g_old_anim - 36) > 11) { + if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { v0 = g_old_x; v58 = g_old_y; } else { @@ -2594,7 +2592,7 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); - if ((uint16)(NUMZONE + 1) > 1u && !_vm->_globals.ZONEP[NUMZONE].field16) { + if (NUMZONE != -1 && NUMZONE != 0 && !_vm->_globals.ZONEP[NUMZONE].field16) { NUMZONE = -1; _forceZoneFl = true; } @@ -3261,7 +3259,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager._mouseCursorId = 4; LABEL_24: - if (!_vm->_globals.NOMARCHE || (v = NUMZONE + 1, (uint16)(NUMZONE + 1) <= 1u)) { + if (!_vm->_globals.NOMARCHE || (v = NUMZONE + 1, NUMZONE == -1 || NUMZONE == 0) { if (_vm->_eventsManager._mouseCursorId == 4) return; } else { -- cgit v1.2.3 From 137eb5f34881c04c7e6305bbe07446148a2da9a9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Jan 2013 00:38:19 +0100 Subject: HOPKINS: Fix typo in previous commit --- engines/hopkins/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8c3cde71fa..5ef8c1292d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3259,7 +3259,7 @@ void ObjectsManager::VERBEPLUS() { do { _vm->_eventsManager._mouseCursorId = 4; LABEL_24: - if (!_vm->_globals.NOMARCHE || (v = NUMZONE + 1, NUMZONE == -1 || NUMZONE == 0) { + if (!_vm->_globals.NOMARCHE || (v = NUMZONE + 1, NUMZONE == -1 || NUMZONE == 0)) { if (_vm->_eventsManager._mouseCursorId == 4) return; } else { -- cgit v1.2.3 From f3174c64bf20611c234083488826f3882a5a3846 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Jan 2013 01:15:15 +0100 Subject: HOPKINS: Rewrite nextVerbIcon --- engines/hopkins/objects.cpp | 310 +++++++++++++++++++------------------------- engines/hopkins/objects.h | 2 +- 2 files changed, 131 insertions(+), 181 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5ef8c1292d..df8f3d75b9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2602,7 +2602,7 @@ LABEL_64: } else { _vm->_eventsManager._mouseCursorId = _vm->_globals._saveData->data[svField1]; if (_changeVerbFl) { - VERBEPLUS(); + nextVerbIcon(); _changeVerbFl = false; } if (_vm->_eventsManager._mouseCursorId == 5) @@ -3206,204 +3206,154 @@ LABEL_88: return result; } -void ObjectsManager::VERBEPLUS() { - int v; - - v = _vm->_eventsManager._mouseCursorId + 1; - _vm->_eventsManager._mouseCursorId = v; - if (v == 4) - goto LABEL_24; - if (v == 5) - goto LABEL_28; - if (v == 6) - goto LABEL_29; - if (v == 7) - goto LABEL_31; - if (v == 8) - goto LABEL_33; - if (v == 9) - goto LABEL_35; - if (v == 10) - goto LABEL_37; - if (v == 11) - goto LABEL_39; - if (v == 12) - goto LABEL_41; - if (v == 13) - goto LABEL_43; - if (v == 14) - goto LABEL_45; - if (v == 15) - goto LABEL_47; - if (v == 16) - goto LABEL_49; - if (v == 17) - goto LABEL_51; - if (v == 18) - goto LABEL_53; - if (v == 19) - goto LABEL_55; - if (v == 20) - goto LABEL_57; - if (v == 21) - goto LABEL_59; - if (v == 22) - goto LABEL_61; - if (v == 23) - goto LABEL_63; - if (v == 24) - goto LABEL_65; - if (v == 25) - goto LABEL_67; +/** + * Get next verb icon (or text) + */ +void ObjectsManager::nextVerbIcon() { + _vm->_eventsManager._mouseCursorId++; + do { - do { - _vm->_eventsManager._mouseCursorId = 4; -LABEL_24: - if (!_vm->_globals.NOMARCHE || (v = NUMZONE + 1, NUMZONE == -1 || NUMZONE == 0)) { - if (_vm->_eventsManager._mouseCursorId == 4) - return; - } else { - _vm->_eventsManager._mouseCursorId = 5; - } -LABEL_28: + if (_vm->_eventsManager._mouseCursorId == 4) { + if (!_vm->_globals.NOMARCHE || NUMZONE == -1 || NUMZONE == 0) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 6) { -LABEL_29: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 5 || _vm->_eventsManager._mouseCursorId == 6) { + _vm->_eventsManager._mouseCursorId = 6; + if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 7) { -LABEL_31: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 7) { + if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 8) { -LABEL_33: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 8) { + if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 9) { -LABEL_35: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 9) { + if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 10) { -LABEL_37: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 10) { + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) + return; ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 11) { -LABEL_39: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 11) { + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 12) { -LABEL_41: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 12) { + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 13) { -LABEL_43: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 13) { + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 14) { -LABEL_45: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 14) { + if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 15) { -LABEL_47: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 15) { + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 16) { -LABEL_49: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 16) { + if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 17) { -LABEL_51: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 17) { + if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 18) { -LABEL_53: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 18) { + if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 19) { -LABEL_55: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 19) { + if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 20) { -LABEL_57: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 20) { + if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 21) { -LABEL_59: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 21) { + if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 22) { -LABEL_61: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 22) { + if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 23) { -LABEL_63: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) - return; - } + } + + if (_vm->_eventsManager._mouseCursorId == 23) { + if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) + return; + ++_vm->_eventsManager._mouseCursorId; - if (_vm->_eventsManager._mouseCursorId == 24) { -LABEL_65: - v = 5 * NUMZONE; - if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) - return; - } - v = _vm->_eventsManager._mouseCursorId + 1; - _vm->_eventsManager._mouseCursorId = v; - } while (v != 25); -LABEL_67: - v = 5 * NUMZONE; + } + + if (_vm->_eventsManager._mouseCursorId == 24) { + if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) + return; + + ++_vm->_eventsManager._mouseCursorId; + } + + _vm->_eventsManager._mouseCursorId = 4; } while (_vm->_globals.ZONEP[NUMZONE].fieldE != 2); } @@ -3412,7 +3362,7 @@ LABEL_67: */ void ObjectsManager::handleRightButton() { if (NUMZONE != -1 && NUMZONE != 0) { - VERBEPLUS(); + nextVerbIcon(); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); _verb = _vm->_eventsManager._mouseCursorId; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 8b7ed924e1..d8f9c13506 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -190,7 +190,7 @@ public: void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); int16 *PARC_VOITURE(int a1, int a2, int a3, int a4); - void VERBEPLUS(); + void nextVerbIcon(); void handleRightButton(); int MZONE(); void initBorder(int a1); -- cgit v1.2.3 From df00c12c85300680b9b5074d872ef8c9ecddca46 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Jan 2013 07:36:00 +0100 Subject: HOPKINS: Refactor searchSavegames --- engines/hopkins/dialogs.cpp | 72 +++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 81ef831dde..b2477c2bb0 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -689,58 +689,46 @@ int DialogsManager::searchSavegames() { int yp = _vm->_eventsManager.getMouseY(); _vm->_graphicsManager._scrollOffset = _vm->_eventsManager._startPos.x; - if ((uint16)(yp - 112) <= 86) { - if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) + if (yp >= 112 && yp <= 198) { + if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) { slotNumber = 1; - if ((uint16)(yp - 112) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) + _vm->_objectsManager._saveLoadX = 189; + _vm->_objectsManager._saveLoadY = 111; + } else if (xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) { slotNumber = 2; - } - if ((uint16)(yp - 203) <= 86) { - if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) + _vm->_objectsManager._saveLoadX = 322; + _vm->_objectsManager._saveLoadY = 111; + } + } else if (yp >= 203 && yp <= 289) { + if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) { slotNumber = 3; - if ((uint16)(yp - 203) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) + _vm->_objectsManager._saveLoadX = 189; + _vm->_objectsManager._saveLoadY = 202; + } else if (xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) { slotNumber = 4; - } - if ((uint16)(yp - 294) <= 86) { - if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) + _vm->_objectsManager._saveLoadX = 322; + _vm->_objectsManager._saveLoadY = 202; + } + } else if (yp >= 294 && yp <= 380) { + if (xp > _vm->_graphicsManager._scrollOffset + 189 && xp < _vm->_graphicsManager._scrollOffset + 318) { slotNumber = 5; - if ((uint16)(yp - 294) <= 86 && xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) + _vm->_objectsManager._saveLoadX = 189; + _vm->_objectsManager._saveLoadY = 293; + } else if (xp > _vm->_graphicsManager._scrollOffset + 322 && xp < _vm->_graphicsManager._scrollOffset + 452) { slotNumber = 6; - } - if ((uint16)(yp - 388) <= 16 && xp > _vm->_graphicsManager._scrollOffset + 273 && xp < _vm->_graphicsManager._scrollOffset + 355) + _vm->_objectsManager._saveLoadX = 322; + _vm->_objectsManager._saveLoadY = 293; + } + } else if (yp >= 388 && yp <= 404 && xp > _vm->_graphicsManager._scrollOffset + 273 && xp < _vm->_graphicsManager._scrollOffset + 355) { slotNumber = 7; - - switch (slotNumber) { - case 1: - _vm->_objectsManager._saveLoadX = 189; - _vm->_objectsManager._saveLoadY = 111; - break; - case 2: - _vm->_objectsManager._saveLoadX = 322; - _vm->_objectsManager._saveLoadY = 111; - break; - case 3: - _vm->_objectsManager._saveLoadX = 189; - _vm->_objectsManager._saveLoadY = 202; - break; - case 4: - _vm->_objectsManager._saveLoadX = 322; - _vm->_objectsManager._saveLoadY = 202; - break; - case 5: - _vm->_objectsManager._saveLoadX = 189; - _vm->_objectsManager._saveLoadY = 293; - break; - case 6: - _vm->_objectsManager._saveLoadX = 322; - _vm->_objectsManager._saveLoadY = 293; - break; - case 0: - case 7: _vm->_objectsManager._saveLoadX = 0; _vm->_objectsManager._saveLoadY = 0; - break; + } else { + slotNumber = 0; + _vm->_objectsManager._saveLoadX = 0; + _vm->_objectsManager._saveLoadY = 0; } + return slotNumber; } -- cgit v1.2.3 From 0bf6d54d6bbddcb490aecdeaf6844957ee5faa56 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Jan 2013 08:05:58 +0100 Subject: HOPKINS: Simplify absolute values in LinesManager --- engines/hopkins/graphics.cpp | 40 +++++----- engines/hopkins/graphics.h | 2 +- engines/hopkins/lines.cpp | 182 +++++++++++-------------------------------- 3 files changed, 66 insertions(+), 158 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 93c96ab1d9..2b5eef98d7 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -48,7 +48,7 @@ GraphicsManager::GraphicsManager() { _lineNbr2 = 0; Agr_x = Agr_y = 0; - Agr_Flag_x = Agr_Flag_y = 0; + Agr_Flag_x = Agr_Flag_y = false; _fadeDefaultSpeed = 15; FADE_LINUX = 0; _skipVideoLockFl = false; @@ -455,7 +455,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width yNext = height; Agr_x = 0; Agr_y = 0; - Agr_Flag_y = 0; + Agr_Flag_y = false; do { for (;;) { @@ -483,17 +483,17 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width yNext = yCtr; srcP = srcCopyP; destP = WinScan + destCopyP; - if (Agr_Flag_y == 1) + if (Agr_Flag_y) break; if ((unsigned int)Agr_y < 100) break; Agr_y -= 100; - Agr_Flag_y = 1; + Agr_Flag_y = true; } - Agr_Flag_y = 0; + Agr_Flag_y = false; srcP = _lineNbr2 + srcCopyP; yNext = yCtr - 1; } while (yCtr != 1); @@ -1313,8 +1313,8 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Compteur_y = 0; Agr_x = 0; Agr_y = 0; - Agr_Flag_y = 0; - Agr_Flag_x = 0; + Agr_Flag_y = false; + Agr_Flag_x = false; _width = spriteWidth; int v20 = zoomIn(spriteWidth, zoom2); int v22 = zoomIn(spriteHeight1, zoom2); @@ -1340,12 +1340,10 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if (v20 > (uint16)clip_x1) { int v32 = v20 - (uint16)clip_x1; v29 -= v32; - int v62 = v22; int v33 = 0; while (zoomIn(v33 + 1, zoom2) < v32) ; int v34 = v33; - v22 = v62; spritePixelsP += v34; v20 = (uint16)clip_x1; } @@ -1355,7 +1353,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v63 = v22; byte *v53 = v29; v46 = spritePixelsP; - Agr_Flag_x = 0; + Agr_Flag_x = false; Agr_x = 0; for (int v35 = v20; v35; v35--) { for (;;) { @@ -1367,14 +1365,14 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_x = zoom2 + Agr_x; if ((uint16)Agr_x < 100) break; - Agr_x = Agr_x - 100; + Agr_x -= 100; --spritePixelsP; - Agr_Flag_x = 1; + Agr_Flag_x = true; --v35; if (!v35) goto R_Aff_Zoom_Larg_Cont1; } - Agr_Flag_x = 0; + Agr_Flag_x = false; } R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; @@ -1384,14 +1382,14 @@ R_Aff_Zoom_Larg_Cont1: Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 100) break; - Agr_y = Agr_y - 100; + Agr_y -= 100; spritePixelsP = v46; - Agr_Flag_y = 1; + Agr_Flag_y = true; v22 = v63 - 1; if (v63 == 1) return; } - Agr_Flag_y = 0; + Agr_Flag_y = false; v22 = v63 - 1; } while (v63 != 1); } else { @@ -1431,7 +1429,7 @@ R_Aff_Zoom_Larg_Cont1: byte *v51 = dest1P; v45 = spritePixelsP; int v28 = v20; - Agr_Flag_x = 0; + Agr_Flag_x = false; Agr_x = 0; do { for (;;) { @@ -1445,12 +1443,12 @@ R_Aff_Zoom_Larg_Cont1: break; Agr_x = Agr_x - 100; --spritePixelsP; - Agr_Flag_x = 1; + Agr_Flag_x = true; --v28; if (!v28) goto Aff_Zoom_Larg_Cont1; } - Agr_Flag_x = 0; + Agr_Flag_x = false; --v28; } while (v28); Aff_Zoom_Larg_Cont1: @@ -1462,12 +1460,12 @@ Aff_Zoom_Larg_Cont1: break; Agr_y = Agr_y - 100; spritePixelsP = v45; - Agr_Flag_y = 1; + Agr_Flag_y = true; v22 = v60 - 1; if (v60 == 1) return; } - Agr_Flag_y = 0; + Agr_Flag_y = false; v22 = v60 - 1; } while (v60 != 1); } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 2796deb685..8ff4a7c13e 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -76,7 +76,7 @@ public: int _scrollSpeed; int _lineNbr2; int Agr_x, Agr_y; - int Agr_Flag_x, Agr_Flag_y; + bool Agr_Flag_x, Agr_Flag_y; int _fadeDefaultSpeed; int FADE_LINUX; bool _skipVideoLockFl; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c2a56fa46d..1fb48047eb 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -141,12 +141,8 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ _zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx].zoneData); - int v8 = a2 - a4; - if (a2 - a4 < 0) - v8 = -v8; - int v9 = a3 - a5; - if (a3 - a5 < 0) - v9 = -v9; + int v8 = abs(a2 - a4); + int v9 = abs(a3 - a5); int v20 = 1; if (v8 <= v9) v20 += v9; @@ -230,16 +226,12 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, _linesNumb = idx; Ligne[idx].lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx].lineData); - v7 = a3 - a5; - if (a3 - a5 < 0) - v7 = -v7; + v7 = abs(a3 - a5); v8 = v7 + 1; - v9 = a4 - a6; - if (a4 - a6 < 0) - v9 = -v9; + v9 = abs(a4 - a6); v34 = v9 + 1; v33 = v9 + 1; - if (v8 > (int)(v9 + 1)) + if (v8 > v34) v34 = v8; v10 = _vm->_globals.allocMemory(4 * v34 + 8); @@ -1059,17 +1051,13 @@ LABEL_11: v93 = v16[v65 - 1]; } LABEL_17: - int v18 = a3 - a5; - if (a3 - a5 < 0) - v18 = -v18; + int v18 = abs(a3 - a5); int v58 = v18 + 1; - int v19 = a4 - a6; - if (a4 - a6 < 0) - v19 = -v19; + int v19 = abs(a4 - a6); int v85 = v19 + 1; int v20 = v19 + 1; if (v58 > v20) - v85 = v18 + 1; + v85 = v58; int v84 = 1000 * v58 / v85; int v83 = 1000 * v20 / v85; int v21 = 1000 * a3; @@ -1222,9 +1210,7 @@ LABEL_17: NVPX = v78; NVPY = v79; if (a1 < v80) { - int v40 = v80 - a1; - if (v40 < 0) - v40 = -v40; + int v40 = abs(v80 - a1); int v41 = v40; int v43 = 0; int v52 = v92 - 1; @@ -1239,15 +1225,9 @@ LABEL_17: } while (v80 != v42); if (v41 == v43) { int v44 = Ligne[a1].field0 / 2; - int v54 = Ligne[a1].field0 / 2; - if (v44 < 0) - v54 = -v44; + int v54 = abs(v44); if (a2 > v54) { - int v55 = Ligne[a1].field0 / 2; - if (v44 < 0) - v55 = -v44; - if (a2 >= v55) - v99 = CONTOURNE(a1, a2, a7, v80, v77, a8, a9); + v99 = CONTOURNE(a1, a2, a7, v80, v77, a8, a9); } else { v99 = CONTOURNE1(a1, a2, a7, v80, v77, a8, a9, v92, v91); } @@ -1258,9 +1238,7 @@ LABEL_17: v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); } if (a1 > v80) { - int v45 = a1 - v80; - if (v45 < 0) - v45 = -v45; + int v45 = abs(a1 - v80); int v46 = v45; int v47 = a1; int v48 = 0; @@ -1275,15 +1253,9 @@ LABEL_17: } while (v80 != v47); if (v46 == v48) { int v49 = Ligne[a1].field0 / 2; - int v56 = Ligne[a1].field0 / 2; - if (v49 < 0) - v56 = -v49; + int v56 = abs(v49); if (a2 > v56) { - int v57 = Ligne[a1].field0 / 2; - if (v49 < 0) - v57 = -v49; - if (a2 >= v57) - v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); } else { v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); } @@ -1461,33 +1433,21 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (destY <= 24) v122 = 25; if (!_vm->_globals.NOT_VERIF) { - v4 = srcX - _vm->_globals.old_x1_65; - if (v4 < 0) - v4 = -v4; + v4 = abs(srcX - _vm->_globals.old_x1_65); if (v4 <= 4) { - v5 = srcY - _vm->_globals.old_y1_66; - if (v5 < 0) - v5 = -v5; + v5 = abs(srcY - _vm->_globals.old_y1_66); if (v5 <= 4) { - v6 = _vm->_globals.old_x2_67 - destX; - if (v6 < 0) - v6 = -v6; + v6 = abs(_vm->_globals.old_x2_67 - destX); if (v6 <= 4) { - v7 = _vm->_globals.old_y2_68 - v122; - if (v7 < 0) - v7 = -v7; + v7 = abs(_vm->_globals.old_y2_68 - v122); if (v7 <= 4) return (int16 *)g_PTRNUL; } } } - v8 = srcX - destX; - if (v8 < 0) - v8 = -v8; + v8 = abs(srcX - destX); if (v8 <= 4) { - v9 = srcY - v122; - if (v9 < 0) - v9 = -v9; + v9 = abs(srcY - v122); if (v9 <= 4) return (int16 *)g_PTRNUL; } @@ -1510,13 +1470,9 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v123 = _vm->_graphicsManager.max_x - 10; if (v122 > _vm->_globals.Max_Perso_Y) v122 = _vm->_globals.Max_Perso_Y; - v10 = srcX - v123; - if (v10 < 0) - v10 = -v10; + v10 = abs(srcX - v123); if (v10 <= 3) { - v11 = srcY - v122; - if (v11 < 0) - v11 = -v11; + v11 = abs(srcY - v122); if (v11 <= 3) return (int16 *)g_PTRNUL; } @@ -1735,27 +1691,19 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } v131[7] = v46 + 1; if (v141[1] != -1) { - v50 = v141[1] - v121; - if (v50 < 0) - v50 = -v50; + v50 = abs(v141[1] - v121); v126[1] = v50; } if (v141[3] != -1) { - v51 = v141[3] - v121; - if (v51 < 0) - v51 = -v51; + v51 = abs(v141[3] - v121); v126[3] = v51; } if (v141[5] != -1) { - v52 = v141[5] - v121; - if (v52 < 0) - v52 = -v52; + v52 = abs(v141[5] - v121); v126[5] = v52; } if (v141[7] != -1) { - v53 = v141[7] - v121; - if (v53 < 0) - v53 = -v53; + v53 = abs(v141[7] - v121); v126[7] = v53; } if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) @@ -1927,9 +1875,7 @@ LABEL_234: v112 += 4; v76 = Ligne[v110].field0; if (v76 > 30) { - v77 = v76 / 2; - if (v77 < 0) - v77 = -v77; + v77 = abs(v76 / 2); if (v72 == v77) { v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); if (v78 == 1) @@ -1997,9 +1943,7 @@ LABEL_200: v112 += 4; v86 = Ligne[v109].field0; if (v86 > 30) { - v87 = v86 / 2; - if (v87 < 0) - v87 = -v87; + v87 = abs(v86 / 2); if (v83 == v87) { v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); if (v88 == 1) @@ -2285,13 +2229,9 @@ LABEL_150: } goto LABEL_248; } - v9 = v7 - a3; - if (v7 - a3 < 0) - v9 = -v9; + v9 = abs(v7 - a3); v10 = v9 + 1; - v11 = v90 - a4; - if (v90 - a4 < 0) - v11 = -v11; + v11 = abs(v90 - a4); v107 = v11 + 1; if (v10 > (int16)(v11 + 1)) v107 = v10; @@ -2330,13 +2270,9 @@ LABEL_150: if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(v7, v109, a3, a4) != -1) break; LABEL_72: - v19 = v111 - a3; - if (v111 - a3 < 0) - v19 = -v19; + v19 = abs(v111 - a3); v20 = v19 + 1; - v95 = v109 - a4; - if (v95 < 0) - v95 = -(v109 - a4); + v95 = abs(v109 - a4); v108 = v95 + 1; if (v20 > (int16)(v95 + 1)) v108 = v20; @@ -2928,13 +2864,9 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { int v17; int v18; - v4 = a1 - a3; - if (a1 - a3 < 0) - v4 = -v4; + v4 = abs(a1 - a3); v5 = v4 + 1; - v11 = a2 - a4; - if (a2 - a4 < 0) - v11 = -(a2 - a4); + v11 = abs(a2 - a4); v13 = v11 + 1; if (v5 > (int)(v11 + 1)) v13 = v5; @@ -3046,14 +2978,10 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v26 = v48; } if (v26 > 0) { - v30 = v26; - v31 = v26; - if (v26 < 0) - v31 = -v26; + v30 = abs(v26); + v31 = abs(v26); v46 = v63; v25 = _vm->_graphicsManager.zoomIn(v25, v31); - if (v30 < 0) - v30 = -v30; v40 = _vm->_graphicsManager.zoomIn(v40, v30); v63 = v46; } @@ -3089,28 +3017,20 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v39 = _vm->_globals.Hopkins[v52].field2; v15 = _vm->_globals.STAILLE[v63]; if (v15 < 0) { - v16 = v15; - v17 = v15; - if (v15 < 0) - v17 = -v15; + v16 = abs(v15); + v17 = abs(v15); v47 = _vm->_globals.STAILLE[v63]; v43 = v63; v14 = _vm->_graphicsManager.zoomOut(v14, v17); - if (v16 < 0) - v16 = -v16; v39 = _vm->_graphicsManager.zoomOut(v39, v16); v63 = v43; v15 = v47; } if (v15 > 0) { - v19 = v15; - v20 = v15; - if (v15 < 0) - v20 = -v15; + v19 = abs(v15); + v20 = abs(v15); v44 = v63; v14 = _vm->_graphicsManager.zoomIn(v14, v20); - if (v19 < 0) - v19 = -v19; v39 = _vm->_graphicsManager.zoomIn(v39, v19); v63 = v44; } @@ -3158,7 +3078,7 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { if (v51 == 24) v51 = 12; ++v55; - if (v62 <= a5 || a6 >= (int)v63) + if (v62 <= a5 || a6 >= v63) v49 = 1; } while (v49 != 1); if (v55 > 5) { @@ -3287,32 +3207,22 @@ int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { v35 = 100; v27 = 100; v8 = 0; - v9 = a4 - a5; - if (a4 - a5 < 0) - v9 = -v9; + v9 = abs(a4 - a5); v36 = v9; if (v40 != -1) { - v10 = v50 - a5; - if (v50 - a5 < 0) - v10 = -v10; + v10 = abs(v50 - a5); v28 = v10; } if (v39 != -1) { - v11 = v51 - a5; - if (v11 < 0) - v11 = -v11; + v11 = abs(v51 - a5); v7 = v11; } if (v38 != -1) { - v12 = v52 - a5; - if (v12 < 0) - v12 = -v12; + v12 = abs(v52 - a5); v35 = v12; } if (v37 != -1) { - v13 = v53 - a5; - if (v13 < 0) - v13 = -v13; + v13 = abs(v53 - a5); v27 = v13; } if (v28 < v36 && v28 <= v7 && v28 <= v35 && v28 <= v27) -- cgit v1.2.3 From 36894babe1ddecc10c9fedba36c5649f3e21b84e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Jan 2013 08:28:15 +0100 Subject: HOPKINS: Refactor checkCollisionLine --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/lines.cpp | 361 +++++++++++++++++++++----------------------- engines/hopkins/lines.h | 6 +- engines/hopkins/objects.cpp | 56 ++++--- 4 files changed, 200 insertions(+), 227 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 7d93e31af7..2392376a97 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -325,12 +325,12 @@ void Globals::clearAll() { chemin = (int16 *)g_PTRNUL; for (int idx = 0; idx < 400; ++idx) { - _vm->_linesManager.Ligne[idx].field0 = 0; + _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; _vm->_linesManager.Ligne[idx].field2 = 0; _vm->_linesManager.Ligne[idx].field4 = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; - _vm->_linesManager.Ligne[idx].lineData = (int16 *)g_PTRNUL; + _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; _vm->_linesManager._zoneLine[idx].count = 0; _vm->_linesManager._zoneLine[idx].field2 = 0; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 1fb48047eb..d9052859eb 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -183,8 +183,8 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ void LinesManager::RESET_OBSTACLE() { for (int idx = 0; idx < 400; ++idx) { RETIRE_LIGNE(idx); - Ligne[idx].field0 = 0; - Ligne[idx].lineData = (int16 *)g_PTRNUL; + Ligne[idx]._lineDataEndIdx = 0; + Ligne[idx]._lineData = (int16 *)g_PTRNUL; } } @@ -192,7 +192,7 @@ void LinesManager::RESET_OBSTACLE() { void LinesManager::RETIRE_LIGNE(int idx) { if (idx > 400) error("Attempting to add a line obstacle > MAX_LIGNE."); - Ligne[idx].lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx].lineData); + Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); } // Add Line @@ -225,7 +225,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, if (_linesNumb < idx) _linesNumb = idx; - Ligne[idx].lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx].lineData); + Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); v7 = abs(a3 - a5); v8 = v7 + 1; v9 = abs(a4 - a6); @@ -239,9 +239,9 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, error("AJOUTE LIGNE OBSTACLE"); Common::fill(v10, v10 + 4 * v34 + 8, 0); - Ligne[idx].lineData = (int16 *)v10; + Ligne[idx]._lineData = (int16 *)v10; - v32 = Ligne[idx].lineData; + v32 = Ligne[idx]._lineData; v36 = 1000 * v8; v39 = 1000 * v8 / (v34 - 1); v37 = 1000 * v33 / (v34 - 1); @@ -337,91 +337,68 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, v27[0] = -1; v27[1] = -1; - Ligne[idx].field0 = v35 + 1; + Ligne[idx]._lineDataEndIdx = v35 + 1; Ligne[idx].field2 = a7; Ligne[idx].field4 = a2; } -// Line Collision 2 -bool LinesManager::colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6) { - int16 *v7; - int16 *v13; - - int v24 = a5; - int v6 = a5; - if (a5 >= a6 + 1) - return false; - - int v11; - int v22 = a1 + 4; - int v21 = a1 - 4; - int v20 = a2 + 4; - int v19 = a2 - 4; - int v17; - for (;;) { - v7 = Ligne[v6].lineData; - - if (v7 != (int16 *)g_PTRNUL) { - int v23 = 1; - int v8 = 2 * Ligne[v6].field0; - int v9 = v7[0]; - int v16 = v7[1]; - int v10 = v7[v8 - 2]; - int v18 = v7[v8 - 1]; - if (v7[0] >= v10) { - if (v21 > v9 || v22 < v10) - v23 = 0; - } else { - if (v22 < v9 || v21 > v10) - v23 = 0; - if (v9 >= v10) { - if (v21 > v9 || v22 < v10) - v23 = 0; - } - } - if (v16 >= v18) { - if (v19 > v16 || v20 < v18) - v23 = 0; - } else { - if (v20 < v16 || v19 > v18) - v23 = 0; - if (v16 >= v18) { - if (v19 > v16 || v20 < v18) - v23 = 0; - } - } - - if (v23 == 1) { - v11 = 0; - v17 = Ligne[v24].field0; - if (v17 > 0) - break; +/** + * Check collision line + */ +bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx) { + int16 *lineData; + + int left = xp + 4; + int right = xp - 4; + int top = yp + 4; + int bottom = yp - 4; + + *foundDataIdx = -1; + *foundLineIdx = -1; + + for (int curLineIdx = startLineIdx; curLineIdx <= endLineIdx; curLineIdx++) { + lineData = Ligne[curLineIdx]._lineData; + + if (lineData == (int16 *)g_PTRNUL) + continue; + + bool collisionFl = true; + int lineStartX = lineData[0]; + int lineStartY = lineData[1]; + int lineDataIdx = 2 * Ligne[curLineIdx]._lineDataEndIdx; + int lineEndX = lineData[lineDataIdx - 2]; + int lineEndY = lineData[lineDataIdx - 1]; + if (lineStartX >= lineEndX) { + if (right > lineStartX || left < lineEndX) + collisionFl = false; + } else { // lineStartX < lineEndX + if (left < lineStartX || right > lineEndX) + collisionFl = false; + } + if (lineStartY >= lineEndY) { + if (bottom > lineStartY || top < lineEndY) + collisionFl = false; + } else { // lineStartY < lineEndY + if (top < lineStartY || bottom > lineEndY) + collisionFl = false; + } + + if (!collisionFl) + continue; + + for (int idx = 0; idx < Ligne[curLineIdx]._lineDataEndIdx; idx++) { + int lineX = lineData[0]; + int lineY = lineData[1]; + lineData += 2; + + if ((xp == lineX || xp + 1 == lineX) && (yp == lineY || yp + 1 == lineY)) { + *foundDataIdx = idx; + *foundLineIdx = curLineIdx; + return true; } } -LABEL_28: - ++v24; - v6 = v24; - if (v24 >= a6 + 1) - return false; - } - for (;;) { - int v12 = v7[0]; - - v13 = v7 + 1; - int v14 = v13[0]; - v7 = v13 + 1; - - if (a1 == v12 || a1 + 1 == v12) { - if (a2 == v14 || a2 + 1 == v14) - break; - } - ++v11; - if (v17 <= v11) - goto LABEL_28; } - *a3 = v11; - *a4 = v24; - return true; + return false; } // Init route @@ -436,14 +413,14 @@ void LinesManager::INIPARCOURS() { int v12; int v13; - int v15 = Ligne[0].lineData[0]; - int v14 = Ligne[0].lineData[1]; + int v15 = Ligne[0]._lineData[0]; + int v14 = Ligne[0]._lineData[1]; int v0 = 1; bool v1 = false; do { - v2 = Ligne[v0].field0; - v3 = Ligne[v0].lineData; + v2 = Ligne[v0]._lineDataEndIdx; + v3 = Ligne[v0]._lineData; v4 = v3[2 * v2 - 2]; v5 = v3[2 * v2 - 1]; @@ -455,7 +432,7 @@ void LinesManager::INIPARCOURS() { if (v0 == 400) error("ERROR - LAST LINE NOT FOUND"); - v7 = Ligne[v0 + 1].lineData; + v7 = Ligne[v0 + 1]._lineData; if (v7[0] != v4 && v7[1] != v5) v1 = true; if (!v1) @@ -467,7 +444,7 @@ void LinesManager::INIPARCOURS() { v9 = _vm->_objectsManager._lastLine + 1; for (int v8 = 1; v8 != 400; v8++) { v11 = v8; - if (Ligne[v11].field0 < v13) { + if (Ligne[v11]._lineDataEndIdx < v13) { if (v8 != v9) { v12 = v8 - 1; Ligne[v11].field6 = Ligne[v12].field6; @@ -484,8 +461,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i int v8 = a3; int v50; if (a1 < a4) { - for (int i = a2; Ligne[a1].field0 > i; ++i) { - int16 *v10 = Ligne[a1].lineData; + for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { + int16 *v10 = Ligne[a1]._lineData; int v11 = v10[2 * i]; v50 = v10[2 * i + 1]; @@ -497,8 +474,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } for (int v34 = a1 + 1; v34 < a4; v34++) { - for (int i = 0; i < Ligne[v34].field0; i++) { - int16 *v14 = Ligne[v34].lineData; + for (int i = 0; i < Ligne[v34]._lineDataEndIdx; i++) { + int16 *v14 = Ligne[v34]._lineData; int v15 = v14[2 * i]; v50 = v14[2 * i + 1]; int v16 = v8; @@ -515,7 +492,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if (v36 > a4) { for (int j = v7; j > 0; --j) { - int16 *v18 = Ligne[v36].lineData; + int16 *v18 = Ligne[v36]._lineData; int v19 = v18[2 * j]; v50 = v18[2 * j + 1]; @@ -527,8 +504,8 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if ((int)(v36 - 1) > a4) { for (int v35 = v36 - 1; v35 > a4; v35--) { - for (int k = Ligne[v35].field0 - 1; k > 0; --k) { - int16 *v22 = Ligne[v35].lineData; + for (int k = Ligne[v35]._lineDataEndIdx - 1; k > 0; --k) { + int16 *v22 = Ligne[v35]._lineData; int v23 = v22[2 * k]; v50 = v22[2 * k + 1]; @@ -541,13 +518,13 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } } - v7 = Ligne[a4].field0 - 1; + v7 = Ligne[a4]._lineDataEndIdx - 1; v36 = a4; } if (v36 == a4) { if (a5 >= v7) { for (int i = v7; i > a5; i++) { - int16 *v30 = Ligne[a4].lineData; + int16 *v30 = Ligne[a4]._lineData; int v31 = v30[2 * i]; v50 = v30[2 * i + 1]; @@ -559,7 +536,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } } else { for (int i = v7; i > a5; --i) { - int16 *v26 = Ligne[a4].lineData; + int16 *v26 = Ligne[a4]._lineData; int v27 = v26[2 * i]; v50 = v26[2 * i+ 1]; @@ -581,8 +558,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int v40 = a3; int v50; if (a4 < a1) { - for (int i = a2; Ligne[a1].field0 > i; ++i) { - int16 *v12 = Ligne[a1].lineData; + for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { + int16 *v12 = Ligne[a1]._lineData; int v13 = v12[2 * i]; v50 = v12[2 * i + 1]; @@ -596,8 +573,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, if (a1 + 1 == a9 + 1) v15 = a8; while (a4 != v15) { - for (int v16 = 0; v16 < Ligne[v15].field0; v16++) { - int16 *v17 = Ligne[v15].lineData; + for (int v16 = 0; v16 < Ligne[v15]._lineDataEndIdx; v16++) { + int16 *v17 = Ligne[v15]._lineData; int v18 = v17[2 * v16]; v50 = v17[2 * v16 + 1]; @@ -617,7 +594,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, } if (a4 > v9) { for (int j = v10; j > 0; --j) { - int16 *v21 = Ligne[v9].lineData; + int16 *v21 = Ligne[v9]._lineData; int v22 = v21[2 * j]; v50 = v21[2 * j + 1]; @@ -631,8 +608,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, if (v24 == a8 - 1) v24 = a9; while (a4 != v24) { - for (int k = Ligne[v24].field0 - 1; k > 0; --k) { - int16 *v26 = Ligne[v24].lineData; + for (int k = Ligne[v24]._lineDataEndIdx - 1; k > 0; --k) { + int16 *v26 = Ligne[v24]._lineData; int v27 = v26[2 * k]; v50 = v26[2 * k + 1]; @@ -646,7 +623,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, if (a8 - 1 == v24) v24 = a9; } - v10 = Ligne[a4].field0 - 1; + v10 = Ligne[a4]._lineDataEndIdx - 1; v9 = a4; } if (a4 == v9) { @@ -654,7 +631,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, if (a5 > v10) { int v39 = a4; for (int v33 = v10; v33 < a5; v33++) { - int16 *v34 = Ligne[v39].lineData; + int16 *v34 = Ligne[v39]._lineData; int v35 = v34[2 * v33]; v50 = v34[2 * v33 + 1]; @@ -668,7 +645,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, } else { int v38 = a4; for (int v29 = v10; v29 > a5; v29--) { - int16 *v30 = Ligne[v38].lineData; + int16 *v30 = Ligne[v38]._lineData; int v31 = v30[2 * v29]; v50 = v30[2 * v29 + 1]; @@ -731,7 +708,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v6 = a2; v50 = a3; v7 = a5; - if (colision2_ligne(a1, a2, &v51, &v50, 0, _linesNumb)) { + if (checkCollisionLine(a1, a2, &v51, &v50, 0, _linesNumb)) { v8 = Ligne[v50].field4; if (v8 == 1) v6 = a2 - 2; @@ -763,7 +740,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v9 = 0; v10 = v40; for (i = v40; v40 + 200 > v10; i = v10) { - if (colision2_ligne(v41, i, &v49, &v48, 0, _vm->_objectsManager._lastLine) == 1 && v48 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v41, i, &v49, &v48, 0, _vm->_objectsManager._lastLine) == 1 && v48 <= _vm->_objectsManager._lastLine) break; v49 = 0; v48 = -1; @@ -774,7 +751,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v12 = 0; v13 = v40; for (j = v40; v40 - 200 < v13; j = v13) { - if (colision2_ligne(v41, j, &v47, &v46, 0, _vm->_objectsManager._lastLine) == 1 && v46 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v41, j, &v47, &v46, 0, _vm->_objectsManager._lastLine) == 1 && v46 <= _vm->_objectsManager._lastLine) break; v47 = 0; v46 = -1; @@ -785,7 +762,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v15 = 0; v16 = v41; for (k = v41; v41 + 200 > v16; k = v16) { - if (colision2_ligne(k, v40, &v45, &v44, 0, _vm->_objectsManager._lastLine) == 1 && v44 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(k, v40, &v45, &v44, 0, _vm->_objectsManager._lastLine) == 1 && v44 <= _vm->_objectsManager._lastLine) break; v45 = 0; v44 = -1; @@ -796,7 +773,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v18 = 0; v19 = v41; for (l = v41; v41 - 200 < v19; l = v19) { - if (colision2_ligne(l, v40, &v43, &v42, 0, _vm->_objectsManager._lastLine) == 1 && v42 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(l, v40, &v43, &v42, 0, _vm->_objectsManager._lastLine) == 1 && v42 <= _vm->_objectsManager._lastLine) break; v43 = 0; v42 = -1; @@ -888,7 +865,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 1) { for (int v22 = 0; v22 < v39; v22++) { - if (colision2_ligne(v41, v40 - v22, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v46) { v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); if (v23 == -1) @@ -912,7 +889,7 @@ LABEL_186: } if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { - if (colision2_ligne(v41, v25 + v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v46) { v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); if (v26 == -1) @@ -932,7 +909,7 @@ LABEL_186: } if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { - if (colision2_ligne(v41 - v28, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v46) { v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v29 == -1) @@ -952,7 +929,7 @@ LABEL_186: } if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { - if (colision2_ligne(v31 + v41, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v46) { v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v32 == -1) @@ -988,7 +965,7 @@ LABEL_112: a8[v9 + 2] = -1; return -1; } - int16 *v10 = Ligne[a1].lineData; + int16 *v10 = Ligne[a1]._lineData; int v98 = v10[0]; int v97 = v10[1]; int v92 = a1; @@ -996,16 +973,16 @@ LABEL_112: int v65; for (;;) { int v86 = v92 - 1; - int v11 = 2 * Ligne[v92 - 1].field0; + int v11 = 2 * Ligne[v92 - 1]._lineDataEndIdx; - int16 *v12 = Ligne[v92 - 1].lineData; + int16 *v12 = Ligne[v92 - 1]._lineData; if (v12 == (int16 *)g_PTRNUL) break; while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) { --v86; if (_vm->_objectsManager._lastLine - 1 != v86) { - v11 = 2 * Ligne[v86].field0; - v12 = Ligne[v86].lineData; + v11 = 2 * Ligne[v86]._lineDataEndIdx; + v12 = Ligne[v86]._lineData; if (v12 != (int16 *)g_PTRNUL) continue; } @@ -1017,16 +994,16 @@ LABEL_112: v97 = v12[1]; } LABEL_11: - int16 *v13 = Ligne[a1].lineData; - int v14 = 2 * Ligne[a1].field0; + int16 *v13 = Ligne[a1]._lineData; + int v14 = 2 * Ligne[a1]._lineDataEndIdx; int v95 = v13[v14 - 2]; int v93 = v13[v14 - 1]; int v91 = a1; int v100, v101; for (;;) { int v87 = v91 + 1; - int v15 = 2 * Ligne[v91 + 1].field0; - int16 *v16 = Ligne[v91 + 1].lineData; + int v15 = 2 * Ligne[v91 + 1]._lineDataEndIdx; + int16 *v16 = Ligne[v91 + 1]._lineData; if (v16 == (int16 *)g_PTRNUL) break; int v17; @@ -1039,8 +1016,8 @@ LABEL_11: } ++v87; if (v87 != _linesNumb + 1) { - v15 = 2 * Ligne[v87].field0; - v16 = Ligne[v87].lineData; + v15 = 2 * Ligne[v87]._lineDataEndIdx; + v16 = Ligne[v87]._lineData; if (v16 != (int16 *)g_PTRNUL) continue; } @@ -1094,7 +1071,7 @@ LABEL_17: for (int v89 = v85 + 1; v89 > 0; v89--) { int v96 = _vm->_globals.BufLig[v25]; int v94 = _vm->_globals.BufLig[v25 + 1]; - if (colision2_ligne(v96, v94, &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) { + if (checkCollisionLine(v96, v94, &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) { v80 = v100; v77 = v101; v78 = v96; @@ -1110,8 +1087,8 @@ LABEL_17: int v70 = 0; int v72 = 0; for (int i = v92; i < v91 + 1; ++i) { - int v27 = 2 * Ligne[i].field0; - int16 *v28 = Ligne[i].lineData; + int v27 = 2 * Ligne[i]._lineDataEndIdx; + int16 *v28 = Ligne[i]._lineData; if (v28 == (int16 *)g_PTRNUL) error("error in genial routine"); int v29 = v28[0]; @@ -1162,7 +1139,7 @@ LABEL_17: loopCond = false; do { --v34; - loopCond = colision2_ligne(a5, v34, &v101, &v100, v92, v91); + loopCond = checkCollisionLine(a5, v34, &v101, &v100, v92, v91); if (loopCond) v76 = v100; if (!v34 || v73 > v34) @@ -1173,7 +1150,7 @@ LABEL_17: loopCond = false; do { ++v35; - loopCond = colision2_ligne(a5, v35, &v101, &v100, v92, v91); + loopCond = checkCollisionLine(a5, v35, &v101, &v100, v92, v91); if (loopCond) v75 = v100; if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) @@ -1184,7 +1161,7 @@ LABEL_17: loopCond = false; do { ++v36; - loopCond = colision2_ligne(v36, a6, &v101, &v100, v92, v91); + loopCond = checkCollisionLine(v36, a6, &v101, &v100, v92, v91); if (loopCond) v74 = v100; if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) @@ -1195,7 +1172,7 @@ LABEL_17: loopCond = false; do { --v37; - loopCond = colision2_ligne(v37, a6, &v101, &v100, v92, v91); + loopCond = checkCollisionLine(v37, a6, &v101, &v100, v92, v91); if (loopCond) v38 = v100; if (v37 <= 0 || v69 >= v37) @@ -1224,7 +1201,7 @@ LABEL_17: v42 = v91; } while (v80 != v42); if (v41 == v43) { - int v44 = Ligne[a1].field0 / 2; + int v44 = Ligne[a1]._lineDataEndIdx / 2; int v54 = abs(v44); if (a2 > v54) { v99 = CONTOURNE(a1, a2, a7, v80, v77, a8, a9); @@ -1252,7 +1229,7 @@ LABEL_17: v47 = v92; } while (v80 != v47); if (v46 == v48) { - int v49 = Ligne[a1].field0 / 2; + int v49 = Ligne[a1]._lineDataEndIdx / 2; int v56 = abs(v49); if (a2 > v56) { v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); @@ -1269,7 +1246,7 @@ LABEL_17: v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); loopCond = false; do { - loopCond = colision2_ligne(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb); + loopCond = checkCollisionLine(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb); if (loopCond) { int v50 = v100; if (Ligne[v50].field4 == 1) @@ -1493,7 +1470,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v101 = v16; v16 = v101; - if (colision2_ligne(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v101] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v101] <= _vm->_objectsManager._lastLine) break; v136[v101] = 0; v141[v101] = -1; @@ -1509,7 +1486,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v102 = v20; v20 = v102; - if (colision2_ligne(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v102] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v102] <= _vm->_objectsManager._lastLine) break; v136[v102] = 0; v141[v102] = -1; @@ -1529,7 +1506,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v103 = v24; v24 = v103; - if (colision2_ligne(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v103] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v103] <= _vm->_objectsManager._lastLine) break; v136[v103] = 0; v141[v103] = -1; @@ -1551,7 +1528,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v104 = v28; v28 = v104; - if (colision2_ligne(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v104] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v104] <= _vm->_objectsManager._lastLine) break; v136[v104] = 0; v141[v104] = -1; @@ -1621,7 +1598,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v105 = v36; v36 = v105; - if (colision2_ligne(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v105] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v105] <= _vm->_objectsManager._lastLine) break; v136[v105] = 0; v141[v105] = -1; @@ -1637,7 +1614,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v106 = v40; v40 = v106; - if (colision2_ligne(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v106] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v106] <= _vm->_objectsManager._lastLine) break; v136[v106] = 0; v141[v106] = -1; @@ -1657,7 +1634,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v107 = v44; v44 = v107; - if (colision2_ligne(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v107] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v107] <= _vm->_objectsManager._lastLine) break; v136[v107] = 0; v141[v107] = -1; @@ -1677,7 +1654,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { do { v108 = v48; v48 = v108; - if (colision2_ligne(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v108] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v108] <= _vm->_objectsManager._lastLine) break; v136[v108] = 0; v141[v108] = -1; @@ -1752,7 +1729,7 @@ LABEL_201: v56 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { v57 = v112; v58 = GENIAL(v124, v125, srcX, srcY - v56, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); @@ -1776,7 +1753,7 @@ LABEL_201: v60 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { v57 = v112; v61 = GENIAL(v124, v125, srcX, v60 + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); @@ -1800,7 +1777,7 @@ LABEL_201: v63 = 0; if (v111 > 0) { do { - if (colision2_ligne(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { v57 = v112; v64 = GENIAL(v124, v125, srcX - v63, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); @@ -1824,7 +1801,7 @@ LABEL_201: v66 = 0; if (v111 > 0) { do { - if (colision2_ligne(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + if (checkCollisionLine(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { v57 = v112; v67 = GENIAL(v124, v125, v66 + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); @@ -1847,8 +1824,8 @@ LABEL_201: } LABEL_234: if (v115 < v121) { - for (i = v114; Ligne[v115].field0 > i; ++i) { - v70 = Ligne[v115].lineData; + for (i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { + v70 = Ligne[v115]._lineData; v119 = v70[2 * i]; v118 = v70[2 * i + 1]; v71 = v112; @@ -1863,8 +1840,8 @@ LABEL_234: do { v72 = 0; v110 = v116; - for (j = v116; Ligne[j].field0 > v72; j = v116) { - v74 = Ligne[v110].lineData; + for (j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { + v74 = Ligne[v110]._lineData; v119 = v74[2 * v72]; v118 = v74[2 * v72 + 1]; v75 = v112; @@ -1873,7 +1850,7 @@ LABEL_234: _vm->_globals.super_parcours[v75 + 2] = Ligne[v110].field6; _vm->_globals.super_parcours[v75 + 3] = 0; v112 += 4; - v76 = Ligne[v110].field0; + v76 = Ligne[v110]._lineDataEndIdx; if (v76 > 30) { v77 = abs(v76 / 2); if (v72 == v77) { @@ -1912,7 +1889,7 @@ LABEL_200: if (v114 > 0) { v98 = v115; do { - v81 = Ligne[v98].lineData; + v81 = Ligne[v98]._lineData; v119 = v81[2 * v80]; v118 = v81[2 * v80 + 1]; @@ -1928,11 +1905,11 @@ LABEL_200: v117 = v115 - 1; if ((v115 - 1) > v121) { do { - v83 = Ligne[v117].field0 - 1; + v83 = Ligne[v117]._lineDataEndIdx - 1; if (v83 > -1) { v109 = v117; do { - v84 = Ligne[v109].lineData; + v84 = Ligne[v109]._lineData; v119 = v84[2 * v83]; v118 = v84[2 * v83 + 1]; v85 = v112; @@ -1941,7 +1918,7 @@ LABEL_200: _vm->_globals.super_parcours[v85 + 2] = Ligne[v109].field8; _vm->_globals.super_parcours[v85 + 3] = 0; v112 += 4; - v86 = Ligne[v109].field0; + v86 = Ligne[v109]._lineDataEndIdx; if (v86 > 30) { v87 = abs(v86 / 2); if (v83 == v87) { @@ -1967,7 +1944,7 @@ LABEL_200: --v117; } while (v117 > v121); } - v114 = Ligne[v121].field0 - 1; + v114 = Ligne[v121]._lineDataEndIdx - 1; v115 = v121; } if (v115 == v121) { @@ -1976,7 +1953,7 @@ LABEL_200: v94 = v114; v100 = v121; do { - v95 = Ligne[v100].lineData; + v95 = Ligne[v100]._lineData; v96 = v95[2 * v94 + 1]; v97 = v112; _vm->_globals.super_parcours[v97] = v95[2 * v94]; @@ -1991,7 +1968,7 @@ LABEL_200: v90 = v114; v99 = v121; do { - v91 = Ligne[v99].lineData; + v91 = Ligne[v99]._lineData; v92 = v91[2 * v90 + 1]; v93 = v112; _vm->_globals.super_parcours[v93] = v91[2 * v90]; @@ -2161,7 +2138,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int if (a5 == -1 && a6 == -1) v136 = 1; v144 = a5; - if (colision2_ligne(a1, a2, &v145, &v144, 0, _linesNumb)) { + if (checkCollisionLine(a1, a2, &v145, &v144, 0, _linesNumb)) { int v8 = Ligne[v144].field4; if (v8 == 1) v90 = a2 - 2; @@ -2359,7 +2336,7 @@ LABEL_103: v23 = 0; if (v108 + 1 <= 0) goto LABEL_149; - while (!colision2_ligne(v104, v103, &v143, &v142, 0, _linesNumb)) { + while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { v25 = v115; v26 = _vm->_globals.essai0; v26[v25] = v104; @@ -2399,7 +2376,7 @@ LABEL_67: v126 = 1; goto LABEL_70; } - if (colision2_ligne(v15, v110, &v143, &v142, 0, _linesNumb)) + if (checkCollisionLine(v15, v110, &v143, &v142, 0, _linesNumb)) break; v16 = v115; @@ -2437,7 +2414,7 @@ LABEL_158: LABEL_165: if (v113 > a3) { v36 = v113; - while (!colision2_ligne(v36, v92, &v141, &v140, 0, _linesNumb)) { + while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) { v37 = v117; v38 = _vm->_globals.essai1; v38[v37] = v36; @@ -2456,7 +2433,7 @@ LABEL_181: if (v92 > a4) { v43 = v92; do { - if (colision2_ligne(a3, v43, &v141, &v140, 0, _linesNumb)) { + if (checkCollisionLine(a3, v43, &v141, &v140, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v140) { v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); if (v44 == -1) @@ -2466,7 +2443,7 @@ LABEL_181: if (NVPY != -1) { v33 = NVPX; v92 = NVPY; - v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); goto LABEL_189; } } @@ -2510,7 +2487,7 @@ LABEL_195: } v39 = v92; for (;;) { - if (colision2_ligne(a3, v39, &v141, &v140, 0, _linesNumb)) { + if (checkCollisionLine(a3, v39, &v141, &v140, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v140) { v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3); if (v40 == -1) @@ -2520,7 +2497,7 @@ LABEL_195: if (NVPY != -1) { v33 = NVPX; v92 = NVPY; - v45 = colision2_ligne(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); LABEL_189: if (v45 && v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; @@ -2543,7 +2520,7 @@ LABEL_189: goto LABEL_181; } } - while (!colision2_ligne(v33, v92, &v141, &v140, 0, _linesNumb)) { + while (!checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { v34 = v117; v35 = _vm->_globals.essai1; v35[v34] = v33; @@ -2572,7 +2549,7 @@ LABEL_203: goto LABEL_241; if (v93 < a4) { v55 = v93; - while (!colision2_ligne(v114, v55, &v139, &v138, 0, _linesNumb)) { + while (!checkCollisionLine(v114, v55, &v139, &v138, 0, _linesNumb)) { v56 = v117; v57 = _vm->_globals.essai2; v57[v56] = v114; @@ -2588,7 +2565,7 @@ LABEL_203: LABEL_211: if (v93 > a4) { v58 = v93; - while (!colision2_ligne(v114, v58, &v139, &v138, 0, _linesNumb)) { + while (!checkCollisionLine(v114, v58, &v139, &v138, 0, _linesNumb)) { v59 = v117; v60 = _vm->_globals.essai2; v60[v59] = v114; @@ -2754,7 +2731,7 @@ LABEL_217: if (v114 < a3) { v61 = v114; do { - if (colision2_ligne(v61, a4, &v139, &v138, 0, _linesNumb)) { + if (checkCollisionLine(v61, a4, &v139, &v138, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v138) { v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v62 == -1) @@ -2764,7 +2741,7 @@ LABEL_217: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); + colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); LABEL_235: if (colResult && v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; @@ -2788,7 +2765,7 @@ LABEL_235: if (v114 > a3) { v65 = v114; do { - if (colision2_ligne(v65, a4, &v139, &v138, 0, _linesNumb)) { + if (checkCollisionLine(v65, a4, &v139, &v138, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v138) { v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v66 == -1) @@ -2798,7 +2775,7 @@ LABEL_235: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = colision2_ligne(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); + colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); goto LABEL_235; } } @@ -2885,7 +2862,7 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { v12 = 1000 * a2 / 1000; v14 = 0; if (v13 + 1 > 0) { - while (!colision2_ligne(v9, v12, &v18, &v17, 0, _linesNumb) || v17 > _vm->_objectsManager._lastLine) { + while (!checkCollisionLine(v9, v12, &v18, &v17, 0, _linesNumb) || v17 > _vm->_objectsManager._lastLine) { v7 += v16; v8 += v15; v9 = v7 / 1000; @@ -3271,11 +3248,11 @@ LABEL_60: } if (v33 == 1) { v14 = 0; - if (Ligne[v34].field0 > 0) { + if (Ligne[v34]._lineDataEndIdx > 0) { v32 = v34; v25 = _vm->_globals.essai0; do { - v15 = Ligne[v32].lineData; + v15 = Ligne[v32]._lineData; v16 = v15[2 * v14]; v29 = v15[2 * v14 + 1]; if (!a6) { @@ -3294,16 +3271,16 @@ LABEL_60: } v41 += 4; ++v14; - } while (Ligne[v32].field0 > v14); + } while (Ligne[v32]._lineDataEndIdx > v14); } } if (v33 == 2) { - v19 = Ligne[v34].field0 - 1; + v19 = Ligne[v34]._lineDataEndIdx - 1; if (v19 > -1) { v31 = v34; v26 = _vm->_globals.essai0; do { - v20 = Ligne[v31].lineData; + v20 = Ligne[v31]._lineData; v21 = v20[2 * v19]; v30 = v20[2 * v19 + 1]; if (a6) { @@ -3359,8 +3336,8 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { v25 = _vm->_objectsManager._lastLine + 1; for (i = (int)(_vm->_objectsManager._lastLine + 1); i < _vm->_linesManager._linesNumb + 1; i = v25) { v6 = i; - v7 = Ligne[i].lineData; - v8 = Ligne[v6].field0; + v7 = Ligne[i]._lineData; + v8 = Ligne[v6]._lineDataEndIdx; v23 = v7[2 * v8 - 2]; v9 = v7[2 * v8 - 1]; if (v7[0] == a1 && a2 == v7[1]) { @@ -3382,8 +3359,8 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { LABEL_12: if (*a3 == 1) { v10 = v24; - v11 = Ligne[v10].field0; - v12 = Ligne[v10].lineData; + v11 = Ligne[v10]._lineDataEndIdx; + v12 = Ligne[v10]._lineData; v13 = v12[2 * v11 - 2]; v14 = v12[2 * v11 - 1]; v15 = Ligne[v10].field6; @@ -3392,13 +3369,13 @@ LABEL_12: v16 = v24; if (Ligne[v16].field6 == 3 || Ligne[v16].field8 == 7) v13 += 2; - if (!colision2_ligne(v13, v14, &v28, &v27, 0, _vm->_objectsManager._lastLine)) + if (!checkCollisionLine(v13, v14, &v28, &v27, 0, _vm->_objectsManager._lastLine)) error("error"); *a4 = v27; *a5 = v28; } if (v26 == 1 && *a3 == 2) { - v17 = Ligne[v25].lineData; + v17 = Ligne[v25]._lineData; v18 = v17[0]; v19 = v17[1]; v20 = Ligne[v24].field6; @@ -3407,7 +3384,7 @@ LABEL_12: v21 = v24; if (Ligne[v21].field6 == 3 || Ligne[v21].field8 == 7) v18 -= 2; - if (!colision2_ligne(v18, v19, &v28, &v27, 0, _vm->_objectsManager._lastLine)) + if (!checkCollisionLine(v18, v19, &v28, &v27, 0, _vm->_objectsManager._lastLine)) error("erreure"); *a4 = v27; *a5 = v28; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index e951fcd4a2..a4ace29b4c 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -37,12 +37,12 @@ struct LigneZoneItem { }; struct LigneItem { - int field0; + int _lineDataEndIdx; int field2; int field4; int field6; int field8; - int16 *lineData; + int16 *_lineData; }; struct SmoothItem { @@ -78,7 +78,7 @@ public: void RESET_OBSTACLE(); void RETIRE_LIGNE(int idx); void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); - bool colision2_ligne(int a1, int a2, int *a3, int *a4, int a5, int a6); + bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); void INIPARCOURS(); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index df8f3d75b9..a4b34e3ad8 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2886,7 +2886,6 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v5; int v6; int v7; - int v8; int v10; int v11; int v12; @@ -2915,7 +2914,6 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v52; int16 *v54; int16 *v58; - int v62; int v63; int v64; int v65; @@ -2945,17 +2943,15 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v5 = 440; v75 = v4; v74 = v5; - v6 = 0; v7 = v74; + + v6 = 0; if (_vm->_graphicsManager.max_y > v74) { - v8 = 5; do { - v62 = v8; - v8 = v62; - if (_vm->_linesManager.colision2_ligne(v75, v7, &v82[5], &v87[5], 0, _lastLine) && v87[v62] <= _lastLine) + if (_vm->_linesManager.checkCollisionLine(v75, v7, &v82[5], &v87[5], 0, _lastLine) && v87[5] <= _lastLine) break; - v82[v62] = 0; - v87[v62] = -1; + v82[5] = 0; + v87[5] = -1; ++v6; ++v7; } while (_vm->_graphicsManager.max_y > v7); @@ -2968,7 +2964,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v63 = v12; v12 = v63; - if (_vm->_linesManager.colision2_ligne(v75, v11, &v82[1], &v87[1], 0, _lastLine) && v87[v63] <= _lastLine) + if (_vm->_linesManager.checkCollisionLine(v75, v11, &v82[1], &v87[1], 0, _lastLine) && v87[v63] <= _lastLine) break; v82[v63] = 0; v87[v63] = -1; @@ -2988,7 +2984,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v64 = v16; v16 = v64; - if (_vm->_linesManager.colision2_ligne(v15, v74, &v82[3], &v87[3], 0, _lastLine) && v87[v64] <= _lastLine) + if (_vm->_linesManager.checkCollisionLine(v15, v74, &v82[3], &v87[3], 0, _lastLine) && v87[v64] <= _lastLine) break; v82[v64] = 0; v87[v64] = -1; @@ -3010,7 +3006,7 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { do { v65 = v20; v20 = v65; - if (_vm->_linesManager.colision2_ligne(v19, v74, &v82[7], &v87[7], 0, _lastLine) && v87[v65] <= _lastLine) + if (_vm->_linesManager.checkCollisionLine(v19, v74, &v82[7], &v87[7], 0, _lastLine) && v87[v65] <= _lastLine) break; v82[v65] = 0; v87[v65] = -1; @@ -3061,17 +3057,17 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { v82[v24] = 0; v77[v24] = 1300; } - if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _lastLine)) { + if (_vm->_linesManager.checkCollisionLine(a1, a2, &v82[1], &v87[1], 0, _lastLine)) { v69 = v87[1]; v68 = v82[1]; - } else if (_vm->_linesManager.colision2_ligne(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager._linesNumb)) { + } else if (_vm->_linesManager.checkCollisionLine(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager._linesNumb)) { v27 = 0; for (;;) { v28 = _vm->_globals.essai2[v27]; v29 = _vm->_globals.essai2[v27 + 1]; v66 = _vm->_globals.essai2[v27 + 2]; v27 += 4; - if (_vm->_linesManager.colision2_ligne(v28, v29, &v82[1], &v87[1], 0, _lastLine)) + if (_vm->_linesManager.checkCollisionLine(v28, v29, &v82[1], &v87[1], 0, _lastLine)) break; v32 = v67; _vm->_globals.super_parcours[v32] = v28; @@ -3101,8 +3097,8 @@ LABEL_90: if (v69 < v73) { v34 = v68; v35 = v68; - for (int i = _vm->_linesManager.Ligne[v69].field0; v35 < i - 2; i = _vm->_linesManager.Ligne[v69].field0) { - v37 = _vm->_linesManager.Ligne[v69].lineData; + for (int i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx; v35 < i - 2; i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx) { + v37 = _vm->_linesManager.Ligne[v69]._lineData; v39 = v67; _vm->_globals.super_parcours[v39] = v37[2 * v35]; _vm->_globals.super_parcours[v39 + 1] = v37[2 * v35 + 1]; @@ -3114,8 +3110,8 @@ LABEL_90: } for (j = v69 + 1; j < v73; ++j) { if (_vm->_linesManager.PLAN_TEST( - _vm->_linesManager.Ligne[j].lineData[0], - _vm->_linesManager.Ligne[j].lineData[1], + _vm->_linesManager.Ligne[j]._lineData[0], + _vm->_linesManager.Ligne[j]._lineData[1], v67, j, v73, @@ -3126,9 +3122,9 @@ LABEL_88: v67 = _vm->_linesManager.NV_POSI; goto LABEL_90; } - if (_vm->_linesManager.Ligne[j].field0 - 2 > 0) { - for (int v40 = 0; v40 < _vm->_linesManager.Ligne[j].field0 - 2; v40++) { - v41 = _vm->_linesManager.Ligne[j].lineData; + if (_vm->_linesManager.Ligne[j]._lineDataEndIdx - 2 > 0) { + for (int v40 = 0; v40 < _vm->_linesManager.Ligne[j]._lineDataEndIdx - 2; v40++) { + v41 = _vm->_linesManager.Ligne[j]._lineData; _vm->_globals.super_parcours[v67] = v41[2 * v40]; _vm->_globals.super_parcours[v67 + 1] = v41[2 * v40 + 1]; _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[j].field6; @@ -3142,7 +3138,7 @@ LABEL_88: } if (v69 > v73) { for (int k = v68; k > 0; --k) { - v45 = _vm->_linesManager.Ligne[v69].lineData; + v45 = _vm->_linesManager.Ligne[v69]._lineData; v47 = v67; _vm->_globals.super_parcours[v47] = v45[2 * k]; _vm->_globals.super_parcours[v47 + 1] = v45[2 * k + 1]; @@ -3153,16 +3149,16 @@ LABEL_88: for (int l = v69 - 1; l > v73; --l) { v48 = l; if (_vm->_linesManager.PLAN_TEST( - _vm->_linesManager.Ligne[l].lineData[2 * _vm->_linesManager.Ligne[v48].field0 - 2], - _vm->_linesManager.Ligne[l].lineData[2 * _vm->_linesManager.Ligne[v48].field0 - 1], + _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2], + _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 1], v67, l, v73, 0) == 1) goto LABEL_88; - for (int v49 = _vm->_linesManager.Ligne[v48].field0 - 2; v49 > 0; v49 --) { - v50 = _vm->_linesManager.Ligne[l].lineData; + for (int v49 = _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { + v50 = _vm->_linesManager.Ligne[l]._lineData; v52 = v67; _vm->_globals.super_parcours[v52] = v50[2 * v49]; _vm->_globals.super_parcours[v52 + 1] = v50[2 * v49 + 1]; @@ -3171,13 +3167,13 @@ LABEL_88: v67 += 4; } } - v68 = _vm->_linesManager.Ligne[v73].field0 - 1; + v68 = _vm->_linesManager.Ligne[v73]._lineDataEndIdx - 1; v69 = v73; } if (v69 == v73) { if (v68 <= v72) { for (int v57 = v68; v57 < v72; v57++) { - v58 = _vm->_linesManager.Ligne[v73].lineData; + v58 = _vm->_linesManager.Ligne[v73]._lineData; _vm->_globals.super_parcours[v67] = v58[2 * v57]; _vm->_globals.super_parcours[v67 + 1] = v58[2 * v57 + 1]; _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field6; @@ -3186,7 +3182,7 @@ LABEL_88: } } else { for (int v53 = v68; v53 > v72; v53--) { - v54 = _vm->_linesManager.Ligne[v73].lineData; + v54 = _vm->_linesManager.Ligne[v73]._lineData; _vm->_globals.super_parcours[v67] = v54[2 * v53]; _vm->_globals.super_parcours[v67 + 1] = v54[2 * v53 + 1]; _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field8; -- cgit v1.2.3 From 66cc7d099e3787b50a45d289652e9f258a2a805d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Jan 2013 20:10:16 +0100 Subject: HOPKINS: Some refactoring of PARC_VOITURE and initRoute --- engines/hopkins/lines.cpp | 75 ++++++------- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 249 +++++++++++++++++--------------------------- engines/hopkins/objects.h | 2 +- 4 files changed, 126 insertions(+), 202 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index d9052859eb..d0865bb179 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -401,55 +401,38 @@ bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *fo return false; } -// Init route -void LinesManager::INIPARCOURS() { - int v2; - int16 *v3; - int v4; - int v5; - int16 *v7; - int v9; - int v11; - int v12; - int v13; +/** + * Init route + */ +void LinesManager::initRoute() { + int lineX = Ligne[0]._lineData[0]; + int lineY = Ligne[0]._lineData[1]; - int v15 = Ligne[0]._lineData[0]; - int v14 = Ligne[0]._lineData[1]; - - int v0 = 1; - bool v1 = false; - do { - v2 = Ligne[v0]._lineDataEndIdx; - v3 = Ligne[v0]._lineData; - - v4 = v3[2 * v2 - 2]; - v5 = v3[2 * v2 - 1]; - if (_vm->_graphicsManager.max_x == v4 || _vm->_graphicsManager.max_y == v5 || _vm->_graphicsManager.min_x == v4 - || _vm->_graphicsManager.min_y == v5) - v1 = true; - if (v15 == v4 && v14 == v5) - v1 = true; - if (v0 == 400) + int lineIdx = 1; + for (;;) { + int curDataIdx = Ligne[lineIdx]._lineDataEndIdx; + int16 *curLineData = Ligne[lineIdx]._lineData; + + int curLineX = curLineData[2 * curDataIdx - 2]; + int curLineY = curLineData[2 * curDataIdx - 1]; + if (_vm->_graphicsManager.max_x == curLineX || _vm->_graphicsManager.max_y == curLineY || + _vm->_graphicsManager.min_x == curLineX || _vm->_graphicsManager.min_y == curLineY || + (lineX == curLineX && lineY == curLineY)) + break; + if (lineIdx == 400) error("ERROR - LAST LINE NOT FOUND"); - v7 = Ligne[v0 + 1]._lineData; - if (v7[0] != v4 && v7[1] != v5) - v1 = true; - if (!v1) - ++v0; - } while (!v1); - - _vm->_objectsManager._lastLine = v0; - v13 = _vm->_globals._maxLineLength; - v9 = _vm->_objectsManager._lastLine + 1; - for (int v8 = 1; v8 != 400; v8++) { - v11 = v8; - if (Ligne[v11]._lineDataEndIdx < v13) { - if (v8 != v9) { - v12 = v8 - 1; - Ligne[v11].field6 = Ligne[v12].field6; - Ligne[v11].field8 = Ligne[v12].field8; - } + int16 *nextLineData = Ligne[lineIdx + 1]._lineData; + if (nextLineData[0] != curLineX && nextLineData[1] != curLineY) + break; + ++lineIdx; + } + + _vm->_objectsManager._lastLine = lineIdx + 1; + for (int idx = 1; idx < 400; idx++) { + if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _vm->_objectsManager._lastLine)) { + Ligne[idx].field6 = Ligne[idx - 1].field6; + Ligne[idx].field8 = Ligne[idx - 1].field8; } } } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index a4ace29b4c..e6dcd2539f 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -79,7 +79,7 @@ public: void RETIRE_LIGNE(int idx); void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); - void INIPARCOURS(); + void initRoute(); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); int MIRACLE(int a1, int a2, int a3, int a4, int a5); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a4b34e3ad8..2f83df0ad0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2076,7 +2076,7 @@ void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { v4 += 5; ++v5; } while (v1 != -1); - _vm->_linesManager.INIPARCOURS(); + _vm->_linesManager.initRoute(); _vm->_globals.freeMemory(ptr); } @@ -2356,8 +2356,6 @@ void ObjectsManager::handleLeftButton() { int v12; int16 *v13; int16 *v16; - int v17; - int v18; _vm->_fontManager.hideText(9); destX = _vm->_eventsManager.getMouseX(); @@ -2490,11 +2488,8 @@ LABEL_63: _vm->_globals.chemin = v9; } LABEL_65: - if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) { - v17 = getSpriteY(0); - v18 = getSpriteX(0); - _vm->_globals.chemin = PARC_VOITURE(v18, v17, destX, destY); - } + if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) + _vm->_globals.chemin = PARC_VOITURE(getSpriteX(0), getSpriteY(0), destX, destY); } if (NUMZONE != -1 && NUMZONE != 0) { if (_vm->_eventsManager._mouseCursorId == 23) @@ -2881,20 +2876,7 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { } } -int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { - int v4; - int v5; - int v6; - int v7; - int v10; - int v11; - int v12; - int v14; - int v15; - int v16; - int v18; - int v19; - int v20; +int16 *ObjectsManager::PARC_VOITURE(int x1, int y1, int x2, int y2) { int16 *result; int v23; int v27; @@ -2914,9 +2896,6 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int v52; int16 *v54; int16 *v58; - int v63; - int v64; - int v65; int v66; int v67; int v68 = 0; @@ -2924,150 +2903,112 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { int j; int v72 = 0; int v73 = 0; - int v74; - int v75; - int v77[10]; - int v82[10]; - int v87[10]; - - v4 = a3; - v5 = a4; + int arrDelta[10]; + int arrDataIdx[10]; + int arrLineIdx[10]; + + int clipX2 = x2; + int clipY2 = y2; v67 = 0; - if (a3 <= 14) - v4 = 15; - if (a4 <= 14) - v5 = 15; - if (v4 > _vm->_graphicsManager.max_x - 10) - v4 = _vm->_graphicsManager.max_x - 10; - if (v5 > 445) - v5 = 440; - v75 = v4; - v74 = v5; - v7 = v74; - - v6 = 0; - if (_vm->_graphicsManager.max_y > v74) { - do { - if (_vm->_linesManager.checkCollisionLine(v75, v7, &v82[5], &v87[5], 0, _lastLine) && v87[5] <= _lastLine) - break; - v82[5] = 0; - v87[5] = -1; - ++v6; - ++v7; - } while (_vm->_graphicsManager.max_y > v7); + if (x2 <= 14) + clipX2 = 15; + if (y2 <= 14) + clipY2 = 15; + if (clipX2 > _vm->_graphicsManager.max_x - 10) + clipX2 = _vm->_graphicsManager.max_x - 10; + if (clipY2 > 445) + clipY2 = 440; + + int delta = 0; + for (delta = 0; clipY2 + delta < _vm->_graphicsManager.max_y; delta++) { + if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 + delta, &arrDataIdx[5], &arrLineIdx[5], 0, _lastLine) && arrLineIdx[5] <= _lastLine) + break; + arrDataIdx[5] = 0; + arrLineIdx[5] = -1; } - v77[5] = v6; - v10 = 0; - v11 = v74; - if (_vm->_graphicsManager.min_y < v74) { - v12 = 1; - do { - v63 = v12; - v12 = v63; - if (_vm->_linesManager.checkCollisionLine(v75, v11, &v82[1], &v87[1], 0, _lastLine) && v87[v63] <= _lastLine) - break; - v82[v63] = 0; - v87[v63] = -1; - if (v77[5] < v10) { - if (v87[5] != -1) - break; - } - ++v10; - --v11; - } while (_vm->_graphicsManager.min_y < v11); - } - v77[1] = v10; - v14 = 0; - v15 = v75; - if (_vm->_graphicsManager.max_x > v75) { - v16 = 3; - do { - v64 = v16; - v16 = v64; - if (_vm->_linesManager.checkCollisionLine(v15, v74, &v82[3], &v87[3], 0, _lastLine) && v87[v64] <= _lastLine) - break; - v82[v64] = 0; - v87[v64] = -1; - ++v14; - if (v77[1] < v14) { - if (v87[1] != -1) - break; - } - if (v77[5] < v14 && v87[5] != -1) - break; - ++v15; - } while (_vm->_graphicsManager.max_x > v15); + arrDelta[5] = delta; + + for (delta = 0; clipY2 - delta > _vm->_graphicsManager.min_y; delta++) { + if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 - delta , &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine) && arrLineIdx[1] <= _lastLine) + break; + arrDataIdx[1] = 0; + arrLineIdx[1] = -1; + if (arrDelta[5] < delta && arrLineIdx[5] != -1) + break; } - v77[3] = v14; - v18 = 0; - v19 = v75; - if (_vm->_graphicsManager.min_x < v75) { - v20 = 7; - do { - v65 = v20; - v20 = v65; - if (_vm->_linesManager.checkCollisionLine(v19, v74, &v82[7], &v87[7], 0, _lastLine) && v87[v65] <= _lastLine) - break; - v82[v65] = 0; - v87[v65] = -1; - ++v18; - if (v77[1] < v18) { - if (v87[1] != -1) - break; - } - if (v77[5] < v18 && v87[5] != -1) - break; - if (v77[3] < v18 && v87[3] != -1) - break; - --v19; - } while (_vm->_graphicsManager.min_x < v19); - } - v77[7] = v18; - if (v87[1] == -1) - v77[1] = 1300; - if (v87[3] == -1) - v77[3] = 1300; - if (v87[5] == -1) - v77[5] = 1300; - if (v87[7] == -1) - v77[7] = 1300; - if (v87[1] != -1 || v87[3] != -1 || v87[5] != -1 || v87[7] != -1) { + arrDelta[1] = delta; + + for (delta = 0; clipX2 + delta < _vm->_graphicsManager.max_x; delta++) { + if (_vm->_linesManager.checkCollisionLine(clipX2 + delta, clipY2, &arrDataIdx[3], &arrLineIdx[3], 0, _lastLine) && arrLineIdx[3] <= _lastLine) + break; + arrDataIdx[3] = 0; + arrLineIdx[3] = -1; + if (arrDelta[1] <= delta && arrLineIdx[1] != -1) + break; + if (arrDelta[5] <= delta && arrLineIdx[5] != -1) + break; + } + arrDelta[3] = delta; + + for (delta = 0; clipX2 - delta > _vm->_graphicsManager.min_x; delta++) { + if (_vm->_linesManager.checkCollisionLine(clipX2 - delta, clipY2, &arrDataIdx[7], &arrLineIdx[7], 0, _lastLine) && arrLineIdx[7] <= _lastLine) + break; + arrDataIdx[7] = 0; + arrLineIdx[7] = -1; + if (arrDelta[1] <= delta && arrLineIdx[1] != -1) + break; + if (arrDelta[5] <= delta && arrLineIdx[5] != -1) + break; + if (arrDelta[3] <= delta && arrLineIdx[3] != -1) + break; + } + arrDelta[7] = delta; + + if (arrLineIdx[1] == -1) + arrDelta[1] = 1300; + if (arrLineIdx[3] == -1) + arrDelta[3] = 1300; + if (arrLineIdx[5] == -1) + arrDelta[5] = 1300; + if (arrLineIdx[7] == -1) + arrDelta[7] = 1300; + if (arrLineIdx[1] != -1 || arrLineIdx[3] != -1 || arrLineIdx[5] != -1 || arrLineIdx[7] != -1) { v23 = 0; - if (v87[5] != -1 && v77[1] >= v77[5] && v77[3] >= v77[5] && v77[7] >= v77[5]) { - v73 = v87[5]; - v72 = v82[5]; + if (arrLineIdx[5] != -1 && arrDelta[1] >= arrDelta[5] && arrDelta[3] >= arrDelta[5] && arrDelta[7] >= arrDelta[5]) { + v73 = arrLineIdx[5]; + v72 = arrDataIdx[5]; v23 = 1; } - if (v87[1] != -1 && !v23 && v77[5] >= v77[1] && v77[3] >= v77[1] && v77[7] >= v77[1]) { - v73 = v87[1]; - v72 = v82[1]; + if (arrLineIdx[1] != -1 && !v23 && arrDelta[5] >= arrDelta[1] && arrDelta[3] >= arrDelta[1] && arrDelta[7] >= arrDelta[1]) { + v73 = arrLineIdx[1]; + v72 = arrDataIdx[1]; v23 = 1; } - if (v87[3] != -1 && !v23 && v77[1] >= v77[3] && v77[5] >= v77[3] && v77[7] >= v77[3]) { - v73 = v87[3]; - v72 = v82[3]; + if (arrLineIdx[3] != -1 && !v23 && arrDelta[1] >= arrDelta[3] && arrDelta[5] >= arrDelta[3] && arrDelta[7] >= arrDelta[3]) { + v73 = arrLineIdx[3]; + v72 = arrDataIdx[3]; v23 = 1; } - if (v87[7] != -1 && !v23 && v77[5] >= v77[7] && v77[3] >= v77[7] && v77[1] >= v77[7]) { - v73 = v87[7]; - v72 = v82[7]; + if (arrLineIdx[7] != -1 && !v23 && arrDelta[5] >= arrDelta[7] && arrDelta[3] >= arrDelta[7] && arrDelta[1] >= arrDelta[7]) { + v73 = arrLineIdx[7]; + v72 = arrDataIdx[7]; } for (int v24 = 0; v24 <= 8; v24++) { - v87[v24] = -1; - v82[v24] = 0; - v77[v24] = 1300; - } - if (_vm->_linesManager.checkCollisionLine(a1, a2, &v82[1], &v87[1], 0, _lastLine)) { - v69 = v87[1]; - v68 = v82[1]; - } else if (_vm->_linesManager.checkCollisionLine(a1, a2, &v82[1], &v87[1], 0, _vm->_linesManager._linesNumb)) { + arrLineIdx[v24] = -1; + arrDataIdx[v24] = 0; + arrDelta[v24] = 1300; + } + if (_vm->_linesManager.checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) { + v69 = arrLineIdx[1]; + v68 = arrDataIdx[1]; + } else if (_vm->_linesManager.checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _vm->_linesManager._linesNumb)) { v27 = 0; for (;;) { v28 = _vm->_globals.essai2[v27]; v29 = _vm->_globals.essai2[v27 + 1]; v66 = _vm->_globals.essai2[v27 + 2]; v27 += 4; - if (_vm->_linesManager.checkCollisionLine(v28, v29, &v82[1], &v87[1], 0, _lastLine)) + if (_vm->_linesManager.checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) break; v32 = v67; _vm->_globals.super_parcours[v32] = v28; @@ -3085,8 +3026,8 @@ int16 *ObjectsManager::PARC_VOITURE(int a1, int a2, int a3, int a4) { break;; } if (v28 != -1) { - v69 = v87[1]; - v68 = v82[1]; + v69 = arrLineIdx[1]; + v68 = arrDataIdx[1]; } } else { v69 = 1; @@ -4225,7 +4166,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v32 += 5; ++v34; } while (v27 != -1); - _vm->_linesManager.INIPARCOURS(); + _vm->_linesManager.initRoute(); } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d8f9c13506..f96d13a3c7 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -189,7 +189,7 @@ public: void VERIFTAILLE(); void PACOURS_PROPRE(int16 *a1); - int16 *PARC_VOITURE(int a1, int a2, int a3, int a4); + int16 *PARC_VOITURE(int x1, int y1, int x2, int y2); void nextVerbIcon(); void handleRightButton(); int MZONE(); -- cgit v1.2.3 From 271087850f7da414ee6daf259e0b7d41e196a66c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Jan 2013 21:25:21 +0100 Subject: HOPKINS: Refactor CHARGE_OBSTACLE --- engines/hopkins/objects.cpp | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2f83df0ad0..d78990431e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2049,33 +2049,21 @@ void ObjectsManager::GOHOME2() { // Load Obstacle void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { - int16 v1; - byte *ptr; - int16 v4; - int16 v5; - _vm->_linesManager.RESET_OBSTACLE(); _vm->_linesManager._linesNumb = 0; _lastLine = 0; - ptr = _vm->_fileManager.loadFile(file); - v4 = 0; - v5 = 0; - do { - v1 = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - if (v1 != -1) { - _vm->_linesManager.AJOUTE_LIGNE( - v5, - v1, - (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1), - (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2), - (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 3), - (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 4), - 1); - ++_vm->_linesManager._linesNumb; - } - v4 += 5; - ++v5; - } while (v1 != -1); + byte *ptr = _vm->_fileManager.loadFile(file); + for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { + _vm->_linesManager.AJOUTE_LIGNE( + idx, + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4), + 1); + ++_vm->_linesManager._linesNumb; + } _vm->_linesManager.initRoute(); _vm->_globals.freeMemory(ptr); } -- cgit v1.2.3 From de93e44b16375a272618722745287fdefd2547de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Jan 2013 21:40:46 +0100 Subject: HOPKINS: (on behalf of fuzzie) Fix regression introduced in 66cc7d099e3787b50a45d289652e9f258a2a805d --- engines/hopkins/lines.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index d0865bb179..44dc5b06f3 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -428,9 +428,9 @@ void LinesManager::initRoute() { ++lineIdx; } - _vm->_objectsManager._lastLine = lineIdx + 1; + _vm->_objectsManager._lastLine = lineIdx; for (int idx = 1; idx < 400; idx++) { - if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _vm->_objectsManager._lastLine)) { + if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _vm->_objectsManager._lastLine + 1)) { Ligne[idx].field6 = Ligne[idx - 1].field6; Ligne[idx].field8 = Ligne[idx - 1].field8; } -- cgit v1.2.3 From 9f153a3cbd47da66da6e2f03b909e20fc993d4c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Jan 2013 22:09:37 +0100 Subject: HOPKINS: Get rid of a magic value, rename a couple of pathfinding functions --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/hopkins.h | 2 ++ engines/hopkins/lines.cpp | 24 ++++++++++++------------ engines/hopkins/lines.h | 4 ++-- engines/hopkins/objects.cpp | 8 ++++---- engines/hopkins/talk.cpp | 4 ++-- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2392376a97..319516ada6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -324,7 +324,7 @@ void Globals::clearAll() { BufLig = (int16 *)g_PTRNUL; chemin = (int16 *)g_PTRNUL; - for (int idx = 0; idx < 400; ++idx) { + for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; _vm->_linesManager.Ligne[idx].field2 = 0; _vm->_linesManager.Ligne[idx].field4 = 0; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 18c7414827..9b1bce5509 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -73,6 +73,8 @@ enum { #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 +#define MAX_LINES 400 + struct HopkinsGameDescription; class HopkinsEngine : public Engine { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 44dc5b06f3..5ebc762fbc 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -29,7 +29,7 @@ namespace Hopkins { LinesManager::LinesManager() { - for (int i = 0; i < 400; ++i) { + for (int i = 0; i < MAX_LINES; ++i) { Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0); Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0); } @@ -53,7 +53,7 @@ void LinesManager::setParent(HopkinsEngine *vm) { } void LinesManager::CLEAR_ZONE() { - for (int idx = 0; idx < 400; ++idx) + for (int idx = 0; idx < MAX_LINES; ++idx) removeZoneLine(idx); next_ligne = 0; @@ -120,7 +120,7 @@ int LinesManager::OPTI_ZONE(int posX, int minZoneNum, bool lastRow) { * Remove Zone Line */ void LinesManager::removeZoneLine(int idx) { - if (idx > 400) + if (idx > MAX_LINES) error("Attempting to remove a line obstacle > MAX_LIGNE."); _vm->_linesManager._zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager._zoneLine[idx].zoneData); @@ -136,7 +136,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ _vm->_globals.BOBZONE_FLAG[bobZoneIdx] = true; _vm->_globals.BOBZONE[bobZoneIdx] = a3; } else { - if (idx > 400) + if (idx > MAX_LINES) error("Attempting to add a line obstacle > MAX_LIGNE."); _zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx].zoneData); @@ -180,17 +180,17 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ } -void LinesManager::RESET_OBSTACLE() { - for (int idx = 0; idx < 400; ++idx) { - RETIRE_LIGNE(idx); +void LinesManager::resetLines() { + for (int idx = 0; idx < MAX_LINES; ++idx) { + removeLine(idx); Ligne[idx]._lineDataEndIdx = 0; Ligne[idx]._lineData = (int16 *)g_PTRNUL; } } // Remove Line -void LinesManager::RETIRE_LIGNE(int idx) { - if (idx > 400) +void LinesManager::removeLine(int idx) { + if (idx > MAX_LINES) error("Attempting to add a line obstacle > MAX_LIGNE."); Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); } @@ -219,7 +219,7 @@ void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int v39; int v40; - if (idx > 400) + if (idx > MAX_LINES) error("Attempting to add a line obstacle > MAX_LIGNE."); if (_linesNumb < idx) @@ -419,7 +419,7 @@ void LinesManager::initRoute() { _vm->_graphicsManager.min_x == curLineX || _vm->_graphicsManager.min_y == curLineY || (lineX == curLineX && lineY == curLineY)) break; - if (lineIdx == 400) + if (lineIdx == MAX_LINES) error("ERROR - LAST LINE NOT FOUND"); int16 *nextLineData = Ligne[lineIdx + 1]._lineData; @@ -429,7 +429,7 @@ void LinesManager::initRoute() { } _vm->_objectsManager._lastLine = lineIdx; - for (int idx = 1; idx < 400; idx++) { + for (int idx = 1; idx < MAX_LINES; idx++) { if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _vm->_objectsManager._lastLine + 1)) { Ligne[idx].field6 = Ligne[idx - 1].field6; Ligne[idx].field8 = Ligne[idx - 1].field8; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index e6dcd2539f..67b5fa44a0 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -75,8 +75,8 @@ public: int OPTI_ZONE(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); - void RESET_OBSTACLE(); - void RETIRE_LIGNE(int idx); + void resetLines(); + void removeLine(int idx); void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); void initRoute(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d78990431e..c01901d2fb 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2049,7 +2049,7 @@ void ObjectsManager::GOHOME2() { // Load Obstacle void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { - _vm->_linesManager.RESET_OBSTACLE(); + _vm->_linesManager.resetLines(); _vm->_linesManager._linesNumb = 0; _lastLine = 0; byte *ptr = _vm->_fileManager.loadFile(file); @@ -2177,7 +2177,7 @@ void ObjectsManager::CARRE_ZONE() { _vm->_globals.CarreZone[idx].fieldC = 0; } - for (int idx = 0; idx < 400; ++idx) { + for (int idx = 0; idx < MAX_LINES; ++idx) { dataP = _vm->_linesManager._zoneLine[idx].zoneData; if (dataP != (int16 *)g_PTRNUL) { v4 = _vm->_linesManager._zoneLine[idx].field2; @@ -2620,7 +2620,7 @@ void ObjectsManager::CLEAR_ECRAN() { _vm->_globals.CLEAR_VBOB(); _vm->_animationManager.clearAnim(); _vm->_linesManager.CLEAR_ZONE(); - _vm->_linesManager.RESET_OBSTACLE(); + _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); for (int v1 = 0; v1 <= 48; v1++) { @@ -4131,7 +4131,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } } - _vm->_linesManager.RESET_OBSTACLE(); + _vm->_linesManager.resetLines(); for (size_t idx = 0; idx < nbytes; idx++) { if (ptr[idx] == 'O' && ptr[idx + 1] == 'B' && ptr[idx + 2] == '2') { v16 = ptr + idx + 4; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ff4642c18e..ae403d6d1f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1070,7 +1070,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 1; _vm->_linesManager.CLEAR_ZONE(); - _vm->_linesManager.RESET_OBSTACLE(); + _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) @@ -1146,7 +1146,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(false); _vm->_linesManager.CLEAR_ZONE(); - _vm->_linesManager.RESET_OBSTACLE(); + _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) _vm->_globals.BOBZONE[i] = 0; -- cgit v1.2.3 From d1378dd594704a6c6ef5f0fcae66d849f8b86682 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Jan 2013 23:15:52 +0100 Subject: HOPKINS: Refactor inventory code --- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/lines.cpp | 63 ++++++++++++++++++++++++--------------------- engines/hopkins/lines.h | 4 +-- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index b2477c2bb0..9c7347f5f7 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -375,7 +375,7 @@ LABEL_7: int mousePosY = _vm->_eventsManager.getMouseY(); int mouseButton = _vm->_eventsManager.getMouseButton(); int oldInventoryItem = newInventoryItem; - newInventoryItem = _vm->_linesManager.ZONE_OBJET(mousePosX, mousePosY); + newInventoryItem = _vm->_linesManager.checkInventoryHotspots(mousePosX, mousePosY); if (newInventoryItem != oldInventoryItem) _vm->_objectsManager.initBorder(newInventoryItem); if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 5ebc762fbc..cf1794189b 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -59,51 +59,57 @@ void LinesManager::CLEAR_ZONE() { next_ligne = 0; } -// Object Zone -int LinesManager::ZONE_OBJET(int posX, int posY) { - int v2 = 0; - if ((uint)(posY - 120) <= 33) - v2 = OPTI_ZONE(posX, 1, false); - if ((uint)(posY - 154) <= 37) - v2 = OPTI_ZONE(posX, 7, false); - if ((uint)(posY - 192) <= 37) - v2 = OPTI_ZONE(posX, 13, false); - if ((uint)(posY - 230) <= 37) - v2 = OPTI_ZONE(posX, 19, false); - if ((uint)(posY - 268) <= 37) - v2 = OPTI_ZONE(posX, 25, true); - if ((uint)(posY - 268) <= 20 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) - v2 = 30; - if ((uint)(posY - 290) <= 16 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) - v2 = 31; - if (posX < _vm->_graphicsManager._scrollOffset + 152 || posX > _vm->_graphicsManager._scrollOffset + 484) - v2 = 32; - if ((uint)(posY - 114) > 192) - v2 = 32; - return v2; +/** + * Check Hotspots in Inventory screen + * Returns the ID of the hotspot under mouse + */ +int LinesManager::checkInventoryHotspots(int posX, int posY) { + int hotspotId = 0; + if (posY >= 120 && posY <= 153) + hotspotId = checkInventoryHostpotsRow(posX, 1, false); + if (posY >= 154 && posY <= 191) + hotspotId = checkInventoryHostpotsRow(posX, 7, false); + if (posY >= 192 && posY <= 229) + hotspotId = checkInventoryHostpotsRow(posX, 13, false); + if (posY >= 230 && posY <= 267) + hotspotId = checkInventoryHostpotsRow(posX, 19, false); + if (posY >= 268 && posY <= 306) + hotspotId = checkInventoryHostpotsRow(posX, 25, true); + if (posY >= 268 && posY <= 288 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) + hotspotId = 30; + if (posY >= 290 && posY <= 306 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) + hotspotId = 31; + if (posY < 114 || posY > 306 || posX < _vm->_graphicsManager._scrollOffset + 152 || posX > _vm->_graphicsManager._scrollOffset + 484) + hotspotId = 32; + + return hotspotId; } -int LinesManager::OPTI_ZONE(int posX, int minZoneNum, bool lastRow) { +/** + * Check the hotspots in an inventory line + * Returns the hotspot Id under the mouse, if any. + */ +int LinesManager::checkInventoryHostpotsRow(int posX, int minZoneNum, bool lastRow) { int result = minZoneNum; - if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX <= _vm->_graphicsManager._scrollOffset + 208) + if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX < _vm->_graphicsManager._scrollOffset + 208) return result; - if (posX >= _vm->_graphicsManager._scrollOffset + 208 && posX <= _vm->_graphicsManager._scrollOffset + 266) { + if (posX >= _vm->_graphicsManager._scrollOffset + 208 && posX < _vm->_graphicsManager._scrollOffset + 266) { result += 1; return result; } - if (posX >= _vm->_graphicsManager._scrollOffset + 266 && posX <= _vm->_graphicsManager._scrollOffset + 320) { + if (posX >= _vm->_graphicsManager._scrollOffset + 266 && posX < _vm->_graphicsManager._scrollOffset + 320) { result += 2; return result; } - if (posX >= _vm->_graphicsManager._scrollOffset + 320 && posX <= _vm->_graphicsManager._scrollOffset + 370) { + if (posX >= _vm->_graphicsManager._scrollOffset + 320 && posX < _vm->_graphicsManager._scrollOffset + 370) { result += 3; return result; } - if (posX >= _vm->_graphicsManager._scrollOffset + 370 && posX <= _vm->_graphicsManager._scrollOffset + 424) { + if (posX >= _vm->_graphicsManager._scrollOffset + 370 && posX < _vm->_graphicsManager._scrollOffset + 424) { result += 4; return result; } @@ -179,7 +185,6 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ } } - void LinesManager::resetLines() { for (int idx = 0; idx < MAX_LINES; ++idx) { removeLine(idx); diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 67b5fa44a0..279ed29373 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -71,8 +71,8 @@ public: void setParent(HopkinsEngine *vm); void CLEAR_ZONE(); - int ZONE_OBJET(int posX, int posY); - int OPTI_ZONE(int posX, int minZoneNum, bool lastRow); + int checkInventoryHotspots(int posX, int posY); + int checkInventoryHostpotsRow(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); void resetLines(); -- cgit v1.2.3 From b7b3e959e32fc4f195720b0f0e7f37ad94841f70 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Jan 2013 01:50:29 +0100 Subject: HOPKINS: Various renaming --- engines/hopkins/computer.cpp | 8 +-- engines/hopkins/hopkins.cpp | 6 +- engines/hopkins/lines.cpp | 87 ++++++++++++----------- engines/hopkins/lines.h | 9 ++- engines/hopkins/objects.cpp | 164 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 14 ++-- engines/hopkins/script.cpp | 48 ++++++------- engines/hopkins/talk.cpp | 4 +- 8 files changed, 166 insertions(+), 174 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 039dc563b3..d44ff42550 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -620,12 +620,12 @@ void ComputerManager::newLevel() { _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(file); displayBricks(); - _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); - _vm->_objectsManager.SPRITE(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); + _vm->_objectsManager.addStaticSprite(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); + _vm->_objectsManager.addStaticSprite(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); _ballPosition = Common::Point(164, 187); _padPositionX = 150; - _vm->_objectsManager.SPRITE_ON(0); - _vm->_objectsManager.SPRITE_ON(1); + _vm->_objectsManager.animateSprite(0); + _vm->_objectsManager.animateSprite(1); _vm->_eventsManager.mouseOn(); _vm->_soundManager.playSample(3, 5); } diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 8c8b53a5a5..ab8f0ff800 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2856,12 +2856,12 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in break; } - _objectsManager.SPRITE(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager.PERI, 0, 0, 0, 0); + _objectsManager.addStaticSprite(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager.PERI, 0, 0, 0, 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); - _objectsManager.SPRITE_ON(0); + _objectsManager.animateSprite(0); _globals.chemin = (int16 *)g_PTRNUL; _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(4); @@ -2896,7 +2896,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._exitId = exit4; _graphicsManager.fadeOutLong(); _objectsManager.removeSprite(0); - _objectsManager.CLEAR_ECRAN(); + _objectsManager.clearScreen(); _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; } diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index cf1794189b..0484899b71 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -37,7 +37,6 @@ LinesManager::LinesManager() { Common::fill((byte *)&SMOOTH[i], (byte *)&SMOOTH[i] + sizeof(SmoothItem), 0); } - next_ligne = 0; _linesNumb = 0; NV_LIGNEDEP = 0; NV_LIGNEOFS = 0; @@ -52,11 +51,12 @@ void LinesManager::setParent(HopkinsEngine *vm) { _vm = vm; } -void LinesManager::CLEAR_ZONE() { +/** + * Clear all zones and reset nextLine + */ +void LinesManager::clearAllZones() { for (int idx = 0; idx < MAX_LINES; ++idx) removeZoneLine(idx); - - next_ligne = 0; } /** @@ -200,8 +200,10 @@ void LinesManager::removeLine(int idx) { Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); } -// Add Line -void LinesManager::AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { +/** + * Add Line + */ +void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { int v7; int v8; int v9; @@ -648,7 +650,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, return v40; } -int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { +bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int v5; int v6; int v7; @@ -857,7 +859,7 @@ int LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { && _vm->_objectsManager._lastLine < v46) { v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); if (v23 == -1) - return 0; + return false; v7 = v23; if (NVPY != -1) v22 = NVPY - v40; @@ -873,7 +875,7 @@ LABEL_186: NV_LIGNEDEP = v36; NV_LIGNEOFS = v35; NV_POSI = v7; - return 1; + return true; } if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { @@ -881,7 +883,7 @@ LABEL_186: && _vm->_objectsManager._lastLine < v46) { v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); if (v26 == -1) - return 0; + return false; v7 = v26; if (NVPY != -1) v25 = v40 - NVPY; @@ -901,7 +903,7 @@ LABEL_186: && _vm->_objectsManager._lastLine < v46) { v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v29 == -1) - return 0; + return false; v7 = v29; if (NVPX != -1) v28 = v41 - NVPX; @@ -921,7 +923,7 @@ LABEL_186: && _vm->_objectsManager._lastLine < v46) { v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v32 == -1) - return 0; + return false; v7 = v32; if (NVPX != -1) v31 = NVPX - v41; @@ -937,7 +939,7 @@ LABEL_186: } } } - return 0; + return false; } int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { @@ -947,7 +949,6 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, ++_vm->_globals.STOP_BUG; if (_vm->_globals.STOP_BUG > 10) { v9 = a7; -LABEL_112: a8[v9] = -1; a8[v9 + 1] = -1; a8[v9 + 2] = -1; @@ -1038,18 +1039,14 @@ LABEL_17: Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0); int v23 = 0; - if (v85 + 1 > 0) { - int16 *v51 = _vm->_globals.BufLig; - for (int v88 = 0; v88 < v85 + 1; v88++) { - int v24 = v23; - v51[v24] = v82; - v51[v24 + 1] = v81; - v21 += v84; - v22 += v83; - v82 = v21 / 1000; - v81 = v22 / 1000; - v23 += 2; - } + for (int v88 = 0; v88 < v85 + 1; v88++) { + _vm->_globals.BufLig[v23] = v82; + _vm->_globals.BufLig[v23 + 1] = v81; + v21 += v84; + v22 += v83; + v82 = v21 / 1000; + v81 = v22 / 1000; + v23 += 2; } int v25 = v23 - 2; bool loopCond = false; @@ -1168,7 +1165,10 @@ LABEL_17: } while (!loopCond); if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) { v9 = a7; - goto LABEL_112; + a8[v9] = -1; + a8[v9 + 1] = -1; + a8[v9 + 2] = -1; + return -1; } } if (v78 < a3 - 1 || v78 > a3 + 1 || v79 < a4 - 1 || v79 > a4 + 1) { @@ -1847,7 +1847,7 @@ LABEL_234: return &_vm->_globals.super_parcours[0]; if (v78 == 2) goto LABEL_200; - if (MIRACLE(v119, v118, v110, v121, v112) == 1) + if (MIRACLE(v119, v118, v110, v121, v112)) goto LABEL_201; } } @@ -1864,7 +1864,7 @@ LABEL_200: v112 = NV_POSI; goto LABEL_234; } - if (MIRACLE(v119, v118, v116, v121, v112) == 1) + if (MIRACLE(v119, v118, v116, v121, v112)) goto LABEL_201; ++v116; } while (v116 < v121); @@ -1915,7 +1915,7 @@ LABEL_200: return &_vm->_globals.super_parcours[0]; if (v88 == 2) goto LABEL_200; - if (MIRACLE(v119, v118, v117, v121, v112) == 1) + if (MIRACLE(v119, v118, v117, v121, v112)) goto LABEL_201; } } @@ -1927,7 +1927,7 @@ LABEL_200: return &_vm->_globals.super_parcours[0]; if (v89 == 2) goto LABEL_200; - if (MIRACLE(v119, v118, v117, v121, v112) == 1) + if (MIRACLE(v119, v118, v117, v121, v112)) goto LABEL_201; --v117; } while (v117 > v121); @@ -3092,7 +3092,7 @@ LABEL_85: return -1; } -int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { +bool LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { int v6; int v7; int v8; @@ -3148,7 +3148,7 @@ int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { v6 = TEST_LIGNE(a1 + 2, a2, &v45, &v53, &v49); v37 = v6; if (v40 == -1 && v39 == -1 && v38 == -1 && v6 == -1) - return -1; + return false; if (a4 == -1 || a5 == -1) { v8 = 0; if (v40 != -1) @@ -3206,7 +3206,7 @@ int LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { LABEL_59: if (v8) goto LABEL_60; - return -1; + return false; } v8 = 4; LABEL_60: @@ -3290,7 +3290,7 @@ LABEL_60: } } NV_POSI = v41; - return 1; + return true; } // Test line @@ -3316,11 +3316,10 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { int v23; int v24 = 0; int v25; - int v26; int v27; int v28; - v26 = 0; + bool v26 = false; v25 = _vm->_objectsManager._lastLine + 1; for (i = (int)(_vm->_objectsManager._lastLine + 1); i < _vm->_linesManager._linesNumb + 1; i = v25) { v6 = i; @@ -3330,19 +3329,19 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { v9 = v7[2 * v8 - 1]; if (v7[0] == a1 && a2 == v7[1]) { v24 = v25; - v26 = 1; + v26 = true; *a3 = 1; } if (v23 == a1 && a2 == v9) { v24 = v25; - v26 = 1; + v26 = true; *a3 = 2; } - if (v26 == 1) + if (v26) goto LABEL_12; ++v25; } - if (v26 != 1) + if (!v26) goto LABEL_33; LABEL_12: if (*a3 == 1) { @@ -3358,11 +3357,11 @@ LABEL_12: if (Ligne[v16].field6 == 3 || Ligne[v16].field8 == 7) v13 += 2; if (!checkCollisionLine(v13, v14, &v28, &v27, 0, _vm->_objectsManager._lastLine)) - error("error"); + error("Error in test line"); *a4 = v27; *a5 = v28; } - if (v26 == 1 && *a3 == 2) { + if (v26 && *a3 == 2) { v17 = Ligne[v25]._lineData; v18 = v17[0]; v19 = v17[1]; @@ -3373,7 +3372,7 @@ LABEL_12: if (Ligne[v21].field6 == 3 || Ligne[v21].field8 == 7) v18 -= 2; if (!checkCollisionLine(v18, v19, &v28, &v27, 0, _vm->_objectsManager._lastLine)) - error("erreure"); + error("Error in test line"); *a4 = v27; *a5 = v28; } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 279ed29373..11a6c6382b 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -57,7 +57,6 @@ public: LigneZoneItem _zoneLine[401]; LigneItem Ligne[400]; SmoothItem SMOOTH[4000]; - int next_ligne; int _linesNumb; int NV_LIGNEDEP; int NV_LIGNEOFS; @@ -70,25 +69,25 @@ public: LinesManager(); void setParent(HopkinsEngine *vm); - void CLEAR_ZONE(); + void clearAllZones(); int checkInventoryHotspots(int posX, int posY); int checkInventoryHostpotsRow(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); void resetLines(); void removeLine(int idx); - void AJOUTE_LIGNE(int idx, int a2, int a3, int a4, int a5, int a6, int a7); + void addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7); bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); void initRoute(); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); - int MIRACLE(int a1, int a2, int a3, int a4, int a5); + bool MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); int16 *PARCOURS2(int srcX, int srcY, int destX, int destY); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); int SMOOTH_MOVE(int a3, int a4, int a5, int a6); - int PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); + bool PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); int TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5); }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index c01901d2fb..3c80d086a8 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1289,12 +1289,12 @@ void ObjectsManager::clearSprite() { } } -void ObjectsManager::SPRITE_ON(int idx) { +void ObjectsManager::animateSprite(int idx) { assert (idx <= MAX_SPRITE); _sprite[idx]._animationType = 1; } -void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { +void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { assert (idx <= MAX_SPRITE); _sprite[idx]._spriteData = spriteData; _sprite[idx]._spritePos = pos; @@ -1310,15 +1310,17 @@ void ObjectsManager::SPRITE(const byte *spriteData, Common::Point pos, int idx, _sprite[idx].field22 = 0; _sprite[idx]._animationType = 0; - _sprite[idx]._rleFl = false; if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { _sprite[idx]._rleFl = true; _sprite[idx].fieldC = 0; _sprite[idx].fieldE = 0; - } + } else + _sprite[idx]._rleFl = false; + } -void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5) { +void ObjectsManager::addAnimatedSprite(const byte *spriteData, int idx, byte *a3, int a4, int a5) { + assert (idx <= MAX_SPRITE); _sprite[idx]._spriteData = spriteData; _sprite[idx].field1C = a3; _sprite[idx].field20 = a4; @@ -1330,10 +1332,10 @@ void ObjectsManager::SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, _sprite[idx].field22 = 0; _sprite[idx].field14 = a5; - _sprite[idx]._rleFl = false; if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') _sprite[idx]._rleFl = true; - + else + _sprite[idx]._rleFl = false; } /** @@ -1370,10 +1372,10 @@ void ObjectsManager::setSpriteIndex(int idx, int spriteIndex) { } // Set Sprite Size -void ObjectsManager::SETTAILLESPR(int idx, int a2) { +void ObjectsManager::setSpriteSize(int idx, int size) { assert (idx <= MAX_SPRITE); if (!_sprite[idx]._rleFl) - _sprite[idx].fieldC = a2; + _sprite[idx].fieldC = size; } void ObjectsManager::setFlipSprite(int idx, bool flip) { @@ -1552,7 +1554,7 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (_vm->_globals.g_old_sens == -1) { - VERIFTAILLE(); + computeAndSetSpriteSize(); nouveau_x = *_vm->_globals.chemin; _vm->_globals.chemin++; @@ -1579,7 +1581,7 @@ void ObjectsManager::GOHOME() { else v54 = NUMZONE; _vm->_globals.chemin = (int16 *)g_PTRNUL; - VERIFTAILLE(); + computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -1920,7 +1922,7 @@ LABEL_153: setSpriteIndex(0, _vm->_globals.g_old_sens + 59); _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - VERIFTAILLE(); + computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.g_old_sens = -1; @@ -1957,7 +1959,7 @@ LABEL_153: v47 = 1; } while (v47 != 1); if (v47 == 1) { - VERIFTAILLE(); + computeAndSetSpriteSize(); if ((_vm->_globals.g_old_sens == 6) || (_vm->_globals.g_old_sens == 7) || (_vm->_globals.g_old_sens == 8)) setFlipSprite(0, true); @@ -2047,14 +2049,16 @@ void ObjectsManager::GOHOME2() { A_DEPA = 0; } -// Load Obstacle -void ObjectsManager::CHARGE_OBSTACLE(const Common::String &file) { +/** + * Load lines + */ +void ObjectsManager::loadLines(const Common::String &file) { _vm->_linesManager.resetLines(); _vm->_linesManager._linesNumb = 0; _lastLine = 0; byte *ptr = _vm->_fileManager.loadFile(file); for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { - _vm->_linesManager.AJOUTE_LIGNE( + _vm->_linesManager.addLine( idx, (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), @@ -2219,11 +2223,6 @@ void ObjectsManager::CARRE_ZONE() { } void ObjectsManager::PLAN_BETA() { - int v1; - int v3; - int v5; - - v1 = 0; _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_globals.Max_Propre = 1; @@ -2238,15 +2237,15 @@ void ObjectsManager::PLAN_BETA() { _vm->_soundManager.WSOUND(31); _vm->_globals.iRegul = 1; _vm->_graphicsManager.loadImage("PLAN"); - CHARGE_OBSTACLE("PLAN.OB2"); + loadLines("PLAN.OB2"); _vm->_globals.loadCache("PLAN.CA2"); loadZone("PLAN.ZO2"); _spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR"); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN", false); - for (int v2 = 0; v2 <= 15; v2++) - _vm->_globals.CACHE_OFF(v2); + for (int i = 0; i <= 15; i++) + _vm->_globals.CACHE_OFF(i); _vm->_globals.CACHE_OFF(19); _vm->_globals.CACHE_OFF(20); _vm->_globals.CACHE_ON(); @@ -2256,21 +2255,20 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANY = 319; _vm->_globals.PLANI = 1; } - SPRITE(_spritePtr, Common::Point(_vm->_globals.PLANX, _vm->_globals.PLANY), 0, _vm->_globals.PLANI, 0, 0, 5, 5); + addStaticSprite(_spritePtr, Common::Point(_vm->_globals.PLANX, _vm->_globals.PLANY), 0, _vm->_globals.PLANI, 0, 0, 5, 5); _vm->_eventsManager.setMouseXY(_vm->_globals.PLANX, _vm->_globals.PLANY); my_anim = 0; _vm->_eventsManager.mouseOn(); - v3 = getSpriteX(0); - _vm->_graphicsManager.scrollScreen(v3 - 320); + _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; - SPRITE_ON(0); + animateSprite(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - for (int v4 = 0; v4 <= 4; v4++) + for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); _vm->_globals.iRegul = 1; @@ -2278,25 +2276,26 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager._noFadingFl = false; + bool v1 = false; do { - v5 = _vm->_eventsManager.getMouseButton(); - if (v5) { + int mouseButton = _vm->_eventsManager.getMouseButton(); + if (mouseButton) { if (_vm->_globals._saveData->data[svField170] == 1 && !_vm->_globals._saveData->data[svField171]) { _vm->_globals._saveData->data[svField171] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); _vm->_globals.NOPARLE = false; - v5 = 0; + mouseButton = 0; } if (_vm->_globals._saveData->data[svField80] == 1 && !_vm->_globals._saveData->data[svField172]) { _vm->_globals._saveData->data[svField172] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); _vm->_globals.NOPARLE = false; - v5 = 0; + mouseButton = 0; _vm->_eventsManager._curMouseButton = 0; } - if (v5 == 1) + if (mouseButton == 1) handleLeftButton(); } @@ -2308,8 +2307,8 @@ void ObjectsManager::PLAN_BETA() { _vm->_eventsManager.VBL(); if (_vm->_globals._exitId) - v1 = 1; - } while (!_vm->shouldQuit() && v1 != 1); + v1 = true; + } while (!_vm->shouldQuit() && !v1); if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.fadeOutLong(); @@ -2320,7 +2319,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.PLANI = 1; removeSprite(0); _spritePtr = _vm->_globals.freeMemory(_spritePtr); - CLEAR_ECRAN(); + clearScreen(); _vm->_globals.PLAN_FLAG = false; } @@ -2452,7 +2451,7 @@ LABEL_38: setSpriteIndex(0, _vm->_globals.g_old_sens2 + 59); _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - VERIFTAILLE(); + computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.g_old_sens = -1; @@ -2611,21 +2610,23 @@ LABEL_64: _vm->_globals.GOACTION = false; } -// Clear Screen -void ObjectsManager::CLEAR_ECRAN() { +/** + * Clear Screen + */ +void ObjectsManager::clearScreen() { clearSprite(); _vm->_graphicsManager.FIN_VISU(); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_globals.CLEAR_VBOB(); _vm->_animationManager.clearAnim(); - _vm->_linesManager.CLEAR_ZONE(); + _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); - for (int v1 = 0; v1 <= 48; v1++) { - _vm->_globals.BOBZONE[v1] = 0; - _vm->_globals.BOBZONE_FLAG[v1] = false; + for (int i = 0; i <= 48; i++) { + _vm->_globals.BOBZONE[i] = 0; + _vm->_globals.BOBZONE_FLAG[i] = false; } _vm->_eventsManager._mouseCursorId = 4; _verb = 4; @@ -2684,8 +2685,8 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->field4 = _sprite[0]._animationType; removeSprite(1); - SPRITE(_vm->_globals.TETE, loc->_pos, 1, 3, loc->field4, 0, 20, 127); - SPRITE_ON(1); + addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->field4, 0, 20, 127); + animateSprite(1); removeSprite(0); _vm->_globals._saveData->data[svField354] = 0; @@ -2696,8 +2697,8 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; - SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); - SPRITE_ON(0); + addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); + animateSprite(0); _vm->_globals.loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { @@ -2710,8 +2711,8 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->field4 = _sprite[0].fieldC; removeSprite(1); - SPRITE(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); - SPRITE_ON(1); + addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); + animateSprite(1); removeSprite(0); _vm->_globals._saveData->data[svField354] = 0; @@ -2721,8 +2722,8 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); _vm->_globals.PERSO_TYPE = 2; - SPRITE(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); - SPRITE_ON(0); + addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); + animateSprite(0); _vm->_globals.loadCharacterData(); } else { switch (oldCharacter) { @@ -2781,18 +2782,14 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha } // Check Size -void ObjectsManager::VERIFTAILLE() { - int v0 = _vm->_globals.STAILLE[getSpriteY(0)]; +void ObjectsManager::computeAndSetSpriteSize() { + int size = _vm->_globals.STAILLE[getSpriteY(0)]; if (_vm->_globals.PERSO_TYPE == 1) { - if (v0 < 0) - v0 = -v0; - v0 = 20 * (5 * v0 - 100) / -80; + size = 20 * (5 * abs(size) - 100) / -80; } else if (_vm->_globals.PERSO_TYPE == 2) { - if (v0 < 0) - v0 = -v0; - v0 = 20 * (5 * v0 - 165) / -67; + size = 20 * (5 * abs(size) - 165) / -67; } - SETTAILLESPR(0, v0); + setSpriteSize(0, size); } void ObjectsManager::PACOURS_PROPRE(int16 *a1) { @@ -3041,11 +3038,7 @@ LABEL_90: if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[j]._lineData[0], _vm->_linesManager.Ligne[j]._lineData[1], - v67, - j, - v73, - 0) == 1) { -LABEL_88: + v67, j, v73, 0)) { v69 = _vm->_linesManager.NV_LIGNEDEP; v68 = _vm->_linesManager.NV_LIGNEOFS; v67 = _vm->_linesManager.NV_POSI; @@ -3080,12 +3073,13 @@ LABEL_88: if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2], _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 1], - v67, - l, - v73, - 0) == 1) - goto LABEL_88; - + v67, l, v73, 0)) { + v69 = _vm->_linesManager.NV_LIGNEDEP; + v68 = _vm->_linesManager.NV_LIGNEOFS; + v67 = _vm->_linesManager.NV_POSI; + goto LABEL_90; + } + for (int v49 = _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { v50 = _vm->_linesManager.Ligne[l]._lineData; v52 = v67; @@ -4141,7 +4135,7 @@ void ObjectsManager::INILINK(const Common::String &file) { do { v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { - _vm->_linesManager.AJOUTE_LIGNE( + _vm->_linesManager.addLine( v34, v27, (int16)READ_LE_UINT16(v16 + 2 * v32 + 2), @@ -4243,7 +4237,7 @@ void ObjectsManager::SPECIAL_INI() { for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); _vm->_graphicsManager.fadeInLong(); - SPRITE_ON(0); + animateSprite(0); for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); @@ -4813,10 +4807,10 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } _vm->_eventsManager.mouseOn(); if (_vm->_globals._screenId == 61) { - SPRITE(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, 0, 34, 190); - SPRITE_ON(0); + addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, 0, 34, 190); + animateSprite(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; - VERIFTAILLE(); + computeAndSetSpriteSize(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); @@ -4871,7 +4865,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.FIN_VISU(); if (_vm->_globals._screenId == 61) removeSprite(0); - CLEAR_ECRAN(); + clearScreen(); _vm->_globals.iRegul = 0; } @@ -4932,23 +4926,23 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.loadCharacterData(); switch (_vm->_globals.PERSO_TYPE) { case 0: - SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190); + addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190); break; case 1: - SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 28, 155); + addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 28, 155); break; case 2: - SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 20, 127); + addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 20, 127); break; } _vm->_eventsManager.setMouseXY(_characterPos); if (_vm->_graphicsManager._largeScreenFl) _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; - VERIFTAILLE(); - SPRITE_ON(0); + computeAndSetSpriteSize(); + animateSprite(0); _vm->_globals.CACHE_ON(); _vm->_globals.chemin = (int16 *)g_PTRNUL; - VERIFTAILLE(); + computeAndSetSpriteSize(); SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; g_old_x = _characterPos.x; @@ -5018,7 +5012,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm } if (!animFile.empty()) _vm->_graphicsManager.FIN_VISU(); - CLEAR_ECRAN(); + clearScreen(); } else { _vm->_globals._helicopterFl = false; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index f96d13a3c7..1919d57ecf 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -159,26 +159,26 @@ public: int getSpriteX(int idx); int getSpriteY(int idx); void clearSprite(); - void SPRITE_ON(int idx); - void SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); - void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5); + void animateSprite(int idx); + void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); + void addAnimatedSprite(const byte *spriteData, int idx, byte *a3, int a4, int a5); void removeSprite(int idx); void setSpriteX(int idx, int xp); void setSpriteIndex(int idx, int spriteIndex); void setSpriteY(int idx, int yp); - void SETTAILLESPR(int idx, int a2); + void setSpriteSize(int idx, int size); void setFlipSprite(int idx, bool flip); void checkZone(); void GOHOME(); void GOHOME2(); - void CHARGE_OBSTACLE(const Common::String &file); + void loadLines(const Common::String &file); void loadZone(const Common::String &file); void CARRE_ZONE(); void PLAN_BETA(); void handleLeftButton(); void PARADISE(); - void CLEAR_ECRAN(); + void clearScreen(); /** * Change the currently active player @@ -187,7 +187,7 @@ public: */ void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); - void VERIFTAILLE(); + void computeAndSetSpriteSize(); void PACOURS_PROPRE(int16 *a1); int16 *PARC_VOITURE(int x1, int y1, int x2, int y2); void nextVerbIcon(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1f94d4b997..8baff49192 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -224,7 +224,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } if (_vm->_globals._saveData->data[svField356] == 1 && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { - _vm->_objectsManager.SPRITE( + _vm->_objectsManager.addStaticSprite( _vm->_globals.TETE, _vm->_globals._saveData->_realHopkins._pos, 1, @@ -233,13 +233,13 @@ int ScriptManager::handleOpcode(byte *dataP) { 0, 34, 190); - _vm->_objectsManager.SPRITE_ON(1); + _vm->_objectsManager.animateSprite(1); _vm->_objectsManager._twoCharactersFl = true; } if (_vm->_globals._saveData->data[svField357] == 1 && _vm->_globals._saveData->data[svField355] == 1 && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { - _vm->_objectsManager.SPRITE( + _vm->_objectsManager.addStaticSprite( _vm->_globals.TETE, _vm->_globals._saveData->_samantha._pos, 1, @@ -248,7 +248,7 @@ int ScriptManager::handleOpcode(byte *dataP) { 0, 20, 127); - _vm->_objectsManager.SPRITE_ON(1); + _vm->_objectsManager.animateSprite(1); _vm->_objectsManager._twoCharactersFl = true; } } @@ -535,7 +535,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_graphicsManager.FIN_VISU(); - _vm->_objectsManager.CLEAR_ECRAN(); + _vm->_objectsManager.clearScreen(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { _vm->_graphicsManager.fadeOutLong(); @@ -802,7 +802,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(9) != 36); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.stopBobAnimation(10); _vm->_soundManager.DEL_SAMPLE(1); @@ -851,7 +851,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(9) != v19); if (v19 == 12) { - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(9); } _vm->_globals.CACHE_ON(); @@ -924,7 +924,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 28; _vm->_objectsManager._sprite[0].field14 = 155; - _vm->_objectsManager.VERIFTAILLE(); + _vm->_objectsManager.computeAndSetSpriteSize(); break; case 57: @@ -934,7 +934,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 34; _vm->_objectsManager._sprite[0].field14 = 190; - _vm->_objectsManager.VERIFTAILLE(); + _vm->_objectsManager.computeAndSetSpriteSize(); break; case 58: @@ -989,7 +989,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.BOBPOSI(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.stopBobAnimation(7); _vm->_objectsManager.stopBobAnimation(3); @@ -1040,7 +1040,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.BOBPOSI(4) != 16); _vm->_objectsManager.stopBobAnimation(12); _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM27a"); _vm->_objectsManager.OBSSEUL = 0; @@ -1092,7 +1092,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(8) != 32); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(11); _vm->_objectsManager.stopBobAnimation(8); _vm->_objectsManager.setBobAnimation(5); @@ -1318,7 +1318,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(9) != 15); _vm->_objectsManager.stopBobAnimation(9); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_soundManager.playSound("SOUND50.WAV"); do { if (_vm->shouldQuit()) @@ -1484,7 +1484,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.BOBPOSI(5) != 72); _vm->_objectsManager.stopBobAnimation(5); } - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.ACTION_DOS(1); _vm->_soundManager.DEL_SAMPLE(1); break; @@ -1524,7 +1524,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 77); _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); break; case 107: @@ -1562,7 +1562,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(5) != 53); _vm->_objectsManager.stopBobAnimation(5); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); break; case 108: @@ -1719,7 +1719,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(8); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.stopBobAnimation(10); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); break; case 176: @@ -1770,7 +1770,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 18, 334, 0, false); } while (_vm->_objectsManager.BOBPOSI(4) != 26); _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); break; case 204: { @@ -1791,7 +1791,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(3) != 50); _vm->_objectsManager.stopBobAnimation(3); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); break; } @@ -1813,7 +1813,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(4) != 24); _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); break; } @@ -1992,7 +1992,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(7); _vm->_objectsManager.setSpriteX(0, 476); _vm->_objectsManager.setSpriteY(0, 278); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); _vm->_objectsManager.OBSSEUL = 1; _vm->_objectsManager.INILINK("IM93c"); @@ -2020,7 +2020,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 12); - _vm->_objectsManager.SPRITE_ON(0); + _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(12); _vm->_globals.CACHE_ON(); break; @@ -2226,8 +2226,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._saveData->data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.SPRITE(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); - _vm->_objectsManager.SPRITE_ON(1); + _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); + _vm->_objectsManager.animateSprite(1); break; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ae403d6d1f..0a3ebd9797 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1069,7 +1069,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); _vm->_graphicsManager.no_scroll = 1; - _vm->_linesManager.CLEAR_ZONE(); + _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); @@ -1145,7 +1145,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(false); - _vm->_linesManager.CLEAR_ZONE(); + _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) -- cgit v1.2.3 From d963e971303c925fead904e303c39a5e873c885d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Jan 2013 08:16:47 +0100 Subject: HOPKINS: Refactor TEST_LIGNE --- engines/hopkins/lines.cpp | 121 ++++++++++++++-------------------------------- engines/hopkins/lines.h | 2 +- 2 files changed, 37 insertions(+), 86 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 0484899b71..7f58709e89 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3294,94 +3294,45 @@ LABEL_60: } // Test line -int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5) { - int i; - int v6; - int16 *v7; - int v8; - int v9; - int v10; - int v11; - int16 *v12; - int v13; - int v14; - int v15; - int v16; - int16 *v17; - int v18; - int v19; - int v20; - int v21; - int result; - int v23; - int v24 = 0; - int v25; - int v27; - int v28; - - bool v26 = false; - v25 = _vm->_objectsManager._lastLine + 1; - for (i = (int)(_vm->_objectsManager._lastLine + 1); i < _vm->_linesManager._linesNumb + 1; i = v25) { - v6 = i; - v7 = Ligne[i]._lineData; - v8 = Ligne[v6]._lineDataEndIdx; - v23 = v7[2 * v8 - 2]; - v9 = v7[2 * v8 - 1]; - if (v7[0] == a1 && a2 == v7[1]) { - v24 = v25; - v26 = true; +int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *foundDataIdx) { + int16 *lineData; + int lineDataEndIdx; + int collLineIdx; + int collDataIdx; + + for (int idx = _vm->_objectsManager._lastLine + 1; idx < _vm->_linesManager._linesNumb + 1; idx++) { + lineData = Ligne[idx]._lineData; + lineDataEndIdx = Ligne[idx]._lineDataEndIdx; + if (lineData[2 * (lineDataEndIdx - 1)] == a1 && lineData[1] == a2) { *a3 = 1; - } - if (v23 == a1 && a2 == v9) { - v24 = v25; - v26 = true; + int posX = lineData[2 * (lineDataEndIdx - 1)]; + int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; + if (Ligne[idx].field6 == 5 || Ligne[idx].field6 == 1) + posY += 2; + if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7) + posX += 2; + if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine)) + error("Error in test line"); + *foundLineIdx = collLineIdx; + *foundDataIdx = collDataIdx; + return idx; + } + if (lineData[2 * (lineDataEndIdx - 1)] == a1 && lineData[2 * (lineDataEndIdx - 1) + 1] == a2) { *a3 = 2; + int posX = lineData[0]; + int posY = lineData[1]; + if (Ligne[idx].field6 == 5 || Ligne[idx].field6 == 1) + posY -= 2; + if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7) + posX -= 2; + if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine)) + error("Error in test line"); + *foundLineIdx = collLineIdx; + *foundDataIdx = collDataIdx; + return idx; } - if (v26) - goto LABEL_12; - ++v25; - } - if (!v26) - goto LABEL_33; -LABEL_12: - if (*a3 == 1) { - v10 = v24; - v11 = Ligne[v10]._lineDataEndIdx; - v12 = Ligne[v10]._lineData; - v13 = v12[2 * v11 - 2]; - v14 = v12[2 * v11 - 1]; - v15 = Ligne[v10].field6; - if (v15 == 5 || v15 == 1) - v14 += 2; - v16 = v24; - if (Ligne[v16].field6 == 3 || Ligne[v16].field8 == 7) - v13 += 2; - if (!checkCollisionLine(v13, v14, &v28, &v27, 0, _vm->_objectsManager._lastLine)) - error("Error in test line"); - *a4 = v27; - *a5 = v28; - } - if (v26 && *a3 == 2) { - v17 = Ligne[v25]._lineData; - v18 = v17[0]; - v19 = v17[1]; - v20 = Ligne[v24].field6; - if (v20 == 5 || v20 == 1) - v19 -= 2; - v21 = v24; - if (Ligne[v21].field6 == 3 || Ligne[v21].field8 == 7) - v18 -= 2; - if (!checkCollisionLine(v18, v19, &v28, &v27, 0, _vm->_objectsManager._lastLine)) - error("Error in test line"); - *a4 = v27; - *a5 = v28; - } -LABEL_33: - if (v26) - result = v24; - else - result = -1; - return result; + } + return -1; } } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 11a6c6382b..82c190c41b 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -88,7 +88,7 @@ public: int VERIF_SMOOTH(int a1, int a2, int a3, int a4); int SMOOTH_MOVE(int a3, int a4, int a5, int a6); bool PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); - int TEST_LIGNE(int a1, int a2, int *a3, int *a4, int *a5); + int TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *foundDataIdx); }; } // End of namespace Hopkins -- cgit v1.2.3 From f9f5888c903373d0b8f8d2005d84fbf29c6be343 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Jan 2013 17:12:47 +0100 Subject: HOPKINS: (on behalf of fuzzie) Fix regression introduced in d963e971303c925fead904e303c39a5e873c885d --- engines/hopkins/lines.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 7f58709e89..62be29fc20 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3303,7 +3303,7 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *fo for (int idx = _vm->_objectsManager._lastLine + 1; idx < _vm->_linesManager._linesNumb + 1; idx++) { lineData = Ligne[idx]._lineData; lineDataEndIdx = Ligne[idx]._lineDataEndIdx; - if (lineData[2 * (lineDataEndIdx - 1)] == a1 && lineData[1] == a2) { + if (lineData[0] == a1 && lineData[1] == a2) { *a3 = 1; int posX = lineData[2 * (lineDataEndIdx - 1)]; int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; -- cgit v1.2.3 From 86eb21e8855e885b7a76cd4dfe57997d82e4eb80 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Jan 2013 19:19:49 +0100 Subject: HOPKINS: Refactor PLAN_TEST --- engines/hopkins/lines.cpp | 270 +++++++++++++++----------------------------- engines/hopkins/lines.h | 4 +- engines/hopkins/objects.cpp | 4 +- 3 files changed, 94 insertions(+), 184 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 62be29fc20..7816d11836 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3092,201 +3092,111 @@ LABEL_85: return -1; } -bool LinesManager::PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6) { - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - int16 *v15; - int v16; - int v17; - int v18; - int v19; - int16 *v20; - int v21; - int v22; - int v23; - int16 *v25; - int16 *v26; - int v27; - int v28; - int v29; - int v30; - int v31; - int v32; - int v33 = 0; - int v34 = 0; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - int v41; +bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int v42; int v43; int v44; int v45; - int v46; - int v47; - int v48; - int v49; - int v50; - int v51; - int v52; - int v53; - - v41 = a3; - v40 = TEST_LIGNE(a1, a2 - 2, &v42, &v50, &v46); - v39 = TEST_LIGNE(a1, a2 + 2, &v43, &v51, &v47); - v38 = TEST_LIGNE(a1 - 2, a2, &v44, &v52, &v48); - v6 = TEST_LIGNE(a1 + 2, a2, &v45, &v53, &v49); - v37 = v6; - if (v40 == -1 && v39 == -1 && v38 == -1 && v6 == -1) + int dataIdxTestUp; + int dataIdxTestDown; + int dataIdxTestLeft; + int dataIdxTestRight; + int lineIdxTestUp; + int lineIdxTestDown; + int lineIdxTestLeft; + int lineIdxTestRight; + + int v41 = a3; + int idxTestUp = TEST_LIGNE(paramX, paramY - 2, &v42, &lineIdxTestUp, &dataIdxTestUp); + int idxTestDown = TEST_LIGNE(paramX, paramY + 2, &v43, &lineIdxTestDown, &dataIdxTestDown); + int idxTestLeft = TEST_LIGNE(paramX - 2, paramY, &v44, &lineIdxTestLeft, &dataIdxTestLeft); + int idxTestRight = TEST_LIGNE(paramX + 2, paramY, &v45, &lineIdxTestRight, &dataIdxTestRight); + if (idxTestUp == -1 && idxTestDown == -1 && idxTestLeft == -1 && idxTestRight == -1) return false; + + int v8; if (a4 == -1 || a5 == -1) { - v8 = 0; - if (v40 != -1) + if (idxTestUp != -1) v8 = 1; - if (v8) - goto LABEL_60; - if (v39 != -1) + else if (idxTestDown != -1) v8 = 2; - if (v8) - goto LABEL_60; - if (v38 != -1) + else if (idxTestLeft != -1) v8 = 3; - if (v8) - goto LABEL_60; - if (v6 != -1) + else if (idxTestRight != -1) v8 = 4; - goto LABEL_59; - } - v28 = 100; - v7 = 100; - v35 = 100; - v27 = 100; - v8 = 0; - v9 = abs(a4 - a5); - v36 = v9; - if (v40 != -1) { - v10 = abs(v50 - a5); - v28 = v10; - } - if (v39 != -1) { - v11 = abs(v51 - a5); - v7 = v11; - } - if (v38 != -1) { - v12 = abs(v52 - a5); - v35 = v12; - } - if (v37 != -1) { - v13 = abs(v53 - a5); - v27 = v13; - } - if (v28 < v36 && v28 <= v7 && v28 <= v35 && v28 <= v27) - v8 = 1; - if (v8) - goto LABEL_60; - if (v36 > v7 && v28 >= v7 && v35 >= v7 && v27 >= v7) - v8 = 2; - if (v8) - goto LABEL_60; - if (v35 < v36 && v35 <= v28 && v35 <= v7 && v35 <= v27) - v8 = 3; - if (v8) - goto LABEL_60; - if (v27 >= v36 || v27 > v28 || v27 > v7 || v27 > v35) { -LABEL_59: - if (v8) - goto LABEL_60; - return false; + else + return false; + } else { + int v28 = 100; + int v7 = 100; + int v35 = 100; + int v27 = 100; + int v36 = abs(a4 - a5); + if (idxTestUp != -1) { + v28 = abs(lineIdxTestUp - a5); + } + if (idxTestDown != -1) { + v7 = abs(lineIdxTestDown - a5); + } + if (idxTestLeft != -1) { + v35 = abs(lineIdxTestLeft - a5); + } + if (idxTestRight != -1) { + v27 = abs(lineIdxTestRight - a5); + } + + if (v28 < v36 && v28 <= v7 && v28 <= v35 && v28 <= v27) + v8 = 1; + else if (v36 > v7 && v28 >= v7 && v35 >= v7 && v27 >= v7) + v8 = 2; + else if (v35 < v36 && v35 <= v28 && v35 <= v7 && v35 <= v27) + v8 = 3; + else if (v27 < v36 && v27 <= v28 && v27 <= v7 && v27 <= v35) + v8 = 4; + else + return false; } - v8 = 4; -LABEL_60: + + int v33 = 0; + int idxTest = 0; if (v8 == 1) { - v34 = v40; + idxTest = idxTestUp; v33 = v42; - NV_LIGNEDEP = v50; - NV_LIGNEOFS = v46; - } - if (v8 == 2) { - v34 = v39; + NV_LIGNEDEP = lineIdxTestUp; + NV_LIGNEOFS = dataIdxTestUp; + } else if (v8 == 2) { + idxTest = idxTestDown; v33 = v43; - NV_LIGNEDEP = v51; - NV_LIGNEOFS = v47; - } - if (v8 == 3) { - v34 = v38; + NV_LIGNEDEP = lineIdxTestDown; + NV_LIGNEOFS = dataIdxTestDown; + } else if (v8 == 3) { + idxTest = idxTestLeft; v33 = v44; - NV_LIGNEDEP = v52; - NV_LIGNEOFS = v48; - } - if (v8 == 4) { - v34 = v37; + NV_LIGNEDEP = lineIdxTestLeft; + NV_LIGNEOFS = dataIdxTestLeft; + } else if (v8 == 4) { + idxTest = idxTestRight; v33 = v45; - NV_LIGNEDEP = v53; - NV_LIGNEOFS = v49; + NV_LIGNEDEP = lineIdxTestRight; + NV_LIGNEOFS = dataIdxTestRight; } + if (v33 == 1) { - v14 = 0; - if (Ligne[v34]._lineDataEndIdx > 0) { - v32 = v34; - v25 = _vm->_globals.essai0; - do { - v15 = Ligne[v32]._lineData; - v16 = v15[2 * v14]; - v29 = v15[2 * v14 + 1]; - if (!a6) { - v17 = v41; - _vm->_globals.super_parcours[v17] = v16; - _vm->_globals.super_parcours[v17 + 1] = v29; - _vm->_globals.super_parcours[v17 + 2] = Ligne[v32].field6; - _vm->_globals.super_parcours[v17 + 3] = 0; - } - if (a6 == 1) { - v18 = v41; - v25[v18] = v16; - v25[v18 + 1] = v29; - v25[v18 + 2] = Ligne[v32].field6; - v25[v18 + 3] = 0; - } - v41 += 4; - ++v14; - } while (Ligne[v32]._lineDataEndIdx > v14); - } - } - if (v33 == 2) { - v19 = Ligne[v34]._lineDataEndIdx - 1; - if (v19 > -1) { - v31 = v34; - v26 = _vm->_globals.essai0; - do { - v20 = Ligne[v31]._lineData; - v21 = v20[2 * v19]; - v30 = v20[2 * v19 + 1]; - if (a6) { - v23 = v41; - v26[v23] = v21; - v26[v23 + 1] = v30; - v26[v23 + 2] = Ligne[v31].field8; - v26[v23 + 3] = 0; - } else { - v22 = v41; - _vm->_globals.super_parcours[v22] = v21; - _vm->_globals.super_parcours[v22 + 1] = v30; - _vm->_globals.super_parcours[v22 + 2] = Ligne[v31].field8; - _vm->_globals.super_parcours[v22 + 3] = 0; - } - v41 += 4; - --v19; - } while (v19 > -1); + _vm->_globals.essai0 = _vm->_globals.essai0; + for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) { + _vm->_globals.super_parcours[v41] = Ligne[idxTest]._lineData[2 * i]; + _vm->_globals.super_parcours[v41 + 1] = Ligne[idxTest]._lineData[2 * i + 1]; + _vm->_globals.super_parcours[v41 + 2] = Ligne[idxTest].field6; + _vm->_globals.super_parcours[v41 + 3] = 0; + v41 += 4; + } + } else if (v33 == 2) { + for (int v19 = Ligne[idxTest]._lineDataEndIdx - 1; v19 > -1; v19--) { + _vm->_globals.super_parcours[v41] = Ligne[idxTest]._lineData[2 * v19]; + _vm->_globals.super_parcours[v41 + 1] = Ligne[idxTest]._lineData[2 * v19 + 1]; + _vm->_globals.super_parcours[v41 + 2] = Ligne[idxTest].field8; + _vm->_globals.super_parcours[v41 + 3] = 0; + v41 += 4; } } NV_POSI = v41; @@ -3294,7 +3204,7 @@ LABEL_60: } // Test line -int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *foundDataIdx) { +int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx) { int16 *lineData; int lineDataEndIdx; int collLineIdx; @@ -3303,7 +3213,7 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *fo for (int idx = _vm->_objectsManager._lastLine + 1; idx < _vm->_linesManager._linesNumb + 1; idx++) { lineData = Ligne[idx]._lineData; lineDataEndIdx = Ligne[idx]._lineDataEndIdx; - if (lineData[0] == a1 && lineData[1] == a2) { + if (lineData[0] == paramX && lineData[1] == paramY) { *a3 = 1; int posX = lineData[2 * (lineDataEndIdx - 1)]; int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; @@ -3317,7 +3227,7 @@ int LinesManager::TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *fo *foundDataIdx = collDataIdx; return idx; } - if (lineData[2 * (lineDataEndIdx - 1)] == a1 && lineData[2 * (lineDataEndIdx - 1) + 1] == a2) { + if (lineData[2 * (lineDataEndIdx - 1)] == paramX && lineData[2 * (lineDataEndIdx - 1) + 1] == paramY) { *a3 = 2; int posX = lineData[0]; int posY = lineData[1]; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 82c190c41b..1393a062ba 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -87,8 +87,8 @@ public: int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); int SMOOTH_MOVE(int a3, int a4, int a5, int a6); - bool PLAN_TEST(int a1, int a2, int a3, int a4, int a5, int a6); - int TEST_LIGNE(int a1, int a2, int *a3, int *foundLineIdx, int *foundDataIdx); + bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); + int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3c80d086a8..6953230adf 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3038,7 +3038,7 @@ LABEL_90: if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[j]._lineData[0], _vm->_linesManager.Ligne[j]._lineData[1], - v67, j, v73, 0)) { + v67, j, v73)) { v69 = _vm->_linesManager.NV_LIGNEDEP; v68 = _vm->_linesManager.NV_LIGNEOFS; v67 = _vm->_linesManager.NV_POSI; @@ -3073,7 +3073,7 @@ LABEL_90: if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2], _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 1], - v67, l, v73, 0)) { + v67, l, v73)) { v69 = _vm->_linesManager.NV_LIGNEDEP; v68 = _vm->_linesManager.NV_LIGNEOFS; v67 = _vm->_linesManager.NV_POSI; -- cgit v1.2.3 From 8fa4b4b8466a6b94523c40f57ce6459134fced54 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Jan 2013 21:27:04 +0100 Subject: HOPKINS: Start refactoring PARC_VOITURE, some renaming --- engines/hopkins/computer.cpp | 2 +- engines/hopkins/font.cpp | 47 +++++++++--------- engines/hopkins/font.h | 2 +- engines/hopkins/lines.cpp | 24 ++++----- engines/hopkins/objects.cpp | 113 ++++++++++++++++++++----------------------- 5 files changed, 88 insertions(+), 100 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index d44ff42550..ef56575567 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -428,7 +428,7 @@ void ComputerManager::TXT4(int xp, int yp, int textIdx) { * Outputs a text string */ void ComputerManager::outText(const Common::String &msg) { - _vm->_fontManager.TEXT_COMPUT(_textPosition.x, _textPosition.y, msg, _textColor); + _vm->_fontManager.renderTextDisplay(_textPosition.x, _textPosition.y, msg, _textColor); } /** diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 8b2bc51b90..492bde5ebd 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -450,35 +450,31 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int } } -void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col) { - const char *srcP; - int v5; - int v6; - byte v7; - int fontCol; - int v9; - - srcP = msg.c_str(); - v9 = xp; - fontCol = col; - do { - v7 = *srcP++; - if (v7 == '&') { +/** + * Compute character width and render text using variable width fonts + */ +void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, int col) { + const char *srcP = msg.c_str(); + int charEndPosX = xp; + int fontCol = col; + byte curChar = *srcP++; + while (curChar) { + if (curChar == '&') { fontCol = 2; - v7 = *srcP++; + curChar = *srcP++; } - if (v7 == '$') { + if (curChar == '$') { fontCol = 4; - v7 = *srcP++; + curChar = *srcP++; } - if (!v7) + if (!curChar) break; - if (v7 >= 32) { - v5 = v7 - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, v9, yp, v7 - 32, fontCol); - v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5); - v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5); - _vm->_graphicsManager.addVesaSegment(v9 - v6, yp, v9, yp + 12); + if (curChar >= 32) { + byte printChar = curChar - 32; + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, charEndPosX, yp, printChar, fontCol); + charEndPosX += _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + int charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + _vm->_graphicsManager.addVesaSegment(charEndPosX - charWidth, yp, charEndPosX, yp + 12); if (_vm->_eventsManager._escKeyFl) { _vm->_globals.iRegul = 1; _vm->_eventsManager.VBL(); @@ -488,7 +484,8 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col _vm->_globals.iRegul = 1; } } - } while (v7); + curChar = *srcP++; + } } } // End of namespace Hopkins diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 8970b9c8e8..d9debdee44 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -82,7 +82,7 @@ public: void displayTextVesa(int xp, int yp, const Common::String &message, int col); void displayText(int xp, int yp, const Common::String &message, int col); - void TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col); + void renderTextDisplay(int xp, int yp, const Common::String &msg, int col); }; } // End of namespace Hopkins diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 7816d11836..e55c2b6fca 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3106,7 +3106,6 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int lineIdxTestLeft; int lineIdxTestRight; - int v41 = a3; int idxTestUp = TEST_LIGNE(paramX, paramY - 2, &v42, &lineIdxTestUp, &dataIdxTestUp); int idxTestDown = TEST_LIGNE(paramX, paramY + 2, &v43, &lineIdxTestDown, &dataIdxTestDown); int idxTestLeft = TEST_LIGNE(paramX - 2, paramY, &v44, &lineIdxTestLeft, &dataIdxTestLeft); @@ -3181,25 +3180,26 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { NV_LIGNEOFS = dataIdxTestRight; } + int superRouteIdx = a3; if (v33 == 1) { _vm->_globals.essai0 = _vm->_globals.essai0; for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) { - _vm->_globals.super_parcours[v41] = Ligne[idxTest]._lineData[2 * i]; - _vm->_globals.super_parcours[v41 + 1] = Ligne[idxTest]._lineData[2 * i + 1]; - _vm->_globals.super_parcours[v41 + 2] = Ligne[idxTest].field6; - _vm->_globals.super_parcours[v41 + 3] = 0; - v41 += 4; + _vm->_globals.super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * i]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * i + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[idxTest].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } } else if (v33 == 2) { for (int v19 = Ligne[idxTest]._lineDataEndIdx - 1; v19 > -1; v19--) { - _vm->_globals.super_parcours[v41] = Ligne[idxTest]._lineData[2 * v19]; - _vm->_globals.super_parcours[v41 + 1] = Ligne[idxTest]._lineData[2 * v19 + 1]; - _vm->_globals.super_parcours[v41 + 2] = Ligne[idxTest].field8; - _vm->_globals.super_parcours[v41 + 3] = 0; - v41 += 4; + _vm->_globals.super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * v19]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * v19 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[idxTest].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } } - NV_POSI = v41; + NV_POSI = superRouteIdx; return true; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6953230adf..3877b03017 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2867,22 +2867,16 @@ int16 *ObjectsManager::PARC_VOITURE(int x1, int y1, int x2, int y2) { int v27; int v28; int v29; - int v32; - int16 *v33; int v34; int v35; int16 *v37; - int v39; int16 *v41; int16 *v45; - int v47; int v48; int16 *v50; - int v52; int16 *v54; int16 *v58; int v66; - int v67; int v68 = 0; int v69 = 0; int j; @@ -2894,7 +2888,7 @@ int16 *ObjectsManager::PARC_VOITURE(int x1, int y1, int x2, int y2) { int clipX2 = x2; int clipY2 = y2; - v67 = 0; + int superRouteIdx = 0; if (x2 <= 14) clipX2 = 15; if (y2 <= 14) @@ -2993,20 +2987,20 @@ int16 *ObjectsManager::PARC_VOITURE(int x1, int y1, int x2, int y2) { v29 = _vm->_globals.essai2[v27 + 1]; v66 = _vm->_globals.essai2[v27 + 2]; v27 += 4; + if (_vm->_linesManager.checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) break; - v32 = v67; - _vm->_globals.super_parcours[v32] = v28; - _vm->_globals.super_parcours[v32 + 1] = v29; - _vm->_globals.super_parcours[v32 + 2] = v66; - _vm->_globals.super_parcours[v32 + 3] = 0; - - v33 = _vm->_globals.essai0; - _vm->_globals.essai0[v32] = v28; - v33[v32 + 1] = v29; - v33[v32 + 2] = v66; - v33[v32 + 3] = 0; - v67 += 4; + + _vm->_globals.super_parcours[superRouteIdx] = v28; + _vm->_globals.super_parcours[superRouteIdx + 1] = v29; + _vm->_globals.super_parcours[superRouteIdx + 2] = v66; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + + _vm->_globals.essai0[superRouteIdx] = v28; + _vm->_globals.essai0[superRouteIdx + 1] = v29; + _vm->_globals.essai0[superRouteIdx + 2] = v66; + _vm->_globals.essai0[superRouteIdx + 3] = 0; + superRouteIdx += 4; if (v28 == -1) break;; } @@ -3017,7 +3011,7 @@ int16 *ObjectsManager::PARC_VOITURE(int x1, int y1, int x2, int y2) { } else { v69 = 1; v68 = 1; - v67 = 0; + superRouteIdx = 0; } LABEL_90: if (v69 < v73) { @@ -3025,12 +3019,11 @@ LABEL_90: v35 = v68; for (int i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx; v35 < i - 2; i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx) { v37 = _vm->_linesManager.Ligne[v69]._lineData; - v39 = v67; - _vm->_globals.super_parcours[v39] = v37[2 * v35]; - _vm->_globals.super_parcours[v39 + 1] = v37[2 * v35 + 1]; - _vm->_globals.super_parcours[v39 + 2] = _vm->_linesManager.Ligne[v69].field6; - _vm->_globals.super_parcours[v39 + 3] = 0; - v67 += 4; + _vm->_globals.super_parcours[superRouteIdx] = v37[2 * v35]; + _vm->_globals.super_parcours[superRouteIdx + 1] = v37[2 * v35 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v69].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; ++v34; v35 = v34; } @@ -3038,20 +3031,20 @@ LABEL_90: if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[j]._lineData[0], _vm->_linesManager.Ligne[j]._lineData[1], - v67, j, v73)) { + superRouteIdx, j, v73)) { v69 = _vm->_linesManager.NV_LIGNEDEP; v68 = _vm->_linesManager.NV_LIGNEOFS; - v67 = _vm->_linesManager.NV_POSI; + superRouteIdx = _vm->_linesManager.NV_POSI; goto LABEL_90; } if (_vm->_linesManager.Ligne[j]._lineDataEndIdx - 2 > 0) { for (int v40 = 0; v40 < _vm->_linesManager.Ligne[j]._lineDataEndIdx - 2; v40++) { v41 = _vm->_linesManager.Ligne[j]._lineData; - _vm->_globals.super_parcours[v67] = v41[2 * v40]; - _vm->_globals.super_parcours[v67 + 1] = v41[2 * v40 + 1]; - _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[j].field6; - _vm->_globals.super_parcours[v67 + 3] = 0; - v67 += 4; + _vm->_globals.super_parcours[superRouteIdx] = v41[2 * v40]; + _vm->_globals.super_parcours[superRouteIdx + 1] = v41[2 * v40 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[j].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } } } @@ -3061,33 +3054,31 @@ LABEL_90: if (v69 > v73) { for (int k = v68; k > 0; --k) { v45 = _vm->_linesManager.Ligne[v69]._lineData; - v47 = v67; - _vm->_globals.super_parcours[v47] = v45[2 * k]; - _vm->_globals.super_parcours[v47 + 1] = v45[2 * k + 1]; - _vm->_globals.super_parcours[v47 + 2] = _vm->_linesManager.Ligne[v69].field8; - _vm->_globals.super_parcours[v47 + 3] = 0; - v67 += 4; + _vm->_globals.super_parcours[superRouteIdx] = v45[2 * k]; + _vm->_globals.super_parcours[superRouteIdx + 1] = v45[2 * k + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v69].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } for (int l = v69 - 1; l > v73; --l) { v48 = l; if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2], _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 1], - v67, l, v73)) { + superRouteIdx, l, v73)) { v69 = _vm->_linesManager.NV_LIGNEDEP; v68 = _vm->_linesManager.NV_LIGNEOFS; - v67 = _vm->_linesManager.NV_POSI; + superRouteIdx = _vm->_linesManager.NV_POSI; goto LABEL_90; } for (int v49 = _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { v50 = _vm->_linesManager.Ligne[l]._lineData; - v52 = v67; - _vm->_globals.super_parcours[v52] = v50[2 * v49]; - _vm->_globals.super_parcours[v52 + 1] = v50[2 * v49 + 1]; - _vm->_globals.super_parcours[v52 + 2] = _vm->_linesManager.Ligne[l].field8; - _vm->_globals.super_parcours[v52 + 3] = 0; - v67 += 4; + _vm->_globals.super_parcours[superRouteIdx] = v50[2 * v49]; + _vm->_globals.super_parcours[superRouteIdx + 1] = v50[2 * v49 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[l].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } } v68 = _vm->_linesManager.Ligne[v73]._lineDataEndIdx - 1; @@ -3097,27 +3088,27 @@ LABEL_90: if (v68 <= v72) { for (int v57 = v68; v57 < v72; v57++) { v58 = _vm->_linesManager.Ligne[v73]._lineData; - _vm->_globals.super_parcours[v67] = v58[2 * v57]; - _vm->_globals.super_parcours[v67 + 1] = v58[2 * v57 + 1]; - _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field6; - _vm->_globals.super_parcours[v67 + 3] = 0; - v67 += 4; + _vm->_globals.super_parcours[superRouteIdx] = v58[2 * v57]; + _vm->_globals.super_parcours[superRouteIdx + 1] = v58[2 * v57 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v73].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } } else { for (int v53 = v68; v53 > v72; v53--) { v54 = _vm->_linesManager.Ligne[v73]._lineData; - _vm->_globals.super_parcours[v67] = v54[2 * v53]; - _vm->_globals.super_parcours[v67 + 1] = v54[2 * v53 + 1]; - _vm->_globals.super_parcours[v67 + 2] = _vm->_linesManager.Ligne[v73].field8; - _vm->_globals.super_parcours[v67 + 3] = 0; - v67 += 4; + _vm->_globals.super_parcours[superRouteIdx] = v54[2 * v53]; + _vm->_globals.super_parcours[superRouteIdx + 1] = v54[2 * v53 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v73].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; } } } - _vm->_globals.super_parcours[v67] = -1; - _vm->_globals.super_parcours[v67 + 1] = -1; - _vm->_globals.super_parcours[v67 + 2] = -1; - _vm->_globals.super_parcours[v67 + 3] = -1; + _vm->_globals.super_parcours[superRouteIdx] = -1; + _vm->_globals.super_parcours[superRouteIdx + 1] = -1; + _vm->_globals.super_parcours[superRouteIdx + 2] = -1; + _vm->_globals.super_parcours[superRouteIdx + 3] = -1; result = &_vm->_globals.super_parcours[0]; } else { result = (int16 *)g_PTRNUL; -- cgit v1.2.3 From e28c459a3baa84bfa12ee779c7776f49717edb43 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Jan 2013 00:38:23 +0100 Subject: HOPKINS: Start refactoring VERIF_SMOOTH --- engines/hopkins/lines.cpp | 315 ++++++++++++++++++-------------------------- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 4 +- engines/hopkins/objects.h | 2 +- 4 files changed, 134 insertions(+), 189 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index e55c2b6fca..740730e4e3 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -66,15 +66,15 @@ void LinesManager::clearAllZones() { int LinesManager::checkInventoryHotspots(int posX, int posY) { int hotspotId = 0; if (posY >= 120 && posY <= 153) - hotspotId = checkInventoryHostpotsRow(posX, 1, false); + hotspotId = checkInventoryHotspotsRow(posX, 1, false); if (posY >= 154 && posY <= 191) - hotspotId = checkInventoryHostpotsRow(posX, 7, false); + hotspotId = checkInventoryHotspotsRow(posX, 7, false); if (posY >= 192 && posY <= 229) - hotspotId = checkInventoryHostpotsRow(posX, 13, false); + hotspotId = checkInventoryHotspotsRow(posX, 13, false); if (posY >= 230 && posY <= 267) - hotspotId = checkInventoryHostpotsRow(posX, 19, false); + hotspotId = checkInventoryHotspotsRow(posX, 19, false); if (posY >= 268 && posY <= 306) - hotspotId = checkInventoryHostpotsRow(posX, 25, true); + hotspotId = checkInventoryHotspotsRow(posX, 25, true); if (posY >= 268 && posY <= 288 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) hotspotId = 30; if (posY >= 290 && posY <= 306 && posX >= _vm->_graphicsManager._scrollOffset + 424 && posX <= _vm->_graphicsManager._scrollOffset + 478) @@ -89,7 +89,7 @@ int LinesManager::checkInventoryHotspots(int posX, int posY) { * Check the hotspots in an inventory line * Returns the hotspot Id under the mouse, if any. */ -int LinesManager::checkInventoryHostpotsRow(int posX, int minZoneNum, bool lastRow) { +int LinesManager::checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow) { int result = minZoneNum; if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX < _vm->_graphicsManager._scrollOffset + 208) return result; @@ -2867,198 +2867,145 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v6; int v7; - int v9; int v10; int v11; - int v13; int v14; - int v15; + int spriteSize; int v16; int v17; int v19; int v20; int v22; - int v24; int v25; - int v26; - int v27; - int v28; - int v30; - int v31; int v33; - int v35; int v37; int v38; int v39; int v40; int v41; int v42; - int v43; - int v44; - int v45; - int v46; int v47; - int v48; - int v49 = 0; int v50; int v51; int v52; - int v53; - int v54; - int v55; - int v56; - int v57; - int v58; - int v59; - int v60; - int v61; - int v62; - int v63; - - v62 = a3; - v63 = a4; - if (a3 >= a5 || a6 >= a4) { - if (a3 <= a5 || a6 >= a4) { - if (a3 >= a5 || a6 <= a4) { - if (a3 > a5 && a6 > a4) { - v53 = 36; - v61 = 0; - v57 = 0; - do { - v25 = _vm->_globals.Hopkins[v53].field0; - v40 = _vm->_globals.Hopkins[v53].field2; - v26 = _vm->_globals.STAILLE[v63]; - if (v26 < 0) { - v27 = v26; - v28 = v26; - if (v26 < 0) - v28 = -v26; - v48 = _vm->_globals.STAILLE[v63]; - v45 = v63; - v25 = _vm->_graphicsManager.zoomOut(v25, v28); - if (v27 < 0) - v27 = -v27; - v40 = _vm->_graphicsManager.zoomOut(v40, v27); - v63 = v45; - v26 = v48; - } - if (v26 > 0) { - v30 = abs(v26); - v31 = abs(v26); - v46 = v63; - v25 = _vm->_graphicsManager.zoomIn(v25, v31); - v40 = _vm->_graphicsManager.zoomIn(v40, v30); - v63 = v46; - } - v33 = v63 + v40; - for (int v34 = 0; v34 < v25; v34++) { - --v62; - SMOOTH[v61].field0 = v62; - if (v63 != v33) - v63++; - SMOOTH[v61++].field2 = v63; - } - ++v53; - if (v53 == 48) - v53 = 36; - ++v57; - if (v62 <= a5 || a6 <= v63) - v49 = 1; - } while (v49 != 1); - if (v57 > 5) { - v35 = v61; - SMOOTH[v35].field0 = -1; - SMOOTH[v35].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 6; - goto LABEL_85; - } - } - } else { - v52 = 36; - v60 = 0; - v56 = 0; - do { - v14 = _vm->_globals.Hopkins[v52].field0; - v39 = _vm->_globals.Hopkins[v52].field2; - v15 = _vm->_globals.STAILLE[v63]; - if (v15 < 0) { - v16 = abs(v15); - v17 = abs(v15); - v47 = _vm->_globals.STAILLE[v63]; - v43 = v63; - v14 = _vm->_graphicsManager.zoomOut(v14, v17); - v39 = _vm->_graphicsManager.zoomOut(v39, v16); - v63 = v43; - v15 = v47; - } - if (v15 > 0) { - v19 = abs(v15); - v20 = abs(v15); - v44 = v63; - v14 = _vm->_graphicsManager.zoomIn(v14, v20); - v39 = _vm->_graphicsManager.zoomIn(v39, v19); - v63 = v44; - } - v22 = v63 + v39; - for (int v23 = 0; v23 < v14; v23++) { - ++v62; - SMOOTH[v60].field0 = v62; - if (v63 != v22) - v63++; - SMOOTH[v60++].field2 = v63; - } - ++v52; - if (v52 == 48) - v52 = 36; - ++v56; - if (v62 >= a5 || a6 <= (int)v63) - v49 = 1; - } while (v49 != 1); - if (v56 > 5) { - v24 = v60; - SMOOTH[v24].field0 = -1; - SMOOTH[v24].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 4; - goto LABEL_85; - } + int hopkinsIdx; + int smoothIdx; + + int v62 = a3; + int v63 = a4; + if (a3 > a5 && a6 > a4) { + hopkinsIdx = 36; + smoothIdx = 0; + int loopCount = 0; + while (v62 > a5 && a6 > v63) { + v25 = _vm->_globals.Hopkins[hopkinsIdx].field0; + v40 = _vm->_globals.Hopkins[hopkinsIdx].field2; + int spriteSize = _vm->_globals.STAILLE[v63]; + if (spriteSize < 0) { + v25 = _vm->_graphicsManager.zoomOut(v25, -spriteSize); + v40 = _vm->_graphicsManager.zoomOut(v40, -spriteSize); + } else if (spriteSize > 0) { + v25 = _vm->_graphicsManager.zoomIn(v25, spriteSize); + v40 = _vm->_graphicsManager.zoomIn(v40, spriteSize); } - } else { - v51 = 12; - v59 = 0; - v55 = 0; - do { - v10 = _vm->_globals.Hopkins[v51].field2; - v42 = v63; - v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25); - v38 = _vm->_graphicsManager.zoomOut(v10, 25); - v63 = v42; - for (int v12 = 0; v12 < v11; v12++) { - --v62; - SMOOTH[v59].field0 = v62; - if ((uint16)v63 != (uint16)v42 + v38) - v63--; - SMOOTH[v59++].field2 = v63; - } - ++v51; - if (v51 == 24) - v51 = 12; - ++v55; - if (v62 <= a5 || a6 >= v63) - v49 = 1; - } while (v49 != 1); - if (v55 > 5) { - v13 = 4 * v59; - SMOOTH[v13].field0 = -1; - SMOOTH[v13].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 8; - goto LABEL_85; + v33 = v63 + v40; + for (int v34 = 0; v34 < v25; v34++) { + --v62; + SMOOTH[smoothIdx].field0 = v62; + if (v63 != v33) + v63++; + SMOOTH[smoothIdx].field2 = v63; + smoothIdx++; } + ++hopkinsIdx; + if (hopkinsIdx == 48) + hopkinsIdx = 36; + ++loopCount; + } + if (loopCount > 5) { + SMOOTH[smoothIdx].field0 = -1; + SMOOTH[smoothIdx].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 6; + SMOOTH_X = v62; + SMOOTH_Y = v63; + return 0; } - } else { + } else if (a3 < a5 && a6 > a4) { + v52 = 36; + smoothIdx = 0; + int loopCount = 0; + while (v62 < a5 && a6 > v63) { + v14 = _vm->_globals.Hopkins[v52].field0; + v39 = _vm->_globals.Hopkins[v52].field2; + int spriteSize = _vm->_globals.STAILLE[v63]; + if (spriteSize < 0) { + v47 = _vm->_globals.STAILLE[v63]; + v14 = _vm->_graphicsManager.zoomOut(v14, -spriteSize); + v39 = _vm->_graphicsManager.zoomOut(v39, -spriteSize); + spriteSize = v47; + } + if (spriteSize > 0) { + v14 = _vm->_graphicsManager.zoomIn(v14, spriteSize); + v39 = _vm->_graphicsManager.zoomIn(v39, spriteSize); + } + v22 = v63 + v39; + for (int i = 0; i < v14; i++) { + ++v62; + SMOOTH[smoothIdx].field0 = v62; + if (v63 != v22) + v63++; + SMOOTH[smoothIdx].field2 = v63; + smoothIdx++; + } + ++v52; + if (v52 == 48) + v52 = 36; + ++loopCount; + } + if (loopCount > 5) { + SMOOTH[smoothIdx].field0 = -1; + SMOOTH[smoothIdx].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 4; + SMOOTH_X = v62; + SMOOTH_Y = v63; + return 0; + } + } else if (a3 > a5 && a6 < a4) { + v51 = 12; + smoothIdx = 0; + int loopCount = 0; + while (v62 > a5 && a6 < v63) { + v10 = _vm->_globals.Hopkins[v51].field2; + v42 = v63; + v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25); + v38 = _vm->_graphicsManager.zoomOut(v10, 25); + v63 = v42; + for (int v12 = 0; v12 < v11; v12++) { + --v62; + SMOOTH[smoothIdx].field0 = v62; + if ((uint16)v63 != (uint16)v42 + v38) + v63--; + SMOOTH[smoothIdx].field2 = v63; + smoothIdx++; + } + ++v51; + if (v51 == 24) + v51 = 12; + ++loopCount; + } + if (loopCount > 5) { + SMOOTH[smoothIdx].field0 = -1; + SMOOTH[smoothIdx].field2 = -1; + _vm->_linesManager.SMOOTH_SENS = 8; + SMOOTH_X = v62; + SMOOTH_Y = v63; + return 0; + } + } else if (a3 < a5 && a6 < a4) { v50 = 12; - v58 = 0; - v54 = 0; - do { + int smoothIdx = 0; + int loopCount = 0; + while (v62 < a5 && a6 < v63) { v6 = _vm->_globals.Hopkins[v50].field2; v41 = v63; v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 25); @@ -3066,24 +3013,22 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v63 = v41; for (int v8 = 0; v8 < v7; v8++) { ++v62; - SMOOTH[v58].field0 = v62; + SMOOTH[smoothIdx].field0 = v62; if ((uint16)v63 != (uint16)v41 + v37) v63--; - SMOOTH[v58++].field2 = v63; + SMOOTH[smoothIdx].field2 = v63; + smoothIdx++; } ++v50; if (v50 == 24) v50 = 12; - ++v54; - if (v62 >= a5 || a6 >= (int)v63) - v49 = 1; - } while (v49 != 1); - if (v54 > 5) { - v9 = v58; - SMOOTH[v9].field0 = -1; - SMOOTH[v9].field2 = -1; + ++loopCount; + } + + if (loopCount > 5) { + SMOOTH[smoothIdx].field0 = -1; + SMOOTH[smoothIdx].field2 = -1; _vm->_linesManager.SMOOTH_SENS = 2; -LABEL_85: SMOOTH_X = v62; SMOOTH_Y = v63; return 0; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 1393a062ba..19f245ee65 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -71,7 +71,7 @@ public: void clearAllZones(); int checkInventoryHotspots(int posX, int posY); - int checkInventoryHostpotsRow(int posX, int minZoneNum, bool lastRow); + int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); void resetLines(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3877b03017..7c5945fdbe 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2476,7 +2476,7 @@ LABEL_63: } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) - _vm->_globals.chemin = PARC_VOITURE(getSpriteX(0), getSpriteY(0), destX, destY); + _vm->_globals.chemin = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } if (NUMZONE != -1 && NUMZONE != 0) { if (_vm->_eventsManager._mouseCursorId == 23) @@ -2861,7 +2861,7 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { } } -int16 *ObjectsManager::PARC_VOITURE(int x1, int y1, int x2, int y2) { +int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int16 *result; int v23; int v27; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 1919d57ecf..b7f1d3c44b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -189,7 +189,7 @@ public: void computeAndSetSpriteSize(); void PACOURS_PROPRE(int16 *a1); - int16 *PARC_VOITURE(int x1, int y1, int x2, int y2); + int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); void nextVerbIcon(); void handleRightButton(); int MZONE(); -- cgit v1.2.3 From 1fd81eee4056342971220240a49baef73737b386 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Jan 2013 11:55:44 +0100 Subject: HOPKINS: Some refactoring in the pathfinding code --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 10 +- engines/hopkins/lines.cpp | 530 ++++++++++++++++++++------------------------ engines/hopkins/objects.cpp | 84 +++---- engines/hopkins/objects.h | 2 +- engines/hopkins/script.cpp | 10 +- engines/hopkins/talk.cpp | 6 +- 8 files changed, 306 insertions(+), 344 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 319516ada6..1a339115e9 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -160,7 +160,7 @@ Globals::Globals() { _actionDirection = 0; _actionDirection = 0; SegmentEnCours = 0; - STOP_BUG = 0; + pathFindingDepth = 0; Credit_bx = -1; Credit_bx1 = -1; @@ -216,7 +216,7 @@ Globals::Globals() { old_x2_67 = 0; old_y2_68 = 0; old_zone_68 = 0; - old_z_69 = 0; + _oldZoneNum = 0; old_x_69 = 0; old_y_70 = 0; compteur_71 = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 700670563d..7c9d16a951 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -402,7 +402,7 @@ public: int SegmentEnCours; int couleur_40; - int STOP_BUG; + int pathFindingDepth; int force_to_data_0; int oldzone_46; @@ -414,7 +414,7 @@ public: int compteur_71; int zozo_73; int old_y2_68; - int old_z_69; + int _oldZoneNum; int j_104; int Credit_bx; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ab8f0ff800..7ab2e91785 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2610,11 +2610,11 @@ void HopkinsEngine::BTOCEAN() { _fontManager.hideText(9); if (_eventsManager._mouseCursorId == 16) { _eventsManager.getMouseX(); - if (_objectsManager.NUMZONE > 0) { + if (_objectsManager._zoneNum > 0) { int oldPosX = _eventsManager.getMouseX(); int oldPosY = _eventsManager.getMouseY(); bool displAnim = false; - if (_objectsManager.NUMZONE == 1) { + if (_objectsManager._zoneNum == 1) { if (_globals._oceanDirection == 3) _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, 0); else if (_globals._oceanDirection == 1) @@ -2646,7 +2646,7 @@ void HopkinsEngine::BTOCEAN() { displAnim = true; } LABEL_22: - if (_objectsManager.NUMZONE == 2) { + if (_objectsManager._zoneNum == 2) { if (_globals._oceanDirection == 7) _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); else if (_globals._oceanDirection == 1) @@ -2678,7 +2678,7 @@ LABEL_22: displAnim = true; } LABEL_41: - if (_objectsManager.NUMZONE == 3) { + if (_objectsManager._zoneNum == 3) { if (_globals._oceanDirection == 3) { int oldX = _objectsManager.getSpriteX(0); do { @@ -2734,7 +2734,7 @@ LABEL_72: _globals._oceanDirection = 1; _globals._exitId = 3; } - if (_objectsManager.NUMZONE == 4) { + if (_objectsManager._zoneNum == 4) { if (_globals._oceanDirection == 3) { int oldX = _objectsManager.getSpriteX(0); do { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 740730e4e3..a60e26af03 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -945,13 +945,13 @@ LABEL_186: int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { int v99 = a7; int v80 = -1; - int v9; - ++_vm->_globals.STOP_BUG; - if (_vm->_globals.STOP_BUG > 10) { - v9 = a7; - a8[v9] = -1; - a8[v9 + 1] = -1; - a8[v9 + 2] = -1; + ++_vm->_globals.pathFindingDepth; + if (_vm->_globals.pathFindingDepth > 10) { + warning("PathFinding - Max depth reached"); + a7 = a7; + a8[a7] = -1; + a8[a7 + 1] = -1; + a8[a7 + 2] = -1; return -1; } int16 *v10 = Ligne[a1]._lineData; @@ -1038,80 +1038,68 @@ LABEL_17: v85 = 800; Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0); - int v23 = 0; + int bugLigIdx = 0; for (int v88 = 0; v88 < v85 + 1; v88++) { - _vm->_globals.BufLig[v23] = v82; - _vm->_globals.BufLig[v23 + 1] = v81; + _vm->_globals.BufLig[bugLigIdx] = v82; + _vm->_globals.BufLig[bugLigIdx + 1] = v81; v21 += v84; v22 += v83; v82 = v21 / 1000; v81 = v22 / 1000; - v23 += 2; + bugLigIdx += 2; } - int v25 = v23 - 2; - bool loopCond = false; + bugLigIdx -= 2; int v77 = 0; int v78 = 0; int v79 = 0; for (int v89 = v85 + 1; v89 > 0; v89--) { - int v96 = _vm->_globals.BufLig[v25]; - int v94 = _vm->_globals.BufLig[v25 + 1]; - if (checkCollisionLine(v96, v94, &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) { + if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) { v80 = v100; v77 = v101; - v78 = v96; - v79 = v94; - loopCond = true; - } - if (loopCond) + v78 = _vm->_globals.BufLig[bugLigIdx]; + v79 = _vm->_globals.BufLig[bugLigIdx + 1]; break; - v25 -= 2; + } + bugLigIdx -= 2; } int v66 = 0; int v68 = 0; int v70 = 0; int v72 = 0; - for (int i = v92; i < v91 + 1; ++i) { - int v27 = 2 * Ligne[i]._lineDataEndIdx; - int16 *v28 = Ligne[i]._lineData; - if (v28 == (int16 *)g_PTRNUL) + for (int i = v92; i <= v91; ++i) { + int16 *lineData = Ligne[i]._lineData; + if (lineData == (int16 *)g_PTRNUL) error("error in genial routine"); - int v29 = v28[0]; - int v30 = v28[1]; - int v59 = v28[1]; - int v31 = v27; - int v32 = v28[v27 - 2]; - int v33 = v28[v31 - 1]; if (i == v92) { - v72 = v33; - if (v30 <= v33) - v72 = v30; - v70 = v33; - if (v59 >= v33) - v70 = v59; - v68 = v32; - if (v29 <= v32) - v68 = v29; - v66 = v32; - if (v29 >= v32) - v66 = v29; + v72 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; + if (lineData[1] <= lineData[2 * Ligne[i]._lineDataEndIdx - 1]) + v72 = lineData[1]; + v70 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; + if (lineData[1] >= lineData[2 * Ligne[i]._lineDataEndIdx - 1]) + v70 = lineData[1]; + v68 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; + if (lineData[0] <= lineData[2 * Ligne[i]._lineDataEndIdx - 2]) + v68 = lineData[0]; + v66 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; + if (lineData[0] >= lineData[2 * Ligne[i]._lineDataEndIdx - 2]) + v66 = lineData[0]; } else { - if (v59 < v33 && v59 < v72) - v72 = v59; - if (v33 < v59 && v33 < v72) - v72 = v33; - if (v59 > v33 && v59 > v70) - v70 = v59; - if (v33 > v59 && v33 > v70) - v70 = v33; - if (v29 < v32 && v68 > v29) - v68 = v29; - if (v32 < v29 && v68 > v32) - v68 = v32; - if (v29 > v32 && v66 < v29) - v66 = v29; - if (v32 > v29 && v66 < v32) - v66 = v32; + if (lineData[1] < lineData[2 * Ligne[i]._lineDataEndIdx - 1] && lineData[1] < v72) + v72 = lineData[1]; + if (lineData[2 * Ligne[i]._lineDataEndIdx - 1] < lineData[1] && lineData[2 * Ligne[i]._lineDataEndIdx - 1] < v72) + v72 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; + if (lineData[1] > lineData[2 * Ligne[i]._lineDataEndIdx - 1] && lineData[1] > v70) + v70 = lineData[1]; + if (lineData[2 * Ligne[i]._lineDataEndIdx - 1] > lineData[1] && lineData[2 * Ligne[i]._lineDataEndIdx - 1] > v70) + v70 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; + if (lineData[0] < lineData[2 * Ligne[i]._lineDataEndIdx - 2] && v68 > lineData[0]) + v68 = lineData[0]; + if (lineData[2 * Ligne[i]._lineDataEndIdx - 2] < lineData[0] && v68 > lineData[2 * Ligne[i]._lineDataEndIdx - 2]) + v68 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; + if (lineData[0] > lineData[2 * Ligne[i]._lineDataEndIdx - 2] && v66 < lineData[0]) + v66 = lineData[0]; + if (lineData[2 * Ligne[i]._lineDataEndIdx - 2] > lineData[0] && v66 < lineData[2 * Ligne[i]._lineDataEndIdx - 2]) + v66 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; } } int v69 = v68 - 2; @@ -1121,53 +1109,53 @@ LABEL_17: if (a5 >= v69 && a5 <= v67 && a6 >= v73 && a6 <= v71) { int v34 = a6; int v76 = -1; - loopCond = false; - do { + for (;;) { --v34; - loopCond = checkCollisionLine(a5, v34, &v101, &v100, v92, v91); - if (loopCond) - v76 = v100; + if (!checkCollisionLine(a5, v34, &v101, &v100, v92, v91)) + break; + + v76 = v100; if (!v34 || v73 > v34) - loopCond = true; - } while (!loopCond); + break; + } int v35 = a6; int v75 = -1; - loopCond = false; - do { + for (;;) { ++v35; - loopCond = checkCollisionLine(a5, v35, &v101, &v100, v92, v91); - if (loopCond) - v75 = v100; + if (!checkCollisionLine(a5, v35, &v101, &v100, v92, v91)) + break; + + v75 = v100; if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) - loopCond = true; - } while (!loopCond); + break; + } int v36 = a5; int v74 = -1; - loopCond = false; - do { + for (;;) { ++v36; - loopCond = checkCollisionLine(v36, a6, &v101, &v100, v92, v91); - if (loopCond) - v74 = v100; + if (!checkCollisionLine(v36, a6, &v101, &v100, v92, v91)) + break; + + v74 = v100; + if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) - loopCond = true; - } while (!loopCond); + break; + } int v37 = a5; int v38 = -1; - loopCond = false; - do { + for(;;) { --v37; - loopCond = checkCollisionLine(v37, a6, &v101, &v100, v92, v91); - if (loopCond) - v38 = v100; + if (!checkCollisionLine(v37, a6, &v101, &v100, v92, v91)) + break; + v38 = v100; if (v37 <= 0 || v69 >= v37) - loopCond = true; - } while (!loopCond); + break;; + } if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) { - v9 = a7; - a8[v9] = -1; - a8[v9 + 1] = -1; - a8[v9 + 2] = -1; + a7 = a7; + a8[a7] = -1; + a8[a7 + 1] = -1; + a8[a7 + 2] = -1; return -1; } } @@ -1175,94 +1163,83 @@ LABEL_17: NVPX = v78; NVPY = v79; if (a1 < v80) { - int v40 = abs(v80 - a1); - int v41 = v40; int v43 = 0; - int v52 = v92 - 1; int v42 = a1; do { - if (v52 == v42) + if (v42 == v92 - 1) v42 = v91; ++v43; --v42; - if (v52 == v42) + if (v42 == v92 - 1) v42 = v91; } while (v80 != v42); - if (v41 == v43) { - int v44 = Ligne[a1]._lineDataEndIdx / 2; - int v54 = abs(v44); - if (a2 > v54) { + if (abs(v80 - a1) == v43) { + if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) { v99 = CONTOURNE(a1, a2, a7, v80, v77, a8, a9); } else { v99 = CONTOURNE1(a1, a2, a7, v80, v77, a8, a9, v92, v91); } } - if (v41 < v43) + if (abs(v80 - a1) < v43) v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); - if (v43 < v41) + if (v43 < abs(v80 - a1)) v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); } if (a1 > v80) { int v45 = abs(a1 - v80); - int v46 = v45; int v47 = a1; int v48 = 0; - int v53 = v91 + 1; do { - if (v53 == v47) + if (v47 == v91 + 1) v47 = v92; ++v48; ++v47; - if (v53 == v47) + if (v47 == v91 + 1) v47 = v92; } while (v80 != v47); - if (v46 == v48) { - int v49 = Ligne[a1]._lineDataEndIdx / 2; - int v56 = abs(v49); - if (a2 > v56) { + if (v45 == v48) { + if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) { v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); } else { v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); } } - if (v46 < v48) + if (v45 < v48) v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); - if (v48 < v46) + if (v48 < v45) v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); } if (a1 == v80) v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); - loopCond = false; - do { - loopCond = checkCollisionLine(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb); - if (loopCond) { - int v50 = v100; - if (Ligne[v50].field4 == 1) - --NVPY; - if (Ligne[v50].field4 == 2) { - --NVPY; - ++NVPX; - } - if (Ligne[v50].field4 == 3) - ++NVPX; - if (Ligne[v50].field4 == 4) { - ++NVPY; - ++NVPX; - } - if (Ligne[v50].field4 == 5) - ++NVPY; - if (Ligne[v50].field4 == 6) { - ++NVPY; - --NVPX; - } - if (Ligne[v50].field4 == 7) - --NVPX; - if (Ligne[v50].field4 == 8) { - --NVPY; - --NVPX; - } + for(;;) { + if (!checkCollisionLine(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb)) + break; + + if (Ligne[v100].field4 == 1) + --NVPY; + if (Ligne[v100].field4 == 2) { + --NVPY; + ++NVPX; + } + if (Ligne[v100].field4 == 3) + ++NVPX; + if (Ligne[v100].field4 == 4) { + ++NVPY; + ++NVPX; + } + if (Ligne[v100].field4 == 5) + ++NVPY; + if (Ligne[v100].field4 == 6) { + ++NVPY; + --NVPX; } - } while (loopCond); + if (Ligne[v100].field4 == 7) + --NVPX; + if (Ligne[v100].field4 == 8) { + --NVPY; + --NVPX; + } + } } else { NVPX = -1; NVPY = -1; @@ -1272,14 +1249,6 @@ LABEL_17: // Avoid 2 int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; int v12; int v14; int v15; @@ -1313,7 +1282,6 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v54; int v55; int v56; - int v57; int v58; int v59; int v60; @@ -1378,8 +1346,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v119 = 0; int v120; int v121; - int v122; - int v123; + int clipDestY; + int clipDestX; int v124; int v125; int v126[9]; @@ -1387,8 +1355,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v136[9]; int v141[9]; - v123 = destX; - v122 = destY; + clipDestX = destX; + clipDestY = destY; v121 = 0; v120 = 0; v115 = 0; @@ -1396,51 +1364,37 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v113 = 0; v111 = 0; if (destY <= 24) - v122 = 25; + clipDestY = 25; if (!_vm->_globals.NOT_VERIF) { - v4 = abs(srcX - _vm->_globals.old_x1_65); - if (v4 <= 4) { - v5 = abs(srcY - _vm->_globals.old_y1_66); - if (v5 <= 4) { - v6 = abs(_vm->_globals.old_x2_67 - destX); - if (v6 <= 4) { - v7 = abs(_vm->_globals.old_y2_68 - v122); - if (v7 <= 4) - return (int16 *)g_PTRNUL; - } - } - } - v8 = abs(srcX - destX); - if (v8 <= 4) { - v9 = abs(srcY - v122); - if (v9 <= 4) - return (int16 *)g_PTRNUL; - } - if (_vm->_globals.old_z_69 > 0 && _vm->_objectsManager.NUMZONE > 0 && _vm->_globals.old_z_69 == _vm->_objectsManager.NUMZONE) + if (abs(srcX - _vm->_globals.old_x1_65) <= 4 && abs(srcY - _vm->_globals.old_y1_66) <= 4 && + abs(_vm->_globals.old_x2_67 - destX) <= 4 && abs(_vm->_globals.old_y2_68 - clipDestY) <= 4) + return (int16 *)g_PTRNUL; + + if (abs(srcX - destX) <= 4 && abs(srcY - clipDestY) <= 4) + return (int16 *)g_PTRNUL; + + if (_vm->_globals._oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals._oldZoneNum == _vm->_objectsManager._zoneNum) return (int16 *)g_PTRNUL; } _vm->_globals.NOT_VERIF = false; - _vm->_globals.old_z_69 = _vm->_objectsManager.NUMZONE; + _vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum; _vm->_globals.old_x1_65 = srcX; _vm->_globals.old_x2_67 = destX; _vm->_globals.old_y1_66 = srcY; - _vm->_globals.old_y2_68 = v122; - _vm->_globals.STOP_BUG = 0; + _vm->_globals.old_y2_68 = clipDestY; + _vm->_globals.pathFindingDepth = 0; v112 = 0; if (destX <= 19) - v123 = 20; - if (v122 <= 19) - v122 = 20; - if (v123 > _vm->_graphicsManager.max_x - 10) - v123 = _vm->_graphicsManager.max_x - 10; - if (v122 > _vm->_globals.Max_Perso_Y) - v122 = _vm->_globals.Max_Perso_Y; - v10 = abs(srcX - v123); - if (v10 <= 3) { - v11 = abs(srcY - v122); - if (v11 <= 3) - return (int16 *)g_PTRNUL; - } + clipDestX = 20; + if (clipDestY <= 19) + clipDestY = 20; + if (clipDestX > _vm->_graphicsManager.max_x - 10) + clipDestX = _vm->_graphicsManager.max_x - 10; + if (clipDestY > _vm->_globals.Max_Perso_Y) + clipDestY = _vm->_globals.Max_Perso_Y; + + if (abs(srcX - clipDestX) <= 3 && abs(srcY - clipDestY) <= 3) + return (int16 *)g_PTRNUL; for (v12 = 0; v12 <= 8; ++v12) { v141[v12] = -1; @@ -1450,15 +1404,15 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { ++v12; } - if (PARC_PERS(srcX, srcY, v123, v122, -1, -1, 0) != 1) { + if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) != 1) { v14 = 0; - v15 = v122; - if (_vm->_graphicsManager.max_y > v122) { + v15 = clipDestY; + if (_vm->_graphicsManager.max_y > clipDestY) { v16 = 5; do { v101 = v16; v16 = v101; - if (checkCollisionLine(v123, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v101] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(clipDestX, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v101] <= _vm->_objectsManager._lastLine) break; v136[v101] = 0; v141[v101] = -1; @@ -1468,13 +1422,13 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } v131[5] = v14; v18 = 0; - v19 = v122; - if (_vm->_graphicsManager.min_y < v122) { + v19 = clipDestY; + if (_vm->_graphicsManager.min_y < clipDestY) { v20 = 1; do { v102 = v20; v20 = v102; - if (checkCollisionLine(v123, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v102] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(clipDestX, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v102] <= _vm->_objectsManager._lastLine) break; v136[v102] = 0; v141[v102] = -1; @@ -1488,13 +1442,13 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } v131[1] = v18; v22 = 0; - v23 = v123; - if (_vm->_graphicsManager.max_x > v123) { + v23 = clipDestX; + if (_vm->_graphicsManager.max_x > clipDestX) { v24 = 3; do { v103 = v24; v24 = v103; - if (checkCollisionLine(v23, v122, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v103] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v23, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v103] <= _vm->_objectsManager._lastLine) break; v136[v103] = 0; v141[v103] = -1; @@ -1510,13 +1464,13 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } v131[3] = v22; v26 = 0; - v27 = v123; - if (_vm->_graphicsManager.min_x < v123) { + v27 = clipDestX; + if (_vm->_graphicsManager.min_x < clipDestX) { v28 = 7; do { v104 = v28; v28 = v104; - if (checkCollisionLine(v27, v122, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v104] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v27, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v104] <= _vm->_objectsManager._lastLine) break; v136[v104] = 0; v141[v104] = -1; @@ -1705,7 +1659,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } } } - v55 = PARC_PERS(srcX, srcY, v123, v122, v115, v121, 0); + v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); if (v55 != 1) { if (v55 == 2) { LABEL_201: @@ -1719,10 +1673,15 @@ LABEL_201: do { if (checkCollisionLine(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v57 = v112; + v112 = v112; v58 = GENIAL(v124, v125, srcX, srcY - v56, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); - if (v58 == -1) - goto LABEL_282; + if (v58 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } v112 = v58; if (NVPY != -1) v56 = srcY - NVPY; @@ -1743,10 +1702,15 @@ LABEL_201: do { if (checkCollisionLine(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v57 = v112; + v112 = v112; v61 = GENIAL(v124, v125, srcX, v60 + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); - if (v61 == -1) - goto LABEL_282; + if (v61 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } v112 = v61; if (NVPY != -1) v60 = NVPY - srcY; @@ -1767,10 +1731,15 @@ LABEL_201: do { if (checkCollisionLine(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v57 = v112; + v112 = v112; v64 = GENIAL(v124, v125, srcX - v63, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); - if (v64 == -1) - goto LABEL_282; + if (v64 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } v112 = v64; if (NVPX != -1) v63 = srcX - NVPX; @@ -1791,10 +1760,15 @@ LABEL_201: do { if (checkCollisionLine(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v57 = v112; + v112 = v112; v67 = GENIAL(v124, v125, v66 + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); - if (v67 == -1) - goto LABEL_282; + if (v67 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } v112 = v67; if (NVPX != -1) v66 = NVPX - srcX; @@ -1842,7 +1816,7 @@ LABEL_234: if (v76 > 30) { v77 = abs(v76 / 2); if (v72 == v77) { - v78 = PARC_PERS(v119, v118, v123, v122, v110, v121, v112); + v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) return &_vm->_globals.super_parcours[0]; if (v78 == 2) @@ -1854,7 +1828,7 @@ LABEL_234: ++v72; v110 = v116; } - v79 = PARC_PERS(v119, v118, v123, v122, v116, v121, v112); + v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); if (v79 == 1) return &_vm->_globals.super_parcours[0]; if (v79 == 2) { @@ -1910,7 +1884,7 @@ LABEL_200: if (v86 > 30) { v87 = abs(v86 / 2); if (v83 == v87) { - v88 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); + v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) return &_vm->_globals.super_parcours[0]; if (v88 == 2) @@ -1922,7 +1896,7 @@ LABEL_200: --v83; } while (v83 > -1); } - v89 = PARC_PERS(v119, v118, v123, v122, v117, v121, v112); + v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v89 == 1) return &_vm->_globals.super_parcours[0]; if (v89 == 2) @@ -1968,20 +1942,18 @@ LABEL_200: } while (v120 < v90); } } - v57 = v112; if (PARC_PERS( _vm->_globals.super_parcours[v112 - 4], _vm->_globals.super_parcours[v112 - 3], - v123, - v122, + clipDestX, + clipDestY, -1, -1, v112) != 1) { -LABEL_282: - _vm->_globals.super_parcours[v57] = -1; - _vm->_globals.super_parcours[v57 + 1] = -1; - _vm->_globals.super_parcours[v57 + 2] = -1; - _vm->_globals.super_parcours[v57 + 3] = -1; + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; } return &_vm->_globals.super_parcours[0]; } @@ -2040,10 +2012,6 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int16 *v64; int v65; int v66; - int v68; - int16 *v69; - int v70; - int16 *v71; int16 *v72; int v73; int v74; @@ -2061,7 +2029,6 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v87; int16 *v88; int v89; - int v90; int v91; int v92; int v93; @@ -2107,50 +2074,51 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v133; int v134; int v135; - int v136; - int v137; int v138; int v139; int v140; int v141; int v142; int v143; - int v144; int v145; bool colResult = false; int v7 = a1; - v90 = a2; - v137 = a7; - v136 = 0; + int v90 = a2; + int v137 = a7; + int v136 = 0; if (a5 == -1 && a6 == -1) v136 = 1; - v144 = a5; + int v144 = a5; if (checkCollisionLine(a1, a2, &v145, &v144, 0, _linesNumb)) { - int v8 = Ligne[v144].field4; - if (v8 == 1) - v90 = a2 - 2; - if (v8 == 2) { + switch (Ligne[v144].field4) { + case 1: + v90 -= 2; + break; + case 2: v90 -= 2; - v7 = a1 + 2; - } - if (v8 == 3) v7 += 2; - if (v8 == 4) { + break; + case 3: + v7 += 2; + break; + case 4: v90 += 2; v7 += 2; - } - if (v8 == 5) + case 5: v90 += 2; - if (v8 == 6) { + break; + case 6: v90 += 2; v7 -= 2; - } - if (v8 == 7) + break; + case 7: v7 -= 2; - if (v8 == 8) { + break; + case 8: v90 -= 2; v7 -= 2; + break; } } v98 = v7; @@ -2192,7 +2160,12 @@ LABEL_150: } } while (v127 != 1); } - goto LABEL_248; + v74 = v137; + _vm->_globals.super_parcours[v74] = -1; + _vm->_globals.super_parcours[v74 + 1] = -1; + _vm->_globals.super_parcours[v74 + 2] = -1; + _vm->_globals.super_parcours[v74 + 3] = -1; + return 1; } v9 = abs(v7 - a3); v10 = v9 + 1; @@ -2471,7 +2444,12 @@ LABEL_195: v128 = 1; } while (v128 != 1); } - goto LABEL_248; + v74 = v137; + _vm->_globals.super_parcours[v74] = -1; + _vm->_globals.super_parcours[v74 + 1] = -1; + _vm->_globals.super_parcours[v74 + 2] = -1; + _vm->_globals.super_parcours[v74 + 3] = -1; + return 1; } v39 = v92; for (;;) { @@ -2771,22 +2749,18 @@ LABEL_235: if (v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; } - v68 = v117; - v69 = _vm->_globals.essai2; - v69[v68] = v65; - v69[v68 + 1] = a4; - v69[v68 + 2] = 7; + _vm->_globals.essai2[v117] = v65; + _vm->_globals.essai2[v117 + 1] = a4; + _vm->_globals.essai2[v117 + 2] = 7; v117 += 3; --v65; } while (a3 < v65); } v138 = -1; LABEL_241: - v70 = v117; - v71 = _vm->_globals.essai2; - v71[v70] = -1; - v71[v70 + 1] = -1; - v71[v70 + 2] = -1; + _vm->_globals.essai2[v117] = -1; + _vm->_globals.essai2[v117 + 1] = -1; + _vm->_globals.essai2[v117 + 2] = -1; LABEL_242: if (v117) { v129 = 0; @@ -2804,7 +2778,6 @@ LABEL_242: v129 = 1; } while (v129 != 1); } -LABEL_248: v74 = v137; _vm->_globals.super_parcours[v74] = -1; _vm->_globals.super_parcours[v74 + 1] = -1; @@ -2814,32 +2787,26 @@ LABEL_248: } int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { - int v4; - int v5; int v6; int v7; int v8; int v9; - int v11; int v12; - int v13; int v14; int v15; int v16; int v17; int v18; - v4 = abs(a1 - a3); - v5 = v4 + 1; - v11 = abs(a2 - a4); - v13 = v11 + 1; - if (v5 > (int)(v11 + 1)) + int v5 = abs(a1 - a3) + 1; + int v13 = abs(a2 - a4) + 1; + if (v5 > v13) v13 = v5; if (v13 <= 10) return -1; v6 = v13 - 1; v16 = 1000 * v5 / v6; - v15 = 1000 * (int)(v11 + 1) / v6; + v15 = 1000 * (abs(a2 - a4) + 1) / v6; if (a3 < a1) v16 = -v16; if (a4 < a2) @@ -2870,11 +2837,6 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v10; int v11; int v14; - int spriteSize; - int v16; - int v17; - int v19; - int v20; int v22; int v25; int v33; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7c5945fdbe..231ef2e885 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -57,7 +57,7 @@ ObjectsManager::ObjectsManager() { _visibleFl = false; BOBTOUS = false; my_anim = 0; - NUMZONE = 0; + _zoneNum = 0; _forceZoneFl = false; _changeVerbFl = false; _verb = 0; @@ -1464,7 +1464,7 @@ void ObjectsManager::checkZone() { _vm->_eventsManager.changeMouseCursor(4); } } - NUMZONE = v4; + _zoneNum = v4; _vm->_globals.old_x_69 = v0; _vm->_globals.old_y_70 = v2; _vm->_globals.old_zone_68 = v4; @@ -1579,7 +1579,7 @@ void ObjectsManager::GOHOME() { if (_vm->_globals.GOACTION) v54 = _vm->_globals._saveData->data[svField2]; else - v54 = NUMZONE; + v54 = _zoneNum; _vm->_globals.chemin = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); @@ -1918,7 +1918,7 @@ LABEL_153: if (_vm->_globals.GOACTION) v49 = _vm->_globals._saveData->data[svField2]; else - v49 = NUMZONE; + v49 = _zoneNum; setSpriteIndex(0, _vm->_globals.g_old_sens + 59); _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2388,7 +2388,7 @@ void ObjectsManager::handleLeftButton() { if (!_vm->_globals.GOACTION) goto LABEL_38; checkZone(); - if (NUMZONE <= 0) + if (_zoneNum <= 0) return; v2 = 0; v3 = _vm->_globals.essai2; @@ -2411,10 +2411,10 @@ void ObjectsManager::handleLeftButton() { _vm->_globals._saveData->data[svField2] = 0; } LABEL_38: - if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || NUMZONE <= 0)) + if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0)) return; - if (NUMZONE != -1 && NUMZONE != 0) { - zoneCount = NUMZONE; + if (_zoneNum != -1 && _zoneNum != 0) { + zoneCount = _zoneNum; zoneX = _vm->_globals.ZONEP[zoneCount]._destX; if (zoneX) { zoneY = _vm->_globals.ZONEP[zoneCount]._destY; @@ -2429,7 +2429,7 @@ LABEL_38: _vm->_globals.GOACTION = false; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals._forestFl && NUMZONE >= 20 && NUMZONE <= 23) { + if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { v10 = getSpriteX(0); v11 = getSpriteY(0); @@ -2478,7 +2478,7 @@ LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) _vm->_globals.chemin = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } - if (NUMZONE != -1 && NUMZONE != 0) { + if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) _vm->_globals._saveData->data[svField1] = 5; else @@ -2486,14 +2486,14 @@ LABEL_65: if (_vm->_globals.PLAN_FLAG) _vm->_globals._saveData->data[svField1] = 6; - _vm->_globals._saveData->data[svField2] = NUMZONE; + _vm->_globals._saveData->data[svField2] = _zoneNum; _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; _vm->_globals.GOACTION = true; } _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); if (_vm->_globals._screenId == 20 && _vm->_globals._saveData->data[svField132] == 1 - && _vm->_globals._curObjectIndex == 20 && NUMZONE == 12 + && _vm->_globals._curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2512,7 +2512,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals._saveData->data[svField1]; if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); - if (!_vm->_globals._forestFl || NUMZONE < 20 || NUMZONE > 23) { + if (!_vm->_globals._forestFl || _zoneNum < 20 || _zoneNum > 23) { if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) @@ -2574,11 +2574,11 @@ LABEL_64: _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); - if (NUMZONE != -1 && NUMZONE != 0 && !_vm->_globals.ZONEP[NUMZONE].field16) { - NUMZONE = -1; + if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum].field16) { + _zoneNum = -1; _forceZoneFl = true; } - if (NUMZONE != _vm->_globals._saveData->data[svField2] || NUMZONE == -1 || NUMZONE == 0) { + if (_zoneNum != _vm->_globals._saveData->data[svField2] || _zoneNum == -1 || _zoneNum == 0) { _vm->_eventsManager._mouseCursorId = 4; _changeVerbFl = false; } else { @@ -2592,7 +2592,7 @@ LABEL_64: } if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); - NUMZONE = 0; + _zoneNum = 0; _vm->_globals._saveData->data[svField1] = 0; _vm->_globals._saveData->data[svField2] = 0; } @@ -2602,8 +2602,8 @@ LABEL_64: } if (_vm->_globals.NOMARCHE) { if (_vm->_eventsManager._mouseCursorId == 4) { - result = NUMZONE + 1; - if (NUMZONE != -1 && NUMZONE != 0) + result = _zoneNum + 1; + if (_zoneNum != -1 && _zoneNum != 0) handleRightButton(); } } @@ -2630,7 +2630,7 @@ void ObjectsManager::clearScreen() { } _vm->_eventsManager._mouseCursorId = 4; _verb = 4; - NUMZONE = 0; + _zoneNum = 0; Vold_taille = 0; SPEED_PTR = g_PTRNUL; SPEED_X = 0; @@ -3124,7 +3124,7 @@ void ObjectsManager::nextVerbIcon() { do { if (_vm->_eventsManager._mouseCursorId == 4) { - if (!_vm->_globals.NOMARCHE || NUMZONE == -1 || NUMZONE == 0) + if (!_vm->_globals.NOMARCHE || _zoneNum == -1 || _zoneNum == 0) return; ++_vm->_eventsManager._mouseCursorId; @@ -3132,146 +3132,146 @@ void ObjectsManager::nextVerbIcon() { if (_vm->_eventsManager._mouseCursorId == 5 || _vm->_eventsManager._mouseCursorId == 6) { _vm->_eventsManager._mouseCursorId = 6; - if (_vm->_globals.ZONEP[NUMZONE].field6 == 1) + if (_vm->_globals.ZONEP[_zoneNum].field6 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 7) { - if (_vm->_globals.ZONEP[NUMZONE].field7 == 1) + if (_vm->_globals.ZONEP[_zoneNum].field7 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 8) { - if (_vm->_globals.ZONEP[NUMZONE].field8 == 1) + if (_vm->_globals.ZONEP[_zoneNum].field8 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 9) { - if (_vm->_globals.ZONEP[NUMZONE].field9 == 1) + if (_vm->_globals.ZONEP[_zoneNum].field9 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 10) { - if (_vm->_globals.ZONEP[NUMZONE].fieldA == 1) + if (_vm->_globals.ZONEP[_zoneNum].fieldA == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 11) { - if (_vm->_globals.ZONEP[NUMZONE].fieldB == 1) + if (_vm->_globals.ZONEP[_zoneNum].fieldB == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 12) { - if (_vm->_globals.ZONEP[NUMZONE].fieldC == 1) + if (_vm->_globals.ZONEP[_zoneNum].fieldC == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 13) { - if (_vm->_globals.ZONEP[NUMZONE].fieldD == 1) + if (_vm->_globals.ZONEP[_zoneNum].fieldD == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 14) { - if (_vm->_globals.ZONEP[NUMZONE].fieldE == 1) + if (_vm->_globals.ZONEP[_zoneNum].fieldE == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 15) { - if (_vm->_globals.ZONEP[NUMZONE].fieldF == 1) + if (_vm->_globals.ZONEP[_zoneNum].fieldF == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 16) { - if (_vm->_globals.ZONEP[NUMZONE].field6 == 2) + if (_vm->_globals.ZONEP[_zoneNum].field6 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 17) { - if (_vm->_globals.ZONEP[NUMZONE].field9 == 2) + if (_vm->_globals.ZONEP[_zoneNum].field9 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 18) { - if (_vm->_globals.ZONEP[NUMZONE].fieldA == 2) + if (_vm->_globals.ZONEP[_zoneNum].fieldA == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 19) { - if (_vm->_globals.ZONEP[NUMZONE].fieldB == 2) + if (_vm->_globals.ZONEP[_zoneNum].fieldB == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 20) { - if (_vm->_globals.ZONEP[NUMZONE].fieldC == 2) + if (_vm->_globals.ZONEP[_zoneNum].fieldC == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 21) { - if (_vm->_globals.ZONEP[NUMZONE].fieldF == 2) + if (_vm->_globals.ZONEP[_zoneNum].fieldF == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 22) { - if (_vm->_globals.ZONEP[NUMZONE].fieldD == 2) + if (_vm->_globals.ZONEP[_zoneNum].fieldD == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 23) { - if (_vm->_globals.ZONEP[NUMZONE].field8 == 2) + if (_vm->_globals.ZONEP[_zoneNum].field8 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 24) { - if (_vm->_globals.ZONEP[NUMZONE].field9 == 3) + if (_vm->_globals.ZONEP[_zoneNum].field9 == 3) return; ++_vm->_eventsManager._mouseCursorId; } _vm->_eventsManager._mouseCursorId = 4; - } while (_vm->_globals.ZONEP[NUMZONE].fieldE != 2); + } while (_vm->_globals.ZONEP[_zoneNum].fieldE != 2); } /** * Handle Right button */ void ObjectsManager::handleRightButton() { - if (NUMZONE != -1 && NUMZONE != 0) { + if (_zoneNum != -1 && _zoneNum != 0) { nextVerbIcon(); if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index b7f1d3c44b..e2d706e782 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -82,7 +82,7 @@ public: bool _visibleFl; bool BOBTOUS; int my_anim; - int NUMZONE; + int _zoneNum; bool _forceZoneFl; bool _changeVerbFl; int _verb; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 8baff49192..3c1c8d080f 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -740,7 +740,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v13 = _vm->_objectsManager.getSpriteY(0); int v14 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); - _vm->_objectsManager.NUMZONE = -1; + _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1629,7 +1629,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v56 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.NUMZONE = -1; + _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1659,7 +1659,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v58 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.NUMZONE = -1; + _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1836,7 +1836,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v38 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.NUMZONE = 0; + _vm->_objectsManager._zoneNum = 0; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1868,7 +1868,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v39 = _vm->_objectsManager.getSpriteY(0); int v40 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); - _vm->_objectsManager.NUMZONE = 0; + _vm->_objectsManager._zoneNum = 0; _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 0a3ebd9797..e3acad312d 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1076,7 +1076,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { for (int i = 0; i <= 44; i++) _vm->_globals.BOBZONE[i] = 0; - _vm->_objectsManager.NUMZONE = -1; + _vm->_objectsManager._zoneNum = -1; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); _characterBuffer = _vm->_fileManager.searchCat(a2, 5); @@ -1117,14 +1117,14 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.INILINK(v22); _vm->_objectsManager.PERSO_ON = true; _vm->_globals.GOACTION = false; - _vm->_objectsManager.NUMZONE = -1; + _vm->_objectsManager._zoneNum = -1; initCharacterAnim(); VISU_PARLE(); dialogWait(); _vm->_graphicsManager.INI_ECRAN2(v22, true); _vm->_globals.NOMARCHE = true; _vm->_objectsManager._forceZoneFl = true; - _vm->_objectsManager.NUMZONE = -1; + _vm->_objectsManager._zoneNum = -1; do { int mouseButton = _vm->_eventsManager.getMouseButton(); if (mouseButton == 1) -- cgit v1.2.3 From 212a2cb0f8e54f9fae171621e36119a9f80706e1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Jan 2013 14:50:53 +0100 Subject: HOPKINS: Get rid of some GOTOs in pathfinding code --- engines/hopkins/lines.cpp | 130 +++++++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 52 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index a60e26af03..c9434e9e2f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -871,7 +871,6 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { _vm->_globals.super_parcours[v24 + 3] = 0; v7 += 4; } -LABEL_186: NV_LIGNEDEP = v36; NV_LIGNEOFS = v35; NV_POSI = v7; @@ -895,7 +894,10 @@ LABEL_186: _vm->_globals.super_parcours[v27 + 3] = 0; v7 += 4; } - goto LABEL_186; + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; } if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { @@ -915,7 +917,10 @@ LABEL_186: _vm->_globals.super_parcours[v30 + 3] = 0; v7 += 4; } - goto LABEL_186; + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; } if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { @@ -935,7 +940,10 @@ LABEL_186: _vm->_globals.super_parcours[v33 + 3] = 0; v7 += 4; } - goto LABEL_186; + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; } } } @@ -984,9 +992,8 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, } LABEL_11: int16 *v13 = Ligne[a1]._lineData; - int v14 = 2 * Ligne[a1]._lineDataEndIdx; - int v95 = v13[v14 - 2]; - int v93 = v13[v14 - 1]; + int v95 = v13[2 * Ligne[a1]._lineDataEndIdx - 2]; + int v93 = v13[2 * Ligne[a1]._lineDataEndIdx - 1]; int v91 = a1; int v100, v101; for (;;) { @@ -1017,19 +1024,17 @@ LABEL_11: v93 = v16[v65 - 1]; } LABEL_17: - int v18 = abs(a3 - a5); - int v58 = v18 + 1; - int v19 = abs(a4 - a6); - int v85 = v19 + 1; - int v20 = v19 + 1; + int v58 = abs(a3 - a5) + 1; + int v85 = abs(a4 - a6) + 1; + int v20 = v85; if (v58 > v20) v85 = v58; int v84 = 1000 * v58 / v85; int v83 = 1000 * v20 / v85; int v21 = 1000 * a3; int v22 = 1000 * a4; - int v82 = v21 / 1000; - int v81 = v22 / 1000; + int v82 = a3; + int v81 = a4; if (a5 < a3) v84 = -v84; if (a6 < a4) @@ -1819,8 +1824,12 @@ LABEL_234: v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) return &_vm->_globals.super_parcours[0]; - if (v78 == 2) - goto LABEL_200; + if (v78 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; + } if (MIRACLE(v119, v118, v110, v121, v112)) goto LABEL_201; } @@ -1832,7 +1841,6 @@ LABEL_234: if (v79 == 1) return &_vm->_globals.super_parcours[0]; if (v79 == 2) { -LABEL_200: v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; v112 = NV_POSI; @@ -1887,8 +1895,12 @@ LABEL_200: v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) return &_vm->_globals.super_parcours[0]; - if (v88 == 2) - goto LABEL_200; + if (v88 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; + } if (MIRACLE(v119, v118, v117, v121, v112)) goto LABEL_201; } @@ -1899,8 +1911,12 @@ LABEL_200: v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v89 == 1) return &_vm->_globals.super_parcours[0]; - if (v89 == 2) - goto LABEL_200; + if (v89 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; + } if (MIRACLE(v119, v118, v117, v121, v112)) goto LABEL_201; --v117; @@ -2212,24 +2228,24 @@ LABEL_72: v20 = v19 + 1; v95 = abs(v109 - a4); v108 = v95 + 1; - if (v20 > (int16)(v95 + 1)) + if (v20 > (v95 + 1)) v108 = v20; if (v108 <= 10) goto LABEL_149; v21 = v108 - 1; v102 = 1000 * v20 / v21; - v100 = 1000 * (int16)(v95 + 1) / v21; + v100 = 1000 * (v95 + 1) / v21; if (a3 < v111) v102 = -v102; if (a4 < v109) v100 = -v100; - v22 = (int16)v102 / 1000; - v96 = (int16)v100 / 1000; + v22 = v102 / 1000; + v96 = v100 / 1000; v106 = 1000 * v111; v105 = 1000 * v109; v104 = 1000 * v111 / 1000; v103 = v105 / 1000; - if (!((int16)v102 / 1000) && v96 == -1) + if (!(v102 / 1000) && v96 == -1) v91 = 1; if (v22 == 1) { if (v96 == -1) @@ -2241,20 +2257,23 @@ LABEL_72: } if (!v22 && v96 == 1) v91 = 5; - if (v22 != -1) - goto LABEL_103; - if (v96 == 1) - v91 = 6; - if (!v96) - v91 = 7; - if (v96 == -1) { - v91 = 8; -LABEL_103: - if (v96 == -1) { - if ((unsigned int)v102 <= 510) + if ((v22 != -1) && (v96 == -1)) { + if (v102 >= 0 && v102 < 510) + v91 = 1; + else if (v102 >= 510 && v102 <= 1000) + v91 = 2; + } else { + if (v96 == 1) + v91 = 6; + else if (!v96) + v91 = 7; + else if (v96 == -1) { + if (v102 >= 0 && v102 < 510) v91 = 1; - if ((unsigned int)(v102 - 510) <= 490) + else if (v102 >= 510 && v102 <= 1000) v91 = 2; + else + v91 = 8; } } if (v22 == 1) { @@ -2319,7 +2338,6 @@ LABEL_103: goto LABEL_150; v115 = v24; if (NVPX != -1 || NVPY != -1) { -LABEL_67: v142 = -1; goto LABEL_157; } @@ -2335,7 +2353,12 @@ LABEL_67: v110 = SMOOTH[v14].field2; if (v15 == -1 || SMOOTH[v14].field2 == -1) { v126 = 1; - goto LABEL_70; + if (v126 == 1) { + v18 = v14 - 1; + v111 = SMOOTH[v18].field0; + v109 = SMOOTH[v18].field2; + goto LABEL_72; + } } if (checkCollisionLine(v15, v110, &v143, &v142, 0, _linesNumb)) break; @@ -2347,7 +2370,6 @@ LABEL_67: v17[v16 + 2] = v91; v115 += 3; ++v14; -LABEL_70: if (v126 == 1) { v18 = v14 - 1; v111 = SMOOTH[v18].field0; @@ -2356,7 +2378,8 @@ LABEL_70: } } if (v142 > _vm->_objectsManager._lastLine) - goto LABEL_67; + v142 = -1; + LABEL_157: v31 = v115; v32 = _vm->_globals.essai0; @@ -2405,7 +2428,9 @@ LABEL_181: v33 = NVPX; v92 = NVPY; v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); - goto LABEL_189; + if (v45 && v140 <= _vm->_objectsManager._lastLine) + goto LABEL_202; + goto LABEL_158; } } } @@ -2464,7 +2489,6 @@ LABEL_195: v33 = NVPX; v92 = NVPY; v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); -LABEL_189: if (v45 && v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; goto LABEL_158; @@ -2571,7 +2595,6 @@ LABEL_249: if (v78[v120] == -1 && v78[v120 + 1] == -1) v130 = 1; } while (v130 != 1); -LABEL_323: NV_POSI = v137; return 2; } @@ -2593,7 +2616,6 @@ LABEL_323: if (v80[v121] == -1 && v80[v121 + 1] == -1) v131 = 1; } while (v131 != 1); -LABEL_301: NV_POSI = v137; return 2; } @@ -2616,7 +2638,6 @@ LABEL_301: if (v82[v122] == -1 && v82[v122 + 1] == -1) v132 = 1; } while (v132 != 1); -LABEL_312: NV_POSI = v137; return 2; } @@ -2647,7 +2668,8 @@ LABEL_312: if (v84[v123] == -1 && v84[v123 + 1] == -1) v133 = 1; } while (v133 != 1); - goto LABEL_301; + NV_POSI = v137; + return 2; } v86 = _vm->_globals.essai2; if (_vm->_globals.essai2[0] != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { @@ -2667,7 +2689,8 @@ LABEL_312: if (v86[v124] == -1 && v86[v124 + 1] == -1) v134 = 1; } while (v134 != 1); - goto LABEL_312; + NV_POSI = v137; + return 2; } if (_vm->_globals.essai1[0] != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; @@ -2687,7 +2710,9 @@ LABEL_312: if (v88[v125] == -1 && v88[v125 + 1] == -1) v135 = 1; } while (v135 != 1); - goto LABEL_323; + + NV_POSI = v137; + return 2; } } } @@ -2708,7 +2733,6 @@ LABEL_217: v54 = NVPX; v93 = NVPY; colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); -LABEL_235: if (colResult && v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; goto LABEL_203; @@ -2742,7 +2766,9 @@ LABEL_235: v54 = NVPX; v93 = NVPY; colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); - goto LABEL_235; + if (colResult && v138 <= _vm->_objectsManager._lastLine) + goto LABEL_249; + goto LABEL_203; } } } -- cgit v1.2.3 From 558506af549f763f5743bad1359f7b16255c42f9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Jan 2013 15:19:46 +0100 Subject: HOPKINS: Some refactoring in DialogManager and AnimationManager --- engines/hopkins/anim.cpp | 113 +++++++++++++++++++++----------------------- engines/hopkins/dialogs.cpp | 54 ++++++++++----------- engines/hopkins/globals.cpp | 1 - engines/hopkins/globals.h | 1 - 4 files changed, 79 insertions(+), 90 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 780fdd9eca..25c6913a72 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -462,7 +462,7 @@ LABEL_114: * Load Animation */ void AnimationManager::loadAnim(const Common::String &animName) { - byte v20[15]; + char dummyBuf[15]; char header[10]; char filename1[15]; char filename2[15]; @@ -481,7 +481,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { int filesize = f.size(); int nbytes = filesize - 115; f.read(header, 10); - f.read(v20, 15); + f.read(dummyBuf, 15); f.read(filename1, 15); f.read(filename2, 15); f.read(filename3, 15); @@ -490,7 +490,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { f.read(filename6, 15); if (header[0] != 'A' || header[1] != 'N' || header[2] != 'I' || header[3] != 'S') - error("File incompatible with this soft."); + error("Invalid animation File: %s", filename.c_str()); const char *files[6] = { &filename1[0], &filename2[0], &filename3[0], &filename4[0], &filename5[0], &filename6[0] }; @@ -498,9 +498,9 @@ void AnimationManager::loadAnim(const Common::String &animName) { for (int idx = 0; idx <= 5; ++idx) { if (files[idx][0]) { if (!f.exists(files[idx])) - error("File not found"); + error("Missing file %s in animation File: %s", files[idx], filename.c_str()); if (loadSpriteBank(idx + 1, files[idx])) - error("File not compatible with this soft."); + error("Invalid sprite bank in animation File: %s", filename.c_str()); } } @@ -528,7 +528,6 @@ void AnimationManager::clearAnim() { _vm->_globals.Bank[idx]._loadedFl = false; _vm->_globals.Bank[idx]._filename = ""; _vm->_globals.Bank[idx]._fileHeader = 0; - _vm->_globals.Bank[idx].field1C = 0; } } @@ -539,7 +538,6 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *v13; byte *v19; int result = 0; - _vm->_globals.Bank[idx].field1C = _vm->_fileManager.fileSize(filename); _vm->_globals.Bank[idx]._loadedFl = true; _vm->_globals.Bank[idx]._filename = filename; @@ -551,63 +549,60 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { else if (fileDataPtr[1] == 'O' && fileDataPtr[2] == 'R') _vm->_globals.Bank[idx]._fileHeader = 2; - if (_vm->_globals.Bank[idx]._fileHeader) { - _vm->_globals.Bank[idx]._data = fileDataPtr; - - bool loopCond = false; - int v8 = 0; - int width; - int height; - do { - width = _vm->_objectsManager.getWidth(fileDataPtr, v8); - height = _vm->_objectsManager.getHeight(fileDataPtr, v8); - if (!width && !height) - loopCond = true; - else - ++v8; - if (v8 > 249) - loopCond = true; - } while (!loopCond); + if (!_vm->_globals.Bank[idx]._fileHeader) { + _vm->_globals.freeMemory(fileDataPtr); + _vm->_globals.Bank[idx]._loadedFl = false; + result = -1; + } + + _vm->_globals.Bank[idx]._data = fileDataPtr; + + int v8 = 0; + int width; + int height; + for(;;) { + width = _vm->_objectsManager.getWidth(fileDataPtr, v8); + height = _vm->_objectsManager.getHeight(fileDataPtr, v8); + if (!width && !height) + break; - if (v8 <= 249) { - _vm->_globals.Bank[idx].field1A = v8; + ++v8; + if (v8 > 249) + break; + } - Common::String ofsFilename = _vm->_globals.Bank[idx]._filename; - char ch; - do { - ch = ofsFilename.lastChar(); - ofsFilename.deleteLastChar(); - } while (ch != '.'); - ofsFilename += ".OFS"; - - Common::File f; - if (f.exists(ofsFilename)) { - v19 = _vm->_fileManager.loadFile(ofsFilename); - v13 = v19; - for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) { - int x1 = (int16)READ_LE_UINT16(v13); - int y1 = (int16)READ_LE_UINT16(v13 + 2); - int x2 = (int16)READ_LE_UINT16(v13 + 4); - int y2 = (int16)READ_LE_UINT16(v13 + 6); - - _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); - if (_vm->_globals.Bank[idx]._fileHeader == 2) - _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); - } + if (v8 > 249) { + _vm->_globals.freeMemory(fileDataPtr); + _vm->_globals.Bank[idx]._loadedFl = false; + result = -2; + } + _vm->_globals.Bank[idx].field1A = v8; - _vm->_globals.freeMemory(v19); - } + Common::String ofsFilename = _vm->_globals.Bank[idx]._filename; + char ch; + do { + ch = ofsFilename.lastChar(); + ofsFilename.deleteLastChar(); + } while (ch != '.'); + ofsFilename += ".OFS"; - result = 0; - } else { - _vm->_globals.freeMemory(fileDataPtr); - _vm->_globals.Bank[idx]._loadedFl = false; - result = -2; + Common::File f; + if (f.exists(ofsFilename)) { + v19 = _vm->_fileManager.loadFile(ofsFilename); + v13 = v19; + for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) { + int x1 = (int16)READ_LE_UINT16(v13); + int y1 = (int16)READ_LE_UINT16(v13 + 2); + int x2 = (int16)READ_LE_UINT16(v13 + 4); + int y2 = (int16)READ_LE_UINT16(v13 + 6); + + _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); + if (_vm->_globals.Bank[idx]._fileHeader == 2) + _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); } - } else { - _vm->_globals.freeMemory(fileDataPtr); - _vm->_globals.Bank[idx]._loadedFl = false; - result = -1; + + _vm->_globals.freeMemory(v19); + result = 0; } return result; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 9c7347f5f7..489ce0f625 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -363,7 +363,6 @@ LABEL_7: } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager._curMouseButton = 0; - bool v20 = false; int newInventoryItem = 0; // Main loop to select an inventory item @@ -390,38 +389,35 @@ LABEL_7: break; _vm->_objectsManager.takeInventoryObject(_vm->_globals._inventory[newInventoryItem]); if (_vm->_eventsManager._mouseCursorId == 8) - v20 = true; - if (!v20) { - _vm->_scriptManager.TRAVAILOBJET = true; - _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; - _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[newInventoryItem]; - _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; - _vm->_objectsManager.OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = false; - - if (_vm->_soundManager._voiceOffFl) { - do - _vm->_eventsManager.VBL(); - while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); - _vm->_fontManager.hideText(9); - } - if (_vm->_globals._exitId) { - if (_vm->_globals._exitId == 2) - v20 = true; + break; + + _vm->_scriptManager.TRAVAILOBJET = true; + _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[newInventoryItem]; + _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; + _vm->_objectsManager.OPTI_OBJET(); + _vm->_scriptManager.TRAVAILOBJET = false; + + if (_vm->_soundManager._voiceOffFl) { + do + _vm->_eventsManager.VBL(); + while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); + _vm->_fontManager.hideText(9); + } + if (_vm->_globals._exitId) { + if (_vm->_globals._exitId == 2) { _vm->_globals._exitId = 0; - if (!v20) { - _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); - _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); - goto LABEL_7; - } - } else if (!v20) { - _inventDisplayedFl = true; + break; } - } + + _vm->_globals._exitId = 0; + _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); + _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + goto LABEL_7; + } else + _inventDisplayedFl = true; } if (_removeInventFl) - v20 = true; - if (v20) break; _vm->_eventsManager.VBL(); if (_vm->_globals._screenId >= 35 && _vm->_globals._screenId <= 40) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1a339115e9..f16f54abbc 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -389,7 +389,6 @@ void Globals::INIT_ANIM() { Bank[idx]._loadedFl = false; Bank[idx]._filename = ""; Bank[idx]._fileHeader = 0; - Bank[idx].field1C = 0; } } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7c9d16a951..44fedf2561 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -70,7 +70,6 @@ struct BankItem { Common::String _filename; int _fileHeader; int field1A; - uint32 field1C; }; struct ListeItem { -- cgit v1.2.3 From ba3453ac9aac31d5a71526a62d8e38c0ec8c7264 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Jan 2013 16:27:08 +0100 Subject: HOPKINS: Remove one more label --- engines/hopkins/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 231ef2e885..20f18c1781 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1606,7 +1606,6 @@ void ObjectsManager::GOHOME() { } } } -LABEL_241: _vm->_globals.Compteur = 0; return; } @@ -1948,7 +1947,8 @@ LABEL_153: } } } - goto LABEL_241; + _vm->_globals.Compteur = 0; + return; } if (_vm->_globals.g_old_sens != nouveau_sens) break; -- cgit v1.2.3 From a75055a92300069a18ec0818feee729c77088264 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Jan 2013 18:20:24 +0100 Subject: HOPKINS: Some refactoring in ObjectsManager --- engines/hopkins/objects.cpp | 100 ++++++++++---------------------------------- 1 file changed, 21 insertions(+), 79 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 20f18c1781..2476083050 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -711,14 +711,10 @@ void ObjectsManager::CALCUL_BOB(int idx) { else deltaX = -_vm->_graphicsManager.zoomIn(deltaX, v21); - if (deltaY >= 0) { + if (deltaY >= 0) deltaY = _vm->_graphicsManager.zoomIn(deltaY, v21); - } else { - deltaY = deltaX; - if (deltaX < 0) - deltaY = -deltaX; - deltaY = -_vm->_graphicsManager.zoomIn(deltaY, v21); - } + else + deltaY = -_vm->_graphicsManager.zoomIn(abs(deltaX), v21); } if (v20) { @@ -727,14 +723,10 @@ void ObjectsManager::CALCUL_BOB(int idx) { else deltaX = -_vm->_graphicsManager.zoomOut(-deltaX, v20); - if (deltaY >= 0) { + if (deltaY >= 0) deltaY = _vm->_graphicsManager.zoomOut(deltaY, v20); - } else { - if (deltaX < 0) - deltaY = -_vm->_graphicsManager.zoomOut(-deltaX, v20); - else - deltaY = -_vm->_graphicsManager.zoomOut(deltaX, v20); - } + else + deltaY = -_vm->_graphicsManager.zoomOut(abs(deltaX), v20); } int v13 = _vm->_globals._bob[idx]._xp - deltaX; @@ -912,12 +904,8 @@ void ObjectsManager::computeSprite(int idx) { if (tmpY >= 0) { deltaY = _vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } else { - if (tmpX < 0) - tmpY = -tmpX; - else - tmpY = tmpX; - - deltaY = -_vm->_graphicsManager.zoomIn(tmpY, zoomPercent); + tmpY = abs(tmpX); + deltaY = -_vm->_graphicsManager.zoomIn(abs(tmpX), zoomPercent); } } else if (reducePercent) { if (tmpX >= 0) @@ -928,12 +916,8 @@ void ObjectsManager::computeSprite(int idx) { if (tmpY >= 0) { deltaY = _vm->_graphicsManager.zoomOut(tmpY, reducePercent); } else { - if (tmpX < 0) - tmpY = -tmpX; - else - tmpY = tmpX; - - deltaY = -_vm->_graphicsManager.zoomOut(tmpY, reducePercent); + tmpY = abs(tmpX); + deltaY = -_vm->_graphicsManager.zoomOut(abs(tmpX), reducePercent); } } @@ -1486,20 +1470,10 @@ void ObjectsManager::GOHOME() { int16 v1; int16 v3; int16 v4; - unsigned int v5; - unsigned int v6; - unsigned int v7; - unsigned int v8; int16 v9; int16 v10; - unsigned int v11; - unsigned int v12; - unsigned int v13; - unsigned int v14; int v15; int16 v16; - unsigned int v17; - unsigned int v18; int v19; int16 v20; unsigned int v21; @@ -1618,24 +1592,12 @@ void ObjectsManager::GOHOME() { v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0].fieldC < 0) { - v5 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v5 = -_sprite[0].fieldC; - v3 = _vm->_graphicsManager.zoomOut(v3, v5); - v6 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v6 = -_sprite[0].fieldC; - v4 = _vm->_graphicsManager.zoomOut(v4, v6); + v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0].fieldC); + v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0].fieldC); } if (_sprite[0].fieldC > 0) { - v7 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v7 = -_sprite[0].fieldC; - v3 = _vm->_graphicsManager.zoomIn(v3, v7); - v8 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v8 = -_sprite[0].fieldC; - v4 = _vm->_graphicsManager.zoomIn(v4, v8); + v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0].fieldC); + v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0].fieldC); } v0 = v3 + g_old_x; v58 = g_old_y + v4; @@ -1656,24 +1618,12 @@ LABEL_23: v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0].fieldC < 0) { - v11 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v11 = -_sprite[0].fieldC; - v9 = _vm->_graphicsManager.zoomOut(v9, v11); - v12 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v12 = -_sprite[0].fieldC; - v10 = _vm->_graphicsManager.zoomOut(v10, v12); + v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0].fieldC); + v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0].fieldC); } if (_sprite[0].fieldC > 0) { - v13 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v13 = -_sprite[0].fieldC; - v9 = _vm->_graphicsManager.zoomIn(v9, v13); - v14 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v14 = -_sprite[0].fieldC; - v10 = _vm->_graphicsManager.zoomIn(v10, v14); + v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0].fieldC); + v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0].fieldC); } v0 = g_old_x - v9; v58 = g_old_y - v10; @@ -1691,21 +1641,13 @@ LABEL_43: v0 = g_old_x; v58 = g_old_y; } else { - v15 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (v15 < 0) - v15 = -v15; + v15 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); v16 = v15; if (_sprite[0].fieldC < 0) { - v17 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v17 = -_sprite[0].fieldC; - v16 = _vm->_graphicsManager.zoomOut(v16, v17); + v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0].fieldC); } if (_sprite[0].fieldC > 0) { - v18 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v18 = -_sprite[0].fieldC; - v16 = _vm->_graphicsManager.zoomIn(v16, v18); + v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0].fieldC); } v0 = g_old_x; v58 = g_old_y - v16; -- cgit v1.2.3 From a743857b87bd6e7cec47c231943d3e8cef254ebf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Jan 2013 11:01:26 +0100 Subject: HOPKINS: (Courtesy of Eriktorbjorn) slight optimisation of the sound code --- engines/hopkins/sound.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 9fb45fa9fe..4da7bdac15 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -73,6 +73,7 @@ public: _cueSheet.clear(); _cueStream = NULL; _cue = 0; + _loadedCue = -1; for (;;) { char buf[3]; @@ -134,8 +135,14 @@ public: protected: bool loadCue(int nr) { + if (_loadedCue == _cueSheet[nr]) { + _cueStream->rewind(); + return true; + } + delete _cueStream; _cueStream = NULL; + _loadedCue = _cueSheet[nr]; Common::String filename = Common::String::format("%s_%02d", _name.c_str(), _cueSheet[nr]); Common::File *file = new Common::File(); @@ -151,6 +158,7 @@ protected: } warning("TwaAudioStream::loadCue: Missing cue %d (%s)", nr, filename.c_str()); + _loadedCue = -1; delete file; return false; } @@ -158,8 +166,9 @@ protected: private: Common::String _name; Common::Array _cueSheet; - Audio::AudioStream *_cueStream; + Audio::RewindableAudioStream *_cueStream; uint _cue; + int _loadedCue; }; Audio::AudioStream *makeTwaStream(Common::String name, Common::SeekableReadStream *stream) { -- cgit v1.2.3 From dd7676a37edc5404bdccdfcac386c6a79ab6f23e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Jan 2013 19:56:04 +0100 Subject: HOPKINS: Fix regression in Bomb display. This was caused by the use of the wrong sprite file (two files with the same name) --- engines/hopkins/hopkins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 7ab2e91785..a04081705b 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1630,11 +1630,11 @@ void HopkinsEngine::initializeSystem() { const Common::FSNode gameDataDir(ConfMan.get("path")); SearchMan.addSubDirectoryMatching(gameDataDir, "SYSTEM"); + SearchMan.addSubDirectoryMatching(gameDataDir, "LINK"); SearchMan.addSubDirectoryMatching(gameDataDir, "BUFFER"); SearchMan.addSubDirectoryMatching(gameDataDir, "ANIM"); SearchMan.addSubDirectoryMatching(gameDataDir, "ANM"); SearchMan.addSubDirectoryMatching(gameDataDir, "BASE"); - SearchMan.addSubDirectoryMatching(gameDataDir, "LINK"); SearchMan.addSubDirectoryMatching(gameDataDir, "MUSIC"); SearchMan.addSubDirectoryMatching(gameDataDir, "SEQ"); SearchMan.addSubDirectoryMatching(gameDataDir, "SAVE"); -- cgit v1.2.3 From 6856556a1a30c3b6b3039077adc47bf727b719fc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Jan 2013 23:10:06 +0100 Subject: HOPKINS: Fix regression in 5a961b104fb22ce1c32f46a112a185c1fc08b45c. Thanks to Eriktorbjorn for the analysis of the issue --- engines/hopkins/objects.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2476083050..7ca01203ef 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3426,13 +3426,16 @@ void ObjectsManager::initBorder(int zoneIdx) { * Get next icon for an object in the inventory */ void ObjectsManager::nextObjectIcon(int idx) { - if (_vm->_eventsManager._mouseCursorId == 0 || _vm->_eventsManager._mouseCursorId == 16 || _vm->_eventsManager._mouseCursorId == 3 || - _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 7) + if (_vm->_eventsManager._mouseCursorId == 0 || _vm->_eventsManager._mouseCursorId == 2 || + _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16) return; int nextCursorId = _vm->_eventsManager._mouseCursorId + 1; + if (nextCursorId > 25) + nextCursorId = 6; + do { - if (nextCursorId == 6) { + if (nextCursorId == 2 || nextCursorId == 5 || nextCursorId == 6) { _vm->_eventsManager._mouseCursorId = 6; if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field2 == 1) return; @@ -3457,7 +3460,6 @@ void ObjectsManager::nextObjectIcon(int idx) { if (nextCursorId == 11) { _vm->_eventsManager._mouseCursorId = 11; - ++_vm->_eventsManager._mouseCursorId; if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field4 == 1) return; nextCursorId++; @@ -3481,6 +3483,11 @@ void ObjectsManager::nextObjectIcon(int idx) { _vm->_eventsManager._mouseCursorId = 23; if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 2) return; + nextCursorId = 24; + } + + if (nextCursorId == 24 || nextCursorId == 25) { + _vm->_eventsManager._mouseCursorId = 25; } nextCursorId = 6; -- cgit v1.2.3 From 65c61ab6d7958ee91328d470cb97127bf2ca986d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Jan 2013 07:52:24 +0100 Subject: HOPKINS: Add synchronization of car position on the city map --- engines/hopkins/globals.h | 2 ++ engines/hopkins/saveload.cpp | 19 ++++++++++++++++--- engines/hopkins/saveload.h | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 44fedf2561..2aacfbbb5e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -284,6 +284,8 @@ struct Sauvegarde { CharacterLocation _realHopkins; CharacterLocation _samantha; int16 _inventory[35]; // Originally at offset 1300 of data array + int16 PLANX; + int16 PLANY; }; struct CreditItem { diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index bed7a0d6b6..179145d20d 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -146,6 +146,9 @@ Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName for (int i = 0; i < 35; ++i) _vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i]; + _vm->_globals._saveData->PLANX = _vm->_globals.PLANX; + _vm->_globals._saveData->PLANY = _vm->_globals.PLANY; + /* Create the savegame */ Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot)); if (!savefile) @@ -161,7 +164,7 @@ Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName writeSavegameHeader(savefile, header); // Write out the savegame data - syncSavegameData(serializer); + syncSavegameData(serializer, header._version); // Save file complete savefile->finalize(); @@ -188,7 +191,7 @@ Common::Error SaveLoadManager::loadGame(int slot) { delete header._thumbnail; // Read in the savegame data - syncSavegameData(serializer); + syncSavegameData(serializer, header._version); // Loading save file complete delete savefile; @@ -202,6 +205,8 @@ Common::Error SaveLoadManager::loadGame(int slot) { _vm->_globals._exitId = _vm->_globals._saveData->data[svField5]; _vm->_globals._saveData->data[svField6] = 0; _vm->_globals._screenId = 0; + _vm->_globals.PLANX = _vm->_globals._saveData->PLANX; + _vm->_globals.PLANY = _vm->_globals._saveData->PLANY; return Common::kNoError; } @@ -251,7 +256,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { thumb8.free(); } -void SaveLoadManager::syncSavegameData(Common::Serializer &s) { +void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { s.syncBytes(&_vm->_globals._saveData->data[0], 2050); syncCharacterLocation(s, _vm->_globals._saveData->_cloneHopkins); syncCharacterLocation(s, _vm->_globals._saveData->_realHopkins); @@ -259,6 +264,14 @@ void SaveLoadManager::syncSavegameData(Common::Serializer &s) { for (int i = 0; i < 35; ++i) s.syncAsSint16LE(_vm->_globals._saveData->_inventory[i]); + + if (version > 1) { + s.syncAsSint16LE(_vm->_globals._saveData->PLANX); + s.syncAsSint16LE(_vm->_globals._saveData->PLANY); + } else { + _vm->_globals._saveData->PLANX = _vm->_globals._saveData->PLANY = 0; + } + } void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLocation &item) { diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index c2e9488223..b4cdf8ed02 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -33,7 +33,7 @@ namespace Hopkins { class HopkinsEngine; -#define HOPKINS_SAVEGAME_VERSION 1 +#define HOPKINS_SAVEGAME_VERSION 2 struct hopkinsSavegameHeader { uint8 _version; @@ -49,7 +49,7 @@ private: HopkinsEngine *_vm; void createThumbnail(Graphics::Surface *s); - void syncSavegameData(Common::Serializer &s); + void syncSavegameData(Common::Serializer &s, int version); void syncCharacterLocation(Common::Serializer &s, CharacterLocation &item); public: void setParent(HopkinsEngine *vm); -- cgit v1.2.3 From 75ba8bfb88a8e62a588747184fa341d20b52fa79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Jan 2013 07:58:06 +0100 Subject: HOPKINS: Rename car related fields, remove map car sprite index --- engines/hopkins/globals.cpp | 3 +-- engines/hopkins/globals.h | 7 +++---- engines/hopkins/hopkins.cpp | 6 +++--- engines/hopkins/objects.cpp | 16 +++++++--------- engines/hopkins/saveload.cpp | 14 +++++++------- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f16f54abbc..b4a6d7953d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -135,8 +135,7 @@ Globals::Globals() { _catalogSize = 0; iRegul = 0; _exitId = 0; - PLANX = PLANY = 0; - PLANI = 0; + _mapCarPosX = _mapCarPosY = 0; PERSO = 0; _screenId = 0; _prevScreenId = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 2aacfbbb5e..dce74b14e0 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -284,8 +284,8 @@ struct Sauvegarde { CharacterLocation _realHopkins; CharacterLocation _samantha; int16 _inventory[35]; // Originally at offset 1300 of data array - int16 PLANX; - int16 PLANY; + int16 _mapCarPosX; + int16 _mapCarPosY; }; struct CreditItem { @@ -372,8 +372,7 @@ public: uint32 _catalogSize; int iRegul; int _exitId; - int PLANX, PLANY; - int PLANI; + int _mapCarPosX, _mapCarPosY; int _screenId; int _prevScreenId; int Max_Propre; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a04081705b..1097b31b40 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -179,7 +179,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.iRegul = 1; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; - _globals.PLANX = _globals.PLANY = 0; + _globals._mapCarPosX = _globals._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -473,7 +473,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.iRegul = 0; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; - _globals.PLANX = _globals.PLANY = 0; + _globals._mapCarPosX = _globals._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -831,7 +831,7 @@ bool HopkinsEngine::runFull() { _globals.iRegul = 0; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; - _globals.PLANX = _globals.PLANY = 0; + _globals._mapCarPosX = _globals._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; for (;;) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7ca01203ef..3dbe129705 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2192,13 +2192,12 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals.CACHE_OFF(20); _vm->_globals.CACHE_ON(); - if (!_vm->_globals.PLANX && !_vm->_globals.PLANY) { - _vm->_globals.PLANX = 900; - _vm->_globals.PLANY = 319; - _vm->_globals.PLANI = 1; + if (!_vm->_globals._mapCarPosX && !_vm->_globals._mapCarPosY) { + _vm->_globals._mapCarPosX = 900; + _vm->_globals._mapCarPosY = 319; } - addStaticSprite(_spritePtr, Common::Point(_vm->_globals.PLANX, _vm->_globals.PLANY), 0, _vm->_globals.PLANI, 0, 0, 5, 5); - _vm->_eventsManager.setMouseXY(_vm->_globals.PLANX, _vm->_globals.PLANY); + addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, 0, 5, 5); + _vm->_eventsManager.setMouseXY(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY); my_anim = 0; _vm->_eventsManager.mouseOn(); _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); @@ -2256,9 +2255,8 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.fadeOutLong(); _vm->_globals.iRegul = 0; _vm->_graphicsManager._noFadingFl = false; - _vm->_globals.PLANX = getSpriteX(0); - _vm->_globals.PLANY = getSpriteY(0); - _vm->_globals.PLANI = 1; + _vm->_globals._mapCarPosX = getSpriteX(0); + _vm->_globals._mapCarPosY = getSpriteY(0); removeSprite(0); _spritePtr = _vm->_globals.freeMemory(_spritePtr); clearScreen(); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 179145d20d..35d52005bb 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -146,8 +146,8 @@ Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName for (int i = 0; i < 35; ++i) _vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i]; - _vm->_globals._saveData->PLANX = _vm->_globals.PLANX; - _vm->_globals._saveData->PLANY = _vm->_globals.PLANY; + _vm->_globals._saveData->_mapCarPosX = _vm->_globals._mapCarPosX; + _vm->_globals._saveData->_mapCarPosY = _vm->_globals._mapCarPosY; /* Create the savegame */ Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot)); @@ -205,8 +205,8 @@ Common::Error SaveLoadManager::loadGame(int slot) { _vm->_globals._exitId = _vm->_globals._saveData->data[svField5]; _vm->_globals._saveData->data[svField6] = 0; _vm->_globals._screenId = 0; - _vm->_globals.PLANX = _vm->_globals._saveData->PLANX; - _vm->_globals.PLANY = _vm->_globals._saveData->PLANY; + _vm->_globals._mapCarPosX = _vm->_globals._saveData->_mapCarPosX; + _vm->_globals._mapCarPosY = _vm->_globals._saveData->_mapCarPosY; return Common::kNoError; } @@ -266,10 +266,10 @@ void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { s.syncAsSint16LE(_vm->_globals._saveData->_inventory[i]); if (version > 1) { - s.syncAsSint16LE(_vm->_globals._saveData->PLANX); - s.syncAsSint16LE(_vm->_globals._saveData->PLANY); + s.syncAsSint16LE(_vm->_globals._saveData->_mapCarPosX); + s.syncAsSint16LE(_vm->_globals._saveData->_mapCarPosY); } else { - _vm->_globals._saveData->PLANX = _vm->_globals._saveData->PLANY = 0; + _vm->_globals._saveData->_mapCarPosX = _vm->_globals._saveData->_mapCarPosY = 0; } } -- cgit v1.2.3 From ec2feb4aeca0009a0b70a094565a0b464280a899 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Jan 2013 08:04:38 +0100 Subject: HOPKINS: Rename old Direction fields --- engines/hopkins/globals.cpp | 8 +++--- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 70 ++++++++++++++++++++++----------------------- engines/hopkins/script.cpp | 12 ++++---- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index b4a6d7953d..71f1c8711c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -113,14 +113,14 @@ Globals::Globals() { for (int i = 0; i < 51; ++i) Common::fill((byte *)&_sortedDisplay[i], (byte *)&_sortedDisplay[i] + sizeof(SortItem), 0); - // Initialise fields + // Initialize fields _language = LANG_EN; PUBEXIT = false; _speed = 1; g_old_anim = 0; - g_old_sens = 0; - g_old_sens2 = 0; + _oldDirection = 0; + _oldDirectionSpriteIdx = 59; _lastDirection = 0; police_l = police_h = 0; TETE = NULL; @@ -374,7 +374,7 @@ void Globals::loadCharacterData() { } g_old_anim = -1; - g_old_sens = -1; + _oldDirection = -1; } void Globals::INIT_ANIM() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index dce74b14e0..b1c7218985 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -337,7 +337,7 @@ public: Common::String FICH_TEXTE; bool _censorshipFl; int g_old_anim; - int g_old_sens, g_old_sens2; + int _oldDirection, _oldDirectionSpriteIdx; int _lastDirection; byte *police; int police_l; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3dbe129705..a6f1b641cd 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1527,7 +1527,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 0; - if (_vm->_globals.g_old_sens == -1) { + if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); nouveau_x = *_vm->_globals.chemin; _vm->_globals.chemin++; @@ -1542,13 +1542,13 @@ void ObjectsManager::GOHOME() { _vm->_globals.chemin++; if (nouveau_x != -1 || nouveau_y != -1) { - _vm->_globals.g_old_sens = nouveau_sens; - _vm->_globals.g_old_sens2 = nouveau_sens; + _vm->_globals._oldDirection = nouveau_sens; + _vm->_globals._oldDirectionSpriteIdx = nouveau_sens + 59; _vm->_globals.g_old_anim = 0; g_old_x = nouveau_x; g_old_y = nouveau_y; } else { - setSpriteIndex(0, _vm->_globals.g_old_sens + 59); + setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; if (_vm->_globals.GOACTION) v54 = _vm->_globals._saveData->data[svField2]; @@ -1559,7 +1559,7 @@ void ObjectsManager::GOHOME() { setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; if (v54 > 0) { v55 = v54; if (_vm->_globals.ZONEP[v55]._destX) { @@ -1583,7 +1583,7 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; return; } - if (_vm->_globals.g_old_sens == 3) { + if (_vm->_globals._oldDirection == 3) { if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { v0 = g_old_x; v58 = g_old_y; @@ -1609,7 +1609,7 @@ void ObjectsManager::GOHOME() { LABEL_23: _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals.g_old_sens != 7) + if (_vm->_globals._oldDirection != 7) goto LABEL_43; if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { v0 = g_old_x; @@ -1635,7 +1635,7 @@ LABEL_23: LABEL_42: _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_43: - if (_vm->_globals.g_old_sens != 1) + if (_vm->_globals._oldDirection != 1) goto LABEL_60; if (_vm->_globals.g_old_anim > 11) { v0 = g_old_x; @@ -1659,7 +1659,7 @@ LABEL_43: LABEL_59: _vm->_globals.Compteur = 4 / _vm->_globals._speed; LABEL_60: - if (_vm->_globals.g_old_sens != 5) + if (_vm->_globals._oldDirection != 5) goto LABEL_77; if (_vm->_globals.g_old_anim < 48 || _vm->_globals.g_old_anim > 59) { v0 = g_old_x; @@ -1689,7 +1689,7 @@ LABEL_60: LABEL_76: _vm->_globals.Compteur = 4 / _vm->_globals._speed; LABEL_77: - if (_vm->_globals.g_old_sens != 2) + if (_vm->_globals._oldDirection != 2) goto LABEL_96; if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { v0 = g_old_x; @@ -1727,7 +1727,7 @@ LABEL_77: LABEL_95: _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_96: - if (_vm->_globals.g_old_sens != 8) + if (_vm->_globals._oldDirection != 8) goto LABEL_115; if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { v0 = g_old_x; @@ -1765,7 +1765,7 @@ LABEL_96: LABEL_114: _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_115: - if (_vm->_globals.g_old_sens != 4) + if (_vm->_globals._oldDirection != 4) goto LABEL_134; if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { v0 = g_old_x; @@ -1803,7 +1803,7 @@ LABEL_115: LABEL_133: _vm->_globals.Compteur = 5 / _vm->_globals._speed; LABEL_134: - if (_vm->_globals.g_old_sens != 6) + if (_vm->_globals._oldDirection != 6) goto LABEL_153; if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { v0 = g_old_x; @@ -1860,13 +1860,13 @@ LABEL_153: v49 = _vm->_globals._saveData->data[svField2]; else v49 = _zoneNum; - setSpriteIndex(0, _vm->_globals.g_old_sens + 59); + setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); @@ -1892,37 +1892,37 @@ LABEL_153: _vm->_globals.Compteur = 0; return; } - if (_vm->_globals.g_old_sens != nouveau_sens) + if (_vm->_globals._oldDirection != nouveau_sens) break; - if ((nouveau_sens == 3 && nouveau_x >= v0) || (_vm->_globals.g_old_sens == 7 && nouveau_x <= v0) || - (_vm->_globals.g_old_sens == 1 && nouveau_y <= v58) || (_vm->_globals.g_old_sens == 5 && nouveau_y >= v58) || - (_vm->_globals.g_old_sens == 2 && nouveau_x >= v0) || (_vm->_globals.g_old_sens == 8 && nouveau_x <= v0) || - (_vm->_globals.g_old_sens == 4 && nouveau_x >= v0) || (_vm->_globals.g_old_sens == 6 && nouveau_x <= v0)) + if ((nouveau_sens == 3 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 7 && nouveau_x <= v0) || + (_vm->_globals._oldDirection == 1 && nouveau_y <= v58) || (_vm->_globals._oldDirection == 5 && nouveau_y >= v58) || + (_vm->_globals._oldDirection == 2 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 8 && nouveau_x <= v0) || + (_vm->_globals._oldDirection == 4 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 6 && nouveau_x <= v0)) v47 = 1; } while (v47 != 1); if (v47 == 1) { computeAndSetSpriteSize(); - if ((_vm->_globals.g_old_sens == 6) || (_vm->_globals.g_old_sens == 7) || (_vm->_globals.g_old_sens == 8)) + if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) setFlipSprite(0, true); - if ((_vm->_globals.g_old_sens == 1) || (_vm->_globals.g_old_sens == 2) || (_vm->_globals.g_old_sens == 3) || - (_vm->_globals.g_old_sens == 4) || (_vm->_globals.g_old_sens == 5)) + if ((_vm->_globals._oldDirection == 1) || (_vm->_globals._oldDirection == 2) || (_vm->_globals._oldDirection == 3) || + (_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5)) setFlipSprite(0, false); setSpriteX(0, nouveau_x); setSpriteY(0, nouveau_y); setSpriteIndex(0, v1); } else { - if ((_vm->_globals.g_old_sens == 6) || (_vm->_globals.g_old_sens == 7) || (_vm->_globals.g_old_sens == 8)) + if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) setFlipSprite(0, true); - if ((_vm->_globals.g_old_sens == 1) || (_vm->_globals.g_old_sens == 2) || (_vm->_globals.g_old_sens == 3) || - (_vm->_globals.g_old_sens == 4) || (_vm->_globals.g_old_sens == 5)) + if ((_vm->_globals._oldDirection == 1) || (_vm->_globals._oldDirection == 2) || (_vm->_globals._oldDirection == 3) || + (_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5)) setFlipSprite(0, false); _vm->_globals.Compteur = 0; } - _vm->_globals.g_old_sens = nouveau_sens; - _vm->_globals.g_old_sens2 = nouveau_sens; + _vm->_globals._oldDirection = nouveau_sens; + _vm->_globals._oldDirectionSpriteIdx = nouveau_sens + 59; _vm->_globals.g_old_anim = v1; g_old_x = nouveau_x; g_old_y = nouveau_y; @@ -2382,19 +2382,19 @@ LABEL_38: g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) { - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; goto LABEL_65; } goto LABEL_63; } _vm->_globals.chemin = (int16 *)g_PTRNUL; - setSpriteIndex(0, _vm->_globals.g_old_sens2 + 59); + setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; goto LABEL_65; } if (!_vm->_globals.NOMARCHE) { @@ -2409,7 +2409,7 @@ LABEL_38: g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; else LABEL_63: _vm->_globals.chemin = v9; @@ -2591,7 +2591,7 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _changeVerbFl = false; _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; my_anim = 1; A_ANIM = 0; MA_ANIM = 0; @@ -4763,7 +4763,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo stopBobAnimation(3); _vm->_globals.NOT_VERIF = true; g_old_x = getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; v7 = getSpriteY(0); @@ -4885,7 +4885,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_eventsManager._mouseSpriteId = 4; g_old_x = _characterPos.x; g_old_y = _characterPos.y; - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; for (int idx = 0; idx < 5; ++idx) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3c1c8d080f..d90ae76b75 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -948,7 +948,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 59: { _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; int v16 = _vm->_objectsManager.getSpriteY(0); @@ -1050,7 +1050,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 81: { _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; int v22 = _vm->_objectsManager.getSpriteY(0); @@ -1368,7 +1368,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 105: _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals._saveData->data[svField253] == 1) { @@ -1621,7 +1621,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; @@ -1651,7 +1651,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOPARLE = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; @@ -1961,7 +1961,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.g_old_sens = -1; + _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; -- cgit v1.2.3 From 6d7de8262323c20f6118a3fe3897e307af556179 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Jan 2013 19:24:25 +0100 Subject: HOPKINS: Get rid of GOTOs in GOHOME --- engines/hopkins/objects.cpp | 444 +++++++++++++++++++++----------------------- 1 file changed, 214 insertions(+), 230 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a6f1b641cd..e6792cf103 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1587,6 +1587,7 @@ void ObjectsManager::GOHOME() { if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { v0 = g_old_x; v58 = g_old_y; + v1 = 24; } else { v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; @@ -1594,253 +1595,236 @@ void ObjectsManager::GOHOME() { if (_sprite[0].fieldC < 0) { v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0].fieldC); v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0].fieldC); - } - if (_sprite[0].fieldC > 0) { + } else if (_sprite[0].fieldC > 0) { v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0].fieldC); v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0].fieldC); } v0 = v3 + g_old_x; v58 = g_old_y + v4; v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 35) - goto LABEL_23; + if (v1 > 35) + v1 = 24; } - v1 = 24; -LABEL_23: _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection != 7) - goto LABEL_43; - if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0].fieldC); - v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0].fieldC); - } - if (_sprite[0].fieldC > 0) { - v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0].fieldC); - v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0].fieldC); - } - v0 = g_old_x - v9; - v58 = g_old_y - v10; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 35) - goto LABEL_42; - } - v1 = 24; -LABEL_42: - _vm->_globals.Compteur = 5 / _vm->_globals._speed; -LABEL_43: - if (_vm->_globals._oldDirection != 1) - goto LABEL_60; - if (_vm->_globals.g_old_anim > 11) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v15 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); - v16 = v15; - if (_sprite[0].fieldC < 0) { - v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0].fieldC); - } - if (_sprite[0].fieldC > 0) { - v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0].fieldC); + if (_vm->_globals._oldDirection == 7) { + if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 24; + } else { + v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_sprite[0].fieldC < 0) { + v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0].fieldC); + v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0].fieldC); + } + if (_sprite[0].fieldC > 0) { + v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0].fieldC); + v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0].fieldC); + } + v0 = g_old_x - v9; + v58 = g_old_y - v10; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 35) + v1 = 24; } - v0 = g_old_x; - v58 = g_old_y - v16; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 11) - goto LABEL_59; + _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - v1 = 0; -LABEL_59: - _vm->_globals.Compteur = 4 / _vm->_globals._speed; -LABEL_60: - if (_vm->_globals._oldDirection != 5) - goto LABEL_77; - if (_vm->_globals.g_old_anim < 48 || _vm->_globals.g_old_anim > 59) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v19 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); - v20 = v19; - if (_sprite[0].fieldC < 0) { - v21 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v21 = -_sprite[0].fieldC; - v20 = _vm->_graphicsManager.zoomOut(v20, v21); - } - if (_sprite[0].fieldC > 0) { - v22 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v22 = -_sprite[0].fieldC; - v20 = _vm->_graphicsManager.zoomIn(v20, v22); - } - v0 = g_old_x; - v58 = v20 + g_old_y; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 59) - goto LABEL_76; - } - v1 = 48; -LABEL_76: - _vm->_globals.Compteur = 4 / _vm->_globals._speed; -LABEL_77: - if (_vm->_globals._oldDirection != 2) - goto LABEL_96; - if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v25 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v25 = -_sprite[0].fieldC; - v23 = _vm->_graphicsManager.zoomOut(v23, v25); - v26 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v26 = -_sprite[0].fieldC; - v24 = _vm->_graphicsManager.zoomOut(v24, v26); - } - if (_sprite[0].fieldC > 0) { - v27 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v27 = -_sprite[0].fieldC; - v23 = _vm->_graphicsManager.zoomIn(v23, v27); - v28 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v28 = -_sprite[0].fieldC; - v24 = _vm->_graphicsManager.zoomIn(v24, v28); - } - v0 = v23 + g_old_x; - v58 = g_old_y + v24; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 23) - goto LABEL_95; - } - v1 = 12; -LABEL_95: - _vm->_globals.Compteur = 5 / _vm->_globals._speed; -LABEL_96: - if (_vm->_globals._oldDirection != 8) - goto LABEL_115; - if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v31 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v31 = -_sprite[0].fieldC; - v29 = _vm->_graphicsManager.zoomOut(v29, v31); - v32 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v32 = -_sprite[0].fieldC; - v30 = _vm->_graphicsManager.zoomOut(v30, v32); + if (_vm->_globals._oldDirection == 1) { + if (_vm->_globals.g_old_anim > 11) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 0; + } else { + v15 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + v16 = v15; + if (_sprite[0].fieldC < 0) { + v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0].fieldC); + } + if (_sprite[0].fieldC > 0) { + v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0].fieldC); + } + v0 = g_old_x; + v58 = g_old_y - v16; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 11) + v1 = 0; } - if (_sprite[0].fieldC > 0) { - v33 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v33 = -_sprite[0].fieldC; - v29 = _vm->_graphicsManager.zoomIn(v29, v33); - v34 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v34 = -_sprite[0].fieldC; - v30 = _vm->_graphicsManager.zoomIn(v30, v34); + _vm->_globals.Compteur = 4 / _vm->_globals._speed; + } + + if (_vm->_globals._oldDirection == 5) { + if (_vm->_globals.g_old_anim < 48 || _vm->_globals.g_old_anim > 59) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 48; + } else { + v19 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + v20 = v19; + if (_sprite[0].fieldC < 0) { + v21 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v21 = -_sprite[0].fieldC; + v20 = _vm->_graphicsManager.zoomOut(v20, v21); + } + if (_sprite[0].fieldC > 0) { + v22 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v22 = -_sprite[0].fieldC; + v20 = _vm->_graphicsManager.zoomIn(v20, v22); + } + v0 = g_old_x; + v58 = v20 + g_old_y; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 59) + v1 = 48; } - v0 = g_old_x - v29; - v58 = g_old_y + v30; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 23) - goto LABEL_114; - } - v1 = 12; -LABEL_114: - _vm->_globals.Compteur = 5 / _vm->_globals._speed; -LABEL_115: - if (_vm->_globals._oldDirection != 4) - goto LABEL_134; - if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v37 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v37 = -_sprite[0].fieldC; - v35 = _vm->_graphicsManager.zoomOut(v35, v37); - v38 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v38 = -_sprite[0].fieldC; - v36 = _vm->_graphicsManager.zoomOut(v36, v38); + _vm->_globals.Compteur = 4 / _vm->_globals._speed; + } + if (_vm->_globals._oldDirection == 2) { + if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 12; + } else { + v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_sprite[0].fieldC < 0) { + v25 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v25 = -_sprite[0].fieldC; + v23 = _vm->_graphicsManager.zoomOut(v23, v25); + v26 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v26 = -_sprite[0].fieldC; + v24 = _vm->_graphicsManager.zoomOut(v24, v26); + } + if (_sprite[0].fieldC > 0) { + v27 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v27 = -_sprite[0].fieldC; + v23 = _vm->_graphicsManager.zoomIn(v23, v27); + v28 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v28 = -_sprite[0].fieldC; + v24 = _vm->_graphicsManager.zoomIn(v24, v28); + } + v0 = v23 + g_old_x; + v58 = g_old_y + v24; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 23) + v1 = 12; } - if (_sprite[0].fieldC > 0) { - v39 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v39 = -_sprite[0].fieldC; - v35 = _vm->_graphicsManager.zoomIn(v35, v39); - v40 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v40 = -_sprite[0].fieldC; - v36 = _vm->_graphicsManager.zoomIn(v36, v40); + _vm->_globals.Compteur = 5 / _vm->_globals._speed; + } + if (_vm->_globals._oldDirection == 8) { + if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 12; + } else { + v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_sprite[0].fieldC < 0) { + v31 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v31 = -_sprite[0].fieldC; + v29 = _vm->_graphicsManager.zoomOut(v29, v31); + v32 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v32 = -_sprite[0].fieldC; + v30 = _vm->_graphicsManager.zoomOut(v30, v32); + } else if (_sprite[0].fieldC > 0) { + v33 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v33 = -_sprite[0].fieldC; + v29 = _vm->_graphicsManager.zoomIn(v29, v33); + v34 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v34 = -_sprite[0].fieldC; + v30 = _vm->_graphicsManager.zoomIn(v30, v34); + } + v0 = g_old_x - v29; + v58 = g_old_y + v30; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 23) + v1 = 12; } - v0 = v35 + g_old_x; - v58 = g_old_y + v36; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 47) - goto LABEL_133; - } - v1 = 36; -LABEL_133: - _vm->_globals.Compteur = 5 / _vm->_globals._speed; -LABEL_134: - if (_vm->_globals._oldDirection != 6) - goto LABEL_153; - if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { - v0 = g_old_x; - v58 = g_old_y; - } else { - v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v43 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v43 = -_sprite[0].fieldC; - v41 = _vm->_graphicsManager.zoomOut(v41, v43); - v44 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v44 = -_sprite[0].fieldC; - v42 = _vm->_graphicsManager.zoomOut(v42, v44); + _vm->_globals.Compteur = 5 / _vm->_globals._speed; + } + if (_vm->_globals._oldDirection == 4) { + if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 36; + } else { + v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_sprite[0].fieldC < 0) { + v37 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v37 = -_sprite[0].fieldC; + v35 = _vm->_graphicsManager.zoomOut(v35, v37); + v38 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v38 = -_sprite[0].fieldC; + v36 = _vm->_graphicsManager.zoomOut(v36, v38); + } + if (_sprite[0].fieldC > 0) { + v39 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v39 = -_sprite[0].fieldC; + v35 = _vm->_graphicsManager.zoomIn(v35, v39); + v40 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v40 = -_sprite[0].fieldC; + v36 = _vm->_graphicsManager.zoomIn(v36, v40); + } + v0 = v35 + g_old_x; + v58 = g_old_y + v36; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 47) + v1 = 36; } - if (_sprite[0].fieldC > 0) { - v45 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v45 = -_sprite[0].fieldC; - v41 = _vm->_graphicsManager.zoomIn(v41, v45); - v46 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v46 = -_sprite[0].fieldC; - v42 = _vm->_graphicsManager.zoomIn(v42, v46); + _vm->_globals.Compteur = 5 / _vm->_globals._speed; + } + if (_vm->_globals._oldDirection == 6) { + if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { + v0 = g_old_x; + v58 = g_old_y; + v1 = 36; + } else { + v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + if (_sprite[0].fieldC < 0) { + v43 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v43 = -_sprite[0].fieldC; + v41 = _vm->_graphicsManager.zoomOut(v41, v43); + v44 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v44 = -_sprite[0].fieldC; + v42 = _vm->_graphicsManager.zoomOut(v42, v44); + } + if (_sprite[0].fieldC > 0) { + v45 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v45 = -_sprite[0].fieldC; + v41 = _vm->_graphicsManager.zoomIn(v41, v45); + v46 = _sprite[0].fieldC; + if (_sprite[0].fieldC < 0) + v46 = -_sprite[0].fieldC; + v42 = _vm->_graphicsManager.zoomIn(v42, v46); + } + v0 = g_old_x - v41; + v58 = g_old_y + v42; + v1 = _vm->_globals.g_old_anim + 1; + if (v1 > 47) + v1 = 36; } - v0 = g_old_x - v41; - v58 = g_old_y + v42; - v1 = _vm->_globals.g_old_anim + 1; - if (_vm->_globals.g_old_anim != 47) - goto LABEL_152; - } - v1 = 36; -LABEL_152: - _vm->_globals.Compteur = 5 / _vm->_globals._speed; -LABEL_153: + _vm->_globals.Compteur = 5 / _vm->_globals._speed; + } v47 = 0; do { nouveau_x = *_vm->_globals.chemin; -- cgit v1.2.3 From 5ef0a5ed2c7073d47492c628ef2cc8c2ef5ca02c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Jan 2013 21:56:25 +0100 Subject: HOPKINS: Rename _newDirection --- engines/hopkins/objects.cpp | 30 +++++++++++++++--------------- engines/hopkins/objects.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e6792cf103..3dd1ba6bf1 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -88,7 +88,7 @@ ObjectsManager::ObjectsManager() { S_old_ani = 0; S_old_ret = 0; nouveau_x = nouveau_y = 0; - nouveau_sens = 0; + _newDirection = 0; nouveau_anim = 0; } @@ -1535,15 +1535,15 @@ void ObjectsManager::GOHOME() { nouveau_y = *_vm->_globals.chemin; _vm->_globals.chemin++; - nouveau_sens = *_vm->_globals.chemin; + _newDirection = *_vm->_globals.chemin; _vm->_globals.chemin++; nouveau_anim = *_vm->_globals.chemin; _vm->_globals.chemin++; if (nouveau_x != -1 || nouveau_y != -1) { - _vm->_globals._oldDirection = nouveau_sens; - _vm->_globals._oldDirectionSpriteIdx = nouveau_sens + 59; + _vm->_globals._oldDirection = _newDirection; + _vm->_globals._oldDirectionSpriteIdx = _newDirection + 59; _vm->_globals.g_old_anim = 0; g_old_x = nouveau_x; g_old_y = nouveau_y; @@ -1825,7 +1825,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - v47 = 0; + bool v47 = false; do { nouveau_x = *_vm->_globals.chemin; _vm->_globals.chemin++; @@ -1834,7 +1834,7 @@ void ObjectsManager::GOHOME() { nouveau_y = *_vm->_globals.chemin; _vm->_globals.chemin++; - nouveau_sens = *_vm->_globals.chemin; + _newDirection = *_vm->_globals.chemin; _vm->_globals.chemin++; nouveau_anim = *_vm->_globals.chemin; _vm->_globals.chemin++; @@ -1876,15 +1876,15 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; return; } - if (_vm->_globals._oldDirection != nouveau_sens) + if (_vm->_globals._oldDirection != _newDirection) break; - if ((nouveau_sens == 3 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 7 && nouveau_x <= v0) || + if ((_newDirection == 3 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 7 && nouveau_x <= v0) || (_vm->_globals._oldDirection == 1 && nouveau_y <= v58) || (_vm->_globals._oldDirection == 5 && nouveau_y >= v58) || (_vm->_globals._oldDirection == 2 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 8 && nouveau_x <= v0) || (_vm->_globals._oldDirection == 4 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 6 && nouveau_x <= v0)) - v47 = 1; - } while (v47 != 1); - if (v47 == 1) { + v47 = true; + } while (!v47); + if (v47) { computeAndSetSpriteSize(); if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) setFlipSprite(0, true); @@ -1905,8 +1905,8 @@ void ObjectsManager::GOHOME() { setFlipSprite(0, false); _vm->_globals.Compteur = 0; } - _vm->_globals._oldDirection = nouveau_sens; - _vm->_globals._oldDirectionSpriteIdx = nouveau_sens + 59; + _vm->_globals._oldDirection = _newDirection; + _vm->_globals._oldDirectionSpriteIdx = _newDirection + 59; _vm->_globals.g_old_anim = v1; g_old_x = nouveau_x; g_old_y = nouveau_y; @@ -1931,7 +1931,7 @@ void ObjectsManager::GOHOME2() { nouveau_y = *_vm->_globals.chemin; _vm->_globals.chemin++; - nouveau_sens = *_vm->_globals.chemin; + _newDirection = *_vm->_globals.chemin; _vm->_globals.chemin++; nouveau_anim = *_vm->_globals.chemin; @@ -1942,7 +1942,7 @@ void ObjectsManager::GOHOME2() { ++_vm->_globals.j_104; if (_vm->_globals.j_104 >= v0) { - _vm->_globals._lastDirection = nouveau_sens; + _vm->_globals._lastDirection = _newDirection; setSpriteX(0, nouveau_x); setSpriteY(0, nouveau_y); if (_vm->_globals._lastDirection == 1) diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index e2d706e782..d2786086a9 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -113,7 +113,7 @@ public: int S_old_ani; int S_old_ret; int nouveau_x, nouveau_y; - int nouveau_sens; + int _newDirection; int nouveau_anim; public: ObjectsManager(); -- cgit v1.2.3 From c7ee7c7ba8b4d1e3d9f0cee5d46a1155ce94916d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Jan 2013 07:29:02 +0100 Subject: HOPKINS: Refactor several functions in ObjectsManager --- engines/hopkins/objects.cpp | 219 ++++++++++++++------------------------------ 1 file changed, 71 insertions(+), 148 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3dd1ba6bf1..b715ac0b80 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1502,16 +1502,9 @@ void ObjectsManager::GOHOME() { unsigned int v44; unsigned int v45; unsigned int v46; - int16 v47; int16 v48; - int16 v49; - int v50; - int16 v51; - int16 v52; - int16 v54; - int v55; - int16 v56; - int16 v57; + int v49; + int v54; int16 v58; v0 = 0; @@ -1561,21 +1554,14 @@ void ObjectsManager::GOHOME() { _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; if (v54 > 0) { - v55 = v54; - if (_vm->_globals.ZONEP[v55]._destX) { - v56 = _vm->_globals.ZONEP[v55]._destY; - if (v56) { - if (v56 != 31) { - v57 = _vm->_globals.ZONEP[v55].field4; - if (v57 == -1) { - _vm->_globals.ZONEP[v55]._destX = 0; - _vm->_globals.ZONEP[v55]._destY = 0; - _vm->_globals.ZONEP[v55].field4 = 0; - } else { - setSpriteIndex(0, v57); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v55].field4 - 59; - } - } + if (_vm->_globals.ZONEP[v54]._destX && _vm->_globals.ZONEP[v54]._destY && _vm->_globals.ZONEP[v54]._destY != 31) { + if (_vm->_globals.ZONEP[v54].field4 == -1) { + _vm->_globals.ZONEP[v54]._destX = 0; + _vm->_globals.ZONEP[v54]._destY = 0; + _vm->_globals.ZONEP[v54].field4 = 0; + } else { + setSpriteIndex(0, _vm->_globals.ZONEP[v54].field4); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v54].field4 - 59; } } } @@ -1855,21 +1841,14 @@ void ObjectsManager::GOHOME() { g_old_y = getSpriteY(0); if (v49 > 0) { - v50 = v49; - if (_vm->_globals.ZONEP[v50]._destX) { - v51 = _vm->_globals.ZONEP[v50]._destY; - if (v51) { - if (v51 != 31) { - v52 = _vm->_globals.ZONEP[v50].field4; - if (v52 == -1) { - _vm->_globals.ZONEP[v50]._destX = 0; - _vm->_globals.ZONEP[v50]._destY = 0; - _vm->_globals.ZONEP[v50].field4 = 0; - } else { - setSpriteIndex(0, v52); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v50].field4 - 59; - } - } + if (_vm->_globals.ZONEP[v49]._destX && _vm->_globals.ZONEP[v49]._destY && _vm->_globals.ZONEP[v49]._destY != 31) { + if ( _vm->_globals.ZONEP[v49].field4 == -1) { + _vm->_globals.ZONEP[v49]._destX = 0; + _vm->_globals.ZONEP[v49]._destY = 0; + _vm->_globals.ZONEP[v49].field4 = 0; + } else { + setSpriteIndex(0, _vm->_globals.ZONEP[v49].field4); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v49].field4 - 59; } } } @@ -2251,38 +2230,21 @@ void ObjectsManager::PLAN_BETA() { * Handle Left button */ void ObjectsManager::handleLeftButton() { - int srcX, srcY; - int destX, destY; - int v1; - int v2; - int16 *v3; - int16 *v4; - int16 *v5; - int zoneCount; - int zoneX; - int zoneY; - int16 *v9; - int v10; - int v11; - int v12; - int16 *v13; - int16 *v16; - _vm->_fontManager.hideText(9); - destX = _vm->_eventsManager.getMouseX(); - destY = _vm->_eventsManager.getMouseY(); + int destX = _vm->_eventsManager.getMouseX(); + int destY = _vm->_eventsManager.getMouseY(); if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 && destY > -30 && destY < 50) { - v1 = _vm->_eventsManager._mouseCursorId; + int oldMouseCursor = _vm->_eventsManager._mouseCursorId; _vm->_dialogsManager._inventFl = true; _vm->_dialogsManager.showInventory(); _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; if (!_vm->_globals._exitId) { _vm->_dialogsManager._inventFl = false; - _vm->_eventsManager._mouseCursorId = v1; + _vm->_eventsManager._mouseCursorId = oldMouseCursor; } return; } @@ -2308,64 +2270,49 @@ void ObjectsManager::handleLeftButton() { return; } } - if (_vm->_globals.PLAN_FLAG) { - if (!_vm->_globals.GOACTION) - goto LABEL_38; + if (_vm->_globals.PLAN_FLAG && _vm->_globals.GOACTION) { checkZone(); if (_zoneNum <= 0) return; - v2 = 0; - v3 = _vm->_globals.essai2; - v4 = _vm->_globals.chemin; + int routeIdx = 0; do { - v3[v2] = v4[v2]; - ++v2; - } while (v4[v2] != -1); + _vm->_globals.essai2[routeIdx] = _vm->_globals.chemin[routeIdx]; + ++routeIdx; + } while (_vm->_globals.chemin[routeIdx] != -1); - v5 = _vm->_globals.essai2; - v5[v2] = -1; - v5[v2 + 1] = -1; - v5[v2 + 2] = -1; - v5[v2 + 3] = -1; + _vm->_globals.essai2[routeIdx] = -1; + _vm->_globals.essai2[routeIdx + 1] = -1; + _vm->_globals.essai2[routeIdx + 2] = -1; + _vm->_globals.essai2[routeIdx + 3] = -1; } + if (_vm->_globals.GOACTION) { checkZone(); _vm->_globals.GOACTION = false; _vm->_globals._saveData->data[svField1] = 0; _vm->_globals._saveData->data[svField2] = 0; } -LABEL_38: + if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0)) return; if (_zoneNum != -1 && _zoneNum != 0) { - zoneCount = _zoneNum; - zoneX = _vm->_globals.ZONEP[zoneCount]._destX; - if (zoneX) { - zoneY = _vm->_globals.ZONEP[zoneCount]._destY; - if (zoneY) { - if (zoneY != 31) { - destX = zoneX; - destY = zoneY; - } - } + if (_vm->_globals.ZONEP[_zoneNum]._destX && _vm->_globals.ZONEP[_zoneNum]._destY && _vm->_globals.ZONEP[_zoneNum]._destY != 31) { + destX = _vm->_globals.ZONEP[_zoneNum]._destX; + destY = _vm->_globals.ZONEP[_zoneNum]._destY; } } _vm->_globals.GOACTION = false; - v9 = _vm->_globals.chemin; + int16 *oldRoute = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { - v10 = getSpriteX(0); - v11 = getSpriteY(0); - v12 = getSpriteX(0); - v13 = _vm->_linesManager.PARCOURS2(v12, v11, v10, 390); - _vm->_globals.chemin = v13; - if (v13 != (int16 *)g_PTRNUL) - PACOURS_PROPRE(v13); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); + if (_vm->_globals.chemin != (int16 *)g_PTRNUL) + PACOURS_PROPRE(_vm->_globals.chemin); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) { + if (_vm->_globals.chemin != (int16 *)g_PTRNUL || oldRoute == _vm->_globals.chemin) { _vm->_globals._oldDirection = -1; goto LABEL_65; } @@ -2383,20 +2330,17 @@ LABEL_38: } if (!_vm->_globals.NOMARCHE) { if (!_vm->_globals.PLAN_FLAG) { - srcY = getSpriteY(0); - srcX = getSpriteX(0); - v16 = _vm->_linesManager.PARCOURS2(srcX, srcY, destX, destY); - _vm->_globals.chemin = v16; - if (v16 != (int16 *)g_PTRNUL) - PACOURS_PROPRE(v16); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); + if (_vm->_globals.chemin != (int16 *)g_PTRNUL) + PACOURS_PROPRE(_vm->_globals.chemin); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL || v9 == _vm->_globals.chemin) + if (_vm->_globals.chemin != (int16 *)g_PTRNUL || oldRoute == _vm->_globals.chemin) _vm->_globals._oldDirection = -1; else LABEL_63: - _vm->_globals.chemin = v9; + _vm->_globals.chemin = oldRoute; } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) @@ -2427,64 +2371,46 @@ LABEL_65: } void ObjectsManager::PARADISE() { - int v1; - char result; - int v3; - int v5; - - v1 = 0; - result = _vm->_globals._saveData->data[svField1]; + char result = _vm->_globals._saveData->data[svField1]; if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); if (!_vm->_globals._forestFl || _zoneNum < 20 || _zoneNum > 23) { if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.no_scroll = 2; - if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) - goto LABEL_64; - v3 = _vm->_eventsManager._startPos.x + 320 - getSpriteX(0); - if (v3 < 0) - v3 = -v3; - if (v3 <= 160) { -LABEL_64: - if (_vm->_eventsManager._startPos.x > getSpriteX(0) - 320) { - v5 = _vm->_eventsManager._startPos.x + 320 - getSpriteX(0); - if (v5 < 0) - v5 = -v5; - if (v5 > 160) { - _vm->_graphicsManager.no_scroll = 2; - do { - _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager._scrollSpeed; - if (_vm->_graphicsManager.SCROLL < 0) { - _vm->_graphicsManager.SCROLL = 0; - v1 = 1; - } - if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { - _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; - v1 = 1; - } - if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) - _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x - 4, _vm->_eventsManager.getMouseY()); - - _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager._startPos.x > getSpriteX(0) - 320); + if (_vm->_eventsManager._startPos.x + 320 - getSpriteX(0) > 160) { + bool loopCond = false; + do { + _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager._scrollSpeed; + if (_vm->_graphicsManager.SCROLL < 0) { + _vm->_graphicsManager.SCROLL = 0; + loopCond = true; } - } - } else { + if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { + _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; + loopCond = true; + } + if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) + _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x - 4, _vm->_eventsManager.getMouseY()); + + _vm->_eventsManager.VBL(); + } while (!loopCond && _vm->_eventsManager._startPos.x > getSpriteX(0) - 320); + } else if (_vm->_eventsManager._startPos.x + 320 - getSpriteX(0) < -160) { + bool loopCond = false; do { _vm->_graphicsManager.SCROLL += _vm->_graphicsManager._scrollSpeed; if (_vm->_graphicsManager.SCROLL < 0) { _vm->_graphicsManager.SCROLL = 0; - v1 = 1; + loopCond = true; } if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; - v1 = 1; + loopCond = true; } if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager.SCROLL + 10) _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x + 4, _vm->_eventsManager.getMouseY()); _vm->_eventsManager.VBL(); - } while (v1 != 1 && _vm->_eventsManager._startPos.x < getSpriteX(0) - 320); + } while (!loopCond && _vm->_eventsManager._startPos.x < getSpriteX(0) - 320); } if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) _vm->_eventsManager.setMouseXY(_vm->_graphicsManager.SCROLL + 610, 0); @@ -2524,12 +2450,9 @@ LABEL_64: _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } - if (_vm->_globals.NOMARCHE) { - if (_vm->_eventsManager._mouseCursorId == 4) { - result = _zoneNum + 1; - if (_zoneNum != -1 && _zoneNum != 0) - handleRightButton(); - } + if (_vm->_globals.NOMARCHE && _vm->_eventsManager._mouseCursorId == 4) { + if (_zoneNum != -1 && _zoneNum != 0) + handleRightButton(); } _vm->_globals.GOACTION = false; } -- cgit v1.2.3 From 4410da443c814a077fd3f09cbc44d20a9f2d36db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Jan 2013 08:22:27 +0100 Subject: HOPKINS: More refactoring in ObjectsManager --- engines/hopkins/objects.cpp | 238 +++++++++++++++++--------------------------- 1 file changed, 90 insertions(+), 148 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b715ac0b80..e0e49d7a67 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2640,25 +2640,17 @@ void ObjectsManager::computeAndSetSpriteSize() { } void ObjectsManager::PACOURS_PROPRE(int16 *a1) { - int v1; - int v2; int v4; int v5; - int v6; - int v7; int v9; int v10; int v11; int v12; - int v13; - int v14; - int v15; - v1 = 0; - v13 = 0; - v14 = -1; - v2 = a1[1]; - v15 = a1[2]; + int v1 = 0; + int v14 = -1; + int v2 = a1[1]; + int v15 = a1[2]; if (a1[0] == -1 && v2 == -1) return; @@ -2670,21 +2662,18 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { v4 = a1[v1]; v9 = a1[v1]; v5 = a1[v1 + 1]; - v6 = 0; while (v4 != -1 || v5 != -1) { int idx = v1; v1 += 4; ++v12; if (a1[idx + 2] != v15) - v6 = 1; - if (v6 == 1) break; v4 = a1[v1]; v9 = a1[v1]; v5 = a1[v1 + 1]; } if (v12 < v10) { - v7 = v11; + int v7 = v11; for (int v8 = 0; v8 < v12; v8++) { a1[v7 + 2] = v14; v7 += 4; @@ -2693,30 +2682,22 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { } v1 = v11; if (v9 == -1 && v5 == -1) - v13 = 1; + break; } v1 += 4; - if (v13 == 1) - break; v14 = v15; v2 = a1[v1 + 1]; v15 = a1[v1 + 2]; - if (a1[v1] == -1) { - if (v2 == -1) - break; - } + if (a1[v1] == -1 && v2 == -1) + break; } } int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int16 *result; - int v23; int v27; int v28; int v29; - int v34; - int v35; - int16 *v37; int16 *v41; int16 *v45; int v48; @@ -2781,11 +2762,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { break; arrDataIdx[7] = 0; arrLineIdx[7] = -1; - if (arrDelta[1] <= delta && arrLineIdx[1] != -1) - break; - if (arrDelta[5] <= delta && arrLineIdx[5] != -1) - break; - if (arrDelta[3] <= delta && arrLineIdx[3] != -1) + if ((arrDelta[1] <= delta && arrLineIdx[1] != -1) || arrDelta[3] <= delta && arrLineIdx[3] != -1 || arrDelta[5] <= delta && arrLineIdx[5] != -1) break; } arrDelta[7] = delta; @@ -2799,21 +2776,21 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { if (arrLineIdx[7] == -1) arrDelta[7] = 1300; if (arrLineIdx[1] != -1 || arrLineIdx[3] != -1 || arrLineIdx[5] != -1 || arrLineIdx[7] != -1) { - v23 = 0; + bool v23 = false; if (arrLineIdx[5] != -1 && arrDelta[1] >= arrDelta[5] && arrDelta[3] >= arrDelta[5] && arrDelta[7] >= arrDelta[5]) { v73 = arrLineIdx[5]; v72 = arrDataIdx[5]; - v23 = 1; + v23 = true; } if (arrLineIdx[1] != -1 && !v23 && arrDelta[5] >= arrDelta[1] && arrDelta[3] >= arrDelta[1] && arrDelta[7] >= arrDelta[1]) { v73 = arrLineIdx[1]; v72 = arrDataIdx[1]; - v23 = 1; + v23 = true; } if (arrLineIdx[3] != -1 && !v23 && arrDelta[1] >= arrDelta[3] && arrDelta[5] >= arrDelta[3] && arrDelta[7] >= arrDelta[3]) { v73 = arrLineIdx[3]; v72 = arrDataIdx[3]; - v23 = 1; + v23 = true; } if (arrLineIdx[7] != -1 && !v23 && arrDelta[5] >= arrDelta[7] && arrDelta[3] >= arrDelta[7] && arrDelta[1] >= arrDelta[7]) { v73 = arrLineIdx[7]; @@ -2862,17 +2839,14 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } LABEL_90: if (v69 < v73) { - v34 = v68; - v35 = v68; - for (int i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx; v35 < i - 2; i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx) { - v37 = _vm->_linesManager.Ligne[v69]._lineData; - _vm->_globals.super_parcours[superRouteIdx] = v37[2 * v35]; - _vm->_globals.super_parcours[superRouteIdx + 1] = v37[2 * v35 + 1]; + int v34 = v68; + for (int i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx) { + _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v69]._lineData[2 * v34]; + _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v69]._lineData[2 * v34 + 1]; _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v69].field6; _vm->_globals.super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; ++v34; - v35 = v34; } for (j = v69 + 1; j < v73; ++j) { if (_vm->_linesManager.PLAN_TEST( @@ -3127,129 +3101,96 @@ void ObjectsManager::handleRightButton() { } int ObjectsManager::MZONE() { - signed int result; - int16 v2; - int v3; - int16 v4; - int16 v5; - int v6; - int v8; - int v9; - int16 yCurrent; - int16 v11; - int16 j; - int16 k; - int16 xCurrent; - int v15; - int16 v16; - int16 v17; - int16 v18; - int16 v19; - int16 yp; - int16 xp; + int result; - v19 = 0; - v18 = 0; - v17 = 0; - v16 = 0; - xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; - yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; + int xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; + int yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { for (int v1 = 0; v1 <= 48; v1++) { - v2 = _vm->_globals.BOBZONE[v1]; - if (v2) { - if (_vm->_globals.BOBZONE_FLAG[v1]) { - v3 = v2; - v15 = v3; - if (_vm->_globals._bob[v3].field0) { - if (_vm->_globals._bob[v3]._frameIndex != 250) { - if (!_vm->_globals._bob[v3]._disabledAnimationFl) { - v4 = _vm->_globals._bob[v3]._oldX; - if (xp > v4) { - if (xp < _vm->_globals._bob[v3]._oldWidth + v4) { - v5 = _vm->_globals._bob[v3]._oldY; - if (yp > v5) { - if (yp < _vm->_globals._bob[v3]._oldHeight + v5) { - v6 = v1; - if (_vm->_globals.ZONEP[v1].field4 == -1) { - _vm->_globals.ZONEP[v6]._destX = 0; - _vm->_globals.ZONEP[v1]._destY = 0; - } - if (!_vm->_globals.ZONEP[v6]._destX) { - if (!_vm->_globals.ZONEP[v1]._destY) { - _vm->_globals.ZONEP[v6]._destX = _vm->_globals._bob[v15]._oldWidth + _vm->_globals._bob[v15]._oldX; - _vm->_globals.ZONEP[v1]._destY = _vm->_globals._bob[v15]._oldHeight + _vm->_globals._bob[v15]._oldY + 6; - _vm->_globals.ZONEP[v1].field4 = -1; - } - } - return v1; - } - } - } - } - } - } + int v2 = _vm->_globals.BOBZONE[v1]; + if (v2 && _vm->_globals.BOBZONE_FLAG[v1] && _vm->_globals._bob[v2].field0 && _vm->_globals._bob[v2]._frameIndex != 250 && + !_vm->_globals._bob[v2]._disabledAnimationFl && xp > _vm->_globals._bob[v2]._oldX && + xp < _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX && yp > _vm->_globals._bob[v2]._oldY) { + if (yp < _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY) { + if (_vm->_globals.ZONEP[v1].field4 == -1) { + _vm->_globals.ZONEP[v1]._destX = 0; + _vm->_globals.ZONEP[v1]._destY = 0; } + if (!_vm->_globals.ZONEP[v1]._destX && !_vm->_globals.ZONEP[v1]._destY) { + _vm->_globals.ZONEP[v1]._destX = _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX; + _vm->_globals.ZONEP[v1]._destY = _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY + 6; + _vm->_globals.ZONEP[v1].field4 = -1; + } + return v1; } } } _vm->_globals.SegmentEnCours = 0; for (int v7 = 0; v7 <= 99; v7++) { - if (_vm->_globals.ZONEP[v7].field10 == 1) { - v8 = v7; - if (_vm->_globals.CarreZone[v8].field0 == 1) { - if (_vm->_globals.CarreZone[v7].field2 <= xp - && _vm->_globals.CarreZone[v7].field4 >= xp - && _vm->_globals.CarreZone[v7].field6 <= yp - && _vm->_globals.CarreZone[v7].field8 >= yp) { - if (_vm->_globals.CarreZone[v7].fieldE == 1) { - _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7].fieldA].field2; - return _vm->_globals.oldzone_46; - } - v9 = _vm->_globals.SegmentEnCours; - _vm->_globals.Segment[v9].field2 = _vm->_globals.CarreZone[v7].fieldA; - _vm->_globals.Segment[v9].field4 = _vm->_globals.CarreZone[v7].fieldC; - ++_vm->_globals.SegmentEnCours; - } + if (_vm->_globals.ZONEP[v7].field10 == 1 && _vm->_globals.CarreZone[v7].field0 == 1 + && _vm->_globals.CarreZone[v7].field2 <= xp + && _vm->_globals.CarreZone[v7].field4 >= xp + && _vm->_globals.CarreZone[v7].field6 <= yp + && _vm->_globals.CarreZone[v7].field8 >= yp) { + if (_vm->_globals.CarreZone[v7].fieldE == 1) { + _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7].fieldA].field2; + return _vm->_globals.oldzone_46; } + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = _vm->_globals.CarreZone[v7].fieldA; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = _vm->_globals.CarreZone[v7].fieldC; + ++_vm->_globals.SegmentEnCours; } } - if (!_vm->_globals.SegmentEnCours) - goto LABEL_58; + if (!_vm->_globals.SegmentEnCours) { + _vm->_globals.oldzone_46 = -1; + return -1; + } - for (yCurrent = yp; yCurrent >= 0; --yCurrent) { - v11 = colision(xp, yCurrent); - v19 = v11; - if (v11 != -1 && _vm->_globals.ZONEP[v11].field10 == 1) + int colRes1 = 0; + for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { + colRes1 = colision(xp, yCurrent); + if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; } - if (v19 == -1) - goto LABEL_58; - for (j = yp; j < _vm->_graphicsManager.max_y; ++j) { - v18 = colision(xp, j); - if (v18 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) + + if (colRes1 == -1) { + _vm->_globals.oldzone_46 = -1; + return -1; + } + + int colRes2 = 0; + for (int j = yp; j < _vm->_graphicsManager.max_y; ++j) { + colRes2 = colision(xp, j); + if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; } - if (v18 == -1) - goto LABEL_58; - for (k = xp; k >= 0; --k) { - v16 = colision(k, yp); - if (v16 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) + + if (colRes2 == -1) { + _vm->_globals.oldzone_46 = -1; + return -1; + } + + int colRes3 = 0; + for (int k = xp; k >= 0; --k) { + colRes3 = colision(k, yp); + if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; } - if (v16 == -1) - goto LABEL_58; + if (colRes3 == -1) { + _vm->_globals.oldzone_46 = -1; + return -1; + } - for (xCurrent = xp; _vm->_graphicsManager.max_x > xCurrent; ++xCurrent) { - v17 = colision(xCurrent, yp); - if (v17 != -1 && _vm->_globals.ZONEP[v19].field10 == 1) + int colRes4 = 0; + for (int xCurrent = xp; _vm->_graphicsManager.max_x > xCurrent; ++xCurrent) { + colRes4 = colision(xCurrent, yp); + if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; } - if (v19 == v18 && v19 == v16 && v19 == v17) { - _vm->_globals.oldzone_46 = v19; - result = v19; + if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) { + _vm->_globals.oldzone_46 = colRes1; + result = colRes1; } else { -LABEL_58: _vm->_globals.oldzone_46 = -1; result = -1; } @@ -3421,23 +3362,24 @@ void ObjectsManager::OPTI_OBJET() { if (data[0] != 'I' || data[1] != 'N' || data[2] != 'I') error("File %s is not an INI file", file.c_str()); - bool v7 = false; - do { + for (;;) { v5 = _vm->_scriptManager.handleOpcode(data + 20 * v0); if (_vm->shouldQuit()) return; if (v5 == 2) v0 = _vm->_scriptManager.handleGoto(data + 20 * v0); - if (v5 == 3) + else if (v5 == 3) v0 = _vm->_scriptManager.handleIf(data, v0); + if (v0 == -1) error("defective IFF function"); + if (v5 == 1 || v5 == 4) ++v0; if (!v5 || v5 == 5) - v7 = true; - } while (!v7); + break; + } _vm->_globals.freeMemory(data); } -- cgit v1.2.3 From ec59e1496f42c3e5bde5e5aaba5a2d82389f84c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Jan 2013 08:39:41 +0100 Subject: HOPKINS: More refactoring in ObjectsManager --- engines/hopkins/objects.cpp | 69 +++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 49 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e0e49d7a67..b5a2e655e2 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3386,8 +3386,6 @@ void ObjectsManager::OPTI_OBJET() { void ObjectsManager::handleSpecialGames() { byte *oldPalette; - byte *v2; - byte *v3; switch (_vm->_globals._screenId) { case 5: @@ -3429,14 +3427,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); - v2 = _vm->_graphicsManager._vesaBuffer; - v3 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v3 = v3 + 614396; - v2 = v2 + 614396; - *v2 = *v3; - v2 = v2 + 2; - *v2 = v3[2]; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); _vm->_graphicsManager.no_scroll = 0; _vm->_graphicsManager.DD_VBL(); @@ -3825,11 +3816,6 @@ void ObjectsManager::INILINK(const Common::String &file) { int v8; int v9; int v10; - int v11; - int v12; - byte *v13; - int v14; - int v15; byte *v16; byte *v17; byte *v22; @@ -3883,23 +3869,18 @@ void ObjectsManager::INILINK(const Common::String &file) { v8 = (int16)READ_LE_UINT16(v37 + 2 * v36); v9 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 2); v10 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 4); - v11 = v40; - _vm->_globals.Cache[v11].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); - _vm->_globals.Cache[v11]._spriteIndex = v8; - _vm->_globals.Cache[v11]._x = v9; - _vm->_globals.Cache[v11]._y = v10; + _vm->_globals.Cache[v40].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); + _vm->_globals.Cache[v40]._spriteIndex = v8; + _vm->_globals.Cache[v40]._x = v9; + _vm->_globals.Cache[v40]._y = v10; if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[v40].fieldA = 0; } else { - v12 = v8; - v13 = _vm->_globals.CACHE_BANQUE[1]; - v14 = getWidth(v13, v8); - v15 = getHeight(v13, v12); - _vm->_globals.Cache[v40]._spriteData = v13; - _vm->_globals.Cache[v40]._width = v14; - _vm->_globals.Cache[v40]._height = v15; + _vm->_globals.Cache[v40]._spriteData = _vm->_globals.CACHE_BANQUE[1]; + _vm->_globals.Cache[v40]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); + _vm->_globals.Cache[v40]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); _vm->_globals.Cache[v40].fieldA = 1; } if (!_vm->_globals.Cache[v40]._x && !_vm->_globals.Cache[v40]._y @@ -4312,7 +4293,7 @@ int ObjectsManager::colision(int xp, int yp) { flag = false; if (flag && _vm->_linesManager._zoneLine[field2].count > 0) { - for (int v5 = 0; v5 < count; ++v5) { + for (int i = 0; i < count; ++i) { int xCheck = *dataP++; int yCheck = *dataP++; @@ -4563,12 +4544,6 @@ void ObjectsManager::lockAnimX(int idx, int a2) { void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { - int v5; - int v7; - int v8; - int v9; - - v5 = 0; _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_dialogsManager._removeInventFl = false; @@ -4604,7 +4579,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); _vm->_eventsManager.changeMouseCursor(4); - for (int v6 = 0; v6 <= 4; v6++) + for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); _vm->_graphicsManager.fadeInLong(); if (_vm->_globals._screenId == 61) { @@ -4615,9 +4590,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - v7 = getSpriteY(0); - v8 = getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v8, v7, 330, 345); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); _vm->_globals.NOT_VERIF = true; do { GOHOME(); @@ -4626,24 +4599,22 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo setSpriteIndex(0, 64); } do { - v9 = _vm->_eventsManager.getMouseButton(); - if (v9 == 1) { + int mouseButton = _vm->_eventsManager.getMouseButton(); + if (mouseButton == 1) { handleLeftButton(); - v9 = 1; - } - if (v9 == 2) + mouseButton = 1; + } else if (mouseButton == 2) handleRightButton(); _vm->_dialogsManager.testDialogOpening(); checkZone(); if (_vm->_globals.GOACTION) PARADISE(); - if (!_vm->_globals._exitId) { + if (!_vm->_globals._exitId) _vm->_eventsManager.VBL(); - if (!_vm->_globals._exitId) - continue; - } - v5 = 1; - } while (!_vm->shouldQuit() && v5 != 1); + + if (_vm->_globals._exitId) + break; + } while (!_vm->shouldQuit()); if (_vm->shouldQuit()) return; -- cgit v1.2.3 From 58af4bc6755c0b643cc5a1195117a9cec53477ef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Jan 2013 02:00:29 +0100 Subject: HOPKINS: More refactoring in Hopkins (Thanks fuzzie for the help) --- engines/hopkins/objects.cpp | 199 +++++++++++++++++--------------------------- engines/hopkins/objects.h | 16 ++-- 2 files changed, 86 insertions(+), 129 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b5a2e655e2..459f1036c6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -231,7 +231,7 @@ int ObjectsManager::getHeight(const byte *objectData, int idx) { return (int16)READ_LE_UINT16(rectP + 6); } -int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { +void ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { const byte *objP = objectData + 3; for (int i = objIndex; i; --i) { objP += READ_LE_UINT32(objP) + 16; @@ -241,7 +241,17 @@ int ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIn int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); memcpy(sprite + 3, objP - 4, result + 16); - return result; +} + +void ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { + const byte *objP = objectData + 3; + for (int i = objIndex; i; --i) { + objP += READ_LE_UINT32(objP) + 16; + } + + objP += 4; + int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); + memcpy(sprite, objP + 12, result); } void ObjectsManager::DEL_FICHIER_OBJ() { @@ -256,23 +266,10 @@ byte *ObjectsManager::loadSprite(const Common::String &file) { return _vm->_fileManager.loadFile(file); } -int ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex) { - const byte *objP = objectData + 3; - for (int i = objIndex; i; --i) { - objP += READ_LE_UINT32(objP) + 16; - } - - objP += 4; - int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); - - memcpy(sprite, objP + 12, result); - return result; -} - /** * Add Object */ -int ObjectsManager::addObject(int objIndex) { +void ObjectsManager::addObject(int objIndex) { int arrIndex = 0; for (;;) { ++arrIndex; @@ -281,7 +278,6 @@ int ObjectsManager::addObject(int objIndex) { } _vm->_globals._inventory[arrIndex] = objIndex; - return arrIndex; } /** @@ -342,7 +338,7 @@ void ObjectsManager::displaySprite() { if (_sprite[idx]._animationType == 1) { computeSprite(idx); if (_sprite[idx].field2A) - beforeSort(SORT_SPRITE, idx, _sprite[idx]._height + _sprite[idx].field2E); + beforeSort(SORT_SPRITE, idx, _sprite[idx]._height + _sprite[idx].destY); } } @@ -356,11 +352,11 @@ void ObjectsManager::displaySprite() { do { loopCondFl = false; - for (int v34 = 1; v34 < _vm->_globals._sortedDisplayCount; v34++) { - if (_vm->_globals._sortedDisplay[arr[v34]]._priority > _vm->_globals._sortedDisplay[arr[v34 + 1]]._priority) { - int oldIdx = arr[v34]; - arr[v34] = arr[v34 + 1]; - arr[v34 + 1] = oldIdx; + for (int sortIdx = 1; sortIdx < _vm->_globals._sortedDisplayCount; sortIdx++) { + if (_vm->_globals._sortedDisplay[arr[sortIdx]]._priority > _vm->_globals._sortedDisplay[arr[sortIdx + 1]]._priority) { + int oldIdx = arr[sortIdx]; + arr[sortIdx] = arr[sortIdx + 1]; + arr[sortIdx + 1] = oldIdx; loopCondFl = true; } } @@ -402,7 +398,7 @@ void ObjectsManager::displaySprite() { } } - // Reset the Tri array + // Reset the Sort array for (int idx = 0; idx < 50; ++idx) { _vm->_globals._sortedDisplay[idx]._sortMode = SORT_NONE; _vm->_globals._sortedDisplay[idx]._index = 0; @@ -490,9 +486,8 @@ void ObjectsManager::displaySprite() { } void ObjectsManager::INIT_BOB() { - for (int idx = 0; idx < 35; ++idx) { + for (int idx = 0; idx < 35; ++idx) BOB_ZERO(idx); - } } void ObjectsManager::BOB_ZERO(int idx) { @@ -642,34 +637,18 @@ void ObjectsManager::SCBOB(int idx) { if (_vm->_globals.Cache[idx].fieldA <= 0) return; - for (int v8 = 0; v8 <= 20; v8++) { - if ((_vm->_globals._bob[v8].field0) && (!_vm->_globals._bob[v8]._disabledAnimationFl) && (!_vm->_globals._bob[v8].field34) && (_vm->_globals._bob[v8]._frameIndex != 250)) { - int v9 = _vm->_globals._bob[v8]._oldX + _vm->_globals._bob[v8]._oldWidth; - int v6 = _vm->_globals._bob[v8]._oldY + _vm->_globals._bob[v8]._oldHeight; - int v7 = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x; - - if ((v6 > _vm->_globals.Cache[idx]._y) && (v6 < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) { - bool checkFl = false; - if (v9 >= _vm->_globals.Cache[idx]._x && v9 <= v7) { - ++_vm->_globals.Cache[idx].fieldA; - checkFl = true; - } - if (!checkFl && v7 >= _vm->_globals._bob[v8]._oldWidth && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x) { - ++_vm->_globals.Cache[idx].fieldA; - checkFl = true; - } - - if (!checkFl && v7 >= _vm->_globals._bob[v8]._oldWidth && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x ) { - ++_vm->_globals.Cache[idx].fieldA; - checkFl = true; - } - - if (!checkFl && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x && v9 <= v7) { - ++_vm->_globals.Cache[idx].fieldA; - checkFl = true; - } - - if (!checkFl && _vm->_globals._bob[v8]._oldWidth <= _vm->_globals.Cache[idx]._x && v9 >= v7) + for (int i = 0; i <= 20; i++) { + if ((_vm->_globals._bob[i].field0) && (!_vm->_globals._bob[i]._disabledAnimationFl) && (!_vm->_globals._bob[i].field34) && (_vm->_globals._bob[i]._frameIndex != 250)) { + int oldRight = _vm->_globals._bob[i]._oldX + _vm->_globals._bob[i]._oldWidth; + int oldBottom = _vm->_globals._bob[i]._oldY + _vm->_globals._bob[i]._oldHeight; + int cachedRight = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x; + + if ((oldBottom > _vm->_globals.Cache[idx]._y) && (oldBottom < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) { + if ((oldRight >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) + || (cachedRight >= _vm->_globals._bob[i]._oldWidth && _vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) + || (cachedRight >= _vm->_globals._bob[i]._oldWidth && _vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) + || (_vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) + || (_vm->_globals._bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight)) ++_vm->_globals.Cache[idx].fieldA; } } @@ -683,17 +662,17 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals._bob[idx].field36 = 0; } - int result = _vm->_globals._bob[idx]._frameIndex; - if (result == 250) + int spriteIdx = _vm->_globals._bob[idx]._frameIndex; + if (spriteIdx == 250) return; int deltaY, deltaX; if (_vm->_globals._bob[idx]._modeFlag) { - deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); - deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); + deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, spriteIdx, true); + deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, true); } else { - deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); - deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); + deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, spriteIdx, false); + deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, false); } int v20 = 0; @@ -760,59 +739,42 @@ void ObjectsManager::CALCUL_BOB(int idx) { } void ObjectsManager::checkCache() { - for (int v8 = 0; v8 <= 19; v8++) { - if (_vm->_globals.Cache[v8].fieldA <= 0) + for (int cacheIdx = 0; cacheIdx <= 19; cacheIdx++) { + if (_vm->_globals.Cache[cacheIdx].fieldA <= 0) continue; - int oldFieldA = _vm->_globals.Cache[v8].fieldA; - for (int v10 = 0; v10 <= 4; v10++) { - if (_sprite[v10]._animationType == 1 && _sprite[v10]._spriteIndex != 250) { - int v11 = _sprite[v10]._width + _sprite[v10].field2C; - int v2 = _sprite[v10]._height + _sprite[v10].field2E; - int v9 = _vm->_globals.Cache[v8]._width + _vm->_globals.Cache[v8]._x; - - if (v2 > _vm->_globals.Cache[v8]._y && v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + _vm->_globals.Cache[v8]._y)) { - bool v4 = false; - if (v11 >= _vm->_globals.Cache[v8]._x && v11 <= v9) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = true; - } - - if (!v4 && v9 >= _sprite[v10].field2C && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = true; - } - - if (!v4 && v9 >= _sprite[v10].field2C && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = true; - } - - if (!v4 && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C && v11 <= v9) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = true; - } - - if (!v4 && _vm->_globals.Cache[v8]._x >= _sprite[v10].field2C && v11 >= v9) - ++_vm->_globals.Cache[v8].fieldA; + int oldFieldA = _vm->_globals.Cache[cacheIdx].fieldA; + for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { + if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { + int right = _sprite[spriteIdx]._width + _sprite[spriteIdx].destX; + int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx].destY; + int cachedRight = _vm->_globals.Cache[cacheIdx]._width + _vm->_globals.Cache[cacheIdx]._x; + + if (bottom > _vm->_globals.Cache[cacheIdx]._y && bottom < (_vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y)) { + if ((right >= _vm->_globals.Cache[cacheIdx]._x && right <= cachedRight) + || (cachedRight >= _sprite[spriteIdx].destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx].destX) + || (cachedRight >= _sprite[spriteIdx].destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx].destX) + || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx].destX && right <= cachedRight) + || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx].destX && right >= cachedRight)) + ++_vm->_globals.Cache[cacheIdx].fieldA; } } } - SCBOB(v8); - if (_vm->_globals.Cache[v8].fieldA == oldFieldA) { - if (_vm->_globals.Cache[v8].field10) { - _vm->_globals.Cache[v8].field10 = false; - _vm->_globals.Cache[v8].fieldA = 1; + SCBOB(cacheIdx); + if (_vm->_globals.Cache[cacheIdx].fieldA == oldFieldA) { + if (_vm->_globals.Cache[cacheIdx].field10) { + _vm->_globals.Cache[cacheIdx].field10 = false; + _vm->_globals.Cache[cacheIdx].fieldA = 1; } } else { - int v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + _vm->_globals.Cache[v8]._y; + int v5 = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y; if (v5 > 440) v5 = 500; - beforeSort(SORT_CACHE, v8, v5); - _vm->_globals.Cache[v8].fieldA = 1; - _vm->_globals.Cache[v8].field10 = true; + beforeSort(SORT_CACHE, cacheIdx, v5); + _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx].field10 = true; } } } @@ -823,10 +785,10 @@ void ObjectsManager::DEF_SPRITE(int idx) { if (_sprite[idx]._rleFl) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex); + _sprite[idx].destX + 300, _sprite[idx].destY + 300, _sprite[idx]._spriteIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx].field2C + 300, _sprite[idx].field2E + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); + _sprite[idx].destX + 300, _sprite[idx].destY + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); _vm->_globals.Liste[idx]._width = _sprite[idx]._width; _vm->_globals.Liste[idx]._height = _sprite[idx]._height; @@ -874,11 +836,11 @@ void ObjectsManager::computeSprite(int idx) { int offX; int offY; if (_sprite[idx].fieldE) { - offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, 1); - offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 1); + offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, true); + offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, true); } else { - offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, 0); - offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, 0); + offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, false); + offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, false); } int tmpX = _sprite[idx].field12 + offX; @@ -923,8 +885,8 @@ void ObjectsManager::computeSprite(int idx) { int v15 = _sprite[idx]._spritePos.x - deltaX; int v16 = _sprite[idx]._spritePos.y - deltaY; - _sprite[idx].field2C = v15; - _sprite[idx].field2E = v16; + _sprite[idx].destX = v15; + _sprite[idx].destY = v16; _sprite[idx].field2A = true; _sprite[idx]._zoomPct = zoomPercent; _sprite[idx]._reducePct = reducePercent; @@ -949,19 +911,14 @@ void ObjectsManager::computeSprite(int idx) { } // Before Sort -int ObjectsManager::beforeSort(SortMode triMode, int index, int priority) { - int result; - +void ObjectsManager::beforeSort(SortMode triMode, int index, int priority) { ++_vm->_globals._sortedDisplayCount; if (_vm->_globals._sortedDisplayCount > 48) error("NBTRI too high"); - result = _vm->_globals._sortedDisplayCount; - _vm->_globals._sortedDisplay[result]._sortMode = triMode; - _vm->_globals._sortedDisplay[result]._index = index; - _vm->_globals._sortedDisplay[result]._priority = priority; - - return result; + _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._sortMode = triMode; + _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._index = index; + _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._priority = priority; } // Display BOB Anim @@ -3804,11 +3761,11 @@ int ObjectsManager::getBobPosX(int idx) { return _vm->_globals._bob[idx]._xp; } -int ObjectsManager::BOBY(int idx) { +int ObjectsManager::getBobPosY(int idx) { return _vm->_globals._bob[idx]._yp; } -int ObjectsManager::BOBA(int idx) { +int ObjectsManager::getBobFrameIndex(int idx) { return _vm->_globals._bob[idx]._frameIndex; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d2786086a9..2db9983d85 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -47,8 +47,8 @@ struct SpriteItem { int field26; bool _rleFl; bool field2A; - int field2C; - int field2E; + int destX; + int destY; int _width; int _height; int _zoomPct; @@ -125,7 +125,7 @@ public: int getWidth(const byte *objectData, int idx); int getHeight(const byte *objectData, int idx); - int sprite_alone(const byte *objectData, byte *sprite, int objIndex); + void sprite_alone(const byte *objectData, byte *sprite, int objIndex); void DEL_FICHIER_OBJ(); byte *loadSprite(const Common::String &file); @@ -134,8 +134,8 @@ public: int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize); void displaySprite(); - int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); - int addObject(int objIndex); + void capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); + void addObject(int objIndex); void INIT_BOB(); void BOB_ZERO(int idx); @@ -152,7 +152,7 @@ public: void DEF_SPRITE(int idx); void DEF_CACHE(int idx); void computeSprite(int idx); - int beforeSort(SortMode triMode, int index, int priority); + void beforeSort(SortMode triMode, int index, int priority); void displayBobAnim(); void displayVBob(); @@ -217,8 +217,8 @@ public: void stopBobAnimation(int idx); void SET_BOBPOSI(int idx, int a2); int getBobPosX(int idx); - int BOBY(int idx); - int BOBA(int idx); + int getBobPosY(int idx); + int getBobFrameIndex(int idx); void INILINK(const Common::String &file); void SPECIAL_INI(); -- cgit v1.2.3 From fe60baf1dfe3e78a67e988c92e319ade9cae3bae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Jan 2013 17:17:13 +0100 Subject: HOPKINS: Fix mouse cursor 25 in nextVerbIcon ("use coffin") --- engines/hopkins/objects.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 459f1036c6..cdd6930329 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2900,7 +2900,7 @@ LABEL_90: void ObjectsManager::nextVerbIcon() { _vm->_eventsManager._mouseCursorId++; - do { + for(;;) { if (_vm->_eventsManager._mouseCursorId == 4) { if (!_vm->_globals.NOMARCHE || _zoneNum == -1 || _zoneNum == 0) return; @@ -3041,8 +3041,12 @@ void ObjectsManager::nextVerbIcon() { ++_vm->_eventsManager._mouseCursorId; } + if (_vm->_eventsManager._mouseCursorId == 25) { + if (_vm->_globals.ZONEP[_zoneNum].fieldE == 2) + return; + } _vm->_eventsManager._mouseCursorId = 4; - } while (_vm->_globals.ZONEP[_zoneNum].fieldE != 2); + } } /** -- cgit v1.2.3 From ae93d1f6ee73cd61a0f4b65814accbc33e863d51 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Jan 2013 21:15:30 +0100 Subject: HOPKINS: Some refactoring in TalkManager --- engines/hopkins/talk.cpp | 263 ++++++++++++++++++++--------------------------- engines/hopkins/talk.h | 2 +- 2 files changed, 111 insertions(+), 154 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e3acad312d..8fb70c19e1 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -39,7 +39,7 @@ TalkManager::TalkManager() { _characterSprite = NULL; _characterAnim = NULL; _characterSize = 0; - STATI = 0; + STATI = false; PLIGNE1 = PLIGNE2 = 0; PLIGNE3 = PLIGNE4 = 0; _paletteBufferIdx = 0; @@ -154,7 +154,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { void TalkManager::PARLER_PERSO2(const Common::String &filename) { // TODO: The original disables the mouse cursor here - STATI = 1; + STATI = true; bool v7 = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; _characterBuffer = _vm->_fileManager.searchCat(filename, 5); @@ -189,7 +189,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { PLIGNE2 = PLIGNE1 + 1; PLIGNE3 = PLIGNE1 + 2; PLIGNE4 = PLIGNE1 + 3; - int v8 = _vm->_eventsManager._mouseCursorId; + int oldMouseCursorId = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); @@ -213,14 +213,14 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { } _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); - _vm->_eventsManager._mouseCursorId = v8; + _vm->_eventsManager._mouseCursorId = oldMouseCursorId; - _vm->_eventsManager.changeMouseCursor(v8); + _vm->_eventsManager.changeMouseCursor(oldMouseCursorId); _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); // TODO: The original reenables the mouse cursor here _vm->_globals._disableInventFl = v7; - STATI = 0; + STATI = false; } void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData) { @@ -228,52 +228,30 @@ void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const } int TalkManager::DIALOGUE() { - byte *v0; - int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - byte *v11; - int v12; - int v13; - int v14; - int v15; - int v16; - int v18; - int v19; - int v20; - int v21; - if (STATI) { - v0 = _characterBuffer; - v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); - if (v1) - _vm->_objectsManager.setBobAnimation(v1); - if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 1) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 49)); - if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 2) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 50)); - if ( (int16)READ_LE_UINT16((uint16 *)v0 + 48) != 3) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 51)); - if ((int16)READ_LE_UINT16((uint16 *)v0 + 48) != 4) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16((uint16 *)v0 + 52)); + uint16 *bufPtr = (uint16 *)_characterBuffer + 48; + int curVal = (int16)READ_LE_UINT16(bufPtr); + if (curVal != 0) + _vm->_objectsManager.setBobAnimation(curVal); + if (curVal != 1) + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 1)); + if (curVal != 2) + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 2)); + if (curVal != 3) + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 3)); + if (curVal != 4) + _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 4)); } else { dialogWait(); } - v19 = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); - v2 = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); - v3 = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); - v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, _questionsFilename, 65); - v21 = v20 - 20 * v3; - v18 = v20 - 20 * v3 - 1; - v4 = v20 - 20 * v3 - 20 * v2; + int v19 = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); + int v2 = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); + int v3 = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); + int v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, _questionsFilename, 65); + int v21 = v20 - 20 * v3; + int v18 = v21 - 1; + int v4 = v21 - 20 * v2; _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, v4 - 20 * v19, 0, 65, 255); _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, v4, 0, 65, 255); _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, v21, 0, 65, 255); @@ -283,90 +261,75 @@ int TalkManager::DIALOGUE() { _vm->_fontManager.showText(7); _vm->_fontManager.showText(8); - v5 = -1; - v6 = 0; + int retVal = -1; + bool v6 = false; do { - v7 = _vm->_eventsManager.getMouseY(); - if ((v4 - 20 * v19) < v7 && (v4 - 1) > v7) { - v8 = v7; + int mousePosY = _vm->_eventsManager.getMouseY(); + if ((v4 - 20 * v19) < mousePosY && (v4 - 1) > mousePosY) { _vm->_fontManager.setOptimalColor(6, 7, 8, 5); - v5 = PLIGNE1; - v7 = v8; + retVal = PLIGNE1; } - if (v7 > v4 && v18 > v7) { - v9 = v7; + if (mousePosY > v4 && v18 > mousePosY) { _vm->_fontManager.setOptimalColor(5, 7, 8, 6); - v5 = PLIGNE2; - v7 = v9; + retVal = PLIGNE2; } - if (v21 < v7 && (v20 - 1) > v7) { - v10 = v7; + if (v21 < mousePosY && (v20 - 1) > mousePosY) { _vm->_fontManager.setOptimalColor(5, 6, 8, 7); - v5 = PLIGNE3; - v7 = v10; + retVal = PLIGNE3; } - if (v20 < v7 && v7 < 419) { + if (v20 < mousePosY && mousePosY < 419) { _vm->_fontManager.setOptimalColor(5, 6, 7, 8); - v5 = PLIGNE4; + retVal = PLIGNE4; } _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) - v6 = 1; - if (v5 == -1) - v6 = 0; - } while (!_vm->shouldQuit() && v6 != 1); + v6 = true; + if (retVal == -1) + v6 = false; + } while (!_vm->shouldQuit() && !v6); - _vm->_soundManager.mixVoice(v5, 1); + _vm->_soundManager.mixVoice(retVal, 1); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(6); _vm->_fontManager.hideText(7); _vm->_fontManager.hideText(8); if (STATI) { - v11 = _characterBuffer; - v12 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 48); - if (v12) - _vm->_objectsManager.stopBobAnimation(v12); - v13 = (int16)READ_LE_UINT16((uint16 *)v11 + 49); - if (v13 != 1) - _vm->_objectsManager.stopBobAnimation(v13); - v14 = (int16)READ_LE_UINT16((uint16 *)v11 + 50); - if (v14 != 2) - _vm->_objectsManager.stopBobAnimation(v14); - v15 = (int16)READ_LE_UINT16((uint16 *)v11 + 51); - if (v15 != 3) - _vm->_objectsManager.stopBobAnimation(v15); - v16 = (int16)READ_LE_UINT16((uint16 *)v11 + 52); - if (v16 != 4) - _vm->_objectsManager.stopBobAnimation(v16); + uint16 *bufPtr = (uint16 *)_characterBuffer + 48; + + int curVal = (int16)READ_LE_UINT16(bufPtr); + if (curVal != 0) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 1); + if (curVal != 1) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 2); + if (curVal != 2) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 3); + if (curVal != 3) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 4); + if (curVal != 4) + _vm->_objectsManager.stopBobAnimation(curVal); } else { dialogTalk(); } _vm->_eventsManager.VBL(); - return v5; + return retVal; } int TalkManager::DIALOGUE_REP(int idx) { int v1; - int v2; byte *v3; int v6; int v7; - byte *v8; - int v9; - int v10; - int v11; - int v12; - int v13; - int v14; - void *v15; - int v16; - int v17; - int v18; - int v19; - int v20; int v21; int v22; int v23; @@ -374,17 +337,12 @@ int TalkManager::DIALOGUE_REP(int idx) { int v25; v1 = 0; - v2 = 0; v3 = _characterBuffer + 110; for (; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) { ++v1; if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < v1) - v2 = 1; - if (v2 == 1) return -1; } - if (v2 == 1) - return -1; v22 = (int16)READ_LE_UINT16((uint16 *)v3 + 1); v25 = (int16)READ_LE_UINT16((uint16 *)v3 + 2); @@ -402,22 +360,26 @@ int TalkManager::DIALOGUE_REP(int idx) { if (!v6) v6 = 10; if (STATI) { - v8 = _characterBuffer; - v9 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); - if (v9) - _vm->_objectsManager.setBobAnimation(v9); - v10 = (int16)READ_LE_UINT16((uint16 *)v8 + 44); - if (v10) - _vm->_objectsManager.setBobAnimation(v10); - v11 = (int16)READ_LE_UINT16((uint16 *)v8 + 45); - if (v11) - _vm->_objectsManager.setBobAnimation(v11); - v12 = (int16)READ_LE_UINT16((uint16 *)v8 + 46); - if (v12) - _vm->_objectsManager.setBobAnimation(v12); - v13 = (int16)READ_LE_UINT16((uint16 *)v8 + 47); - if (v13) - _vm->_objectsManager.setBobAnimation(v13); + uint16 *bufPtr = (uint16 *)_characterBuffer + 43; + int curVal = (int16)READ_LE_UINT16(bufPtr); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 1); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 2); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 3); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 4); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); } else { VISU_PARLE(); } @@ -427,52 +389,47 @@ int TalkManager::DIALOGUE_REP(int idx) { _vm->_fontManager.showText(9); } if (!_vm->_soundManager.mixVoice(v22, 1)) { - v14 = 0; _vm->_eventsManager._curMouseButton = 0; _vm->_eventsManager._mouseButton = 0; if (_vm->getIsDemo()) { - do { + for (int i = 0; i < v6; i++) { _vm->_eventsManager.VBL(); - ++v14; - } while (v14 != v6); + } } else { - int tmpVal = 0; - do { + for (int i = 0; i < v6; i++) { _vm->_eventsManager.VBL(); - ++v14; if (_vm->_eventsManager._mouseButton || _vm->_eventsManager._curMouseButton) - v14 = v6; - if (_vm->_eventsManager.getMouseButton()) { - tmpVal = v6 / 5; - if (tmpVal < 0) - tmpVal = -tmpVal; - if (v14 > tmpVal) - v14 = v6; - } - } while (v14 != v6); + break; + if (_vm->_eventsManager.getMouseButton() && i + 1 > abs(v6 / 5)) + break; + } } } if (!_vm->_soundManager._textOffFl) _vm->_fontManager.hideText(9); if (STATI) { - v15 = _characterBuffer; - v16 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); - if (v16) - _vm->_objectsManager.stopBobAnimation(v16); - v17 = (int16)READ_LE_UINT16((uint16 *)v15 + 44); - if (v17) - _vm->_objectsManager.stopBobAnimation(v17); - v18 = (int16)READ_LE_UINT16((uint16 *)v15 + 45); - if (v18) - _vm->_objectsManager.stopBobAnimation(v18); - v19 = (int16)READ_LE_UINT16((uint16 *)v15 + 46); - if (v19) - _vm->_objectsManager.stopBobAnimation(v19); - v20 = (int16)READ_LE_UINT16((uint16 *)v15 + 47); - if (v20) - _vm->_objectsManager.stopBobAnimation(v20); + uint16 *bufPtr = (uint16 *)_characterBuffer + 43; + int curVal = (int16)READ_LE_UINT16(bufPtr); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 1); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 2); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 3); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); + + curVal = (int16)READ_LE_UINT16(bufPtr + 4); + if (curVal) + _vm->_objectsManager.stopBobAnimation(curVal); } else { dialogEndTalk(); } diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 88fb11ed08..ca17f09c3c 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -41,7 +41,7 @@ public: byte *_characterSprite; byte *_characterAnim; size_t _characterSize; - int STATI; + bool STATI; int PLIGNE1, PLIGNE2; int PLIGNE3, PLIGNE4; int _paletteBufferIdx; -- cgit v1.2.3 From 4d16fb1bbde48b091bf1be48a110f1969fa876ec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Jan 2013 23:38:03 +0100 Subject: HOPKINS: More refactoring in TalkManager --- engines/hopkins/talk.cpp | 152 ++++++++++++++++++++++------------------------- 1 file changed, 71 insertions(+), 81 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 8fb70c19e1..2628621be5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -245,17 +245,20 @@ int TalkManager::DIALOGUE() { dialogWait(); } - int v19 = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); - int v2 = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); - int v3 = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); - int v20 = 420 - 20 * VERIF_BOITE(PLIGNE4, _questionsFilename, 65); - int v21 = v20 - 20 * v3; - int v18 = v21 - 1; - int v4 = v21 - 20 * v2; - _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, v4 - 20 * v19, 0, 65, 255); - _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, v4, 0, 65, 255); - _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, v21, 0, 65, 255); - _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, v20, 0, 65, 255); + int sentence1LineNumb = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); + int sentence2LineNumb = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); + int sentence3LineNumb = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); + int sentence4LineNumb = VERIF_BOITE(PLIGNE4, _questionsFilename, 65); + + int sentence4PosY = 420 - 20 * sentence4LineNumb; + int sentence3PosY = sentence4PosY - 20 * sentence3LineNumb; + int sentence2PosY = sentence3PosY - 20 * sentence2LineNumb; + int sentence1PosY = sentence2PosY - 20 * sentence1LineNumb; + + _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, sentence1PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, sentence2PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, sentence3PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, sentence4PosY, 0, 65, 255); _vm->_fontManager.showText(5); _vm->_fontManager.showText(6); _vm->_fontManager.showText(7); @@ -265,19 +268,19 @@ int TalkManager::DIALOGUE() { bool v6 = false; do { int mousePosY = _vm->_eventsManager.getMouseY(); - if ((v4 - 20 * v19) < mousePosY && (v4 - 1) > mousePosY) { + if (sentence1PosY < mousePosY && mousePosY < (sentence2PosY - 1)) { _vm->_fontManager.setOptimalColor(6, 7, 8, 5); retVal = PLIGNE1; } - if (mousePosY > v4 && v18 > mousePosY) { + if (sentence2PosY < mousePosY && mousePosY < (sentence3PosY - 1)) { _vm->_fontManager.setOptimalColor(5, 7, 8, 6); retVal = PLIGNE2; } - if (v21 < mousePosY && (v20 - 1) > mousePosY) { + if (sentence3PosY < mousePosY && mousePosY < (sentence4PosY - 1)) { _vm->_fontManager.setOptimalColor(5, 6, 8, 7); retVal = PLIGNE3; } - if (v20 < mousePosY && mousePosY < 419) { + if (sentence4PosY < mousePosY && mousePosY < 419) { _vm->_fontManager.setOptimalColor(5, 6, 7, 8); retVal = PLIGNE4; } @@ -510,16 +513,13 @@ void TalkManager::dialogEndTalk() { } int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { - char v8; int v9; int v10; char v11; char v13; - char v14; int v15; byte *ptr; int v17; - int v18; byte *v19; uint32 indexData[4047]; Common::String filename; @@ -527,7 +527,6 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { Common::File f; int filesize; - v18 = 0; _vm->_globals.police_l = 11; // Build up the filename @@ -569,47 +568,42 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { v13 = *v19 + 111; } *v19 = v13; - v19 = v19 + 1; + v19++; } for (int i = 0; i < 2048; i++) { - v8 = ptr[i]; - if ( v8 == 10 || v8 == 13 ) + if ( ptr[i] == 10 || ptr[i] == 13 ) ptr[i] = 0; } v9 = 0; v15 = (11 * a3) - 4; + int lineCount = 0; do { v10 = 0; for (;;) { v17 = v10; do { v11 = ptr[v9 + v10]; - v14 = v11; ++v10; } while (v11 != ' ' && v11 != '%'); - if (v10 >= v15 / _vm->_globals.police_l) + if (v10 >= v15 / _vm->_globals.police_l) { + if (v11 == '%') + v11 = ' '; break; + } + if (v11 == '%') { - if (v10 < v15 / _vm->_globals.police_l) - goto LABEL_31; + v17 = v10; break; } } - if (v11 != '%') - goto LABEL_33; - v14 = ' '; -LABEL_31: - if (v14 == '%') - v17 = v10; -LABEL_33: - ++v18; + ++lineCount; v9 += v17; - } while (v14 != 37); + } while (v11 != '%'); free(ptr); - return v18; + return lineCount; } void TalkManager::VISU_PARLE() { @@ -676,51 +670,47 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { * Initialize character animation */ void TalkManager::initCharacterAnim() { - byte *v0; - byte *v1; - int v2; - int v4; - int v5; - int v6; - int v7; - int v8; - int v9; - int v10; - int v11; - int v12; - - v0 = _characterBuffer; - v1 = _characterBuffer + 110; - v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 43); - if (v2) - searchCharacterAnim(21, (_characterBuffer + 110), v2, _characterSize); - v4 = (int16)READ_LE_UINT16((uint16 *)v0 + 44); - if (v4) - searchCharacterAnim(22, v1, v4, _characterSize); - v5 = (int16)READ_LE_UINT16((uint16 *)v0 + 45); - if (v5) - searchCharacterAnim(23, v1, v5, _characterSize); - v6 = (int16)READ_LE_UINT16((uint16 *)v0 + 46); - if (v6) - searchCharacterAnim(24, v1, v6, _characterSize); - v7 = (int16)READ_LE_UINT16((uint16 *)v0 + 47); - if (v7) - searchCharacterAnim(25, v1, v7, _characterSize); - v8 = (int16)READ_LE_UINT16((uint16 *)v0 + 48); - if (v8) - searchCharacterAnim(26, v1, v8, _characterSize); - v9 = (int16)READ_LE_UINT16((uint16 *)v0 + 49); - if (v9) - searchCharacterAnim(27, v1, v9, _characterSize); - v10 = (int16)READ_LE_UINT16((uint16 *)v0 + 50); - if (v10) - searchCharacterAnim(28, v1, v10, _characterSize); - v11 = (int16)READ_LE_UINT16((uint16 *)v0 + 51); - if (v11) - searchCharacterAnim(29, v1, v11, _characterSize); - v12 = (int16)READ_LE_UINT16((uint16 *)v0 + 52); - if (v12) - searchCharacterAnim(30, v1, v12, _characterSize); + uint16 *bufPtr = (uint16 *)_characterBuffer + 43; + byte *animPtr = _characterBuffer + 110; + int curVal = (int16)READ_LE_UINT16(bufPtr); + if (curVal) + searchCharacterAnim(21, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 1); + if (curVal) + searchCharacterAnim(22, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 2); + if (curVal) + searchCharacterAnim(23, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 3); + if (curVal) + searchCharacterAnim(24, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 4); + if (curVal) + searchCharacterAnim(25, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 5); + if (curVal) + searchCharacterAnim(26, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 6); + if (curVal) + searchCharacterAnim(27, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 7); + if (curVal) + searchCharacterAnim(28, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 8); + if (curVal) + searchCharacterAnim(29, animPtr, curVal, _characterSize); + + curVal = (int16)READ_LE_UINT16(bufPtr + 9); + if (curVal) + searchCharacterAnim(30, animPtr, curVal, _characterSize); } void TalkManager::clearCharacterAnim() { -- cgit v1.2.3 From ae4d99b1652d7bb1bfad3c5a2802255177286bd1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Jan 2013 23:48:09 +0100 Subject: HOPKINS: Move 4 int to boolean in TalkManager --- engines/hopkins/talk.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2628621be5..e5b1b08774 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -724,7 +724,6 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int bool result; const byte *v5; int v6; - int v7; byte *v8; byte *v9; int v10; @@ -746,11 +745,11 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int v5 = v22 + bufPerso + 5; v18 = v22 + 5; v6 = 0; - v7 = 0; + bool v7 = false; do { if ((v5[0] == 'A' && v5[1] == 'N' && v5[2] == 'I' && v5[3] == 'M') || (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N')) - v7 = 1; + v7 = true; if (v18 > a4) { _vm->_globals.Bqe_Anim[idx]._enabledFl = false; result = false; @@ -759,7 +758,7 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int ++v18; ++v6; ++v5; - } while (v7 != 1); + } while (!v7); _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(v6 + 50); _vm->_globals.Bqe_Anim[idx]._enabledFl = true; memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(v22 + bufPerso + 5), 20); @@ -814,27 +813,27 @@ void TalkManager::REPONSE(int a1, int a2) { uint16 v11; int v12; int v13; - int v15; - int v16; + bool v15; + bool v16; bool loopCond; byte *ptr; v2 = a1; v3 = a2; LABEL_2: - v15 = 0; + v15 = false; if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; for (;;) { if (v5[0] == 'C' && v5[1] == 'O' && v5[2] == 'D') { if (v5[3] == v2 && v5[4] == v3) - v15 = 1; + v15 = true; } if (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N') break; if (!v15) - v5 = v5 + 1; - if (v15 == 1) { + v5++; + else if (v15) { v6 = v5 + 5; ptr = _vm->_globals.allocMemory(620); if (g_PTRNUL == ptr) @@ -844,7 +843,7 @@ LABEL_2: v12 = 0; loopCond = false; do { - v16 = 0; + v16 = false; if (v6[v7] == 'F' && v6[v7 + 1] == 'C') { ++v12; assert(v12 < (620 / 20)); @@ -855,14 +854,14 @@ LABEL_2: assert(v11 < 20); v8[v11++] = v6[v7++]; if (v6[v7] == 'F' && v6[v7 + 1] == 'F') { - v16 = 1; + v16 = true; v8[v11] = 'F'; v8[v11 + 1] = 'F'; ++v7; } - } while (v16 != 1); + } while (!v16); } - if (v16 != 1) { + if (!v16) { if ((v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') || (v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N')) loopCond = true; } -- cgit v1.2.3 From b7abcf2bfb9f98330d6d9dae2c25210d14093e3d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Jan 2013 00:18:53 +0100 Subject: HOPKINS: Fix loops on zoom in Affiche_perfect. Thanks fuzzie for the help! --- engines/hopkins/graphics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 2b5eef98d7..7f6d7223a7 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1324,7 +1324,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if ((uint16)clip_y >= v22) return; int v30 = 0; - while (zoomIn(v30 + 1, zoom2) < (uint16)clip_y) + while (zoomIn(++v30, zoom2) < (uint16)clip_y) ; spritePixelsP += _width * v30; v29 += _lineNbr2 * (uint16)clip_y; @@ -1341,7 +1341,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v32 = v20 - (uint16)clip_x1; v29 -= v32; int v33 = 0; - while (zoomIn(v33 + 1, zoom2) < v32) + while (zoomIn(++v33, zoom2) < v32) ; int v34 = v33; spritePixelsP += v34; @@ -1400,7 +1400,7 @@ R_Aff_Zoom_Larg_Cont1: int v49 = v20; int v23 = 0; int v24 = (uint16)clip_y; - while (zoomIn(v23 + 1, zoom2) < v24) + while (zoomIn(++v23, zoom2) < v24) ; v20 = v49; spritePixelsP += _width * v23; @@ -1413,7 +1413,7 @@ R_Aff_Zoom_Larg_Cont1: if ((uint16)clip_x >= v20) return; int v26 = 0; - while (zoomIn(v26 + 1, zoom2) < (uint16)clip_x) + while (zoomIn(++v26, zoom2) < (uint16)clip_x) ; spritePixelsP += v26; dest1P += (uint16)clip_x; -- cgit v1.2.3 From 4ce218ef00225dc6f0032fe263a53170dfbbea9b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Jan 2013 08:20:19 +0100 Subject: HOPKINS: Fix a BE issue --- engines/hopkins/script.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d90ae76b75..d94cb87e14 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -278,11 +278,10 @@ int ScriptManager::handleOpcode(byte *dataP) { int v73 = (int16)READ_LE_UINT16(dataP + 5); if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { v70 = 0; - if ((int16)READ_LE_UINT16(dataP + 5) == 14) - v73 = 1; switch (v73) { case 1: + case 14: if (_vm->_globals._actionDirection == 1) _vm->_objectsManager.ACTION_DOS(4); if (_vm->_globals._actionDirection == 3) @@ -2205,6 +2204,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); break; + // Resurrect Samantha's clone case 242: { _vm->_soundManager.playSound("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = true; @@ -2385,7 +2385,10 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 4; } else if (dataP[2] == 'V' && dataP[3] == 'A' && dataP[4] == 'L') { opcodeType = 1; - _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] = (int16)READ_LE_UINT16(dataP + 7); + int idx = (int16)READ_LE_UINT16(dataP + 5); + assert(idx >= 0 && idx < 2050); + _vm->_globals._saveData->data[idx] = dataP[7]; + _vm->_globals._saveData->data[idx + 1] = dataP[8]; } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { opcodeType = 1; _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; -- cgit v1.2.3 From d90720dee11e9814092dab31486fcb74398c688e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Jan 2013 08:35:24 +0100 Subject: HOPKINS: Some simplifications in handleOpcode() --- engines/hopkins/script.cpp | 72 ++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d94cb87e14..86c86339e5 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -50,10 +50,6 @@ int ScriptManager::handleOpcode(byte *dataP) { int v70 = 0; if (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') { v70 = dataP[6]; - byte v2 = dataP[7]; - byte v69 = dataP[8]; - int v67 = (int16)READ_LE_UINT16(dataP + 9); - int v65 = (int16)READ_LE_UINT16(dataP + 11); int mesgId = (int16)READ_LE_UINT16(dataP + 13); opcodeType = 1; if (!TRAVAILOBJET) { @@ -133,7 +129,9 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_soundManager._soundFl); } if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 6, v2, 253); + int textPosX = (int16)READ_LE_UINT16(dataP + 9); + int textPosY = (int16)READ_LE_UINT16(dataP + 11); + _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } @@ -142,18 +140,19 @@ int ScriptManager::handleOpcode(byte *dataP) { } if (TRAVAILOBJET) { if (_vm->_globals._saveData->data[svField356]) { - _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, v69, 35, 253); + _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, dataP[8], 35, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(635, 4); } else { + int textPosX = (int16)READ_LE_UINT16(dataP + 9); if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl) - _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * v67, 60, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * textPosX, 60, 6, dataP[7], 253); else if (_vm->_globals._language == LANG_EN && !_vm->_soundManager._textOffFl) - _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * v67, 60, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * textPosX, 60, 6, dataP[7], 253); else if (_vm->_globals._language == LANG_SP && !_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * v67, 60, 6, v2, 253); + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * textPosX, 60, 6, dataP[7], 253); } if (!_vm->_soundManager._textOffFl) @@ -174,33 +173,29 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(dataP + 10), v70); } else if (v72 == 51) { _vm->_objectsManager.BOB_VIVANT(v70); - } else { - if (v72 != 50) { - _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); - if (v4) - v4 /= _vm->_globals._speed; - if (v4 > 1) { - do { - if (_vm->shouldQuit()) - return -1; // Exiting game - - --v4; - _vm->_eventsManager.VBL(); - } while (v4); - } - } else - _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); - } + } else if (v72 != 50) { + _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); + if (v4) + v4 /= _vm->_globals._speed; + if (v4 > 1) { + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + --v4; + _vm->_eventsManager.VBL(); + } while (v4); + } + } else + _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); } opcodeType = 1; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { if (!_vm->_objectsManager._disableFl) { _vm->_objectsManager._twoCharactersFl = false; - int v5 = dataP[5]; - int v6 = (int16)READ_LE_UINT16(dataP + 8); _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); - _vm->_objectsManager._characterPos.y = v6; - _vm->_objectsManager.PERI = v5; + _vm->_objectsManager._characterPos.y = (int16)READ_LE_UINT16(dataP + 8); + _vm->_objectsManager.PERI = dataP[5]; if (_vm->_objectsManager.CH_TETE) { if (_vm->_globals._saveData->data[svField354] == 1 && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y @@ -256,18 +251,13 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.CH_TETE = false; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { if (!_vm->_objectsManager._disableFl) { - int v7 = dataP[5]; - v70 = dataP[6]; - int v8 = dataP[7]; - int v9 = dataP[8]; _vm->_objectsManager.RECALL = 0; _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; - _vm->_globals._screenId = v7; - _vm->_globals._saveData->data[svField5] = v7; - _vm->_objectsManager.PTAILLE = v70; - _vm->_objectsManager.PEROFX = v8; - _vm->_objectsManager.PEROFY = v9; + _vm->_globals._screenId = _vm->_globals._saveData->data[svField5] = dataP[5]; + _vm->_objectsManager.PTAILLE = v70 = dataP[6]; + _vm->_objectsManager.PEROFX = dataP[7]; + _vm->_objectsManager.PEROFY = dataP[8]; } opcodeType = 1; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') { @@ -275,11 +265,11 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; } else if (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') { - int v73 = (int16)READ_LE_UINT16(dataP + 5); + int specialOpcode = (int16)READ_LE_UINT16(dataP + 5); if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { v70 = 0; - switch (v73) { + switch (specialOpcode) { case 1: case 14: if (_vm->_globals._actionDirection == 1) -- cgit v1.2.3 From 8a41d3c1fcacc21355f9dadb99eabf2a1cbb9c64 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Jan 2013 19:04:44 +0100 Subject: HOPKINS: (on behalf of fuzzie) Fix zoom bug introduced in 1c5a6f8c74a794e9a913c9b2c0bebfd59ac0fd9e --- engines/hopkins/script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 86c86339e5..69af1cc318 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2209,7 +2209,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; - v53->field4 = 242 - (100 * (67 - (100 - v54)) / 67); + v53->field4 = -(100 * (67 - (100 - v54)) / 67); _vm->_globals._saveData->data[svField357] = 1; _vm->_globals._saveData->data[svField354] = 0; _vm->_globals._saveData->data[svField356] = 0; -- cgit v1.2.3 From c8c1c88654c822a9a6e316a36ca9e9c356305698 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Jan 2013 20:06:00 +0100 Subject: HOPKINS: Remove a lot of useless variables in ObjectsManager --- engines/hopkins/dialogs.cpp | 1 - engines/hopkins/objects.cpp | 55 +++++---------------------------------------- engines/hopkins/objects.h | 23 +++---------------- engines/hopkins/script.cpp | 36 ++++++++++++++--------------- 4 files changed, 25 insertions(+), 90 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 489ce0f625..90eb5f3193 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -671,7 +671,6 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); _vm->_objectsManager._saveLoadFl = true; - _vm->_objectsManager.SL_MODE = a1; _vm->_objectsManager._saveLoadX = 0; _vm->_objectsManager._saveLoadY = 0; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index cdd6930329..5c9c9b8e76 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -53,7 +53,6 @@ ObjectsManager::ObjectsManager() { S_old_spr = g_PTRNUL; PERSO_ON = false; _saveLoadFl = false; - SL_MODE = false; _visibleFl = false; BOBTOUS = false; my_anim = 0; @@ -61,35 +60,19 @@ ObjectsManager::ObjectsManager() { _forceZoneFl = false; _changeVerbFl = false; _verb = 0; - Vold_taille = 0; - SPEED_X = SPEED_Y = 0; - SPEED_IMAGE = 0; - SPEED_PTR = g_PTRNUL; _lastLine = 0; - A_ANIM = 0; - MA_ANIM = 0; - MA_ANIM1 = 0; - A_DEPA = 0; - MAX_DEPA = 0; - MAX_DEPA1 = 0; - CH_TETE = false; - T_RECTIF = 0; + _changeHeadFl = false; _disableFl = false; _twoCharactersFl = false; _characterPos = Common::Point(0, 0); PERI = 0; - RECALL = 0; - PTAILLE = 0; - PEROFX = 0; - PEROFY = 0; - OBSSEUL = 0; + OBSSEUL = false; NVVERBE = 0; NVZONE = 0; S_old_ani = 0; S_old_ret = 0; nouveau_x = nouveau_y = 0; _newDirection = 0; - nouveau_anim = 0; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -1487,8 +1470,6 @@ void ObjectsManager::GOHOME() { _newDirection = *_vm->_globals.chemin; _vm->_globals.chemin++; - - nouveau_anim = *_vm->_globals.chemin; _vm->_globals.chemin++; if (nouveau_x != -1 || nouveau_y != -1) { @@ -1779,7 +1760,6 @@ void ObjectsManager::GOHOME() { _newDirection = *_vm->_globals.chemin; _vm->_globals.chemin++; - nouveau_anim = *_vm->_globals.chemin; _vm->_globals.chemin++; if (nouveau_x == -1 && v48 == -1) { @@ -1869,8 +1849,6 @@ void ObjectsManager::GOHOME2() { _newDirection = *_vm->_globals.chemin; _vm->_globals.chemin++; - - nouveau_anim = *_vm->_globals.chemin; _vm->_globals.chemin++; if ((nouveau_x == -1) && (nouveau_y == -1)) @@ -1907,8 +1885,6 @@ void ObjectsManager::GOHOME2() { _vm->_globals.chemin = (int16 *)g_PTRNUL; my_anim = 0; - A_ANIM = 0; - A_DEPA = 0; } /** @@ -2435,11 +2411,6 @@ void ObjectsManager::clearScreen() { _vm->_eventsManager._mouseCursorId = 4; _verb = 4; _zoneNum = 0; - Vold_taille = 0; - SPEED_PTR = g_PTRNUL; - SPEED_X = 0; - SPEED_Y = 0; - SPEED_IMAGE = 0; _forceZoneFl = true; _vm->_linesManager._linesNumb = 0; _lastLine = 0; @@ -2448,7 +2419,6 @@ void ObjectsManager::clearScreen() { _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager._mouseSpriteId = 0; - Vold_taille = 200; _vm->_globals._saveData->data[svField1] = 0; _vm->_globals._saveData->data[svField2] = 0; _vm->_globals.GOACTION = false; @@ -2457,12 +2427,6 @@ void ObjectsManager::clearScreen() { _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; my_anim = 1; - A_ANIM = 0; - MA_ANIM = 0; - MA_ANIM1 = 0; - A_DEPA = 0; - MAX_DEPA = 0; - MAX_DEPA1 = 0; _vm->_graphicsManager.RESET_SEGMENT_VESA(); } @@ -2472,7 +2436,7 @@ void ObjectsManager::clearScreen() { void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { CharacterLocation *loc; - CH_TETE = true; + _changeHeadFl = true; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); _vm->_globals.NOT_VERIF = true; @@ -2480,7 +2444,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { - CH_TETE = false; + _changeHeadFl = false; loc = &_vm->_globals._saveData->_samantha; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); @@ -2496,7 +2460,6 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals._saveData->data[svField354] = 0; _vm->_globals._saveData->data[svField356] = 0; _vm->_globals._saveData->data[svField357] = 1; - T_RECTIF = 0; loc = &_vm->_globals._saveData->_realHopkins; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); @@ -2506,7 +2469,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_globals.loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { - CH_TETE = false; + _changeHeadFl = false; loc = &_vm->_globals._saveData->_realHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); @@ -3719,14 +3682,6 @@ void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { } } - -void ObjectsManager::AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img) { - SPEED_PTR = speedData; - SPEED_X = xp; - SPEED_Y = yp; - SPEED_IMAGE = img; -} - int ObjectsManager::BOBPOSI(int idx) { return _vm->_globals._bob[idx].field10 / 5; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 2db9983d85..8c0741c1f1 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -78,7 +78,6 @@ public: const byte *S_old_spr; bool PERSO_ON; bool _saveLoadFl; - int SL_MODE; bool _visibleFl; bool BOBTOUS; int my_anim; @@ -86,28 +85,13 @@ public: bool _forceZoneFl; bool _changeVerbFl; int _verb; - int Vold_taille; - int SPEED_X, SPEED_Y; - int SPEED_IMAGE; - byte *SPEED_PTR; int _lastLine; - int A_ANIM; - int MA_ANIM; - int MA_ANIM1; - int A_DEPA; - int MAX_DEPA; - int MAX_DEPA1; - bool CH_TETE; - int T_RECTIF; + bool _changeHeadFl; bool _disableFl; bool _twoCharactersFl; Common::Point _characterPos; int PERI; - int RECALL; - int PTAILLE; - int PEROFX; - int PEROFY; - int OBSSEUL; + bool OBSSEUL; int NVVERBE; int NVZONE; int S_old_ani; @@ -210,8 +194,7 @@ public: void ZONE_ON(int idx); void disableZone(int idx); - void OPTI_ONE(int a1, int a2, int a3, int a4); - void AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img); + void OPTI_ONE(int idx, int fromPosi, int destPosi, int a4); int BOBPOSI(int idx); void setBobAnimation(int idx); void stopBobAnimation(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 69af1cc318..477f44b3a9 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -187,7 +187,8 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (v4); } } else - _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); + // TODO: Remove this: + warning("Former AFFICHE_SPEED1: %d %d %d", v68, v66, v70); } opcodeType = 1; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { @@ -196,7 +197,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); _vm->_objectsManager._characterPos.y = (int16)READ_LE_UINT16(dataP + 8); _vm->_objectsManager.PERI = dataP[5]; - if (_vm->_objectsManager.CH_TETE) { + if (_vm->_objectsManager._changeHeadFl) { if (_vm->_globals._saveData->data[svField354] == 1 && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y && _vm->_globals._saveData->_cloneHopkins.field2 && _vm->_globals._saveData->_cloneHopkins._location) { @@ -248,16 +249,13 @@ int ScriptManager::handleOpcode(byte *dataP) { } } opcodeType = 1; - _vm->_objectsManager.CH_TETE = false; + _vm->_objectsManager._changeHeadFl = false; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { if (!_vm->_objectsManager._disableFl) { - _vm->_objectsManager.RECALL = 0; _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; _vm->_globals._screenId = _vm->_globals._saveData->data[svField5] = dataP[5]; - _vm->_objectsManager.PTAILLE = v70 = dataP[6]; - _vm->_objectsManager.PEROFX = dataP[7]; - _vm->_objectsManager.PEROFY = dataP[8]; + v70 = dataP[6]; } opcodeType = 1; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') { @@ -901,9 +899,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.OPTI_ONE(15, 0, 12, 0); _vm->_objectsManager.stopBobAnimation(15); - _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.INILINK("IM19a"); - _vm->_objectsManager.OBSSEUL = 0; + _vm->_objectsManager.OBSSEUL = false; break; case 56: @@ -1030,9 +1028,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(12); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.animateSprite(0); - _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.INILINK("IM27a"); - _vm->_objectsManager.OBSSEUL = 0; + _vm->_objectsManager.OBSSEUL = false; break; } @@ -1124,9 +1122,9 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.BOBPOSI(5) != 6); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(6); - _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.INILINK("IM24a"); - _vm->_objectsManager.OBSSEUL = 0; + _vm->_objectsManager.OBSSEUL = false; break; case 86: @@ -1887,9 +1885,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.SPECIAL_SOUND = 0; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); _vm->_objectsManager.setBobAnimation(9); - _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.INILINK("IM73a"); - _vm->_objectsManager.OBSSEUL = 0; + _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); _vm->_animationManager.NO_SEQ = false; _vm->_globals.CACHE_ADD(0); @@ -1944,9 +1942,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 230: { - _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.INILINK("IM93a"); - _vm->_objectsManager.OBSSEUL = 0; + _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); @@ -1983,9 +1981,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.setSpriteY(0, 278); _vm->_objectsManager.animateSprite(0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); - _vm->_objectsManager.OBSSEUL = 1; + _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.INILINK("IM93c"); - _vm->_objectsManager.OBSSEUL = 0; + _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); break; } -- cgit v1.2.3 From 9c58c936c8eeacf656e6304f54ddf795574bf57d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Jan 2013 08:32:07 +0100 Subject: HOPKINS: Some renaming and refactoring --- engines/hopkins/dialogs.cpp | 24 +++++------ engines/hopkins/objects.cpp | 102 +++++++++++++++++++------------------------- engines/hopkins/objects.h | 13 +++--- 3 files changed, 60 insertions(+), 79 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 90eb5f3193..2930d0f745 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -553,8 +553,8 @@ void DialogsManager::showLoadGame() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); _vm->_objectsManager.BOBTOUS = true; - _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); - _vm->_objectsManager.SL_SPR2 = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager._saveLoadSprite = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite); + _vm->_objectsManager._saveLoadSprite2 = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite2); _vm->_objectsManager._saveLoadX = 0; _vm->_objectsManager._saveLoadY = 0; @@ -584,8 +584,8 @@ void DialogsManager::showSaveGame() { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); _vm->_objectsManager.BOBTOUS = true; - _vm->_objectsManager.SL_SPR = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR); - _vm->_objectsManager.SL_SPR2 = _vm->_globals.freeMemory(_vm->_objectsManager.SL_SPR2); + _vm->_objectsManager._saveLoadSprite = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite); + _vm->_objectsManager._saveLoadSprite2 = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite2); _vm->_objectsManager._saveLoadX = 0; _vm->_objectsManager._saveLoadY = 0; @@ -619,20 +619,20 @@ void DialogsManager::showSaveLoad(int a1) { break; } - _vm->_objectsManager.SL_SPR = _vm->_objectsManager.loadSprite(filename); - _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite("SAVE2.SPR"); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); + _vm->_objectsManager._saveLoadSprite = _vm->_objectsManager.loadSprite(filename); + _vm->_objectsManager._saveLoadSprite2 = _vm->_objectsManager.loadSprite("SAVE2.SPR"); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 483, 360, 0); if (_vm->_globals._language == LANG_FR) { if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 525, 375, 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 525, 375, 1); if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 515, 375, 2); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 515, 375, 2); } else { if (a1 == 1) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 535, 372, 1); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 535, 372, 1); if (a1 == 2) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 539, 372, 2); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 539, 372, 2); } for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { @@ -669,7 +669,7 @@ void DialogsManager::showSaveLoad(int a1) { } } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); _vm->_objectsManager._saveLoadFl = true; _vm->_objectsManager._saveLoadX = 0; _vm->_objectsManager._saveLoadY = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5c9c9b8e76..133eaf7919 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -47,8 +47,8 @@ ObjectsManager::ObjectsManager() { I_old_x = I_old_y = 0; g_old_x = g_old_y = 0; FLAG_VISIBLE_EFFACE = 0; - SL_SPR = g_PTRNUL; - SL_SPR2 = g_PTRNUL; + _saveLoadSprite = g_PTRNUL; + _saveLoadSprite2 = g_PTRNUL; _spritePtr = g_PTRNUL; S_old_spr = g_PTRNUL; PERSO_ON = false; @@ -67,12 +67,10 @@ ObjectsManager::ObjectsManager() { _characterPos = Common::Point(0, 0); PERI = 0; OBSSEUL = false; - NVVERBE = 0; - NVZONE = 0; - S_old_ani = 0; + _jumpVerb = 0; + _jumpZone = 0; + _oldSpriteIndex = 0; S_old_ret = 0; - nouveau_x = nouveau_y = 0; - _newDirection = 0; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -399,9 +397,9 @@ void ObjectsManager::displaySprite() { } if (_saveLoadFl) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, SL_SPR, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, _saveLoadSprite, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); if (_saveLoadX && _saveLoadY) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, SL_SPR2, _saveLoadX + _vm->_eventsManager._startPos.x + 300, _saveLoadY + 300, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _saveLoadSprite2, _saveLoadX + _vm->_eventsManager._startPos.x + 300, _saveLoadY + 300, 0); _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); } @@ -484,7 +482,6 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._frameIndex = 0; bob.field10 = 0; bob.field12 = 0; - bob.field14 = 0; bob._disabledAnimationFl = false; bob._animData = g_PTRNUL; bob.field1C = false; @@ -1442,7 +1439,6 @@ void ObjectsManager::GOHOME() { unsigned int v44; unsigned int v45; unsigned int v46; - int16 v48; int v49; int v54; int16 v58; @@ -1459,25 +1455,24 @@ void ObjectsManager::GOHOME() { return; } + int newPosX; + int newPosY; + int newDirection; + _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); - nouveau_x = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - nouveau_y = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - _newDirection = *_vm->_globals.chemin; - _vm->_globals.chemin++; + newPosX = *_vm->_globals.chemin++; + newPosY = *_vm->_globals.chemin++; + int newDirection = *_vm->_globals.chemin++; _vm->_globals.chemin++; - if (nouveau_x != -1 || nouveau_y != -1) { - _vm->_globals._oldDirection = _newDirection; - _vm->_globals._oldDirectionSpriteIdx = _newDirection + 59; + if (newPosX != -1 || newPosY != -1) { + _vm->_globals._oldDirection = newDirection; + _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; _vm->_globals.g_old_anim = 0; - g_old_x = nouveau_x; - g_old_y = nouveau_y; + g_old_x = newPosX; + g_old_y = newPosY; } else { setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; @@ -1751,18 +1746,12 @@ void ObjectsManager::GOHOME() { } bool v47 = false; do { - nouveau_x = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - v48 = *_vm->_globals.chemin; - nouveau_y = *_vm->_globals.chemin; + newPosX = *_vm->_globals.chemin++; + newPosY = *_vm->_globals.chemin++; + newDirection = *_vm->_globals.chemin++; _vm->_globals.chemin++; - _newDirection = *_vm->_globals.chemin; - _vm->_globals.chemin++; - _vm->_globals.chemin++; - - if (nouveau_x == -1 && v48 == -1) { + if (newPosX == -1 && newPosY == -1) { if (_vm->_globals.GOACTION) v49 = _vm->_globals._saveData->data[svField2]; else @@ -1792,12 +1781,12 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; return; } - if (_vm->_globals._oldDirection != _newDirection) + if (_vm->_globals._oldDirection != newDirection) break; - if ((_newDirection == 3 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 7 && nouveau_x <= v0) || - (_vm->_globals._oldDirection == 1 && nouveau_y <= v58) || (_vm->_globals._oldDirection == 5 && nouveau_y >= v58) || - (_vm->_globals._oldDirection == 2 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 8 && nouveau_x <= v0) || - (_vm->_globals._oldDirection == 4 && nouveau_x >= v0) || (_vm->_globals._oldDirection == 6 && nouveau_x <= v0)) + if ((newDirection == 3 && newPosX >= v0) || (_vm->_globals._oldDirection == 7 && newPosX <= v0) || + (_vm->_globals._oldDirection == 1 && newPosY <= v58) || (_vm->_globals._oldDirection == 5 && newPosY >= v58) || + (_vm->_globals._oldDirection == 2 && newPosX >= v0) || (_vm->_globals._oldDirection == 8 && newPosX <= v0) || + (_vm->_globals._oldDirection == 4 && newPosX >= v0) || (_vm->_globals._oldDirection == 6 && newPosX <= v0)) v47 = true; } while (!v47); if (v47) { @@ -1809,8 +1798,8 @@ void ObjectsManager::GOHOME() { (_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5)) setFlipSprite(0, false); - setSpriteX(0, nouveau_x); - setSpriteY(0, nouveau_y); + setSpriteX(0, newPosX); + setSpriteY(0, newPosY); setSpriteIndex(0, v1); } else { if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) @@ -1821,11 +1810,11 @@ void ObjectsManager::GOHOME() { setFlipSprite(0, false); _vm->_globals.Compteur = 0; } - _vm->_globals._oldDirection = _newDirection; - _vm->_globals._oldDirectionSpriteIdx = _newDirection + 59; + _vm->_globals._oldDirection = newDirection; + _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; _vm->_globals.g_old_anim = v1; - g_old_x = nouveau_x; - g_old_y = nouveau_y; + g_old_x = newPosX; + g_old_y = newPosY; } void ObjectsManager::GOHOME2() { @@ -1841,24 +1830,19 @@ void ObjectsManager::GOHOME2() { _vm->_globals.j_104 = 0; for (;;) { - nouveau_x = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - nouveau_y = *_vm->_globals.chemin; - _vm->_globals.chemin++; - - _newDirection = *_vm->_globals.chemin; - _vm->_globals.chemin++; + int nexPosX = *_vm->_globals.chemin++; + int newPosY = *_vm->_globals.chemin++; + int newDirection = *_vm->_globals.chemin++; _vm->_globals.chemin++; - if ((nouveau_x == -1) && (nouveau_y == -1)) + if ((nexPosX == -1) && (newPosY == -1)) break; ++_vm->_globals.j_104; if (_vm->_globals.j_104 >= v0) { - _vm->_globals._lastDirection = _newDirection; - setSpriteX(0, nouveau_x); - setSpriteY(0, nouveau_y); + _vm->_globals._lastDirection = newDirection; + setSpriteX(0, nexPosX); + setSpriteY(0, newPosY); if (_vm->_globals._lastDirection == 1) setSpriteIndex(0, 4); else if (_vm->_globals._lastDirection == 3) @@ -4286,7 +4270,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int realSpeed = speed / 3; S_old_spr = _sprite[0]._spriteData; - S_old_ani = _sprite[0]._spriteIndex; + _oldSpriteIndex = _sprite[0]._spriteIndex; S_old_ret = _sprite[0].fieldE; _sprite[0].field12 += a3; _sprite[0].field14 += a4; @@ -4350,7 +4334,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin if (completeTokenFl) { if (spriteIndex == -1) { _sprite[0]._spriteData = S_old_spr; - _sprite[0]._spriteIndex = S_old_ani; + _sprite[0]._spriteIndex = _oldSpriteIndex; _sprite[0].field12 -= a3; _sprite[0].field14 -= a4; _sprite[0].fieldE = S_old_ret; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 8c0741c1f1..384b7c70b2 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -72,8 +72,8 @@ public: int I_old_x, I_old_y; int g_old_x, g_old_y; int FLAG_VISIBLE_EFFACE; - byte *SL_SPR; - byte *SL_SPR2; + byte *_saveLoadSprite; + byte *_saveLoadSprite2; byte *_spritePtr; const byte *S_old_spr; bool PERSO_ON; @@ -92,13 +92,10 @@ public: Common::Point _characterPos; int PERI; bool OBSSEUL; - int NVVERBE; - int NVZONE; - int S_old_ani; + int _jumpVerb; + int _jumpZone; + int _oldSpriteIndex; int S_old_ret; - int nouveau_x, nouveau_y; - int _newDirection; - int nouveau_anim; public: ObjectsManager(); void setParent(HopkinsEngine *vm); -- cgit v1.2.3 From 55b288e98b33dfdb57e0f381a4c38bebf5549c5e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Jan 2013 18:51:30 +0100 Subject: HOPKINS: Add some specific BeOS and OS2 files --- engines/hopkins/dialogs.cpp | 66 ++++++++++++++++++++++++++------------------- engines/hopkins/hopkins.cpp | 48 ++++++++++++++++++++------------- 2 files changed, 69 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 2930d0f745..b06d2707c5 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -60,12 +60,16 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); Common::String filename; - if (_vm->_globals._language == LANG_FR) - filename = "OPTIFR.SPR"; - else if (_vm->_globals._language == LANG_EN) - filename = "OPTIAN.SPR"; - else if (_vm->_globals._language == LANG_SP) - filename = "OPTIES.SPR"; + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + filename = "OPTION.SPR"; + else { + if (_vm->_globals._language == LANG_FR) + filename = "OPTIFR.SPR"; + else if (_vm->_globals._language == LANG_EN) + filename = "OPTIAN.SPR"; + else if (_vm->_globals._language == LANG_SP) + filename = "OPTIES.SPR"; + } _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(filename); _vm->_globals._optionDialogFl = true; @@ -313,16 +317,20 @@ LABEL_7: _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); Common::String filename; - switch (_vm->_globals._language) { - case LANG_EN: - filename = "INVENTAN.SPR"; - break; - case LANG_FR: - filename = "INVENTFR.SPR"; - break; - case LANG_SP: - filename = "INVENTES.SPR"; - break; + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + filename = "INVENT.SPR"; + else { + switch (_vm->_globals._language) { + case LANG_EN: + filename = "INVENTAN.SPR"; + break; + case LANG_FR: + filename = "INVENTFR.SPR"; + break; + case LANG_SP: + filename = "INVENTES.SPR"; + break; + } } Common::File f; @@ -605,18 +613,22 @@ void DialogsManager::showSaveLoad(int a1) { int slotNumber; hopkinsSavegameHeader header; byte *thumb; - Common::String filename; - switch (_vm->_globals._language) { - case LANG_EN: - filename = "SAVEAN.SPR"; - break; - case LANG_FR: - filename = "SAVEFR.SPR"; - break; - case LANG_SP: - filename = "SAVEES.SPR"; - break; + + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + filename = "SAVE.SPR"; + else { + switch (_vm->_globals._language) { + case LANG_EN: + filename = "SAVEAN.SPR"; + break; + case LANG_FR: + filename = "SAVEFR.SPR"; + break; + case LANG_SP: + filename = "SAVEES.SPR"; + break; + } } _vm->_objectsManager._saveLoadSprite = _vm->_objectsManager.loadSprite(filename); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1097b31b40..34b410cf05 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -214,12 +214,16 @@ bool HopkinsEngine::runWin95Demo() { case 3: if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); - if (_globals._language == LANG_FR) - _graphicsManager.loadImage("fondfr"); - else if (_globals._language == LANG_EN) - _graphicsManager.loadImage("fondan"); - else if (_globals._language == LANG_SP) - _graphicsManager.loadImage("fondes"); + if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) + _graphicsManager.loadImage("fond"); + else { + if (_globals._language == LANG_FR) + _graphicsManager.loadImage("fondfr"); + else if (_globals._language == LANG_EN) + _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); + } _graphicsManager.fadeInLong(); _eventsManager.delay(500); _graphicsManager.fadeOutLong(); @@ -523,12 +527,16 @@ bool HopkinsEngine::runLinuxDemo() { case 3: if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); - if (_globals._language == LANG_FR) - _graphicsManager.loadImage("fondfr"); - else if (_globals._language == LANG_EN) - _graphicsManager.loadImage("fondan"); - else if (_globals._language == LANG_SP) - _graphicsManager.loadImage("fondes"); + if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) + _graphicsManager.loadImage("fond"); + else { + if (_globals._language == LANG_FR) + _graphicsManager.loadImage("fondfr"); + else if (_globals._language == LANG_EN) + _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); + } _graphicsManager.fadeInLong(); _eventsManager.delay(500); _graphicsManager.fadeOutLong(); @@ -860,12 +868,16 @@ bool HopkinsEngine::runFull() { case 3: if (!_globals._saveData->data[svField170]) { _soundManager.WSOUND(3); - if (_globals._language == LANG_FR) - _graphicsManager.loadImage("fondfr"); - else if (_globals._language == LANG_EN) - _graphicsManager.loadImage("fondan"); - else if (_globals._language == LANG_SP) - _graphicsManager.loadImage("fondes"); + if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) + _graphicsManager.loadImage("fond"); + else { + if (_globals._language == LANG_FR) + _graphicsManager.loadImage("fondfr"); + else if (_globals._language == LANG_EN) + _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); + } _graphicsManager.fadeInLong(); _eventsManager.delay(500); _graphicsManager.fadeOutLong(); -- cgit v1.2.3 From 4fd422692b554d4c49e2f00662f36f24bb9f1b24 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Jan 2013 18:52:19 +0100 Subject: HOPKINS: Some renaming and refactoring --- engines/hopkins/script.cpp | 9 +- engines/hopkins/sound.cpp | 16 ++-- engines/hopkins/sound.h | 6 +- engines/hopkins/talk.cpp | 212 +++++++++++++++++++++++---------------------- engines/hopkins/talk.h | 2 +- 5 files changed, 121 insertions(+), 124 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 477f44b3a9..aa478f2d6d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2390,14 +2390,13 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 1; } else if (dataP[2] == 'J' && dataP[3] == 'U' && dataP[4] == 'M') { - int v59 = (int16)READ_LE_UINT16(dataP + 7); - _vm->_objectsManager.NVZONE = (int16)READ_LE_UINT16(dataP + 5); - _vm->_objectsManager.NVVERBE = v59; + _vm->_objectsManager._jumpZone = (int16)READ_LE_UINT16(dataP + 5); + _vm->_objectsManager._jumpVerb = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 6; } else if (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') { - int v60 = (int16)READ_LE_UINT16(dataP + 5); + int soundNum = (int16)READ_LE_UINT16(dataP + 5); - Common::String file = Common::String::format("SOUND%d.WAV", v60); + Common::String file = Common::String::format("SOUND%d.WAV", soundNum); _vm->_soundManager.playSound(file); opcodeType = 1; } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 4da7bdac15..9f0212c9aa 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -569,7 +569,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { if (!_musicOffFl && _musicVolume > 2) _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); - PLAY_VOICE_SDL(); + playVoice(); // Loop for playing voice breakFlag = 0; @@ -698,13 +698,11 @@ void SoundManager::stopVoice(int voiceIndex) { Voice[voiceIndex]._status = 0; int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { - if (Swav[wavIndex].freeSample) + if (Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } } - Voice[voiceIndex].fieldC = 0; Voice[voiceIndex]._status = 0; - Voice[voiceIndex].field14 = 0; } void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength) { @@ -714,13 +712,13 @@ void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size Swav[20]._active = true; } -void SoundManager::PLAY_VOICE_SDL() { +void SoundManager::playVoice() { if (!Swav[20]._active) error("Bad handle"); if (!Voice[2]._status) { int wavIndex = Voice[2]._wavIndex; - if (Swav[wavIndex]._active && Swav[wavIndex].freeSample) + if (Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } @@ -761,7 +759,7 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename SDL_LoadVoice(filename, 0, 0, Swav[wavIndex]); Swav[wavIndex]._active = true; - Swav[wavIndex].freeSample = freeSample; + Swav[wavIndex]._freeSampleFl = freeSample; } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { @@ -790,12 +788,10 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { if (!Swav[wavIndex]._active) warning("Bad handle"); - if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex].freeSample) + if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); - Voice[voiceIndex].fieldC = 0; Voice[voiceIndex]._status = 1; - Voice[voiceIndex].field14 = 4; Voice[voiceIndex]._wavIndex = wavIndex; int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index c6563209c9..fecd05aaeb 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -35,8 +35,6 @@ class VoiceItem { public: int _status; int _wavIndex; - int fieldC; - int field14; }; class SwavItem { @@ -44,7 +42,7 @@ public: bool _active; Audio::RewindableAudioStream *_audioStream; Audio::SoundHandle _soundHandle; - bool freeSample; + bool _freeSampleFl; }; class MusicItem { @@ -70,7 +68,7 @@ private: int VOICE_STAT(int voiceIndex); void stopVoice(int voiceIndex); void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); - void PLAY_VOICE_SDL(); + void playVoice(); bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e5b1b08774..158a644b84 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -802,9 +802,7 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int return result; } -void TalkManager::REPONSE(int a1, int a2) { - byte v2; - byte v3; +void TalkManager::REPONSE(int zone, int verb) { byte *v5; byte *v6; uint16 v7; @@ -818,15 +816,15 @@ void TalkManager::REPONSE(int a1, int a2) { bool loopCond; byte *ptr; - v2 = a1; - v3 = a2; + byte zoneObj = zone; + byte verbObj = verb; LABEL_2: v15 = false; if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; for (;;) { if (v5[0] == 'C' && v5[1] == 'O' && v5[2] == 'D') { - if (v5[3] == v2 && v5[4] == v3) + if (v5[3] == zoneObj && v5[4] == verbObj) v15 = true; } if (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N') @@ -876,21 +874,26 @@ LABEL_2: return; if (v10 == 2) + // GOTO v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); else if (v10 == 3) + // IF v13 = _vm->_scriptManager.handleIf(ptr, v13); if (v13 == -1) error("Invalid IFF function"); if (v10 == 1 || v10 == 4) + // Already handled opcode or END IF ++v13; else if (!v10 || v10 == 5) + // EXIT loopCond = true; else if (v10 == 6) { + // JUMP _vm->_globals.freeMemory(ptr); - v2 = _vm->_objectsManager.NVZONE; - v3 = _vm->_objectsManager.NVVERBE; + zoneObj = _vm->_objectsManager._jumpZone; + verbObj = _vm->_objectsManager._jumpVerb; goto LABEL_2; } } while (!loopCond); @@ -904,103 +907,104 @@ LABEL_2: void TalkManager::REPONSE2(int a1, int a2) { int indx = 0; - if (a2 == 5 && _vm->_globals._saveData->data[svField3] == 4) { - if (a1 == 22 || a1 == 23) { - _vm->_objectsManager.setFlipSprite(0, false); - _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); - if (a1 == 22) { - _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); - _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); - } else { // a1 == 23 - _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(4)); - _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(4)); - } - _vm->_objectsManager.stopBobAnimation(3); - _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.setBobAnimation(6); - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); - do - _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(6) < 12); - _vm->_objectsManager.stopBobAnimation(6); - _vm->_objectsManager.setBobAnimation(8); - - switch (_vm->_globals._screenId) { - case 35: - indx = 201; - break; - case 36: - indx = 203; - break; - case 37: - indx = 205; - break; - case 38: - indx = 207; - break; - case 39: - indx = 209; - break; - case 40: - indx = 211; - break; - case 41: - indx = 213; - break; - } - _vm->_globals._saveData->data[indx] = 2; - _vm->_objectsManager.disableZone(22); - _vm->_objectsManager.disableZone(23); - } else if (a1 == 20 || a1 == 21) { - _vm->_objectsManager.setFlipSprite(0, true); - _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); - if (a1 == 20) { - _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); - _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); - } else { // a1 == 21 - _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(2)); - _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(2)); - } - _vm->_objectsManager.stopBobAnimation(1); - _vm->_objectsManager.stopBobAnimation(2); - _vm->_objectsManager.setBobAnimation(5); - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); - do - _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) < 12); - _vm->_objectsManager.stopBobAnimation(5); - _vm->_objectsManager.setBobAnimation(7); - switch (_vm->_globals._screenId) { - case 35: - indx = 200; - break; - case 36: - indx = 202; - break; - case 37: - indx = 204; - break; - case 38: - indx = 206; - break; - case 39: - indx = 208; - break; - case 40: - indx = 210; - break; - case 41: - indx = 212; - break; - } - _vm->_globals._saveData->data[indx] = 2; - _vm->_objectsManager.disableZone(21); - _vm->_objectsManager.disableZone(20); + if (a2 != 5 || _vm->_globals._saveData->data[svField3] != 4) + return; + + if (a1 == 22 || a1 == 23) { + _vm->_objectsManager.setFlipSprite(0, false); + _vm->_objectsManager.setSpriteIndex(0, 62); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); + if (a1 == 22) { + _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); + _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); + } else { // a1 == 23 + _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(4)); + _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(4)); + } + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.setBobAnimation(6); + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(6) < 12); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.setBobAnimation(8); + + switch (_vm->_globals._screenId) { + case 35: + indx = 201; + break; + case 36: + indx = 203; + break; + case 37: + indx = 205; + break; + case 38: + indx = 207; + break; + case 39: + indx = 209; + break; + case 40: + indx = 211; + break; + case 41: + indx = 213; + break; + } + _vm->_globals._saveData->data[indx] = 2; + _vm->_objectsManager.disableZone(22); + _vm->_objectsManager.disableZone(23); + } else if (a1 == 20 || a1 == 21) { + _vm->_objectsManager.setFlipSprite(0, true); + _vm->_objectsManager.setSpriteIndex(0, 62); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); + if (a1 == 20) { + _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); + _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); + } else { // a1 == 21 + _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(2)); + _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(2)); + } + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.setBobAnimation(5); + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) < 12); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.setBobAnimation(7); + switch (_vm->_globals._screenId) { + case 35: + indx = 200; + break; + case 36: + indx = 202; + break; + case 37: + indx = 204; + break; + case 38: + indx = 206; + break; + case 39: + indx = 208; + break; + case 40: + indx = 210; + break; + case 41: + indx = 212; + break; } + _vm->_globals._saveData->data[indx] = 2; + _vm->_objectsManager.disableZone(21); + _vm->_objectsManager.disableZone(20); } } diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index ca17f09c3c..090c804cbf 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -65,7 +65,7 @@ public: void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int idx, const byte *bufPerso, int a3, int a4); - void REPONSE(int a1, int a2); + void REPONSE(int zone, int verb); void REPONSE2(int a1, int a2); void OBJET_VIVANT(const Common::String &a2); }; -- cgit v1.2.3 From 4fd4a5ce0565c158af81d8aea6c67bea35501181 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Jan 2013 19:03:38 +0100 Subject: HOPKINS: Fix cut&paste error in searchCat. Thanks eriktorbjorn for pointing at it --- engines/hopkins/files.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index dbb33576bc..71d06ddd22 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -167,7 +167,7 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { case 9: { Common::String tmpFilename; if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - tmpFilename = "ENG_VOI.RES"; + tmpFilename = "ENG_VOI.CAT"; // Win95 and Linux versions uses another set of names else { switch (_vm->_globals._language) { -- cgit v1.2.3 From 0d92a7e5a3a9dd8303e01f17c9206e645c10b4de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Jan 2013 21:09:41 +0100 Subject: HOPKINS: Add support for RAW speechs used by the OS/2 version --- engines/hopkins/sound.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 9f0212c9aa..d9a6ed7730 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -30,6 +30,7 @@ #include "hopkins/hopkins.h" #include "audio/audiostream.h" #include "audio/mods/protracker.h" +#include "audio/decoders/raw.h" namespace Audio { @@ -157,6 +158,11 @@ protected: return true; } + if (file->open(filename + ".RAW")) { + _cueStream = Audio::makeRawStream(file, 22050, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); + return true; + } + warning("TwaAudioStream::loadCue: Missing cue %d (%s)", nr, filename.c_str()); _loadedCue = -1; delete file; @@ -550,6 +556,19 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { else if (_vm->_globals._language == LANG_SP) filename = "RES_VES.RES"; + catPos = _vm->_globals._catalogPos; + catLen = _vm->_globals._catalogSize; + } else if (!_vm->_fileManager.searchCat(filename + ".RAW", 9)) { + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + filename = "ENG_VOI.RES"; + // Win95 and Linux versions uses another set of names + else if (_vm->_globals._language == LANG_FR) + filename = "RES_VFR.RES"; + else if (_vm->_globals._language == LANG_EN) + filename = "RES_VAN.RES"; + else if (_vm->_globals._language == LANG_SP) + filename = "RES_VES.RES"; + catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else { @@ -845,8 +864,10 @@ void SoundManager::updateScummVMSoundSettings() { Audio::RewindableAudioStream *SoundManager::makeSoundStream(Common::SeekableReadStream *stream) { if (_vm->getPlatform() == Common::kPlatformWindows) return Audio::makeAPCStream(stream, DisposeAfterUse::YES); - else + else if (_vm->getPlatform() == Common::kPlatformLinux) return Audio::makeWAVStream(stream, DisposeAfterUse::YES); + else + return Audio::makeRawStream(stream, 22050, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); } // Blatant rip from gob engine. Hi DrMcCoy! -- cgit v1.2.3 From ca2f04b70fb4a4df83e19d67b8cd61e8943e1d71 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Jan 2013 22:23:58 +0100 Subject: HOPKINS: The first speech after a video was skipped if the video was skipped before. This fixes it. --- engines/hopkins/sound.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index d9a6ed7730..2104f5648c 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -590,6 +590,8 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { playVoice(); + _vm->_eventsManager._escKeyFl = false; + // Loop for playing voice breakFlag = 0; do { -- cgit v1.2.3 From 1e2723576aa3258aec0ae329587867e98f1e70dc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 19 Jan 2013 14:12:37 +0100 Subject: HOPKINS: Fix regression introduced in 9c58c936c8eeacf656e6304f54ddf795574bf57d --- engines/hopkins/objects.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 133eaf7919..d290c4a45a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -482,6 +482,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._frameIndex = 0; bob.field10 = 0; bob.field12 = 0; + bob.field14 = 0; bob._disabledAnimationFl = false; bob._animData = g_PTRNUL; bob.field1C = false; -- cgit v1.2.3 From 523aa825634784d9c25f16ccca118030565a8344 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 00:56:19 +0100 Subject: HOPKINS: Some renaming --- engines/hopkins/anim.cpp | 54 +++++------ engines/hopkins/dialogs.cpp | 16 ++-- engines/hopkins/events.cpp | 40 ++++---- engines/hopkins/graphics.cpp | 14 +-- engines/hopkins/graphics.h | 7 +- engines/hopkins/hopkins.cpp | 50 +++++----- engines/hopkins/objects.cpp | 44 ++++----- engines/hopkins/script.cpp | 68 +++++++------- engines/hopkins/sound.cpp | 219 +++++++++++++++++++------------------------ engines/hopkins/sound.h | 24 ++--- engines/hopkins/talk.cpp | 71 +++++++------- engines/hopkins/talk.h | 4 +- 12 files changed, 289 insertions(+), 322 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 25c6913a72..e6e9985fcc 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -102,7 +102,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; - _vm->_soundManager.LOAD_ANM_SOUND(); + _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul == 1) { // Do pre-animation delay @@ -118,7 +118,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui frameNumber = 0; while (!_vm->shouldQuit()) { ++frameNumber; - _vm->_soundManager.playAnim_SOUND(frameNumber); + _vm->_soundManager.playAnimSound(frameNumber); // Read frame header if (f.read(ptr, 16) != 16) @@ -135,7 +135,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui goto EXIT; _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } while (!_vm->shouldQuit() && _vm->_eventsManager._rateCounter < rate2); } @@ -151,7 +151,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } if (_vm->_globals.iRegul == 1) { @@ -161,12 +161,12 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui break; _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate3); } _vm->_eventsManager._rateCounter = 0; - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); EXIT: if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { screenCopy = _vm->_globals.allocMemory(307200); @@ -256,7 +256,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint f.read(screenP, nbytes); _vm->_graphicsManager.clearPalette(); - oldScrollVal = _vm->_graphicsManager.SCROLL; + oldScrollVal = _vm->_graphicsManager._scrollPosX; _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.scrollScreen(0); _vm->_graphicsManager.lockScreen(); @@ -284,7 +284,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint } _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; - _vm->_soundManager.LOAD_ANM_SOUND(); + _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul != 1) break; for (;;) { @@ -309,7 +309,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.SCROLL = oldScrollVal; + _vm->_graphicsManager._scrollPosX = oldScrollVal; _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); @@ -333,7 +333,7 @@ LABEL_48: frameNumber = 0; for (;;) { ++frameNumber; - _vm->_soundManager.playAnim_SOUND(frameNumber); + _vm->_soundManager.playAnimSound(frameNumber); memset(&buf, 0, 6); memset(ptr, 0, 19); @@ -361,13 +361,13 @@ LABEL_77: } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); LABEL_88: if (v5 == -1) { if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); if (_vm->_eventsManager._rateCounter >= a4) goto LABEL_114; } @@ -377,7 +377,7 @@ LABEL_88: } while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); if (_vm->_eventsManager._rateCounter >= a3) goto LABEL_77; } @@ -439,7 +439,7 @@ LABEL_114: _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.SCROLL = oldScrollVal; + _vm->_graphicsManager._scrollPosX = oldScrollVal; _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); @@ -756,7 +756,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->getIsDemo()) { _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; - _vm->_soundManager.LOAD_ANM_SOUND(); + _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager._escKeyFl) { @@ -765,7 +765,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate1); } } else { @@ -773,7 +773,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.fadeInDefaultLength(screenP); _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; - _vm->_soundManager.LOAD_ANM_SOUND(); + _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager._escKeyFl) { @@ -782,7 +782,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate1); } } @@ -791,7 +791,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui soundNumber = 0; do { ++soundNumber; - _vm->_soundManager.playAnim_SOUND(soundNumber); + _vm->_soundManager.playAnimSound(soundNumber); memset(v10, 0, 19); if (f.read(v10, 16) != 16) readError = true; @@ -808,7 +808,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate2); } _vm->_eventsManager._rateCounter = 0; @@ -823,7 +823,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } } while (!readError); @@ -835,7 +835,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager._escKeyFl = false; } _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate3); } _vm->_eventsManager._rateCounter = 0; @@ -913,14 +913,14 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u } _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; - _vm->_soundManager.LOAD_ANM_SOUND(); + _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul != 1) break; while (!_vm->shouldQuit()) { if (_vm->_eventsManager._escKeyFl) goto LABEL_54; _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); if (_vm->_eventsManager._rateCounter >= rate1) goto LABEL_23; } @@ -936,7 +936,7 @@ LABEL_23: v4 = false; v13 = 0; while (!_vm->shouldQuit()) { - _vm->_soundManager.playAnim_SOUND(v13++); + _vm->_soundManager.playAnimSound(v13++); memset(v11, 0, 19); if (f.read(v11, 16) != 16) @@ -962,13 +962,13 @@ LABEL_33: } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); LABEL_44: if (v4) { if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); if (_vm->_eventsManager._rateCounter >= rate3) { _vm->_eventsManager._rateCounter = 0; break; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index b06d2707c5..a082cf172e 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -299,7 +299,7 @@ void DialogsManager::showInventory() { if (_removeInventFl || _inventDisplayedFl || _vm->_globals._disableInventFl) return; - _vm->_graphicsManager.no_scroll = 1; + _vm->_graphicsManager._scrollStatus = 1; _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; _vm->_objectsManager._visibleFl = false; for (int i = 0; i <= 1; i++) { @@ -454,7 +454,7 @@ LABEL_7: _vm->_objectsManager._oldBorderPos = Common::Point(0, 0); _vm->_objectsManager._borderPos = Common::Point(0, 0); _vm->_globals._disableInventFl = false; - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; } /** @@ -523,19 +523,19 @@ void DialogsManager::testDialogOpening() { _vm->_dialogsManager.showInventory(); break; case KEY_OPTIONS: - _vm->_graphicsManager.no_scroll = 1; + _vm->_graphicsManager._scrollStatus = 1; _vm->_dialogsManager.showOptionsDialog(); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; break; case KEY_LOAD: - _vm->_graphicsManager.no_scroll = 1; + _vm->_graphicsManager._scrollStatus = 1; _vm->_dialogsManager.showLoadGame(); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; break; case KEY_SAVE: - _vm->_graphicsManager.no_scroll = 1; + _vm->_graphicsManager._scrollStatus = 1; _vm->_dialogsManager.showSaveGame(); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; break; default: break; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 1b4e02a386..d2c0689f0a 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -389,7 +389,7 @@ LABEL_45: } } goto LABEL_54; - } + } _vm->_eventsManager.updateCursor(); _vm->_graphicsManager.addVesaSegment(v15, yp, v12, v11); @@ -418,25 +418,25 @@ LABEL_63: LABEL_65: _vm->_globals._speed = 2; _rateCounter = 0; - if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager.no_scroll == 1) { + if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager._scrollStatus == 1) { _vm->_graphicsManager.displayVesaSegment(); } else { - if (_vm->_graphicsManager.no_scroll != 2) { - if (getMouseX() > _vm->_graphicsManager.SCROLL + 620) - _vm->_graphicsManager.SCROLL += _vm->_graphicsManager._scrollSpeed; - if (getMouseX() < _vm->_graphicsManager.SCROLL + 10) - _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager._scrollSpeed; + if (_vm->_graphicsManager._scrollStatus != 2) { + if (getMouseX() > _vm->_graphicsManager._scrollPosX + 620) + _vm->_graphicsManager._scrollPosX += _vm->_graphicsManager._scrollSpeed; + if (getMouseX() < _vm->_graphicsManager._scrollPosX + 10) + _vm->_graphicsManager._scrollPosX -= _vm->_graphicsManager._scrollSpeed; } - if (_vm->_graphicsManager.SCROLL < 0) - _vm->_graphicsManager.SCROLL = 0; - if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) - _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; - if (_vm->_graphicsManager.OLD_SCROLL == _vm->_graphicsManager.SCROLL) { + if (_vm->_graphicsManager._scrollPosX < 0) + _vm->_graphicsManager._scrollPosX = 0; + if (_vm->_graphicsManager._scrollPosX > SCREEN_WIDTH) + _vm->_graphicsManager._scrollPosX = SCREEN_WIDTH; + if (_vm->_graphicsManager._oldScrollPosX == _vm->_graphicsManager._scrollPosX) { _vm->_graphicsManager.displayVesaSegment(); } else { _vm->_fontManager.hideText(9); _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager.SCROLL, 20, SCREEN_WIDTH, 440, 0, 20); + _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollPosX, 20, SCREEN_WIDTH, 440, 0, 20); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); @@ -446,17 +446,17 @@ LABEL_65: } _vm->_globals.NBBLOC = 0; - _startPos.x = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager.SCROLL = _vm->_graphicsManager.SCROLL; + _startPos.x = _vm->_graphicsManager._scrollPosX; + _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager._scrollPosX; + _vm->_graphicsManager._scrollPosX = _vm->_graphicsManager._scrollPosX; } - _vm->_graphicsManager.OLD_SCROLL = _vm->_graphicsManager.SCROLL; - _startPos.x = _vm->_graphicsManager.SCROLL; - _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager.SCROLL; + _vm->_graphicsManager._oldScrollPosX = _vm->_graphicsManager._scrollPosX; + _startPos.x = _vm->_graphicsManager._scrollPosX; + _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager._scrollPosX; } _curMouseButton = _mouseButton; _mouseButton = 0; - _vm->_soundManager.VERIF_SOUND(); + _vm->_soundManager.checkSoundEnd(); refreshEvents(); } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7f6d7223a7..3ad8d95061 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -42,9 +42,9 @@ GraphicsManager::GraphicsManager() { _lineNbr = 0; _videoPtr = NULL; _scrollOffset = 0; - SCROLL = 0; + _scrollPosX = 0; _largeScreenFl = false; - OLD_SCROLL = 0; + _oldScrollPosX = 0; _lineNbr2 = 0; Agr_x = Agr_y = 0; @@ -52,7 +52,7 @@ GraphicsManager::GraphicsManager() { _fadeDefaultSpeed = 15; FADE_LINUX = 0; _skipVideoLockFl = false; - no_scroll = 0; + _scrollStatus = 0; min_x = 0; min_y = 20; max_x = SCREEN_WIDTH * 2; @@ -82,7 +82,7 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { if (_vm->getIsDemo()) { if (_vm->getPlatform() == Common::kPlatformLinux) - // CHECKME: Should be 0? + // CHECKME: Should be false? MANU_SCROLL = true; else MANU_SCROLL = false; @@ -194,8 +194,8 @@ void GraphicsManager::loadScreen(const Common::String &file) { scrollScreen(0); A_PCX640_480(_vesaScreen, file, _palette, flag); - SCROLL = 0; - OLD_SCROLL = 0; + _scrollPosX = 0; + _oldScrollPosX = 0; clearPalette(); if (!_largeScreenFl) { @@ -246,7 +246,7 @@ void GraphicsManager::scrollScreen(int amount) { int result = CLIP(amount, 0, SCREEN_WIDTH); _vm->_eventsManager._startPos.x = result; _scrollOffset = result; - SCROLL = result; + _scrollPosX = result; } void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 8ff4a7c13e..264a3fad80 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -68,10 +68,9 @@ public: byte *_vesaScreen; byte *_vesaBuffer; int _scrollOffset; - int SCROLL; - byte HEADER_PCX[128]; + int _scrollPosX; bool _largeScreenFl; - int OLD_SCROLL; + int _oldScrollPosX; bool MANU_SCROLL; int _scrollSpeed; int _lineNbr2; @@ -80,7 +79,7 @@ public: int _fadeDefaultSpeed; int FADE_LINUX; bool _skipVideoLockFl; - int no_scroll; + int _scrollStatus; Common::Rect dstrect[50]; int min_x, min_y; int max_x, max_y; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 34b410cf05..3a7e4d4520 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -228,7 +228,7 @@ bool HopkinsEngine::runWin95Demo() { _eventsManager.delay(500); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; + _soundManager._specialSoundNum = 2; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); @@ -237,7 +237,7 @@ bool HopkinsEngine::runWin95Demo() { _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); @@ -541,7 +541,7 @@ bool HopkinsEngine::runLinuxDemo() { _eventsManager.delay(500); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; + _soundManager._specialSoundNum = 2; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -553,7 +553,7 @@ bool HopkinsEngine::runLinuxDemo() { _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); @@ -882,7 +882,7 @@ bool HopkinsEngine::runFull() { _eventsManager.delay(500); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 2; + _soundManager._specialSoundNum = 2; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); @@ -897,7 +897,7 @@ bool HopkinsEngine::runFull() { } else { _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); } - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; _soundManager.DEL_SAMPLE(1); _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); @@ -1763,24 +1763,24 @@ void HopkinsEngine::playIntro() { _globals.iRegul = 1; _graphicsManager.fadeInLong(); if (_graphicsManager._largeScreenFl) { - _graphicsManager.no_scroll = 2; + _graphicsManager._scrollStatus = 2; bool v3 = false; - _graphicsManager.SCROLL = 0; + _graphicsManager._scrollPosX = 0; do { - _graphicsManager.SCROLL += 2; - if (_graphicsManager.SCROLL > (SCREEN_WIDTH - 2)) { - _graphicsManager.SCROLL = SCREEN_WIDTH; + _graphicsManager._scrollPosX += 2; + if (_graphicsManager._scrollPosX > (SCREEN_WIDTH - 2)) { + _graphicsManager._scrollPosX = SCREEN_WIDTH; v3 = true; } - if (_eventsManager.getMouseX() < _graphicsManager.SCROLL + 10) + if (_eventsManager.getMouseX() < _graphicsManager._scrollPosX + 10) _eventsManager.setMouseXY(_eventsManager._mousePos.x + 4, _eventsManager.getMouseY()); _eventsManager.VBL(); - } while (!shouldQuit() && !v3 && _graphicsManager.SCROLL != SCREEN_WIDTH); + } while (!shouldQuit() && !v3 && _graphicsManager._scrollPosX != SCREEN_WIDTH); _eventsManager.VBL(); - _graphicsManager.no_scroll = 0; + _graphicsManager._scrollStatus = 0; if (shouldQuit()) return; @@ -1788,7 +1788,7 @@ void HopkinsEngine::playIntro() { _soundManager.mixVoice(4, 3); _graphicsManager.fadeOutLong(); - _graphicsManager.no_scroll = 0; + _graphicsManager._scrollStatus = 0; _graphicsManager.loadImage("intro2"); _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); @@ -1822,13 +1822,13 @@ void HopkinsEngine::playIntro() { if (shouldQuit()) return; - _soundManager.SPECIAL_SOUND = 5; + _soundManager._specialSoundNum = 5; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("ELEC.ANM", 10, 26, 200); if (shouldQuit()) return; - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; if (!_eventsManager._escKeyFl) { _graphicsManager.loadImage("intro2"); @@ -1917,12 +1917,12 @@ void HopkinsEngine::playIntro() { _graphicsManager.FIN_VISU(); _animationManager._clearAnimationFl = true; _soundManager.WSOUND(3); - _soundManager.SPECIAL_SOUND = 1; + _soundManager._specialSoundNum = 1; _animationManager.playAnim("INTRO1.anm", 10, 24, 18); if (shouldQuit()) return; - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; if (!_eventsManager._escKeyFl) { _animationManager.playAnim("INTRO2.anm", 10, 24, 18); @@ -2003,10 +2003,10 @@ void HopkinsEngine::bombExplosion() { _graphicsManager.clearPalette(); _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 199; + _soundManager._specialSoundNum = 199; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; _graphicsManager.loadImage("IM15"); _animationManager.loadAnim("ANIM15"); _graphicsManager.VISU_ALL(); @@ -2260,7 +2260,7 @@ void HopkinsEngine::playEnding() { _objectsManager.stopBobAnimation(7); if (_globals._saveData->data[svField135] == 1) { - _soundManager.SPECIAL_SOUND = 200; + _soundManager._specialSoundNum = 200; _soundManager.VBL_MERDE = true; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BERM.ANM", 100, 24, 300); @@ -2278,7 +2278,7 @@ void HopkinsEngine::playEnding() { _eventsManager._escKeyFl = false; _graphicsManager.fadeOutLong(); _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR2A.anm", 12, 12, 1000); _soundManager.WSOUND(11); @@ -2297,7 +2297,7 @@ void HopkinsEngine::playEnding() { _dialogsManager._removeInventFl = false; _globals._disableInventFl = false; } else { - _soundManager.SPECIAL_SOUND = 200; + _soundManager._specialSoundNum = 200; _soundManager.VBL_MERDE = true; _animationManager.playAnim2("BERM.ANM", 100, 24, 300); _objectsManager.stopBobAnimation(7); @@ -2321,7 +2321,7 @@ void HopkinsEngine::playEnding() { _soundManager.DEL_SAMPLE(1); _soundManager.WSOUND(16); _globals.iRegul = 1; - _soundManager.SPECIAL_SOUND = 0; + _soundManager._specialSoundNum = 0; _dialogsManager._removeInventFl = false; _globals._disableInventFl = false; _animationManager.playAnim("JOUR4A.anm", 12, 12, 1000); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d290c4a45a..36e124e14c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2294,20 +2294,20 @@ void ObjectsManager::PARADISE() { _vm->_fontManager.hideText(5); if (!_vm->_globals._forestFl || _zoneNum < 20 || _zoneNum > 23) { if (_vm->_graphicsManager._largeScreenFl) { - _vm->_graphicsManager.no_scroll = 2; + _vm->_graphicsManager._scrollStatus = 2; if (_vm->_eventsManager._startPos.x + 320 - getSpriteX(0) > 160) { bool loopCond = false; do { - _vm->_graphicsManager.SCROLL -= _vm->_graphicsManager._scrollSpeed; - if (_vm->_graphicsManager.SCROLL < 0) { - _vm->_graphicsManager.SCROLL = 0; + _vm->_graphicsManager._scrollPosX -= _vm->_graphicsManager._scrollSpeed; + if (_vm->_graphicsManager._scrollPosX < 0) { + _vm->_graphicsManager._scrollPosX = 0; loopCond = true; } - if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { - _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; + if (_vm->_graphicsManager._scrollPosX > SCREEN_WIDTH) { + _vm->_graphicsManager._scrollPosX = SCREEN_WIDTH; loopCond = true; } - if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) + if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager._scrollPosX + 620) _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x - 4, _vm->_eventsManager.getMouseY()); _vm->_eventsManager.VBL(); @@ -2315,27 +2315,27 @@ void ObjectsManager::PARADISE() { } else if (_vm->_eventsManager._startPos.x + 320 - getSpriteX(0) < -160) { bool loopCond = false; do { - _vm->_graphicsManager.SCROLL += _vm->_graphicsManager._scrollSpeed; - if (_vm->_graphicsManager.SCROLL < 0) { - _vm->_graphicsManager.SCROLL = 0; + _vm->_graphicsManager._scrollPosX += _vm->_graphicsManager._scrollSpeed; + if (_vm->_graphicsManager._scrollPosX < 0) { + _vm->_graphicsManager._scrollPosX = 0; loopCond = true; } - if (_vm->_graphicsManager.SCROLL > SCREEN_WIDTH) { - _vm->_graphicsManager.SCROLL = SCREEN_WIDTH; + if (_vm->_graphicsManager._scrollPosX > SCREEN_WIDTH) { + _vm->_graphicsManager._scrollPosX = SCREEN_WIDTH; loopCond = true; } - if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager.SCROLL + 10) + if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager._scrollPosX + 10) _vm->_eventsManager.setMouseXY(_vm->_eventsManager._mousePos.x + 4, _vm->_eventsManager.getMouseY()); _vm->_eventsManager.VBL(); } while (!loopCond && _vm->_eventsManager._startPos.x < getSpriteX(0) - 320); } - if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager.SCROLL + 620) - _vm->_eventsManager.setMouseXY(_vm->_graphicsManager.SCROLL + 610, 0); - if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager.SCROLL + 10) - _vm->_eventsManager.setMouseXY(_vm->_graphicsManager.SCROLL + 10, 0); + if (_vm->_eventsManager.getMouseX() > _vm->_graphicsManager._scrollPosX + 620) + _vm->_eventsManager.setMouseXY(_vm->_graphicsManager._scrollPosX + 610, 0); + if (_vm->_eventsManager.getMouseX() < _vm->_graphicsManager._scrollPosX + 10) + _vm->_eventsManager.setMouseXY(_vm->_graphicsManager._scrollPosX + 10, 0); _vm->_eventsManager.VBL(); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; } _vm->_talkManager.REPONSE(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } else { @@ -3317,13 +3317,13 @@ void ObjectsManager::handleSpecialGames() { if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; _vm->_graphicsManager.NB_SCREEN(true); - _vm->_soundManager.SPECIAL_SOUND = 198; + _vm->_soundManager._specialSoundNum = 198; PERSO_ON = true; _vm->_animationManager.NO_SEQ = true; _vm->_animationManager._clearAnimationFl = false; _vm->_animationManager.playAnim("otage.ANM", 1, 24, 500); _vm->_animationManager.NO_SEQ = false; - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager.NB_SCREEN(false); _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager._vesaScreen); @@ -3338,7 +3338,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_graphicsManager.unlockScreen(); memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; _vm->_graphicsManager.DD_VBL(); break; case 20: @@ -4596,7 +4596,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm } _vm->_eventsManager.setMouseXY(_characterPos); if (_vm->_graphicsManager._largeScreenFl) - _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; + _vm->_graphicsManager._scrollPosX = (int16)getSpriteX(0) - 320; computeAndSetSpriteSize(); animateSprite(0); _vm->_globals.CACHE_ON(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index aa478f2d6d..58d6decb7b 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -556,10 +556,10 @@ int ScriptManager::handleOpcode(byte *dataP) { // If uncensored, rip the throat of the hostage if (!_vm->_globals._censorshipFl) { - _vm->_soundManager.SPECIAL_SOUND = 16; + _vm->_soundManager._specialSoundNum = 16; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("EGORGE.ANM", 50, 28, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; } _vm->_animationManager.loadAnim("ASCEN"); _vm->_eventsManager.mouseOff(); @@ -582,10 +582,10 @@ int ScriptManager::handleOpcode(byte *dataP) { if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) _vm->_soundManager.playSound("SOUND17.WAV"); - _vm->_soundManager.SPECIAL_SOUND = 14; + _vm->_soundManager._specialSoundNum = 14; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playSequence2("ASSOM.SEQ", 10, 4, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) _vm->_graphicsManager.fadeOutLong(); @@ -686,9 +686,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.loadSample(1, "SOUND44.WAV"); _vm->_soundManager.loadSample(2, "SOUND42.WAV"); _vm->_soundManager.loadSample(3, "SOUND41.WAV"); - _vm->_soundManager.SPECIAL_SOUND = 17; + _vm->_soundManager._specialSoundNum = 17; _vm->_animationManager.playSequence("grenade.SEQ", 1, 32, 100); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("CREVE17.ANM", 24, 24, 200); _vm->_soundManager.DEL_SAMPLE(1); @@ -863,7 +863,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.fadeInLong(); bool v52 = false; - _vm->_soundManager.LOAD_WAV("SOUND46.WAV", 1); + _vm->_soundManager.loadWav("SOUND46.WAV", 1); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -998,8 +998,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.SET_BOBPOSI(12, 0); _vm->_objectsManager.SET_BOBPOSI(13, 0); int v21 = 0; - _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND71.WAV", 2); + _vm->_soundManager.loadWav("SOUND44.WAV", 1); + _vm->_soundManager.loadWav("SOUND71.WAV", 2); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1056,9 +1056,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.setBobAnimation(8); _vm->_objectsManager.SET_BOBPOSI(11, 0); _vm->_objectsManager.SET_BOBPOSI(8, 0); - _vm->_soundManager.LOAD_WAV("SOUND44.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND48.WAV", 2); - _vm->_soundManager.LOAD_WAV("SOUND49.WAV", 3); + _vm->_soundManager.loadWav("SOUND44.WAV", 1); + _vm->_soundManager.loadWav("SOUND48.WAV", 2); + _vm->_soundManager.loadWav("SOUND49.WAV", 3); int v24 = 0; do { if (_vm->shouldQuit()) @@ -1480,9 +1480,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(4); _vm->_objectsManager.SET_BOBPOSI(4, 0); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); + _vm->_soundManager.loadWav("SOUND61.WAV", 1); + _vm->_soundManager.loadWav("SOUND62.WAV", 2); + _vm->_soundManager.loadWav("SOUND61.WAV", 3); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1518,9 +1518,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(5); _vm->_objectsManager.SET_BOBPOSI(5, 0); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 1); - _vm->_soundManager.LOAD_WAV("SOUND62.WAV", 2); - _vm->_soundManager.LOAD_WAV("SOUND61.WAV", 3); + _vm->_soundManager.loadWav("SOUND61.WAV", 1); + _vm->_soundManager.loadWav("SOUND62.WAV", 2); + _vm->_soundManager.loadWav("SOUND61.WAV", 3); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1763,7 +1763,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 204: { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(3); - _vm->_soundManager.LOAD_WAV("SOUND67.WAV", 1); + _vm->_soundManager.loadWav("SOUND67.WAV", 1); int v41 = 0; do { if (_vm->shouldQuit()) @@ -1785,7 +1785,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 205: { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(4); - _vm->_soundManager.LOAD_WAV("SOUND69.WAV", 1); + _vm->_soundManager.loadWav("SOUND69.WAV", 1); int v42 = 0; do { if (_vm->shouldQuit()) @@ -1811,11 +1811,11 @@ int ScriptManager::handleOpcode(byte *dataP) { case 208: { _vm->_globals._disableInventFl = true; if (_vm->_globals._saveData->data[svField6] != _vm->_globals._saveData->data[svField401]) { - _vm->_soundManager.SPECIAL_SOUND = 208; + _vm->_soundManager._specialSoundNum = 208; _vm->_eventsManager._disableEscKeyFl = true; _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); _vm->_eventsManager._disableEscKeyFl = false; - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; } _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -1880,9 +1880,9 @@ int ScriptManager::handleOpcode(byte *dataP) { case 210: _vm->_animationManager.NO_SEQ = true; - _vm->_soundManager.SPECIAL_SOUND = 210; + _vm->_soundManager._specialSoundNum = 210; _vm->_animationManager.playSequence2("SECRET1.SEQ", 1, 12, 1); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.OBSSEUL = true; @@ -1902,9 +1902,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_globals.CACHE_OFF(); _vm->_animationManager.NO_SEQ = true; - _vm->_soundManager.SPECIAL_SOUND = 211; + _vm->_soundManager._specialSoundNum = 211; _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_animationManager.NO_SEQ = false; _vm->_graphicsManager._noFadingFl = true; _vm->_graphicsManager.fadeOutLong(); @@ -1935,9 +1935,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 229: - _vm->_soundManager.SPECIAL_SOUND = 229; + _vm->_soundManager._specialSoundNum = 229; _vm->_animationManager.playSequence("MUR.SEQ", 1, 12, 1); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 340, 157, 2); break; @@ -2281,10 +2281,10 @@ int ScriptManager::handleOpcode(byte *dataP) { case 603: _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(3, 0, 16, 4); - _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_soundManager._specialSoundNum = 199; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_graphicsManager._noFadingFl = true; _vm->_globals._exitId = 151; @@ -2293,9 +2293,9 @@ int ScriptManager::handleOpcode(byte *dataP) { case 604: _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(1, 0, 16, 4); - _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_soundManager._specialSoundNum = 199; _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager._noFadingFl = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_globals._exitId = 151; @@ -2305,10 +2305,10 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 163, 7, false); _vm->_objectsManager.OPTI_ONE(5, 0, 16, 4); _vm->_graphicsManager.fadeOutShort(); - _vm->_soundManager.SPECIAL_SOUND = 199; + _vm->_soundManager._specialSoundNum = 199; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("BOMBE2A.ANM", 50, 14, 500); - _vm->_soundManager.SPECIAL_SOUND = 0; + _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager._noFadingFl = true; memset(_vm->_graphicsManager._vesaBuffer, 0, 614400); _vm->_globals._exitId = 151; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 2104f5648c..24001cbb6f 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -188,7 +188,7 @@ Audio::AudioStream *makeTwaStream(Common::String name, Common::SeekableReadStrea namespace Hopkins { SoundManager::SoundManager() { - SPECIAL_SOUND = 0; + _specialSoundNum = 0; _soundVolume = 0; _voiceVolume = 0; _musicVolume = 0; @@ -198,9 +198,9 @@ SoundManager::SoundManager() { _textOffFl = false; _soundFl = false; VBL_MERDE = false; - SOUND_NUM = 0; - old_music = 0; - MOD_FLAG = false; + _currentSoundIndex = 0; + _oldSoundNumber = 0; + _modPlayingFl = false; for (int i = 0; i < VOICE_COUNT; ++i) Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); @@ -215,29 +215,29 @@ SoundManager::~SoundManager() { stopMusic(); delMusic(); _vm->_mixer->stopHandle(_musicHandle); - MOD_FLAG = false; + _modPlayingFl = false; } void SoundManager::setParent(HopkinsEngine *vm) { _vm = vm; - SPECIAL_SOUND = 0; + _specialSoundNum = 0; } void SoundManager::WSOUND_INIT() { warning("TODO: WSOUND_INIT"); } -void SoundManager::VERIF_SOUND() { +void SoundManager::checkSoundEnd() { if (!_soundOffFl && _soundFl) { - if (!VOICE_STAT(1)) { + if (!checkVoiceStatus(1)) { stopVoice(1); - DEL_NWAV(SOUND_NUM); + DEL_NWAV(_currentSoundIndex); } } } -void SoundManager::LOAD_ANM_SOUND() { - switch (SPECIAL_SOUND) { +void SoundManager::loadAnimSound() { + switch (_specialSoundNum) { case 2: loadSample(5, "mitra1.wav"); loadSample(1, "tir2.wav"); @@ -246,41 +246,41 @@ void SoundManager::LOAD_ANM_SOUND() { loadSample(4, "sound4.WAV"); break; case 5: - LOAD_WAV("CRIE.WAV", 1); + loadWav("CRIE.WAV", 1); break; case 14: - LOAD_WAV("SOUND14.WAV", 1); + loadWav("SOUND14.WAV", 1); break; case 16: - LOAD_WAV("SOUND16.WAV", 1); + loadWav("SOUND16.WAV", 1); break; case 198: - LOAD_WAV("SOUND3.WAV", 1); + loadWav("SOUND3.WAV", 1); break; case 199: - LOAD_WAV("SOUND22.WAV", 1); + loadWav("SOUND22.WAV", 1); break; case 200: mixVoice(682, 1); break; case 208: - LOAD_WAV("SOUND77.WAV", 1); + loadWav("SOUND77.WAV", 1); break; case 210: - LOAD_WAV("SOUND78.WAV", 1); + loadWav("SOUND78.WAV", 1); break; case 211: - LOAD_WAV("SOUND78.WAV", 1); + loadWav("SOUND78.WAV", 1); break; case 229: - LOAD_WAV("SOUND80.WAV", 1); - LOAD_WAV("SOUND82.WAV", 2); + loadWav("SOUND80.WAV", 1); + loadWav("SOUND82.WAV", 2); break; } } -void SoundManager::playAnim_SOUND(int soundNumber) { - if (!_vm->_globals._censorshipFl && SPECIAL_SOUND == 2) { +void SoundManager::playAnimSound(int soundNumber) { + if (!_vm->_globals._censorshipFl && _specialSoundNum == 2) { switch (soundNumber) { case 20: PLAY_SAMPLE2(5); @@ -300,32 +300,32 @@ void SoundManager::playAnim_SOUND(int soundNumber) { PLAY_SAMPLE2(4); break; } - } else if (SPECIAL_SOUND == 1 && soundNumber == 17) + } else if (_specialSoundNum == 1 && soundNumber == 17) playSound("SOUND42.WAV"); - else if (SPECIAL_SOUND == 5 && soundNumber == 19) + else if (_specialSoundNum == 5 && soundNumber == 19) playWav(1); - else if (SPECIAL_SOUND == 14 && soundNumber == 625) + else if (_specialSoundNum == 14 && soundNumber == 625) playWav(1); - else if (SPECIAL_SOUND == 16 && soundNumber == 25) + else if (_specialSoundNum == 16 && soundNumber == 25) playWav(1); - else if (SPECIAL_SOUND == 17) { + else if (_specialSoundNum == 17) { if (soundNumber == 6) PLAY_SAMPLE2(1); else if (soundNumber == 14) PLAY_SAMPLE2(2); else if (soundNumber == 67) PLAY_SAMPLE2(3); - } else if (SPECIAL_SOUND == 198 && soundNumber == 15) + } else if (_specialSoundNum == 198 && soundNumber == 15) playWav(1); - else if (SPECIAL_SOUND == 199 && soundNumber == 72) + else if (_specialSoundNum == 199 && soundNumber == 72) playWav(1); - else if (SPECIAL_SOUND == 208 && soundNumber == 40) + else if (_specialSoundNum == 208 && soundNumber == 40) playWav(1); - else if (SPECIAL_SOUND == 210 && soundNumber == 2) + else if (_specialSoundNum == 210 && soundNumber == 2) playWav(1); - else if (SPECIAL_SOUND == 211 && soundNumber == 22) + else if (_specialSoundNum == 211 && soundNumber == 22) playWav(1); - else if (SPECIAL_SOUND == 229) { + else if (_specialSoundNum == 229) { if (soundNumber == 15) playWav(1); else if (soundNumber == 91) @@ -349,12 +349,12 @@ void SoundManager::WSOUND(int soundNumber) { return; } - if (old_music != soundNumber || !MOD_FLAG) { - if (MOD_FLAG) + if (_oldSoundNumber != soundNumber || !_modPlayingFl) { + if (_modPlayingFl) WSOUND_OFF(); - PLAY_MOD(modSounds[soundNumber - 1]); - old_music = soundNumber; + playMod(modSounds[soundNumber - 1]); + _oldSoundNumber = soundNumber; } } @@ -363,19 +363,19 @@ void SoundManager::WSOUND_OFF() { stopVoice(1); stopVoice(2); if (_vm->_soundManager._soundFl) - DEL_NWAV(SOUND_NUM); + DEL_NWAV(_currentSoundIndex); for (int i = 1; i <= 48; ++i) DEL_SAMPLE_SDL(i); - if (MOD_FLAG) { + if (_modPlayingFl) { stopMusic(); delMusic(); - MOD_FLAG = false; + _modPlayingFl = false; } } -void SoundManager::PLAY_MOD(const Common::String &file) { +void SoundManager::playMod(const Common::String &file) { if (_musicOffFl) return; Common::String modFile = file; @@ -395,15 +395,15 @@ void SoundManager::PLAY_MOD(const Common::String &file) { modFile += "2"; } } - if (MOD_FLAG) { + if (_modPlayingFl) { stopMusic(); delMusic(); - MOD_FLAG = false; + _modPlayingFl = false; } loadMusic(modFile); playMusic(); - MOD_FLAG = true; + _modPlayingFl = true; } void SoundManager::loadMusic(const Common::String &file) { @@ -446,20 +446,20 @@ void SoundManager::delMusic() { } void SoundManager::checkSounds() { - checkVoices(); + checkVoiceActivity(); } -void SoundManager::checkVoices() { +void SoundManager::checkVoiceActivity() { // Check the status of each voice. bool hasActiveVoice = false; for (int i = 0; i < VOICE_COUNT; ++i) { - VOICE_STAT(i); - hasActiveVoice |= Voice[i]._status != 0; + checkVoiceStatus(i); + hasActiveVoice |= Voice[i]._status; } if (!hasActiveVoice && _soundFl) { _soundFl = false; - SOUND_NUM = 0; + _currentSoundIndex = 0; } } @@ -476,59 +476,31 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { if (_voiceOffFl) return false; - if ((unsigned int)(voiceMode - 1) <= 1 - && (voiceId == 4 - || voiceId == 16 - || voiceId == 121 - || voiceId == 142 - || voiceId == 182 - || voiceId == 191 - || voiceId == 212 - || voiceId == 225 - || voiceId == 239 - || voiceId == 245 - || voiceId == 297 - || voiceId == 308 - || voiceId == 333 - || voiceId == 348 - || voiceId == 352 - || voiceId == 358 - || voiceId == 364 - || voiceId == 371 - || voiceId == 394 - || voiceId == 414 - || voiceId == 429 - || voiceId == 442 - || voiceId == 446 - || voiceId == 461 - || voiceId == 468 - || voiceId == 476 - || voiceId == 484 - || voiceId == 491 - || voiceId == 497 - || voiceId == 501 - || voiceId == 511 - || voiceId == 520 - || voiceId == 536 - || voiceId == 554 - || voiceId == 566 - || voiceId == 573 - || voiceId == 632 - || voiceId == 645)) + if ((voiceMode == 1 || voiceMode == 2) + && ( voiceId == 4 || voiceId == 16 || voiceId == 121 + || voiceId == 142 || voiceId == 182 || voiceId == 191 + || voiceId == 212 || voiceId == 225 || voiceId == 239 + || voiceId == 245 || voiceId == 297 || voiceId == 308 + || voiceId == 333 || voiceId == 348 || voiceId == 352 + || voiceId == 358 || voiceId == 364 || voiceId == 371 + || voiceId == 394 || voiceId == 414 || voiceId == 429 + || voiceId == 442 || voiceId == 446 || voiceId == 461 + || voiceId == 468 || voiceId == 476 || voiceId == 484 + || voiceId == 491 || voiceId == 497 || voiceId == 501 + || voiceId == 511 || voiceId == 520 || voiceId == 536 + || voiceId == 554 || voiceId == 566 || voiceId == 573 + || voiceId == 632 || voiceId == 645)) fileNumber = 684; - if ((unsigned int)(voiceMode - 1) <= 1) { + if (voiceMode == 1 || voiceMode == 2) prefix = "DF"; - } - if (voiceMode == 3) { + else if (voiceMode == 3) prefix = "IF"; - } - if (voiceMode == 4) { + else if (voiceMode == 4) prefix = "TF"; - } - if (voiceMode == 5) { + else if (voiceMode == 5) prefix = "OF"; - } + filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); @@ -595,14 +567,14 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { // Loop for playing voice breakFlag = 0; do { - if (SPECIAL_SOUND != 4 && !VBL_MERDE) + if (_specialSoundNum != 4 && !VBL_MERDE) _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) break; _vm->_eventsManager.refreshEvents(); if (_vm->_eventsManager._escKeyFl) break; - if (!VOICE_STAT(2)) + if (!checkVoiceStatus(2)) breakFlag = true; } while (!_vm->shouldQuit() && !breakFlag); @@ -616,11 +588,11 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { } void SoundManager::DEL_SAMPLE(int soundIndex) { - if (VOICE_STAT(1) == 1) + if (checkVoiceStatus(1)) stopVoice(1); - if (VOICE_STAT(2) == 2) + if (checkVoiceStatus(2)) stopVoice(2); - if (VOICE_STAT(3) == 3) + if (checkVoiceStatus(3)) stopVoice(3); DEL_SAMPLE_SDL(soundIndex); SOUND[soundIndex]._active = false; @@ -629,7 +601,7 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { void SoundManager::playSound(const Common::String &file) { if (!_soundOffFl) { if (_soundFl) - DEL_NWAV(SOUND_NUM); + DEL_NWAV(_currentSoundIndex); LOAD_NWAV(file, 1); PLAY_NWAV(1); } @@ -662,24 +634,21 @@ void SoundManager::loadSample(int wavIndex, const Common::String &file) { void SoundManager::playSample(int wavIndex, int voiceMode) { if (!_soundOffFl && SOUND[wavIndex]._active) { if (_soundFl) - DEL_NWAV(SOUND_NUM); + DEL_NWAV(_currentSoundIndex); if (voiceMode == 5) { - if (VOICE_STAT(1) == 1) + if (checkVoiceStatus(1)) stopVoice(1); PLAY_SAMPLE_SDL(1, wavIndex); - } - if (voiceMode == 6) { - if (VOICE_STAT(2) == 1) + } else if (voiceMode == 6) { + if (checkVoiceStatus(2)) stopVoice(1); PLAY_SAMPLE_SDL(2, wavIndex); - } - if (voiceMode == 7) { - if (VOICE_STAT(3) == 1) + } else if (voiceMode == 7) { + if (checkVoiceStatus(3)) stopVoice(1); PLAY_SAMPLE_SDL(3, wavIndex); - } - if (voiceMode == 8) { - if (VOICE_STAT(1) == 1) + } else if (voiceMode == 8) { + if (checkVoiceStatus(1)) stopVoice(1); PLAY_SAMPLE_SDL(1, wavIndex); } @@ -689,14 +658,14 @@ void SoundManager::playSample(int wavIndex, int voiceMode) { void SoundManager::PLAY_SAMPLE2(int idx) { if (!_soundOffFl && SOUND[idx]._active) { if (_soundFl) - DEL_NWAV(SOUND_NUM); - if (VOICE_STAT(1) == 1) + DEL_NWAV(_currentSoundIndex); + if (checkVoiceStatus(1)) stopVoice(1); PLAY_SAMPLE_SDL(1, idx); } } -void SoundManager::LOAD_WAV(const Common::String &file, int wavIndex) { +void SoundManager::loadWav(const Common::String &file, int wavIndex) { LOAD_NWAV(file, wavIndex); } @@ -704,7 +673,7 @@ void SoundManager::playWav(int wavIndex) { PLAY_NWAV(wavIndex); } -int SoundManager::VOICE_STAT(int voiceIndex) { +bool SoundManager::checkVoiceStatus(int voiceIndex) { if (Voice[voiceIndex]._status) { int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._audioStream != NULL && Swav[wavIndex]._audioStream->endOfStream()) @@ -716,14 +685,14 @@ int SoundManager::VOICE_STAT(int voiceIndex) { void SoundManager::stopVoice(int voiceIndex) { if (Voice[voiceIndex]._status) { - Voice[voiceIndex]._status = 0; + Voice[voiceIndex]._status = false; int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { if (Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } } - Voice[voiceIndex]._status = 0; + Voice[voiceIndex]._status = false; } void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength) { @@ -790,17 +759,17 @@ void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { void SoundManager::PLAY_NWAV(int wavIndex) { if (!_soundFl && !_soundOffFl) { _soundFl = true; - SOUND_NUM = wavIndex; + _currentSoundIndex = wavIndex; PLAY_SAMPLE_SDL(1, wavIndex); } } void SoundManager::DEL_NWAV(int wavIndex) { if (DEL_SAMPLE_SDL(wavIndex)) { - if (VOICE_STAT(1) == 1) + if (checkVoiceStatus(1)) stopVoice(1); - SOUND_NUM = 0; + _currentSoundIndex = 0; _soundFl = false; } } @@ -809,10 +778,10 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { if (!Swav[wavIndex]._active) warning("Bad handle"); - if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) + if (Voice[voiceIndex]._status && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); - Voice[voiceIndex]._status = 1; + Voice[voiceIndex]._status = true; Voice[voiceIndex]._wavIndex = wavIndex; int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index fecd05aaeb..dcd6af5ba3 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -33,7 +33,7 @@ namespace Hopkins { class VoiceItem { public: - int _status; + bool _status; int _wavIndex; }; @@ -65,7 +65,7 @@ class SoundManager { private: HopkinsEngine *_vm; - int VOICE_STAT(int voiceIndex); + bool checkVoiceStatus(int voiceIndex); void stopVoice(int voiceIndex); void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); void playVoice(); @@ -80,7 +80,7 @@ private: /** * Checks voices to see if they're finished */ - void checkVoices(); + void checkVoiceActivity(); /** * Creates an audio stream based on a passed raw stream @@ -88,7 +88,7 @@ private: Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); public: Audio::SoundHandle _musicHandle; - int SPECIAL_SOUND; + int _specialSoundNum; int _soundVolume; int _voiceVolume; int _musicVolume; @@ -98,9 +98,9 @@ public: bool _textOffFl; bool _soundFl; bool VBL_MERDE; - int SOUND_NUM; - bool MOD_FLAG; - int old_music; + int _currentSoundIndex; + bool _modPlayingFl; + int _oldSoundNumber; VoiceItem Voice[VOICE_COUNT]; SwavItem Swav[SWAV_COUNT]; @@ -112,13 +112,13 @@ public: void setParent(HopkinsEngine *vm); void WSOUND_INIT(); - void VERIF_SOUND(); - void LOAD_ANM_SOUND(); - void playAnim_SOUND(int soundNumber); - void LOAD_WAV(const Common::String &file, int wavIndex); + void checkSoundEnd(); + void loadAnimSound(); + void playAnimSound(int soundNumber); + void loadWav(const Common::String &file, int wavIndex); void WSOUND(int soundNumber); void WSOUND_OFF(); - void PLAY_MOD(const Common::String &file); + void playMod(const Common::String &file); void loadMusic(const Common::String &file); void playMusic(); void stopMusic(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 158a644b84..9140c3efd9 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -40,8 +40,7 @@ TalkManager::TalkManager() { _characterAnim = NULL; _characterSize = 0; STATI = false; - PLIGNE1 = PLIGNE2 = 0; - PLIGNE3 = PLIGNE4 = 0; + _dialogueMesgId1 = _dialogueMesgId2 = _dialogueMesgId3 = _dialogueMesgId4 = 0; _paletteBufferIdx = 0; } @@ -56,7 +55,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); - _vm->_graphicsManager.no_scroll = 1; + _vm->_graphicsManager._scrollStatus = 1; bool oldDisableInventFl = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; _characterBuffer = _vm->_fileManager.searchCat(filename, 5); @@ -76,7 +75,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } else if (_vm->_globals._language == LANG_SP) { _answersFilename = _questionsFilename = "RUEES.TXT"; } - PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) { @@ -97,9 +96,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { searchCharacterPalette(_paletteBufferIdx, false); startCharacterAnim0(_paletteBufferIdx, false); initCharacterAnim(); - PLIGNE2 = PLIGNE1 + 1; - PLIGNE3 = PLIGNE1 + 2; - PLIGNE4 = PLIGNE1 + 3; + _dialogueMesgId2 = _dialogueMesgId1 + 1; + _dialogueMesgId3 = _dialogueMesgId1 + 2; + _dialogueMesgId4 = _dialogueMesgId1 + 3; int v14 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); @@ -107,12 +106,12 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { int v5; do { v5 = DIALOGUE(); - if (v5 != PLIGNE4) + if (v5 != _dialogueMesgId4) answer = DIALOGUE_REP(v5); if (answer == -1) - v5 = PLIGNE4; + v5 = _dialogueMesgId4; _vm->_eventsManager.VBL(); - } while (v5 != PLIGNE4); + } while (v5 != _dialogueMesgId4); } if (_vm->_globals.NOPARLE) { int v6 = 1; @@ -149,7 +148,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; } void TalkManager::PARLER_PERSO2(const Common::String &filename) { @@ -183,12 +182,12 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { break; } - PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); + _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; searchCharacterPalette(_paletteBufferIdx, false); - PLIGNE2 = PLIGNE1 + 1; - PLIGNE3 = PLIGNE1 + 2; - PLIGNE4 = PLIGNE1 + 3; + _dialogueMesgId2 = _dialogueMesgId1 + 1; + _dialogueMesgId3 = _dialogueMesgId1 + 2; + _dialogueMesgId4 = _dialogueMesgId1 + 3; int oldMouseCursorId = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); @@ -197,11 +196,11 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { int v3; do { v3 = DIALOGUE(); - if (v3 != PLIGNE4) { + if (v3 != _dialogueMesgId4) { if (DIALOGUE_REP(v3) == -1) - v3 = PLIGNE4; + v3 = _dialogueMesgId4; } - } while (v3 != PLIGNE4); + } while (v3 != _dialogueMesgId4); } if (_vm->_globals.NOPARLE) { @@ -245,20 +244,20 @@ int TalkManager::DIALOGUE() { dialogWait(); } - int sentence1LineNumb = VERIF_BOITE(PLIGNE1, _questionsFilename, 65); - int sentence2LineNumb = VERIF_BOITE(PLIGNE2, _questionsFilename, 65); - int sentence3LineNumb = VERIF_BOITE(PLIGNE3, _questionsFilename, 65); - int sentence4LineNumb = VERIF_BOITE(PLIGNE4, _questionsFilename, 65); + int sentence1LineNumb = VERIF_BOITE(_dialogueMesgId1, _questionsFilename, 65); + int sentence2LineNumb = VERIF_BOITE(_dialogueMesgId2, _questionsFilename, 65); + int sentence3LineNumb = VERIF_BOITE(_dialogueMesgId3, _questionsFilename, 65); + int sentence4LineNumb = VERIF_BOITE(_dialogueMesgId4, _questionsFilename, 65); int sentence4PosY = 420 - 20 * sentence4LineNumb; int sentence3PosY = sentence4PosY - 20 * sentence3LineNumb; int sentence2PosY = sentence3PosY - 20 * sentence2LineNumb; int sentence1PosY = sentence2PosY - 20 * sentence1LineNumb; - _vm->_fontManager.initTextBuffers(5, PLIGNE1, _questionsFilename, 5, sentence1PosY, 0, 65, 255); - _vm->_fontManager.initTextBuffers(6, PLIGNE2, _questionsFilename, 5, sentence2PosY, 0, 65, 255); - _vm->_fontManager.initTextBuffers(7, PLIGNE3, _questionsFilename, 5, sentence3PosY, 0, 65, 255); - _vm->_fontManager.initTextBuffers(8, PLIGNE4, _questionsFilename, 5, sentence4PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(5, _dialogueMesgId1, _questionsFilename, 5, sentence1PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(6, _dialogueMesgId2, _questionsFilename, 5, sentence2PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(7, _dialogueMesgId3, _questionsFilename, 5, sentence3PosY, 0, 65, 255); + _vm->_fontManager.initTextBuffers(8, _dialogueMesgId4, _questionsFilename, 5, sentence4PosY, 0, 65, 255); _vm->_fontManager.showText(5); _vm->_fontManager.showText(6); _vm->_fontManager.showText(7); @@ -270,19 +269,19 @@ int TalkManager::DIALOGUE() { int mousePosY = _vm->_eventsManager.getMouseY(); if (sentence1PosY < mousePosY && mousePosY < (sentence2PosY - 1)) { _vm->_fontManager.setOptimalColor(6, 7, 8, 5); - retVal = PLIGNE1; + retVal = _dialogueMesgId1; } if (sentence2PosY < mousePosY && mousePosY < (sentence3PosY - 1)) { _vm->_fontManager.setOptimalColor(5, 7, 8, 6); - retVal = PLIGNE2; + retVal = _dialogueMesgId2; } if (sentence3PosY < mousePosY && mousePosY < (sentence4PosY - 1)) { _vm->_fontManager.setOptimalColor(5, 6, 8, 7); - retVal = PLIGNE3; + retVal = _dialogueMesgId3; } if (sentence4PosY < mousePosY && mousePosY < 419) { _vm->_fontManager.setOptimalColor(5, 6, 7, 8); - retVal = PLIGNE4; + retVal = _dialogueMesgId4; } _vm->_eventsManager.VBL(); @@ -351,9 +350,9 @@ int TalkManager::DIALOGUE_REP(int idx) { v25 = (int16)READ_LE_UINT16((uint16 *)v3 + 2); v24 = (int16)READ_LE_UINT16((uint16 *)v3 + 3); v23 = (int16)READ_LE_UINT16((uint16 *)v3 + 4); - PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)v3 + 5); - PLIGNE2 = (int16)READ_LE_UINT16((uint16 *)v3 + 6); - PLIGNE3 = (int16)READ_LE_UINT16((uint16 *)v3 + 7); + _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)v3 + 5); + _dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)v3 + 6); + _dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)v3 + 7); v6 = (int16)READ_LE_UINT16((uint16 *)v3 + 8); v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9); @@ -437,7 +436,7 @@ int TalkManager::DIALOGUE_REP(int idx) { dialogEndTalk(); } v21 = 0; - if (!PLIGNE1) + if (!_dialogueMesgId1) v21 = -1; return v21; @@ -1018,7 +1017,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); - _vm->_graphicsManager.no_scroll = 1; + _vm->_graphicsManager._scrollStatus = 1; _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); @@ -1133,7 +1132,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) _vm->_eventsManager.VBL(); - _vm->_graphicsManager.no_scroll = 0; + _vm->_graphicsManager._scrollStatus = 0; } } // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 090c804cbf..a71ddfba7b 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -42,8 +42,8 @@ public: byte *_characterAnim; size_t _characterSize; bool STATI; - int PLIGNE1, PLIGNE2; - int PLIGNE3, PLIGNE4; + int _dialogueMesgId1, _dialogueMesgId2; + int _dialogueMesgId3, _dialogueMesgId4; int _paletteBufferIdx; public: TalkManager(); -- cgit v1.2.3 From d88e5ad22f96e6e667182967b50de820f7823e2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 01:01:09 +0100 Subject: HOPKINS: Remove a couple of useless functions --- engines/hopkins/sound.cpp | 32 ++++++++++++-------------------- engines/hopkins/sound.h | 6 ++---- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 24001cbb6f..e1100cb04a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -231,7 +231,7 @@ void SoundManager::checkSoundEnd() { if (!_soundOffFl && _soundFl) { if (!checkVoiceStatus(1)) { stopVoice(1); - DEL_NWAV(_currentSoundIndex); + delWav(_currentSoundIndex); } } } @@ -363,7 +363,7 @@ void SoundManager::WSOUND_OFF() { stopVoice(1); stopVoice(2); if (_vm->_soundManager._soundFl) - DEL_NWAV(_currentSoundIndex); + delWav(_currentSoundIndex); for (int i = 1; i <= 48; ++i) DEL_SAMPLE_SDL(i); @@ -601,16 +601,16 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { void SoundManager::playSound(const Common::String &file) { if (!_soundOffFl) { if (_soundFl) - DEL_NWAV(_currentSoundIndex); - LOAD_NWAV(file, 1); - PLAY_NWAV(1); + delWav(_currentSoundIndex); + loadWav(file, 1); + playWav(1); } } void SoundManager::PLAY_SOUND2(const Common::String &file) { if (!_soundOffFl) { - LOAD_NWAV(file, 1); - PLAY_NWAV(1); + loadWav(file, 1); + playWav(1); } } @@ -634,7 +634,7 @@ void SoundManager::loadSample(int wavIndex, const Common::String &file) { void SoundManager::playSample(int wavIndex, int voiceMode) { if (!_soundOffFl && SOUND[wavIndex]._active) { if (_soundFl) - DEL_NWAV(_currentSoundIndex); + delWav(_currentSoundIndex); if (voiceMode == 5) { if (checkVoiceStatus(1)) stopVoice(1); @@ -658,21 +658,13 @@ void SoundManager::playSample(int wavIndex, int voiceMode) { void SoundManager::PLAY_SAMPLE2(int idx) { if (!_soundOffFl && SOUND[idx]._active) { if (_soundFl) - DEL_NWAV(_currentSoundIndex); + delWav(_currentSoundIndex); if (checkVoiceStatus(1)) stopVoice(1); PLAY_SAMPLE_SDL(1, idx); } } -void SoundManager::loadWav(const Common::String &file, int wavIndex) { - LOAD_NWAV(file, wavIndex); -} - -void SoundManager::playWav(int wavIndex) { - PLAY_NWAV(wavIndex); -} - bool SoundManager::checkVoiceStatus(int voiceIndex) { if (Voice[voiceIndex]._status) { int wavIndex = Voice[voiceIndex]._wavIndex; @@ -752,11 +744,11 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename Swav[wavIndex]._freeSampleFl = freeSample; } -void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { +void SoundManager::loadWav(const Common::String &file, int wavIndex) { LOAD_SAMPLE2_SDL(wavIndex, file, 1); } -void SoundManager::PLAY_NWAV(int wavIndex) { +void SoundManager::playWav(int wavIndex) { if (!_soundFl && !_soundOffFl) { _soundFl = true; _currentSoundIndex = wavIndex; @@ -764,7 +756,7 @@ void SoundManager::PLAY_NWAV(int wavIndex) { } } -void SoundManager::DEL_NWAV(int wavIndex) { +void SoundManager::delWav(int wavIndex) { if (DEL_SAMPLE_SDL(wavIndex)) { if (checkVoiceStatus(1)) stopVoice(1); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index dcd6af5ba3..55d2d4d233 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -72,9 +72,7 @@ private: bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); - void LOAD_NWAV(const Common::String &file, int wavIndex); - void PLAY_NWAV(int wavIndex); - void DEL_NWAV(int wavIndex); + void delWav(int wavIndex); void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); /** @@ -116,6 +114,7 @@ public: void loadAnimSound(); void playAnimSound(int soundNumber); void loadWav(const Common::String &file, int wavIndex); + void playWav(int wavIndex); void WSOUND(int soundNumber); void WSOUND_OFF(); void playMod(const Common::String &file); @@ -135,7 +134,6 @@ public: void loadSample(int wavIndex, const Common::String &file); void playSample(int wavIndex, int voiceMode); void PLAY_SAMPLE2(int idx); - void playWav(int wavIndex); void syncSoundSettings(); void updateScummVMSoundSettings(); -- cgit v1.2.3 From 17d57a367edc70f2cc2a48efa308179bbdd12ce1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 01:04:52 +0100 Subject: HOPKINS: Remove WSOUND_INIT --- engines/hopkins/hopkins.cpp | 2 -- engines/hopkins/sound.cpp | 4 ---- engines/hopkins/sound.h | 1 - 3 files changed, 7 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 3a7e4d4520..2dc5211793 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -99,8 +99,6 @@ Common::Error HopkinsEngine::run() { _fileManager.initCensorship(); initializeSystem(); - _soundManager.WSOUND_INIT(); - if (getPlatform() == Common::kPlatformLinux) { if (getIsDemo()) runLinuxDemo(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e1100cb04a..3894e7f67a 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -223,10 +223,6 @@ void SoundManager::setParent(HopkinsEngine *vm) { _specialSoundNum = 0; } -void SoundManager::WSOUND_INIT() { - warning("TODO: WSOUND_INIT"); -} - void SoundManager::checkSoundEnd() { if (!_soundOffFl && _soundFl) { if (!checkVoiceStatus(1)) { diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 55d2d4d233..df66898232 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -109,7 +109,6 @@ public: ~SoundManager(); void setParent(HopkinsEngine *vm); - void WSOUND_INIT(); void checkSoundEnd(); void loadAnimSound(); void playAnimSound(int soundNumber); -- cgit v1.2.3 From 3878138d8f290fc42fa45b80f9a9b03e824d7584 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 11:28:39 +0100 Subject: HOPKINS: Some renaming in GraphicsManager and HopkinsEngine --- engines/hopkins/anim.cpp | 10 +- engines/hopkins/computer.cpp | 12 +-- engines/hopkins/events.cpp | 62 ++++++------ engines/hopkins/graphics.cpp | 222 +++++++++++++++++++++---------------------- engines/hopkins/graphics.h | 19 ++-- engines/hopkins/hopkins.cpp | 30 +++--- engines/hopkins/hopkins.h | 4 +- engines/hopkins/lines.cpp | 42 ++++---- engines/hopkins/objects.cpp | 88 ++++++++--------- 9 files changed, 241 insertions(+), 248 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index e6e9985fcc..a9932ab65b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -262,7 +262,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager._maxX = SCREEN_WIDTH; if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { hasScreenCopy = true; screenCopy = _vm->_globals.allocMemory(307200); @@ -313,12 +313,12 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager._maxX = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager._maxX = SCREEN_WIDTH; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -443,12 +443,12 @@ LABEL_114: _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager._maxX = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager._maxX = SCREEN_WIDTH; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index ef56575567..9420e82b9f 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -521,9 +521,9 @@ void ComputerManager::displayGamesSubMenu() { _ballRightFl = false; _ballUpFl = false; _breakoutLevelNbr = 0; - _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = 320; - _vm->_graphicsManager.max_y = 200; + _vm->_graphicsManager._minY = 0; + _vm->_graphicsManager._maxX = 320; + _vm->_graphicsManager._maxY = 200; _vm->_soundManager.loadSample(1, "SOUND37.WAV"); _vm->_soundManager.loadSample(2, "SOUND38.WAV"); _vm->_soundManager.loadSample(3, "SOUND39.WAV"); @@ -546,9 +546,9 @@ void ComputerManager::displayGamesSubMenu() { setVideoMode(); setTextColor(15); clearScreen(); - _vm->_graphicsManager.max_x = 680; - _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_y = 460; + _vm->_graphicsManager._maxX = 680; + _vm->_graphicsManager._minY = 0; + _vm->_graphicsManager._maxY = 460; } /** diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index d2c0689f0a..6fd46ec82d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -340,26 +340,26 @@ void EventsManager::VBL() { goto LABEL_35; } if (_breakoutFl) { - if (v15 < _vm->_graphicsManager.min_x) - v15 = _vm->_graphicsManager.min_x; - if (_mousePos.y < _vm->_graphicsManager.min_y) - yp = _vm->_graphicsManager.min_y; - if (_mouseSizeX + v15 >= _vm->_graphicsManager.max_x) - v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager.max_x); - if (yp + _mouseSizeY < _vm->_graphicsManager.max_y) + if (v15 < _vm->_graphicsManager._minX) + v15 = _vm->_graphicsManager._minX; + if (_mousePos.y < _vm->_graphicsManager._minY) + yp = _vm->_graphicsManager._minY; + if (_mouseSizeX + v15 >= _vm->_graphicsManager._maxX) + v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager._maxX); + if (yp + _mouseSizeY < _vm->_graphicsManager._maxY) goto LABEL_34; - v3 = yp + _mouseSizeY - _vm->_graphicsManager.max_y; + v3 = yp + _mouseSizeY - _vm->_graphicsManager._maxY; } else { - if (v15 < _vm->_graphicsManager.min_x) - v15 = _vm->_graphicsManager.min_x - v1; + if (v15 < _vm->_graphicsManager._minX) + v15 = _vm->_graphicsManager._minX - v1; v2 = (int16)v2; - if (_mousePos.y < _vm->_graphicsManager.min_y - (int16)v2) - yp = _vm->_graphicsManager.min_y - (int16)v2; - if (_mouseSizeX + v15 >= _vm->_graphicsManager.max_x) - v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager.max_x - v1); - if (yp + _mouseSizeY < v2 + _vm->_graphicsManager.max_y) + if (_mousePos.y < _vm->_graphicsManager._minY - (int16)v2) + yp = _vm->_graphicsManager._minY - (int16)v2; + if (_mouseSizeX + v15 >= _vm->_graphicsManager._maxX) + v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager._maxX - v1); + if (yp + _mouseSizeY < v2 + _vm->_graphicsManager._maxY) goto LABEL_34; - v3 = v2 + yp + _mouseSizeY - _vm->_graphicsManager.max_y; + v3 = v2 + yp + _mouseSizeY - _vm->_graphicsManager._maxY; } v13 = _mouseSizeY - v3; LABEL_34: @@ -375,15 +375,15 @@ LABEL_35: } if (_mouseCursorId == 23) goto LABEL_45; - if (yp >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || v14 <= 1 || v13 <= 1) { + if (yp >= _vm->_graphicsManager._maxY || v15 >= _vm->_graphicsManager._maxX || v14 <= 1 || v13 <= 1) { if (_mouseCursorId != 23) goto LABEL_54; LABEL_45: - if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x) { - if ((signed int)(v14 + v15) > _vm->_graphicsManager.max_x) - v14 -= v14 + v15 - _vm->_graphicsManager.max_x; - if (yp + v13 > _vm->_graphicsManager.max_y) - v13 -= yp + v13 - _vm->_graphicsManager.max_y; + if (yp < _vm->_graphicsManager._maxY && v15 < _vm->_graphicsManager._maxX) { + if ((signed int)(v14 + v15) > _vm->_graphicsManager._maxX) + v14 -= v14 + v15 - _vm->_graphicsManager._maxX; + if (yp + v13 > _vm->_graphicsManager._maxY) + v13 -= yp + v13 - _vm->_graphicsManager._maxY; if (v14 > 1 && v13 > 1) { _vm->_eventsManager.updateCursor(); } @@ -462,11 +462,11 @@ LABEL_65: void EventsManager::updateCursor() { // Backup the current sprite clipping bounds and reset them - Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, - _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); - _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = _vm->_globals._objectWidth; - _vm->_graphicsManager.max_y = _vm->_globals._objectHeight; + Common::Rect clipBounds(_vm->_graphicsManager._minX, _vm->_graphicsManager._minY, + _vm->_graphicsManager._maxX, _vm->_graphicsManager._maxY); + _vm->_graphicsManager._minX = _vm->_graphicsManager._minY = 0; + _vm->_graphicsManager._maxX = _vm->_globals._objectWidth; + _vm->_graphicsManager._maxY = _vm->_globals._objectHeight; int pitch = _vm->_graphicsManager._lineNbr2; _vm->_graphicsManager._lineNbr2 = _vm->_globals._objectWidth; @@ -483,10 +483,10 @@ void EventsManager::updateCursor() { } // Reset the clipping bounds - _vm->_graphicsManager.min_x = clipBounds.left; - _vm->_graphicsManager.min_y = clipBounds.top; - _vm->_graphicsManager.max_x = clipBounds.right; - _vm->_graphicsManager.max_y = clipBounds.bottom; + _vm->_graphicsManager._minX = clipBounds.left; + _vm->_graphicsManager._minY = clipBounds.top; + _vm->_graphicsManager._maxX = clipBounds.right; + _vm->_graphicsManager._maxY = clipBounds.bottom; _vm->_graphicsManager._lineNbr2 = pitch; // Convert the cursor to the pixel format. At the moment, it's hardcoded diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3ad8d95061..8e54bc1cfb 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -35,8 +35,8 @@ namespace Hopkins { GraphicsManager::GraphicsManager() { _lockCounter = 0; - SDL_MODEYES = false; - XSCREEN = YSCREEN = 0; + _initGraphicsFl = false; + _screenWidth = _screenHeight = 0; WinScan = 0; PAL_PIXELS = NULL; _lineNbr = 0; @@ -53,17 +53,16 @@ GraphicsManager::GraphicsManager() { FADE_LINUX = 0; _skipVideoLockFl = false; _scrollStatus = 0; - min_x = 0; - min_y = 20; - max_x = SCREEN_WIDTH * 2; - max_y = SCREEN_HEIGHT - 20; - clip_x = clip_y = 0; + _minX = 0; + _minY = 20; + _maxX = SCREEN_WIDTH * 2; + _maxY = SCREEN_HEIGHT - 20; + _posXClipped = _posYClipped = 0; clip_x1 = clip_y1 = 0; - clip_flag = false; + _clipFl = false; Red_x = Red_y = 0; Red = 0; _width = 0; - Compteur_y = 0; spec_largeur = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); @@ -94,7 +93,7 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { } void GraphicsManager::setGraphicalMode(int width, int height) { - if (!SDL_MODEYES) { + if (!_initGraphicsFl) { Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); initGraphics(width, height, true, &pixelFormat16); @@ -103,17 +102,17 @@ void GraphicsManager::setGraphicalMode(int width, int height) { _vesaBuffer = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); _videoPtr = NULL; - XSCREEN = width; - YSCREEN = height; + _screenWidth = width; + _screenHeight = height; WinScan = width * 2; // Refactor me PAL_PIXELS = SD_PIXELS; _lineNbr = width; - SDL_MODEYES = true; + _initGraphicsFl = true; } else { - error("Called SET_MODE multiple times"); + error("setGraphicalMode called multiple times"); } } @@ -143,7 +142,7 @@ void GraphicsManager::unlockScreen() { */ void GraphicsManager::clearScreen() { assert(_videoPtr); - _videoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); + _videoPtr->fillRect(Common::Rect(0, 0, _screenWidth, _screenHeight), 0); } /** @@ -163,10 +162,10 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { lockScreen(); clearScreen(); unlockScreen(); - A_PCX320(_vesaScreen, file, _palette); + loadPCX320(_vesaScreen, file, _palette); memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); - max_x = 320; + _maxX = 320; lockScreen(); copy16bFromSurfaceScaleX2(_vesaBuffer); @@ -192,7 +191,7 @@ void GraphicsManager::loadScreen(const Common::String &file) { } scrollScreen(0); - A_PCX640_480(_vesaScreen, file, _palette, flag); + loadPCX640(_vesaScreen, file, _palette, flag); _scrollPosX = 0; _oldScrollPosX = 0; @@ -200,14 +199,14 @@ void GraphicsManager::loadScreen(const Common::String &file) { if (!_largeScreenFl) { SCANLINE(SCREEN_WIDTH); - max_x = SCREEN_WIDTH; + _maxX = SCREEN_WIDTH; lockScreen(); clearScreen(); m_scroll16(_vesaScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); unlockScreen(); } else { SCANLINE(SCREEN_WIDTH * 2); - max_x = SCREEN_WIDTH * 2; + _maxX = SCREEN_WIDTH * 2; lockScreen(); clearScreen(); unlockScreen(); @@ -290,7 +289,7 @@ void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { } } -void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { +void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { Common::File f; Graphics::PCXDecoder pcxDecoder; @@ -325,7 +324,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by f.close(); } -void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *palette) { +void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte *palette) { size_t filesize; int v4; size_t v5; @@ -898,7 +897,6 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int const byte *srcP; byte *destP; int rowCount; - int i; int rowCount2; // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within @@ -913,7 +911,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int srcP += width; destP += width; } else if (width & 2) { - for (i = width >> 1; i; --i) { + for (int i = width >> 1; i; --i) { destP[0] = srcP[0]; destP[1] = srcP[1]; srcP += 2; @@ -935,9 +933,9 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, for (int i = spriteIndex; i; --i) spriteP += READ_LE_UINT32(spriteP) + 16; - clip_x = 0; - clip_y = 0; - clip_flag = false; + _posXClipped = 0; + _posYClipped = 0; + _clipFl = false; spriteP += 4; int width = READ_LE_UINT16(spriteP); @@ -946,44 +944,44 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Clip X clip_x1 = width; - if ((xp + width) <= (min_x + 300)) + if ((xp + width) <= (_minX + 300)) return; - if (xp < (min_x + 300)) { - clip_x = min_x + 300 - xp; - clip_flag = true; + if (xp < (_minX + 300)) { + _posXClipped = _minX + 300 - xp; + _clipFl = true; } // Clip Y // TODO: This is weird, but it's that way in the original. Original game bug? if ((yp + height) <= height) return; - if (yp < (min_y + 300)) { - clip_y = min_y + 300 - yp; - clip_flag = true; + if (yp < (_minY + 300)) { + _posYClipped = _minY + 300 - yp; + _clipFl = true; } // Clip X1 - if (xp >= (max_x + 300)) + if (xp >= (_maxX + 300)) return; - if ((xp + width) > (max_x + 300)) { - int xAmount = width + 10 - (xp + width - (max_x + 300)); + if ((xp + width) > (_maxX + 300)) { + int xAmount = width + 10 - (xp + width - (_maxX + 300)); if (xAmount <= 10) return; clip_x1 = xAmount - 10; - clip_flag = true; + _clipFl = true; } // Clip Y1 - if (yp >= (max_y + 300)) + if (yp >= (_maxY + 300)) return; - if ((yp + height) > (max_y + 300)) { - int yAmount = height + 10 - (yp + height - (max_y + 300)); + if ((yp + height) > (_maxY + 300)) { + int yAmount = height + 10 - (yp + height - (_maxY + 300)); if (yAmount <= 10) return; clip_y1 = yAmount - 10; - clip_flag = true; + _clipFl = true; } // Sprite display @@ -999,7 +997,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, byte *destP = surface + (yp - 300) * _lineNbr2 + (xp - 300); // Handling for clipped versus non-clipped - if (clip_flag) { + if (_clipFl) { // Clipped version for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; @@ -1014,7 +1012,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, if (byteVal == 254) { // Copy pixel range for (int xv = 0; xv < width; ++xv, ++xc, ++spriteP, ++tempDestP) { - if (clip_y == 0 && xc >= clip_x && xc < clip_x1) + if (_posYClipped == 0 && xc >= _posXClipped && xc < clip_x1) *tempDestP = *spriteP; } } else { @@ -1024,8 +1022,8 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } } - if (clip_y > 0) - --clip_y; + if (_posYClipped > 0) + --_posYClipped; srcP += 3; } } else { @@ -1100,14 +1098,14 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { tempX = x1; addFlag = true; - if (x2 > max_x) - x2 = max_x; - if (y2 > max_y) - y2 = max_y; - if (x1 < min_x) - tempX = min_x; - if (y1 < min_y) - y1 = min_y; + if (x2 > _maxX) + x2 = _maxX; + if (y2 > _maxY) + y2 = _maxY; + if (x1 < _minX) + tempX = _minX; + if (y1 < _minY) + y1 = _minY; if (_vm->_globals.NBBLOC > 1) { int16 blocIndex = 0; @@ -1293,24 +1291,23 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); int spriteHeight1 = spriteHeight2; spritePixelsP = spriteSizeP + 10; - clip_x = 0; - clip_y = 0; + _posXClipped = 0; + _posYClipped = 0; clip_x1 = 0; clip_y1 = 0; - if ((xp300 <= min_x) || (yp300 <= min_y) || (xp300 >= max_x + 300) || (yp300 >= max_y + 300)) + if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300)) return; - if ((uint16)xp300 < (uint16)(min_x + 300)) - clip_x = min_x + 300 - xp300; + if ((uint16)xp300 < (uint16)(_minX + 300)) + _posXClipped = _minX + 300 - xp300; - if ((uint16)yp300 < (uint16)(min_y + 300)) - clip_y = min_y + 300 - yp300; + if ((uint16)yp300 < (uint16)(_minY + 300)) + _posYClipped = _minY + 300 - yp300; - clip_x1 = max_x + 300 - xp300; - clip_y1 = max_y + 300 - yp300; + clip_x1 = _maxX + 300 - xp300; + clip_y1 = _maxY + 300 - yp300; dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; if (zoom2) { - Compteur_y = 0; Agr_x = 0; Agr_y = 0; Agr_Flag_y = false; @@ -1320,22 +1317,22 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v22 = zoomIn(spriteHeight1, zoom2); if (modeFlag) { v29 = v20 + dest1P; - if (clip_y) { - if ((uint16)clip_y >= v22) + if (_posYClipped) { + if ((uint16)_posYClipped >= v22) return; int v30 = 0; - while (zoomIn(++v30, zoom2) < (uint16)clip_y) + while (zoomIn(++v30, zoom2) < (uint16)_posYClipped) ; spritePixelsP += _width * v30; - v29 += _lineNbr2 * (uint16)clip_y; - v22 = v22 - (uint16)clip_y; + v29 += _lineNbr2 * (uint16)_posYClipped; + v22 = v22 - (uint16)_posYClipped; } if (v22 > (uint16)clip_y1) v22 = (uint16)clip_y1; - if (clip_x) { - if ((uint16)clip_x >= v20) + if (_posXClipped) { + if ((uint16)_posXClipped >= v20) return; - v20 -= (uint16)clip_x; + v20 -= (uint16)_posXClipped; } if (v20 > (uint16)clip_x1) { int v32 = v20 - (uint16)clip_x1; @@ -1377,7 +1374,6 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; v29 = _lineNbr2 + v53; - ++Compteur_y; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 100) @@ -1393,31 +1389,31 @@ R_Aff_Zoom_Larg_Cont1: v22 = v63 - 1; } while (v63 != 1); } else { - if (clip_y) { - if ((uint16)clip_y >= v22) + if (_posYClipped) { + if ((uint16)_posYClipped >= v22) return; int v58 = v22; int v49 = v20; int v23 = 0; - int v24 = (uint16)clip_y; + int v24 = (uint16)_posYClipped; while (zoomIn(++v23, zoom2) < v24) ; v20 = v49; spritePixelsP += _width * v23; - dest1P += _lineNbr2 * (uint16)clip_y; - v22 = v58 - (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)_posYClipped; + v22 = v58 - (uint16)_posYClipped; } if (v22 > (uint16)clip_y1) v22 = (uint16)clip_y1; - if (clip_x) { - if ((uint16)clip_x >= v20) + if (_posXClipped) { + if ((uint16)_posXClipped >= v20) return; int v26 = 0; - while (zoomIn(++v26, zoom2) < (uint16)clip_x) + while (zoomIn(++v26, zoom2) < (uint16)_posXClipped) ; spritePixelsP += v26; - dest1P += (uint16)clip_x; - v20 = v20 - (uint16)clip_x; + dest1P += (uint16)_posXClipped; + v20 = v20 - (uint16)_posXClipped; } if (v20 > (uint16)clip_x1) v20 = (uint16)clip_x1; @@ -1470,7 +1466,6 @@ Aff_Zoom_Larg_Cont1: } while (v60 != 1); } } else if (zoom1) { - Compteur_y = 0; Red_x = 0; Red_y = 0; _width = spriteWidth; @@ -1489,7 +1484,7 @@ Aff_Zoom_Larg_Cont1: for (int v41 = _width; v41; v41--) { Red_x = Red + Red_x; if ((uint16)Red_x < 100) { - if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) + if (v42 >= _posXClipped && v42 < clip_x1 && *spritePixelsP) *v40 = *spritePixelsP; --v40; ++spritePixelsP; @@ -1518,7 +1513,7 @@ Aff_Zoom_Larg_Cont1: for (int v38 = _width; v38; v38--) { Red_x = Red + Red_x; if ((uint16)Red_x < 100) { - if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) + if (v39 >= _posXClipped && v39 < clip_x1 && *spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; ++spritePixelsP; @@ -1540,22 +1535,21 @@ Aff_Zoom_Larg_Cont1: } } else { _width = spriteWidth; - Compteur_y = 0; if (modeFlag) { dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; - if (clip_y) { - if ((uint16)clip_y >= (unsigned int)spriteHeight1) + if (_posYClipped) { + if ((uint16)_posYClipped >= (unsigned int)spriteHeight1) return; - spritePixelsP += spriteWidth * (uint16)clip_y; - dest2P += _lineNbr2 * (uint16)clip_y; - spriteHeight1 -= (uint16)clip_y; + spritePixelsP += spriteWidth * (uint16)_posYClipped; + dest2P += _lineNbr2 * (uint16)_posYClipped; + spriteHeight1 -= (uint16)_posYClipped; } int xLeft = (uint16)clip_y1; if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; - xLeft = clip_x; - if (clip_x) { + xLeft = _posXClipped; + if (_posXClipped) { if (xLeft >= spriteWidth) return; spriteWidth -= xLeft; @@ -1583,21 +1577,21 @@ Aff_Zoom_Larg_Cont1: } while (yCtr2 != 1); } else { spec_largeur = spriteWidth; - if (clip_y) { - if ((uint16)clip_y >= (unsigned int)spriteHeight1) + if (_posYClipped) { + if ((uint16)_posYClipped >= (unsigned int)spriteHeight1) return; - spritePixelsP += spriteWidth * (uint16)clip_y; - dest1P += _lineNbr2 * (uint16)clip_y; - spriteHeight1 -= (uint16)clip_y; + spritePixelsP += spriteWidth * (uint16)_posYClipped; + dest1P += _lineNbr2 * (uint16)_posYClipped; + spriteHeight1 -= (uint16)_posYClipped; } if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; - if (clip_x) { - if ((uint16)clip_x >= spriteWidth) + if (_posXClipped) { + if ((uint16)_posXClipped >= spriteWidth) return; - spritePixelsP += (uint16)clip_x; - dest1P += (uint16)clip_x; - spriteWidth -= (uint16)clip_x; + spritePixelsP += (uint16)_posXClipped; + dest1P += (uint16)_posXClipped; + spriteWidth -= (uint16)_posXClipped; } if (spriteWidth > (uint16)clip_x1) spriteWidth = (uint16)clip_x1; @@ -1651,20 +1645,20 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int croppedWidth = width; croppedHeight = height; - if (x1 < min_x) { - croppedWidth = width - (min_x - x1); - left = min_x; + if (x1 < _minX) { + croppedWidth = width - (_minX - x1); + left = _minX; } - if (y1 < min_y) { - croppedHeight = height - (min_y - y1); - top = min_y; + if (y1 < _minY) { + croppedHeight = height - (_minY - y1); + top = _minY; } top2 = top; - if (top + croppedHeight > max_y) - croppedHeight = max_y - top; + if (top + croppedHeight > _maxY) + croppedHeight = _maxY - top; xRight = left + croppedWidth; - if (xRight > max_x) - croppedWidth = max_x - left; + if (xRight > _maxX) + croppedWidth = _maxX - left; if (croppedWidth > 0 && croppedHeight > 0) { int height2 = croppedHeight; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 264a3fad80..2c601492e5 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -54,9 +54,9 @@ private: void loadScreen(const Common::String &file); public: int _lockCounter; - bool SDL_MODEYES; - int XSCREEN; - int YSCREEN; + bool _initGraphicsFl; + int _screenWidth; + int _screenHeight; int WinScan; byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; @@ -81,15 +81,14 @@ public: bool _skipVideoLockFl; int _scrollStatus; Common::Rect dstrect[50]; - int min_x, min_y; - int max_x, max_y; - int clip_x, clip_y; + int _minX, _minY; + int _maxX, _maxY; + int _posXClipped, _posYClipped; int clip_x1, clip_y1; - bool clip_flag; + bool _clipFl; int Red_x, Red_y; int Red; int _width; - int Compteur_y; int spec_largeur; bool _noFadingFl; public: @@ -107,8 +106,8 @@ public: void scrollScreen(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); - void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); - void A_PCX320(byte *surface, const Common::String &file, byte *palette); + void loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void loadPCX320(byte *surface, const Common::String &file, byte *palette); void clearPalette(); void SCANLINE(int pitch); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2dc5211793..42916448ac 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -333,7 +333,7 @@ bool HopkinsEngine::runWin95Demo() { case 13: case 14: case 15: - NO_DISPO(11); + handleNotAvailable(11); break; case 16: @@ -348,11 +348,11 @@ bool HopkinsEngine::runWin95Demo() { case 33: case 32: case 34: - NO_DISPO(4); + handleNotAvailable(4); break; case 17: - NO_DISPO(1); + handleNotAvailable(1); break; case 111: @@ -512,7 +512,7 @@ bool HopkinsEngine::runLinuxDemo() { case 32: case 34: case 38: - PASS(); + displayNotAvailable(); break; case 1: @@ -1953,7 +1953,7 @@ void HopkinsEngine::playIntro() { /** * If in demo, displays a 'not available' screen and returns to the city map */ -void HopkinsEngine::PASS() { +void HopkinsEngine::displayNotAvailable() { if (!getIsDemo()) return; @@ -1972,10 +1972,10 @@ void HopkinsEngine::PASS() { _globals._exitId = 4; } -void HopkinsEngine::NO_DISPO(int sortie) { +void HopkinsEngine::handleNotAvailable(int sortie) { // Use the code of the linux demo instead of the code of the Windows demo. // The behavior is somewhat better, and common code is easier to maintain. - PASS(); + displayNotAvailable(); _globals._exitId = sortie; } @@ -2921,10 +2921,10 @@ bool HopkinsEngine::displayAdultDisclaimer() { int xp, yp; int buttonIndex; - _graphicsManager.min_x = 0; - _graphicsManager.min_y = 0; - _graphicsManager.max_x = SCREEN_WIDTH; - _graphicsManager.max_y = SCREEN_HEIGHT - 1; + _graphicsManager._minX = 0; + _graphicsManager._minY = 0; + _graphicsManager._maxX = SCREEN_WIDTH; + _graphicsManager._maxY = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; _globals._forestFl = false; _globals._disableInventFl = true; @@ -2958,10 +2958,10 @@ bool HopkinsEngine::displayAdultDisclaimer() { return false; } else { // Continue - _graphicsManager.min_x = 0; - _graphicsManager.max_y = 20; - _graphicsManager.max_x = SCREEN_WIDTH; - _graphicsManager.max_y = SCREEN_HEIGHT - 20; + _graphicsManager._minX = 0; + _graphicsManager._maxY = 20; + _graphicsManager._maxX = SCREEN_WIDTH; + _graphicsManager._maxY = SCREEN_HEIGHT - 20; return true; } } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 9b1bce5509..8ae9093872 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -84,7 +84,7 @@ private: void initializeSystem(); - void PASS(); + void displayNotAvailable(); void restoreSystem(); void PUBQUIT(); void displayEndDemo(); @@ -106,7 +106,7 @@ private: void loadCredits(); void displayCredits(int startPosY, byte *buffer, char colour); void displayCredits(); - void NO_DISPO(int sortie); + void handleNotAvailable(int sortie); bool runWin95Demo(); bool runLinuxDemo(); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c9434e9e2f..07fbc16d64 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -422,8 +422,8 @@ void LinesManager::initRoute() { int curLineX = curLineData[2 * curDataIdx - 2]; int curLineY = curLineData[2 * curDataIdx - 1]; - if (_vm->_graphicsManager.max_x == curLineX || _vm->_graphicsManager.max_y == curLineY || - _vm->_graphicsManager.min_x == curLineX || _vm->_graphicsManager.min_y == curLineY || + if (_vm->_graphicsManager._maxX == curLineX || _vm->_graphicsManager._maxY == curLineY || + _vm->_graphicsManager._minX == curLineX || _vm->_graphicsManager._minY == curLineY || (lineX == curLineX && lineY == curLineY)) break; if (lineIdx == MAX_LINES) @@ -1143,7 +1143,7 @@ LABEL_17: v74 = v100; - if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) + if (_vm->_graphicsManager._maxX <= v36 || v67 <= v36) break; } int v37 = a5; @@ -1393,8 +1393,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { clipDestX = 20; if (clipDestY <= 19) clipDestY = 20; - if (clipDestX > _vm->_graphicsManager.max_x - 10) - clipDestX = _vm->_graphicsManager.max_x - 10; + if (clipDestX > _vm->_graphicsManager._maxX - 10) + clipDestX = _vm->_graphicsManager._maxX - 10; if (clipDestY > _vm->_globals.Max_Perso_Y) clipDestY = _vm->_globals.Max_Perso_Y; @@ -1412,7 +1412,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) != 1) { v14 = 0; v15 = clipDestY; - if (_vm->_graphicsManager.max_y > clipDestY) { + if (_vm->_graphicsManager._maxY > clipDestY) { v16 = 5; do { v101 = v16; @@ -1423,12 +1423,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v141[v101] = -1; ++v14; ++v15; - } while (_vm->_graphicsManager.max_y > v15); + } while (_vm->_graphicsManager._maxY > v15); } v131[5] = v14; v18 = 0; v19 = clipDestY; - if (_vm->_graphicsManager.min_y < clipDestY) { + if (_vm->_graphicsManager._minY < clipDestY) { v20 = 1; do { v102 = v20; @@ -1443,12 +1443,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } ++v18; --v19; - } while (_vm->_graphicsManager.min_y < v19); + } while (_vm->_graphicsManager._minY < v19); } v131[1] = v18; v22 = 0; v23 = clipDestX; - if (_vm->_graphicsManager.max_x > clipDestX) { + if (_vm->_graphicsManager._maxX > clipDestX) { v24 = 3; do { v103 = v24; @@ -1465,12 +1465,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (v131[5] < v22 && v141[5] != -1) break; ++v23; - } while (_vm->_graphicsManager.max_x > v23); + } while (_vm->_graphicsManager._maxX > v23); } v131[3] = v22; v26 = 0; v27 = clipDestX; - if (_vm->_graphicsManager.min_x < clipDestX) { + if (_vm->_graphicsManager._minX < clipDestX) { v28 = 7; do { v104 = v28; @@ -1489,7 +1489,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (v131[3] < v26 && v141[3] != -1) break; --v27; - } while (_vm->_graphicsManager.min_x < v27); + } while (_vm->_graphicsManager._minX < v27); } v131[7] = v26; if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) @@ -1540,7 +1540,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v34 = 0; v35 = srcY; - if (_vm->_graphicsManager.max_y > srcY) { + if (_vm->_graphicsManager._maxY > srcY) { v36 = 5; do { v105 = v36; @@ -1551,12 +1551,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v141[v105] = -1; ++v34; ++v35; - } while (_vm->_graphicsManager.max_y > v35); + } while (_vm->_graphicsManager._maxY > v35); } v131[5] = v34 + 1; v38 = 0; v39 = srcY; - if (_vm->_graphicsManager.min_y < srcY) { + if (_vm->_graphicsManager._minY < srcY) { v40 = 1; do { v106 = v40; @@ -1571,12 +1571,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { break; } --v39; - } while (_vm->_graphicsManager.min_y < v39); + } while (_vm->_graphicsManager._minY < v39); } v131[1] = v38 + 1; v42 = 0; v43 = srcX; - if (_vm->_graphicsManager.max_x > srcX) { + if (_vm->_graphicsManager._maxX > srcX) { v44 = 3; do { v107 = v44; @@ -1591,12 +1591,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { break; } ++v43; - } while (_vm->_graphicsManager.max_x > v43); + } while (_vm->_graphicsManager._maxX > v43); } v131[3] = v42 + 1; v46 = 0; v47 = srcX; - if (_vm->_graphicsManager.min_x < srcX) { + if (_vm->_graphicsManager._minX < srcX) { v48 = 7; do { v108 = v48; @@ -1611,7 +1611,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { break; } --v47; - } while (_vm->_graphicsManager.min_x < v47); + } while (_vm->_graphicsManager._minX < v47); } v131[7] = v46 + 1; if (v141[1] != -1) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 36e124e14c..2ddf24c75c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -276,12 +276,12 @@ void ObjectsManager::displaySprite() { if (_vm->_fontManager._textList[idx]._enabledFl && _vm->_fontManager._text[idx]._textType != 2) { clipX = _vm->_fontManager._textList[idx]._pos.x - 2; - if (clipX < _vm->_graphicsManager.min_x) - clipX = _vm->_graphicsManager.min_x; + if (clipX < _vm->_graphicsManager._minX) + clipX = _vm->_graphicsManager._minX; clipY = _vm->_fontManager._textList[idx]._pos.y - 2; - if (clipY < _vm->_graphicsManager.min_y) - clipY = _vm->_graphicsManager.min_y; + if (clipY < _vm->_graphicsManager._minY) + clipY = _vm->_graphicsManager._minY; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, @@ -294,12 +294,12 @@ void ObjectsManager::displaySprite() { for (int idx = 0; idx < MAX_SPRITE; ++idx) { if (_vm->_globals.Liste[idx].field0) { clipX = _vm->_globals.Liste[idx].field2 - 2; - if (clipX < _vm->_graphicsManager.min_x) - clipX = _vm->_graphicsManager.min_x; + if (clipX < _vm->_graphicsManager._minX) + clipX = _vm->_graphicsManager._minX; clipY = _vm->_globals.Liste[idx].field4 - 2; - if (clipY < _vm->_graphicsManager.min_y) - clipY = _vm->_graphicsManager.min_y; + if (clipY < _vm->_graphicsManager._minY) + clipY = _vm->_graphicsManager._minY; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, @@ -447,17 +447,17 @@ void ObjectsManager::displaySprite() { _vm->_fontManager._textList[idx]._width = _vm->_fontManager._text[idx]._width; _vm->_fontManager._textList[idx]._height = _vm->_fontManager._text[idx]._height; - if (_vm->_fontManager._textList[idx]._pos.x < _vm->_graphicsManager.min_x) - _vm->_fontManager._textList[idx]._pos.x = _vm->_graphicsManager.min_x - 1; - if (_vm->_fontManager._textList[idx]._pos.y < _vm->_graphicsManager.min_y) - _vm->_fontManager._textList[idx]._pos.y = _vm->_graphicsManager.min_y - 1; + if (_vm->_fontManager._textList[idx]._pos.x < _vm->_graphicsManager._minX) + _vm->_fontManager._textList[idx]._pos.x = _vm->_graphicsManager._minX - 1; + if (_vm->_fontManager._textList[idx]._pos.y < _vm->_graphicsManager._minY) + _vm->_fontManager._textList[idx]._pos.y = _vm->_graphicsManager._minY - 1; int posX = _vm->_fontManager._textList[idx]._pos.x; - if (_vm->_fontManager._textList[idx]._width + posX > _vm->_graphicsManager.max_x) - _vm->_fontManager._textList[idx]._width = _vm->_graphicsManager.max_x - posX; + if (_vm->_fontManager._textList[idx]._width + posX > _vm->_graphicsManager._maxX) + _vm->_fontManager._textList[idx]._width = _vm->_graphicsManager._maxX - posX; int posY = _vm->_fontManager._textList[idx]._pos.y; - if (_vm->_fontManager._textList[idx]._height + posY > _vm->_graphicsManager.max_y) - _vm->_fontManager._textList[idx]._height = _vm->_graphicsManager.max_y - posY; + if (_vm->_fontManager._textList[idx]._height + posY > _vm->_graphicsManager._maxY) + _vm->_fontManager._textList[idx]._height = _vm->_graphicsManager._maxY - posY; if (_vm->_fontManager._textList[idx]._width <= 0 || _vm->_fontManager._textList[idx]._height <= 0) _vm->_fontManager._textList[idx]._enabledFl = false; } @@ -526,21 +526,21 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; - if (_vm->_globals.Liste2[idx]._xp < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste2[idx]._xp; - _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager.min_x; + if (_vm->_globals.Liste2[idx]._xp < _vm->_graphicsManager._minX) { + _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste2[idx]._xp; + _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste2[idx]._yp < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste2[idx]._yp; - _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager.min_y; + if (_vm->_globals.Liste2[idx]._yp < _vm->_graphicsManager._minY) { + _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste2[idx]._yp; + _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._xp > _vm->_graphicsManager.max_x) - _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste2[idx]._xp; + if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._xp > _vm->_graphicsManager._maxX) + _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste2[idx]._xp; - if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._yp > _vm->_graphicsManager.max_y) - _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste2[idx]._yp; + if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._yp > _vm->_graphicsManager._maxY) + _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste2[idx]._yp; if (_vm->_globals.Liste2[idx]._width <= 0 || _vm->_globals.Liste2[idx]._height <= 0) _vm->_globals.Liste2[idx]._visibleFl = false; @@ -774,21 +774,21 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx]._width = _sprite[idx]._width; _vm->_globals.Liste[idx]._height = _sprite[idx]._height; - if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste[idx].field2; - _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager.min_x; + if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager._minX) { + _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste[idx].field2; + _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste[idx].field4; - _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager.min_y; + if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager._minY) { + _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste[idx].field4; + _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste[idx].field2; + if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager._maxX) + _vm->_globals.Liste[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste[idx].field2; - if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste[idx].field4; + if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager._maxY) + _vm->_globals.Liste[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste[idx].field4; if (_vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) _vm->_globals.Liste[idx].field0 = false; @@ -2626,13 +2626,13 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { clipX2 = 15; if (y2 <= 14) clipY2 = 15; - if (clipX2 > _vm->_graphicsManager.max_x - 10) - clipX2 = _vm->_graphicsManager.max_x - 10; + if (clipX2 > _vm->_graphicsManager._maxX - 10) + clipX2 = _vm->_graphicsManager._maxX - 10; if (clipY2 > 445) clipY2 = 440; int delta = 0; - for (delta = 0; clipY2 + delta < _vm->_graphicsManager.max_y; delta++) { + for (delta = 0; clipY2 + delta < _vm->_graphicsManager._maxY; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 + delta, &arrDataIdx[5], &arrLineIdx[5], 0, _lastLine) && arrLineIdx[5] <= _lastLine) break; arrDataIdx[5] = 0; @@ -2640,7 +2640,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[5] = delta; - for (delta = 0; clipY2 - delta > _vm->_graphicsManager.min_y; delta++) { + for (delta = 0; clipY2 - delta > _vm->_graphicsManager._minY; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 - delta , &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine) && arrLineIdx[1] <= _lastLine) break; arrDataIdx[1] = 0; @@ -2650,7 +2650,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[1] = delta; - for (delta = 0; clipX2 + delta < _vm->_graphicsManager.max_x; delta++) { + for (delta = 0; clipX2 + delta < _vm->_graphicsManager._maxX; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2 + delta, clipY2, &arrDataIdx[3], &arrLineIdx[3], 0, _lastLine) && arrLineIdx[3] <= _lastLine) break; arrDataIdx[3] = 0; @@ -2662,7 +2662,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[3] = delta; - for (delta = 0; clipX2 - delta > _vm->_graphicsManager.min_x; delta++) { + for (delta = 0; clipX2 - delta > _vm->_graphicsManager._minX; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2 - delta, clipY2, &arrDataIdx[7], &arrLineIdx[7], 0, _lastLine) && arrLineIdx[7] <= _lastLine) break; arrDataIdx[7] = 0; @@ -3068,7 +3068,7 @@ int ObjectsManager::MZONE() { } int colRes2 = 0; - for (int j = yp; j < _vm->_graphicsManager.max_y; ++j) { + for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { colRes2 = colision(xp, j); if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; @@ -3091,7 +3091,7 @@ int ObjectsManager::MZONE() { } int colRes4 = 0; - for (int xCurrent = xp; _vm->_graphicsManager.max_x > xCurrent; ++xCurrent) { + for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { colRes4 = colision(xCurrent, yp); if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; -- cgit v1.2.3 From db80d0d0df48b8679b209491b164642d95269ad8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 12:33:59 +0100 Subject: HOPKINS: Some more renaming --- engines/hopkins/dialogs.cpp | 24 +++++++++++------------- engines/hopkins/graphics.cpp | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index a082cf172e..b4c5c34976 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -344,13 +344,12 @@ LABEL_7: _inventBuf2 = _vm->_fileManager.loadFile("INVENT2.SPR"); - int v19 = _inventX = _vm->_graphicsManager._scrollOffset + 152; + _inventX = _vm->_graphicsManager._scrollOffset + 152; _inventY = 114; int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, - v19 + 300, 414, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, 0); int v15 = 0; int inventCount = 0; for (int inventLine = 1; inventLine <= 5; inventLine++) { @@ -361,7 +360,7 @@ LABEL_7: // The last two zones are not reserved for the inventory: Options and Save/Load if (inventIdx && inventCount <= 29) { byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, v19 + v16 + 6, + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, _inventX + v16 + 6, v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); _vm->_globals.freeMemory(v7); } @@ -434,8 +433,8 @@ LABEL_7: _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { _inventDisplayedFl = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, v19, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, v19, 114); - _vm->_graphicsManager.addVesaSegment(v19, 114, v19 + v18, v18 + 114); + _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _inventX, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, _inventX, 114); + _vm->_graphicsManager.addVesaSegment(_inventX, 114, _inventX + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; } @@ -478,11 +477,10 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - int v0 = _vm->_graphicsManager._scrollOffset + 2; - int v1 = _vm->_graphicsManager._scrollOffset + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, v1 + 300, 327, 0); - _vm->_graphicsManager.addVesaSegment(v1, 27, v1 + 45, 62); - _vm->_objectsManager.I_old_x = v0; + int newOffset = _vm->_graphicsManager._scrollOffset + 2; + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, newOffset + 300, 327, 0); + _vm->_graphicsManager.addVesaSegment(newOffset, 27, newOffset + 45, 62); + _vm->_objectsManager.I_old_x = newOffset; } if (_vm->_globals._saveData->data[svField357] == 1) { @@ -638,12 +636,12 @@ void DialogsManager::showSaveLoad(int a1) { if (_vm->_globals._language == LANG_FR) { if (a1 == 1) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 525, 375, 1); - if (a1 == 2) + else if (a1 == 2) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 515, 375, 2); } else { if (a1 == 1) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 535, 372, 1); - if (a1 == 2) + else if (a1 == 2) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 539, 372, 2); } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 8e54bc1cfb..93f1d01998 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1359,7 +1359,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp --v29; ++spritePixelsP; if (!Agr_Flag_x) - Agr_x = zoom2 + Agr_x; + Agr_x += zoom2; if ((uint16)Agr_x < 100) break; Agr_x -= 100; @@ -1375,7 +1375,7 @@ R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; v29 = _lineNbr2 + v53; if (!Agr_Flag_y) - Agr_y = zoom2 + Agr_y; + Agr_y += zoom2; if ((uint16)Agr_y < 100) break; Agr_y -= 100; -- cgit v1.2.3 From e5db285cd64dfe3941b1fd55d95805c97ccd8332 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 12:43:34 +0100 Subject: HOPKINS: Add Spanish computer text --- engines/hopkins/computer.cpp | 37 ++++++++++++++++++++++++++++++------- engines/hopkins/computer.h | 4 ++-- engines/hopkins/hopkins.cpp | 6 +++--- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 9420e82b9f..e771b75884 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -126,7 +126,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) outText(Common::String(_menuText[0]._line)); - else if (mode == COMPUTER_SAMANTHAS) + else if (mode == COMPUTER_SAMANTHA) outText(Common::String(_menuText[1]._line)); else // COMPUTER_PUBLIC outText(Common::String(_menuText[2]._line)); @@ -140,11 +140,11 @@ void ComputerManager::showComputer(ComputerEnum mode) { outText(Common::String(_menuText[4]._line)); setTextPosition(14, 35); - TXT4(280, 224, 8); + displayMessage(280, 224, 8); bool passwordMatch = false; if ((mode == COMPUTER_HOPKINS) && !strcmp(_inputBuf, "HOPKINS")) passwordMatch = true; - else if ((mode == COMPUTER_SAMANTHAS) && !strcmp(_inputBuf, "328MHZA")) + else if ((mode == COMPUTER_SAMANTHA) && !strcmp(_inputBuf, "328MHZA")) passwordMatch = true; else if ((mode == COMPUTER_PUBLIC) && !strcmp(_inputBuf, "ALLFREE")) passwordMatch = true; @@ -157,7 +157,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { setTextPosition(2, 4); if (mode == COMPUTER_HOPKINS) outText(Common::String(_menuText[0]._line)); - else if (mode == COMPUTER_SAMANTHAS) + else if (mode == COMPUTER_SAMANTHA) outText(Common::String(_menuText[1]._line)); else if (mode == COMPUTER_PUBLIC) outText(Common::String(_menuText[2]._line)); @@ -176,7 +176,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { outText2(Common::String(_menuText[10]._line)); setTextPosition(16, 25); outText2(Common::String(_menuText[11]._line)); - } else if (mode == COMPUTER_SAMANTHAS) { + } else if (mode == COMPUTER_SAMANTHA) { setTextPosition(10, 25); // outText2(Common::String(_menuText[0x95A])); <=== CHECKME: Unexpected value! replaced by the following line, for consistancy outText2(Common::String(_menuText[12]._line)); @@ -227,7 +227,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { readText(4); break; } - } else if (mode == COMPUTER_SAMANTHAS) { + } else if (mode == COMPUTER_SAMANTHA) { clearScreen(); setTextColor(4); setTextPosition(2, 4); @@ -322,6 +322,26 @@ static char _frenchText[] = "% 6) DISPARITIONS (suite).\n" "%% fin\n"; +static char _spanishText[] = +"% **** ORDENADOR DEL FBI NUMERO 4985 **** ORDENADOR J.HOPKINS *****\n" +"% **** ORDENADOR DEL FBI NUMERO 4998 **** ORDENADOR S.COLLINS *****\n" +"% *** ORDENADOR DEL FBI NUMERO 4997 *** ORDENADOR DE ACCESO LIBRE ***\n" +"% LA CONTRASE¥A ES: ALLFREE\n" +"% ESCRIBE CONTRASE¥A ACTUAL\n" +"% **** ACCESO DENEGADO ****\n" +"% 1) *** JUEGO ***\n" +"% 0) SALIR DEL ORDENADOR\n" +"% 2) CADAVER EXTRA¥O\n" +"% 3) CADAVER EXTRA¥O\n" +"% 4) SENADOR FERGUSSON\n" +"% 5) MATAPERROS\n" +"% 2) CIENTIFICO SECUESTRADO.\n" +"% 3) CIENTIFICO SECUESTRADO (siguiente).\n" +"% 4) CIENTIFICO SECUESTRADO (siguiente).\n" +"% 5) CIENTIFICO SECUESTRADO (siguiente).\n" +"% 6) CIENTIFICO SECUESTRADO (siguiente).\n" +"%% fin\n"; + /** * Load Menu data */ @@ -332,6 +352,9 @@ void ComputerManager::loadMenu() { } else if (_vm->_globals._language == LANG_FR) { ptr = (char *)_vm->_globals.allocMemory(sizeof(_frenchText)); strcpy(ptr, _frenchText); + } else if (_vm->_globals._language == LANG_SP) { + ptr = (char *)_vm->_globals.allocMemory(sizeof(_spanishText)); + strcpy(ptr, _spanishText); } else { ptr = (char *)_vm->_globals.allocMemory(sizeof(_englishText)); strcpy(ptr, _englishText); @@ -367,7 +390,7 @@ void ComputerManager::loadMenu() { _vm->_globals.freeMemory((byte *)ptr); } -void ComputerManager::TXT4(int xp, int yp, int textIdx) { +void ComputerManager::displayMessage(int xp, int yp, int textIdx) { char curChar; char newChar; char mappedChar; diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index c5f92f35bf..41ed902a2a 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -42,7 +42,7 @@ struct ScoreItem { Common::String _score; }; -enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHAS = 2, COMPUTER_PUBLIC = 3 }; +enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHA = 2, COMPUTER_PUBLIC = 3 }; class ComputerManager { private: @@ -93,7 +93,7 @@ private: void checkBallCollisions(); void getScoreName(); - void TXT4(int xp, int yp, int textIdx); + void displayMessage(int xp, int yp, int textIdx); void displayScoreChar(int charPos, int charDisp); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 42916448ac..e41ef1c533 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -386,7 +386,7 @@ bool HopkinsEngine::runWin95Demo() { _globals._screenId = 114; _globals._saveData->data[svField5] = _globals._screenId; _globals._exitId = 0; - _computerManager.showComputer(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHA); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); @@ -717,7 +717,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals._saveData->data[svField6] = _globals._screenId; _globals._screenId = 114; _globals._saveData->data[svField5] = 114; - _computerManager.showComputer(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHA); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); @@ -1531,7 +1531,7 @@ bool HopkinsEngine::runFull() { _globals._screenId = 114; _globals._saveData->data[svField6] = _globals._prevScreenId; _globals._saveData->data[svField5] = _globals._screenId; - _computerManager.showComputer(COMPUTER_SAMANTHAS); + _computerManager.showComputer(COMPUTER_SAMANTHA); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); -- cgit v1.2.3 From 4c44e797d8b1b84b29294d09fc6f43b5e33dd6f0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 13:44:14 +0100 Subject: HOPKINS: Fix speech in intro for BeOS and OS/2 versions. Thanks Eriktorbjorn for the help --- engines/hopkins/sound.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 3894e7f67a..f80081be00 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -497,8 +497,17 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { else if (voiceMode == 5) prefix = "OF"; + // BeOS and OS/2 versions are using a slightly different speech order during intro + // This map those values to the oens used by the Win95 and Linux versions + int mappedFileNumber = fileNumber; + if (voiceMode == 3 && (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)) { + if (fileNumber == 4) + mappedFileNumber = 0; + else if (fileNumber > 4) + mappedFileNumber = fileNumber - 1; + } - filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); + filename = Common::String::format("%s%d", prefix.c_str(), mappedFileNumber); if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) -- cgit v1.2.3 From 568e64541774715f56a974cc74d5060067283cc0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 17:47:35 +0100 Subject: HOPKINS: Refactor playIntro --- engines/hopkins/hopkins.cpp | 354 +++++++++++++++++++++----------------------- engines/hopkins/sound.cpp | 2 +- 2 files changed, 172 insertions(+), 184 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index e41ef1c533..d0fed7810f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1732,218 +1732,206 @@ void HopkinsEngine::playIntro() { _soundManager.WSOUND(16); _animationManager._clearAnimationFl = true; _animationManager.playAnim("J1.anm", 12, 12, 50); - if (!_eventsManager._escKeyFl) { - _soundManager.mixVoice(1, 3); - _animationManager.playAnim("J2.anm", 12, 12, 50); + if (shouldQuit() || _eventsManager._escKeyFl) + return; - if (!_eventsManager._escKeyFl) { - _soundManager.mixVoice(2, 3); - _animationManager.playAnim("J3.anm", 12, 12, 50); + _soundManager.mixVoice(1, 3); + _animationManager.playAnim("J2.anm", 12, 12, 50); - if (!_eventsManager._escKeyFl) { - _soundManager.mixVoice(3, 3); - _graphicsManager.lockScreen(); - _graphicsManager.clearScreen(); - _graphicsManager.unlockScreen(); - _graphicsManager.clearPalette(); - _graphicsManager.DD_VBL(); - _soundManager.WSOUND(11); - _graphicsManager.loadImage("intro1"); - _graphicsManager.scrollScreen(0); - _graphicsManager._scrollOffset = 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); - for (int i = 0; i <= 4; i++) - _eventsManager.VBL(); + if (shouldQuit() || _eventsManager._escKeyFl) + return; - _globals.iRegul = 1; - _graphicsManager.fadeInLong(); - if (_graphicsManager._largeScreenFl) { - _graphicsManager._scrollStatus = 2; - bool v3 = false; - _graphicsManager._scrollPosX = 0; + _soundManager.mixVoice(2, 3); + _animationManager.playAnim("J3.anm", 12, 12, 50); - do { - _graphicsManager._scrollPosX += 2; - if (_graphicsManager._scrollPosX > (SCREEN_WIDTH - 2)) { - _graphicsManager._scrollPosX = SCREEN_WIDTH; - v3 = true; - } + if (shouldQuit() || _eventsManager._escKeyFl) + return; - if (_eventsManager.getMouseX() < _graphicsManager._scrollPosX + 10) - _eventsManager.setMouseXY(_eventsManager._mousePos.x + 4, _eventsManager.getMouseY()); - _eventsManager.VBL(); - } while (!shouldQuit() && !v3 && _graphicsManager._scrollPosX != SCREEN_WIDTH); + _soundManager.mixVoice(3, 3); + _graphicsManager.lockScreen(); + _graphicsManager.clearScreen(); + _graphicsManager.unlockScreen(); + _graphicsManager.clearPalette(); + _graphicsManager.DD_VBL(); + _soundManager.WSOUND(11); + _graphicsManager.loadImage("intro1"); + _graphicsManager.scrollScreen(0); + _graphicsManager._scrollOffset = 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); + for (int i = 0; i <= 4; i++) + _eventsManager.VBL(); - _eventsManager.VBL(); - _graphicsManager._scrollStatus = 0; + _globals.iRegul = 1; + _graphicsManager.fadeInLong(); + if (_graphicsManager._largeScreenFl) { + _graphicsManager._scrollStatus = 2; + _graphicsManager._scrollPosX = 0; + + bool loopCond = false; + do { + _graphicsManager._scrollPosX += 2; + if (_graphicsManager._scrollPosX > (SCREEN_WIDTH - 2)) { + _graphicsManager._scrollPosX = SCREEN_WIDTH; + loopCond = true; + } - if (shouldQuit()) - return; - } + if (_eventsManager.getMouseX() < _graphicsManager._scrollPosX + 10) + _eventsManager.setMouseXY(_eventsManager._mousePos.x + 4, _eventsManager.getMouseY()); + _eventsManager.VBL(); + } while (!shouldQuit() && !loopCond && _graphicsManager._scrollPosX != SCREEN_WIDTH); - _soundManager.mixVoice(4, 3); - _graphicsManager.fadeOutLong(); - _graphicsManager._scrollStatus = 0; - _graphicsManager.loadImage("intro2"); - _graphicsManager.scrollScreen(0); - _animationManager.loadAnim("INTRO2"); - _graphicsManager.VISU_ALL(); - _soundManager.WSOUND(23); - _objectsManager.stopBobAnimation(3); - _objectsManager.stopBobAnimation(5); - _graphicsManager._scrollOffset = 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); - - for (int i = 0; i <= 4; i++) - _eventsManager.VBL(); + _eventsManager.VBL(); + _graphicsManager._scrollStatus = 0; - _globals.iRegul = 1; - _graphicsManager.fadeInLong(); - for (uint i = 0; i < 200 / _globals._speed; ++i) - _eventsManager.VBL(); + if (shouldQuit()) + return; + } - _objectsManager.setBobAnimation(3); - _soundManager.mixVoice(5, 3); - _objectsManager.stopBobAnimation(3); - _eventsManager.VBL(); - memcpy(&paletteData2, _graphicsManager._palette, 796); + _soundManager.mixVoice(4, 3); + _graphicsManager.fadeOutLong(); + _graphicsManager._scrollStatus = 0; + _graphicsManager.loadImage("intro2"); + _graphicsManager.scrollScreen(0); + _animationManager.loadAnim("INTRO2"); + _graphicsManager.VISU_ALL(); + _soundManager.WSOUND(23); + _objectsManager.stopBobAnimation(3); + _objectsManager.stopBobAnimation(5); + _graphicsManager._scrollOffset = 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); + + for (int i = 0; i <= 4; i++) + _eventsManager.VBL(); + + _globals.iRegul = 1; + _graphicsManager.fadeInLong(); + for (uint i = 0; i < 200 / _globals._speed; ++i) + _eventsManager.VBL(); - _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); - _graphicsManager.FIN_VISU(); + _objectsManager.setBobAnimation(3); + _soundManager.mixVoice(5, 3); + _objectsManager.stopBobAnimation(3); + _eventsManager.VBL(); + memcpy(&paletteData2, _graphicsManager._palette, 796); - if (shouldQuit()) - return; + _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); + _graphicsManager.FIN_VISU(); - _soundManager._specialSoundNum = 5; - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("ELEC.ANM", 10, 26, 200); - if (shouldQuit()) - return; + if (shouldQuit() || _eventsManager._escKeyFl) + return; - _soundManager._specialSoundNum = 0; + _soundManager._specialSoundNum = 5; + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("ELEC.ANM", 10, 26, 200); + _soundManager._specialSoundNum = 0; - if (!_eventsManager._escKeyFl) { - _graphicsManager.loadImage("intro2"); - _graphicsManager.scrollScreen(0); - _animationManager.loadAnim("INTRO2"); - _graphicsManager.VISU_ALL(); - _soundManager.WSOUND(23); - _objectsManager.stopBobAnimation(3); - _objectsManager.stopBobAnimation(5); - _objectsManager.stopBobAnimation(1); - _graphicsManager._scrollOffset = 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); - - for (int i = 0; i <= 3; i++) - _eventsManager.VBL(); + if (shouldQuit() || _eventsManager._escKeyFl) + return; - _globals.iRegul = 1; - _graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer); - - int v9 = 0; - while (!shouldQuit() && !_eventsManager._escKeyFl) { - if (v9 == 12) { - _objectsManager.setBobAnimation(3); - _eventsManager.VBL(); - _soundManager.mixVoice(6, 3); - _eventsManager.VBL(); - _objectsManager.stopBobAnimation(3); - } + _graphicsManager.loadImage("intro2"); + _graphicsManager.scrollScreen(0); + _animationManager.loadAnim("INTRO2"); + _graphicsManager.VISU_ALL(); + _soundManager.WSOUND(23); + _objectsManager.stopBobAnimation(3); + _objectsManager.stopBobAnimation(5); + _objectsManager.stopBobAnimation(1); + _graphicsManager._scrollOffset = 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); - Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); + for (int i = 0; i <= 3; i++) + _eventsManager.VBL(); + _globals.iRegul = 1; + _graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer); + int introIndex = 0; + while (!shouldQuit() && !_eventsManager._escKeyFl) { + if (introIndex == 12) { + _objectsManager.setBobAnimation(3); + _eventsManager.VBL(); + _soundManager.mixVoice(6, 3); + _eventsManager.VBL(); + _objectsManager.stopBobAnimation(3); + } - for (int i = 1, v12 = 4 * v9; i <= PALETTE_BLOCK_SIZE; i++) { - if (_graphicsManager._palette[i] > v12) - _graphicsManager._palette[i] -= v12; - } + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); - _graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer); + for (int i = 1, v12 = 4 * introIndex; i <= PALETTE_BLOCK_SIZE; i++) { + if (_graphicsManager._palette[i] > v12) + _graphicsManager._palette[i] -= v12; + } + _graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer); - if (2 * v9 > 1) { - for (int i = 1; i < 2 * v9; i++) - _eventsManager.VBL(); - } + for (int i = 1; i < 2 * introIndex; i++) + _eventsManager.VBL(); - _graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer); - if (20 - v9 > 1) { - for (int i = 1; i < 20 - v9; i++) - _eventsManager.VBL(); - } + _graphicsManager.setPaletteVGA256WithRefresh(paletteData2, _graphicsManager._vesaBuffer); - v9 += 2; - if (v9 > 15) { - _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); - for (uint j = 1; j < 100 / _globals._speed; ++j) - _eventsManager.VBL(); - - _objectsManager.setBobAnimation(3); - _soundManager.mixVoice(7, 3); - _objectsManager.stopBobAnimation(3); - - for (uint k = 1; k < 60 / _globals._speed; ++k) - _eventsManager.VBL(); - _objectsManager.setBobAnimation(5); - for (uint l = 0; l < 20 / _globals._speed; ++l) - _eventsManager.VBL(); - - Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); - _graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer); - - for (uint m = 0; m < 50 / _globals._speed; ++m) { - if (m == 30 / _globals._speed) { - _objectsManager.setBobAnimation(3); - _soundManager.mixVoice(8, 3); - _objectsManager.stopBobAnimation(3); - } + for (int i = 1; i < 20 - introIndex; i++) + _eventsManager.VBL(); - _eventsManager.VBL(); - } + introIndex += 2; + if (introIndex > 15) { + _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); + for (uint j = 1; j < 100 / _globals._speed; ++j) + _eventsManager.VBL(); - _graphicsManager.fadeOutLong(); - _graphicsManager.FIN_VISU(); - _animationManager._clearAnimationFl = true; - _soundManager.WSOUND(3); - _soundManager._specialSoundNum = 1; - _animationManager.playAnim("INTRO1.anm", 10, 24, 18); - if (shouldQuit()) - return; - - _soundManager._specialSoundNum = 0; - - if (!_eventsManager._escKeyFl) { - _animationManager.playAnim("INTRO2.anm", 10, 24, 18); - if (shouldQuit()) - return; - - if (!_eventsManager._escKeyFl) { - _animationManager.playAnim("INTRO3.anm", 10, 24, 200); - if (shouldQuit()) - return; - - if (!_eventsManager._escKeyFl) { - _animationManager._clearAnimationFl = false; - _graphicsManager.FADE_LINUX = 2; - _animationManager.playAnim("J4.anm", 12, 12, 1000); - } - } - } - break; - } - } + _objectsManager.setBobAnimation(3); + _soundManager.mixVoice(7, 3); + _objectsManager.stopBobAnimation(3); + + for (uint k = 1; k < 60 / _globals._speed; ++k) + _eventsManager.VBL(); + _objectsManager.setBobAnimation(5); + for (uint l = 0; l < 20 / _globals._speed; ++l) + _eventsManager.VBL(); + + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager._palette[0]); + _graphicsManager.setPaletteVGA256WithRefresh(_graphicsManager._palette, _graphicsManager._vesaBuffer); + + for (uint m = 0; m < 50 / _globals._speed; ++m) { + if (m == 30 / _globals._speed) { + _objectsManager.setBobAnimation(3); + _soundManager.mixVoice(8, 3); + _objectsManager.stopBobAnimation(3); } + + _eventsManager.VBL(); } + + _graphicsManager.fadeOutLong(); + _graphicsManager.FIN_VISU(); + _animationManager._clearAnimationFl = true; + _soundManager.WSOUND(3); + _soundManager._specialSoundNum = 1; + _animationManager.playAnim("INTRO1.anm", 10, 24, 18); + _soundManager._specialSoundNum = 0; + if (shouldQuit() || _eventsManager._escKeyFl) + return; + + _animationManager.playAnim("INTRO2.anm", 10, 24, 18); + if (shouldQuit() || _eventsManager._escKeyFl) + return; + + _animationManager.playAnim("INTRO3.anm", 10, 24, 200); + if (shouldQuit() || _eventsManager._escKeyFl) + return; + + _animationManager._clearAnimationFl = false; + _graphicsManager.FADE_LINUX = 2; + _animationManager.playAnim("J4.anm", 12, 12, 1000); + break; } } diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index f80081be00..94e846e802 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -498,7 +498,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { prefix = "OF"; // BeOS and OS/2 versions are using a slightly different speech order during intro - // This map those values to the oens used by the Win95 and Linux versions + // This map those values to the ones used by the Win95 and Linux versions int mappedFileNumber = fileNumber; if (voiceMode == 3 && (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)) { if (fileNumber == 4) -- cgit v1.2.3 From d92f85f0e1f3fb2ea29cf5fd8827ae75ac2d0f96 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 19:12:45 +0100 Subject: HOPKINS: Some more renaming and refactoring --- engines/hopkins/events.h | 2 +- engines/hopkins/font.cpp | 57 +++++++++++++++++++++------------------------ engines/hopkins/font.h | 3 +-- engines/hopkins/hopkins.cpp | 4 ++-- engines/hopkins/sound.cpp | 6 ++--- engines/hopkins/sound.h | 2 +- 6 files changed, 35 insertions(+), 39 deletions(-) diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 8aa9a862d3..28a4a9a2de 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -81,7 +81,7 @@ public: void mouseOff(); void changeMouseCursor(int id); void refreshEvents(); - void delay(int delay); + void delay(int totalMilli); int waitKeyPress(); void VBL(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 492bde5ebd..bae47957dc 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -111,8 +111,7 @@ void FontManager::setOptimalColor(int idx1, int idx2, int idx3, int idx4) { * Init text structure */ void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color) { - if ((idx - 5) > MAX_TEXT) - error("Attempted to display text > MAX_TEXT."); + assert(idx - 5 >= 0 && (idx - 5) <= MAX_TEXT); TxtItem &txt = _text[idx - 5]; txt._textOnFl = false; @@ -121,7 +120,7 @@ void FontManager::initTextBuffers(int idx, int messageId, const Common::String & txt._pos.y = yp; txt._messageId = messageId; txt._textType = textType; - txt._field3FE = a9; + txt._length = a9; txt._color = color; } @@ -138,7 +137,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in error("Bad number for text"); _vm->_globals.police_l = 11; - _vm->_globals._boxWidth = 11 * _text[idx]._field3FE; + _vm->_globals._boxWidth = 11 * _text[idx]._length; if (_text[idx]._textLoadedFl) { int textType = _text[idx]._textType; if (textType != 6 && textType != 1 && textType != 3 && textType != 5) { @@ -179,7 +178,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _index[i] = f.readUint32LE(); f.close(); } - int v11, v69; + int v69; if (filename[0] != 'Z' || filename[1] != 'O') { if (!f.open(file)) error("Error opening file - %s", _indexName.c_str()); @@ -202,11 +201,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _tempText = v9; const byte *v10 = _vm->_globals.BUF_ZONE + _index[messageId]; memcpy(v9, v10, 96); - v11 = 0; WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } byte *v59 = _tempText; - byte *v60; if (!v69) goto LABEL_43; for (int v63 = 0; v63 < v69; v63++) { @@ -225,25 +222,24 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in v59++; }; - v60 = _tempText; if (v69) { - int v64 = 0; + int textLength = 0; for (;;) { - byte v14 = v60[v64]; - if (v14 == '\r' || v14 == '\n') { - v60[v64] = 0; - if (!_text[idx]._field3FE) + byte curChar = _tempText[textLength]; + if (curChar == '\r' || curChar == '\n') { + _tempText[textLength] = 0; + if (!_text[idx]._length) break; } - ++v64; - if (v69 <= v64) + ++textLength; + if (v69 <= textLength) goto LABEL_43; } - _text[idx]._field3FE = v64; + _text[idx]._length = textLength; _vm->_globals._boxWidth = 0; - for (int v15 = 0; v15 < v64 + 1; v15++) { - byte v16 = v60[v15]; + for (int v15 = 0; v15 < textLength + 1; v15++) { + byte v16 = _tempText[v15]; if (v16 <= 31) v16 = ' '; _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); @@ -256,37 +252,38 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._pos.x = 320 - v17; v73 = _vm->_eventsManager._startPos.x + 320 - v17; lineCount = 1; - if (v64 + 1 > 0) { - _text[idx]._lines[0] = Common::String((const char *)v60, v64); + // CHECKME: textLength should be always positive... + if (textLength + 1 > 0) { + _text[idx]._lines[0] = Common::String((const char *)_tempText, textLength); } } else { LABEL_43: if (!_vm->_globals._boxWidth) _vm->_globals._boxWidth = 240; int v65 = 0; - byte *v61 = _tempText; int lineSize; + byte curChar; do { int v19 = 0; int ptrb = _vm->_globals._boxWidth - 4; for (;;) { lineSize = v19; do - v11 = v61[v65 + v19++]; - while (v11 != ' ' && v11 != '%'); + curChar = _tempText[v65 + v19++]; + while (curChar != ' ' && curChar != '%'); if (v19 >= ptrb / _vm->_globals.police_l) break; - if (v11 == '%') { + if (curChar == '%') { if (v19 < ptrb / _vm->_globals.police_l) goto LABEL_55; break; } } - if (v11 != '%') + if (curChar != '%') goto LABEL_57; - v11 = ' '; + curChar = ' '; LABEL_55: - if (v11 == '%') + if (curChar == '%') lineSize = v19; LABEL_57: int v20 = lineCount; @@ -295,14 +292,14 @@ LABEL_57: // actual length of the line to be copied will be. Otherwise, you can see artifacts, // such as a single character beyond the end of string NULL. int actualSize = 0; - while (actualSize < lineSize && v61[v65 + actualSize]) + while (actualSize < lineSize && _tempText[v65 + actualSize]) ++actualSize; - _text[idx]._lines[v20] = Common::String((const char *)v61 + v65, actualSize); + _text[idx]._lines[v20] = Common::String((const char *)_tempText + v65, actualSize); _textSortArray[lineCount++] = lineSize; v65 += lineSize; - } while (v11 != '%'); + } while (curChar != '%'); for (int i = 0; i <= 19; i++) { if (_textSortArray[i] <= 0) { diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index d9debdee44..10466ba529 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -35,14 +35,13 @@ class HopkinsEngine; struct TxtItem { bool _textOnFl; -// int _field2; // Unused variable Common::String _filename; Common::Point _pos; int _messageId; int _lineCount; Common::String _lines[10]; int _textType; - int _field3FE; + int _length; byte *_textBlock; int16 _width; int16 _height; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d0fed7810f..a64398fdc5 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2247,7 +2247,7 @@ void HopkinsEngine::playEnding() { _objectsManager.stopBobAnimation(7); if (_globals._saveData->data[svField135] == 1) { _soundManager._specialSoundNum = 200; - _soundManager.VBL_MERDE = true; + _soundManager.skipRefreshFl = true; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BERM.ANM", 100, 24, 300); _graphicsManager.FIN_VISU(); @@ -2284,7 +2284,7 @@ void HopkinsEngine::playEnding() { _globals._disableInventFl = false; } else { _soundManager._specialSoundNum = 200; - _soundManager.VBL_MERDE = true; + _soundManager.skipRefreshFl = true; _animationManager.playAnim2("BERM.ANM", 100, 24, 300); _objectsManager.stopBobAnimation(7); _objectsManager.setBobAnimation(8); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 94e846e802..28b5080b33 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -197,7 +197,7 @@ SoundManager::SoundManager() { _voiceOffFl = true; _textOffFl = false; _soundFl = false; - VBL_MERDE = false; + skipRefreshFl = false; _currentSoundIndex = 0; _oldSoundNumber = 0; _modPlayingFl = false; @@ -572,7 +572,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { // Loop for playing voice breakFlag = 0; do { - if (_specialSoundNum != 4 && !VBL_MERDE) + if (_specialSoundNum != 4 && !skipRefreshFl) _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) break; @@ -588,7 +588,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { DEL_SAMPLE_SDL(20); _musicVolume = oldMusicVol; _vm->_eventsManager._escKeyFl = false; - VBL_MERDE = 0; + skipRefreshFl = false; return true; } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index df66898232..622e842d5d 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -95,7 +95,7 @@ public: bool _voiceOffFl; bool _textOffFl; bool _soundFl; - bool VBL_MERDE; + bool skipRefreshFl; int _currentSoundIndex; bool _modPlayingFl; int _oldSoundNumber; -- cgit v1.2.3 From 2c69135c99e088957306675431c34bdf0c3dbde3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 20:49:08 +0100 Subject: HOPKINS: Get rid of GOTOs in FontManager --- engines/hopkins/font.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index bae47957dc..e7d100b380 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -204,8 +204,6 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); } byte *v59 = _tempText; - if (!v69) - goto LABEL_43; for (int v63 = 0; v63 < v69; v63++) { byte v13 = *v59; if ((byte)(*v59 + 46) > 27) { @@ -222,8 +220,8 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in v59++; }; + int textLength = 0; if (v69) { - int textLength = 0; for (;;) { byte curChar = _tempText[textLength]; if (curChar == '\r' || curChar == '\n') { @@ -233,8 +231,11 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } ++textLength; if (v69 <= textLength) - goto LABEL_43; + break; } + } + + if (v69 && v69 > textLength) { _text[idx]._length = textLength; _vm->_globals._boxWidth = 0; @@ -257,7 +258,6 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._lines[0] = Common::String((const char *)_tempText, textLength); } } else { -LABEL_43: if (!_vm->_globals._boxWidth) _vm->_globals._boxWidth = 240; int v65 = 0; @@ -271,21 +271,16 @@ LABEL_43: do curChar = _tempText[v65 + v19++]; while (curChar != ' ' && curChar != '%'); - if (v19 >= ptrb / _vm->_globals.police_l) + if (v19 >= ptrb / _vm->_globals.police_l) { + if (curChar == '%') + curChar = ' '; break; + } if (curChar == '%') { - if (v19 < ptrb / _vm->_globals.police_l) - goto LABEL_55; + lineSize = v19; break; } } - if (curChar != '%') - goto LABEL_57; - curChar = ' '; -LABEL_55: - if (curChar == '%') - lineSize = v19; -LABEL_57: int v20 = lineCount; // WORKAROUND: Perhaps due to the usage of ScummVM strings here, recalculate what the -- cgit v1.2.3 From f9b4fe09dad0cbf94e08a39aaff3e27b020d8a6b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 22:46:00 +0100 Subject: HOPKINS: Fix regression introduced in 5678fbd3212f3d758863ec2338066797718b8f88: Glitch while speaking. Thanks to eriktorbjorn for noticing and bisecting the problem --- engines/hopkins/objects.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2ddf24c75c..d94f838422 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1016,9 +1016,9 @@ void ObjectsManager::displayBobAnim() { } while (idx != 35); if (!PERSO_ON && BOBTOUS) { - for (int v26 = 0; v26 != 35; v26++) { - if (_vm->_globals._bob[v26].field0 == 10 && !_vm->_globals._bob[v26]._disabledAnimationFl) - _vm->_globals._bob[v26].field1C = true; + for (int i = 0; i < 35; i++) { + if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl) + _vm->_globals._bob[i].field1C = true; } } @@ -1056,7 +1056,7 @@ void ObjectsManager::displayBobAnim() { } } - for (int i = 1; i < 25; i++) { + for (int i = 1; i < 35; i++) { _vm->_globals._bob[i]._oldY = 0; if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl && _vm->_globals._bob[i].field1C) { CALCUL_BOB(i); -- cgit v1.2.3 From 7b063288d65402a2ecbaf2c4dd5bf89d29cfaa66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 23:36:58 +0100 Subject: HOPKINS: Fix error in PARADISE (field16 vs field10), rename some fields --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 4 +--- engines/hopkins/objects.cpp | 31 +++++++++++++++---------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 71f1c8711c..543fe26ac2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -314,7 +314,7 @@ void Globals::clearAll() { for (int idx = 0; idx < 105; ++idx) { ZONEP[idx]._destX = 0; ZONEP[idx]._destY = 0; - ZONEP[idx].field4 = 0; + ZONEP[idx]._spriteIndex = 0; } essai0 = (int16 *)g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index b1c7218985..6ba269d9d5 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -32,7 +32,7 @@ namespace Hopkins { struct ZonePItem { int _destX; int _destY; - int field4; + int _spriteIndex; int field6; int field7; int field8; @@ -45,7 +45,6 @@ struct ZonePItem { int fieldF; int field10; int field12; - int field16; }; struct CarreZoneItem { @@ -105,7 +104,6 @@ struct BobItem { int field20; int field22; int _offsetY; // Unused variable? - byte *field30; bool field34; // Set to true in B_CACHE_OFF() int field36; int _modeFlag; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d94f838422..39572179fe 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -490,7 +490,6 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field20 = 0; bob.field22 = 0; bob._offsetY = 0; - bob.field30 = g_PTRNUL; bob.field34 = false; bob.field36 = 0; bob._modeFlag = 0; @@ -1489,13 +1488,13 @@ void ObjectsManager::GOHOME() { _vm->_globals._oldDirection = -1; if (v54 > 0) { if (_vm->_globals.ZONEP[v54]._destX && _vm->_globals.ZONEP[v54]._destY && _vm->_globals.ZONEP[v54]._destY != 31) { - if (_vm->_globals.ZONEP[v54].field4 == -1) { + if (_vm->_globals.ZONEP[v54]._spriteIndex == -1) { _vm->_globals.ZONEP[v54]._destX = 0; _vm->_globals.ZONEP[v54]._destY = 0; - _vm->_globals.ZONEP[v54].field4 = 0; + _vm->_globals.ZONEP[v54]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[v54].field4); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v54].field4 - 59; + setSpriteIndex(0, _vm->_globals.ZONEP[v54]._spriteIndex); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v54]._spriteIndex - 59; } } } @@ -1769,13 +1768,13 @@ void ObjectsManager::GOHOME() { if (v49 > 0) { if (_vm->_globals.ZONEP[v49]._destX && _vm->_globals.ZONEP[v49]._destY && _vm->_globals.ZONEP[v49]._destY != 31) { - if ( _vm->_globals.ZONEP[v49].field4 == -1) { + if ( _vm->_globals.ZONEP[v49]._spriteIndex == -1) { _vm->_globals.ZONEP[v49]._destX = 0; _vm->_globals.ZONEP[v49]._destY = 0; - _vm->_globals.ZONEP[v49].field4 = 0; + _vm->_globals.ZONEP[v49]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[v49].field4); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v49].field4 - 59; + setSpriteIndex(0, _vm->_globals.ZONEP[v49]._spriteIndex); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[v49]._spriteIndex - 59; } } } @@ -1911,7 +1910,7 @@ void ObjectsManager::loadZone(const Common::String &file) { for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; - _vm->_globals.ZONEP[i].field4 = 0; + _vm->_globals.ZONEP[i]._spriteIndex = 0; _vm->_globals.ZONEP[i].field6 = 0; _vm->_globals.ZONEP[i].field7 = 0; _vm->_globals.ZONEP[i].field8 = 0; @@ -1955,7 +1954,7 @@ void ObjectsManager::loadZone(const Common::String &file) { // CHECKME: Shouldn't it be a byte? _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); - _vm->_globals.ZONEP[i].field4 = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); + _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); v4 += 3; } @@ -2342,7 +2341,7 @@ void ObjectsManager::PARADISE() { _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); - if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum].field16) { + if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum].field10) { _zoneNum = -1; _forceZoneFl = true; } @@ -3021,14 +3020,14 @@ int ObjectsManager::MZONE() { !_vm->_globals._bob[v2]._disabledAnimationFl && xp > _vm->_globals._bob[v2]._oldX && xp < _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX && yp > _vm->_globals._bob[v2]._oldY) { if (yp < _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY) { - if (_vm->_globals.ZONEP[v1].field4 == -1) { + if (_vm->_globals.ZONEP[v1]._spriteIndex == -1) { _vm->_globals.ZONEP[v1]._destX = 0; _vm->_globals.ZONEP[v1]._destY = 0; } if (!_vm->_globals.ZONEP[v1]._destX && !_vm->_globals.ZONEP[v1]._destY) { _vm->_globals.ZONEP[v1]._destX = _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX; _vm->_globals.ZONEP[v1]._destY = _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY + 6; - _vm->_globals.ZONEP[v1].field4 = -1; + _vm->_globals.ZONEP[v1]._spriteIndex = -1; } return v1; } @@ -3830,7 +3829,7 @@ void ObjectsManager::INILINK(const Common::String &file) { for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; - _vm->_globals.ZONEP[i].field4 = 0; + _vm->_globals.ZONEP[i]._spriteIndex = 0; _vm->_globals.ZONEP[i].field6 = 0; _vm->_globals.ZONEP[i].field7 = 0; _vm->_globals.ZONEP[i].field8 = 0; @@ -3864,7 +3863,7 @@ void ObjectsManager::INILINK(const Common::String &file) { for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); - _vm->_globals.ZONEP[i].field4 = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); + _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); v33 += 3; } -- cgit v1.2.3 From daa6c887ef73a032c2a203a9b3475a43395db221 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Jan 2013 00:06:50 +0100 Subject: HOPKINS: Remove useless fields in ObjectsManager, some renaming --- engines/hopkins/globals.h | 4 +-- engines/hopkins/objects.cpp | 82 ++++++++++++++++----------------------------- engines/hopkins/objects.h | 12 ++----- engines/hopkins/script.cpp | 2 +- 4 files changed, 34 insertions(+), 66 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 6ba269d9d5..d8f5de894a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -43,7 +43,7 @@ struct ZonePItem { int fieldD; int fieldE; int fieldF; - int field10; + bool _enabledFl; int field12; }; @@ -55,7 +55,7 @@ struct CarreZoneItem { int field8; int fieldA; int fieldC; - int fieldE; + bool fieldE; }; struct BqeAnimItem { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 39572179fe..878d71f7ff 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -319,7 +319,7 @@ void ObjectsManager::displaySprite() { if (_sprite[idx]._animationType == 1) { computeSprite(idx); if (_sprite[idx].field2A) - beforeSort(SORT_SPRITE, idx, _sprite[idx]._height + _sprite[idx].destY); + beforeSort(SORT_SPRITE, idx, _sprite[idx]._height + _sprite[idx]._destY); } } @@ -480,7 +480,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._xp = 0; bob._yp = 0; bob._frameIndex = 0; - bob.field10 = 0; + bob.field10 = false; bob.field12 = 0; bob.field14 = 0; bob._disabledAnimationFl = false; @@ -726,16 +726,16 @@ void ObjectsManager::checkCache() { int oldFieldA = _vm->_globals.Cache[cacheIdx].fieldA; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { - int right = _sprite[spriteIdx]._width + _sprite[spriteIdx].destX; - int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx].destY; + int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; + int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx]._destY; int cachedRight = _vm->_globals.Cache[cacheIdx]._width + _vm->_globals.Cache[cacheIdx]._x; if (bottom > _vm->_globals.Cache[cacheIdx]._y && bottom < (_vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y)) { if ((right >= _vm->_globals.Cache[cacheIdx]._x && right <= cachedRight) - || (cachedRight >= _sprite[spriteIdx].destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx].destX) - || (cachedRight >= _sprite[spriteIdx].destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx].destX) - || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx].destX && right <= cachedRight) - || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx].destX && right >= cachedRight)) + || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX) + || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX) + || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) + || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) ++_vm->_globals.Cache[cacheIdx].fieldA; } } @@ -765,10 +765,10 @@ void ObjectsManager::DEF_SPRITE(int idx) { if (_sprite[idx]._rleFl) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx].destX + 300, _sprite[idx].destY + 300, _sprite[idx]._spriteIndex); + _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx].destX + 300, _sprite[idx].destY + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); + _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); _vm->_globals.Liste[idx]._width = _sprite[idx]._width; _vm->_globals.Liste[idx]._height = _sprite[idx]._height; @@ -865,8 +865,8 @@ void ObjectsManager::computeSprite(int idx) { int v15 = _sprite[idx]._spritePos.x - deltaX; int v16 = _sprite[idx]._spritePos.y - deltaY; - _sprite[idx].destX = v15; - _sprite[idx].destY = v16; + _sprite[idx]._destX = v15; + _sprite[idx]._destY = v16; _sprite[idx].field2A = true; _sprite[idx]._zoomPct = zoomPercent; _sprite[idx]._reducePct = reducePercent; @@ -1195,7 +1195,6 @@ int ObjectsManager::getSpriteY(int idx) { */ void ObjectsManager::clearSprite() { for (int idx = 0; idx < MAX_SPRITE; idx++) { - _sprite[idx].field1C = g_PTRNUL; _sprite[idx]._spriteData = g_PTRNUL; _sprite[idx]._animationType = 0; } @@ -1224,11 +1223,6 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, _sprite[idx].fieldE = a7; _sprite[idx].field12 = a8; _sprite[idx].field14 = a9; - _sprite[idx].field1C = g_PTRNUL; - _sprite[idx].field20 = 0; - _sprite[idx].field24 = 0; - _sprite[idx].field26 = 0; - _sprite[idx].field22 = 0; _sprite[idx]._animationType = 0; if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { @@ -1240,32 +1234,12 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, } -void ObjectsManager::addAnimatedSprite(const byte *spriteData, int idx, byte *a3, int a4, int a5) { - assert (idx <= MAX_SPRITE); - _sprite[idx]._spriteData = spriteData; - _sprite[idx].field1C = a3; - _sprite[idx].field20 = a4; - _sprite[idx].field24 = 0; - _sprite[idx].field26 = 0; - _sprite[idx].fieldC = 0; - _sprite[idx].fieldE = 0; - _sprite[idx]._animationType = 1; - _sprite[idx].field22 = 0; - _sprite[idx].field14 = a5; - - if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') - _sprite[idx]._rleFl = true; - else - _sprite[idx]._rleFl = false; -} - /** * Freeze sprite animation and free its memory */ void ObjectsManager::removeSprite(int idx) { // Type 3 was also used by freeSprite(), which has been removed as it wasn't used _sprite[idx]._animationType = 3; - _sprite[idx].field1C = _vm->_globals.freeMemory(_sprite[idx].field1C); } /** @@ -1922,7 +1896,7 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_globals.ZONEP[i].fieldE = 0; _vm->_globals.ZONEP[i].fieldF = 0; _vm->_globals.ZONEP[i].field12 = 0; - _vm->_globals.ZONEP[i].field10 = 0; + _vm->_globals.ZONEP[i]._enabledFl = false; } Common::File f; @@ -1943,7 +1917,7 @@ void ObjectsManager::loadZone(const Common::String &file) { READ_LE_UINT16((uint16 *)ptr + v4 + 3), READ_LE_UINT16((uint16 *)ptr + v4 + 4), bobZoneIdx); - _vm->_globals.ZONEP[bobZoneIdx].field10 = 1; + _vm->_globals.ZONEP[bobZoneIdx]._enabledFl = true; } v4 += 5; ++v18; @@ -1994,7 +1968,7 @@ void ObjectsManager::CARRE_ZONE() { for (int idx = 0; idx < 100; ++idx) { _vm->_globals.CarreZone[idx].field0 = 0; - _vm->_globals.CarreZone[idx].fieldE = 0; + _vm->_globals.CarreZone[idx].fieldE = false; _vm->_globals.CarreZone[idx].field2 = 1280; _vm->_globals.CarreZone[idx].field4 = 0; _vm->_globals.CarreZone[idx].field6 = 460; @@ -2040,7 +2014,7 @@ void ObjectsManager::CARRE_ZONE() { if (v14 < 0) v14 = -v14; if (v10 == v14) - _vm->_globals.CarreZone[v7].fieldE = 1; + _vm->_globals.CarreZone[v7].fieldE = true; } } @@ -2341,7 +2315,7 @@ void ObjectsManager::PARADISE() { _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); - if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum].field10) { + if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum]._enabledFl) { _zoneNum = -1; _forceZoneFl = true; } @@ -3035,12 +3009,12 @@ int ObjectsManager::MZONE() { } _vm->_globals.SegmentEnCours = 0; for (int v7 = 0; v7 <= 99; v7++) { - if (_vm->_globals.ZONEP[v7].field10 == 1 && _vm->_globals.CarreZone[v7].field0 == 1 + if (_vm->_globals.ZONEP[v7]._enabledFl && _vm->_globals.CarreZone[v7].field0 == 1 && _vm->_globals.CarreZone[v7].field2 <= xp && _vm->_globals.CarreZone[v7].field4 >= xp && _vm->_globals.CarreZone[v7].field6 <= yp && _vm->_globals.CarreZone[v7].field8 >= yp) { - if (_vm->_globals.CarreZone[v7].fieldE == 1) { + if (_vm->_globals.CarreZone[v7].fieldE) { _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7].fieldA].field2; return _vm->_globals.oldzone_46; } @@ -3057,7 +3031,7 @@ int ObjectsManager::MZONE() { int colRes1 = 0; for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { colRes1 = colision(xp, yCurrent); - if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) + if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } @@ -3069,7 +3043,7 @@ int ObjectsManager::MZONE() { int colRes2 = 0; for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { colRes2 = colision(xp, j); - if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) + if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } @@ -3081,7 +3055,7 @@ int ObjectsManager::MZONE() { int colRes3 = 0; for (int k = xp; k >= 0; --k) { colRes3 = colision(k, yp); - if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) + if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } if (colRes3 == -1) { @@ -3092,7 +3066,7 @@ int ObjectsManager::MZONE() { int colRes4 = 0; for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { colRes4 = colision(xCurrent, yp); - if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) + if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) { @@ -3399,7 +3373,7 @@ void ObjectsManager::handleSpecialGames() { stopBobAnimation(6); SET_BOBPOSI(6, 0); setBobAnimation(7); - ZONE_ON(14); + enableZone(14); _vm->_globals._saveData->data[svField261] = 3; } _vm->_globals._disableInventFl = false; @@ -3627,11 +3601,11 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); } -void ObjectsManager::ZONE_ON(int idx) { +void ObjectsManager::enableZone(int idx) { if (_vm->_globals.BOBZONE[idx]) { _vm->_globals.BOBZONE_FLAG[idx] = true; } else { - _vm->_globals.ZONEP[idx].field10 = 1; + _vm->_globals.ZONEP[idx]._enabledFl = true; } } @@ -3639,7 +3613,7 @@ void ObjectsManager::disableZone(int idx) { if (_vm->_globals.BOBZONE[idx]) { _vm->_globals.BOBZONE_FLAG[idx] = false; } else { - _vm->_globals.ZONEP[idx].field10 = 0; + _vm->_globals.ZONEP[idx]._enabledFl = false; } } @@ -3854,7 +3828,7 @@ void ObjectsManager::INILINK(const Common::String &file) { (int16)READ_LE_UINT16(v17 + 2 * v33 + 6), (int16)READ_LE_UINT16(v17 + 2 * v33 + 8), v28); - _vm->_globals.ZONEP[v28].field10 = 1; + _vm->_globals.ZONEP[v28]._enabledFl = true; } v33 += 5; ++v35; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 384b7c70b2..347851f5dd 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -40,15 +40,10 @@ struct SpriteItem { int _spriteIndex; int field12; int field14; - byte *field1C; - int field20; - int field22; - int field24; - int field26; bool _rleFl; bool field2A; - int destX; - int destY; + int _destX; + int _destY; int _width; int _height; int _zoomPct; @@ -142,7 +137,6 @@ public: void clearSprite(); void animateSprite(int idx); void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); - void addAnimatedSprite(const byte *spriteData, int idx, byte *a3, int a4, int a5); void removeSprite(int idx); void setSpriteX(int idx, int xp); void setSpriteIndex(int idx, int spriteIndex); @@ -189,7 +183,7 @@ public: void Q_GAUCHE(int idx); void ACTION_GAUCHE(int idx); - void ZONE_ON(int idx); + void enableZone(int idx); void disableZone(int idx); void OPTI_ONE(int idx, int fromPosi, int destPosi, int a4); int BOBPOSI(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 58d6decb7b..44e95f2de5 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -463,7 +463,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } else if (dataP[2] == 'G' && dataP[3] == 'O' && dataP[4] == 'T') { opcodeType = 2; } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N') { - _vm->_objectsManager.ZONE_ON((int16)READ_LE_UINT16(dataP + 5)); + _vm->_objectsManager.enableZone((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') { _vm->_objectsManager.disableZone((int16)READ_LE_UINT16(dataP + 5)); -- cgit v1.2.3 From de2fa9a81f1fcbb16e222a0cae85e06cd2f44447 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Jan 2013 07:50:12 +0100 Subject: HOPKINS: Rename several structures --- engines/hopkins/anim.cpp | 34 +++----- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 33 +++---- engines/hopkins/objects.cpp | 207 ++++++++++++++++++++------------------------ 4 files changed, 124 insertions(+), 154 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a9932ab65b..d18c4fbd1c 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -535,8 +535,6 @@ void AnimationManager::clearAnim() { * Load Sprite Bank */ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { - byte *v13; - byte *v19; int result = 0; _vm->_globals.Bank[idx]._loadedFl = true; _vm->_globals.Bank[idx]._filename = filename; @@ -557,26 +555,22 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_globals.Bank[idx]._data = fileDataPtr; - int v8 = 0; + int objectDataIdx = 0; int width; int height; - for(;;) { - width = _vm->_objectsManager.getWidth(fileDataPtr, v8); - height = _vm->_objectsManager.getHeight(fileDataPtr, v8); + for(objectDataIdx = 0; objectDataIdx <= 249; objectDataIdx++) { + width = _vm->_objectsManager.getWidth(fileDataPtr, objectDataIdx); + height = _vm->_objectsManager.getHeight(fileDataPtr, objectDataIdx); if (!width && !height) break; - - ++v8; - if (v8 > 249) - break; } - if (v8 > 249) { + if (objectDataIdx > 249) { _vm->_globals.freeMemory(fileDataPtr); _vm->_globals.Bank[idx]._loadedFl = false; result = -2; } - _vm->_globals.Bank[idx].field1A = v8; + _vm->_globals.Bank[idx]._objDataIdx = objectDataIdx; Common::String ofsFilename = _vm->_globals.Bank[idx]._filename; char ch; @@ -588,20 +582,20 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { Common::File f; if (f.exists(ofsFilename)) { - v19 = _vm->_fileManager.loadFile(ofsFilename); - v13 = v19; - for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx].field1A; ++objIdx, v13 += 8) { - int x1 = (int16)READ_LE_UINT16(v13); - int y1 = (int16)READ_LE_UINT16(v13 + 2); - int x2 = (int16)READ_LE_UINT16(v13 + 4); - int y2 = (int16)READ_LE_UINT16(v13 + 6); + byte *ofsData = _vm->_fileManager.loadFile(ofsFilename); + byte *curOfsData = ofsData; + for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) { + int x1 = (int16)READ_LE_UINT16(curOfsData); + int y1 = (int16)READ_LE_UINT16(curOfsData + 2); + int x2 = (int16)READ_LE_UINT16(curOfsData + 4); + int y2 = (int16)READ_LE_UINT16(curOfsData + 6); _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); if (_vm->_globals.Bank[idx]._fileHeader == 2) _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x2, y2, 1); } - _vm->_globals.freeMemory(v19); + _vm->_globals.freeMemory(ofsData); result = 0; } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 543fe26ac2..c13e559b4f 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -81,7 +81,7 @@ Globals::Globals() { for (int i = 0; i < 6; ++i) Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0); for (int i = 0; i < 35; ++i) - Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(Liste2Item), 0); + Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(ListeItem), 0); for (int i = 0; i < 30; ++i) { Common::fill((byte *)&_lockedAnims[i], (byte *)&_lockedAnims[i] + sizeof(LockAnimItem), 0); Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0); @@ -337,7 +337,7 @@ void Globals::clearAll() { } for (int idx = 0; idx < 100; ++idx) { - CarreZone[idx].field0 = 0; + CarreZone[idx]._enabledFl = 0; } BUFFERTAPE = allocMemory(85000); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index d8f5de894a..22c8da8ec5 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -48,14 +48,14 @@ struct ZonePItem { }; struct CarreZoneItem { - int field0; - int field2; - int field4; - int field6; - int field8; - int fieldA; - int fieldC; - bool fieldE; + int _enabledFl; + int _left; + int _right; + int _top; + int _bottom; + int _minZoneLineIdx; + int _maxZoneLineIdx; + bool _squareZoneFl; }; struct BqeAnimItem { @@ -68,22 +68,13 @@ struct BankItem { bool _loadedFl; Common::String _filename; int _fileHeader; - int field1A; + int _objDataIdx; }; struct ListeItem { - bool field0; - int field2; - int field4; - int _width; - int _height; - int fieldA; -}; - -struct Liste2Item { bool _visibleFl; - int _xp; - int _yp; + int _posX; + int _posY; int _width; int _height; }; @@ -312,7 +303,7 @@ public: BankItem Bank[8]; BobItem _bob[36]; ListeItem Liste[6]; - Liste2Item Liste2[35]; + ListeItem Liste2[35]; LockAnimItem _lockedAnims[30]; VBobItem VBob[30]; ObjetWItem ObjetW[300]; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 878d71f7ff..14a8d535f1 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -292,19 +292,19 @@ void ObjectsManager::displaySprite() { if (!PERSO_ON) { for (int idx = 0; idx < MAX_SPRITE; ++idx) { - if (_vm->_globals.Liste[idx].field0) { - clipX = _vm->_globals.Liste[idx].field2 - 2; + if (_vm->_globals.Liste[idx]._visibleFl) { + clipX = _vm->_globals.Liste[idx]._posX - 2; if (clipX < _vm->_graphicsManager._minX) clipX = _vm->_graphicsManager._minX; - clipY = _vm->_globals.Liste[idx].field4 - 2; + clipY = _vm->_globals.Liste[idx]._posY - 2; if (clipY < _vm->_graphicsManager._minY) clipY = _vm->_graphicsManager._minY; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, _vm->_graphicsManager._vesaBuffer, clipX, clipY); - _vm->_globals.Liste[idx].field0 = false; + _vm->_globals.Liste[idx]._visibleFl = false; } } } @@ -315,7 +315,7 @@ void ObjectsManager::displaySprite() { if (!PERSO_ON) { // Handle drawing characters on the screen for (int idx = 0; idx < MAX_SPRITE; ++idx) { - _vm->_globals.Liste[idx].field0 = false; + _vm->_globals.Liste[idx]._visibleFl = false; if (_sprite[idx]._animationType == 1) { computeSprite(idx); if (_sprite[idx].field2A) @@ -473,7 +473,7 @@ void ObjectsManager::INIT_BOB() { void ObjectsManager::BOB_ZERO(int idx) { BobItem &bob = _vm->_globals._bob[idx]; - Liste2Item &item = _vm->_globals.Liste2[idx]; + ListeItem &item = _vm->_globals.Liste2[idx]; bob.field0 = 0; bob._spriteData = g_PTRNUL; @@ -496,8 +496,8 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._oldX2 = 0; item._visibleFl = false; - item._xp = 0; - item._yp = 0; + item._posX = 0; + item._posY = 0; item._width = 0; item._height = 0; } @@ -519,37 +519,37 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals._bob[idx]._modeFlag); _vm->_globals.Liste2[idx]._visibleFl = true; - _vm->_globals.Liste2[idx]._xp = xp; - _vm->_globals.Liste2[idx]._yp = yp; + _vm->_globals.Liste2[idx]._posX = xp; + _vm->_globals.Liste2[idx]._posY = yp; _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; - if (_vm->_globals.Liste2[idx]._xp < _vm->_graphicsManager._minX) { - _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste2[idx]._xp; - _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager._minX; + if (_vm->_globals.Liste2[idx]._posX < _vm->_graphicsManager._minX) { + _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste2[idx]._posX; + _vm->_globals.Liste2[idx]._posX = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste2[idx]._yp < _vm->_graphicsManager._minY) { - _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste2[idx]._yp; - _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager._minY; + if (_vm->_globals.Liste2[idx]._posY < _vm->_graphicsManager._minY) { + _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste2[idx]._posY; + _vm->_globals.Liste2[idx]._posY = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._xp > _vm->_graphicsManager._maxX) - _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste2[idx]._xp; + if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._posX > _vm->_graphicsManager._maxX) + _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste2[idx]._posX; - if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._yp > _vm->_graphicsManager._maxY) - _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste2[idx]._yp; + if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._posY > _vm->_graphicsManager._maxY) + _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste2[idx]._posY; if (_vm->_globals.Liste2[idx]._width <= 0 || _vm->_globals.Liste2[idx]._height <= 0) _vm->_globals.Liste2[idx]._visibleFl = false; if (_vm->_globals.Liste2[idx]._visibleFl) _vm->_graphicsManager.addVesaSegment( - _vm->_globals.Liste2[idx]._xp, - _vm->_globals.Liste2[idx]._yp, - _vm->_globals.Liste2[idx]._xp + _vm->_globals.Liste2[idx]._width, - _vm->_globals.Liste2[idx]._yp + _vm->_globals.Liste2[idx]._height); + _vm->_globals.Liste2[idx]._posX, + _vm->_globals.Liste2[idx]._posY, + _vm->_globals.Liste2[idx]._posX + _vm->_globals.Liste2[idx]._width, + _vm->_globals.Liste2[idx]._posY + _vm->_globals.Liste2[idx]._height); } void ObjectsManager::BOB_VISU(int idx) { @@ -697,8 +697,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals._bob[idx].field4A = v20; _vm->_globals.Liste2[idx]._visibleFl = true; - _vm->_globals.Liste2[idx]._xp = v13; - _vm->_globals.Liste2[idx]._yp = v14; + _vm->_globals.Liste2[idx]._posX = v13; + _vm->_globals.Liste2[idx]._posY = v14; int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); @@ -773,28 +773,28 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx]._width = _sprite[idx]._width; _vm->_globals.Liste[idx]._height = _sprite[idx]._height; - if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager._minX) { - _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste[idx].field2; - _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager._minX; + if (_vm->_globals.Liste[idx]._posX < _vm->_graphicsManager._minX) { + _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste[idx]._posX; + _vm->_globals.Liste[idx]._posX = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager._minY) { - _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste[idx].field4; - _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager._minY; + if (_vm->_globals.Liste[idx]._posY < _vm->_graphicsManager._minY) { + _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste[idx]._posY; + _vm->_globals.Liste[idx]._posY = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager._maxX) - _vm->_globals.Liste[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste[idx].field2; + if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx]._posX > _vm->_graphicsManager._maxX) + _vm->_globals.Liste[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste[idx]._posX; - if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager._maxY) - _vm->_globals.Liste[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste[idx].field4; + if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx]._posY > _vm->_graphicsManager._maxY) + _vm->_globals.Liste[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste[idx]._posY; if (_vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) - _vm->_globals.Liste[idx].field0 = false; + _vm->_globals.Liste[idx]._visibleFl = false; - if (_vm->_globals.Liste[idx].field0) - _vm->_graphicsManager.addVesaSegment( _vm->_globals.Liste[idx].field2, _vm->_globals.Liste[idx].field4, - _vm->_globals.Liste[idx].field2 + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx].field4 + _vm->_globals.Liste[idx]._height); + if (_vm->_globals.Liste[idx]._visibleFl) + _vm->_graphicsManager.addVesaSegment( _vm->_globals.Liste[idx]._posX, _vm->_globals.Liste[idx]._posY, + _vm->_globals.Liste[idx]._posX + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx]._posY + _vm->_globals.Liste[idx]._height); } void ObjectsManager::DEF_CACHE(int idx) { @@ -871,9 +871,9 @@ void ObjectsManager::computeSprite(int idx) { _sprite[idx]._zoomPct = zoomPercent; _sprite[idx]._reducePct = reducePercent; - _vm->_globals.Liste[idx].field0 = true; - _vm->_globals.Liste[idx].field2 = v15; - _vm->_globals.Liste[idx].field4 = v16; + _vm->_globals.Liste[idx]._visibleFl = true; + _vm->_globals.Liste[idx]._posX = v15; + _vm->_globals.Liste[idx]._posY = v16; int width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); int height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); @@ -1031,10 +1031,10 @@ void ObjectsManager::displayBobAnim() { if ((v14 != 2) && (v14 != 4)) { if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, - _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp, + _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, - _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[i]._xp, - _vm->_globals.Liste2[i]._yp); + _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[i]._posX, + _vm->_globals.Liste2[i]._posY); _vm->_globals.Liste2[i]._visibleFl = false; } } @@ -1043,10 +1043,10 @@ void ObjectsManager::displayBobAnim() { if (_vm->_globals._bob[i].field0 == 11) { if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, - _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp, + _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, _vm->_graphicsManager._vesaBuffer, - _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp); + _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY); _vm->_globals.Liste2[i]._visibleFl = false; } @@ -1200,12 +1200,11 @@ void ObjectsManager::clearSprite() { } for (int idx = 0; idx < MAX_SPRITE; idx++) { - _vm->_globals.Liste[idx].field0 = false; - _vm->_globals.Liste[idx].field2 = 0; - _vm->_globals.Liste[idx].field4 = 0; + _vm->_globals.Liste[idx]._visibleFl = false; + _vm->_globals.Liste[idx]._posX = 0; + _vm->_globals.Liste[idx]._posY = 0; _vm->_globals.Liste[idx]._width = 0; _vm->_globals.Liste[idx]._height = 0; - _vm->_globals.Liste[idx].fieldA = 0; } } @@ -1958,63 +1957,49 @@ void ObjectsManager::loadZone(const Common::String &file) { // Square Zone void ObjectsManager::CARRE_ZONE() { - int16 *dataP; - int v4; - int v5; - int v10; - int v11; - int v12; - int v14; - for (int idx = 0; idx < 100; ++idx) { - _vm->_globals.CarreZone[idx].field0 = 0; - _vm->_globals.CarreZone[idx].fieldE = false; - _vm->_globals.CarreZone[idx].field2 = 1280; - _vm->_globals.CarreZone[idx].field4 = 0; - _vm->_globals.CarreZone[idx].field6 = 460; - _vm->_globals.CarreZone[idx].field8 = 0; - _vm->_globals.CarreZone[idx].fieldA = 401; - _vm->_globals.CarreZone[idx].fieldC = 0; + _vm->_globals.CarreZone[idx]._enabledFl = 0; + _vm->_globals.CarreZone[idx]._squareZoneFl = false; + _vm->_globals.CarreZone[idx]._left = 1280; + _vm->_globals.CarreZone[idx]._right = 0; + _vm->_globals.CarreZone[idx]._top = 460; + _vm->_globals.CarreZone[idx]._bottom = 0; + _vm->_globals.CarreZone[idx]._minZoneLineIdx = 401; + _vm->_globals.CarreZone[idx]._maxZoneLineIdx = 0; } for (int idx = 0; idx < MAX_LINES; ++idx) { - dataP = _vm->_linesManager._zoneLine[idx].zoneData; - if (dataP != (int16 *)g_PTRNUL) { - v4 = _vm->_linesManager._zoneLine[idx].field2; - _vm->_globals.CarreZone[v4].field0 = 1; - if (_vm->_globals.CarreZone[v4].fieldC < idx) - _vm->_globals.CarreZone[v4].fieldC = idx; - if (_vm->_globals.CarreZone[v4].fieldA > idx) - _vm->_globals.CarreZone[v4].fieldA = idx; - - v12 = _vm->_linesManager._zoneLine[idx].count; - if (v12 > 0) { - for (int v13 = 0; v13 < v12; v13++) { - v5 = *dataP++; - v11 = *dataP++; - - if (_vm->_globals.CarreZone[v4].field2 >= v5) - _vm->_globals.CarreZone[v4].field2 = v5; - if (_vm->_globals.CarreZone[v4].field4 <= v5) - _vm->_globals.CarreZone[v4].field4 = v5; - if (_vm->_globals.CarreZone[v4].field6 >= v11) - _vm->_globals.CarreZone[v4].field6 = v11; - if (_vm->_globals.CarreZone[v4].field8 <= v11) - _vm->_globals.CarreZone[v4].field8 = v11; - } - } + int16 *dataP = _vm->_linesManager._zoneLine[idx].zoneData; + if (dataP == (int16 *)g_PTRNUL) + continue; + + int v4 = _vm->_linesManager._zoneLine[idx].field2; + _vm->_globals.CarreZone[v4]._enabledFl = 1; + if (_vm->_globals.CarreZone[v4]._maxZoneLineIdx < idx) + _vm->_globals.CarreZone[v4]._maxZoneLineIdx = idx; + if (_vm->_globals.CarreZone[v4]._minZoneLineIdx > idx) + _vm->_globals.CarreZone[v4]._minZoneLineIdx = idx; + + for (int i = 0; i < _vm->_linesManager._zoneLine[idx].count; i++) { + int zoneX = *dataP++; + int zoneY = *dataP++; + + if (_vm->_globals.CarreZone[v4]._left >= zoneX) + _vm->_globals.CarreZone[v4]._left = zoneX; + if (_vm->_globals.CarreZone[v4]._right <= zoneX) + _vm->_globals.CarreZone[v4]._right = zoneX; + if (_vm->_globals.CarreZone[v4]._top >= zoneY) + _vm->_globals.CarreZone[v4]._top = zoneY; + if (_vm->_globals.CarreZone[v4]._bottom <= zoneY) + _vm->_globals.CarreZone[v4]._bottom = zoneY; } } - for (int v7 = 0; v7 <= 99; v7++) { - v10 = _vm->_globals.CarreZone[v7].field2 - _vm->_globals.CarreZone[v7].field4; - if (v10 < 0) - v10 = -v10; - v14 = _vm->_globals.CarreZone[v7].field6 - _vm->_globals.CarreZone[v7].field8; - if (v14 < 0) - v14 = -v14; - if (v10 == v14) - _vm->_globals.CarreZone[v7].fieldE = true; + for (int idx = 0; idx < 100; idx++) { + int zoneWidth = abs(_vm->_globals.CarreZone[idx]._left - _vm->_globals.CarreZone[idx]._right); + int zoneHeight = abs(_vm->_globals.CarreZone[idx]._top - _vm->_globals.CarreZone[idx]._bottom); + if (zoneWidth == zoneHeight) + _vm->_globals.CarreZone[idx]._squareZoneFl = true; } } @@ -3009,17 +2994,17 @@ int ObjectsManager::MZONE() { } _vm->_globals.SegmentEnCours = 0; for (int v7 = 0; v7 <= 99; v7++) { - if (_vm->_globals.ZONEP[v7]._enabledFl && _vm->_globals.CarreZone[v7].field0 == 1 - && _vm->_globals.CarreZone[v7].field2 <= xp - && _vm->_globals.CarreZone[v7].field4 >= xp - && _vm->_globals.CarreZone[v7].field6 <= yp - && _vm->_globals.CarreZone[v7].field8 >= yp) { - if (_vm->_globals.CarreZone[v7].fieldE) { - _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7].fieldA].field2; + if (_vm->_globals.ZONEP[v7]._enabledFl && _vm->_globals.CarreZone[v7]._enabledFl == 1 + && _vm->_globals.CarreZone[v7]._left <= xp + && _vm->_globals.CarreZone[v7]._right >= xp + && _vm->_globals.CarreZone[v7]._top <= yp + && _vm->_globals.CarreZone[v7]._bottom >= yp) { + if (_vm->_globals.CarreZone[v7]._squareZoneFl) { + _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7]._minZoneLineIdx].field2; return _vm->_globals.oldzone_46; } - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = _vm->_globals.CarreZone[v7].fieldA; - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = _vm->_globals.CarreZone[v7].fieldC; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = _vm->_globals.CarreZone[v7]._minZoneLineIdx; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = _vm->_globals.CarreZone[v7]._maxZoneLineIdx; ++_vm->_globals.SegmentEnCours; } } -- cgit v1.2.3 From 33636f0d63d4eb2fdb20a2e73c8c6392426365c9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Jan 2013 18:59:17 +0100 Subject: HOPKINS: More renaming in ObjectsManager --- engines/hopkins/computer.cpp | 2 +- engines/hopkins/dialogs.cpp | 16 +-- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 102 ++++++------- engines/hopkins/objects.cpp | 334 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 6 +- engines/hopkins/saveload.cpp | 10 +- engines/hopkins/script.cpp | 204 +++++++++++++------------- engines/hopkins/talk.cpp | 14 +- 9 files changed, 345 insertions(+), 345 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index e771b75884..53c5809c36 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -248,7 +248,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { break; case '6': readText(10); - _vm->_globals._saveData->data[svField270] = 4; + _vm->_globals._saveData->_data[svField270] = 4; break; } } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index b4c5c34976..486d122c53 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -399,9 +399,9 @@ LABEL_7: break; _vm->_scriptManager.TRAVAILOBJET = true; - _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; - _vm->_globals._saveData->data[svField8] = _vm->_globals._inventory[newInventoryItem]; - _vm->_globals._saveData->data[svField9] = _vm->_eventsManager._mouseCursorId; + _vm->_globals._saveData->_data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->_data[svField8] = _vm->_globals._inventory[newInventoryItem]; + _vm->_globals._saveData->_data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); _vm->_scriptManager.TRAVAILOBJET = false; @@ -483,20 +483,20 @@ void DialogsManager::inventAnim() { _vm->_objectsManager.I_old_x = newOffset; } - if (_vm->_globals._saveData->data[svField357] == 1) { - if (_vm->_globals._saveData->data[svField353] == 1) + if (_vm->_globals._saveData->_data[svField357] == 1) { + if (_vm->_globals._saveData->_data[svField353] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); - if (_vm->_globals._saveData->data[svField355] == 1) + if (_vm->_globals._saveData->_data[svField355] == 1) _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); _vm->_graphicsManager.addVesaSegment(566, 25, 594, 60); } - if (_vm->_globals._saveData->data[svField356] == 1) { + if (_vm->_globals._saveData->_data[svField356] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } - if (_vm->_globals._saveData->data[svField354] == 1) { + if (_vm->_globals._saveData->_data[svField354] == 1) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 22c8da8ec5..92f6b29e71 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -268,7 +268,7 @@ enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARA // TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { - byte data[2050]; + byte _data[2050]; CharacterLocation _cloneHopkins; CharacterLocation _realHopkins; CharacterLocation _samantha; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a64398fdc5..ad6a605f34 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -210,7 +210,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 3: - if (!_globals._saveData->data[svField170]) { + if (!_globals._saveData->_data[svField170]) { _soundManager.WSOUND(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) _graphicsManager.loadImage("fond"); @@ -241,7 +241,7 @@ bool HopkinsEngine::runWin95Demo() { _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); _graphicsManager.fadeOutLong(); - _globals._saveData->data[svField170] = 1; + _globals._saveData->_data[svField170] = 1; } _globals.Max_Propre = 5; _globals._maxLineLength = 5; @@ -260,8 +260,8 @@ bool HopkinsEngine::runWin95Demo() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80]) { - if (_globals._saveData->data[svField80] == 1) + if (_globals._saveData->_data[svField80]) { + if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); } else { _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); @@ -276,7 +276,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 7: - if (_globals._saveData->data[svField220]) + if (_globals._saveData->_data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); @@ -293,7 +293,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre = 15; _globals.Max_Perso_Y = 440; _globals._maxLineLength = 20; - if (_globals._saveData->data[svField225]) + if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else bombExplosion(); @@ -314,7 +314,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Propre = 15; _globals.Max_Perso_Y = 450; _globals._maxLineLength = 20; - if (_globals._saveData->data[svField225]) { + if (_globals._saveData->_data[svField225]) { if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); else @@ -366,9 +366,9 @@ bool HopkinsEngine::runWin95Demo() { case 113: _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._screenId; _globals._screenId = 113; - _globals._saveData->data[svField5] = _globals._screenId; + _globals._saveData->_data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -382,9 +382,9 @@ bool HopkinsEngine::runWin95Demo() { case 114: _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._screenId; _globals._screenId = 114; - _globals._saveData->data[svField5] = _globals._screenId; + _globals._saveData->_data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_SAMANTHA); _graphicsManager.lockScreen(); @@ -395,9 +395,9 @@ bool HopkinsEngine::runWin95Demo() { case 115: _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._screenId; _globals._screenId = 115; - _globals._saveData->data[svField5] = _globals._screenId; + _globals._saveData->_data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -523,7 +523,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 3: - if (!_globals._saveData->data[svField170]) { + if (!_globals._saveData->_data[svField170]) { _soundManager.WSOUND(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) _graphicsManager.loadImage("fond"); @@ -556,7 +556,7 @@ bool HopkinsEngine::runLinuxDemo() { _soundManager.DEL_SAMPLE(2); _soundManager.DEL_SAMPLE(3); _soundManager.DEL_SAMPLE(4); - _globals._saveData->data[svField170] = 1; + _globals._saveData->_data[svField170] = 1; } _globals.Max_Propre = 5; @@ -575,7 +575,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80] == 1) + if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); else _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); @@ -589,7 +589,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 7: - if (_globals._saveData->data[svField220]) + if (_globals._saveData->_data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); @@ -607,7 +607,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; - if (!_globals._saveData->data[svField225]) + if (!_globals._saveData->_data[svField225]) bombExplosion(); _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); @@ -628,7 +628,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField225]) + if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); else bombExplosion(); @@ -657,9 +657,9 @@ bool HopkinsEngine::runLinuxDemo() { _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField113] == 1) { + if (_globals._saveData->_data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); - } else if (!_globals._saveData->data[svField113]) { + } else if (!_globals._saveData->_data[svField113]) { _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); } break; @@ -696,9 +696,9 @@ bool HopkinsEngine::runLinuxDemo() { case 113: _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._screenId; _globals._screenId = 113; - _globals._saveData->data[svField5] = 113; + _globals._saveData->_data[svField5] = 113; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.lockScreen(); @@ -714,9 +714,9 @@ bool HopkinsEngine::runLinuxDemo() { case 114: _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._screenId; _globals._screenId = 114; - _globals._saveData->data[svField5] = 114; + _globals._saveData->_data[svField5] = 114; _computerManager.showComputer(COMPUTER_SAMANTHA); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -726,9 +726,9 @@ bool HopkinsEngine::runLinuxDemo() { case 115: _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; - _globals._saveData->data[svField6] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._screenId; _globals._screenId = 115; - _globals._saveData->data[svField5] = 115; + _globals._saveData->_data[svField5] = 115; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -864,7 +864,7 @@ bool HopkinsEngine::runFull() { break; case 3: - if (!_globals._saveData->data[svField170]) { + if (!_globals._saveData->_data[svField170]) { _soundManager.WSOUND(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) _graphicsManager.loadImage("fond"); @@ -902,7 +902,7 @@ bool HopkinsEngine::runFull() { _soundManager.DEL_SAMPLE(4); if (getPlatform() != Common::kPlatformLinux) _graphicsManager.fadeOutLong(); - _globals._saveData->data[svField170] = 1; + _globals._saveData->_data[svField170] = 1; } _globals.Max_Propre = 5; _globals._maxLineLength = 5; @@ -920,7 +920,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 455; - if (_globals._saveData->data[svField80] == 1) + if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); else _objectsManager.PERSONAGE2("IM05", "IM05", "ANIM05", "IM05", 3, false); @@ -934,7 +934,7 @@ bool HopkinsEngine::runFull() { break; case 7: - if (_globals._saveData->data[svField220]) + if (_globals._saveData->_data[svField220]) _objectsManager.PERSONAGE("BOMBEB", "BOMBE", "BOMBE", "BOMBE", 2, true); else _objectsManager.PERSONAGE("BOMBEA", "BOMBE", "BOMBE", "BOMBE", 2, true); @@ -951,7 +951,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField225]) + if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else bombExplosion(); @@ -972,7 +972,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 20; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField225]) + if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); else bombExplosion(); @@ -1003,7 +1003,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField113] == 1) + if (_globals._saveData->_data[svField113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); else _objectsManager.PERSONAGE2("IM16", "IM16", "ANIM16", "IM16", 7, true); @@ -1013,9 +1013,9 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField117] == 1) + if (_globals._saveData->_data[svField117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); - else if (!_globals._saveData->data[svField117]) + else if (!_globals._saveData->_data[svField117]) _objectsManager.PERSONAGE2("IM17", "IM17", "ANIM17", "IM17", 11, true); if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -1055,7 +1055,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 50; _globals._maxLineLength = 40; _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField123]) + if (_globals._saveData->_data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); else _objectsManager.PERSONAGE2("IM19", "IM19", "ANIM19", "IM19", 6, true); @@ -1101,7 +1101,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField181] == 1) + if (_globals._saveData->_data[svField181] == 1) _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true); else _objectsManager.PERSONAGE2("IM24", "IM24", "ANIM24", "IM24", 1, true); @@ -1131,7 +1131,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 10; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 440; - if (_globals._saveData->data[svField177] == 1) + if (_globals._saveData->_data[svField177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); else _objectsManager.PERSONAGE2("IM27", "IM27", "ANIM27", "IM27", 27, true); @@ -1141,7 +1141,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 450; - if (_globals._saveData->data[svField166] != 1 || _globals._saveData->data[svField167] != 1) + if (_globals._saveData->_data[svField166] != 1 || _globals._saveData->_data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else _objectsManager.PERSONAGE2("IM28A", "IM28", "ANIM28", "IM28", 1, false); @@ -1276,7 +1276,7 @@ bool HopkinsEngine::runFull() { break; case 61: - if (_globals._saveData->data[svField311] == 1 && !_globals._saveData->data[svField312]) + if (_globals._saveData->_data[svField311] == 1 && !_globals._saveData->_data[svField312]) handleConflagration(); _objectsManager.PERSONAGE("IM61", "IM61", "ANIM61", "IM61", 21, false); break; @@ -1355,7 +1355,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 15; _globals._maxLineLength = 15; _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField318] == 1) + if (_globals._saveData->_data[svField318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); else _objectsManager.PERSONAGE2("IM73", "IM73", "ANIM73", "IM73", 21, true); @@ -1429,7 +1429,7 @@ bool HopkinsEngine::runFull() { _globals.Max_Propre = 5; _globals._maxLineLength = 5; _globals.Max_Perso_Y = 445; - if (_globals._saveData->data[svField330]) { + if (_globals._saveData->_data[svField330]) { if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 29, true); else @@ -1511,8 +1511,8 @@ bool HopkinsEngine::runFull() { case 113: _globals._prevScreenId = _globals._screenId; _globals._screenId = 113; - _globals._saveData->data[svField6] = _globals._prevScreenId; - _globals._saveData->data[svField5] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._prevScreenId; + _globals._saveData->_data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_HOPKINS); _graphicsManager.lockScreen(); @@ -1529,8 +1529,8 @@ bool HopkinsEngine::runFull() { _globals._exitId = 0; _globals._prevScreenId = _globals._screenId; _globals._screenId = 114; - _globals._saveData->data[svField6] = _globals._prevScreenId; - _globals._saveData->data[svField5] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._prevScreenId; + _globals._saveData->_data[svField5] = _globals._screenId; _computerManager.showComputer(COMPUTER_SAMANTHA); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -1540,8 +1540,8 @@ bool HopkinsEngine::runFull() { case 115: _globals._prevScreenId = _globals._screenId; _globals._screenId = 115; - _globals._saveData->data[svField6] = _globals._prevScreenId; - _globals._saveData->data[svField5] = _globals._screenId; + _globals._saveData->_data[svField6] = _globals._prevScreenId; + _globals._saveData->_data[svField5] = _globals._screenId; _globals._exitId = 0; _computerManager.showComputer(COMPUTER_PUBLIC); _graphicsManager.lockScreen(); @@ -2087,7 +2087,7 @@ void HopkinsEngine::handleConflagration() { _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); - _globals._saveData->data[svField312] = 1; + _globals._saveData->_data[svField312] = 1; _globals._disableInventFl = false; } @@ -2245,7 +2245,7 @@ void HopkinsEngine::playEnding() { while (_objectsManager.BOBPOSI(7) != 120); _objectsManager.stopBobAnimation(7); - if (_globals._saveData->data[svField135] == 1) { + if (_globals._saveData->_data[svField135] == 1) { _soundManager._specialSoundNum = 200; _soundManager.skipRefreshFl = true; _graphicsManager.FADE_LINUX = 2; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 14a8d535f1..e3df43dc6b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -830,12 +830,12 @@ void ObjectsManager::computeSprite(int idx) { int zoomPercent = 0; int reducePercent = 0; - if (_sprite[idx].fieldC < 0) { - reducePercent = -_sprite[idx].fieldC; + if (_sprite[idx]._zoomfactor < 0) { + reducePercent = -_sprite[idx]._zoomfactor; if (reducePercent > 95) reducePercent = 95; } else - zoomPercent = _sprite[idx].fieldC; + zoomPercent = _sprite[idx]._zoomfactor; if (zoomPercent) { if (tmpX >= 0) @@ -1213,12 +1213,12 @@ void ObjectsManager::animateSprite(int idx) { _sprite[idx]._animationType = 1; } -void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9) { +void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, int a7, int a8, int a9) { assert (idx <= MAX_SPRITE); _sprite[idx]._spriteData = spriteData; _sprite[idx]._spritePos = pos; _sprite[idx]._spriteIndex = spriteIndex; - _sprite[idx].fieldC = a6; + _sprite[idx]._zoomfactor = zoomFactor; _sprite[idx].fieldE = a7; _sprite[idx].field12 = a8; _sprite[idx].field14 = a9; @@ -1226,7 +1226,7 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { _sprite[idx]._rleFl = true; - _sprite[idx].fieldC = 0; + _sprite[idx]._zoomfactor = 0; _sprite[idx].fieldE = 0; } else _sprite[idx]._rleFl = false; @@ -1266,10 +1266,10 @@ void ObjectsManager::setSpriteIndex(int idx, int spriteIndex) { } // Set Sprite Size -void ObjectsManager::setSpriteSize(int idx, int size) { +void ObjectsManager::setSpriteZoom(int idx, int zoomFactor) { assert (idx <= MAX_SPRITE); if (!_sprite[idx]._rleFl) - _sprite[idx].fieldC = size; + _sprite[idx]._zoomfactor = zoomFactor; } void ObjectsManager::setFlipSprite(int idx, bool flip) { @@ -1450,7 +1450,7 @@ void ObjectsManager::GOHOME() { setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; if (_vm->_globals.GOACTION) - v54 = _vm->_globals._saveData->data[svField2]; + v54 = _vm->_globals._saveData->_data[svField2]; else v54 = _zoneNum; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -1484,12 +1484,12 @@ void ObjectsManager::GOHOME() { v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0].fieldC); - v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0].fieldC); - } else if (_sprite[0].fieldC > 0) { - v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0].fieldC); - v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0].fieldC); + if (_sprite[0]._zoomfactor < 0) { + v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomfactor); + v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0]._zoomfactor); + } else if (_sprite[0]._zoomfactor > 0) { + v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0]._zoomfactor); + v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0]._zoomfactor); } v0 = v3 + g_old_x; v58 = g_old_y + v4; @@ -1507,13 +1507,13 @@ void ObjectsManager::GOHOME() { } else { v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0].fieldC); - v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0].fieldC); + if (_sprite[0]._zoomfactor < 0) { + v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomfactor); + v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomfactor); } - if (_sprite[0].fieldC > 0) { - v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0].fieldC); - v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0].fieldC); + if (_sprite[0]._zoomfactor > 0) { + v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0]._zoomfactor); + v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0]._zoomfactor); } v0 = g_old_x - v9; v58 = g_old_y - v10; @@ -1531,11 +1531,11 @@ void ObjectsManager::GOHOME() { } else { v15 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); v16 = v15; - if (_sprite[0].fieldC < 0) { - v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0].fieldC); + if (_sprite[0]._zoomfactor < 0) { + v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomfactor); } - if (_sprite[0].fieldC > 0) { - v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0].fieldC); + if (_sprite[0]._zoomfactor > 0) { + v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0]._zoomfactor); } v0 = g_old_x; v58 = g_old_y - v16; @@ -1554,16 +1554,16 @@ void ObjectsManager::GOHOME() { } else { v19 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); v20 = v19; - if (_sprite[0].fieldC < 0) { - v21 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v21 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor < 0) { + v21 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v21 = -_sprite[0]._zoomfactor; v20 = _vm->_graphicsManager.zoomOut(v20, v21); } - if (_sprite[0].fieldC > 0) { - v22 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v22 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor > 0) { + v22 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v22 = -_sprite[0]._zoomfactor; v20 = _vm->_graphicsManager.zoomIn(v20, v22); } v0 = g_old_x; @@ -1582,24 +1582,24 @@ void ObjectsManager::GOHOME() { } else { v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v25 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v25 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor < 0) { + v25 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v25 = -_sprite[0]._zoomfactor; v23 = _vm->_graphicsManager.zoomOut(v23, v25); - v26 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v26 = -_sprite[0].fieldC; + v26 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v26 = -_sprite[0]._zoomfactor; v24 = _vm->_graphicsManager.zoomOut(v24, v26); } - if (_sprite[0].fieldC > 0) { - v27 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v27 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor > 0) { + v27 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v27 = -_sprite[0]._zoomfactor; v23 = _vm->_graphicsManager.zoomIn(v23, v27); - v28 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v28 = -_sprite[0].fieldC; + v28 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v28 = -_sprite[0]._zoomfactor; v24 = _vm->_graphicsManager.zoomIn(v24, v28); } v0 = v23 + g_old_x; @@ -1618,23 +1618,23 @@ void ObjectsManager::GOHOME() { } else { v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v31 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v31 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor < 0) { + v31 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v31 = -_sprite[0]._zoomfactor; v29 = _vm->_graphicsManager.zoomOut(v29, v31); - v32 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v32 = -_sprite[0].fieldC; + v32 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v32 = -_sprite[0]._zoomfactor; v30 = _vm->_graphicsManager.zoomOut(v30, v32); - } else if (_sprite[0].fieldC > 0) { - v33 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v33 = -_sprite[0].fieldC; + } else if (_sprite[0]._zoomfactor > 0) { + v33 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v33 = -_sprite[0]._zoomfactor; v29 = _vm->_graphicsManager.zoomIn(v29, v33); - v34 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v34 = -_sprite[0].fieldC; + v34 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v34 = -_sprite[0]._zoomfactor; v30 = _vm->_graphicsManager.zoomIn(v30, v34); } v0 = g_old_x - v29; @@ -1653,24 +1653,24 @@ void ObjectsManager::GOHOME() { } else { v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v37 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v37 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor < 0) { + v37 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v37 = -_sprite[0]._zoomfactor; v35 = _vm->_graphicsManager.zoomOut(v35, v37); - v38 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v38 = -_sprite[0].fieldC; + v38 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v38 = -_sprite[0]._zoomfactor; v36 = _vm->_graphicsManager.zoomOut(v36, v38); } - if (_sprite[0].fieldC > 0) { - v39 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v39 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor > 0) { + v39 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v39 = -_sprite[0]._zoomfactor; v35 = _vm->_graphicsManager.zoomIn(v35, v39); - v40 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v40 = -_sprite[0].fieldC; + v40 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v40 = -_sprite[0]._zoomfactor; v36 = _vm->_graphicsManager.zoomIn(v36, v40); } v0 = v35 + g_old_x; @@ -1689,24 +1689,24 @@ void ObjectsManager::GOHOME() { } else { v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0].fieldC < 0) { - v43 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v43 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor < 0) { + v43 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v43 = -_sprite[0]._zoomfactor; v41 = _vm->_graphicsManager.zoomOut(v41, v43); - v44 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v44 = -_sprite[0].fieldC; + v44 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v44 = -_sprite[0]._zoomfactor; v42 = _vm->_graphicsManager.zoomOut(v42, v44); } - if (_sprite[0].fieldC > 0) { - v45 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v45 = -_sprite[0].fieldC; + if (_sprite[0]._zoomfactor > 0) { + v45 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v45 = -_sprite[0]._zoomfactor; v41 = _vm->_graphicsManager.zoomIn(v41, v45); - v46 = _sprite[0].fieldC; - if (_sprite[0].fieldC < 0) - v46 = -_sprite[0].fieldC; + v46 = _sprite[0]._zoomfactor; + if (_sprite[0]._zoomfactor < 0) + v46 = -_sprite[0]._zoomfactor; v42 = _vm->_graphicsManager.zoomIn(v42, v46); } v0 = g_old_x - v41; @@ -1726,7 +1726,7 @@ void ObjectsManager::GOHOME() { if (newPosX == -1 && newPosY == -1) { if (_vm->_globals.GOACTION) - v49 = _vm->_globals._saveData->data[svField2]; + v49 = _vm->_globals._saveData->_data[svField2]; else v49 = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); @@ -2060,15 +2060,15 @@ void ObjectsManager::PLAN_BETA() { do { int mouseButton = _vm->_eventsManager.getMouseButton(); if (mouseButton) { - if (_vm->_globals._saveData->data[svField170] == 1 && !_vm->_globals._saveData->data[svField171]) { - _vm->_globals._saveData->data[svField171] = 1; + if (_vm->_globals._saveData->_data[svField170] == 1 && !_vm->_globals._saveData->_data[svField171]) { + _vm->_globals._saveData->_data[svField171] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); _vm->_globals.NOPARLE = false; mouseButton = 0; } - if (_vm->_globals._saveData->data[svField80] == 1 && !_vm->_globals._saveData->data[svField172]) { - _vm->_globals._saveData->data[svField172] = 1; + if (_vm->_globals._saveData->_data[svField80] == 1 && !_vm->_globals._saveData->_data[svField172]) { + _vm->_globals._saveData->_data[svField172] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); _vm->_globals.NOPARLE = false; @@ -2124,23 +2124,23 @@ void ObjectsManager::handleLeftButton() { } return; } - if (_vm->_globals._saveData->data[svField354] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField354] == 1 && !_vm->_globals.PLAN_FLAG && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } - if (_vm->_globals._saveData->data[svField356] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField356] == 1 && !_vm->_globals.PLAN_FLAG && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 48) { changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } - if (_vm->_globals._saveData->data[svField357] == 1) { - if (_vm->_globals._saveData->data[svField353] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField357] == 1) { + if (_vm->_globals._saveData->_data[svField353] == 1 && !_vm->_globals.PLAN_FLAG && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } - if (_vm->_globals._saveData->data[svField355] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField355] == 1 && !_vm->_globals.PLAN_FLAG && destX >= 567 && destX <= 593 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); return; @@ -2165,8 +2165,8 @@ void ObjectsManager::handleLeftButton() { if (_vm->_globals.GOACTION) { checkZone(); _vm->_globals.GOACTION = false; - _vm->_globals._saveData->data[svField1] = 0; - _vm->_globals._saveData->data[svField2] = 0; + _vm->_globals._saveData->_data[svField1] = 0; + _vm->_globals._saveData->_data[svField2] = 0; } if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0)) @@ -2224,19 +2224,19 @@ LABEL_65: } if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) - _vm->_globals._saveData->data[svField1] = 5; + _vm->_globals._saveData->_data[svField1] = 5; else - _vm->_globals._saveData->data[svField1] = _vm->_eventsManager._mouseCursorId; + _vm->_globals._saveData->_data[svField1] = _vm->_eventsManager._mouseCursorId; if (_vm->_globals.PLAN_FLAG) - _vm->_globals._saveData->data[svField1] = 6; - _vm->_globals._saveData->data[svField2] = _zoneNum; - _vm->_globals._saveData->data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->_data[svField1] = 6; + _vm->_globals._saveData->_data[svField2] = _zoneNum; + _vm->_globals._saveData->_data[svField3] = _vm->_globals._curObjectIndex; _vm->_globals.GOACTION = true; } _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - if (_vm->_globals._screenId == 20 && _vm->_globals._saveData->data[svField132] == 1 + if (_vm->_globals._screenId == 20 && _vm->_globals._saveData->_data[svField132] == 1 && _vm->_globals._curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move @@ -2247,8 +2247,8 @@ LABEL_65: } void ObjectsManager::PARADISE() { - char result = _vm->_globals._saveData->data[svField1]; - if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { + char result = _vm->_globals._saveData->_data[svField1]; + if (result && _vm->_globals._saveData->_data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); if (!_vm->_globals._forestFl || _zoneNum < 20 || _zoneNum > 23) { if (_vm->_graphicsManager._largeScreenFl) { @@ -2295,20 +2295,20 @@ void ObjectsManager::PARADISE() { _vm->_eventsManager.VBL(); _vm->_graphicsManager._scrollStatus = 0; } - _vm->_talkManager.REPONSE(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); + _vm->_talkManager.REPONSE(_vm->_globals._saveData->_data[svField2], _vm->_globals._saveData->_data[svField1]); } else { - _vm->_talkManager.REPONSE2(_vm->_globals._saveData->data[svField2], _vm->_globals._saveData->data[svField1]); + _vm->_talkManager.REPONSE2(_vm->_globals._saveData->_data[svField2], _vm->_globals._saveData->_data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum]._enabledFl) { _zoneNum = -1; _forceZoneFl = true; } - if (_zoneNum != _vm->_globals._saveData->data[svField2] || _zoneNum == -1 || _zoneNum == 0) { + if (_zoneNum != _vm->_globals._saveData->_data[svField2] || _zoneNum == -1 || _zoneNum == 0) { _vm->_eventsManager._mouseCursorId = 4; _changeVerbFl = false; } else { - _vm->_eventsManager._mouseCursorId = _vm->_globals._saveData->data[svField1]; + _vm->_eventsManager._mouseCursorId = _vm->_globals._saveData->_data[svField1]; if (_changeVerbFl) { nextVerbIcon(); _changeVerbFl = false; @@ -2319,8 +2319,8 @@ void ObjectsManager::PARADISE() { if (_vm->_eventsManager._mouseCursorId != 23) _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); _zoneNum = 0; - _vm->_globals._saveData->data[svField1] = 0; - _vm->_globals._saveData->data[svField2] = 0; + _vm->_globals._saveData->_data[svField1] = 0; + _vm->_globals._saveData->_data[svField2] = 0; } if (_vm->_globals.PLAN_FLAG) { _vm->_eventsManager._mouseCursorId = 0; @@ -2362,8 +2362,8 @@ void ObjectsManager::clearScreen() { _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager._mouseSpriteId = 0; - _vm->_globals._saveData->data[svField1] = 0; - _vm->_globals._saveData->data[svField2] = 0; + _vm->_globals._saveData->_data[svField1] = 0; + _vm->_globals._saveData->_data[svField2] = 0; _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; @@ -2400,9 +2400,9 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha animateSprite(1); removeSprite(0); - _vm->_globals._saveData->data[svField354] = 0; - _vm->_globals._saveData->data[svField356] = 0; - _vm->_globals._saveData->data[svField357] = 1; + _vm->_globals._saveData->_data[svField354] = 0; + _vm->_globals._saveData->_data[svField356] = 0; + _vm->_globals._saveData->_data[svField357] = 1; loc = &_vm->_globals._saveData->_realHopkins; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); @@ -2418,16 +2418,16 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0].fieldC; + loc->field4 = _sprite[0]._zoomfactor; removeSprite(1); addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); animateSprite(1); removeSprite(0); - _vm->_globals._saveData->data[svField354] = 0; - _vm->_globals._saveData->data[svField356] = 1; - _vm->_globals._saveData->data[svField357] = 0; + _vm->_globals._saveData->_data[svField354] = 0; + _vm->_globals._saveData->_data[svField356] = 1; + _vm->_globals._saveData->_data[svField357] = 0; loc = &_vm->_globals._saveData->_samantha; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); @@ -2443,7 +2443,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0].fieldC; + loc->field4 = _sprite[0]._zoomfactor; break; case CHARACTER_HOPKINS_CLONE: loc = &_vm->_globals._saveData->_cloneHopkins; @@ -2451,7 +2451,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0].fieldC; + loc->field4 = _sprite[0]._zoomfactor; break; case CHARACTER_SAMANTHA: loc = &_vm->_globals._saveData->_samantha; @@ -2459,7 +2459,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0].fieldC; + loc->field4 = _sprite[0]._zoomfactor; break; default: break; @@ -2467,24 +2467,24 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha switch (newCharacter) { case CHARACTER_HOPKINS: - _vm->_globals._saveData->data[svField121] = 0; - _vm->_globals._saveData->data[svField354] = 0; - _vm->_globals._saveData->data[svField356] = 0; - _vm->_globals._saveData->data[svField357] = 1; + _vm->_globals._saveData->_data[svField121] = 0; + _vm->_globals._saveData->_data[svField354] = 0; + _vm->_globals._saveData->_data[svField356] = 0; + _vm->_globals._saveData->_data[svField357] = 1; _vm->_globals._exitId = _vm->_globals._saveData->_realHopkins._location; break; case CHARACTER_HOPKINS_CLONE: - _vm->_globals._saveData->data[svField121] = 1; - _vm->_globals._saveData->data[svField354] = 1; - _vm->_globals._saveData->data[svField356] = 0; - _vm->_globals._saveData->data[svField357] = 0; + _vm->_globals._saveData->_data[svField121] = 1; + _vm->_globals._saveData->_data[svField354] = 1; + _vm->_globals._saveData->_data[svField356] = 0; + _vm->_globals._saveData->_data[svField357] = 0; _vm->_globals._exitId = _vm->_globals._saveData->_cloneHopkins._location; break; case CHARACTER_SAMANTHA: - _vm->_globals._saveData->data[svField121] = 0; - _vm->_globals._saveData->data[svField354] = 0; - _vm->_globals._saveData->data[svField356] = 1; - _vm->_globals._saveData->data[svField357] = 0; + _vm->_globals._saveData->_data[svField121] = 0; + _vm->_globals._saveData->_data[svField354] = 0; + _vm->_globals._saveData->_data[svField356] = 1; + _vm->_globals._saveData->_data[svField357] = 0; _vm->_globals._exitId = _vm->_globals._saveData->_samantha._location; break; } @@ -2499,7 +2499,7 @@ void ObjectsManager::computeAndSetSpriteSize() { } else if (_vm->_globals.PERSO_TYPE == 2) { size = 20 * (5 * abs(size) - 165) / -67; } - setSpriteSize(0, size); + setSpriteZoom(0, size); } void ObjectsManager::PACOURS_PROPRE(int16 *a1) { @@ -3256,10 +3256,10 @@ void ObjectsManager::handleSpecialGames() { switch (_vm->_globals._screenId) { case 5: - if ((getSpriteY(0) > 399) || _vm->_globals._saveData->data[svField173]) + if ((getSpriteY(0) > 399) || _vm->_globals._saveData->_data[svField173]) break; - _vm->_globals._saveData->data[svField173] = 1; + _vm->_globals._saveData->_data[svField173] = 1; _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); _vm->_globals.NOPARLE = false; @@ -3300,7 +3300,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_graphicsManager.DD_VBL(); break; case 20: - _vm->_globals._saveData->data[svField132] = (getSpriteX(0) > 65 && getSpriteX(0) <= 124 && getSpriteY(0) > 372 && getSpriteY(0) <= 398) ? 1 : 0; + _vm->_globals._saveData->_data[svField132] = (getSpriteX(0) > 65 && getSpriteX(0) <= 124 && getSpriteY(0) > 372 && getSpriteY(0) <= 398) ? 1 : 0; break; case 35: if (_vm->_globals._prevScreenId == 16) @@ -3346,25 +3346,25 @@ void ObjectsManager::handleSpecialGames() { break; case 57: _vm->_globals._disableInventFl = true; - if (_vm->_globals._saveData->data[svField261] == 1 && BOBPOSI(5) == 37) { + if (_vm->_globals._saveData->_data[svField261] == 1 && BOBPOSI(5) == 37) { stopBobAnimation(5); SET_BOBPOSI(5, 0); setBobAnimation(6); - _vm->_globals._saveData->data[svField261] = 2; + _vm->_globals._saveData->_data[svField261] = 2; disableZone(15); _vm->_soundManager.playSound("SOUND75.WAV"); } - if (_vm->_globals._saveData->data[svField261] == 2 && BOBPOSI(6) == 6) { + if (_vm->_globals._saveData->_data[svField261] == 2 && BOBPOSI(6) == 6) { stopBobAnimation(6); SET_BOBPOSI(6, 0); setBobAnimation(7); enableZone(14); - _vm->_globals._saveData->data[svField261] = 3; + _vm->_globals._saveData->_data[svField261] = 3; } _vm->_globals._disableInventFl = false; break; case 93: - if (_vm->_globals._saveData->data[svField333]) + if (_vm->_globals._saveData->_data[svField333]) break; _vm->_globals._disableInventFl = true; @@ -3374,7 +3374,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); stopBobAnimation(8); - _vm->_globals._saveData->data[svField333] = 1; + _vm->_globals._saveData->_data[svField333] = 1; _vm->_globals._disableInventFl = false; break; } @@ -3876,9 +3876,9 @@ void ObjectsManager::SPECIAL_INI() { } if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(383, 4); - _vm->_globals._saveData->data[svField270] = 1; - _vm->_globals._saveData->data[svField300] = 1; - _vm->_globals._saveData->data[svField320] = 1; + _vm->_globals._saveData->_data[svField270] = 1; + _vm->_globals._saveData->_data[svField300] = 1; + _vm->_globals._saveData->_data[svField320] = 1; if (_vm->_soundManager._voiceOffFl) { for (int i = 0; i <= 199; i++) _vm->_eventsManager.VBL(); @@ -3932,20 +3932,20 @@ void ObjectsManager::SPECIAL_INI() { _vm->_globals.ZONEP[22].field12 = 30; _vm->_globals.ZONEP[23].field12 = 30; for (int i = 200; i <= 214; i++) { - if (_vm->_globals._saveData->data[i] != 2) - _vm->_globals._saveData->data[i] = 0; + if (_vm->_globals._saveData->_data[i] != 2) + _vm->_globals._saveData->_data[i] = 0; } break; case 73: - if (!_vm->_globals._saveData->data[svField318]) { + if (!_vm->_globals._saveData->_data[svField318]) { _vm->_globals.CACHE_SUB(0); _vm->_globals.CACHE_SUB(1); } break; case 93: - if (!_vm->_globals._saveData->data[svField333]) + if (!_vm->_globals._saveData->_data[svField333]) setBobAnimation(8); break; } @@ -4361,22 +4361,22 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in break; } - if (_vm->_globals._saveData->data[savegameIdx] == 2) + if (_vm->_globals._saveData->_data[savegameIdx] == 2) return; - if (_vm->_globals._saveData->data[savegameIdx]) { - if (_vm->_globals._saveData->data[savegameIdx] == 1) { + if (_vm->_globals._saveData->_data[savegameIdx]) { + if (_vm->_globals._saveData->_data[savegameIdx] == 1) { if (((idx == 1 || idx == 2) && BOBPOSI(idx) == 26) || ((idx == 3 || idx == 4) && BOBPOSI(idx) == 27)) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_globals._saveData->data[savegameIdx] = 4; + _vm->_globals._saveData->_data[savegameIdx] = 4; } } - if (_vm->_globals._saveData->data[savegameIdx] == 4) { + if (_vm->_globals._saveData->_data[savegameIdx] == 4) { if (idx >= 1 && idx <= 4 && BOBPOSI(idx) > 30) - _vm->_globals._saveData->data[savegameIdx] = 3; + _vm->_globals._saveData->_data[savegameIdx] = 3; } - if (_vm->_globals._saveData->data[savegameIdx] == 3) { + if (_vm->_globals._saveData->_data[savegameIdx] == 3) { _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); _vm->_globals._exitId = 150; @@ -4392,7 +4392,7 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in && maxY > getSpriteY(0)) { if (idx >= 1 && idx <= 4) setBobAnimation(idx); - _vm->_globals._saveData->data[savegameIdx] = 1; + _vm->_globals._saveData->_data[savegameIdx] = 1; } } @@ -4525,18 +4525,18 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); if (_vm->_globals.PERSO_TYPE) { - if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { + if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) { _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; } } if (!_vm->_globals.PERSO_TYPE) { - if (_vm->_globals._saveData->data[svField122] == 1) { + if (_vm->_globals._saveData->_data[svField122] == 1) { _vm->_globals.PERSO = _vm->_fileManager.loadFile("HOPFEM.SPR"); _vm->_globals.PERSO_TYPE = 1; } } - if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->data[svField356] == 1) { + if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->_data[svField356] == 1) { _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); _vm->_globals.PERSO_TYPE = 2; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 347851f5dd..97e98a8309 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -35,7 +35,7 @@ struct SpriteItem { int _animationType; const byte *_spriteData; Common::Point _spritePos; - int fieldC; + int _zoomfactor; int fieldE; int _spriteIndex; int field12; @@ -136,12 +136,12 @@ public: int getSpriteY(int idx); void clearSprite(); void animateSprite(int idx); - void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); + void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, int a7, int a8, int a9); void removeSprite(int idx); void setSpriteX(int idx, int xp); void setSpriteIndex(int idx, int spriteIndex); void setSpriteY(int idx, int yp); - void setSpriteSize(int idx, int size); + void setSpriteZoom(int idx, int zoomFactor); void setFlipSprite(int idx, bool flip); void checkZone(); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 35d52005bb..2db3cce3ee 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -140,7 +140,7 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName) { /* Pack any necessary data into the savegame data structure */ // Set the selected slot number - _vm->_globals._saveData->data[svField10] = slot; + _vm->_globals._saveData->_data[svField10] = slot; // Set up the inventory for (int i = 0; i < 35; ++i) @@ -201,9 +201,9 @@ Common::Error SaveLoadManager::loadGame(int slot) { _vm->_globals._inventory[i] = _vm->_globals._saveData->_inventory[i]; // Set variables from loaded data as necessary - _vm->_globals._saveData->data[svField10] = slot; - _vm->_globals._exitId = _vm->_globals._saveData->data[svField5]; - _vm->_globals._saveData->data[svField6] = 0; + _vm->_globals._saveData->_data[svField10] = slot; + _vm->_globals._exitId = _vm->_globals._saveData->_data[svField5]; + _vm->_globals._saveData->_data[svField6] = 0; _vm->_globals._screenId = 0; _vm->_globals._mapCarPosX = _vm->_globals._saveData->_mapCarPosX; _vm->_globals._mapCarPosY = _vm->_globals._saveData->_mapCarPosY; @@ -257,7 +257,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { - s.syncBytes(&_vm->_globals._saveData->data[0], 2050); + s.syncBytes(&_vm->_globals._saveData->_data[0], 2050); syncCharacterLocation(s, _vm->_globals._saveData->_cloneHopkins); syncCharacterLocation(s, _vm->_globals._saveData->_realHopkins); syncCharacterLocation(s, _vm->_globals._saveData->_samantha); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 44e95f2de5..77ffc5bee0 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -53,7 +53,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int mesgId = (int16)READ_LE_UINT16(dataP + 13); opcodeType = 1; if (!TRAVAILOBJET) { - if (_vm->_globals._saveData->data[svField356] == 1) { + if (_vm->_globals._saveData->_data[svField356] == 1) { if (mesgId == 53) mesgId = 644; if (mesgId == 624) @@ -139,7 +139,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.mixVoice(mesgId, 4); } if (TRAVAILOBJET) { - if (_vm->_globals._saveData->data[svField356]) { + if (_vm->_globals._saveData->_data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, dataP[8], 35, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); @@ -198,27 +198,27 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager._characterPos.y = (int16)READ_LE_UINT16(dataP + 8); _vm->_objectsManager.PERI = dataP[5]; if (_vm->_objectsManager._changeHeadFl) { - if (_vm->_globals._saveData->data[svField354] == 1 + if (_vm->_globals._saveData->_data[svField354] == 1 && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y && _vm->_globals._saveData->_cloneHopkins.field2 && _vm->_globals._saveData->_cloneHopkins._location) { _vm->_objectsManager._characterPos = _vm->_globals._saveData->_cloneHopkins._pos; _vm->_objectsManager.PERI = _vm->_globals._saveData->_cloneHopkins.field2; } - if (_vm->_globals._saveData->data[svField356] == 1 + if (_vm->_globals._saveData->_data[svField356] == 1 && _vm->_globals._saveData->_samantha._pos.x && _vm->_globals._saveData->_samantha._pos.y && _vm->_globals._saveData->_samantha.field2 && _vm->_globals._saveData->_samantha._location) { _vm->_objectsManager._characterPos = _vm->_globals._saveData->_samantha._pos; _vm->_objectsManager.PERI = _vm->_globals._saveData->_samantha.field2; } - if (_vm->_globals._saveData->data[svField357] == 1 + if (_vm->_globals._saveData->_data[svField357] == 1 && _vm->_globals._saveData->_realHopkins._pos.x && _vm->_globals._saveData->_realHopkins._pos.y && _vm->_globals._saveData->_realHopkins.field2 && _vm->_globals._saveData->_realHopkins._location) { _vm->_objectsManager._characterPos = _vm->_globals._saveData->_realHopkins._pos; _vm->_objectsManager.PERI = _vm->_globals._saveData->_realHopkins.field2; } } - if (_vm->_globals._saveData->data[svField356] == 1 + if (_vm->_globals._saveData->_data[svField356] == 1 && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { _vm->_objectsManager.addStaticSprite( _vm->_globals.TETE, @@ -232,8 +232,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.animateSprite(1); _vm->_objectsManager._twoCharactersFl = true; } - if (_vm->_globals._saveData->data[svField357] == 1 - && _vm->_globals._saveData->data[svField355] == 1 + if (_vm->_globals._saveData->_data[svField357] == 1 + && _vm->_globals._saveData->_data[svField355] == 1 && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { _vm->_objectsManager.addStaticSprite( _vm->_globals.TETE, @@ -253,8 +253,8 @@ int ScriptManager::handleOpcode(byte *dataP) { } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { if (!_vm->_objectsManager._disableFl) { _vm->_globals._prevScreenId = _vm->_globals._screenId; - _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; - _vm->_globals._screenId = _vm->_globals._saveData->data[svField5] = dataP[5]; + _vm->_globals._saveData->_data[svField6] = _vm->_globals._screenId; + _vm->_globals._screenId = _vm->_globals._saveData->_data[svField5] = dataP[5]; v70 = dataP[6]; } opcodeType = 1; @@ -264,7 +264,7 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 1; } else if (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') { int specialOpcode = (int16)READ_LE_UINT16(dataP + 5); - if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) { + if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) { v70 = 0; switch (specialOpcode) { @@ -631,7 +631,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 27: - if (_vm->_globals._saveData->data[svField94] != 1 || _vm->_globals._saveData->data[svField95] != 1) + if (_vm->_globals._saveData->_data[svField94] != 1 || _vm->_globals._saveData->_data[svField95] != 1) _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); else _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); @@ -660,19 +660,19 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 36: - if (_vm->_globals._saveData->data[svField270] == 2 && _vm->_globals._saveData->data[svField94] == 1 && _vm->_globals._saveData->data[svField95] == 1) - _vm->_globals._saveData->data[svField270] = 3; - if (!_vm->_globals._saveData->data[svField270]) + if (_vm->_globals._saveData->_data[svField270] == 2 && _vm->_globals._saveData->_data[svField94] == 1 && _vm->_globals._saveData->_data[svField95] == 1) + _vm->_globals._saveData->_data[svField270] = 3; + if (!_vm->_globals._saveData->_data[svField270]) _vm->_talkManager.PARLER_PERSO2("PATRON0.pe2"); - if (_vm->_globals._saveData->data[svField270] == 1) + if (_vm->_globals._saveData->_data[svField270] == 1) _vm->_talkManager.PARLER_PERSO2("PATRON1.pe2"); - if (_vm->_globals._saveData->data[svField270] == 2) + if (_vm->_globals._saveData->_data[svField270] == 2) _vm->_talkManager.PARLER_PERSO2("PATRON2.pe2"); - if (_vm->_globals._saveData->data[svField270] == 3) + if (_vm->_globals._saveData->_data[svField270] == 3) _vm->_talkManager.PARLER_PERSO2("PATRON3.pe2"); - if (_vm->_globals._saveData->data[svField270] > 3) { + if (_vm->_globals._saveData->_data[svField270] > 3) { _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); - _vm->_globals._saveData->data[svField270] = 5; + _vm->_globals._saveData->_data[svField270] = 5; } break; @@ -810,7 +810,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); int v19 = 12; - if (_vm->_globals._saveData->data[svField133] == 1) + if (_vm->_globals._saveData->_data[svField133] == 1) v19 = 41; int v20 = 0; do { @@ -907,7 +907,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 56: _vm->_globals.PERSO = _vm->_fileManager.loadFile("HOPFEM.SPR"); _vm->_globals.PERSO_TYPE = 1; - _vm->_globals._saveData->data[svField122] = 1; + _vm->_globals._saveData->_data[svField122] = 1; _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 28; _vm->_objectsManager._sprite[0].field14 = 155; @@ -917,7 +917,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 57: _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; - _vm->_globals._saveData->data[svField122] = 0; + _vm->_globals._saveData->_data[svField122] = 0; _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 34; _vm->_objectsManager._sprite[0].field14 = 190; @@ -927,8 +927,8 @@ int ScriptManager::handleOpcode(byte *dataP) { case 58: _vm->_globals.NOPARLE = true; _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); - _vm->_globals._saveData->data[svField176] = 1; - _vm->_globals._saveData->data[svField270] = 2; + _vm->_globals._saveData->_data[svField176] = 1; + _vm->_globals._saveData->_data[svField270] = 2; _vm->_globals.NOPARLE = false; break; @@ -1128,7 +1128,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 86: - if (_vm->_globals._saveData->data[svField231] == 1) { + if (_vm->_globals._saveData->_data[svField231] == 1) { _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); } else { _vm->_globals.NOPARLE = true; @@ -1138,14 +1138,14 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 87: - if (_vm->_globals._saveData->data[svField188]) + if (_vm->_globals._saveData->_data[svField188]) _vm->_talkManager.PARLER_PERSO("stand2.pe2"); else _vm->_talkManager.PARLER_PERSO("stand1.pe2"); break; case 88: - if (_vm->_globals._saveData->data[svField183] == 1) { + if (_vm->_globals._saveData->_data[svField183] == 1) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(2, 0); _vm->_objectsManager.setBobAnimation(1); @@ -1187,7 +1187,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } - if (_vm->_globals._saveData->data[svField183] == 2) { + if (_vm->_globals._saveData->_data[svField183] == 2) { _vm->_objectsManager.SET_BOBPOSI(1, 0); _vm->_objectsManager.SET_BOBPOSI(3, 0); _vm->_objectsManager.setBobAnimation(1); @@ -1233,11 +1233,11 @@ int ScriptManager::handleOpcode(byte *dataP) { case 90: _vm->_soundManager.playSound("SOUND52.WAV"); - if (!_vm->_globals._saveData->data[svField186]) { + if (!_vm->_globals._saveData->_data[svField186]) { _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } - if (_vm->_globals._saveData->data[svField186] == 1) { + if (_vm->_globals._saveData->_data[svField186] == 1) { _vm->_animationManager.playSequence("CIB5C.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 329, 87, 2); @@ -1246,11 +1246,11 @@ int ScriptManager::handleOpcode(byte *dataP) { case 91: _vm->_soundManager.playSound("SOUND52.WAV"); - if (!_vm->_globals._saveData->data[svField186]) { + if (!_vm->_globals._saveData->_data[svField186]) { _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } - if (_vm->_globals._saveData->data[svField186] == 1) { + if (_vm->_globals._saveData->_data[svField186] == 1) { _vm->_animationManager.playSequence("CIB5D.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); @@ -1259,11 +1259,11 @@ int ScriptManager::handleOpcode(byte *dataP) { case 92: _vm->_soundManager.playSound("SOUND52.WAV"); - if (!_vm->_globals._saveData->data[svField184]) { + if (!_vm->_globals._saveData->_data[svField184]) { _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); } - if (_vm->_globals._saveData->data[svField184] == 1) { + if (_vm->_globals._saveData->_data[svField184] == 1) { _vm->_animationManager.playSequence("CIB6C.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 293, 139, 3); @@ -1272,11 +1272,11 @@ int ScriptManager::handleOpcode(byte *dataP) { case 93: _vm->_soundManager.playSound("SOUND52.WAV"); - if (!_vm->_globals._saveData->data[svField184]) { + if (!_vm->_globals._saveData->_data[svField184]) { _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); } - if (_vm->_globals._saveData->data[svField184] == 1) { + if (_vm->_globals._saveData->_data[svField184] == 1) { _vm->_animationManager.playSequence("CIB6D.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); @@ -1284,9 +1284,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 94: - if (!_vm->_globals._saveData->data[svField228]) + if (!_vm->_globals._saveData->_data[svField228]) _vm->_talkManager.PARLER_PERSO("flicn.pe2"); - if (_vm->_globals._saveData->data[svField228] == 1) + if (_vm->_globals._saveData->_data[svField228] == 1) _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); break; @@ -1358,17 +1358,17 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals._saveData->data[svField253] == 1) { + if (_vm->_globals._saveData->_data[svField253] == 1) { int v27 = _vm->_objectsManager.getSpriteY(0); int v28 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); } - if (_vm->_globals._saveData->data[svField253] == 2) { + if (_vm->_globals._saveData->_data[svField253] == 2) { int v29 = _vm->_objectsManager.getSpriteY(0); int v30 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); } - if (_vm->_globals._saveData->data[svField253] > 2) { + if (_vm->_globals._saveData->_data[svField253] > 2) { int v31 = _vm->_objectsManager.getSpriteY(0); int v32 = _vm->_objectsManager.getSpriteX(0); _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); @@ -1384,7 +1384,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.loadSample(1, "SOUND63.WAV"); - if (_vm->_globals._saveData->data[svField253] > 2) { + if (_vm->_globals._saveData->_data[svField253] > 2) { _vm->_objectsManager.setBobAnimation(4); int v33 = 0; do { @@ -1413,7 +1413,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.BOBPOSI(4) != 72); _vm->_objectsManager.stopBobAnimation(4); } - if (_vm->_globals._saveData->data[svField253] == 1) { + if (_vm->_globals._saveData->_data[svField253] == 1) { _vm->_objectsManager.setBobAnimation(6); int v34 = 0; do { @@ -1442,7 +1442,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.BOBPOSI(6) != 72); _vm->_objectsManager.stopBobAnimation(6); } - if (_vm->_globals._saveData->data[svField253] == 2) { + if (_vm->_globals._saveData->_data[svField253] == 2) { _vm->_objectsManager.setBobAnimation(5); int v35 = 0; do { @@ -1810,7 +1810,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 208: { _vm->_globals._disableInventFl = true; - if (_vm->_globals._saveData->data[svField6] != _vm->_globals._saveData->data[svField401]) { + if (_vm->_globals._saveData->_data[svField6] != _vm->_globals._saveData->_data[svField401]) { _vm->_soundManager._specialSoundNum = 208; _vm->_eventsManager._disableEscKeyFl = true; _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); @@ -1832,7 +1832,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); - _vm->_globals._exitId = _vm->_globals._saveData->data[svField401]; + _vm->_globals._exitId = _vm->_globals._saveData->_data[svField401]; _vm->_globals._disableInventFl = false; break; } @@ -2045,7 +2045,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 236: { - char v47 = _vm->_globals._saveData->data[svField341]; + char v47 = _vm->_globals._saveData->_data[svField341]; if (v47) { if (v47 == 2) v70 = 5; @@ -2055,18 +2055,18 @@ int ScriptManager::handleOpcode(byte *dataP) { v70 = 6; _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals._saveData->data[svField341] == 1) + if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals._saveData->data[svField341] == 2) + if (_vm->_globals._saveData->_data[svField341] == 2) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals._saveData->data[svField341] == 3) + if (_vm->_globals._saveData->_data[svField341] == 3) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals._saveData->data[svField341] == 1) - _vm->_globals._saveData->data[svField338] = 0; - if (_vm->_globals._saveData->data[svField341] == 2) - _vm->_globals._saveData->data[svField339] = 0; - if (_vm->_globals._saveData->data[svField341] == 3) - _vm->_globals._saveData->data[svField340] = 0; + if (_vm->_globals._saveData->_data[svField341] == 1) + _vm->_globals._saveData->_data[svField338] = 0; + if (_vm->_globals._saveData->_data[svField341] == 2) + _vm->_globals._saveData->_data[svField339] = 0; + if (_vm->_globals._saveData->_data[svField341] == 3) + _vm->_globals._saveData->_data[svField340] = 0; } _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); @@ -2075,7 +2075,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 237: { - char v48 = _vm->_globals._saveData->data[svField341]; + char v48 = _vm->_globals._saveData->_data[svField341]; if (v48) { if (v48 == 2) v70 = 5; @@ -2085,18 +2085,18 @@ int ScriptManager::handleOpcode(byte *dataP) { v70 = 6; _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals._saveData->data[svField341] == 1) + if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals._saveData->data[svField341] == 2) + if (_vm->_globals._saveData->_data[svField341] == 2) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals._saveData->data[svField341] == 3) + if (_vm->_globals._saveData->_data[svField341] == 3) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals._saveData->data[svField341] == 1) - _vm->_globals._saveData->data[svField338] = 0; - if (_vm->_globals._saveData->data[svField341] == 2) - _vm->_globals._saveData->data[svField339] = 0; - if (_vm->_globals._saveData->data[svField341] == 3) - _vm->_globals._saveData->data[svField340] = 0; + if (_vm->_globals._saveData->_data[svField341] == 1) + _vm->_globals._saveData->_data[svField338] = 0; + if (_vm->_globals._saveData->_data[svField341] == 2) + _vm->_globals._saveData->_data[svField339] = 0; + if (_vm->_globals._saveData->_data[svField341] == 3) + _vm->_globals._saveData->_data[svField340] = 0; } _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); @@ -2105,7 +2105,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 238: { - char v49 = _vm->_globals._saveData->data[svField341]; + char v49 = _vm->_globals._saveData->_data[svField341]; if (v49) { if (v49 == 2) v70 = 5; @@ -2115,18 +2115,18 @@ int ScriptManager::handleOpcode(byte *dataP) { v70 = 6; _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); - if (_vm->_globals._saveData->data[svField341] == 1) + if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); - if (_vm->_globals._saveData->data[svField341] == 2) + if (_vm->_globals._saveData->_data[svField341] == 2) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 2); - if (_vm->_globals._saveData->data[svField341] == 3) + if (_vm->_globals._saveData->_data[svField341] == 3) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 4); - if (_vm->_globals._saveData->data[svField341] == 1) - _vm->_globals._saveData->data[svField338] = 0; - if (_vm->_globals._saveData->data[svField341] == 2) - _vm->_globals._saveData->data[svField339] = 0; - if (_vm->_globals._saveData->data[svField341] == 3) - _vm->_globals._saveData->data[svField340] = 0; + if (_vm->_globals._saveData->_data[svField341] == 1) + _vm->_globals._saveData->_data[svField338] = 0; + if (_vm->_globals._saveData->_data[svField341] == 2) + _vm->_globals._saveData->_data[svField339] = 0; + if (_vm->_globals._saveData->_data[svField341] == 3) + _vm->_globals._saveData->_data[svField340] = 0; } _vm->_soundManager.playSound("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); @@ -2181,10 +2181,10 @@ int ScriptManager::handleOpcode(byte *dataP) { v51->_pos.y = _vm->_objectsManager.getSpriteY(0); v51->field2 = 57; v51->_location = 97; - _vm->_globals._saveData->data[svField121] = 1; - _vm->_globals._saveData->data[svField352] = 1; - _vm->_globals._saveData->data[svField353] = 1; - _vm->_globals._saveData->data[svField354] = 1; + _vm->_globals._saveData->_data[svField121] = 1; + _vm->_globals._saveData->_data[svField352] = 1; + _vm->_globals._saveData->_data[svField353] = 1; + _vm->_globals._saveData->_data[svField354] = 1; break; } @@ -2208,10 +2208,10 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; v53->field4 = -(100 * (67 - (100 - v54)) / 67); - _vm->_globals._saveData->data[svField357] = 1; - _vm->_globals._saveData->data[svField354] = 0; - _vm->_globals._saveData->data[svField356] = 0; - _vm->_globals._saveData->data[svField355] = 1; + _vm->_globals._saveData->_data[svField357] = 1; + _vm->_globals._saveData->_data[svField354] = 0; + _vm->_globals._saveData->_data[svField356] = 0; + _vm->_globals._saveData->_data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); @@ -2221,7 +2221,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 243: _vm->_soundManager.playSound("SOUND88.WAV"); - if (_vm->_globals._saveData->data[svField341] == 2) { + if (_vm->_globals._saveData->_data[svField341] == 2) { _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); _vm->_animationManager.NO_SEQ = false; @@ -2236,7 +2236,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.ZONEP[4]._destX = 276; _vm->_objectsManager.enableVerb(4, 19); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); - _vm->_globals._saveData->data[svField399] = 1; + _vm->_globals._saveData->_data[svField399] = 1; break; case 246: @@ -2375,11 +2375,11 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 1; int idx = (int16)READ_LE_UINT16(dataP + 5); assert(idx >= 0 && idx < 2050); - _vm->_globals._saveData->data[idx] = dataP[7]; - _vm->_globals._saveData->data[idx + 1] = dataP[8]; + _vm->_globals._saveData->_data[idx] = dataP[7]; + _vm->_globals._saveData->_data[idx + 1] = dataP[8]; } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { opcodeType = 1; - _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; + _vm->_globals._saveData->_data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') { opcodeType = 1; _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); @@ -2459,24 +2459,24 @@ LABEL_2: int saveDataIdx1 = (int16)READ_LE_UINT16(buf + 5); int compVal1 = (int16)READ_LE_UINT16(buf + 7); bool check1Fl = false; - if ((oper == 1 && _vm->_globals._saveData->data[saveDataIdx1] == compVal1) || - (oper == 2 && _vm->_globals._saveData->data[saveDataIdx1] != compVal1) || - (oper == 3 && _vm->_globals._saveData->data[saveDataIdx1] <= compVal1) || - (oper == 4 && _vm->_globals._saveData->data[saveDataIdx1] >= compVal1) || - (oper == 5 && _vm->_globals._saveData->data[saveDataIdx1] > compVal1) || - (oper == 6 && _vm->_globals._saveData->data[saveDataIdx1] < compVal1)) + if ((oper == 1 && _vm->_globals._saveData->_data[saveDataIdx1] == compVal1) || + (oper == 2 && _vm->_globals._saveData->_data[saveDataIdx1] != compVal1) || + (oper == 3 && _vm->_globals._saveData->_data[saveDataIdx1] <= compVal1) || + (oper == 4 && _vm->_globals._saveData->_data[saveDataIdx1] >= compVal1) || + (oper == 5 && _vm->_globals._saveData->_data[saveDataIdx1] > compVal1) || + (oper == 6 && _vm->_globals._saveData->_data[saveDataIdx1] < compVal1)) check1Fl = true; bool check2Fl = false; if (operType != 3) { int saveDataIdx2 = (int16)READ_LE_UINT16(buf + 9); int compVal2 = (int16)READ_LE_UINT16(buf + 11); - if ((oper2 == 1 && compVal2 == _vm->_globals._saveData->data[saveDataIdx2]) || - (oper2 == 2 && compVal2 != _vm->_globals._saveData->data[saveDataIdx2]) || - (oper2 == 3 && compVal2 >= _vm->_globals._saveData->data[saveDataIdx2]) || - (oper2 == 4 && compVal2 <= _vm->_globals._saveData->data[saveDataIdx2]) || - (oper2 == 5 && compVal2 < _vm->_globals._saveData->data[saveDataIdx2]) || - (oper2 == 6 && compVal2 > _vm->_globals._saveData->data[saveDataIdx2])) + if ((oper2 == 1 && compVal2 == _vm->_globals._saveData->_data[saveDataIdx2]) || + (oper2 == 2 && compVal2 != _vm->_globals._saveData->_data[saveDataIdx2]) || + (oper2 == 3 && compVal2 >= _vm->_globals._saveData->_data[saveDataIdx2]) || + (oper2 == 4 && compVal2 <= _vm->_globals._saveData->_data[saveDataIdx2]) || + (oper2 == 5 && compVal2 < _vm->_globals._saveData->_data[saveDataIdx2]) || + (oper2 == 6 && compVal2 > _vm->_globals._saveData->_data[saveDataIdx2])) check2Fl = true; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 9140c3efd9..23b9dcf0a2 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -64,7 +64,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterBuffer = _vm->_fileManager.loadFile(filename); _characterSize = _vm->_fileManager.fileSize(filename); } - _vm->_globals._saveData->data[svField4] = 0; + _vm->_globals._saveData->_data[svField4] = 0; getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); @@ -163,7 +163,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _characterSize = _vm->_fileManager.fileSize(filename); } - _vm->_globals._saveData->data[svField4] = 0; + _vm->_globals._saveData->_data[svField4] = 0; getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); @@ -357,7 +357,7 @@ int TalkManager::DIALOGUE_REP(int idx) { v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9); if (v7) - _vm->_globals._saveData->data[svField4] = v7; + _vm->_globals._saveData->_data[svField4] = v7; if (!v6) v6 = 10; @@ -897,7 +897,7 @@ LABEL_2: } } while (!loopCond); _vm->_globals.freeMemory(ptr); - _vm->_globals._saveData->data[svField2] = 0; + _vm->_globals._saveData->_data[svField2] = 0; return; } } @@ -906,7 +906,7 @@ LABEL_2: void TalkManager::REPONSE2(int a1, int a2) { int indx = 0; - if (a2 != 5 || _vm->_globals._saveData->data[svField3] != 4) + if (a2 != 5 || _vm->_globals._saveData->_data[svField3] != 4) return; if (a1 == 22 || a1 == 23) { @@ -954,7 +954,7 @@ void TalkManager::REPONSE2(int a1, int a2) { indx = 213; break; } - _vm->_globals._saveData->data[indx] = 2; + _vm->_globals._saveData->_data[indx] = 2; _vm->_objectsManager.disableZone(22); _vm->_objectsManager.disableZone(23); } else if (a1 == 20 || a1 == 21) { @@ -1001,7 +1001,7 @@ void TalkManager::REPONSE2(int a1, int a2) { indx = 212; break; } - _vm->_globals._saveData->data[indx] = 2; + _vm->_globals._saveData->_data[indx] = 2; _vm->_objectsManager.disableZone(21); _vm->_objectsManager.disableZone(20); } -- cgit v1.2.3 From 2cd0d1f4a1440bbd7d56ab8317cbc3f0fad7eb30 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Jan 2013 19:15:37 +0100 Subject: Hopkins: More renaming --- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 201 +++++++++++++------------------------------ engines/hopkins/objects.h | 2 +- engines/hopkins/saveload.cpp | 2 +- engines/hopkins/script.cpp | 8 +- 5 files changed, 68 insertions(+), 147 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 92f6b29e71..5d8acda8e2 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -187,7 +187,7 @@ struct CharacterLocation { Common::Point _pos; int field2; int _location; - int field4; + int _zoomFactor; }; enum SauvegardeOffset { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e3df43dc6b..57cbb83c0b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -830,12 +830,12 @@ void ObjectsManager::computeSprite(int idx) { int zoomPercent = 0; int reducePercent = 0; - if (_sprite[idx]._zoomfactor < 0) { - reducePercent = -_sprite[idx]._zoomfactor; + if (_sprite[idx]._zoomFactor < 0) { + reducePercent = -_sprite[idx]._zoomFactor; if (reducePercent > 95) reducePercent = 95; } else - zoomPercent = _sprite[idx]._zoomfactor; + zoomPercent = _sprite[idx]._zoomFactor; if (zoomPercent) { if (tmpX >= 0) @@ -1218,7 +1218,7 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, _sprite[idx]._spriteData = spriteData; _sprite[idx]._spritePos = pos; _sprite[idx]._spriteIndex = spriteIndex; - _sprite[idx]._zoomfactor = zoomFactor; + _sprite[idx]._zoomFactor = zoomFactor; _sprite[idx].fieldE = a7; _sprite[idx].field12 = a8; _sprite[idx].field14 = a9; @@ -1226,7 +1226,7 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { _sprite[idx]._rleFl = true; - _sprite[idx]._zoomfactor = 0; + _sprite[idx]._zoomFactor = 0; _sprite[idx].fieldE = 0; } else _sprite[idx]._rleFl = false; @@ -1269,7 +1269,7 @@ void ObjectsManager::setSpriteIndex(int idx, int spriteIndex) { void ObjectsManager::setSpriteZoom(int idx, int zoomFactor) { assert (idx <= MAX_SPRITE); if (!_sprite[idx]._rleFl) - _sprite[idx]._zoomfactor = zoomFactor; + _sprite[idx]._zoomFactor = zoomFactor; } void ObjectsManager::setFlipSprite(int idx, bool flip) { @@ -1382,36 +1382,16 @@ void ObjectsManager::GOHOME() { int16 v4; int16 v9; int16 v10; - int v15; int16 v16; - int v19; int16 v20; - unsigned int v21; - unsigned int v22; int16 v23; int16 v24; - unsigned int v25; - unsigned int v26; - unsigned int v27; - unsigned int v28; int16 v29; int16 v30; - unsigned int v31; - unsigned int v32; - unsigned int v33; - unsigned int v34; int16 v35; int16 v36; - unsigned int v37; - unsigned int v38; - unsigned int v39; - unsigned int v40; int16 v41; int16 v42; - unsigned int v43; - unsigned int v44; - unsigned int v45; - unsigned int v46; int v49; int v54; int16 v58; @@ -1484,12 +1464,12 @@ void ObjectsManager::GOHOME() { v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0]._zoomfactor < 0) { - v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomfactor); - v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0]._zoomfactor); - } else if (_sprite[0]._zoomfactor > 0) { - v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0]._zoomfactor); - v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0]._zoomfactor); + if (_sprite[0]._zoomFactor < 0) { + v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomFactor); + v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0]._zoomFactor); + } else if (_sprite[0]._zoomFactor > 0) { + v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0]._zoomFactor); + v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0]._zoomFactor); } v0 = v3 + g_old_x; v58 = g_old_y + v4; @@ -1507,13 +1487,12 @@ void ObjectsManager::GOHOME() { } else { v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0]._zoomfactor < 0) { - v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomfactor); - v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomfactor); - } - if (_sprite[0]._zoomfactor > 0) { - v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0]._zoomfactor); - v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0]._zoomfactor); + if (_sprite[0]._zoomFactor < 0) { + v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomFactor); + v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomFactor); + } else if (_sprite[0]._zoomFactor > 0) { + v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0]._zoomFactor); + v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0]._zoomFactor); } v0 = g_old_x - v9; v58 = g_old_y - v10; @@ -1529,13 +1508,11 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 0; } else { - v15 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); - v16 = v15; - if (_sprite[0]._zoomfactor < 0) { - v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomfactor); - } - if (_sprite[0]._zoomfactor > 0) { - v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0]._zoomfactor); + v16 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + if (_sprite[0]._zoomFactor < 0) { + v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomFactor); + } else if (_sprite[0]._zoomFactor > 0) { + v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0]._zoomFactor); } v0 = g_old_x; v58 = g_old_y - v16; @@ -1552,19 +1529,11 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 48; } else { - v19 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); - v20 = v19; - if (_sprite[0]._zoomfactor < 0) { - v21 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v21 = -_sprite[0]._zoomfactor; - v20 = _vm->_graphicsManager.zoomOut(v20, v21); - } - if (_sprite[0]._zoomfactor > 0) { - v22 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v22 = -_sprite[0]._zoomfactor; - v20 = _vm->_graphicsManager.zoomIn(v20, v22); + v20 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + if (_sprite[0]._zoomFactor < 0) { + v20 = _vm->_graphicsManager.zoomOut(v20, -_sprite[0]._zoomFactor); + } else if (_sprite[0]._zoomFactor > 0) { + v20 = _vm->_graphicsManager.zoomIn(v20, _sprite[0]._zoomFactor); } v0 = g_old_x; v58 = v20 + g_old_y; @@ -1582,25 +1551,13 @@ void ObjectsManager::GOHOME() { } else { v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0]._zoomfactor < 0) { - v25 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v25 = -_sprite[0]._zoomfactor; - v23 = _vm->_graphicsManager.zoomOut(v23, v25); - v26 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v26 = -_sprite[0]._zoomfactor; - v24 = _vm->_graphicsManager.zoomOut(v24, v26); + if (_sprite[0]._zoomFactor < 0) { + v23 = _vm->_graphicsManager.zoomOut(v23, -_sprite[0]._zoomFactor); + v24 = _vm->_graphicsManager.zoomOut(v24, -_sprite[0]._zoomFactor); } - if (_sprite[0]._zoomfactor > 0) { - v27 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v27 = -_sprite[0]._zoomfactor; - v23 = _vm->_graphicsManager.zoomIn(v23, v27); - v28 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v28 = -_sprite[0]._zoomfactor; - v24 = _vm->_graphicsManager.zoomIn(v24, v28); + if (_sprite[0]._zoomFactor > 0) { + v23 = _vm->_graphicsManager.zoomIn(v23, _sprite[0]._zoomFactor); + v24 = _vm->_graphicsManager.zoomIn(v24, _sprite[0]._zoomFactor); } v0 = v23 + g_old_x; v58 = g_old_y + v24; @@ -1618,24 +1575,12 @@ void ObjectsManager::GOHOME() { } else { v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0]._zoomfactor < 0) { - v31 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v31 = -_sprite[0]._zoomfactor; - v29 = _vm->_graphicsManager.zoomOut(v29, v31); - v32 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v32 = -_sprite[0]._zoomfactor; - v30 = _vm->_graphicsManager.zoomOut(v30, v32); - } else if (_sprite[0]._zoomfactor > 0) { - v33 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v33 = -_sprite[0]._zoomfactor; - v29 = _vm->_graphicsManager.zoomIn(v29, v33); - v34 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v34 = -_sprite[0]._zoomfactor; - v30 = _vm->_graphicsManager.zoomIn(v30, v34); + if (_sprite[0]._zoomFactor < 0) { + v29 = _vm->_graphicsManager.zoomOut(v29, -_sprite[0]._zoomFactor); + v30 = _vm->_graphicsManager.zoomOut(v30, -_sprite[0]._zoomFactor); + } else if (_sprite[0]._zoomFactor > 0) { + v29 = _vm->_graphicsManager.zoomIn(v29, _sprite[0]._zoomFactor); + v30 = _vm->_graphicsManager.zoomIn(v30, _sprite[0]._zoomFactor); } v0 = g_old_x - v29; v58 = g_old_y + v30; @@ -1653,25 +1598,13 @@ void ObjectsManager::GOHOME() { } else { v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0]._zoomfactor < 0) { - v37 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v37 = -_sprite[0]._zoomfactor; - v35 = _vm->_graphicsManager.zoomOut(v35, v37); - v38 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v38 = -_sprite[0]._zoomfactor; - v36 = _vm->_graphicsManager.zoomOut(v36, v38); + if (_sprite[0]._zoomFactor < 0) { + v35 = _vm->_graphicsManager.zoomOut(v35, -_sprite[0]._zoomFactor); + v36 = _vm->_graphicsManager.zoomOut(v36, -_sprite[0]._zoomFactor); } - if (_sprite[0]._zoomfactor > 0) { - v39 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v39 = -_sprite[0]._zoomfactor; - v35 = _vm->_graphicsManager.zoomIn(v35, v39); - v40 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v40 = -_sprite[0]._zoomfactor; - v36 = _vm->_graphicsManager.zoomIn(v36, v40); + if (_sprite[0]._zoomFactor > 0) { + v35 = _vm->_graphicsManager.zoomIn(v35, _sprite[0]._zoomFactor); + v36 = _vm->_graphicsManager.zoomIn(v36, _sprite[0]._zoomFactor); } v0 = v35 + g_old_x; v58 = g_old_y + v36; @@ -1689,25 +1622,13 @@ void ObjectsManager::GOHOME() { } else { v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; - if (_sprite[0]._zoomfactor < 0) { - v43 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v43 = -_sprite[0]._zoomfactor; - v41 = _vm->_graphicsManager.zoomOut(v41, v43); - v44 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v44 = -_sprite[0]._zoomfactor; - v42 = _vm->_graphicsManager.zoomOut(v42, v44); + if (_sprite[0]._zoomFactor < 0) { + v41 = _vm->_graphicsManager.zoomOut(v41, -_sprite[0]._zoomFactor); + v42 = _vm->_graphicsManager.zoomOut(v42, -_sprite[0]._zoomFactor); } - if (_sprite[0]._zoomfactor > 0) { - v45 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v45 = -_sprite[0]._zoomfactor; - v41 = _vm->_graphicsManager.zoomIn(v41, v45); - v46 = _sprite[0]._zoomfactor; - if (_sprite[0]._zoomfactor < 0) - v46 = -_sprite[0]._zoomfactor; - v42 = _vm->_graphicsManager.zoomIn(v42, v46); + if (_sprite[0]._zoomFactor > 0) { + v41 = _vm->_graphicsManager.zoomIn(v41, _sprite[0]._zoomFactor); + v42 = _vm->_graphicsManager.zoomIn(v42, _sprite[0]._zoomFactor); } v0 = g_old_x - v41; v58 = g_old_y + v42; @@ -2393,10 +2314,10 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0]._animationType; + loc->_zoomFactor = _sprite[0]._animationType; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->field4, 0, 20, 127); + addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->_zoomFactor, 0, 20, 127); animateSprite(1); removeSprite(0); @@ -2407,7 +2328,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; - addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 34, 190); + addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, 0, 34, 190); animateSprite(0); _vm->_globals.loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA @@ -2418,10 +2339,10 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0]._zoomfactor; + loc->_zoomFactor = _sprite[0]._zoomFactor; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->field4, 0, 34, 190); + addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->_zoomFactor, 0, 34, 190); animateSprite(1); removeSprite(0); @@ -2432,7 +2353,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); _vm->_globals.PERSO_TYPE = 2; - addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->field4, 0, 20, 127); + addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, 0, 20, 127); animateSprite(0); _vm->_globals.loadCharacterData(); } else { @@ -2443,7 +2364,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0]._zoomfactor; + loc->_zoomFactor = _sprite[0]._zoomFactor; break; case CHARACTER_HOPKINS_CLONE: loc = &_vm->_globals._saveData->_cloneHopkins; @@ -2451,7 +2372,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0]._zoomfactor; + loc->_zoomFactor = _sprite[0]._zoomFactor; break; case CHARACTER_SAMANTHA: loc = &_vm->_globals._saveData->_samantha; @@ -2459,7 +2380,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_pos.y = getSpriteY(0); loc->field2 = 64; loc->_location = _vm->_globals._screenId; - loc->field4 = _sprite[0]._zoomfactor; + loc->_zoomFactor = _sprite[0]._zoomFactor; break; default: break; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 97e98a8309..f45fc91eab 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -35,7 +35,7 @@ struct SpriteItem { int _animationType; const byte *_spriteData; Common::Point _spritePos; - int _zoomfactor; + int _zoomFactor; int fieldE; int _spriteIndex; int field12; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 2db3cce3ee..b90a7a0436 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -279,7 +279,7 @@ void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLoca s.syncAsSint16LE(item._pos.y); s.syncAsSint16LE(item.field2); s.syncAsSint16LE(item._location); - s.syncAsSint16LE(item.field4); + s.syncAsSint16LE(item._zoomFactor); } void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Surface *thumb8) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 77ffc5bee0..1fc61f7ebe 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -225,7 +225,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._saveData->_realHopkins._pos, 1, 2, - _vm->_globals._saveData->_realHopkins.field4, + _vm->_globals._saveData->_realHopkins._zoomFactor, 0, 34, 190); @@ -240,7 +240,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._saveData->_samantha._pos, 1, 3, - _vm->_globals._saveData->_samantha.field4, + _vm->_globals._saveData->_samantha._zoomFactor, 0, 20, 127); @@ -2207,14 +2207,14 @@ int ScriptManager::handleOpcode(byte *dataP) { int v54 = _vm->_globals.STAILLE[790 / 2]; if (_vm->_globals.STAILLE[790 / 2] < 0) v54 = -_vm->_globals.STAILLE[790 / 2]; - v53->field4 = -(100 * (67 - (100 - v54)) / 67); + v53->_zoomFactor = -(100 * (67 - (100 - v54)) / 67); _vm->_globals._saveData->_data[svField357] = 1; _vm->_globals._saveData->_data[svField354] = 0; _vm->_globals._saveData->_data[svField356] = 0; _vm->_globals._saveData->_data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->field4, 0, 20, 127); + _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->_zoomFactor, 0, 20, 127); _vm->_objectsManager.animateSprite(1); break; } -- cgit v1.2.3 From 704a36d1fb6567cdcbe0b985f745bd6d6c871dcb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Jan 2013 22:25:12 +0100 Subject: HOPKINS: More renaming in ObjectsManager and globals --- engines/hopkins/computer.cpp | 4 +- engines/hopkins/dialogs.cpp | 10 +-- engines/hopkins/events.cpp | 2 +- engines/hopkins/globals.h | 4 +- engines/hopkins/graphics.cpp | 16 ++--- engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 34 +++++----- engines/hopkins/objects.cpp | 148 +++++++++++++++++++++---------------------- engines/hopkins/objects.h | 12 ++-- engines/hopkins/saveload.cpp | 2 +- engines/hopkins/script.cpp | 24 +++---- engines/hopkins/talk.cpp | 6 +- 12 files changed, 131 insertions(+), 133 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 53c5809c36..8d9b108ce3 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -643,8 +643,8 @@ void ComputerManager::newLevel() { _breakoutLevel = (int16 *)_vm->_fileManager.loadFile(file); displayBricks(); - _vm->_objectsManager.addStaticSprite(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, 0, 0, 0); - _vm->_objectsManager.addStaticSprite(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, 0, 0, 0); + _vm->_objectsManager.addStaticSprite(_breakoutSpr, Common::Point(150, 192), 0, 13, 0, false, 0, 0); + _vm->_objectsManager.addStaticSprite(_breakoutSpr, Common::Point(164, 187), 1, 14, 0, false, 0, 0); _ballPosition = Common::Point(164, 187); _padPositionX = 150; _vm->_objectsManager.animateSprite(0); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 486d122c53..70b94088f1 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -349,7 +349,7 @@ LABEL_7: int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false); int v15 = 0; int inventCount = 0; for (int inventLine = 1; inventLine <= 5; inventLine++) { @@ -485,19 +485,19 @@ void DialogsManager::inventAnim() { if (_vm->_globals._saveData->_data[svField357] == 1) { if (_vm->_globals._saveData->_data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); if (_vm->_globals._saveData->_data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); _vm->_graphicsManager.addVesaSegment(566, 25, 594, 60); } if (_vm->_globals._saveData->_data[svField356] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } if (_vm->_globals._saveData->_data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } } diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 6fd46ec82d..448838bc2c 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -479,7 +479,7 @@ void EventsManager::updateCursor() { _vm->_graphicsManager.Sprite_Vesa(cursorSurface, _mouseCursor, 300, 300, _mouseSpriteId); } else { // Draw the active inventory object - _vm->_graphicsManager.Affiche_Perfect(cursorSurface, _objectBuf, 300, 300, 0, 0, 0, 0); + _vm->_graphicsManager.Affiche_Perfect(cursorSurface, _objectBuf, 300, 300, 0, 0, 0, false); } // Reset the clipping bounds diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 5d8acda8e2..3fdf1d0930 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -97,7 +97,7 @@ struct BobItem { int _offsetY; // Unused variable? bool field34; // Set to true in B_CACHE_OFF() int field36; - int _modeFlag; + bool _flipFl; bool _isSpriteFl; bool _activeFl; int _oldX; @@ -185,7 +185,7 @@ struct HopkinsItem { struct CharacterLocation { Common::Point _pos; - int field2; + int _startSpriteIndex; int _location; int _zoomFactor; }; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 93f1d01998..bca38038c4 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1181,8 +1181,8 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i width = _vm->_objectsManager.getWidth(objectData, idx); height = _vm->_objectsManager.getHeight(objectData, idx); if (*objectData == 78) { - Affiche_Perfect(_vesaScreen, objectData, xp + 300, yp + 300, idx, 0, 0, 0); - Affiche_Perfect(_vesaBuffer, objectData, xp + 300, yp + 300, idx, 0, 0, 0); + Affiche_Perfect(_vesaScreen, objectData, xp + 300, yp + 300, idx, 0, 0, false); + Affiche_Perfect(_vesaBuffer, objectData, xp + 300, yp + 300, idx, 0, 0, false); } else { Sprite_Vesa(_vesaBuffer, objectData, xp + 300, yp + 300, idx); Sprite_Vesa(_vesaScreen, objectData, xp + 300, yp + 300, idx); @@ -1269,7 +1269,7 @@ int GraphicsManager::zoomOut(int v, int percentage) { } // Display 'Perfect?' -void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag) { +void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl) { const byte *spriteStartP; int i; const byte *spriteSizeP; @@ -1315,7 +1315,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp _width = spriteWidth; int v20 = zoomIn(spriteWidth, zoom2); int v22 = zoomIn(spriteHeight1, zoom2); - if (modeFlag) { + if (flipFl) { v29 = v20 + dest1P; if (_posYClipped) { if ((uint16)_posYClipped >= v22) @@ -1472,7 +1472,7 @@ Aff_Zoom_Larg_Cont1: Red = zoom1; if (zoom1 < 100) { int v37 = zoomOut(spriteWidth, Red); - if (modeFlag) { + if (flipFl) { v40 = v37 + dest1P; do { int v65 = spriteHeight2; @@ -1535,7 +1535,7 @@ Aff_Zoom_Larg_Cont1: } } else { _width = spriteWidth; - if (modeFlag) { + if (flipFl) { dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; if (_posYClipped) { @@ -1622,8 +1622,8 @@ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int sp int height = _vm->_objectsManager.getHeight(spriteData, spriteIndex); if (*spriteData == 78) { - Affiche_Perfect(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); - Affiche_Perfect(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, 0); + Affiche_Perfect(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, false); + Affiche_Perfect(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex, 0, 0, false); } else { Sprite_Vesa(_vesaBuffer, spriteData, xp + 300, yp + 300, spriteIndex); Sprite_Vesa(_vesaScreen, spriteData, xp + 300, yp + 300, spriteIndex); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 2c601492e5..f43e35f710 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -156,7 +156,7 @@ public: void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); - void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, int modeFlag); + void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl); void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ad6a605f34..45039ede8f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2614,11 +2614,11 @@ void HopkinsEngine::BTOCEAN() { bool displAnim = false; if (_objectsManager._zoneNum == 1) { if (_globals._oceanDirection == 3) - _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false); else if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); else if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false); _globals._oceanDirection = 7; _globals._exitId = 1; int oldX = _objectsManager.getSpriteX(0); @@ -2646,11 +2646,11 @@ void HopkinsEngine::BTOCEAN() { LABEL_22: if (_objectsManager._zoneNum == 2) { if (_globals._oceanDirection == 7) - _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); else if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); else if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false); _globals._oceanDirection = 3; _globals._exitId = 2; int oldX = _objectsManager.getSpriteX(0); @@ -2699,7 +2699,7 @@ LABEL_41: } } while (oldX <= 235); if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false); } LABEL_57: if (_globals._oceanDirection == 7) { @@ -2724,11 +2724,11 @@ LABEL_57: } } while (oldX > 236); if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); } LABEL_72: if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); _globals._oceanDirection = 1; _globals._exitId = 3; } @@ -2755,7 +2755,7 @@ LABEL_72: } } while (oldX <= 235); if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false); } LABEL_91: if (_globals._oceanDirection == 7) { @@ -2778,13 +2778,13 @@ LABEL_91: } if (oldX <= 236) { if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); break; } } } if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, 0); + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); _globals._oceanDirection = 5; _globals._exitId = 4; } @@ -2838,23 +2838,23 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in switch (_globals._oceanDirection) { case 1: _objectsManager._characterPos.x = 236; - _objectsManager.PERI = 27; + _objectsManager._startSpriteIndex = 27; break; case 3: _objectsManager._characterPos.x = -20; - _objectsManager.PERI = 0; + _objectsManager._startSpriteIndex = 0; break; case 5: _objectsManager._characterPos.x = 236; - _objectsManager.PERI = 9; + _objectsManager._startSpriteIndex = 9; break; case 7: _objectsManager._characterPos.x = 415; - _objectsManager.PERI = 18; + _objectsManager._startSpriteIndex = 18; break; } - _objectsManager.addStaticSprite(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager.PERI, 0, 0, 0, 0); + _objectsManager.addStaticSprite(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager._startSpriteIndex, 0, false, 0, 0); _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 57cbb83c0b..26b0214535 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -65,12 +65,12 @@ ObjectsManager::ObjectsManager() { _disableFl = false; _twoCharactersFl = false; _characterPos = Common::Point(0, 0); - PERI = 0; + _startSpriteIndex = 0; OBSSEUL = false; _jumpVerb = 0; _jumpZone = 0; _oldSpriteIndex = 0; - S_old_ret = 0; + _oldFlipFl = false; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -492,7 +492,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._offsetY = 0; bob.field34 = false; bob.field36 = 0; - bob._modeFlag = 0; + bob._flipFl = false; bob._oldX2 = 0; item._visibleFl = false; @@ -516,7 +516,7 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals._bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex, _vm->_globals._bob[idx].field4A, _vm->_globals._bob[idx]._oldY2, - _vm->_globals._bob[idx]._modeFlag); + _vm->_globals._bob[idx]._flipFl); _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._posX = xp; @@ -583,7 +583,7 @@ void ObjectsManager::BOB_VISU(int idx) { if (_vm->_globals.Bank[bankIdx]._fileHeader == 1) { _vm->_globals._bob[idx]._isSpriteFl = true; _vm->_globals._bob[idx].field36 = 0; - _vm->_globals._bob[idx]._modeFlag = 0; + _vm->_globals._bob[idx]._flipFl = false; } _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; @@ -638,7 +638,7 @@ void ObjectsManager::SCBOB(int idx) { void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals._bob[idx]._activeFl = false; if (_vm->_globals._bob[idx]._isSpriteFl) { - _vm->_globals._bob[idx]._modeFlag = 0; + _vm->_globals._bob[idx]._flipFl = false; _vm->_globals._bob[idx].field36 = 0; } @@ -647,7 +647,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { return; int deltaY, deltaX; - if (_vm->_globals._bob[idx]._modeFlag) { + if (_vm->_globals._bob[idx]._flipFl) { deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, spriteIdx, true); deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, true); } else { @@ -768,7 +768,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx].fieldE); + _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx]._flipFl); _vm->_globals.Liste[idx]._width = _sprite[idx]._width; _vm->_globals.Liste[idx]._height = _sprite[idx]._height; @@ -815,7 +815,7 @@ void ObjectsManager::computeSprite(int idx) { int offX; int offY; - if (_sprite[idx].fieldE) { + if (_sprite[idx]._flipFl) { offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, true); offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, true); } else { @@ -959,7 +959,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; - _vm->_globals._bob[idx]._modeFlag = v20[2 * v24 + 9]; + _vm->_globals._bob[idx]._flipFl = (v20[2 * v24 + 9] != 0); _vm->_globals._bob[idx].field10 += 5; v5 = _vm->_globals._bob[idx].field12; @@ -994,7 +994,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); _vm->_globals._bob[idx]._frameIndex = v21[8]; - _vm->_globals._bob[idx]._modeFlag = v21[9]; + _vm->_globals._bob[idx]._flipFl = (v21[9] != 0); _vm->_globals._bob[idx].field10 += 5; v10 = _vm->_globals._bob[idx].field12; @@ -1148,14 +1148,12 @@ void ObjectsManager::displayVBob() { if (*v10 == 78) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaScreen, v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, - _vm->_globals.VBob[idx]._frameIndex, - 0, 0, 0); + _vm->_globals.VBob[idx]._frameIndex, 0, 0, false); _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, - _vm->_globals.VBob[idx]._frameIndex, - 0, 0, 0); + _vm->_globals.VBob[idx]._frameIndex, 0, 0, false); } else { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, @@ -1213,13 +1211,13 @@ void ObjectsManager::animateSprite(int idx) { _sprite[idx]._animationType = 1; } -void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, int a7, int a8, int a9) { +void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9) { assert (idx <= MAX_SPRITE); _sprite[idx]._spriteData = spriteData; _sprite[idx]._spritePos = pos; _sprite[idx]._spriteIndex = spriteIndex; _sprite[idx]._zoomFactor = zoomFactor; - _sprite[idx].fieldE = a7; + _sprite[idx]._flipFl = flipFl; _sprite[idx].field12 = a8; _sprite[idx].field14 = a9; _sprite[idx]._animationType = 0; @@ -1227,7 +1225,7 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { _sprite[idx]._rleFl = true; _sprite[idx]._zoomFactor = 0; - _sprite[idx].fieldE = 0; + _sprite[idx]._flipFl = false; } else _sprite[idx]._rleFl = false; @@ -1272,10 +1270,10 @@ void ObjectsManager::setSpriteZoom(int idx, int zoomFactor) { _sprite[idx]._zoomFactor = zoomFactor; } -void ObjectsManager::setFlipSprite(int idx, bool flip) { +void ObjectsManager::setFlipSprite(int idx, bool flipFl) { assert (idx <= MAX_SPRITE); if (!_sprite[idx]._rleFl) - _sprite[idx].fieldE = flip; + _sprite[idx]._flipFl = flipFl; } void ObjectsManager::checkZone() { @@ -1956,7 +1954,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_globals._mapCarPosX = 900; _vm->_globals._mapCarPosY = 319; } - addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, 0, 5, 5); + addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, false, 5, 5); _vm->_eventsManager.setMouseXY(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY); my_anim = 0; _vm->_eventsManager.mouseOn(); @@ -2312,12 +2310,12 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); - loc->field2 = 64; + loc->_startSpriteIndex = 64; loc->_location = _vm->_globals._screenId; loc->_zoomFactor = _sprite[0]._animationType; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->_zoomFactor, 0, 20, 127); + addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->_zoomFactor, false, 20, 127); animateSprite(1); removeSprite(0); @@ -2328,7 +2326,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); _vm->_globals.PERSO_TYPE = 0; - addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, 0, 34, 190); + addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, false, 34, 190); animateSprite(0); _vm->_globals.loadCharacterData(); } else if (oldCharacter == CHARACTER_HOPKINS && newCharacter == CHARACTER_SAMANTHA @@ -2337,12 +2335,12 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); - loc->field2 = 64; + loc->_startSpriteIndex = 64; loc->_location = _vm->_globals._screenId; loc->_zoomFactor = _sprite[0]._zoomFactor; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->_zoomFactor, 0, 34, 190); + addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->_zoomFactor, false, 34, 190); animateSprite(1); removeSprite(0); @@ -2353,7 +2351,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); _vm->_globals.PERSO_TYPE = 2; - addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, 0, 20, 127); + addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, false, 20, 127); animateSprite(0); _vm->_globals.loadCharacterData(); } else { @@ -2362,7 +2360,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); - loc->field2 = 64; + loc->_startSpriteIndex = 64; loc->_location = _vm->_globals._screenId; loc->_zoomFactor = _sprite[0]._zoomFactor; break; @@ -2370,7 +2368,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_cloneHopkins; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); - loc->field2 = 64; + loc->_startSpriteIndex = 64; loc->_location = _vm->_globals._screenId; loc->_zoomFactor = _sprite[0]._zoomFactor; break; @@ -2378,7 +2376,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; loc->_pos.x = getSpriteX(0); loc->_pos.y = getSpriteY(0); - loc->field2 = 64; + loc->_startSpriteIndex = 64; loc->_location = _vm->_globals._screenId; loc->_zoomFactor = _sprite[0]._zoomFactor; break; @@ -3358,23 +3356,23 @@ void ObjectsManager::ACTION_DOS(int idx) { _vm->_globals.GESTE = _vm->_fileManager.loadFile("DOS.SPR"); } if (idx == 1) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); if (idx == 2) - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false); if (idx == 3) SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); if (idx == 4) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); if (idx == 5) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); if (idx == 6) SPACTION1(_vm->_globals.GESTE, "20,19,18,17,16,15,-1,", 0, 0, 8); if (idx == 7) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); if (idx == 8) SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); if (idx == 9) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); if (idx == 10) SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); } @@ -3386,23 +3384,23 @@ void ObjectsManager::ACTION_DROITE(int idx) { _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); } if (idx == 1) - ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false); if (idx == 2) - SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false); if (idx == 3) SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); if (idx == 4) - ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false); if (idx == 5) - SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, false); if (idx == 6) SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); if (idx == 7) - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, false); if (idx == 8) SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); if (idx == 9) - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false); if (idx == 10) SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); } @@ -3414,23 +3412,23 @@ void ObjectsManager::Q_DROITE(int idx) { _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); } if (idx == 1) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); if (idx == 2) - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false); if (idx == 3) SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); if (idx == 4) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); if (idx == 5) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, false); if (idx == 6) SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); if (idx == 7) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, false); if (idx == 8) SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); if (idx == 9) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); if (idx == 10) SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); } @@ -3442,13 +3440,13 @@ void ObjectsManager::ACTION_FACE(int idx) { _vm->_globals.GESTE = _vm->_fileManager.loadFile("FACE.SPR"); } if (idx == 1) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); if (idx == 2) - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, 0); + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false); if (idx == 3) SPACTION1(_vm->_globals.GESTE, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); if (idx == 4) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); } void ObjectsManager::Q_GAUCHE(int idx) { @@ -3458,23 +3456,23 @@ void ObjectsManager::Q_GAUCHE(int idx) { _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); } if (idx == 1) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); if (idx == 2) - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true); if (idx == 3) SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); if (idx == 4) - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 1); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); if (idx == 5) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, true); if (idx == 6) SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); if (idx == 7) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,-1,", 0, 0, 8, true); if (idx == 8) SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); if (idx == 9) - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true); if (idx == 10) SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); } @@ -3486,23 +3484,23 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); } if (idx == 1) - ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, 1); + ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true); if (idx == 2) - SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true); if (idx == 3) SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); if (idx == 4) - ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, 1); + ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true); if (idx == 5) - SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, true); if (idx == 6) SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); if (idx == 7) - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, true); if (idx == 8) SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); if (idx == 9) - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, 1); + SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true); if (idx == 10) SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); } @@ -4088,7 +4086,7 @@ int ObjectsManager::colision(int xp, int yp) { return -1; } -void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, int a6) { +void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl) { bool tokenCompleteFl; char curChar; int spriteIndex; @@ -4103,10 +4101,10 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in realSpeed = speed / 3; const byte *oldSpriteData = _sprite[0]._spriteData; spriteIndex = _sprite[0]._spriteIndex; - int oldFieldE = _sprite[0].fieldE; + bool oldFlipFl = _sprite[0]._flipFl; _sprite[0].field12 += a3; _sprite[0].field14 += a4; - _sprite[0].fieldE = a6; + _sprite[0]._flipFl = flipFl; for (;;) { tokenCompleteFl = false; @@ -4126,7 +4124,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in _sprite[0]._spriteIndex = spriteIndex; _sprite[0].field12 -= a3; _sprite[0].field14 -= a4; - _sprite[0].fieldE = oldFieldE; + _sprite[0]._flipFl = oldFlipFl; } else { _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = idx; @@ -4139,7 +4137,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } } -void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, int a6) { +void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl) { int spriteIndex = 0; Common::String tmpStr = ""; @@ -4151,10 +4149,10 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int S_old_spr = _sprite[0]._spriteData; _oldSpriteIndex = _sprite[0]._spriteIndex; - S_old_ret = _sprite[0].fieldE; + _oldFlipFl = _sprite[0]._flipFl; _sprite[0].field12 += a3; _sprite[0].field14 += a4; - _sprite[0].fieldE = a6; + _sprite[0]._flipFl = flipFl; uint strPos = 0; char nextChar; @@ -4217,7 +4215,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin _sprite[0]._spriteIndex = _oldSpriteIndex; _sprite[0].field12 -= a3; _sprite[0].field14 -= a4; - _sprite[0].fieldE = S_old_ret; + _sprite[0]._flipFl = _oldFlipFl; } else { _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = spriteIndex; @@ -4349,7 +4347,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } _vm->_eventsManager.mouseOn(); if (_vm->_globals._screenId == 61) { - addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, 0, 34, 190); + addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); _vm->_globals.chemin = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); @@ -4464,13 +4462,13 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.loadCharacterData(); switch (_vm->_globals.PERSO_TYPE) { case 0: - addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190); + addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 34, 190); break; case 1: - addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 28, 155); + addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 28, 155); break; case 2: - addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 20, 127); + addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 20, 127); break; } _vm->_eventsManager.setMouseXY(_characterPos); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index f45fc91eab..61e87bca88 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -36,7 +36,7 @@ struct SpriteItem { const byte *_spriteData; Common::Point _spritePos; int _zoomFactor; - int fieldE; + bool _flipFl; int _spriteIndex; int field12; int field14; @@ -85,12 +85,12 @@ public: bool _disableFl; bool _twoCharactersFl; Common::Point _characterPos; - int PERI; + int _startSpriteIndex; bool OBSSEUL; int _jumpVerb; int _jumpZone; int _oldSpriteIndex; - int S_old_ret; + bool _oldFlipFl; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -136,7 +136,7 @@ public: int getSpriteY(int idx); void clearSprite(); void animateSprite(int idx); - void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, int a7, int a8, int a9); + void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9); void removeSprite(int idx); void setSpriteX(int idx, int xp); void setSpriteIndex(int idx, int spriteIndex); @@ -203,8 +203,8 @@ public: int CALC_PROPRE(int idx); int colision(int xp, int yp); - void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, int a6); - void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, int a6); + void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl); + void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int a2); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index b90a7a0436..e692aef81c 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -277,7 +277,7 @@ void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { void SaveLoadManager::syncCharacterLocation(Common::Serializer &s, CharacterLocation &item) { s.syncAsSint16LE(item._pos.x); s.syncAsSint16LE(item._pos.y); - s.syncAsSint16LE(item.field2); + s.syncAsSint16LE(item._startSpriteIndex); s.syncAsSint16LE(item._location); s.syncAsSint16LE(item._zoomFactor); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1fc61f7ebe..cd871b59a8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -196,26 +196,26 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager._twoCharactersFl = false; _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); _vm->_objectsManager._characterPos.y = (int16)READ_LE_UINT16(dataP + 8); - _vm->_objectsManager.PERI = dataP[5]; + _vm->_objectsManager._startSpriteIndex = dataP[5]; if (_vm->_objectsManager._changeHeadFl) { if (_vm->_globals._saveData->_data[svField354] == 1 && _vm->_globals._saveData->_cloneHopkins._pos.x && _vm->_globals._saveData->_cloneHopkins._pos.y - && _vm->_globals._saveData->_cloneHopkins.field2 && _vm->_globals._saveData->_cloneHopkins._location) { + && _vm->_globals._saveData->_cloneHopkins._startSpriteIndex && _vm->_globals._saveData->_cloneHopkins._location) { _vm->_objectsManager._characterPos = _vm->_globals._saveData->_cloneHopkins._pos; - _vm->_objectsManager.PERI = _vm->_globals._saveData->_cloneHopkins.field2; + _vm->_objectsManager._startSpriteIndex = _vm->_globals._saveData->_cloneHopkins._startSpriteIndex; } if (_vm->_globals._saveData->_data[svField356] == 1 && _vm->_globals._saveData->_samantha._pos.x && _vm->_globals._saveData->_samantha._pos.y - && _vm->_globals._saveData->_samantha.field2 && _vm->_globals._saveData->_samantha._location) { + && _vm->_globals._saveData->_samantha._startSpriteIndex && _vm->_globals._saveData->_samantha._location) { _vm->_objectsManager._characterPos = _vm->_globals._saveData->_samantha._pos; - _vm->_objectsManager.PERI = _vm->_globals._saveData->_samantha.field2; + _vm->_objectsManager._startSpriteIndex = _vm->_globals._saveData->_samantha._startSpriteIndex; } if (_vm->_globals._saveData->_data[svField357] == 1 && _vm->_globals._saveData->_realHopkins._pos.x && _vm->_globals._saveData->_realHopkins._pos.y - && _vm->_globals._saveData->_realHopkins.field2 && _vm->_globals._saveData->_realHopkins._location) { + && _vm->_globals._saveData->_realHopkins._startSpriteIndex && _vm->_globals._saveData->_realHopkins._location) { _vm->_objectsManager._characterPos = _vm->_globals._saveData->_realHopkins._pos; - _vm->_objectsManager.PERI = _vm->_globals._saveData->_realHopkins.field2; + _vm->_objectsManager._startSpriteIndex = _vm->_globals._saveData->_realHopkins._startSpriteIndex; } } if (_vm->_globals._saveData->_data[svField356] == 1 @@ -226,7 +226,7 @@ int ScriptManager::handleOpcode(byte *dataP) { 1, 2, _vm->_globals._saveData->_realHopkins._zoomFactor, - 0, + false, 34, 190); _vm->_objectsManager.animateSprite(1); @@ -241,7 +241,7 @@ int ScriptManager::handleOpcode(byte *dataP) { 1, 3, _vm->_globals._saveData->_samantha._zoomFactor, - 0, + false, 20, 127); _vm->_objectsManager.animateSprite(1); @@ -2179,7 +2179,7 @@ int ScriptManager::handleOpcode(byte *dataP) { CharacterLocation *v51 = &_vm->_globals._saveData->_realHopkins; v51->_pos.x = _vm->_objectsManager.getSpriteX(0); v51->_pos.y = _vm->_objectsManager.getSpriteY(0); - v51->field2 = 57; + v51->_startSpriteIndex = 57; v51->_location = 97; _vm->_globals._saveData->_data[svField121] = 1; _vm->_globals._saveData->_data[svField352] = 1; @@ -2201,7 +2201,7 @@ int ScriptManager::handleOpcode(byte *dataP) { CharacterLocation *v53 = &_vm->_globals._saveData->_samantha; v53->_pos.x = 404; v53->_pos.y = 395; - v53->field2 = 64; + v53->_startSpriteIndex = 64; v53->_location = _vm->_globals._screenId; int v54 = _vm->_globals.STAILLE[790 / 2]; @@ -2214,7 +2214,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._saveData->_data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->_zoomFactor, 0, 20, 127); + _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->_zoomFactor, false, 20, 127); _vm->_objectsManager.animateSprite(1); break; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 23b9dcf0a2..39b4580fcf 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -626,7 +626,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { if ((int16)READ_LE_UINT16(v5 + 24)) { _vm->_globals._bob[idx]._isSpriteFl = true; _vm->_globals._bob[idx].field36 = 0; - _vm->_globals._bob[idx]._modeFlag = 0; + _vm->_globals._bob[idx]._flipFl = false; _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals._bob[idx].field0 = 10; v5 = _characterSprite; @@ -912,7 +912,7 @@ void TalkManager::REPONSE2(int a1, int a2) { if (a1 == 22 || a1 == 23) { _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, false); if (a1 == 22) { _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); @@ -960,7 +960,7 @@ void TalkManager::REPONSE2(int a1, int a2) { } else if (a1 == 20 || a1 == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, true); if (a1 == 20) { _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); -- cgit v1.2.3 From 1a3fb10d912ada574423cebe6e4cb818a6009127 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Jan 2013 07:53:59 +0100 Subject: HOPKINS: Some renaming --- engines/hopkins/dialogs.cpp | 12 ++++++------ engines/hopkins/globals.cpp | 8 +++----- engines/hopkins/globals.h | 5 ++--- engines/hopkins/graphics.cpp | 6 +----- engines/hopkins/graphics.h | 3 +-- engines/hopkins/hopkins.cpp | 8 ++++---- engines/hopkins/hopkins.h | 2 +- engines/hopkins/lines.cpp | 27 ++++++++++---------------- engines/hopkins/lines.h | 6 +++--- engines/hopkins/objects.cpp | 46 ++++++++++++++++++-------------------------- engines/hopkins/objects.h | 6 ++---- engines/hopkins/script.cpp | 20 +++++++++---------- 12 files changed, 61 insertions(+), 88 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 70b94088f1..e67301b25f 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -286,7 +286,7 @@ void DialogsManager::showOptionsDialog() { _vm->_eventsManager.VBL(); } while (!doneFlag); - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager._scrollOffset + 164, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager._scrollOffset + 164, 107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollOffset + 164, 107); _vm->_graphicsManager.addVesaSegment(_vm->_graphicsManager._scrollOffset + 164, 107, _vm->_graphicsManager._scrollOffset + 498, 320); @@ -433,7 +433,7 @@ LABEL_7: _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { _inventDisplayedFl = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _inventX, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, _inventX, 114); + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _inventX, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, _inventX, 114); _vm->_graphicsManager.addVesaSegment(_inventX, 114, _inventX + v18, v18 + 114); _vm->_objectsManager.BOBTOUS = true; } @@ -464,7 +464,7 @@ void DialogsManager::inventAnim() { return; if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; @@ -473,7 +473,7 @@ void DialogsManager::inventAnim() { if (_vm->_objectsManager._visibleFl) { if (_vm->_objectsManager.I_old_x <= 1) _vm->_objectsManager.I_old_x = 2; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); @@ -556,7 +556,7 @@ void DialogsManager::showLoadGame() { _vm->_eventsManager.VBL(); } while (!_vm->shouldQuit() && (!slotNumber || _vm->_eventsManager.getMouseButton() != 1)); _vm->_objectsManager._saveLoadFl = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager._saveLoadSprite = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite); @@ -587,7 +587,7 @@ void DialogsManager::showSaveGame() { } while (!_vm->shouldQuit() && (!slotNumber || _vm->_eventsManager.getMouseButton() != 1)); _vm->_objectsManager._saveLoadFl = false; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x + 183, 60); _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 183, 60, _vm->_eventsManager._startPos.x + 457, 413); _vm->_objectsManager.BOBTOUS = true; _vm->_objectsManager._saveLoadSprite = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index c13e559b4f..af942b94d0 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -100,11 +100,9 @@ Globals::Globals() { BOBZONE_FLAG[i] = false; } for (int i = 0; i < 500; ++i) - STAILLE[i] = 0; + _spriteSize[i] = 0; for (int i = 0; i < 32002; ++i) super_parcours[i] = 0; - for (int i = 0; i < 2100; ++i) - Param[i] = 0; for (int i = 0; i < 70; ++i) Common::fill((byte *)&Hopkins[i], (byte *)&Hopkins[i] + sizeof(HopkinsItem), 0); @@ -331,9 +329,9 @@ void Globals::clearAll() { _vm->_linesManager.Ligne[idx].field8 = 0; _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; - _vm->_linesManager._zoneLine[idx].count = 0; + _vm->_linesManager._zoneLine[idx]._count = 0; _vm->_linesManager._zoneLine[idx].field2 = 0; - _vm->_linesManager._zoneLine[idx].zoneData = (int16 *)g_PTRNUL; + _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; } for (int idx = 0; idx < 100; ++idx) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 3fdf1d0930..7879a71e53 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -173,7 +173,7 @@ struct CacheItem { }; struct SegmentItem { - int field0; + int field0; // Useless variable int field2; int field4; }; @@ -312,9 +312,8 @@ public: SegmentItem Segment[101]; int BOBZONE[105]; bool BOBZONE_FLAG[105]; - int STAILLE[500]; + int _spriteSize[500]; int16 super_parcours[32002]; - int Param[2100]; HopkinsItem Hopkins[70]; int _inventory[36]; SortItem _sortedDisplay[51]; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index bca38038c4..69ea5b2190 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1632,7 +1632,7 @@ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int sp addVesaSegment(xp, yp, xp + width, yp + height); } -void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { +void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { int top; int croppedWidth; int croppedHeight; @@ -1824,10 +1824,6 @@ void GraphicsManager::NB_SCREEN(bool initPalette) { DD_VBL(); } -void GraphicsManager::SHOW_PALETTE() { - setPaletteVGA256(_palette); -} - void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { int destOffset; const byte *srcPtr; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index f43e35f710..86ee8197c6 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -158,14 +158,13 @@ public: int zoomOut(int v, int percentage); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl); void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); - void SCOPY(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); + void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); void INI_ECRAN(const Common::String &file, bool initializeScreen); void INI_ECRAN2(const Common::String &file, bool initializeScreen); void OPTI_INI(const Common::String &file, int mode, bool initializeScreen); void NB_SCREEN(bool initPalette); - void SHOW_PALETTE(); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 45039ede8f..aa93289cc0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -157,7 +157,7 @@ bool HopkinsEngine::runWin95Demo() { _globals._speed = 1; for (int i = 1; i < 50; i++) { - _graphicsManager.SCOPY(_graphicsManager._vesaScreen, 0, 0, 640, 440, _graphicsManager._vesaBuffer, 0, 0); + _graphicsManager.copySurface(_graphicsManager._vesaScreen, 0, 0, 640, 440, _graphicsManager._vesaBuffer, 0, 0); _eventsManager.VBL(); } @@ -487,7 +487,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals._exitId = _menuManager.menu(); if (_globals._exitId == -1) { if (!g_system->getEventManager()->shouldQuit()) - PUBQUIT(); + endLinuxDemo(); _globals.PERSO = _globals.freeMemory(_globals.PERSO); restoreSystem(); } @@ -2029,7 +2029,7 @@ void HopkinsEngine::restoreSystem() { _eventsManager.refreshEvents(); } -void HopkinsEngine::PUBQUIT() { +void HopkinsEngine::endLinuxDemo() { _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); _globals._forestFl = false; @@ -2583,7 +2583,7 @@ void HopkinsEngine::displayCredits() { --_globals.Credit_y; if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) { _eventsManager.VBL(); - _graphicsManager.SCOPY(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50); + _graphicsManager.copySurface(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50); } else { _eventsManager.VBL(); } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 8ae9093872..4ab356be9a 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -86,7 +86,7 @@ private: void displayNotAvailable(); void restoreSystem(); - void PUBQUIT(); + void endLinuxDemo(); void displayEndDemo(); void bombExplosion(); void handleConflagration(); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 07fbc16d64..6fc9436a7a 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -129,7 +129,7 @@ void LinesManager::removeZoneLine(int idx) { if (idx > MAX_LINES) error("Attempting to remove a line obstacle > MAX_LIGNE."); - _vm->_linesManager._zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager._zoneLine[idx].zoneData); + _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager._zoneLine[idx]._zoneData); } /** @@ -145,7 +145,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ if (idx > MAX_LINES) error("Attempting to add a line obstacle > MAX_LIGNE."); - _zoneLine[idx].zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx].zoneData); + _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); int v8 = abs(a2 - a4); int v9 = abs(a3 - a5); @@ -157,7 +157,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ zoneData = (int16 *)_vm->_globals.allocMemory(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); int v11 = idx; - _zoneLine[v11].zoneData = zoneData; + _zoneLine[v11]._zoneData = zoneData; if (zoneData == (int16 *)g_PTRNUL) error("AJOUTE LIGNE ZONE"); @@ -180,7 +180,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ *dataP++ = -1; *dataP++ = -1; - _zoneLine[idx].count = v20; + _zoneLine[idx]._count = v20; _zoneLine[idx].field2 = bobZoneIdx; } } @@ -2066,7 +2066,6 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v109; int v110; int v111; - int v112; int v113; int v114; int v115; @@ -2348,10 +2347,9 @@ LABEL_72: v14 = 0; int v16; for (;;) { - int v15 = SMOOTH[v14].field0; - v112 = v15; + int v112 = SMOOTH[v14].field0; v110 = SMOOTH[v14].field2; - if (v15 == -1 || SMOOTH[v14].field2 == -1) { + if (v112 == -1 || SMOOTH[v14].field2 == -1) { v126 = 1; if (v126 == 1) { v18 = v14 - 1; @@ -2360,7 +2358,7 @@ LABEL_72: goto LABEL_72; } } - if (checkCollisionLine(v15, v110, &v143, &v142, 0, _linesNumb)) + if (checkCollisionLine(v112, v110, &v143, &v142, 0, _linesNumb)) break; v16 = v115; @@ -2860,7 +2858,6 @@ int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v6; int v7; - int v10; int v11; int v14; int v22; @@ -2872,7 +2869,6 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { int v40; int v41; int v42; - int v47; int v50; int v51; int v52; @@ -2888,7 +2884,7 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { while (v62 > a5 && a6 > v63) { v25 = _vm->_globals.Hopkins[hopkinsIdx].field0; v40 = _vm->_globals.Hopkins[hopkinsIdx].field2; - int spriteSize = _vm->_globals.STAILLE[v63]; + int spriteSize = _vm->_globals._spriteSize[v63]; if (spriteSize < 0) { v25 = _vm->_graphicsManager.zoomOut(v25, -spriteSize); v40 = _vm->_graphicsManager.zoomOut(v40, -spriteSize); @@ -2925,12 +2921,10 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { while (v62 < a5 && a6 > v63) { v14 = _vm->_globals.Hopkins[v52].field0; v39 = _vm->_globals.Hopkins[v52].field2; - int spriteSize = _vm->_globals.STAILLE[v63]; + int spriteSize = _vm->_globals._spriteSize[v63]; if (spriteSize < 0) { - v47 = _vm->_globals.STAILLE[v63]; v14 = _vm->_graphicsManager.zoomOut(v14, -spriteSize); v39 = _vm->_graphicsManager.zoomOut(v39, -spriteSize); - spriteSize = v47; } if (spriteSize > 0) { v14 = _vm->_graphicsManager.zoomIn(v14, spriteSize); @@ -2963,10 +2957,9 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { smoothIdx = 0; int loopCount = 0; while (v62 > a5 && a6 < v63) { - v10 = _vm->_globals.Hopkins[v51].field2; v42 = v63; v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25); - v38 = _vm->_graphicsManager.zoomOut(v10, 25); + v38 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field2, 25); v63 = v42; for (int v12 = 0; v12 < v11; v12++) { --v62; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 19f245ee65..f2a62eb900 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -31,14 +31,14 @@ namespace Hopkins { class HopkinsEngine; struct LigneZoneItem { - int count; + int _count; int field2; - int16 *zoneData; + int16 *_zoneData; }; struct LigneItem { int _lineDataEndIdx; - int field2; + int field2; // Useless variable int field4; int field6; int field8; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 26b0214535..2dc7db0f38 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -50,7 +50,7 @@ ObjectsManager::ObjectsManager() { _saveLoadSprite = g_PTRNUL; _saveLoadSprite2 = g_PTRNUL; _spritePtr = g_PTRNUL; - S_old_spr = g_PTRNUL; + _oldSpriteData = g_PTRNUL; PERSO_ON = false; _saveLoadFl = false; _visibleFl = false; @@ -283,7 +283,7 @@ void ObjectsManager::displaySprite() { if (clipY < _vm->_graphicsManager._minY) clipY = _vm->_graphicsManager._minY; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, _vm->_graphicsManager._vesaBuffer, clipX, clipY); _vm->_fontManager._textList[idx]._enabledFl = false; @@ -301,7 +301,7 @@ void ObjectsManager::displaySprite() { if (clipY < _vm->_graphicsManager._minY) clipY = _vm->_graphicsManager._minY; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, _vm->_graphicsManager._vesaBuffer, clipX, clipY); _vm->_globals.Liste[idx]._visibleFl = false; @@ -605,14 +605,6 @@ void ObjectsManager::BOB_OFFSET(int idx, int v) { _vm->_globals._bob[idx]._oldX2 = v; } -void ObjectsManager::BOB_ADJUST(int idx, int v) { - _vm->_globals._bob[idx]._oldX2 = v; -} - -void ObjectsManager::BOB_OFFSETY(int idx, int v) { - _vm->_globals._bob[idx]._offsetY = v; -} - void ObjectsManager::SCBOB(int idx) { if (_vm->_globals.Cache[idx].fieldA <= 0) return; @@ -1030,7 +1022,7 @@ void ObjectsManager::displayBobAnim() { if ((v14 != 2) && (v14 != 4)) { if (_vm->_globals.Liste2[i]._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[i]._posX, @@ -1042,7 +1034,7 @@ void ObjectsManager::displayBobAnim() { if (_vm->_globals._bob[i].field0 == 11) { if (_vm->_globals.Liste2[i]._visibleFl) { - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, _vm->_graphicsManager._vesaBuffer, @@ -1888,7 +1880,7 @@ void ObjectsManager::CARRE_ZONE() { } for (int idx = 0; idx < MAX_LINES; ++idx) { - int16 *dataP = _vm->_linesManager._zoneLine[idx].zoneData; + int16 *dataP = _vm->_linesManager._zoneLine[idx]._zoneData; if (dataP == (int16 *)g_PTRNUL) continue; @@ -1899,7 +1891,7 @@ void ObjectsManager::CARRE_ZONE() { if (_vm->_globals.CarreZone[v4]._minZoneLineIdx > idx) _vm->_globals.CarreZone[v4]._minZoneLineIdx = idx; - for (int i = 0; i < _vm->_linesManager._zoneLine[idx].count; i++) { + for (int i = 0; i < _vm->_linesManager._zoneLine[idx]._count; i++) { int zoneX = *dataP++; int zoneY = *dataP++; @@ -2299,7 +2291,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha CharacterLocation *loc; _changeHeadFl = true; - _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -2412,7 +2404,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha // Check Size void ObjectsManager::computeAndSetSpriteSize() { - int size = _vm->_globals.STAILLE[getSpriteY(0)]; + int size = _vm->_globals._spriteSize[getSpriteY(0)]; if (_vm->_globals.PERSO_TYPE == 1) { size = 20 * (5 * abs(size) - 100) / -80; } else if (_vm->_globals.PERSO_TYPE == 2) { @@ -3208,7 +3200,7 @@ void ObjectsManager::handleSpecialGames() { PERSO_ON = false; memcpy(_vm->_graphicsManager._palette, oldPalette, 769); - _vm->_graphicsManager.SHOW_PALETTE(); + _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); _vm->_globals.freeMemory(oldPalette); _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -3627,7 +3619,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } if (!OBSSEUL) { for (int idx = 0; idx < 500; ++idx) - _vm->_globals.STAILLE[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx); + _vm->_globals._spriteSize[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx); _vm->_globals.resetCache(); @@ -4017,7 +4009,7 @@ void ObjectsManager::enableVerb(int idx, int a2) { int ObjectsManager::CALC_PROPRE(int idx) { int retVal = 25; - int size = _vm->_globals.STAILLE[idx]; + int size = _vm->_globals._spriteSize[idx]; if (_vm->_globals.PERSO_TYPE == 1) { if (size < 0) size = -size; @@ -4052,9 +4044,9 @@ int ObjectsManager::colision(int xp, int yp) { int yMin = yp - 4; do { - int16 *dataP = _vm->_linesManager._zoneLine[field2].zoneData; + int16 *dataP = _vm->_linesManager._zoneLine[field2]._zoneData; if (dataP != (int16 *)g_PTRNUL) { - int count = _vm->_linesManager._zoneLine[field2].count; + int count = _vm->_linesManager._zoneLine[field2]._count; int v1 = dataP[0]; int v2 = dataP[1]; int v3 = dataP[count * 2 - 2]; @@ -4070,7 +4062,7 @@ int ObjectsManager::colision(int xp, int yp) { if (v2 >= v4 && (yMin > v2 || yMax < v4)) flag = false; - if (flag && _vm->_linesManager._zoneLine[field2].count > 0) { + if (flag && _vm->_linesManager._zoneLine[field2]._count > 0) { for (int i = 0; i < count; ++i) { int xCheck = *dataP++; int yCheck = *dataP++; @@ -4137,7 +4129,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in } } -void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl) { +void ObjectsManager::SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl) { int spriteIndex = 0; Common::String tmpStr = ""; @@ -4147,7 +4139,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int else if (_vm->_globals._speed == 3) realSpeed = speed / 3; - S_old_spr = _sprite[0]._spriteData; + _oldSpriteData = _sprite[0]._spriteData; _oldSpriteIndex = _sprite[0]._spriteIndex; _oldFlipFl = _sprite[0]._flipFl; _sprite[0].field12 += a3; @@ -4174,7 +4166,7 @@ void ObjectsManager::SPACTION(byte *a1, const Common::String &animationSeq, int } while (!completeTokenFl); if (spriteIndex != -1) { - _sprite[0]._spriteData = a1; + _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = spriteIndex; } for (int i = 0; i < realSpeed; i++) @@ -4211,7 +4203,7 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin if (completeTokenFl) { if (spriteIndex == -1) { - _sprite[0]._spriteData = S_old_spr; + _sprite[0]._spriteData = _oldSpriteData; _sprite[0]._spriteIndex = _oldSpriteIndex; _sprite[0].field12 -= a3; _sprite[0].field14 -= a4; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 61e87bca88..3c3db8687b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -70,7 +70,7 @@ public: byte *_saveLoadSprite; byte *_saveLoadSprite2; byte *_spritePtr; - const byte *S_old_spr; + const byte *_oldSpriteData; bool PERSO_ON; bool _saveLoadFl; bool _visibleFl; @@ -119,8 +119,6 @@ public: void BOB_VISU(int idx); void BOB_OFF(int idx); void BOB_OFFSET(int idx, int v); - void BOB_ADJUST(int idx, int v); - void BOB_OFFSETY(int idx, int v); void SCBOB(int idx); void CALCUL_BOB(int idx); @@ -204,7 +202,7 @@ public: int colision(int xp, int yp); void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl); - void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); + void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int a2); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index cd871b59a8..7bca24714a 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2198,23 +2198,21 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; - CharacterLocation *v53 = &_vm->_globals._saveData->_samantha; - v53->_pos.x = 404; - v53->_pos.y = 395; - v53->_startSpriteIndex = 64; - v53->_location = _vm->_globals._screenId; - - int v54 = _vm->_globals.STAILLE[790 / 2]; - if (_vm->_globals.STAILLE[790 / 2] < 0) - v54 = -_vm->_globals.STAILLE[790 / 2]; - v53->_zoomFactor = -(100 * (67 - (100 - v54)) / 67); + + CharacterLocation *samantha = &_vm->_globals._saveData->_samantha; + samantha->_pos.x = 404; + samantha->_pos.y = 395; + samantha->_startSpriteIndex = 64; + samantha->_location = _vm->_globals._screenId; + samantha->_zoomFactor = -(100 * (67 - (100 - abs(_vm->_globals._spriteSize[790 / 2]))) / 67); + _vm->_globals._saveData->_data[svField357] = 1; _vm->_globals._saveData->_data[svField354] = 0; _vm->_globals._saveData->_data[svField356] = 0; _vm->_globals._saveData->_data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, v53->_pos, 1, 3, v53->_zoomFactor, false, 20, 127); + _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127); _vm->_objectsManager.animateSprite(1); break; } -- cgit v1.2.3 From 6a8d6e6eca997aace48f1503ced958cc47cf4f55 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Jan 2013 07:59:21 +0100 Subject: HOPKINS: Fix error in loop conditions. Thanks Eriktorbjorn for noticing --- engines/hopkins/objects.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 2dc7db0f38..8833f13ecb 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -905,9 +905,7 @@ void ObjectsManager::displayBobAnim() { byte *v21; int v24; - int idx = 0; - do { - ++idx; + for (int idx = 1; idx <= 35; idx++) { if (idx <= 20 && PERSO_ON) { _vm->_globals._bob[idx].field1C = false; continue; @@ -1003,8 +1001,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx].field14 = 1; if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) _vm->_globals._bob[idx].field1C = true; - continue; - } while (idx != 35); + } if (!PERSO_ON && BOBTOUS) { for (int i = 0; i < 35; i++) { @@ -1015,7 +1012,7 @@ void ObjectsManager::displayBobAnim() { BOBTOUS = false; - for (int i = 1; i < 35; i++) { + for (int i = 1; i <= 35; i++) { if (i > 20 || !PERSO_ON) { if ((_vm->_globals._bob[i].field0 == 10) && (_vm->_globals._bob[i].field1C)) { v14 = _vm->_globals._bob[i].field1E; @@ -1047,7 +1044,7 @@ void ObjectsManager::displayBobAnim() { } } - for (int i = 1; i < 35; i++) { + for (int i = 1; i <= 35; i++) { _vm->_globals._bob[i]._oldY = 0; if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl && _vm->_globals._bob[i].field1C) { CALCUL_BOB(i); @@ -3695,7 +3692,6 @@ void ObjectsManager::INILINK(const Common::String &file) { if (ptr[idx] == 'Z' && ptr[idx + 1] == 'O' && ptr[idx + 2] == '2') { v17 = &ptr[idx + 4]; v33 = 0; - v35 = 0; for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; @@ -3713,6 +3709,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.ZONEP[i].field12 = 0; } + v35 = 0; v31 = 0; do { v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); -- cgit v1.2.3 From c056266cdd3c760d77d927ae1f85a14acd581e0f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Jan 2013 18:59:01 +0100 Subject: HOPKINS: rename one more field, fix glitch in ObjectsManager --- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 102 +++++++++++++++++++++----------------------- engines/hopkins/talk.cpp | 2 +- 3 files changed, 50 insertions(+), 56 deletions(-) diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7879a71e53..4f277de7e4 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -96,7 +96,7 @@ struct BobItem { int field22; int _offsetY; // Unused variable? bool field34; // Set to true in B_CACHE_OFF() - int field36; + int _zoomFactor; bool _flipFl; bool _isSpriteFl; bool _activeFl; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8833f13ecb..6d2403265d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -491,7 +491,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob.field22 = 0; bob._offsetY = 0; bob.field34 = false; - bob.field36 = 0; + bob._zoomFactor = 0; bob._flipFl = false; bob._oldX2 = 0; @@ -582,7 +582,7 @@ void ObjectsManager::BOB_VISU(int idx) { if (_vm->_globals.Bank[bankIdx]._fileHeader == 1) { _vm->_globals._bob[idx]._isSpriteFl = true; - _vm->_globals._bob[idx].field36 = 0; + _vm->_globals._bob[idx]._zoomFactor = 0; _vm->_globals._bob[idx]._flipFl = false; } @@ -631,7 +631,7 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals._bob[idx]._activeFl = false; if (_vm->_globals._bob[idx]._isSpriteFl) { _vm->_globals._bob[idx]._flipFl = false; - _vm->_globals._bob[idx].field36 = 0; + _vm->_globals._bob[idx]._zoomFactor = 0; } int spriteIdx = _vm->_globals._bob[idx]._frameIndex; @@ -647,37 +647,37 @@ void ObjectsManager::CALCUL_BOB(int idx) { deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, false); } - int v20 = 0; - int v21 = 0; - if (_vm->_globals._bob[idx].field36 < 0) { - v20 = -_vm->_globals._bob[idx].field36; - if (v20 > 95) - v20 = 95; + int negZoom = 0; + int posZoom = 0; + if (_vm->_globals._bob[idx]._zoomFactor < 0) { + negZoom = -_vm->_globals._bob[idx]._zoomFactor; + if (negZoom > 95) + negZoom = 95; } else - v21 = _vm->_globals._bob[idx].field36; + posZoom = _vm->_globals._bob[idx]._zoomFactor; - if (v21) { + if (posZoom) { if (deltaX >= 0) - deltaX = _vm->_graphicsManager.zoomIn(deltaX, v21); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, posZoom); else - deltaX = -_vm->_graphicsManager.zoomIn(deltaX, v21); + deltaX = -_vm->_graphicsManager.zoomIn(-deltaX, posZoom); if (deltaY >= 0) - deltaY = _vm->_graphicsManager.zoomIn(deltaY, v21); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, posZoom); else - deltaY = -_vm->_graphicsManager.zoomIn(abs(deltaX), v21); + deltaY = -_vm->_graphicsManager.zoomIn(abs(deltaX), posZoom); } - if (v20) { + if (negZoom) { if (deltaX >= 0) - deltaX = _vm->_graphicsManager.zoomOut(deltaX, v20); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, negZoom); else - deltaX = -_vm->_graphicsManager.zoomOut(-deltaX, v20); + deltaX = -_vm->_graphicsManager.zoomOut(-deltaX, negZoom); if (deltaY >= 0) - deltaY = _vm->_graphicsManager.zoomOut(deltaY, v20); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, negZoom); else - deltaY = -_vm->_graphicsManager.zoomOut(abs(deltaX), v20); + deltaY = -_vm->_graphicsManager.zoomOut(abs(deltaX), negZoom); } int v13 = _vm->_globals._bob[idx]._xp - deltaX; @@ -685,8 +685,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals._bob[idx]._activeFl = true; _vm->_globals._bob[idx]._oldX = v13; _vm->_globals._bob[idx]._oldY = v14; - _vm->_globals._bob[idx]._oldY2 = v21; - _vm->_globals._bob[idx].field4A = v20; + _vm->_globals._bob[idx]._oldY2 = posZoom; + _vm->_globals._bob[idx].field4A = negZoom; _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._posX = v13; @@ -695,13 +695,13 @@ void ObjectsManager::CALCUL_BOB(int idx) { int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); - if (v21) { - width = _vm->_graphicsManager.zoomIn(width, v21); - height = _vm->_graphicsManager.zoomIn(height, v21); + if (posZoom) { + width = _vm->_graphicsManager.zoomIn(width, posZoom); + height = _vm->_graphicsManager.zoomIn(height, posZoom); } - if (v20) { - height = _vm->_graphicsManager.zoomOut(height, v20); - width = _vm->_graphicsManager.zoomOut(width, v20); + if (negZoom) { + height = _vm->_graphicsManager.zoomOut(height, negZoom); + width = _vm->_graphicsManager.zoomOut(width, negZoom); } _vm->_globals.Liste2[idx]._width = width; @@ -947,7 +947,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); - _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); + _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; _vm->_globals._bob[idx]._flipFl = (v20[2 * v24 + 9] != 0); _vm->_globals._bob[idx].field10 += 5; @@ -982,7 +982,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); - _vm->_globals._bob[idx].field36 = (int16)READ_LE_UINT16(v21 + 6); + _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6); _vm->_globals._bob[idx]._frameIndex = v21[8]; _vm->_globals._bob[idx]._flipFl = (v21[9] != 0); _vm->_globals._bob[idx].field10 += 5; @@ -3592,17 +3592,13 @@ void ObjectsManager::INILINK(const Common::String &file) { int v32; int v33; int v34; - int v35; int v36; byte *v37; - size_t nbytes; - byte *ptr; - Common::String filename, filename2; Common::File f; - filename = file + ".LNK"; - ptr = _vm->_fileManager.searchCat(filename, 3); - nbytes = _vm->_globals._catalogSize; + Common::String filename = file + ".LNK"; + byte *ptr = _vm->_fileManager.searchCat(filename, 3); + size_t nbytes = _vm->_globals._catalogSize; if (ptr == g_PTRNUL) { if (!f.open(filename)) error("Error opening file - %s", filename.c_str()); @@ -3620,7 +3616,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.resetCache(); - filename2 = Common::String((const char *)ptr + 1000); + Common::String filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); @@ -3632,27 +3628,27 @@ void ObjectsManager::INILINK(const Common::String &file) { v36 = 60; v37 = ptr + 1000; - for (int v40 = 0; v40 <= 21; v40++) { + for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) { v8 = (int16)READ_LE_UINT16(v37 + 2 * v36); v9 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 2); v10 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 4); - _vm->_globals.Cache[v40].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); - _vm->_globals.Cache[v40]._spriteIndex = v8; - _vm->_globals.Cache[v40]._x = v9; - _vm->_globals.Cache[v40]._y = v10; + _vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); + _vm->_globals.Cache[cacheIdx]._spriteIndex = v8; + _vm->_globals.Cache[cacheIdx]._x = v9; + _vm->_globals.Cache[cacheIdx]._y = v10; if (!_vm->_globals.CACHE_BANQUE[1]) { - _vm->_globals.Cache[v40].fieldA = 0; + _vm->_globals.Cache[cacheIdx].fieldA = 0; } else { - _vm->_globals.Cache[v40]._spriteData = _vm->_globals.CACHE_BANQUE[1]; - _vm->_globals.Cache[v40]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); - _vm->_globals.Cache[v40]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); - _vm->_globals.Cache[v40].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._spriteData = _vm->_globals.CACHE_BANQUE[1]; + _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); + _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); + _vm->_globals.Cache[cacheIdx].fieldA = 1; } - if (!_vm->_globals.Cache[v40]._x && !_vm->_globals.Cache[v40]._y - && !_vm->_globals.Cache[v40]._spriteIndex) - _vm->_globals.Cache[v40].fieldA = 0; + if (!_vm->_globals.Cache[cacheIdx]._x && !_vm->_globals.Cache[cacheIdx]._y + && !_vm->_globals.Cache[cacheIdx]._spriteIndex) + _vm->_globals.Cache[cacheIdx].fieldA = 0; v36 += 5; } @@ -3709,13 +3705,12 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.ZONEP[i].field12 = 0; } - v35 = 0; v31 = 0; do { v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); if (v28 != -1) { _vm->_linesManager.addZoneLine( - v35, + v31, (int16)READ_LE_UINT16(v17 + 2 * v33 + 2), (int16)READ_LE_UINT16(v17 + 2 * v33 + 4), (int16)READ_LE_UINT16(v17 + 2 * v33 + 6), @@ -3724,7 +3719,6 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.ZONEP[v28]._enabledFl = true; } v33 += 5; - ++v35; ++v31; } while (v28 != -1); for (int i = 1; i <= 100; i++) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 39b4580fcf..77705d735f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -625,7 +625,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { v4 = 1; if ((int16)READ_LE_UINT16(v5 + 24)) { _vm->_globals._bob[idx]._isSpriteFl = true; - _vm->_globals._bob[idx].field36 = 0; + _vm->_globals._bob[idx]._zoomFactor = 0; _vm->_globals._bob[idx]._flipFl = false; _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; _vm->_globals._bob[idx].field0 = 10; -- cgit v1.2.3 From 0e0337c30e3b32ae9ab487be8b20ba6a1043c6ef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Jan 2013 21:24:31 +0100 Subject: HOPKINS: Some renaming. Implement proper music volume during speech --- engines/hopkins/dialogs.cpp | 8 +++--- engines/hopkins/objects.cpp | 8 +++--- engines/hopkins/script.cpp | 65 +++++++++++++++++++++-------------------- engines/hopkins/sound.cpp | 70 ++++++++++++++++++++++++++++----------------- engines/hopkins/sound.h | 6 ++-- 5 files changed, 86 insertions(+), 71 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e67301b25f..3bc7f41951 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -346,8 +346,8 @@ LABEL_7: _inventX = _vm->_graphicsManager._scrollOffset + 152; _inventY = 114; - int v18 = _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); - int v17 = _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); + _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); + _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false); int v15 = 0; @@ -433,8 +433,8 @@ LABEL_7: _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { _inventDisplayedFl = false; - _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _inventX, 114, v18, v17, _vm->_graphicsManager._vesaBuffer, _inventX, 114); - _vm->_graphicsManager.addVesaSegment(_inventX, 114, _inventX + v18, v18 + 114); + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _inventX, 114, _inventWidth, _inventHeight, _vm->_graphicsManager._vesaBuffer, _inventX, 114); + _vm->_graphicsManager.addVesaSegment(_inventX, 114, _inventX + _inventWidth, _inventWidth + 114); _vm->_objectsManager.BOBTOUS = true; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 6d2403265d..44a446e9a6 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -740,11 +740,11 @@ void ObjectsManager::checkCache() { _vm->_globals.Cache[cacheIdx].fieldA = 1; } } else { - int v5 = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y; - if (v5 > 440) - v5 = 500; + int priority = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y; + if (priority > 440) + priority = 500; - beforeSort(SORT_CACHE, cacheIdx, v5); + beforeSort(SORT_CACHE, cacheIdx, priority); _vm->_globals.Cache[cacheIdx].fieldA = 1; _vm->_globals.Cache[cacheIdx].field10 = true; } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 7bca24714a..6bf6e5f4b0 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -47,9 +47,9 @@ int ScriptManager::handleOpcode(byte *dataP) { return 0; int opcodeType = 0; - int v70 = 0; + int vbobFrameIndex = 0; if (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') { - v70 = dataP[6]; + vbobFrameIndex = dataP[6]; int mesgId = (int16)READ_LE_UINT16(dataP + 13); opcodeType = 1; if (!TRAVAILOBJET) { @@ -137,8 +137,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(mesgId, 4); - } - if (TRAVAILOBJET) { + } else { // if (TRAVAILOBJET) if (_vm->_globals._saveData->_data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, dataP[8], 35, 253); if (!_vm->_soundManager._textOffFl) @@ -164,17 +163,17 @@ int ScriptManager::handleOpcode(byte *dataP) { } } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') { if (!_vm->_objectsManager._disableFl) { - int v72 = dataP[5]; - v70 = dataP[6]; + int vbobIdx = dataP[5]; + vbobFrameIndex = dataP[6]; int v4 = dataP[7]; - int v68 = (int16)READ_LE_UINT16(dataP + 8); - int v66 = (int16)READ_LE_UINT16(dataP + 10); - if (v72 == 52) { - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, v68, (int16)READ_LE_UINT16(dataP + 10), v70); - } else if (v72 == 51) { - _vm->_objectsManager.BOB_VIVANT(v70); - } else if (v72 != 50) { - _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); + int vbobPosX = (int16)READ_LE_UINT16(dataP + 8); + int vbobPosY = (int16)READ_LE_UINT16(dataP + 10); + if (vbobIdx == 52) { + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, vbobPosX, (int16)READ_LE_UINT16(dataP + 10), vbobFrameIndex); + } else if (vbobIdx == 51) { + _vm->_objectsManager.BOB_VIVANT(vbobFrameIndex); + } else if (vbobIdx != 50) { + _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, vbobIdx, vbobPosX, vbobPosY, vbobFrameIndex); if (v4) v4 /= _vm->_globals._speed; if (v4 > 1) { @@ -188,7 +187,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } } else // TODO: Remove this: - warning("Former AFFICHE_SPEED1: %d %d %d", v68, v66, v70); + warning("Former AFFICHE_SPEED1: %d %d %d", vbobPosX, vbobPosY, vbobFrameIndex); } opcodeType = 1; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { @@ -255,7 +254,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->_data[svField6] = _vm->_globals._screenId; _vm->_globals._screenId = _vm->_globals._saveData->_data[svField5] = dataP[5]; - v70 = dataP[6]; + vbobFrameIndex = dataP[6]; } opcodeType = 1; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') { @@ -265,7 +264,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } else if (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') { int specialOpcode = (int16)READ_LE_UINT16(dataP + 5); if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) { - v70 = 0; + vbobFrameIndex = 0; switch (specialOpcode) { case 1: @@ -2048,13 +2047,13 @@ int ScriptManager::handleOpcode(byte *dataP) { char v47 = _vm->_globals._saveData->_data[svField341]; if (v47) { if (v47 == 2) - v70 = 5; - if (v47 == 3) - v70 = 4; - if (v47 == 1) - v70 = 6; + vbobFrameIndex = 5; + else if (v47 == 3) + vbobFrameIndex = 4; + else if (v47 == 1) + vbobFrameIndex = 6; _vm->_soundManager.playSound("SOUND83.WAV"); - _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); + _vm->_objectsManager.OPTI_ONE(vbobFrameIndex, 26, 50, 0); if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); if (_vm->_globals._saveData->_data[svField341] == 2) @@ -2078,13 +2077,13 @@ int ScriptManager::handleOpcode(byte *dataP) { char v48 = _vm->_globals._saveData->_data[svField341]; if (v48) { if (v48 == 2) - v70 = 5; + vbobFrameIndex = 5; if (v48 == 3) - v70 = 4; + vbobFrameIndex = 4; if (v48 == 1) - v70 = 6; + vbobFrameIndex = 6; _vm->_soundManager.playSound("SOUND83.WAV"); - _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); + _vm->_objectsManager.OPTI_ONE(vbobFrameIndex, 26, 50, 0); if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); if (_vm->_globals._saveData->_data[svField341] == 2) @@ -2108,13 +2107,13 @@ int ScriptManager::handleOpcode(byte *dataP) { char v49 = _vm->_globals._saveData->_data[svField341]; if (v49) { if (v49 == 2) - v70 = 5; - if (v49 == 3) - v70 = 4; - if (v49 == 1) - v70 = 6; + vbobFrameIndex = 5; + else if (v49 == 3) + vbobFrameIndex = 4; + else if (v49 == 1) + vbobFrameIndex = 6; _vm->_soundManager.playSound("SOUND83.WAV"); - _vm->_objectsManager.OPTI_ONE(v70, 26, 50, 0); + _vm->_objectsManager.OPTI_ONE(vbobFrameIndex, 26, 50, 0); if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); if (_vm->_globals._saveData->_data[svField341] == 2) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 28b5080b33..47b2e6827e 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -203,12 +203,12 @@ SoundManager::SoundManager() { _modPlayingFl = false; for (int i = 0; i < VOICE_COUNT; ++i) - Common::fill((byte *)&Voice[i], (byte *)&Voice[i] + sizeof(VoiceItem), 0); + Common::fill((byte *)&_voice[i], (byte *)&_voice[i] + sizeof(VoiceItem), 0); for (int i = 0; i < SWAV_COUNT; ++i) Common::fill((byte *)&Swav[i], (byte *)&Swav[i] + sizeof(SwavItem), 0); for (int i = 0; i < SOUND_COUNT; ++i) - Common::fill((byte *)&SOUND[i], (byte *)&SOUND[i] + sizeof(SoundItem), 0); - Common::fill((byte *)&Music, (byte *)&Music + sizeof(MusicItem), 0); + Common::fill((byte *)&_sound[i], (byte *)&_sound[i] + sizeof(SoundItem), 0); + Common::fill((byte *)&_music, (byte *)&_music + sizeof(MusicItem), 0); } SoundManager::~SoundManager() { @@ -403,7 +403,7 @@ void SoundManager::playMod(const Common::String &file) { } void SoundManager::loadMusic(const Common::String &file) { - if (Music._active) + if (_music._active) delMusic(); Common::File f; @@ -427,7 +427,7 @@ void SoundManager::loadMusic(const Common::String &file) { f.close(); } - Music._active = true; + _music._active = true; } void SoundManager::playMusic() { @@ -438,7 +438,7 @@ void SoundManager::stopMusic() { } void SoundManager::delMusic() { - Music._active = false; + _music._active = false; } void SoundManager::checkSounds() { @@ -450,7 +450,7 @@ void SoundManager::checkVoiceActivity() { bool hasActiveVoice = false; for (int i = 0; i < VOICE_COUNT; ++i) { checkVoiceStatus(i); - hasActiveVoice |= Voice[i]._status; + hasActiveVoice |= _voice[i]._status; } if (!hasActiveVoice && _soundFl) { @@ -562,8 +562,10 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { SDL_LVOICE(filename, catPos, catLen); oldMusicVol = _musicVolume; - if (!_musicOffFl && _musicVolume > 2) + if (!_musicOffFl && _musicVolume > 2) { _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + } playVoice(); @@ -587,6 +589,9 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { stopVoice(2); DEL_SAMPLE_SDL(20); _musicVolume = oldMusicVol; + if (!_musicOffFl && _musicVolume > 2) { + _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + } _vm->_eventsManager._escKeyFl = false; skipRefreshFl = false; return true; @@ -600,7 +605,7 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { if (checkVoiceStatus(3)) stopVoice(3); DEL_SAMPLE_SDL(soundIndex); - SOUND[soundIndex]._active = false; + _sound[soundIndex]._active = false; } void SoundManager::playSound(const Common::String &file) { @@ -620,24 +625,35 @@ void SoundManager::PLAY_SOUND2(const Common::String &file) { } void SoundManager::MODSetSampleVolume() { - // No implementation needed + for (int idx = 0; idx < SWAV_COUNT; ++idx) { + if (Swav[idx]._active) { + int volume = (idx == 20) ? (_voiceVolume * 255 / 16) : (_soundVolume * 255 / 16); + _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); + } + } } void SoundManager::MODSetVoiceVolume() { - // No implementation needed + for (int idx = 0; idx < SWAV_COUNT; ++idx) { + if (Swav[idx]._active) { + int volume = (idx == 20) ? (_voiceVolume * 255 / 16) : (_soundVolume * 255 / 16); + _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); + } + } } void SoundManager::MODSetMusicVolume(int volume) { - // No implementation needed + if (_vm->_mixer->isSoundHandleActive(_musicHandle)) + _vm->_mixer->setChannelVolume(_musicHandle, volume * 255 / 16); } void SoundManager::loadSample(int wavIndex, const Common::String &file) { LOAD_SAMPLE2_SDL(wavIndex, file, 0); - SOUND[wavIndex]._active = true; + _sound[wavIndex]._active = true; } void SoundManager::playSample(int wavIndex, int voiceMode) { - if (!_soundOffFl && SOUND[wavIndex]._active) { + if (!_soundOffFl && _sound[wavIndex]._active) { if (_soundFl) delWav(_currentSoundIndex); if (voiceMode == 5) { @@ -661,7 +677,7 @@ void SoundManager::playSample(int wavIndex, int voiceMode) { } void SoundManager::PLAY_SAMPLE2(int idx) { - if (!_soundOffFl && SOUND[idx]._active) { + if (!_soundOffFl && _sound[idx]._active) { if (_soundFl) delWav(_currentSoundIndex); if (checkVoiceStatus(1)) @@ -671,25 +687,25 @@ void SoundManager::PLAY_SAMPLE2(int idx) { } bool SoundManager::checkVoiceStatus(int voiceIndex) { - if (Voice[voiceIndex]._status) { - int wavIndex = Voice[voiceIndex]._wavIndex; + if (_voice[voiceIndex]._status) { + int wavIndex = _voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._audioStream != NULL && Swav[wavIndex]._audioStream->endOfStream()) stopVoice(voiceIndex); } - return Voice[voiceIndex]._status; + return _voice[voiceIndex]._status; } void SoundManager::stopVoice(int voiceIndex) { - if (Voice[voiceIndex]._status) { - Voice[voiceIndex]._status = false; - int wavIndex = Voice[voiceIndex]._wavIndex; + if (_voice[voiceIndex]._status) { + _voice[voiceIndex]._status = false; + int wavIndex = _voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { if (Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } } - Voice[voiceIndex]._status = false; + _voice[voiceIndex]._status = false; } void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength) { @@ -703,8 +719,8 @@ void SoundManager::playVoice() { if (!Swav[20]._active) error("Bad handle"); - if (!Voice[2]._status) { - int wavIndex = Voice[2]._wavIndex; + if (!_voice[2]._status) { + int wavIndex = _voice[2]._wavIndex; if (Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } @@ -775,11 +791,11 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { if (!Swav[wavIndex]._active) warning("Bad handle"); - if (Voice[voiceIndex]._status && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) + if (_voice[voiceIndex]._status && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); - Voice[voiceIndex]._status = true; - Voice[voiceIndex]._wavIndex = wavIndex; + _voice[voiceIndex]._status = true; + _voice[voiceIndex]._wavIndex = wavIndex; int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 622e842d5d..081046d335 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -100,10 +100,10 @@ public: bool _modPlayingFl; int _oldSoundNumber; - VoiceItem Voice[VOICE_COUNT]; + VoiceItem _voice[VOICE_COUNT]; SwavItem Swav[SWAV_COUNT]; - SoundItem SOUND[SOUND_COUNT]; - MusicItem Music; + SoundItem _sound[SOUND_COUNT]; + MusicItem _music; public: SoundManager(); ~SoundManager(); -- cgit v1.2.3 From 82ecfd537f8cb52701cc05e39457d00ce71ecb59 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 23 Jan 2013 01:38:34 +0100 Subject: HOPKINS: Some renaming and refactoring in globals, TalkManager and FontsManager --- engines/hopkins/font.cpp | 4 +- engines/hopkins/font.h | 2 +- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 18 +++---- engines/hopkins/objects.cpp | 16 +++--- engines/hopkins/script.cpp | 92 ++++++++++++++++---------------- engines/hopkins/sound.cpp | 4 ++ engines/hopkins/talk.cpp | 124 ++++++++++++++++++++------------------------ engines/hopkins/talk.h | 4 +- 10 files changed, 131 insertions(+), 137 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index e7d100b380..b7b9ecf3b6 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -110,7 +110,7 @@ void FontManager::setOptimalColor(int idx1, int idx2, int idx3, int idx4) { /** * Init text structure */ -void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color) { +void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color) { assert(idx - 5 >= 0 && (idx - 5) <= MAX_TEXT); TxtItem &txt = _text[idx - 5]; @@ -120,7 +120,7 @@ void FontManager::initTextBuffers(int idx, int messageId, const Common::String & txt._pos.y = yp; txt._messageId = messageId; txt._textType = textType; - txt._length = a9; + txt._length = length; txt._color = color; } diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 10466ba529..3a81361de1 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -76,7 +76,7 @@ public: void hideText(int idx); void setTextColor(int idx, byte colByte); void setOptimalColor(int idx1, int idx2, int idx3, int idx4); - void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color); + void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color); void box(int idx, int messageId, const Common::String &filename, int xp, int yp); void displayTextVesa(int xp, int yp, const Common::String &message, int col); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index af942b94d0..68692735e1 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -202,7 +202,7 @@ Globals::Globals() { NOMARCHE = false; _optionDialogFl = false; _cacheFl = false; - NOPARLE = false; + _introSpeechOffFl = false; couleur_40 = 50; // Reset indexed variables diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 4f277de7e4..272c14be94 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -382,7 +382,7 @@ public: int _sortedDisplayCount; bool NOT_VERIF; bool _cacheFl; - bool NOPARLE; + bool _introSpeechOffFl; bool PLAN_FLAG; bool GOACTION; int Compteur; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index aa93289cc0..2b81867060 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2009,9 +2009,9 @@ void HopkinsEngine::bombExplosion() { _eventsManager.VBL(); } - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO2("vire.pe2"); - _globals.NOPARLE = false; + _globals._introSpeechOffFl = false; _objectsManager.setBobAnimation(7); for (int idx = 0; idx < 100; ++idx) { @@ -2078,9 +2078,9 @@ void HopkinsEngine::handleConflagration() { for (int cpt = 0; cpt <= 249; cpt++) _eventsManager.VBL(); - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("SVGARD1.pe2"); - _globals.NOPARLE = false; + _globals._introSpeechOffFl = false; for (int cpt = 0; cpt <= 49; cpt++) _eventsManager.VBL(); @@ -2203,7 +2203,7 @@ void HopkinsEngine::playEnding() { _eventsManager.VBL(); while (_objectsManager.BOBPOSI(6) != 54); - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("GM4.PE2"); _globals._disableInventFl = true; _objectsManager.stopBobAnimation(6); @@ -2221,7 +2221,7 @@ void HopkinsEngine::playEnding() { _eventsManager.VBL(); while (_objectsManager.BOBPOSI(7) != 65); - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("DUELB4.PE2"); _eventsManager.mouseOff(); _globals._disableInventFl = true; @@ -2230,14 +2230,14 @@ void HopkinsEngine::playEnding() { _eventsManager.VBL(); while (_objectsManager.BOBPOSI(7) != 72); - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("DUELH1.PE2"); do _eventsManager.VBL(); while (_objectsManager.BOBPOSI(7) != 81); - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("DUELB5.PE2"); do @@ -2288,7 +2288,7 @@ void HopkinsEngine::playEnding() { _animationManager.playAnim2("BERM.ANM", 100, 24, 300); _objectsManager.stopBobAnimation(7); _objectsManager.setBobAnimation(8); - _globals.NOPARLE = true; + _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("GM5.PE2"); _globals._disableInventFl = true; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 44a446e9a6..fb788a7031 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1970,16 +1970,16 @@ void ObjectsManager::PLAN_BETA() { if (mouseButton) { if (_vm->_globals._saveData->_data[svField170] == 1 && !_vm->_globals._saveData->_data[svField171]) { _vm->_globals._saveData->_data[svField171] = 1; - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; mouseButton = 0; } if (_vm->_globals._saveData->_data[svField80] == 1 && !_vm->_globals._saveData->_data[svField172]) { _vm->_globals._saveData->_data[svField172] = 1; - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; mouseButton = 0; _vm->_eventsManager._curMouseButton = 0; } @@ -3168,9 +3168,9 @@ void ObjectsManager::handleSpecialGames() { break; _vm->_globals._saveData->_data[svField173] = 1; - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; if (_vm->_globals._censorshipFl) break; @@ -3279,7 +3279,7 @@ void ObjectsManager::handleSpecialGames() { do _vm->_eventsManager.VBL(); while (BOBPOSI(8) != 3); - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); stopBobAnimation(8); _vm->_globals._saveData->_data[svField333] = 1; @@ -3803,7 +3803,7 @@ void ObjectsManager::SPECIAL_INI() { _vm->_globals.iRegul = 1; _vm->_globals._disableInventFl = false; _vm->_graphicsManager._noFadingFl = true; - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); _vm->_graphicsManager._noFadingFl = true; _vm->_globals._disableInventFl = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 6bf6e5f4b0..2aa96c8145 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -881,9 +881,9 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 52: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 53: @@ -924,11 +924,11 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 58: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); _vm->_globals._saveData->_data[svField176] = 1; _vm->_globals._saveData->_data[svField270] = 2; - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 59: { @@ -1104,9 +1104,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 84: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 85: @@ -1130,9 +1130,9 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField231] == 1) { _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); } else { - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; } break; @@ -1319,9 +1319,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 98: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 100: @@ -1333,22 +1333,22 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 103: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 104: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 105: @@ -1552,33 +1552,33 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 108: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("peche1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 109: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("peche2.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 110: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("peche3.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 111: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("peche4.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 112: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("teint1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 113: @@ -1602,9 +1602,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 171: { - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("gred1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; @@ -1632,9 +1632,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 173: { - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; @@ -1709,21 +1709,21 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 176: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("gred2.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 177: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 200: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 201: @@ -1739,9 +1739,9 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 202: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 203: @@ -1922,15 +1922,15 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 215: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("aviat.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 216: - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; break; case 229: @@ -1997,9 +1997,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(12) != 6); - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -2033,9 +2033,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(13) != 48); - _vm->_globals.NOPARLE = true; + _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; _vm->_graphicsManager.fadeOutLong(); _vm->_objectsManager.stopBobAnimation(13); _vm->_graphicsManager._noFadingFl = true; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 47b2e6827e..3ef1618d8b 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -561,6 +561,8 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { } SDL_LVOICE(filename, catPos, catLen); + + // Reduce music volume during speech oldMusicVol = _musicVolume; if (!_musicOffFl && _musicVolume > 2) { _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); @@ -588,6 +590,8 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { stopVoice(2); DEL_SAMPLE_SDL(20); + + // Speech is over, set the music volume back to normal _musicVolume = oldMusicVol; if (!_musicOffFl && _musicVolume > 2) { _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 77705d735f..7df6b21c51 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -51,7 +51,6 @@ void TalkManager::setParent(HopkinsEngine *vm) { void TalkManager::PARLER_PERSO(const Common::String &filename) { Common::String spriteFilename; - int answer = 0; _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); @@ -99,29 +98,30 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _dialogueMesgId2 = _dialogueMesgId1 + 1; _dialogueMesgId3 = _dialogueMesgId1 + 2; _dialogueMesgId4 = _dialogueMesgId1 + 3; - int v14 = _vm->_eventsManager._mouseCursorId; + int oldMouseCursorId = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); - if (!_vm->_globals.NOPARLE) { - int v5; + if (!_vm->_globals._introSpeechOffFl) { + int answer = 0; + int dlgAnswer; do { - v5 = DIALOGUE(); - if (v5 != _dialogueMesgId4) - answer = DIALOGUE_REP(v5); + dlgAnswer = dialogQuestion(); + if (dlgAnswer != _dialogueMesgId4) + answer = dialogAnswer(dlgAnswer); if (answer == -1) - v5 = _dialogueMesgId4; + dlgAnswer = _dialogueMesgId4; _vm->_eventsManager.VBL(); - } while (v5 != _dialogueMesgId4); + } while (dlgAnswer != _dialogueMesgId4); } - if (_vm->_globals.NOPARLE) { - int v6 = 1; - int v7; + if (_vm->_globals._introSpeechOffFl) { + int idx = 1; + int answer; do - v7 = DIALOGUE_REP(v6++); - while (v7 != -1); + answer = dialogAnswer(idx++); + while (answer != -1); } clearCharacterAnim(); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(false); @@ -130,9 +130,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager.PERSO_ON = false; - _vm->_eventsManager._mouseCursorId = v14; + _vm->_eventsManager._mouseCursorId = oldMouseCursorId; - _vm->_eventsManager.changeMouseCursor(v14); + _vm->_eventsManager.changeMouseCursor(oldMouseCursorId); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); if (_vm->getIsDemo() == false) @@ -154,7 +154,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { void TalkManager::PARLER_PERSO2(const Common::String &filename) { // TODO: The original disables the mouse cursor here STATI = true; - bool v7 = _vm->_globals._disableInventFl; + bool oldDisableInventFl = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; _characterBuffer = _vm->_fileManager.searchCat(filename, 5); _characterSize = _vm->_globals._catalogSize; @@ -192,23 +192,23 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); - if (!_vm->_globals.NOPARLE) { - int v3; + if (!_vm->_globals._introSpeechOffFl) { + int answer; do { - v3 = DIALOGUE(); - if (v3 != _dialogueMesgId4) { - if (DIALOGUE_REP(v3) == -1) - v3 = _dialogueMesgId4; + answer = dialogQuestion(); + if (answer != _dialogueMesgId4) { + if (dialogAnswer(answer) == -1) + answer = _dialogueMesgId4; } - } while (v3 != _dialogueMesgId4); + } while (answer != _dialogueMesgId4); } - if (_vm->_globals.NOPARLE) { - int v4 = 1; - int v5; + if (_vm->_globals._introSpeechOffFl) { + int idx = 1; + int answer; do - v5 = DIALOGUE_REP(v4++); - while (v5 != -1); + answer = dialogAnswer(idx++); + while (answer != -1); } _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); @@ -218,7 +218,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); // TODO: The original reenables the mouse cursor here - _vm->_globals._disableInventFl = v7; + _vm->_globals._disableInventFl = oldDisableInventFl; STATI = false; } @@ -226,7 +226,7 @@ void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const dest = Common::String(srcData + srcStart); } -int TalkManager::DIALOGUE() { +int TalkManager::dialogQuestion() { if (STATI) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; int curVal = (int16)READ_LE_UINT16(bufPtr); @@ -264,7 +264,7 @@ int TalkManager::DIALOGUE() { _vm->_fontManager.showText(8); int retVal = -1; - bool v6 = false; + bool loopCond = false; do { int mousePosY = _vm->_eventsManager.getMouseY(); if (sentence1PosY < mousePosY && mousePosY < (sentence2PosY - 1)) { @@ -286,10 +286,10 @@ int TalkManager::DIALOGUE() { _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) - v6 = true; + loopCond = true; if (retVal == -1) - v6 = false; - } while (!_vm->shouldQuit() && !v6); + loopCond = false; + } while (!_vm->shouldQuit() && !loopCond); _vm->_soundManager.mixVoice(retVal, 1); _vm->_fontManager.hideText(5); @@ -327,34 +327,24 @@ int TalkManager::DIALOGUE() { return retVal; } -int TalkManager::DIALOGUE_REP(int idx) { - int v1; - byte *v3; - int v6; - int v7; - int v21; - int v22; - int v23; - int v24; - int v25; - - v1 = 0; - v3 = _characterBuffer + 110; - for (; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) { - ++v1; - if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < v1) +int TalkManager::dialogAnswer(int idx) { + int charIdx; + byte *charBuf; + for (charBuf = _characterBuffer + 110, charIdx = 0; (int16)READ_LE_UINT16(charBuf) != idx; charBuf += 20) { + ++charIdx; + if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < charIdx) return -1; } - v22 = (int16)READ_LE_UINT16((uint16 *)v3 + 1); - v25 = (int16)READ_LE_UINT16((uint16 *)v3 + 2); - v24 = (int16)READ_LE_UINT16((uint16 *)v3 + 3); - v23 = (int16)READ_LE_UINT16((uint16 *)v3 + 4); - _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)v3 + 5); - _dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)v3 + 6); - _dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)v3 + 7); - v6 = (int16)READ_LE_UINT16((uint16 *)v3 + 8); - v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9); + int mesgId = (int16)READ_LE_UINT16((uint16 *)charBuf + 1); + int mesgPosX = (int16)READ_LE_UINT16((uint16 *)charBuf + 2); + int mesgPosY = (int16)READ_LE_UINT16((uint16 *)charBuf + 3); + int mesgLength = (int16)READ_LE_UINT16((uint16 *)charBuf + 4); + _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)charBuf + 5); + _dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)charBuf + 6); + _dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)charBuf + 7); + int v6 = (int16)READ_LE_UINT16((uint16 *)charBuf + 8); + int v7 = (int16)READ_LE_UINT16((uint16 *)charBuf + 9); if (v7) _vm->_globals._saveData->_data[svField4] = v7; @@ -387,10 +377,10 @@ int TalkManager::DIALOGUE_REP(int idx) { } if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 5, v23, 252); + _vm->_fontManager.initTextBuffers(9, mesgId, _answersFilename, mesgPosX, mesgPosY, 5, mesgLength, 252); _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.mixVoice(v22, 1)) { + if (!_vm->_soundManager.mixVoice(mesgId, 1)) { _vm->_eventsManager._curMouseButton = 0; _vm->_eventsManager._mouseButton = 0; @@ -435,11 +425,11 @@ int TalkManager::DIALOGUE_REP(int idx) { } else { dialogEndTalk(); } - v21 = 0; + int result = 0; if (!_dialogueMesgId1) - v21 = -1; + result = -1; - return v21; + return result; } void TalkManager::searchCharacterPalette(int startIdx, bool dark) { @@ -1090,7 +1080,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { dialogTalk(); clearCharacterAnim(); clearCharacterAnim(); - _vm->_globals.NOPARLE = false; + _vm->_globals._introSpeechOffFl = false; _characterBuffer = _vm->_globals.freeMemory(_characterBuffer); _characterSprite = _vm->_globals.freeMemory(_characterSprite); _vm->_graphicsManager.NB_SCREEN(false); diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index a71ddfba7b..db49e7bb02 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -52,8 +52,8 @@ public: void PARLER_PERSO2(const Common::String &filename); void PARLER_PERSO(const Common::String &filename); void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData); - int DIALOGUE(); - int DIALOGUE_REP(int idx); + int dialogQuestion(); + int dialogAnswer(int idx); void searchCharacterPalette(int startIdx, bool dark); void dialogWait(); void dialogTalk(); -- cgit v1.2.3 From 56ca87b3a573c64e8c82d9c6fa8427ddb5458ba5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 23 Jan 2013 01:42:31 +0100 Subject: HOPKINS: Modify misc setVolume functions so they are a bit less precise --- engines/hopkins/sound.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 3ef1618d8b..d24c3e10b2 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -630,19 +630,17 @@ void SoundManager::PLAY_SOUND2(const Common::String &file) { void SoundManager::MODSetSampleVolume() { for (int idx = 0; idx < SWAV_COUNT; ++idx) { - if (Swav[idx]._active) { - int volume = (idx == 20) ? (_voiceVolume * 255 / 16) : (_soundVolume * 255 / 16); + if (idx != 20 && Swav[idx]._active) { + int volume = _soundVolume * 255 / 16; _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); } } } void SoundManager::MODSetVoiceVolume() { - for (int idx = 0; idx < SWAV_COUNT; ++idx) { - if (Swav[idx]._active) { - int volume = (idx == 20) ? (_voiceVolume * 255 / 16) : (_soundVolume * 255 / 16); - _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); - } + if (Swav[20]._active) { + int volume = _voiceVolume * 255 / 16; + _vm->_mixer->setChannelVolume(Swav[20]._soundHandle, volume); } } -- cgit v1.2.3 From 668f2ddad793ee0e4ae5de4571ceffbc64a3a241 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 23 Jan 2013 08:10:36 +0100 Subject: HOPKINS: Renaming in globals and ObjectsManager --- engines/hopkins/globals.cpp | 10 +-- engines/hopkins/globals.h | 12 +-- engines/hopkins/objects.cpp | 193 +++++++++++++++++++++----------------------- engines/hopkins/objects.h | 2 +- 4 files changed, 103 insertions(+), 114 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 68692735e1..a66dafc053 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -206,18 +206,18 @@ Globals::Globals() { couleur_40 = 50; // Reset indexed variables - force_to_data_0 = 0; + _hotspotTextColor = 0; oldzone_46 = 0; old_x1_65 = 0; old_y1_66 = 0; old_x2_67 = 0; old_y2_68 = 0; - old_zone_68 = 0; + _oldMouseZoneId = 0; _oldZoneNum = 0; - old_x_69 = 0; - old_y_70 = 0; + _oldMouseX = 0; + _oldMouseY = 0; compteur_71 = 0; - zozo_73 = 0; + _forceHideText = false; j_104 = 0; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 272c14be94..db8409a664 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -105,8 +105,8 @@ struct BobItem { int _oldWidth; int _oldHeight; int _oldX2; - int _oldY2; - int field4A; + int _zooInmFactor; + int _zoomOutFactor; }; struct LockAnimItem { @@ -392,15 +392,15 @@ public: int pathFindingDepth; - int force_to_data_0; + int _hotspotTextColor; int oldzone_46; int old_x1_65; int old_y1_66; int old_x2_67; - int old_zone_68; - int old_x_69, old_y_70; + int _oldMouseZoneId; + int _oldMouseX, _oldMouseY; int compteur_71; - int zozo_73; + bool _forceHideText; int old_y2_68; int _oldZoneNum; int j_104; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index fb788a7031..0c76c56357 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -328,8 +328,8 @@ void ObjectsManager::displaySprite() { } if (_priorityFl && _vm->_globals._sortedDisplayCount) { - for (int v33 = 1; v33 <= 48; v33++) - arr[v33] = v33; + for (int i = 1; i <= 48; i++) + arr[i] = i; do { loopCondFl = false; @@ -515,7 +515,7 @@ void ObjectsManager::DEF_BOB(int idx) { else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals._bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex, - _vm->_globals._bob[idx].field4A, _vm->_globals._bob[idx]._oldY2, + _vm->_globals._bob[idx]._zoomOutFactor, _vm->_globals._bob[idx]._zooInmFactor, _vm->_globals._bob[idx]._flipFl); _vm->_globals.Liste2[idx]._visibleFl = true; @@ -601,8 +601,8 @@ void ObjectsManager::BOB_OFF(int idx) { _vm->_globals._bob[idx].field0++; } -void ObjectsManager::BOB_OFFSET(int idx, int v) { - _vm->_globals._bob[idx]._oldX2 = v; +void ObjectsManager::BOB_OFFSET(int idx, int offset) { + _vm->_globals._bob[idx]._oldX2 = offset; } void ObjectsManager::SCBOB(int idx) { @@ -680,17 +680,17 @@ void ObjectsManager::CALCUL_BOB(int idx) { deltaY = -_vm->_graphicsManager.zoomOut(abs(deltaX), negZoom); } - int v13 = _vm->_globals._bob[idx]._xp - deltaX; - int v14 = _vm->_globals._bob[idx]._yp - deltaY; + int newX = _vm->_globals._bob[idx]._xp - deltaX; + int newY = _vm->_globals._bob[idx]._yp - deltaY; _vm->_globals._bob[idx]._activeFl = true; - _vm->_globals._bob[idx]._oldX = v13; - _vm->_globals._bob[idx]._oldY = v14; - _vm->_globals._bob[idx]._oldY2 = posZoom; - _vm->_globals._bob[idx].field4A = negZoom; + _vm->_globals._bob[idx]._oldX = newX; + _vm->_globals._bob[idx]._oldY = newY; + _vm->_globals._bob[idx]._zooInmFactor = posZoom; + _vm->_globals._bob[idx]._zoomOutFactor = negZoom; _vm->_globals.Liste2[idx]._visibleFl = true; - _vm->_globals.Liste2[idx]._posX = v13; - _vm->_globals.Liste2[idx]._posY = v14; + _vm->_globals.Liste2[idx]._posX = newX; + _vm->_globals.Liste2[idx]._posY = newY; int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); @@ -1266,19 +1266,13 @@ void ObjectsManager::setFlipSprite(int idx, bool flipFl) { } void ObjectsManager::checkZone() { - int v0; - int v1; - int v2; - uint16 v3; - int v4; - - v0 = _vm->_eventsManager.getMouseX(); - v1 = _vm->_eventsManager.getMouseY(); - v2 = v1; + int mouseX = _vm->_eventsManager.getMouseX(); + int mouseY = _vm->_eventsManager.getMouseY(); + int oldMouseY = mouseY; if (_vm->_globals.PLAN_FLAG - || _vm->_eventsManager._startPos.x >= v0 - || (v1 = _vm->_graphicsManager._scrollOffset + 54, v0 >= v1) - || (v1 = v2 - 1, v1 < 0 || v1 > 59)) { + || _vm->_eventsManager._startPos.x >= mouseX + || (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY) + || (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) { if (_visibleFl) FLAG_VISIBLE_EFFACE = 4; _visibleFl = false; @@ -1287,53 +1281,52 @@ void ObjectsManager::checkZone() { } if (_forceZoneFl) { _vm->_globals.compteur_71 = 100; - _vm->_globals.old_zone_68 = -1; - _vm->_globals.old_x_69 = -200; - _vm->_globals.old_y_70 = -220; + _vm->_globals._oldMouseZoneId = -1; + _vm->_globals._oldMouseX = -200; + _vm->_globals._oldMouseY = -220; _forceZoneFl = false; } - v3 = _vm->_globals.compteur_71 + 1; - _vm->_globals.compteur_71 = v3; - if (v3 <= 1) + _vm->_globals.compteur_71++; + if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || v3 > 4u) { + if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; - if (_vm->_globals.old_x_69 != v0 || _vm->_globals.old_y_70 != v2) { - v4 = MZONE(); + int zoneId; + if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { + zoneId = MZONE(); } else { - v4 = _vm->_globals.old_zone_68; + zoneId = _vm->_globals._oldMouseZoneId; } - if (_vm->_globals.old_zone_68 != v4) { + if (_vm->_globals._oldMouseZoneId != zoneId) { _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); - if (_vm->_globals.zozo_73 == 1) { + if (_vm->_globals._forceHideText) { _vm->_fontManager.hideText(5); - _vm->_globals.zozo_73 = 0; + _vm->_globals._forceHideText = false; return; } } - if (v4 != -1) { - if (_vm->_globals.ZONEP[v4].field6 || _vm->_globals.ZONEP[v4].field7 || - _vm->_globals.ZONEP[v4].field8 || _vm->_globals.ZONEP[v4].field9 || - _vm->_globals.ZONEP[v4].fieldA || _vm->_globals.ZONEP[v4].fieldB || - _vm->_globals.ZONEP[v4].fieldC || _vm->_globals.ZONEP[v4].fieldD || - _vm->_globals.ZONEP[v4].fieldE || _vm->_globals.ZONEP[v4].fieldF) { - if (_vm->_globals.old_zone_68 != v4) { - _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[v4].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); + if (zoneId != -1) { + if (_vm->_globals.ZONEP[zoneId].field6 || _vm->_globals.ZONEP[zoneId].field7 || + _vm->_globals.ZONEP[zoneId].field8 || _vm->_globals.ZONEP[zoneId].field9 || + _vm->_globals.ZONEP[zoneId].fieldA || _vm->_globals.ZONEP[zoneId].fieldB || + _vm->_globals.ZONEP[zoneId].fieldC || _vm->_globals.ZONEP[zoneId].fieldD || + _vm->_globals.ZONEP[zoneId].fieldE || _vm->_globals.ZONEP[zoneId].fieldF) { + if (_vm->_globals._oldMouseZoneId != zoneId) { + _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[zoneId].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); _vm->_fontManager.showText(5); - _vm->_globals.zozo_73 = 1; + _vm->_globals._forceHideText = true; } - _vm->_globals.force_to_data_0 += 25; - if (_vm->_globals.force_to_data_0 > 100) - _vm->_globals.force_to_data_0 = 0; - _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals.force_to_data_0, _vm->_globals.force_to_data_0, - _vm->_globals.force_to_data_0); + _vm->_globals._hotspotTextColor += 25; + if (_vm->_globals._hotspotTextColor > 100) + _vm->_globals._hotspotTextColor = 0; + _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor, + _vm->_globals._hotspotTextColor); if (_vm->_eventsManager._mouseCursorId == 4) { - v1 = 5 * v4; - if (_vm->_globals.ZONEP[v4].field6 == 2) { + if (_vm->_globals.ZONEP[zoneId].field6 == 2) { _vm->_eventsManager.changeMouseCursor(16); _vm->_eventsManager._mouseCursorId = 16; _verb = 16; @@ -1345,16 +1338,15 @@ void ObjectsManager::checkZone() { _vm->_eventsManager.changeMouseCursor(4); } } - _zoneNum = v4; - _vm->_globals.old_x_69 = v0; - _vm->_globals.old_y_70 = v2; - _vm->_globals.old_zone_68 = v4; + _zoneNum = zoneId; + _vm->_globals._oldMouseX = mouseX; + _vm->_globals._oldMouseY = oldMouseY; + _vm->_globals._oldMouseZoneId = zoneId; if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) { - v1 = v4 + 1; - if (v4 != -1 && v4 != 0) + if (zoneId != -1 && zoneId != 0) handleRightButton(); } - if ((_vm->_globals.PLAN_FLAG && v4 == -1) || !v4) { + if ((_vm->_globals.PLAN_FLAG && zoneId == -1) || !zoneId) { _verb = 0; _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); @@ -1363,8 +1355,6 @@ void ObjectsManager::checkZone() { } void ObjectsManager::GOHOME() { - int16 v0; - int16 v1; int16 v3; int16 v4; int16 v9; @@ -1380,12 +1370,10 @@ void ObjectsManager::GOHOME() { int16 v41; int16 v42; int v49; - int v54; - int16 v58; - v0 = 0; - v58 = 0; - v1 = 0; + int v0 = 0; + int v58 = 0; + int v1 = 0; if (_vm->_globals.chemin == (int16 *)g_PTRNUL) return; @@ -1416,25 +1404,26 @@ void ObjectsManager::GOHOME() { } else { setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; + int zoneId; if (_vm->_globals.GOACTION) - v54 = _vm->_globals._saveData->_data[svField2]; + zoneId = _vm->_globals._saveData->_data[svField2]; else - v54 = _zoneNum; + zoneId = _zoneNum; _vm->_globals.chemin = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; - if (v54 > 0) { - if (_vm->_globals.ZONEP[v54]._destX && _vm->_globals.ZONEP[v54]._destY && _vm->_globals.ZONEP[v54]._destY != 31) { - if (_vm->_globals.ZONEP[v54]._spriteIndex == -1) { - _vm->_globals.ZONEP[v54]._destX = 0; - _vm->_globals.ZONEP[v54]._destY = 0; - _vm->_globals.ZONEP[v54]._spriteIndex = 0; + if (zoneId > 0) { + if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { + if (_vm->_globals.ZONEP[zoneId]._spriteIndex == -1) { + _vm->_globals.ZONEP[zoneId]._destX = 0; + _vm->_globals.ZONEP[zoneId]._destY = 0; + _vm->_globals.ZONEP[zoneId]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[v54]._spriteIndex); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v54]._spriteIndex - 59; + setSpriteIndex(0, _vm->_globals.ZONEP[zoneId]._spriteIndex); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[zoneId]._spriteIndex - 59; } } } @@ -2881,38 +2870,38 @@ int ObjectsManager::MZONE() { int xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; int yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { - for (int v1 = 0; v1 <= 48; v1++) { - int v2 = _vm->_globals.BOBZONE[v1]; - if (v2 && _vm->_globals.BOBZONE_FLAG[v1] && _vm->_globals._bob[v2].field0 && _vm->_globals._bob[v2]._frameIndex != 250 && - !_vm->_globals._bob[v2]._disabledAnimationFl && xp > _vm->_globals._bob[v2]._oldX && - xp < _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX && yp > _vm->_globals._bob[v2]._oldY) { - if (yp < _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY) { - if (_vm->_globals.ZONEP[v1]._spriteIndex == -1) { - _vm->_globals.ZONEP[v1]._destX = 0; - _vm->_globals.ZONEP[v1]._destY = 0; + for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) { + int bobId = _vm->_globals.BOBZONE[bobZoneId]; + if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_globals._bob[bobId].field0 && _vm->_globals._bob[bobId]._frameIndex != 250 && + !_vm->_globals._bob[bobId]._disabledAnimationFl && xp > _vm->_globals._bob[bobId]._oldX && + xp < _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX && yp > _vm->_globals._bob[bobId]._oldY) { + if (yp < _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY) { + if (_vm->_globals.ZONEP[bobZoneId]._spriteIndex == -1) { + _vm->_globals.ZONEP[bobZoneId]._destX = 0; + _vm->_globals.ZONEP[bobZoneId]._destY = 0; } - if (!_vm->_globals.ZONEP[v1]._destX && !_vm->_globals.ZONEP[v1]._destY) { - _vm->_globals.ZONEP[v1]._destX = _vm->_globals._bob[v2]._oldWidth + _vm->_globals._bob[v2]._oldX; - _vm->_globals.ZONEP[v1]._destY = _vm->_globals._bob[v2]._oldHeight + _vm->_globals._bob[v2]._oldY + 6; - _vm->_globals.ZONEP[v1]._spriteIndex = -1; + if (!_vm->_globals.ZONEP[bobZoneId]._destX && !_vm->_globals.ZONEP[bobZoneId]._destY) { + _vm->_globals.ZONEP[bobZoneId]._destX = _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX; + _vm->_globals.ZONEP[bobZoneId]._destY = _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY + 6; + _vm->_globals.ZONEP[bobZoneId]._spriteIndex = -1; } - return v1; + return bobZoneId; } } } _vm->_globals.SegmentEnCours = 0; - for (int v7 = 0; v7 <= 99; v7++) { - if (_vm->_globals.ZONEP[v7]._enabledFl && _vm->_globals.CarreZone[v7]._enabledFl == 1 - && _vm->_globals.CarreZone[v7]._left <= xp - && _vm->_globals.CarreZone[v7]._right >= xp - && _vm->_globals.CarreZone[v7]._top <= yp - && _vm->_globals.CarreZone[v7]._bottom >= yp) { - if (_vm->_globals.CarreZone[v7]._squareZoneFl) { - _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[v7]._minZoneLineIdx].field2; + for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { + if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _vm->_globals.CarreZone[squareZoneId]._enabledFl == 1 + && _vm->_globals.CarreZone[squareZoneId]._left <= xp + && _vm->_globals.CarreZone[squareZoneId]._right >= xp + && _vm->_globals.CarreZone[squareZoneId]._top <= yp + && _vm->_globals.CarreZone[squareZoneId]._bottom >= yp) { + if (_vm->_globals.CarreZone[squareZoneId]._squareZoneFl) { + _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[squareZoneId]._minZoneLineIdx].field2; return _vm->_globals.oldzone_46; } - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = _vm->_globals.CarreZone[v7]._minZoneLineIdx; - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = _vm->_globals.CarreZone[v7]._maxZoneLineIdx; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = _vm->_globals.CarreZone[squareZoneId]._minZoneLineIdx; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = _vm->_globals.CarreZone[squareZoneId]._maxZoneLineIdx; ++_vm->_globals.SegmentEnCours; } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 3c3db8687b..edbe544365 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -118,7 +118,7 @@ public: void DEF_BOB(int idx); void BOB_VISU(int idx); void BOB_OFF(int idx); - void BOB_OFFSET(int idx, int v); + void BOB_OFFSET(int idx, int offset); void SCBOB(int idx); void CALCUL_BOB(int idx); -- cgit v1.2.3 From efe910d6893ae680f35647b6a3a1e4043bfdb8fa Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 23 Jan 2013 21:44:31 +0100 Subject: HOPKINS: Fix GCC warnings --- engines/hopkins/lines.cpp | 2 +- engines/hopkins/objects.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 6fc9436a7a..2791113c2f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2984,7 +2984,7 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { } } else if (a3 < a5 && a6 < a4) { v50 = 12; - int smoothIdx = 0; + smoothIdx = 0; int loopCount = 0; while (v62 < a5 && a6 < v63) { v6 = _vm->_globals.Hopkins[v50].field2; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0c76c56357..380e764dd8 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1392,7 +1392,7 @@ void ObjectsManager::GOHOME() { computeAndSetSpriteSize(); newPosX = *_vm->_globals.chemin++; newPosY = *_vm->_globals.chemin++; - int newDirection = *_vm->_globals.chemin++; + newDirection = *_vm->_globals.chemin++; _vm->_globals.chemin++; if (newPosX != -1 || newPosY != -1) { @@ -2522,7 +2522,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { break; arrDataIdx[7] = 0; arrLineIdx[7] = -1; - if ((arrDelta[1] <= delta && arrLineIdx[1] != -1) || arrDelta[3] <= delta && arrLineIdx[3] != -1 || arrDelta[5] <= delta && arrLineIdx[5] != -1) + if ((arrDelta[1] <= delta && arrLineIdx[1] != -1) || (arrDelta[3] <= delta && arrLineIdx[3] != -1) || (arrDelta[5] <= delta && arrLineIdx[5] != -1)) break; } arrDelta[7] = delta; -- cgit v1.2.3 From 51df9a7f9bddcd2c595317453bf01a5eca5b20d6 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 24 Jan 2013 00:05:36 +0100 Subject: HOPKINS: Change a few spaces to tabs --- engines/hopkins/anim.cpp | 2 +- engines/hopkins/computer.cpp | 2 +- engines/hopkins/font.cpp | 8 ++++---- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/talk.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index d18c4fbd1c..1875932a53 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -543,7 +543,7 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_globals.Bank[idx]._fileHeader = 0; if (fileDataPtr[1] == 'L' && fileDataPtr[2] == 'E') - _vm->_globals.Bank[idx]._fileHeader = 1; + _vm->_globals.Bank[idx]._fileHeader = 1; else if (fileDataPtr[1] == 'O' && fileDataPtr[2] == 'R') _vm->_globals.Bank[idx]._fileHeader = 2; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 8d9b108ce3..e44b77c317 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -927,7 +927,7 @@ void ComputerManager::displayScoreChar(int charPos, int charDisp) { xp = 134; if (charDisp >= '0' && charDisp <= '9') - idx = charDisp - 45; + idx = charDisp - 45; _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 11, idx); } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index b7b9ecf3b6..1077cad865 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -152,10 +152,10 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _vm->_graphicsManager.Restore_Mem( _vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, - xp, - yp, - _text[idx]._width, - _text[idx]._height); + xp, + yp, + _text[idx]._width, + _text[idx]._height); _vm->_graphicsManager.addVesaSegment(xp, yp, xp + width, yp + height); } } else { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2b81867060..647851dbbd 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1972,7 +1972,7 @@ void HopkinsEngine::displayEndDemo() { if (_globals._language == LANG_FR) _graphicsManager.loadImage("endfr"); else - _graphicsManager.loadImage("enduk"); + _graphicsManager.loadImage("enduk"); _graphicsManager.fadeInLong(); _eventsManager.delay(1500); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 7df6b21c51..eb72133c4d 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -206,7 +206,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { if (_vm->_globals._introSpeechOffFl) { int idx = 1; int answer; - do + do answer = dialogAnswer(idx++); while (answer != -1); } -- cgit v1.2.3 From 380bf2ba1a664f5aaca46b4e4161ca79ed3f53b2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Jan 2013 00:05:57 +0100 Subject: HOPKINS: Some renaming and refactoring in ObjectsManager and LinesManager --- engines/hopkins/lines.cpp | 75 ++++---------- engines/hopkins/objects.cpp | 237 +++++++++++++++++--------------------------- 2 files changed, 114 insertions(+), 198 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2791113c2f..ef4e75c250 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -452,27 +452,17 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i int v50; if (a1 < a4) { for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { - int16 *v10 = Ligne[a1]._lineData; - int v11 = v10[2 * i]; - v50 = v10[2 * i + 1]; - - int v12 = v8; - a6[v12] = v11; - a6[v12 + 1] = v50; - a6[v12 + 2] = Ligne[a1].field6; + a6[v8] = Ligne[a1]._lineData[2 * i]; + a6[v8 + 1] = Ligne[a1]._lineData[2 * i + 1]; + a6[v8 + 2] = Ligne[a1].field6; v8 += a7; } for (int v34 = a1 + 1; v34 < a4; v34++) { for (int i = 0; i < Ligne[v34]._lineDataEndIdx; i++) { - int16 *v14 = Ligne[v34]._lineData; - int v15 = v14[2 * i]; - v50 = v14[2 * i + 1]; - int v16 = v8; - - a6[v16] = v15; - a6[v16 + 1] = v50; - a6[v16 + 2] = Ligne[v34].field6; + a6[v8] = Ligne[v34]._lineData[2 * i]; + a6[v8 + 1] = Ligne[v34]._lineData[2 * i + 1]; + a6[v8 + 2] = Ligne[v34].field6; v8 += a7; } } @@ -482,30 +472,17 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if (v36 > a4) { for (int j = v7; j > 0; --j) { - int16 *v18 = Ligne[v36]._lineData; - int v19 = v18[2 * j]; - v50 = v18[2 * j + 1]; - - int v20 = v8; - a6[v20] = v19; - a6[v20 + 1] = v50; - a6[v20 + 2] = Ligne[v36].field8; + a6[v8] = Ligne[v36]._lineData[2 * j]; + a6[v8 + 1] = Ligne[v36]._lineData[2 * j + 1]; + a6[v8 + 2] = Ligne[v36].field8; v8 += a7; } - if ((int)(v36 - 1) > a4) { - for (int v35 = v36 - 1; v35 > a4; v35--) { - for (int k = Ligne[v35]._lineDataEndIdx - 1; k > 0; --k) { - int16 *v22 = Ligne[v35]._lineData; - int v23 = v22[2 * k]; - v50 = v22[2 * k + 1]; - - int v24 = v8; - a6[v24] = v23; - a6[v24 + 1] = v50; - a6[v24 + 2] = Ligne[v35].field8; - v8 += a7; - } - + for (int v35 = v36 - 1; v35 > a4; v35--) { + for (int k = Ligne[v35]._lineDataEndIdx - 1; k > 0; --k) { + a6[v8] = Ligne[v35]._lineData[2 * k]; + a6[v8 + 1] = Ligne[v35]._lineData[2 * k + 1]; + a6[v8 + 2] = Ligne[v35].field8; + v8 += a7; } } v7 = Ligne[a4]._lineDataEndIdx - 1; @@ -514,26 +491,16 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i if (v36 == a4) { if (a5 >= v7) { for (int i = v7; i > a5; i++) { - int16 *v30 = Ligne[a4]._lineData; - int v31 = v30[2 * i]; - v50 = v30[2 * i + 1]; - - int v32 = v8; - a6[v32] = v31; - a6[v32 + 1] = v50; - a6[v32 + 2] = Ligne[a4].field6; + a6[v8] = Ligne[a4]._lineData[2 * i]; + a6[v8 + 1] = Ligne[a4]._lineData[2 * i + 1]; + a6[v8 + 2] = Ligne[a4].field6; v8 += a7; } } else { for (int i = v7; i > a5; --i) { - int16 *v26 = Ligne[a4]._lineData; - int v27 = v26[2 * i]; - v50 = v26[2 * i+ 1]; - - int v28 = v8; - a6[v28] = v27; - a6[v28 + 1] = v50; - a6[v28 + 2] = Ligne[a4].field8; + a6[v8] = Ligne[a4]._lineData[2 * i]; + a6[v8 + 1] = Ligne[a4]._lineData[2 * i+ 1]; + a6[v8 + 2] = Ligne[a4].field8; v8 += a7; } } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 380e764dd8..7b6128a98b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -895,16 +895,6 @@ void ObjectsManager::beforeSort(SortMode triMode, int index, int priority) { // Display BOB Anim void ObjectsManager::displayBobAnim() { - int v1; - int v5; - uint v6; - int v10; - int v11; - int v14; - byte *v20; - byte *v21; - int v24; - for (int idx = 1; idx <= 35; idx++) { if (idx <= 20 && PERSO_ON) { _vm->_globals._bob[idx].field1C = false; @@ -915,7 +905,7 @@ void ObjectsManager::displayBobAnim() { continue; _vm->_globals._bob[idx].field1C = false; - v1 = _vm->_globals._bob[idx].field20; + int v1 = _vm->_globals._bob[idx].field20; if (v1 == -1) v1 = 50; if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) { @@ -937,8 +927,8 @@ void ObjectsManager::displayBobAnim() { continue; } - v20 = _vm->_globals._bob[idx]._animData + 20; - v24 = _vm->_globals._bob[idx].field10; + byte *v20 = _vm->_globals._bob[idx]._animData + 20; + int v24 = _vm->_globals._bob[idx].field10; _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); if (_vm->_globals._lockedAnims[idx]._enableFl) _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; @@ -951,10 +941,10 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; _vm->_globals._bob[idx]._flipFl = (v20[2 * v24 + 9] != 0); _vm->_globals._bob[idx].field10 += 5; - v5 = _vm->_globals._bob[idx].field12; + int v5 = _vm->_globals._bob[idx].field12; if (v5 > 0) { - v6 = v5 / _vm->_globals._speed; + int v6 = v5 / _vm->_globals._speed; _vm->_globals._bob[idx].field12 = v5 / _vm->_globals._speed; if (v6 > 0) { _vm->_globals._bob[idx].field14 = 1; @@ -972,7 +962,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx].field0 = 11; } else { _vm->_globals._bob[idx].field10 = 0; - v21 = _vm->_globals._bob[idx]._animData + 20; + byte *v21 = _vm->_globals._bob[idx]._animData + 20; _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); if (_vm->_globals._lockedAnims[idx]._enableFl) @@ -986,10 +976,10 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx]._frameIndex = v21[8]; _vm->_globals._bob[idx]._flipFl = (v21[9] != 0); _vm->_globals._bob[idx].field10 += 5; - v10 = _vm->_globals._bob[idx].field12; + int v10 = _vm->_globals._bob[idx].field12; if (v10 > 0) { - v11 = v10 / _vm->_globals._speed; + int v11 = v10 / _vm->_globals._speed; _vm->_globals._bob[idx].field12 = v10 / _vm->_globals._speed; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) @@ -1015,9 +1005,7 @@ void ObjectsManager::displayBobAnim() { for (int i = 1; i <= 35; i++) { if (i > 20 || !PERSO_ON) { if ((_vm->_globals._bob[i].field0 == 10) && (_vm->_globals._bob[i].field1C)) { - v14 = _vm->_globals._bob[i].field1E; - - if ((v14 != 2) && (v14 != 4)) { + if ((_vm->_globals._bob[i].field1E != 2) && (_vm->_globals._bob[i].field1E != 4)) { if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, @@ -1355,22 +1343,6 @@ void ObjectsManager::checkZone() { } void ObjectsManager::GOHOME() { - int16 v3; - int16 v4; - int16 v9; - int16 v10; - int16 v16; - int16 v20; - int16 v23; - int16 v24; - int16 v29; - int16 v30; - int16 v35; - int16 v36; - int16 v41; - int16 v42; - int v49; - int v0 = 0; int v58 = 0; int v1 = 0; @@ -1437,8 +1409,8 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 24; } else { - v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + int v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0]._zoomFactor < 0) { v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomFactor); @@ -1461,8 +1433,8 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 24; } else { - v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + int v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0]._zoomFactor < 0) { v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomFactor); v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomFactor); @@ -1484,7 +1456,7 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 0; } else { - v16 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + int v16 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); if (_sprite[0]._zoomFactor < 0) { v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1505,7 +1477,7 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 48; } else { - v20 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + int v20 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); if (_sprite[0]._zoomFactor < 0) { v20 = _vm->_graphicsManager.zoomOut(v20, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1525,8 +1497,8 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 12; } else { - v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + int v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0]._zoomFactor < 0) { v23 = _vm->_graphicsManager.zoomOut(v23, -_sprite[0]._zoomFactor); v24 = _vm->_graphicsManager.zoomOut(v24, -_sprite[0]._zoomFactor); @@ -1549,8 +1521,8 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 12; } else { - v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + int v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0]._zoomFactor < 0) { v29 = _vm->_graphicsManager.zoomOut(v29, -_sprite[0]._zoomFactor); v30 = _vm->_graphicsManager.zoomOut(v30, -_sprite[0]._zoomFactor); @@ -1572,8 +1544,8 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 36; } else { - v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + int v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0]._zoomFactor < 0) { v35 = _vm->_graphicsManager.zoomOut(v35, -_sprite[0]._zoomFactor); v36 = _vm->_graphicsManager.zoomOut(v36, -_sprite[0]._zoomFactor); @@ -1596,8 +1568,8 @@ void ObjectsManager::GOHOME() { v58 = g_old_y; v1 = 36; } else { - v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; + int v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; if (_sprite[0]._zoomFactor < 0) { v41 = _vm->_graphicsManager.zoomOut(v41, -_sprite[0]._zoomFactor); v42 = _vm->_graphicsManager.zoomOut(v42, -_sprite[0]._zoomFactor); @@ -1614,7 +1586,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - bool v47 = false; + bool loopCond = false; do { newPosX = *_vm->_globals.chemin++; newPosY = *_vm->_globals.chemin++; @@ -1622,10 +1594,11 @@ void ObjectsManager::GOHOME() { _vm->_globals.chemin++; if (newPosX == -1 && newPosY == -1) { + int zoneId; if (_vm->_globals.GOACTION) - v49 = _vm->_globals._saveData->_data[svField2]; + zoneId = _vm->_globals._saveData->_data[svField2]; else - v49 = _zoneNum; + zoneId = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; @@ -1636,15 +1609,15 @@ void ObjectsManager::GOHOME() { g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); - if (v49 > 0) { - if (_vm->_globals.ZONEP[v49]._destX && _vm->_globals.ZONEP[v49]._destY && _vm->_globals.ZONEP[v49]._destY != 31) { - if ( _vm->_globals.ZONEP[v49]._spriteIndex == -1) { - _vm->_globals.ZONEP[v49]._destX = 0; - _vm->_globals.ZONEP[v49]._destY = 0; - _vm->_globals.ZONEP[v49]._spriteIndex = 0; + if (zoneId > 0) { + if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { + if ( _vm->_globals.ZONEP[zoneId]._spriteIndex == -1) { + _vm->_globals.ZONEP[zoneId]._destX = 0; + _vm->_globals.ZONEP[zoneId]._destY = 0; + _vm->_globals.ZONEP[zoneId]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[v49]._spriteIndex); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[v49]._spriteIndex - 59; + setSpriteIndex(0, _vm->_globals.ZONEP[zoneId]._spriteIndex); + _vm->_globals._actionDirection = _vm->_globals.ZONEP[zoneId]._spriteIndex - 59; } } } @@ -1657,9 +1630,9 @@ void ObjectsManager::GOHOME() { (_vm->_globals._oldDirection == 1 && newPosY <= v58) || (_vm->_globals._oldDirection == 5 && newPosY >= v58) || (_vm->_globals._oldDirection == 2 && newPosX >= v0) || (_vm->_globals._oldDirection == 8 && newPosX <= v0) || (_vm->_globals._oldDirection == 4 && newPosX >= v0) || (_vm->_globals._oldDirection == 6 && newPosX <= v0)) - v47 = true; - } while (!v47); - if (v47) { + loopCond = true; + } while (!loopCond); + if (loopCond) { computeAndSetSpriteSize(); if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) setFlipSprite(0, true); @@ -1768,15 +1741,6 @@ void ObjectsManager::loadLines(const Common::String &file) { * Load Zone */ void ObjectsManager::loadZone(const Common::String &file) { - int bobZoneIdx; - int v4; - byte *v9; - int v10; - byte *v13; - int16 v17; - int16 v18; - byte *ptr; - for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; @@ -1799,54 +1763,53 @@ void ObjectsManager::loadZone(const Common::String &file) { if (!f.exists(file)) error("File not found : %s", file.c_str()); - ptr = _vm->_fileManager.loadFile(file); - v4 = 0; - v18 = 0; - v17 = 0; + byte *ptr = _vm->_fileManager.loadFile(file); + int bufId = 0; + int zoneLineIdx = 0; + int bobZoneIdx; do { - bobZoneIdx = (int16)READ_LE_UINT16((uint16 *)ptr + v4); + bobZoneIdx = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); if (bobZoneIdx != -1) { _vm->_linesManager.addZoneLine( - v18, - READ_LE_UINT16((uint16 *)ptr + v4 + 1), // CHECKME: Shouldn't it be a byte? - READ_LE_UINT16((uint16 *)ptr + v4 + 2), - READ_LE_UINT16((uint16 *)ptr + v4 + 3), - READ_LE_UINT16((uint16 *)ptr + v4 + 4), + zoneLineIdx, + READ_LE_UINT16((uint16 *)ptr + bufId + 1), + READ_LE_UINT16((uint16 *)ptr + bufId + 2), + READ_LE_UINT16((uint16 *)ptr + bufId + 3), + READ_LE_UINT16((uint16 *)ptr + bufId + 4), bobZoneIdx); _vm->_globals.ZONEP[bobZoneIdx]._enabledFl = true; } - v4 += 5; - ++v18; - ++v17; + bufId += 5; + ++zoneLineIdx; } while (bobZoneIdx != -1); for (int i = 1; i <= 100; i++) { // CHECKME: Shouldn't it be a byte? - _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + v4); - _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 1); - _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + v4 + 2); - v4 += 3; + _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); + _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1); + _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2); + bufId += 3; } - v9 = (ptr + 10 * v17 + 606); - v10 = 0; + byte *v9 = (ptr + 10 * zoneLineIdx + 606); + bufId = 0; for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i].field6 = v9[v10]; - _vm->_globals.ZONEP[i].field7 = v9[v10 + 1]; - _vm->_globals.ZONEP[i].field8 = v9[v10 + 2]; - _vm->_globals.ZONEP[i].field9 = v9[v10 + 3]; - _vm->_globals.ZONEP[i].fieldA = v9[v10 + 4]; - _vm->_globals.ZONEP[i].fieldB = v9[v10 + 5]; - _vm->_globals.ZONEP[i].fieldC = v9[v10 + 6]; - _vm->_globals.ZONEP[i].fieldD = v9[v10 + 7]; - _vm->_globals.ZONEP[i].fieldE = v9[v10 + 8]; - _vm->_globals.ZONEP[i].fieldF = v9[v10 + 9]; - - v10 += 10; - } - v13 = v9 + 1010; - for (int v14 = 0; v14 < 100; v14++) - _vm->_globals.ZONEP[v14 + 1].field12 = READ_LE_UINT16(v13 + 2 * v14); + _vm->_globals.ZONEP[i].field6 = v9[bufId]; + _vm->_globals.ZONEP[i].field7 = v9[bufId + 1]; + _vm->_globals.ZONEP[i].field8 = v9[bufId + 2]; + _vm->_globals.ZONEP[i].field9 = v9[bufId + 3]; + _vm->_globals.ZONEP[i].fieldA = v9[bufId + 4]; + _vm->_globals.ZONEP[i].fieldB = v9[bufId + 5]; + _vm->_globals.ZONEP[i].fieldC = v9[bufId + 6]; + _vm->_globals.ZONEP[i].fieldD = v9[bufId + 7]; + _vm->_globals.ZONEP[i].fieldE = v9[bufId + 8]; + _vm->_globals.ZONEP[i].fieldF = v9[bufId + 9]; + + bufId += 10; + } + v9 += 1010; + for (int i = 0; i < 100; i++) + _vm->_globals.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i); _vm->_globals.freeMemory(ptr); CARRE_ZONE(); @@ -2455,21 +2418,6 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int16 *result; - int v27; - int v28; - int v29; - int16 *v41; - int16 *v45; - int v48; - int16 *v50; - int16 *v54; - int16 *v58; - int v66; - int v68 = 0; - int v69 = 0; - int j; - int v72 = 0; - int v73 = 0; int arrDelta[10]; int arrDataIdx[10]; int arrLineIdx[10]; @@ -2527,6 +2475,11 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[7] = delta; + int v68 = 0; + int v69 = 0; + int v72 = 0; + int v73 = 0; + if (arrLineIdx[1] == -1) arrDelta[1] = 1300; if (arrLineIdx[3] == -1) @@ -2565,11 +2518,12 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { v69 = arrLineIdx[1]; v68 = arrDataIdx[1]; } else if (_vm->_linesManager.checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _vm->_linesManager._linesNumb)) { - v27 = 0; + int v27 = 0; + int v28; for (;;) { v28 = _vm->_globals.essai2[v27]; - v29 = _vm->_globals.essai2[v27 + 1]; - v66 = _vm->_globals.essai2[v27 + 2]; + int v29 = _vm->_globals.essai2[v27 + 1]; + int v66 = _vm->_globals.essai2[v27 + 2]; v27 += 4; if (_vm->_linesManager.checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) @@ -2608,7 +2562,7 @@ LABEL_90: superRouteIdx += 4; ++v34; } - for (j = v69 + 1; j < v73; ++j) { + for (int j = v69 + 1; j < v73; ++j) { if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[j]._lineData[0], _vm->_linesManager.Ligne[j]._lineData[1], @@ -2620,9 +2574,8 @@ LABEL_90: } if (_vm->_linesManager.Ligne[j]._lineDataEndIdx - 2 > 0) { for (int v40 = 0; v40 < _vm->_linesManager.Ligne[j]._lineDataEndIdx - 2; v40++) { - v41 = _vm->_linesManager.Ligne[j]._lineData; - _vm->_globals.super_parcours[superRouteIdx] = v41[2 * v40]; - _vm->_globals.super_parcours[superRouteIdx + 1] = v41[2 * v40 + 1]; + _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[j]._lineData[2 * v40]; + _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[j]._lineData[2 * v40 + 1]; _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[j].field6; _vm->_globals.super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; @@ -2634,15 +2587,14 @@ LABEL_90: } if (v69 > v73) { for (int k = v68; k > 0; --k) { - v45 = _vm->_linesManager.Ligne[v69]._lineData; - _vm->_globals.super_parcours[superRouteIdx] = v45[2 * k]; - _vm->_globals.super_parcours[superRouteIdx + 1] = v45[2 * k + 1]; + _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v69]._lineData[2 * k]; + _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v69]._lineData[2 * k + 1]; _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v69].field8; _vm->_globals.super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } for (int l = v69 - 1; l > v73; --l) { - v48 = l; + int v48 = l; if (_vm->_linesManager.PLAN_TEST( _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2], _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 1], @@ -2654,9 +2606,8 @@ LABEL_90: } for (int v49 = _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { - v50 = _vm->_linesManager.Ligne[l]._lineData; - _vm->_globals.super_parcours[superRouteIdx] = v50[2 * v49]; - _vm->_globals.super_parcours[superRouteIdx + 1] = v50[2 * v49 + 1]; + _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[l]._lineData[2 * v49]; + _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[l]._lineData[2 * v49 + 1]; _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[l].field8; _vm->_globals.super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; @@ -2668,18 +2619,16 @@ LABEL_90: if (v69 == v73) { if (v68 <= v72) { for (int v57 = v68; v57 < v72; v57++) { - v58 = _vm->_linesManager.Ligne[v73]._lineData; - _vm->_globals.super_parcours[superRouteIdx] = v58[2 * v57]; - _vm->_globals.super_parcours[superRouteIdx + 1] = v58[2 * v57 + 1]; + _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v73]._lineData[2 * v57]; + _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v73]._lineData[2 * v57 + 1]; _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v73].field6; _vm->_globals.super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } else { for (int v53 = v68; v53 > v72; v53--) { - v54 = _vm->_linesManager.Ligne[v73]._lineData; - _vm->_globals.super_parcours[superRouteIdx] = v54[2 * v53]; - _vm->_globals.super_parcours[superRouteIdx + 1] = v54[2 * v53 + 1]; + _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v73]._lineData[2 * v53]; + _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v73]._lineData[2 * v53 + 1]; _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v73].field8; _vm->_globals.super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; -- cgit v1.2.3 From e1d85a28b54fcc99adea17a882f3c35bd9548c31 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Jan 2013 00:24:44 +0100 Subject: HOPKINS: Some more renaming in LinesManager. Fix a bug in last loop condition --- engines/hopkins/lines.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index ef4e75c250..019ab784f4 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -458,11 +458,11 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i v8 += a7; } - for (int v34 = a1 + 1; v34 < a4; v34++) { - for (int i = 0; i < Ligne[v34]._lineDataEndIdx; i++) { - a6[v8] = Ligne[v34]._lineData[2 * i]; - a6[v8 + 1] = Ligne[v34]._lineData[2 * i + 1]; - a6[v8 + 2] = Ligne[v34].field6; + for (int i = a1 + 1; i < a4; i++) { + for (int j = 0; j < Ligne[i]._lineDataEndIdx; j++) { + a6[v8] = Ligne[i]._lineData[2 * j]; + a6[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; + a6[v8 + 2] = Ligne[i].field6; v8 += a7; } } @@ -471,17 +471,17 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i v36 = a4; } if (v36 > a4) { - for (int j = v7; j > 0; --j) { - a6[v8] = Ligne[v36]._lineData[2 * j]; - a6[v8 + 1] = Ligne[v36]._lineData[2 * j + 1]; + for (int i = v7; i > 0; --i) { + a6[v8] = Ligne[v36]._lineData[2 * i]; + a6[v8 + 1] = Ligne[v36]._lineData[2 * i + 1]; a6[v8 + 2] = Ligne[v36].field8; v8 += a7; } - for (int v35 = v36 - 1; v35 > a4; v35--) { - for (int k = Ligne[v35]._lineDataEndIdx - 1; k > 0; --k) { - a6[v8] = Ligne[v35]._lineData[2 * k]; - a6[v8 + 1] = Ligne[v35]._lineData[2 * k + 1]; - a6[v8 + 2] = Ligne[v35].field8; + for (int i = v36 - 1; i > a4; i--) { + for (int j = Ligne[i]._lineDataEndIdx - 1; j > 0; --j) { + a6[v8] = Ligne[i]._lineData[2 * j]; + a6[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; + a6[v8 + 2] = Ligne[i].field8; v8 += a7; } } @@ -490,7 +490,7 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if (v36 == a4) { if (a5 >= v7) { - for (int i = v7; i > a5; i++) { + for (int i = v7; i < a5; i++) { a6[v8] = Ligne[a4]._lineData[2 * i]; a6[v8 + 1] = Ligne[a4]._lineData[2 * i + 1]; a6[v8 + 2] = Ligne[a4].field6; -- cgit v1.2.3 From 59d46f36a98d08a2a85344afc4751feba4e59800 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Jan 2013 08:04:58 +0100 Subject: HOPKINS: Refactoring in LinesManager. Fix a loop bug in PARCOURS2 --- engines/hopkins/lines.cpp | 216 ++++++++++++++++++---------------------------- engines/hopkins/lines.h | 6 +- 2 files changed, 87 insertions(+), 135 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 019ab784f4..b3db053455 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -129,7 +129,7 @@ void LinesManager::removeZoneLine(int idx) { if (idx > MAX_LINES) error("Attempting to remove a line obstacle > MAX_LIGNE."); - _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_vm->_linesManager._zoneLine[idx]._zoneData); + _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); } /** @@ -445,24 +445,23 @@ void LinesManager::initRoute() { } // Avoid -int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7) { +int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7) { int v36 = a1; int v7 = a2; int v8 = a3; - int v50; if (a1 < a4) { for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { - a6[v8] = Ligne[a1]._lineData[2 * i]; - a6[v8 + 1] = Ligne[a1]._lineData[2 * i + 1]; - a6[v8 + 2] = Ligne[a1].field6; + route[v8] = Ligne[a1]._lineData[2 * i]; + route[v8 + 1] = Ligne[a1]._lineData[2 * i + 1]; + route[v8 + 2] = Ligne[a1].field6; v8 += a7; } for (int i = a1 + 1; i < a4; i++) { for (int j = 0; j < Ligne[i]._lineDataEndIdx; j++) { - a6[v8] = Ligne[i]._lineData[2 * j]; - a6[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; - a6[v8 + 2] = Ligne[i].field6; + route[v8] = Ligne[i]._lineData[2 * j]; + route[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; + route[v8 + 2] = Ligne[i].field6; v8 += a7; } } @@ -472,16 +471,16 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } if (v36 > a4) { for (int i = v7; i > 0; --i) { - a6[v8] = Ligne[v36]._lineData[2 * i]; - a6[v8 + 1] = Ligne[v36]._lineData[2 * i + 1]; - a6[v8 + 2] = Ligne[v36].field8; + route[v8] = Ligne[v36]._lineData[2 * i]; + route[v8 + 1] = Ligne[v36]._lineData[2 * i + 1]; + route[v8 + 2] = Ligne[v36].field8; v8 += a7; } for (int i = v36 - 1; i > a4; i--) { for (int j = Ligne[i]._lineDataEndIdx - 1; j > 0; --j) { - a6[v8] = Ligne[i]._lineData[2 * j]; - a6[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; - a6[v8 + 2] = Ligne[i].field8; + route[v8] = Ligne[i]._lineData[2 * j]; + route[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; + route[v8 + 2] = Ligne[i].field8; v8 += a7; } } @@ -491,16 +490,16 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i if (v36 == a4) { if (a5 >= v7) { for (int i = v7; i < a5; i++) { - a6[v8] = Ligne[a4]._lineData[2 * i]; - a6[v8 + 1] = Ligne[a4]._lineData[2 * i + 1]; - a6[v8 + 2] = Ligne[a4].field6; + route[v8] = Ligne[a4]._lineData[2 * i]; + route[v8 + 1] = Ligne[a4]._lineData[2 * i + 1]; + route[v8 + 2] = Ligne[a4].field6; v8 += a7; } } else { for (int i = v7; i > a5; --i) { - a6[v8] = Ligne[a4]._lineData[2 * i]; - a6[v8 + 1] = Ligne[a4]._lineData[2 * i+ 1]; - a6[v8 + 2] = Ligne[a4].field8; + route[v8] = Ligne[a4]._lineData[2 * i]; + route[v8 + 1] = Ligne[a4]._lineData[2 * i+ 1]; + route[v8 + 2] = Ligne[a4].field8; v8 += a7; } } @@ -509,36 +508,25 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, i } // Avoid 1 -int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9) { +int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9) { int v9 = a1; int v10 = a2; int v40 = a3; - int v50; if (a4 < a1) { - for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { - int16 *v12 = Ligne[a1]._lineData; - int v13 = v12[2 * i]; - v50 = v12[2 * i + 1]; - - int v14 = v40; - a6[v14] = v13; - a6[v14 + 1] = v50; - a6[v14 + 2] = Ligne[a1].field6; + for (int i = a2; i < Ligne[a1]._lineDataEndIdx; ++i) { + route[v40] = Ligne[a1]._lineData[2 * i]; + route[v40 + 1] = Ligne[a1]._lineData[2 * i + 1]; + route[v40 + 2] = Ligne[a1].field6; v40 += a7; } int v15 = a1 + 1; - if (a1 + 1 == a9 + 1) + if (v15 == a9 + 1) v15 = a8; while (a4 != v15) { - for (int v16 = 0; v16 < Ligne[v15]._lineDataEndIdx; v16++) { - int16 *v17 = Ligne[v15]._lineData; - int v18 = v17[2 * v16]; - v50 = v17[2 * v16 + 1]; - - int v19 = v40; - a6[v19] = v18; - a6[v19 + 1] = v50; - a6[v19 + 2] = Ligne[v15].field6; + for (int i = 0; i < Ligne[v15]._lineDataEndIdx; i++) { + route[v40] = Ligne[v15]._lineData[2 * i]; + route[v40 + 1] = Ligne[v15]._lineData[2 * i + 1]; + route[v40 + 2] = Ligne[v15].field6; v40 += a7; } @@ -550,30 +538,20 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, v9 = a4; } if (a4 > v9) { - for (int j = v10; j > 0; --j) { - int16 *v21 = Ligne[v9]._lineData; - int v22 = v21[2 * j]; - v50 = v21[2 * j + 1]; - - int v23 = v40; - a6[v23] = v22; - a6[v23 + 1] = v50; - a6[v23 + 2] = Ligne[v9].field8; + for (int i = v10; i > 0; --i) { + route[v40] = Ligne[v9]._lineData[2 * i]; + route[v40 + 1] = Ligne[v9]._lineData[2 * i + 1]; + route[v40 + 2] = Ligne[v9].field8; v40 += a7; } int v24 = v9 - 1; if (v24 == a8 - 1) v24 = a9; while (a4 != v24) { - for (int k = Ligne[v24]._lineDataEndIdx - 1; k > 0; --k) { - int16 *v26 = Ligne[v24]._lineData; - int v27 = v26[2 * k]; - v50 = v26[2 * k + 1]; - - int v28 = v40; - a6[v28] = v27; - a6[v28 + 1] = v50; - a6[v28 + 2] = Ligne[v24].field8; + for (int i = Ligne[v24]._lineDataEndIdx - 1; i > 0; --i) { + route[v40] = Ligne[v24]._lineData[2 * i]; + route[v40 + 1] = Ligne[v24]._lineData[2 * i + 1]; + route[v40 + 2] = Ligne[v24].field8; v40 += a7; } --v24; @@ -585,31 +563,17 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, } if (a4 == v9) { if (a5 >= v10) { - if (a5 > v10) { - int v39 = a4; - for (int v33 = v10; v33 < a5; v33++) { - int16 *v34 = Ligne[v39]._lineData; - int v35 = v34[2 * v33]; - v50 = v34[2 * v33 + 1]; - - int v36 = v40; - a6[v36] = v35; - a6[v36 + 1] = v50; - a6[v36 + 2] = Ligne[v39].field6; - v40 += a7; - } + for (int i = v10; i < a5; i++) { + route[v40] = Ligne[a4]._lineData[2 * i]; + route[v40 + 1] = Ligne[a4]._lineData[2 * i + 1]; + route[v40 + 2] = Ligne[a4].field6; + v40 += a7; } } else { - int v38 = a4; - for (int v29 = v10; v29 > a5; v29--) { - int16 *v30 = Ligne[v38]._lineData; - int v31 = v30[2 * v29]; - v50 = v30[2 * v29 + 1]; - - int v32 = v40; - a6[v32] = v31; - a6[v32 + 1] = v50; - a6[v32 + 2] = Ligne[v38].field8; + for (int i = v10; i > a5; i--) { + route[v40] = Ligne[a4]._lineData[2 * i]; + route[v40 + 1] = Ligne[a4]._lineData[2 * i + 1]; + route[v40 + 2] = Ligne[a4].field8; v40 += a7; } } @@ -636,13 +600,9 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int l; int v21; int v23; - int v24; int v26; - int v27; int v29; - int v30; int v32; - int v33; int v35 = 0; int v36 = 0; int v37; @@ -831,11 +791,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (NVPY != -1) v22 = NVPY - v40; } - v24 = v7; - _vm->_globals.super_parcours[v24] = v41; - _vm->_globals.super_parcours[v24 + 1] = v40 - v22; - _vm->_globals.super_parcours[v24 + 2] = 1; - _vm->_globals.super_parcours[v24 + 3] = 0; + _vm->_globals.super_parcours[v7] = v41; + _vm->_globals.super_parcours[v7 + 1] = v40 - v22; + _vm->_globals.super_parcours[v7 + 2] = 1; + _vm->_globals.super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -854,11 +813,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (NVPY != -1) v25 = v40 - NVPY; } - v27 = v7; - _vm->_globals.super_parcours[v27] = v41; - _vm->_globals.super_parcours[v27 + 1] = v25 + v40; - _vm->_globals.super_parcours[v27 + 2] = 5; - _vm->_globals.super_parcours[v27 + 3] = 0; + _vm->_globals.super_parcours[v7] = v41; + _vm->_globals.super_parcours[v7 + 1] = v25 + v40; + _vm->_globals.super_parcours[v7 + 2] = 5; + _vm->_globals.super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -877,11 +835,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (NVPX != -1) v28 = v41 - NVPX; } - v30 = v7; - _vm->_globals.super_parcours[v30] = v41 - v28; - _vm->_globals.super_parcours[v30 + 1] = v40; - _vm->_globals.super_parcours[v30 + 2] = 7; - _vm->_globals.super_parcours[v30 + 3] = 0; + _vm->_globals.super_parcours[v7] = v41 - v28; + _vm->_globals.super_parcours[v7 + 1] = v40; + _vm->_globals.super_parcours[v7 + 2] = 7; + _vm->_globals.super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -900,11 +857,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (NVPX != -1) v31 = NVPX - v41; } - v33 = v7; - _vm->_globals.super_parcours[v33] = v31 + v41; - _vm->_globals.super_parcours[v33 + 1] = v40; - _vm->_globals.super_parcours[v33 + 2] = 3; - _vm->_globals.super_parcours[v33 + 3] = 0; + _vm->_globals.super_parcours[v7] = v31 + v41; + _vm->_globals.super_parcours[v7 + 1] = v40; + _vm->_globals.super_parcours[v7 + 2] = 3; + _vm->_globals.super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -917,16 +873,15 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { return false; } -int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9) { - int v99 = a7; +int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) { + int result = a7; int v80 = -1; ++_vm->_globals.pathFindingDepth; if (_vm->_globals.pathFindingDepth > 10) { warning("PathFinding - Max depth reached"); - a7 = a7; - a8[a7] = -1; - a8[a7 + 1] = -1; - a8[a7 + 2] = -1; + route[a7] = -1; + route[a7 + 1] = -1; + route[a7 + 2] = -1; return -1; } int16 *v10 = Ligne[a1]._lineData; @@ -973,10 +928,9 @@ LABEL_11: for (;;) { v65 = v15; v17 = v16[v15 - 2]; - if (v16[0] == v95) { - if (v93 == v16[1]) - break; - } + if (v16[0] == v95 && v93 == v16[1]) + break; + ++v87; if (v87 != _linesNumb + 1) { v15 = 2 * Ligne[v87]._lineDataEndIdx; @@ -1124,10 +1078,9 @@ LABEL_17: break;; } if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) { - a7 = a7; - a8[a7] = -1; - a8[a7 + 1] = -1; - a8[a7 + 2] = -1; + route[a7] = -1; + route[a7 + 1] = -1; + route[a7 + 2] = -1; return -1; } } @@ -1147,15 +1100,15 @@ LABEL_17: } while (v80 != v42); if (abs(v80 - a1) == v43) { if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) { - v99 = CONTOURNE(a1, a2, a7, v80, v77, a8, a9); + result = CONTOURNE(a1, a2, a7, v80, v77, route, a9); } else { - v99 = CONTOURNE1(a1, a2, a7, v80, v77, a8, a9, v92, v91); + result = CONTOURNE1(a1, a2, a7, v80, v77, route, a9, v92, v91); } } if (abs(v80 - a1) < v43) - v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); + result = CONTOURNE(a1, a2, result, v80, v77, route, a9); if (v43 < abs(v80 - a1)) - v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91); } if (a1 > v80) { int v45 = abs(a1 - v80); @@ -1171,18 +1124,18 @@ LABEL_17: } while (v80 != v47); if (v45 == v48) { if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) { - v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91); } else { - v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); + result = CONTOURNE(a1, a2, result, v80, v77, route, a9); } } if (v45 < v48) - v99 = CONTOURNE(a1, a2, v99, v80, v77, a8, a9); + result = CONTOURNE(a1, a2, result, v80, v77, route, a9); if (v48 < v45) - v99 = CONTOURNE1(a1, a2, v99, v80, v77, a8, a9, v92, v91); + result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91); } if (a1 == v80) - v99 = CONTOURNE(a1, a2, v99, a1, v77, a8, a9); + result = CONTOURNE(a1, a2, result, a1, v77, route, a9); for(;;) { if (!checkCollisionLine(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb)) break; @@ -1216,7 +1169,7 @@ LABEL_17: NVPX = -1; NVPY = -1; } - return v99; + return result; } // Avoid 2 @@ -1373,7 +1326,6 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v136[v12] = 0; v131[v12] = 1300; v126[v12] = 1300; - ++v12; } if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) != 1) { diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index f2a62eb900..6fecbcb64e 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -79,10 +79,10 @@ public: void addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7); bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); void initRoute(); - int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7, int a8, int a9); - int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *a6, int a7); + int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); + int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); bool MIRACLE(int a1, int a2, int a3, int a4, int a5); - int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *a8, int a9); + int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); int16 *PARCOURS2(int srcX, int srcY, int destX, int destY); int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int VERIF_SMOOTH(int a1, int a2, int a3, int a4); -- cgit v1.2.3 From 6bd728e9c8c221c6e2e746a13ecc041c915ac8a4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Jan 2013 08:34:35 +0100 Subject: HOPKINS: Start refactoring PARCOURS2 --- engines/hopkins/lines.cpp | 357 ++++++++++++++++------------------------------ 1 file changed, 119 insertions(+), 238 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index b3db053455..eed136a076 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1176,35 +1176,6 @@ LABEL_17: int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v12; int v14; - int v15; - int v16; - int v18; - int v19; - int v20; - int v22; - int v23; - int v24; - int v26; - int v27; - int v28; - int v31; - int v34; - int v35; - int v36; - int v38; - int v39; - int v40; - int v42; - int v43; - int v44; - int v46; - int v47; - int v48; - int v50; - int v51; - int v52; - int v53; - int v54; int v55; int v56; int v58; @@ -1250,14 +1221,6 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v98; int v99; int v100; - int v101; - int v102; - int v103; - int v104; - int v105; - int v106; - int v107; - int v108; int v109; int v110; int v111; @@ -1330,87 +1293,55 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) != 1) { v14 = 0; - v15 = clipDestY; - if (_vm->_graphicsManager._maxY > clipDestY) { - v16 = 5; - do { - v101 = v16; - v16 = v101; - if (checkCollisionLine(clipDestX, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v101] <= _vm->_objectsManager._lastLine) - break; - v136[v101] = 0; - v141[v101] = -1; - ++v14; - ++v15; - } while (_vm->_graphicsManager._maxY > v15); + for (int v15 = clipDestY; v15 < _vm->_graphicsManager._maxY; v15++, v14++) { + if (checkCollisionLine(clipDestX, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + break; + v136[5] = 0; + v141[5] = -1; } v131[5] = v14; - v18 = 0; - v19 = clipDestY; - if (_vm->_graphicsManager._minY < clipDestY) { - v20 = 1; - do { - v102 = v20; - v20 = v102; - if (checkCollisionLine(clipDestX, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v102] <= _vm->_objectsManager._lastLine) - break; - v136[v102] = 0; - v141[v102] = -1; - if (v131[5] < v18) { - if (v141[5] != -1) - break; - } - ++v18; - --v19; - } while (_vm->_graphicsManager._minY < v19); - } - v131[1] = v18; - v22 = 0; - v23 = clipDestX; - if (_vm->_graphicsManager._maxX > clipDestX) { - v24 = 3; - do { - v103 = v24; - v24 = v103; - if (checkCollisionLine(v23, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v103] <= _vm->_objectsManager._lastLine) - break; - v136[v103] = 0; - v141[v103] = -1; - ++v22; - if (v131[1] < v22) { - if (v141[1] != -1) - break; - } - if (v131[5] < v22 && v141[5] != -1) - break; - ++v23; - } while (_vm->_graphicsManager._maxX > v23); - } - v131[3] = v22; - v26 = 0; - v27 = clipDestX; - if (_vm->_graphicsManager._minX < clipDestX) { - v28 = 7; - do { - v104 = v28; - v28 = v104; - if (checkCollisionLine(v27, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v104] <= _vm->_objectsManager._lastLine) - break; - v136[v104] = 0; - v141[v104] = -1; - ++v26; - if (v131[1] < v26) { - if (v141[1] != -1) - break; - } - if (v131[5] < v26 && v141[5] != -1) - break; - if (v131[3] < v26 && v141[3] != -1) + + v14 = 0; + for (int v19 = clipDestY; v19 > _vm->_graphicsManager._minY; v19--, v14++) { + if (checkCollisionLine(clipDestX, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + break; + v136[1] = 0; + v141[1] = -1; + if (v131[5] < v14 && v141[5] != -1) + break; + } + v131[1] = v14; + + v14 = 0; + for (int v23 = clipDestX; v23 < _vm->_graphicsManager._maxX; v23++) { + if (checkCollisionLine(v23, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + break; + v136[3] = 0; + v141[3] = -1; + ++v14; + if (v131[1] < v14 && v141[1] != -1) break; - --v27; - } while (_vm->_graphicsManager._minX < v27); + if (v131[5] < v14 && v141[5] != -1) + break; } - v131[7] = v26; + v131[3] = v14; + + v14 = 0; + for (int v27 = clipDestX; v27 > _vm->_graphicsManager._minX; v27--) { + if (checkCollisionLine(v27, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + break; + v136[7] = 0; + v141[7] = -1; + ++v14; + if (v131[1] < v14 && v141[1] != -1) + break; + if (v131[5] < v14 && v141[5] != -1) + break; + if (v131[3] < v14 && v141[3] != -1) + break; + } + v131[7] = v14; + if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) v141[1] = -1; if (v141[3] < 0 || _vm->_objectsManager._lastLine < v141[3]) @@ -1429,23 +1360,17 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v131[7] = 1300; if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) return (int16 *)g_PTRNUL; - v31 = 0; + if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { v121 = v141[5]; v120 = v136[5]; - v31 = 1; - } - if (v141[1] != -1 && !v31 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { + } else if (v141[1] != -1 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { v121 = v141[1]; v120 = v136[1]; - v31 = 1; - } - if (v141[3] != -1 && !v31 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { + } else if (v141[3] != -1 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { v121 = v141[3]; v120 = v136[3]; - v31 = 1; - } - if (v141[7] != -1 && !v31 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { + } else if (v141[7] != -1 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { v121 = v141[7]; v120 = v136[7]; } @@ -1457,132 +1382,88 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v126[v12] = 1300; } - v34 = 0; - v35 = srcY; - if (_vm->_graphicsManager._maxY > srcY) { - v36 = 5; - do { - v105 = v36; - v36 = v105; - if (checkCollisionLine(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[v105] <= _vm->_objectsManager._lastLine) - break; - v136[v105] = 0; - v141[v105] = -1; - ++v34; - ++v35; - } while (_vm->_graphicsManager._maxY > v35); - } - v131[5] = v34 + 1; - v38 = 0; - v39 = srcY; - if (_vm->_graphicsManager._minY < srcY) { - v40 = 1; - do { - v106 = v40; - v40 = v106; - if (checkCollisionLine(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[v106] <= _vm->_objectsManager._lastLine) - break; - v136[v106] = 0; - v141[v106] = -1; - ++v38; - if (v141[5] != -1) { - if (v38 > 80) - break; - } - --v39; - } while (_vm->_graphicsManager._minY < v39); - } - v131[1] = v38 + 1; - v42 = 0; - v43 = srcX; - if (_vm->_graphicsManager._maxX > srcX) { - v44 = 3; - do { - v107 = v44; - v44 = v107; - if (checkCollisionLine(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[v107] <= _vm->_objectsManager._lastLine) - break; - v136[v107] = 0; - v141[v107] = -1; - ++v42; - if (v141[5] != -1 || v141[1] != -1) { - if (v42 > 100) - break; - } - ++v43; - } while (_vm->_graphicsManager._maxX > v43); - } - v131[3] = v42 + 1; - v46 = 0; - v47 = srcX; - if (_vm->_graphicsManager._minX < srcX) { - v48 = 7; - do { - v108 = v48; - v48 = v108; - if (checkCollisionLine(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[v108] <= _vm->_objectsManager._lastLine) - break; - v136[v108] = 0; - v141[v108] = -1; - ++v46; - if (v141[5] != -1 || v141[1] != -1 || v141[3] != -1) { - if (v46 > 100) - break; - } - --v47; - } while (_vm->_graphicsManager._minX < v47); - } - v131[7] = v46 + 1; - if (v141[1] != -1) { - v50 = abs(v141[1] - v121); - v126[1] = v50; + v14 = 0; + for (int v35 = srcY; v35 < _vm->_graphicsManager._maxY; v35++, v14++) { + if (checkCollisionLine(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + break; + v136[5] = 0; + v141[5] = -1; } - if (v141[3] != -1) { - v51 = abs(v141[3] - v121); - v126[3] = v51; + v131[5] = v14 + 1; + + v14 = 0; + for (int v39 = srcY; v39 > _vm->_graphicsManager._minY; v39--) { + if (checkCollisionLine(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + break; + v136[1] = 0; + v141[1] = -1; + ++v14; + if (v141[5] != -1 && v14 > 80) + break; } - if (v141[5] != -1) { - v52 = abs(v141[5] - v121); - v126[5] = v52; + v131[1] = v14 + 1; + + v14 = 0; + for (int v43 = srcX; v43 < _vm->_graphicsManager._maxX; v43++) { + if (checkCollisionLine(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + break; + v136[3] = 0; + v141[3] = -1; + ++v14; + if ((v141[5] != -1 || v141[1] != -1) && (v14 > 100)) + break; } - if (v141[7] != -1) { - v53 = abs(v141[7] - v121); - v126[7] = v53; + v131[3] = v14 + 1; + + v14 = 0; + for (int v47 = srcX; v47 > _vm->_graphicsManager._minX; v47--) { + if (checkCollisionLine(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + break; + v136[7] = 0; + v141[7] = -1; + ++v14; + if ((v141[5] != -1 || v141[1] != -1 || v141[3] != -1) && (v14 > 100)) + break; } + v131[7] = v14 + 1; + + if (v141[1] != -1) + v126[1] = abs(v141[1] - v121); + + if (v141[3] != -1) + v126[3] = abs(v141[3] - v121); + + if (v141[5] != -1) + v126[5] = abs(v141[5] - v121); + + if (v141[7] != -1) + v126[7] = abs(v141[7] - v121); + if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) error("Nearest point not found error"); - v54 = 0; + if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { - v54 = 1; v115 = v141[1]; v111 = v131[1]; v113 = 1; v114 = v136[1]; + } else if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { + v115 = v141[5]; + v111 = v131[5]; + v113 = 5; + v114 = v136[5]; + } else if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { + v115 = v141[3]; + v111 = v131[3]; + v113 = 3; + v114 = v136[3]; + } else if (v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { + v115 = v141[7]; + v111 = v131[7]; + v113 = 7; + v114 = v136[7]; } - if (!v54) { - if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { - v54 = 1; - v115 = v141[5]; - v111 = v131[5]; - v113 = 5; - v114 = v136[5]; - } - if (!v54) { - if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { - v54 = 1; - v115 = v141[3]; - v111 = v131[3]; - v113 = 3; - v114 = v136[3]; - } - if (!v54 && v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { - v115 = v141[7]; - v111 = v131[7]; - v113 = 7; - v114 = v136[7]; - } - } - } + v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); if (v55 != 1) { if (v55 == 2) { -- cgit v1.2.3 From 06b72f3ff091a898570b14aa3450a143a16ddbae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Jan 2013 20:50:48 +0100 Subject: HOPKINS: More refactoring on PARCOURS2 --- engines/hopkins/lines.cpp | 886 ++++++++++++++++++++-------------------------- 1 file changed, 380 insertions(+), 506 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index eed136a076..56a68f14cd 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1174,68 +1174,21 @@ LABEL_17: // Avoid 2 int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { - int v12; int v14; int v55; - int v56; int v58; - int v59; - int v60; int v61; - int v62; - int v63; int v64; - int v65; - int v66; int v67; - int v68; - int i; - int16 *v70; - int v71; int v72; - int j; - int16 *v74; - int v75; - int v76; - int v77; int v78; int v79; - int v80; - int16 *v81; - int v82; - int v83; - int16 *v84; - int v85; - int v86; - int v87; int v88; int v89; - int v90; - int16 *v91; - int v92; - int v93; - int v94; - int16 *v95; - int v96; - int v97; - int v98; - int v99; - int v100; - int v109; int v110; - int v111; int v112; - int v113; - int v114; - int v115; - int v116; - int v117; int v118 = 0; int v119 = 0; - int v120; - int v121; - int clipDestY; - int clipDestX; int v124; int v125; int v126[9]; @@ -1243,14 +1196,14 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { int v136[9]; int v141[9]; - clipDestX = destX; - clipDestY = destY; - v121 = 0; - v120 = 0; - v115 = 0; - v114 = 0; - v113 = 0; - v111 = 0; + int clipDestX = destX; + int clipDestY = destY; + int v121 = 0; + int v120 = 0; + int v115 = 0; + int v114 = 0; + int v113 = 0; + int v111 = 0; if (destY <= 24) clipDestY = 25; if (!_vm->_globals.NOT_VERIF) { @@ -1284,495 +1237,416 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (abs(srcX - clipDestX) <= 3 && abs(srcY - clipDestY) <= 3) return (int16 *)g_PTRNUL; - for (v12 = 0; v12 <= 8; ++v12) { - v141[v12] = -1; - v136[v12] = 0; - v131[v12] = 1300; - v126[v12] = 1300; + for (int i = 0; i <= 8; ++i) { + v141[i] = -1; + v136[i] = 0; + v131[i] = 1300; + v126[i] = 1300; } - if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) != 1) { - v14 = 0; - for (int v15 = clipDestY; v15 < _vm->_graphicsManager._maxY; v15++, v14++) { - if (checkCollisionLine(clipDestX, v15, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) - break; - v136[5] = 0; - v141[5] = -1; - } - v131[5] = v14; + if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) == 1) + return &_vm->_globals.super_parcours[0]; - v14 = 0; - for (int v19 = clipDestY; v19 > _vm->_graphicsManager._minY; v19--, v14++) { - if (checkCollisionLine(clipDestX, v19, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) - break; - v136[1] = 0; - v141[1] = -1; - if (v131[5] < v14 && v141[5] != -1) - break; - } - v131[1] = v14; + v14 = 0; + for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { + if (checkCollisionLine(clipDestX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + break; + v136[5] = 0; + v141[5] = -1; + } + v131[5] = v14; - v14 = 0; - for (int v23 = clipDestX; v23 < _vm->_graphicsManager._maxX; v23++) { - if (checkCollisionLine(v23, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) - break; - v136[3] = 0; - v141[3] = -1; - ++v14; - if (v131[1] < v14 && v141[1] != -1) - break; - if (v131[5] < v14 && v141[5] != -1) - break; - } - v131[3] = v14; + v14 = 0; + for (int tmpY = clipDestY; tmpY > _vm->_graphicsManager._minY; tmpY--, v14++) { + if (checkCollisionLine(clipDestX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + break; + v136[1] = 0; + v141[1] = -1; + if (v131[5] < v14 && v141[5] != -1) + break; + } + v131[1] = v14; - v14 = 0; - for (int v27 = clipDestX; v27 > _vm->_graphicsManager._minX; v27--) { - if (checkCollisionLine(v27, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) - break; - v136[7] = 0; - v141[7] = -1; - ++v14; - if (v131[1] < v14 && v141[1] != -1) - break; - if (v131[5] < v14 && v141[5] != -1) - break; - if (v131[3] < v14 && v141[3] != -1) + v14 = 0; + for (int tmpX = clipDestX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { + if (checkCollisionLine(tmpX, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + break; + v136[3] = 0; + v141[3] = -1; + ++v14; + if (v131[1] < v14 && v141[1] != -1) break; - } - v131[7] = v14; - - if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) - v141[1] = -1; - if (v141[3] < 0 || _vm->_objectsManager._lastLine < v141[3]) - v141[3] = -1; - if (v141[5] < 0 || _vm->_objectsManager._lastLine < v141[5]) - v141[5] = -1; - if (v141[7] < 0 || _vm->_objectsManager._lastLine < v141[7]) - v141[7] = -1; - if (v141[1] < 0) - v131[1] = 1300; - if (v141[3] < 0) - v131[3] = 1300; - if (v141[5] < 0) - v131[5] = 1300; - if (v141[7] < 0) - v131[7] = 1300; - if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) - return (int16 *)g_PTRNUL; + if (v131[5] < v14 && v141[5] != -1) + break; + } + v131[3] = v14; - if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { - v121 = v141[5]; - v120 = v136[5]; - } else if (v141[1] != -1 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { - v121 = v141[1]; - v120 = v136[1]; - } else if (v141[3] != -1 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { - v121 = v141[3]; - v120 = v136[3]; - } else if (v141[7] != -1 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { - v121 = v141[7]; - v120 = v136[7]; - } - - for (v12 = 0; v12 <= 8; ++v12) { - v141[v12] = -1; - v136[v12] = 0; - v131[v12] = 1300; - v126[v12] = 1300; - } - - v14 = 0; - for (int v35 = srcY; v35 < _vm->_graphicsManager._maxY; v35++, v14++) { - if (checkCollisionLine(srcX, v35, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) - break; - v136[5] = 0; - v141[5] = -1; - } - v131[5] = v14 + 1; + v14 = 0; + for (int tmpX = clipDestX; tmpX > _vm->_graphicsManager._minX; tmpX--) { + if (checkCollisionLine(tmpX, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + break; + v136[7] = 0; + v141[7] = -1; + ++v14; + if (v131[1] < v14 && v141[1] != -1) + break; + if (v131[5] < v14 && v141[5] != -1) + break; + if (v131[3] < v14 && v141[3] != -1) + break; + } + v131[7] = v14; + + if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) + v141[1] = -1; + if (v141[3] < 0 || _vm->_objectsManager._lastLine < v141[3]) + v141[3] = -1; + if (v141[5] < 0 || _vm->_objectsManager._lastLine < v141[5]) + v141[5] = -1; + if (v141[7] < 0 || _vm->_objectsManager._lastLine < v141[7]) + v141[7] = -1; + if (v141[1] < 0) + v131[1] = 1300; + if (v141[3] < 0) + v131[3] = 1300; + if (v141[5] < 0) + v131[5] = 1300; + if (v141[7] < 0) + v131[7] = 1300; + if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) + return (int16 *)g_PTRNUL; - v14 = 0; - for (int v39 = srcY; v39 > _vm->_graphicsManager._minY; v39--) { - if (checkCollisionLine(srcX, v39, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) - break; - v136[1] = 0; - v141[1] = -1; - ++v14; - if (v141[5] != -1 && v14 > 80) - break; - } - v131[1] = v14 + 1; + if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { + v121 = v141[5]; + v120 = v136[5]; + } else if (v141[1] != -1 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { + v121 = v141[1]; + v120 = v136[1]; + } else if (v141[3] != -1 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { + v121 = v141[3]; + v120 = v136[3]; + } else if (v141[7] != -1 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { + v121 = v141[7]; + v120 = v136[7]; + } - v14 = 0; - for (int v43 = srcX; v43 < _vm->_graphicsManager._maxX; v43++) { - if (checkCollisionLine(v43, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) - break; - v136[3] = 0; - v141[3] = -1; - ++v14; - if ((v141[5] != -1 || v141[1] != -1) && (v14 > 100)) - break; - } - v131[3] = v14 + 1; + for (int i = 0; i <= 8; ++i) { + v141[i] = -1; + v136[i] = 0; + v131[i] = 1300; + v126[i] = 1300; + } - v14 = 0; - for (int v47 = srcX; v47 > _vm->_graphicsManager._minX; v47--) { - if (checkCollisionLine(v47, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) - break; - v136[7] = 0; - v141[7] = -1; - ++v14; - if ((v141[5] != -1 || v141[1] != -1 || v141[3] != -1) && (v14 > 100)) - break; - } - v131[7] = v14 + 1; - - if (v141[1] != -1) - v126[1] = abs(v141[1] - v121); - - if (v141[3] != -1) - v126[3] = abs(v141[3] - v121); - - if (v141[5] != -1) - v126[5] = abs(v141[5] - v121); - - if (v141[7] != -1) - v126[7] = abs(v141[7] - v121); - - if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) - error("Nearest point not found error"); - - if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { - v115 = v141[1]; - v111 = v131[1]; - v113 = 1; - v114 = v136[1]; - } else if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { - v115 = v141[5]; - v111 = v131[5]; - v113 = 5; - v114 = v136[5]; - } else if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { - v115 = v141[3]; - v111 = v131[3]; - v113 = 3; - v114 = v136[3]; - } else if (v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { - v115 = v141[7]; - v111 = v131[7]; - v113 = 7; - v114 = v136[7]; - } - - v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); - if (v55 != 1) { - if (v55 == 2) { + v14 = 0; + for (int tmpY = srcY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { + if (checkCollisionLine(srcX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + break; + v136[5] = 0; + v141[5] = -1; + } + v131[5] = v14 + 1; + + v14 = 0; + for (int tmpY = srcY; tmpY > _vm->_graphicsManager._minY; tmpY--) { + if (checkCollisionLine(srcX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + break; + v136[1] = 0; + v141[1] = -1; + ++v14; + if (v141[5] != -1 && v14 > 80) + break; + } + v131[1] = v14 + 1; + + v14 = 0; + for (int tmpX = srcX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { + if (checkCollisionLine(tmpX, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + break; + v136[3] = 0; + v141[3] = -1; + ++v14; + if ((v141[5] != -1 || v141[1] != -1) && (v14 > 100)) + break; + } + v131[3] = v14 + 1; + + v14 = 0; + for (int tmpX = srcX; tmpX > _vm->_graphicsManager._minX; tmpX--) { + if (checkCollisionLine(tmpX, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + break; + v136[7] = 0; + v141[7] = -1; + ++v14; + if ((v141[5] != -1 || v141[1] != -1 || v141[3] != -1) && (v14 > 100)) + break; + } + v131[7] = v14 + 1; + + if (v141[1] != -1) + v126[1] = abs(v141[1] - v121); + + if (v141[3] != -1) + v126[3] = abs(v141[3] - v121); + + if (v141[5] != -1) + v126[5] = abs(v141[5] - v121); + + if (v141[7] != -1) + v126[7] = abs(v141[7] - v121); + + if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) + error("Nearest point not found"); + + if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { + v115 = v141[1]; + v111 = v131[1]; + v113 = 1; + v114 = v136[1]; + } else if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { + v115 = v141[5]; + v111 = v131[5]; + v113 = 5; + v114 = v136[5]; + } else if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { + v115 = v141[3]; + v111 = v131[3]; + v113 = 3; + v114 = v136[3]; + } else if (v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { + v115 = v141[7]; + v111 = v131[7]; + v113 = 7; + v114 = v136[7]; + } + + v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); + if (v55 != 1) { + if (v55 == 2) { LABEL_201: - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - } else { - if (v113 == 1) { - v56 = 0; - if (v111 > 0) { - do { - if (checkCollisionLine(srcX, srcY - v56, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - v112 = v112; - v58 = GENIAL(v124, v125, srcX, srcY - v56, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); - if (v58 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; - } - v112 = v58; - if (NVPY != -1) - v56 = srcY - NVPY; - } - v59 = v112; - _vm->_globals.super_parcours[v59] = srcX; - _vm->_globals.super_parcours[v59 + 1] = srcY - v56; - _vm->_globals.super_parcours[v59 + 2] = 1; - _vm->_globals.super_parcours[v59 + 3] = 0; - v112 += 4; - ++v56; - } while (v111 > v56); + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + } else { + if (v113 == 1) { + for (int deltaY = 0; deltaY < v111; deltaY++) { + if (checkCollisionLine(srcX, srcY - deltaY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { + v58 = GENIAL(v124, v125, srcX, srcY - deltaY, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); + if (v58 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } + v112 = v58; + if (NVPY != -1) + deltaY = srcY - NVPY; } + _vm->_globals.super_parcours[v112] = srcX; + _vm->_globals.super_parcours[v112 + 1] = srcY - deltaY; + _vm->_globals.super_parcours[v112 + 2] = 1; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; } - if (v113 == 5) { - v60 = 0; - if (v111 > 0) { - do { - if (checkCollisionLine(srcX, v60 + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - v112 = v112; - v61 = GENIAL(v124, v125, srcX, v60 + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); - if (v61 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; - } - v112 = v61; - if (NVPY != -1) - v60 = NVPY - srcY; - } - v62 = v112; - _vm->_globals.super_parcours[v62] = srcX; - _vm->_globals.super_parcours[v62 + 1] = v60 + srcY; - _vm->_globals.super_parcours[v62 + 2] = 5; - _vm->_globals.super_parcours[v62 + 3] = 0; - v112 += 4; - ++v60; - } while (v111 > v60); + } else if (v113 == 5) { + for (int deltaY = 0; deltaY < v111; deltaY++) { + if (checkCollisionLine(srcX, deltaY + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { + v61 = GENIAL(v124, v125, srcX, deltaY + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); + if (v61 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } + v112 = v61; + if (NVPY != -1) + deltaY = NVPY - srcY; } + _vm->_globals.super_parcours[v112] = srcX; + _vm->_globals.super_parcours[v112 + 1] = deltaY + srcY; + _vm->_globals.super_parcours[v112 + 2] = 5; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; } - if (v113 == 7) { - v63 = 0; - if (v111 > 0) { - do { - if (checkCollisionLine(srcX - v63, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - v112 = v112; - v64 = GENIAL(v124, v125, srcX - v63, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); - if (v64 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; - } - v112 = v64; - if (NVPX != -1) - v63 = srcX - NVPX; - } - v65 = v112; - _vm->_globals.super_parcours[v65] = srcX - v63; - _vm->_globals.super_parcours[v65 + 1] = srcY; - _vm->_globals.super_parcours[v65 + 2] = 7; - _vm->_globals.super_parcours[v65 + 3] = 0; - v112 += 4; - ++v63; - } while (v111 > v63); + } else if (v113 == 7) { + for (int deltaX = 0; deltaX < v111; deltaX++) { + if (checkCollisionLine(srcX - deltaX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { + v64 = GENIAL(v124, v125, srcX - deltaX, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); + if (v64 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } + v112 = v64; + if (NVPX != -1) + deltaX = srcX - NVPX; } + _vm->_globals.super_parcours[v112] = srcX - deltaX; + _vm->_globals.super_parcours[v112 + 1] = srcY; + _vm->_globals.super_parcours[v112 + 2] = 7; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; } - if (v113 == 3) { - v66 = 0; - if (v111 > 0) { - do { - if (checkCollisionLine(v66 + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - v112 = v112; - v67 = GENIAL(v124, v125, v66 + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); - if (v67 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; - } - v112 = v67; - if (NVPX != -1) - v66 = NVPX - srcX; - } - v68 = v112; - _vm->_globals.super_parcours[v68] = v66 + srcX; - _vm->_globals.super_parcours[v68 + 1] = srcY; - _vm->_globals.super_parcours[v68 + 2] = 3; - _vm->_globals.super_parcours[v68 + 3] = 0; - v112 += 4; - ++v66; - } while (v111 > v66); + } else if (v113 == 3) { + for (int deltaX = 0; deltaX < v111; deltaX++) { + if (checkCollisionLine(deltaX + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < v124) { + v67 = GENIAL(v124, v125, deltaX + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); + if (v67 == -1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + return &_vm->_globals.super_parcours[0]; + } + v112 = v67; + if (NVPX != -1) + deltaX = NVPX - srcX; } + _vm->_globals.super_parcours[v112] = deltaX + srcX; + _vm->_globals.super_parcours[v112 + 1] = srcY; + _vm->_globals.super_parcours[v112 + 2] = 3; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; } } + } LABEL_234: - if (v115 < v121) { - for (i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { - v70 = Ligne[v115]._lineData; - v119 = v70[2 * i]; - v118 = v70[2 * i + 1]; - v71 = v112; - _vm->_globals.super_parcours[v71] = v119; - _vm->_globals.super_parcours[v71 + 1] = v118; - _vm->_globals.super_parcours[v71 + 2] = Ligne[v115].field6; - _vm->_globals.super_parcours[v71 + 3] = 0; + if (v115 < v121) { + for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { + _vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * i]; + _vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; + _vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field6; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; + } + for (int v116 = v115 + 1; v116 < v121; v116++) { + v72 = 0; + v110 = v116; + for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { + v119 = Ligne[v110]._lineData[2 * v72]; + v118 = Ligne[v110]._lineData[2 * v72 + 1]; + _vm->_globals.super_parcours[v112] = v119; + _vm->_globals.super_parcours[v112 + 1] = v118; + _vm->_globals.super_parcours[v112 + 2] = Ligne[v110].field6; + _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; - } - v116 = v115 + 1; - if ((v115 + 1) < v121) { - do { - v72 = 0; - v110 = v116; - for (j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { - v74 = Ligne[v110]._lineData; - v119 = v74[2 * v72]; - v118 = v74[2 * v72 + 1]; - v75 = v112; - _vm->_globals.super_parcours[v75] = v119; - _vm->_globals.super_parcours[v75 + 1] = v118; - _vm->_globals.super_parcours[v75 + 2] = Ligne[v110].field6; - _vm->_globals.super_parcours[v75 + 3] = 0; - v112 += 4; - v76 = Ligne[v110]._lineDataEndIdx; - if (v76 > 30) { - v77 = abs(v76 / 2); - if (v72 == v77) { - v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); - if (v78 == 1) - return &_vm->_globals.super_parcours[0]; - if (v78 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v110, v121, v112)) - goto LABEL_201; - } + if (Ligne[v110]._lineDataEndIdx > 30) { + if (v72 == Ligne[v110]._lineDataEndIdx / 2) { + v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); + if (v78 == 1) + return &_vm->_globals.super_parcours[0]; + if (v78 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } - ++v72; - v110 = v116; - } - v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); - if (v79 == 1) - return &_vm->_globals.super_parcours[0]; - if (v79 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; + if (MIRACLE(v119, v118, v110, v121, v112)) + goto LABEL_201; } - if (MIRACLE(v119, v118, v116, v121, v112)) - goto LABEL_201; - ++v116; - } while (v116 < v121); + } + ++v72; + v110 = v116; } - v114 = 0; - v115 = v121; - } - if (v115 > v121) { - v80 = v114; - if (v114 > 0) { - v98 = v115; - do { - v81 = Ligne[v98]._lineData; - v119 = v81[2 * v80]; - v118 = v81[2 * v80 + 1]; - - v82 = v112; - _vm->_globals.super_parcours[v82] = v119; - _vm->_globals.super_parcours[v82 + 1] = v118; - _vm->_globals.super_parcours[v82 + 2] = Ligne[v98].field8; - _vm->_globals.super_parcours[v82 + 3] = 0; - v112 += 4; - --v80; - } while (v80 > 0); + v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); + if (v79 == 1) + return &_vm->_globals.super_parcours[0]; + if (v79 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } - v117 = v115 - 1; - if ((v115 - 1) > v121) { - do { - v83 = Ligne[v117]._lineDataEndIdx - 1; - if (v83 > -1) { - v109 = v117; - do { - v84 = Ligne[v109]._lineData; - v119 = v84[2 * v83]; - v118 = v84[2 * v83 + 1]; - v85 = v112; - _vm->_globals.super_parcours[v85] = v119; - _vm->_globals.super_parcours[v85 + 1] = v118; - _vm->_globals.super_parcours[v85 + 2] = Ligne[v109].field8; - _vm->_globals.super_parcours[v85 + 3] = 0; - v112 += 4; - v86 = Ligne[v109]._lineDataEndIdx; - if (v86 > 30) { - v87 = abs(v86 / 2); - if (v83 == v87) { - v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v88 == 1) - return &_vm->_globals.super_parcours[0]; - if (v88 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v117, v121, v112)) - goto LABEL_201; - } - } - --v83; - } while (v83 > -1); - } - v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v89 == 1) + if (MIRACLE(v119, v118, v116, v121, v112)) + goto LABEL_201; + } + v114 = 0; + v115 = v121; + } + if (v115 > v121) { + for (int dataIdx = v114; dataIdx > 0; dataIdx--) { + _vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; + _vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; + _vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field8; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; + } + + for (int v117 = v115 - 1; v117 > v121; v117--) { + for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { + _vm->_globals.super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; + _vm->_globals.super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; + _vm->_globals.super_parcours[v112 + 2] = Ligne[v117].field8; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; + if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { + v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v88 == 1) return &_vm->_globals.super_parcours[0]; - if (v89 == 2) { + if (v88 == 2) { v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; v112 = NV_POSI; - goto LABEL_234; + goto LABEL_234; } if (MIRACLE(v119, v118, v117, v121, v112)) goto LABEL_201; - --v117; - } while (v117 > v121); - } - v114 = Ligne[v121]._lineDataEndIdx - 1; - v115 = v121; - } - if (v115 == v121) { - if (v114 <= v120) { - if (v114 < v120) { - v94 = v114; - v100 = v121; - do { - v95 = Ligne[v100]._lineData; - v96 = v95[2 * v94 + 1]; - v97 = v112; - _vm->_globals.super_parcours[v97] = v95[2 * v94]; - _vm->_globals.super_parcours[v97 + 1] = v96; - _vm->_globals.super_parcours[v97 + 2] = Ligne[v100].field6; - _vm->_globals.super_parcours[v97 + 3] = 0; - v112 += 4; - ++v94; - } while (v120 > v94); } - } else { - v90 = v114; - v99 = v121; - do { - v91 = Ligne[v99]._lineData; - v92 = v91[2 * v90 + 1]; - v93 = v112; - _vm->_globals.super_parcours[v93] = v91[2 * v90]; - _vm->_globals.super_parcours[v93 + 1] = v92; - _vm->_globals.super_parcours[v93 + 2] = Ligne[v99].field8; - _vm->_globals.super_parcours[v93 + 3] = 0; - v112 += 4; - --v90; - } while (v120 < v90); } + v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v89 == 1) + return &_vm->_globals.super_parcours[0]; + if (v89 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; + } + if (MIRACLE(v119, v118, v117, v121, v112)) + goto LABEL_201; } - if (PARC_PERS( - _vm->_globals.super_parcours[v112 - 4], - _vm->_globals.super_parcours[v112 - 3], - clipDestX, - clipDestY, - -1, - -1, - v112) != 1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; + v114 = Ligne[v121]._lineDataEndIdx - 1; + v115 = v121; + } + if (v115 == v121) { + if (v114 <= v120) { + for (int dataIdx = v114; dataIdx < v120; dataIdx++) { + _vm->_globals.super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; + _vm->_globals.super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; + _vm->_globals.super_parcours[v112 + 2] = Ligne[v121].field6; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; + } + } else { + for (int dataIdx = v114; dataIdx > v120; dataIdx--) { + _vm->_globals.super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; + _vm->_globals.super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; + _vm->_globals.super_parcours[v112 + 2] = Ligne[v121].field8; + _vm->_globals.super_parcours[v112 + 3] = 0; + v112 += 4; + } } - return &_vm->_globals.super_parcours[0]; } + if (PARC_PERS(_vm->_globals.super_parcours[v112 - 4], + _vm->_globals.super_parcours[v112 - 3], + clipDestX, + clipDestY, + -1, + -1, + v112) != 1) { + _vm->_globals.super_parcours[v112] = -1; + _vm->_globals.super_parcours[v112 + 1] = -1; + _vm->_globals.super_parcours[v112 + 2] = -1; + _vm->_globals.super_parcours[v112 + 3] = -1; + } + return &_vm->_globals.super_parcours[0]; } return &_vm->_globals.super_parcours[0]; } -- cgit v1.2.3 From 550065b496e8b84db785f57c48466ec71e5e1b78 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 25 Jan 2013 08:24:17 +0100 Subject: HOPKINS: Start refactoring PARC_PERS --- engines/hopkins/lines.cpp | 471 ++++++++++++++++------------------------------ 1 file changed, 167 insertions(+), 304 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 56a68f14cd..7d91ca96c8 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1174,23 +1174,8 @@ LABEL_17: // Avoid 2 int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { - int v14; - int v55; - int v58; - int v61; - int v64; - int v67; - int v72; - int v78; - int v79; - int v88; - int v89; - int v110; - int v112; int v118 = 0; int v119 = 0; - int v124; - int v125; int v126[9]; int v131[9]; int v136[9]; @@ -1224,7 +1209,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { _vm->_globals.old_y1_66 = srcY; _vm->_globals.old_y2_68 = clipDestY; _vm->_globals.pathFindingDepth = 0; - v112 = 0; + int v112 = 0; if (destX <= 19) clipDestX = 20; if (clipDestY <= 19) @@ -1247,7 +1232,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) == 1) return &_vm->_globals.super_parcours[0]; - v14 = 0; + int v14 = 0; for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { if (checkCollisionLine(clipDestX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) break; @@ -1419,7 +1404,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v114 = v136[7]; } - v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); + int v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); if (v55 != 1) { if (v55 == 2) { LABEL_201: @@ -1427,11 +1412,13 @@ LABEL_201: v114 = NV_LIGNEOFS; v112 = NV_POSI; } else { + int v125; + int v124; if (v113 == 1) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(srcX, srcY - deltaY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v58 = GENIAL(v124, v125, srcX, srcY - deltaY, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); + int v58 = GENIAL(v124, v125, srcX, srcY - deltaY, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); if (v58 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1453,7 +1440,7 @@ LABEL_201: for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(srcX, deltaY + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v61 = GENIAL(v124, v125, srcX, deltaY + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); + int v61 = GENIAL(v124, v125, srcX, deltaY + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1475,7 +1462,7 @@ LABEL_201: for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(srcX - deltaX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v64 = GENIAL(v124, v125, srcX - deltaX, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); + int v64 = GENIAL(v124, v125, srcX - deltaX, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v64 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1497,7 +1484,7 @@ LABEL_201: for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { - v67 = GENIAL(v124, v125, deltaX + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); + int v67 = GENIAL(v124, v125, deltaX + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v67 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1527,8 +1514,8 @@ LABEL_234: v112 += 4; } for (int v116 = v115 + 1; v116 < v121; v116++) { - v72 = 0; - v110 = v116; + int v72 = 0; + int v110 = v116; for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { v119 = Ligne[v110]._lineData[2 * v72]; v118 = Ligne[v110]._lineData[2 * v72 + 1]; @@ -1539,7 +1526,7 @@ LABEL_234: v112 += 4; if (Ligne[v110]._lineDataEndIdx > 30) { if (v72 == Ligne[v110]._lineDataEndIdx / 2) { - v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); + int v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) return &_vm->_globals.super_parcours[0]; if (v78 == 2) { @@ -1555,7 +1542,7 @@ LABEL_234: ++v72; v110 = v116; } - v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); + int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); if (v79 == 1) return &_vm->_globals.super_parcours[0]; if (v79 == 2) { @@ -1587,7 +1574,7 @@ LABEL_234: _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { - v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) return &_vm->_globals.super_parcours[0]; if (v88 == 2) { @@ -1600,7 +1587,7 @@ LABEL_234: goto LABEL_201; } } - v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v89 == 1) return &_vm->_globals.super_parcours[0]; if (v89 == 2) { @@ -1652,73 +1639,26 @@ LABEL_234: } int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { - int16 *v17; - int v18; int v19; int v20; int v21; int v22; int v23; int v24; - int v25; - int16 *v26; - int v27; - int16 *v28; - int16 *v29; - int v30; - int v31; - int16 *v32; int v33; - int v34; - int16 *v35; int v36; - int v37; - int16 *v38; int v39; int v40; - int v41; - int16 *v42; int v43; int v44; bool v45; - int v46; - int16 *v47; - int v48; - int16 *v49; - int16 *v50; - int v51; - int v52; - int16 *v53; int v54; int v55; - int v56; - int16 *v57; int v58; - int v59; - int16 *v60; int v61; int v62; - int v63; - int16 *v64; int v65; int v66; - int16 *v72; - int v73; - int v74; - int v76; - int16 *v77; - int16 *v78; - int v79; - int16 *v80; - int v81; - int16 *v82; - int v83; - int16 *v84; - int v85; - int16 *v86; - int v87; - int16 *v88; - int v89; int v91; int v92; int v93; @@ -1738,7 +1678,6 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v107; int v108; int v109; - int v110; int v111; int v113; int v114; @@ -1753,16 +1692,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v123; int v124; int v125; - int v126 = 0; - int v127; - int v128; - int v129; - int v130; - int v131; - int v132; - int v133; - int v134; - int v135; + bool v126 = false; int v138; int v139; int v140; @@ -1775,9 +1705,10 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v7 = a1; int v90 = a2; int v137 = a7; - int v136 = 0; + bool v136 = false; if (a5 == -1 && a6 == -1) - v136 = 1; + v136 = true; + int v144 = a5; if (checkCollisionLine(a1, a2, &v145, &v144, 0, _linesNumb)) { switch (Ligne[v144].field4) { @@ -1823,44 +1754,36 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int v109 = v90; if (a3 >= v7 - 2 && a3 <= v7 + 2 && a4 >= v90 - 2 && a4 <= v90 + 2) { LABEL_149: - v27 = v115; - v28 = _vm->_globals.essai0; - v28[v27] = -1; - v28[v27 + 1] = -1; - v28[v27 + 2] = -1; + _vm->_globals.essai0[v115] = -1; + _vm->_globals.essai0[v115 + 1] = -1; + _vm->_globals.essai0[v115 + 2] = -1; LABEL_150: if (v115) { - v127 = 0; v116 = 0; - v29 = _vm->_globals.essai0; - do { - v30 = v137; - _vm->_globals.super_parcours[v30] = v29[v116]; - _vm->_globals.super_parcours[v30 + 1] = v29[v116 + 1]; - _vm->_globals.super_parcours[v30 + 2] = v29[v116 + 2]; - _vm->_globals.super_parcours[v30 + 3] = 0; + for (;;) { + _vm->_globals.super_parcours[v137] = _vm->_globals.essai0[v116]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai0[v116 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai0[v116 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v116 += 3; v137 += 4; - if (v29[v116] == -1) { - if (v29[v116 + 1] == -1) - v127 = 1; - } - } while (v127 != 1); + if (_vm->_globals.essai0[v116] == -1 && _vm->_globals.essai0[v116 + 1] == -1) + break; + }; } - v74 = v137; - _vm->_globals.super_parcours[v74] = -1; - _vm->_globals.super_parcours[v74 + 1] = -1; - _vm->_globals.super_parcours[v74 + 2] = -1; - _vm->_globals.super_parcours[v74 + 3] = -1; + _vm->_globals.super_parcours[v137] = -1; + _vm->_globals.super_parcours[v137 + 1] = -1; + _vm->_globals.super_parcours[v137 + 2] = -1; + _vm->_globals.super_parcours[v137 + 3] = -1; return 1; } v9 = abs(v7 - a3); v10 = v9 + 1; v11 = abs(v90 - a4); v107 = v11 + 1; - if (v10 > (int16)(v11 + 1)) + if (v10 > v107) v107 = v10; v12 = v107 - 1; v101 = 1000 * v10 / v12; @@ -1872,7 +1795,7 @@ LABEL_150: v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; v91 = -1; - if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 150) + if (v94 == -1 && (unsigned int)v101 <= 150) v91 = 1; if (v13 == 1) { if ((unsigned int)(v99 + 1) <= 151) @@ -1990,11 +1913,9 @@ LABEL_72: if (v108 + 1 <= 0) goto LABEL_149; while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { - v25 = v115; - v26 = _vm->_globals.essai0; - v26[v25] = v104; - v26[v25 + 1] = v103; - v26[v25 + 2] = v91; + _vm->_globals.essai0[v115] = v104; + _vm->_globals.essai0[v115 + 1] = v103; + _vm->_globals.essai0[v115 + 2] = v91; v106 += v102; v105 += v100; v104 = v106 / 1000; @@ -2019,33 +1940,24 @@ LABEL_72: } v91 = SMOOTH_SENS; v14 = 0; - int v16; for (;;) { - int v112 = SMOOTH[v14].field0; - v110 = SMOOTH[v14].field2; - if (v112 == -1 || SMOOTH[v14].field2 == -1) { - v126 = 1; - if (v126 == 1) { - v18 = v14 - 1; - v111 = SMOOTH[v18].field0; - v109 = SMOOTH[v18].field2; - goto LABEL_72; - } + if (SMOOTH[v14].field0 == -1 || SMOOTH[v14].field2 == -1) { + v126 = true; + v111 = SMOOTH[v14 - 1].field0; + v109 = SMOOTH[v14 - 1].field2; + goto LABEL_72; } - if (checkCollisionLine(v112, v110, &v143, &v142, 0, _linesNumb)) + if (checkCollisionLine(SMOOTH[v14].field0, SMOOTH[v14].field2, &v143, &v142, 0, _linesNumb)) break; - v16 = v115; - v17 = _vm->_globals.essai0; - v17[v16] = v112; - v17[v16 + 1] = v110; - v17[v16 + 2] = v91; + _vm->_globals.essai0[v115] = SMOOTH[v14].field0; + _vm->_globals.essai0[v115 + 1] = SMOOTH[v14].field2; + _vm->_globals.essai0[v115 + 2] = v91; v115 += 3; ++v14; - if (v126 == 1) { - v18 = v14 - 1; - v111 = SMOOTH[v18].field0; - v109 = SMOOTH[v18].field2; + if (v126) { + v111 = SMOOTH[v14 - 1].field0; + v109 = SMOOTH[v14 - 1].field2; goto LABEL_72; } } @@ -2053,11 +1965,9 @@ LABEL_72: v142 = -1; LABEL_157: - v31 = v115; - v32 = _vm->_globals.essai0; - v32[v31] = -1; - v32[v31 + 1] = -1; - v32[v31 + 2] = -1; + _vm->_globals.essai0[v115] = -1; + _vm->_globals.essai0[v115 + 1] = -1; + _vm->_globals.essai0[v115 + 2] = -1; v117 = 0; v33 = v98; @@ -2071,11 +1981,9 @@ LABEL_165: if (v113 > a3) { v36 = v113; while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) { - v37 = v117; - v38 = _vm->_globals.essai1; - v38[v37] = v36; - v38[v37 + 1] = v92; - v38[v37 + 2] = 7; + _vm->_globals.essai1[v117] = v36; + _vm->_globals.essai1[v117 + 1] = v92; + _vm->_globals.essai1[v117 + 2] = 7; v117 += 3; --v36; if (a3 >= v36) @@ -2109,43 +2017,36 @@ LABEL_181: if (v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; } - v46 = v117; - v47 = _vm->_globals.essai1; - v47[v46] = a3; - v47[v46 + 1] = v43; - v47[v46 + 2] = 1; + _vm->_globals.essai1[v117] = a3; + _vm->_globals.essai1[v117 + 1] = v43; + _vm->_globals.essai1[v117 + 2] = 1; v117 += 3; --v43; } while (a4 < v43); } LABEL_194: - v48 = v117; - v49 = _vm->_globals.essai1; - v49[v48] = -1; - v49[v48 + 1] = -1; - v49[v48 + 2] = -1; + _vm->_globals.essai1[v117] = -1; + _vm->_globals.essai1[v117 + 1] = -1; + _vm->_globals.essai1[v117 + 2] = -1; LABEL_195: if (v117) { - v128 = 0; v118 = 0; - v50 = _vm->_globals.essai1; - do { - v51 = v137; - _vm->_globals.super_parcours[v51] = v50[v118]; - _vm->_globals.super_parcours[v51 + 1] = v50[v118 + 1]; - _vm->_globals.super_parcours[v51 + 2] = v50[v118 + 2]; - _vm->_globals.super_parcours[v51 + 3] = 0; + _vm->_globals.essai1 = _vm->_globals.essai1; + for (;;) { + _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v118]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v118 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v118 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v118 += 3; v137 += 4; - if (v50[v118] == -1 && v50[v118 + 1] == -1) - v128 = 1; - } while (v128 != 1); + if (_vm->_globals.essai1[v118] == -1 && _vm->_globals.essai1[v118 + 1] == -1) + break;; + } } - v74 = v137; - _vm->_globals.super_parcours[v74] = -1; - _vm->_globals.super_parcours[v74 + 1] = -1; - _vm->_globals.super_parcours[v74 + 2] = -1; - _vm->_globals.super_parcours[v74 + 3] = -1; + _vm->_globals.super_parcours[v137] = -1; + _vm->_globals.super_parcours[v137 + 1] = -1; + _vm->_globals.super_parcours[v137 + 2] = -1; + _vm->_globals.super_parcours[v137 + 3] = -1; return 1; } v39 = v92; @@ -2156,26 +2057,22 @@ LABEL_195: if (v40 == -1) goto LABEL_195; v117 = v40; - if (NVPX != -1) { - if (NVPY != -1) { - v33 = NVPX; - v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); - if (v45 && v140 <= _vm->_objectsManager._lastLine) - goto LABEL_202; - goto LABEL_158; - } + if (NVPX != -1 && NVPY != -1) { + v33 = NVPX; + v92 = NVPY; + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); + if (v45 && v140 <= _vm->_objectsManager._lastLine) + goto LABEL_202; + goto LABEL_158; } } if (v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; } - v41 = v117; - v42 = _vm->_globals.essai1; - v42[v41] = a3; - v42[v41 + 1] = v39; - v42[v41 + 2] = 5; + _vm->_globals.essai1[v117] = a3; + _vm->_globals.essai1[v117 + 1] = v39; + _vm->_globals.essai1[v117 + 2] = 5; v117 += 3; ++v39; if (a4 <= v39) @@ -2183,11 +2080,9 @@ LABEL_195: } } while (!checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { - v34 = v117; - v35 = _vm->_globals.essai1; - v35[v34] = v33; - v35[v34 + 1] = v92; - v35[v34 + 2] = 3; + _vm->_globals.essai1[v117] = v33; + _vm->_globals.essai1[v117 + 1] = v92; + _vm->_globals.essai1[v117 + 2] = 3; v117 += 3; ++v33; if (a3 <= v33) @@ -2197,11 +2092,9 @@ LABEL_168: if (v140 > _vm->_objectsManager._lastLine) v140 = -1; LABEL_202: - v52 = v117; - v53 = _vm->_globals.essai1; - v53[v52] = -1; - v53[v52 + 1] = -1; - v53[v52 + 2] = -1; + _vm->_globals.essai1[v117] = -1; + _vm->_globals.essai1[v117 + 1] = -1; + _vm->_globals.essai1[v117 + 2] = -1; v117 = 0; v54 = v98; v93 = v97; @@ -2212,11 +2105,9 @@ LABEL_203: if (v93 < a4) { v55 = v93; while (!checkCollisionLine(v114, v55, &v139, &v138, 0, _linesNumb)) { - v56 = v117; - v57 = _vm->_globals.essai2; - v57[v56] = v114; - v57[v56 + 1] = v55; - v57[v56 + 2] = 5; + _vm->_globals.essai2[v117] = v114; + _vm->_globals.essai2[v117 + 1] = v55; + _vm->_globals.essai2[v117 + 2] = 5; v117 += 3; ++v55; if (a4 <= v55) @@ -2228,11 +2119,9 @@ LABEL_211: if (v93 > a4) { v58 = v93; while (!checkCollisionLine(v114, v58, &v139, &v138, 0, _linesNumb)) { - v59 = v117; - v60 = _vm->_globals.essai2; - v60[v59] = v114; - v60[v59 + 1] = v58; - v60[v59 + 2] = 1; + _vm->_globals.essai2[v117] = v114; + _vm->_globals.essai2[v117 + 1] = v58; + _vm->_globals.essai2[v117 + 2] = 1; v117 += 3; --v58; if (a4 >= v58) @@ -2242,74 +2131,64 @@ LABEL_214: if (v138 > _vm->_objectsManager._lastLine) v138 = -1; LABEL_249: - v76 = v117; - v77 = _vm->_globals.essai2; - v77[v76] = -1; - v77[v76 + 1] = -1; - v77[v76 + 2] = -1; + _vm->_globals.essai2[v117] = -1; + _vm->_globals.essai2[v117 + 1] = -1; + _vm->_globals.essai2[v117 + 2] = -1; - if (v136 != 1) { + if (!v136) { if (a6 > v144) { if (_vm->_globals.essai0[0] != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; - v130 = 0; v120 = 0; - v78 = _vm->_globals.essai0; - do { - v79 = v137; - _vm->_globals.super_parcours[v79] = v78[v120]; - _vm->_globals.super_parcours[v79 + 1] = v78[v120 + 1]; - _vm->_globals.super_parcours[v79 + 2] = v78[v120 + 2]; - _vm->_globals.super_parcours[v79 + 3] = 0; + for (;;) { + _vm->_globals.super_parcours[v137] = _vm->_globals.essai0[v120]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai0[v120 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai0[v120 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v120 += 3; v137 += 4; - if (v78[v120] == -1 && v78[v120 + 1] == -1) - v130 = 1; - } while (v130 != 1); + if (_vm->_globals.essai0[v120] == -1 && _vm->_globals.essai0[v120 + 1] == -1) + break; + } NV_POSI = v137; return 2; } - v80 = _vm->_globals.essai1; if (_vm->_globals.essai1[0] != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; - v131 = 0; v121 = 0; - do { + for (;;) { assert(137 <= 32000); - v81 = v137; - _vm->_globals.super_parcours[v81] = v80[v121]; - _vm->_globals.super_parcours[v81 + 1] = v80[v121 + 1]; - _vm->_globals.super_parcours[v81 + 2] = v80[v121 + 2]; - _vm->_globals.super_parcours[v81 + 3] = 0; + _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v121]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v121 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v121 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v121 += 3; v137 += 4; - if (v80[v121] == -1 && v80[v121 + 1] == -1) - v131 = 1; - } while (v131 != 1); + if (_vm->_globals.essai1[v121] == -1 && _vm->_globals.essai1[v121 + 1] == -1) + break; + } NV_POSI = v137; return 2; } - v82 = _vm->_globals.essai2; + _vm->_globals.essai2 = _vm->_globals.essai2; if (_vm->_globals.essai2[0] != -1) { if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; - v132 = 0; v122 = 0; - do { + for (;;) { assert(v137 <= 32000); - v83 = v137; - _vm->_globals.super_parcours[v83] = v82[v122]; - _vm->_globals.super_parcours[v83 + 1] = v82[v122 + 1]; - _vm->_globals.super_parcours[v83 + 2] = v82[v122 + 2]; - _vm->_globals.super_parcours[v83 + 3] = 0; + _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v122]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v122 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v122 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v122 += 3; v137 += 4; - if (v82[v122] == -1 && v82[v122 + 1] == -1) - v132 = 1; - } while (v132 != 1); + if (_vm->_globals.essai2[v122] == -1 && _vm->_globals.essai2[v122 + 1] == -1) + break; + } NV_POSI = v137; return 2; } @@ -2325,63 +2204,54 @@ LABEL_249: if (_vm->_globals.essai1[0] != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; - v133 = 0; v123 = 0; - v84 = _vm->_globals.essai1; - do { + for (;;) { assert(137 <= 32000); - v85 = v137; - _vm->_globals.super_parcours[v85] = v84[v123]; - _vm->_globals.super_parcours[v85 + 1] = v84[v123 + 1]; - _vm->_globals.super_parcours[v85 + 2] = v84[v123 + 2]; - _vm->_globals.super_parcours[v85 + 3] = 0; + _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v123]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v123 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v123 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v123 += 3; v137 += 4; - if (v84[v123] == -1 && v84[v123 + 1] == -1) - v133 = 1; - } while (v133 != 1); + if (_vm->_globals.essai1[v123] == -1 && _vm->_globals.essai1[v123 + 1] == -1) + break; + } NV_POSI = v137; return 2; } - v86 = _vm->_globals.essai2; if (_vm->_globals.essai2[0] != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { NV_LIGNEDEP = v138; NV_LIGNEOFS = v139; - v134 = 0; v124 = 0; - do { + for (;;) { assert(137 <= 32000); - v87 = v137; - _vm->_globals.super_parcours[v87] = v86[v124]; - _vm->_globals.super_parcours[v87 + 1] = v86[v124 + 1]; - _vm->_globals.super_parcours[v87 + 2] = v86[v124 + 2]; - _vm->_globals.super_parcours[v87 + 3] = 0; + _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v124]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v124 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v124 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v124 += 3; v137 += 4; - if (v86[v124] == -1 && v86[v124 + 1] == -1) - v134 = 1; - } while (v134 != 1); + if (_vm->_globals.essai2[v124] == -1 && _vm->_globals.essai2[v124 + 1] == -1) + break; + } NV_POSI = v137; return 2; } if (_vm->_globals.essai1[0] != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; - v135 = 0; v125 = 0; - v88 = _vm->_globals.essai0; - do { + for (;;) { assert(137 <= 32000); - v89 = v137; - _vm->_globals.super_parcours[v89] = v88[v125]; - _vm->_globals.super_parcours[v89 + 1] = v88[v125 + 1]; - _vm->_globals.super_parcours[v89 + 2] = v88[v125 + 2]; - _vm->_globals.super_parcours[v89 + 3] = 0; + _vm->_globals.super_parcours[v137] = _vm->_globals.essai0[v125]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai0[v125 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai0[v125 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v125 += 3; v137 += 4; - if (v88[v125] == -1 && v88[v125 + 1] == -1) - v135 = 1; - } while (v135 != 1); + if (_vm->_globals.essai0[v125] == -1 && _vm->_globals.essai0[v125 + 1] == -1) + break; + } NV_POSI = v137; return 2; @@ -2414,12 +2284,9 @@ LABEL_217: if (v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; } - v63 = v117; - - v64 = _vm->_globals.essai2; - v64[v63] = v61; - v64[v63 + 1] = a4; - v64[v63 + 2] = 3; + _vm->_globals.essai2[v117] = v61; + _vm->_globals.essai2[v117 + 1] = a4; + _vm->_globals.essai2[v117 + 2] = 3; v117 += 3; ++v61; } while (a3 > v61); @@ -2461,26 +2328,22 @@ LABEL_241: _vm->_globals.essai2[v117 + 2] = -1; LABEL_242: if (v117) { - v129 = 0; v119 = 0; - v72 = _vm->_globals.essai2; - do { - v73 = v137; - _vm->_globals.super_parcours[v73] = v72[v119]; - _vm->_globals.super_parcours[v73 + 1] = v72[v119 + 1]; - _vm->_globals.super_parcours[v73 + 2] = v72[v119 + 2]; - _vm->_globals.super_parcours[v73 + 3] = 0; + for (;;) { + _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v119]; + _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v119 + 1]; + _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v119 + 2]; + _vm->_globals.super_parcours[v137 + 3] = 0; v119 += 3; v137 += 4; - if (v72[v119] == -1 && v72[v119 + 1] == -1) - v129 = 1; - } while (v129 != 1); - } - v74 = v137; - _vm->_globals.super_parcours[v74] = -1; - _vm->_globals.super_parcours[v74 + 1] = -1; - _vm->_globals.super_parcours[v74 + 2] = -1; - _vm->_globals.super_parcours[v74 + 3] = -1; + if (_vm->_globals.essai2[v119] == -1 && _vm->_globals.essai2[v119 + 1] == -1) + break; + } + } + _vm->_globals.super_parcours[v137] = -1; + _vm->_globals.super_parcours[v137 + 1] = -1; + _vm->_globals.super_parcours[v137 + 2] = -1; + _vm->_globals.super_parcours[v137 + 3] = -1; return 1; } -- cgit v1.2.3 From 9644e865bd4cf40a0c7ffa35bc24891abd038654 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Jan 2013 01:57:06 +0100 Subject: HOPKINS: Fix regression in pathfinding code, some more refactoring --- engines/hopkins/lines.cpp | 167 ++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 7d91ca96c8..8852fafebc 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1174,6 +1174,8 @@ LABEL_17: // Avoid 2 int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { + int v124; + int v125; int v118 = 0; int v119 = 0; int v126[9]; @@ -1412,8 +1414,6 @@ LABEL_201: v114 = NV_LIGNEOFS; v112 = NV_POSI; } else { - int v125; - int v124; if (v113 == 1) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(srcX, srcY - deltaY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) @@ -1436,10 +1436,11 @@ LABEL_201: _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; } - } else if (v113 == 5) { + } + if (v113 == 5) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(srcX, deltaY + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { + && _vm->_objectsManager._lastLine < v124) { int v61 = GENIAL(v124, v125, srcX, deltaY + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) { _vm->_globals.super_parcours[v112] = -1; @@ -1458,7 +1459,8 @@ LABEL_201: _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; } - } else if (v113 == 7) { + } + if (v113 == 7) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(srcX - deltaX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { @@ -1480,7 +1482,8 @@ LABEL_201: _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; } - } else if (v113 == 3) { + } + if (v113 == 3) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) && _vm->_objectsManager._lastLine < v124) { @@ -1507,6 +1510,8 @@ LABEL_201: LABEL_234: if (v115 < v121) { for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { + v119 = Ligne[v115]._lineData[2 * i]; + v118 = Ligne[v115]._lineData[2 * i + 1]; _vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * i]; _vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; _vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field6; @@ -1519,25 +1524,23 @@ LABEL_234: for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { v119 = Ligne[v110]._lineData[2 * v72]; v118 = Ligne[v110]._lineData[2 * v72 + 1]; - _vm->_globals.super_parcours[v112] = v119; - _vm->_globals.super_parcours[v112 + 1] = v118; + _vm->_globals.super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; + _vm->_globals.super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; _vm->_globals.super_parcours[v112 + 2] = Ligne[v110].field6; _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; - if (Ligne[v110]._lineDataEndIdx > 30) { - if (v72 == Ligne[v110]._lineDataEndIdx / 2) { - int v78 = PARC_PERS(v119, v118, clipDestX, clipDestY, v110, v121, v112); - if (v78 == 1) - return &_vm->_globals.super_parcours[0]; - if (v78 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v110, v121, v112)) - goto LABEL_201; + if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { + int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); + if (v78 == 1) + return &_vm->_globals.super_parcours[0]; + if (v78 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } + if (MIRACLE(v119, v118, v110, v121, v112)) + goto LABEL_201; } ++v72; v110 = v116; @@ -1559,15 +1562,19 @@ LABEL_234: } if (v115 > v121) { for (int dataIdx = v114; dataIdx > 0; dataIdx--) { + v119 = Ligne[v115]._lineData[2 * dataIdx]; + v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; + _vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; _vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; _vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field8; _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; } - for (int v117 = v115 - 1; v117 > v121; v117--) { for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { + v119 = Ligne[v117]._lineData[2 * dataIdx]; + v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; _vm->_globals.super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; _vm->_globals.super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; _vm->_globals.super_parcours[v112 + 2] = Ligne[v117].field8; @@ -1621,7 +1628,8 @@ LABEL_234: } } } - if (PARC_PERS(_vm->_globals.super_parcours[v112 - 4], + if (PARC_PERS( + _vm->_globals.super_parcours[v112 - 4], _vm->_globals.super_parcours[v112 - 3], clipDestX, clipDestY, @@ -1635,10 +1643,12 @@ LABEL_234: } return &_vm->_globals.super_parcours[0]; } + return &_vm->_globals.super_parcours[0]; } int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { + int v18; int v19; int v20; int v21; @@ -1649,15 +1659,10 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v36; int v39; int v40; - int v43; - int v44; bool v45; int v54; int v55; int v58; - int v61; - int v62; - int v65; int v66; int v91; int v92; @@ -1708,7 +1713,6 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int bool v136 = false; if (a5 == -1 && a6 == -1) v136 = true; - int v144 = a5; if (checkCollisionLine(a1, a2, &v145, &v144, 0, _linesNumb)) { switch (Ligne[v144].field4) { @@ -1771,7 +1775,7 @@ LABEL_150: if (_vm->_globals.essai0[v116] == -1 && _vm->_globals.essai0[v116 + 1] == -1) break; - }; + } } _vm->_globals.super_parcours[v137] = -1; _vm->_globals.super_parcours[v137 + 1] = -1; @@ -1783,7 +1787,7 @@ LABEL_150: v10 = v9 + 1; v11 = abs(v90 - a4); v107 = v11 + 1; - if (v10 > v107) + if (v10 > (int16)(v11 + 1)) v107 = v10; v12 = v107 - 1; v101 = 1000 * v10 / v12; @@ -1795,7 +1799,7 @@ LABEL_150: v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; v91 = -1; - if (v94 == -1 && (unsigned int)v101 <= 150) + if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 150) v91 = 1; if (v13 == 1) { if ((unsigned int)(v99 + 1) <= 151) @@ -1943,8 +1947,9 @@ LABEL_72: for (;;) { if (SMOOTH[v14].field0 == -1 || SMOOTH[v14].field2 == -1) { v126 = true; - v111 = SMOOTH[v14 - 1].field0; - v109 = SMOOTH[v14 - 1].field2; + v18 = v14 - 1; + v111 = SMOOTH[v18].field0; + v109 = SMOOTH[v18].field2; goto LABEL_72; } if (checkCollisionLine(SMOOTH[v14].field0, SMOOTH[v14].field2, &v143, &v142, 0, _linesNumb)) @@ -1956,8 +1961,9 @@ LABEL_72: v115 += 3; ++v14; if (v126) { - v111 = SMOOTH[v14 - 1].field0; - v109 = SMOOTH[v14 - 1].field2; + v18 = v14 - 1; + v111 = SMOOTH[v18].field0; + v109 = SMOOTH[v18].field2; goto LABEL_72; } } @@ -1994,35 +2000,29 @@ LABEL_165: LABEL_171: if (v92 >= a4) { LABEL_181: - if (v92 > a4) { - v43 = v92; - do { - if (checkCollisionLine(a3, v43, &v141, &v140, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < v140) { - v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); - if (v44 == -1) - goto LABEL_195; - v117 = v44; - if (NVPX != -1) { - if (NVPY != -1) { - v33 = NVPX; - v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); - if (v45 && v140 <= _vm->_objectsManager._lastLine) - goto LABEL_202; - goto LABEL_158; - } - } + for (int v43 = v92; v43 > a4; v43--) { + if (checkCollisionLine(a3, v43, &v141, &v140, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < v140) { + int v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); + if (v44 == -1) + goto LABEL_195; + v117 = v44; + if (NVPX != -1 && NVPY != -1) { + v33 = NVPX; + v92 = NVPY; + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); + if (v45 && v140 <= _vm->_objectsManager._lastLine) + goto LABEL_202; + goto LABEL_158; } - if (v140 <= _vm->_objectsManager._lastLine) - goto LABEL_202; } - _vm->_globals.essai1[v117] = a3; - _vm->_globals.essai1[v117 + 1] = v43; - _vm->_globals.essai1[v117 + 2] = 1; - v117 += 3; - --v43; - } while (a4 < v43); + if (v140 <= _vm->_objectsManager._lastLine) + goto LABEL_202; + } + _vm->_globals.essai1[v117] = a3; + _vm->_globals.essai1[v117 + 1] = v43; + _vm->_globals.essai1[v117 + 2] = 1; + v117 += 3; } LABEL_194: _vm->_globals.essai1[v117] = -1; @@ -2031,7 +2031,6 @@ LABEL_194: LABEL_195: if (v117) { v118 = 0; - _vm->_globals.essai1 = _vm->_globals.essai1; for (;;) { _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v118]; _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v118 + 1]; @@ -2040,7 +2039,7 @@ LABEL_195: v118 += 3; v137 += 4; if (_vm->_globals.essai1[v118] == -1 && _vm->_globals.essai1[v118 + 1] == -1) - break;; + break; } } _vm->_globals.super_parcours[v137] = -1; @@ -2159,7 +2158,7 @@ LABEL_249: NV_LIGNEOFS = v141; v121 = 0; for (;;) { - assert(137 <= 32000); + assert(v137 <= 32000); _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v121]; _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v121 + 1]; _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v121 + 2]; @@ -2172,7 +2171,6 @@ LABEL_249: NV_POSI = v137; return 2; } - _vm->_globals.essai2 = _vm->_globals.essai2; if (_vm->_globals.essai2[0] != -1) { if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) { NV_LIGNEDEP = v138; @@ -2188,7 +2186,7 @@ LABEL_249: v137 += 4; if (_vm->_globals.essai2[v122] == -1 && _vm->_globals.essai2[v122 + 1] == -1) break; - } + }; NV_POSI = v137; return 2; } @@ -2224,7 +2222,7 @@ LABEL_249: NV_LIGNEOFS = v139; v124 = 0; for (;;) { - assert(137 <= 32000); + assert(v137 <= 32000); _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v124]; _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v124 + 1]; _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v124 + 2]; @@ -2262,11 +2260,10 @@ LABEL_249: } LABEL_217: if (v114 < a3) { - v61 = v114; - do { + for (int v61 = v114; v61 < a3; v61++) { if (checkCollisionLine(v61, a4, &v139, &v138, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v138) { - v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); + int v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v62 == -1) goto LABEL_195; v117 = v62; @@ -2284,31 +2281,28 @@ LABEL_217: if (v138 <= _vm->_objectsManager._lastLine) goto LABEL_249; } + _vm->_globals.essai2[v117] = v61; _vm->_globals.essai2[v117 + 1] = a4; _vm->_globals.essai2[v117 + 2] = 3; v117 += 3; - ++v61; - } while (a3 > v61); + } } if (v114 > a3) { - v65 = v114; - do { + for (int v65 = v114; v65 > a3; v65--) { if (checkCollisionLine(v65, a4, &v139, &v138, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v138) { v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3); if (v66 == -1) goto LABEL_242; v117 = v66; - if (NVPX != -1) { - if (NVPY != -1) { - v54 = NVPX; - v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); - if (colResult && v138 <= _vm->_objectsManager._lastLine) - goto LABEL_249; - goto LABEL_203; - } + if (NVPX != -1 && NVPY != -1) { + v54 = NVPX; + v93 = NVPY; + colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); + if (colResult && v138 <= _vm->_objectsManager._lastLine) + goto LABEL_249; + goto LABEL_203; } } if (v138 <= _vm->_objectsManager._lastLine) @@ -2318,8 +2312,7 @@ LABEL_217: _vm->_globals.essai2[v117 + 1] = a4; _vm->_globals.essai2[v117 + 2] = 7; v117 += 3; - --v65; - } while (a3 < v65); + } } v138 = -1; LABEL_241: -- cgit v1.2.3 From 4887fd6e6e0715088ca9eb48a4cecb4728671de2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Jan 2013 14:54:57 +0100 Subject: HOPKINS: Refactor checkSmoothMove and makeSmoothMove --- engines/hopkins/lines.cpp | 488 +++++++++++++++++++++------------------------- engines/hopkins/lines.h | 15 +- 2 files changed, 231 insertions(+), 272 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 8852fafebc..b5323901e5 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -34,7 +34,7 @@ LinesManager::LinesManager() { Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0); } for (int i = 0; i < 4000; ++i) { - Common::fill((byte *)&SMOOTH[i], (byte *)&SMOOTH[i] + sizeof(SmoothItem), 0); + Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0); } _linesNumb = 0; @@ -43,8 +43,7 @@ LinesManager::LinesManager() { NV_POSI = 0; NVPX = 0; NVPY = 0; - SMOOTH_SENS = 0; - SMOOTH_X = SMOOTH_Y = 0; + _smoothMoveDirection = 0; } void LinesManager::setParent(HopkinsEngine *vm) { @@ -1647,7 +1646,7 @@ LABEL_234: return &_vm->_globals.super_parcours[0]; } -int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { +int LinesManager::PARC_PERS(int a1, int a2, int destX, int destY, int a5, int a6, int a7) { int v18; int v19; int v20; @@ -1664,7 +1663,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int int v55; int v58; int v66; - int v91; + int newDirection; int v92; int v93; int v94; @@ -1756,7 +1755,7 @@ int LinesManager::PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int for (;;) { v111 = v7; v109 = v90; - if (a3 >= v7 - 2 && a3 <= v7 + 2 && a4 >= v90 - 2 && a4 <= v90 + 2) { + if (destX >= v7 - 2 && destX <= v7 + 2 && destY >= v90 - 2 && destY <= v90 + 2) { LABEL_149: _vm->_globals.essai0[v115] = -1; _vm->_globals.essai0[v115 + 1] = -1; @@ -1783,50 +1782,50 @@ LABEL_150: _vm->_globals.super_parcours[v137 + 3] = -1; return 1; } - v9 = abs(v7 - a3); + v9 = abs(v7 - destX); v10 = v9 + 1; - v11 = abs(v90 - a4); + v11 = abs(v90 - destY); v107 = v11 + 1; if (v10 > (int16)(v11 + 1)) v107 = v10; v12 = v107 - 1; v101 = 1000 * v10 / v12; v99 = 1000 * (int16)(v11 + 1) / v12; - if (a3 < v7) + if (destX < v7) v101 = -v101; - if (a4 < v90) + if (destY < v90) v99 = -v99; v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; - v91 = -1; + newDirection = -1; if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 150) - v91 = 1; + newDirection = 1; if (v13 == 1) { if ((unsigned int)(v99 + 1) <= 151) - v91 = 3; + newDirection = 3; if ((unsigned int)v99 <= 150) - v91 = 3; + newDirection = 3; } if (v94 == 1) { if ((unsigned int)v101 <= 150) - v91 = 5; + newDirection = 5; if ((unsigned int)(v101 + 150) <= 150) - v91 = 5; + newDirection = 5; } if (v13 == -1) { if ((unsigned int)v99 <= 150) - v91 = 7; + newDirection = 7; if ((unsigned int)(v99 + 150) <= 150) - v91 = 7; + newDirection = 7; } if (v94 == -1 && (unsigned int)(v101 + 150) <= 150) - v91 = 1; - if (v91 == -1 && !VERIF_SMOOTH(v7, v109, a3, a4) && SMOOTH_MOVE(v7, v109, a3, a4) != -1) + newDirection = 1; + if (newDirection == -1 && !checkSmoothMove(v7, v109, destX, destY) && !makeSmoothMove(v7, v109, destX, destY)) break; LABEL_72: - v19 = abs(v111 - a3); + v19 = abs(v111 - destX); v20 = v19 + 1; - v95 = abs(v109 - a4); + v95 = abs(v109 - destY); v108 = v95 + 1; if (v20 > (v95 + 1)) v108 = v20; @@ -1835,9 +1834,9 @@ LABEL_72: v21 = v108 - 1; v102 = 1000 * v20 / v21; v100 = 1000 * (v95 + 1) / v21; - if (a3 < v111) + if (destX < v111) v102 = -v102; - if (a4 < v109) + if (destY < v109) v100 = -v100; v22 = v102 / 1000; v96 = v100 / 1000; @@ -1846,72 +1845,72 @@ LABEL_72: v104 = 1000 * v111 / 1000; v103 = v105 / 1000; if (!(v102 / 1000) && v96 == -1) - v91 = 1; + newDirection = 1; if (v22 == 1) { if (v96 == -1) - v91 = 2; + newDirection = 2; if (!v96) - v91 = 3; + newDirection = 3; if (v96 == 1) - v91 = 4; + newDirection = 4; } if (!v22 && v96 == 1) - v91 = 5; + newDirection = 5; if ((v22 != -1) && (v96 == -1)) { if (v102 >= 0 && v102 < 510) - v91 = 1; + newDirection = 1; else if (v102 >= 510 && v102 <= 1000) - v91 = 2; + newDirection = 2; } else { if (v96 == 1) - v91 = 6; + newDirection = 6; else if (!v96) - v91 = 7; + newDirection = 7; else if (v96 == -1) { if (v102 >= 0 && v102 < 510) - v91 = 1; + newDirection = 1; else if (v102 >= 510 && v102 <= 1000) - v91 = 2; + newDirection = 2; else - v91 = 8; + newDirection = 8; } } if (v22 == 1) { if ((unsigned int)(v100 + 1) <= 511) - v91 = 2; + newDirection = 2; if ((unsigned int)(v100 + 510) <= 510) - v91 = 3; + newDirection = 3; if ((unsigned int)v100 <= 510) - v91 = 3; + newDirection = 3; if ((unsigned int)(v100 - 510) <= 490) - v91 = 4; + newDirection = 4; } if (v96 == 1) { if ((unsigned int)(v102 - 510) <= 490) - v91 = 4; + newDirection = 4; if ((unsigned int)v102 <= 510) - v91 = 5; + newDirection = 5; // CHECKME: The two conditions on v102 are not compatible! if (v102 >= -1 && v102 <= -510) - v91 = 6; + newDirection = 6; if ((unsigned int)(v102 + 510) <= 510) - v91 = 5; + newDirection = 5; } if (v22 == -1) { if ((unsigned int)(v100 - 510) <= 490) - v91 = 6; + newDirection = 6; if ((unsigned int)v100 <= 510) - v91 = 7; + newDirection = 7; if ((unsigned int)(v100 + 1000) <= 490) - v91 = 8; + newDirection = 8; if ((unsigned int)(v100 + 510) <= 510) - v91 = 7; + newDirection = 7; } if (v96 == -1) { if ((unsigned int)(v102 + 1000) <= 490) - v91 = 8; + newDirection = 8; if ((unsigned int)(v102 + 510) <= 510) - v91 = 1; + newDirection = 1; } v23 = 0; if (v108 + 1 <= 0) @@ -1919,7 +1918,7 @@ LABEL_72: while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { _vm->_globals.essai0[v115] = v104; _vm->_globals.essai0[v115 + 1] = v103; - _vm->_globals.essai0[v115 + 2] = v91; + _vm->_globals.essai0[v115 + 2] = newDirection; v106 += v102; v105 += v100; v104 = v106 / 1000; @@ -1931,7 +1930,7 @@ LABEL_72: } if (_vm->_objectsManager._lastLine >= v142) goto LABEL_157; - v24 = GENIAL(v142, v143, v104, v103, a3, a4, v115, _vm->_globals.essai0, 3); + v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, _vm->_globals.essai0, 3); if (v24 == -1) goto LABEL_150; v115 = v24; @@ -1942,28 +1941,28 @@ LABEL_72: v7 = -1; v90 = -1; } - v91 = SMOOTH_SENS; + newDirection = _smoothMoveDirection; v14 = 0; for (;;) { - if (SMOOTH[v14].field0 == -1 || SMOOTH[v14].field2 == -1) { + if (_smoothRoute[v14]._posX == -1 || _smoothRoute[v14]._posY == -1) { v126 = true; v18 = v14 - 1; - v111 = SMOOTH[v18].field0; - v109 = SMOOTH[v18].field2; + v111 = _smoothRoute[v18]._posX; + v109 = _smoothRoute[v18]._posY; goto LABEL_72; } - if (checkCollisionLine(SMOOTH[v14].field0, SMOOTH[v14].field2, &v143, &v142, 0, _linesNumb)) + if (checkCollisionLine(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, &v143, &v142, 0, _linesNumb)) break; - _vm->_globals.essai0[v115] = SMOOTH[v14].field0; - _vm->_globals.essai0[v115 + 1] = SMOOTH[v14].field2; - _vm->_globals.essai0[v115 + 2] = v91; + _vm->_globals.essai0[v115] = _smoothRoute[v14]._posX; + _vm->_globals.essai0[v115 + 1] = _smoothRoute[v14]._posY; + _vm->_globals.essai0[v115 + 2] = newDirection; v115 += 3; ++v14; if (v126) { v18 = v14 - 1; - v111 = SMOOTH[v18].field0; - v109 = SMOOTH[v18].field2; + v111 = _smoothRoute[v18]._posX; + v109 = _smoothRoute[v18]._posY; goto LABEL_72; } } @@ -1980,11 +1979,11 @@ LABEL_157: v92 = v97; LABEL_158: v113 = v33; - if (a3 >= v33 - 2 && a3 <= v33 + 2 && a4 >= v92 - 2 && a4 <= v92 + 2) + if (destX >= v33 - 2 && destX <= v33 + 2 && destY >= v92 - 2 && destY <= v92 + 2) goto LABEL_194; - if (v33 >= a3) { + if (v33 >= destX) { LABEL_165: - if (v113 > a3) { + if (v113 > destX) { v36 = v113; while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) { _vm->_globals.essai1[v117] = v36; @@ -1992,18 +1991,18 @@ LABEL_165: _vm->_globals.essai1[v117 + 2] = 7; v117 += 3; --v36; - if (a3 >= v36) + if (destX >= v36) goto LABEL_171; } goto LABEL_168; } LABEL_171: - if (v92 >= a4) { + if (v92 >= destY) { LABEL_181: - for (int v43 = v92; v43 > a4; v43--) { - if (checkCollisionLine(a3, v43, &v141, &v140, 0, _linesNumb)) { + for (int v43 = v92; v43 > destY; v43--) { + if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v140) { - int v44 = GENIAL(v140, v141, a3, v43, a3, a4, v117, _vm->_globals.essai1, 3); + int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, _vm->_globals.essai1, 3); if (v44 == -1) goto LABEL_195; v117 = v44; @@ -2019,7 +2018,7 @@ LABEL_181: if (v140 <= _vm->_objectsManager._lastLine) goto LABEL_202; } - _vm->_globals.essai1[v117] = a3; + _vm->_globals.essai1[v117] = destX; _vm->_globals.essai1[v117 + 1] = v43; _vm->_globals.essai1[v117 + 2] = 1; v117 += 3; @@ -2050,9 +2049,9 @@ LABEL_195: } v39 = v92; for (;;) { - if (checkCollisionLine(a3, v39, &v141, &v140, 0, _linesNumb)) { + if (checkCollisionLine(destX, v39, &v141, &v140, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v140) { - v40 = GENIAL(v140, v141, a3, v39, a3, a4, v117, _vm->_globals.essai1, 3); + v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, _vm->_globals.essai1, 3); if (v40 == -1) goto LABEL_195; v117 = v40; @@ -2069,12 +2068,12 @@ LABEL_195: goto LABEL_202; } - _vm->_globals.essai1[v117] = a3; + _vm->_globals.essai1[v117] = destX; _vm->_globals.essai1[v117 + 1] = v39; _vm->_globals.essai1[v117 + 2] = 5; v117 += 3; ++v39; - if (a4 <= v39) + if (destY <= v39) goto LABEL_181; } } @@ -2084,7 +2083,7 @@ LABEL_195: _vm->_globals.essai1[v117 + 2] = 3; v117 += 3; ++v33; - if (a3 <= v33) + if (destX <= v33) goto LABEL_165; } LABEL_168: @@ -2099,9 +2098,9 @@ LABEL_202: v93 = v97; LABEL_203: v114 = v54; - if (a3 >= v54 - 2 && a3 <= v54 + 2 && a4 >= v93 - 2 && a4 <= v93 + 2) + if (destX >= v54 - 2 && destX <= v54 + 2 && destY >= v93 - 2 && destY <= v93 + 2) goto LABEL_241; - if (v93 < a4) { + if (v93 < destY) { v55 = v93; while (!checkCollisionLine(v114, v55, &v139, &v138, 0, _linesNumb)) { _vm->_globals.essai2[v117] = v114; @@ -2109,13 +2108,13 @@ LABEL_203: _vm->_globals.essai2[v117 + 2] = 5; v117 += 3; ++v55; - if (a4 <= v55) + if (destY <= v55) goto LABEL_211; } goto LABEL_214; } LABEL_211: - if (v93 > a4) { + if (v93 > destY) { v58 = v93; while (!checkCollisionLine(v114, v58, &v139, &v138, 0, _linesNumb)) { _vm->_globals.essai2[v117] = v114; @@ -2123,7 +2122,7 @@ LABEL_211: _vm->_globals.essai2[v117 + 2] = 1; v117 += 3; --v58; - if (a4 >= v58) + if (destY >= v58) goto LABEL_217; } LABEL_214: @@ -2259,11 +2258,11 @@ LABEL_249: return 0; } LABEL_217: - if (v114 < a3) { - for (int v61 = v114; v61 < a3; v61++) { - if (checkCollisionLine(v61, a4, &v139, &v138, 0, _linesNumb)) { + if (v114 < destX) { + for (int v61 = v114; v61 < destX; v61++) { + if (checkCollisionLine(v61, destY, &v139, &v138, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v138) { - int v62 = GENIAL(v138, v139, v61, a4, a3, a4, v117, _vm->_globals.essai2, 3); + int v62 = GENIAL(v138, v139, v61, destY, destX, destY, v117, _vm->_globals.essai2, 3); if (v62 == -1) goto LABEL_195; v117 = v62; @@ -2283,16 +2282,16 @@ LABEL_217: } _vm->_globals.essai2[v117] = v61; - _vm->_globals.essai2[v117 + 1] = a4; + _vm->_globals.essai2[v117 + 1] = destY; _vm->_globals.essai2[v117 + 2] = 3; v117 += 3; } } - if (v114 > a3) { - for (int v65 = v114; v65 > a3; v65--) { - if (checkCollisionLine(v65, a4, &v139, &v138, 0, _linesNumb)) { + if (v114 > destX) { + for (int v65 = v114; v65 > destX; v65--) { + if (checkCollisionLine(v65, destY, &v139, &v138, 0, _linesNumb)) { if (_vm->_objectsManager._lastLine < v138) { - v66 = GENIAL(v138, v139, v65, a4, a3, a4, v117, _vm->_globals.essai2, 3); + v66 = GENIAL(v138, v139, v65, destY, destX, destY, v117, _vm->_globals.essai2, 3); if (v66 == -1) goto LABEL_242; v117 = v66; @@ -2309,7 +2308,7 @@ LABEL_217: goto LABEL_249; } _vm->_globals.essai2[v117] = v65; - _vm->_globals.essai2[v117 + 1] = a4; + _vm->_globals.essai2[v117 + 1] = destY; _vm->_globals.essai2[v117 + 2] = 7; v117 += 3; } @@ -2340,81 +2339,56 @@ LABEL_242: return 1; } -int LinesManager::VERIF_SMOOTH(int a1, int a2, int a3, int a4) { - int v6; - int v7; - int v8; - int v9; - int v12; - int v14; - int v15; - int v16; - int v17; - int v18; - - int v5 = abs(a1 - a3) + 1; - int v13 = abs(a2 - a4) + 1; - if (v5 > v13) - v13 = v5; - if (v13 <= 10) - return -1; - v6 = v13 - 1; - v16 = 1000 * v5 / v6; - v15 = 1000 * (abs(a2 - a4) + 1) / v6; - if (a3 < a1) - v16 = -v16; - if (a4 < a2) - v15 = -v15; - v7 = 1000 * a1; - v8 = 1000 * a2; - v9 = 1000 * a1 / 1000; - v12 = 1000 * a2 / 1000; - v14 = 0; - if (v13 + 1 > 0) { - while (!checkCollisionLine(v9, v12, &v18, &v17, 0, _linesNumb) || v17 > _vm->_objectsManager._lastLine) { - v7 += v16; - v8 += v15; - v9 = v7 / 1000; - v12 = v8 / 1000; - ++v14; - if (v14 >= v13 + 1) - return 0; - } - return -1; +bool LinesManager::checkSmoothMove(int fromX, int fromY, int destX, int destY) { + int foundLineIdx; + int foundDataIdx; + + int distX = abs(fromX - destX) + 1; + int distY = abs(fromY - destY) + 1; + if (distX > distY) + distY = distX; + if (distY <= 10) + return true; + + int stepX = 1000 * distX / (distY - 1); + int stepY = 1000 * distY / (distY - 1); + if (destX < fromX) + stepX = -stepX; + if (destY < fromY) + stepY = -stepY; + + int smoothPosX = 1000 * fromX; + int smoothPosY = 1000 * fromY; + int newPosX = fromX; + int newPosY = fromY; + + if (distY + 1 > 0) { + int stepCount = 0; + while (!checkCollisionLine(newPosX, newPosY, &foundDataIdx, &foundLineIdx, 0, _linesNumb) || foundLineIdx > _vm->_objectsManager._lastLine) { + smoothPosX += stepX; + smoothPosY += stepY; + newPosX = smoothPosX / 1000; + newPosY = smoothPosY / 1000; + ++stepCount; + if (stepCount >= distY + 1) + return false; + } + return true; } - return 0; + return false; } -int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { - int v6; - int v7; - int v11; - int v14; - int v22; - int v25; - int v33; - int v37; - int v38; - int v39; - int v40; - int v41; - int v42; - int v50; - int v51; - int v52; - int hopkinsIdx; - int smoothIdx; - - int v62 = a3; - int v63 = a4; - if (a3 > a5 && a6 > a4) { - hopkinsIdx = 36; - smoothIdx = 0; - int loopCount = 0; - while (v62 > a5 && a6 > v63) { - v25 = _vm->_globals.Hopkins[hopkinsIdx].field0; - v40 = _vm->_globals.Hopkins[hopkinsIdx].field2; - int spriteSize = _vm->_globals._spriteSize[v63]; +bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { + int curX = fromX; + int curY = fromY; + if (fromX > destX && destY > fromY) { + int hopkinsIdx = 36; + int smoothIdx = 0; + int stepCount = 0; + while (curX > destX && destY > curY) { + int v25 = _vm->_globals.Hopkins[hopkinsIdx].field0; + int v40 = _vm->_globals.Hopkins[hopkinsIdx].field2; + int spriteSize = _vm->_globals._spriteSize[curY]; if (spriteSize < 0) { v25 = _vm->_graphicsManager.zoomOut(v25, -spriteSize); v40 = _vm->_graphicsManager.zoomOut(v40, -spriteSize); @@ -2422,130 +2396,116 @@ int LinesManager::SMOOTH_MOVE(int a3, int a4, int a5, int a6) { v25 = _vm->_graphicsManager.zoomIn(v25, spriteSize); v40 = _vm->_graphicsManager.zoomIn(v40, spriteSize); } - v33 = v63 + v40; - for (int v34 = 0; v34 < v25; v34++) { - --v62; - SMOOTH[smoothIdx].field0 = v62; - if (v63 != v33) - v63++; - SMOOTH[smoothIdx].field2 = v63; + for (int i = 0; i < v25; i++) { + --curX; + _smoothRoute[smoothIdx]._posX = curX; + if (curY != curY + v40) + curY++; + _smoothRoute[smoothIdx]._posY = curY; smoothIdx++; } ++hopkinsIdx; if (hopkinsIdx == 48) hopkinsIdx = 36; - ++loopCount; - } - if (loopCount > 5) { - SMOOTH[smoothIdx].field0 = -1; - SMOOTH[smoothIdx].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 6; - SMOOTH_X = v62; - SMOOTH_Y = v63; - return 0; - } - } else if (a3 < a5 && a6 > a4) { - v52 = 36; - smoothIdx = 0; - int loopCount = 0; - while (v62 < a5 && a6 > v63) { - v14 = _vm->_globals.Hopkins[v52].field0; - v39 = _vm->_globals.Hopkins[v52].field2; - int spriteSize = _vm->_globals._spriteSize[v63]; + ++stepCount; + } + if (stepCount > 5) { + _smoothRoute[smoothIdx]._posX = -1; + _smoothRoute[smoothIdx]._posY = -1; + _vm->_linesManager._smoothMoveDirection = 6; + return false; + } + } else if (fromX < destX && destY > fromY) { + int hopkinsIdx = 36; + int smoothIdx = 0; + int stepCount = 0; + while (curX < destX && destY > curY) { + int v14 = _vm->_globals.Hopkins[hopkinsIdx].field0; + int v39 = _vm->_globals.Hopkins[hopkinsIdx].field2; + int spriteSize = _vm->_globals._spriteSize[curY]; if (spriteSize < 0) { v14 = _vm->_graphicsManager.zoomOut(v14, -spriteSize); v39 = _vm->_graphicsManager.zoomOut(v39, -spriteSize); - } - if (spriteSize > 0) { + } else if (spriteSize > 0) { v14 = _vm->_graphicsManager.zoomIn(v14, spriteSize); v39 = _vm->_graphicsManager.zoomIn(v39, spriteSize); } - v22 = v63 + v39; for (int i = 0; i < v14; i++) { - ++v62; - SMOOTH[smoothIdx].field0 = v62; - if (v63 != v22) - v63++; - SMOOTH[smoothIdx].field2 = v63; + ++curX; + _smoothRoute[smoothIdx]._posX = curX; + if (curY != curY + v39) + curY++; + _smoothRoute[smoothIdx]._posY = curY; smoothIdx++; } - ++v52; - if (v52 == 48) - v52 = 36; - ++loopCount; - } - if (loopCount > 5) { - SMOOTH[smoothIdx].field0 = -1; - SMOOTH[smoothIdx].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 4; - SMOOTH_X = v62; - SMOOTH_Y = v63; - return 0; - } - } else if (a3 > a5 && a6 < a4) { - v51 = 12; - smoothIdx = 0; - int loopCount = 0; - while (v62 > a5 && a6 < v63) { - v42 = v63; - v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field0, 25); - v38 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v51].field2, 25); - v63 = v42; + ++hopkinsIdx; + if (hopkinsIdx == 48) + hopkinsIdx = 36; + ++stepCount; + } + if (stepCount > 5) { + _smoothRoute[smoothIdx]._posX = -1; + _smoothRoute[smoothIdx]._posY = -1; + _vm->_linesManager._smoothMoveDirection = 4; + return false; + } + } else if (fromX > destX && destY < fromY) { + int hopkinsIdx = 12; + int smoothIdx = 0; + int stepCount = 0; + while (curX > destX && destY < curY) { + int v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field0, 25); + int v38 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field2, 25); + int oldY = curY; for (int v12 = 0; v12 < v11; v12++) { - --v62; - SMOOTH[smoothIdx].field0 = v62; - if ((uint16)v63 != (uint16)v42 + v38) - v63--; - SMOOTH[smoothIdx].field2 = v63; + --curX; + _smoothRoute[smoothIdx]._posX = curX; + if ((uint16)curY != (uint16)oldY + v38) + curY--; + _smoothRoute[smoothIdx]._posY = curY; smoothIdx++; } - ++v51; - if (v51 == 24) - v51 = 12; - ++loopCount; - } - if (loopCount > 5) { - SMOOTH[smoothIdx].field0 = -1; - SMOOTH[smoothIdx].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 8; - SMOOTH_X = v62; - SMOOTH_Y = v63; - return 0; - } - } else if (a3 < a5 && a6 < a4) { - v50 = 12; - smoothIdx = 0; - int loopCount = 0; - while (v62 < a5 && a6 < v63) { - v6 = _vm->_globals.Hopkins[v50].field2; - v41 = v63; - v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[v50].field0, 25); - v37 = _vm->_graphicsManager.zoomOut(v6, 25); - v63 = v41; - for (int v8 = 0; v8 < v7; v8++) { - ++v62; - SMOOTH[smoothIdx].field0 = v62; - if ((uint16)v63 != (uint16)v41 + v37) - v63--; - SMOOTH[smoothIdx].field2 = v63; + ++hopkinsIdx; + if (hopkinsIdx == 24) + hopkinsIdx = 12; + ++stepCount; + } + if (stepCount > 5) { + _smoothRoute[smoothIdx]._posX = -1; + _smoothRoute[smoothIdx]._posY = -1; + _vm->_linesManager._smoothMoveDirection = 8; + return false; + } + } else if (fromX < destX && destY < fromY) { + int hopkinsIdx = 12; + int smoothIdx = 0; + int stepCount = 0; + while (curX < destX && destY < curY) { + int oldY = curY; + int v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field0, 25); + int v37 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field2, 25); + for (int i = 0; i < v7; i++) { + ++curX; + _smoothRoute[smoothIdx]._posX = curX; + if ((uint16)curY != (uint16)oldY + v37) + curY--; + _smoothRoute[smoothIdx]._posY = curY; smoothIdx++; } - ++v50; - if (v50 == 24) - v50 = 12; - ++loopCount; + ++hopkinsIdx; + if (hopkinsIdx == 24) + hopkinsIdx = 12; + ++stepCount; } - if (loopCount > 5) { - SMOOTH[smoothIdx].field0 = -1; - SMOOTH[smoothIdx].field2 = -1; - _vm->_linesManager.SMOOTH_SENS = 2; - SMOOTH_X = v62; - SMOOTH_Y = v63; - return 0; + if (stepCount > 5) { + _smoothRoute[smoothIdx]._posX = -1; + _smoothRoute[smoothIdx]._posY = -1; + _vm->_linesManager._smoothMoveDirection = 2; + return false; } } - return -1; + return true; } bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 6fecbcb64e..a1a81921b5 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -46,8 +46,8 @@ struct LigneItem { }; struct SmoothItem { - int field0; - int field2; + int _posX; + int _posY; }; class LinesManager { @@ -56,15 +56,14 @@ private: public: LigneZoneItem _zoneLine[401]; LigneItem Ligne[400]; - SmoothItem SMOOTH[4000]; + SmoothItem _smoothRoute[4000]; int _linesNumb; int NV_LIGNEDEP; int NV_LIGNEOFS; int NV_POSI; int NVPX; int NVPY; - int SMOOTH_SENS; - int SMOOTH_X, SMOOTH_Y; + int _smoothMoveDirection; public: LinesManager(); void setParent(HopkinsEngine *vm); @@ -84,9 +83,9 @@ public: bool MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); int16 *PARCOURS2(int srcX, int srcY, int destX, int destY); - int PARC_PERS(int a1, int a2, int a3, int a4, int a5, int a6, int a7); - int VERIF_SMOOTH(int a1, int a2, int a3, int a4); - int SMOOTH_MOVE(int a3, int a4, int a5, int a6); + int PARC_PERS(int a1, int a2, int destX, int destY, int a5, int a6, int a7); + bool checkSmoothMove(int fromX, int fromY, int destX, int destY); + bool makeSmoothMove(int fromX, int fromY, int destX, int destY); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); }; -- cgit v1.2.3 From 33431f666c7c2d8941548da37a8dd012fd4c1c3c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Jan 2013 15:30:27 +0100 Subject: HOPKINS: Fix bank animation speed for OS2 and BeOS version, add code to replace display_version --- engines/hopkins/hopkins.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 647851dbbd..59d042ec3e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -134,8 +134,6 @@ bool HopkinsEngine::runWin95Demo() { _globals._helicopterFl = false; _globals.iRegul = 1; - warning("TODO Affiche_Version(1)"); - _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); @@ -793,13 +791,23 @@ bool HopkinsEngine::runFull() { if (getPlatform() == Common::kPlatformLinux) { _globals._helicopterFl = false; _eventsManager.mouseOff(); + // No code has been added to display the version as it's wrong + // in my copy: it mentions a Win95 version v4 using DirectDraw } else if (getPlatform() == Common::kPlatformWindows) { _globals._helicopterFl = false; _globals.iRegul = 1; - // warning("TODO: Affiche_Version();"); + // This code displays the game version. + // It wasn't present in the original and could be put in the debugger + // It has been added there for debug purposes + _graphicsManager.loadImage("VERSW"); + _graphicsManager.fadeInLong(); + _eventsManager.delay(500); + _graphicsManager.fadeOutLong(); } else { - //warning("_graphicsManager.loadImage(\"VERSW\");"); // OS/2 - //warning("_graphicsManager.FADE_INW();"); // OS/2 + // This piece of code, though named "display_version" in the original, + // displays a "loading please wait" screen. + _graphicsManager.loadImage("VERSW"); + _graphicsManager.fadeInLong(); _eventsManager.delay(500); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; @@ -888,12 +896,13 @@ bool HopkinsEngine::runFull() { if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) { if (getPlatform() == Common::kPlatformLinux) _graphicsManager.FADE_LINUX = 2; + if (!_globals._censorshipFl) _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); } else { - _animationManager.playAnim("BANQUE.ANM", 200, 12, 200); + _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); } _soundManager._specialSoundNum = 0; _soundManager.DEL_SAMPLE(1); -- cgit v1.2.3 From 305c820eeff1688d16ad8c02c56eceaa20c54772 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Jan 2013 15:35:02 +0100 Subject: HOPKINS: Simplify version selection --- engines/hopkins/hopkins.cpp | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 59d042ec3e..ed94ad8e2b 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -99,28 +99,15 @@ Common::Error HopkinsEngine::run() { _fileManager.initCensorship(); initializeSystem(); - if (getPlatform() == Common::kPlatformLinux) { - if (getIsDemo()) - runLinuxDemo(); - else - runFull(); - } else if (getPlatform() == Common::kPlatformWindows) { - if (getIsDemo()) - runWin95Demo(); - else - runFull(); - } else if (getPlatform() == Common::kPlatformBeOS) { - if (getIsDemo()) { - warning("Unhandled version, switching to linux demo"); - runLinuxDemo(); - } else - runFull(); - } else { - if (getIsDemo()) { - warning("Unhandled version, switching to linux demo"); - runLinuxDemo(); - } else - runFull(); + if (!getIsDemo()) + runFull(); + else if (getPlatform() == Common::kPlatformLinux) + runLinuxDemo(); + else if (getPlatform() == Common::kPlatformWindows) + runWin95Demo(); + else { + warning("Unhandled version, switching to linux demo. Please report this version to ScummVM developers"); + runLinuxDemo(); } return Common::kNoError; -- cgit v1.2.3 From 8bbb9a2bbdfeff13e70888d64e86954e9f229a75 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 26 Jan 2013 15:47:38 +0100 Subject: AUDIO: Mention that the Hopkins engine uses Protracker as well --- audio/mods/protracker.h | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/mods/protracker.h b/audio/mods/protracker.h index 5f47c4453b..6cee1a84bf 100644 --- a/audio/mods/protracker.h +++ b/audio/mods/protracker.h @@ -26,6 +26,7 @@ * - agos * - parallaction * - gob + * - hopkins */ #ifndef AUDIO_MODS_PROTRACKER_H -- cgit v1.2.3 From e21fed17073d87f06fc549ad5fd5e4ebf06db5de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Jan 2013 16:45:48 +0100 Subject: HOPKINS: Simplify calls to PARCOURS2 --- engines/hopkins/script.cpp | 50 +++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 2aa96c8145..85522a72f3 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -723,9 +723,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 46: { _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v13 = _vm->_objectsManager.getSpriteY(0); - int v14 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v14, v13, 564, 420); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) @@ -937,9 +935,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v16 = _vm->_objectsManager.getSpriteY(0); - int v17 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v17, v16, 445, 332); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1039,9 +1035,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v22 = _vm->_objectsManager.getSpriteY(0); - int v23 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v23, v22, 119, 268); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1358,19 +1352,13 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.Compteur = 0; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals._saveData->_data[svField253] == 1) { - int v27 = _vm->_objectsManager.getSpriteY(0); - int v28 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v28, v27, 201, 294); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); } if (_vm->_globals._saveData->_data[svField253] == 2) { - int v29 = _vm->_objectsManager.getSpriteY(0); - int v30 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v30, v29, 158, 338); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); } if (_vm->_globals._saveData->_data[svField253] > 2) { - int v31 = _vm->_objectsManager.getSpriteY(0); - int v32 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v32, v31, 211, 393); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); } _vm->_globals.NOT_VERIF = true; do { @@ -1609,11 +1597,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - int v55 = _vm->_objectsManager.getSpriteY(0); - int v56 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v56, v55, 361, 325); + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1639,11 +1625,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - int v57 = _vm->_objectsManager.getSpriteY(0); - int v58 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v58, v57, 361, 325); + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1818,9 +1802,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } _vm->_globals.NOT_VERIF = true; _vm->_globals.chemin = (int16 *)g_PTRNUL; - int v37 = _vm->_objectsManager.getSpriteY(0); - int v38 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v38, v37, 330, 418); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = 0; do { @@ -1851,9 +1833,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(1); _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - int v39 = _vm->_objectsManager.getSpriteY(0); - int v40 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v40, v39, 330, 314); + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); _vm->_objectsManager._zoneNum = 0; _vm->_globals.NOT_VERIF = true; do { @@ -1949,11 +1929,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - int v43 = _vm->_objectsManager.getSpriteY(0); - int v44 = _vm->_objectsManager.getSpriteX(0); - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(v44, v43, 488, 280); + _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) -- cgit v1.2.3 From 84f7ce6ea3666b3933ea48f29c60b30cce175db3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 01:25:46 +0100 Subject: HOPKINS: Refactor REPONSE --- engines/hopkins/globals.cpp | 12 +-- engines/hopkins/globals.h | 4 +- engines/hopkins/graphics.cpp | 9 +-- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/objects.cpp | 102 ++++++++++++------------- engines/hopkins/script.cpp | 58 +++++++------- engines/hopkins/talk.cpp | 178 +++++++++++++++++++++---------------------- 7 files changed, 183 insertions(+), 184 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a66dafc053..44d3798daa 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -187,9 +187,9 @@ Globals::Globals() { GESTE = NULL; _inventoryObject = NULL; _forestSprite = NULL; - COUCOU = NULL; - chemin = NULL; - BufLig = NULL; + _answerBuffer = g_PTRNUL; + _route = (int16 *)g_PTRNUL; + BufLig = (int16 *)g_PTRNUL; ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; @@ -235,7 +235,7 @@ Globals::~Globals() { freeMemory(GESTE); freeMemory(_inventoryObject); freeMemory(_forestSprite); - freeMemory(COUCOU); + freeMemory(_answerBuffer); freeMemory(ADR_FICHIER_OBJ); freeMemory(PERSO); @@ -304,7 +304,7 @@ void Globals::clearAll() { _vm->_eventsManager._objectBuf = g_PTRNUL; _vm->_dialogsManager._inventWin1 = g_PTRNUL; _vm->_dialogsManager._inventBuf2 = g_PTRNUL; - COUCOU = g_PTRNUL; + _answerBuffer = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; _saveData = (Sauvegarde *)g_PTRNUL; _curObjectIndex = 0; @@ -319,7 +319,7 @@ void Globals::clearAll() { essai1 = (int16 *)g_PTRNUL; essai2 = (int16 *)g_PTRNUL; BufLig = (int16 *)g_PTRNUL; - chemin = (int16 *)g_PTRNUL; + _route = (int16 *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index db8409a664..b81ce5fceb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -349,8 +349,8 @@ public: int GESTE_FLAG; byte *_forestSprite; bool _forestFl; - byte *COUCOU; - int16 *chemin; + byte *_answerBuffer; + int16 *_route; int16 *BufLig; byte *ADR_FICHIER_OBJ; byte *PERSO; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 69ea5b2190..3203749cf8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1793,15 +1793,14 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia } _vm->_globals.freeMemory(ptr); if (mode != 1) { - _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); + _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); filename = file + ".rep"; byte *dataP = _vm->_fileManager.searchCat(filename, 2); - _vm->_globals.COUCOU = dataP; - if (g_PTRNUL == dataP) { + if (dataP == g_PTRNUL) dataP = _vm->_fileManager.loadFile(filename); - _vm->_globals.COUCOU = dataP; - } + + _vm->_globals._answerBuffer = dataP; } _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager._changeVerbFl = false; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ed94ad8e2b..90978c1196 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2172,7 +2172,7 @@ void HopkinsEngine::playEnding() { _globals.PLAN_FLAG = false; _globals.iRegul = 1; _soundManager.WSOUND(26); - _globals.chemin = (int16 *)g_PTRNUL; + _globals._route = (int16 *)g_PTRNUL; _globals.NOMARCHE = true; _globals._exitId = 0; _soundManager.loadSample(1, "SOUND90.WAV"); @@ -2856,7 +2856,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _objectsManager.animateSprite(0); - _globals.chemin = (int16 *)g_PTRNUL; + _globals._route = (int16 *)g_PTRNUL; _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(4); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7b6128a98b..ff6e09c3d2 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1279,7 +1279,7 @@ void ObjectsManager::checkZone() { if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + if (_vm->_globals.NOMARCHE || (_vm->_globals._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { @@ -1347,7 +1347,7 @@ void ObjectsManager::GOHOME() { int v58 = 0; int v1 = 0; - if (_vm->_globals.chemin == (int16 *)g_PTRNUL) + if (_vm->_globals._route == (int16 *)g_PTRNUL) return; if (_vm->_globals.Compteur > 1) { @@ -1362,10 +1362,10 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); - newPosX = *_vm->_globals.chemin++; - newPosY = *_vm->_globals.chemin++; - newDirection = *_vm->_globals.chemin++; - _vm->_globals.chemin++; + newPosX = *_vm->_globals._route++; + newPosY = *_vm->_globals._route++; + newDirection = *_vm->_globals._route++; + _vm->_globals._route++; if (newPosX != -1 || newPosY != -1) { _vm->_globals._oldDirection = newDirection; @@ -1381,11 +1381,11 @@ void ObjectsManager::GOHOME() { zoneId = _vm->_globals._saveData->_data[svField2]; else zoneId = _zoneNum; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; if (zoneId > 0) { if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { @@ -1588,10 +1588,10 @@ void ObjectsManager::GOHOME() { } bool loopCond = false; do { - newPosX = *_vm->_globals.chemin++; - newPosY = *_vm->_globals.chemin++; - newDirection = *_vm->_globals.chemin++; - _vm->_globals.chemin++; + newPosX = *_vm->_globals._route++; + newPosY = *_vm->_globals._route++; + newDirection = *_vm->_globals._route++; + _vm->_globals._route++; if (newPosX == -1 && newPosY == -1) { int zoneId; @@ -1601,7 +1601,7 @@ void ObjectsManager::GOHOME() { zoneId = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -1661,7 +1661,7 @@ void ObjectsManager::GOHOME() { } void ObjectsManager::GOHOME2() { - if (_vm->_globals.chemin == (int16 *)g_PTRNUL) + if (_vm->_globals._route == (int16 *)g_PTRNUL) return; int v0 = 2; @@ -1673,10 +1673,10 @@ void ObjectsManager::GOHOME2() { _vm->_globals.j_104 = 0; for (;;) { - int nexPosX = *_vm->_globals.chemin++; - int newPosY = *_vm->_globals.chemin++; - int newDirection = *_vm->_globals.chemin++; - _vm->_globals.chemin++; + int nexPosX = *_vm->_globals._route++; + int newPosY = *_vm->_globals._route++; + int newDirection = *_vm->_globals._route++; + _vm->_globals._route++; if ((nexPosX == -1) && (newPosY == -1)) break; @@ -1710,7 +1710,7 @@ void ObjectsManager::GOHOME2() { else if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 3); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; my_anim = 0; } @@ -1902,7 +1902,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; animateSprite(0); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -1942,7 +1942,7 @@ void ObjectsManager::PLAN_BETA() { checkZone(); GOHOME2(); - if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) + if (_vm->_globals._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) PARADISE(); _vm->_eventsManager.VBL(); @@ -2012,9 +2012,9 @@ void ObjectsManager::handleLeftButton() { return; int routeIdx = 0; do { - _vm->_globals.essai2[routeIdx] = _vm->_globals.chemin[routeIdx]; + _vm->_globals.essai2[routeIdx] = _vm->_globals._route[routeIdx]; ++routeIdx; - } while (_vm->_globals.chemin[routeIdx] != -1); + } while (_vm->_globals._route[routeIdx] != -1); _vm->_globals.essai2[routeIdx] = -1; _vm->_globals.essai2[routeIdx + 1] = -1; @@ -2038,26 +2038,26 @@ void ObjectsManager::handleLeftButton() { } } _vm->_globals.GOACTION = false; - int16 *oldRoute = _vm->_globals.chemin; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + int16 *oldRoute = _vm->_globals._route; + _vm->_globals._route = (int16 *)g_PTRNUL; if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); - if (_vm->_globals.chemin != (int16 *)g_PTRNUL) - PACOURS_PROPRE(_vm->_globals.chemin); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); + if (_vm->_globals._route != (int16 *)g_PTRNUL) + PACOURS_PROPRE(_vm->_globals._route); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL || oldRoute == _vm->_globals.chemin) { + if (_vm->_globals._route != (int16 *)g_PTRNUL || oldRoute == _vm->_globals._route) { _vm->_globals._oldDirection = -1; goto LABEL_65; } goto LABEL_63; } - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); _vm->_globals._actionDirection = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -2066,21 +2066,21 @@ void ObjectsManager::handleLeftButton() { } if (!_vm->_globals.NOMARCHE) { if (!_vm->_globals.PLAN_FLAG) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); - if (_vm->_globals.chemin != (int16 *)g_PTRNUL) - PACOURS_PROPRE(_vm->_globals.chemin); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); + if (_vm->_globals._route != (int16 *)g_PTRNUL) + PACOURS_PROPRE(_vm->_globals._route); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL || oldRoute == _vm->_globals.chemin) + if (_vm->_globals._route != (int16 *)g_PTRNUL || oldRoute == _vm->_globals._route) _vm->_globals._oldDirection = -1; else LABEL_63: - _vm->_globals.chemin = oldRoute; + _vm->_globals._route = oldRoute; } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) - _vm->_globals.chemin = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); + _vm->_globals._route = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) @@ -2100,7 +2100,7 @@ LABEL_65: && _vm->_globals._curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; getSpriteX(0); getSpriteY(0); } @@ -2217,8 +2217,8 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _vm->_linesManager._linesNumb = 0; _lastLine = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager._mouseSpriteId = 0; @@ -2227,7 +2227,7 @@ void ObjectsManager::clearScreen() { _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; my_anim = 1; _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -2243,7 +2243,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { @@ -4250,7 +4250,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals._exitId = 0; if (!backgroundFile.empty()) @@ -4270,7 +4270,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->_globals._screenId == 61) { addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -4288,13 +4288,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo g_old_x = getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); _vm->_globals.NOT_VERIF = true; do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); setSpriteIndex(0, 64); } do { @@ -4398,7 +4398,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm computeAndSetSpriteSize(); animateSprite(0); _vm->_globals.CACHE_ON(); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; @@ -4429,7 +4429,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm yp = _vm->_eventsManager.getMouseY(); if ((xCheck == xp) && (yCheck == yp)) { - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; PARADISE(); if (_vm->_globals._exitId) breakFlag = true; @@ -4445,8 +4445,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); checkZone(); - if (_vm->_globals.chemin == (int16 *)g_PTRNUL - || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { + if (_vm->_globals._route == (int16 *)g_PTRNUL + || (GOHOME(), _vm->_globals._route == (int16 *)g_PTRNUL)) { if (_vm->_globals.GOACTION) PARADISE(); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 85522a72f3..cb287fe9e7 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -722,8 +722,8 @@ int ScriptManager::handleOpcode(byte *dataP) { case 46: { _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) @@ -731,7 +731,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_globals.NOT_VERIF = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); @@ -934,8 +934,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -943,7 +943,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); @@ -1034,8 +1034,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1043,7 +1043,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); _vm->_objectsManager.setBobAnimation(8); @@ -1350,15 +1350,15 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; if (_vm->_globals._saveData->_data[svField253] == 1) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); } if (_vm->_globals._saveData->_data[svField253] == 2) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); } if (_vm->_globals._saveData->_data[svField253] > 2) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); } _vm->_globals.NOT_VERIF = true; do { @@ -1367,7 +1367,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.loadSample(1, "SOUND63.WAV"); @@ -1598,8 +1598,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1608,7 +1608,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1626,8 +1626,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1636,7 +1636,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1801,8 +1801,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager._specialSoundNum = 0; } _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = 0; do { @@ -1811,7 +1811,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_globals._exitId = _vm->_globals._saveData->_data[svField401]; _vm->_globals._disableInventFl = false; @@ -1831,9 +1831,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.stopBobAnimation(1); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); _vm->_objectsManager._zoneNum = 0; _vm->_globals.NOT_VERIF = true; do { @@ -1842,7 +1842,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.playSound("SOUND66.WAV"); @@ -1930,8 +1930,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1939,7 +1939,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); int v45 = 0; _vm->_objectsManager.setBobAnimation(7); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index eb72133c4d..60553cd009 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -792,15 +792,13 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int } void TalkManager::REPONSE(int zone, int verb) { - byte *v5; - byte *v6; uint16 v7; byte *v8; int v10; uint16 v11; int v12; int v13; - bool v15; + bool tagFound; bool v16; bool loopCond; byte *ptr; @@ -808,90 +806,92 @@ void TalkManager::REPONSE(int zone, int verb) { byte zoneObj = zone; byte verbObj = verb; LABEL_2: - v15 = false; - if (_vm->_globals.COUCOU != g_PTRNUL) { - v5 = _vm->_globals.COUCOU; - for (;;) { - if (v5[0] == 'C' && v5[1] == 'O' && v5[2] == 'D') { - if (v5[3] == zoneObj && v5[4] == verbObj) - v15 = true; - } - if (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N') - break; - if (!v15) - v5++; - else if (v15) { - v6 = v5 + 5; - ptr = _vm->_globals.allocMemory(620); - if (g_PTRNUL == ptr) - error("TRADUC"); - memset(ptr, 0, 620); - v7 = 0; - v12 = 0; - loopCond = false; - do { - v16 = false; - if (v6[v7] == 'F' && v6[v7 + 1] == 'C') { - ++v12; - assert(v12 < (620 / 20)); - - v8 = (ptr + 20 * v12); - v11 = 0; - do { - assert(v11 < 20); - v8[v11++] = v6[v7++]; - if (v6[v7] == 'F' && v6[v7 + 1] == 'F') { - v16 = true; - v8[v11] = 'F'; - v8[v11 + 1] = 'F'; - ++v7; - } - } while (!v16); - } - if (!v16) { - if ((v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') || (v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N')) - loopCond = true; - } - v6 += v7 + 1; - v7 = 0; - } while (!loopCond); - loopCond = false; - v13 = 1; - do { - v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13); - if (_vm->shouldQuit()) - return; - - if (v10 == 2) - // GOTO - v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); - else if (v10 == 3) - // IF - v13 = _vm->_scriptManager.handleIf(ptr, v13); - - if (v13 == -1) - error("Invalid IFF function"); - - if (v10 == 1 || v10 == 4) - // Already handled opcode or END IF - ++v13; - else if (!v10 || v10 == 5) - // EXIT - loopCond = true; - else if (v10 == 6) { - // JUMP - _vm->_globals.freeMemory(ptr); - zoneObj = _vm->_objectsManager._jumpZone; - verbObj = _vm->_objectsManager._jumpVerb; - goto LABEL_2; - } - } while (!loopCond); - _vm->_globals.freeMemory(ptr); - _vm->_globals._saveData->_data[svField2] = 0; - return; - } + tagFound = false; + if (_vm->_globals._answerBuffer == g_PTRNUL) + return; + + byte *curAnswerBuf = _vm->_globals._answerBuffer; + for (;;) { + if (curAnswerBuf[0] == 'F' && curAnswerBuf[1] == 'I' && curAnswerBuf[2] == 'N') + return; + if (curAnswerBuf[0] == 'C' && curAnswerBuf[1] == 'O' && curAnswerBuf[2] == 'D') { + if (curAnswerBuf[3] == zoneObj && curAnswerBuf[4] == verbObj) + tagFound = true; } + if (!tagFound) + curAnswerBuf++; + else + break; } + + // 'COD' tag found + curAnswerBuf += 5; + ptr = _vm->_globals.allocMemory(620); + assert(ptr != g_PTRNUL); + memset(ptr, 0, 620); + v7 = 0; + v12 = 0; + loopCond = false; + do { + v16 = false; + if (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'C') { + ++v12; + assert(v12 < (620 / 20)); + + v8 = (ptr + 20 * v12); + v11 = 0; + do { + assert(v11 < 20); + v8[v11++] = curAnswerBuf[v7++]; + if (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'F') { + v16 = true; + v8[v11] = 'F'; + v8[v11 + 1] = 'F'; + ++v7; + } + } while (!v16); + } + if (!v16) { + if ((curAnswerBuf[v7] == 'C' && curAnswerBuf[v7 + 1] == 'O' && curAnswerBuf[v7 + 2] == 'D') || (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'I' && curAnswerBuf[v7 + 2] == 'N')) + loopCond = true; + } + curAnswerBuf += v7 + 1; + v7 = 0; + } while (!loopCond); + loopCond = false; + v13 = 1; + do { + v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13); + if (_vm->shouldQuit()) + return; + + if (v10 == 2) + // GOTO + v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); + else if (v10 == 3) + // IF + v13 = _vm->_scriptManager.handleIf(ptr, v13); + + if (v13 == -1) + error("Invalid IFF function"); + + if (v10 == 1 || v10 == 4) + // Already handled opcode or END IF + ++v13; + else if (!v10 || v10 == 5) + // EXIT + loopCond = true; + else if (v10 == 6) { + // JUMP + _vm->_globals.freeMemory(ptr); + zoneObj = _vm->_objectsManager._jumpZone; + verbObj = _vm->_objectsManager._jumpVerb; + goto LABEL_2; + } + } while (!loopCond); + _vm->_globals.freeMemory(ptr); + _vm->_globals._saveData->_data[svField2] = 0; + return; } void TalkManager::REPONSE2(int a1, int a2) { @@ -1050,8 +1050,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, true); startCharacterAnim0(_paletteBufferIdx, false); - v11 = _vm->_globals.COUCOU; - _vm->_globals.COUCOU = g_PTRNUL; + v11 = _vm->_globals._answerBuffer; + _vm->_globals._answerBuffer = g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_objectsManager.INILINK(v22); _vm->_objectsManager.PERSO_ON = true; @@ -1090,8 +1090,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { for (int i = 0; i <= 44; i++) _vm->_globals.BOBZONE[i] = 0; - _vm->_globals.freeMemory(_vm->_globals.COUCOU); - _vm->_globals.COUCOU = v11; + _vm->_globals.freeMemory(_vm->_globals._answerBuffer); + _vm->_globals._answerBuffer = v11; _vm->_objectsManager._disableFl = true; _vm->_objectsManager.INILINK(v20); _vm->_graphicsManager.INI_ECRAN2(v20, true); -- cgit v1.2.3 From e1504b28a6dfbf51a345b2d402595d886c17eaf4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 12:04:24 +0100 Subject: HOPKINS: More renaming in LinesManager --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/lines.cpp | 365 +++++++++++++++++++++++--------------------- engines/hopkins/lines.h | 8 +- 3 files changed, 193 insertions(+), 182 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 44d3798daa..3150074e77 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -324,7 +324,7 @@ void Globals::clearAll() { for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; _vm->_linesManager.Ligne[idx].field2 = 0; - _vm->_linesManager.Ligne[idx].field4 = 0; + _vm->_linesManager.Ligne[idx]._direction = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index b5323901e5..0e668cf819 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -345,7 +345,7 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int Ligne[idx]._lineDataEndIdx = v35 + 1; Ligne[idx].field2 = a7; - Ligne[idx].field4 = a2; + Ligne[idx]._direction = a2; } /** @@ -584,7 +584,6 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int v5; int v6; int v7; - int v8; int v9; int v10; int i; @@ -625,30 +624,35 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v50 = a3; v7 = a5; if (checkCollisionLine(a1, a2, &v51, &v50, 0, _linesNumb)) { - v8 = Ligne[v50].field4; - if (v8 == 1) + switch (Ligne[v50]._direction) { + case 1: v6 = a2 - 2; - if (v8 == 2) { + break; + case 2: v6 -= 2; v5 = a1 + 2; - } - if (v8 == 3) + break; + case 3: v5 += 2; - if (v8 == 4) { + break; + case 4: v6 += 2; v5 += 2; - } - if (v8 == 5) + break; + case 5: v6 += 2; - if (v8 == 6) { + break; + case 6: v6 += 2; v5 -= 2; - } - if (v8 == 7) + break; + case 7: v5 -= 2; - if (v8 == 8) { + break; + case 8: v6 -= 2; v5 -= 2; + break; } } v41 = v5; @@ -872,7 +876,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { return false; } -int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) { +int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) { int result = a7; int v80 = -1; ++_vm->_globals.pathFindingDepth; @@ -883,10 +887,10 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, route[a7 + 2] = -1; return -1; } - int16 *v10 = Ligne[a1]._lineData; + int16 *v10 = Ligne[lineIdx]._lineData; int v98 = v10[0]; int v97 = v10[1]; - int v92 = a1; + int v92 = lineIdx; int v65; for (;;) { @@ -912,11 +916,11 @@ int LinesManager::GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, v97 = v12[1]; } LABEL_11: - int16 *v13 = Ligne[a1]._lineData; - int v95 = v13[2 * Ligne[a1]._lineDataEndIdx - 2]; - int v93 = v13[2 * Ligne[a1]._lineDataEndIdx - 1]; - int v91 = a1; - int v100, v101; + int16 *v13 = Ligne[lineIdx]._lineData; + int v95 = v13[2 * Ligne[lineIdx]._lineDataEndIdx - 2]; + int v93 = v13[2 * Ligne[lineIdx]._lineDataEndIdx - 1]; + int v91 = lineIdx; + int foundLineIdx, foundDataIdx; for (;;) { int v87 = v91 + 1; int v15 = 2 * Ligne[v91 + 1]._lineDataEndIdx; @@ -978,9 +982,9 @@ LABEL_17: int v78 = 0; int v79 = 0; for (int v89 = v85 + 1; v89 > 0; v89--) { - if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &v101, &v100, v92, v91) && _vm->_objectsManager._lastLine < v100) { - v80 = v100; - v77 = v101; + if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _vm->_objectsManager._lastLine < foundLineIdx) { + v80 = foundLineIdx; + v77 = foundDataIdx; v78 = _vm->_globals.BufLig[bugLigIdx]; v79 = _vm->_globals.BufLig[bugLigIdx + 1]; break; @@ -1036,10 +1040,10 @@ LABEL_17: int v76 = -1; for (;;) { --v34; - if (!checkCollisionLine(a5, v34, &v101, &v100, v92, v91)) + if (!checkCollisionLine(a5, v34, &foundDataIdx, &foundLineIdx, v92, v91)) break; - v76 = v100; + v76 = foundLineIdx; if (!v34 || v73 > v34) break; } @@ -1047,10 +1051,10 @@ LABEL_17: int v75 = -1; for (;;) { ++v35; - if (!checkCollisionLine(a5, v35, &v101, &v100, v92, v91)) + if (!checkCollisionLine(a5, v35, &foundDataIdx, &foundLineIdx, v92, v91)) break; - v75 = v100; + v75 = foundLineIdx; if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) break; } @@ -1058,10 +1062,10 @@ LABEL_17: int v74 = -1; for (;;) { ++v36; - if (!checkCollisionLine(v36, a6, &v101, &v100, v92, v91)) + if (!checkCollisionLine(v36, a6, &foundDataIdx, &foundLineIdx, v92, v91)) break; - v74 = v100; + v74 = foundLineIdx; if (_vm->_graphicsManager._maxX <= v36 || v67 <= v36) break; @@ -1070,9 +1074,9 @@ LABEL_17: int v38 = -1; for(;;) { --v37; - if (!checkCollisionLine(v37, a6, &v101, &v100, v92, v91)) + if (!checkCollisionLine(v37, a6, &foundDataIdx, &foundLineIdx, v92, v91)) break; - v38 = v100; + v38 = foundLineIdx; if (v37 <= 0 || v69 >= v37) break;; } @@ -1086,9 +1090,9 @@ LABEL_17: if (v78 < a3 - 1 || v78 > a3 + 1 || v79 < a4 - 1 || v79 > a4 + 1) { NVPX = v78; NVPY = v79; - if (a1 < v80) { + if (lineIdx < v80) { int v43 = 0; - int v42 = a1; + int v42 = lineIdx; do { if (v42 == v92 - 1) v42 = v91; @@ -1097,21 +1101,21 @@ LABEL_17: if (v42 == v92 - 1) v42 = v91; } while (v80 != v42); - if (abs(v80 - a1) == v43) { - if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) { - result = CONTOURNE(a1, a2, a7, v80, v77, route, a9); + if (abs(v80 - lineIdx) == v43) { + if (dataIdx > abs(Ligne[lineIdx]._lineDataEndIdx / 2)) { + result = CONTOURNE(lineIdx, dataIdx, a7, v80, v77, route, a9); } else { - result = CONTOURNE1(a1, a2, a7, v80, v77, route, a9, v92, v91); + result = CONTOURNE1(lineIdx, dataIdx, a7, v80, v77, route, a9, v92, v91); } } - if (abs(v80 - a1) < v43) - result = CONTOURNE(a1, a2, result, v80, v77, route, a9); - if (v43 < abs(v80 - a1)) - result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91); - } - if (a1 > v80) { - int v45 = abs(a1 - v80); - int v47 = a1; + if (abs(v80 - lineIdx) < v43) + result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route, a9); + if (v43 < abs(v80 - lineIdx)) + result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, a9, v92, v91); + } + if (lineIdx > v80) { + int v45 = abs(lineIdx - v80); + int v47 = lineIdx; int v48 = 0; do { if (v47 == v91 + 1) @@ -1122,46 +1126,52 @@ LABEL_17: v47 = v92; } while (v80 != v47); if (v45 == v48) { - if (a2 > abs(Ligne[a1]._lineDataEndIdx / 2)) { - result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91); + if (dataIdx > abs(Ligne[lineIdx]._lineDataEndIdx / 2)) { + result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, a9, v92, v91); } else { - result = CONTOURNE(a1, a2, result, v80, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route, a9); } } if (v45 < v48) - result = CONTOURNE(a1, a2, result, v80, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route, a9); if (v48 < v45) - result = CONTOURNE1(a1, a2, result, v80, v77, route, a9, v92, v91); + result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, a9, v92, v91); } - if (a1 == v80) - result = CONTOURNE(a1, a2, result, a1, v77, route, a9); + if (lineIdx == v80) + result = CONTOURNE(lineIdx, dataIdx, result, lineIdx, v77, route, a9); for(;;) { - if (!checkCollisionLine(NVPX, NVPY, &v101, &v100, _vm->_objectsManager._lastLine + 1, _linesNumb)) + if (!checkCollisionLine(NVPX, NVPY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb)) break; - if (Ligne[v100].field4 == 1) + switch (Ligne[foundLineIdx]._direction) { + case 1: --NVPY; - if (Ligne[v100].field4 == 2) { + break; + case 2: --NVPY; ++NVPX; - } - if (Ligne[v100].field4 == 3) + break; + case 3: ++NVPX; - if (Ligne[v100].field4 == 4) { + break; + case 4: ++NVPY; ++NVPX; - } - if (Ligne[v100].field4 == 5) + break; + case 5: ++NVPY; - if (Ligne[v100].field4 == 6) { + break; + case 6: ++NVPY; --NVPX; - } - if (Ligne[v100].field4 == 7) + break; + case 7: --NVPX; - if (Ligne[v100].field4 == 8) { + break; + case 8: --NVPY; --NVPX; + break; } } } else { @@ -1172,9 +1182,9 @@ LABEL_17: } // Avoid 2 -int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { - int v124; - int v125; +int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { + int foundLineIdx; + int foundDataIdx; int v118 = 0; int v119 = 0; int v126[9]; @@ -1193,11 +1203,11 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (destY <= 24) clipDestY = 25; if (!_vm->_globals.NOT_VERIF) { - if (abs(srcX - _vm->_globals.old_x1_65) <= 4 && abs(srcY - _vm->_globals.old_y1_66) <= 4 && + if (abs(fromX - _vm->_globals.old_x1_65) <= 4 && abs(fromY - _vm->_globals.old_y1_66) <= 4 && abs(_vm->_globals.old_x2_67 - destX) <= 4 && abs(_vm->_globals.old_y2_68 - clipDestY) <= 4) return (int16 *)g_PTRNUL; - if (abs(srcX - destX) <= 4 && abs(srcY - clipDestY) <= 4) + if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4) return (int16 *)g_PTRNUL; if (_vm->_globals._oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals._oldZoneNum == _vm->_objectsManager._zoneNum) @@ -1205,9 +1215,9 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } _vm->_globals.NOT_VERIF = false; _vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum; - _vm->_globals.old_x1_65 = srcX; + _vm->_globals.old_x1_65 = fromX; _vm->_globals.old_x2_67 = destX; - _vm->_globals.old_y1_66 = srcY; + _vm->_globals.old_y1_66 = fromY; _vm->_globals.old_y2_68 = clipDestY; _vm->_globals.pathFindingDepth = 0; int v112 = 0; @@ -1220,7 +1230,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (clipDestY > _vm->_globals.Max_Perso_Y) clipDestY = _vm->_globals.Max_Perso_Y; - if (abs(srcX - clipDestX) <= 3 && abs(srcY - clipDestY) <= 3) + if (abs(fromX - clipDestX) <= 3 && abs(fromY - clipDestY) <= 3) return (int16 *)g_PTRNUL; for (int i = 0; i <= 8; ++i) { @@ -1230,7 +1240,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v126[i] = 1300; } - if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) == 1) + if (PARC_PERS(fromX, fromY, clipDestX, clipDestY, -1, -1, 0) == 1) return &_vm->_globals.super_parcours[0]; int v14 = 0; @@ -1324,8 +1334,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } v14 = 0; - for (int tmpY = srcY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { - if (checkCollisionLine(srcX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + for (int tmpY = fromY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { + if (checkCollisionLine(fromX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) break; v136[5] = 0; v141[5] = -1; @@ -1333,8 +1343,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v131[5] = v14 + 1; v14 = 0; - for (int tmpY = srcY; tmpY > _vm->_graphicsManager._minY; tmpY--) { - if (checkCollisionLine(srcX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + for (int tmpY = fromY; tmpY > _vm->_graphicsManager._minY; tmpY--) { + if (checkCollisionLine(fromX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) break; v136[1] = 0; v141[1] = -1; @@ -1345,8 +1355,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v131[1] = v14 + 1; v14 = 0; - for (int tmpX = srcX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { - if (checkCollisionLine(tmpX, srcY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + for (int tmpX = fromX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { + if (checkCollisionLine(tmpX, fromY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) break; v136[3] = 0; v141[3] = -1; @@ -1357,8 +1367,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v131[3] = v14 + 1; v14 = 0; - for (int tmpX = srcX; tmpX > _vm->_graphicsManager._minX; tmpX--) { - if (checkCollisionLine(tmpX, srcY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + for (int tmpX = fromX; tmpX > _vm->_graphicsManager._minX; tmpX--) { + if (checkCollisionLine(tmpX, fromY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) break; v136[7] = 0; v141[7] = -1; @@ -1405,7 +1415,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v114 = v136[7]; } - int v55 = PARC_PERS(srcX, srcY, clipDestX, clipDestY, v115, v121, 0); + int v55 = PARC_PERS(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); if (v55 != 1) { if (v55 == 2) { LABEL_201: @@ -1415,9 +1425,9 @@ LABEL_201: } else { if (v113 == 1) { for (int deltaY = 0; deltaY < v111; deltaY++) { - if (checkCollisionLine(srcX, srcY - deltaY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - int v58 = GENIAL(v124, v125, srcX, srcY - deltaY, srcX, srcY - v111, v112, &_vm->_globals.super_parcours[0], 4); + if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < foundLineIdx) { + int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &_vm->_globals.super_parcours[0], 4); if (v58 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1427,10 +1437,10 @@ LABEL_201: } v112 = v58; if (NVPY != -1) - deltaY = srcY - NVPY; + deltaY = fromY - NVPY; } - _vm->_globals.super_parcours[v112] = srcX; - _vm->_globals.super_parcours[v112 + 1] = srcY - deltaY; + _vm->_globals.super_parcours[v112] = fromX; + _vm->_globals.super_parcours[v112 + 1] = fromY - deltaY; _vm->_globals.super_parcours[v112 + 2] = 1; _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; @@ -1438,9 +1448,9 @@ LABEL_201: } if (v113 == 5) { for (int deltaY = 0; deltaY < v111; deltaY++) { - if (checkCollisionLine(srcX, deltaY + srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - int v61 = GENIAL(v124, v125, srcX, deltaY + srcY, srcX, v111 + srcY, v112, &_vm->_globals.super_parcours[0], 4); + if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < foundLineIdx) { + int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1450,10 +1460,10 @@ LABEL_201: } v112 = v61; if (NVPY != -1) - deltaY = NVPY - srcY; + deltaY = NVPY - fromY; } - _vm->_globals.super_parcours[v112] = srcX; - _vm->_globals.super_parcours[v112 + 1] = deltaY + srcY; + _vm->_globals.super_parcours[v112] = fromX; + _vm->_globals.super_parcours[v112 + 1] = deltaY + fromY; _vm->_globals.super_parcours[v112 + 2] = 5; _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; @@ -1461,9 +1471,9 @@ LABEL_201: } if (v113 == 7) { for (int deltaX = 0; deltaX < v111; deltaX++) { - if (checkCollisionLine(srcX - deltaX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - int v64 = GENIAL(v124, v125, srcX - deltaX, srcY, srcX - v111, srcY, v112, &_vm->_globals.super_parcours[0], 4); + if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < foundLineIdx) { + int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &_vm->_globals.super_parcours[0], 4); if (v64 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1473,10 +1483,10 @@ LABEL_201: } v112 = v64; if (NVPX != -1) - deltaX = srcX - NVPX; + deltaX = fromX - NVPX; } - _vm->_globals.super_parcours[v112] = srcX - deltaX; - _vm->_globals.super_parcours[v112 + 1] = srcY; + _vm->_globals.super_parcours[v112] = fromX - deltaX; + _vm->_globals.super_parcours[v112 + 1] = fromY; _vm->_globals.super_parcours[v112 + 2] = 7; _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; @@ -1484,9 +1494,9 @@ LABEL_201: } if (v113 == 3) { for (int deltaX = 0; deltaX < v111; deltaX++) { - if (checkCollisionLine(deltaX + srcX, srcY, &v125, &v124, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v124) { - int v67 = GENIAL(v124, v125, deltaX + srcX, srcY, v111 + srcX, srcY, v112, &_vm->_globals.super_parcours[0], 4); + if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) + && _vm->_objectsManager._lastLine < foundLineIdx) { + int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &_vm->_globals.super_parcours[0], 4); if (v67 == -1) { _vm->_globals.super_parcours[v112] = -1; _vm->_globals.super_parcours[v112 + 1] = -1; @@ -1496,10 +1506,10 @@ LABEL_201: } v112 = v67; if (NVPX != -1) - deltaX = NVPX - srcX; + deltaX = NVPX - fromX; } - _vm->_globals.super_parcours[v112] = deltaX + srcX; - _vm->_globals.super_parcours[v112 + 1] = srcY; + _vm->_globals.super_parcours[v112] = deltaX + fromX; + _vm->_globals.super_parcours[v112 + 1] = fromY; _vm->_globals.super_parcours[v112 + 2] = 3; _vm->_globals.super_parcours[v112 + 3] = 0; v112 += 4; @@ -1646,7 +1656,7 @@ LABEL_234: return &_vm->_globals.super_parcours[0]; } -int LinesManager::PARC_PERS(int a1, int a2, int destX, int destY, int a5, int a6, int a7) { +int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7) { int v18; int v19; int v20; @@ -1697,65 +1707,65 @@ int LinesManager::PARC_PERS(int a1, int a2, int destX, int destY, int a5, int a6 int v124; int v125; bool v126 = false; - int v138; - int v139; + int collLineIdx; + int collDataIdx; int v140; int v141; int v142; int v143; - int v145; bool colResult = false; - int v7 = a1; - int v90 = a2; + int curX = fromX; + int curY = fromY; int v137 = a7; bool v136 = false; if (a5 == -1 && a6 == -1) v136 = true; - int v144 = a5; - if (checkCollisionLine(a1, a2, &v145, &v144, 0, _linesNumb)) { - switch (Ligne[v144].field4) { + int foundDataIdx; + int foundLineIdx = a5; + if (checkCollisionLine(fromX, fromY, &foundDataIdx, &foundLineIdx, 0, _linesNumb)) { + switch (Ligne[foundLineIdx]._direction) { case 1: - v90 -= 2; + curY -= 2; break; case 2: - v90 -= 2; - v7 += 2; + curY -= 2; + curX += 2; break; case 3: - v7 += 2; + curX += 2; break; case 4: - v90 += 2; - v7 += 2; + curY += 2; + curX += 2; case 5: - v90 += 2; + curY += 2; break; case 6: - v90 += 2; - v7 -= 2; + curY += 2; + curX -= 2; break; case 7: - v7 -= 2; + curX -= 2; break; case 8: - v90 -= 2; - v7 -= 2; + curY -= 2; + curX -= 2; break; } } - v98 = v7; - v97 = v90; + v98 = curX; + v97 = curY; v115 = 0; v142 = -1; v140 = -1; - v138 = -1; + collLineIdx = -1; - int v9, v10, v11, v12, v13, v14; + int distX, v10, distY, v12, v13, v14; for (;;) { - v111 = v7; - v109 = v90; - if (destX >= v7 - 2 && destX <= v7 + 2 && destY >= v90 - 2 && destY <= v90 + 2) { + v111 = curX; + v109 = curY; + if (destX >= curX - 2 && destX <= curX + 2 && destY >= curY - 2 && destY <= curY + 2) { LABEL_149: _vm->_globals.essai0[v115] = -1; _vm->_globals.essai0[v115 + 1] = -1; @@ -1782,18 +1792,19 @@ LABEL_150: _vm->_globals.super_parcours[v137 + 3] = -1; return 1; } - v9 = abs(v7 - destX); - v10 = v9 + 1; - v11 = abs(v90 - destY); - v107 = v11 + 1; - if (v10 > (int16)(v11 + 1)) + distX = abs(curX - destX); + v10 = distX + 1; + distY = abs(curY - destY); + v107 = distY + 1; + if (v10 > v107) v107 = v10; v12 = v107 - 1; + assert(v12 != 0); v101 = 1000 * v10 / v12; - v99 = 1000 * (int16)(v11 + 1) / v12; - if (destX < v7) + v99 = 1000 * (distY + 1) / v12; + if (destX < curX) v101 = -v101; - if (destY < v90) + if (destY < curY) v99 = -v99; v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; @@ -1820,7 +1831,7 @@ LABEL_150: } if (v94 == -1 && (unsigned int)(v101 + 150) <= 150) newDirection = 1; - if (newDirection == -1 && !checkSmoothMove(v7, v109, destX, destY) && !makeSmoothMove(v7, v109, destX, destY)) + if (newDirection == -1 && !checkSmoothMove(curX, v109, destX, destY) && !makeSmoothMove(curX, v109, destX, destY)) break; LABEL_72: v19 = abs(v111 - destX); @@ -1938,8 +1949,8 @@ LABEL_72: v142 = -1; goto LABEL_157; } - v7 = -1; - v90 = -1; + curX = -1; + curY = -1; } newDirection = _smoothMoveDirection; v14 = 0; @@ -2102,7 +2113,7 @@ LABEL_203: goto LABEL_241; if (v93 < destY) { v55 = v93; - while (!checkCollisionLine(v114, v55, &v139, &v138, 0, _linesNumb)) { + while (!checkCollisionLine(v114, v55, &collDataIdx, &collLineIdx, 0, _linesNumb)) { _vm->_globals.essai2[v117] = v114; _vm->_globals.essai2[v117 + 1] = v55; _vm->_globals.essai2[v117 + 2] = 5; @@ -2116,7 +2127,7 @@ LABEL_203: LABEL_211: if (v93 > destY) { v58 = v93; - while (!checkCollisionLine(v114, v58, &v139, &v138, 0, _linesNumb)) { + while (!checkCollisionLine(v114, v58, &collDataIdx, &collLineIdx, 0, _linesNumb)) { _vm->_globals.essai2[v117] = v114; _vm->_globals.essai2[v117 + 1] = v58; _vm->_globals.essai2[v117 + 2] = 1; @@ -2126,16 +2137,16 @@ LABEL_211: goto LABEL_217; } LABEL_214: - if (v138 > _vm->_objectsManager._lastLine) - v138 = -1; + if (collLineIdx > _vm->_objectsManager._lastLine) + collLineIdx = -1; LABEL_249: _vm->_globals.essai2[v117] = -1; _vm->_globals.essai2[v117 + 1] = -1; _vm->_globals.essai2[v117 + 2] = -1; if (!v136) { - if (a6 > v144) { - if (_vm->_globals.essai0[0] != -1 && v142 > v144 && v140 <= v142 && v138 <= v142 && a6 >= v142) { + if (a6 > foundLineIdx) { + if (_vm->_globals.essai0[0] != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v120 = 0; @@ -2152,7 +2163,7 @@ LABEL_249: NV_POSI = v137; return 2; } - if (_vm->_globals.essai1[0] != -1 && v144 < v140 && v138 <= v140 && v142 <= v140 && a6 >= v140) { + if (_vm->_globals.essai1[0] != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v121 = 0; @@ -2171,9 +2182,9 @@ LABEL_249: return 2; } if (_vm->_globals.essai2[0] != -1) { - if (v144 < v138 && v140 < v138 && v142 < v138 && a6 >= v138) { - NV_LIGNEDEP = v138; - NV_LIGNEOFS = v139; + if (foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { + NV_LIGNEDEP = collLineIdx; + NV_LIGNEOFS = collDataIdx; v122 = 0; for (;;) { assert(v137 <= 32000); @@ -2191,14 +2202,14 @@ LABEL_249: } } } - if (a6 < v144) { + if (a6 < foundLineIdx) { if (v142 == -1) v142 = 1300; if (v140 == -1) v142 = 1300; - if (v138 == -1) + if (collLineIdx == -1) v142 = 1300; - if (_vm->_globals.essai1[0] != -1 && v140 < v144 && v138 >= v140 && v142 >= v140 && a6 <= v140) { + if (_vm->_globals.essai1[0] != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v123 = 0; @@ -2216,9 +2227,9 @@ LABEL_249: NV_POSI = v137; return 2; } - if (_vm->_globals.essai2[0] != -1 && v144 > v138 && v140 >= v138 && v142 >= v138 && a6 <= v138) { - NV_LIGNEDEP = v138; - NV_LIGNEOFS = v139; + if (_vm->_globals.essai2[0] != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { + NV_LIGNEDEP = collLineIdx; + NV_LIGNEOFS = collDataIdx; v124 = 0; for (;;) { assert(v137 <= 32000); @@ -2234,7 +2245,7 @@ LABEL_249: NV_POSI = v137; return 2; } - if (_vm->_globals.essai1[0] != -1 && v144 > v142 && v140 >= v142 && v138 >= v142 && a6 <= v142) { + if (_vm->_globals.essai1[0] != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v125 = 0; @@ -2260,9 +2271,9 @@ LABEL_249: LABEL_217: if (v114 < destX) { for (int v61 = v114; v61 < destX; v61++) { - if (checkCollisionLine(v61, destY, &v139, &v138, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < v138) { - int v62 = GENIAL(v138, v139, v61, destY, destX, destY, v117, _vm->_globals.essai2, 3); + if (checkCollisionLine(v61, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < collLineIdx) { + int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, _vm->_globals.essai2, 3); if (v62 == -1) goto LABEL_195; v117 = v62; @@ -2270,14 +2281,14 @@ LABEL_217: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); - if (colResult && v138 <= _vm->_objectsManager._lastLine) + colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine); + if (colResult && collLineIdx <= _vm->_objectsManager._lastLine) goto LABEL_249; goto LABEL_203; } } } - if (v138 <= _vm->_objectsManager._lastLine) + if (collLineIdx <= _vm->_objectsManager._lastLine) goto LABEL_249; } @@ -2289,22 +2300,22 @@ LABEL_217: } if (v114 > destX) { for (int v65 = v114; v65 > destX; v65--) { - if (checkCollisionLine(v65, destY, &v139, &v138, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < v138) { - v66 = GENIAL(v138, v139, v65, destY, destX, destY, v117, _vm->_globals.essai2, 3); + if (checkCollisionLine(v65, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { + if (_vm->_objectsManager._lastLine < collLineIdx) { + v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, _vm->_globals.essai2, 3); if (v66 == -1) goto LABEL_242; v117 = v66; if (NVPX != -1 && NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &v139, &v138, 0, _vm->_objectsManager._lastLine); - if (colResult && v138 <= _vm->_objectsManager._lastLine) + colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine); + if (colResult && collLineIdx <= _vm->_objectsManager._lastLine) goto LABEL_249; goto LABEL_203; } } - if (v138 <= _vm->_objectsManager._lastLine) + if (collLineIdx <= _vm->_objectsManager._lastLine) goto LABEL_249; } _vm->_globals.essai2[v117] = v65; @@ -2313,7 +2324,7 @@ LABEL_217: v117 += 3; } } - v138 = -1; + collLineIdx = -1; LABEL_241: _vm->_globals.essai2[v117] = -1; _vm->_globals.essai2[v117 + 1] = -1; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index a1a81921b5..046ef120dc 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -39,7 +39,7 @@ struct LigneZoneItem { struct LigneItem { int _lineDataEndIdx; int field2; // Useless variable - int field4; + int _direction; int field6; int field8; int16 *_lineData; @@ -81,9 +81,9 @@ public: int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); bool MIRACLE(int a1, int a2, int a3, int a4, int a5); - int GENIAL(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); - int16 *PARCOURS2(int srcX, int srcY, int destX, int destY); - int PARC_PERS(int a1, int a2, int destX, int destY, int a5, int a6, int a7); + int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); + int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); + int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); bool checkSmoothMove(int fromX, int fromY, int destX, int destY); bool makeSmoothMove(int fromX, int fromY, int destX, int destY); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); -- cgit v1.2.3 From 50aa4cbc7378f6ec3535438554491de051b7d873 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 12:53:00 +0100 Subject: HOPKINS: Move some structures and functions to LinesManager --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 12 -- engines/hopkins/lines.cpp | 376 ++++++++++++++++++++++++++++++++++++-------- engines/hopkins/lines.h | 3 + engines/hopkins/objects.cpp | 328 +++++--------------------------------- engines/hopkins/objects.h | 15 +- 6 files changed, 364 insertions(+), 374 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 3150074e77..dfd270a7e1 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -70,8 +70,6 @@ Globals::Globals() { CACHE_BANQUE[i] = g_PTRNUL; for (int i = 0; i < 106; ++i) Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0); - for (int i = 0; i < 100; ++i) - Common::fill((byte *)&CarreZone[i], (byte *)&CarreZone[i] + sizeof(CarreZoneItem), 0); for (int i = 0; i < 35; ++i) Common::fill((byte *)&Bqe_Anim[i], (byte *)&Bqe_Anim[i] + sizeof(BqeAnimItem), 0); for (int i = 0; i < 8; ++i) @@ -335,7 +333,7 @@ void Globals::clearAll() { } for (int idx = 0; idx < 100; ++idx) { - CarreZone[idx]._enabledFl = 0; + _vm->_objectsManager.CarreZone[idx]._enabledFl = 0; } BUFFERTAPE = allocMemory(85000); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index b81ce5fceb..a1688d07c8 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -47,17 +47,6 @@ struct ZonePItem { int field12; }; -struct CarreZoneItem { - int _enabledFl; - int _left; - int _right; - int _top; - int _bottom; - int _minZoneLineIdx; - int _maxZoneLineIdx; - bool _squareZoneFl; -}; - struct BqeAnimItem { byte *_data; bool _enabledFl; @@ -298,7 +287,6 @@ private: public: byte *CACHE_BANQUE[6]; ZonePItem ZONEP[106]; - CarreZoneItem CarreZone[101]; BqeAnimItem Bqe_Anim[35]; BankItem Bank[8]; BobItem _bob[36]; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 0e668cf819..91ab0580ca 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -44,12 +44,35 @@ LinesManager::LinesManager() { NVPX = 0; NVPY = 0; _smoothMoveDirection = 0; + _lastLine = 0; } void LinesManager::setParent(HopkinsEngine *vm) { _vm = vm; } +/** + * Load lines + */ +void LinesManager::loadLines(const Common::String &file) { + resetLines(); + _linesNumb = 0; + _lastLine = 0; + byte *ptr = _vm->_fileManager.loadFile(file); + for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { + addLine(idx, + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4), + 1); + ++_linesNumb; + } + initRoute(); + _vm->_globals.freeMemory(ptr); +} + /** * Clear all zones and reset nextLine */ @@ -434,9 +457,9 @@ void LinesManager::initRoute() { ++lineIdx; } - _vm->_objectsManager._lastLine = lineIdx; + _lastLine = lineIdx; for (int idx = 1; idx < MAX_LINES; idx++) { - if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _vm->_objectsManager._lastLine + 1)) { + if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _lastLine + 1)) { Ligne[idx].field6 = Ligne[idx - 1].field6; Ligne[idx].field8 = Ligne[idx - 1].field8; } @@ -660,7 +683,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v9 = 0; v10 = v40; for (i = v40; v40 + 200 > v10; i = v10) { - if (checkCollisionLine(v41, i, &v49, &v48, 0, _vm->_objectsManager._lastLine) == 1 && v48 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v41, i, &v49, &v48, 0, _lastLine) == 1 && v48 <= _lastLine) break; v49 = 0; v48 = -1; @@ -671,7 +694,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v12 = 0; v13 = v40; for (j = v40; v40 - 200 < v13; j = v13) { - if (checkCollisionLine(v41, j, &v47, &v46, 0, _vm->_objectsManager._lastLine) == 1 && v46 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(v41, j, &v47, &v46, 0, _lastLine) == 1 && v46 <= _lastLine) break; v47 = 0; v46 = -1; @@ -682,7 +705,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v15 = 0; v16 = v41; for (k = v41; v41 + 200 > v16; k = v16) { - if (checkCollisionLine(k, v40, &v45, &v44, 0, _vm->_objectsManager._lastLine) == 1 && v44 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(k, v40, &v45, &v44, 0, _lastLine) == 1 && v44 <= _lastLine) break; v45 = 0; v44 = -1; @@ -693,7 +716,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v18 = 0; v19 = v41; for (l = v41; v41 - 200 < v19; l = v19) { - if (checkCollisionLine(l, v40, &v43, &v42, 0, _vm->_objectsManager._lastLine) == 1 && v42 <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(l, v40, &v43, &v42, 0, _lastLine) == 1 && v42 <= _lastLine) break; v43 = 0; v42 = -1; @@ -785,8 +808,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 1) { for (int v22 = 0; v22 < v39; v22++) { - if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v46) { + if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); if (v23 == -1) return false; @@ -807,8 +829,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { - if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v46) { + if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); if (v26 == -1) return false; @@ -829,8 +850,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { - if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v46) { + if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v29 == -1) return false; @@ -851,8 +871,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { } if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { - if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < v46) { + if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); if (v32 == -1) return false; @@ -902,7 +921,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a break; while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) { --v86; - if (_vm->_objectsManager._lastLine - 1 != v86) { + if (_lastLine - 1 != v86) { v11 = 2 * Ligne[v86]._lineDataEndIdx; v12 = Ligne[v86]._lineData; if (v12 != (int16 *)g_PTRNUL) @@ -982,7 +1001,7 @@ LABEL_17: int v78 = 0; int v79 = 0; for (int v89 = v85 + 1; v89 > 0; v89--) { - if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _vm->_objectsManager._lastLine < foundLineIdx) { + if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { v80 = foundLineIdx; v77 = foundDataIdx; v78 = _vm->_globals.BufLig[bugLigIdx]; @@ -1140,7 +1159,7 @@ LABEL_17: if (lineIdx == v80) result = CONTOURNE(lineIdx, dataIdx, result, lineIdx, v77, route, a9); for(;;) { - if (!checkCollisionLine(NVPX, NVPY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb)) + if (!checkCollisionLine(NVPX, NVPY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb)) break; switch (Ligne[foundLineIdx]._direction) { @@ -1245,7 +1264,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v14 = 0; for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { - if (checkCollisionLine(clipDestX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(clipDestX, tmpY, &v136[5], &v141[5], 0, _lastLine) && v141[5] <= _lastLine) break; v136[5] = 0; v141[5] = -1; @@ -1254,7 +1273,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpY = clipDestY; tmpY > _vm->_graphicsManager._minY; tmpY--, v14++) { - if (checkCollisionLine(clipDestX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(clipDestX, tmpY, &v136[1], &v141[1], 0, _lastLine) && v141[1] <= _lastLine) break; v136[1] = 0; v141[1] = -1; @@ -1265,7 +1284,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpX = clipDestX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { - if (checkCollisionLine(tmpX, clipDestY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(tmpX, clipDestY, &v136[3], &v141[3], 0, _lastLine) && v141[3] <= _lastLine) break; v136[3] = 0; v141[3] = -1; @@ -1279,7 +1298,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpX = clipDestX; tmpX > _vm->_graphicsManager._minX; tmpX--) { - if (checkCollisionLine(tmpX, clipDestY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(tmpX, clipDestY, &v136[7], &v141[7], 0, _lastLine) && v141[7] <= _lastLine) break; v136[7] = 0; v141[7] = -1; @@ -1293,13 +1312,13 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } v131[7] = v14; - if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) + if (v141[1] < 0 || _lastLine < v141[1]) v141[1] = -1; - if (v141[3] < 0 || _vm->_objectsManager._lastLine < v141[3]) + if (v141[3] < 0 || _lastLine < v141[3]) v141[3] = -1; - if (v141[5] < 0 || _vm->_objectsManager._lastLine < v141[5]) + if (v141[5] < 0 || _lastLine < v141[5]) v141[5] = -1; - if (v141[7] < 0 || _vm->_objectsManager._lastLine < v141[7]) + if (v141[7] < 0 || _lastLine < v141[7]) v141[7] = -1; if (v141[1] < 0) v131[1] = 1300; @@ -1335,7 +1354,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpY = fromY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { - if (checkCollisionLine(fromX, tmpY, &v136[5], &v141[5], 0, _vm->_objectsManager._lastLine) && v141[5] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(fromX, tmpY, &v136[5], &v141[5], 0, _lastLine) && v141[5] <= _lastLine) break; v136[5] = 0; v141[5] = -1; @@ -1344,7 +1363,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpY = fromY; tmpY > _vm->_graphicsManager._minY; tmpY--) { - if (checkCollisionLine(fromX, tmpY, &v136[1], &v141[1], 0, _vm->_objectsManager._lastLine) && v141[1] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(fromX, tmpY, &v136[1], &v141[1], 0, _lastLine) && v141[1] <= _lastLine) break; v136[1] = 0; v141[1] = -1; @@ -1356,7 +1375,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpX = fromX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { - if (checkCollisionLine(tmpX, fromY, &v136[3], &v141[3], 0, _vm->_objectsManager._lastLine) && v141[3] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(tmpX, fromY, &v136[3], &v141[3], 0, _lastLine) && v141[3] <= _lastLine) break; v136[3] = 0; v141[3] = -1; @@ -1368,7 +1387,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v14 = 0; for (int tmpX = fromX; tmpX > _vm->_graphicsManager._minX; tmpX--) { - if (checkCollisionLine(tmpX, fromY, &v136[7], &v141[7], 0, _vm->_objectsManager._lastLine) && v141[7] <= _vm->_objectsManager._lastLine) + if (checkCollisionLine(tmpX, fromY, &v136[7], &v141[7], 0, _lastLine) && v141[7] <= _lastLine) break; v136[7] = 0; v141[7] = -1; @@ -1425,8 +1444,7 @@ LABEL_201: } else { if (v113 == 1) { for (int deltaY = 0; deltaY < v111; deltaY++) { - if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < foundLineIdx) { + if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &_vm->_globals.super_parcours[0], 4); if (v58 == -1) { _vm->_globals.super_parcours[v112] = -1; @@ -1448,8 +1466,8 @@ LABEL_201: } if (v113 == 5) { for (int deltaY = 0; deltaY < v111; deltaY++) { - if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < foundLineIdx) { + if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) + && _lastLine < foundLineIdx) { int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &_vm->_globals.super_parcours[0], 4); if (v61 == -1) { _vm->_globals.super_parcours[v112] = -1; @@ -1471,8 +1489,7 @@ LABEL_201: } if (v113 == 7) { for (int deltaX = 0; deltaX < v111; deltaX++) { - if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < foundLineIdx) { + if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &_vm->_globals.super_parcours[0], 4); if (v64 == -1) { _vm->_globals.super_parcours[v112] = -1; @@ -1494,8 +1511,7 @@ LABEL_201: } if (v113 == 3) { for (int deltaX = 0; deltaX < v111; deltaX++) { - if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _vm->_objectsManager._lastLine + 1, _linesNumb) - && _vm->_objectsManager._lastLine < foundLineIdx) { + if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &_vm->_globals.super_parcours[0], 4); if (v67 == -1) { _vm->_globals.super_parcours[v112] = -1; @@ -1939,7 +1955,7 @@ LABEL_72: if (v23 >= v108 + 1) goto LABEL_149; } - if (_vm->_objectsManager._lastLine >= v142) + if (_lastLine >= v142) goto LABEL_157; v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, _vm->_globals.essai0, 3); if (v24 == -1) @@ -1977,7 +1993,7 @@ LABEL_72: goto LABEL_72; } } - if (v142 > _vm->_objectsManager._lastLine) + if (v142 > _lastLine) v142 = -1; LABEL_157: @@ -2012,7 +2028,7 @@ LABEL_171: LABEL_181: for (int v43 = v92; v43 > destY; v43--) { if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < v140) { + if (_lastLine < v140) { int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, _vm->_globals.essai1, 3); if (v44 == -1) goto LABEL_195; @@ -2020,13 +2036,13 @@ LABEL_181: if (NVPX != -1 && NVPY != -1) { v33 = NVPX; v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); - if (v45 && v140 <= _vm->_objectsManager._lastLine) + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _lastLine); + if (v45 && v140 <= _lastLine) goto LABEL_202; goto LABEL_158; } } - if (v140 <= _vm->_objectsManager._lastLine) + if (v140 <= _lastLine) goto LABEL_202; } _vm->_globals.essai1[v117] = destX; @@ -2061,7 +2077,7 @@ LABEL_195: v39 = v92; for (;;) { if (checkCollisionLine(destX, v39, &v141, &v140, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < v140) { + if (_lastLine < v140) { v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, _vm->_globals.essai1, 3); if (v40 == -1) goto LABEL_195; @@ -2069,13 +2085,13 @@ LABEL_195: if (NVPX != -1 && NVPY != -1) { v33 = NVPX; v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _vm->_objectsManager._lastLine); - if (v45 && v140 <= _vm->_objectsManager._lastLine) + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _lastLine); + if (v45 && v140 <= _lastLine) goto LABEL_202; goto LABEL_158; } } - if (v140 <= _vm->_objectsManager._lastLine) + if (v140 <= _lastLine) goto LABEL_202; } @@ -2098,7 +2114,7 @@ LABEL_195: goto LABEL_165; } LABEL_168: - if (v140 > _vm->_objectsManager._lastLine) + if (v140 > _lastLine) v140 = -1; LABEL_202: _vm->_globals.essai1[v117] = -1; @@ -2137,7 +2153,7 @@ LABEL_211: goto LABEL_217; } LABEL_214: - if (collLineIdx > _vm->_objectsManager._lastLine) + if (collLineIdx > _lastLine) collLineIdx = -1; LABEL_249: _vm->_globals.essai2[v117] = -1; @@ -2272,7 +2288,7 @@ LABEL_217: if (v114 < destX) { for (int v61 = v114; v61 < destX; v61++) { if (checkCollisionLine(v61, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < collLineIdx) { + if (_lastLine < collLineIdx) { int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, _vm->_globals.essai2, 3); if (v62 == -1) goto LABEL_195; @@ -2281,14 +2297,14 @@ LABEL_217: if (NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine); - if (colResult && collLineIdx <= _vm->_objectsManager._lastLine) + colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _lastLine); + if (colResult && collLineIdx <= _lastLine) goto LABEL_249; goto LABEL_203; } } } - if (collLineIdx <= _vm->_objectsManager._lastLine) + if (collLineIdx <= _lastLine) goto LABEL_249; } @@ -2301,7 +2317,7 @@ LABEL_217: if (v114 > destX) { for (int v65 = v114; v65 > destX; v65--) { if (checkCollisionLine(v65, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - if (_vm->_objectsManager._lastLine < collLineIdx) { + if (_lastLine < collLineIdx) { v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, _vm->_globals.essai2, 3); if (v66 == -1) goto LABEL_242; @@ -2309,13 +2325,13 @@ LABEL_217: if (NVPX != -1 && NVPY != -1) { v54 = NVPX; v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine); - if (colResult && collLineIdx <= _vm->_objectsManager._lastLine) + colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _lastLine); + if (colResult && collLineIdx <= _lastLine) goto LABEL_249; goto LABEL_203; } } - if (collLineIdx <= _vm->_objectsManager._lastLine) + if (collLineIdx <= _lastLine) goto LABEL_249; } _vm->_globals.essai2[v117] = v65; @@ -2350,6 +2366,236 @@ LABEL_242: return 1; } +int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { + int16 *result; + int arrDelta[10]; + int arrDataIdx[10]; + int arrLineIdx[10]; + + int clipX2 = x2; + int clipY2 = y2; + int superRouteIdx = 0; + if (x2 <= 14) + clipX2 = 15; + if (y2 <= 14) + clipY2 = 15; + if (clipX2 > _vm->_graphicsManager._maxX - 10) + clipX2 = _vm->_graphicsManager._maxX - 10; + if (clipY2 > 445) + clipY2 = 440; + + int delta = 0; + for (delta = 0; clipY2 + delta < _vm->_graphicsManager._maxY; delta++) { + if (checkCollisionLine(clipX2, clipY2 + delta, &arrDataIdx[5], &arrLineIdx[5], 0, _lastLine) && arrLineIdx[5] <= _lastLine) + break; + arrDataIdx[5] = 0; + arrLineIdx[5] = -1; + } + arrDelta[5] = delta; + + for (delta = 0; clipY2 - delta > _vm->_graphicsManager._minY; delta++) { + if (checkCollisionLine(clipX2, clipY2 - delta , &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine) && arrLineIdx[1] <= _lastLine) + break; + arrDataIdx[1] = 0; + arrLineIdx[1] = -1; + if (arrDelta[5] < delta && arrLineIdx[5] != -1) + break; + } + arrDelta[1] = delta; + + for (delta = 0; clipX2 + delta < _vm->_graphicsManager._maxX; delta++) { + if (checkCollisionLine(clipX2 + delta, clipY2, &arrDataIdx[3], &arrLineIdx[3], 0, _lastLine) && arrLineIdx[3] <= _lastLine) + break; + arrDataIdx[3] = 0; + arrLineIdx[3] = -1; + if (arrDelta[1] <= delta && arrLineIdx[1] != -1) + break; + if (arrDelta[5] <= delta && arrLineIdx[5] != -1) + break; + } + arrDelta[3] = delta; + + for (delta = 0; clipX2 - delta > _vm->_graphicsManager._minX; delta++) { + if (checkCollisionLine(clipX2 - delta, clipY2, &arrDataIdx[7], &arrLineIdx[7], 0, _lastLine) && arrLineIdx[7] <= _lastLine) + break; + arrDataIdx[7] = 0; + arrLineIdx[7] = -1; + if ((arrDelta[1] <= delta && arrLineIdx[1] != -1) || (arrDelta[3] <= delta && arrLineIdx[3] != -1) || (arrDelta[5] <= delta && arrLineIdx[5] != -1)) + break; + } + arrDelta[7] = delta; + + int v68 = 0; + int v69 = 0; + int v72 = 0; + int v73 = 0; + + if (arrLineIdx[1] == -1) + arrDelta[1] = 1300; + if (arrLineIdx[3] == -1) + arrDelta[3] = 1300; + if (arrLineIdx[5] == -1) + arrDelta[5] = 1300; + if (arrLineIdx[7] == -1) + arrDelta[7] = 1300; + if (arrLineIdx[1] != -1 || arrLineIdx[3] != -1 || arrLineIdx[5] != -1 || arrLineIdx[7] != -1) { + bool v23 = false; + if (arrLineIdx[5] != -1 && arrDelta[1] >= arrDelta[5] && arrDelta[3] >= arrDelta[5] && arrDelta[7] >= arrDelta[5]) { + v73 = arrLineIdx[5]; + v72 = arrDataIdx[5]; + v23 = true; + } + if (arrLineIdx[1] != -1 && !v23 && arrDelta[5] >= arrDelta[1] && arrDelta[3] >= arrDelta[1] && arrDelta[7] >= arrDelta[1]) { + v73 = arrLineIdx[1]; + v72 = arrDataIdx[1]; + v23 = true; + } + if (arrLineIdx[3] != -1 && !v23 && arrDelta[1] >= arrDelta[3] && arrDelta[5] >= arrDelta[3] && arrDelta[7] >= arrDelta[3]) { + v73 = arrLineIdx[3]; + v72 = arrDataIdx[3]; + v23 = true; + } + if (arrLineIdx[7] != -1 && !v23 && arrDelta[5] >= arrDelta[7] && arrDelta[3] >= arrDelta[7] && arrDelta[1] >= arrDelta[7]) { + v73 = arrLineIdx[7]; + v72 = arrDataIdx[7]; + } + for (int v24 = 0; v24 <= 8; v24++) { + arrLineIdx[v24] = -1; + arrDataIdx[v24] = 0; + arrDelta[v24] = 1300; + } + if (checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) { + v69 = arrLineIdx[1]; + v68 = arrDataIdx[1]; + } else if (checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _linesNumb)) { + int v27 = 0; + int v28; + for (;;) { + v28 = _vm->_globals.essai2[v27]; + int v29 = _vm->_globals.essai2[v27 + 1]; + int v66 = _vm->_globals.essai2[v27 + 2]; + v27 += 4; + + if (checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) + break; + + _vm->_globals.super_parcours[superRouteIdx] = v28; + _vm->_globals.super_parcours[superRouteIdx + 1] = v29; + _vm->_globals.super_parcours[superRouteIdx + 2] = v66; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + + _vm->_globals.essai0[superRouteIdx] = v28; + _vm->_globals.essai0[superRouteIdx + 1] = v29; + _vm->_globals.essai0[superRouteIdx + 2] = v66; + _vm->_globals.essai0[superRouteIdx + 3] = 0; + superRouteIdx += 4; + if (v28 == -1) + break;; + } + if (v28 != -1) { + v69 = arrLineIdx[1]; + v68 = arrDataIdx[1]; + } + } else { + v69 = 1; + v68 = 1; + superRouteIdx = 0; + } +LABEL_90: + if (v69 < v73) { + int v34 = v68; + for (int i = Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = Ligne[v69]._lineDataEndIdx) { + _vm->_globals.super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * v34]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * v34 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v69].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + ++v34; + } + for (int j = v69 + 1; j < v73; ++j) { + if (PLAN_TEST( + Ligne[j]._lineData[0], + Ligne[j]._lineData[1], + superRouteIdx, j, v73)) { + v69 = NV_LIGNEDEP; + v68 = NV_LIGNEOFS; + superRouteIdx = NV_POSI; + goto LABEL_90; + } + if (Ligne[j]._lineDataEndIdx - 2 > 0) { + for (int v40 = 0; v40 < Ligne[j]._lineDataEndIdx - 2; v40++) { + _vm->_globals.super_parcours[superRouteIdx] = Ligne[j]._lineData[2 * v40]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[j]._lineData[2 * v40 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[j].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + } + } + v68 = 0; + v69 = v73; + } + if (v69 > v73) { + for (int k = v68; k > 0; --k) { + _vm->_globals.super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * k]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * k + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v69].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + for (int l = v69 - 1; l > v73; --l) { + int v48 = l; + if (PLAN_TEST( + Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 2], + Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 1], + superRouteIdx, l, v73)) { + v69 = NV_LIGNEDEP; + v68 = NV_LIGNEOFS; + superRouteIdx = NV_POSI; + goto LABEL_90; + } + + for (int v49 = Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { + _vm->_globals.super_parcours[superRouteIdx] = Ligne[l]._lineData[2 * v49]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[l]._lineData[2 * v49 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[l].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + } + v68 = Ligne[v73]._lineDataEndIdx - 1; + v69 = v73; + } + if (v69 == v73) { + if (v68 <= v72) { + for (int v57 = v68; v57 < v72; v57++) { + _vm->_globals.super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v57]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v57 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v73].field6; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + } else { + for (int v53 = v68; v53 > v72; v53--) { + _vm->_globals.super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v53]; + _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v53 + 1]; + _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v73].field8; + _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + } + } + _vm->_globals.super_parcours[superRouteIdx] = -1; + _vm->_globals.super_parcours[superRouteIdx + 1] = -1; + _vm->_globals.super_parcours[superRouteIdx + 2] = -1; + _vm->_globals.super_parcours[superRouteIdx + 3] = -1; + result = &_vm->_globals.super_parcours[0]; + } else { + result = (int16 *)g_PTRNUL; + } + return result; +} + bool LinesManager::checkSmoothMove(int fromX, int fromY, int destX, int destY) { int foundLineIdx; int foundDataIdx; @@ -2375,7 +2621,7 @@ bool LinesManager::checkSmoothMove(int fromX, int fromY, int destX, int destY) { if (distY + 1 > 0) { int stepCount = 0; - while (!checkCollisionLine(newPosX, newPosY, &foundDataIdx, &foundLineIdx, 0, _linesNumb) || foundLineIdx > _vm->_objectsManager._lastLine) { + while (!checkCollisionLine(newPosX, newPosY, &foundDataIdx, &foundLineIdx, 0, _linesNumb) || foundLineIdx > _lastLine) { smoothPosX += stepX; smoothPosY += stepY; newPosX = smoothPosX / 1000; @@ -2423,7 +2669,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _vm->_linesManager._smoothMoveDirection = 6; + _smoothMoveDirection = 6; return false; } } else if (fromX < destX && destY > fromY) { @@ -2457,7 +2703,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _vm->_linesManager._smoothMoveDirection = 4; + _smoothMoveDirection = 4; return false; } } else if (fromX > destX && destY < fromY) { @@ -2484,7 +2730,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _vm->_linesManager._smoothMoveDirection = 8; + _smoothMoveDirection = 8; return false; } } else if (fromX < destX && destY < fromY) { @@ -2512,7 +2758,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _vm->_linesManager._smoothMoveDirection = 2; + _smoothMoveDirection = 2; return false; } } @@ -2637,7 +2883,7 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int collLineIdx; int collDataIdx; - for (int idx = _vm->_objectsManager._lastLine + 1; idx < _vm->_linesManager._linesNumb + 1; idx++) { + for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) { lineData = Ligne[idx]._lineData; lineDataEndIdx = Ligne[idx]._lineDataEndIdx; if (lineData[0] == paramX && lineData[1] == paramY) { @@ -2648,7 +2894,7 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, posY += 2; if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7) posX += 2; - if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine)) + if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); *foundLineIdx = collLineIdx; *foundDataIdx = collDataIdx; @@ -2662,7 +2908,7 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, posY -= 2; if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7) posX -= 2; - if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _vm->_objectsManager._lastLine)) + if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); *foundLineIdx = collLineIdx; *foundDataIdx = collDataIdx; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 046ef120dc..5a7c68c3d7 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -64,10 +64,12 @@ public: int NVPX; int NVPY; int _smoothMoveDirection; + int _lastLine; public: LinesManager(); void setParent(HopkinsEngine *vm); + void loadLines(const Common::String &file); void clearAllZones(); int checkInventoryHotspots(int posX, int posY); int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); @@ -84,6 +86,7 @@ public: int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); + int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); bool checkSmoothMove(int fromX, int fromY, int destX, int destY); bool makeSmoothMove(int fromX, int fromY, int destX, int destY); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ff6e09c3d2..b050b064cf 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -37,6 +37,8 @@ ObjectsManager::ObjectsManager() { for (int i = 0; i < 6; ++i) { Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0); } + for (int i = 0; i < 100; ++i) + Common::fill((byte *)&CarreZone[i], (byte *)&CarreZone[i] + sizeof(CarreZoneItem), 0); _priorityFl = false; _oldBorderPos = Common::Point(0, 0); @@ -60,7 +62,6 @@ ObjectsManager::ObjectsManager() { _forceZoneFl = false; _changeVerbFl = false; _verb = 0; - _lastLine = 0; _changeHeadFl = false; _disableFl = false; _twoCharactersFl = false; @@ -1714,29 +1715,6 @@ void ObjectsManager::GOHOME2() { my_anim = 0; } -/** - * Load lines - */ -void ObjectsManager::loadLines(const Common::String &file) { - _vm->_linesManager.resetLines(); - _vm->_linesManager._linesNumb = 0; - _lastLine = 0; - byte *ptr = _vm->_fileManager.loadFile(file); - for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { - _vm->_linesManager.addLine( - idx, - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4), - 1); - ++_vm->_linesManager._linesNumb; - } - _vm->_linesManager.initRoute(); - _vm->_globals.freeMemory(ptr); -} - /** * Load Zone */ @@ -1818,14 +1796,14 @@ void ObjectsManager::loadZone(const Common::String &file) { // Square Zone void ObjectsManager::CARRE_ZONE() { for (int idx = 0; idx < 100; ++idx) { - _vm->_globals.CarreZone[idx]._enabledFl = 0; - _vm->_globals.CarreZone[idx]._squareZoneFl = false; - _vm->_globals.CarreZone[idx]._left = 1280; - _vm->_globals.CarreZone[idx]._right = 0; - _vm->_globals.CarreZone[idx]._top = 460; - _vm->_globals.CarreZone[idx]._bottom = 0; - _vm->_globals.CarreZone[idx]._minZoneLineIdx = 401; - _vm->_globals.CarreZone[idx]._maxZoneLineIdx = 0; + CarreZone[idx]._enabledFl = 0; + CarreZone[idx]._squareZoneFl = false; + CarreZone[idx]._left = 1280; + CarreZone[idx]._right = 0; + CarreZone[idx]._top = 460; + CarreZone[idx]._bottom = 0; + CarreZone[idx]._minZoneLineIdx = 401; + CarreZone[idx]._maxZoneLineIdx = 0; } for (int idx = 0; idx < MAX_LINES; ++idx) { @@ -1833,33 +1811,33 @@ void ObjectsManager::CARRE_ZONE() { if (dataP == (int16 *)g_PTRNUL) continue; - int v4 = _vm->_linesManager._zoneLine[idx].field2; - _vm->_globals.CarreZone[v4]._enabledFl = 1; - if (_vm->_globals.CarreZone[v4]._maxZoneLineIdx < idx) - _vm->_globals.CarreZone[v4]._maxZoneLineIdx = idx; - if (_vm->_globals.CarreZone[v4]._minZoneLineIdx > idx) - _vm->_globals.CarreZone[v4]._minZoneLineIdx = idx; + int carreZoneId = _vm->_linesManager._zoneLine[idx].field2; + CarreZone[carreZoneId]._enabledFl = 1; + if (CarreZone[carreZoneId]._maxZoneLineIdx < idx) + CarreZone[carreZoneId]._maxZoneLineIdx = idx; + if (CarreZone[carreZoneId]._minZoneLineIdx > idx) + CarreZone[carreZoneId]._minZoneLineIdx = idx; for (int i = 0; i < _vm->_linesManager._zoneLine[idx]._count; i++) { int zoneX = *dataP++; int zoneY = *dataP++; - if (_vm->_globals.CarreZone[v4]._left >= zoneX) - _vm->_globals.CarreZone[v4]._left = zoneX; - if (_vm->_globals.CarreZone[v4]._right <= zoneX) - _vm->_globals.CarreZone[v4]._right = zoneX; - if (_vm->_globals.CarreZone[v4]._top >= zoneY) - _vm->_globals.CarreZone[v4]._top = zoneY; - if (_vm->_globals.CarreZone[v4]._bottom <= zoneY) - _vm->_globals.CarreZone[v4]._bottom = zoneY; + if (CarreZone[carreZoneId]._left >= zoneX) + CarreZone[carreZoneId]._left = zoneX; + if (CarreZone[carreZoneId]._right <= zoneX) + CarreZone[carreZoneId]._right = zoneX; + if (CarreZone[carreZoneId]._top >= zoneY) + CarreZone[carreZoneId]._top = zoneY; + if (CarreZone[carreZoneId]._bottom <= zoneY) + CarreZone[carreZoneId]._bottom = zoneY; } } for (int idx = 0; idx < 100; idx++) { - int zoneWidth = abs(_vm->_globals.CarreZone[idx]._left - _vm->_globals.CarreZone[idx]._right); - int zoneHeight = abs(_vm->_globals.CarreZone[idx]._top - _vm->_globals.CarreZone[idx]._bottom); + int zoneWidth = abs(CarreZone[idx]._left - CarreZone[idx]._right); + int zoneHeight = abs(CarreZone[idx]._top - CarreZone[idx]._bottom); if (zoneWidth == zoneHeight) - _vm->_globals.CarreZone[idx]._squareZoneFl = true; + CarreZone[idx]._squareZoneFl = true; } } @@ -1878,7 +1856,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_soundManager.WSOUND(31); _vm->_globals.iRegul = 1; _vm->_graphicsManager.loadImage("PLAN"); - loadLines("PLAN.OB2"); + _vm->_linesManager.loadLines("PLAN.OB2"); _vm->_globals.loadCache("PLAN.CA2"); loadZone("PLAN.ZO2"); _spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR"); @@ -2080,7 +2058,7 @@ LABEL_63: } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) - _vm->_globals._route = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); + _vm->_globals._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) @@ -2216,7 +2194,7 @@ void ObjectsManager::clearScreen() { _zoneNum = 0; _forceZoneFl = true; _vm->_linesManager._linesNumb = 0; - _lastLine = 0; + _vm->_linesManager._lastLine = 0; _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); @@ -2416,236 +2394,6 @@ void ObjectsManager::PACOURS_PROPRE(int16 *a1) { } } -int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { - int16 *result; - int arrDelta[10]; - int arrDataIdx[10]; - int arrLineIdx[10]; - - int clipX2 = x2; - int clipY2 = y2; - int superRouteIdx = 0; - if (x2 <= 14) - clipX2 = 15; - if (y2 <= 14) - clipY2 = 15; - if (clipX2 > _vm->_graphicsManager._maxX - 10) - clipX2 = _vm->_graphicsManager._maxX - 10; - if (clipY2 > 445) - clipY2 = 440; - - int delta = 0; - for (delta = 0; clipY2 + delta < _vm->_graphicsManager._maxY; delta++) { - if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 + delta, &arrDataIdx[5], &arrLineIdx[5], 0, _lastLine) && arrLineIdx[5] <= _lastLine) - break; - arrDataIdx[5] = 0; - arrLineIdx[5] = -1; - } - arrDelta[5] = delta; - - for (delta = 0; clipY2 - delta > _vm->_graphicsManager._minY; delta++) { - if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 - delta , &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine) && arrLineIdx[1] <= _lastLine) - break; - arrDataIdx[1] = 0; - arrLineIdx[1] = -1; - if (arrDelta[5] < delta && arrLineIdx[5] != -1) - break; - } - arrDelta[1] = delta; - - for (delta = 0; clipX2 + delta < _vm->_graphicsManager._maxX; delta++) { - if (_vm->_linesManager.checkCollisionLine(clipX2 + delta, clipY2, &arrDataIdx[3], &arrLineIdx[3], 0, _lastLine) && arrLineIdx[3] <= _lastLine) - break; - arrDataIdx[3] = 0; - arrLineIdx[3] = -1; - if (arrDelta[1] <= delta && arrLineIdx[1] != -1) - break; - if (arrDelta[5] <= delta && arrLineIdx[5] != -1) - break; - } - arrDelta[3] = delta; - - for (delta = 0; clipX2 - delta > _vm->_graphicsManager._minX; delta++) { - if (_vm->_linesManager.checkCollisionLine(clipX2 - delta, clipY2, &arrDataIdx[7], &arrLineIdx[7], 0, _lastLine) && arrLineIdx[7] <= _lastLine) - break; - arrDataIdx[7] = 0; - arrLineIdx[7] = -1; - if ((arrDelta[1] <= delta && arrLineIdx[1] != -1) || (arrDelta[3] <= delta && arrLineIdx[3] != -1) || (arrDelta[5] <= delta && arrLineIdx[5] != -1)) - break; - } - arrDelta[7] = delta; - - int v68 = 0; - int v69 = 0; - int v72 = 0; - int v73 = 0; - - if (arrLineIdx[1] == -1) - arrDelta[1] = 1300; - if (arrLineIdx[3] == -1) - arrDelta[3] = 1300; - if (arrLineIdx[5] == -1) - arrDelta[5] = 1300; - if (arrLineIdx[7] == -1) - arrDelta[7] = 1300; - if (arrLineIdx[1] != -1 || arrLineIdx[3] != -1 || arrLineIdx[5] != -1 || arrLineIdx[7] != -1) { - bool v23 = false; - if (arrLineIdx[5] != -1 && arrDelta[1] >= arrDelta[5] && arrDelta[3] >= arrDelta[5] && arrDelta[7] >= arrDelta[5]) { - v73 = arrLineIdx[5]; - v72 = arrDataIdx[5]; - v23 = true; - } - if (arrLineIdx[1] != -1 && !v23 && arrDelta[5] >= arrDelta[1] && arrDelta[3] >= arrDelta[1] && arrDelta[7] >= arrDelta[1]) { - v73 = arrLineIdx[1]; - v72 = arrDataIdx[1]; - v23 = true; - } - if (arrLineIdx[3] != -1 && !v23 && arrDelta[1] >= arrDelta[3] && arrDelta[5] >= arrDelta[3] && arrDelta[7] >= arrDelta[3]) { - v73 = arrLineIdx[3]; - v72 = arrDataIdx[3]; - v23 = true; - } - if (arrLineIdx[7] != -1 && !v23 && arrDelta[5] >= arrDelta[7] && arrDelta[3] >= arrDelta[7] && arrDelta[1] >= arrDelta[7]) { - v73 = arrLineIdx[7]; - v72 = arrDataIdx[7]; - } - for (int v24 = 0; v24 <= 8; v24++) { - arrLineIdx[v24] = -1; - arrDataIdx[v24] = 0; - arrDelta[v24] = 1300; - } - if (_vm->_linesManager.checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) { - v69 = arrLineIdx[1]; - v68 = arrDataIdx[1]; - } else if (_vm->_linesManager.checkCollisionLine(x1, y1, &arrDataIdx[1], &arrLineIdx[1], 0, _vm->_linesManager._linesNumb)) { - int v27 = 0; - int v28; - for (;;) { - v28 = _vm->_globals.essai2[v27]; - int v29 = _vm->_globals.essai2[v27 + 1]; - int v66 = _vm->_globals.essai2[v27 + 2]; - v27 += 4; - - if (_vm->_linesManager.checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) - break; - - _vm->_globals.super_parcours[superRouteIdx] = v28; - _vm->_globals.super_parcours[superRouteIdx + 1] = v29; - _vm->_globals.super_parcours[superRouteIdx + 2] = v66; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - - _vm->_globals.essai0[superRouteIdx] = v28; - _vm->_globals.essai0[superRouteIdx + 1] = v29; - _vm->_globals.essai0[superRouteIdx + 2] = v66; - _vm->_globals.essai0[superRouteIdx + 3] = 0; - superRouteIdx += 4; - if (v28 == -1) - break;; - } - if (v28 != -1) { - v69 = arrLineIdx[1]; - v68 = arrDataIdx[1]; - } - } else { - v69 = 1; - v68 = 1; - superRouteIdx = 0; - } -LABEL_90: - if (v69 < v73) { - int v34 = v68; - for (int i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = _vm->_linesManager.Ligne[v69]._lineDataEndIdx) { - _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v69]._lineData[2 * v34]; - _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v69]._lineData[2 * v34 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v69].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - ++v34; - } - for (int j = v69 + 1; j < v73; ++j) { - if (_vm->_linesManager.PLAN_TEST( - _vm->_linesManager.Ligne[j]._lineData[0], - _vm->_linesManager.Ligne[j]._lineData[1], - superRouteIdx, j, v73)) { - v69 = _vm->_linesManager.NV_LIGNEDEP; - v68 = _vm->_linesManager.NV_LIGNEOFS; - superRouteIdx = _vm->_linesManager.NV_POSI; - goto LABEL_90; - } - if (_vm->_linesManager.Ligne[j]._lineDataEndIdx - 2 > 0) { - for (int v40 = 0; v40 < _vm->_linesManager.Ligne[j]._lineDataEndIdx - 2; v40++) { - _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[j]._lineData[2 * v40]; - _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[j]._lineData[2 * v40 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[j].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - } - } - v68 = 0; - v69 = v73; - } - if (v69 > v73) { - for (int k = v68; k > 0; --k) { - _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v69]._lineData[2 * k]; - _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v69]._lineData[2 * k + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v69].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - for (int l = v69 - 1; l > v73; --l) { - int v48 = l; - if (_vm->_linesManager.PLAN_TEST( - _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2], - _vm->_linesManager.Ligne[l]._lineData[2 * _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 1], - superRouteIdx, l, v73)) { - v69 = _vm->_linesManager.NV_LIGNEDEP; - v68 = _vm->_linesManager.NV_LIGNEOFS; - superRouteIdx = _vm->_linesManager.NV_POSI; - goto LABEL_90; - } - - for (int v49 = _vm->_linesManager.Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { - _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[l]._lineData[2 * v49]; - _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[l]._lineData[2 * v49 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[l].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - } - v68 = _vm->_linesManager.Ligne[v73]._lineDataEndIdx - 1; - v69 = v73; - } - if (v69 == v73) { - if (v68 <= v72) { - for (int v57 = v68; v57 < v72; v57++) { - _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v73]._lineData[2 * v57]; - _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v73]._lineData[2 * v57 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v73].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - } else { - for (int v53 = v68; v53 > v72; v53--) { - _vm->_globals.super_parcours[superRouteIdx] = _vm->_linesManager.Ligne[v73]._lineData[2 * v53]; - _vm->_globals.super_parcours[superRouteIdx + 1] = _vm->_linesManager.Ligne[v73]._lineData[2 * v53 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = _vm->_linesManager.Ligne[v73].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - } - } - _vm->_globals.super_parcours[superRouteIdx] = -1; - _vm->_globals.super_parcours[superRouteIdx + 1] = -1; - _vm->_globals.super_parcours[superRouteIdx + 2] = -1; - _vm->_globals.super_parcours[superRouteIdx + 3] = -1; - result = &_vm->_globals.super_parcours[0]; - } else { - result = (int16 *)g_PTRNUL; - } - return result; -} - /** * Get next verb icon (or text) */ @@ -2840,17 +2588,15 @@ int ObjectsManager::MZONE() { } _vm->_globals.SegmentEnCours = 0; for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { - if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _vm->_globals.CarreZone[squareZoneId]._enabledFl == 1 - && _vm->_globals.CarreZone[squareZoneId]._left <= xp - && _vm->_globals.CarreZone[squareZoneId]._right >= xp - && _vm->_globals.CarreZone[squareZoneId]._top <= yp - && _vm->_globals.CarreZone[squareZoneId]._bottom >= yp) { - if (_vm->_globals.CarreZone[squareZoneId]._squareZoneFl) { - _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[_vm->_globals.CarreZone[squareZoneId]._minZoneLineIdx].field2; + if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && CarreZone[squareZoneId]._enabledFl == 1 + && CarreZone[squareZoneId]._left <= xp && CarreZone[squareZoneId]._right >= xp + && CarreZone[squareZoneId]._top <= yp && CarreZone[squareZoneId]._bottom >= yp) { + if (CarreZone[squareZoneId]._squareZoneFl) { + _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[CarreZone[squareZoneId]._minZoneLineIdx].field2; return _vm->_globals.oldzone_46; } - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = _vm->_globals.CarreZone[squareZoneId]._minZoneLineIdx; - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = _vm->_globals.CarreZone[squareZoneId]._maxZoneLineIdx; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = CarreZone[squareZoneId]._minZoneLineIdx; + _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = CarreZone[squareZoneId]._maxZoneLineIdx; ++_vm->_globals.SegmentEnCours; } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index edbe544365..d1a40d73d4 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -50,6 +50,17 @@ struct SpriteItem { int _reducePct; }; +struct CarreZoneItem { + int _enabledFl; + int _left; + int _right; + int _top; + int _bottom; + int _minZoneLineIdx; + int _maxZoneLineIdx; + bool _squareZoneFl; +}; + class HopkinsEngine; class ObjectsManager { @@ -80,7 +91,6 @@ public: bool _forceZoneFl; bool _changeVerbFl; int _verb; - int _lastLine; bool _changeHeadFl; bool _disableFl; bool _twoCharactersFl; @@ -91,6 +101,7 @@ public: int _jumpZone; int _oldSpriteIndex; bool _oldFlipFl; + CarreZoneItem CarreZone[101]; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -145,7 +156,6 @@ public: void checkZone(); void GOHOME(); void GOHOME2(); - void loadLines(const Common::String &file); void loadZone(const Common::String &file); void CARRE_ZONE(); void PLAN_BETA(); @@ -162,7 +172,6 @@ public: void computeAndSetSpriteSize(); void PACOURS_PROPRE(int16 *a1); - int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); void nextVerbIcon(); void handleRightButton(); int MZONE(); -- cgit v1.2.3 From 68f5da137569bb954321bf28b1f2b48f7a870534 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 14:32:05 +0100 Subject: HOPKINS: Move _maxLineIdx to LinesManager, remove a useless variable --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 4 +- engines/hopkins/hopkins.cpp | 370 ++++++++++++++++++-------------------------- engines/hopkins/lines.cpp | 9 +- engines/hopkins/lines.h | 1 + engines/hopkins/objects.cpp | 5 +- 6 files changed, 158 insertions(+), 235 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index dfd270a7e1..37ff08a7e5 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -135,9 +135,7 @@ Globals::Globals() { PERSO = 0; _screenId = 0; _prevScreenId = 0; - _maxLineLength = 0; - Max_Perso_Y = 0; - Max_Propre = 0; + _characterMaxPosY = 0; NBBLOC = 0; _menuScrollType = 0; _menuScrollSpeed = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a1688d07c8..eadabc411a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -351,9 +351,7 @@ public: int _mapCarPosX, _mapCarPosY; int _screenId; int _prevScreenId; - int Max_Propre; - int _maxLineLength; - int Max_Perso_Y; + int _characterMaxPosY; bool _disableInventFl; bool NOMARCHE; int NBBLOC; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 90978c1196..cba5693c45 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -188,9 +188,8 @@ bool HopkinsEngine::runWin95Demo() { switch (_globals._exitId) { case 1: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2, true); break; @@ -228,9 +227,8 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.fadeOutLong(); _globals._saveData->_data[svField170] = 1; } - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; @@ -241,9 +239,8 @@ bool HopkinsEngine::runWin95Demo() { break; case 5: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 455; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 455; if (_globals._saveData->_data[svField80]) { if (_globals._saveData->_data[svField80] == 1) @@ -254,9 +251,8 @@ bool HopkinsEngine::runWin95Demo() { break; case 6: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 460; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; @@ -268,16 +264,14 @@ bool HopkinsEngine::runWin95Demo() { break; case 8: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 440; - _globals._maxLineLength = 20; + _globals._characterMaxPosY = 440; + _linesManager._maxLineIdx = 20; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else @@ -289,16 +283,14 @@ bool HopkinsEngine::runWin95Demo() { break; case 11: - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; - _globals.Max_Propre = 15; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: - _globals.Max_Propre = 15; - _globals.Max_Perso_Y = 450; - _globals._maxLineLength = 20; + _globals._characterMaxPosY = 450; + _linesManager._maxLineIdx = 20; if (_globals._saveData->_data[svField225]) { if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); @@ -501,9 +493,8 @@ bool HopkinsEngine::runLinuxDemo() { break; case 1: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; @@ -544,9 +535,8 @@ bool HopkinsEngine::runLinuxDemo() { _globals._saveData->_data[svField170] = 1; } - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; @@ -557,9 +547,8 @@ bool HopkinsEngine::runLinuxDemo() { break; case 5: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 455; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 455; if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); else @@ -567,9 +556,8 @@ bool HopkinsEngine::runLinuxDemo() { break; case 6: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 460; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; @@ -581,16 +569,14 @@ bool HopkinsEngine::runLinuxDemo() { break; case 8: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 440; if (!_globals._saveData->_data[svField225]) bombExplosion(); @@ -603,16 +589,14 @@ bool HopkinsEngine::runLinuxDemo() { break; case 11: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); else @@ -620,16 +604,14 @@ bool HopkinsEngine::runLinuxDemo() { break; case 13: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; @@ -638,9 +620,8 @@ bool HopkinsEngine::runLinuxDemo() { break; case 16: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField113] == 1) { _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); @@ -650,16 +631,14 @@ bool HopkinsEngine::runLinuxDemo() { break; case 25: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); break; case 26: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); case 33: @@ -852,9 +831,8 @@ bool HopkinsEngine::runFull() { switch (_globals._exitId) { case 1: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; @@ -900,9 +878,8 @@ bool HopkinsEngine::runFull() { _graphicsManager.fadeOutLong(); _globals._saveData->_data[svField170] = 1; } - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; @@ -913,9 +890,8 @@ bool HopkinsEngine::runFull() { break; case 5: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 455; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 455; if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); else @@ -923,9 +899,8 @@ bool HopkinsEngine::runFull() { break; case 6: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 460; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; @@ -937,16 +912,14 @@ bool HopkinsEngine::runFull() { break; case 8: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else @@ -958,16 +931,14 @@ bool HopkinsEngine::runFull() { break; case 11: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); else @@ -975,16 +946,14 @@ bool HopkinsEngine::runFull() { break; case 13: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; @@ -996,9 +965,8 @@ bool HopkinsEngine::runFull() { break; case 16: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); else @@ -1006,9 +974,8 @@ bool HopkinsEngine::runFull() { break; case 17: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); else if (!_globals._saveData->_data[svField117]) @@ -1038,9 +1005,8 @@ bool HopkinsEngine::runFull() { break; case 18: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); else @@ -1048,9 +1014,8 @@ bool HopkinsEngine::runFull() { break; case 19: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); else @@ -1058,9 +1023,8 @@ bool HopkinsEngine::runFull() { break; case 20: - _globals.Max_Propre = 8; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 10; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; @@ -1080,23 +1044,20 @@ bool HopkinsEngine::runFull() { break; case 22: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); break; case 23: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); break; case 24: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField181] == 1) _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true); else @@ -1104,9 +1065,8 @@ bool HopkinsEngine::runFull() { break; case 25: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 445; if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); else @@ -1114,9 +1074,8 @@ bool HopkinsEngine::runFull() { break; case 26: - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 435; if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); else @@ -1124,9 +1083,8 @@ bool HopkinsEngine::runFull() { break; case 27: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); else @@ -1134,9 +1092,8 @@ bool HopkinsEngine::runFull() { break; case 28: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 450; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField166] != 1 || _globals._saveData->_data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); else @@ -1144,16 +1101,14 @@ bool HopkinsEngine::runFull() { break; case 29: - _globals.Max_Propre = 60; - _globals._maxLineLength = 50; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 50; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); break; case 30: - _globals.Max_Propre = 10; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; @@ -1162,9 +1117,8 @@ bool HopkinsEngine::runFull() { break; case 32: - _globals.Max_Propre = 15; - _globals._maxLineLength = 20; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 20; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); break; @@ -1183,9 +1137,8 @@ bool HopkinsEngine::runFull() { case 39: case 40: case 41: { - _globals.Max_Propre = 50; - _globals._maxLineLength = 40; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 40; + _globals._characterMaxPosY = 435; _globals._disableInventFl = false; _globals._forestFl = true; Common::String im = Common::String::format("IM%d", _globals._exitId); @@ -1209,65 +1162,56 @@ bool HopkinsEngine::runFull() { break; case 51: - _globals.Max_Propre = 20; - _globals._maxLineLength = 10; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 10; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); break; case 52: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); break; case 54: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); break; case 55: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 460; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); break; case 56: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); break; case 57: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); break; case 58: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); break; case 59: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); break; case 60: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); break; @@ -1278,79 +1222,68 @@ bool HopkinsEngine::runFull() { break; case 62: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 8; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); break; case 63: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); break; case 64: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); break; case 65: - _globals.Max_Propre = 40; - _globals._maxLineLength = 30; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 30; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); break; case 66: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); break; case 67: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 8; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); break; case 68: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 8; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); break; case 69: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); break; case 70: - _globals.Max_Propre = 8; - _globals._maxLineLength = 8; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 8; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); break; case 71: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); break; case 73: - _globals.Max_Propre = 15; - _globals._maxLineLength = 15; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 15; + _globals._characterMaxPosY = 445; if (_globals._saveData->_data[svField318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); else @@ -1422,9 +1355,8 @@ bool HopkinsEngine::runFull() { break; case 93: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 445; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 445; if (_globals._saveData->_data[svField330]) { if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM93", "IM93C", "ANIM93", "IM93", 29, true); @@ -1439,30 +1371,26 @@ bool HopkinsEngine::runFull() { break; case 94: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 440; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); break; case 95: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); break; case 96: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); break; case 97: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { _globals.iRegul = 1; @@ -1479,16 +1407,14 @@ bool HopkinsEngine::runFull() { break; case 98: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); break; case 99: - _globals.Max_Propre = 5; - _globals._maxLineLength = 5; - _globals.Max_Perso_Y = 435; + _linesManager._maxLineIdx = 5; + _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); break; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 91ab0580ca..cdf3fd0ce0 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -45,6 +45,7 @@ LinesManager::LinesManager() { NVPY = 0; _smoothMoveDirection = 0; _lastLine = 0; + _maxLineIdx = 0; } void LinesManager::setParent(HopkinsEngine *vm) { @@ -459,7 +460,7 @@ void LinesManager::initRoute() { _lastLine = lineIdx; for (int idx = 1; idx < MAX_LINES; idx++) { - if ((Ligne[idx]._lineDataEndIdx < _vm->_globals._maxLineLength) && (idx != _lastLine + 1)) { + if ((Ligne[idx]._lineDataEndIdx < _maxLineIdx) && (idx != _lastLine + 1)) { Ligne[idx].field6 = Ligne[idx - 1].field6; Ligne[idx].field8 = Ligne[idx - 1].field8; } @@ -1074,7 +1075,7 @@ LABEL_17: break; v75 = foundLineIdx; - if (_vm->_globals.Max_Perso_Y <= v35 || v71 <= v35) + if (_vm->_globals._characterMaxPosY <= v35 || v71 <= v35) break; } int v36 = a5; @@ -1246,8 +1247,8 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { clipDestY = 20; if (clipDestX > _vm->_graphicsManager._maxX - 10) clipDestX = _vm->_graphicsManager._maxX - 10; - if (clipDestY > _vm->_globals.Max_Perso_Y) - clipDestY = _vm->_globals.Max_Perso_Y; + if (clipDestY > _vm->_globals._characterMaxPosY) + clipDestY = _vm->_globals._characterMaxPosY; if (abs(fromX - clipDestX) <= 3 && abs(fromY - clipDestY) <= 3) return (int16 *)g_PTRNUL; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 5a7c68c3d7..de07848e2d 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -65,6 +65,7 @@ public: int NVPY; int _smoothMoveDirection; int _lastLine; + int _maxLineIdx; public: LinesManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b050b064cf..3b3567e2be 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1844,9 +1844,8 @@ void ObjectsManager::CARRE_ZONE() { void ObjectsManager::PLAN_BETA() { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; - _vm->_globals.Max_Propre = 1; - _vm->_globals._maxLineLength = 1; - _vm->_globals.Max_Perso_Y = 440; + _vm->_linesManager._maxLineIdx = 1; + _vm->_globals._characterMaxPosY = 440; _vm->_globals.PLAN_FLAG = true; _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; -- cgit v1.2.3 From 8de1b1b9963604b9d7b4e9aff6a64df6a14062be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 14:58:47 +0100 Subject: HOPKINS: Move some more variables from Globals to LinesManager --- engines/hopkins/globals.cpp | 17 +- engines/hopkins/globals.h | 4 - engines/hopkins/lines.cpp | 537 ++++++++++++++++++++++---------------------- engines/hopkins/lines.h | 4 + engines/hopkins/objects.cpp | 10 +- 5 files changed, 284 insertions(+), 288 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 37ff08a7e5..f3988f2bdf 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -99,8 +99,6 @@ Globals::Globals() { } for (int i = 0; i < 500; ++i) _spriteSize[i] = 0; - for (int i = 0; i < 32002; ++i) - super_parcours[i] = 0; for (int i = 0; i < 70; ++i) Common::fill((byte *)&Hopkins[i], (byte *)&Hopkins[i] + sizeof(HopkinsItem), 0); @@ -176,9 +174,6 @@ Globals::Globals() { SPRITE_ECRAN = NULL; _saveData = NULL; BUFFERTAPE = NULL; - essai0 = NULL; - essai1 = NULL; - essai2 = NULL; inventaire2 = NULL; GESTE = NULL; _inventoryObject = NULL; @@ -311,9 +306,9 @@ void Globals::clearAll() { ZONEP[idx]._spriteIndex = 0; } - essai0 = (int16 *)g_PTRNUL; - essai1 = (int16 *)g_PTRNUL; - essai2 = (int16 *)g_PTRNUL; + _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; + _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; + _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; BufLig = (int16 *)g_PTRNUL; _route = (int16 *)g_PTRNUL; @@ -339,9 +334,9 @@ void Globals::clearAll() { _saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde)); memset(_saveData, 0, sizeof(Sauvegarde)); - essai0 = (int16 *)BUFFERTAPE; - essai1 = (int16 *)(BUFFERTAPE + 25000); - essai2 = (int16 *)(BUFFERTAPE + 50000); + _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; + _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); + _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); BufLig = (int16 *)(BUFFERTAPE + 75000); _boxWidth = 240; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index eadabc411a..58a45c153e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -301,7 +301,6 @@ public: int BOBZONE[105]; bool BOBZONE_FLAG[105]; int _spriteSize[500]; - int16 super_parcours[32002]; HopkinsItem Hopkins[70]; int _inventory[36]; SortItem _sortedDisplay[51]; @@ -324,9 +323,6 @@ public: byte *SPRITE_ECRAN; Sauvegarde *_saveData; byte *BUFFERTAPE; - int16 *essai0; - int16 *essai1; - int16 *essai2; byte *inventaire2; byte *GESTE; int _curObjectIndex; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index cdf3fd0ce0..2b0dd0ed0d 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -36,6 +36,8 @@ LinesManager::LinesManager() { for (int i = 0; i < 4000; ++i) { Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0); } + for (int i = 0; i < 32002; ++i) + super_parcours[i] = 0; _linesNumb = 0; NV_LIGNEDEP = 0; @@ -46,6 +48,9 @@ LinesManager::LinesManager() { _smoothMoveDirection = 0; _lastLine = 0; _maxLineIdx = 0; + essai0 = NULL; + essai1 = NULL; + essai2 = NULL; } void LinesManager::setParent(HopkinsEngine *vm) { @@ -149,9 +154,7 @@ int LinesManager::checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastR * Remove Zone Line */ void LinesManager::removeZoneLine(int idx) { - if (idx > MAX_LINES) - error("Attempting to remove a line obstacle > MAX_LIGNE."); - + assert (idx <= MAX_LINES); _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); } @@ -165,9 +168,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ _vm->_globals.BOBZONE_FLAG[bobZoneIdx] = true; _vm->_globals.BOBZONE[bobZoneIdx] = a3; } else { - if (idx > MAX_LINES) - error("Attempting to add a line obstacle > MAX_LIGNE."); - + assert (idx <= MAX_LINES); _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); int v8 = abs(a2 - a4); @@ -810,17 +811,17 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 1) { for (int v22 = 0; v22 < v39; v22++) { if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_vm->_globals.super_parcours[0], 4); + v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &super_parcours[0], 4); if (v23 == -1) return false; v7 = v23; if (NVPY != -1) v22 = NVPY - v40; } - _vm->_globals.super_parcours[v7] = v41; - _vm->_globals.super_parcours[v7 + 1] = v40 - v22; - _vm->_globals.super_parcours[v7 + 2] = 1; - _vm->_globals.super_parcours[v7 + 3] = 0; + super_parcours[v7] = v41; + super_parcours[v7 + 1] = v40 - v22; + super_parcours[v7 + 2] = 1; + super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -831,17 +832,17 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_vm->_globals.super_parcours[0], 4); + v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &super_parcours[0], 4); if (v26 == -1) return false; v7 = v26; if (NVPY != -1) v25 = v40 - NVPY; } - _vm->_globals.super_parcours[v7] = v41; - _vm->_globals.super_parcours[v7 + 1] = v25 + v40; - _vm->_globals.super_parcours[v7 + 2] = 5; - _vm->_globals.super_parcours[v7 + 3] = 0; + super_parcours[v7] = v41; + super_parcours[v7 + 1] = v25 + v40; + super_parcours[v7 + 2] = 5; + super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -852,17 +853,17 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_vm->_globals.super_parcours[0], 4); + v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &super_parcours[0], 4); if (v29 == -1) return false; v7 = v29; if (NVPX != -1) v28 = v41 - NVPX; } - _vm->_globals.super_parcours[v7] = v41 - v28; - _vm->_globals.super_parcours[v7 + 1] = v40; - _vm->_globals.super_parcours[v7 + 2] = 7; - _vm->_globals.super_parcours[v7 + 3] = 0; + super_parcours[v7] = v41 - v28; + super_parcours[v7 + 1] = v40; + super_parcours[v7 + 2] = 7; + super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -873,17 +874,17 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_vm->_globals.super_parcours[0], 4); + v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &super_parcours[0], 4); if (v32 == -1) return false; v7 = v32; if (NVPX != -1) v31 = NVPX - v41; } - _vm->_globals.super_parcours[v7] = v31 + v41; - _vm->_globals.super_parcours[v7 + 1] = v40; - _vm->_globals.super_parcours[v7 + 2] = 3; - _vm->_globals.super_parcours[v7 + 3] = 0; + super_parcours[v7] = v31 + v41; + super_parcours[v7 + 1] = v40; + super_parcours[v7 + 2] = 3; + super_parcours[v7 + 3] = 0; v7 += 4; } NV_LIGNEDEP = v36; @@ -1261,7 +1262,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } if (PARC_PERS(fromX, fromY, clipDestX, clipDestY, -1, -1, 0) == 1) - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; int v14 = 0; for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { @@ -1446,22 +1447,22 @@ LABEL_201: if (v113 == 1) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &_vm->_globals.super_parcours[0], 4); + int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &super_parcours[0], 4); if (v58 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } v112 = v58; if (NVPY != -1) deltaY = fromY - NVPY; } - _vm->_globals.super_parcours[v112] = fromX; - _vm->_globals.super_parcours[v112 + 1] = fromY - deltaY; - _vm->_globals.super_parcours[v112 + 2] = 1; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = fromX; + super_parcours[v112 + 1] = fromY - deltaY; + super_parcours[v112 + 2] = 1; + super_parcours[v112 + 3] = 0; v112 += 4; } } @@ -1469,66 +1470,66 @@ LABEL_201: for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &_vm->_globals.super_parcours[0], 4); + int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &super_parcours[0], 4); if (v61 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } v112 = v61; if (NVPY != -1) deltaY = NVPY - fromY; } - _vm->_globals.super_parcours[v112] = fromX; - _vm->_globals.super_parcours[v112 + 1] = deltaY + fromY; - _vm->_globals.super_parcours[v112 + 2] = 5; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = fromX; + super_parcours[v112 + 1] = deltaY + fromY; + super_parcours[v112 + 2] = 5; + super_parcours[v112 + 3] = 0; v112 += 4; } } if (v113 == 7) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &_vm->_globals.super_parcours[0], 4); + int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0], 4); if (v64 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } v112 = v64; if (NVPX != -1) deltaX = fromX - NVPX; } - _vm->_globals.super_parcours[v112] = fromX - deltaX; - _vm->_globals.super_parcours[v112 + 1] = fromY; - _vm->_globals.super_parcours[v112 + 2] = 7; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = fromX - deltaX; + super_parcours[v112 + 1] = fromY; + super_parcours[v112 + 2] = 7; + super_parcours[v112 + 3] = 0; v112 += 4; } } if (v113 == 3) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &_vm->_globals.super_parcours[0], 4); + int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0], 4); if (v67 == -1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; - return &_vm->_globals.super_parcours[0]; + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } v112 = v67; if (NVPX != -1) deltaX = NVPX - fromX; } - _vm->_globals.super_parcours[v112] = deltaX + fromX; - _vm->_globals.super_parcours[v112 + 1] = fromY; - _vm->_globals.super_parcours[v112 + 2] = 3; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = deltaX + fromX; + super_parcours[v112 + 1] = fromY; + super_parcours[v112 + 2] = 3; + super_parcours[v112 + 3] = 0; v112 += 4; } } @@ -1538,10 +1539,10 @@ LABEL_234: for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { v119 = Ligne[v115]._lineData[2 * i]; v118 = Ligne[v115]._lineData[2 * i + 1]; - _vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * i]; - _vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; - _vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field6; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = Ligne[v115]._lineData[2 * i]; + super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; + super_parcours[v112 + 2] = Ligne[v115].field6; + super_parcours[v112 + 3] = 0; v112 += 4; } for (int v116 = v115 + 1; v116 < v121; v116++) { @@ -1550,15 +1551,15 @@ LABEL_234: for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { v119 = Ligne[v110]._lineData[2 * v72]; v118 = Ligne[v110]._lineData[2 * v72 + 1]; - _vm->_globals.super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; - _vm->_globals.super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; - _vm->_globals.super_parcours[v112 + 2] = Ligne[v110].field6; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; + super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; + super_parcours[v112 + 2] = Ligne[v110].field6; + super_parcours[v112 + 3] = 0; v112 += 4; if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; if (v78 == 2) { v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; @@ -1573,7 +1574,7 @@ LABEL_234: } int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); if (v79 == 1) - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; if (v79 == 2) { v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; @@ -1591,25 +1592,25 @@ LABEL_234: v119 = Ligne[v115]._lineData[2 * dataIdx]; v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; - _vm->_globals.super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; - _vm->_globals.super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; - _vm->_globals.super_parcours[v112 + 2] = Ligne[v115].field8; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v115].field8; + super_parcours[v112 + 3] = 0; v112 += 4; } for (int v117 = v115 - 1; v117 > v121; v117--) { for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { v119 = Ligne[v117]._lineData[2 * dataIdx]; v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; - _vm->_globals.super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; - _vm->_globals.super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; - _vm->_globals.super_parcours[v112 + 2] = Ligne[v117].field8; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v117].field8; + super_parcours[v112 + 3] = 0; v112 += 4; if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; if (v88 == 2) { v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; @@ -1622,7 +1623,7 @@ LABEL_234: } int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v89 == 1) - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; if (v89 == 2) { v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; @@ -1638,39 +1639,39 @@ LABEL_234: if (v115 == v121) { if (v114 <= v120) { for (int dataIdx = v114; dataIdx < v120; dataIdx++) { - _vm->_globals.super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; - _vm->_globals.super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; - _vm->_globals.super_parcours[v112 + 2] = Ligne[v121].field6; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v121].field6; + super_parcours[v112 + 3] = 0; v112 += 4; } } else { for (int dataIdx = v114; dataIdx > v120; dataIdx--) { - _vm->_globals.super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; - _vm->_globals.super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; - _vm->_globals.super_parcours[v112 + 2] = Ligne[v121].field8; - _vm->_globals.super_parcours[v112 + 3] = 0; + super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v121].field8; + super_parcours[v112 + 3] = 0; v112 += 4; } } } if (PARC_PERS( - _vm->_globals.super_parcours[v112 - 4], - _vm->_globals.super_parcours[v112 - 3], + super_parcours[v112 - 4], + super_parcours[v112 - 3], clipDestX, clipDestY, -1, -1, v112) != 1) { - _vm->_globals.super_parcours[v112] = -1; - _vm->_globals.super_parcours[v112 + 1] = -1; - _vm->_globals.super_parcours[v112 + 2] = -1; - _vm->_globals.super_parcours[v112 + 3] = -1; + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; } - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; } - return &_vm->_globals.super_parcours[0]; + return &super_parcours[0]; } int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7) { @@ -1784,29 +1785,29 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, v109 = curY; if (destX >= curX - 2 && destX <= curX + 2 && destY >= curY - 2 && destY <= curY + 2) { LABEL_149: - _vm->_globals.essai0[v115] = -1; - _vm->_globals.essai0[v115 + 1] = -1; - _vm->_globals.essai0[v115 + 2] = -1; + essai0[v115] = -1; + essai0[v115 + 1] = -1; + essai0[v115 + 2] = -1; LABEL_150: if (v115) { v116 = 0; for (;;) { - _vm->_globals.super_parcours[v137] = _vm->_globals.essai0[v116]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai0[v116 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai0[v116 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai0[v116]; + super_parcours[v137 + 1] = essai0[v116 + 1]; + super_parcours[v137 + 2] = essai0[v116 + 2]; + super_parcours[v137 + 3] = 0; v116 += 3; v137 += 4; - if (_vm->_globals.essai0[v116] == -1 && _vm->_globals.essai0[v116 + 1] == -1) + if (essai0[v116] == -1 && essai0[v116 + 1] == -1) break; } } - _vm->_globals.super_parcours[v137] = -1; - _vm->_globals.super_parcours[v137 + 1] = -1; - _vm->_globals.super_parcours[v137 + 2] = -1; - _vm->_globals.super_parcours[v137 + 3] = -1; + super_parcours[v137] = -1; + super_parcours[v137 + 1] = -1; + super_parcours[v137 + 2] = -1; + super_parcours[v137 + 3] = -1; return 1; } distX = abs(curX - destX); @@ -1944,9 +1945,9 @@ LABEL_72: if (v108 + 1 <= 0) goto LABEL_149; while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { - _vm->_globals.essai0[v115] = v104; - _vm->_globals.essai0[v115 + 1] = v103; - _vm->_globals.essai0[v115 + 2] = newDirection; + essai0[v115] = v104; + essai0[v115 + 1] = v103; + essai0[v115 + 2] = newDirection; v106 += v102; v105 += v100; v104 = v106 / 1000; @@ -1958,7 +1959,7 @@ LABEL_72: } if (_lastLine >= v142) goto LABEL_157; - v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, _vm->_globals.essai0, 3); + v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, essai0, 3); if (v24 == -1) goto LABEL_150; v115 = v24; @@ -1982,9 +1983,9 @@ LABEL_72: if (checkCollisionLine(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, &v143, &v142, 0, _linesNumb)) break; - _vm->_globals.essai0[v115] = _smoothRoute[v14]._posX; - _vm->_globals.essai0[v115 + 1] = _smoothRoute[v14]._posY; - _vm->_globals.essai0[v115 + 2] = newDirection; + essai0[v115] = _smoothRoute[v14]._posX; + essai0[v115 + 1] = _smoothRoute[v14]._posY; + essai0[v115 + 2] = newDirection; v115 += 3; ++v14; if (v126) { @@ -1998,9 +1999,9 @@ LABEL_72: v142 = -1; LABEL_157: - _vm->_globals.essai0[v115] = -1; - _vm->_globals.essai0[v115 + 1] = -1; - _vm->_globals.essai0[v115 + 2] = -1; + essai0[v115] = -1; + essai0[v115 + 1] = -1; + essai0[v115 + 2] = -1; v117 = 0; v33 = v98; @@ -2014,9 +2015,9 @@ LABEL_165: if (v113 > destX) { v36 = v113; while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) { - _vm->_globals.essai1[v117] = v36; - _vm->_globals.essai1[v117 + 1] = v92; - _vm->_globals.essai1[v117 + 2] = 7; + essai1[v117] = v36; + essai1[v117 + 1] = v92; + essai1[v117 + 2] = 7; v117 += 3; --v36; if (destX >= v36) @@ -2030,7 +2031,7 @@ LABEL_181: for (int v43 = v92; v43 > destY; v43--) { if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { if (_lastLine < v140) { - int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, _vm->_globals.essai1, 3); + int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, essai1, 3); if (v44 == -1) goto LABEL_195; v117 = v44; @@ -2046,40 +2047,40 @@ LABEL_181: if (v140 <= _lastLine) goto LABEL_202; } - _vm->_globals.essai1[v117] = destX; - _vm->_globals.essai1[v117 + 1] = v43; - _vm->_globals.essai1[v117 + 2] = 1; + essai1[v117] = destX; + essai1[v117 + 1] = v43; + essai1[v117 + 2] = 1; v117 += 3; } LABEL_194: - _vm->_globals.essai1[v117] = -1; - _vm->_globals.essai1[v117 + 1] = -1; - _vm->_globals.essai1[v117 + 2] = -1; + essai1[v117] = -1; + essai1[v117 + 1] = -1; + essai1[v117 + 2] = -1; LABEL_195: if (v117) { v118 = 0; for (;;) { - _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v118]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v118 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v118 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai1[v118]; + super_parcours[v137 + 1] = essai1[v118 + 1]; + super_parcours[v137 + 2] = essai1[v118 + 2]; + super_parcours[v137 + 3] = 0; v118 += 3; v137 += 4; - if (_vm->_globals.essai1[v118] == -1 && _vm->_globals.essai1[v118 + 1] == -1) + if (essai1[v118] == -1 && essai1[v118 + 1] == -1) break; } } - _vm->_globals.super_parcours[v137] = -1; - _vm->_globals.super_parcours[v137 + 1] = -1; - _vm->_globals.super_parcours[v137 + 2] = -1; - _vm->_globals.super_parcours[v137 + 3] = -1; + super_parcours[v137] = -1; + super_parcours[v137 + 1] = -1; + super_parcours[v137 + 2] = -1; + super_parcours[v137 + 3] = -1; return 1; } v39 = v92; for (;;) { if (checkCollisionLine(destX, v39, &v141, &v140, 0, _linesNumb)) { if (_lastLine < v140) { - v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, _vm->_globals.essai1, 3); + v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, essai1, 3); if (v40 == -1) goto LABEL_195; v117 = v40; @@ -2096,9 +2097,9 @@ LABEL_195: goto LABEL_202; } - _vm->_globals.essai1[v117] = destX; - _vm->_globals.essai1[v117 + 1] = v39; - _vm->_globals.essai1[v117 + 2] = 5; + essai1[v117] = destX; + essai1[v117 + 1] = v39; + essai1[v117 + 2] = 5; v117 += 3; ++v39; if (destY <= v39) @@ -2106,9 +2107,9 @@ LABEL_195: } } while (!checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { - _vm->_globals.essai1[v117] = v33; - _vm->_globals.essai1[v117 + 1] = v92; - _vm->_globals.essai1[v117 + 2] = 3; + essai1[v117] = v33; + essai1[v117 + 1] = v92; + essai1[v117 + 2] = 3; v117 += 3; ++v33; if (destX <= v33) @@ -2118,9 +2119,9 @@ LABEL_168: if (v140 > _lastLine) v140 = -1; LABEL_202: - _vm->_globals.essai1[v117] = -1; - _vm->_globals.essai1[v117 + 1] = -1; - _vm->_globals.essai1[v117 + 2] = -1; + essai1[v117] = -1; + essai1[v117 + 1] = -1; + essai1[v117 + 2] = -1; v117 = 0; v54 = v98; v93 = v97; @@ -2131,9 +2132,9 @@ LABEL_203: if (v93 < destY) { v55 = v93; while (!checkCollisionLine(v114, v55, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - _vm->_globals.essai2[v117] = v114; - _vm->_globals.essai2[v117 + 1] = v55; - _vm->_globals.essai2[v117 + 2] = 5; + essai2[v117] = v114; + essai2[v117 + 1] = v55; + essai2[v117 + 2] = 5; v117 += 3; ++v55; if (destY <= v55) @@ -2145,9 +2146,9 @@ LABEL_211: if (v93 > destY) { v58 = v93; while (!checkCollisionLine(v114, v58, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - _vm->_globals.essai2[v117] = v114; - _vm->_globals.essai2[v117 + 1] = v58; - _vm->_globals.essai2[v117 + 2] = 1; + essai2[v117] = v114; + essai2[v117 + 1] = v58; + essai2[v117 + 2] = 1; v117 += 3; --v58; if (destY >= v58) @@ -2157,61 +2158,61 @@ LABEL_214: if (collLineIdx > _lastLine) collLineIdx = -1; LABEL_249: - _vm->_globals.essai2[v117] = -1; - _vm->_globals.essai2[v117 + 1] = -1; - _vm->_globals.essai2[v117 + 2] = -1; + essai2[v117] = -1; + essai2[v117 + 1] = -1; + essai2[v117 + 2] = -1; if (!v136) { if (a6 > foundLineIdx) { - if (_vm->_globals.essai0[0] != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { + if (essai0[0] != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v120 = 0; for (;;) { - _vm->_globals.super_parcours[v137] = _vm->_globals.essai0[v120]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai0[v120 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai0[v120 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai0[v120]; + super_parcours[v137 + 1] = essai0[v120 + 1]; + super_parcours[v137 + 2] = essai0[v120 + 2]; + super_parcours[v137 + 3] = 0; v120 += 3; v137 += 4; - if (_vm->_globals.essai0[v120] == -1 && _vm->_globals.essai0[v120 + 1] == -1) + if (essai0[v120] == -1 && essai0[v120 + 1] == -1) break; } NV_POSI = v137; return 2; } - if (_vm->_globals.essai1[0] != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { + if (essai1[0] != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v121 = 0; for (;;) { assert(v137 <= 32000); - _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v121]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v121 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v121 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai1[v121]; + super_parcours[v137 + 1] = essai1[v121 + 1]; + super_parcours[v137 + 2] = essai1[v121 + 2]; + super_parcours[v137 + 3] = 0; v121 += 3; v137 += 4; - if (_vm->_globals.essai1[v121] == -1 && _vm->_globals.essai1[v121 + 1] == -1) + if (essai1[v121] == -1 && essai1[v121 + 1] == -1) break; } NV_POSI = v137; return 2; } - if (_vm->_globals.essai2[0] != -1) { + if (essai2[0] != -1) { if (foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { NV_LIGNEDEP = collLineIdx; NV_LIGNEOFS = collDataIdx; v122 = 0; for (;;) { assert(v137 <= 32000); - _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v122]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v122 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v122 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai2[v122]; + super_parcours[v137 + 1] = essai2[v122 + 1]; + super_parcours[v137 + 2] = essai2[v122 + 2]; + super_parcours[v137 + 3] = 0; v122 += 3; v137 += 4; - if (_vm->_globals.essai2[v122] == -1 && _vm->_globals.essai2[v122 + 1] == -1) + if (essai2[v122] == -1 && essai2[v122 + 1] == -1) break; }; NV_POSI = v137; @@ -2226,55 +2227,55 @@ LABEL_249: v142 = 1300; if (collLineIdx == -1) v142 = 1300; - if (_vm->_globals.essai1[0] != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { + if (essai1[0] != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v123 = 0; for (;;) { assert(137 <= 32000); - _vm->_globals.super_parcours[v137] = _vm->_globals.essai1[v123]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai1[v123 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai1[v123 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai1[v123]; + super_parcours[v137 + 1] = essai1[v123 + 1]; + super_parcours[v137 + 2] = essai1[v123 + 2]; + super_parcours[v137 + 3] = 0; v123 += 3; v137 += 4; - if (_vm->_globals.essai1[v123] == -1 && _vm->_globals.essai1[v123 + 1] == -1) + if (essai1[v123] == -1 && essai1[v123 + 1] == -1) break; } NV_POSI = v137; return 2; } - if (_vm->_globals.essai2[0] != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { + if (essai2[0] != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { NV_LIGNEDEP = collLineIdx; NV_LIGNEOFS = collDataIdx; v124 = 0; for (;;) { assert(v137 <= 32000); - _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v124]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v124 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v124 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai2[v124]; + super_parcours[v137 + 1] = essai2[v124 + 1]; + super_parcours[v137 + 2] = essai2[v124 + 2]; + super_parcours[v137 + 3] = 0; v124 += 3; v137 += 4; - if (_vm->_globals.essai2[v124] == -1 && _vm->_globals.essai2[v124 + 1] == -1) + if (essai2[v124] == -1 && essai2[v124 + 1] == -1) break; } NV_POSI = v137; return 2; } - if (_vm->_globals.essai1[0] != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { + if (essai1[0] != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v125 = 0; for (;;) { assert(137 <= 32000); - _vm->_globals.super_parcours[v137] = _vm->_globals.essai0[v125]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai0[v125 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai0[v125 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai0[v125]; + super_parcours[v137 + 1] = essai0[v125 + 1]; + super_parcours[v137 + 2] = essai0[v125 + 2]; + super_parcours[v137 + 3] = 0; v125 += 3; v137 += 4; - if (_vm->_globals.essai0[v125] == -1 && _vm->_globals.essai0[v125 + 1] == -1) + if (essai0[v125] == -1 && essai0[v125 + 1] == -1) break; } @@ -2290,7 +2291,7 @@ LABEL_217: for (int v61 = v114; v61 < destX; v61++) { if (checkCollisionLine(v61, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { if (_lastLine < collLineIdx) { - int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, _vm->_globals.essai2, 3); + int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, essai2, 3); if (v62 == -1) goto LABEL_195; v117 = v62; @@ -2309,9 +2310,9 @@ LABEL_217: goto LABEL_249; } - _vm->_globals.essai2[v117] = v61; - _vm->_globals.essai2[v117 + 1] = destY; - _vm->_globals.essai2[v117 + 2] = 3; + essai2[v117] = v61; + essai2[v117 + 1] = destY; + essai2[v117 + 2] = 3; v117 += 3; } } @@ -2319,7 +2320,7 @@ LABEL_217: for (int v65 = v114; v65 > destX; v65--) { if (checkCollisionLine(v65, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { if (_lastLine < collLineIdx) { - v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, _vm->_globals.essai2, 3); + v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, essai2, 3); if (v66 == -1) goto LABEL_242; v117 = v66; @@ -2335,35 +2336,35 @@ LABEL_217: if (collLineIdx <= _lastLine) goto LABEL_249; } - _vm->_globals.essai2[v117] = v65; - _vm->_globals.essai2[v117 + 1] = destY; - _vm->_globals.essai2[v117 + 2] = 7; + essai2[v117] = v65; + essai2[v117 + 1] = destY; + essai2[v117 + 2] = 7; v117 += 3; } } collLineIdx = -1; LABEL_241: - _vm->_globals.essai2[v117] = -1; - _vm->_globals.essai2[v117 + 1] = -1; - _vm->_globals.essai2[v117 + 2] = -1; + essai2[v117] = -1; + essai2[v117 + 1] = -1; + essai2[v117 + 2] = -1; LABEL_242: if (v117) { v119 = 0; for (;;) { - _vm->_globals.super_parcours[v137] = _vm->_globals.essai2[v119]; - _vm->_globals.super_parcours[v137 + 1] = _vm->_globals.essai2[v119 + 1]; - _vm->_globals.super_parcours[v137 + 2] = _vm->_globals.essai2[v119 + 2]; - _vm->_globals.super_parcours[v137 + 3] = 0; + super_parcours[v137] = essai2[v119]; + super_parcours[v137 + 1] = essai2[v119 + 1]; + super_parcours[v137 + 2] = essai2[v119 + 2]; + super_parcours[v137 + 3] = 0; v119 += 3; v137 += 4; - if (_vm->_globals.essai2[v119] == -1 && _vm->_globals.essai2[v119 + 1] == -1) + if (essai2[v119] == -1 && essai2[v119 + 1] == -1) break; } } - _vm->_globals.super_parcours[v137] = -1; - _vm->_globals.super_parcours[v137 + 1] = -1; - _vm->_globals.super_parcours[v137 + 2] = -1; - _vm->_globals.super_parcours[v137 + 3] = -1; + super_parcours[v137] = -1; + super_parcours[v137 + 1] = -1; + super_parcours[v137 + 2] = -1; + super_parcours[v137 + 3] = -1; return 1; } @@ -2472,23 +2473,23 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int v27 = 0; int v28; for (;;) { - v28 = _vm->_globals.essai2[v27]; - int v29 = _vm->_globals.essai2[v27 + 1]; - int v66 = _vm->_globals.essai2[v27 + 2]; + v28 = essai2[v27]; + int v29 = essai2[v27 + 1]; + int v66 = essai2[v27 + 2]; v27 += 4; if (checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) break; - _vm->_globals.super_parcours[superRouteIdx] = v28; - _vm->_globals.super_parcours[superRouteIdx + 1] = v29; - _vm->_globals.super_parcours[superRouteIdx + 2] = v66; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = v28; + super_parcours[superRouteIdx + 1] = v29; + super_parcours[superRouteIdx + 2] = v66; + super_parcours[superRouteIdx + 3] = 0; - _vm->_globals.essai0[superRouteIdx] = v28; - _vm->_globals.essai0[superRouteIdx + 1] = v29; - _vm->_globals.essai0[superRouteIdx + 2] = v66; - _vm->_globals.essai0[superRouteIdx + 3] = 0; + essai0[superRouteIdx] = v28; + essai0[superRouteIdx + 1] = v29; + essai0[superRouteIdx + 2] = v66; + essai0[superRouteIdx + 3] = 0; superRouteIdx += 4; if (v28 == -1) break;; @@ -2506,10 +2507,10 @@ LABEL_90: if (v69 < v73) { int v34 = v68; for (int i = Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = Ligne[v69]._lineDataEndIdx) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * v34]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * v34 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v69].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * v34]; + super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * v34 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v69].field6; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; ++v34; } @@ -2525,10 +2526,10 @@ LABEL_90: } if (Ligne[j]._lineDataEndIdx - 2 > 0) { for (int v40 = 0; v40 < Ligne[j]._lineDataEndIdx - 2; v40++) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[j]._lineData[2 * v40]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[j]._lineData[2 * v40 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[j].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[j]._lineData[2 * v40]; + super_parcours[superRouteIdx + 1] = Ligne[j]._lineData[2 * v40 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[j].field6; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } @@ -2538,10 +2539,10 @@ LABEL_90: } if (v69 > v73) { for (int k = v68; k > 0; --k) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * k]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * k + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v69].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * k]; + super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * k + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v69].field8; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } for (int l = v69 - 1; l > v73; --l) { @@ -2557,10 +2558,10 @@ LABEL_90: } for (int v49 = Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[l]._lineData[2 * v49]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[l]._lineData[2 * v49 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[l].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[l]._lineData[2 * v49]; + super_parcours[superRouteIdx + 1] = Ligne[l]._lineData[2 * v49 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[l].field8; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } @@ -2570,27 +2571,27 @@ LABEL_90: if (v69 == v73) { if (v68 <= v72) { for (int v57 = v68; v57 < v72; v57++) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v57]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v57 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v73].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v57]; + super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v57 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v73].field6; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } else { for (int v53 = v68; v53 > v72; v53--) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v53]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v53 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[v73].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v53]; + super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v53 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v73].field8; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } } - _vm->_globals.super_parcours[superRouteIdx] = -1; - _vm->_globals.super_parcours[superRouteIdx + 1] = -1; - _vm->_globals.super_parcours[superRouteIdx + 2] = -1; - _vm->_globals.super_parcours[superRouteIdx + 3] = -1; - result = &_vm->_globals.super_parcours[0]; + super_parcours[superRouteIdx] = -1; + super_parcours[superRouteIdx + 1] = -1; + super_parcours[superRouteIdx + 2] = -1; + super_parcours[superRouteIdx + 3] = -1; + result = &super_parcours[0]; } else { result = (int16 *)g_PTRNUL; } @@ -2856,20 +2857,20 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int superRouteIdx = a3; if (v33 == 1) { - _vm->_globals.essai0 = _vm->_globals.essai0; + essai0 = essai0; for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * i]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * i + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[idxTest].field6; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * i]; + super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * i + 1]; + super_parcours[superRouteIdx + 2] = Ligne[idxTest].field6; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } else if (v33 == 2) { for (int v19 = Ligne[idxTest]._lineDataEndIdx - 1; v19 > -1; v19--) { - _vm->_globals.super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * v19]; - _vm->_globals.super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * v19 + 1]; - _vm->_globals.super_parcours[superRouteIdx + 2] = Ligne[idxTest].field8; - _vm->_globals.super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * v19]; + super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * v19 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[idxTest].field8; + super_parcours[superRouteIdx + 3] = 0; superRouteIdx += 4; } } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index de07848e2d..d31c34df59 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -66,6 +66,10 @@ public: int _smoothMoveDirection; int _lastLine; int _maxLineIdx; + int16 super_parcours[32002]; + int16 *essai0; + int16 *essai1; + int16 *essai2; public: LinesManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3b3567e2be..0633320700 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1989,14 +1989,14 @@ void ObjectsManager::handleLeftButton() { return; int routeIdx = 0; do { - _vm->_globals.essai2[routeIdx] = _vm->_globals._route[routeIdx]; + _vm->_linesManager.essai2[routeIdx] = _vm->_globals._route[routeIdx]; ++routeIdx; } while (_vm->_globals._route[routeIdx] != -1); - _vm->_globals.essai2[routeIdx] = -1; - _vm->_globals.essai2[routeIdx + 1] = -1; - _vm->_globals.essai2[routeIdx + 2] = -1; - _vm->_globals.essai2[routeIdx + 3] = -1; + _vm->_linesManager.essai2[routeIdx] = -1; + _vm->_linesManager.essai2[routeIdx + 1] = -1; + _vm->_linesManager.essai2[routeIdx + 2] = -1; + _vm->_linesManager.essai2[routeIdx + 3] = -1; } if (_vm->_globals.GOACTION) { -- cgit v1.2.3 From 9d1d5a09c4a1fb2ca827755e197ea7726eaa39ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 15:22:57 +0100 Subject: HOPKINS: Move two more variables to _linesManager, set private some variables --- engines/hopkins/globals.cpp | 6 ++---- engines/hopkins/globals.h | 3 --- engines/hopkins/lines.cpp | 20 +++++++++++--------- engines/hopkins/lines.h | 18 +++++++++++------- engines/hopkins/objects.cpp | 1 - 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f3988f2bdf..52ccfafc4a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -151,7 +151,6 @@ Globals::Globals() { _actionDirection = 0; _actionDirection = 0; SegmentEnCours = 0; - pathFindingDepth = 0; Credit_bx = -1; Credit_bx1 = -1; @@ -180,7 +179,6 @@ Globals::Globals() { _forestSprite = NULL; _answerBuffer = g_PTRNUL; _route = (int16 *)g_PTRNUL; - BufLig = (int16 *)g_PTRNUL; ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; @@ -309,7 +307,7 @@ void Globals::clearAll() { _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; - BufLig = (int16 *)g_PTRNUL; + _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; _route = (int16 *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { @@ -337,7 +335,7 @@ void Globals::clearAll() { _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); - BufLig = (int16 *)(BUFFERTAPE + 75000); + _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE + 75000); _boxWidth = 240; _vm->_eventsManager._objectBuf = allocMemory(2500); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 58a45c153e..316ed54fe0 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -335,7 +335,6 @@ public: bool _forestFl; byte *_answerBuffer; int16 *_route; - int16 *BufLig; byte *ADR_FICHIER_OBJ; byte *PERSO; int _objectWidth, _objectHeight; @@ -372,8 +371,6 @@ public: int SegmentEnCours; int couleur_40; - int pathFindingDepth; - int _hotspotTextColor; int oldzone_46; int old_x1_65; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2b0dd0ed0d..4a4ad44804 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -48,9 +48,11 @@ LinesManager::LinesManager() { _smoothMoveDirection = 0; _lastLine = 0; _maxLineIdx = 0; + _pathFindingMaxDepth = 0; essai0 = NULL; essai1 = NULL; essai2 = NULL; + BufLig = (int16 *)g_PTRNUL; } void LinesManager::setParent(HopkinsEngine *vm) { @@ -900,8 +902,8 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) { int result = a7; int v80 = -1; - ++_vm->_globals.pathFindingDepth; - if (_vm->_globals.pathFindingDepth > 10) { + ++_pathFindingMaxDepth; + if (_pathFindingMaxDepth > 10) { warning("PathFinding - Max depth reached"); route[a7] = -1; route[a7 + 1] = -1; @@ -987,11 +989,11 @@ LABEL_17: if (v85 > 800) v85 = 800; - Common::fill(&_vm->_globals.BufLig[0], &_vm->_globals.BufLig[1000], 0); + Common::fill(&BufLig[0], &BufLig[1000], 0); int bugLigIdx = 0; for (int v88 = 0; v88 < v85 + 1; v88++) { - _vm->_globals.BufLig[bugLigIdx] = v82; - _vm->_globals.BufLig[bugLigIdx + 1] = v81; + BufLig[bugLigIdx] = v82; + BufLig[bugLigIdx + 1] = v81; v21 += v84; v22 += v83; v82 = v21 / 1000; @@ -1003,11 +1005,11 @@ LABEL_17: int v78 = 0; int v79 = 0; for (int v89 = v85 + 1; v89 > 0; v89--) { - if (checkCollisionLine(_vm->_globals.BufLig[bugLigIdx], _vm->_globals.BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { + if (checkCollisionLine(BufLig[bugLigIdx], BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { v80 = foundLineIdx; v77 = foundDataIdx; - v78 = _vm->_globals.BufLig[bugLigIdx]; - v79 = _vm->_globals.BufLig[bugLigIdx + 1]; + v78 = BufLig[bugLigIdx]; + v79 = BufLig[bugLigIdx + 1]; break; } bugLigIdx -= 2; @@ -1240,7 +1242,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { _vm->_globals.old_x2_67 = destX; _vm->_globals.old_y1_66 = fromY; _vm->_globals.old_y2_68 = clipDestY; - _vm->_globals.pathFindingDepth = 0; + _pathFindingMaxDepth = 0; int v112 = 0; if (destX <= 19) clipDestX = 20; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index d31c34df59..3806a98f41 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -53,24 +53,28 @@ struct SmoothItem { class LinesManager { private: HopkinsEngine *_vm; -public: - LigneZoneItem _zoneLine[401]; - LigneItem Ligne[400]; + + int _pathFindingMaxDepth; SmoothItem _smoothRoute[4000]; - int _linesNumb; int NV_LIGNEDEP; int NV_LIGNEOFS; int NV_POSI; int NVPX; int NVPY; int _smoothMoveDirection; - int _lastLine; - int _maxLineIdx; int16 super_parcours[32002]; + +public: + LigneZoneItem _zoneLine[401]; + LigneItem Ligne[400]; int16 *essai0; int16 *essai1; int16 *essai2; -public: + int _maxLineIdx; + int _linesNumb; + int _lastLine; + int16 *BufLig; + LinesManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0633320700..af9d33edb3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1762,7 +1762,6 @@ void ObjectsManager::loadZone(const Common::String &file) { } while (bobZoneIdx != -1); for (int i = 1; i <= 100; i++) { - // CHECKME: Shouldn't it be a byte? _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1); _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2); -- cgit v1.2.3 From a50c05f7d0b98a1777f7b97af54bb2c842de0318 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 27 Jan 2013 18:18:04 +0100 Subject: HOPKINS: Work around broken cadavre.mod in OS/2 and BeOS versions A large part of cadavre.mod is broken. No new notes play, and only the old background sounds remain. It's possible, perhaps even probable, that the original MOD player didn't have this problem, but all standalone players I've tried do, so I'm assuming it's the file that's broken. We work around it by changing the length of the song after it's been loaded to only include the good parts. --- audio/mods/protracker.cpp | 16 ++++++++++++++-- audio/mods/protracker.h | 7 ++++++- engines/hopkins/sound.cpp | 14 +++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/audio/mods/protracker.cpp b/audio/mods/protracker.cpp index 1e18d5adf8..c947f256e0 100644 --- a/audio/mods/protracker.cpp +++ b/audio/mods/protracker.cpp @@ -90,6 +90,14 @@ private: public: ProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo); + Modules::Module *getModule() { + // Ordinarily, the Module is not meant to be seen outside of + // this class, but occasionally, it's useful to be able to + // manipulate it directly. The Hopkins engine uses this to + // repair a broken song. + return &_module; + } + private: void interrupt(); @@ -462,8 +470,12 @@ void ProtrackerStream::interrupt() { namespace Audio { -AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo) { - return new Modules::ProtrackerStream(stream, offs, rate, stereo); +AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo, Modules::Module **module) { + Modules::ProtrackerStream *protrackerStream = new Modules::ProtrackerStream(stream, offs, rate, stereo); + if (module) { + *module = protrackerStream->getModule(); + } + return (AudioStream *)protrackerStream; } } // End of namespace Audio diff --git a/audio/mods/protracker.h b/audio/mods/protracker.h index 6cee1a84bf..50528fc599 100644 --- a/audio/mods/protracker.h +++ b/audio/mods/protracker.h @@ -36,6 +36,10 @@ namespace Common { class SeekableReadStream; } +namespace Modules { +class Module; +} + namespace Audio { class AudioStream; @@ -49,9 +53,10 @@ class AudioStream; * @param stream the ReadStream from which to read the ProTracker data * @param rate TODO * @param stereo TODO + * @param module can be used to return the Module object (rarely useful) * @return a new AudioStream, or NULL, if an error occurred */ -AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs = 0, int rate = 44100, bool stereo = true); +AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs = 0, int rate = 44100, bool stereo = true, Modules::Module **module = 0); } // End of namespace Audio diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index d24c3e10b2..46bdb1e841 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -29,6 +29,7 @@ #include "hopkins/globals.h" #include "hopkins/hopkins.h" #include "audio/audiostream.h" +#include "audio/mods/module.h" #include "audio/mods/protracker.h" #include "audio/decoders/raw.h" @@ -413,7 +414,18 @@ void SoundManager::loadMusic(const Common::String &file) { if (!f.open(filename)) error("Error opening file %s", filename.c_str()); - Audio::AudioStream *modStream = Audio::makeProtrackerStream(&f); + Modules::Module *module; + Audio::AudioStream *modStream = Audio::makeProtrackerStream(&f, 0, 44100, true, &module); + + // WORKAROUND: This song is played at the empty lot where the + // bank robbers have left the helicopter. The MOD file appears + // to be slightly broken. Almost half of it is just the same + // noise repeating. We fix this by only playing the working + // part of it. The result is pretty close to the Windows music. + if (file.equalsIgnoreCase("cadavre")) { + module->songlen = 3; + } + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, modStream); } else { -- cgit v1.2.3 From b9f9b2c75b372194122dfae4d8b75d7c3a5dc254 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 20:20:36 +0100 Subject: HOPKINS: Move some more members to LinesManager --- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/globals.cpp | 11 +- engines/hopkins/globals.h | 10 -- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/lines.cpp | 277 +++++++++++++++++++++++++++++++ engines/hopkins/lines.h | 69 +++++--- engines/hopkins/objects.cpp | 385 +++++++------------------------------------- engines/hopkins/objects.h | 18 +-- engines/hopkins/script.cpp | 58 +++---- 9 files changed, 419 insertions(+), 415 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 3bc7f41951..3bb8f547d3 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -399,7 +399,7 @@ LABEL_7: break; _vm->_scriptManager.TRAVAILOBJET = true; - _vm->_globals._saveData->_data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->_data[svField3] = _vm->_objectsManager._curObjectIndex; _vm->_globals._saveData->_data[svField8] = _vm->_globals._inventory[newInventoryItem]; _vm->_globals._saveData->_data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 52ccfafc4a..e132457ac0 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -91,8 +91,6 @@ Globals::Globals() { for (int i = 0; i < 25; ++i) Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0); - for (int i = 0; i < 101; ++i) - Common::fill((byte *)&Segment[i], (byte *)&Segment[i] + sizeof(SegmentItem), 0); for (int i = 0; i < 105; ++i) { BOBZONE[i] = 0; BOBZONE_FLAG[i] = false; @@ -118,7 +116,6 @@ Globals::Globals() { _lastDirection = 0; police_l = police_h = 0; TETE = NULL; - _curObjectIndex = 0; NUM_FICHIER_OBJ = 0; nbrligne = 0; _boxWidth = 0; @@ -150,7 +147,6 @@ Globals::Globals() { Compteur = 0; _actionDirection = 0; _actionDirection = 0; - SegmentEnCours = 0; Credit_bx = -1; Credit_bx1 = -1; @@ -178,7 +174,6 @@ Globals::Globals() { _inventoryObject = NULL; _forestSprite = NULL; _answerBuffer = g_PTRNUL; - _route = (int16 *)g_PTRNUL; ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; @@ -296,7 +291,7 @@ void Globals::clearAll() { _answerBuffer = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; _saveData = (Sauvegarde *)g_PTRNUL; - _curObjectIndex = 0; + _vm->_objectsManager._curObjectIndex = 0; for (int idx = 0; idx < 105; ++idx) { ZONEP[idx]._destX = 0; @@ -308,7 +303,7 @@ void Globals::clearAll() { _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; - _route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; @@ -324,7 +319,7 @@ void Globals::clearAll() { } for (int idx = 0; idx < 100; ++idx) { - _vm->_objectsManager.CarreZone[idx]._enabledFl = 0; + _vm->_linesManager.CarreZone[idx]._enabledFl = 0; } BUFFERTAPE = allocMemory(85000); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 316ed54fe0..55bd3c7455 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -161,12 +161,6 @@ struct CacheItem { int field14; }; -struct SegmentItem { - int field0; // Useless variable - int field2; - int field4; -}; - struct HopkinsItem { int field0; int field2; @@ -297,7 +291,6 @@ public: ObjetWItem ObjetW[300]; BlocItem BLOC[250]; CacheItem Cache[25]; - SegmentItem Segment[101]; int BOBZONE[105]; bool BOBZONE_FLAG[105]; int _spriteSize[500]; @@ -325,7 +318,6 @@ public: byte *BUFFERTAPE; byte *inventaire2; byte *GESTE; - int _curObjectIndex; int NUM_FICHIER_OBJ; int nbrligne; // Useless variable? int _boxWidth; @@ -334,7 +326,6 @@ public: byte *_forestSprite; bool _forestFl; byte *_answerBuffer; - int16 *_route; byte *ADR_FICHIER_OBJ; byte *PERSO; int _objectWidth, _objectHeight; @@ -368,7 +359,6 @@ public: bool GOACTION; int Compteur; int _actionDirection; - int SegmentEnCours; int couleur_40; int _hotspotTextColor; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index cba5693c45..ec0a8589a1 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2098,7 +2098,7 @@ void HopkinsEngine::playEnding() { _globals.PLAN_FLAG = false; _globals.iRegul = 1; _soundManager.WSOUND(26); - _globals._route = (int16 *)g_PTRNUL; + _linesManager._route = (int16 *)g_PTRNUL; _globals.NOMARCHE = true; _globals._exitId = 0; _soundManager.loadSample(1, "SOUND90.WAV"); @@ -2782,7 +2782,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _objectsManager.animateSprite(0); - _globals._route = (int16 *)g_PTRNUL; + _linesManager._route = (int16 *)g_PTRNUL; _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(4); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4a4ad44804..b1a289ab53 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -38,6 +38,10 @@ LinesManager::LinesManager() { } for (int i = 0; i < 32002; ++i) super_parcours[i] = 0; + for (int i = 0; i < 101; ++i) { + Common::fill((byte *)&Segment[i], (byte *)&Segment[i] + sizeof(SegmentItem), 0); + Common::fill((byte *)&CarreZone[i], (byte *)&CarreZone[i] + sizeof(CarreZoneItem), 0); + } _linesNumb = 0; NV_LIGNEDEP = 0; @@ -53,6 +57,8 @@ LinesManager::LinesManager() { essai1 = NULL; essai2 = NULL; BufLig = (int16 *)g_PTRNUL; + _route = (int16 *)g_PTRNUL; + SegmentEnCours = 0; } void LinesManager::setParent(HopkinsEngine *vm) { @@ -2922,4 +2928,275 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, return -1; } +int LinesManager::CALC_PROPRE(int idx) { + int retVal = 25; + int size = _vm->_globals._spriteSize[idx]; + if (_vm->_globals.PERSO_TYPE == 1) { + if (size < 0) + size = -size; + size = 20 * (5 * size - 100) / -80; + } else if (_vm->_globals.PERSO_TYPE == 2) { + if (size < 0) + size = -size; + size = 20 * (5 * size - 165) / -67; + } + + if (size < 0) + retVal = _vm->_graphicsManager.zoomOut(25, -size); + else if (size > 0) + retVal = _vm->_graphicsManager.zoomIn(25, size); + + return retVal; +} + +void LinesManager::PACOURS_PROPRE(int16 *route) { + int v4; + int v5; + int v9; + int v10; + int v11; + int v12; + + int v1 = 0; + int v14 = -1; + int v2 = route[1]; + int v15 = route[2]; + if (route[0] == -1 && v2 == -1) + return; + + for (;;) { + if (v14 != -1 && v15 != v14) { + v11 = v1; + v12 = 0; + v10 = CALC_PROPRE(v2); + v4 = route[v1]; + v9 = route[v1]; + v5 = route[v1 + 1]; + while (v4 != -1 || v5 != -1) { + int idx = v1; + v1 += 4; + ++v12; + if (route[idx + 2] != v15) + break; + v4 = route[v1]; + v9 = route[v1]; + v5 = route[v1 + 1]; + } + if (v12 < v10) { + int v7 = v11; + for (int v8 = 0; v8 < v12; v8++) { + route[v7 + 2] = v14; + v7 += 4; + } + v15 = v14; + } + v1 = v11; + if (v9 == -1 && v5 == -1) + break; + } + v1 += 4; + v14 = v15; + v2 = route[v1 + 1]; + v15 = route[v1 + 2]; + if (route[v1] == -1 && v2 == -1) + break; + } +} + +int LinesManager::MZONE() { + int result; + + int xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; + int yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; + if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { + for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) { + int bobId = _vm->_globals.BOBZONE[bobZoneId]; + if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_globals._bob[bobId].field0 && _vm->_globals._bob[bobId]._frameIndex != 250 && + !_vm->_globals._bob[bobId]._disabledAnimationFl && xp > _vm->_globals._bob[bobId]._oldX && + xp < _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX && yp > _vm->_globals._bob[bobId]._oldY) { + if (yp < _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY) { + if (_vm->_globals.ZONEP[bobZoneId]._spriteIndex == -1) { + _vm->_globals.ZONEP[bobZoneId]._destX = 0; + _vm->_globals.ZONEP[bobZoneId]._destY = 0; + } + if (!_vm->_globals.ZONEP[bobZoneId]._destX && !_vm->_globals.ZONEP[bobZoneId]._destY) { + _vm->_globals.ZONEP[bobZoneId]._destX = _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX; + _vm->_globals.ZONEP[bobZoneId]._destY = _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY + 6; + _vm->_globals.ZONEP[bobZoneId]._spriteIndex = -1; + } + return bobZoneId; + } + } + } + SegmentEnCours = 0; + for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { + if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && CarreZone[squareZoneId]._enabledFl == 1 + && CarreZone[squareZoneId]._left <= xp && CarreZone[squareZoneId]._right >= xp + && CarreZone[squareZoneId]._top <= yp && CarreZone[squareZoneId]._bottom >= yp) { + if (CarreZone[squareZoneId]._squareZoneFl) { + _vm->_globals.oldzone_46 = _zoneLine[CarreZone[squareZoneId]._minZoneLineIdx].field2; + return _vm->_globals.oldzone_46; + } + Segment[SegmentEnCours].field2 = CarreZone[squareZoneId]._minZoneLineIdx; + Segment[SegmentEnCours].field4 = CarreZone[squareZoneId]._maxZoneLineIdx; + ++SegmentEnCours; + } + } + if (!SegmentEnCours) { + _vm->_globals.oldzone_46 = -1; + return -1; + } + + int colRes1 = 0; + for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { + colRes1 = colision(xp, yCurrent); + if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + break; + } + + if (colRes1 == -1) { + _vm->_globals.oldzone_46 = -1; + return -1; + } + + int colRes2 = 0; + for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { + colRes2 = colision(xp, j); + if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + break; + } + + if (colRes2 == -1) { + _vm->_globals.oldzone_46 = -1; + return -1; + } + + int colRes3 = 0; + for (int k = xp; k >= 0; --k) { + colRes3 = colision(k, yp); + if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + break; + } + if (colRes3 == -1) { + _vm->_globals.oldzone_46 = -1; + return -1; + } + + int colRes4 = 0; + for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { + colRes4 = colision(xCurrent, yp); + if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + break; + } + if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) { + _vm->_globals.oldzone_46 = colRes1; + result = colRes1; + } else { + _vm->_globals.oldzone_46 = -1; + result = -1; + } + } else { + result = 0; + } + return result; +} + +int LinesManager::colision(int xp, int yp) { + if (SegmentEnCours <= 0) + return -1; + + int xMax = xp + 4; + int xMin = xp - 4; + + for (int idx = 0; idx <= SegmentEnCours; ++idx) { + int field2 = Segment[idx].field2; + if (Segment[idx].field4 < field2) + continue; + + int yMax = yp + 4; + int yMin = yp - 4; + + do { + int16 *dataP = _vm->_linesManager._zoneLine[field2]._zoneData; + if (dataP != (int16 *)g_PTRNUL) { + int count = _vm->_linesManager._zoneLine[field2]._count; + int v1 = dataP[0]; + int v2 = dataP[1]; + int v3 = dataP[count * 2 - 2]; + int v4 = dataP[count * 2 - 1]; + + bool flag = true; + if (v1 < v3 && (xMax < v1 || xMin > v3)) + flag = false; + if (v1 >= v3 && (xMin > v1 || xMax < v3)) + flag = false; + if (v2 < v4 && (yMax < v2 || yMin > v4)) + flag = false; + if (v2 >= v4 && (yMin > v2 || yMax < v4)) + flag = false; + + if (flag && _vm->_linesManager._zoneLine[field2]._count > 0) { + for (int i = 0; i < count; ++i) { + int xCheck = *dataP++; + int yCheck = *dataP++; + + if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) + return _vm->_linesManager._zoneLine[field2].field2; + } + } + } + } while (++field2 <= Segment[idx].field4); + } + + return -1; +} + +// Square Zone +void LinesManager::CARRE_ZONE() { + for (int idx = 0; idx < 100; ++idx) { + CarreZone[idx]._enabledFl = 0; + CarreZone[idx]._squareZoneFl = false; + CarreZone[idx]._left = 1280; + CarreZone[idx]._right = 0; + CarreZone[idx]._top = 460; + CarreZone[idx]._bottom = 0; + CarreZone[idx]._minZoneLineIdx = 401; + CarreZone[idx]._maxZoneLineIdx = 0; + } + + for (int idx = 0; idx < MAX_LINES; ++idx) { + int16 *dataP = _vm->_linesManager._zoneLine[idx]._zoneData; + if (dataP == (int16 *)g_PTRNUL) + continue; + + int carreZoneId = _vm->_linesManager._zoneLine[idx].field2; + CarreZone[carreZoneId]._enabledFl = 1; + if (CarreZone[carreZoneId]._maxZoneLineIdx < idx) + CarreZone[carreZoneId]._maxZoneLineIdx = idx; + if (CarreZone[carreZoneId]._minZoneLineIdx > idx) + CarreZone[carreZoneId]._minZoneLineIdx = idx; + + for (int i = 0; i < _vm->_linesManager._zoneLine[idx]._count; i++) { + int zoneX = *dataP++; + int zoneY = *dataP++; + + if (CarreZone[carreZoneId]._left >= zoneX) + CarreZone[carreZoneId]._left = zoneX; + if (CarreZone[carreZoneId]._right <= zoneX) + CarreZone[carreZoneId]._right = zoneX; + if (CarreZone[carreZoneId]._top >= zoneY) + CarreZone[carreZoneId]._top = zoneY; + if (CarreZone[carreZoneId]._bottom <= zoneY) + CarreZone[carreZoneId]._bottom = zoneY; + } + } + + for (int idx = 0; idx < 100; idx++) { + int zoneWidth = abs(CarreZone[idx]._left - CarreZone[idx]._right); + int zoneHeight = abs(CarreZone[idx]._top - CarreZone[idx]._bottom); + if (zoneWidth == zoneHeight) + CarreZone[idx]._squareZoneFl = true; + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 3806a98f41..fa4e2efe7c 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -50,6 +50,23 @@ struct SmoothItem { int _posY; }; +struct SegmentItem { + int field0; // Useless variable + int field2; + int field4; +}; + +struct CarreZoneItem { + int _enabledFl; + int _left; + int _right; + int _top; + int _bottom; + int _minZoneLineIdx; + int _maxZoneLineIdx; + bool _squareZoneFl; +}; + class LinesManager { private: HopkinsEngine *_vm; @@ -64,42 +81,54 @@ private: int _smoothMoveDirection; int16 super_parcours[32002]; + int CALC_PROPRE(int idx); + int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); + void removeZoneLine(int idx); + void removeLine(int idx); + bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); + int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); + int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); + bool MIRACLE(int a1, int a2, int a3, int a4, int a5); + int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); + int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); + bool checkSmoothMove(int fromX, int fromY, int destX, int destY); + bool makeSmoothMove(int fromX, int fromY, int destX, int destY); + bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); + int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); + public: + int _lastLine; + int _linesNumb; LigneZoneItem _zoneLine[401]; LigneItem Ligne[400]; + int _maxLineIdx; + SegmentItem Segment[101]; + CarreZoneItem CarreZone[101]; + int SegmentEnCours; + +public: int16 *essai0; int16 *essai1; int16 *essai2; - int _maxLineIdx; - int _linesNumb; - int _lastLine; int16 *BufLig; + int16 *_route; LinesManager(); void setParent(HopkinsEngine *vm); - void loadLines(const Common::String &file); - void clearAllZones(); int checkInventoryHotspots(int posX, int posY); - int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); - void removeZoneLine(int idx); + void loadLines(const Common::String &file); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); + int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); + void PACOURS_PROPRE(int16 *route); + int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); + void clearAllZones(); void resetLines(); - void removeLine(int idx); void addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7); - bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); void initRoute(); - int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); - int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); - bool MIRACLE(int a1, int a2, int a3, int a4, int a5); - int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); - int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); - int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); - int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); - bool checkSmoothMove(int fromX, int fromY, int destX, int destY); - bool makeSmoothMove(int fromX, int fromY, int destX, int destY); - bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); - int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); + int colision(int xp, int yp); + int MZONE(); + void CARRE_ZONE(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index af9d33edb3..d468884859 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -37,8 +37,6 @@ ObjectsManager::ObjectsManager() { for (int i = 0; i < 6; ++i) { Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0); } - for (int i = 0; i < 100; ++i) - Common::fill((byte *)&CarreZone[i], (byte *)&CarreZone[i] + sizeof(CarreZoneItem), 0); _priorityFl = false; _oldBorderPos = Common::Point(0, 0); @@ -72,6 +70,7 @@ ObjectsManager::ObjectsManager() { _jumpZone = 0; _oldSpriteIndex = 0; _oldFlipFl = false; + _curObjectIndex = 0; } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -83,7 +82,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { */ void ObjectsManager::changeObject(int objIndex) { _vm->_eventsManager._objectBuf = CAPTURE_OBJET(objIndex, true); - _vm->_globals._curObjectIndex = objIndex; + _curObjectIndex = objIndex; } byte *ObjectsManager::CAPTURE_OBJET(int objIndex, bool mode) { @@ -1280,11 +1279,11 @@ void ObjectsManager::checkZone() { if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_vm->_globals._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { - zoneId = MZONE(); + zoneId = _vm->_linesManager.MZONE(); } else { zoneId = _vm->_globals._oldMouseZoneId; } @@ -1348,7 +1347,7 @@ void ObjectsManager::GOHOME() { int v58 = 0; int v1 = 0; - if (_vm->_globals._route == (int16 *)g_PTRNUL) + if (_vm->_linesManager._route == (int16 *)g_PTRNUL) return; if (_vm->_globals.Compteur > 1) { @@ -1363,10 +1362,10 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); - newPosX = *_vm->_globals._route++; - newPosY = *_vm->_globals._route++; - newDirection = *_vm->_globals._route++; - _vm->_globals._route++; + newPosX = *_vm->_linesManager._route++; + newPosY = *_vm->_linesManager._route++; + newDirection = *_vm->_linesManager._route++; + _vm->_linesManager._route++; if (newPosX != -1 || newPosY != -1) { _vm->_globals._oldDirection = newDirection; @@ -1382,11 +1381,11 @@ void ObjectsManager::GOHOME() { zoneId = _vm->_globals._saveData->_data[svField2]; else zoneId = _zoneNum; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; if (zoneId > 0) { if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { @@ -1589,10 +1588,10 @@ void ObjectsManager::GOHOME() { } bool loopCond = false; do { - newPosX = *_vm->_globals._route++; - newPosY = *_vm->_globals._route++; - newDirection = *_vm->_globals._route++; - _vm->_globals._route++; + newPosX = *_vm->_linesManager._route++; + newPosY = *_vm->_linesManager._route++; + newDirection = *_vm->_linesManager._route++; + _vm->_linesManager._route++; if (newPosX == -1 && newPosY == -1) { int zoneId; @@ -1602,7 +1601,7 @@ void ObjectsManager::GOHOME() { zoneId = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -1662,7 +1661,7 @@ void ObjectsManager::GOHOME() { } void ObjectsManager::GOHOME2() { - if (_vm->_globals._route == (int16 *)g_PTRNUL) + if (_vm->_linesManager._route == (int16 *)g_PTRNUL) return; int v0 = 2; @@ -1674,10 +1673,10 @@ void ObjectsManager::GOHOME2() { _vm->_globals.j_104 = 0; for (;;) { - int nexPosX = *_vm->_globals._route++; - int newPosY = *_vm->_globals._route++; - int newDirection = *_vm->_globals._route++; - _vm->_globals._route++; + int nexPosX = *_vm->_linesManager._route++; + int newPosY = *_vm->_linesManager._route++; + int newDirection = *_vm->_linesManager._route++; + _vm->_linesManager._route++; if ((nexPosX == -1) && (newPosY == -1)) break; @@ -1711,7 +1710,7 @@ void ObjectsManager::GOHOME2() { else if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 3); - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; my_anim = 0; } @@ -1789,55 +1788,7 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_globals.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i); _vm->_globals.freeMemory(ptr); - CARRE_ZONE(); -} - -// Square Zone -void ObjectsManager::CARRE_ZONE() { - for (int idx = 0; idx < 100; ++idx) { - CarreZone[idx]._enabledFl = 0; - CarreZone[idx]._squareZoneFl = false; - CarreZone[idx]._left = 1280; - CarreZone[idx]._right = 0; - CarreZone[idx]._top = 460; - CarreZone[idx]._bottom = 0; - CarreZone[idx]._minZoneLineIdx = 401; - CarreZone[idx]._maxZoneLineIdx = 0; - } - - for (int idx = 0; idx < MAX_LINES; ++idx) { - int16 *dataP = _vm->_linesManager._zoneLine[idx]._zoneData; - if (dataP == (int16 *)g_PTRNUL) - continue; - - int carreZoneId = _vm->_linesManager._zoneLine[idx].field2; - CarreZone[carreZoneId]._enabledFl = 1; - if (CarreZone[carreZoneId]._maxZoneLineIdx < idx) - CarreZone[carreZoneId]._maxZoneLineIdx = idx; - if (CarreZone[carreZoneId]._minZoneLineIdx > idx) - CarreZone[carreZoneId]._minZoneLineIdx = idx; - - for (int i = 0; i < _vm->_linesManager._zoneLine[idx]._count; i++) { - int zoneX = *dataP++; - int zoneY = *dataP++; - - if (CarreZone[carreZoneId]._left >= zoneX) - CarreZone[carreZoneId]._left = zoneX; - if (CarreZone[carreZoneId]._right <= zoneX) - CarreZone[carreZoneId]._right = zoneX; - if (CarreZone[carreZoneId]._top >= zoneY) - CarreZone[carreZoneId]._top = zoneY; - if (CarreZone[carreZoneId]._bottom <= zoneY) - CarreZone[carreZoneId]._bottom = zoneY; - } - } - - for (int idx = 0; idx < 100; idx++) { - int zoneWidth = abs(CarreZone[idx]._left - CarreZone[idx]._right); - int zoneHeight = abs(CarreZone[idx]._top - CarreZone[idx]._bottom); - if (zoneWidth == zoneHeight) - CarreZone[idx]._squareZoneFl = true; - } + _vm->_linesManager.CARRE_ZONE(); } void ObjectsManager::PLAN_BETA() { @@ -1878,7 +1829,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; animateSprite(0); - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -1918,7 +1869,7 @@ void ObjectsManager::PLAN_BETA() { checkZone(); GOHOME2(); - if (_vm->_globals._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) + if (_vm->_linesManager._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) PARADISE(); _vm->_eventsManager.VBL(); @@ -1988,9 +1939,9 @@ void ObjectsManager::handleLeftButton() { return; int routeIdx = 0; do { - _vm->_linesManager.essai2[routeIdx] = _vm->_globals._route[routeIdx]; + _vm->_linesManager.essai2[routeIdx] = _vm->_linesManager._route[routeIdx]; ++routeIdx; - } while (_vm->_globals._route[routeIdx] != -1); + } while (_vm->_linesManager._route[routeIdx] != -1); _vm->_linesManager.essai2[routeIdx] = -1; _vm->_linesManager.essai2[routeIdx + 1] = -1; @@ -2014,26 +1965,26 @@ void ObjectsManager::handleLeftButton() { } } _vm->_globals.GOACTION = false; - int16 *oldRoute = _vm->_globals._route; - _vm->_globals._route = (int16 *)g_PTRNUL; + int16 *oldRoute = _vm->_linesManager._route; + _vm->_linesManager._route = (int16 *)g_PTRNUL; if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { - _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); - if (_vm->_globals._route != (int16 *)g_PTRNUL) - PACOURS_PROPRE(_vm->_globals._route); + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); + if (_vm->_linesManager._route != (int16 *)g_PTRNUL) + _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals._route != (int16 *)g_PTRNUL || oldRoute == _vm->_globals._route) { + if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) { _vm->_globals._oldDirection = -1; goto LABEL_65; } goto LABEL_63; } - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); _vm->_globals._actionDirection = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -2042,21 +1993,21 @@ void ObjectsManager::handleLeftButton() { } if (!_vm->_globals.NOMARCHE) { if (!_vm->_globals.PLAN_FLAG) { - _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); - if (_vm->_globals._route != (int16 *)g_PTRNUL) - PACOURS_PROPRE(_vm->_globals._route); + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); + if (_vm->_linesManager._route != (int16 *)g_PTRNUL) + _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals._route != (int16 *)g_PTRNUL || oldRoute == _vm->_globals._route) + if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) _vm->_globals._oldDirection = -1; else LABEL_63: - _vm->_globals._route = oldRoute; + _vm->_linesManager._route = oldRoute; } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) - _vm->_globals._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); + _vm->_linesManager._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) @@ -2067,16 +2018,16 @@ LABEL_65: if (_vm->_globals.PLAN_FLAG) _vm->_globals._saveData->_data[svField1] = 6; _vm->_globals._saveData->_data[svField2] = _zoneNum; - _vm->_globals._saveData->_data[svField3] = _vm->_globals._curObjectIndex; + _vm->_globals._saveData->_data[svField3] = _curObjectIndex; _vm->_globals.GOACTION = true; } _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); if (_vm->_globals._screenId == 20 && _vm->_globals._saveData->_data[svField132] == 1 - && _vm->_globals._curObjectIndex == 20 && _zoneNum == 12 + && _curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; getSpriteX(0); getSpriteY(0); } @@ -2193,7 +2144,7 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _vm->_linesManager._linesNumb = 0; _vm->_linesManager._lastLine = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; @@ -2203,7 +2154,7 @@ void ObjectsManager::clearScreen() { _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; my_anim = 1; _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -2219,7 +2170,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { @@ -2338,60 +2289,6 @@ void ObjectsManager::computeAndSetSpriteSize() { setSpriteZoom(0, size); } -void ObjectsManager::PACOURS_PROPRE(int16 *a1) { - int v4; - int v5; - int v9; - int v10; - int v11; - int v12; - - int v1 = 0; - int v14 = -1; - int v2 = a1[1]; - int v15 = a1[2]; - if (a1[0] == -1 && v2 == -1) - return; - - for (;;) { - if (v14 != -1 && v15 != v14) { - v11 = v1; - v12 = 0; - v10 = CALC_PROPRE(v2); - v4 = a1[v1]; - v9 = a1[v1]; - v5 = a1[v1 + 1]; - while (v4 != -1 || v5 != -1) { - int idx = v1; - v1 += 4; - ++v12; - if (a1[idx + 2] != v15) - break; - v4 = a1[v1]; - v9 = a1[v1]; - v5 = a1[v1 + 1]; - } - if (v12 < v10) { - int v7 = v11; - for (int v8 = 0; v8 < v12; v8++) { - a1[v7 + 2] = v14; - v7 += 4; - } - v15 = v14; - } - v1 = v11; - if (v9 == -1 && v5 == -1) - break; - } - v1 += 4; - v14 = v15; - v2 = a1[v1 + 1]; - v15 = a1[v1 + 2]; - if (a1[v1] == -1 && v2 == -1) - break; - } -} - /** * Get next verb icon (or text) */ @@ -2559,103 +2456,6 @@ void ObjectsManager::handleRightButton() { } } -int ObjectsManager::MZONE() { - int result; - - int xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; - int yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; - if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { - for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) { - int bobId = _vm->_globals.BOBZONE[bobZoneId]; - if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_globals._bob[bobId].field0 && _vm->_globals._bob[bobId]._frameIndex != 250 && - !_vm->_globals._bob[bobId]._disabledAnimationFl && xp > _vm->_globals._bob[bobId]._oldX && - xp < _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX && yp > _vm->_globals._bob[bobId]._oldY) { - if (yp < _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY) { - if (_vm->_globals.ZONEP[bobZoneId]._spriteIndex == -1) { - _vm->_globals.ZONEP[bobZoneId]._destX = 0; - _vm->_globals.ZONEP[bobZoneId]._destY = 0; - } - if (!_vm->_globals.ZONEP[bobZoneId]._destX && !_vm->_globals.ZONEP[bobZoneId]._destY) { - _vm->_globals.ZONEP[bobZoneId]._destX = _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX; - _vm->_globals.ZONEP[bobZoneId]._destY = _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY + 6; - _vm->_globals.ZONEP[bobZoneId]._spriteIndex = -1; - } - return bobZoneId; - } - } - } - _vm->_globals.SegmentEnCours = 0; - for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { - if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && CarreZone[squareZoneId]._enabledFl == 1 - && CarreZone[squareZoneId]._left <= xp && CarreZone[squareZoneId]._right >= xp - && CarreZone[squareZoneId]._top <= yp && CarreZone[squareZoneId]._bottom >= yp) { - if (CarreZone[squareZoneId]._squareZoneFl) { - _vm->_globals.oldzone_46 = _vm->_linesManager._zoneLine[CarreZone[squareZoneId]._minZoneLineIdx].field2; - return _vm->_globals.oldzone_46; - } - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field2 = CarreZone[squareZoneId]._minZoneLineIdx; - _vm->_globals.Segment[_vm->_globals.SegmentEnCours].field4 = CarreZone[squareZoneId]._maxZoneLineIdx; - ++_vm->_globals.SegmentEnCours; - } - } - if (!_vm->_globals.SegmentEnCours) { - _vm->_globals.oldzone_46 = -1; - return -1; - } - - int colRes1 = 0; - for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { - colRes1 = colision(xp, yCurrent); - if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) - break; - } - - if (colRes1 == -1) { - _vm->_globals.oldzone_46 = -1; - return -1; - } - - int colRes2 = 0; - for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { - colRes2 = colision(xp, j); - if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) - break; - } - - if (colRes2 == -1) { - _vm->_globals.oldzone_46 = -1; - return -1; - } - - int colRes3 = 0; - for (int k = xp; k >= 0; --k) { - colRes3 = colision(k, yp); - if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) - break; - } - if (colRes3 == -1) { - _vm->_globals.oldzone_46 = -1; - return -1; - } - - int colRes4 = 0; - for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { - colRes4 = colision(xCurrent, yp); - if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) - break; - } - if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) { - _vm->_globals.oldzone_46 = colRes1; - result = colRes1; - } else { - _vm->_globals.oldzone_46 = -1; - result = -1; - } - } else { - result = 0; - } - return result; -} /** * Prepare border used to highlight the place below mouse cursor, in the inventory. * Also set the mouse cursor @@ -3429,7 +3229,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep); dep += 2; } - CARRE_ZONE(); + _vm->_linesManager.CARRE_ZONE(); } } } @@ -3680,77 +3480,6 @@ void ObjectsManager::enableVerb(int idx, int a2) { } } -int ObjectsManager::CALC_PROPRE(int idx) { - int retVal = 25; - int size = _vm->_globals._spriteSize[idx]; - if (_vm->_globals.PERSO_TYPE == 1) { - if (size < 0) - size = -size; - size = 20 * (5 * size - 100) / -80; - } else if (_vm->_globals.PERSO_TYPE == 2) { - if (size < 0) - size = -size; - size = 20 * (5 * size - 165) / -67; - } - - if (size < 0) - retVal = _vm->_graphicsManager.zoomOut(25, -size); - else if (size > 0) - retVal = _vm->_graphicsManager.zoomIn(25, size); - - return retVal; -} - -int ObjectsManager::colision(int xp, int yp) { - if (_vm->_globals.SegmentEnCours <= 0) - return -1; - - int xMax = xp + 4; - int xMin = xp - 4; - - for (int idx = 0; idx <= _vm->_globals.SegmentEnCours; ++idx) { - int field2 = _vm->_globals.Segment[idx].field2; - if (_vm->_globals.Segment[idx].field4 < field2) - continue; - - int yMax = yp + 4; - int yMin = yp - 4; - - do { - int16 *dataP = _vm->_linesManager._zoneLine[field2]._zoneData; - if (dataP != (int16 *)g_PTRNUL) { - int count = _vm->_linesManager._zoneLine[field2]._count; - int v1 = dataP[0]; - int v2 = dataP[1]; - int v3 = dataP[count * 2 - 2]; - int v4 = dataP[count * 2 - 1]; - - bool flag = true; - if (v1 < v3 && (xMax < v1 || xMin > v3)) - flag = false; - if (v1 >= v3 && (xMin > v1 || xMax < v3)) - flag = false; - if (v2 < v4 && (yMax < v2 || yMin > v4)) - flag = false; - if (v2 >= v4 && (yMin > v2 || yMax < v4)) - flag = false; - - if (flag && _vm->_linesManager._zoneLine[field2]._count > 0) { - for (int i = 0; i < count; ++i) { - int xCheck = *dataP++; - int yCheck = *dataP++; - - if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) - return _vm->_linesManager._zoneLine[field2].field2; - } - } - } - } while (++field2 <= _vm->_globals.Segment[idx].field4); - } - - return -1; -} - void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl) { bool tokenCompleteFl; char curChar; @@ -3994,7 +3723,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals._exitId = 0; if (!backgroundFile.empty()) @@ -4014,7 +3743,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->_globals._screenId == 61) { addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -4032,13 +3761,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo g_old_x = getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); _vm->_globals.NOT_VERIF = true; do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); setSpriteIndex(0, 64); } do { @@ -4142,7 +3871,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm computeAndSetSpriteSize(); animateSprite(0); _vm->_globals.CACHE_ON(); - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; @@ -4173,7 +3902,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm yp = _vm->_eventsManager.getMouseY(); if ((xCheck == xp) && (yCheck == yp)) { - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; PARADISE(); if (_vm->_globals._exitId) breakFlag = true; @@ -4189,8 +3918,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); checkZone(); - if (_vm->_globals._route == (int16 *)g_PTRNUL - || (GOHOME(), _vm->_globals._route == (int16 *)g_PTRNUL)) { + if (_vm->_linesManager._route == (int16 *)g_PTRNUL + || (GOHOME(), _vm->_linesManager._route == (int16 *)g_PTRNUL)) { if (_vm->_globals.GOACTION) PARADISE(); } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d1a40d73d4..ef7b069152 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -50,17 +50,6 @@ struct SpriteItem { int _reducePct; }; -struct CarreZoneItem { - int _enabledFl; - int _left; - int _right; - int _top; - int _bottom; - int _minZoneLineIdx; - int _maxZoneLineIdx; - bool _squareZoneFl; -}; - class HopkinsEngine; class ObjectsManager { @@ -101,7 +90,7 @@ public: int _jumpZone; int _oldSpriteIndex; bool _oldFlipFl; - CarreZoneItem CarreZone[101]; + int _curObjectIndex; public: ObjectsManager(); void setParent(HopkinsEngine *vm); @@ -157,7 +146,6 @@ public: void GOHOME(); void GOHOME2(); void loadZone(const Common::String &file); - void CARRE_ZONE(); void PLAN_BETA(); void handleLeftButton(); void PARADISE(); @@ -171,10 +159,8 @@ public: void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); void computeAndSetSpriteSize(); - void PACOURS_PROPRE(int16 *a1); void nextVerbIcon(); void handleRightButton(); - int MZONE(); void initBorder(int a1); void nextObjectIcon(int idx); void takeInventoryObject(int idx); @@ -207,8 +193,6 @@ public: void SCI_OPTI_ONE(int idx, int a2, int a3, int a4); void disableVerb(int idx, int a2); void enableVerb(int idx, int a2); - int CALC_PROPRE(int idx); - int colision(int xp, int yp); void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl); void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index cb287fe9e7..b4caa74b2c 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -722,8 +722,8 @@ int ScriptManager::handleOpcode(byte *dataP) { case 46: { _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) @@ -731,7 +731,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_globals.NOT_VERIF = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); @@ -934,8 +934,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -943,7 +943,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); @@ -1034,8 +1034,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1043,7 +1043,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); _vm->_objectsManager.setBobAnimation(8); @@ -1350,15 +1350,15 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; if (_vm->_globals._saveData->_data[svField253] == 1) { - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); } if (_vm->_globals._saveData->_data[svField253] == 2) { - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); } if (_vm->_globals._saveData->_data[svField253] > 2) { - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); } _vm->_globals.NOT_VERIF = true; do { @@ -1367,7 +1367,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.loadSample(1, "SOUND63.WAV"); @@ -1598,8 +1598,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1608,7 +1608,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1626,8 +1626,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1636,7 +1636,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1801,8 +1801,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager._specialSoundNum = 0; } _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = 0; do { @@ -1811,7 +1811,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_globals._exitId = _vm->_globals._saveData->_data[svField401]; _vm->_globals._disableInventFl = false; @@ -1831,9 +1831,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.stopBobAnimation(1); - _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); _vm->_objectsManager._zoneNum = 0; _vm->_globals.NOT_VERIF = true; do { @@ -1842,7 +1842,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.playSound("SOUND66.WAV"); @@ -1930,8 +1930,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals._route = (int16 *)g_PTRNUL; - _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); + _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1939,7 +1939,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); int v45 = 0; _vm->_objectsManager.setBobAnimation(7); -- cgit v1.2.3 From 0f13ff5cc1984a9748ce666d89d46c7d80624de0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 22:28:10 +0100 Subject: HOPKINS: More private members in LinesManager --- engines/hopkins/globals.cpp | 33 +----------- engines/hopkins/globals.h | 1 - engines/hopkins/lines.cpp | 119 ++++++++++++++++++++++++++++---------------- engines/hopkins/lines.h | 21 ++++---- engines/hopkins/objects.cpp | 16 +++--- engines/hopkins/objects.h | 2 +- engines/hopkins/script.cpp | 4 +- 7 files changed, 101 insertions(+), 95 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e132457ac0..a8ee4e4063 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -161,14 +161,13 @@ Globals::Globals() { _oceanDirection = 0; - // Initialise pointers + // Initialize pointers ICONE = NULL; BUF_ZONE = NULL; for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; - BUFFERTAPE = NULL; inventaire2 = NULL; GESTE = NULL; _inventoryObject = NULL; @@ -214,7 +213,6 @@ Globals::~Globals() { CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); - freeMemory(BUFFERTAPE); freeMemory(inventaire2); freeMemory(GESTE); freeMemory(_inventoryObject); @@ -299,38 +297,11 @@ void Globals::clearAll() { ZONEP[idx]._spriteIndex = 0; } - _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; - _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; - _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; - _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; - _vm->_linesManager._route = (int16 *)g_PTRNUL; - - for (int idx = 0; idx < MAX_LINES; ++idx) { - _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; - _vm->_linesManager.Ligne[idx].field2 = 0; - _vm->_linesManager.Ligne[idx]._direction = 0; - _vm->_linesManager.Ligne[idx].field6 = 0; - _vm->_linesManager.Ligne[idx].field8 = 0; - _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; - - _vm->_linesManager._zoneLine[idx]._count = 0; - _vm->_linesManager._zoneLine[idx].field2 = 0; - _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; - } - - for (int idx = 0; idx < 100; ++idx) { - _vm->_linesManager.CarreZone[idx]._enabledFl = 0; - } - - BUFFERTAPE = allocMemory(85000); + _vm->_linesManager.clearAll(); _saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde)); memset(_saveData, 0, sizeof(Sauvegarde)); - _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; - _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); - _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); - _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE + 75000); _boxWidth = 240; _vm->_eventsManager._objectBuf = allocMemory(2500); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 55bd3c7455..f17156cee9 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -315,7 +315,6 @@ public: byte *BUF_ZONE; byte *SPRITE_ECRAN; Sauvegarde *_saveData; - byte *BUFFERTAPE; byte *inventaire2; byte *GESTE; int NUM_FICHIER_OBJ; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index b1a289ab53..fe01446742 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -58,7 +58,12 @@ LinesManager::LinesManager() { essai2 = NULL; BufLig = (int16 *)g_PTRNUL; _route = (int16 *)g_PTRNUL; - SegmentEnCours = 0; + _currentSegmentId = 0; + BUFFERTAPE = NULL; +} + +LinesManager::~LinesManager() { + _vm->_globals.freeMemory(BUFFERTAPE); } void LinesManager::setParent(HopkinsEngine *vm) { @@ -87,14 +92,6 @@ void LinesManager::loadLines(const Common::String &file) { _vm->_globals.freeMemory(ptr); } -/** - * Clear all zones and reset nextLine - */ -void LinesManager::clearAllZones() { - for (int idx = 0; idx < MAX_LINES; ++idx) - removeZoneLine(idx); -} - /** * Check Hotspots in Inventory screen * Returns the ID of the hotspot under mouse @@ -158,14 +155,6 @@ int LinesManager::checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastR return 0; } -/** - * Remove Zone Line - */ -void LinesManager::removeZoneLine(int idx) { - assert (idx <= MAX_LINES); - _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); -} - /** * Add Zone Line */ @@ -217,21 +206,6 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ } } -void LinesManager::resetLines() { - for (int idx = 0; idx < MAX_LINES; ++idx) { - removeLine(idx); - Ligne[idx]._lineDataEndIdx = 0; - Ligne[idx]._lineData = (int16 *)g_PTRNUL; - } -} - -// Remove Line -void LinesManager::removeLine(int idx) { - if (idx > MAX_LINES) - error("Attempting to add a line obstacle > MAX_LIGNE."); - Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); -} - /** * Add Line */ @@ -274,8 +248,7 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int v34 = v8; v10 = _vm->_globals.allocMemory(4 * v34 + 8); - if (v10 == g_PTRNUL) - error("AJOUTE LIGNE OBSTACLE"); + assert (v10 != g_PTRNUL); Common::fill(v10, v10 + 4 * v34 + 8, 0); Ligne[idx]._lineData = (int16 *)v10; @@ -2865,7 +2838,6 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int superRouteIdx = a3; if (v33 == 1) { - essai0 = essai0; for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) { super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * i]; super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * i + 1]; @@ -3028,7 +3000,7 @@ int LinesManager::MZONE() { } } } - SegmentEnCours = 0; + _currentSegmentId = 0; for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && CarreZone[squareZoneId]._enabledFl == 1 && CarreZone[squareZoneId]._left <= xp && CarreZone[squareZoneId]._right >= xp @@ -3037,12 +3009,12 @@ int LinesManager::MZONE() { _vm->_globals.oldzone_46 = _zoneLine[CarreZone[squareZoneId]._minZoneLineIdx].field2; return _vm->_globals.oldzone_46; } - Segment[SegmentEnCours].field2 = CarreZone[squareZoneId]._minZoneLineIdx; - Segment[SegmentEnCours].field4 = CarreZone[squareZoneId]._maxZoneLineIdx; - ++SegmentEnCours; + Segment[_currentSegmentId].field2 = CarreZone[squareZoneId]._minZoneLineIdx; + Segment[_currentSegmentId].field4 = CarreZone[squareZoneId]._maxZoneLineIdx; + ++_currentSegmentId; } } - if (!SegmentEnCours) { + if (!_currentSegmentId) { _vm->_globals.oldzone_46 = -1; return -1; } @@ -3102,13 +3074,13 @@ int LinesManager::MZONE() { } int LinesManager::colision(int xp, int yp) { - if (SegmentEnCours <= 0) + if (_currentSegmentId <= 0) return -1; int xMax = xp + 4; int xMin = xp - 4; - for (int idx = 0; idx <= SegmentEnCours; ++idx) { + for (int idx = 0; idx <= _currentSegmentId; ++idx) { int field2 = Segment[idx].field2; if (Segment[idx].field4 < field2) continue; @@ -3199,4 +3171,67 @@ void LinesManager::CARRE_ZONE() { } } +void LinesManager::clearAll() { + _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; + _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; + _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; + _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (int16 *)g_PTRNUL; + + for (int idx = 0; idx < MAX_LINES; ++idx) { + _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; + _vm->_linesManager.Ligne[idx].field2 = 0; + _vm->_linesManager.Ligne[idx]._direction = 0; + _vm->_linesManager.Ligne[idx].field6 = 0; + _vm->_linesManager.Ligne[idx].field8 = 0; + _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; + + _vm->_linesManager._zoneLine[idx]._count = 0; + _vm->_linesManager._zoneLine[idx].field2 = 0; + _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; + } + + for (int idx = 0; idx < 100; ++idx) { + _vm->_linesManager.CarreZone[idx]._enabledFl = 0; + } + + BUFFERTAPE = _vm->_globals.allocMemory(85000); + + _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; + _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); + _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); + _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE + 75000); +} + +/** + * Clear all zones and reset nextLine + */ +void LinesManager::clearAllZones() { + for (int idx = 0; idx < MAX_LINES; ++idx) + removeZoneLine(idx); +} + +/** + * Remove Zone Line + */ +void LinesManager::removeZoneLine(int idx) { + assert (idx <= MAX_LINES); + _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); +} + +void LinesManager::resetLines() { + for (int idx = 0; idx < MAX_LINES; ++idx) { + removeLine(idx); + Ligne[idx]._lineDataEndIdx = 0; + Ligne[idx]._lineData = (int16 *)g_PTRNUL; + } +} + +// Remove Line +void LinesManager::removeLine(int idx) { + if (idx > MAX_LINES) + error("Attempting to add a line obstacle > MAX_LIGNE."); + Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index fa4e2efe7c..6098ca5034 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -80,6 +80,15 @@ private: int NVPY; int _smoothMoveDirection; int16 super_parcours[32002]; + byte *BUFFERTAPE; + int16 *essai0; + int16 *essai1; + int16 *BufLig; + LigneZoneItem _zoneLine[401]; + LigneItem Ligne[400]; + SegmentItem Segment[101]; + CarreZoneItem CarreZone[101]; + int _currentSegmentId; int CALC_PROPRE(int idx); int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); @@ -99,21 +108,14 @@ private: public: int _lastLine; int _linesNumb; - LigneZoneItem _zoneLine[401]; - LigneItem Ligne[400]; int _maxLineIdx; - SegmentItem Segment[101]; - CarreZoneItem CarreZone[101]; - int SegmentEnCours; + int16 *essai2; public: - int16 *essai0; - int16 *essai1; - int16 *essai2; - int16 *BufLig; int16 *_route; LinesManager(); + ~LinesManager(); void setParent(HopkinsEngine *vm); int checkInventoryHotspots(int posX, int posY); @@ -129,6 +131,7 @@ public: int colision(int xp, int yp); int MZONE(); void CARRE_ZONE(); + void clearAll(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d468884859..48fcfb8f10 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3335,21 +3335,19 @@ void ObjectsManager::SPECIAL_INI() { } } -void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6, int a7) { +void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6) { if (idx1 != -1) setBobAnimation(idx1); if (idx2 != -1) setBobAnimation(idx2); if (idx3 != -1) setBobAnimation(idx3); - if (!a7) { - if (idx1 != -1) - SET_BOBPOSI(idx1, a4); - if (idx2 != -1) - SET_BOBPOSI(idx2, a5); - if (idx3 != -1) - SET_BOBPOSI(idx3, a6); - } + if (idx1 != -1) + SET_BOBPOSI(idx1, a4); + if (idx2 != -1) + SET_BOBPOSI(idx2, a5); + if (idx3 != -1) + SET_BOBPOSI(idx3, a6); } void ObjectsManager::SCI_OPTI_ONE(int idx, int a2, int a3, int a4) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index ef7b069152..d0d61c954c 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -189,7 +189,7 @@ public: void INILINK(const Common::String &file); void SPECIAL_INI(); - void OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6, int a7); + void OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6); void SCI_OPTI_ONE(int idx, int a2, int a3, int a4); void disableVerb(int idx, int a2); void enableVerb(int idx, int a2); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index b4caa74b2c..a9bcae6be6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -736,7 +736,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.NOT_VERIF = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); _vm->_soundManager.loadSample(2, "SOUND45.WAV"); - _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0); bool v15 = false; do { if (_vm->shouldQuit()) @@ -805,7 +805,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 49: { _vm->_globals.CACHE_OFF(); _vm->_objectsManager.removeSprite(0); - _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0, 0); + _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0); int v19 = 12; if (_vm->_globals._saveData->_data[svField133] == 1) v19 = 41; -- cgit v1.2.3 From e77198081d35ffe0e468eb983010750b8103dc0d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 22:53:20 +0100 Subject: HOPKINS: Move some more LinesManager variables to private, add some functions to access them --- engines/hopkins/hopkins.cpp | 148 ++++++++++++++++++++++---------------------- engines/hopkins/lines.cpp | 17 ++++- engines/hopkins/lines.h | 9 ++- engines/hopkins/objects.cpp | 9 ++- 4 files changed, 98 insertions(+), 85 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ec0a8589a1..766c37bea3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -188,7 +188,7 @@ bool HopkinsEngine::runWin95Demo() { switch (_globals._exitId) { case 1: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 2, true); break; @@ -227,7 +227,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.fadeOutLong(); _globals._saveData->_data[svField170] = 1; } - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; @@ -239,7 +239,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 5: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 455; if (_globals._saveData->_data[svField80]) { @@ -251,7 +251,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 6: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; @@ -264,14 +264,14 @@ bool HopkinsEngine::runWin95Demo() { break; case 8: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: _globals._characterMaxPosY = 440; - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); else @@ -283,14 +283,14 @@ bool HopkinsEngine::runWin95Demo() { break; case 11: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: _globals._characterMaxPosY = 450; - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); if (_globals._saveData->_data[svField225]) { if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); @@ -493,7 +493,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 1: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; @@ -535,7 +535,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals._saveData->_data[svField170] = 1; } - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; @@ -547,7 +547,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 5: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 455; if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); @@ -556,7 +556,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 6: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; @@ -569,13 +569,13 @@ bool HopkinsEngine::runLinuxDemo() { break; case 8: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 440; if (!_globals._saveData->_data[svField225]) @@ -589,13 +589,13 @@ bool HopkinsEngine::runLinuxDemo() { break; case 11: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); @@ -604,13 +604,13 @@ bool HopkinsEngine::runLinuxDemo() { break; case 13: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; @@ -620,7 +620,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 16: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField113] == 1) { @@ -631,13 +631,13 @@ bool HopkinsEngine::runLinuxDemo() { break; case 25: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); break; case 26: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); @@ -831,7 +831,7 @@ bool HopkinsEngine::runFull() { switch (_globals._exitId) { case 1: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM01", "IM01", "ANIM01", "IM01", 1, true); break; @@ -878,7 +878,7 @@ bool HopkinsEngine::runFull() { _graphicsManager.fadeOutLong(); _globals._saveData->_data[svField170] = 1; } - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM03", "IM03", "ANIM03", "IM03", 2, false); break; @@ -890,7 +890,7 @@ bool HopkinsEngine::runFull() { break; case 5: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 455; if (_globals._saveData->_data[svField80] == 1) _objectsManager.PERSONAGE2("IM05", "IM05A", "ANIM05B", "IM05", 3, false); @@ -899,7 +899,7 @@ bool HopkinsEngine::runFull() { break; case 6: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM06", "IM06", "ANIM06", "IM06", 2, true); break; @@ -912,13 +912,13 @@ bool HopkinsEngine::runFull() { break; case 8: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM08", "IM08", "ANIM08", "IM08", 2, true); break; case 9: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM09", "IM09", "ANIM09", "IM09", 10, true); @@ -931,13 +931,13 @@ bool HopkinsEngine::runFull() { break; case 11: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 450; _objectsManager.PERSONAGE2("IM11", "IM11", "ANIM11", "IM11", 2, false); break; case 12: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField225]) _objectsManager.PERSONAGE2("IM12", "IM12", "ANIM12", "IM12", 1, false); @@ -946,13 +946,13 @@ bool HopkinsEngine::runFull() { break; case 13: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM13", "IM13", "ANIM13", "IM13", 1, true); break; case 14: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM14", "IM14", "ANIM14", "IM14", 1, true); break; @@ -965,7 +965,7 @@ bool HopkinsEngine::runFull() { break; case 16: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField113] == 1) _objectsManager.PERSONAGE2("IM16", "IM16A", "ANIM16", "IM16", 7, true); @@ -974,7 +974,7 @@ bool HopkinsEngine::runFull() { break; case 17: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField117] == 1) _objectsManager.PERSONAGE2("IM17", "IM17A", "ANIM17", "IM17", 11, true); @@ -1005,7 +1005,7 @@ bool HopkinsEngine::runFull() { break; case 18: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM18", "IM18", "ANIM18", "IM18", 29, false); @@ -1014,7 +1014,7 @@ bool HopkinsEngine::runFull() { break; case 19: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField123]) _objectsManager.PERSONAGE2("IM19", "IM19A", "ANIM19", "IM19", 6, true); @@ -1023,7 +1023,7 @@ bool HopkinsEngine::runFull() { break; case 20: - _linesManager._maxLineIdx = 10; + _linesManager.setMaxLineIdx(10); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { @@ -1044,19 +1044,19 @@ bool HopkinsEngine::runFull() { break; case 22: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM22", "IM22", "ANIM22", "IM22", 6, true); break; case 23: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM23", "IM23", "ANIM23", "IM23", 6, true); break; case 24: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField181] == 1) _objectsManager.PERSONAGE2("IM24", "IM24A", "ANIM24", "IM24", 1, true); @@ -1065,7 +1065,7 @@ bool HopkinsEngine::runFull() { break; case 25: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 445; if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM25", "IM25", "ANIM25", "IM25", 30, true); @@ -1074,7 +1074,7 @@ bool HopkinsEngine::runFull() { break; case 26: - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) _objectsManager.PERSONAGE2("IM26", "IM26", "ANIM26", "IM26", 30, true); @@ -1083,7 +1083,7 @@ bool HopkinsEngine::runFull() { break; case 27: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 440; if (_globals._saveData->_data[svField177] == 1) _objectsManager.PERSONAGE2("IM27", "IM27A", "ANIM27", "IM27", 27, true); @@ -1092,7 +1092,7 @@ bool HopkinsEngine::runFull() { break; case 28: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 450; if (_globals._saveData->_data[svField166] != 1 || _globals._saveData->_data[svField167] != 1) _objectsManager.PERSONAGE2("IM28", "IM28", "ANIM28", "IM28", 1, false); @@ -1101,13 +1101,13 @@ bool HopkinsEngine::runFull() { break; case 29: - _linesManager._maxLineIdx = 50; + _linesManager.setMaxLineIdx(50); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM29", "IM29", "ANIM29", "IM29", 1, true); break; case 30: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; @@ -1117,7 +1117,7 @@ bool HopkinsEngine::runFull() { break; case 32: - _linesManager._maxLineIdx = 20; + _linesManager.setMaxLineIdx(20); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM32", "IM32", "ANIM32", "IM32", 2, true); break; @@ -1137,7 +1137,7 @@ bool HopkinsEngine::runFull() { case 39: case 40: case 41: { - _linesManager._maxLineIdx = 40; + _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; _globals._disableInventFl = false; _globals._forestFl = true; @@ -1162,55 +1162,55 @@ bool HopkinsEngine::runFull() { break; case 51: - _linesManager._maxLineIdx = 10; + _linesManager.setMaxLineIdx(10); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM51", "IM51", "ANIM51", "IM51", 14, true); break; case 52: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM52", "IM52", "ANIM52", "IM52", 14, true); break; case 54: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM54", "IM54", "ANIM54", "IM54", 14, true); break; case 55: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 460; _objectsManager.PERSONAGE2("IM55", "IM55", "ANIM55", "IM55", 14, false); break; case 56: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM56", "IM56", "ANIM56", "IM56", 14, false); break; case 57: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM57", "IM57", "ANIM57", "IM57", 14, true); break; case 58: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM58", "IM58", "ANIM58", "IM58", 14, false); break; case 59: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM59", "IM59", "ANIM59", "IM59", 21, false); break; case 60: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM60", "IM60", "ANIM60", "IM60", 21, false); break; @@ -1222,67 +1222,67 @@ bool HopkinsEngine::runFull() { break; case 62: - _linesManager._maxLineIdx = 8; + _linesManager.setMaxLineIdx(8); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM62", "IM62", NULL, "IM62", 21, false); break; case 63: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM63", "IM63", "ANIM63", "IM63", 21, false); break; case 64: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM64", "IM64", "ANIM64", "IM64", 21, true); break; case 65: - _linesManager._maxLineIdx = 30; + _linesManager.setMaxLineIdx(30); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM65", "IM65", "ANIM65", "IM65", 21, false); break; case 66: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM66", "IM66", "ANIM66", "IM66", 21, false); break; case 67: - _linesManager._maxLineIdx = 8; + _linesManager.setMaxLineIdx(8); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM67", "IM67", NULL, "IM67", 21, false); break; case 68: - _linesManager._maxLineIdx = 8; + _linesManager.setMaxLineIdx(8); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM68", "IM68", "ANIM68", "IM68", 21, true); break; case 69: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM69", "IM69", "ANIM69", "IM69", 21, false); break; case 70: - _linesManager._maxLineIdx = 8; + _linesManager.setMaxLineIdx(8); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM70", "IM70", NULL, "IM70", 21, false); break; case 71: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 445; _objectsManager.PERSONAGE2("IM71", "IM71", "ANIM71", "IM71", 21, false); break; case 73: - _linesManager._maxLineIdx = 15; + _linesManager.setMaxLineIdx(15); _globals._characterMaxPosY = 445; if (_globals._saveData->_data[svField318] == 1) _objectsManager.PERSONAGE2("IM73", "IM73A", "ANIM73", "IM73", 21, true); @@ -1355,7 +1355,7 @@ bool HopkinsEngine::runFull() { break; case 93: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 445; if (_globals._saveData->_data[svField330]) { if (getPlatform() == Common::kPlatformLinux || getPlatform() == Common::kPlatformWindows) @@ -1371,25 +1371,25 @@ bool HopkinsEngine::runFull() { break; case 94: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 440; _objectsManager.PERSONAGE2("IM94", "IM94", "ANIM94", "IM94", 19, true); break; case 95: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM95", "IM95", "ANIM95", "IM95", 19, false); break; case 96: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM96", "IM96", "ANIM96", "IM96", 19, false); break; case 97: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { @@ -1407,13 +1407,13 @@ bool HopkinsEngine::runFull() { break; case 98: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM98", "IM98", "ANIM98", "IM98", 19, true); break; case 99: - _linesManager._maxLineIdx = 5; + _linesManager.setMaxLineIdx(5); _globals._characterMaxPosY = 435; _objectsManager.PERSONAGE2("IM99", "IM99", "ANIM99", "IM99", 19, true); break; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index fe01446742..ee3c138236 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -86,7 +86,6 @@ void LinesManager::loadLines(const Common::String &file) { (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4), 1); - ++_linesNumb; } initRoute(); _vm->_globals.freeMemory(ptr); @@ -232,8 +231,7 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int int v39; int v40; - if (idx > MAX_LINES) - error("Attempting to add a line obstacle > MAX_LIGNE."); + assert (idx <= MAX_LINES); if (_linesNumb < idx) _linesNumb = idx; @@ -352,6 +350,8 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int Ligne[idx]._lineDataEndIdx = v35 + 1; Ligne[idx].field2 = a7; Ligne[idx]._direction = a2; + + ++_linesNumb; } /** @@ -3234,4 +3234,15 @@ void LinesManager::removeLine(int idx) { Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); } +void LinesManager::setMaxLineIdx(int idx) { + _maxLineIdx = idx; +} + +void LinesManager::resetLastLine() { + _lastLine = 0; +} + +void LinesManager::resetLinesNumb() { + _linesNumb = 0; +} } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 6098ca5034..2208ced2a1 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -89,6 +89,9 @@ private: SegmentItem Segment[101]; CarreZoneItem CarreZone[101]; int _currentSegmentId; + int _maxLineIdx; + int _lastLine; + int _linesNumb; int CALC_PROPRE(int idx); int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); @@ -106,9 +109,6 @@ private: int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); public: - int _lastLine; - int _linesNumb; - int _maxLineIdx; int16 *essai2; public: @@ -132,6 +132,9 @@ public: int MZONE(); void CARRE_ZONE(); void clearAll(); + void setMaxLineIdx(int idx); + void resetLastLine(); + void resetLinesNumb(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 48fcfb8f10..e488c24321 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1794,7 +1794,7 @@ void ObjectsManager::loadZone(const Common::String &file) { void ObjectsManager::PLAN_BETA() { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; - _vm->_linesManager._maxLineIdx = 1; + _vm->_linesManager.setMaxLineIdx(1); _vm->_globals._characterMaxPosY = 440; _vm->_globals.PLAN_FLAG = true; _vm->_graphicsManager._noFadingFl = false; @@ -2142,8 +2142,8 @@ void ObjectsManager::clearScreen() { _verb = 4; _zoneNum = 0; _forceZoneFl = true; - _vm->_linesManager._linesNumb = 0; - _vm->_linesManager._lastLine = 0; + _vm->_linesManager.resetLinesNumb(); + _vm->_linesManager.resetLastLine(); _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); @@ -3144,7 +3144,7 @@ void ObjectsManager::INILINK(const Common::String &file) { v16 = ptr + idx + 4; v32 = 0; v34 = 0; - _vm->_linesManager._linesNumb = 0; + _vm->_linesManager.resetLinesNumb(); do { v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); if (v27 != -1) { @@ -3156,7 +3156,6 @@ void ObjectsManager::INILINK(const Common::String &file) { (int16)READ_LE_UINT16(v16 + 2 * v32 + 6), (int16)READ_LE_UINT16(v16 + 2 * v32 + 8), 1); - ++_vm->_linesManager._linesNumb; } v32 += 5; ++v34; -- cgit v1.2.3 From e923cdef5b31fbdd85894aa37c186c1e8574ffb9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 23:30:40 +0100 Subject: HOPKINS: Some refactoring in LinesManager --- engines/hopkins/lines.cpp | 89 +++++++++++++++++++++++------------------------ engines/hopkins/lines.h | 17 ++++----- 2 files changed, 51 insertions(+), 55 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index ee3c138236..2b6a650615 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -39,8 +39,8 @@ LinesManager::LinesManager() { for (int i = 0; i < 32002; ++i) super_parcours[i] = 0; for (int i = 0; i < 101; ++i) { - Common::fill((byte *)&Segment[i], (byte *)&Segment[i] + sizeof(SegmentItem), 0); - Common::fill((byte *)&CarreZone[i], (byte *)&CarreZone[i] + sizeof(CarreZoneItem), 0); + Common::fill((byte *)&_segment[i], (byte *)&_segment[i] + sizeof(SegmentItem), 0); + Common::fill((byte *)&_squareZone[i], (byte *)&_squareZone[i] + sizeof(SquareZoneItem), 0); } _linesNumb = 0; @@ -176,10 +176,9 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ v20 += v8; zoneData = (int16 *)_vm->_globals.allocMemory(2 * sizeof(int16) * v20 + (4 * sizeof(int16))); - int v11 = idx; - _zoneLine[v11]._zoneData = zoneData; - if (zoneData == (int16 *)g_PTRNUL) - error("AJOUTE LIGNE ZONE"); + assert(zoneData != (int16 *)g_PTRNUL); + + _zoneLine[idx]._zoneData = zoneData; int16 *dataP = zoneData; int v23 = 1000 * v8 / v20; @@ -3002,15 +3001,15 @@ int LinesManager::MZONE() { } _currentSegmentId = 0; for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { - if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && CarreZone[squareZoneId]._enabledFl == 1 - && CarreZone[squareZoneId]._left <= xp && CarreZone[squareZoneId]._right >= xp - && CarreZone[squareZoneId]._top <= yp && CarreZone[squareZoneId]._bottom >= yp) { - if (CarreZone[squareZoneId]._squareZoneFl) { - _vm->_globals.oldzone_46 = _zoneLine[CarreZone[squareZoneId]._minZoneLineIdx].field2; + if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1 + && _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp + && _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) { + if (_squareZone[squareZoneId]._squareZoneFl) { + _vm->_globals.oldzone_46 = _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx].field2; return _vm->_globals.oldzone_46; } - Segment[_currentSegmentId].field2 = CarreZone[squareZoneId]._minZoneLineIdx; - Segment[_currentSegmentId].field4 = CarreZone[squareZoneId]._maxZoneLineIdx; + _segment[_currentSegmentId]._minZoneLineIdx = _squareZone[squareZoneId]._minZoneLineIdx; + _segment[_currentSegmentId]._maxZoneLineIdx = _squareZone[squareZoneId]._maxZoneLineIdx; ++_currentSegmentId; } } @@ -3081,17 +3080,17 @@ int LinesManager::colision(int xp, int yp) { int xMin = xp - 4; for (int idx = 0; idx <= _currentSegmentId; ++idx) { - int field2 = Segment[idx].field2; - if (Segment[idx].field4 < field2) + int curZoneLineIdx = _segment[idx]._minZoneLineIdx; + if (_segment[idx]._maxZoneLineIdx < curZoneLineIdx) continue; int yMax = yp + 4; int yMin = yp - 4; do { - int16 *dataP = _vm->_linesManager._zoneLine[field2]._zoneData; + int16 *dataP = _vm->_linesManager._zoneLine[curZoneLineIdx]._zoneData; if (dataP != (int16 *)g_PTRNUL) { - int count = _vm->_linesManager._zoneLine[field2]._count; + int count = _vm->_linesManager._zoneLine[curZoneLineIdx]._count; int v1 = dataP[0]; int v2 = dataP[1]; int v3 = dataP[count * 2 - 2]; @@ -3107,17 +3106,17 @@ int LinesManager::colision(int xp, int yp) { if (v2 >= v4 && (yMin > v2 || yMax < v4)) flag = false; - if (flag && _vm->_linesManager._zoneLine[field2]._count > 0) { + if (flag && _vm->_linesManager._zoneLine[curZoneLineIdx]._count > 0) { for (int i = 0; i < count; ++i) { int xCheck = *dataP++; int yCheck = *dataP++; if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) - return _vm->_linesManager._zoneLine[field2].field2; + return _vm->_linesManager._zoneLine[curZoneLineIdx].field2; } } } - } while (++field2 <= Segment[idx].field4); + } while (++curZoneLineIdx <= _segment[idx]._maxZoneLineIdx); } return -1; @@ -3126,14 +3125,14 @@ int LinesManager::colision(int xp, int yp) { // Square Zone void LinesManager::CARRE_ZONE() { for (int idx = 0; idx < 100; ++idx) { - CarreZone[idx]._enabledFl = 0; - CarreZone[idx]._squareZoneFl = false; - CarreZone[idx]._left = 1280; - CarreZone[idx]._right = 0; - CarreZone[idx]._top = 460; - CarreZone[idx]._bottom = 0; - CarreZone[idx]._minZoneLineIdx = 401; - CarreZone[idx]._maxZoneLineIdx = 0; + _squareZone[idx]._enabledFl = 0; + _squareZone[idx]._squareZoneFl = false; + _squareZone[idx]._left = 1280; + _squareZone[idx]._right = 0; + _squareZone[idx]._top = 460; + _squareZone[idx]._bottom = 0; + _squareZone[idx]._minZoneLineIdx = 401; + _squareZone[idx]._maxZoneLineIdx = 0; } for (int idx = 0; idx < MAX_LINES; ++idx) { @@ -3142,32 +3141,32 @@ void LinesManager::CARRE_ZONE() { continue; int carreZoneId = _vm->_linesManager._zoneLine[idx].field2; - CarreZone[carreZoneId]._enabledFl = 1; - if (CarreZone[carreZoneId]._maxZoneLineIdx < idx) - CarreZone[carreZoneId]._maxZoneLineIdx = idx; - if (CarreZone[carreZoneId]._minZoneLineIdx > idx) - CarreZone[carreZoneId]._minZoneLineIdx = idx; + _squareZone[carreZoneId]._enabledFl = 1; + if (_squareZone[carreZoneId]._maxZoneLineIdx < idx) + _squareZone[carreZoneId]._maxZoneLineIdx = idx; + if (_squareZone[carreZoneId]._minZoneLineIdx > idx) + _squareZone[carreZoneId]._minZoneLineIdx = idx; for (int i = 0; i < _vm->_linesManager._zoneLine[idx]._count; i++) { int zoneX = *dataP++; int zoneY = *dataP++; - if (CarreZone[carreZoneId]._left >= zoneX) - CarreZone[carreZoneId]._left = zoneX; - if (CarreZone[carreZoneId]._right <= zoneX) - CarreZone[carreZoneId]._right = zoneX; - if (CarreZone[carreZoneId]._top >= zoneY) - CarreZone[carreZoneId]._top = zoneY; - if (CarreZone[carreZoneId]._bottom <= zoneY) - CarreZone[carreZoneId]._bottom = zoneY; + if (_squareZone[carreZoneId]._left >= zoneX) + _squareZone[carreZoneId]._left = zoneX; + if (_squareZone[carreZoneId]._right <= zoneX) + _squareZone[carreZoneId]._right = zoneX; + if (_squareZone[carreZoneId]._top >= zoneY) + _squareZone[carreZoneId]._top = zoneY; + if (_squareZone[carreZoneId]._bottom <= zoneY) + _squareZone[carreZoneId]._bottom = zoneY; } } for (int idx = 0; idx < 100; idx++) { - int zoneWidth = abs(CarreZone[idx]._left - CarreZone[idx]._right); - int zoneHeight = abs(CarreZone[idx]._top - CarreZone[idx]._bottom); + int zoneWidth = abs(_squareZone[idx]._left - _squareZone[idx]._right); + int zoneHeight = abs(_squareZone[idx]._top - _squareZone[idx]._bottom); if (zoneWidth == zoneHeight) - CarreZone[idx]._squareZoneFl = true; + _squareZone[idx]._squareZoneFl = true; } } @@ -3192,7 +3191,7 @@ void LinesManager::clearAll() { } for (int idx = 0; idx < 100; ++idx) { - _vm->_linesManager.CarreZone[idx]._enabledFl = 0; + _vm->_linesManager._squareZone[idx]._enabledFl = 0; } BUFFERTAPE = _vm->_globals.allocMemory(85000); diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 2208ced2a1..69d59f530f 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -51,12 +51,11 @@ struct SmoothItem { }; struct SegmentItem { - int field0; // Useless variable - int field2; - int field4; + int _minZoneLineIdx; + int _maxZoneLineIdx; }; -struct CarreZoneItem { +struct SquareZoneItem { int _enabledFl; int _left; int _right; @@ -86,8 +85,8 @@ private: int16 *BufLig; LigneZoneItem _zoneLine[401]; LigneItem Ligne[400]; - SegmentItem Segment[101]; - CarreZoneItem CarreZone[101]; + SegmentItem _segment[101]; + SquareZoneItem _squareZone[101]; int _currentSegmentId; int _maxLineIdx; int _lastLine; @@ -107,12 +106,11 @@ private: bool makeSmoothMove(int fromX, int fromY, int destX, int destY); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); - -public: - int16 *essai2; + int colision(int xp, int yp); public: int16 *_route; + int16 *essai2; LinesManager(); ~LinesManager(); @@ -128,7 +126,6 @@ public: void resetLines(); void addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7); void initRoute(); - int colision(int xp, int yp); int MZONE(); void CARRE_ZONE(); void clearAll(); -- cgit v1.2.3 From 0b78d86335a3c5d657b756729760816ed1369c61 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 23:48:50 +0100 Subject: HOPKINS: set private a couple of members of AnimationManager --- engines/hopkins/anim.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index 181a0cf327..c5e6461044 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -34,21 +34,23 @@ class HopkinsEngine; class AnimationManager { private: + HopkinsEngine *_vm; + int loadSpriteBank(int idx, const Common::String &filename); + void searchAnim(const byte *data, int animIndex, int count); + public: - HopkinsEngine *_vm; bool _clearAnimationFl; bool NO_SEQ; bool NO_COUL; -public: + AnimationManager(); void setParent(HopkinsEngine *vm) { _vm = vm; } - void playAnim(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); - void playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); void loadAnim(const Common::String &animName); void clearAnim(); - void searchAnim(const byte *data, int animIndex, int count); + void playAnim(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); + void playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); }; -- cgit v1.2.3 From a896975962078be403cee562598656caae50bb03 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Jan 2013 23:49:20 +0100 Subject: HOPKINS: Renaming of another variable in LinesManager --- engines/hopkins/lines.cpp | 10 +++++----- engines/hopkins/lines.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 2b6a650615..4ee656848c 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -200,7 +200,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ *dataP++ = -1; _zoneLine[idx]._count = v20; - _zoneLine[idx].field2 = bobZoneIdx; + _zoneLine[idx]._bobZoneIdx = bobZoneIdx; } } @@ -3005,7 +3005,7 @@ int LinesManager::MZONE() { && _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp && _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) { if (_squareZone[squareZoneId]._squareZoneFl) { - _vm->_globals.oldzone_46 = _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx].field2; + _vm->_globals.oldzone_46 = _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx]._bobZoneIdx; return _vm->_globals.oldzone_46; } _segment[_currentSegmentId]._minZoneLineIdx = _squareZone[squareZoneId]._minZoneLineIdx; @@ -3112,7 +3112,7 @@ int LinesManager::colision(int xp, int yp) { int yCheck = *dataP++; if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) - return _vm->_linesManager._zoneLine[curZoneLineIdx].field2; + return _vm->_linesManager._zoneLine[curZoneLineIdx]._bobZoneIdx; } } } @@ -3140,7 +3140,7 @@ void LinesManager::CARRE_ZONE() { if (dataP == (int16 *)g_PTRNUL) continue; - int carreZoneId = _vm->_linesManager._zoneLine[idx].field2; + int carreZoneId = _vm->_linesManager._zoneLine[idx]._bobZoneIdx; _squareZone[carreZoneId]._enabledFl = 1; if (_squareZone[carreZoneId]._maxZoneLineIdx < idx) _squareZone[carreZoneId]._maxZoneLineIdx = idx; @@ -3186,7 +3186,7 @@ void LinesManager::clearAll() { _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; _vm->_linesManager._zoneLine[idx]._count = 0; - _vm->_linesManager._zoneLine[idx].field2 = 0; + _vm->_linesManager._zoneLine[idx]._bobZoneIdx = 0; _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 69d59f530f..69efd922d1 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -32,7 +32,7 @@ class HopkinsEngine; struct LigneZoneItem { int _count; - int field2; + int _bobZoneIdx; int16 *_zoneData; }; -- cgit v1.2.3 From 623360cf15173d9b0dfc79acb62732af15c3b095 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Jan 2013 07:15:06 +0100 Subject: HOPKINS: Add fallback alternative for the computer font file, for the BeOS and OS/2 versions --- engines/hopkins/computer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index e44b77c317..eef4a64f3e 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -75,11 +75,16 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - //SET_MODE(SCREEN_WIDTH, SCREEN_HEIGHT); _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_globals.police = _vm->_fileManager.loadFile("STFONT.SPR"); + + Common::String filename = "STFONT.SPR"; + Common::File f; + if (!f.exists(filename)) + filename = "FONTE.SPR"; // Used by the BeOS and OS/2 versions as an alternative + + _vm->_globals.police = _vm->_fileManager.loadFile(filename); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; _vm->_graphicsManager.loadImage("WINTEXT"); -- cgit v1.2.3 From c0ad052c727650464419318a760e08bb7d152072 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Jan 2013 07:45:46 +0100 Subject: HOPKINS: Add a fallback for the sound played in the option menu, for the BeOS and OS/2 versions --- engines/hopkins/sound.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 46bdb1e841..96c7df2329 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -625,12 +625,23 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { } void SoundManager::playSound(const Common::String &file) { - if (!_soundOffFl) { - if (_soundFl) - delWav(_currentSoundIndex); - loadWav(file, 1); - playWav(1); - } + if (_soundOffFl) + return; + + // Fallback for the menu option. + // The BeOS and OS/2 versions don't play sound at this point. + // sound20 sounds very close to bruit2 from the linux and Win95 versions. + Common::File f; + Common::String filename; + if (file == "bruit2.wav" && !f.exists(file)) + filename = "sound20.wav"; + else + filename = file; + + if (_soundFl) + delWav(_currentSoundIndex); + loadWav(filename, 1); + playWav(1); } void SoundManager::PLAY_SOUND2(const Common::String &file) { -- cgit v1.2.3 From 11a0f00c2571d37742db194cdc92fac25283d8eb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Jan 2013 22:36:11 +0100 Subject: HOPKINS: Add hack to improve the display of text on the computers, for the BeOS and OS/2 versions --- engines/hopkins/computer.cpp | 2 +- engines/hopkins/font.cpp | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index eef4a64f3e..b4b89f7dac 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -83,10 +83,10 @@ void ComputerManager::setTextMode() { Common::File f; if (!f.exists(filename)) filename = "FONTE.SPR"; // Used by the BeOS and OS/2 versions as an alternative - _vm->_globals.police = _vm->_fileManager.loadFile(filename); _vm->_globals.police_l = 8; _vm->_globals.police_h = 8; + _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.fadeInLong(); loadMenu(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 1077cad865..faa77377f1 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -464,9 +464,25 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i if (curChar >= 32) { byte printChar = curChar - 32; _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, charEndPosX, yp, printChar, fontCol); - charEndPosX += _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); - int charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); - _vm->_graphicsManager.addVesaSegment(charEndPosX - charWidth, yp, charEndPosX, yp + 12); + + // UGLY HACK: For some obscure reason, the BeOS and OS/2 versions use another font file, which doesn't have variable width. + // All the fonts have a length of 9, which results in completely broken text in the computer. + // This horrible workaround fixes the English versions of the game. So far, no other languages are known for those platforms. + // Just in case, all the accentuated characters are handled properly, which *should* be OK for the other languages too. + int charWidth; + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { + if ((curChar >= 'A' && curChar <= 'Z') || (curChar >= 'a' && curChar <= 'z' && curChar != 'm' && curChar != 'w') || (curChar >= '0' && curChar <= '9') || curChar == '*' || (curChar >= 128 && curChar <= 168)) + charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar) - 1; + else if (curChar == 'm' || curChar == 'w') + charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + else + charWidth = 6; + } else + charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + + int charStartPosX = charEndPosX; + charEndPosX += charWidth; + _vm->_graphicsManager.addVesaSegment(charStartPosX, yp, charEndPosX, yp + 12); if (_vm->_eventsManager._escKeyFl) { _vm->_globals.iRegul = 1; _vm->_eventsManager.VBL(); -- cgit v1.2.3 From fbc19ab3b41cb88b75d3ab35f8d2b0c67a5c5fbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Jan 2013 08:12:43 +0100 Subject: HOPKINS: Various renaming --- engines/hopkins/anim.cpp | 8 +++--- engines/hopkins/anim.h | 4 +-- engines/hopkins/globals.cpp | 12 ++++----- engines/hopkins/globals.h | 2 +- engines/hopkins/objects.cpp | 61 ++++++++++++++++++++++----------------------- engines/hopkins/objects.h | 14 +++++------ 6 files changed, 50 insertions(+), 51 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 1875932a53..7e7c621a8e 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -211,7 +211,7 @@ EXIT: /** * Play Animation, type 2 */ -void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4) { +void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { int v5; byte *screenCopy = NULL; int oldScrollVal = 0; @@ -291,7 +291,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint if (_vm->_eventsManager._escKeyFl) goto LABEL_114; _vm->_eventsManager.refreshEvents(); - if (_vm->_eventsManager._rateCounter >= a2) + if (_vm->_eventsManager._rateCounter >= rate1) goto LABEL_48; } if (_vm->_graphicsManager._skipVideoLockFl) @@ -368,7 +368,7 @@ LABEL_88: while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= a4) + if (_vm->_eventsManager._rateCounter >= rate3) goto LABEL_114; } } @@ -378,7 +378,7 @@ LABEL_88: while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= a3) + if (_vm->_eventsManager._rateCounter >= rate2) goto LABEL_77; } LABEL_114: diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index c5e6461044..e89d2155b9 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -49,8 +49,8 @@ public: void loadAnim(const Common::String &animName); void clearAnim(); - void playAnim(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); - void playAnim2(const Common::String &filename, uint32 a2, uint32 a3, uint32 a4); + void playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3); + void playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3); void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); }; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a8ee4e4063..5d27768522 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -412,7 +412,7 @@ void Globals::resetCache() { Cache[idx]._x = 0; Cache[idx]._y = 0; Cache[idx]._spriteIndex = 0; - Cache[idx].fieldA = 0; + Cache[idx]._useCount = 0; Cache[idx]._width = 0; Cache[idx]._height = 0; Cache[idx].field10 = false; @@ -432,11 +432,11 @@ void Globals::CACHE_OFF(int v1) { } void Globals::CACHE_SUB(int idx) { - Cache[idx].fieldA = 0; + Cache[idx]._useCount = 0; } void Globals::CACHE_ADD(int idx) { - Cache[idx].fieldA = 1; + Cache[idx]._useCount = 1; } // Load Cache @@ -467,18 +467,18 @@ void Globals::loadCache(const Common::String &file) { Cache[v6]._x = v4; Cache[v6]._y = v5; if (spriteData == g_PTRNUL) { - Cache[i].fieldA = 0; + Cache[i]._useCount = 0; } else { int v8 = _vm->_objectsManager.getWidth(spriteData, v11); int v9 = _vm->_objectsManager.getHeight(spriteData, v11); Cache[i]._spriteData = spriteData; Cache[i]._width = v8; Cache[i]._height = v9; - Cache[i].fieldA = 1; + Cache[i]._useCount = 1; } if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) - Cache[i].fieldA = 0; + Cache[i]._useCount = 0; v15 += 5; } CACHE_ON(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f17156cee9..8676c9384a 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -155,7 +155,7 @@ struct CacheItem { int _y; int _width; int _height; - int fieldA; + int _useCount; byte *_spriteData; bool field10; int field14; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e488c24321..558c006b98 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -353,7 +353,7 @@ void ObjectsManager::displaySprite() { DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; case SORT_CACHE: - DEF_CACHE(_vm->_globals._sortedDisplay[idx]._index); + displayCache(_vm->_globals._sortedDisplay[idx]._index); break; default: break; @@ -370,7 +370,7 @@ void ObjectsManager::displaySprite() { DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; case SORT_CACHE: - DEF_CACHE(_vm->_globals._sortedDisplay[idx]._index); + displayCache(_vm->_globals._sortedDisplay[idx]._index); break; default: break; @@ -606,7 +606,7 @@ void ObjectsManager::BOB_OFFSET(int idx, int offset) { } void ObjectsManager::SCBOB(int idx) { - if (_vm->_globals.Cache[idx].fieldA <= 0) + if (_vm->_globals.Cache[idx]._useCount == 0) return; for (int i = 0; i <= 20; i++) { @@ -621,7 +621,7 @@ void ObjectsManager::SCBOB(int idx) { || (cachedRight >= _vm->_globals._bob[i]._oldWidth && _vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) || (_vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) || (_vm->_globals._bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight)) - ++_vm->_globals.Cache[idx].fieldA; + ++_vm->_globals.Cache[idx]._useCount; } } } @@ -712,10 +712,10 @@ void ObjectsManager::CALCUL_BOB(int idx) { void ObjectsManager::checkCache() { for (int cacheIdx = 0; cacheIdx <= 19; cacheIdx++) { - if (_vm->_globals.Cache[cacheIdx].fieldA <= 0) + if (_vm->_globals.Cache[cacheIdx]._useCount == 0) continue; - int oldFieldA = _vm->_globals.Cache[cacheIdx].fieldA; + int _oldEnableCount = _vm->_globals.Cache[cacheIdx]._useCount; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; @@ -728,16 +728,16 @@ void ObjectsManager::checkCache() { || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX) || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) - ++_vm->_globals.Cache[cacheIdx].fieldA; + ++_vm->_globals.Cache[cacheIdx]._useCount; } } } SCBOB(cacheIdx); - if (_vm->_globals.Cache[cacheIdx].fieldA == oldFieldA) { + if (_vm->_globals.Cache[cacheIdx]._useCount == _oldEnableCount) { if (_vm->_globals.Cache[cacheIdx].field10) { _vm->_globals.Cache[cacheIdx].field10 = false; - _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._useCount = 1; } } else { int priority = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y; @@ -745,7 +745,7 @@ void ObjectsManager::checkCache() { priority = 500; beforeSort(SORT_CACHE, cacheIdx, priority); - _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._useCount = 1; _vm->_globals.Cache[cacheIdx].field10 = true; } } @@ -789,7 +789,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx]._posX + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx]._posY + _vm->_globals.Liste[idx]._height); } -void ObjectsManager::DEF_CACHE(int idx) { +void ObjectsManager::displayCache(int idx) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1], _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, _vm->_globals.Cache[idx]._spriteIndex); @@ -839,7 +839,7 @@ void ObjectsManager::computeSprite(int idx) { deltaY = _vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } else { tmpY = abs(tmpX); - deltaY = -_vm->_graphicsManager.zoomIn(abs(tmpX), zoomPercent); + deltaY = -_vm->_graphicsManager.zoomIn(tmpY, zoomPercent); } } else if (reducePercent) { if (tmpX >= 0) @@ -851,7 +851,7 @@ void ObjectsManager::computeSprite(int idx) { deltaY = _vm->_graphicsManager.zoomOut(tmpY, reducePercent); } else { tmpY = abs(tmpX); - deltaY = -_vm->_graphicsManager.zoomOut(abs(tmpX), reducePercent); + deltaY = -_vm->_graphicsManager.zoomOut(tmpY, reducePercent); } } @@ -883,12 +883,11 @@ void ObjectsManager::computeSprite(int idx) { } // Before Sort -void ObjectsManager::beforeSort(SortMode triMode, int index, int priority) { +void ObjectsManager::beforeSort(SortMode sortMode, int index, int priority) { ++_vm->_globals._sortedDisplayCount; - if (_vm->_globals._sortedDisplayCount > 48) - error("NBTRI too high"); + assert (_vm->_globals._sortedDisplayCount <= 48); - _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._sortMode = triMode; + _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._sortMode = sortMode; _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._index = index; _vm->_globals._sortedDisplay[_vm->_globals._sortedDisplayCount]._priority = priority; } @@ -980,7 +979,7 @@ void ObjectsManager::displayBobAnim() { if (v10 > 0) { int v11 = v10 / _vm->_globals._speed; - _vm->_globals._bob[idx].field12 = v10 / _vm->_globals._speed; + _vm->_globals._bob[idx].field12 = v11; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) _vm->_globals._bob[idx].field12 = 1; @@ -2993,9 +2992,9 @@ void ObjectsManager::disableZone(int idx) { } -void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { +void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction) { // Set Hopkins animation and position - if (a4 != 3) { + if (animAction != 3) { setBobAnimation(idx); SET_BOBPOSI(idx, fromPosi); } @@ -3005,9 +3004,9 @@ void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int a4) { _vm->_eventsManager.VBL(); } while (destPosi != BOBPOSI(idx)); - if (!a4) + if (!animAction) stopBobAnimation(idx); - else if (a4 == 4) { + else if (animAction == 4) { _vm->_graphicsManager.fastDisplay(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._oldX, _vm->_globals._bob[idx]._oldY, _vm->_globals._bob[idx]._frameIndex); stopBobAnimation(idx); @@ -3121,16 +3120,16 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.Cache[cacheIdx]._y = v10; if (!_vm->_globals.CACHE_BANQUE[1]) { - _vm->_globals.Cache[cacheIdx].fieldA = 0; + _vm->_globals.Cache[cacheIdx]._useCount = 0; } else { _vm->_globals.Cache[cacheIdx]._spriteData = _vm->_globals.CACHE_BANQUE[1]; _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); - _vm->_globals.Cache[cacheIdx].fieldA = 1; + _vm->_globals.Cache[cacheIdx]._useCount = 1; } if (!_vm->_globals.Cache[cacheIdx]._x && !_vm->_globals.Cache[cacheIdx]._y && !_vm->_globals.Cache[cacheIdx]._spriteIndex) - _vm->_globals.Cache[cacheIdx].fieldA = 0; + _vm->_globals.Cache[cacheIdx]._useCount = 0; v36 += 5; } @@ -3477,7 +3476,7 @@ void ObjectsManager::enableVerb(int idx, int a2) { } } -void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl) { +void ObjectsManager::ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl) { bool tokenCompleteFl; char curChar; int spriteIndex; @@ -3499,7 +3498,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in for (;;) { tokenCompleteFl = false; - curChar = a2[strPos]; + curChar = actionStr[strPos]; if (curChar == ',') { idx = atoi(tmpStr.c_str()); tmpStr = ""; @@ -3520,7 +3519,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &a2, in _sprite[0]._spriteData = spriteData; _sprite[0]._spriteIndex = idx; } - for (int v10 = 0; v10 < realSpeed; v10++) + for (int i = 0; i < realSpeed; i++) _vm->_eventsManager.VBL(); if (idx == -1) break; @@ -3706,9 +3705,9 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in } } -void ObjectsManager::lockAnimX(int idx, int a2) { +void ObjectsManager::lockAnimX(int idx, int x) { _vm->_globals._lockedAnims[idx]._enableFl = true; - _vm->_globals._lockedAnims[idx]._posX = a2; + _vm->_globals._lockedAnims[idx]._posX = x; } void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, @@ -3733,7 +3732,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (!s4.empty()) { if (initializeScreen) _vm->_graphicsManager.INI_ECRAN(s4, initializeScreen); - if (!s4.empty() && !initializeScreen) + else _vm->_graphicsManager.INI_ECRAN2(s4, initializeScreen); } _vm->_eventsManager.mouseOn(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d0d61c954c..5f6633d82b 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -124,9 +124,9 @@ public: void checkCache(); void DEF_SPRITE(int idx); - void DEF_CACHE(int idx); + void displayCache(int idx); void computeSprite(int idx); - void beforeSort(SortMode triMode, int index, int priority); + void beforeSort(SortMode sortMode, int index, int priority); void displayBobAnim(); void displayVBob(); @@ -161,12 +161,12 @@ public: void computeAndSetSpriteSize(); void nextVerbIcon(); void handleRightButton(); - void initBorder(int a1); + void initBorder(int zoneIdx); void nextObjectIcon(int idx); void takeInventoryObject(int idx); void OPTI_OBJET(); void handleSpecialGames(); - void BOB_VIVANT(int a1); + void BOB_VIVANT(int idx); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); void ACTION_DOS(int idx); @@ -178,7 +178,7 @@ public: void enableZone(int idx); void disableZone(int idx); - void OPTI_ONE(int idx, int fromPosi, int destPosi, int a4); + void OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction); int BOBPOSI(int idx); void setBobAnimation(int idx); void stopBobAnimation(int idx); @@ -194,11 +194,11 @@ public: void disableVerb(int idx, int a2); void enableVerb(int idx, int a2); - void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int speed, bool flipFl); + void ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl); void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); - void lockAnimX(int idx, int a2); + void lockAnimX(int idx, int x); /** * Game scene control method -- cgit v1.2.3 From 4fed1f580eb3a02ffde3f3b8ee4f8167326a7782 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Jan 2013 08:35:14 +0100 Subject: HOPKINS: More renaming in the Global class --- engines/hopkins/computer.cpp | 32 +++++++++++----------- engines/hopkins/font.cpp | 30 ++++++++++----------- engines/hopkins/globals.cpp | 39 ++++++++++++--------------- engines/hopkins/globals.h | 30 +++++++++------------ engines/hopkins/hopkins.cpp | 64 +++++++++++++++++++++----------------------- engines/hopkins/lines.cpp | 44 ++++++++++++------------------ engines/hopkins/objects.cpp | 64 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 4 +-- 8 files changed, 143 insertions(+), 164 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b4b89f7dac..38b464cf68 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -77,15 +77,15 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; - _vm->_globals.police = _vm->_globals.freeMemory(_vm->_globals.police); + _vm->_globals._font = _vm->_globals.freeMemory(_vm->_globals._font); Common::String filename = "STFONT.SPR"; Common::File f; if (!f.exists(filename)) filename = "FONTE.SPR"; // Used by the BeOS and OS/2 versions as an alternative - _vm->_globals.police = _vm->_fileManager.loadFile(filename); - _vm->_globals.police_l = 8; - _vm->_globals.police_h = 8; + _vm->_globals._font = _vm->_fileManager.loadFile(filename); + _vm->_globals._fontFixedWidth = 8; + _vm->_globals._fontFixedHeight = 8; _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.fadeInLong(); @@ -424,28 +424,28 @@ void ComputerManager::displayMessage(int xp, int yp, int textIdx) { // BackSpace if (curChar == 8 && textIndex > 0) { _inputBuf[textIndex--] = 0; - x1 -= _vm->_globals.police_l; - x2 = x1 + 2 * _vm->_globals.police_l; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + x1 -= _vm->_globals._fontFixedWidth; + x2 = x1 + 2 * _vm->_globals._fontFixedWidth; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, x2, yp + 12); _vm->_fontManager.displayTextVesa(x1, yp, "_", 252); } if (mappedChar != '*') { newChar = mappedChar; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); _inputBuf[textIndex] = newChar; charString = Common::String::format("%c_", newChar); _vm->_fontManager.displayTextVesa(x1, yp, charString, 252); ++textIndex; - x1 += _vm->_globals.police_l; + x1 += _vm->_globals._fontFixedWidth; } _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals.police_l, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals.police_l + x1, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; @@ -470,11 +470,11 @@ void ComputerManager::outText2(const Common::String &msg) { * Restores the scene for the FBI headquarters room */ void ComputerManager::restoreFBIRoom() { - _vm->_globals.freeMemory(_vm->_globals.police); - _vm->_globals.police = _vm->_fileManager.loadFile("FONTE3.SPR"); + _vm->_globals.freeMemory(_vm->_globals._font); + _vm->_globals._font = _vm->_fileManager.loadFile("FONTE3.SPR"); - _vm->_globals.police_l = 12; - _vm->_globals.police_h = 21; + _vm->_globals._fontFixedWidth = 12; + _vm->_globals._fontFixedHeight = 21; _vm->_eventsManager._mouseFl = true; } diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index faa77377f1..59c37b27f8 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -135,7 +135,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int v73 = xp; if (idx < 0) error("Bad number for text"); - _vm->_globals.police_l = 11; + _vm->_globals._fontFixedWidth = 11; _vm->_globals._boxWidth = 11 * _text[idx]._length; if (_text[idx]._textLoadedFl) { @@ -144,7 +144,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int yCurrent = yp + 5; for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); - yCurrent += _vm->_globals.police_h + 1; + yCurrent += _vm->_globals._fontFixedHeight + 1; } } else { int height = _text[idx]._height; @@ -243,7 +243,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in byte v16 = _tempText[v15]; if (v16 <= 31) v16 = ' '; - _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals.police, v16 - 32); + _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals._font, v16 - 32); } _vm->_globals._boxWidth += 2; @@ -271,7 +271,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in do curChar = _tempText[v65 + v19++]; while (curChar != ' ' && curChar != '%'); - if (v19 >= ptrb / _vm->_globals.police_l) { + if (v19 >= ptrb / _vm->_globals._fontFixedWidth) { if (curChar == '%') curChar = ' '; break; @@ -306,7 +306,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if (v24 <= 32) v24 = ' '; - ptrc += _vm->_objectsManager.getWidth(_vm->_globals.police, (byte)v24 - 32); + ptrc += _vm->_objectsManager.getWidth(_vm->_globals._font, (byte)v24 - 32); } _textSortArray[i] = ptrc; } @@ -344,7 +344,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int posX = v73; int posY = yp; int saveWidth = _vm->_globals._boxWidth + 10; - int saveHeight = (_vm->_globals.police_h + 1) * lineCount + 12; + int saveHeight = (_vm->_globals._fontFixedHeight + 1) * lineCount + 12; if (_text[idx]._textType == 6) { int v27 = saveWidth / 2; if (v27 < 0) @@ -378,7 +378,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in for (int lineNum = 0; lineNum < lineCount; ++lineNum) { displayText(v73 + 5, v71, _text[idx]._lines[lineNum], _text[idx]._color); - v71 += _vm->_globals.police_h + 1; + v71 += _vm->_globals._fontFixedHeight + 1; } int blockWidth = saveWidth + 1; @@ -418,9 +418,9 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, break; if (currChar >= 32) { charIndex = currChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, currentX, yp, currChar - 32, col); - currentX += _vm->_objectsManager.getWidth(_vm->_globals.police, charIndex); + currentX += _vm->_objectsManager.getWidth(_vm->_globals._font, charIndex); } } @@ -436,8 +436,8 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, xp, yp, characterIndex, col); - xp += _vm->_objectsManager.getWidth(_vm->_globals.police, characterIndex); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, xp, yp, characterIndex, col); + xp += _vm->_objectsManager.getWidth(_vm->_globals._font, characterIndex); } } } @@ -463,7 +463,7 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i break; if (curChar >= 32) { byte printChar = curChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, charEndPosX, yp, printChar, fontCol); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, charEndPosX, yp, printChar, fontCol); // UGLY HACK: For some obscure reason, the BeOS and OS/2 versions use another font file, which doesn't have variable width. // All the fonts have a length of 9, which results in completely broken text in the computer. @@ -472,13 +472,13 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i int charWidth; if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { if ((curChar >= 'A' && curChar <= 'Z') || (curChar >= 'a' && curChar <= 'z' && curChar != 'm' && curChar != 'w') || (curChar >= '0' && curChar <= '9') || curChar == '*' || (curChar >= 128 && curChar <= 168)) - charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar) - 1; + charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar) - 1; else if (curChar == 'm' || curChar == 'w') - charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); else charWidth = 6; } else - charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar); + charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); int charStartPosX = charEndPosX; charEndPosX += charWidth; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 5d27768522..d912f4f227 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -110,11 +110,11 @@ Globals::Globals() { PUBEXIT = false; _speed = 1; - g_old_anim = 0; + _oldFrameIndex = 0; _oldDirection = 0; _oldDirectionSpriteIdx = 59; _lastDirection = 0; - police_l = police_h = 0; + _fontFixedWidth = _fontFixedHeight = 0; TETE = NULL; NUM_FICHIER_OBJ = 0; nbrligne = 0; @@ -152,12 +152,10 @@ Globals::Globals() { Credit_bx1 = -1; Credit_by = -1; Credit_by1 = -1; - Credit_y = 0; - Credit_lignes = 0; - memset(Credit, 0, 12000); - Credit_step = 0; - Credit_l = 0; - Credit_h = 0; + _creditsPosY = 0; + _creditsLineNumb = 0; + memset(_creditsItem, 0, 12000); + _creditsStep = 0; _oceanDirection = 0; @@ -168,13 +166,12 @@ Globals::Globals() { CACHE_BANQUE[idx] = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; - inventaire2 = NULL; GESTE = NULL; _inventoryObject = NULL; _forestSprite = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; - police = NULL; + _font = NULL; PERSO = NULL; OPTION_SPR = NULL; @@ -186,15 +183,14 @@ Globals::Globals() { _optionDialogFl = false; _cacheFl = false; _introSpeechOffFl = false; - couleur_40 = 50; + _baseMapColor = 50; // Reset indexed variables _hotspotTextColor = 0; - oldzone_46 = 0; - old_x1_65 = 0; - old_y1_66 = 0; - old_x2_67 = 0; - old_y2_68 = 0; + _oldRouteFromX = 0; + _oldRouteFromY = 0; + _oldRouteDestX = 0; + _oldRouteDestY = 0; _oldMouseZoneId = 0; _oldZoneNum = 0; _oldMouseX = 0; @@ -207,13 +203,12 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); freeMemory(TETE); - freeMemory(police); + freeMemory(_font); freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); - freeMemory(inventaire2); freeMemory(GESTE); freeMemory(_inventoryObject); freeMemory(_forestSprite); @@ -273,9 +268,9 @@ void Globals::clearAll() { nbrligne = 80; INIT_ANIM(); - police = g_PTRNUL; - police_h = 0; - police_l = 0; + _font = g_PTRNUL; + _fontFixedHeight = 0; + _fontFixedWidth = 0; _boxWidth = 0; _vm->_fontManager.clearAll(); @@ -326,7 +321,7 @@ void Globals::loadCharacterData() { Hopkins[idx].field2 = *srcP++; } - g_old_anim = -1; + _oldFrameIndex = -1; _oldDirection = -1; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 8676c9384a..c29b9789ff 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -304,18 +304,17 @@ public: Common::String FICH_ZONE; Common::String FICH_TEXTE; bool _censorshipFl; - int g_old_anim; + int _oldFrameIndex; int _oldDirection, _oldDirectionSpriteIdx; int _lastDirection; - byte *police; - int police_l; - int police_h; + byte *_font; + int _fontFixedWidth; + int _fontFixedHeight; byte *TETE; byte *ICONE; byte *BUF_ZONE; byte *SPRITE_ECRAN; Sauvegarde *_saveData; - byte *inventaire2; byte *GESTE; int NUM_FICHIER_OBJ; int nbrligne; // Useless variable? @@ -358,18 +357,17 @@ public: bool GOACTION; int Compteur; int _actionDirection; - int couleur_40; + int _baseMapColor; int _hotspotTextColor; - int oldzone_46; - int old_x1_65; - int old_y1_66; - int old_x2_67; + int _oldRouteFromX; + int _oldRouteFromY; + int _oldRouteDestX; int _oldMouseZoneId; int _oldMouseX, _oldMouseY; int compteur_71; bool _forceHideText; - int old_y2_68; + int _oldRouteDestY; int _oldZoneNum; int j_104; @@ -377,12 +375,10 @@ public: int Credit_bx1; int Credit_by; int Credit_by1; - int Credit_y; - int Credit_lignes; - CreditItem Credit[200]; - int Credit_step; - int Credit_l; - int Credit_h; + int _creditsPosY; + int _creditsLineNumb; + CreditItem _creditsItem[200]; + int _creditsStep; int _oceanDirection; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 766c37bea3..2ff70f5abd 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1557,7 +1557,7 @@ void HopkinsEngine::initializeSystem() { // Set graphics mode _graphicsManager.setGraphicalMode(SCREEN_WIDTH, SCREEN_HEIGHT); - // Synchronise the sound settings from ScummVM + // Synchronize the sound settings from ScummVM _soundManager.syncSoundSettings(); const Common::FSNode gameDataDir(ConfMan.get("path")); @@ -1608,9 +1608,9 @@ void HopkinsEngine::initializeSystem() { _globals.clearAll(); - _globals.police = _fileManager.loadFile("FONTE3.SPR"); - _globals.police_l = 12; - _globals.police_h = 21; + _globals._font = _fileManager.loadFile("FONTE3.SPR"); + _globals._fontFixedWidth = 12; + _globals._fontFixedHeight = 21; _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); _globals.TETE = _fileManager.loadFile("TETE.SPR"); @@ -2326,10 +2326,10 @@ int HopkinsEngine::handleBaseMap() { zone = 6; if (zone) { _eventsManager.changeMouseCursor(4); - _globals.couleur_40 += 25; - if (_globals.couleur_40 > 100) - _globals.couleur_40 = 0; - _graphicsManager.SETCOLOR4(251, _globals.couleur_40, _globals.couleur_40, _globals.couleur_40); + _globals._baseMapColor += 25; + if (_globals._baseMapColor > 100) + _globals._baseMapColor = 0; + _graphicsManager.SETCOLOR4(251, _globals._baseMapColor, _globals._baseMapColor, _globals._baseMapColor); } else { _eventsManager.changeMouseCursor(0); _graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -2370,10 +2370,8 @@ int HopkinsEngine::handleBaseMap() { } void HopkinsEngine::loadCredits() { - _globals.Credit_y = 440; - _globals.Credit_l = 10; - _globals.Credit_h = 40; - _globals.Credit_step = 45; + _globals._creditsPosY = 440; + _globals._creditsStep = 45; byte *bufPtr; switch (_globals._language) { case LANG_EN: @@ -2399,25 +2397,25 @@ void HopkinsEngine::loadCredits() { loopCond = true; break; } - _globals.Credit[idxLines]._colour = curPtr[1]; - _globals.Credit[idxLines]._actvFl = true; - _globals.Credit[idxLines]._linePosY = _globals.Credit_y + idxLines * _globals.Credit_step; + _globals._creditsItem[idxLines]._colour = curPtr[1]; + _globals._creditsItem[idxLines]._actvFl = true; + _globals._creditsItem[idxLines]._linePosY = _globals._creditsPosY + idxLines * _globals._creditsStep; int idxBuf = 0; for(; idxBuf < 49; idxBuf++) { byte curChar = curPtr[idxBuf + 3]; if (curChar == '%' || curChar == 10) break; - _globals.Credit[idxLines]._line[idxBuf] = curChar; + _globals._creditsItem[idxLines]._line[idxBuf] = curChar; } - _globals.Credit[idxLines]._line[idxBuf] = 0; - _globals.Credit[idxLines]._lineSize = idxBuf - 1; + _globals._creditsItem[idxLines]._line[idxBuf] = 0; + _globals._creditsItem[idxLines]._lineSize = idxBuf - 1; curPtr = curPtr + idxBuf + 2; ++idxLines; } else { curPtr++; } - _globals.Credit_lignes = idxLines; + _globals._creditsLineNumb = idxLines; } while (!loopCond); _globals.freeMemory(bufPtr); @@ -2432,7 +2430,7 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) - strWidth += _objectsManager.getWidth(_globals.police, curChar - 32); + strWidth += _objectsManager.getWidth(_globals._font, curChar - 32); } int startPosX = 320 - strWidth / 2; int endPosX = strWidth + startPosX; @@ -2458,15 +2456,15 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) { - _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals.police, startPosX, startPosY, curChar - 32, colour); - startPosX += _objectsManager.getWidth(_globals.police, curChar - 32); + _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals._font, startPosX, startPosY, curChar - 32, colour); + startPosX += _objectsManager.getWidth(_globals._font, curChar - 32); } } } void HopkinsEngine::displayCredits() { loadCredits(); - _globals.Credit_y = 436; + _globals._creditsPosY = 436; _graphicsManager.loadImage("GENERIC"); _graphicsManager.fadeInLong(); _soundManager.WSOUND(28); @@ -2475,14 +2473,14 @@ void HopkinsEngine::displayCredits() { _globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1; int soundId = 28; do { - for (int i = 0; i < _globals.Credit_lignes; ++i) { - if (_globals.Credit[i]._actvFl) { - int nextY = _globals.Credit_y + i * _globals.Credit_step; - _globals.Credit[i]._linePosY = nextY; + for (int i = 0; i < _globals._creditsLineNumb; ++i) { + if (_globals._creditsItem[i]._actvFl) { + int nextY = _globals._creditsPosY + i * _globals._creditsStep; + _globals._creditsItem[i]._linePosY = nextY; if ((nextY - 21 >= 0) && (nextY - 21 <= 418)) { int col = 0; - switch (_globals.Credit[i]._colour) { + switch (_globals._creditsItem[i]._colour) { case '1': col = 163; break; @@ -2497,20 +2495,20 @@ void HopkinsEngine::displayCredits() { col = 163; break; } - if (_globals.Credit[i]._lineSize != -1) - displayCredits(nextY, _globals.Credit[i]._line, col); + if (_globals._creditsItem[i]._lineSize != -1) + displayCredits(nextY, _globals._creditsItem[i]._line, col); } } } - --_globals.Credit_y; + --_globals._creditsPosY; if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) { _eventsManager.VBL(); _graphicsManager.copySurface(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50); } else { _eventsManager.VBL(); } - if (_globals.Credit[_globals.Credit_lignes - 1]._linePosY <= 39) { - _globals.Credit_y = 440; + if (_globals._creditsItem[_globals._creditsLineNumb - 1]._linePosY <= 39) { + _globals._creditsPosY = 440; ++soundId; if (soundId > 31) soundId = 28; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4ee656848c..1ed1841077 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1204,8 +1204,8 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (destY <= 24) clipDestY = 25; if (!_vm->_globals.NOT_VERIF) { - if (abs(fromX - _vm->_globals.old_x1_65) <= 4 && abs(fromY - _vm->_globals.old_y1_66) <= 4 && - abs(_vm->_globals.old_x2_67 - destX) <= 4 && abs(_vm->_globals.old_y2_68 - clipDestY) <= 4) + if (abs(fromX - _vm->_globals._oldRouteFromX) <= 4 && abs(fromY - _vm->_globals._oldRouteFromY) <= 4 && + abs(_vm->_globals._oldRouteDestX - destX) <= 4 && abs(_vm->_globals._oldRouteDestY - clipDestY) <= 4) return (int16 *)g_PTRNUL; if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4) @@ -1216,10 +1216,10 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } _vm->_globals.NOT_VERIF = false; _vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum; - _vm->_globals.old_x1_65 = fromX; - _vm->_globals.old_x2_67 = destX; - _vm->_globals.old_y1_66 = fromY; - _vm->_globals.old_y2_68 = clipDestY; + _vm->_globals._oldRouteFromX = fromX; + _vm->_globals._oldRouteDestX = destX; + _vm->_globals._oldRouteFromY = fromY; + _vm->_globals._oldRouteDestY = clipDestY; _pathFindingMaxDepth = 0; int v112 = 0; if (destX <= 19) @@ -3004,19 +3004,17 @@ int LinesManager::MZONE() { if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1 && _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp && _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) { - if (_squareZone[squareZoneId]._squareZoneFl) { - _vm->_globals.oldzone_46 = _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx]._bobZoneIdx; - return _vm->_globals.oldzone_46; - } + if (_squareZone[squareZoneId]._squareZoneFl) + return _zoneLine[_squareZone[squareZoneId]._minZoneLineIdx]._bobZoneIdx; + _segment[_currentSegmentId]._minZoneLineIdx = _squareZone[squareZoneId]._minZoneLineIdx; _segment[_currentSegmentId]._maxZoneLineIdx = _squareZone[squareZoneId]._maxZoneLineIdx; ++_currentSegmentId; } } - if (!_currentSegmentId) { - _vm->_globals.oldzone_46 = -1; + if (!_currentSegmentId) return -1; - } + int colRes1 = 0; for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { @@ -3025,10 +3023,8 @@ int LinesManager::MZONE() { break; } - if (colRes1 == -1) { - _vm->_globals.oldzone_46 = -1; + if (colRes1 == -1) return -1; - } int colRes2 = 0; for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { @@ -3037,10 +3033,8 @@ int LinesManager::MZONE() { break; } - if (colRes2 == -1) { - _vm->_globals.oldzone_46 = -1; + if (colRes2 == -1) return -1; - } int colRes3 = 0; for (int k = xp; k >= 0; --k) { @@ -3048,10 +3042,8 @@ int LinesManager::MZONE() { if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } - if (colRes3 == -1) { - _vm->_globals.oldzone_46 = -1; + if (colRes3 == -1) return -1; - } int colRes4 = 0; for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { @@ -3059,13 +3051,11 @@ int LinesManager::MZONE() { if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) break; } - if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) { - _vm->_globals.oldzone_46 = colRes1; + if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) result = colRes1; - } else { - _vm->_globals.oldzone_46 = -1; + else result = -1; - } + } else { result = 0; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 558c006b98..62d02238f5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1369,7 +1369,7 @@ void ObjectsManager::GOHOME() { if (newPosX != -1 || newPosY != -1) { _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals.g_old_anim = 0; + _vm->_globals._oldFrameIndex = 0; g_old_x = newPosX; g_old_y = newPosY; } else { @@ -1403,13 +1403,13 @@ void ObjectsManager::GOHOME() { return; } if (_vm->_globals._oldDirection == 3) { - if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { + if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { v0 = g_old_x; v58 = g_old_y; v1 = 24; } else { - int v3 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v4 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v3 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v4 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomFactor); @@ -1420,20 +1420,20 @@ void ObjectsManager::GOHOME() { } v0 = v3 + g_old_x; v58 = g_old_y + v4; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 7) { - if (_vm->_globals.g_old_anim < 24 || _vm->_globals.g_old_anim > 35) { + if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { v0 = g_old_x; v58 = g_old_y; v1 = 24; } else { - int v9 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v10 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v9 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v10 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomFactor); v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomFactor); @@ -1443,19 +1443,19 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x - v9; v58 = g_old_y - v10; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 1) { - if (_vm->_globals.g_old_anim > 11) { + if (_vm->_globals._oldFrameIndex > 11) { v0 = g_old_x; v58 = g_old_y; v1 = 0; } else { - int v16 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + int v16 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1463,7 +1463,7 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x; v58 = g_old_y - v16; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 11) v1 = 0; } @@ -1471,12 +1471,12 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 5) { - if (_vm->_globals.g_old_anim < 48 || _vm->_globals.g_old_anim > 59) { + if (_vm->_globals._oldFrameIndex < 48 || _vm->_globals._oldFrameIndex > 59) { v0 = g_old_x; v58 = g_old_y; v1 = 48; } else { - int v20 = abs(_vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2); + int v20 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { v20 = _vm->_graphicsManager.zoomOut(v20, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1484,20 +1484,20 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x; v58 = v20 + g_old_y; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 59) v1 = 48; } _vm->_globals.Compteur = 4 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 2) { - if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { + if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { v0 = g_old_x; v58 = g_old_y; v1 = 12; } else { - int v23 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v24 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v23 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v24 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v23 = _vm->_graphicsManager.zoomOut(v23, -_sprite[0]._zoomFactor); v24 = _vm->_graphicsManager.zoomOut(v24, -_sprite[0]._zoomFactor); @@ -1508,20 +1508,20 @@ void ObjectsManager::GOHOME() { } v0 = v23 + g_old_x; v58 = g_old_y + v24; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 8) { - if (_vm->_globals.g_old_anim < 12 || _vm->_globals.g_old_anim > 23) { + if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { v0 = g_old_x; v58 = g_old_y; v1 = 12; } else { - int v29 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v30 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v29 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v30 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v29 = _vm->_graphicsManager.zoomOut(v29, -_sprite[0]._zoomFactor); v30 = _vm->_graphicsManager.zoomOut(v30, -_sprite[0]._zoomFactor); @@ -1531,20 +1531,20 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x - v29; v58 = g_old_y + v30; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 4) { - if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { + if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { v0 = g_old_x; v58 = g_old_y; v1 = 36; } else { - int v35 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v36 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v35 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v36 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v35 = _vm->_graphicsManager.zoomOut(v35, -_sprite[0]._zoomFactor); v36 = _vm->_graphicsManager.zoomOut(v36, -_sprite[0]._zoomFactor); @@ -1555,20 +1555,20 @@ void ObjectsManager::GOHOME() { } v0 = v35 + g_old_x; v58 = g_old_y + v36; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 6) { - if (_vm->_globals.g_old_anim < 36 || _vm->_globals.g_old_anim > 47) { + if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { v0 = g_old_x; v58 = g_old_y; v1 = 36; } else { - int v41 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field0; - int v42 = _vm->_globals.Hopkins[_vm->_globals.g_old_anim].field2; + int v41 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int v42 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { v41 = _vm->_graphicsManager.zoomOut(v41, -_sprite[0]._zoomFactor); v42 = _vm->_graphicsManager.zoomOut(v42, -_sprite[0]._zoomFactor); @@ -1579,7 +1579,7 @@ void ObjectsManager::GOHOME() { } v0 = g_old_x - v41; v58 = g_old_y + v42; - v1 = _vm->_globals.g_old_anim + 1; + v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; } @@ -1654,7 +1654,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals.g_old_anim = v1; + _vm->_globals._oldFrameIndex = v1; g_old_x = newPosX; g_old_y = newPosY; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 60553cd009..88110157ca 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -516,7 +516,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { Common::File f; int filesize; - _vm->_globals.police_l = 11; + _vm->_globals._fontFixedWidth = 11; // Build up the filename filename = dest = file; @@ -577,7 +577,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { ++v10; } while (v11 != ' ' && v11 != '%'); - if (v10 >= v15 / _vm->_globals.police_l) { + if (v10 >= v15 / _vm->_globals._fontFixedWidth) { if (v11 == '%') v11 = ' '; break; -- cgit v1.2.3 From 9ceb6c18cd47bdbd3472ef892956f69aec0fd067 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Jan 2013 21:16:46 +0100 Subject: HOPKINS: Fix regression introduced in 4ce218ef00225dc6f0032fe263a53170dfbbea9b --- engines/hopkins/script.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a9bcae6be6..87f2410330 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2351,7 +2351,6 @@ int ScriptManager::handleOpcode(byte *dataP) { int idx = (int16)READ_LE_UINT16(dataP + 5); assert(idx >= 0 && idx < 2050); _vm->_globals._saveData->_data[idx] = dataP[7]; - _vm->_globals._saveData->_data[idx + 1] = dataP[8]; } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { opcodeType = 1; _vm->_globals._saveData->_data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; -- cgit v1.2.3 From 3b63e28a39cd80ada4c67ee17536566424e0d573 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Jan 2013 23:59:25 +0100 Subject: HOPKINS: Refactor searchCharacterAnim() --- engines/hopkins/talk.cpp | 112 +++++++++++++++++++---------------------------- engines/hopkins/talk.h | 2 +- 2 files changed, 46 insertions(+), 68 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 88110157ca..3e88415383 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -709,84 +709,61 @@ void TalkManager::clearCharacterAnim() { } } -bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int a4) { - bool result; - const byte *v5; - int v6; - byte *v8; - byte *v9; - int v10; - int v11; - int v12; - int v14; - int v15; - int v16; - int v18; - int v22; - int v23; - const byte *v24; - - v22 = 0; - result = false; - - do { - if (bufPerso[v22] == 'A' && bufPerso[v22 + 1] == 'N' && bufPerso[v22 + 2] == 'I' && bufPerso[v22 + 3] == 'M' && bufPerso[v22 + 4] == a3) { - v5 = v22 + bufPerso + 5; - v18 = v22 + 5; - v6 = 0; - bool v7 = false; +bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, int bufferSize) { + bool result = false; + + for (int bufPos = 0; bufPos <= bufferSize; bufPos++) { + if (READ_BE_UINT32(bufPerso + bufPos) == MKTAG('A', 'N', 'I', 'M') && bufPerso[bufPos + 4] == animId) { + int bufIndx = bufPos + 5; + const byte *curPtr = bufPerso + bufIndx; + int animLength = 0; + bool loopCond = false; do { - if ((v5[0] == 'A' && v5[1] == 'N' && v5[2] == 'I' && v5[3] == 'M') || - (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N')) - v7 = true; - if (v18 > a4) { + if (READ_BE_UINT32(curPtr) == MKTAG('A', 'N', 'I', 'M') || + (curPtr[0] == 'F' && curPtr[1] == 'I' && curPtr[2] == 'N')) + loopCond = true; + if (bufIndx > bufferSize) { _vm->_globals.Bqe_Anim[idx]._enabledFl = false; - result = false; _vm->_globals.Bqe_Anim[idx]._data = g_PTRNUL; + return false; } - ++v18; - ++v6; - ++v5; - } while (!v7); - _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(v6 + 50); + ++bufIndx; + ++animLength; + ++curPtr; + } while (!loopCond); + _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(animLength + 50); _vm->_globals.Bqe_Anim[idx]._enabledFl = true; - memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(v22 + bufPerso + 5), 20); - v8 = _vm->_globals.Bqe_Anim[idx]._data; - - v9 = v8 + 20; - v24 = v22 + bufPerso + 25; - v10 = (int16)READ_LE_UINT16(v22 + bufPerso + 25); - v11 = (int16)READ_LE_UINT16(v22 + bufPerso + 27); - v23 = (int16)READ_LE_UINT16(v22 + bufPerso + 29); - v12 = (int16)READ_LE_UINT16(v22 + bufPerso + 31); - v8[28] = bufPerso[v22 + 33]; - v8[29] = bufPerso[v22 + 34]; - WRITE_LE_UINT16(v8 + 20, v10); - WRITE_LE_UINT16(v8 + 22, v11); - WRITE_LE_UINT16(v8 + 24, v23); - WRITE_LE_UINT16(v8 + 26, v12); + memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20); + int v23 = (int16)READ_LE_UINT16(bufPos + bufPerso + 29); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 20, (int16)READ_LE_UINT16(bufPos + bufPerso + 25)); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 22, (int16)READ_LE_UINT16(bufPos + bufPerso + 27)); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 24, v23); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 26, (int16)READ_LE_UINT16(bufPos + bufPerso + 31)); + _vm->_globals.Bqe_Anim[idx]._data[28] = bufPerso[bufPos + 33]; + _vm->_globals.Bqe_Anim[idx]._data[29] = bufPerso[bufPos + 34]; + byte *bqeCurData = _vm->_globals.Bqe_Anim[idx]._data + 20; + const byte *curBufPerso = bufPos + bufPerso + 25; for (int i = 1; i < 5000; i++) { - v9 += 10; - v24 += 10; + bqeCurData += 10; + curBufPerso += 10; if (!v23) break; - v14 = (int16)READ_LE_UINT16(v24); - v15 = (int16)READ_LE_UINT16(v24 + 2); - v23 = (int16)READ_LE_UINT16(v24 + 4); - v16 = (int16)READ_LE_UINT16(v24 + 6); - v9[8] = v24[8]; - v9[9] = v24[9]; - WRITE_LE_UINT16(v9, v14); - WRITE_LE_UINT16(v9 + 2, v15); - WRITE_LE_UINT16(v9 + 4, v23); - WRITE_LE_UINT16(v9 + 6, v16); + v23 = (int16)READ_LE_UINT16(curBufPerso + 4); + WRITE_LE_UINT16(bqeCurData, (int16)READ_LE_UINT16(curBufPerso)); + WRITE_LE_UINT16(bqeCurData + 2, (int16)READ_LE_UINT16(curBufPerso + 2)); + WRITE_LE_UINT16(bqeCurData + 4, v23); + WRITE_LE_UINT16(bqeCurData + 6, (int16)READ_LE_UINT16(curBufPerso + 6)); + bqeCurData[8] = curBufPerso[8]; + bqeCurData[9] = curBufPerso[9]; } result = true; } - if (bufPerso[v22] == 'F' && bufPerso[v22 + 1] == 'I' && bufPerso[v22 + 2] == 'N') + if (bufPerso[bufPos] == 'F' && bufPerso[bufPos + 1] == 'I' && bufPerso[bufPos + 2] == 'N') result = true; - ++v22; - } while (v22 <= a4 && !result); + + if (result) + break; + } return result; } @@ -852,7 +829,8 @@ LABEL_2: } while (!v16); } if (!v16) { - if ((curAnswerBuf[v7] == 'C' && curAnswerBuf[v7 + 1] == 'O' && curAnswerBuf[v7 + 2] == 'D') || (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'I' && curAnswerBuf[v7 + 2] == 'N')) + if ((curAnswerBuf[v7] == 'C' && curAnswerBuf[v7 + 1] == 'O' && curAnswerBuf[v7 + 2] == 'D') || + (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'I' && curAnswerBuf[v7 + 2] == 'N')) loopCond = true; } curAnswerBuf += v7 + 1; diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index db49e7bb02..20b79f8015 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -64,7 +64,7 @@ public: void startCharacterAnim0(int startIndedx, bool readOnlyFl); void initCharacterAnim(); void clearCharacterAnim(); - bool searchCharacterAnim(int idx, const byte *bufPerso, int a3, int a4); + bool searchCharacterAnim(int idx, const byte *bufPerso, int animId, int bufferSize); void REPONSE(int zone, int verb); void REPONSE2(int a1, int a2); void OBJET_VIVANT(const Common::String &a2); -- cgit v1.2.3 From e68e3c91ebb089cf31f305f18199bb3a9ccca612 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 Jan 2013 00:17:08 +0100 Subject: HOPKINS: USe MKTAG where possible --- engines/hopkins/anim.cpp | 6 +++--- engines/hopkins/talk.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 7e7c621a8e..ec256eb05d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -489,7 +489,7 @@ void AnimationManager::loadAnim(const Common::String &animName) { f.read(filename5, 15); f.read(filename6, 15); - if (header[0] != 'A' || header[1] != 'N' || header[2] != 'I' || header[3] != 'S') + if (READ_BE_UINT32(header) != MKTAG('A', 'N', 'I', 'S')) error("Invalid animation File: %s", filename.c_str()); const char *files[6] = { &filename1[0], &filename2[0], &filename3[0], &filename4[0], @@ -622,14 +622,14 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { v21 = 0; bool loopCond = false; do { - if (data[v21] == 'A' && data[v21 + 1] == 'N' && data[v21 + 2] == 'I' && data[v21 + 3] == 'M') { + if (READ_BE_UINT32(&data[v21]) == MKTAG('A', 'N', 'I', 'M')) { int entryIndex = data[v21 + 4]; if (animIndex == entryIndex) { v6 = v21 + 5; v7 = 0; bool innerLoopCond = false; do { - if ((data[v6] == 'A' && data[v6 + 1] == 'N' && data[v6 + 2] == 'I' && data[v6 + 3] == 'M') || + if (READ_BE_UINT32(&data[v6]) == MKTAG('A', 'N', 'I', 'M') || (data[v6] == 'F' && data[v6 + 1] == 'I' && data[v6 + 2] == 'N')) innerLoopCond = true; if (count < v6) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 3e88415383..5e265dbeff 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -633,7 +633,7 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { int animIdx = 0; size_t curIdx = startIdx; for (;;) { - if (_characterBuffer[curIdx] == 'A' && _characterBuffer[curIdx + 1] == 'N' && _characterBuffer[curIdx + 2] == 'I' && _characterBuffer[curIdx + 3] == 'M' && _characterBuffer[curIdx + 4] == 1) { + if (READ_BE_UINT32(&_characterBuffer[curIdx]) == MKTAG('A', 'N', 'I', 'M') && _characterBuffer[curIdx + 4] == 1) { animIdx = curIdx; break; } -- cgit v1.2.3 From 15de07ff74e610510f724cca9c6d155ef376d68a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 Jan 2013 08:31:32 +0100 Subject: HOPKINS: Introduce MKTAG24. Make use of MKTAG16 and MKTAG24 --- engines/hopkins/anim.cpp | 5 +- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/hopkins.h | 6 ++ engines/hopkins/objects.cpp | 8 +- engines/hopkins/script.cpp | 187 ++++++++++++++++++++++++++----------------- engines/hopkins/talk.cpp | 19 +++-- 6 files changed, 137 insertions(+), 90 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index ec256eb05d..a492d0a5ac 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -629,8 +629,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { v7 = 0; bool innerLoopCond = false; do { - if (READ_BE_UINT32(&data[v6]) == MKTAG('A', 'N', 'I', 'M') || - (data[v6] == 'F' && data[v6 + 1] == 'I' && data[v6 + 2] == 'N')) + if (READ_BE_UINT32(&data[v6]) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(&data[v6]) == MKTAG24('F', 'I', 'N')) innerLoopCond = true; if (count < v6) { _vm->_globals.Bqe_Anim[animIndex]._enabledFl = false; @@ -678,7 +677,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { loopCond = true; } } - if (data[v21] == 'F' && data[v21 + 1] == 'I' && data[v21 + 2] == 'N') + if (READ_BE_UINT24(&data[v21]) == MKTAG24('F', 'I', 'N')) loopCond = true; ++v21; } while (v21 <= count && !loopCond); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3203749cf8..a81ce9db41 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1768,7 +1768,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia } } } - if (ptr[0] != 'I' || ptr[1] != 'N' || ptr[2] != 'I') { + if (READ_BE_UINT24(ptr) != MKTAG24('I', 'N', 'I')) { error("Error, file not ini"); } else { bool doneFlag = false; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 4ab356be9a..04b3558963 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -75,6 +75,12 @@ enum { #define MAX_LINES 400 +/** + * A wrapper macro used around three character constants, like 'END', to + * ensure portability. Typical usage: MKTAG24('E','N','D'). + */ +#define MKTAG24(a0,a1,a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16))) + struct HopkinsGameDescription; class HopkinsEngine : public Engine { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 62d02238f5..7f94c8d92c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1198,7 +1198,7 @@ void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, _sprite[idx].field14 = a9; _sprite[idx]._animationType = 0; - if (spriteData[0] == 'R' && spriteData[1] == 'L' && spriteData[2] == 'E') { + if (READ_BE_UINT24(spriteData) == MKTAG24('R', 'L', 'E')) { _sprite[idx]._rleFl = true; _sprite[idx]._zoomFactor = 0; _sprite[idx]._flipFl = false; @@ -2615,7 +2615,7 @@ void ObjectsManager::OPTI_OBJET() { error("INI file %s not found", file.c_str()); } - if (data[0] != 'I' || data[1] != 'N' || data[2] != 'I') + if (READ_BE_UINT24(data) != MKTAG24('I', 'N', 'I')) error("File %s is not an INI file", file.c_str()); for (;;) { @@ -3139,7 +3139,7 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_linesManager.resetLines(); for (size_t idx = 0; idx < nbytes; idx++) { - if (ptr[idx] == 'O' && ptr[idx + 1] == 'B' && ptr[idx + 2] == '2') { + if (READ_BE_UINT24(&ptr[idx]) == MKTAG24('O', 'B', '2')) { v16 = ptr + idx + 4; v32 = 0; v34 = 0; @@ -3165,7 +3165,7 @@ void ObjectsManager::INILINK(const Common::String &file) { if (!OBSSEUL) { for (size_t idx = 0; idx < nbytes; idx++) { - if (ptr[idx] == 'Z' && ptr[idx + 1] == 'O' && ptr[idx + 2] == '2') { + if (READ_BE_UINT24(&ptr[idx]) == MKTAG24('Z', 'O', '2')) { v17 = &ptr[idx + 4]; v33 = 0; for (int i = 1; i <= 100; i++) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 87f2410330..a662a3755c 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -43,12 +43,15 @@ void ScriptManager::setParent(HopkinsEngine *vm) { } int ScriptManager::handleOpcode(byte *dataP) { - if (dataP[0] != 'F' || dataP[1] != 'C') + if (READ_BE_UINT16(dataP) != MKTAG16('F', 'C')) return 0; int opcodeType = 0; int vbobFrameIndex = 0; - if (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') { + + uint32 signature24 = READ_BE_UINT24(&dataP[2]); + switch (signature24) { + case MKTAG24('T', 'X', 'T'): { vbobFrameIndex = dataP[6]; int mesgId = (int16)READ_LE_UINT16(dataP + 13); opcodeType = 1; @@ -161,7 +164,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.mixVoice(mesgId, 5); } } - } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') { + break; + } + case MKTAG24('B', 'O', 'B'): if (!_vm->_objectsManager._disableFl) { int vbobIdx = dataP[5]; vbobFrameIndex = dataP[6]; @@ -190,7 +195,8 @@ int ScriptManager::handleOpcode(byte *dataP) { warning("Former AFFICHE_SPEED1: %d %d %d", vbobPosX, vbobPosY, vbobFrameIndex); } opcodeType = 1; - } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { + break; + case MKTAG24('S', 'T', 'P'): if (!_vm->_objectsManager._disableFl) { _vm->_objectsManager._twoCharactersFl = false; _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); @@ -249,7 +255,8 @@ int ScriptManager::handleOpcode(byte *dataP) { } opcodeType = 1; _vm->_objectsManager._changeHeadFl = false; - } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { + break; + case MKTAG24('S', 'T', 'E'): if (!_vm->_objectsManager._disableFl) { _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->_data[svField6] = _vm->_globals._screenId; @@ -257,11 +264,13 @@ int ScriptManager::handleOpcode(byte *dataP) { vbobFrameIndex = dataP[6]; } opcodeType = 1; - } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') { + break; + case MKTAG24('B', 'O', 'F'): if (!_vm->_objectsManager._disableFl) _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; - } else if (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') { + break; + case MKTAG24('P', 'E', 'R'): { int specialOpcode = (int16)READ_LE_UINT16(dataP + 5); if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) { vbobFrameIndex = 0; @@ -440,49 +449,64 @@ int ScriptManager::handleOpcode(byte *dataP) { } } opcodeType = 1; - } else if (dataP[2] == 'M' && dataP[3] == 'U' && dataP[4] == 'S') { + break; + } + case MKTAG24('M', 'U', 'S'): opcodeType = 1; - } else if (dataP[2] == 'W' && dataP[3] == 'A' && dataP[4] == 'I') { - uint v74 = READ_LE_UINT16(dataP + 5) / _vm->_globals._speed; - if (!v74) - v74 = 1; - for (uint v10 = 0; v10 < v74 + 1; v10++) { + break; + case MKTAG24('W', 'A', 'I'): { + uint frameNumb = READ_LE_UINT16(dataP + 5) / _vm->_globals._speed; + if (!frameNumb) + frameNumb = 1; + for (uint i = 0; i < frameNumb + 1; i++) { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); } opcodeType = 1; - } else if (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'P') { + break; + } + case MKTAG24('O', 'B', 'P'): opcodeType = 1; _vm->_objectsManager.addObject((int16)READ_LE_UINT16(dataP + 5)); - } else if (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'M') { + break; + case MKTAG24('O', 'B', 'M'): opcodeType = 1; _vm->_objectsManager.removeObject((int16)READ_LE_UINT16(dataP + 5)); - } else if (dataP[2] == 'G' && dataP[3] == 'O' && dataP[4] == 'T') { + break; + case MKTAG24('G', 'O', 'T'): opcodeType = 2; - } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N') { + break; + case MKTAG24('Z', 'O', 'N'): _vm->_objectsManager.enableZone((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; - } else if (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') { + break; + case MKTAG24('Z', 'O', 'F'): _vm->_objectsManager.disableZone((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; - } else if (dataP[2] == 'E' && dataP[3] == 'X' && dataP[4] == 'I') { + break; + case MKTAG24('E', 'X', 'I'): opcodeType = 5; - } else if (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'R') { + break; + case MKTAG24('S', 'O', 'R'): _vm->_globals._exitId = (int16)READ_LE_UINT16(dataP + 5); opcodeType = 5; - } else if (dataP[2] == 'B' && dataP[3] == 'C' && dataP[4] == 'A') { + break; + case MKTAG24('B', 'C', 'A'): _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; - } else if (dataP[2] == 'A' && dataP[3] == 'N' && dataP[4] == 'I') { - int v75 = (int16)READ_LE_UINT16(dataP + 5); - if (v75 <= 100) - _vm->_objectsManager.setBobAnimation(v75); + break; + case MKTAG24('A', 'N', 'I'): { + int animId = (int16)READ_LE_UINT16(dataP + 5); + if (animId <= 100) + _vm->_objectsManager.setBobAnimation(animId); else - _vm->_objectsManager.stopBobAnimation(v75 - 100); + _vm->_objectsManager.stopBobAnimation(animId - 100); opcodeType = 1; - } else if (dataP[2] == 'S' && dataP[3] == 'P' && dataP[4] == 'E') { + break; + } + case MKTAG24('S', 'P', 'E'): switch ((int16)READ_LE_UINT16(dataP + 5)) { case 6: _vm->_objectsManager.removeSprite(0); @@ -2344,40 +2368,56 @@ int ScriptManager::handleOpcode(byte *dataP) { break; } opcodeType = 1; - } else if (dataP[2] == 'E' && dataP[3] == 'I' && dataP[4] == 'F') { + break; + case MKTAG24('E', 'I', 'F'): opcodeType = 4; - } else if (dataP[2] == 'V' && dataP[3] == 'A' && dataP[4] == 'L') { + break; + case MKTAG24('V', 'A', 'L'): { opcodeType = 1; int idx = (int16)READ_LE_UINT16(dataP + 5); assert(idx >= 0 && idx < 2050); _vm->_globals._saveData->_data[idx] = dataP[7]; - } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { + break; + } + case MKTAG24('A', 'D', 'D'): opcodeType = 1; _vm->_globals._saveData->_data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; - } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') { + break; + case MKTAG24('B', 'O', 'S'): opcodeType = 1; _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); - } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'N') { + break; + case MKTAG24('V', 'O', 'N'): _vm->_objectsManager.enableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); opcodeType = 1; - } else if (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') { + break; + case MKTAG24('Z', 'C', 'H'): _vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 1; - } else if (dataP[2] == 'J' && dataP[3] == 'U' && dataP[4] == 'M') { + break; + case MKTAG24('J', 'U', 'M'): _vm->_objectsManager._jumpZone = (int16)READ_LE_UINT16(dataP + 5); _vm->_objectsManager._jumpVerb = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 6; - } else if (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') { + break; + case MKTAG24('S', 'O', 'U'): { int soundNum = (int16)READ_LE_UINT16(dataP + 5); Common::String file = Common::String::format("SOUND%d.WAV", soundNum); _vm->_soundManager.playSound(file); opcodeType = 1; - } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') { + break; + } + case MKTAG24('V', 'O', 'F'): _vm->_objectsManager.disableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); opcodeType = 1; - } else if (dataP[2] == 'I' && dataP[3] == 'I' && dataP[4] == 'F') { + break; + case MKTAG24('I', 'I', 'F'): opcodeType = 3; + break; + default: + warning("Unhandled opcode %c%c%c", dataP[2], dataP[3], dataP[4]); + break; } return opcodeType; @@ -2466,48 +2506,51 @@ LABEL_2: } int ScriptManager::checkOpcode(const byte *dataP) { - if (dataP[0] != 'F' || dataP[1] != 'C') { - return 0; - } - int result = 0; - - if ((dataP[2] == 'A' && dataP[3] == 'N' && dataP[4] == 'I') || - (dataP[2] == 'B' && dataP[3] == 'C' && dataP[4] == 'A') || - (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') || - (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'F') || - (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') || - (dataP[2] == 'M' && dataP[3] == 'U' && dataP[4] == 'S') || - (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'M') || - (dataP[2] == 'O' && dataP[3] == 'B' && dataP[4] == 'P') || - (dataP[2] == 'P' && dataP[3] == 'E' && dataP[4] == 'R') || - (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') || - (dataP[2] == 'S' && dataP[3] == 'P' && dataP[4] == 'E') || - (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') || - (dataP[2] == 'V' && dataP[3] == 'A' && dataP[4] == 'L') || - (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') || - (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'N') || - (dataP[2] == 'Z' && dataP[3] == 'C' && dataP[4] == 'H') || - (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'F') || - (dataP[2] == 'Z' && dataP[3] == 'O' && dataP[4] == 'N')) + if (READ_BE_UINT16(dataP) != MKTAG16('F', 'C')) + return result; + + uint32 signature24 = READ_BE_UINT24(&dataP[2]); + switch (signature24) { + case MKTAG24('A', 'N', 'I'): + case MKTAG24('B', 'C', 'A'): + case MKTAG24('B', 'O', 'B'): + case MKTAG24('B', 'O', 'F'): + case MKTAG24('B', 'O', 'S'): + case MKTAG24('M', 'U', 'S'): + case MKTAG24('O', 'B', 'M'): + case MKTAG24('O', 'B', 'P'): + case MKTAG24('P', 'E', 'R'): + case MKTAG24('S', 'O', 'U'): + case MKTAG24('S', 'P', 'E'): + case MKTAG24('T', 'X', 'T'): + case MKTAG24('V', 'A', 'L'): + case MKTAG24('V', 'O', 'F'): + case MKTAG24('V', 'O', 'N'): + case MKTAG24('Z', 'C', 'H'): + case MKTAG24('Z', 'O', 'F'): + case MKTAG24('Z', 'O', 'N'): result = 1; - - if (dataP[2] == 'G' && dataP[3] == 'O' && dataP[4] == 'T') + break; + case MKTAG24('G', 'O', 'T'): result = 2; - - if (dataP[2] == 'I' && dataP[3] == 'I' && dataP[4] == 'F') + break; + case MKTAG24('I', 'I', 'F'): result = 3; - - if (dataP[2] == 'E' && dataP[3] == 'I' && dataP[4] == 'F') + break; + case MKTAG24('E', 'I', 'F'): result = 4; - - if ((dataP[2] == 'E' && dataP[3] == 'X' && dataP[4] == 'I') || - (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'R')) + break; + case MKTAG24('E', 'X', 'I'): + case MKTAG24('S', 'O', 'R'): result = 5; - - if (dataP[2] == 'J' && dataP[3] == 'U' && dataP[4] == 'M') + break; + case MKTAG24('J', 'U', 'M'): result = 6; - + break; +// default: +// warning("Unhandled opcode %c%c%c", dataP[2], dataP[3], dataP[4]); + } return result; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 5e265dbeff..d655b95822 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -436,7 +436,7 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) { int palettePos = 0; size_t curIdx = startIdx; for (;;) { - if (_characterBuffer[curIdx] == 'P' && _characterBuffer[curIdx + 1] == 'A' && _characterBuffer[curIdx + 2] == 'L') { + if (READ_BE_UINT24(&_characterBuffer[curIdx]) == MKTAG24('P', 'A', 'L')) { palettePos = curIdx; break; } @@ -719,8 +719,7 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, int animLength = 0; bool loopCond = false; do { - if (READ_BE_UINT32(curPtr) == MKTAG('A', 'N', 'I', 'M') || - (curPtr[0] == 'F' && curPtr[1] == 'I' && curPtr[2] == 'N')) + if (READ_BE_UINT32(curPtr) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(curPtr) == MKTAG24('F', 'I', 'N')) loopCond = true; if (bufIndx > bufferSize) { _vm->_globals.Bqe_Anim[idx]._enabledFl = false; @@ -758,7 +757,7 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, } result = true; } - if (bufPerso[bufPos] == 'F' && bufPerso[bufPos + 1] == 'I' && bufPerso[bufPos + 2] == 'N') + if (READ_BE_UINT24(&bufPerso[bufPos]) == MKTAG24('F', 'I', 'N')) result = true; if (result) @@ -789,9 +788,9 @@ LABEL_2: byte *curAnswerBuf = _vm->_globals._answerBuffer; for (;;) { - if (curAnswerBuf[0] == 'F' && curAnswerBuf[1] == 'I' && curAnswerBuf[2] == 'N') + if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('F', 'I', 'N')) return; - if (curAnswerBuf[0] == 'C' && curAnswerBuf[1] == 'O' && curAnswerBuf[2] == 'D') { + if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('C', 'O', 'D')) { if (curAnswerBuf[3] == zoneObj && curAnswerBuf[4] == verbObj) tagFound = true; } @@ -811,7 +810,7 @@ LABEL_2: loopCond = false; do { v16 = false; - if (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'C') { + if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'C')) { ++v12; assert(v12 < (620 / 20)); @@ -820,7 +819,7 @@ LABEL_2: do { assert(v11 < 20); v8[v11++] = curAnswerBuf[v7++]; - if (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'F') { + if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'F')) { v16 = true; v8[v11] = 'F'; v8[v11 + 1] = 'F'; @@ -829,8 +828,8 @@ LABEL_2: } while (!v16); } if (!v16) { - if ((curAnswerBuf[v7] == 'C' && curAnswerBuf[v7 + 1] == 'O' && curAnswerBuf[v7 + 2] == 'D') || - (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'I' && curAnswerBuf[v7 + 2] == 'N')) + uint32 signature24 = READ_BE_UINT24(&curAnswerBuf[v7]); + if (signature24 == MKTAG24('C', 'O', 'D') || signature24 == MKTAG24('F', 'I', 'N')) loopCond = true; } curAnswerBuf += v7 + 1; -- cgit v1.2.3 From 9dd09f6c6eff178e6c996f59d95fd9014d9653c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 31 Jan 2013 07:48:44 +0100 Subject: HOPKINS: Remove some more casts to unsigned int --- engines/hopkins/events.cpp | 2 +- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/lines.cpp | 55 ++++++++++++++++++-------------------------- 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 448838bc2c..dd929ac214 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -319,7 +319,7 @@ void EventsManager::VBL() { signed int v11 = 0; signed int v12 = 0; int v13 = 0; - unsigned int v14 = 0; + uint v14 = 0; int v15 = 0; int yp = 0; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index a81ce9db41..0aa9d3ff15 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -485,7 +485,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width if (Agr_Flag_y) break; - if ((unsigned int)Agr_y < 100) + if (Agr_y >= 0 && Agr_y < 100) break; Agr_y -= 100; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 1ed1841077..5b6631c77f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1807,28 +1807,17 @@ LABEL_150: v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; newDirection = -1; - if ((int16)v99 / 1000 == -1 && (unsigned int)v101 <= 150) + if (v94 == -1 && (v101 >= 0 && v101 <= 150)) newDirection = 1; - if (v13 == 1) { - if ((unsigned int)(v99 + 1) <= 151) - newDirection = 3; - if ((unsigned int)v99 <= 150) - newDirection = 3; - } - if (v94 == 1) { - if ((unsigned int)v101 <= 150) - newDirection = 5; - if ((unsigned int)(v101 + 150) <= 150) - newDirection = 5; - } - if (v13 == -1) { - if ((unsigned int)v99 <= 150) - newDirection = 7; - if ((unsigned int)(v99 + 150) <= 150) - newDirection = 7; - } - if (v94 == -1 && (unsigned int)(v101 + 150) <= 150) + if (v13 == 1 && (v99 >= -1 && v99 <= 150)) + newDirection = 3; + if (v94 == 1 && (v101 >= -150 && v101 <= 150)) + newDirection = 5; + if (v13 == -1 && (v99 >= -150 && v99 <= 150)) + newDirection = 7; + if (v94 == -1 && (v101 >= -150 && v101 <= 0)) newDirection = 1; + if (newDirection == -1 && !checkSmoothMove(curX, v109, destX, destY) && !makeSmoothMove(curX, v109, destX, destY)) break; LABEL_72: @@ -1885,40 +1874,40 @@ LABEL_72: } } if (v22 == 1) { - if ((unsigned int)(v100 + 1) <= 511) + if (v100 >= -1 && v100 <= 510) newDirection = 2; - if ((unsigned int)(v100 + 510) <= 510) + if (v100 >= -510 && v100 <= 0) newDirection = 3; - if ((unsigned int)v100 <= 510) + if (v100 >= 0 && v100 <= 510) newDirection = 3; - if ((unsigned int)(v100 - 510) <= 490) + if (v100 >= 510 && v100 <= 1000) newDirection = 4; } if (v96 == 1) { - if ((unsigned int)(v102 - 510) <= 490) + if (v102 >= 510 && v102 <= 1000) newDirection = 4; - if ((unsigned int)v102 <= 510) + if (v102 >= 0 && v102 <= 510) newDirection = 5; // CHECKME: The two conditions on v102 are not compatible! if (v102 >= -1 && v102 <= -510) newDirection = 6; - if ((unsigned int)(v102 + 510) <= 510) + if (v102 >= -510 && v102 <= 0) newDirection = 5; } if (v22 == -1) { - if ((unsigned int)(v100 - 510) <= 490) + if (v100 >= 510 && v100 <= 1000) newDirection = 6; - if ((unsigned int)v100 <= 510) + if (v100 >= 0 && v100 <= 510) newDirection = 7; - if ((unsigned int)(v100 + 1000) <= 490) + if (v100 >= -1000 && v100 <= -510) newDirection = 8; - if ((unsigned int)(v100 + 510) <= 510) + if (v100 >= -510 && v100 <= 0) newDirection = 7; } if (v96 == -1) { - if ((unsigned int)(v102 + 1000) <= 490) + if (v102 >= -1000 && v102 <= -510) newDirection = 8; - if ((unsigned int)(v102 + 510) <= 510) + if (v102 >= -510 && v102 <= 0) newDirection = 1; } v23 = 0; -- cgit v1.2.3 From ab6826e24d2c2b8dbaeb7ca7ce944351b535f9bf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 31 Jan 2013 08:18:01 +0100 Subject: HOPKINS: Start refactoring searchAnim --- engines/hopkins/anim.cpp | 97 ++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 56 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index a492d0a5ac..ce3ae57b8d 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -462,15 +462,6 @@ LABEL_114: * Load Animation */ void AnimationManager::loadAnim(const Common::String &animName) { - char dummyBuf[15]; - char header[10]; - char filename1[15]; - char filename2[15]; - char filename3[15]; - char filename4[15]; - char filename5[15]; - char filename6[15]; - clearAnim(); Common::String filename = animName + ".ANI"; @@ -480,6 +471,16 @@ void AnimationManager::loadAnim(const Common::String &animName) { int filesize = f.size(); int nbytes = filesize - 115; + + char header[10]; + char dummyBuf[15]; + char filename1[15]; + char filename2[15]; + char filename3[15]; + char filename4[15]; + char filename5[15]; + char filename6[15]; + f.read(header, 10); f.read(dummyBuf, 15); f.read(filename1, 15); @@ -608,24 +609,15 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { int v6; int v7; - byte *v9; - int v10; - int v11; - int v12; - int v15; - int v16; - int v21; + int curDestDataIndx; + int curSrcDataIndx; int v22; - const byte *v23; - int v; - v21 = 0; - bool loopCond = false; - do { - if (READ_BE_UINT32(&data[v21]) == MKTAG('A', 'N', 'I', 'M')) { - int entryIndex = data[v21 + 4]; + for (int dataIdx = 0; dataIdx <= count; dataIdx++) { + if (READ_BE_UINT32(&data[dataIdx]) == MKTAG('A', 'N', 'I', 'M')) { + int entryIndex = data[dataIdx + 4]; if (animIndex == entryIndex) { - v6 = v21 + 5; + v6 = dataIdx + 5; v7 = 0; bool innerLoopCond = false; do { @@ -641,46 +633,39 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { } while (!innerLoopCond); _vm->_globals.Bqe_Anim[animIndex]._data = _vm->_globals.allocMemory(v7 + 50); _vm->_globals.Bqe_Anim[animIndex]._enabledFl = true; - memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, v21 + data + 5, 20); + memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, dataIdx + data + 5, 20); byte *dataP = _vm->_globals.Bqe_Anim[animIndex]._data; - v9 = dataP + 20; - v23 = v21 + data + 25; - v10 = READ_LE_UINT16(v21 + data + 25); - v11 = READ_LE_UINT16(v21 + data + 27); - v22 = READ_LE_UINT16(v21 + data + 29); - v12 = READ_LE_UINT16(v21 + data + 31); - WRITE_LE_UINT16(dataP + 20, v10); - WRITE_LE_UINT16(dataP + 22, v11); - WRITE_LE_UINT16(dataP + 24, v22); - WRITE_LE_UINT16(dataP + 26, v12); - dataP[28] = data[v21 + 33]; - dataP[29] = data[v21 + 34]; - - for (int v14 = 1; v14 <= 4999; v14++) { - v9 += 10; - v23 += 10; + curDestDataIndx = 20; + curSrcDataIndx = dataIdx + 25; + v22 = READ_LE_UINT16(data + dataIdx + 29); + WRITE_LE_UINT16(dataP + curDestDataIndx, READ_LE_UINT16(data + dataIdx + 25)); + WRITE_LE_UINT16(dataP + curDestDataIndx + 2, READ_LE_UINT16(data + dataIdx + 27)); + WRITE_LE_UINT16(dataP + curDestDataIndx + 4, v22); + WRITE_LE_UINT16(dataP + curDestDataIndx + 6, READ_LE_UINT16(data + dataIdx + 31)); + dataP[curDestDataIndx + 8] = data[dataIdx + 33]; + dataP[curDestDataIndx + 9] = data[dataIdx + 34]; + + for (int i = 1; i <= 4999; i++) { + curDestDataIndx += 10; + curSrcDataIndx += 10; if (!v22) break; - v = READ_LE_UINT16(v23); - v15 = READ_LE_UINT16(v23 + 2); - v22 = READ_LE_UINT16(v23 + 4); - v16 = READ_LE_UINT16(v23 + 6); - WRITE_LE_UINT16(v9, v); - WRITE_LE_UINT16(v9 + 2, v15); - WRITE_LE_UINT16(v9 + 4, v22); - WRITE_LE_UINT16(v9 + 6, v16); - v9[8] = v23[8]; - v9[9] = v23[9]; + v22 = READ_LE_UINT16(data + curSrcDataIndx + 4); + WRITE_LE_UINT16(dataP + curDestDataIndx, READ_LE_UINT16(data + curSrcDataIndx)); + WRITE_LE_UINT16(dataP + curDestDataIndx + 2, READ_LE_UINT16(data + curSrcDataIndx + 2)); + WRITE_LE_UINT16(dataP + curDestDataIndx + 4, v22); + WRITE_LE_UINT16(dataP + curDestDataIndx + 6, READ_LE_UINT16(data + curSrcDataIndx + 6)); + dataP[curDestDataIndx + 8] = data[curSrcDataIndx + 8]; + dataP[curDestDataIndx + 9] = data[curSrcDataIndx + 9]; } - loopCond = true; + break; } } - if (READ_BE_UINT24(&data[v21]) == MKTAG24('F', 'I', 'N')) - loopCond = true; - ++v21; - } while (v21 <= count && !loopCond); + if (READ_BE_UINT24(&data[dataIdx]) == MKTAG24('F', 'I', 'N')) + break; + } } /** -- cgit v1.2.3 From 7d743c9e77ee12049bfeb220557f236a9dd2f2d6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 31 Jan 2013 08:24:34 +0100 Subject: HOPKINS: More refactoring in searchAnim --- engines/hopkins/anim.cpp | 51 ++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index ce3ae57b8d..fea9eb38cb 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -606,59 +606,46 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { /** * Search Animation */ -void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { - int v6; - int v7; - int curDestDataIndx; - int curSrcDataIndx; - int v22; - - for (int dataIdx = 0; dataIdx <= count; dataIdx++) { +void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) { + for (int dataIdx = 0; dataIdx <= bufSize; dataIdx++) { if (READ_BE_UINT32(&data[dataIdx]) == MKTAG('A', 'N', 'I', 'M')) { int entryIndex = data[dataIdx + 4]; if (animIndex == entryIndex) { - v6 = dataIdx + 5; - v7 = 0; + int curBufferPos = dataIdx + 5; + int count = 0; bool innerLoopCond = false; do { - if (READ_BE_UINT32(&data[v6]) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(&data[v6]) == MKTAG24('F', 'I', 'N')) + if (READ_BE_UINT32(&data[curBufferPos]) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(&data[curBufferPos]) == MKTAG24('F', 'I', 'N')) innerLoopCond = true; - if (count < v6) { + if (bufSize < curBufferPos) { _vm->_globals.Bqe_Anim[animIndex]._enabledFl = false; _vm->_globals.Bqe_Anim[animIndex]._data = g_PTRNUL; return; } - ++v6; - ++v7; + ++curBufferPos; + ++count; } while (!innerLoopCond); - _vm->_globals.Bqe_Anim[animIndex]._data = _vm->_globals.allocMemory(v7 + 50); + _vm->_globals.Bqe_Anim[animIndex]._data = _vm->_globals.allocMemory(count + 50); _vm->_globals.Bqe_Anim[animIndex]._enabledFl = true; - memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, dataIdx + data + 5, 20); + memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, data + dataIdx + 5, 20); byte *dataP = _vm->_globals.Bqe_Anim[animIndex]._data; - curDestDataIndx = 20; - curSrcDataIndx = dataIdx + 25; - v22 = READ_LE_UINT16(data + dataIdx + 29); - WRITE_LE_UINT16(dataP + curDestDataIndx, READ_LE_UINT16(data + dataIdx + 25)); - WRITE_LE_UINT16(dataP + curDestDataIndx + 2, READ_LE_UINT16(data + dataIdx + 27)); - WRITE_LE_UINT16(dataP + curDestDataIndx + 4, v22); - WRITE_LE_UINT16(dataP + curDestDataIndx + 6, READ_LE_UINT16(data + dataIdx + 31)); - dataP[curDestDataIndx + 8] = data[dataIdx + 33]; - dataP[curDestDataIndx + 9] = data[dataIdx + 34]; - - for (int i = 1; i <= 4999; i++) { - curDestDataIndx += 10; - curSrcDataIndx += 10; - if (!v22) - break; + int curDestDataIndx = 20; + int curSrcDataIndx = dataIdx + 25; - v22 = READ_LE_UINT16(data + curSrcDataIndx + 4); + for (int i = 0; i <= 4999; i++) { + int v22 = READ_LE_UINT16(data + curSrcDataIndx + 4); WRITE_LE_UINT16(dataP + curDestDataIndx, READ_LE_UINT16(data + curSrcDataIndx)); WRITE_LE_UINT16(dataP + curDestDataIndx + 2, READ_LE_UINT16(data + curSrcDataIndx + 2)); WRITE_LE_UINT16(dataP + curDestDataIndx + 4, v22); WRITE_LE_UINT16(dataP + curDestDataIndx + 6, READ_LE_UINT16(data + curSrcDataIndx + 6)); dataP[curDestDataIndx + 8] = data[curSrcDataIndx + 8]; dataP[curDestDataIndx + 9] = data[curSrcDataIndx + 9]; + + curDestDataIndx += 10; + curSrcDataIndx += 10; + if (!v22) + break; } break; } -- cgit v1.2.3 From 334968c5ffed9cfd24ab47860ac980f571eb5c8b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 31 Jan 2013 23:52:01 +0100 Subject: HOPKINS: More refactoring in AnimationManager and ComputerManager --- engines/hopkins/anim.cpp | 13 ++--- engines/hopkins/computer.cpp | 117 ++++++++++++++++++------------------------- 2 files changed, 52 insertions(+), 78 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index fea9eb38cb..52212c6b45 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -634,18 +634,11 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) int curSrcDataIndx = dataIdx + 25; for (int i = 0; i <= 4999; i++) { - int v22 = READ_LE_UINT16(data + curSrcDataIndx + 4); - WRITE_LE_UINT16(dataP + curDestDataIndx, READ_LE_UINT16(data + curSrcDataIndx)); - WRITE_LE_UINT16(dataP + curDestDataIndx + 2, READ_LE_UINT16(data + curSrcDataIndx + 2)); - WRITE_LE_UINT16(dataP + curDestDataIndx + 4, v22); - WRITE_LE_UINT16(dataP + curDestDataIndx + 6, READ_LE_UINT16(data + curSrcDataIndx + 6)); - dataP[curDestDataIndx + 8] = data[curSrcDataIndx + 8]; - dataP[curDestDataIndx + 9] = data[curSrcDataIndx + 9]; - + memcpy(dataP + curDestDataIndx, data + curSrcDataIndx, 10); + if (!READ_LE_UINT16(data + curSrcDataIndx + 4)) + break; curDestDataIndx += 10; curSrcDataIndx += 10; - if (!v22) - break; } break; } diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 38b464cf68..903185e329 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -591,14 +591,14 @@ void ComputerManager::loadHiscore() { for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { - nextChar = ptr[i + (16 * scoreIndex)]; + nextChar = ptr[(16 * scoreIndex) + i]; if (!nextChar) nextChar = ' '; _score[scoreIndex]._name += nextChar; } for (int i = 0; i < 9; ++i) { - nextChar = ptr[i + scoreIndex * 16 + 6]; + nextChar = ptr[(scoreIndex * 16) + 6 + i]; if (!nextChar) nextChar = '0'; _score[scoreIndex]._score += nextChar; @@ -941,61 +941,49 @@ void ComputerManager::displayScoreChar(int charPos, int charDisp) { * Save Hiscore in file */ void ComputerManager::saveScore() { - int v1; - int v2; - int v4; - int v6; - int v9; - int v14; - int v16[6]; - int v17[6]; - - for (int v0 = 0; v0 <= 5; v0++) { - v1 = atol(_score[v0]._score.c_str()); - v17[v0] = v1; - if (!v1) - v17[v0] = 5; + int scorePlace[6]; + int scores[6]; + + // Load high scores in an array + for (int i = 0; i <= 5; i++) { + scores[i] = atol(_score[i]._score.c_str()); + if (!scores[i]) + scores[i] = 5; } - for (int v13 = 0; v13 <= 5; v13++) { - v2 = 0; - bool v3 = false; - do { - v4 = v17[v2]; - if (v4 && v17[0] <= v4 && v17[1] <= v4 && v17[2] <= v4 && v17[3] <= v4 - && v17[4] <= v4 && v17[5] <= v4) - v3 = true; - if (v3) { - v16[v13] = v2; - v17[v2] = 0; - } else { - ++v2; + // order high scores + for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) { + for(int i = 0;;i++) { + int curScore = scores[i]; + if (curScore && scores[0] <= curScore && scores[1] <= curScore && scores[2] <= curScore && scores[3] <= curScore + && scores[4] <= curScore && scores[5] <= curScore) { + scorePlace[scorePlaceIdx] = i; + scores[i] = 0; + break; } - } while (!v3); + } } byte *ptr = _vm->_globals.allocMemory(100); memset(ptr, 0, 99); - for (int v5 = 0; v5 <= 5; v5++) { - v6 = 16 * v5; - v14 = v16[v5]; + for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) { + int curBufPtr = 16 * scorePlaceIdx; for (int namePos = 0; namePos <= 4; namePos++) { - char curChar = _score[v14]._name[namePos]; + char curChar = _score[scorePlace[scorePlaceIdx]]._name[namePos]; if (!curChar) curChar = ' '; - ptr[v6 + namePos] = curChar; + ptr[curBufPtr + namePos] = curChar; }; - ptr[v6 + 5] = 0; - v9 = v6 + 6; + ptr[curBufPtr + 5] = 0; for (int scorePos = 0; scorePos <= 8; scorePos++) { - char curChar = _score[v14]._score[scorePos]; + char curChar = _score[scorePlace[scorePlaceIdx]]._score[scorePos]; if (!curChar) curChar = '0'; - ptr[v9 + scorePos] = curChar; + ptr[curBufPtr + 6 + scorePos] = curChar; }; - ptr[v9 + 9] = 0; + ptr[curBufPtr + 15] = 0; } _vm->_saveLoadManager.saveFile("HISCORE.DAT", ptr, 100); @@ -1078,24 +1066,22 @@ int ComputerManager::moveBall() { } if (_ballPosition.y >= 186 && _ballPosition.y <= 194) { _vm->_soundManager.playSample(2, 6); - if (_ballPosition.x > _padPositionX - 2) { - int v2 = _ballPosition.x + 6; - if (v2 < _padPositionX + 36) { - _ballUpFl = false; - if (v2 <= _padPositionX + 15) { - _ballRightFl = false; - if (_ballPosition.x >= _padPositionX && v2 <= _padPositionX + 5) - _ballPosition.x -= 4; - if (_ballPosition.x >= _padPositionX + 5 && _ballPosition.x + 6 <= _padPositionX + 10) - _ballPosition.x -= 2; - } - if (_ballPosition.x >= _padPositionX + 19 && _ballPosition.x + 6 <= _padPositionX + 36) { - _ballRightFl = true; - if (_ballPosition.x >= _padPositionX + 29) - _ballPosition.x += 4; - if (_ballPosition.x >= _padPositionX + 24 && _ballPosition.x + 6 <= _padPositionX + 29) - _ballPosition.x += 2; - } + int ballPosXRight = _ballPosition.x + 6; + if ((_ballPosition.x > _padPositionX - 2) && (ballPosXRight < _padPositionX + 36)) { + _ballUpFl = false; + if (ballPosXRight <= _padPositionX + 15) { + _ballRightFl = false; + if (_ballPosition.x >= _padPositionX && ballPosXRight <= _padPositionX + 5) + _ballPosition.x -= 4; + if (_ballPosition.x >= _padPositionX + 5 && _ballPosition.x + 6 <= _padPositionX + 10) + _ballPosition.x -= 2; + } + if (_ballPosition.x >= _padPositionX + 19 && _ballPosition.x + 6 <= _padPositionX + 36) { + _ballRightFl = true; + if (_ballPosition.x >= _padPositionX + 29) + _ballPosition.x += 4; + if (_ballPosition.x >= _padPositionX + 24 && _ballPosition.x + 6 <= _padPositionX + 29) + _ballPosition.x += 2; } } } @@ -1114,11 +1100,6 @@ int ComputerManager::moveBall() { */ void ComputerManager::checkBallCollisions() { int cellLeft; - int cellRight; - int cellType; - bool collisionFl; - int cellBottom; - int cellUp; bool brickDestroyedFl = false; // TODO: Check if correct @@ -1131,12 +1112,12 @@ void ComputerManager::checkBallCollisions() { uint16 levelIdx = 0; do { cellLeft = level[levelIdx]; - cellUp = level[levelIdx + 1]; - cellRight = level[levelIdx + 2]; - cellBottom = level[levelIdx + 3]; - cellType = level[levelIdx + 4]; + int cellUp = level[levelIdx + 1]; + int cellRight = level[levelIdx + 2]; + int cellBottom = level[levelIdx + 3]; + int cellType = level[levelIdx + 4]; if (level[levelIdx + 5] == 1 && cellLeft != -1) { - collisionFl = false; + bool collisionFl = false; if (ballTop <= cellBottom && ballBottom >= cellBottom) { if (ballLeft >= cellLeft && ballRight <= cellRight) { collisionFl = true; -- cgit v1.2.3 From 3cb6af38df8bbd09025318b0a8fafc3b05b9d685 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Feb 2013 00:33:01 +0100 Subject: HOPKINS: Some refactoring in DialogsManager --- engines/hopkins/dialogs.cpp | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 3bb8f547d3..01ed89637d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -54,9 +54,6 @@ void DialogsManager::setParent(HopkinsEngine *vm) { } void DialogsManager::showOptionsDialog() { - bool doneFlag; - - doneFlag = false; _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); Common::String filename; @@ -74,6 +71,7 @@ void DialogsManager::showOptionsDialog() { _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(filename); _vm->_globals._optionDialogFl = true; + bool doneFlag = false; do { if (_vm->_eventsManager.getMouseButton()) { Common::Point mousePos(_vm->_eventsManager.getMouseX(), _vm->_eventsManager.getMouseY()); @@ -350,23 +348,23 @@ LABEL_7: _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false); - int v15 = 0; + int curPosY = 0; int inventCount = 0; for (int inventLine = 1; inventLine <= 5; inventLine++) { - int v16 = 0; + int curPosX = 0; for (int inventCol = 1; inventCol <= 6; inventCol++) { ++inventCount; int inventIdx = _vm->_globals._inventory[inventCount]; // The last two zones are not reserved for the inventory: Options and Save/Load if (inventIdx && inventCount <= 29) { - byte *v7 = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, v7, _inventX + v16 + 6, - v15 + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); - _vm->_globals.freeMemory(v7); + byte *obj = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6, + curPosY + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); + _vm->_globals.freeMemory(obj); } - v16 += 54; + curPosX += 54; }; - v15 += 38; + curPosY += 38; } _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager._curMouseButton = 0; @@ -547,10 +545,10 @@ void DialogsManager::testDialogOpening() { * Load Game dialog */ void DialogsManager::showLoadGame() { - int slotNumber; - _vm->_eventsManager.VBL(); showSaveLoad(2); + + int slotNumber; do { slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); @@ -575,12 +573,10 @@ void DialogsManager::showLoadGame() { * Save Game dialog */ void DialogsManager::showSaveGame() { - int slotNumber; - Common::String saveName; - _vm->_eventsManager.VBL(); showSaveLoad(1); + int slotNumber; do { slotNumber = searchSavegames(); _vm->_eventsManager.VBL(); @@ -597,7 +593,7 @@ void DialogsManager::showSaveGame() { if (slotNumber != 7) { // Since the original GUI doesn't support save names, use a default name - saveName = Common::String::format("Save #%d", slotNumber); + Common::String saveName = Common::String::format("Save #%d", slotNumber); // Save the game _vm->_saveLoadManager.saveGame(slotNumber, saveName); @@ -608,9 +604,6 @@ void DialogsManager::showSaveGame() { * Load/Save dialog */ void DialogsManager::showSaveLoad(int a1) { - int slotNumber; - hopkinsSavegameHeader header; - byte *thumb; Common::String filename; if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) @@ -645,12 +638,13 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 539, 372, 2); } - for (slotNumber = 1; slotNumber <= 6; ++slotNumber) { + for (int slotNumber = 1; slotNumber <= 6; ++slotNumber) { + hopkinsSavegameHeader header; if (_vm->_saveLoadManager.readSavegameHeader(slotNumber, header)) { Graphics::Surface thumb8; _vm->_saveLoadManager.convertThumb16To8(header._thumbnail, &thumb8); - thumb = (byte *)thumb8.pixels; + byte *thumb = (byte *)thumb8.pixels; switch (slotNumber) { case 1: @@ -689,11 +683,12 @@ void DialogsManager::showSaveLoad(int a1) { * Search savegames */ int DialogsManager::searchSavegames() { - int slotNumber = 0; int xp = _vm->_eventsManager.getMouseX(); int yp = _vm->_eventsManager.getMouseY(); _vm->_graphicsManager._scrollOffset = _vm->_eventsManager._startPos.x; + + int slotNumber = 0; if (yp >= 112 && yp <= 198) { if (xp > _vm->_eventsManager._startPos.x + 189 && xp < _vm->_eventsManager._startPos.x + 318) { slotNumber = 1; -- cgit v1.2.3 From 7480957ab066c75f806cf9bd20d798b70a7a3170 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Feb 2013 07:36:13 +0100 Subject: HOPKINS: Get rid of a couple of LABELS in EventsManager, some renaming --- engines/hopkins/events.cpp | 90 +++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index dd929ac214..380471f5c9 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -313,87 +313,77 @@ int EventsManager::waitKeyPress() { } void EventsManager::VBL() { - int v1; - int v2; - int v3; signed int v11 = 0; signed int v12 = 0; - int v13 = 0; - uint v14 = 0; - int v15 = 0; + int height = 0; + uint width = 0; + int xp = 0; int yp = 0; if (_mouseFl) { - v1 = 20; + int mouseWidth = 20; if (!_mouseLinuxFl) - v1 = 10; - v2 = 20; + mouseWidth = 10; + int mouseHeight = 20; if (!_mouseLinuxFl) - v2 = 15; - v15 = _mousePos.x - v1; + mouseHeight = 15; + xp = _mousePos.x - mouseWidth; yp = _mousePos.y; - v14 = _mouseSizeX; - v13 = _mouseSizeY; + width = _mouseSizeX; + height = _mouseSizeY; if (_mouseCursorId == 23) { - v14 = _vm->_globals._objectWidth; - v13 = _vm->_globals._objectHeight; + width = _vm->_globals._objectWidth; + height = _vm->_globals._objectHeight; goto LABEL_35; } + int v3; if (_breakoutFl) { - if (v15 < _vm->_graphicsManager._minX) - v15 = _vm->_graphicsManager._minX; + if (xp < _vm->_graphicsManager._minX) + xp = _vm->_graphicsManager._minX; if (_mousePos.y < _vm->_graphicsManager._minY) yp = _vm->_graphicsManager._minY; - if (_mouseSizeX + v15 >= _vm->_graphicsManager._maxX) - v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager._maxX); + if (_mouseSizeX + xp >= _vm->_graphicsManager._maxX) + width = _mouseSizeX - (_mouseSizeX + xp - _vm->_graphicsManager._maxX); if (yp + _mouseSizeY < _vm->_graphicsManager._maxY) goto LABEL_34; v3 = yp + _mouseSizeY - _vm->_graphicsManager._maxY; } else { - if (v15 < _vm->_graphicsManager._minX) - v15 = _vm->_graphicsManager._minX - v1; - v2 = (int16)v2; - if (_mousePos.y < _vm->_graphicsManager._minY - (int16)v2) - yp = _vm->_graphicsManager._minY - (int16)v2; - if (_mouseSizeX + v15 >= _vm->_graphicsManager._maxX) - v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager._maxX - v1); - if (yp + _mouseSizeY < v2 + _vm->_graphicsManager._maxY) + if (xp < _vm->_graphicsManager._minX) + xp = _vm->_graphicsManager._minX - mouseWidth; + mouseHeight = (int16)mouseHeight; + if (_mousePos.y < _vm->_graphicsManager._minY - mouseHeight) + yp = _vm->_graphicsManager._minY - mouseHeight; + if (_mouseSizeX + xp >= _vm->_graphicsManager._maxX) + width = _mouseSizeX - (_mouseSizeX + xp - _vm->_graphicsManager._maxX - mouseWidth); + if (yp + _mouseSizeY < mouseHeight + _vm->_graphicsManager._maxY) goto LABEL_34; - v3 = v2 + yp + _mouseSizeY - _vm->_graphicsManager._maxY; + v3 = mouseHeight + yp + _mouseSizeY - _vm->_graphicsManager._maxY; } - v13 = _mouseSizeY - v3; + height = _mouseSizeY - v3; LABEL_34: - v12 = v14 + v15; - v11 = yp + v13; + v12 = width + xp; + v11 = yp + height; } LABEL_35: if (!_vm->_globals.PUBEXIT) _vm->_objectsManager.displaySprite(); if (!_mouseFl) { updateCursor(); - goto LABEL_54; - } - if (_mouseCursorId == 23) - goto LABEL_45; - if (yp >= _vm->_graphicsManager._maxY || v15 >= _vm->_graphicsManager._maxX || v14 <= 1 || v13 <= 1) { - if (_mouseCursorId != 23) - goto LABEL_54; -LABEL_45: - if (yp < _vm->_graphicsManager._maxY && v15 < _vm->_graphicsManager._maxX) { - if ((signed int)(v14 + v15) > _vm->_graphicsManager._maxX) - v14 -= v14 + v15 - _vm->_graphicsManager._maxX; - if (yp + v13 > _vm->_graphicsManager._maxY) - v13 -= yp + v13 - _vm->_graphicsManager._maxY; - if (v14 > 1 && v13 > 1) { + } else if (_mouseCursorId == 23) { + if (yp < _vm->_graphicsManager._maxY && xp < _vm->_graphicsManager._maxX) { + if ((signed int)(width + xp) > _vm->_graphicsManager._maxX) + width -= width + xp - _vm->_graphicsManager._maxX; + if (yp + height > _vm->_graphicsManager._maxY) + height -= yp + height - _vm->_graphicsManager._maxY; + if (width > 1 && height > 1) { _vm->_eventsManager.updateCursor(); } } - goto LABEL_54; - } + } else if (yp < _vm->_graphicsManager._maxY && xp < _vm->_graphicsManager._maxX && width > 1 && height > 1) { + _vm->_eventsManager.updateCursor(); + _vm->_graphicsManager.addVesaSegment(xp, yp, v12, v11); + } - _vm->_eventsManager.updateCursor(); - _vm->_graphicsManager.addVesaSegment(v15, yp, v12, v11); -LABEL_54: _vm->_globals._speed = 2; do { while (!_vm->shouldQuit()) { -- cgit v1.2.3 From f10d3c8dcc4baa694ef2ec5081941f3656853c1c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Feb 2013 07:55:49 +0100 Subject: HOPKINS: Remove 2 more labels in EventsManager --- engines/hopkins/events.cpp | 59 +++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 380471f5c9..31b972cdc3 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -316,7 +316,7 @@ void EventsManager::VBL() { signed int v11 = 0; signed int v12 = 0; int height = 0; - uint width = 0; + int width = 0; int xp = 0; int yp = 0; @@ -334,47 +334,42 @@ void EventsManager::VBL() { if (_mouseCursorId == 23) { width = _vm->_globals._objectWidth; height = _vm->_globals._objectHeight; - goto LABEL_35; - } - int v3; - if (_breakoutFl) { - if (xp < _vm->_graphicsManager._minX) - xp = _vm->_graphicsManager._minX; - if (_mousePos.y < _vm->_graphicsManager._minY) - yp = _vm->_graphicsManager._minY; - if (_mouseSizeX + xp >= _vm->_graphicsManager._maxX) - width = _mouseSizeX - (_mouseSizeX + xp - _vm->_graphicsManager._maxX); - if (yp + _mouseSizeY < _vm->_graphicsManager._maxY) - goto LABEL_34; - v3 = yp + _mouseSizeY - _vm->_graphicsManager._maxY; } else { - if (xp < _vm->_graphicsManager._minX) - xp = _vm->_graphicsManager._minX - mouseWidth; - mouseHeight = (int16)mouseHeight; - if (_mousePos.y < _vm->_graphicsManager._minY - mouseHeight) - yp = _vm->_graphicsManager._minY - mouseHeight; - if (_mouseSizeX + xp >= _vm->_graphicsManager._maxX) - width = _mouseSizeX - (_mouseSizeX + xp - _vm->_graphicsManager._maxX - mouseWidth); - if (yp + _mouseSizeY < mouseHeight + _vm->_graphicsManager._maxY) - goto LABEL_34; - v3 = mouseHeight + yp + _mouseSizeY - _vm->_graphicsManager._maxY; + if (_breakoutFl) { + if (xp < _vm->_graphicsManager._minX) + xp = _vm->_graphicsManager._minX; + if (_mousePos.y < _vm->_graphicsManager._minY) + yp = _vm->_graphicsManager._minY; + if (_mouseSizeX + xp >= _vm->_graphicsManager._maxX) + width = _mouseSizeX - (_mouseSizeX + xp - _vm->_graphicsManager._maxX); + if (yp + _mouseSizeY >= _vm->_graphicsManager._maxY) + height = _vm->_graphicsManager._maxY - yp; + } else { + if (xp < _vm->_graphicsManager._minX) + xp = _vm->_graphicsManager._minX - mouseWidth; + mouseHeight = (int16)mouseHeight; + if (_mousePos.y < _vm->_graphicsManager._minY - mouseHeight) + yp = _vm->_graphicsManager._minY - mouseHeight; + if (_mouseSizeX + xp >= _vm->_graphicsManager._maxX) + width = _mouseSizeX - (_mouseSizeX + xp - _vm->_graphicsManager._maxX - mouseWidth); + if (yp + _mouseSizeY >= mouseHeight + _vm->_graphicsManager._maxY) + height = _vm->_graphicsManager._maxY - mouseHeight - yp; + } + v12 = width + xp; + v11 = yp + height; } - height = _mouseSizeY - v3; -LABEL_34: - v12 = width + xp; - v11 = yp + height; } -LABEL_35: + if (!_vm->_globals.PUBEXIT) _vm->_objectsManager.displaySprite(); if (!_mouseFl) { updateCursor(); } else if (_mouseCursorId == 23) { if (yp < _vm->_graphicsManager._maxY && xp < _vm->_graphicsManager._maxX) { - if ((signed int)(width + xp) > _vm->_graphicsManager._maxX) - width -= width + xp - _vm->_graphicsManager._maxX; + if (width + xp > _vm->_graphicsManager._maxX) + width = _vm->_graphicsManager._maxX - xp; if (yp + height > _vm->_graphicsManager._maxY) - height -= yp + height - _vm->_graphicsManager._maxY; + height = _vm->_graphicsManager._maxY - yp; if (width > 1 && height > 1) { _vm->_eventsManager.updateCursor(); } -- cgit v1.2.3 From 4b0e2263402a0f80595a6e910359dd4b062817ac Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 2 Feb 2013 12:15:41 +0100 Subject: HOPKINS: Get rid of a goto in the display code. Remove useless casts (with comments about that). Some renaming. --- engines/hopkins/graphics.cpp | 161 ++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 79 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0aa9d3ff15..36febe17ee 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -944,26 +944,25 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Clip X clip_x1 = width; - if ((xp + width) <= (_minX + 300)) + if ((xp + width) <= _minX + 300) return; - if (xp < (_minX + 300)) { + if (xp < _minX + 300) { _posXClipped = _minX + 300 - xp; _clipFl = true; } // Clip Y - // TODO: This is weird, but it's that way in the original. Original game bug? - if ((yp + height) <= height) + if (yp <= 0) return; - if (yp < (_minY + 300)) { + if (yp < _minY + 300) { _posYClipped = _minY + 300 - yp; _clipFl = true; } // Clip X1 - if (xp >= (_maxX + 300)) + if (xp >= _maxX + 300) return; - if ((xp + width) > (_maxX + 300)) { + if (xp + width > _maxX + 300) { int xAmount = width + 10 - (xp + width - (_maxX + 300)); if (xAmount <= 10) return; @@ -973,13 +972,14 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } // Clip Y1 - if (yp >= (_maxY + 300)) + if (yp >= _maxY + 300) return; - if ((yp + height) > (_maxY + 300)) { + if (yp + height > _maxY + 300) { int yAmount = height + 10 - (yp + height - (_maxY + 300)); if (yAmount <= 10) return; + // clip_y1 is always positive thanks to the previous check clip_y1 = yAmount - 10; _clipFl = true; } @@ -1298,14 +1298,20 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300)) return; - if ((uint16)xp300 < (uint16)(_minX + 300)) + // Clipped values are greater or equal to zero, thanks to the previous test + clip_x1 = _maxX + 300 - xp300; + clip_y1 = _maxY + 300 - yp300; + + // _minX is never negative, and should be always 0 + // The previous check insures that xp300 it's always greater to it + // After this check, posXClipped is always positive + if (xp300 < _minX + 300) _posXClipped = _minX + 300 - xp300; - if ((uint16)yp300 < (uint16)(_minY + 300)) + // Ditto. + if (yp300 < _minY + 300) _posYClipped = _minY + 300 - yp300; - clip_x1 = _maxX + 300 - xp300; - clip_y1 = _maxY + 300 - yp300; dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; if (zoom2) { Agr_x = 0; @@ -1313,46 +1319,47 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_Flag_y = false; Agr_Flag_x = false; _width = spriteWidth; - int v20 = zoomIn(spriteWidth, zoom2); - int v22 = zoomIn(spriteHeight1, zoom2); + int zoomedWidth = zoomIn(spriteWidth, zoom2); + int zoomedHeight = zoomIn(spriteHeight1, zoom2); if (flipFl) { - v29 = v20 + dest1P; + v29 = zoomedWidth + dest1P; if (_posYClipped) { - if ((uint16)_posYClipped >= v22) + if (_posYClipped < 0 || _posYClipped >= zoomedHeight) return; int v30 = 0; - while (zoomIn(++v30, zoom2) < (uint16)_posYClipped) + while (zoomIn(++v30, zoom2) < _posYClipped) ; spritePixelsP += _width * v30; - v29 += _lineNbr2 * (uint16)_posYClipped; - v22 = v22 - (uint16)_posYClipped; + v29 += _lineNbr2 * _posYClipped; + zoomedHeight -= _posYClipped; } - if (v22 > (uint16)clip_y1) - v22 = (uint16)clip_y1; + if (zoomedHeight > clip_y1) + zoomedHeight = clip_y1; if (_posXClipped) { - if ((uint16)_posXClipped >= v20) + if (_posXClipped >= zoomedWidth) return; - v20 -= (uint16)_posXClipped; + zoomedWidth -= _posXClipped; } - if (v20 > (uint16)clip_x1) { - int v32 = v20 - (uint16)clip_x1; + if (zoomedWidth > clip_x1) { + int v32 = zoomedWidth - clip_x1; v29 -= v32; int v33 = 0; while (zoomIn(++v33, zoom2) < v32) ; int v34 = v33; spritePixelsP += v34; - v20 = (uint16)clip_x1; + zoomedWidth = clip_x1; } int v63; do { for (;;) { - v63 = v22; + v63 = zoomedHeight; byte *v53 = v29; v46 = spritePixelsP; Agr_Flag_x = false; Agr_x = 0; - for (int v35 = v20; v35; v35--) { + for (int v35 = zoomedWidth; v35; v35--) { + Agr_Flag_x = false; for (;;) { if (*spritePixelsP) *v29 = *spritePixelsP; @@ -1360,18 +1367,16 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++spritePixelsP; if (!Agr_Flag_x) Agr_x += zoom2; - if ((uint16)Agr_x < 100) + if (Agr_x >= 0 && Agr_x < 100) break; Agr_x -= 100; --spritePixelsP; Agr_Flag_x = true; --v35; if (!v35) - goto R_Aff_Zoom_Larg_Cont1; + break; } - Agr_Flag_x = false; } -R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; v29 = _lineNbr2 + v53; if (!Agr_Flag_y) @@ -1381,50 +1386,50 @@ R_Aff_Zoom_Larg_Cont1: Agr_y -= 100; spritePixelsP = v46; Agr_Flag_y = true; - v22 = v63 - 1; + zoomedHeight = v63 - 1; if (v63 == 1) return; } Agr_Flag_y = false; - v22 = v63 - 1; + zoomedHeight = v63 - 1; } while (v63 != 1); } else { if (_posYClipped) { - if ((uint16)_posYClipped >= v22) + if (_posYClipped >= zoomedHeight) return; - int v58 = v22; - int v49 = v20; + int v58 = zoomedHeight; + int v49 = zoomedWidth; int v23 = 0; - int v24 = (uint16)_posYClipped; + int v24 = _posYClipped; while (zoomIn(++v23, zoom2) < v24) ; - v20 = v49; + zoomedWidth = v49; spritePixelsP += _width * v23; - dest1P += _lineNbr2 * (uint16)_posYClipped; - v22 = v58 - (uint16)_posYClipped; + dest1P += _lineNbr2 * _posYClipped; + zoomedHeight = v58 - _posYClipped; } - if (v22 > (uint16)clip_y1) - v22 = (uint16)clip_y1; + if (zoomedHeight > clip_y1) + zoomedHeight = clip_y1; if (_posXClipped) { - if ((uint16)_posXClipped >= v20) + if (_posXClipped >= zoomedWidth) return; int v26 = 0; - while (zoomIn(++v26, zoom2) < (uint16)_posXClipped) + while (zoomIn(++v26, zoom2) < _posXClipped) ; spritePixelsP += v26; - dest1P += (uint16)_posXClipped; - v20 = v20 - (uint16)_posXClipped; + dest1P += _posXClipped; + zoomedWidth = zoomedWidth - _posXClipped; } - if (v20 > (uint16)clip_x1) - v20 = (uint16)clip_x1; + if (zoomedWidth > clip_x1) + zoomedWidth = clip_x1; int v60; do { for (;;) { - v60 = v22; + v60 = zoomedHeight; byte *v51 = dest1P; v45 = spritePixelsP; - int v28 = v20; + int v28 = zoomedWidth; Agr_Flag_x = false; Agr_x = 0; do { @@ -1457,12 +1462,12 @@ Aff_Zoom_Larg_Cont1: Agr_y = Agr_y - 100; spritePixelsP = v45; Agr_Flag_y = true; - v22 = v60 - 1; + zoomedHeight = v60 - 1; if (v60 == 1) return; } Agr_Flag_y = false; - v22 = v60 - 1; + zoomedHeight = v60 - 1; } while (v60 != 1); } } else if (zoom1) { @@ -1510,7 +1515,7 @@ Aff_Zoom_Larg_Cont1: if ((uint16)Red_y < 100) { Red_x = 0; int v39 = 0; - for (int v38 = _width; v38; v38--) { + for (int i = _width; i; i--) { Red_x = Red + Red_x; if ((uint16)Red_x < 100) { if (v39 >= _posXClipped && v39 < clip_x1 && *spritePixelsP) @@ -1539,26 +1544,24 @@ Aff_Zoom_Larg_Cont1: dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; if (_posYClipped) { - if ((uint16)_posYClipped >= (unsigned int)spriteHeight1) + if (_posYClipped >= (unsigned int)spriteHeight1) return; - spritePixelsP += spriteWidth * (uint16)_posYClipped; - dest2P += _lineNbr2 * (uint16)_posYClipped; - spriteHeight1 -= (uint16)_posYClipped; + spritePixelsP += spriteWidth * _posYClipped; + dest2P += _lineNbr2 * _posYClipped; + spriteHeight1 -= _posYClipped; } - int xLeft = (uint16)clip_y1; if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; - xLeft = _posXClipped; - if (_posXClipped) { - if (xLeft >= spriteWidth) - return; - spriteWidth -= xLeft; - } - if (spriteWidth > (uint16)clip_x1) { - int clippedWidth = spriteWidth - (uint16)clip_x1; + + if (_posXClipped >= spriteWidth) + return; + spriteWidth -= _posXClipped; + + if (spriteWidth > clip_x1) { + int clippedWidth = spriteWidth - clip_x1; spritePixelsP += clippedWidth; dest2P -= clippedWidth; - spriteWidth = (uint16)clip_x1; + spriteWidth = clip_x1; } int yCtr2; do { @@ -1578,23 +1581,23 @@ Aff_Zoom_Larg_Cont1: } else { spec_largeur = spriteWidth; if (_posYClipped) { - if ((uint16)_posYClipped >= (unsigned int)spriteHeight1) + if (_posYClipped >= (unsigned int)spriteHeight1) return; - spritePixelsP += spriteWidth * (uint16)_posYClipped; - dest1P += _lineNbr2 * (uint16)_posYClipped; - spriteHeight1 -= (uint16)_posYClipped; + spritePixelsP += spriteWidth * _posYClipped; + dest1P += _lineNbr2 * _posYClipped; + spriteHeight1 -= _posYClipped; } if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; if (_posXClipped) { - if ((uint16)_posXClipped >= spriteWidth) + if (_posXClipped >= spriteWidth) return; - spritePixelsP += (uint16)_posXClipped; - dest1P += (uint16)_posXClipped; - spriteWidth -= (uint16)_posXClipped; + spritePixelsP += _posXClipped; + dest1P += _posXClipped; + spriteWidth -= _posXClipped; } - if (spriteWidth > (uint16)clip_x1) - spriteWidth = (uint16)clip_x1; + if (spriteWidth > clip_x1) + spriteWidth = clip_x1; int yCtr1; do { yCtr1 = spriteHeight1; -- cgit v1.2.3 From 9772426c586c0ac25fd21e9865ac5f2d85217db1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 2 Feb 2013 12:26:21 +0100 Subject: HOPKINS: Fix signness issue, get rid of another GOTO --- engines/hopkins/graphics.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 36febe17ee..bdc2d50cd4 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1358,8 +1358,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v46 = spritePixelsP; Agr_Flag_x = false; Agr_x = 0; - for (int v35 = zoomedWidth; v35; v35--) { - Agr_Flag_x = false; + for (int v35 = zoomedWidth; v35; Agr_Flag_x = false, v35--) { for (;;) { if (*spritePixelsP) *v29 = *spritePixelsP; @@ -1429,17 +1428,16 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp v60 = zoomedHeight; byte *v51 = dest1P; v45 = spritePixelsP; - int v28 = zoomedWidth; Agr_Flag_x = false; Agr_x = 0; - do { + for (int v28 = zoomedWidth; v28; Agr_Flag_x = false, v28--) { for (;;) { if (*spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; ++spritePixelsP; if (!Agr_Flag_x) - Agr_x = zoom2 + Agr_x; + Agr_x += zoom2; if ((uint16)Agr_x < 100) break; Agr_x = Agr_x - 100; @@ -1447,12 +1445,9 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_Flag_x = true; --v28; if (!v28) - goto Aff_Zoom_Larg_Cont1; + break; } - Agr_Flag_x = false; - --v28; - } while (v28); -Aff_Zoom_Larg_Cont1: + } spritePixelsP = _width + v45; dest1P = _lineNbr2 + v51; if (!Agr_Flag_y) @@ -1544,7 +1539,7 @@ Aff_Zoom_Larg_Cont1: dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; if (_posYClipped) { - if (_posYClipped >= (unsigned int)spriteHeight1) + if (_posYClipped >= spriteHeight1 || spriteHeight1 < 0) return; spritePixelsP += spriteWidth * _posYClipped; dest2P += _lineNbr2 * _posYClipped; @@ -1581,7 +1576,7 @@ Aff_Zoom_Larg_Cont1: } else { spec_largeur = spriteWidth; if (_posYClipped) { - if (_posYClipped >= (unsigned int)spriteHeight1) + if (_posYClipped >= spriteHeight1 || spriteHeight1 < 0) return; spritePixelsP += spriteWidth * _posYClipped; dest1P += _lineNbr2 * _posYClipped; -- cgit v1.2.3 From ea4639c65facbfef049d3581dc1e0f96d5f19dc9 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 2 Feb 2013 12:41:44 +0100 Subject: HOPKINS: Fix Sprite_Vesa() height clipping This fixes some Valgrind warnings on the city overhead map, and also seem to get rid of the bird "droppings" previously left behind in the area beneath the picture. There are things I don't understand about this function, but I hope I didn't break anything. --- engines/hopkins/graphics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index bdc2d50cd4..5e31f02d48 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -952,6 +952,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } // Clip Y + clip_y1 = height; if (yp <= 0) return; if (yp < _minY + 300) { @@ -999,7 +1000,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Handling for clipped versus non-clipped if (_clipFl) { // Clipped version - for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { + for (int yc = 0; yc < clip_y1; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; byte byteVal; int xc = 0; -- cgit v1.2.3 From 690405961f73ddbdfc5e07a57f4ca438421856a0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 2 Feb 2013 19:20:58 +0100 Subject: HOPKINS: Some refactoring in GraphicsManager --- engines/hopkins/graphics.cpp | 134 ++++++++++++++++--------------------------- engines/hopkins/graphics.h | 4 +- 2 files changed, 51 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 5e31f02d48..810a6bf92d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -469,7 +469,7 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width destP[0] = palette[2 * srcP[0]]; destP[1] = palette[(2 * srcP[0]) + 1]; destP += 2; - if ((unsigned int)Agr_x >= 100) { + if (Agr_x >= 100) { Agr_x -= 100; destP[0] = palette[2 * srcP[0]]; destP[1] = palette[(2 * srcP[0]) + 1]; @@ -1252,7 +1252,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in /** * Compute the value of a parameter plus a given percentage */ -int GraphicsManager::zoomIn( int v, int percentage ) { +int GraphicsManager::zoomIn(int v, int percentage ) { if (v) v += percentage * (long int)v / 100; @@ -1279,8 +1279,6 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp byte *dest2P; byte *v29; byte *v40; - const byte *v45; - const byte *v46; spriteStartP = srcData + 3; for (i = frameIndex; i; --i) @@ -1356,7 +1354,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp for (;;) { v63 = zoomedHeight; byte *v53 = v29; - v46 = spritePixelsP; + const byte *oldSpritePixelsP = spritePixelsP; Agr_Flag_x = false; Agr_x = 0; for (int v35 = zoomedWidth; v35; Agr_Flag_x = false, v35--) { @@ -1377,14 +1375,14 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp break; } } - spritePixelsP = _width + v46; + spritePixelsP = _width + oldSpritePixelsP; v29 = _lineNbr2 + v53; if (!Agr_Flag_y) Agr_y += zoom2; if ((uint16)Agr_y < 100) break; Agr_y -= 100; - spritePixelsP = v46; + spritePixelsP = oldSpritePixelsP; Agr_Flag_y = true; zoomedHeight = v63 - 1; if (v63 == 1) @@ -1397,16 +1395,12 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if (_posYClipped) { if (_posYClipped >= zoomedHeight) return; - int v58 = zoomedHeight; - int v49 = zoomedWidth; int v23 = 0; - int v24 = _posYClipped; - while (zoomIn(++v23, zoom2) < v24) + while (zoomIn(++v23, zoom2) < _posYClipped) ; - zoomedWidth = v49; spritePixelsP += _width * v23; dest1P += _lineNbr2 * _posYClipped; - zoomedHeight = v58 - _posYClipped; + zoomedHeight -= _posYClipped; } if (zoomedHeight > clip_y1) zoomedHeight = clip_y1; @@ -1427,8 +1421,8 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp do { for (;;) { v60 = zoomedHeight; - byte *v51 = dest1P; - v45 = spritePixelsP; + byte *oldDest1P = dest1P; + const byte *oldSpritePixelsP = spritePixelsP; Agr_Flag_x = false; Agr_x = 0; for (int v28 = zoomedWidth; v28; Agr_Flag_x = false, v28--) { @@ -1441,7 +1435,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp Agr_x += zoom2; if ((uint16)Agr_x < 100) break; - Agr_x = Agr_x - 100; + Agr_x -= 100; --spritePixelsP; Agr_Flag_x = true; --v28; @@ -1449,14 +1443,14 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp break; } } - spritePixelsP = _width + v45; - dest1P = _lineNbr2 + v51; + spritePixelsP = _width + oldSpritePixelsP; + dest1P = _lineNbr2 + oldDest1P; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 100) break; - Agr_y = Agr_y - 100; - spritePixelsP = v45; + Agr_y -= 100; + spritePixelsP = oldSpritePixelsP; Agr_Flag_y = true; zoomedHeight = v60 - 1; if (v60 == 1) @@ -1505,8 +1499,8 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp } while (spriteHeight2); } else { do { - int v64 = spriteHeight2; - byte *v54 = dest1P; + int oldSpriteHeight = spriteHeight2; + byte *oldDest1P = dest1P; Red_y = Red + Red_y; if ((uint16)Red_y < 100) { Red_x = 0; @@ -1524,8 +1518,8 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++spritePixelsP; } } - spriteHeight2 = v64; - dest1P = _lineNbr2 + v54; + spriteHeight2 = oldSpriteHeight; + dest1P = _lineNbr2 + oldDest1P; } else { Red_y = Red_y - 100; spritePixelsP += _width; @@ -1632,17 +1626,12 @@ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int sp } void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { - int top; - int croppedWidth; - int croppedHeight; int xRight; - int top2; - int left; - left = x1; - top = y1; - croppedWidth = width; - croppedHeight = height; + int left = x1; + int top = y1; + int croppedWidth = width; + int croppedHeight = height; if (x1 < _minX) { croppedWidth = width - (_minX - x1); @@ -1652,7 +1641,7 @@ void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width croppedHeight = height - (_minY - y1); top = _minY; } - top2 = top; + int top2 = top; if (top + croppedHeight > _maxY) croppedHeight = _maxY - top; xRight = left + croppedWidth; @@ -1666,18 +1655,15 @@ void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width } } -void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY) { - const byte *srcP; - byte *destP; - int yp; +void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY) { int yCurrent; byte *dest2P; const byte *src2P; - unsigned int pitch; + uint16 pitch; - srcP = x1 + _lineNbr2 * y1 + srcSurface; - destP = destX + _lineNbr2 * destY + destSurface; - yp = height; + const byte *srcP = x1 + _lineNbr2 * y1 + srcSurface; + byte *destP = destX + _lineNbr2 * destY + destSurface; + int yp = height; do { yCurrent = yp; memcpy(destP, srcP, 4 * (width >> 2)); @@ -1692,38 +1678,27 @@ void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned } // Display Font -void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, int yp, - int characterIndex, int colour) { - const byte *spriteDataP; - int i; - const byte *spriteSizeP; - int spriteWidth; - int spriteHeight; - const byte *spritePixelsP; - byte *destP; - byte destByte; - byte *destLineP; - int yCtr; - - spriteDataP = spriteData + 3; - for (i = characterIndex; i; --i) +void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour) { + const byte *spriteDataP = spriteData + 3; + for (int i = characterIndex; i; --i) spriteDataP += READ_LE_UINT32(spriteDataP) + 16; - spriteWidth = 0; - spriteHeight = 0; - spriteSizeP = spriteDataP + 4; + int spriteWidth = 0; + int spriteHeight = 0; + const byte *spriteSizeP = spriteDataP + 4; spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); spriteSizeP += 2; spriteHeight = (int16)READ_LE_UINT16(spriteSizeP); - spritePixelsP = spriteSizeP + 10; - destP = surface + xp + _lineNbr2 * yp; + const byte *spritePixelsP = spriteSizeP + 10; + byte *destP = surface + xp + _lineNbr2 * yp; _width = spriteWidth; + int yCtr = 0; do { - yCtr = spriteHeight; - destLineP = destP; + int yCtr = spriteHeight; + byte *destLineP = destP; for (int xCtr = spriteWidth; xCtr; xCtr--) { - destByte = *spritePixelsP; + byte destByte = *spritePixelsP; if (*spritePixelsP) { if (destByte == 252) destByte = colour; @@ -1823,14 +1798,10 @@ void GraphicsManager::NB_SCREEN(bool initPalette) { } void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { - int destOffset; - const byte *srcPtr; - byte byteVal; - - destOffset = 0; - srcPtr = src; + int destOffset = 0; + const byte *srcPtr = src; for (;;) { - byteVal = *srcPtr; + byte byteVal = *srcPtr; if (byteVal == kByteStop) return; if (*srcPtr > kByteStop) { @@ -1855,15 +1826,11 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { } void GraphicsManager::Copy_Video_Vbe(const byte *src) { - int destOffset; - const byte *srcP; - byte byteVal; - assert(_videoPtr); - destOffset = 0; - srcP = src; + int destOffset = 0; + const byte *srcP = src; for (;;) { - byteVal = *srcP; + byte byteVal = *srcP; if (*srcP < kByteStop) break; else { @@ -1892,11 +1859,8 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { // Reduce Screen void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) { - const byte *srcP; - byte *destP; - - srcP = xp + _lineNbr2 * yp + srcSurface; - destP = destSurface; + const byte *srcP = xp + _lineNbr2 * yp + srcSurface; + byte *destP = destSurface; Red = zoom; _width = width; Red_x = 0; @@ -1927,7 +1891,7 @@ void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int /** * Draw horizontal line */ -void GraphicsManager::drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col) { +void GraphicsManager::drawHorizontalLine(byte *surface, int xp, int yp, uint16 width, byte col) { memset(surface + xp + _lineNbr2 * yp, col, width); } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 86ee8197c6..e5feaddad5 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -159,7 +159,7 @@ public: void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl); void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); - void Copy_Mem(const byte *srcSurface, int x1, int y1, unsigned int width, int height, byte *destSurface, int destX, int destY); + void Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY); void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); void INI_ECRAN(const Common::String &file, bool initializeScreen); void INI_ECRAN2(const Common::String &file, bool initializeScreen); @@ -168,7 +168,7 @@ public: void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); - void drawHorizontalLine(byte *surface, int xp, int yp, unsigned int width, byte col); + void drawHorizontalLine(byte *surface, int xp, int yp, uint16 width, byte col); void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); }; -- cgit v1.2.3 From 8f300bdc303579e4becc1d8e68bd8774042501b6 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 2 Feb 2013 20:26:42 +0100 Subject: HOPKINS: Fix GCC warnings --- engines/hopkins/graphics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 810a6bf92d..b5920e37e6 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1505,7 +1505,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if ((uint16)Red_y < 100) { Red_x = 0; int v39 = 0; - for (int i = _width; i; i--) { + for (i = _width; i; i--) { Red_x = Red + Red_x; if ((uint16)Red_x < 100) { if (v39 >= _posXClipped && v39 < clip_x1 && *spritePixelsP) @@ -1693,9 +1693,9 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, byte *destP = surface + xp + _lineNbr2 * yp; _width = spriteWidth; - int yCtr = 0; + int yCtr; do { - int yCtr = spriteHeight; + yCtr = spriteHeight; byte *destLineP = destP; for (int xCtr = spriteWidth; xCtr; xCtr--) { byte destByte = *spritePixelsP; -- cgit v1.2.3 From b889bb69efee53327039d492b05cdc8cf20ea769 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 2 Feb 2013 23:09:29 +0100 Subject: HOPKINS: Fix Valgrind warnings in INILINK() We can't read all the way to the end of the buffer, because the READ_BE_UINT24() function will, naturally, read a few bytes ahead. --- engines/hopkins/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7f94c8d92c..4249a1880d 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3138,7 +3138,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } _vm->_linesManager.resetLines(); - for (size_t idx = 0; idx < nbytes; idx++) { + for (size_t idx = 0; idx < nbytes - 3; idx++) { if (READ_BE_UINT24(&ptr[idx]) == MKTAG24('O', 'B', '2')) { v16 = ptr + idx + 4; v32 = 0; @@ -3164,7 +3164,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } if (!OBSSEUL) { - for (size_t idx = 0; idx < nbytes; idx++) { + for (size_t idx = 0; idx < nbytes - 3; idx++) { if (READ_BE_UINT24(&ptr[idx]) == MKTAG24('Z', 'O', '2')) { v17 = &ptr[idx + 4]; v33 = 0; -- cgit v1.2.3 From 6797698af8fe90cd8cbfa02870e38f6ca47f7ca9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 01:25:37 +0100 Subject: HOPKINS: Some more refactoring --- engines/hopkins/graphics.cpp | 86 +++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 53 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b5920e37e6..6318bd1ca8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -249,19 +249,15 @@ void GraphicsManager::scrollScreen(int amount) { } void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold) { - int palIndex; - int srcOffset; - int col1, col2; - byte *destPosP = destP; for (int idx = 0; idx < count; ++idx) { - palIndex = *destPosP; - srcOffset = 3 * palIndex; - col1 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; + int palIndex = *destPosP; + int srcOffset = 3 * palIndex; + int col1 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; for (int idx2 = 0; idx2 < 38; ++idx2) { srcOffset = 3 * idx2; - col2 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; + int col2 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; col2 += minThreshold; if (col2 < col1) @@ -1112,9 +1108,7 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { int16 blocIndex = 0; do { BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; - - if (bloc._activeFl && tempX >= bloc._x1 && x2 <= bloc._x2 - && y1 >= bloc._y1 && y2 <= bloc._y2) + if (bloc._activeFl && tempX >= bloc._x1 && x2 <= bloc._x2 && y1 >= bloc._y1 && y2 <= bloc._y2) addFlag = false; ++blocIndex; } while (_vm->_globals.NBBLOC + 1 != blocIndex); @@ -1151,10 +1145,10 @@ void GraphicsManager::displayVesaSegment() { dstRect.top = bloc._y1 * 2 + 30; dstRect.setWidth((bloc._x2 - bloc._x1) * 2); dstRect.setHeight((bloc._y2 - bloc._y1) * 2); - } else if (bloc._x2 > _vm->_eventsManager._startPos.x && bloc._x1 < (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) { + } else if (bloc._x2 > _vm->_eventsManager._startPos.x && bloc._x1 < _vm->_eventsManager._startPos.x + SCREEN_WIDTH) { if (bloc._x1 < _vm->_eventsManager._startPos.x) bloc._x1 = _vm->_eventsManager._startPos.x; - if (bloc._x2 > (_vm->_eventsManager._startPos.x + SCREEN_WIDTH)) + if (bloc._x2 > _vm->_eventsManager._startPos.x + SCREEN_WIDTH) bloc._x2 = _vm->_eventsManager._startPos.x + SCREEN_WIDTH; // WORKAROUND: Original didn't lock the screen for access @@ -1271,25 +1265,16 @@ int GraphicsManager::zoomOut(int v, int percentage) { // Display 'Perfect?' void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl) { - const byte *spriteStartP; - int i; - const byte *spriteSizeP; - const byte *spritePixelsP; - byte *dest1P; - byte *dest2P; - byte *v29; - byte *v40; - - spriteStartP = srcData + 3; - for (i = frameIndex; i; --i) + const byte *spriteStartP = srcData + 3; + for (int i = frameIndex; i; --i) spriteStartP += READ_LE_UINT32(spriteStartP) + 16; - spriteSizeP = spriteStartP + 4; + const byte *spriteSizeP = spriteStartP + 4; int spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); spriteSizeP += 2; int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); int spriteHeight1 = spriteHeight2; - spritePixelsP = spriteSizeP + 10; + const byte *spritePixelsP = spriteSizeP + 10; _posXClipped = 0; _posYClipped = 0; clip_x1 = 0; @@ -1311,7 +1296,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if (yp300 < _minY + 300) _posYClipped = _minY + 300 - yp300; - dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; + byte *dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; if (zoom2) { Agr_x = 0; Agr_y = 0; @@ -1321,7 +1306,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int zoomedWidth = zoomIn(spriteWidth, zoom2); int zoomedHeight = zoomIn(spriteHeight1, zoom2); if (flipFl) { - v29 = zoomedWidth + dest1P; + byte *v29 = zoomedWidth + dest1P; if (_posYClipped) { if (_posYClipped < 0 || _posYClipped >= zoomedHeight) return; @@ -1345,8 +1330,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v33 = 0; while (zoomIn(++v33, zoom2) < v32) ; - int v34 = v33; - spritePixelsP += v34; + spritePixelsP += v33; zoomedWidth = clip_x1; } int v63; @@ -1446,7 +1430,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp spritePixelsP = _width + oldSpritePixelsP; dest1P = _lineNbr2 + oldDest1P; if (!Agr_Flag_y) - Agr_y = zoom2 + Agr_y; + Agr_y += zoom2; if ((uint16)Agr_y < 100) break; Agr_y -= 100; @@ -1468,16 +1452,16 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp if (zoom1 < 100) { int v37 = zoomOut(spriteWidth, Red); if (flipFl) { - v40 = v37 + dest1P; + byte *v40 = v37 + dest1P; do { int v65 = spriteHeight2; byte *v55 = v40; - Red_y = Red + Red_y; + Red_y += Red; if ((uint16)Red_y < 100) { Red_x = 0; int v42 = v37; for (int v41 = _width; v41; v41--) { - Red_x = Red + Red_x; + Red_x += Red; if ((uint16)Red_x < 100) { if (v42 >= _posXClipped && v42 < clip_x1 && *spritePixelsP) *v40 = *spritePixelsP; @@ -1485,14 +1469,14 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++spritePixelsP; --v42; } else { - Red_x = Red_x - 100; + Red_x -= 100; ++spritePixelsP; } } spriteHeight2 = v65; v40 = _lineNbr2 + v55; } else { - Red_y = Red_y - 100; + Red_y -= 100; spritePixelsP += _width; } --spriteHeight2; @@ -1501,12 +1485,12 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp do { int oldSpriteHeight = spriteHeight2; byte *oldDest1P = dest1P; - Red_y = Red + Red_y; + Red_y += Red; if ((uint16)Red_y < 100) { Red_x = 0; int v39 = 0; - for (i = _width; i; i--) { - Red_x = Red + Red_x; + for (int i = _width; i; i--) { + Red_x += Red; if ((uint16)Red_x < 100) { if (v39 >= _posXClipped && v39 < clip_x1 && *spritePixelsP) *dest1P = *spritePixelsP; @@ -1514,14 +1498,14 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++spritePixelsP; ++v39; } else { - Red_x = Red_x - 100; + Red_x -= 100; ++spritePixelsP; } } spriteHeight2 = oldSpriteHeight; dest1P = _lineNbr2 + oldDest1P; } else { - Red_y = Red_y - 100; + Red_y -= 100; spritePixelsP += _width; } --spriteHeight2; @@ -1531,7 +1515,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp } else { _width = spriteWidth; if (flipFl) { - dest2P = spriteWidth + dest1P; + byte *dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; if (_posYClipped) { if (_posYClipped >= spriteHeight1 || spriteHeight1 < 0) @@ -1641,7 +1625,7 @@ void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width croppedHeight = height - (_minY - y1); top = _minY; } - int top2 = top; + if (top + croppedHeight > _maxY) croppedHeight = _maxY - top; xRight = left + croppedWidth; @@ -1650,26 +1634,22 @@ void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width if (croppedWidth > 0 && croppedHeight > 0) { int height2 = croppedHeight; - Copy_Mem(surface, left, top2, croppedWidth, croppedHeight, destSurface, destX, destY); - addVesaSegment(left, top2, left + croppedWidth, top2 + height2); + Copy_Mem(surface, left, top, croppedWidth, croppedHeight, destSurface, destX, destY); + addVesaSegment(left, top, left + croppedWidth, top + height2); } } void GraphicsManager::Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY) { - int yCurrent; - byte *dest2P; - const byte *src2P; - uint16 pitch; - const byte *srcP = x1 + _lineNbr2 * y1 + srcSurface; byte *destP = destX + _lineNbr2 * destY + destSurface; int yp = height; + int yCurrent; do { yCurrent = yp; memcpy(destP, srcP, 4 * (width >> 2)); - src2P = (srcP + 4 * (width >> 2)); - dest2P = (destP + 4 * (width >> 2)); - pitch = width - 4 * (width >> 2); + const byte *src2P = (srcP + 4 * (width >> 2)); + byte *dest2P = (destP + 4 * (width >> 2)); + int pitch = width - 4 * (width >> 2); memcpy(dest2P, src2P, pitch); destP = (dest2P + pitch + _lineNbr2 - width); srcP = (src2P + pitch + _lineNbr2 - width); -- cgit v1.2.3 From aa4f39e6666c6c49df76a926d80a6e2420cfffd4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 07:59:48 +0100 Subject: HOPKINS: Remove two GOTOs in playAnim() --- engines/hopkins/anim.cpp | 76 ++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 52212c6b45..529c4e6f34 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -108,53 +108,57 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui // Do pre-animation delay do { if (_vm->_eventsManager._escKeyFl) - goto EXIT; + break; _vm->_eventsManager.refreshEvents(); } while (!_vm->shouldQuit() && _vm->_eventsManager._rateCounter < rate1); } - _vm->_eventsManager._rateCounter = 0; - frameNumber = 0; - while (!_vm->shouldQuit()) { - ++frameNumber; - _vm->_soundManager.playAnimSound(frameNumber); + if (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager._rateCounter = 0; + frameNumber = 0; + while (!_vm->shouldQuit()) { + ++frameNumber; + _vm->_soundManager.playAnimSound(frameNumber); - // Read frame header - if (f.read(ptr, 16) != 16) - break; + // Read frame header + if (f.read(ptr, 16) != 16) + break; - if (strncmp((char *)ptr, "IMAGE=", 6)) - break; + if (strncmp((char *)ptr, "IMAGE=", 6)) + break; - f.read(screenP, READ_LE_UINT32(ptr + 8)); + f.read(screenP, READ_LE_UINT32(ptr + 8)); - if (_vm->_globals.iRegul == 1) { - do { - if (_vm->_eventsManager._escKeyFl) - goto EXIT; + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->_eventsManager._escKeyFl) + break; - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - } while (!_vm->shouldQuit() && _vm->_eventsManager._rateCounter < rate2); - } + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } while (!_vm->shouldQuit() && _vm->_eventsManager._rateCounter < rate2); + } - _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (hasScreenCopy) { - if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (hasScreenCopy) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); + } + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); } - if (_vm->_globals.iRegul == 1) { + if (_vm->_globals.iRegul == 1 && !_vm->_eventsManager._escKeyFl) { // Do post-animation delay do { if (_vm->_eventsManager._escKeyFl) @@ -165,9 +169,11 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui } while (_vm->_eventsManager._rateCounter < rate3); } - _vm->_eventsManager._rateCounter = 0; - _vm->_soundManager.checkSoundEnd(); -EXIT: + if (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager._rateCounter = 0; + _vm->_soundManager.checkSoundEnd(); + } + if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { screenCopy = _vm->_globals.allocMemory(307200); -- cgit v1.2.3 From f90da4dd7e93801cc74f3c084c8bd8db2a8efecf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 10:04:03 +0100 Subject: HOPKINS: Get rid of another couple of GOTOs in playAnim2 --- engines/hopkins/anim.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 529c4e6f34..34442f848c 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -352,9 +352,15 @@ LABEL_48: if (v5) goto LABEL_88; f.read(screenP, READ_LE_UINT32(ptr + 8)); - if (_vm->_globals.iRegul == 1) - break; -LABEL_77: + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + if (_vm->_eventsManager._rateCounter >= rate2) + break; + } + } + _vm->_eventsManager._rateCounter = 0; _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) { @@ -375,18 +381,12 @@ LABEL_88: _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); if (_vm->_eventsManager._rateCounter >= rate3) - goto LABEL_114; + break; } } goto LABEL_114; } } - while (!_vm->_eventsManager._escKeyFl) { - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate2) - goto LABEL_77; - } LABEL_114: _vm->_graphicsManager._skipVideoLockFl = false; f.close(); -- cgit v1.2.3 From 3653f2b21463025b46cb5bcba87d96a72cc8d4ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 10:19:42 +0100 Subject: HOPKINS: Remove dead code in playAnim2, get rid of one more GOTO --- engines/hopkins/anim.cpp | 61 ++++++++++++---------------------------------- engines/hopkins/script.cpp | 2 ++ 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 34442f848c..865a6812cd 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -218,7 +218,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui * Play Animation, type 2 */ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { - int v5; + bool v5; byte *screenCopy = NULL; int oldScrollVal = 0; byte *screenP = NULL; @@ -291,51 +291,20 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.loadAnimSound(); - if (_vm->_globals.iRegul != 1) - break; - for (;;) { - if (_vm->_eventsManager._escKeyFl) - goto LABEL_114; - _vm->_eventsManager.refreshEvents(); - if (_vm->_eventsManager._rateCounter >= rate1) - goto LABEL_48; - } - if (_vm->_graphicsManager._skipVideoLockFl) - goto LABEL_114; - if (hasScreenCopy) - screenCopy = _vm->_globals.freeMemory(screenCopy); - _vm->_globals.freeMemory(ptr); - f.close(); - - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); - g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); - - memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769); - _vm->_graphicsManager.clearPalette(); - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.clearScreen(); - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager._scrollPosX = oldScrollVal; - _vm->_graphicsManager.scrollScreen(oldScrollVal); - if (_vm->_graphicsManager._largeScreenFl) { - _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager._maxX = 1280; - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } else { - _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); - _vm->_graphicsManager._maxX = SCREEN_WIDTH; - _vm->_graphicsManager.lockScreen(); - _vm->_graphicsManager.clearScreen(); - _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + if (_vm->_globals.iRegul == 1) { + for (;;) { + if (_vm->_eventsManager._escKeyFl) + goto LABEL_114; + _vm->_eventsManager.refreshEvents(); + if (_vm->_eventsManager._rateCounter >= rate1) + break; + } } - _vm->_graphicsManager.unlockScreen(); - _vm->_eventsManager.VBL(); - _vm->_graphicsManager.fadeInShort(); + break; } -LABEL_48: + _vm->_eventsManager._rateCounter = 0; - v5 = 0; + v5 = false; frameNumber = 0; for (;;) { ++frameNumber; @@ -344,10 +313,10 @@ LABEL_48: memset(ptr, 0, 19); if (f.read(ptr, 16) != 16) - v5 = -1; + v5 = true; if (strncmp((const char *)ptr, "IMAGE=", 6)) - v5 = -1; + v5 = true; if (v5) goto LABEL_88; @@ -375,7 +344,7 @@ LABEL_48: _vm->_graphicsManager.DD_VBL(); _vm->_soundManager.checkSoundEnd(); LABEL_88: - if (v5 == -1) { + if (v5) { if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a662a3755c..b63490fb46 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1351,6 +1351,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 103: + // Dice game _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); _vm->_globals._introSpeechOffFl = false; @@ -2324,6 +2325,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 607: + // Display bomb plan if (!_vm->getIsDemo()) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); -- cgit v1.2.3 From c56efbb203d3a5b07070ee53bdb78a30526ac9ae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 10:27:53 +0100 Subject: HOPKINS: More refactoring in playAnim2: Get rid of another label and associated GOTO --- engines/hopkins/anim.cpp | 56 +++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 865a6812cd..24c300c210 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -318,33 +318,31 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u if (strncmp((const char *)ptr, "IMAGE=", 6)) v5 = true; - if (v5) - goto LABEL_88; - f.read(screenP, READ_LE_UINT32(ptr + 8)); - if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl) { - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate2) - break; + if (!v5) { + f.read(screenP, READ_LE_UINT32(ptr + 8)); + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + if (_vm->_eventsManager._rateCounter >= rate2) + break; + } } - } - _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (hasScreenCopy) { - if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (hasScreenCopy) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); - } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); -LABEL_88: - if (v5) { + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); + } else { if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager.refreshEvents(); @@ -353,7 +351,7 @@ LABEL_88: break; } } - goto LABEL_114; + break; } } LABEL_114: @@ -380,21 +378,21 @@ LABEL_114: f.read(screenP, nbytes); memcpy(ptra, screenP, 307200); - int v6 = 0; + bool v6 = false; do { memset(&buf, 0, 6); memset(ptr, 0, 19); if (f.read(ptr, 16) != 16) - v6 = -1; + v6 = true; if (strncmp((const char *)ptr, "IMAGE=", 6)) - v6 = -1; + v6 = true; if (!v6) { f.read(screenP, READ_LE_UINT32(ptr + 8)); if (*screenP != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, ptra); } - } while (v6 != -1); + } while (!v6); _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } -- cgit v1.2.3 From 29ce3e23f1b1aa70a0c662a0c632ac2bdebd8149 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 11:08:37 +0100 Subject: HOPKINS: More refactoring in playAnim2. Get rid of the remaining GOTOs --- engines/hopkins/anim.cpp | 118 ++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 64 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 24c300c210..6ce7c35d5b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -218,12 +218,10 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui * Play Animation, type 2 */ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { - bool v5; byte *screenCopy = NULL; - int oldScrollVal = 0; + int oldScrollPosX = 0; byte *screenP = NULL; byte *ptr = NULL; - int frameNumber; size_t nbytes; byte buf[6]; Common::File f; @@ -239,6 +237,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200); else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2)) _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400); + if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; @@ -262,7 +261,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u f.read(screenP, nbytes); _vm->_graphicsManager.clearPalette(); - oldScrollVal = _vm->_graphicsManager._scrollPosX; + oldScrollPosX = _vm->_graphicsManager._scrollPosX; _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); _vm->_graphicsManager.scrollScreen(0); _vm->_graphicsManager.lockScreen(); @@ -292,69 +291,64 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul == 1) { - for (;;) { - if (_vm->_eventsManager._escKeyFl) - goto LABEL_114; + while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate1) { _vm->_eventsManager.refreshEvents(); - if (_vm->_eventsManager._rateCounter >= rate1) - break; } } break; } - _vm->_eventsManager._rateCounter = 0; - v5 = false; - frameNumber = 0; - for (;;) { - ++frameNumber; - _vm->_soundManager.playAnimSound(frameNumber); - memset(&buf, 0, 6); - memset(ptr, 0, 19); + if (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager._rateCounter = 0; + bool v5 = false; + int frameNumber = 0; + for (;;) { + if (_vm->_eventsManager._escKeyFl) + break; + ++frameNumber; + _vm->_soundManager.playAnimSound(frameNumber); + memset(ptr, 0, 19); - if (f.read(ptr, 16) != 16) - v5 = true; + if (f.read(ptr, 16) != 16) + v5 = true; - if (strncmp((const char *)ptr, "IMAGE=", 6)) - v5 = true; + if (strncmp((const char *)ptr, "IMAGE=", 6)) + v5 = true; - if (!v5) { - f.read(screenP, READ_LE_UINT32(ptr + 8)); - if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl) { - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate2) - break; + if (v5) { + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate3) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } + } + break; + } else { + f.read(screenP, READ_LE_UINT32(ptr + 8)); + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate2) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } } - } - _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (hasScreenCopy) { + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); - } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); - } else { - if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl) { - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate3) - break; + if (hasScreenCopy) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } else { + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); + } } + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); } - break; } } -LABEL_114: + _vm->_graphicsManager._skipVideoLockFl = false; f.close(); @@ -378,21 +372,17 @@ LABEL_114: f.read(screenP, nbytes); memcpy(ptra, screenP, 307200); - bool v6 = false; - do { - memset(&buf, 0, 6); + for (;;) { memset(ptr, 0, 19); if (f.read(ptr, 16) != 16) - v6 = true; + break; if (strncmp((const char *)ptr, "IMAGE=", 6)) - v6 = true; + break; - if (!v6) { - f.read(screenP, READ_LE_UINT32(ptr + 8)); - if (*screenP != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, ptra); - } - } while (!v6); + f.read(screenP, READ_LE_UINT32(ptr + 8)); + if (*screenP != kByteStop) + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, ptra); + } _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); } @@ -412,8 +402,8 @@ LABEL_114: _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager._scrollPosX = oldScrollVal; - _vm->_graphicsManager.scrollScreen(oldScrollVal); + _vm->_graphicsManager._scrollPosX = oldScrollPosX; + _vm->_graphicsManager.scrollScreen(oldScrollPosX); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager._maxX = 1280; -- cgit v1.2.3 From 0f69da1a4ffe2f1a266eb533e5b5783784f9815d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 11:22:20 +0100 Subject: HOPKINS: Skip several useless reads in playAnim2, some more refactoring --- engines/hopkins/anim.cpp | 57 +++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 6ce7c35d5b..0115f854a0 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -221,9 +221,6 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u byte *screenCopy = NULL; int oldScrollPosX = 0; byte *screenP = NULL; - byte *ptr = NULL; - size_t nbytes; - byte buf[6]; Common::File f; if (_vm->shouldQuit()) @@ -242,21 +239,14 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_graphicsManager._scrollOffset = 0; screenP = _vm->_graphicsManager._vesaScreen; - ptr = _vm->_globals.allocMemory(20); - if (!f.open(filename)) error("Error opening file - %s", filename.c_str()); - f.read(&buf, 6); + f.seek(f.pos() + 6); f.read(_vm->_graphicsManager._palette, 800); - f.read(&buf, 4); - nbytes = f.readUint32LE(); - f.readUint32LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); + f.seek(f.pos() + 4); + size_t nbytes = f.readUint32LE(); + f.seek(f.pos() + 14); f.read(screenP, nbytes); @@ -307,12 +297,13 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u break; ++frameNumber; _vm->_soundManager.playAnimSound(frameNumber); - memset(ptr, 0, 19); + byte imageStr[20]; + memset(imageStr, 0, 19); - if (f.read(ptr, 16) != 16) + if (f.read(imageStr, 16) != 16) v5 = true; - if (strncmp((const char *)ptr, "IMAGE=", 6)) + if (strncmp((const char *)imageStr, "IMAGE=", 6)) v5 = true; if (v5) { @@ -324,7 +315,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u } break; } else { - f.read(screenP, READ_LE_UINT32(ptr + 8)); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (_vm->_globals.iRegul == 1) { while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate2) { _vm->_eventsManager.refreshEvents(); @@ -356,30 +347,23 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u byte *ptra; ptra = _vm->_globals.allocMemory(307200); - f.seek(0); - f.read(&buf, 6); + f.seek(6); f.read(_vm->_graphicsManager._palette, 800); - f.read(&buf, 4); - nbytes = f.readUint32LE(); - - f.readUint32LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - + f.seek(f.pos() + 4); + size_t nbytes = f.readUint32LE(); + f.seek(f.pos() + 14); f.read(screenP, nbytes); memcpy(ptra, screenP, 307200); for (;;) { - memset(ptr, 0, 19); - if (f.read(ptr, 16) != 16) + byte imageStr[20]; + memset(imageStr, 0, 19); + if (f.read(imageStr, 16) != 16) break; - if (strncmp((const char *)ptr, "IMAGE=", 6)) + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; - f.read(screenP, READ_LE_UINT32(ptr + 8)); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (*screenP != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, ptra); } @@ -392,7 +376,6 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_globals.freeMemory(screenCopy); } _vm->_graphicsManager.FADE_LINUX = 0; - _vm->_globals.freeMemory(ptr); _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); @@ -405,8 +388,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_graphicsManager._scrollPosX = oldScrollPosX; _vm->_graphicsManager.scrollScreen(oldScrollPosX); if (_vm->_graphicsManager._largeScreenFl) { - _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager._maxX = 1280; + _vm->_graphicsManager.SCANLINE(2 * SCREEN_WIDTH); + _vm->_graphicsManager._maxX = 2 * SCREEN_WIDTH; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { -- cgit v1.2.3 From 397c0cc238fbb58bfac4f54e04af7751131ee9ad Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 13:38:51 +0100 Subject: HOPKINS: Start refactoring BTOCEAN. Get rid of two labels and their associated GOTOs --- engines/hopkins/hopkins.cpp | 335 +++++++++++++++++++++----------------------- 1 file changed, 161 insertions(+), 174 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2ff70f5abd..4b9895ec32 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -106,7 +106,7 @@ Common::Error HopkinsEngine::run() { else if (getPlatform() == Common::kPlatformWindows) runWin95Demo(); else { - warning("Unhandled version, switching to linux demo. Please report this version to ScummVM developers"); + warning("Unhandled version, switching to Linux demo. Please report this version to ScummVM developers"); runLinuxDemo(); } @@ -783,7 +783,7 @@ bool HopkinsEngine::runFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - + if (getPlatform() == Common::kPlatformLinux) { _graphicsManager.loadImage("H2"); _graphicsManager.fadeInLong(); @@ -813,7 +813,9 @@ bool HopkinsEngine::runFull() { _globals.PERSO_TYPE = 0; _globals._mapCarPosX = _globals._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); + _globals._exitId = 0; + for (;;) { if (_globals._exitId == 300) _globals._exitId = 0; @@ -2526,189 +2528,174 @@ void HopkinsEngine::displayCredits() { void HopkinsEngine::BTOCEAN() { _fontManager.hideText(9); - if (_eventsManager._mouseCursorId == 16) { - _eventsManager.getMouseX(); - if (_objectsManager._zoneNum > 0) { - int oldPosX = _eventsManager.getMouseX(); - int oldPosY = _eventsManager.getMouseY(); - bool displAnim = false; - if (_objectsManager._zoneNum == 1) { - if (_globals._oceanDirection == 3) - _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false); - _globals._oceanDirection = 7; - _globals._exitId = 1; - int oldX = _objectsManager.getSpriteX(0); - for (;;) { - if (_globals._speed == 1) - oldX -= 2; - else if (_globals._speed == 2) - oldX -= 4; - else if (_globals._speed == 3) - oldX -= 6; - _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); - _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) - break; - } - } - if (oldX <= -100) - goto LABEL_22; - } + if (_eventsManager._mouseCursorId != 16) + return; + + _eventsManager.getMouseX(); + if (_objectsManager._zoneNum <= 0) + return; + + int oldPosX = _eventsManager.getMouseX(); + int oldPosY = _eventsManager.getMouseY(); + bool displAnim = false; + + if (_objectsManager._zoneNum == 1) { + if (_globals._oceanDirection == 3) + _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false); + else if (_globals._oceanDirection == 1) + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); + else if (_globals._oceanDirection == 5) + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false); + _globals._oceanDirection = 7; + _globals._exitId = 1; + int oldX = _objectsManager.getSpriteX(0); + for (;;) { + if (_globals._speed == 1) + oldX -= 2; + else if (_globals._speed == 2) + oldX -= 4; + else if (_globals._speed == 3) + oldX -= 6; + _objectsManager.setSpriteX(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; + break; } -LABEL_22: - if (_objectsManager._zoneNum == 2) { - if (_globals._oceanDirection == 7) - _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false); - _globals._oceanDirection = 3; - _globals._exitId = 2; - int oldX = _objectsManager.getSpriteX(0); - for (;;) { - if (_globals._speed == 1) - oldX += 2; - else if (_globals._speed == 2) - oldX += 4; - else if (_globals._speed == 3) - oldX += 6; - _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); - _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) - break; - } - } - if (oldX > 499) - goto LABEL_41; - } + + if (oldX <= -100) + break; + } + } + + if (_objectsManager._zoneNum == 2) { + if (_globals._oceanDirection == 7) + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); + else if (_globals._oceanDirection == 1) + _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); + else if (_globals._oceanDirection == 5) + _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false); + _globals._oceanDirection = 3; + _globals._exitId = 2; + int oldX = _objectsManager.getSpriteX(0); + for (;;) { + if (_globals._speed == 1) + oldX += 2; + else if (_globals._speed == 2) + oldX += 4; + else if (_globals._speed == 3) + oldX += 6; + _objectsManager.setSpriteX(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; + break; } -LABEL_41: - if (_objectsManager._zoneNum == 3) { - if (_globals._oceanDirection == 3) { - int oldX = _objectsManager.getSpriteX(0); - do { - if (_globals._speed == 1) - oldX += 2; - else if (_globals._speed == 2) - oldX += 4; - else if (_globals._speed == 3) - oldX += 6; - _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); - _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) { - displAnim = true; - goto LABEL_57; - } - } - } - } while (oldX <= 235); - if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false); + if (oldX > 499) + break; + } + } + if (_objectsManager._zoneNum == 3) { + if (_globals._oceanDirection == 3) { + int oldX = _objectsManager.getSpriteX(0); + do { + if (_globals._speed == 1) + oldX += 2; + else if (_globals._speed == 2) + oldX += 4; + else if (_globals._speed == 3) + oldX += 6; + _objectsManager.setSpriteX(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { + displAnim = true; + goto LABEL_57; } + } while (oldX <= 235); + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false); + } LABEL_57: - if (_globals._oceanDirection == 7) { - int oldX = _objectsManager.getSpriteX(0); - do { - if (_globals._speed == 1) - oldX -= 2; - else if (_globals._speed == 2) - oldX -= 4; - else if (_globals._speed == 3) - oldX -= 6; - _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); - _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) { - displAnim = true; - goto LABEL_72; - } - } - } - } while (oldX > 236); - if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); + if (_globals._oceanDirection == 7) { + int oldX = _objectsManager.getSpriteX(0); + do { + if (_globals._speed == 1) + oldX -= 2; + else if (_globals._speed == 2) + oldX -= 4; + else if (_globals._speed == 3) + oldX -= 6; + _objectsManager.setSpriteX(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { + displAnim = true; + goto LABEL_72; } + } while (oldX > 236); + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); + } LABEL_72: - if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); - _globals._oceanDirection = 1; - _globals._exitId = 3; - } - if (_objectsManager._zoneNum == 4) { - if (_globals._oceanDirection == 3) { - int oldX = _objectsManager.getSpriteX(0); - do { - if (_globals._speed == 1) - oldX += 2; - else if (_globals._speed == 2) - oldX += 4; - else if (_globals._speed == 3) - oldX += 6; - _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); - _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) { - displAnim = true; - goto LABEL_91; - } - } - } - } while (oldX <= 235); - if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false); + if (_globals._oceanDirection == 5) + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); + _globals._oceanDirection = 1; + _globals._exitId = 3; + } + if (_objectsManager._zoneNum == 4) { + if (_globals._oceanDirection == 3) { + int oldX = _objectsManager.getSpriteX(0); + do { + if (_globals._speed == 1) + oldX += 2; + else if (_globals._speed == 2) + oldX += 4; + else if (_globals._speed == 3) + oldX += 6; + _objectsManager.setSpriteX(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { + displAnim = true; + goto LABEL_91; } + } while (oldX <= 235); + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false); + } LABEL_91: - if (_globals._oceanDirection == 7) { - int oldX = _objectsManager.getSpriteX(0); - for (;;) { - if (_globals._speed == 1) - oldX -= 2; - else if (_globals._speed == 2) - oldX -= 4; - else if (_globals._speed == 3) - oldX -= 6; - _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); - _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) - break; - } - } - if (oldX <= 236) { - if (!displAnim) - _objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); + if (_globals._oceanDirection == 7) { + int oldX = _objectsManager.getSpriteX(0); + for (;;) { + if (_globals._speed == 1) + oldX -= 2; + else if (_globals._speed == 2) + oldX -= 4; + else if (_globals._speed == 3) + oldX -= 6; + _objectsManager.setSpriteX(0, oldX); + OCEAN_HOME(); + _eventsManager.VBL(); + if (_eventsManager.getMouseButton() == 1) { + if (oldPosX == _eventsManager.getMouseX()) { + if (_eventsManager.getMouseY() == oldPosY) break; - } } } - if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); - _globals._oceanDirection = 5; - _globals._exitId = 4; + if (oldX <= 236) { + if (!displAnim) + _objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); + break; + } } } + if (_globals._oceanDirection == 1) + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); + _globals._oceanDirection = 5; + _globals._exitId = 4; } } @@ -2734,14 +2721,14 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in if (backgroundFilename.size()) _graphicsManager.loadImage(backgroundFilename); - if ((curExitId != 77) && (curExitId != 84) && (curExitId != 91)) - _objectsManager.INILINK("ocean"); - else if (curExitId == 77) + if (curExitId == 77) _objectsManager.INILINK("IM77"); else if (curExitId == 84) _objectsManager.INILINK("IM84"); else if (curExitId == 91) _objectsManager.INILINK("IM91"); + else + _objectsManager.INILINK("ocean"); if (!exit1) _objectsManager.disableZone(1); @@ -2800,7 +2787,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _objectsManager.checkZone(); OCEAN_HOME(); _eventsManager.VBL(); - if (_globals._exitId) + if (_globals._exitId || g_system->getEventManager()->shouldQuit()) loopCond = true; } while (!loopCond); -- cgit v1.2.3 From c4657c71abad72f249ed95120ca869b33cf5ef65 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 13:50:29 +0100 Subject: HOPKINS: Get rid of 3 more labels --- engines/hopkins/hopkins.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4b9895ec32..2ee48164cc 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2612,13 +2612,12 @@ void HopkinsEngine::BTOCEAN() { _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; - goto LABEL_57; + break; } } while (oldX <= 235); if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false); } -LABEL_57: if (_globals._oceanDirection == 7) { int oldX = _objectsManager.getSpriteX(0); do { @@ -2633,13 +2632,12 @@ LABEL_57: _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; - goto LABEL_72; + break; } } while (oldX > 236); if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); } -LABEL_72: if (_globals._oceanDirection == 5) _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); _globals._oceanDirection = 1; @@ -2660,13 +2658,13 @@ LABEL_72: _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; - goto LABEL_91; + break; } } while (oldX <= 235); if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false); } -LABEL_91: + if (_globals._oceanDirection == 7) { int oldX = _objectsManager.getSpriteX(0); for (;;) { -- cgit v1.2.3 From 6a477576b91fc88fb2676c0019dc98bd724e81ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 14:14:08 +0100 Subject: HOPKINS: Some more refactoring in BTOCEAN code --- engines/hopkins/hopkins.cpp | 85 +++++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 34 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2ee48164cc..9974f7a2c6 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2538,17 +2538,24 @@ void HopkinsEngine::BTOCEAN() { int oldPosX = _eventsManager.getMouseX(); int oldPosY = _eventsManager.getMouseY(); bool displAnim = false; - - if (_objectsManager._zoneNum == 1) { - if (_globals._oceanDirection == 3) + int oldX; + switch (_objectsManager._zoneNum) { + case 1: + switch (_globals._oceanDirection) { + case 1: + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); + break; + case 3: _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 5) + break; + case 5: _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false); + break; + } + _globals._oceanDirection = 7; _globals._exitId = 1; - int oldX = _objectsManager.getSpriteX(0); + oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) oldX -= 2; @@ -2567,18 +2574,22 @@ void HopkinsEngine::BTOCEAN() { if (oldX <= -100) break; } - } - - if (_objectsManager._zoneNum == 2) { - if (_globals._oceanDirection == 7) - _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 1) + break; + case 2: + switch (_globals._oceanDirection) { + case 1: _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); - else if (_globals._oceanDirection == 5) + break; + case 5: _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false); + break; + case 7: + _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); + break; + } _globals._oceanDirection = 3; _globals._exitId = 2; - int oldX = _objectsManager.getSpriteX(0); + oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) oldX += 2; @@ -2596,10 +2607,11 @@ void HopkinsEngine::BTOCEAN() { if (oldX > 499) break; } - } - if (_objectsManager._zoneNum == 3) { - if (_globals._oceanDirection == 3) { - int oldX = _objectsManager.getSpriteX(0); + break; + case 3: + switch (_globals._oceanDirection) { + case 3: + oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) oldX += 2; @@ -2617,9 +2629,12 @@ void HopkinsEngine::BTOCEAN() { } while (oldX <= 235); if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false); - } - if (_globals._oceanDirection == 7) { - int oldX = _objectsManager.getSpriteX(0); + break; + case 5: + _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); + break; + case 7: + oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) oldX -= 2; @@ -2637,15 +2652,18 @@ void HopkinsEngine::BTOCEAN() { } while (oldX > 236); if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); + break; } - if (_globals._oceanDirection == 5) - _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); _globals._oceanDirection = 1; _globals._exitId = 3; - } - if (_objectsManager._zoneNum == 4) { - if (_globals._oceanDirection == 3) { - int oldX = _objectsManager.getSpriteX(0); + break; + case 4: + switch (_globals._oceanDirection) { + case 1: + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); + break; + case 3: + oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) oldX += 2; @@ -2663,10 +2681,9 @@ void HopkinsEngine::BTOCEAN() { } while (oldX <= 235); if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false); - } - - if (_globals._oceanDirection == 7) { - int oldX = _objectsManager.getSpriteX(0); + break; + case 7: + oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) oldX -= 2; @@ -2689,11 +2706,11 @@ void HopkinsEngine::BTOCEAN() { break; } } + break; } - if (_globals._oceanDirection == 1) - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); _globals._oceanDirection = 5; _globals._exitId = 4; + break; } } -- cgit v1.2.3 From 5be9c19ac75476be2117c14e0795c96d12c481ea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 14:20:39 +0100 Subject: HOPKINS: flatten a leftover serie of IFs --- engines/hopkins/hopkins.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 9974f7a2c6..216d8787cc 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -816,6 +816,8 @@ bool HopkinsEngine::runFull() { _globals._exitId = 0; + _globals._exitId = 77; + for (;;) { if (_globals._exitId == 300) _globals._exitId = 0; @@ -2694,12 +2696,9 @@ void HopkinsEngine::BTOCEAN() { _objectsManager.setSpriteX(0, oldX); OCEAN_HOME(); _eventsManager.VBL(); - if (_eventsManager.getMouseButton() == 1) { - if (oldPosX == _eventsManager.getMouseX()) { - if (_eventsManager.getMouseY() == oldPosY) - break; - } - } + if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) + break; + if (oldX <= 236) { if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); -- cgit v1.2.3 From 5846c71469dd29d2e1e6863de6804c7b6dd9b6ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 14:30:03 +0100 Subject: HOPKINS: Remove debug hack left in previous commit, some tiny refactoring --- engines/hopkins/hopkins.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 216d8787cc..5d85afa548 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -816,8 +816,6 @@ bool HopkinsEngine::runFull() { _globals._exitId = 0; - _globals._exitId = 77; - for (;;) { if (_globals._exitId == 300) _globals._exitId = 0; @@ -2793,8 +2791,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager._noFadingFl = false; _globals.iRegul = 1; - bool loopCond = false; - do { + for (;;) { int mouseButton = _eventsManager.getMouseButton(); if (mouseButton && mouseButton == 1) BTOCEAN(); @@ -2802,16 +2799,16 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in OCEAN_HOME(); _eventsManager.VBL(); if (_globals._exitId || g_system->getEventManager()->shouldQuit()) - loopCond = true; - } while (!loopCond); + break; + } if (_globals._exitId == 1) _globals._exitId = exit1; - if (_globals._exitId == 2) + else if (_globals._exitId == 2) _globals._exitId = exit2; - if (_globals._exitId == 3) + else if (_globals._exitId == 3) _globals._exitId = exit3; - if (_globals._exitId == 4) + else if (_globals._exitId == 4) _globals._exitId = exit4; _graphicsManager.fadeOutLong(); _objectsManager.removeSprite(0); -- cgit v1.2.3 From bce7139c8c5ed3966f9750c46ccfa83f6ad692c1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 15:42:49 +0100 Subject: HOPKINS: Refactor selection of action animations --- engines/hopkins/objects.cpp | 180 +++++++++++++++++++++++++++++++------------- 1 file changed, 126 insertions(+), 54 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 4249a1880d..bc7d555c93 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2825,26 +2825,39 @@ void ObjectsManager::ACTION_DOS(int idx) { _vm->_globals.GESTE_FLAG = 1; _vm->_globals.GESTE = _vm->_fileManager.loadFile("DOS.SPR"); } - if (idx == 1) + + switch (idx) { + case 1: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); - if (idx == 2) + break; + case 2: SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false); - if (idx == 3) + break; + case 3: SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); - if (idx == 4) + break; + case 4: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); - if (idx == 5) + break; + case 5: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); - if (idx == 6) + break; + case 6: SPACTION1(_vm->_globals.GESTE, "20,19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 7) + break; + case 7: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); - if (idx == 8) + break; + case 8: SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 9) + break; + case 9: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); - if (idx == 10) + break; + case 10: SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + break; + } } void ObjectsManager::ACTION_DROITE(int idx) { @@ -2853,26 +2866,39 @@ void ObjectsManager::ACTION_DROITE(int idx) { _vm->_globals.GESTE_FLAG = 3; _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); } - if (idx == 1) + + switch (idx) { + case 1: ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false); - if (idx == 2) + break; + case 2: SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false); - if (idx == 3) + break; + case 3: SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); - if (idx == 4) + break; + case 4: ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false); - if (idx == 5) + break; + case 5: SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, false); - if (idx == 6) + break; + case 6: SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); - if (idx == 7) + break; + case 7: SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, false); - if (idx == 8) + break; + case 8: SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); - if (idx == 9) + break; + case 9: SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false); - if (idx == 10) + break; + case 10: SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); + break; + } } void ObjectsManager::Q_DROITE(int idx) { @@ -2881,26 +2907,39 @@ void ObjectsManager::Q_DROITE(int idx) { _vm->_globals.GESTE_FLAG = 4; _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); } - if (idx == 1) + + switch (idx) { + case 1: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); - if (idx == 2) + break; + case 2: SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false); - if (idx == 3) + break; + case 3: SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); - if (idx == 4) + break; + case 4: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); - if (idx == 5) + break; + case 5: SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, false); - if (idx == 6) + break; + case 6: SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); - if (idx == 7) + break; + case 7: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, false); - if (idx == 8) + break; + case 8: SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 9) + break; + case 9: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); - if (idx == 10) + break; + case 10: SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); + break; + } } void ObjectsManager::ACTION_FACE(int idx) { @@ -2909,14 +2948,21 @@ void ObjectsManager::ACTION_FACE(int idx) { _vm->_globals.GESTE_FLAG = 2; _vm->_globals.GESTE = _vm->_fileManager.loadFile("FACE.SPR"); } - if (idx == 1) + + switch (idx) { + case 1: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); - if (idx == 2) + break; + case 2: SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false); - if (idx == 3) + break; + case 3: SPACTION1(_vm->_globals.GESTE, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); - if (idx == 4) + break; + case 4: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + break; + } } void ObjectsManager::Q_GAUCHE(int idx) { @@ -2925,26 +2971,39 @@ void ObjectsManager::Q_GAUCHE(int idx) { _vm->_globals.GESTE_FLAG = 4; _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); } - if (idx == 1) + + switch (idx) { + case 1: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); - if (idx == 2) + break; + case 2: SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true); - if (idx == 3) + break; + case 3: SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); - if (idx == 4) + break; + case 4: ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); - if (idx == 5) + break; + case 5: SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, true); - if (idx == 6) + break; + case 6: SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); - if (idx == 7) + break; + case 7: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,-1,", 0, 0, 8, true); - if (idx == 8) + break; + case 8: SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); - if (idx == 9) + break; + case 9: SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true); - if (idx == 10) + break; + case 10: SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); + break; + } } void ObjectsManager::ACTION_GAUCHE(int idx) { @@ -2953,26 +3012,39 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { _vm->_globals.GESTE_FLAG = 3; _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); } - if (idx == 1) + + switch (idx) { + case 1: ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true); - if (idx == 2) + break; + case 2: SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true); - if (idx == 3) + break; + case 3: SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); - if (idx == 4) + break; + case 4: ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true); - if (idx == 5) + break; + case 5: SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, true); - if (idx == 6) + break; + case 6: SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); - if (idx == 7) + break; + case 7: SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, true); - if (idx == 8) + break; + case 8: SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); - if (idx == 9) + break; + case 9: SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true); - if (idx == 10) + break; + case 10: SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); + break; + } } void ObjectsManager::enableZone(int idx) { -- cgit v1.2.3 From 49afc87b883c89c01a8638e158a5a533279ef073 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 3 Feb 2013 18:33:20 +0100 Subject: HOPKINS: Attempt to fix crash when skipping movie Before starting an "Swav" sound, check that its sound handle isn't already used. If it is, stop it. When skipping a movie, it still (incorrectly?) goes through the motions of playing the remaining frames, including starting any movie sounds on the way. This would cause us to lose the handle to the sound that was currently playing in the "Swav" slot, and I *think* that's what ended up confusing things. I'm still not entirely sure exactly what was happening. --- engines/hopkins/sound.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 96c7df2329..7b59f1ee62 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -824,6 +824,12 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16; + // If the handle is still in use, stop it. Otherwise we'll lose the + // handle to that sound. This can currently happen (but probably + // shouldn't) when skipping a movie. + if (_vm->_mixer->isSoundHandleActive(Swav[wavIndex]._soundHandle)) + _vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle); + // Start the voice playing Swav[wavIndex]._audioStream->rewind(); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, -- cgit v1.2.3 From cec23051b340cd112841e9f930f97b6ec1c0d01a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 22:28:38 +0100 Subject: HOPKINS: Fix the Esc key behavior in playSequence, remove several GOTOs --- engines/hopkins/anim.cpp | 113 ++++++++++++++++++++++++++++----------------- engines/hopkins/events.cpp | 2 + 2 files changed, 72 insertions(+), 43 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 0115f854a0..e2980b3eae 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -606,6 +606,8 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui size_t nbytes; Common::File f; + bool skipFl = false; + if (_vm->shouldQuit()) return; @@ -665,9 +667,13 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui do { if (_vm->_eventsManager._escKeyFl) { if (!_vm->_eventsManager._disableEscKeyFl) - goto LABEL_59; - _vm->_eventsManager._escKeyFl = false; + skipFl = true; + else + _vm->_eventsManager._escKeyFl = false; } + if (skipFl) + break; + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate1); @@ -682,9 +688,14 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui do { if (_vm->_eventsManager._escKeyFl) { if (!_vm->_eventsManager._disableEscKeyFl) - goto LABEL_59; - _vm->_eventsManager._escKeyFl = false; + skipFl = true; + else + _vm->_eventsManager._escKeyFl = false; } + + if (skipFl) + break; + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate1); @@ -693,57 +704,73 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager._rateCounter = 0; readError = false; soundNumber = 0; - do { - ++soundNumber; - _vm->_soundManager.playAnimSound(soundNumber); - memset(v10, 0, 19); - if (f.read(v10, 16) != 16) - readError = true; - - if (strncmp((const char *)v10, "IMAGE=", 6)) - readError = true; - if (!readError) { - f.read(screenP, READ_LE_UINT32(v10 + 8)); - if (_vm->_globals.iRegul == 1) { - do { - if (_vm->_eventsManager._escKeyFl) { - if (!_vm->_eventsManager._disableEscKeyFl) - goto LABEL_59; - _vm->_eventsManager._escKeyFl = false; + if (!skipFl) { + do { + ++soundNumber; + _vm->_soundManager.playAnimSound(soundNumber); + memset(v10, 0, 19); + if (f.read(v10, 16) != 16) + readError = true; + + if (strncmp((const char *)v10, "IMAGE=", 6)) + readError = true; + if (!readError) { + f.read(screenP, READ_LE_UINT32(v10 + 8)); + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->_eventsManager._escKeyFl) { + if (!_vm->_eventsManager._disableEscKeyFl) + skipFl = true; + else + _vm->_eventsManager._escKeyFl = false; + } + + if (skipFl) + break; + + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } while (_vm->_eventsManager._rateCounter < rate2); + } + + if (skipFl) + break; + + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (hasScreenCopy) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - } while (_vm->_eventsManager._rateCounter < rate2); - } - _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (hasScreenCopy) { - if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); - } - } while (!readError); + } while (!readError); + } - if (_vm->_globals.iRegul == 1) { + if (_vm->_globals.iRegul == 1 && !skipFl) { do { if (_vm->_eventsManager._escKeyFl) { if (!_vm->_eventsManager._disableEscKeyFl) - goto LABEL_59; - _vm->_eventsManager._escKeyFl = false; + skipFl = true; + else + _vm->_eventsManager._escKeyFl = false; } + if (skipFl) + break; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate3); } - _vm->_eventsManager._rateCounter = 0; -LABEL_59: + + if (!skipFl) + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager._skipVideoLockFl = false; f.close(); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 31b972cdc3..98ce803e18 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -53,6 +53,8 @@ EventsManager::EventsManager() { Common::fill(&_keyState[0], &_keyState[256], false); _priorCounterTime = 0; _priorFrameTime = 0; + + _disableEscKeyFl = false; } EventsManager::~EventsManager() { -- cgit v1.2.3 From db60dcb4328c1e703c234560d5dfe42aa08935c4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 22:51:34 +0100 Subject: HOPKINS: Replace a global variable by a parameter in playSequence() --- engines/hopkins/anim.cpp | 10 +++++----- engines/hopkins/anim.h | 2 +- engines/hopkins/events.cpp | 2 -- engines/hopkins/events.h | 1 - engines/hopkins/script.cpp | 4 +--- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index e2980b3eae..d0186171d2 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -597,7 +597,7 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) /** * Play sequence */ -void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { +void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl) { bool readError; byte *screenCopy = NULL; byte *screenP; @@ -666,7 +666,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager._escKeyFl) { - if (!_vm->_eventsManager._disableEscKeyFl) + if (!skipEscFl) skipFl = true; else _vm->_eventsManager._escKeyFl = false; @@ -687,7 +687,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager._escKeyFl) { - if (!_vm->_eventsManager._disableEscKeyFl) + if (!skipEscFl) skipFl = true; else _vm->_eventsManager._escKeyFl = false; @@ -719,7 +719,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1) { do { if (_vm->_eventsManager._escKeyFl) { - if (!_vm->_eventsManager._disableEscKeyFl) + if (!skipEscFl) skipFl = true; else _vm->_eventsManager._escKeyFl = false; @@ -756,7 +756,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1 && !skipFl) { do { if (_vm->_eventsManager._escKeyFl) { - if (!_vm->_eventsManager._disableEscKeyFl) + if (!skipEscFl) skipFl = true; else _vm->_eventsManager._escKeyFl = false; diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index e89d2155b9..c0a62b711d 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -51,7 +51,7 @@ public: void clearAnim(); void playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3); void playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3); - void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); + void playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl = false); void playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3); }; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 98ce803e18..31b972cdc3 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -53,8 +53,6 @@ EventsManager::EventsManager() { Common::fill(&_keyState[0], &_keyState[256], false); _priorCounterTime = 0; _priorFrameTime = 0; - - _disableEscKeyFl = false; } EventsManager::~EventsManager() { diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 28a4a9a2de..d6517906ed 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -62,7 +62,6 @@ public: uint32 _priorCounterTime; uint32 _priorFrameTime; bool _escKeyFl; - bool _disableEscKeyFl; DIALOG_KEY _gameKey; int _mouseCursorId; byte *_objectBuf; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index b63490fb46..ba83b61725 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1820,9 +1820,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._disableInventFl = true; if (_vm->_globals._saveData->_data[svField6] != _vm->_globals._saveData->_data[svField401]) { _vm->_soundManager._specialSoundNum = 208; - _vm->_eventsManager._disableEscKeyFl = true; - _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10); - _vm->_eventsManager._disableEscKeyFl = false; + _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10, true); _vm->_soundManager._specialSoundNum = 0; } _vm->_globals.NOT_VERIF = true; -- cgit v1.2.3 From ae80dc481befa2ef342056e596d7c0f62b9a1cbe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Feb 2013 23:07:51 +0100 Subject: HOPKINS: More refactoring of playSequence in order to handle shouldQuit() --- engines/hopkins/anim.cpp | 70 +++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index d0186171d2..73f3a00b50 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -598,16 +598,6 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) * Play sequence */ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl) { - bool readError; - byte *screenCopy = NULL; - byte *screenP; - byte *v10; - int soundNumber; - size_t nbytes; - Common::File f; - - bool skipFl = false; - if (_vm->shouldQuit()) return; @@ -623,18 +613,20 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; } - screenP = _vm->_graphicsManager._vesaScreen; - v10 = _vm->_globals.allocMemory(22); + byte *screenP = _vm->_graphicsManager._vesaScreen; + byte *v10 = _vm->_globals.allocMemory(22); + Common::File f; if (!f.open(file)) error("Error opening file - %s", file.c_str()); f.skip(6); f.read(_vm->_graphicsManager._palette, 800); f.skip(4); - nbytes = f.readUint32LE(); + size_t nbytes = f.readUint32LE(); f.skip(14); f.read(screenP, nbytes); + byte *screenCopy = NULL; if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { hasScreenCopy = true; screenCopy = _vm->_globals.allocMemory(307200); @@ -659,21 +651,19 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); } + bool skipFl = false; if (_vm->getIsDemo()) { _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager._escKeyFl) { - if (!skipEscFl) - skipFl = true; - else - _vm->_eventsManager._escKeyFl = false; - } - if (skipFl) + if (_vm->shouldQuit() || (_vm->_eventsManager._escKeyFl && !skipEscFl)) { + skipFl = true; break; + } + _vm->_eventsManager._escKeyFl = false; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate1); @@ -686,24 +676,20 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_soundManager.loadAnimSound(); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager._escKeyFl) { - if (!skipEscFl) - skipFl = true; - else - _vm->_eventsManager._escKeyFl = false; - } - - if (skipFl) + if (_vm->shouldQuit() || (_vm->_eventsManager._escKeyFl && !skipEscFl)) { + skipFl = true; break; + } + _vm->_eventsManager._escKeyFl = false; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate1); } } _vm->_eventsManager._rateCounter = 0; - readError = false; - soundNumber = 0; + bool readError = false; + int soundNumber = 0; if (!skipFl) { do { ++soundNumber; @@ -718,16 +704,12 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.read(screenP, READ_LE_UINT32(v10 + 8)); if (_vm->_globals.iRegul == 1) { do { - if (_vm->_eventsManager._escKeyFl) { - if (!skipEscFl) - skipFl = true; - else - _vm->_eventsManager._escKeyFl = false; - } - - if (skipFl) + if (_vm->shouldQuit() || (_vm->_eventsManager._escKeyFl && !skipEscFl)) { + skipFl = true; break; + } + _vm->_eventsManager._escKeyFl = false; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate2); @@ -755,14 +737,12 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui if (_vm->_globals.iRegul == 1 && !skipFl) { do { - if (_vm->_eventsManager._escKeyFl) { - if (!skipEscFl) - skipFl = true; - else - _vm->_eventsManager._escKeyFl = false; - } - if (skipFl) + if (_vm->shouldQuit() || (_vm->_eventsManager._escKeyFl && !skipEscFl)) { + skipFl = true; break; + } + + _vm->_eventsManager._escKeyFl = false; _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } while (_vm->_eventsManager._rateCounter < rate3); -- cgit v1.2.3 From 2396316201685a996cf0ff43b03b0951f46472a8 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 4 Feb 2013 00:17:24 +0100 Subject: HOPKINS: Use SWAP() to swap elements in displaySprite() --- engines/hopkins/objects.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bc7d555c93..3453c2b408 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -335,9 +335,7 @@ void ObjectsManager::displaySprite() { loopCondFl = false; for (int sortIdx = 1; sortIdx < _vm->_globals._sortedDisplayCount; sortIdx++) { if (_vm->_globals._sortedDisplay[arr[sortIdx]]._priority > _vm->_globals._sortedDisplay[arr[sortIdx + 1]]._priority) { - int oldIdx = arr[sortIdx]; - arr[sortIdx] = arr[sortIdx + 1]; - arr[sortIdx + 1] = oldIdx; + SWAP(arr[sortIdx], arr[sortIdx + 1]); loopCondFl = true; } } -- cgit v1.2.3 From 013bbbbad43d1a0b9c230bc84aaba620dc20e374 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 4 Feb 2013 08:06:50 +0100 Subject: HOPKINS: Start refactoring playSequence2. Remove 4 labels and the associated GOTOs --- engines/hopkins/anim.cpp | 114 +++++++++++++++++++------------------------- engines/hopkins/hopkins.cpp | 2 +- 2 files changed, 50 insertions(+), 66 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 73f3a00b50..7b8d296624 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -769,11 +769,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui * Play Sequence type 2 */ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { - bool v4; byte *screenCopy = NULL; byte *screenP; byte *v11 = NULL; - int v13; + int frameNumber; size_t nbytes; Common::File f; @@ -825,78 +824,63 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.loadAnimSound(); - if (_vm->_globals.iRegul != 1) - break; - while (!_vm->shouldQuit()) { - if (_vm->_eventsManager._escKeyFl) - goto LABEL_54; - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate1) - goto LABEL_23; + if (_vm->_globals.iRegul == 1) { + do { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } while (!_vm->shouldQuit() && !_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate1); } - if (_vm->_graphicsManager._skipVideoLockFl) - goto LABEL_54; - if (multiScreenFl) - screenCopy = _vm->_globals.freeMemory(screenCopy); - _vm->_globals.freeMemory(v11); - f.close(); - } -LABEL_23: - _vm->_eventsManager._rateCounter = 0; - v4 = false; - v13 = 0; - while (!_vm->shouldQuit()) { - _vm->_soundManager.playAnimSound(v13++); - - memset(v11, 0, 19); - if (f.read(v11, 16) != 16) - v4 = true; - - if (strncmp((const char *)v11, "IMAGE=", 6)) - v4 = true; - if (v4) - goto LABEL_44; - f.read(screenP, READ_LE_UINT32(v11 + 8)); - if (_vm->_globals.iRegul == 1) - break; -LABEL_33: + break; + } + + if (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (multiScreenFl) { - if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); - } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); -LABEL_44: - if (v4) { + frameNumber = 0; + while (!_vm->shouldQuit()) { + _vm->_soundManager.playAnimSound(frameNumber++); + + memset(v11, 0, 19); + if (f.read(v11, 16) != 16) + break; + + if (strncmp((const char *)v11, "IMAGE=", 6)) + break; + + f.read(screenP, READ_LE_UINT32(v11 + 8)); if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl) { + do { _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate3) { - _vm->_eventsManager._rateCounter = 0; - break; - } + } while (!_vm->shouldQuit() && !_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate2); + } + + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (multiScreenFl) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else { - _vm->_eventsManager._rateCounter = 0; + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); } - goto LABEL_54; + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); } } - while (!_vm->_eventsManager._escKeyFl) { - _vm->_eventsManager.refreshEvents(); - if (_vm->_eventsManager._rateCounter >= rate2) - goto LABEL_33; + + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + if (_vm->_eventsManager._rateCounter < rate3) { + break; + } + } } -LABEL_54: + + _vm->_eventsManager._rateCounter = 0; + if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) { byte *ptra = _vm->_globals.allocMemory(307200); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5d85afa548..dcff7f2615 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -758,7 +758,7 @@ bool HopkinsEngine::runFull() { _globals._helicopterFl = false; _eventsManager.mouseOff(); // No code has been added to display the version as it's wrong - // in my copy: it mentions a Win95 version v4 using DirectDraw + // in my copy: it mentions a Win95 version v4 using DirectDraw (Strangerke) } else if (getPlatform() == Common::kPlatformWindows) { _globals._helicopterFl = false; _globals.iRegul = 1; -- cgit v1.2.3 From 0747f769e9ac902b9fa01a0280da98fc6590699c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 4 Feb 2013 08:24:49 +0100 Subject: HOPKINS: Use similar naming and coding style in different functions of AnimationManager --- engines/hopkins/anim.cpp | 167 +++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 7b8d296624..12ef88fb3a 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -56,7 +56,6 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui bool hasScreenCopy = false; byte *screenP = _vm->_graphicsManager._vesaScreen; - byte *ptr = _vm->_globals.allocMemory(20); Common::String tmpStr; // The Windows 95 demo only contains the interlaced version of the BOMBE1 and BOMBE2 videos @@ -121,14 +120,16 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui ++frameNumber; _vm->_soundManager.playAnimSound(frameNumber); + byte imageStr[20]; + memset(imageStr, 0, 20); // Read frame header - if (f.read(ptr, 16) != 16) + if (f.read(imageStr, 16) != 16) break; - if (strncmp((char *)ptr, "IMAGE=", 6)) + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; - f.read(screenP, READ_LE_UINT32(ptr + 8)); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (_vm->_globals.iRegul == 1) { do { @@ -188,14 +189,15 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui memcpy(screenCopy, screenP, 307200); for (;;) { - memset(ptr, 0, 20); + byte imageStr[20]; + memset(imageStr, 0, 20); - if (f.read(ptr, 16) != 16) + if (f.read(imageStr, 16) != 16) break; - if (strncmp((char *)ptr, "IMAGE=", 6)) + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; - f.read(screenP, READ_LE_UINT32(ptr + 8)); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (*screenP != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); } @@ -210,7 +212,6 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.FADE_LINUX = 0; f.close(); - ptr = _vm->_globals.freeMemory(ptr); _vm->_graphicsManager._skipVideoLockFl = false; } @@ -290,7 +291,6 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u if (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager._rateCounter = 0; - bool v5 = false; int frameNumber = 0; for (;;) { if (_vm->_eventsManager._escKeyFl) @@ -301,40 +301,37 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u memset(imageStr, 0, 19); if (f.read(imageStr, 16) != 16) - v5 = true; + break; if (strncmp((const char *)imageStr, "IMAGE=", 6)) - v5 = true; - - if (v5) { - if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate3) { - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - } - } break; - } else { - f.read(screenP, READ_LE_UINT32(imageStr + 8)); - if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate2) { - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - } + + f.read(screenP, READ_LE_UINT32(imageStr + 8)); + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate2) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); } + } - _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (*screenP != kByteStop) { - if (hasScreenCopy) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } else { - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); - } + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (*screenP != kByteStop) { + if (hasScreenCopy) { + _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + } else { + _vm->_graphicsManager.Copy_Video_Vbe16(screenP); } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); + } + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); + } + + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate3) { + _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); } } @@ -614,7 +611,6 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager._scrollOffset = 0; } byte *screenP = _vm->_graphicsManager._vesaScreen; - byte *v10 = _vm->_globals.allocMemory(22); Common::File f; if (!f.open(file)) error("Error opening file - %s", file.c_str()); @@ -688,51 +684,50 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } } _vm->_eventsManager._rateCounter = 0; - bool readError = false; int soundNumber = 0; if (!skipFl) { - do { + for (;;) { ++soundNumber; _vm->_soundManager.playAnimSound(soundNumber); - memset(v10, 0, 19); - if (f.read(v10, 16) != 16) - readError = true; - - if (strncmp((const char *)v10, "IMAGE=", 6)) - readError = true; - if (!readError) { - f.read(screenP, READ_LE_UINT32(v10 + 8)); - if (_vm->_globals.iRegul == 1) { - do { - if (_vm->shouldQuit() || (_vm->_eventsManager._escKeyFl && !skipEscFl)) { - skipFl = true; - break; - } - - _vm->_eventsManager._escKeyFl = false; - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - } while (_vm->_eventsManager._rateCounter < rate2); - } + byte imageStr[20]; + memset(imageStr, 0, 19); + if (f.read(imageStr, 16) != 16) + break; - if (skipFl) - break; + if (strncmp((const char *)imageStr, "IMAGE=", 6)) + break; - _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (hasScreenCopy) { - if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); + if (_vm->_globals.iRegul == 1) { + do { + if (_vm->shouldQuit() || (_vm->_eventsManager._escKeyFl && !skipEscFl)) { + skipFl = true; + break; } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); + + _vm->_eventsManager._escKeyFl = false; + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } while (_vm->_eventsManager._rateCounter < rate2); + } + + if (skipFl) + break; + + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (hasScreenCopy) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); } - } while (!readError); + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); + } } if (_vm->_globals.iRegul == 1 && !skipFl) { @@ -762,7 +757,6 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui } if (hasScreenCopy) _vm->_globals.freeMemory(screenCopy); - _vm->_globals.freeMemory(v10); } /** @@ -771,7 +765,6 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { byte *screenCopy = NULL; byte *screenP; - byte *v11 = NULL; int frameNumber; size_t nbytes; Common::File f; @@ -783,7 +776,6 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._mouseFl = false; screenP = _vm->_graphicsManager._vesaScreen; - v11 = _vm->_globals.allocMemory(22); if (!f.open(file)) error("File not found - %s", file.c_str()); @@ -839,14 +831,15 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u while (!_vm->shouldQuit()) { _vm->_soundManager.playAnimSound(frameNumber++); - memset(v11, 0, 19); - if (f.read(v11, 16) != 16) + byte imageStr[20]; + memset(imageStr, 0, 19); + if (f.read(imageStr, 16) != 16) break; - if (strncmp((const char *)v11, "IMAGE=", 6)) + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; - f.read(screenP, READ_LE_UINT32(v11 + 8)); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (_vm->_globals.iRegul == 1) { do { _vm->_eventsManager.refreshEvents(); @@ -901,14 +894,15 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u memcpy(ptra, screenP, 307200); for (;;) { - memset(v11, 0, 19); - if (f.read(v11, 16) != 16) + byte imageStr[20]; + memset(imageStr, 0, 19); + if (f.read(imageStr, 16) != 16) break; - if (strncmp((const char *)v11, "IMAGE=", 6)) + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; - f.read(screenP, READ_LE_UINT32(v11 + 8)); + f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (*screenP != kByteStop) _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, ptra); } @@ -923,7 +917,6 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_graphicsManager.FADE_LINUX = 0; f.close(); - _vm->_globals.freeMemory(v11); _vm->_eventsManager._mouseFl = true; } -- cgit v1.2.3 From 98e3f098631d5670b137011da9dc55716396c794 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 4 Feb 2013 20:38:31 +0100 Subject: HOPKINS: Improve imageStr allocation, replace remaining useless reads by skips --- engines/hopkins/anim.cpp | 83 ++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 52 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 12ef88fb3a..16d6d581db 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -48,7 +48,6 @@ AnimationManager::AnimationManager() { */ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) { byte *screenCopy = NULL; - int frameNumber; Common::File f; if (_vm->shouldQuit()) @@ -115,17 +114,16 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager._rateCounter = 0; - frameNumber = 0; + int frameNumber = 0; while (!_vm->shouldQuit()) { ++frameNumber; _vm->_soundManager.playAnimSound(frameNumber); - byte imageStr[20]; - memset(imageStr, 0, 20); + byte imageStr[17]; // Read frame header if (f.read(imageStr, 16) != 16) break; - + imageStr[16] = 0; if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; @@ -178,8 +176,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { screenCopy = _vm->_globals.allocMemory(307200); - f.seek(0); - f.skip(6); + f.seek(6); f.read(_vm->_graphicsManager._palette, 800); f.skip(4); nbytes = f.readUint32LE(); @@ -189,11 +186,11 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui memcpy(screenCopy, screenP, 307200); for (;;) { - byte imageStr[20]; - memset(imageStr, 0, 20); - + byte imageStr[17]; if (f.read(imageStr, 16) != 16) break; + imageStr[16] = 0; + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; @@ -243,11 +240,11 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u if (!f.open(filename)) error("Error opening file - %s", filename.c_str()); - f.seek(f.pos() + 6); + f.skip(6); f.read(_vm->_graphicsManager._palette, 800); - f.seek(f.pos() + 4); + f.skip(4); size_t nbytes = f.readUint32LE(); - f.seek(f.pos() + 14); + f.skip(14); f.read(screenP, nbytes); @@ -297,11 +294,10 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u break; ++frameNumber; _vm->_soundManager.playAnimSound(frameNumber); - byte imageStr[20]; - memset(imageStr, 0, 19); - + byte imageStr[17]; if (f.read(imageStr, 16) != 16) break; + imageStr[16] = 0; if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; @@ -341,22 +337,21 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u f.close(); if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) { - byte *ptra; - ptra = _vm->_globals.allocMemory(307200); - f.seek(6); f.read(_vm->_graphicsManager._palette, 800); - f.seek(f.pos() + 4); + f.skip(4); size_t nbytes = f.readUint32LE(); - f.seek(f.pos() + 14); + f.skip(14); f.read(screenP, nbytes); + byte *ptra = _vm->_globals.allocMemory(307200); memcpy(ptra, screenP, 307200); for (;;) { - byte imageStr[20]; - memset(imageStr, 0, 19); + byte imageStr[17]; if (f.read(imageStr, 16) != 16) break; + imageStr[16] = 0; + if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; @@ -500,11 +495,9 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { _vm->_globals.Bank[idx]._data = fileDataPtr; int objectDataIdx = 0; - int width; - int height; for(objectDataIdx = 0; objectDataIdx <= 249; objectDataIdx++) { - width = _vm->_objectsManager.getWidth(fileDataPtr, objectDataIdx); - height = _vm->_objectsManager.getHeight(fileDataPtr, objectDataIdx); + int width = _vm->_objectsManager.getWidth(fileDataPtr, objectDataIdx); + int height = _vm->_objectsManager.getHeight(fileDataPtr, objectDataIdx); if (!width && !height) break; } @@ -689,10 +682,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui for (;;) { ++soundNumber; _vm->_soundManager.playAnimSound(soundNumber); - byte imageStr[20]; - memset(imageStr, 0, 19); + byte imageStr[17]; if (f.read(imageStr, 16) != 16) break; + imageStr[16] = 0; if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; @@ -766,7 +759,6 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u byte *screenCopy = NULL; byte *screenP; int frameNumber; - size_t nbytes; Common::File f; bool multiScreenFl = false; @@ -783,13 +775,8 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u f.skip(6); f.read(_vm->_graphicsManager._palette, 800); f.skip(4); - nbytes = f.readUint32LE(); - f.readUint32LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); + size_t nbytes = f.readUint32LE(); + f.skip(14); f.read(screenP, nbytes); if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { @@ -831,10 +818,10 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u while (!_vm->shouldQuit()) { _vm->_soundManager.playAnimSound(frameNumber++); - byte imageStr[20]; - memset(imageStr, 0, 19); + byte imageStr[17]; if (f.read(imageStr, 16) != 16) break; + imageStr[16] = 0; if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; @@ -877,27 +864,19 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) { byte *ptra = _vm->_globals.allocMemory(307200); - f.seek(0); - f.skip(6); + f.seek(6); f.read(_vm->_graphicsManager._palette, 800); f.skip(4); - nbytes = f.readUint32LE(); - - f.readUint32LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - f.readUint16LE(); - + size_t nbytes = f.readUint32LE(); + f.skip(14); f.read(screenP, nbytes); memcpy(ptra, screenP, 307200); for (;;) { - byte imageStr[20]; - memset(imageStr, 0, 19); + byte imageStr[17]; if (f.read(imageStr, 16) != 16) break; + imageStr[16] = 0; if (strncmp((const char *)imageStr, "IMAGE=", 6)) break; -- cgit v1.2.3 From 03257de9022e7ec1adee8b423890a4b1459172bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 4 Feb 2013 22:54:23 +0100 Subject: HOPKINS: Refactoring in ComputerManager --- engines/hopkins/computer.cpp | 98 ++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 54 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 903185e329..04c81fe2b5 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -288,7 +288,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_graphicsManager.RESET_SEGMENT_VESA(); } -static char _englishText[] = +static const char _englishText[] = "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" @@ -307,7 +307,7 @@ static char _englishText[] = "% 6) SCIENTIST KIDNAPPED (next).\n" "%% fin\n"; -static char _frenchText[] = +static const char _frenchText[] = "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" @@ -327,7 +327,7 @@ static char _frenchText[] = "% 6) DISPARITIONS (suite).\n" "%% fin\n"; -static char _spanishText[] = +static const char _spanishText[] = "% **** ORDENADOR DEL FBI NUMERO 4985 **** ORDENADOR J.HOPKINS *****\n" "% **** ORDENADOR DEL FBI NUMERO 4998 **** ORDENADOR S.COLLINS *****\n" "% *** ORDENADOR DEL FBI NUMERO 4997 *** ORDENADOR DE ACCESO LIBRE ***\n" @@ -390,16 +390,13 @@ void ComputerManager::loadMenu() { } ++lineNum; } - tmpPtr = tmpPtr + 1; + ++tmpPtr; } while (!loopCond); _vm->_globals.freeMemory((byte *)ptr); } void ComputerManager::displayMessage(int xp, int yp, int textIdx) { char curChar; - char newChar; - char mappedChar; - Common::String charString; int x1 = xp; int x2 = 0; @@ -414,7 +411,7 @@ void ComputerManager::displayMessage(int xp, int yp, int textIdx) { if (_vm->shouldQuit()) return; - mappedChar = '*'; + char mappedChar = '*'; if ((curChar == '-') || ((curChar >= '0') && (curChar <= '9')) || ((curChar >= 'A') && (curChar <= 'Z'))) mappedChar = curChar; @@ -431,12 +428,12 @@ void ComputerManager::displayMessage(int xp, int yp, int textIdx) { _vm->_fontManager.displayTextVesa(x1, yp, "_", 252); } if (mappedChar != '*') { - newChar = mappedChar; + char newChar = mappedChar; _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); _inputBuf[textIndex] = newChar; - charString = Common::String::format("%c_", newChar); + Common::String charString = Common::String::format("%c_", newChar); _vm->_fontManager.displayTextVesa(x1, yp, charString, 252); ++textIndex; x1 += _vm->_globals._fontFixedWidth; @@ -483,7 +480,6 @@ void ComputerManager::restoreFBIRoom() { */ void ComputerManager::readText(int idx) { _vm->_eventsManager._escKeyFl = false; - byte *ptr; Common::String filename; if (_vm->_globals._language == LANG_EN) @@ -493,7 +489,7 @@ void ComputerManager::readText(int idx) { else if (_vm->_globals._language == LANG_SP) filename = "THOPKES.TXT"; - ptr = _vm->_fileManager.loadFile(filename); + byte *ptr = _vm->_fileManager.loadFile(filename); uint16 fileSize = _vm->_fileManager.fileSize(filename); int pos; for (pos = 0; pos < fileSize; pos++) { @@ -583,22 +579,19 @@ void ComputerManager::displayGamesSubMenu() { * Load Highscore from file */ void ComputerManager::loadHiscore() { - char nextChar; - byte *ptr; - - ptr = _vm->_globals.allocMemory(100); + byte *ptr = _vm->_globals.allocMemory(100); _vm->_saveLoadManager.load("HISCORE.DAT", ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { - nextChar = ptr[(16 * scoreIndex) + i]; + char nextChar = ptr[(16 * scoreIndex) + i]; if (!nextChar) nextChar = ' '; _score[scoreIndex]._name += nextChar; } for (int i = 0; i < 9; ++i) { - nextChar = ptr[(scoreIndex * 16) + 6 + i]; + char nextChar = ptr[(scoreIndex * 16) + 6 + i]; if (!nextChar) nextChar = '0'; _score[scoreIndex]._score += nextChar; @@ -624,9 +617,6 @@ void ComputerManager::setModeVGA256() { * Load new level */ void ComputerManager::newLevel() { - Common::String file; - Common::File f; - _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.removeSprite(1); ++_breakoutLives; @@ -637,6 +627,8 @@ void ComputerManager::newLevel() { _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); ++_breakoutLevelNbr; + Common::String file; + Common::File f; while (!_vm->shouldQuit()) { file = Common::String::format("TAB%d.TAB", _breakoutLevelNbr); if (f.open(file)) @@ -703,17 +695,11 @@ void ComputerManager::displayBricks() { * Display Lives in breakout game */ void ComputerManager::displayLives() { - int xp = 10; - for (int i = 0; i <= 11; i++) { + for (int i = 0, xp = 10; i <= 11; i++, xp += 7) _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 10, 15); - xp += 7; - } - xp = 10; - for (int i = 0; i < _breakoutLives - 1; i++) { + for (int i = 0, xp = 10; i < _breakoutLives - 1; i++, xp += 7) _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, xp, 10, 14); - xp += 7; - } } /** @@ -721,7 +707,6 @@ void ComputerManager::displayLives() { */ void ComputerManager::playBreakout() { int v1 = 0; - int v; while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) { @@ -780,8 +765,7 @@ void ComputerManager::playBreakout() { _vm->_objectsManager.removeSprite(1); if (_breakoutScore > _breakoutHiscore) getScoreName(); - v = displayHiscores(); - if (v != 1) + if (displayHiscores() != 1) break; _breakoutBrickNbr = 0; @@ -806,9 +790,6 @@ void ComputerManager::playBreakout() { * @return The selected button index: 1 = Game, 2 = Quit */ int ComputerManager::displayHiscores() { - int yp; - int xp; - _vm->_graphicsManager.RESET_SEGMENT_VESA(); loadHiscore(); _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); @@ -818,6 +799,8 @@ int ComputerManager::displayHiscores() { _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); + int yp; + int xp; // Loop for displaying the scores for (int scoreIndex = 0; scoreIndex <= 5; scoreIndex++) { yp = 19 * scoreIndex; @@ -888,11 +871,9 @@ void ComputerManager::getScoreName() { do ++scoreLen; while (score[scoreLen]); - int scorePos = 8; - for (int i = scoreLen; ; _score[5]._score.setChar(score[i], scorePos--)) { - --i; - if (i <= -1) - break; + + for (int i = scoreLen, scorePos = 8; i >= 0; i--) { + _score[5]._score.setChar(score[i], scorePos--); } _vm->_graphicsManager.fateOutBreakout(); _vm->_globals.freeMemory(ptr); @@ -905,8 +886,7 @@ void ComputerManager::getScoreName() { void ComputerManager::displayScore() { Common::String scoreStr = Common::String::format("%d", _breakoutScore); int strSize = scoreStr.size(); - int idx = 0; - for (int i = strSize - 1; i > -1; i--) { + for (int i = strSize - 1, idx = 0; i >= 0; i--) { displayScoreChar(idx++, scoreStr[i]); } } @@ -915,22 +895,32 @@ void ComputerManager::displayScore() { * Display a character of the score */ void ComputerManager::displayScoreChar(int charPos, int charDisp) { - int16 xp = 200; - int16 idx = 3; - - if (charPos == 1) + int xp; + switch (charPos) { + case 1: xp = 190; - else if (charPos == 2) + break; + case 2: xp = 180; - else if (charPos == 3) + break; + case 3: xp = 167; - else if (charPos == 4) + break; + case 4: xp = 157; - else if (charPos == 5) + break; + case 5: xp = 147; - else if (charPos == 9) + break; + case 9: xp = 134; + break; + default: + xp = 200; + break; + } + int idx = 3; if (charDisp >= '0' && charDisp <= '9') idx = charDisp - 45; @@ -941,9 +931,7 @@ void ComputerManager::displayScoreChar(int charPos, int charDisp) { * Save Hiscore in file */ void ComputerManager::saveScore() { - int scorePlace[6]; int scores[6]; - // Load high scores in an array for (int i = 0; i <= 5; i++) { scores[i] = atol(_score[i]._score.c_str()); @@ -951,6 +939,7 @@ void ComputerManager::saveScore() { scores[i] = 5; } + int scorePlace[6]; // order high scores for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) { for(int i = 0;;i++) { @@ -1011,7 +1000,6 @@ void ComputerManager::displayHiscoreLine(byte *objectData, int x, int y, int cur * Handle ball moves */ int ComputerManager::moveBall() { - int16 retVal = 0; //(signed int)(6.0 * (long double)_vm->getRandomNumber( rand() / 2147483648.0) + 1; // TODO: Figure out random number int randVal = _vm->getRandomNumber(6); @@ -1085,6 +1073,8 @@ int ComputerManager::moveBall() { } } } + + int retVal = 0; if (_ballPosition.y > 194) retVal = 1; checkBallCollisions(); -- cgit v1.2.3 From 555c0ad320d177126fa0b202efad190f2ca0b662 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 4 Feb 2013 23:01:02 +0100 Subject: HOPKINS: Fix spacing in Debugger --- engines/hopkins/debugger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp index a332d2160e..c53e9075b6 100644 --- a/engines/hopkins/debugger.cpp +++ b/engines/hopkins/debugger.cpp @@ -28,7 +28,7 @@ namespace Hopkins { Debugger::Debugger() : GUI::Debugger() { - DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); } void Debugger::setParent(HopkinsEngine *vm) { -- cgit v1.2.3 From 19427ff1769617fc379268f1abceccdf272d2aef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Feb 2013 00:12:42 +0100 Subject: HOPKINS: Some refactoring in ObjectsManager --- engines/hopkins/dialogs.cpp | 89 +++++++++++++++------------ engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 6 +- engines/hopkins/graphics.cpp | 2 +- engines/hopkins/hopkins.cpp | 14 ++--- engines/hopkins/objects.cpp | 140 ++++++++++++++++++++----------------------- engines/hopkins/objects.h | 21 ++++--- engines/hopkins/talk.cpp | 6 +- 8 files changed, 143 insertions(+), 137 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 01ed89637d..0dd697d05a 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -68,7 +68,7 @@ void DialogsManager::showOptionsDialog() { filename = "OPTIES.SPR"; } - _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(filename); + _vm->_globals._optionDialogSpr = _vm->_fileManager.loadFile(filename); _vm->_globals._optionDialogFl = true; bool doneFlag = false; @@ -233,7 +233,8 @@ void DialogsManager::showOptionsDialog() { //if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273) // _vm->_globals._speed = 2; - if (mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 || (uint)(mousePos.y - 107) > 211) + if ( mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 + || mousePos.y < 107 || mousePos.y > 318) doneFlag = true; } @@ -256,30 +257,44 @@ void DialogsManager::showOptionsDialog() { _vm->_globals._menuDisplayType = 9; - if (_vm->_graphicsManager._scrollSpeed == 1) + switch (_vm->_graphicsManager._scrollSpeed) { + case 1: _vm->_globals._menuScrollSpeed = 12; - else if (_vm->_graphicsManager._scrollSpeed == 2) + break; + case 2: _vm->_globals._menuScrollSpeed = 13; - else if (_vm->_graphicsManager._scrollSpeed == 4) + break; + case 4: _vm->_globals._menuScrollSpeed = 14; - else if (_vm->_graphicsManager._scrollSpeed == 8) + break; + case 8: _vm->_globals._menuScrollSpeed = 15; - else if (_vm->_graphicsManager._scrollSpeed == 16) + break; + case 16: _vm->_globals._menuScrollSpeed = 16; - else if (_vm->_graphicsManager._scrollSpeed == 32) + break; + case 32: _vm->_globals._menuScrollSpeed = 17; - else if (_vm->_graphicsManager._scrollSpeed == 48) + break; + case 48: _vm->_globals._menuScrollSpeed = 18; - else if (_vm->_graphicsManager._scrollSpeed == 64) + break; + case 64: _vm->_globals._menuScrollSpeed = 19; - else if (_vm->_graphicsManager._scrollSpeed == 128) + break; + case 128: _vm->_globals._menuScrollSpeed = 20; - else if (_vm->_graphicsManager._scrollSpeed == 160) + break; + case 160: _vm->_globals._menuScrollSpeed = 21; - else if (_vm->_graphicsManager._scrollSpeed == 320) + break; + case 320: _vm->_globals._menuScrollSpeed = 22; - else if (_vm->_graphicsManager._scrollSpeed == 640) + break; + case 640: _vm->_globals._menuScrollSpeed = 23; + break; + } _vm->_eventsManager.VBL(); } while (!doneFlag); @@ -289,7 +304,7 @@ void DialogsManager::showOptionsDialog() { _vm->_graphicsManager.addVesaSegment(_vm->_graphicsManager._scrollOffset + 164, 107, _vm->_graphicsManager._scrollOffset + 498, 320); - _vm->_globals.OPTION_SPR = _vm->_globals.freeMemory(_vm->_globals.OPTION_SPR); + _vm->_globals._optionDialogSpr = _vm->_globals.freeMemory(_vm->_globals._optionDialogSpr); _vm->_globals._optionDialogFl = false; } @@ -298,7 +313,7 @@ void DialogsManager::showInventory() { return; _vm->_graphicsManager._scrollStatus = 1; - _vm->_objectsManager.FLAG_VISIBLE_EFFACE = 4; + _vm->_objectsManager._eraseVisibleCounter = 4; _vm->_objectsManager._visibleFl = false; for (int i = 0; i <= 1; i++) { inventAnim(); @@ -319,15 +334,15 @@ LABEL_7: filename = "INVENT.SPR"; else { switch (_vm->_globals._language) { - case LANG_EN: - filename = "INVENTAN.SPR"; - break; - case LANG_FR: - filename = "INVENTFR.SPR"; - break; - case LANG_SP: - filename = "INVENTES.SPR"; - break; + case LANG_EN: + filename = "INVENTAN.SPR"; + break; + case LANG_FR: + filename = "INVENTFR.SPR"; + break; + case LANG_SP: + filename = "INVENTES.SPR"; + break; } } @@ -461,24 +476,24 @@ void DialogsManager::inventAnim() { if (_vm->_globals._disableInventFl) return; - if (_vm->_objectsManager.FLAG_VISIBLE_EFFACE && !_vm->_objectsManager._visibleFl) { - _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, - _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); - _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); - --_vm->_objectsManager.FLAG_VISIBLE_EFFACE; + if (_vm->_objectsManager._eraseVisibleCounter && !_vm->_objectsManager._visibleFl) { + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager._oldInventoryPosX, 27, 48, 38, + _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._oldInventoryPosX, 27); + _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager._oldInventoryPosX, 27, _vm->_objectsManager._oldInventoryPosX + 48, 65); + --_vm->_objectsManager._eraseVisibleCounter; } if (_vm->_objectsManager._visibleFl) { - if (_vm->_objectsManager.I_old_x <= 1) - _vm->_objectsManager.I_old_x = 2; - _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager.I_old_x, 27, 48, 38, - _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.I_old_x, 27); + if (_vm->_objectsManager._oldInventoryPosX <= 1) + _vm->_objectsManager._oldInventoryPosX = 2; + _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_objectsManager._oldInventoryPosX, 27, 48, 38, + _vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._oldInventoryPosX, 27); - _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager.I_old_x, 27, _vm->_objectsManager.I_old_x + 48, 65); + _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager._oldInventoryPosX, 27, _vm->_objectsManager._oldInventoryPosX + 48, 65); int newOffset = _vm->_graphicsManager._scrollOffset + 2; _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, newOffset + 300, 327, 0); _vm->_graphicsManager.addVesaSegment(newOffset, 27, newOffset + 45, 62); - _vm->_objectsManager.I_old_x = newOffset; + _vm->_objectsManager._oldInventoryPosX = newOffset; } if (_vm->_globals._saveData->_data[svField357] == 1) { @@ -504,7 +519,7 @@ void DialogsManager::inventAnim() { * Test dialog opening */ void DialogsManager::testDialogOpening() { - if (_vm->_globals.PLAN_FLAG) + if (_vm->_globals._cityMapEnabledFl) _vm->_eventsManager._gameKey = KEY_NONE; if ((_vm->_eventsManager._gameKey == KEY_NONE) || _inventFl) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index d912f4f227..2c2cfac80e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -173,7 +173,7 @@ Globals::Globals() { ADR_FICHIER_OBJ = NULL; _font = NULL; PERSO = NULL; - OPTION_SPR = NULL; + _optionDialogSpr = NULL; // Reset flags _censorshipFl = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c29b9789ff..4cc2f245be 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -74,7 +74,7 @@ struct BobItem { int _xp; int _yp; int _frameIndex; - int field10; // BOBPOSI ? + int _animDataIdx; int field12; int field14; bool _disabledAnimationFl; @@ -339,7 +339,7 @@ public: bool _disableInventFl; bool NOMARCHE; int NBBLOC; - byte *OPTION_SPR; + byte *_optionDialogSpr; bool _optionDialogFl; int _menuDisplayType; int _menuSpeed; @@ -353,7 +353,7 @@ public: bool NOT_VERIF; bool _cacheFl; bool _introSpeechOffFl; - bool PLAN_FLAG; + bool _cityMapEnabledFl; bool GOACTION; int Compteur; int _actionDirection; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 6318bd1ca8..63bcbf20c8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1060,7 +1060,7 @@ void GraphicsManager::FIN_VISU() { for (int idx = 1; idx <= 20; ++idx) { if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_ZERO(idx); + _vm->_objectsManager.resetBob(idx); } for (int idx = 1; idx <= 29; ++idx) { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index dcff7f2615..46fa3814a6 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -68,14 +68,14 @@ Common::String HopkinsEngine::generateSaveName(int slot) { * Returns true if it is currently okay to restore a game */ bool HopkinsEngine::canLoadGameStateCurrently() { - return !_globals._exitId && !_globals.PLAN_FLAG && _eventsManager._mouseFl; + return !_globals._exitId && !_globals._cityMapEnabledFl && _eventsManager._mouseFl; } /** * Returns true if it is currently okay to save the game */ bool HopkinsEngine::canSaveGameStateCurrently() { - return !_globals._exitId && !_globals.PLAN_FLAG && _eventsManager._mouseFl; + return !_globals._exitId && !_globals._cityMapEnabledFl && _eventsManager._mouseFl; } /** @@ -234,7 +234,7 @@ bool HopkinsEngine::runWin95Demo() { case 4: _globals._disableInventFl = true; - _objectsManager.PLAN_BETA(); + _objectsManager.handleCityMap(); _globals._disableInventFl = false; break; @@ -542,7 +542,7 @@ bool HopkinsEngine::runLinuxDemo() { case 4: _globals._disableInventFl = true; - _objectsManager.PLAN_BETA(); + _objectsManager.handleCityMap(); _globals._disableInventFl = false; break; @@ -887,7 +887,7 @@ bool HopkinsEngine::runFull() { case 4: _globals._disableInventFl = true; - _objectsManager.PLAN_BETA(); + _objectsManager.handleCityMap(); _globals._disableInventFl = false; break; @@ -2097,7 +2097,7 @@ void HopkinsEngine::playEnding() { _dialogsManager._removeInventFl = true; _globals._disableInventFl = true; _graphicsManager._scrollOffset = 0; - _globals.PLAN_FLAG = false; + _globals._cityMapEnabledFl = false; _globals.iRegul = 1; _soundManager.WSOUND(26); _linesManager._route = (int16 *)g_PTRNUL; @@ -2723,7 +2723,7 @@ void HopkinsEngine::OCEAN_HOME() { } void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { - _globals.PLAN_FLAG = false; + _globals._cityMapEnabledFl = false; _graphicsManager._noFadingFl = false; _globals.NOMARCHE = false; _globals._exitId = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3453c2b408..1804458e06 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -44,9 +44,9 @@ ObjectsManager::ObjectsManager() { _borderPos = Common::Point(0, 0); _borderSpriteIndex = 0; _saveLoadX = _saveLoadY = 0; - I_old_x = I_old_y = 0; + _oldInventoryPosX = _oldInventoryPosY = 0; g_old_x = g_old_y = 0; - FLAG_VISIBLE_EFFACE = 0; + _eraseVisibleCounter = 0; _saveLoadSprite = g_PTRNUL; _saveLoadSprite2 = g_PTRNUL; _spritePtr = g_PTRNUL; @@ -55,7 +55,6 @@ ObjectsManager::ObjectsManager() { _saveLoadFl = false; _visibleFl = false; BOBTOUS = false; - my_anim = 0; _zoneNum = 0; _forceZoneFl = false; _changeVerbFl = false; @@ -345,7 +344,7 @@ void ObjectsManager::displaySprite() { int idx = arr[sortIdx]; switch (_vm->_globals._sortedDisplay[idx]._sortMode) { case SORT_BOB: - DEF_BOB(_vm->_globals._sortedDisplay[idx]._index); + setBobInfo(_vm->_globals._sortedDisplay[idx]._index); break; case SORT_SPRITE: DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); @@ -362,7 +361,7 @@ void ObjectsManager::displaySprite() { for (int idx = 1; idx < (_vm->_globals._sortedDisplayCount + 1); ++idx) { switch (_vm->_globals._sortedDisplay[idx]._sortMode) { case SORT_BOB: - DEF_BOB(_vm->_globals._sortedDisplay[idx]._index); + setBobInfo(_vm->_globals._sortedDisplay[idx]._index); break; case SORT_SPRITE: DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); @@ -404,21 +403,21 @@ void ObjectsManager::displaySprite() { // If the Options dialog is activated, draw the elements if (_vm->_globals._optionDialogFl) { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 464, 407, 0); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 657, 556, _vm->_globals._menuSpeed); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 731, 495, _vm->_globals._menuTextOff); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 731, 468, _vm->_globals._menuVoiceOff); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 731, 441, _vm->_globals._menuSoundOff); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 731, 414, _vm->_globals._menuMusicOff); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 600, 522, _vm->_globals._menuDisplayType); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.OPTION_SPR, + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._optionDialogSpr, _vm->_eventsManager._startPos.x + 611, 502, _vm->_globals._menuScrollSpeed); _vm->_graphicsManager.addVesaSegment(_vm->_eventsManager._startPos.x + 164, 107, _vm->_eventsManager._startPos.x + 498, 320); } @@ -464,12 +463,12 @@ void ObjectsManager::displaySprite() { _vm->_dialogsManager.inventAnim(); } -void ObjectsManager::INIT_BOB() { +void ObjectsManager::initBob() { for (int idx = 0; idx < 35; ++idx) - BOB_ZERO(idx); + resetBob(idx); } -void ObjectsManager::BOB_ZERO(int idx) { +void ObjectsManager::resetBob(int idx) { BobItem &bob = _vm->_globals._bob[idx]; ListeItem &item = _vm->_globals.Liste2[idx]; @@ -478,7 +477,7 @@ void ObjectsManager::BOB_ZERO(int idx) { bob._xp = 0; bob._yp = 0; bob._frameIndex = 0; - bob.field10 = false; + bob._animDataIdx = 0; bob.field12 = 0; bob.field14 = 0; bob._disabledAnimationFl = false; @@ -500,7 +499,7 @@ void ObjectsManager::BOB_ZERO(int idx) { item._height = 0; } -void ObjectsManager::DEF_BOB(int idx) { +void ObjectsManager::setBobInfo(int idx) { if (!_vm->_globals._bob[idx]._activeFl) return; @@ -556,7 +555,7 @@ void ObjectsManager::BOB_VISU(int idx) { if (_vm->_globals._bob[idx].field0) return; - BOB_ZERO(idx); + resetBob(idx); const byte *data = _vm->_globals.Bqe_Anim[idx]._data; int bankIdx = (int16)READ_LE_UINT16(data); @@ -853,17 +852,17 @@ void ObjectsManager::computeSprite(int idx) { } } - int v15 = _sprite[idx]._spritePos.x - deltaX; - int v16 = _sprite[idx]._spritePos.y - deltaY; - _sprite[idx]._destX = v15; - _sprite[idx]._destY = v16; + int newPosX = _sprite[idx]._spritePos.x - deltaX; + int newPosY = _sprite[idx]._spritePos.y - deltaY; + _sprite[idx]._destX = newPosX; + _sprite[idx]._destY = newPosY; _sprite[idx].field2A = true; _sprite[idx]._zoomPct = zoomPercent; _sprite[idx]._reducePct = reducePercent; _vm->_globals.Liste[idx]._visibleFl = true; - _vm->_globals.Liste[idx]._posX = v15; - _vm->_globals.Liste[idx]._posY = v16; + _vm->_globals.Liste[idx]._posX = newPosX; + _vm->_globals.Liste[idx]._posY = newPosY; int width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); int height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); @@ -924,20 +923,20 @@ void ObjectsManager::displayBobAnim() { continue; } - byte *v20 = _vm->_globals._bob[idx]._animData + 20; - int v24 = _vm->_globals._bob[idx].field10; - _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v20 + 2 * v24); + byte *dataPtr = _vm->_globals._bob[idx]._animData + 20; + int dataIdx = _vm->_globals._bob[idx]._animDataIdx; + _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx); if (_vm->_globals._lockedAnims[idx]._enableFl) _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if ( PERSO_ON && idx > 20 ) _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v20 + 2 * v24 + 2); - _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v20 + 2 * v24 + 4); - _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v20 + 2 * v24 + 6); - _vm->_globals._bob[idx]._frameIndex = v20[2 * v24 + 8]; - _vm->_globals._bob[idx]._flipFl = (v20[2 * v24 + 9] != 0); - _vm->_globals._bob[idx].field10 += 5; + _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 2); + _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 4); + _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 6); + _vm->_globals._bob[idx]._frameIndex = dataPtr[2 * dataIdx + 8]; + _vm->_globals._bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0); + _vm->_globals._bob[idx]._animDataIdx += 5; int v5 = _vm->_globals._bob[idx].field12; if (v5 > 0) { @@ -958,7 +957,7 @@ void ObjectsManager::displayBobAnim() { if (_vm->_globals._bob[idx].field20 != -1 && _vm->_globals._bob[idx].field20 <= 0) { _vm->_globals._bob[idx].field0 = 11; } else { - _vm->_globals._bob[idx].field10 = 0; + _vm->_globals._bob[idx]._animDataIdx = 0; byte *v21 = _vm->_globals._bob[idx]._animData + 20; _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); @@ -972,7 +971,7 @@ void ObjectsManager::displayBobAnim() { _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6); _vm->_globals._bob[idx]._frameIndex = v21[8]; _vm->_globals._bob[idx]._flipFl = (v21[9] != 0); - _vm->_globals._bob[idx].field10 += 5; + _vm->_globals._bob[idx]._animDataIdx += 5; int v10 = _vm->_globals._bob[idx].field12; if (v10 > 0) { @@ -1254,12 +1253,12 @@ void ObjectsManager::checkZone() { int mouseX = _vm->_eventsManager.getMouseX(); int mouseY = _vm->_eventsManager.getMouseY(); int oldMouseY = mouseY; - if (_vm->_globals.PLAN_FLAG + if (_vm->_globals._cityMapEnabledFl || _vm->_eventsManager._startPos.x >= mouseX || (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY) || (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) { if (_visibleFl) - FLAG_VISIBLE_EFFACE = 4; + _eraseVisibleCounter = 4; _visibleFl = false; } else { _visibleFl = true; @@ -1331,7 +1330,7 @@ void ObjectsManager::checkZone() { if (zoneId != -1 && zoneId != 0) handleRightButton(); } - if ((_vm->_globals.PLAN_FLAG && zoneId == -1) || !zoneId) { + if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) { _verb = 0; _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); @@ -1692,9 +1691,6 @@ void ObjectsManager::GOHOME2() { else if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 7); - if (my_anim++ > 1) - my_anim = 0; - return; } } @@ -1708,7 +1704,6 @@ void ObjectsManager::GOHOME2() { setSpriteIndex(0, 3); _vm->_linesManager._route = (int16 *)g_PTRNUL; - my_anim = 0; } /** @@ -1788,12 +1783,12 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_linesManager.CARRE_ZONE(); } -void ObjectsManager::PLAN_BETA() { +void ObjectsManager::handleCityMap() { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_linesManager.setMaxLineIdx(1); _vm->_globals._characterMaxPosY = 440; - _vm->_globals.PLAN_FLAG = true; + _vm->_globals._cityMapEnabledFl = true; _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; _spritePtr = g_PTRNUL; @@ -1821,7 +1816,6 @@ void ObjectsManager::PLAN_BETA() { } addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, false, 5, 5); _vm->_eventsManager.setMouseXY(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY); - my_anim = 0; _vm->_eventsManager.mouseOn(); _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; @@ -1883,7 +1877,7 @@ void ObjectsManager::PLAN_BETA() { removeSprite(0); _spritePtr = _vm->_globals.freeMemory(_spritePtr); clearScreen(); - _vm->_globals.PLAN_FLAG = false; + _vm->_globals._cityMapEnabledFl = false; } /** @@ -1894,7 +1888,7 @@ void ObjectsManager::handleLeftButton() { int destX = _vm->_eventsManager.getMouseX(); int destY = _vm->_eventsManager.getMouseY(); - if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && + if (!_vm->_dialogsManager._inventFl && !_vm->_globals._cityMapEnabledFl && destX > _vm->_graphicsManager._scrollOffset - 30 && destX < _vm->_graphicsManager._scrollOffset + 50 && destY > -30 && destY < 50) { int oldMouseCursor = _vm->_eventsManager._mouseCursorId; @@ -1908,29 +1902,29 @@ void ObjectsManager::handleLeftButton() { } return; } - if (_vm->_globals._saveData->_data[svField354] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField354] == 1 && !_vm->_globals._cityMapEnabledFl && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS); return; } - if (_vm->_globals._saveData->_data[svField356] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField356] == 1 && !_vm->_globals._cityMapEnabledFl && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 48) { changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS); return; } if (_vm->_globals._saveData->_data[svField357] == 1) { - if (_vm->_globals._saveData->_data[svField353] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField353] == 1 && !_vm->_globals._cityMapEnabledFl && destX >= 533 && destX <= 559 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE); return; } - if (_vm->_globals._saveData->_data[svField355] == 1 && !_vm->_globals.PLAN_FLAG + if (_vm->_globals._saveData->_data[svField355] == 1 && !_vm->_globals._cityMapEnabledFl && destX >= 567 && destX <= 593 && destY >= 26 && destY <= 59) { changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA); return; } } - if (_vm->_globals.PLAN_FLAG && _vm->_globals.GOACTION) { + if (_vm->_globals._cityMapEnabledFl && _vm->_globals.GOACTION) { checkZone(); if (_zoneNum <= 0) return; @@ -1953,7 +1947,7 @@ void ObjectsManager::handleLeftButton() { _vm->_globals._saveData->_data[svField2] = 0; } - if (_vm->_globals.PLAN_FLAG && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0)) + if (_vm->_globals._cityMapEnabledFl && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0)) return; if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_globals.ZONEP[_zoneNum]._destX && _vm->_globals.ZONEP[_zoneNum]._destY && _vm->_globals.ZONEP[_zoneNum]._destY != 31) { @@ -1989,7 +1983,7 @@ void ObjectsManager::handleLeftButton() { goto LABEL_65; } if (!_vm->_globals.NOMARCHE) { - if (!_vm->_globals.PLAN_FLAG) { + if (!_vm->_globals._cityMapEnabledFl) { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); if (_vm->_linesManager._route != (int16 *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); @@ -2003,7 +1997,7 @@ LABEL_63: _vm->_linesManager._route = oldRoute; } LABEL_65: - if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) + if (!_vm->_globals.NOMARCHE && _vm->_globals._cityMapEnabledFl) _vm->_linesManager._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } if (_zoneNum != -1 && _zoneNum != 0) { @@ -2012,7 +2006,7 @@ LABEL_65: else _vm->_globals._saveData->_data[svField1] = _vm->_eventsManager._mouseCursorId; - if (_vm->_globals.PLAN_FLAG) + if (_vm->_globals._cityMapEnabledFl) _vm->_globals._saveData->_data[svField1] = 6; _vm->_globals._saveData->_data[svField2] = _zoneNum; _vm->_globals._saveData->_data[svField3] = _curObjectIndex; @@ -2106,7 +2100,7 @@ void ObjectsManager::PARADISE() { _vm->_globals._saveData->_data[svField1] = 0; _vm->_globals._saveData->_data[svField2] = 0; } - if (_vm->_globals.PLAN_FLAG) { + if (_vm->_globals._cityMapEnabledFl) { _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } @@ -2153,7 +2147,6 @@ void ObjectsManager::clearScreen() { _changeVerbFl = false; _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; - my_anim = 1; _vm->_graphicsManager.RESET_SEGMENT_VESA(); } @@ -3059,14 +3052,13 @@ void ObjectsManager::disableZone(int idx) { } else { _vm->_globals.ZONEP[idx]._enabledFl = false; } - } -void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction) { +void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction) { // Set Hopkins animation and position if (animAction != 3) { setBobAnimation(idx); - SET_BOBPOSI(idx, fromPosi); + SET_BOBPOSI(idx, animIdx); } // Make Hopkins walk to the expected place @@ -3085,7 +3077,7 @@ void ObjectsManager::OPTI_ONE(int idx, int fromPosi, int destPosi, int animActio } int ObjectsManager::BOBPOSI(int idx) { - return _vm->_globals._bob[idx].field10 / 5; + return _vm->_globals._bob[idx]._animDataIdx / 5; } /** @@ -3096,7 +3088,7 @@ void ObjectsManager::setBobAnimation(int idx) { return; _vm->_globals._bob[idx]._disabledAnimationFl = false; - _vm->_globals._bob[idx].field10 = 5; + _vm->_globals._bob[idx]._animDataIdx = 5; _vm->_globals._bob[idx]._frameIndex = 250; _vm->_globals._bob[idx].field12 = 0; _vm->_globals._bob[idx].field14 = 0; @@ -3109,8 +3101,8 @@ void ObjectsManager::stopBobAnimation(int idx) { _vm->_globals._bob[idx]._disabledAnimationFl = true; } -void ObjectsManager::SET_BOBPOSI(int idx, int a2) { - _vm->_globals._bob[idx].field10 = 5 * a2; +void ObjectsManager::SET_BOBPOSI(int idx, int animIdx) { + _vm->_globals._bob[idx]._animDataIdx = 5 * animIdx; _vm->_globals._bob[idx].field12 = 0; _vm->_globals._bob[idx].field14 = 0; } @@ -3403,7 +3395,7 @@ void ObjectsManager::SPECIAL_INI() { } } -void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6) { +void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx) { if (idx1 != -1) setBobAnimation(idx1); if (idx2 != -1) @@ -3411,20 +3403,20 @@ void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, in if (idx3 != -1) setBobAnimation(idx3); if (idx1 != -1) - SET_BOBPOSI(idx1, a4); + SET_BOBPOSI(idx1, anim1Idx); if (idx2 != -1) - SET_BOBPOSI(idx2, a5); + SET_BOBPOSI(idx2, anim2Idx); if (idx3 != -1) - SET_BOBPOSI(idx3, a6); + SET_BOBPOSI(idx3, anim3Idx); } -void ObjectsManager::SCI_OPTI_ONE(int idx, int a2, int a3, int a4) { +void ObjectsManager::SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4) { _vm->_eventsManager._curMouseButton = 0; _vm->_eventsManager._mouseButton = 0; if (a4 != 3) { setBobAnimation(idx); - SET_BOBPOSI(idx, a2); + SET_BOBPOSI(idx, animIdx); } do { @@ -3786,7 +3778,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_eventsManager._gameKey = KEY_NONE; _vm->_dialogsManager._removeInventFl = false; _vm->_graphicsManager._scrollOffset = 0; - _vm->_globals.PLAN_FLAG = false; + _vm->_globals._cityMapEnabledFl = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -3876,7 +3868,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _verb = 4; _vm->_graphicsManager._scrollOffset = 0; _vm->_dialogsManager._removeInventFl = false; - _vm->_globals.PLAN_FLAG = false; + _vm->_globals._cityMapEnabledFl = false; _vm->_graphicsManager._noFadingFl = false; _vm->_globals.NOMARCHE = false; _vm->_globals._exitId = 0; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 5f6633d82b..5e2f0c043d 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -64,9 +64,9 @@ public: Common::Point _borderPos; int _borderSpriteIndex; int _saveLoadX, _saveLoadY; - int I_old_x, I_old_y; + int _oldInventoryPosX, _oldInventoryPosY; int g_old_x, g_old_y; - int FLAG_VISIBLE_EFFACE; + int _eraseVisibleCounter; byte *_saveLoadSprite; byte *_saveLoadSprite2; byte *_spritePtr; @@ -75,7 +75,6 @@ public: bool _saveLoadFl; bool _visibleFl; bool BOBTOUS; - int my_anim; int _zoneNum; bool _forceZoneFl; bool _changeVerbFl; @@ -113,9 +112,9 @@ public: void capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); void addObject(int objIndex); - void INIT_BOB(); - void BOB_ZERO(int idx); - void DEF_BOB(int idx); + void initBob(); + void resetBob(int idx); + void setBobInfo(int idx); void BOB_VISU(int idx); void BOB_OFF(int idx); void BOB_OFFSET(int idx, int offset); @@ -146,7 +145,7 @@ public: void GOHOME(); void GOHOME2(); void loadZone(const Common::String &file); - void PLAN_BETA(); + void handleCityMap(); void handleLeftButton(); void PARADISE(); void clearScreen(); @@ -178,19 +177,19 @@ public: void enableZone(int idx); void disableZone(int idx); - void OPTI_ONE(int idx, int fromPosi, int destPosi, int animAction); + void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction); int BOBPOSI(int idx); void setBobAnimation(int idx); void stopBobAnimation(int idx); - void SET_BOBPOSI(int idx, int a2); + void SET_BOBPOSI(int idx, int animIdx); int getBobPosX(int idx); int getBobPosY(int idx); int getBobFrameIndex(int idx); void INILINK(const Common::String &file); void SPECIAL_INI(); - void OPTI_BOBON(int idx1, int idx2, int idx3, int a4, int a5, int a6); - void SCI_OPTI_ONE(int idx, int a2, int a3, int a4); + void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx); + void SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4); void disableVerb(int idx, int a2); void enableVerb(int idx, int a2); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index d655b95822..1bea537f3c 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -482,7 +482,7 @@ void TalkManager::dialogTalk() { for (int idx = 26; idx <= 30; ++idx) { if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_ZERO(idx); + _vm->_objectsManager.resetBob(idx); } } @@ -497,7 +497,7 @@ void TalkManager::dialogEndTalk() { for (int idx = 21; idx <= 25; ++idx) { if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_ZERO(idx); + _vm->_objectsManager.resetBob(idx); } } @@ -608,7 +608,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_objectsManager._priorityFl = true; if (!_vm->_globals._bob[idx].field0) { - _vm->_objectsManager.BOB_ZERO(idx); + _vm->_objectsManager.resetBob(idx); v5 = _vm->_globals.Bqe_Anim[idx]._data; v4 = (int16)READ_LE_UINT16(v5 + 2); if (!v4) -- cgit v1.2.3 From 324da2999b827608f58aadae899e2c9e4131b7c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Feb 2013 07:52:46 +0100 Subject: HOPKINS: More refactoring and renaming in ObjectsManager --- engines/hopkins/hopkins.cpp | 18 +-- engines/hopkins/objects.cpp | 233 ++++++++++++++++------------------ engines/hopkins/objects.h | 6 +- engines/hopkins/script.cpp | 296 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 4 +- 5 files changed, 268 insertions(+), 289 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 46fa3814a6..4e0698a4c4 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2082,7 +2082,7 @@ void HopkinsEngine::BASED() { do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(8) != 22); + while (_objectsManager.getBobAnimDataIdx(8) != 22); _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); @@ -2125,7 +2125,7 @@ void HopkinsEngine::playEnding() { do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(6) != 54); + while (_objectsManager.getBobAnimDataIdx(6) != 54); _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("GM4.PE2"); @@ -2137,13 +2137,13 @@ void HopkinsEngine::playEnding() { do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(7) != 54); + while (_objectsManager.getBobAnimDataIdx(7) != 54); _soundManager.PLAY_SAMPLE2(1); do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(7) != 65); + while (_objectsManager.getBobAnimDataIdx(7) != 65); _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("DUELB4.PE2"); @@ -2152,21 +2152,21 @@ void HopkinsEngine::playEnding() { do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(7) != 72); + while (_objectsManager.getBobAnimDataIdx(7) != 72); _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("DUELH1.PE2"); do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(7) != 81); + while (_objectsManager.getBobAnimDataIdx(7) != 81); _globals._introSpeechOffFl = true; _talkManager.PARLER_PERSO("DUELB5.PE2"); do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(7) != 120); + while (_objectsManager.getBobAnimDataIdx(7) != 120); _objectsManager.stopBobAnimation(7); if (_globals._saveData->_data[svField135] == 1) { @@ -2218,13 +2218,13 @@ void HopkinsEngine::playEnding() { do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(8) != 5); + while (_objectsManager.getBobAnimDataIdx(8) != 5); _soundManager.PLAY_SOUND2("SOUND41.WAV"); do _eventsManager.VBL(); - while (_objectsManager.BOBPOSI(8) != 21); + while (_objectsManager.getBobAnimDataIdx(8) != 21); _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 1804458e06..3652f4fcaa 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -45,7 +45,7 @@ ObjectsManager::ObjectsManager() { _borderSpriteIndex = 0; _saveLoadX = _saveLoadY = 0; _oldInventoryPosX = _oldInventoryPosY = 0; - g_old_x = g_old_y = 0; + _oldCharacterPosX = _oldCharacterPosY = 0; _eraseVisibleCounter = 0; _saveLoadSprite = g_PTRNUL; _saveLoadSprite2 = g_PTRNUL; @@ -1367,8 +1367,8 @@ void ObjectsManager::GOHOME() { _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; _vm->_globals._oldFrameIndex = 0; - g_old_x = newPosX; - g_old_y = newPosY; + _oldCharacterPosX = newPosX; + _oldCharacterPosY = newPosY; } else { setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; @@ -1401,8 +1401,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 3) { if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 24; } else { int v3 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; @@ -1415,8 +1415,8 @@ void ObjectsManager::GOHOME() { v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0]._zoomFactor); v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0]._zoomFactor); } - v0 = v3 + g_old_x; - v58 = g_old_y + v4; + v0 = v3 + _oldCharacterPosX; + v58 = _oldCharacterPosY + v4; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; @@ -1425,8 +1425,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 7) { if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 24; } else { int v9 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; @@ -1438,8 +1438,8 @@ void ObjectsManager::GOHOME() { v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0]._zoomFactor); v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0]._zoomFactor); } - v0 = g_old_x - v9; - v58 = g_old_y - v10; + v0 = _oldCharacterPosX - v9; + v58 = _oldCharacterPosY - v10; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; @@ -1448,8 +1448,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 1) { if (_vm->_globals._oldFrameIndex > 11) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 0; } else { int v16 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); @@ -1458,8 +1458,8 @@ void ObjectsManager::GOHOME() { } else if (_sprite[0]._zoomFactor > 0) { v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0]._zoomFactor); } - v0 = g_old_x; - v58 = g_old_y - v16; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY - v16; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 11) v1 = 0; @@ -1469,8 +1469,8 @@ void ObjectsManager::GOHOME() { if (_vm->_globals._oldDirection == 5) { if (_vm->_globals._oldFrameIndex < 48 || _vm->_globals._oldFrameIndex > 59) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 48; } else { int v20 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); @@ -1479,8 +1479,8 @@ void ObjectsManager::GOHOME() { } else if (_sprite[0]._zoomFactor > 0) { v20 = _vm->_graphicsManager.zoomIn(v20, _sprite[0]._zoomFactor); } - v0 = g_old_x; - v58 = v20 + g_old_y; + v0 = _oldCharacterPosX; + v58 = v20 + _oldCharacterPosY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 59) v1 = 48; @@ -1489,8 +1489,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 2) { if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 12; } else { int v23 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; @@ -1503,8 +1503,8 @@ void ObjectsManager::GOHOME() { v23 = _vm->_graphicsManager.zoomIn(v23, _sprite[0]._zoomFactor); v24 = _vm->_graphicsManager.zoomIn(v24, _sprite[0]._zoomFactor); } - v0 = v23 + g_old_x; - v58 = g_old_y + v24; + v0 = v23 + _oldCharacterPosX; + v58 = _oldCharacterPosY + v24; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; @@ -1513,8 +1513,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 8) { if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 12; } else { int v29 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; @@ -1526,8 +1526,8 @@ void ObjectsManager::GOHOME() { v29 = _vm->_graphicsManager.zoomIn(v29, _sprite[0]._zoomFactor); v30 = _vm->_graphicsManager.zoomIn(v30, _sprite[0]._zoomFactor); } - v0 = g_old_x - v29; - v58 = g_old_y + v30; + v0 = _oldCharacterPosX - v29; + v58 = _oldCharacterPosY + v30; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; @@ -1536,8 +1536,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 4) { if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 36; } else { int v35 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; @@ -1550,8 +1550,8 @@ void ObjectsManager::GOHOME() { v35 = _vm->_graphicsManager.zoomIn(v35, _sprite[0]._zoomFactor); v36 = _vm->_graphicsManager.zoomIn(v36, _sprite[0]._zoomFactor); } - v0 = v35 + g_old_x; - v58 = g_old_y + v36; + v0 = v35 + _oldCharacterPosX; + v58 = _oldCharacterPosY + v36; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; @@ -1560,8 +1560,8 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 6) { if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { - v0 = g_old_x; - v58 = g_old_y; + v0 = _oldCharacterPosX; + v58 = _oldCharacterPosY; v1 = 36; } else { int v41 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; @@ -1574,8 +1574,8 @@ void ObjectsManager::GOHOME() { v41 = _vm->_graphicsManager.zoomIn(v41, _sprite[0]._zoomFactor); v42 = _vm->_graphicsManager.zoomIn(v42, _sprite[0]._zoomFactor); } - v0 = g_old_x - v41; - v58 = g_old_y + v42; + v0 = _oldCharacterPosX - v41; + v58 = _oldCharacterPosY + v42; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; @@ -1602,8 +1602,8 @@ void ObjectsManager::GOHOME() { setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals._oldDirection = -1; - g_old_x = getSpriteX(0); - g_old_y = getSpriteY(0); + _oldCharacterPosX = getSpriteX(0); + _oldCharacterPosY = getSpriteY(0); if (zoneId > 0) { if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { @@ -1652,8 +1652,8 @@ void ObjectsManager::GOHOME() { _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; _vm->_globals._oldFrameIndex = v1; - g_old_x = newPosX; - g_old_y = newPosY; + _oldCharacterPosX = newPosX; + _oldCharacterPosY = newPosY; } void ObjectsManager::GOHOME2() { @@ -1963,8 +1963,8 @@ void ObjectsManager::handleLeftButton() { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); if (_vm->_linesManager._route != (int16 *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); - g_old_x = getSpriteX(0); - g_old_y = getSpriteY(0); + _oldCharacterPosX = getSpriteX(0); + _oldCharacterPosY = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) { _vm->_globals._oldDirection = -1; @@ -1987,8 +1987,8 @@ void ObjectsManager::handleLeftButton() { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); if (_vm->_linesManager._route != (int16 *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); - g_old_x = getSpriteX(0); - g_old_y = getSpriteY(0); + _oldCharacterPosX = getSpriteX(0); + _oldCharacterPosY = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) _vm->_globals._oldDirection = -1; @@ -2726,17 +2726,17 @@ void ObjectsManager::handleSpecialGames() { break; case 57: _vm->_globals._disableInventFl = true; - if (_vm->_globals._saveData->_data[svField261] == 1 && BOBPOSI(5) == 37) { + if (_vm->_globals._saveData->_data[svField261] == 1 && getBobAnimDataIdx(5) == 37) { stopBobAnimation(5); - SET_BOBPOSI(5, 0); + setBobAnimDataIdx(5, 0); setBobAnimation(6); _vm->_globals._saveData->_data[svField261] = 2; disableZone(15); _vm->_soundManager.playSound("SOUND75.WAV"); } - if (_vm->_globals._saveData->_data[svField261] == 2 && BOBPOSI(6) == 6) { + if (_vm->_globals._saveData->_data[svField261] == 2 && getBobAnimDataIdx(6) == 6) { stopBobAnimation(6); - SET_BOBPOSI(6, 0); + setBobAnimDataIdx(6, 0); setBobAnimation(7); enableZone(14); _vm->_globals._saveData->_data[svField261] = 3; @@ -2750,7 +2750,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_globals._disableInventFl = true; do _vm->_eventsManager.VBL(); - while (BOBPOSI(8) != 3); + while (getBobAnimDataIdx(8) != 3); _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("GM3.PE2"); stopBobAnimation(8); @@ -3058,13 +3058,13 @@ void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction // Set Hopkins animation and position if (animAction != 3) { setBobAnimation(idx); - SET_BOBPOSI(idx, animIdx); + setBobAnimDataIdx(idx, animIdx); } // Make Hopkins walk to the expected place do { _vm->_eventsManager.VBL(); - } while (destPosi != BOBPOSI(idx)); + } while (destPosi != getBobAnimDataIdx(idx)); if (!animAction) stopBobAnimation(idx); @@ -3076,10 +3076,16 @@ void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction } } -int ObjectsManager::BOBPOSI(int idx) { +int ObjectsManager::getBobAnimDataIdx(int idx) { return _vm->_globals._bob[idx]._animDataIdx / 5; } +void ObjectsManager::setBobAnimDataIdx(int idx, int animIdx) { + _vm->_globals._bob[idx]._animDataIdx = 5 * animIdx; + _vm->_globals._bob[idx].field12 = 0; + _vm->_globals._bob[idx].field14 = 0; +} + /** * Set Hopkins animation */ @@ -3101,12 +3107,6 @@ void ObjectsManager::stopBobAnimation(int idx) { _vm->_globals._bob[idx]._disabledAnimationFl = true; } -void ObjectsManager::SET_BOBPOSI(int idx, int animIdx) { - _vm->_globals._bob[idx]._animDataIdx = 5 * animIdx; - _vm->_globals._bob[idx].field12 = 0; - _vm->_globals._bob[idx].field14 = 0; -} - /** * Get X position */ @@ -3126,15 +3126,9 @@ void ObjectsManager::INILINK(const Common::String &file) { int v8; int v9; int v10; - byte *v16; - byte *v17; byte *v22; int16 v27; int16 v28; - int v31; - int v32; - int v33; - int v34; int v36; byte *v37; Common::File f; @@ -3202,24 +3196,24 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_linesManager.resetLines(); for (size_t idx = 0; idx < nbytes - 3; idx++) { if (READ_BE_UINT24(&ptr[idx]) == MKTAG24('O', 'B', '2')) { - v16 = ptr + idx + 4; - v32 = 0; - v34 = 0; + byte *curDataPtr = &ptr[idx + 4]; + int lineDataIdx = 0; + int curLineIdx = 0; _vm->_linesManager.resetLinesNumb(); do { - v27 = (int16)READ_LE_UINT16(v16 + 2 * v32); + v27 = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); if (v27 != -1) { _vm->_linesManager.addLine( - v34, + curLineIdx, v27, - (int16)READ_LE_UINT16(v16 + 2 * v32 + 2), - (int16)READ_LE_UINT16(v16 + 2 * v32 + 4), - (int16)READ_LE_UINT16(v16 + 2 * v32 + 6), - (int16)READ_LE_UINT16(v16 + 2 * v32 + 8), + (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 2), + (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 4), + (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 6), + (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8), 1); } - v32 += 5; - ++v34; + lineDataIdx += 5; + ++curLineIdx; } while (v27 != -1); _vm->_linesManager.initRoute(); } @@ -3228,8 +3222,8 @@ void ObjectsManager::INILINK(const Common::String &file) { if (!OBSSEUL) { for (size_t idx = 0; idx < nbytes - 3; idx++) { if (READ_BE_UINT24(&ptr[idx]) == MKTAG24('Z', 'O', '2')) { - v17 = &ptr[idx + 4]; - v33 = 0; + byte *curDataPtr = &ptr[idx + 4]; + int curDataIdx = 0; for (int i = 1; i <= 100; i++) { _vm->_globals.ZONEP[i]._destX = 0; _vm->_globals.ZONEP[i]._destY = 0; @@ -3247,30 +3241,30 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.ZONEP[i].field12 = 0; } - v31 = 0; + int curLineIdx = 0; do { - v28 = (int16)READ_LE_UINT16(v17 + 2 * v33); + v28 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); if (v28 != -1) { _vm->_linesManager.addZoneLine( - v31, - (int16)READ_LE_UINT16(v17 + 2 * v33 + 2), - (int16)READ_LE_UINT16(v17 + 2 * v33 + 4), - (int16)READ_LE_UINT16(v17 + 2 * v33 + 6), - (int16)READ_LE_UINT16(v17 + 2 * v33 + 8), + curLineIdx, + (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2), + (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4), + (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 6), + (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 8), v28); _vm->_globals.ZONEP[v28]._enabledFl = true; } - v33 += 5; - ++v31; + curDataIdx += 5; + ++curLineIdx; } while (v28 != -1); for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(v17 + 2 * v33); - _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(v17 + 2 * v33 + 2); - _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(v17 + 2 * v33 + 4); - v33 += 3; + _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); + _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2); + _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4); + curDataIdx += 3; } - v22 = ptr + idx + (10 * v31 + 606) + 4; + v22 = ptr + idx + (10 * curLineIdx + 606) + 4; for (int i = 1; i <= 100; i++) { int j = (i - 1) * 10; _vm->_globals.ZONEP[i].field6 = v22[j]; @@ -3403,11 +3397,11 @@ void ObjectsManager::OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int if (idx3 != -1) setBobAnimation(idx3); if (idx1 != -1) - SET_BOBPOSI(idx1, anim1Idx); + setBobAnimDataIdx(idx1, anim1Idx); if (idx2 != -1) - SET_BOBPOSI(idx2, anim2Idx); + setBobAnimDataIdx(idx2, anim2Idx); if (idx3 != -1) - SET_BOBPOSI(idx3, anim3Idx); + setBobAnimDataIdx(idx3, anim3Idx); } void ObjectsManager::SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4) { @@ -3416,14 +3410,14 @@ void ObjectsManager::SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4) { if (a4 != 3) { setBobAnimation(idx); - SET_BOBPOSI(idx, animIdx); + setBobAnimDataIdx(idx, animIdx); } do { _vm->_eventsManager.VBL(); if (_vm->_eventsManager._curMouseButton) break; - } while (a3 != BOBPOSI(idx)); + } while (a3 != getBobAnimDataIdx(idx)); if (!a4) stopBobAnimation(idx); } @@ -3539,11 +3533,6 @@ void ObjectsManager::enableVerb(int idx, int a2) { } void ObjectsManager::ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl) { - bool tokenCompleteFl; - char curChar; - int spriteIndex; - - int strPos = 0; int idx = 0; Common::String tmpStr = ""; int realSpeed = speed; @@ -3552,15 +3541,15 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &action else if (_vm->_globals._speed == 3) realSpeed = speed / 3; const byte *oldSpriteData = _sprite[0]._spriteData; - spriteIndex = _sprite[0]._spriteIndex; + int spriteIndex = _sprite[0]._spriteIndex; bool oldFlipFl = _sprite[0]._flipFl; _sprite[0].field12 += a3; _sprite[0].field14 += a4; _sprite[0]._flipFl = flipFl; - for (;;) { - tokenCompleteFl = false; - curChar = actionStr[strPos]; + for (int strPos = 0; ; strPos++) { + bool tokenCompleteFl = false; + char curChar = actionStr[strPos]; if (curChar == ',') { idx = atoi(tmpStr.c_str()); tmpStr = ""; @@ -3568,7 +3557,6 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &action } else { tmpStr += curChar; } - ++strPos; if (tokenCompleteFl) { if (idx == -1) { @@ -3590,7 +3578,6 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &action } void ObjectsManager::SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl) { - int spriteIndex = 0; Common::String tmpStr = ""; int realSpeed = speed; @@ -3607,11 +3594,11 @@ void ObjectsManager::SPACTION(byte *spriteData, const Common::String &animationS _sprite[0]._flipFl = flipFl; uint strPos = 0; - char nextChar; + int spriteIndex = 0; do { bool completeTokenFl = false; do { - nextChar = animationSeq[strPos]; + char nextChar = animationSeq[strPos]; if ((animationSeq[strPos] == ',') || (strPos == animationSeq.size() - 1)) { // Safeguard: if the sequence doesn't end with a coma, simulate it's present. if (animationSeq[strPos] != ',') @@ -3636,20 +3623,17 @@ void ObjectsManager::SPACTION(byte *spriteData, const Common::String &animationS void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed) { Common::String tmpStr = ""; - int realSpeed; + int realSpeed = speed; if (_vm->_globals._speed == 2) realSpeed = speed / 2; else if (_vm->_globals._speed == 3) realSpeed = speed / 3; - else - realSpeed = speed; - int idx = 0; int spriteIndex = 0; bool completeTokenFl; char nextChar; - for (;;) { + for (int idx = 0; ; idx++) { completeTokenFl = false; nextChar = animString[idx]; if (nextChar == ',') { @@ -3659,7 +3643,6 @@ void ObjectsManager::SPACTION1(byte *spriteData, const Common::String &animStrin } else { tmpStr += nextChar; } - ++idx; if (completeTokenFl) { if (spriteIndex == -1) { @@ -3737,14 +3720,14 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in if (_vm->_globals._saveData->_data[savegameIdx]) { if (_vm->_globals._saveData->_data[savegameIdx] == 1) { - if (((idx == 1 || idx == 2) && BOBPOSI(idx) == 26) || ((idx == 3 || idx == 4) && BOBPOSI(idx) == 27)) { + if (((idx == 1 || idx == 2) && getBobAnimDataIdx(idx) == 26) || ((idx == 3 || idx == 4) && getBobAnimDataIdx(idx) == 27)) { _vm->_dialogsManager._removeInventFl = true; _vm->_soundManager.PLAY_SAMPLE2(1); _vm->_globals._saveData->_data[savegameIdx] = 4; } } if (_vm->_globals._saveData->_data[savegameIdx] == 4) { - if (idx >= 1 && idx <= 4 && BOBPOSI(idx) > 30) + if (idx >= 1 && idx <= 4 && getBobAnimDataIdx(idx) > 30) _vm->_globals._saveData->_data[savegameIdx] = 3; } if (_vm->_globals._saveData->_data[savegameIdx] == 3) { @@ -3816,7 +3799,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); stopBobAnimation(3); _vm->_globals.NOT_VERIF = true; - g_old_x = getSpriteX(0); + _oldCharacterPosX = getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -3859,10 +3842,6 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { - int mouseButtons; - bool breakFlag; - int xp, yp; - _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _verb = 4; @@ -3933,8 +3912,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm computeAndSetSpriteSize(); SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; - g_old_x = _characterPos.x; - g_old_y = _characterPos.y; + _oldCharacterPosX = _characterPos.x; + _oldCharacterPosY = _characterPos.y; _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; @@ -3950,14 +3929,14 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm int xCheck = 0; int yCheck = 0; - breakFlag = false; + bool breakFlag = false; while (!_vm->shouldQuit() && !breakFlag) { - mouseButtons = _vm->_eventsManager.getMouseButton(); + int mouseButtons = _vm->_eventsManager.getMouseButton(); if (mouseButtons) { if (mouseButtons == 1) { if (_verb == 16 && _vm->_eventsManager._mouseCursorId == 16) { - xp = _vm->_eventsManager.getMouseX(); - yp = _vm->_eventsManager.getMouseY(); + int xp = _vm->_eventsManager.getMouseX(); + int yp = _vm->_eventsManager.getMouseY(); if ((xCheck == xp) && (yCheck == yp)) { _vm->_linesManager._route = (int16 *)g_PTRNUL; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 5e2f0c043d..c10b895399 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -65,7 +65,7 @@ public: int _borderSpriteIndex; int _saveLoadX, _saveLoadY; int _oldInventoryPosX, _oldInventoryPosY; - int g_old_x, g_old_y; + int _oldCharacterPosX, _oldCharacterPosY; int _eraseVisibleCounter; byte *_saveLoadSprite; byte *_saveLoadSprite2; @@ -178,10 +178,10 @@ public: void enableZone(int idx); void disableZone(int idx); void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction); - int BOBPOSI(int idx); + int getBobAnimDataIdx(int idx); void setBobAnimation(int idx); void stopBobAnimation(int idx); - void SET_BOBPOSI(int idx, int animIdx); + void setBobAnimDataIdx(int idx, int animIdx); int getBobPosX(int idx); int getBobPosY(int idx); int getBobFrameIndex(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index ba83b61725..a4d768023a 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -573,7 +573,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(3) != 100); + } while (_vm->_objectsManager.getBobAnimDataIdx(3) != 100); _vm->_graphicsManager.fadeOutDefaultLength(_vm->_graphicsManager._vesaBuffer); _vm->_graphicsManager.FIN_VISU(); @@ -766,50 +766,50 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v15) { + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 4 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = true; } - if (_vm->_objectsManager.BOBPOSI(9) == 5) + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 5) v15 = false; - if (_vm->_objectsManager.BOBPOSI(9) == 16 && !v15) { + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 16 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = true; } - if (_vm->_objectsManager.BOBPOSI(9) == 17) + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 17) v15 = false; - if (_vm->_objectsManager.BOBPOSI(9) == 28 && !v15) { + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 28 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(1); v15 = true; } - if (_vm->_objectsManager.BOBPOSI(9) == 29) + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 29) v15 = false; - if (_vm->_objectsManager.BOBPOSI(10) == 10 && !v15) { + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 10 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = true; } - if (_vm->_objectsManager.BOBPOSI(10) == 11) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 11) v15 = false; - if (_vm->_objectsManager.BOBPOSI(10) == 22 && !v15) { + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 22 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = true; } - if (_vm->_objectsManager.BOBPOSI(10) == 23) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 23) v15 = false; - if (_vm->_objectsManager.BOBPOSI(10) == 33 && !v15) { + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 33 && !v15) { _vm->_soundManager.PLAY_SAMPLE2(2); v15 = true; } - if (_vm->_objectsManager.BOBPOSI(10) == 34) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 34) v15 = false; - if (_vm->_objectsManager.BOBPOSI(10) == 12) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 12) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 1); - if (_vm->_objectsManager.BOBPOSI(10) == 23) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 23) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 2); - if (_vm->_objectsManager.BOBPOSI(10) == 34) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 34) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 513, 249, 3); _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(9) != 36); + } while (_vm->_objectsManager.getBobAnimDataIdx(9) != 36); _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.stopBobAnimation(10); @@ -838,26 +838,26 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(9) == 4 && !v20) { + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 4 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); v20 = 1; } - if (_vm->_objectsManager.BOBPOSI(9) == 5) + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 5) v20 = 0; - if (_vm->_objectsManager.BOBPOSI(9) == 18 && !v20) { + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 18 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); v20 = 1; } - if (_vm->_objectsManager.BOBPOSI(9) == 19) + if (_vm->_objectsManager.getBobAnimDataIdx(9) == 19) v20 = 0; - if (_vm->_objectsManager.BOBPOSI(10) == 11 && !v20) { + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 11 && !v20) { _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); v20 = 1; } - if (_vm->_objectsManager.BOBPOSI(10) == 12) + if (_vm->_objectsManager.getBobAnimDataIdx(10) == 12) v20 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(9) != v19); + } while (_vm->_objectsManager.getBobAnimDataIdx(9) != v19); if (v19 == 12) { _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(9); @@ -889,12 +889,12 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(12) == 5 && !v52) { + if (_vm->_objectsManager.getBobAnimDataIdx(12) == 5 && !v52) { _vm->_soundManager.playWav(1); v52 = true; } _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(12) != 34); + } while (_vm->_objectsManager.getBobAnimDataIdx(12) != 34); _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.fadeOutLong(); _vm->_graphicsManager._noFadingFl = true; @@ -955,7 +955,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 59: { _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -970,29 +970,29 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(7); - _vm->_objectsManager.SET_BOBPOSI(7, 0); + _vm->_objectsManager.setBobAnimDataIdx(7, 0); int v18 = 0; _vm->_soundManager.loadSample(1, "SOUND40.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(7) == 10 && !v18) { + if (_vm->_objectsManager.getBobAnimDataIdx(7) == 10 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; } - if (_vm->_objectsManager.BOBPOSI(7) == 11) + if (_vm->_objectsManager.getBobAnimDataIdx(7) == 11) v18 = 0; - if (_vm->_objectsManager.BOBPOSI(7) == 18 && !v18) { + if (_vm->_objectsManager.getBobAnimDataIdx(7) == 18 && !v18) { _vm->_soundManager.PLAY_SAMPLE2(1); v18 = 1; } - if (_vm->_objectsManager.BOBPOSI(7) == 19) + if (_vm->_objectsManager.getBobAnimDataIdx(7) == 19) v18 = 0; - if (_vm->_objectsManager.BOBPOSI(7) == 19) + if (_vm->_objectsManager.getBobAnimDataIdx(7) == 19) _vm->_objectsManager.setBobAnimation(3); _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(3) != 48); + } while (_vm->_objectsManager.getBobAnimDataIdx(3) != 48); _vm->_soundManager.DEL_SAMPLE(1); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.animateSprite(0); @@ -1014,8 +1014,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(12); _vm->_objectsManager.setBobAnimation(13); - _vm->_objectsManager.SET_BOBPOSI(12, 0); - _vm->_objectsManager.SET_BOBPOSI(13, 0); + _vm->_objectsManager.setBobAnimDataIdx(12, 0); + _vm->_objectsManager.setBobAnimDataIdx(13, 0); int v21 = 0; _vm->_soundManager.loadWav("SOUND44.WAV", 1); _vm->_soundManager.loadWav("SOUND71.WAV", 2); @@ -1023,27 +1023,27 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(12) == 4 && !v21) { + if (_vm->_objectsManager.getBobAnimDataIdx(12) == 4 && !v21) { _vm->_soundManager.playWav(1); v21 = 1; } - if (_vm->_objectsManager.BOBPOSI(12) == 5) + if (_vm->_objectsManager.getBobAnimDataIdx(12) == 5) v21 = 0; - if (_vm->_objectsManager.BOBPOSI(4) == 5 && !v21) { + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 5 && !v21) { _vm->_soundManager.playWav(2); v21 = 1; } - if (_vm->_objectsManager.BOBPOSI(4) == 6) + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 6) v21 = 0; - if (_vm->_objectsManager.BOBPOSI(13) == 8) { + if (_vm->_objectsManager.getBobAnimDataIdx(13) == 8) { _vm->_objectsManager.stopBobAnimation(13); _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.setBobAnimation(4); - _vm->_objectsManager.SET_BOBPOSI(4, 0); - _vm->_objectsManager.SET_BOBPOSI(13, 0); + _vm->_objectsManager.setBobAnimDataIdx(4, 0); + _vm->_objectsManager.setBobAnimDataIdx(13, 0); } _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 16); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 16); _vm->_objectsManager.stopBobAnimation(12); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.animateSprite(0); @@ -1055,7 +1055,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 81: { _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -1071,8 +1071,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); _vm->_objectsManager.setBobAnimation(8); - _vm->_objectsManager.SET_BOBPOSI(11, 0); - _vm->_objectsManager.SET_BOBPOSI(8, 0); + _vm->_objectsManager.setBobAnimDataIdx(11, 0); + _vm->_objectsManager.setBobAnimDataIdx(8, 0); _vm->_soundManager.loadWav("SOUND44.WAV", 1); _vm->_soundManager.loadWav("SOUND48.WAV", 2); _vm->_soundManager.loadWav("SOUND49.WAV", 3); @@ -1081,35 +1081,35 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(11) == 4 && !v24) { + if (_vm->_objectsManager.getBobAnimDataIdx(11) == 4 && !v24) { _vm->_soundManager.playWav(1); v24 = 1; } - if (_vm->_objectsManager.BOBPOSI(11) == 5) + if (_vm->_objectsManager.getBobAnimDataIdx(11) == 5) v24 = 0; - if (_vm->_objectsManager.BOBPOSI(8) == 11 && !v24) { + if (_vm->_objectsManager.getBobAnimDataIdx(8) == 11 && !v24) { _vm->_soundManager.playWav(2); v24 = 1; } - if (_vm->_objectsManager.BOBPOSI(8) == 12) + if (_vm->_objectsManager.getBobAnimDataIdx(8) == 12) v24 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(8) != 32); + } while (_vm->_objectsManager.getBobAnimDataIdx(8) != 32); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 201, 14, 1); _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(11); _vm->_objectsManager.stopBobAnimation(8); _vm->_objectsManager.setBobAnimation(5); _vm->_objectsManager.setBobAnimation(6); - _vm->_objectsManager.SET_BOBPOSI(5, 0); - _vm->_objectsManager.SET_BOBPOSI(6, 0); + _vm->_objectsManager.setBobAnimDataIdx(5, 0); + _vm->_objectsManager.setBobAnimDataIdx(6, 0); _vm->_soundManager.playWav(3); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 74); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 74); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.stopBobAnimation(6); _vm->_objectsManager.setBobAnimation(9); @@ -1130,13 +1130,13 @@ int ScriptManager::handleOpcode(byte *dataP) { case 85: _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.setBobAnimation(5); - _vm->_objectsManager.SET_BOBPOSI(5, 0); + _vm->_objectsManager.setBobAnimDataIdx(5, 0); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 6); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 6); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.OBSSEUL = true; @@ -1163,8 +1163,8 @@ int ScriptManager::handleOpcode(byte *dataP) { case 88: if (_vm->_globals._saveData->_data[svField183] == 1) { - _vm->_objectsManager.SET_BOBPOSI(1, 0); - _vm->_objectsManager.SET_BOBPOSI(2, 0); + _vm->_objectsManager.setBobAnimDataIdx(1, 0); + _vm->_objectsManager.setBobAnimDataIdx(2, 0); _vm->_objectsManager.setBobAnimation(1); _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.loadSample(1, "SOUND40.WAV"); @@ -1173,40 +1173,40 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(1) == 1 && !v25) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 1 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 2) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 2) v25 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 3 && !v25) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 3 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 4) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 4) v25 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 5 && !v25) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 5 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 6) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 6) v25 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 7 && !v25) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 7 && !v25) { _vm->_soundManager.PLAY_SAMPLE2(1); v25 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 8) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 8) v25 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(1) != 9); + } while (_vm->_objectsManager.getBobAnimDataIdx(1) != 9); _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); _vm->_soundManager.DEL_SAMPLE(1); } if (_vm->_globals._saveData->_data[svField183] == 2) { - _vm->_objectsManager.SET_BOBPOSI(1, 0); - _vm->_objectsManager.SET_BOBPOSI(3, 0); + _vm->_objectsManager.setBobAnimDataIdx(1, 0); + _vm->_objectsManager.setBobAnimDataIdx(3, 0); _vm->_objectsManager.setBobAnimation(1); _vm->_objectsManager.setBobAnimation(3); _vm->_soundManager.loadSample(1, "SOUND40.WAV"); @@ -1215,32 +1215,32 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(1) == 1 && !v26) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 1 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 2) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 2) v26 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 3 && !v26) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 3 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 4) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 4) v26 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 5 && !v26) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 5 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 6) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 6) v26 = 0; - if (_vm->_objectsManager.BOBPOSI(1) == 7 && !v26) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 7 && !v26) { _vm->_soundManager.PLAY_SAMPLE2(1); v26 = 1; } - if (_vm->_objectsManager.BOBPOSI(1) == 8) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 8) v26 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(1) != 9); + } while (_vm->_objectsManager.getBobAnimDataIdx(1) != 9); _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(3); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); @@ -1311,16 +1311,16 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.setBobAnimation(10); _vm->_objectsManager.setBobAnimation(12); - _vm->_objectsManager.SET_BOBPOSI(9, 0); - _vm->_objectsManager.SET_BOBPOSI(10, 0); - _vm->_objectsManager.SET_BOBPOSI(12, 0); + _vm->_objectsManager.setBobAnimDataIdx(9, 0); + _vm->_objectsManager.setBobAnimDataIdx(10, 0); + _vm->_objectsManager.setBobAnimDataIdx(12, 0); _vm->_objectsManager.removeSprite(0); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(9) != 15); + } while (_vm->_objectsManager.getBobAnimDataIdx(9) != 15); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.animateSprite(0); _vm->_soundManager.playSound("SOUND50.WAV"); @@ -1329,7 +1329,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(12) != 117); + } while (_vm->_objectsManager.getBobAnimDataIdx(12) != 117); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 830, 122, 0); _vm->_objectsManager.stopBobAnimation(12); _vm->_objectsManager.stopBobAnimation(10); @@ -1372,7 +1372,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 105: _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -1403,26 +1403,26 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(4) == 9 && !v33) { + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 9 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if (_vm->_objectsManager.BOBPOSI(4) == 10) + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 10) v33 = 0; - if (_vm->_objectsManager.BOBPOSI(4) == 32 && !v33) { + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 32 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if (_vm->_objectsManager.BOBPOSI(4) == 33) + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 33) v33 = 0; - if (_vm->_objectsManager.BOBPOSI(4) == 55 && !v33) { + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 55 && !v33) { _vm->_soundManager.PLAY_SAMPLE2(1); v33 = 1; } - if (_vm->_objectsManager.BOBPOSI(4) == 56) + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 56) v33 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 72); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 72); _vm->_objectsManager.stopBobAnimation(4); } if (_vm->_globals._saveData->_data[svField253] == 1) { @@ -1432,26 +1432,26 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(6) == 9 && !v34) { + if (_vm->_objectsManager.getBobAnimDataIdx(6) == 9 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if (_vm->_objectsManager.BOBPOSI(6) == 10) + if (_vm->_objectsManager.getBobAnimDataIdx(6) == 10) v34 = 0; - if (_vm->_objectsManager.BOBPOSI(6) == 32 && !v34) { + if (_vm->_objectsManager.getBobAnimDataIdx(6) == 32 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if (_vm->_objectsManager.BOBPOSI(6) == 33) + if (_vm->_objectsManager.getBobAnimDataIdx(6) == 33) v34 = 0; - if (_vm->_objectsManager.BOBPOSI(6) == 55 && !v34) { + if (_vm->_objectsManager.getBobAnimDataIdx(6) == 55 && !v34) { _vm->_soundManager.PLAY_SAMPLE2(1); v34 = 1; } - if (_vm->_objectsManager.BOBPOSI(6) == 56) + if (_vm->_objectsManager.getBobAnimDataIdx(6) == 56) v34 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(6) != 72); + } while (_vm->_objectsManager.getBobAnimDataIdx(6) != 72); _vm->_objectsManager.stopBobAnimation(6); } if (_vm->_globals._saveData->_data[svField253] == 2) { @@ -1461,26 +1461,26 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(5) == 9 && !v35) { + if (_vm->_objectsManager.getBobAnimDataIdx(5) == 9 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if (_vm->_objectsManager.BOBPOSI(5) == 10) + if (_vm->_objectsManager.getBobAnimDataIdx(5) == 10) v35 = 0; - if (_vm->_objectsManager.BOBPOSI(5) == 32 && !v35) { + if (_vm->_objectsManager.getBobAnimDataIdx(5) == 32 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if (_vm->_objectsManager.BOBPOSI(5) == 33) + if (_vm->_objectsManager.getBobAnimDataIdx(5) == 33) v35 = 0; - if (_vm->_objectsManager.BOBPOSI(5) == 55 && !v35) { + if (_vm->_objectsManager.getBobAnimDataIdx(5) == 55 && !v35) { _vm->_soundManager.PLAY_SAMPLE2(1); v35 = 1; } - if (_vm->_objectsManager.BOBPOSI(5) == 56) + if (_vm->_objectsManager.getBobAnimDataIdx(5) == 56) v35 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 72); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 72); _vm->_objectsManager.stopBobAnimation(5); } _vm->_objectsManager.animateSprite(0); @@ -1491,7 +1491,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 106: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(4); - _vm->_objectsManager.SET_BOBPOSI(4, 0); + _vm->_objectsManager.setBobAnimDataIdx(4, 0); _vm->_soundManager.loadWav("SOUND61.WAV", 1); _vm->_soundManager.loadWav("SOUND62.WAV", 2); _vm->_soundManager.loadWav("SOUND61.WAV", 3); @@ -1500,28 +1500,28 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 10); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 10); _vm->_soundManager.playWav(1); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 18); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 18); _vm->_soundManager.playWav(2); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 62); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 62); _vm->_soundManager.playWav(3); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 77); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 77); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.animateSprite(0); break; @@ -1529,7 +1529,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 107: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(5); - _vm->_objectsManager.SET_BOBPOSI(5, 0); + _vm->_objectsManager.setBobAnimDataIdx(5, 0); _vm->_soundManager.loadWav("SOUND61.WAV", 1); _vm->_soundManager.loadWav("SOUND62.WAV", 2); _vm->_soundManager.loadWav("SOUND61.WAV", 3); @@ -1538,28 +1538,28 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 10); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 10); _vm->_soundManager.playWav(1); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 18); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 18); _vm->_soundManager.playWav(2); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 38); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 38); _vm->_soundManager.playWav(3); do { if (_vm->shouldQuit()) return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(5) != 53); + } while (_vm->_objectsManager.getBobAnimDataIdx(5) != 53); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.animateSprite(0); break; @@ -1619,7 +1619,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_talkManager.PARLER_PERSO("gred1.pe2"); _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; @@ -1647,7 +1647,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; @@ -1682,7 +1682,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(10) != 7); + } while (_vm->_objectsManager.getBobAnimDataIdx(10) != 7); _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.stopBobAnimation(3); do { @@ -1690,7 +1690,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(6) != 10); + } while (_vm->_objectsManager.getBobAnimDataIdx(6) != 10); _vm->_soundManager.playSound("SOUND71.WAV"); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.stopBobAnimation(4); @@ -1699,7 +1699,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(7) != 15); + } while (_vm->_objectsManager.getBobAnimDataIdx(7) != 15); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(8); _vm->_soundManager.playSound("SOUND70.WAV"); @@ -1708,7 +1708,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(8) != 76); + } while (_vm->_objectsManager.getBobAnimDataIdx(8) != 76); _vm->_objectsManager.stopBobAnimation(6); _vm->_objectsManager.stopBobAnimation(7); _vm->_objectsManager.stopBobAnimation(8); @@ -1742,7 +1742,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(3) != 18); + } while (_vm->_objectsManager.getBobAnimDataIdx(3) != 18); _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.setBobAnimation(4); break; @@ -1761,9 +1761,9 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - if (_vm->_objectsManager.BOBPOSI(4) == 18) + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 18) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 18, 334, 0, false); - } while (_vm->_objectsManager.BOBPOSI(4) != 26); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 26); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.animateSprite(0); break; @@ -1777,14 +1777,14 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(3) == 10 && !v41) { + if (_vm->_objectsManager.getBobAnimDataIdx(3) == 10 && !v41) { _vm->_soundManager.playWav(1); v41 = 1; } - if (_vm->_objectsManager.BOBPOSI(3) == 11) + if (_vm->_objectsManager.getBobAnimDataIdx(3) == 11) v41 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(3) != 50); + } while (_vm->_objectsManager.getBobAnimDataIdx(3) != 50); _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.animateSprite(0); break; @@ -1799,14 +1799,14 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(4) == 10 && !v42) { + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 10 && !v42) { _vm->_soundManager.playWav(1); v42 = 1; } - if (_vm->_objectsManager.BOBPOSI(4) == 11) + if (_vm->_objectsManager.getBobAnimDataIdx(4) == 11) v42 = 0; _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(4) != 24); + } while (_vm->_objectsManager.getBobAnimDataIdx(4) != 24); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.animateSprite(0); break; @@ -1842,8 +1842,8 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 209: { - _vm->_objectsManager.SET_BOBPOSI(1, 0); - _vm->_objectsManager.SET_BOBPOSI(2, 0); + _vm->_objectsManager.setBobAnimDataIdx(1, 0); + _vm->_objectsManager.setBobAnimDataIdx(2, 0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.setBobAnimation(1); @@ -1852,7 +1852,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(1) != 9); + } while (_vm->_objectsManager.getBobAnimDataIdx(1) != 9); _vm->_objectsManager.stopBobAnimation(1); _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; @@ -1874,7 +1874,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(2) != 10); + } while (_vm->_objectsManager.getBobAnimDataIdx(2) != 10); _vm->_objectsManager.stopBobAnimation(2); _vm->_objectsManager.setBobAnimation(4); break; @@ -1949,7 +1949,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = true; - _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); + _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; @@ -1970,12 +1970,12 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->shouldQuit()) return -1; // Exiting game - if (_vm->_objectsManager.BOBPOSI(7) == 9 && !v45) { + if (_vm->_objectsManager.getBobAnimDataIdx(7) == 9 && !v45) { v45 = 1; _vm->_soundManager.playSound("SOUND81.WAV"); } _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(7) != 15); + } while (_vm->_objectsManager.getBobAnimDataIdx(7) != 15); _vm->_objectsManager.stopBobAnimation(7); _vm->_objectsManager.setSpriteX(0, 476); _vm->_objectsManager.setSpriteY(0, 278); @@ -1997,7 +1997,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(12) != 6); + } while (_vm->_objectsManager.getBobAnimDataIdx(12) != 6); _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); _vm->_globals._introSpeechOffFl = false; @@ -2006,7 +2006,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(12) != 12); + } while (_vm->_objectsManager.getBobAnimDataIdx(12) != 12); _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(12); _vm->_globals.CACHE_ON(); @@ -2022,9 +2022,9 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - if (_vm->_objectsManager.BOBPOSI(11) == 10 && !v46) + if (_vm->_objectsManager.getBobAnimDataIdx(11) == 10 && !v46) v46 = 1; - } while (_vm->_objectsManager.BOBPOSI(11) != 13); + } while (_vm->_objectsManager.getBobAnimDataIdx(11) != 13); _vm->_objectsManager.stopBobAnimation(11); _vm->_globals.CACHE_ON(); _vm->_objectsManager.setBobAnimation(13); @@ -2033,7 +2033,7 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - } while (_vm->_objectsManager.BOBPOSI(13) != 48); + } while (_vm->_objectsManager.getBobAnimDataIdx(13) != 48); _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); _vm->_globals._introSpeechOffFl = false; @@ -2148,19 +2148,19 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game _vm->_eventsManager.VBL(); - if (_vm->_objectsManager.BOBPOSI(1) == 12 && !soundFlag) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 12 && !soundFlag) { _vm->_soundManager.playSound("SOUND86.WAV"); soundFlag = true; } - if (_vm->_objectsManager.BOBPOSI(1) == 13) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 13) soundFlag = false; - if (_vm->_objectsManager.BOBPOSI(1) == 25 && !soundFlag) { + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 25 && !soundFlag) { _vm->_soundManager.playSound("SOUND85.WAV"); soundFlag = true; } - if (_vm->_objectsManager.BOBPOSI(1) == 25) + if (_vm->_objectsManager.getBobAnimDataIdx(1) == 25) soundFlag = false; - } while (_vm->_objectsManager.BOBPOSI(1) != 32); + } while (_vm->_objectsManager.getBobAnimDataIdx(1) != 32); _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 1bea537f3c..29679fe547 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -894,7 +894,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(6) < 12); + while (_vm->_objectsManager.getBobAnimDataIdx(6) < 12); _vm->_objectsManager.stopBobAnimation(6); _vm->_objectsManager.setBobAnimation(8); @@ -942,7 +942,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) < 12); + while (_vm->_objectsManager.getBobAnimDataIdx(5) < 12); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(7); switch (_vm->_globals._screenId) { -- cgit v1.2.3 From caefdc943979361c393a8e3701fd0188b0170059 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Feb 2013 08:00:49 +0100 Subject: HOPKINS: Some renaming in ObjectsManager --- engines/hopkins/objects.cpp | 112 ++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 3652f4fcaa..12bda80868 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1405,18 +1405,18 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 24; } else { - int v3 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int v4 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { - v3 = _vm->_graphicsManager.zoomOut(v3, -_sprite[0]._zoomFactor); - v4 = _vm->_graphicsManager.zoomOut(v4, -_sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { - v3 = _vm->_graphicsManager.zoomIn(v3, _sprite[0]._zoomFactor); - v4 = _vm->_graphicsManager.zoomIn(v4, _sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = v3 + _oldCharacterPosX; - v58 = _oldCharacterPosY + v4; + v0 = _oldCharacterPosX + deltaX; + v58 = _oldCharacterPosY + deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; @@ -1429,17 +1429,17 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 24; } else { - int v9 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int v10 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { - v9 = _vm->_graphicsManager.zoomOut(v9, -_sprite[0]._zoomFactor); - v10 = _vm->_graphicsManager.zoomOut(v10, -_sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { - v9 = _vm->_graphicsManager.zoomIn(v9, _sprite[0]._zoomFactor); - v10 = _vm->_graphicsManager.zoomIn(v10, _sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX - v9; - v58 = _oldCharacterPosY - v10; + v0 = _oldCharacterPosX - deltaX; + v58 = _oldCharacterPosY - deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 35) v1 = 24; @@ -1452,14 +1452,14 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 0; } else { - int v16 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); + int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { - v16 = _vm->_graphicsManager.zoomOut(v16, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { - v16 = _vm->_graphicsManager.zoomIn(v16, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY - v16; + v58 = _oldCharacterPosY - deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 11) v1 = 0; @@ -1473,14 +1473,14 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 48; } else { - int v20 = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); + int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { - v20 = _vm->_graphicsManager.zoomOut(v20, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { - v20 = _vm->_graphicsManager.zoomIn(v20, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } v0 = _oldCharacterPosX; - v58 = v20 + _oldCharacterPosY; + v58 = deltaY + _oldCharacterPosY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 59) v1 = 48; @@ -1493,18 +1493,18 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 12; } else { - int v23 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int v24 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { - v23 = _vm->_graphicsManager.zoomOut(v23, -_sprite[0]._zoomFactor); - v24 = _vm->_graphicsManager.zoomOut(v24, -_sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } if (_sprite[0]._zoomFactor > 0) { - v23 = _vm->_graphicsManager.zoomIn(v23, _sprite[0]._zoomFactor); - v24 = _vm->_graphicsManager.zoomIn(v24, _sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = v23 + _oldCharacterPosX; - v58 = _oldCharacterPosY + v24; + v0 = deltaX + _oldCharacterPosX; + v58 = _oldCharacterPosY + deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; @@ -1517,17 +1517,17 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 12; } else { - int v29 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int v30 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { - v29 = _vm->_graphicsManager.zoomOut(v29, -_sprite[0]._zoomFactor); - v30 = _vm->_graphicsManager.zoomOut(v30, -_sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { - v29 = _vm->_graphicsManager.zoomIn(v29, _sprite[0]._zoomFactor); - v30 = _vm->_graphicsManager.zoomIn(v30, _sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX - v29; - v58 = _oldCharacterPosY + v30; + v0 = _oldCharacterPosX - deltaX; + v58 = _oldCharacterPosY + deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 23) v1 = 12; @@ -1540,18 +1540,18 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 36; } else { - int v35 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int v36 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { - v35 = _vm->_graphicsManager.zoomOut(v35, -_sprite[0]._zoomFactor); - v36 = _vm->_graphicsManager.zoomOut(v36, -_sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } if (_sprite[0]._zoomFactor > 0) { - v35 = _vm->_graphicsManager.zoomIn(v35, _sprite[0]._zoomFactor); - v36 = _vm->_graphicsManager.zoomIn(v36, _sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = v35 + _oldCharacterPosX; - v58 = _oldCharacterPosY + v36; + v0 = deltaX + _oldCharacterPosX; + v58 = _oldCharacterPosY + deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; @@ -1564,18 +1564,18 @@ void ObjectsManager::GOHOME() { v58 = _oldCharacterPosY; v1 = 36; } else { - int v41 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int v42 = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; + int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; if (_sprite[0]._zoomFactor < 0) { - v41 = _vm->_graphicsManager.zoomOut(v41, -_sprite[0]._zoomFactor); - v42 = _vm->_graphicsManager.zoomOut(v42, -_sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } if (_sprite[0]._zoomFactor > 0) { - v41 = _vm->_graphicsManager.zoomIn(v41, _sprite[0]._zoomFactor); - v42 = _vm->_graphicsManager.zoomIn(v42, _sprite[0]._zoomFactor); + deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); + deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX - v41; - v58 = _oldCharacterPosY + v42; + v0 = _oldCharacterPosX - deltaX; + v58 = _oldCharacterPosY + deltaY; v1 = _vm->_globals._oldFrameIndex + 1; if (v1 > 47) v1 = 36; -- cgit v1.2.3 From 46ef222ccd9f6650a85c32e67061c8817259f4bd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 00:11:45 +0100 Subject: HOPKINS: Remove 2 labels and associated GOTOs from ObjectManager --- engines/hopkins/objects.cpp | 64 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 12bda80868..83062023e3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1834,7 +1834,7 @@ void ObjectsManager::handleCityMap() { _vm->_eventsManager.changeMouseCursor(4); _vm->_graphicsManager._noFadingFl = false; - bool v1 = false; + bool loopCond = false; do { int mouseButton = _vm->_eventsManager.getMouseButton(); if (mouseButton) { @@ -1865,8 +1865,8 @@ void ObjectsManager::handleCityMap() { _vm->_eventsManager.VBL(); if (_vm->_globals._exitId) - v1 = true; - } while (!_vm->shouldQuit() && !v1); + loopCond = true; + } while (!_vm->shouldQuit() && !loopCond); if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.fadeOutLong(); @@ -1959,7 +1959,16 @@ void ObjectsManager::handleLeftButton() { int16 *oldRoute = _vm->_linesManager._route; _vm->_linesManager._route = (int16 *)g_PTRNUL; if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { - if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { + if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) { + _vm->_linesManager._route = (int16 *)g_PTRNUL; + setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); + _vm->_globals._actionDirection = 0; + _vm->_linesManager._route = (int16 *)g_PTRNUL; + computeAndSetSpriteSize(); + setFlipSprite(0, false); + _vm->_globals.Compteur = 0; + _vm->_globals._oldDirection = -1; + } else { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); if (_vm->_linesManager._route != (int16 *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); @@ -1968,22 +1977,12 @@ void ObjectsManager::handleLeftButton() { _vm->_globals.Compteur = 0; if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) { _vm->_globals._oldDirection = -1; - goto LABEL_65; + } else { + _vm->_linesManager._route = oldRoute; } - goto LABEL_63; } - _vm->_linesManager._route = (int16 *)g_PTRNUL; - setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); - _vm->_globals._actionDirection = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; - computeAndSetSpriteSize(); - setFlipSprite(0, false); - _vm->_globals.Compteur = 0; - _vm->_globals._oldDirection = -1; - goto LABEL_65; - } - if (!_vm->_globals.NOMARCHE) { - if (!_vm->_globals._cityMapEnabledFl) { + } else { + if (!_vm->_globals.NOMARCHE && !_vm->_globals._cityMapEnabledFl) { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); if (_vm->_linesManager._route != (int16 *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); @@ -1993,13 +1992,13 @@ void ObjectsManager::handleLeftButton() { if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) _vm->_globals._oldDirection = -1; else -LABEL_63: _vm->_linesManager._route = oldRoute; } -LABEL_65: - if (!_vm->_globals.NOMARCHE && _vm->_globals._cityMapEnabledFl) - _vm->_linesManager._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } + + if (!_vm->_globals.NOMARCHE && _vm->_globals._cityMapEnabledFl) + _vm->_linesManager._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); + if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) _vm->_globals._saveData->_data[svField1] = 5; @@ -2595,8 +2594,7 @@ void ObjectsManager::takeInventoryObject(int idx) { void ObjectsManager::OPTI_OBJET() { byte *data; Common::String file; - int v0 = 1; - int v5; + int lastOpcodeResult = 1; file = "OBJET1.ini"; data = _vm->_fileManager.searchCat(file, 1); @@ -2610,21 +2608,21 @@ void ObjectsManager::OPTI_OBJET() { error("File %s is not an INI file", file.c_str()); for (;;) { - v5 = _vm->_scriptManager.handleOpcode(data + 20 * v0); + int opcodeType = _vm->_scriptManager.handleOpcode(data + 20 * lastOpcodeResult); if (_vm->shouldQuit()) return; - if (v5 == 2) - v0 = _vm->_scriptManager.handleGoto(data + 20 * v0); - else if (v5 == 3) - v0 = _vm->_scriptManager.handleIf(data, v0); + if (opcodeType == 2) + lastOpcodeResult = _vm->_scriptManager.handleGoto(data + 20 * lastOpcodeResult); + else if (opcodeType == 3) + lastOpcodeResult = _vm->_scriptManager.handleIf(data, lastOpcodeResult); - if (v0 == -1) + if (lastOpcodeResult == -1) error("defective IFF function"); - if (v5 == 1 || v5 == 4) - ++v0; - if (!v5 || v5 == 5) + if (opcodeType == 1 || opcodeType == 4) + ++lastOpcodeResult; + if (!opcodeType || opcodeType == 5) break; } -- cgit v1.2.3 From 205fdaaa0c8a3592018035ab4f25153e30d0b4d0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 08:02:18 +0100 Subject: HOPKINS: Remove a useless variable in LinesManager, some renaming --- engines/hopkins/lines.cpp | 88 ++++++++++++++++----------------------------- engines/hopkins/lines.h | 3 +- engines/hopkins/objects.cpp | 49 ++++++++++--------------- 3 files changed, 51 insertions(+), 89 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 5b6631c77f..ad82bb264e 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -84,8 +84,7 @@ void LinesManager::loadLines(const Common::String &file) { (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4), - 1); + (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4)); } initRoute(); _vm->_globals.freeMemory(ptr); @@ -207,61 +206,38 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ /** * Add Line */ -void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7) { - int v7; - int v8; - int v9; - byte *v10; - int v11; - int v12; - int v13; - int v24; - int v25; - int16 *v27; - int v30; - int v31; - int16 *v32; - int v33; - int v34; - int v35; - int v36; - int v37; - int v38; - int v39; - int v40; - +void LinesManager::addLine(int idx, int direction, int a3, int a4, int a5, int a6) { assert (idx <= MAX_LINES); if (_linesNumb < idx) _linesNumb = idx; Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); - v7 = abs(a3 - a5); - v8 = v7 + 1; - v9 = abs(a4 - a6); - v34 = v9 + 1; - v33 = v9 + 1; + int v7 = abs(a3 - a5); + int v8 = v7 + 1; + int v9 = abs(a4 - a6); + int v34 = v9 + 1; + int v33 = v9 + 1; if (v8 > v34) v34 = v8; - v10 = _vm->_globals.allocMemory(4 * v34 + 8); + byte *v10 = _vm->_globals.allocMemory(4 * v34 + 8); assert (v10 != g_PTRNUL); Common::fill(v10, v10 + 4 * v34 + 8, 0); Ligne[idx]._lineData = (int16 *)v10; - v32 = Ligne[idx]._lineData; - v36 = 1000 * v8; - v39 = 1000 * v8 / (v34 - 1); - v37 = 1000 * v33 / (v34 - 1); + int16 *v32 = Ligne[idx]._lineData; + int v36 = 1000 * v8; + int v39 = 1000 * v8 / (v34 - 1); + int v37 = 1000 * v33 / (v34 - 1); if (a5 < a3) v39 = -v39; if (a6 < a4) v37 = -v37; - v11 = (int)v39 / 1000; - v12 = (int)v37 / 1000; - v13 = (int)v37 / 1000; - if (!((int)v39 / 1000)) { + int v11 = (int)v39 / 1000; + int v12 = (int)v37 / 1000; + if (!v11) { if (v12 == -1) { Ligne[idx].field6 = 1; Ligne[idx].field8 = 5; @@ -276,25 +252,25 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int Ligne[idx].field6 = 2; Ligne[idx].field8 = 6; } - if (!v13) { + if (!v12) { Ligne[idx].field6 = 3; Ligne[idx].field8 = 7; } - if (v13 == 1) { + if (v12 == 1) { Ligne[idx].field6 = 4; Ligne[idx].field8 = 8; } } if (v11 == -1) { - if (v13 == 1) { + if (v12 == 1) { Ligne[idx].field6 = 6; Ligne[idx].field8 = 2; } - if (!v13) { + if (!v12) { Ligne[idx].field6 = 7; Ligne[idx].field8 = 3; } - if (v13 == -1) { + if (v12 == -1) { Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; } @@ -318,17 +294,17 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int Ligne[idx].field6 = 8; Ligne[idx].field8 = 4; } - v40 = v36 / v34; - v38 = 1000 * v33 / v34; + int v40 = v36 / v34; + int v38 = 1000 * v33 / v34; if (a5 < a3) v40 = -v40; if (a6 < a4) v38 = -v38; - v24 = 1000 * a3; - v25 = 1000 * a4; - v31 = 1000 * a3 / 1000; - v30 = 1000 * a4 / 1000; - v35 = v34 - 1; + int v24 = 1000 * a3; + int v25 = 1000 * a4; + int v31 = 1000 * a3 / 1000; + int v30 = 1000 * a4 / 1000; + int v35 = v34 - 1; for (int v26 = 0; v26 < v35; v26++) { v32[0] = v31; v32[1] = v30; @@ -342,13 +318,12 @@ void LinesManager::addLine(int idx, int a2, int a3, int a4, int a5, int a6, int v32[0] = a5; v32[1] = a6; - v27 = v32 + 2; - v27[0] = -1; - v27[1] = -1; + v32 += 2; + v32[0] = -1; + v32[1] = -1; Ligne[idx]._lineDataEndIdx = v35 + 1; - Ligne[idx].field2 = a7; - Ligne[idx]._direction = a2; + Ligne[idx]._direction = direction; ++_linesNumb; } @@ -3158,7 +3133,6 @@ void LinesManager::clearAll() { for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; - _vm->_linesManager.Ligne[idx].field2 = 0; _vm->_linesManager.Ligne[idx]._direction = 0; _vm->_linesManager.Ligne[idx].field6 = 0; _vm->_linesManager.Ligne[idx].field8 = 0; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 69efd922d1..066c8aeaa7 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -38,7 +38,6 @@ struct LigneZoneItem { struct LigneItem { int _lineDataEndIdx; - int field2; // Useless variable int _direction; int field6; int field8; @@ -124,7 +123,7 @@ public: int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); void clearAllZones(); void resetLines(); - void addLine(int idx, int a2, int a3, int a4, int a5, int a6, int a7); + void addLine(int idx, int direction, int a3, int a4, int a5, int a6); void initRoute(); int MZONE(); void CARRE_ZONE(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 83062023e3..e9db707e98 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3121,16 +3121,7 @@ int ObjectsManager::getBobFrameIndex(int idx) { } void ObjectsManager::INILINK(const Common::String &file) { - int v8; - int v9; - int v10; - byte *v22; - int16 v27; - int16 v28; - int v36; - byte *v37; Common::File f; - Common::String filename = file + ".LNK"; byte *ptr = _vm->_fileManager.searchCat(filename, 3); size_t nbytes = _vm->_globals._catalogSize; @@ -3161,31 +3152,28 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile("RES_SLI.RES"); } - v36 = 60; - v37 = ptr + 1000; + int curDataCacheId = 60; + byte *curDataPtr = ptr + 1000; for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) { - v8 = (int16)READ_LE_UINT16(v37 + 2 * v36); - v9 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 2); - v10 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 4); - - _vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(v37 + 2 * v36 + 8); - _vm->_globals.Cache[cacheIdx]._spriteIndex = v8; - _vm->_globals.Cache[cacheIdx]._x = v9; - _vm->_globals.Cache[cacheIdx]._y = v10; + int curSpriteId = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId); + _vm->_globals.Cache[cacheIdx]._spriteIndex = curSpriteId; + _vm->_globals.Cache[cacheIdx]._x = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 2); + _vm->_globals.Cache[cacheIdx]._y = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 4); + _vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 8); if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[cacheIdx]._useCount = 0; } else { _vm->_globals.Cache[cacheIdx]._spriteData = _vm->_globals.CACHE_BANQUE[1]; - _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], v8); - _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], v8); + _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], curSpriteId); + _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], curSpriteId); _vm->_globals.Cache[cacheIdx]._useCount = 1; } if (!_vm->_globals.Cache[cacheIdx]._x && !_vm->_globals.Cache[cacheIdx]._y && !_vm->_globals.Cache[cacheIdx]._spriteIndex) _vm->_globals.Cache[cacheIdx]._useCount = 0; - v36 += 5; + curDataCacheId += 5; } _vm->_globals.CACHE_ON(); } @@ -3198,21 +3186,21 @@ void ObjectsManager::INILINK(const Common::String &file) { int lineDataIdx = 0; int curLineIdx = 0; _vm->_linesManager.resetLinesNumb(); + int curDirection; do { - v27 = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); - if (v27 != -1) { + curDirection = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); + if (curDirection != -1) { _vm->_linesManager.addLine( curLineIdx, - v27, + curDirection, (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 2), (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 4), (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 6), - (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8), - 1); + (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8)); } lineDataIdx += 5; ++curLineIdx; - } while (v27 != -1); + } while (curDirection != -1); _vm->_linesManager.initRoute(); } } @@ -3240,6 +3228,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } int curLineIdx = 0; + int v28; do { v28 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); if (v28 != -1) { @@ -3262,7 +3251,7 @@ void ObjectsManager::INILINK(const Common::String &file) { curDataIdx += 3; } - v22 = ptr + idx + (10 * curLineIdx + 606) + 4; + byte *v22 = ptr + idx + (10 * curLineIdx + 606) + 4; for (int i = 1; i <= 100; i++) { int j = (i - 1) * 10; _vm->_globals.ZONEP[i].field6 = v22[j]; @@ -3531,7 +3520,6 @@ void ObjectsManager::enableVerb(int idx, int a2) { } void ObjectsManager::ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl) { - int idx = 0; Common::String tmpStr = ""; int realSpeed = speed; if (_vm->_globals._speed == 2) @@ -3545,6 +3533,7 @@ void ObjectsManager::ACTION(const byte *spriteData, const Common::String &action _sprite[0].field14 += a4; _sprite[0]._flipFl = flipFl; + int idx = 0; for (int strPos = 0; ; strPos++) { bool tokenCompleteFl = false; char curChar = actionStr[strPos]; -- cgit v1.2.3 From 880f00150c250903eb3bfb206abee0ab215d3d52 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 08:18:19 +0100 Subject: HOPKINS: Fix regression in #fddc6497bf316e6e44b258b1c7fd9adc0749bd72 : "Menu: after the fading, a button is moved by 1 or 2 pixels" --- engines/hopkins/menu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 3368afa6c3..33369a47ec 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -118,8 +118,11 @@ int MenuManager::menu() { if (menuIndex > MENU_NONE) frameIndex[menuIndex - 1] = 1; - for (int i = 0; i < 5; i++) - _vm->_graphicsManager.fastDisplay(spriteData, 230, 259 + 32 * i, frameIndex[i] + 2 * i); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 259, frameIndex[0]); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 291, frameIndex[1] + 2); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 322, frameIndex[2] + 4); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 354, frameIndex[3] + 6); + _vm->_graphicsManager.fastDisplay(spriteData, 230, 386, frameIndex[4] + 8); _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton() == 1 && menuIndex != MENU_NONE) -- cgit v1.2.3 From 7d40d1e2e31d602f0db016040340cc55ff73f0b5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 19:59:23 +0100 Subject: HOPKINS: Remove two labels and their associated GOTOs from EventsManager --- engines/hopkins/events.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 31b972cdc3..ead8ff0a33 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -380,27 +380,34 @@ void EventsManager::VBL() { } _vm->_globals._speed = 2; + bool externalLoopFl = false; do { while (!_vm->shouldQuit()) { checkForNextFrameCounter(); + bool innerLoopFl = false; while (_breakoutFl || _vm->_globals.iRegul != 1) { checkForNextFrameCounter(); - if (!_breakoutFl) - goto LABEL_63; - if (_rateCounter > 1) - goto LABEL_65; + if (!_breakoutFl) { + innerLoopFl = true; + break; + } + if (_rateCounter > 1) { + externalLoopFl = true; + break; + } } - if (_vm->_globals._speed != 2) + if (innerLoopFl || _vm->_globals._speed != 2) break; - if (_rateCounter > 9) - goto LABEL_65; + if (externalLoopFl ||_rateCounter > 9) { + externalLoopFl = true; + break; + } } -LABEL_63: - ; + if (externalLoopFl) + break; } while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && _rateCounter <= 15); -LABEL_65: _vm->_globals._speed = 2; _rateCounter = 0; if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager._scrollStatus == 1) { -- cgit v1.2.3 From 2e47d8fe7a1978078b2ccd54982401bb3add9f13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 21:44:32 +0100 Subject: HOPKINS: Renaming in ScriptManager and DialogManager --- engines/hopkins/script.cpp | 67 +++++++++++++++++++++++----------------------- engines/hopkins/talk.cpp | 26 +++++++++--------- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index a4d768023a..cf4f296fff 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2429,42 +2429,41 @@ int ScriptManager::handleGoto(const byte *dataP) { } int ScriptManager::handleIf(const byte *dataP, int a2) { - int v2; - int v3; - int v4; - int v6; - bool v7; int v20; - - v2 = a2; -LABEL_2: - v3 = v2; - do { - if (_vm->shouldQuit()) - return 0; // Exiting game - - ++v3; - v4 = checkOpcode(dataP + 20 * v3); - if (v3 > 400) - error("Control if failed"); - } while (v4 != 4); // EIF - v20 = v3; - v6 = v2; - v7 = false; + int v2 = a2; + bool loopFl; do { - if (_vm->shouldQuit()) - return 0; // Exiting game - - ++v6; - if (checkOpcode(dataP + 20 * v6) == 3) // IIF - v7 = true; - if (v6 > 400) - error("Control if failed "); - if (v7) { - v2 = v20; - goto LABEL_2; - } - } while (v20 != v6); + loopFl = false; + int v3 = v2; + int opcodeType; + do { + if (_vm->shouldQuit()) + return 0; // Exiting game + + ++v3; + opcodeType = checkOpcode(dataP + 20 * v3); + if (v3 > 400) + error("Control if failed"); + } while (opcodeType != 4); // EIF + v20 = v3; + int v6 = v2; + bool v7 = false; + do { + if (_vm->shouldQuit()) + return 0; // Exiting game + + ++v6; + if (checkOpcode(dataP + 20 * v6) == 3) // IIF + v7 = true; + if (v6 > 400) + error("Control if failed "); + if (v7) { + v2 = v20; + loopFl = true; + break; + } + } while (v20 != v6); + } while (loopFl); const byte *buf = dataP + 20 * a2; byte oper = buf[13]; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 29679fe547..12ad4d85f0 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -770,10 +770,10 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, void TalkManager::REPONSE(int zone, int verb) { uint16 v7; byte *v8; - int v10; + int opcodeType; uint16 v11; int v12; - int v13; + int lastOpcodeResult; bool tagFound; bool v16; bool loopCond; @@ -836,29 +836,29 @@ LABEL_2: v7 = 0; } while (!loopCond); loopCond = false; - v13 = 1; + lastOpcodeResult = 1; do { - v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13); + opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult); if (_vm->shouldQuit()) return; - if (v10 == 2) + if (opcodeType == 2) // GOTO - v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); - else if (v10 == 3) + lastOpcodeResult = _vm->_scriptManager.handleGoto(ptr + 20 * lastOpcodeResult); + else if (opcodeType == 3) // IF - v13 = _vm->_scriptManager.handleIf(ptr, v13); + lastOpcodeResult = _vm->_scriptManager.handleIf(ptr, lastOpcodeResult); - if (v13 == -1) + if (lastOpcodeResult == -1) error("Invalid IFF function"); - if (v10 == 1 || v10 == 4) + if (opcodeType == 1 || opcodeType == 4) // Already handled opcode or END IF - ++v13; - else if (!v10 || v10 == 5) + ++lastOpcodeResult; + else if (!opcodeType || opcodeType == 5) // EXIT loopCond = true; - else if (v10 == 6) { + else if (opcodeType == 6) { // JUMP _vm->_globals.freeMemory(ptr); zoneObj = _vm->_objectsManager._jumpZone; -- cgit v1.2.3 From f35c410493e5af0751955fb8fbfefe4a44fe2f71 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 21:59:13 +0100 Subject: HOPKINS: Remove the last GOTO from TalkManager --- engines/hopkins/talk.cpp | 169 ++++++++++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 82 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 12ad4d85f0..fea3bcc235 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -776,96 +776,101 @@ void TalkManager::REPONSE(int zone, int verb) { int lastOpcodeResult; bool tagFound; bool v16; - bool loopCond; + bool innerLoopCond; byte *ptr; byte zoneObj = zone; byte verbObj = verb; -LABEL_2: - tagFound = false; - if (_vm->_globals._answerBuffer == g_PTRNUL) - return; - - byte *curAnswerBuf = _vm->_globals._answerBuffer; - for (;;) { - if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('F', 'I', 'N')) - return; - if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('C', 'O', 'D')) { - if (curAnswerBuf[3] == zoneObj && curAnswerBuf[4] == verbObj) - tagFound = true; - } - if (!tagFound) - curAnswerBuf++; - else - break; - } - - // 'COD' tag found - curAnswerBuf += 5; - ptr = _vm->_globals.allocMemory(620); - assert(ptr != g_PTRNUL); - memset(ptr, 0, 620); - v7 = 0; - v12 = 0; - loopCond = false; - do { - v16 = false; - if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'C')) { - ++v12; - assert(v12 < (620 / 20)); - - v8 = (ptr + 20 * v12); - v11 = 0; - do { - assert(v11 < 20); - v8[v11++] = curAnswerBuf[v7++]; - if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'F')) { - v16 = true; - v8[v11] = 'F'; - v8[v11 + 1] = 'F'; - ++v7; - } - } while (!v16); - } - if (!v16) { - uint32 signature24 = READ_BE_UINT24(&curAnswerBuf[v7]); - if (signature24 == MKTAG24('C', 'O', 'D') || signature24 == MKTAG24('F', 'I', 'N')) - loopCond = true; - } - curAnswerBuf += v7 + 1; - v7 = 0; - } while (!loopCond); - loopCond = false; - lastOpcodeResult = 1; + + bool outerLoopFl; do { - opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult); - if (_vm->shouldQuit()) + outerLoopFl = false; + tagFound = false; + if (_vm->_globals._answerBuffer == g_PTRNUL) return; - if (opcodeType == 2) - // GOTO - lastOpcodeResult = _vm->_scriptManager.handleGoto(ptr + 20 * lastOpcodeResult); - else if (opcodeType == 3) - // IF - lastOpcodeResult = _vm->_scriptManager.handleIf(ptr, lastOpcodeResult); - - if (lastOpcodeResult == -1) - error("Invalid IFF function"); - - if (opcodeType == 1 || opcodeType == 4) - // Already handled opcode or END IF - ++lastOpcodeResult; - else if (!opcodeType || opcodeType == 5) - // EXIT - loopCond = true; - else if (opcodeType == 6) { - // JUMP - _vm->_globals.freeMemory(ptr); - zoneObj = _vm->_objectsManager._jumpZone; - verbObj = _vm->_objectsManager._jumpVerb; - goto LABEL_2; + byte *curAnswerBuf = _vm->_globals._answerBuffer; + for (;;) { + if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('F', 'I', 'N')) + return; + if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('C', 'O', 'D')) { + if (curAnswerBuf[3] == zoneObj && curAnswerBuf[4] == verbObj) + tagFound = true; + } + if (!tagFound) + curAnswerBuf++; + else + break; } - } while (!loopCond); + + // 'COD' tag found + curAnswerBuf += 5; + ptr = _vm->_globals.allocMemory(620); + assert(ptr != g_PTRNUL); + memset(ptr, 0, 620); + v7 = 0; + v12 = 0; + innerLoopCond = false; + do { + v16 = false; + if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'C')) { + ++v12; + assert(v12 < (620 / 20)); + + v8 = (ptr + 20 * v12); + v11 = 0; + do { + assert(v11 < 20); + v8[v11++] = curAnswerBuf[v7++]; + if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'F')) { + v16 = true; + v8[v11] = 'F'; + v8[v11 + 1] = 'F'; + ++v7; + } + } while (!v16); + } + if (!v16) { + uint32 signature24 = READ_BE_UINT24(&curAnswerBuf[v7]); + if (signature24 == MKTAG24('C', 'O', 'D') || signature24 == MKTAG24('F', 'I', 'N')) + innerLoopCond = true; + } + curAnswerBuf += v7 + 1; + v7 = 0; + } while (!innerLoopCond); + innerLoopCond = false; + lastOpcodeResult = 1; + do { + opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult); + if (_vm->shouldQuit()) + return; + + if (opcodeType == 2) + // GOTO + lastOpcodeResult = _vm->_scriptManager.handleGoto(ptr + 20 * lastOpcodeResult); + else if (opcodeType == 3) + // IF + lastOpcodeResult = _vm->_scriptManager.handleIf(ptr, lastOpcodeResult); + + if (lastOpcodeResult == -1) + error("Invalid IFF function"); + + if (opcodeType == 1 || opcodeType == 4) + // Already handled opcode or END IF + ++lastOpcodeResult; + else if (!opcodeType || opcodeType == 5) + // EXIT + innerLoopCond = true; + else if (opcodeType == 6) { + // JUMP + _vm->_globals.freeMemory(ptr); + zoneObj = _vm->_objectsManager._jumpZone; + verbObj = _vm->_objectsManager._jumpVerb; + outerLoopFl = true; + break; + } + } while (!innerLoopCond); + } while (outerLoopFl); _vm->_globals.freeMemory(ptr); _vm->_globals._saveData->_data[svField2] = 0; return; -- cgit v1.2.3 From b05ca628e8c06a743116041b4acd6a3c026b9ad5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 22:13:41 +0100 Subject: HOPKINS: Get rid if the last GOTO in DialogManager --- engines/hopkins/dialogs.cpp | 229 ++++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 112 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0dd697d05a..e1a8e16811 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -323,126 +323,131 @@ void DialogsManager::showInventory() { } _vm->_dialogsManager._inventWin1 = g_PTRNUL; -LABEL_7: - _vm->_eventsManager._curMouseButton = 0; - _vm->_eventsManager._mouseButton = 0; - _vm->_globals._disableInventFl = true; - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - - Common::String filename; - if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) - filename = "INVENT.SPR"; - else { - switch (_vm->_globals._language) { - case LANG_EN: - filename = "INVENTAN.SPR"; - break; - case LANG_FR: - filename = "INVENTFR.SPR"; - break; - case LANG_SP: - filename = "INVENTES.SPR"; - break; - } - } - - Common::File f; - if (!f.open(filename)) - error("Error opening file - %s", filename.c_str()); - - size_t filesize = f.size(); - _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); - _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); - f.close(); - - _inventBuf2 = _vm->_fileManager.loadFile("INVENT2.SPR"); - - _inventX = _vm->_graphicsManager._scrollOffset + 152; - _inventY = 114; - _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); - _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); - - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false); - int curPosY = 0; - int inventCount = 0; - for (int inventLine = 1; inventLine <= 5; inventLine++) { - int curPosX = 0; - for (int inventCol = 1; inventCol <= 6; inventCol++) { - ++inventCount; - int inventIdx = _vm->_globals._inventory[inventCount]; - // The last two zones are not reserved for the inventory: Options and Save/Load - if (inventIdx && inventCount <= 29) { - byte *obj = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6, - curPosY + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); - _vm->_globals.freeMemory(obj); - } - curPosX += 54; - }; - curPosY += 38; - } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); - _vm->_eventsManager._curMouseButton = 0; - int newInventoryItem = 0; - - // Main loop to select an inventory item - while (!_vm->shouldQuit()) { - // Turn on drawing the inventory dialog in the event manager - _inventDisplayedFl = true; - - int mousePosX = _vm->_eventsManager.getMouseX(); - int mousePosY = _vm->_eventsManager.getMouseY(); - int mouseButton = _vm->_eventsManager.getMouseButton(); - int oldInventoryItem = newInventoryItem; - newInventoryItem = _vm->_linesManager.checkInventoryHotspots(mousePosX, mousePosY); - if (newInventoryItem != oldInventoryItem) - _vm->_objectsManager.initBorder(newInventoryItem); - if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { - if (mouseButton == 2) { - _vm->_objectsManager.nextObjectIcon(newInventoryItem); - if (_vm->_eventsManager._mouseCursorId != 23) - _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); - } - } - if (mouseButton == 1) { - if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId) + bool loopFl; + do { + loopFl = false; + _vm->_eventsManager._curMouseButton = 0; + _vm->_eventsManager._mouseButton = 0; + _vm->_globals._disableInventFl = true; + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + + Common::String filename; + if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) + filename = "INVENT.SPR"; + else { + switch (_vm->_globals._language) { + case LANG_EN: + filename = "INVENTAN.SPR"; break; - _vm->_objectsManager.takeInventoryObject(_vm->_globals._inventory[newInventoryItem]); - if (_vm->_eventsManager._mouseCursorId == 8) + case LANG_FR: + filename = "INVENTFR.SPR"; break; + case LANG_SP: + filename = "INVENTES.SPR"; + break; + } + } - _vm->_scriptManager.TRAVAILOBJET = true; - _vm->_globals._saveData->_data[svField3] = _vm->_objectsManager._curObjectIndex; - _vm->_globals._saveData->_data[svField8] = _vm->_globals._inventory[newInventoryItem]; - _vm->_globals._saveData->_data[svField9] = _vm->_eventsManager._mouseCursorId; - _vm->_objectsManager.OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = false; - - if (_vm->_soundManager._voiceOffFl) { - do - _vm->_eventsManager.VBL(); - while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); - _vm->_fontManager.hideText(9); + Common::File f; + if (!f.open(filename)) + error("Error opening file - %s", filename.c_str()); + + size_t filesize = f.size(); + _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); + _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); + f.close(); + + _inventBuf2 = _vm->_fileManager.loadFile("INVENT2.SPR"); + + _inventX = _vm->_graphicsManager._scrollOffset + 152; + _inventY = 114; + _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); + _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); + + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false); + int curPosY = 0; + int inventCount = 0; + for (int inventLine = 1; inventLine <= 5; inventLine++) { + int curPosX = 0; + for (int inventCol = 1; inventCol <= 6; inventCol++) { + ++inventCount; + int inventIdx = _vm->_globals._inventory[inventCount]; + // The last two zones are not reserved for the inventory: Options and Save/Load + if (inventIdx && inventCount <= 29) { + byte *obj = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6, + curPosY + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); + _vm->_globals.freeMemory(obj); + } + curPosX += 54; + }; + curPosY += 38; + } + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); + _vm->_eventsManager._curMouseButton = 0; + int newInventoryItem = 0; + + // Main loop to select an inventory item + while (!_vm->shouldQuit()) { + // Turn on drawing the inventory dialog in the event manager + _inventDisplayedFl = true; + + int mousePosX = _vm->_eventsManager.getMouseX(); + int mousePosY = _vm->_eventsManager.getMouseY(); + int mouseButton = _vm->_eventsManager.getMouseButton(); + int oldInventoryItem = newInventoryItem; + newInventoryItem = _vm->_linesManager.checkInventoryHotspots(mousePosX, mousePosY); + if (newInventoryItem != oldInventoryItem) + _vm->_objectsManager.initBorder(newInventoryItem); + if (_vm->_eventsManager._mouseCursorId != 1 && _vm->_eventsManager._mouseCursorId != 2 && _vm->_eventsManager._mouseCursorId != 3 && _vm->_eventsManager._mouseCursorId != 16) { + if (mouseButton == 2) { + _vm->_objectsManager.nextObjectIcon(newInventoryItem); + if (_vm->_eventsManager._mouseCursorId != 23) + _vm->_eventsManager.changeMouseCursor(_vm->_eventsManager._mouseCursorId); + } } - if (_vm->_globals._exitId) { - if (_vm->_globals._exitId == 2) { - _vm->_globals._exitId = 0; + if (mouseButton == 1) { + if (_vm->_eventsManager._mouseCursorId == 1 || _vm->_eventsManager._mouseCursorId == 2 || _vm->_eventsManager._mouseCursorId == 3 || _vm->_eventsManager._mouseCursorId == 16 || !_vm->_eventsManager._mouseCursorId) break; + _vm->_objectsManager.takeInventoryObject(_vm->_globals._inventory[newInventoryItem]); + if (_vm->_eventsManager._mouseCursorId == 8) + break; + + _vm->_scriptManager.TRAVAILOBJET = true; + _vm->_globals._saveData->_data[svField3] = _vm->_objectsManager._curObjectIndex; + _vm->_globals._saveData->_data[svField8] = _vm->_globals._inventory[newInventoryItem]; + _vm->_globals._saveData->_data[svField9] = _vm->_eventsManager._mouseCursorId; + _vm->_objectsManager.OPTI_OBJET(); + _vm->_scriptManager.TRAVAILOBJET = false; + + if (_vm->_soundManager._voiceOffFl) { + do + _vm->_eventsManager.VBL(); + while (!_vm->_globals._exitId && _vm->_eventsManager.getMouseButton() != 1); + _vm->_fontManager.hideText(9); } + if (_vm->_globals._exitId) { + if (_vm->_globals._exitId == 2) { + _vm->_globals._exitId = 0; + break; + } - _vm->_globals._exitId = 0; - _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); - _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); - goto LABEL_7; - } else - _inventDisplayedFl = true; + _vm->_globals._exitId = 0; + _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); + _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + loopFl = true; + break; + } else + _inventDisplayedFl = true; + } + if (_removeInventFl) + break; + _vm->_eventsManager.VBL(); + if (_vm->_globals._screenId >= 35 && _vm->_globals._screenId <= 40) + _vm->_objectsManager.handleSpecialGames(); } - if (_removeInventFl) - break; - _vm->_eventsManager.VBL(); - if (_vm->_globals._screenId >= 35 && _vm->_globals._screenId <= 40) - _vm->_objectsManager.handleSpecialGames(); - } + } while (loopFl); + _vm->_fontManager.hideText(9); if (_inventDisplayedFl) { _inventDisplayedFl = false; -- cgit v1.2.3 From 9eb289d4800c87c87d51c2b0f447e09a8b984bff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Feb 2013 23:50:59 +0100 Subject: HOPKINS: Start refactoring GENIAL. Remove three labels and the associated GOTOs --- engines/hopkins/lines.cpp | 410 +++++++++++++++++++++++----------------------- 1 file changed, 202 insertions(+), 208 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index ad82bb264e..eff980d7b8 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -869,6 +869,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a int v92 = lineIdx; int v65; + bool loopCond = false; for (;;) { int v86 = v92 - 1; int v11 = 2 * Ligne[v92 - 1]._lineDataEndIdx; @@ -884,19 +885,23 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a if (v12 != (int16 *)g_PTRNUL) continue; } - goto LABEL_11; + loopCond = true; + break; } + if (loopCond) + break; v92 = v86; v98 = v12[0]; v97 = v12[1]; } -LABEL_11: + int16 *v13 = Ligne[lineIdx]._lineData; int v95 = v13[2 * Ligne[lineIdx]._lineDataEndIdx - 2]; int v93 = v13[2 * Ligne[lineIdx]._lineDataEndIdx - 1]; int v91 = lineIdx; int foundLineIdx, foundDataIdx; + loopCond = false; for (;;) { int v87 = v91 + 1; int v15 = 2 * Ligne[v91 + 1]._lineDataEndIdx; @@ -917,13 +922,17 @@ LABEL_11: if (v16 != (int16 *)g_PTRNUL) continue; } - goto LABEL_17; + loopCond = true; + break; } + if (loopCond) + break; + v91 = v87; v95 = v17; v93 = v16[v65 - 1]; } -LABEL_17: + int v58 = abs(a3 - a5) + 1; int v85 = abs(a4 - a6) + 1; int v20 = v85; @@ -1392,238 +1401,223 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } int v55 = PARC_PERS(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); - if (v55 != 1) { - if (v55 == 2) { -LABEL_201: - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - } else { - if (v113 == 1) { - for (int deltaY = 0; deltaY < v111; deltaY++) { - if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &super_parcours[0], 4); - if (v58 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; - return &super_parcours[0]; - } - v112 = v58; - if (NVPY != -1) - deltaY = fromY - NVPY; + + if (v55 == 1) + return &super_parcours[0]; + + if (v55 == 2) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + } else { + if (v113 == 1) { + for (int deltaY = 0; deltaY < v111; deltaY++) { + if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { + int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &super_parcours[0], 4); + if (v58 == -1) { + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } - super_parcours[v112] = fromX; - super_parcours[v112 + 1] = fromY - deltaY; - super_parcours[v112 + 2] = 1; - super_parcours[v112 + 3] = 0; - v112 += 4; + v112 = v58; + if (NVPY != -1) + deltaY = fromY - NVPY; } + super_parcours[v112] = fromX; + super_parcours[v112 + 1] = fromY - deltaY; + super_parcours[v112 + 2] = 1; + super_parcours[v112 + 3] = 0; + v112 += 4; } - if (v113 == 5) { - for (int deltaY = 0; deltaY < v111; deltaY++) { - if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) - && _lastLine < foundLineIdx) { - int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &super_parcours[0], 4); - if (v61 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; - return &super_parcours[0]; - } - v112 = v61; - if (NVPY != -1) - deltaY = NVPY - fromY; + } + if (v113 == 5) { + for (int deltaY = 0; deltaY < v111; deltaY++) { + if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) + && _lastLine < foundLineIdx) { + int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &super_parcours[0], 4); + if (v61 == -1) { + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } - super_parcours[v112] = fromX; - super_parcours[v112 + 1] = deltaY + fromY; - super_parcours[v112 + 2] = 5; - super_parcours[v112 + 3] = 0; - v112 += 4; + v112 = v61; + if (NVPY != -1) + deltaY = NVPY - fromY; } + super_parcours[v112] = fromX; + super_parcours[v112 + 1] = deltaY + fromY; + super_parcours[v112 + 2] = 5; + super_parcours[v112 + 3] = 0; + v112 += 4; } - if (v113 == 7) { - for (int deltaX = 0; deltaX < v111; deltaX++) { - if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0], 4); - if (v64 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; - return &super_parcours[0]; - } - v112 = v64; - if (NVPX != -1) - deltaX = fromX - NVPX; + } + if (v113 == 7) { + for (int deltaX = 0; deltaX < v111; deltaX++) { + if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { + int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0], 4); + if (v64 == -1) { + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } - super_parcours[v112] = fromX - deltaX; - super_parcours[v112 + 1] = fromY; - super_parcours[v112 + 2] = 7; - super_parcours[v112 + 3] = 0; - v112 += 4; + v112 = v64; + if (NVPX != -1) + deltaX = fromX - NVPX; } + super_parcours[v112] = fromX - deltaX; + super_parcours[v112 + 1] = fromY; + super_parcours[v112 + 2] = 7; + super_parcours[v112 + 3] = 0; + v112 += 4; } - if (v113 == 3) { - for (int deltaX = 0; deltaX < v111; deltaX++) { - if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0], 4); - if (v67 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; - return &super_parcours[0]; - } - v112 = v67; - if (NVPX != -1) - deltaX = NVPX - fromX; + } + if (v113 == 3) { + for (int deltaX = 0; deltaX < v111; deltaX++) { + if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { + int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0], 4); + if (v67 == -1) { + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; + return &super_parcours[0]; } - super_parcours[v112] = deltaX + fromX; - super_parcours[v112 + 1] = fromY; - super_parcours[v112 + 2] = 3; - super_parcours[v112 + 3] = 0; - v112 += 4; + v112 = v67; + if (NVPX != -1) + deltaX = NVPX - fromX; } + super_parcours[v112] = deltaX + fromX; + super_parcours[v112 + 1] = fromY; + super_parcours[v112 + 2] = 3; + super_parcours[v112 + 3] = 0; + v112 += 4; } } + } LABEL_234: - if (v115 < v121) { - for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { - v119 = Ligne[v115]._lineData[2 * i]; - v118 = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112] = Ligne[v115]._lineData[2 * i]; - super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112 + 2] = Ligne[v115].field6; + if (v115 < v121) { + for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { + v119 = Ligne[v115]._lineData[2 * i]; + v118 = Ligne[v115]._lineData[2 * i + 1]; + super_parcours[v112] = Ligne[v115]._lineData[2 * i]; + super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; + super_parcours[v112 + 2] = Ligne[v115].field6; + super_parcours[v112 + 3] = 0; + v112 += 4; + } + for (int v116 = v115 + 1; v116 < v121; v116++) { + int v72 = 0; + int v110 = v116; + for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { + v119 = Ligne[v110]._lineData[2 * v72]; + v118 = Ligne[v110]._lineData[2 * v72 + 1]; + super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; + super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; + super_parcours[v112 + 2] = Ligne[v110].field6; super_parcours[v112 + 3] = 0; v112 += 4; - } - for (int v116 = v115 + 1; v116 < v121; v116++) { - int v72 = 0; - int v110 = v116; - for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { - v119 = Ligne[v110]._lineData[2 * v72]; - v118 = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; - super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112 + 2] = Ligne[v110].field6; - super_parcours[v112 + 3] = 0; - v112 += 4; - if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { - int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); - if (v78 == 1) - return &super_parcours[0]; - if (v78 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v110, v121, v112)) - goto LABEL_201; + if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { + int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); + if (v78 == 1) + return &super_parcours[0]; + if (v78 == 2 || MIRACLE(v119, v118, v110, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } - ++v72; - v110 = v116; } - int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); - if (v79 == 1) - return &super_parcours[0]; - if (v79 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v116, v121, v112)) - goto LABEL_201; + ++v72; + v110 = v116; + } + int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); + if (v79 == 1) + return &super_parcours[0]; + if (v79 == 2 || MIRACLE(v119, v118, v116, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } - v114 = 0; - v115 = v121; } - if (v115 > v121) { - for (int dataIdx = v114; dataIdx > 0; dataIdx--) { - v119 = Ligne[v115]._lineData[2 * dataIdx]; - v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; - - super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v115].field8; + v114 = 0; + v115 = v121; + } + if (v115 > v121) { + for (int dataIdx = v114; dataIdx > 0; dataIdx--) { + v119 = Ligne[v115]._lineData[2 * dataIdx]; + v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; + + super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v115].field8; + super_parcours[v112 + 3] = 0; + v112 += 4; + } + for (int v117 = v115 - 1; v117 > v121; v117--) { + for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { + v119 = Ligne[v117]._lineData[2 * dataIdx]; + v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; + super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v117].field8; super_parcours[v112 + 3] = 0; v112 += 4; - } - for (int v117 = v115 - 1; v117 > v121; v117--) { - for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { - v119 = Ligne[v117]._lineData[2 * dataIdx]; - v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v117].field8; - super_parcours[v112 + 3] = 0; - v112 += 4; - if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { - int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v88 == 1) - return &super_parcours[0]; - if (v88 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v117, v121, v112)) - goto LABEL_201; + if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { + int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v88 == 1) + return &super_parcours[0]; + if (v88 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } } - int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v89 == 1) - return &super_parcours[0]; - if (v89 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; - } - if (MIRACLE(v119, v118, v117, v121, v112)) - goto LABEL_201; } - v114 = Ligne[v121]._lineDataEndIdx - 1; - v115 = v121; - } - if (v115 == v121) { - if (v114 <= v120) { - for (int dataIdx = v114; dataIdx < v120; dataIdx++) { - super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v121].field6; - super_parcours[v112 + 3] = 0; - v112 += 4; - } - } else { - for (int dataIdx = v114; dataIdx > v120; dataIdx--) { - super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v121].field8; - super_parcours[v112 + 3] = 0; - v112 += 4; - } + int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v89 == 1) + return &super_parcours[0]; + if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + goto LABEL_234; } } - if (PARC_PERS( - super_parcours[v112 - 4], - super_parcours[v112 - 3], - clipDestX, - clipDestY, - -1, - -1, - v112) != 1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; + v114 = Ligne[v121]._lineDataEndIdx - 1; + v115 = v121; + } + if (v115 == v121) { + if (v114 <= v120) { + for (int dataIdx = v114; dataIdx < v120; dataIdx++) { + super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v121].field6; + super_parcours[v112 + 3] = 0; + v112 += 4; + } + } else { + for (int dataIdx = v114; dataIdx > v120; dataIdx--) { + super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v121].field8; + super_parcours[v112 + 3] = 0; + v112 += 4; + } } - return &super_parcours[0]; + } + if (PARC_PERS(super_parcours[v112 - 4], super_parcours[v112 - 3], clipDestX, clipDestY, -1, -1, v112) != 1) { + super_parcours[v112] = -1; + super_parcours[v112 + 1] = -1; + super_parcours[v112 + 2] = -1; + super_parcours[v112 + 3] = -1; } return &super_parcours[0]; -- cgit v1.2.3 From d7c8fe9122af3e7b2b338d7d61ce8fd1e5b34880 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 00:23:17 +0100 Subject: HOPKINS: Remove several GOTOs in PARCOURS2 --- engines/hopkins/lines.cpp | 176 ++++++++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 77 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index eff980d7b8..b9407f904f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1500,100 +1500,122 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } } } -LABEL_234: - if (v115 < v121) { - for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { - v119 = Ligne[v115]._lineData[2 * i]; - v118 = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112] = Ligne[v115]._lineData[2 * i]; - super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112 + 2] = Ligne[v115].field6; - super_parcours[v112 + 3] = 0; - v112 += 4; - } - for (int v116 = v115 + 1; v116 < v121; v116++) { - int v72 = 0; - int v110 = v116; - for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { - v119 = Ligne[v110]._lineData[2 * v72]; - v118 = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; - super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112 + 2] = Ligne[v110].field6; + + + bool loopCond; + do { + loopCond = false; + if (v115 < v121) { + for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { + v119 = Ligne[v115]._lineData[2 * i]; + v118 = Ligne[v115]._lineData[2 * i + 1]; + super_parcours[v112] = Ligne[v115]._lineData[2 * i]; + super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; + super_parcours[v112 + 2] = Ligne[v115].field6; super_parcours[v112 + 3] = 0; v112 += 4; - if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { - int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); - if (v78 == 1) - return &super_parcours[0]; - if (v78 == 2 || MIRACLE(v119, v118, v110, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; + } + for (int v116 = v115 + 1; v116 < v121; v116++) { + int v72 = 0; + int v110 = v116; + for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { + v119 = Ligne[v110]._lineData[2 * v72]; + v118 = Ligne[v110]._lineData[2 * v72 + 1]; + super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; + super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; + super_parcours[v112 + 2] = Ligne[v110].field6; + super_parcours[v112 + 3] = 0; + v112 += 4; + if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { + int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); + if (v78 == 1) + return &super_parcours[0]; + if (v78 == 2 || MIRACLE(v119, v118, v110, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + loopCond = true; + break; + } } + ++v72; + v110 = v116; + } + + if (loopCond) + break; + + int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); + if (v79 == 1) + return &super_parcours[0]; + if (v79 == 2 || MIRACLE(v119, v118, v116, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + loopCond = true; + break; } - ++v72; - v110 = v116; - } - int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); - if (v79 == 1) - return &super_parcours[0]; - if (v79 == 2 || MIRACLE(v119, v118, v116, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; } + if (loopCond) + continue; + + v114 = 0; + v115 = v121; } - v114 = 0; - v115 = v121; - } - if (v115 > v121) { - for (int dataIdx = v114; dataIdx > 0; dataIdx--) { - v119 = Ligne[v115]._lineData[2 * dataIdx]; - v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; - - super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v115].field8; - super_parcours[v112 + 3] = 0; - v112 += 4; - } - for (int v117 = v115 - 1; v117 > v121; v117--) { - for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { - v119 = Ligne[v117]._lineData[2 * dataIdx]; - v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v117].field8; + if (v115 > v121) { + for (int dataIdx = v114; dataIdx > 0; dataIdx--) { + v119 = Ligne[v115]._lineData[2 * dataIdx]; + v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; + + super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v115].field8; super_parcours[v112 + 3] = 0; v112 += 4; - if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { - int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v88 == 1) + } + for (int v117 = v115 - 1; v117 > v121; v117--) { + for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { + v119 = Ligne[v117]._lineData[2 * dataIdx]; + v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; + super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; + super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; + super_parcours[v112 + 2] = Ligne[v117].field8; + super_parcours[v112 + 3] = 0; + v112 += 4; + if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { + int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v88 == 1) + return &super_parcours[0]; + if (v88 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + loopCond = true; + break; + } + } + } + if (!loopCond) { + int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v89 == 1) return &super_parcours[0]; - if (v88 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { + if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { v115 = NV_LIGNEDEP; v114 = NV_LIGNEOFS; v112 = NV_POSI; - goto LABEL_234; + loopCond = true; + break; } } } - int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v89 == 1) - return &super_parcours[0]; - if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - goto LABEL_234; + + if (!loopCond) { + v114 = Ligne[v121]._lineDataEndIdx - 1; + v115 = v121; } } - v114 = Ligne[v121]._lineDataEndIdx - 1; - v115 = v121; - } + } while (loopCond); + if (v115 == v121) { if (v114 <= v120) { for (int dataIdx = v114; dataIdx < v120; dataIdx++) { -- cgit v1.2.3 From 901c4fabd8db897b779a24262df75187daaeee3c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 07:57:16 +0100 Subject: HOPKINS: Remove GOTOs in cityMapCarRoute --- engines/hopkins/lines.cpp | 142 ++++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 69 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index b9407f904f..32190d896f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2463,87 +2463,91 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { v68 = 1; superRouteIdx = 0; } -LABEL_90: - if (v69 < v73) { - int v34 = v68; - for (int i = Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = Ligne[v69]._lineDataEndIdx) { - super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * v34]; - super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * v34 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v69].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - ++v34; - } - for (int j = v69 + 1; j < v73; ++j) { - if (PLAN_TEST( - Ligne[j]._lineData[0], - Ligne[j]._lineData[1], - superRouteIdx, j, v73)) { + bool loopFl = true; + while (loopFl) { + loopFl = false; + if (v69 < v73) { + int v34 = v68; + for (int i = Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = Ligne[v69]._lineDataEndIdx) { + super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * v34]; + super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * v34 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v69].field6; + super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + ++v34; + } + for (int j = v69 + 1; j < v73; ++j) { + if (PLAN_TEST(Ligne[j]._lineData[0], Ligne[j]._lineData[1], superRouteIdx, j, v73)) { v69 = NV_LIGNEDEP; v68 = NV_LIGNEOFS; superRouteIdx = NV_POSI; - goto LABEL_90; - } - if (Ligne[j]._lineDataEndIdx - 2 > 0) { - for (int v40 = 0; v40 < Ligne[j]._lineDataEndIdx - 2; v40++) { - super_parcours[superRouteIdx] = Ligne[j]._lineData[2 * v40]; - super_parcours[superRouteIdx + 1] = Ligne[j]._lineData[2 * v40 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[j].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + loopFl = true; + break; + } + if (Ligne[j]._lineDataEndIdx - 2 > 0) { + for (int v40 = 0; v40 < Ligne[j]._lineDataEndIdx - 2; v40++) { + super_parcours[superRouteIdx] = Ligne[j]._lineData[2 * v40]; + super_parcours[superRouteIdx + 1] = Ligne[j]._lineData[2 * v40 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[j].field6; + super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } } } + if (loopFl) + continue; + v68 = 0; + v69 = v73; } - v68 = 0; - v69 = v73; - } - if (v69 > v73) { - for (int k = v68; k > 0; --k) { - super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * k]; - super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * k + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v69].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - for (int l = v69 - 1; l > v73; --l) { - int v48 = l; - if (PLAN_TEST( - Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 2], - Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 1], - superRouteIdx, l, v73)) { + if (v69 > v73) { + for (int k = v68; k > 0; --k) { + super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * k]; + super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * k + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v69].field8; + super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + for (int l = v69 - 1; l > v73; --l) { + int v48 = l; + if (PLAN_TEST(Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 2], Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { v69 = NV_LIGNEDEP; v68 = NV_LIGNEOFS; superRouteIdx = NV_POSI; - goto LABEL_90; - } + loopFl = true; + break; + } - for (int v49 = Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { - super_parcours[superRouteIdx] = Ligne[l]._lineData[2 * v49]; - super_parcours[superRouteIdx + 1] = Ligne[l]._lineData[2 * v49 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[l].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + for (int v49 = Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { + super_parcours[superRouteIdx] = Ligne[l]._lineData[2 * v49]; + super_parcours[superRouteIdx + 1] = Ligne[l]._lineData[2 * v49 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[l].field8; + super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } } + if (loopFl) + continue; + + v68 = Ligne[v73]._lineDataEndIdx - 1; + v69 = v73; } - v68 = Ligne[v73]._lineDataEndIdx - 1; - v69 = v73; - } - if (v69 == v73) { - if (v68 <= v72) { - for (int v57 = v68; v57 < v72; v57++) { - super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v57]; - super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v57 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v73].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; - } - } else { - for (int v53 = v68; v53 > v72; v53--) { - super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v53]; - super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v53 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v73].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + if (v69 == v73) { + if (v68 <= v72) { + for (int v57 = v68; v57 < v72; v57++) { + super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v57]; + super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v57 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v73].field6; + super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } + } else { + for (int v53 = v68; v53 > v72; v53--) { + super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v53]; + super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v53 + 1]; + super_parcours[superRouteIdx + 2] = Ligne[v73].field8; + super_parcours[superRouteIdx + 3] = 0; + superRouteIdx += 4; + } } } } -- cgit v1.2.3 From e96edd8b19835102bcfd44190e1d6733d3322abe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 08:44:22 +0100 Subject: HOPKINS: Misc refactoring and renaming, remove some dead code --- engines/hopkins/events.cpp | 18 ++--- engines/hopkins/globals.cpp | 5 +- engines/hopkins/globals.h | 12 +--- engines/hopkins/graphics.cpp | 91 ++++++++++--------------- engines/hopkins/graphics.h | 153 ++++++++++++++++++++++--------------------- engines/hopkins/hopkins.cpp | 2 +- engines/hopkins/script.cpp | 2 +- 7 files changed, 122 insertions(+), 161 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index ead8ff0a33..a52371368e 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -313,8 +313,8 @@ int EventsManager::waitKeyPress() { } void EventsManager::VBL() { - signed int v11 = 0; - signed int v12 = 0; + int bottom = 0; + int right = 0; int height = 0; int width = 0; int xp = 0; @@ -355,12 +355,12 @@ void EventsManager::VBL() { if (yp + _mouseSizeY >= mouseHeight + _vm->_graphicsManager._maxY) height = _vm->_graphicsManager._maxY - mouseHeight - yp; } - v12 = width + xp; - v11 = yp + height; + right = xp + width; + bottom = yp + height; } } - if (!_vm->_globals.PUBEXIT) + if (!_vm->_globals._linuxEndDemoFl) _vm->_objectsManager.displaySprite(); if (!_mouseFl) { updateCursor(); @@ -376,7 +376,7 @@ void EventsManager::VBL() { } } else if (yp < _vm->_graphicsManager._maxY && xp < _vm->_graphicsManager._maxX && width > 1 && height > 1) { _vm->_eventsManager.updateCursor(); - _vm->_graphicsManager.addVesaSegment(xp, yp, v12, v11); + _vm->_graphicsManager.addVesaSegment(xp, yp, right, bottom); } _vm->_globals._speed = 2; @@ -432,12 +432,8 @@ void EventsManager::VBL() { _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); - for (int i = 1; i < _vm->_globals.NBBLOC + 1; i++) { - if (_vm->_globals.BLOC[i]._activeFl) - _vm->_globals.BLOC[i]._activeFl = false; - } + _vm->_graphicsManager.RESET_SEGMENT_VESA(); - _vm->_globals.NBBLOC = 0; _startPos.x = _vm->_graphicsManager._scrollPosX; _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager._scrollPosX; _vm->_graphicsManager._scrollPosX = _vm->_graphicsManager._scrollPosX; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2c2cfac80e..e9229c4d59 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -86,8 +86,6 @@ Globals::Globals() { } for (int i = 0; i < 300; ++i) Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0); - for (int i = 0; i < 250; ++i) - Common::fill((byte *)&BLOC[i], (byte *)&BLOC[i] + sizeof(BlocItem), 0); for (int i = 0; i < 25; ++i) Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0); @@ -108,7 +106,7 @@ Globals::Globals() { // Initialize fields _language = LANG_EN; - PUBEXIT = false; + _linuxEndDemoFl = false; _speed = 1; _oldFrameIndex = 0; _oldDirection = 0; @@ -131,7 +129,6 @@ Globals::Globals() { _screenId = 0; _prevScreenId = 0; _characterMaxPosY = 0; - NBBLOC = 0; _menuScrollType = 0; _menuScrollSpeed = 0; _menuSpeed = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 4cc2f245be..033d40f935 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -127,14 +127,6 @@ struct ObjetWItem { byte field7; }; -struct BlocItem { - uint16 _activeFl; - int _x1; - int _y1; - int _x2; - int _y2; -}; - /** * Mode for SortItem records */ @@ -289,7 +281,6 @@ public: LockAnimItem _lockedAnims[30]; VBobItem VBob[30]; ObjetWItem ObjetW[300]; - BlocItem BLOC[250]; CacheItem Cache[25]; int BOBZONE[105]; bool BOBZONE_FLAG[105]; @@ -298,7 +289,7 @@ public: int _inventory[36]; SortItem _sortedDisplay[51]; Language _language; - bool PUBEXIT; + bool _linuxEndDemoFl; int PERSO_TYPE; uint _speed; Common::String FICH_ZONE; @@ -338,7 +329,6 @@ public: int _characterMaxPosY; bool _disableInventFl; bool NOMARCHE; - int NBBLOC; byte *_optionDialogSpr; bool _optionDialogFl; int _menuDisplayType; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 63bcbf20c8..03d79e376e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -45,6 +45,7 @@ GraphicsManager::GraphicsManager() { _scrollPosX = 0; _largeScreenFl = false; _oldScrollPosX = 0; + NBBLOC = 0; _lineNbr2 = 0; Agr_x = Agr_y = 0; @@ -63,12 +64,16 @@ GraphicsManager::GraphicsManager() { Red_x = Red_y = 0; Red = 0; _width = 0; - spec_largeur = 0; + _specialWidth = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&_colorTable[0], &_colorTable[PALETTE_EXT_BLOCK_SIZE], 0); Common::fill(&_palette[0], &_palette[PALETTE_EXT_BLOCK_SIZE], 0); Common::fill(&_oldPalette[0], &_oldPalette[PALETTE_EXT_BLOCK_SIZE], 0); + + for (int i = 0; i < 250; ++i) + Common::fill((byte *)&BLOC[i], (byte *)&BLOC[i] + sizeof(BlocItem), 0); + } GraphicsManager::~GraphicsManager() { @@ -923,6 +928,14 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int } while (rowCount2 != 1); } +/** + * Draws a sprite onto the screen + * @param surface Destination surface + * @param spriteData The raw data for a sprite set + * @param xp X co-ordinate. For some reason, starts from 300 = first column + * @param yp Y co-ordinate. FOr some reason, starts from 300 = top row + * @param spriteIndex Index of the sprite to draw + */ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex) { // Get a pointer to the start of the desired sprite const byte *spriteP = spriteData + 3; @@ -1080,12 +1093,10 @@ void GraphicsManager::VISU_ALL() { } void GraphicsManager::RESET_SEGMENT_VESA() { - if (_vm->_globals.NBBLOC > 0) { - for (int idx = 0; idx != _vm->_globals.NBBLOC; idx++) - _vm->_globals.BLOC[idx]._activeFl = false; + for (int idx = 0; idx <= NBBLOC; idx++) + BLOC[idx]._activeFl = false; - _vm->_globals.NBBLOC = 0; - } + NBBLOC = 0; } // Add VESA Segment @@ -1104,19 +1115,15 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { if (y1 < _minY) y1 = _minY; - if (_vm->_globals.NBBLOC > 1) { - int16 blocIndex = 0; - do { - BlocItem &bloc = _vm->_globals.BLOC[blocIndex]; - if (bloc._activeFl && tempX >= bloc._x1 && x2 <= bloc._x2 && y1 >= bloc._y1 && y2 <= bloc._y2) - addFlag = false; - ++blocIndex; - } while (_vm->_globals.NBBLOC + 1 != blocIndex); - } + for (int blocIndex = 0; blocIndex <= NBBLOC; blocIndex++) { + BlocItem &bloc = BLOC[blocIndex]; + if (bloc._activeFl && tempX >= bloc._x1 && x2 <= bloc._x2 && y1 >= bloc._y1 && y2 <= bloc._y2) + addFlag = false; + }; if (addFlag) { - assert(_vm->_globals.NBBLOC < 250); - BlocItem &bloc = _vm->_globals.BLOC[++_vm->_globals.NBBLOC]; + assert(NBBLOC < 250); + BlocItem &bloc = BLOC[++NBBLOC]; bloc._activeFl = true; bloc._x1 = tempX; @@ -1128,13 +1135,13 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { // Display VESA Segment void GraphicsManager::displayVesaSegment() { - if (_vm->_globals.NBBLOC == 0) + if (NBBLOC == 0) return; lockScreen(); - for (int idx = 1; idx <= _vm->_globals.NBBLOC; ++idx) { - BlocItem &bloc = _vm->_globals.BLOC[idx]; + for (int idx = 1; idx <= NBBLOC; ++idx) { + BlocItem &bloc = BLOC[idx]; Common::Rect &dstRect = dstrect[idx - 1]; if (!bloc._activeFl) continue; @@ -1163,10 +1170,10 @@ void GraphicsManager::displayVesaSegment() { unlockScreen(); } - _vm->_globals.BLOC[idx]._activeFl = false; + BLOC[idx]._activeFl = false; } - _vm->_globals.NBBLOC = 0; + NBBLOC = 0; unlockScreen(); } @@ -1516,7 +1523,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp _width = spriteWidth; if (flipFl) { byte *dest2P = spriteWidth + dest1P; - spec_largeur = spriteWidth; + _specialWidth = spriteWidth; if (_posYClipped) { if (_posYClipped >= spriteHeight1 || spriteHeight1 < 0) return; @@ -1548,12 +1555,12 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++spritePixelsP; --dest2P; } - spritePixelsP = spec_largeur + spritePixelsCopy2P; + spritePixelsP = _specialWidth + spritePixelsCopy2P; dest2P = _lineNbr2 + destCopy2P; spriteHeight1 = yCtr2 - 1; } while (yCtr2 != 1); } else { - spec_largeur = spriteWidth; + _specialWidth = spriteWidth; if (_posYClipped) { if (_posYClipped >= spriteHeight1 || spriteHeight1 < 0) return; @@ -1583,7 +1590,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp ++dest1P; ++spritePixelsP; } - spritePixelsP = spec_largeur + spritePixelsCopyP; + spritePixelsP = _specialWidth + spritePixelsCopyP; dest1P = _lineNbr2 + dest1CopyP; spriteHeight1 = yCtr1 - 1; } while (yCtr1 != 1); @@ -1805,38 +1812,6 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { } } -void GraphicsManager::Copy_Video_Vbe(const byte *src) { - assert(_videoPtr); - int destOffset = 0; - const byte *srcP = src; - for (;;) { - byte byteVal = *srcP; - if (*srcP < kByteStop) - break; - else { - if (byteVal == kByteStop) - return; - if (byteVal == k8bVal) { - destOffset += srcP[1]; - byteVal = srcP[2]; - srcP += 2; - } else if (byteVal == k16bVal) { - destOffset += READ_LE_UINT16(srcP + 1); - byteVal = srcP[3]; - srcP += 3; - } else { - destOffset += READ_LE_UINT32(srcP + 1); - byteVal = srcP[5]; - srcP += 5; - } - } - - *((byte *)_videoPtr->pixels + destOffset) = byteVal; - ++srcP; - ++destOffset; - } -} - // Reduce Screen void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) { const byte *srcP = xp + _lineNbr2 * yp + srcSurface; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index e5feaddad5..af06e8ce88 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -45,131 +45,134 @@ struct RGB8 { byte b; }; +struct BlocItem { + uint16 _activeFl; + int _x1; + int _y1; + int _x2; + int _y2; +}; + class HopkinsEngine; class GraphicsManager { private: HopkinsEngine *_vm; - void loadScreen(const Common::String &file); -public: int _lockCounter; bool _initGraphicsFl; int _screenWidth; int _screenHeight; - int WinScan; + Graphics::Surface *_videoPtr; + int _width; + int _posXClipped, _posYClipped; + bool _clipFl; + int _specialWidth; + byte SD_PIXELS[PALETTE_SIZE * 2]; - byte *PAL_PIXELS; + int Agr_x, Agr_y; + bool Agr_Flag_x, Agr_Flag_y; + int clip_x1, clip_y1; + int Red_x, Red_y; + int Red; + + void loadScreen(const Common::String &file); + void loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void loadPCX320(byte *surface, const Common::String &file, byte *palette); + void fadeIn(const byte *palette, int step, const byte *surface); + void fadeOut(const byte *palette, int step, const byte *surface); + void changePalette(const byte *palette); + uint16 mapRGB(byte r, byte g, byte b); + + void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); + void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); + void copy16bFromSurfaceScaleX2(const byte *surface); +public: int _lineNbr; byte _colorTable[PALETTE_EXT_BLOCK_SIZE]; byte _palette[PALETTE_EXT_BLOCK_SIZE]; byte _oldPalette[PALETTE_EXT_BLOCK_SIZE]; - Graphics::Surface *_videoPtr; byte *_vesaScreen; byte *_vesaBuffer; int _scrollOffset; int _scrollPosX; bool _largeScreenFl; int _oldScrollPosX; - bool MANU_SCROLL; int _scrollSpeed; int _lineNbr2; - int Agr_x, Agr_y; - bool Agr_Flag_x, Agr_Flag_y; - int _fadeDefaultSpeed; - int FADE_LINUX; - bool _skipVideoLockFl; - int _scrollStatus; - Common::Rect dstrect[50]; int _minX, _minY; int _maxX, _maxY; - int _posXClipped, _posYClipped; - int clip_x1, clip_y1; - bool _clipFl; - int Red_x, Red_y; - int Red; - int _width; - int spec_largeur; bool _noFadingFl; + Common::Rect dstrect[50]; + int _scrollStatus; + bool _skipVideoLockFl; + int _fadeDefaultSpeed; + + int NBBLOC; + BlocItem BLOC[250]; + int WinScan; + byte *PAL_PIXELS; + bool MANU_SCROLL; + int FADE_LINUX; public: GraphicsManager(); ~GraphicsManager(); - void setParent(HopkinsEngine *vm); - void setGraphicalMode(int width, int height); + void setParent(HopkinsEngine *vm); void lockScreen(); void unlockScreen(); + void clearPalette(); void clearScreen(); void loadImage(const Common::String &file); void loadVgaImage(const Common::String &file); - void initColorTable(int minIndex, int maxIndex, byte *palette); - void scrollScreen(int amount); - void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); - void Trans_bloc2(byte *surface, byte *col, int size); - void loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag); - void loadPCX320(byte *surface, const Common::String &file, byte *palette); - void clearPalette(); - void SCANLINE(int pitch); - void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); - void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); - void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); - void fadeIn(const byte *palette, int step, const byte *surface); - void fadeOut(const byte *palette, int step, const byte *surface); - void fadeInShort(); - void fadeOutShort(); void fadeInLong(); - void fadeOutLong(); - void fadeOutDefaultLength(const byte *surface); - void fadeInDefaultLength(const byte *surface); void fadeInBreakout(); + void fadeInDefaultLength(const byte *surface); + void fadeInShort(); + void fadeOutDefaultLength(const byte *surface); void fateOutBreakout(); + void fadeOutLong(); + void fadeOutShort(); + void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); + void displayVesaSegment(); + void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); + void drawHorizontalLine(byte *surface, int xp, int yp, uint16 width, byte col); + void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); + void initColorTable(int minIndex, int maxIndex, byte *palette); + void setGraphicalMode(int width, int height); void setPaletteVGA256(const byte *palette); void setPaletteVGA256WithRefresh(const byte *palette, const byte *surface); + void scrollScreen(int amount); + int zoomIn(int v, int percentage); + int zoomOut(int v, int percentage); + + void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); + void addVesaSegment(int x1, int y1, int x2, int y2); + void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); - void changePalette(const byte *palette); - uint16 mapRGB(byte r, byte g, byte b); + void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true); + void RESET_SEGMENT_VESA(); void DD_VBL(); - void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); - void Copy_Video_Vbe16(const byte *srcData); - void Copy_Video_Vbe16a(const byte *srcData); void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height); - - /** - * Draws a sprite onto the screen - * @param surface Destination surface - * @param spriteData The raw data for a sprite set - * @param xp X co-ordinate. For some reason, starts from 300 = first column - * @param yp Y co-ordinate. FOr some reason, starts from 300 = top row - * @param spriteIndex Index of the sprite to draw - */ - void Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex); - - void FIN_VISU(); - void VISU_ALL(); - void RESET_SEGMENT_VESA(); - void addVesaSegment(int x1, int y1, int x2, int y2); - void displayVesaSegment(); - void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true); - void CopyAsm(const byte *surface); - void copy16bFromSurfaceScaleX2(const byte *surface); - void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); - int zoomIn(int v, int percentage); - int zoomOut(int v, int percentage); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl); - void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); - void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY); - void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); + void SCANLINE(int pitch); + void Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex); + void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); + void Trans_bloc2(byte *surface, byte *col, int size); + void VISU_ALL(); + void FIN_VISU(); void INI_ECRAN(const Common::String &file, bool initializeScreen); void INI_ECRAN2(const Common::String &file, bool initializeScreen); - void OPTI_INI(const Common::String &file, int mode, bool initializeScreen); void NB_SCREEN(bool initPalette); - void Copy_WinScan_Vbe(const byte *srcP, byte *destP); - void Copy_Video_Vbe(const byte *src); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); - void drawHorizontalLine(byte *surface, int xp, int yp, uint16 width, byte col); - void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); + void OPTI_INI(const Common::String &file, int mode, bool initializeScreen); + void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); + void Copy_WinScan_Vbe(const byte *srcP, byte *destP); + void Copy_Video_Vbe16(const byte *srcData); + void Copy_Video_Vbe16a(const byte *srcData); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4e0698a4c4..1b8187a5cf 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1954,7 +1954,7 @@ void HopkinsEngine::restoreSystem() { } void HopkinsEngine::endLinuxDemo() { - _globals.PUBEXIT = true; + _globals._linuxEndDemoFl = true; _graphicsManager.RESET_SEGMENT_VESA(); _globals._forestFl = false; _eventsManager._breakoutFl = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index cf4f296fff..c25aacc414 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2328,7 +2328,7 @@ int ScriptManager::handleOpcode(byte *dataP) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); _vm->_animationManager.playAnim2("PLAN.ANM", 50, 10, 800); } - _vm->_globals.NBBLOC = 0; + _vm->_graphicsManager.NBBLOC = 0; break; case 608: -- cgit v1.2.3 From 0f25a607493406d9f6be6b2c7a4bad5fb874886e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 18:12:32 +0100 Subject: HOPKINS: Improve private/public scope in FontMAnager --- engines/hopkins/computer.h | 1 + engines/hopkins/font.h | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index 41ed902a2a..b46fdd16b0 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -100,6 +100,7 @@ private: public: ComputerManager(); void setParent(HopkinsEngine *vm); + void showComputer(ComputerEnum mode); }; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 3a81361de1..0d31324421 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -59,29 +59,31 @@ struct TxtItemList { class FontManager { private: HopkinsEngine *_vm; -public: - TxtItem _text[12]; - TxtItemList _textList[12]; + + void setTextColor(int idx, byte colByte); + void displayText(int xp, int yp, const Common::String &message, int col); + int _textSortArray[21]; Common::String _oldName; Common::String _indexName; int _index[4048]; byte *_tempText; + public: + TxtItem _text[12]; + TxtItemList _textList[12]; + FontManager(); void setParent(HopkinsEngine *vm); - void clearAll(); + void clearAll(); void showText(int idx); void hideText(int idx); - void setTextColor(int idx, byte colByte); - void setOptimalColor(int idx1, int idx2, int idx3, int idx4); void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color); - void box(int idx, int messageId, const Common::String &filename, int xp, int yp); - void displayTextVesa(int xp, int yp, const Common::String &message, int col); - void displayText(int xp, int yp, const Common::String &message, int col); void renderTextDisplay(int xp, int yp, const Common::String &msg, int col); + void setOptimalColor(int idx1, int idx2, int idx3, int idx4); + void box(int idx, int messageId, const Common::String &filename, int xp, int yp); }; } // End of namespace Hopkins -- cgit v1.2.3 From dd9474593fdba0b0308cbd4e0a0afb093fb994e5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 18:37:13 +0100 Subject: HOPKINS: Improve private/public scope in DialogsManager --- engines/hopkins/dialogs.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index 7608af2377..d0fd69250f 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -37,27 +37,27 @@ class HopkinsEngine; class DialogsManager { private: HopkinsEngine *_vm; + + void showSaveLoad(int a1); + int searchSavegames(); public: + byte *_inventWin1; + byte *_inventBuf2; + bool _removeInventFl; + bool _inventDisplayedFl; + bool _inventFl; int _inventX, _inventY; int _inventWidth, _inventHeight; - bool _inventFl; - bool _inventDisplayedFl; - bool _removeInventFl; - byte *_inventWin1; - byte *_inventBuf2; -public: DialogsManager(); ~DialogsManager(); void setParent(HopkinsEngine *vm); + void inventAnim(); + void showInventory(); void showLoadGame(); void showSaveGame(); - void showSaveLoad(int a1); void showOptionsDialog(); - void showInventory(); - int searchSavegames(); void testDialogOpening(); - void inventAnim(); }; } // End of namespace Hopkins -- cgit v1.2.3 From a542e38059dc3ba1a346131cddf210d64a88866e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 18:56:40 +0100 Subject: HOPKINS: Improve private/public scope in EventsManager --- engines/hopkins/events.h | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index d6517906ed..4ca66fb1f1 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -38,52 +38,55 @@ enum DIALOG_KEY { KEY_NONE = 0, KEY_INVENTORY = 1, KEY_OPTIONS = 2, KEY_SAVE = 3 class EventsManager { private: + int _oldIconId; + uint32 _priorCounterTime; + uint32 _priorFrameTime; + bool _keyState[256]; + HopkinsEngine *_vm; void pollEvents(); void handleKey(Common::Event &event); void checkForNextFrameCounter(); void updateCursor(); + public: + DIALOG_KEY _gameKey; + uint32 _rateCounter; + uint32 _gameCounter; + bool _escKeyFl; bool _mouseFl; bool _mouseLinuxFl; - int _mouseSizeX, _mouseSizeY; - Common::Point _mouseOffset; + bool _breakoutFl; Common::Point _startPos; Common::Point _mousePos; - bool _breakoutFl; - int _oldIconId; + Common::Point _mouseOffset; int _mouseSpriteId; int _curMouseButton; int _mouseButton; - byte *_mouseCursor; - uint32 _gameCounter; - uint32 _rateCounter; - uint32 _priorCounterTime; - uint32 _priorFrameTime; - bool _escKeyFl; - DIALOG_KEY _gameKey; int _mouseCursorId; + int _mouseSizeX, _mouseSizeY; byte *_objectBuf; - bool _keyState[256]; -public: + byte *_mouseCursor; + EventsManager(); ~EventsManager(); void setParent(HopkinsEngine *vm); - void setMouseOn(); - void setMouseXY(Common::Point pos); - void setMouseXY(int xp, int yp); + void delay(int totalMilli); + void changeMouseCursor(int id); + void refreshEvents(); + int waitKeyPress(); int getMouseX(); int getMouseY(); int getMouseButton(); + void setMouseXY(Common::Point pos); + void setMouseXY(int xp, int yp); void mouseOn(); void mouseOff(); - void changeMouseCursor(int id); - void refreshEvents(); - void delay(int totalMilli); - int waitKeyPress(); + void setMouseOn(); void VBL(); + }; } // End of namespace Hopkins -- cgit v1.2.3 From d12cd961610e3c2c8d060e2a300a5690dfb3daef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 21:56:10 +0100 Subject: HOPKINS: Improve private/public scope in Globals. Remove some useless variables, move some variables to FontManager --- engines/hopkins/computer.cpp | 32 ++++---- engines/hopkins/dialogs.cpp | 5 -- engines/hopkins/events.h | 1 - engines/hopkins/font.cpp | 39 ++++++---- engines/hopkins/font.h | 4 + engines/hopkins/globals.cpp | 7 -- engines/hopkins/globals.h | 181 +++++++++++++++++++++---------------------- engines/hopkins/hopkins.cpp | 12 +-- engines/hopkins/talk.cpp | 4 +- 9 files changed, 141 insertions(+), 144 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 04c81fe2b5..12ac40e6d8 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -77,15 +77,15 @@ void ComputerManager::setTextMode() { _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager._lineNbr = SCREEN_WIDTH; - _vm->_globals._font = _vm->_globals.freeMemory(_vm->_globals._font); + _vm->_fontManager._font = _vm->_globals.freeMemory(_vm->_fontManager._font); Common::String filename = "STFONT.SPR"; Common::File f; if (!f.exists(filename)) filename = "FONTE.SPR"; // Used by the BeOS and OS/2 versions as an alternative - _vm->_globals._font = _vm->_fileManager.loadFile(filename); - _vm->_globals._fontFixedWidth = 8; - _vm->_globals._fontFixedHeight = 8; + _vm->_fontManager._font = _vm->_fileManager.loadFile(filename); + _vm->_fontManager._fontFixedWidth = 8; + _vm->_fontManager._fontFixedHeight = 8; _vm->_graphicsManager.loadImage("WINTEXT"); _vm->_graphicsManager.fadeInLong(); @@ -421,28 +421,28 @@ void ComputerManager::displayMessage(int xp, int yp, int textIdx) { // BackSpace if (curChar == 8 && textIndex > 0) { _inputBuf[textIndex--] = 0; - x1 -= _vm->_globals._fontFixedWidth; - x2 = x1 + 2 * _vm->_globals._fontFixedWidth; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + x1 -= _vm->_fontManager._fontFixedWidth; + x2 = x1 + 2 * _vm->_fontManager._fontFixedWidth; + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, 3 * _vm->_fontManager._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); _vm->_graphicsManager.addVesaSegment(x1, yp, x2, yp + 12); _vm->_fontManager.displayTextVesa(x1, yp, "_", 252); } if (mappedChar != '*') { char newChar = mappedChar; - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_fontManager._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_fontManager._fontFixedWidth + x1, yp + 12); _inputBuf[textIndex] = newChar; Common::String charString = Common::String::format("%c_", newChar); _vm->_fontManager.displayTextVesa(x1, yp, charString, 252); ++textIndex; - x1 += _vm->_globals._fontFixedWidth; + x1 += _vm->_fontManager._fontFixedWidth; } _vm->_eventsManager.VBL(); } while (textIndex != textIdx && curChar != 13); - _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_globals._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); - _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_globals._fontFixedWidth + x1, yp + 12); + _vm->_graphicsManager.Copy_Mem(_vm->_graphicsManager._vesaScreen, x1, yp, _vm->_fontManager._fontFixedWidth, 12, _vm->_graphicsManager._vesaBuffer, x1, yp); + _vm->_graphicsManager.addVesaSegment(x1, yp, _vm->_fontManager._fontFixedWidth + x1, yp + 12); _vm->_eventsManager.VBL(); _inputBuf[textIndex] = 0; @@ -467,11 +467,11 @@ void ComputerManager::outText2(const Common::String &msg) { * Restores the scene for the FBI headquarters room */ void ComputerManager::restoreFBIRoom() { - _vm->_globals.freeMemory(_vm->_globals._font); - _vm->_globals._font = _vm->_fileManager.loadFile("FONTE3.SPR"); + _vm->_globals.freeMemory(_vm->_fontManager._font); + _vm->_fontManager._font = _vm->_fileManager.loadFile("FONTE3.SPR"); + _vm->_fontManager._fontFixedWidth = 12; + _vm->_fontManager._fontFixedHeight = 21; - _vm->_globals._fontFixedWidth = 12; - _vm->_globals._fontFixedHeight = 21; _vm->_eventsManager._mouseFl = true; } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e1a8e16811..690093f22b 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -238,11 +238,6 @@ void DialogsManager::showOptionsDialog() { doneFlag = true; } - if (_vm->_graphicsManager.MANU_SCROLL) - _vm->_globals._menuScrollType = 1; - else - _vm->_globals._menuScrollType = 2; - if (_vm->_globals._speed == 1) _vm->_globals._menuSpeed = 6; else if (_vm->_globals._speed == 2) diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 4ca66fb1f1..03f8593091 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -86,7 +86,6 @@ public: void setMouseOn(); void VBL(); - }; } // End of namespace Hopkins diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 59c37b27f8..b9ee2d886f 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -36,11 +36,19 @@ FontManager::FontManager() { clearAll(); } +FontManager::~FontManager() { + _vm->_globals.freeMemory(_font); +} + void FontManager::setParent(HopkinsEngine *vm) { _vm = vm; } void FontManager::clearAll() { + _font = g_PTRNUL; + _fontFixedHeight = 0; + _fontFixedWidth = 0; + for (int idx = 0; idx < 12; ++idx) { Common::fill((byte *)&_text[idx], (byte *)&_text[idx] + sizeof(TxtItem), 0); @@ -135,7 +143,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int v73 = xp; if (idx < 0) error("Bad number for text"); - _vm->_globals._fontFixedWidth = 11; + _fontFixedWidth = 11; _vm->_globals._boxWidth = 11 * _text[idx]._length; if (_text[idx]._textLoadedFl) { @@ -144,7 +152,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int yCurrent = yp + 5; for (int lineNum = 0; lineNum < _text[idx]._lineCount; ++lineNum) { displayText(xp + 5, yCurrent, _text[idx]._lines[lineNum], _text[idx]._color); - yCurrent += _vm->_globals._fontFixedHeight + 1; + yCurrent += _fontFixedHeight + 1; } } else { int height = _text[idx]._height; @@ -243,7 +251,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in byte v16 = _tempText[v15]; if (v16 <= 31) v16 = ' '; - _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_vm->_globals._font, v16 - 32); + _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_font, v16 - 32); } _vm->_globals._boxWidth += 2; @@ -271,7 +279,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in do curChar = _tempText[v65 + v19++]; while (curChar != ' ' && curChar != '%'); - if (v19 >= ptrb / _vm->_globals._fontFixedWidth) { + if (v19 >= ptrb / _fontFixedWidth) { if (curChar == '%') curChar = ' '; break; @@ -306,7 +314,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; if (v24 <= 32) v24 = ' '; - ptrc += _vm->_objectsManager.getWidth(_vm->_globals._font, (byte)v24 - 32); + ptrc += _vm->_objectsManager.getWidth(_font, (byte)v24 - 32); } _textSortArray[i] = ptrc; } @@ -344,7 +352,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int posX = v73; int posY = yp; int saveWidth = _vm->_globals._boxWidth + 10; - int saveHeight = (_vm->_globals._fontFixedHeight + 1) * lineCount + 12; + int saveHeight = (_fontFixedHeight + 1) * lineCount + 12; if (_text[idx]._textType == 6) { int v27 = saveWidth / 2; if (v27 < 0) @@ -378,7 +386,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in for (int lineNum = 0; lineNum < lineCount; ++lineNum) { displayText(v73 + 5, v71, _text[idx]._lines[lineNum], _text[idx]._color); - v71 += _vm->_globals._fontFixedHeight + 1; + v71 += _fontFixedHeight + 1; } int blockWidth = saveWidth + 1; @@ -418,9 +426,8 @@ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, break; if (currChar >= 32) { charIndex = currChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, - currentX, yp, currChar - 32, col); - currentX += _vm->_objectsManager.getWidth(_vm->_globals._font, charIndex); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _font, currentX, yp, currChar - 32, col); + currentX += _vm->_objectsManager.getWidth(_font, charIndex); } } @@ -436,8 +443,8 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int if (currentChar > 31) { int characterIndex = currentChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, xp, yp, characterIndex, col); - xp += _vm->_objectsManager.getWidth(_vm->_globals._font, characterIndex); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _font, xp, yp, characterIndex, col); + xp += _vm->_objectsManager.getWidth(_font, characterIndex); } } } @@ -463,7 +470,7 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i break; if (curChar >= 32) { byte printChar = curChar - 32; - _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals._font, charEndPosX, yp, printChar, fontCol); + _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _font, charEndPosX, yp, printChar, fontCol); // UGLY HACK: For some obscure reason, the BeOS and OS/2 versions use another font file, which doesn't have variable width. // All the fonts have a length of 9, which results in completely broken text in the computer. @@ -472,13 +479,13 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i int charWidth; if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { if ((curChar >= 'A' && curChar <= 'Z') || (curChar >= 'a' && curChar <= 'z' && curChar != 'm' && curChar != 'w') || (curChar >= '0' && curChar <= '9') || curChar == '*' || (curChar >= 128 && curChar <= 168)) - charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar) - 1; + charWidth = _vm->_objectsManager.getWidth(_font, printChar) - 1; else if (curChar == 'm' || curChar == 'w') - charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); + charWidth = _vm->_objectsManager.getWidth(_font, printChar); else charWidth = 6; } else - charWidth = _vm->_objectsManager.getWidth(_vm->_globals._font, printChar); + charWidth = _vm->_objectsManager.getWidth(_font, printChar); int charStartPosX = charEndPosX; charEndPosX += charWidth; diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 0d31324421..14aa4a7eae 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -70,10 +70,14 @@ private: byte *_tempText; public: + byte *_font; + int _fontFixedWidth; + int _fontFixedHeight; TxtItem _text[12]; TxtItemList _textList[12]; FontManager(); + ~FontManager(); void setParent(HopkinsEngine *vm); void clearAll(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e9229c4d59..e90748236a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -112,7 +112,6 @@ Globals::Globals() { _oldDirection = 0; _oldDirectionSpriteIdx = 59; _lastDirection = 0; - _fontFixedWidth = _fontFixedHeight = 0; TETE = NULL; NUM_FICHIER_OBJ = 0; nbrligne = 0; @@ -129,7 +128,6 @@ Globals::Globals() { _screenId = 0; _prevScreenId = 0; _characterMaxPosY = 0; - _menuScrollType = 0; _menuScrollSpeed = 0; _menuSpeed = 0; _menuSoundOff = 0; @@ -168,7 +166,6 @@ Globals::Globals() { _forestSprite = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; - _font = NULL; PERSO = NULL; _optionDialogSpr = NULL; @@ -200,7 +197,6 @@ Globals::Globals() { Globals::~Globals() { free(ICONE); freeMemory(TETE); - freeMemory(_font); freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); @@ -265,9 +261,6 @@ void Globals::clearAll() { nbrligne = 80; INIT_ANIM(); - _font = g_PTRNUL; - _fontFixedHeight = 0; - _fontFixedWidth = 0; _boxWidth = 0; _vm->_fontManager.clearAll(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 033d40f935..c2b9ec6e69 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -270,129 +270,128 @@ class HopkinsEngine; class Globals { private: HopkinsEngine *_vm; + + byte *_inventoryObject; + + void INIT_ANIM(); + void INIT_VBOB(); + void B_CACHE_OFF(int idx); + public: - byte *CACHE_BANQUE[6]; - ZonePItem ZONEP[106]; - BqeAnimItem Bqe_Anim[35]; - BankItem Bank[8]; - BobItem _bob[36]; - ListeItem Liste[6]; - ListeItem Liste2[35]; - LockAnimItem _lockedAnims[30]; - VBobItem VBob[30]; - ObjetWItem ObjetW[300]; - CacheItem Cache[25]; - int BOBZONE[105]; - bool BOBZONE_FLAG[105]; - int _spriteSize[500]; - HopkinsItem Hopkins[70]; - int _inventory[36]; - SortItem _sortedDisplay[51]; - Language _language; + bool _disableInventFl; + bool _cityMapEnabledFl; bool _linuxEndDemoFl; - int PERSO_TYPE; - uint _speed; - Common::String FICH_ZONE; - Common::String FICH_TEXTE; bool _censorshipFl; - int _oldFrameIndex; + bool _helicopterFl; + bool _forestFl; + bool _introSpeechOffFl; + bool _cacheFl; + bool _forceHideText; + int _exitId; + int _oceanDirection; int _oldDirection, _oldDirectionSpriteIdx; + int _actionDirection; int _lastDirection; - byte *_font; - int _fontFixedWidth; - int _fontFixedHeight; - byte *TETE; - byte *ICONE; - byte *BUF_ZONE; - byte *SPRITE_ECRAN; - Sauvegarde *_saveData; - byte *GESTE; - int NUM_FICHIER_OBJ; - int nbrligne; // Useless variable? - int _boxWidth; - byte *_inventoryObject; - int GESTE_FLAG; - byte *_forestSprite; - bool _forestFl; - byte *_answerBuffer; - byte *ADR_FICHIER_OBJ; - byte *PERSO; + int _oldFrameIndex; + int _hotspotTextColor; + int _inventory[36]; int _objectWidth, _objectHeight; - bool _helicopterFl; - uint32 _catalogPos; - uint32 _catalogSize; - int iRegul; - int _exitId; - int _mapCarPosX, _mapCarPosY; int _screenId; int _prevScreenId; + int _boxWidth; + int _mapCarPosX, _mapCarPosY; int _characterMaxPosY; - bool _disableInventFl; - bool NOMARCHE; - byte *_optionDialogSpr; - bool _optionDialogFl; - int _menuDisplayType; + int _baseMapColor; + int _spriteSize[500]; + int _sortedDisplayCount; + int _oldMouseZoneId; + int _oldMouseX, _oldMouseY; + uint _speed; + byte *_forestSprite; + byte *_answerBuffer; + Sauvegarde *_saveData; + Language _language; + HopkinsItem Hopkins[70]; + BobItem _bob[36]; + SortItem _sortedDisplay[51]; + + CreditItem _creditsItem[200]; + int _creditsLineNumb; + int _creditsStep; + int _creditsPosY; + int Credit_bx; + int Credit_bx1; + int Credit_by; + int Credit_by1; + int _menuSpeed; - int _menuScrollType; - int _menuScrollSpeed; int _menuSoundOff; + int _menuTextOff; int _menuVoiceOff; int _menuMusicOff; - int _menuTextOff; - int _sortedDisplayCount; - bool NOT_VERIF; - bool _cacheFl; - bool _introSpeechOffFl; - bool _cityMapEnabledFl; - bool GOACTION; - int Compteur; - int _actionDirection; - int _baseMapColor; + int _menuDisplayType; + int _menuScrollSpeed; - int _hotspotTextColor; + byte *_optionDialogSpr; + bool _optionDialogFl; + uint32 _catalogPos; + uint32 _catalogSize; + LockAnimItem _lockedAnims[30]; int _oldRouteFromX; int _oldRouteFromY; int _oldRouteDestX; - int _oldMouseZoneId; - int _oldMouseX, _oldMouseY; - int compteur_71; - bool _forceHideText; int _oldRouteDestY; int _oldZoneNum; - int j_104; - - int Credit_bx; - int Credit_bx1; - int Credit_by; - int Credit_by1; - int _creditsPosY; - int _creditsLineNumb; - CreditItem _creditsItem[200]; - int _creditsStep; - int _oceanDirection; + byte *TETE; + byte *ICONE; + bool NOMARCHE; + int iRegul; + byte *BUF_ZONE; + int nbrligne; // Useless variable? + BqeAnimItem Bqe_Anim[35]; + byte *SPRITE_ECRAN; + byte *PERSO; + int PERSO_TYPE; + int BOBZONE[105]; + bool BOBZONE_FLAG[105]; + bool NOT_VERIF; + ZonePItem ZONEP[106]; + ObjetWItem ObjetW[300]; + int NUM_FICHIER_OBJ; + byte *ADR_FICHIER_OBJ; + ListeItem Liste[6]; + ListeItem Liste2[35]; + BankItem Bank[8]; + byte *CACHE_BANQUE[6]; + CacheItem Cache[25]; + VBobItem VBob[30]; + int Compteur; + int compteur_71; + Common::String FICH_ZONE; + bool GOACTION; + int j_104; + int GESTE_FLAG; + byte *GESTE; + Common::String FICH_TEXTE; Globals(); ~Globals(); void setParent(HopkinsEngine *vm); - + byte *allocMemory(int count); + byte *freeMemory(byte *p); void setConfig(); + void loadObjects(); void clearAll(); void loadCharacterData(); - void INIT_ANIM(); - void INIT_VBOB(); - void CLEAR_VBOB(); - void loadObjects(); - byte *allocMemory(int count); - byte *freeMemory(byte *p); - void resetCache(); + void loadCache(const Common::String &file); + + void CLEAR_VBOB(); void CACHE_ON(); void CACHE_OFF(int v1 = 0); void CACHE_SUB(int idx); void CACHE_ADD(int idx); - void loadCache(const Common::String &file); - void B_CACHE_OFF(int idx); }; // Global null pointer diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1b8187a5cf..0b5aa67aae 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1610,9 +1610,9 @@ void HopkinsEngine::initializeSystem() { _globals.clearAll(); - _globals._font = _fileManager.loadFile("FONTE3.SPR"); - _globals._fontFixedWidth = 12; - _globals._fontFixedHeight = 21; + _fontManager._font = _fileManager.loadFile("FONTE3.SPR"); + _fontManager._fontFixedWidth = 12; + _fontManager._fontFixedHeight = 21; _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); _globals.TETE = _fileManager.loadFile("TETE.SPR"); @@ -2432,7 +2432,7 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) - strWidth += _objectsManager.getWidth(_globals._font, curChar - 32); + strWidth += _objectsManager.getWidth(_fontManager._font, curChar - 32); } int startPosX = 320 - strWidth / 2; int endPosX = strWidth + startPosX; @@ -2458,8 +2458,8 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { if (!curChar) break; if (curChar > 31) { - _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _globals._font, startPosX, startPosY, curChar - 32, colour); - startPosX += _objectsManager.getWidth(_globals._font, curChar - 32); + _graphicsManager.displayFont(_graphicsManager._vesaBuffer, _fontManager._font, startPosX, startPosY, curChar - 32, colour); + startPosX += _objectsManager.getWidth(_fontManager._font, curChar - 32); } } } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index fea3bcc235..319b9f93a6 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -516,7 +516,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { Common::File f; int filesize; - _vm->_globals._fontFixedWidth = 11; + _vm->_fontManager._fontFixedWidth = 11; // Build up the filename filename = dest = file; @@ -577,7 +577,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { ++v10; } while (v11 != ' ' && v11 != '%'); - if (v10 >= v15 / _vm->_globals._fontFixedWidth) { + if (v10 >= v15 / _vm->_fontManager._fontFixedWidth) { if (v11 == '%') v11 = ' '; break; -- cgit v1.2.3 From a836676312c611dba197eebeba1f82890af2acad Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Feb 2013 22:30:40 +0100 Subject: HOPKINS:Move some variables from globals to ObjectManager --- engines/hopkins/globals.cpp | 8 +------- engines/hopkins/globals.h | 4 ---- engines/hopkins/hopkins.cpp | 28 ++++++++++++++-------------- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 35 ++++++++++++++++++++++++----------- engines/hopkins/objects.h | 7 +++++++ engines/hopkins/saveload.cpp | 8 ++++---- engines/hopkins/script.cpp | 2 +- engines/hopkins/talk.cpp | 8 ++++---- 9 files changed, 56 insertions(+), 46 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index e90748236a..837aad1313 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -116,14 +116,11 @@ Globals::Globals() { NUM_FICHIER_OBJ = 0; nbrligne = 0; _boxWidth = 0; - _forestFl = false; _objectWidth = _objectHeight = 0; - _helicopterFl = false; _catalogPos = 0; _catalogSize = 0; iRegul = 0; _exitId = 0; - _mapCarPosX = _mapCarPosY = 0; PERSO = 0; _screenId = 0; _prevScreenId = 0; @@ -163,7 +160,6 @@ Globals::Globals() { _saveData = NULL; GESTE = NULL; _inventoryObject = NULL; - _forestSprite = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; PERSO = NULL; @@ -204,7 +200,6 @@ Globals::~Globals() { freeMemory((byte *)_saveData); freeMemory(GESTE); freeMemory(_inventoryObject); - freeMemory(_forestSprite); freeMemory(_answerBuffer); freeMemory(ADR_FICHIER_OBJ); freeMemory(PERSO); @@ -283,6 +278,7 @@ void Globals::clearAll() { } _vm->_linesManager.clearAll(); + _vm->_objectsManager.clearAll(); _saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde)); memset(_saveData, 0, sizeof(Sauvegarde)); @@ -293,8 +289,6 @@ void Globals::clearAll() { _inventoryObject = allocMemory(2500); ADR_FICHIER_OBJ = g_PTRNUL; - _forestSprite = g_PTRNUL; - _forestFl = false; GESTE = g_PTRNUL; GESTE_FLAG = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c2b9ec6e69..9c730bb1da 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -282,8 +282,6 @@ public: bool _cityMapEnabledFl; bool _linuxEndDemoFl; bool _censorshipFl; - bool _helicopterFl; - bool _forestFl; bool _introSpeechOffFl; bool _cacheFl; bool _forceHideText; @@ -299,7 +297,6 @@ public: int _screenId; int _prevScreenId; int _boxWidth; - int _mapCarPosX, _mapCarPosY; int _characterMaxPosY; int _baseMapColor; int _spriteSize[500]; @@ -307,7 +304,6 @@ public: int _oldMouseZoneId; int _oldMouseX, _oldMouseY; uint _speed; - byte *_forestSprite; byte *_answerBuffer; Sauvegarde *_saveData; Language _language; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0b5aa67aae..f899ee3e61 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -117,8 +117,8 @@ bool HopkinsEngine::runWin95Demo() { _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); + _objectsManager._helicopterFl = false; - _globals._helicopterFl = false; _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -162,7 +162,7 @@ bool HopkinsEngine::runWin95Demo() { _globals.iRegul = 1; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; - _globals._mapCarPosX = _globals._mapCarPosY = 0; + _objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -428,8 +428,8 @@ bool HopkinsEngine::runLinuxDemo() { _globals.loadObjects(); _objectsManager.changeObject(14); _objectsManager.addObject(14); + _objectsManager._helicopterFl = false; - _globals._helicopterFl = false; _eventsManager.mouseOff(); _graphicsManager.lockScreen(); @@ -452,7 +452,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.iRegul = 0; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; - _globals._mapCarPosX = _globals._mapCarPosY = 0; + _objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -755,12 +755,12 @@ bool HopkinsEngine::runFull() { _objectsManager.addObject(14); if (getPlatform() == Common::kPlatformLinux) { - _globals._helicopterFl = false; + _objectsManager._helicopterFl = false; _eventsManager.mouseOff(); // No code has been added to display the version as it's wrong // in my copy: it mentions a Win95 version v4 using DirectDraw (Strangerke) } else if (getPlatform() == Common::kPlatformWindows) { - _globals._helicopterFl = false; + _objectsManager._helicopterFl = false; _globals.iRegul = 1; // This code displays the game version. // It wasn't present in the original and could be put in the debugger @@ -811,7 +811,7 @@ bool HopkinsEngine::runFull() { _globals.iRegul = 0; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; - _globals._mapCarPosX = _globals._mapCarPosY = 0; + _objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -1142,17 +1142,17 @@ bool HopkinsEngine::runFull() { _linesManager.setMaxLineIdx(40); _globals._characterMaxPosY = 435; _globals._disableInventFl = false; - _globals._forestFl = true; + _objectsManager._forestFl = true; Common::String im = Common::String::format("IM%d", _globals._exitId); _soundManager.WSOUND(13); - if (_globals._forestSprite == g_PTRNUL) { - _globals._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR"); + if (_objectsManager._forestSprite == g_PTRNUL) { + _objectsManager._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR"); _soundManager.loadSample(1, "SOUND41.WAV"); } _objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false); if (_globals._exitId < 35 || _globals._exitId > 49) { - _globals._forestSprite = _globals.freeMemory(_globals._forestSprite); - _globals._forestFl = false; + _objectsManager._forestSprite = _globals.freeMemory(_objectsManager._forestSprite); + _objectsManager._forestFl = false; _soundManager.DEL_SAMPLE(1); } break; @@ -1956,7 +1956,7 @@ void HopkinsEngine::restoreSystem() { void HopkinsEngine::endLinuxDemo() { _globals._linuxEndDemoFl = true; _graphicsManager.RESET_SEGMENT_VESA(); - _globals._forestFl = false; + _objectsManager._forestFl = false; _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _graphicsManager.loadImage("BOX"); @@ -2832,7 +2832,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { _graphicsManager._maxX = SCREEN_WIDTH; _graphicsManager._maxY = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; - _globals._forestFl = false; + _objectsManager._forestFl = false; _globals._disableInventFl = true; _globals._exitId = 0; diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 33369a47ec..798acc2a8e 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -53,7 +53,7 @@ int MenuManager::menu() { result = 0; while (!g_system->getEventManager()->shouldQuit()) { - _vm->_globals._forestFl = false; + _vm->_objectsManager._forestFl = false; _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; _vm->_globals._exitId = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e9db707e98..7c30286e5e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -38,6 +38,7 @@ ObjectsManager::ObjectsManager() { Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0); } + _helicopterFl = false; _priorityFl = false; _oldBorderPos = Common::Point(0, 0); _oldBorderSpriteIndex = 0; @@ -70,12 +71,24 @@ ObjectsManager::ObjectsManager() { _oldSpriteIndex = 0; _oldFlipFl = false; _curObjectIndex = 0; + _forestFl = false; + _mapCarPosX = _mapCarPosY = 0; + _forestSprite = NULL; +} + +ObjectsManager::~ObjectsManager() { + _vm->_globals.freeMemory(_forestSprite); } void ObjectsManager::setParent(HopkinsEngine *vm) { _vm = vm; } +void ObjectsManager::clearAll() { + _forestFl = false; + _forestSprite = g_PTRNUL; +} + /** * Change Object */ @@ -1810,12 +1823,12 @@ void ObjectsManager::handleCityMap() { _vm->_globals.CACHE_OFF(20); _vm->_globals.CACHE_ON(); - if (!_vm->_globals._mapCarPosX && !_vm->_globals._mapCarPosY) { - _vm->_globals._mapCarPosX = 900; - _vm->_globals._mapCarPosY = 319; + if (!_mapCarPosX && !_mapCarPosY) { + _mapCarPosX = 900; + _mapCarPosY = 319; } - addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, false, 5, 5); - _vm->_eventsManager.setMouseXY(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY); + addStaticSprite(_spritePtr, Common::Point(_mapCarPosX, _mapCarPosY), 0, 1, 0, false, 5, 5); + _vm->_eventsManager.setMouseXY(_mapCarPosX, _mapCarPosY); _vm->_eventsManager.mouseOn(); _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; @@ -1872,8 +1885,8 @@ void ObjectsManager::handleCityMap() { _vm->_graphicsManager.fadeOutLong(); _vm->_globals.iRegul = 0; _vm->_graphicsManager._noFadingFl = false; - _vm->_globals._mapCarPosX = getSpriteX(0); - _vm->_globals._mapCarPosY = getSpriteY(0); + _mapCarPosX = getSpriteX(0); + _mapCarPosY = getSpriteY(0); removeSprite(0); _spritePtr = _vm->_globals.freeMemory(_spritePtr); clearScreen(); @@ -1958,7 +1971,7 @@ void ObjectsManager::handleLeftButton() { _vm->_globals.GOACTION = false; int16 *oldRoute = _vm->_linesManager._route; _vm->_linesManager._route = (int16 *)g_PTRNUL; - if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { + if (_forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) { _vm->_linesManager._route = (int16 *)g_PTRNUL; setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); @@ -2027,7 +2040,7 @@ void ObjectsManager::PARADISE() { char result = _vm->_globals._saveData->_data[svField1]; if (result && _vm->_globals._saveData->_data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); - if (!_vm->_globals._forestFl || _zoneNum < 20 || _zoneNum > 23) { + if (!_forestFl || _zoneNum < 20 || _zoneNum > 23) { if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager._scrollStatus = 2; if (_vm->_eventsManager._startPos.x + 320 - getSpriteX(0) > 160) { @@ -3955,7 +3968,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm breakFlag = true; } - if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_vm->_globals._helicopterFl) { + if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_helicopterFl) { if (!_vm->_graphicsManager._noFadingFl) _vm->_graphicsManager.fadeOutLong(); _vm->_graphicsManager._noFadingFl = false; @@ -3968,7 +3981,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.FIN_VISU(); clearScreen(); } else { - _vm->_globals._helicopterFl = false; + _helicopterFl = false; } _vm->_globals.iRegul = 0; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index c10b895399..816e616a3f 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -66,10 +66,12 @@ public: int _saveLoadX, _saveLoadY; int _oldInventoryPosX, _oldInventoryPosY; int _oldCharacterPosX, _oldCharacterPosY; + int _mapCarPosX, _mapCarPosY; int _eraseVisibleCounter; byte *_saveLoadSprite; byte *_saveLoadSprite2; byte *_spritePtr; + byte *_forestSprite; const byte *_oldSpriteData; bool PERSO_ON; bool _saveLoadFl; @@ -90,9 +92,14 @@ public: int _oldSpriteIndex; bool _oldFlipFl; int _curObjectIndex; + bool _helicopterFl; + bool _forestFl; public: ObjectsManager(); + ~ObjectsManager(); + void setParent(HopkinsEngine *vm); + void clearAll(); void changeObject(int objIndex); byte *CAPTURE_OBJET(int objIndex, bool mode); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index e692aef81c..7f0dd9cd60 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -146,8 +146,8 @@ Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName for (int i = 0; i < 35; ++i) _vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i]; - _vm->_globals._saveData->_mapCarPosX = _vm->_globals._mapCarPosX; - _vm->_globals._saveData->_mapCarPosY = _vm->_globals._mapCarPosY; + _vm->_globals._saveData->_mapCarPosX = _vm->_objectsManager._mapCarPosX; + _vm->_globals._saveData->_mapCarPosY = _vm->_objectsManager._mapCarPosY; /* Create the savegame */ Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot)); @@ -205,8 +205,8 @@ Common::Error SaveLoadManager::loadGame(int slot) { _vm->_globals._exitId = _vm->_globals._saveData->_data[svField5]; _vm->_globals._saveData->_data[svField6] = 0; _vm->_globals._screenId = 0; - _vm->_globals._mapCarPosX = _vm->_globals._saveData->_mapCarPosX; - _vm->_globals._mapCarPosY = _vm->_globals._saveData->_mapCarPosY; + _vm->_objectsManager._mapCarPosX = _vm->_globals._saveData->_mapCarPosX; + _vm->_objectsManager._mapCarPosY = _vm->_globals._saveData->_mapCarPosY; return Common::kNoError; } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c25aacc414..f124280c75 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -614,7 +614,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fadeOutLong(); _vm->_globals._disableInventFl = false; - _vm->_globals._helicopterFl = true; + _vm->_objectsManager._helicopterFl = true; break; case 16: diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 319b9f93a6..a05e42c2a9 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -884,7 +884,7 @@ void TalkManager::REPONSE2(int a1, int a2) { if (a1 == 22 || a1 == 23) { _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, false); + _vm->_objectsManager.SPACTION(_vm->_objectsManager._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, false); if (a1 == 22) { _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); @@ -896,7 +896,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.setBobAnimation(6); _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + _vm->_objectsManager.SPACTION1(_vm->_objectsManager._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.getBobAnimDataIdx(6) < 12); @@ -932,7 +932,7 @@ void TalkManager::REPONSE2(int a1, int a2) { } else if (a1 == 20 || a1 == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, true); + _vm->_objectsManager.SPACTION(_vm->_objectsManager._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, true); if (a1 == 20) { _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); @@ -944,7 +944,7 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_objectsManager.stopBobAnimation(2); _vm->_objectsManager.setBobAnimation(5); _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + _vm->_objectsManager.SPACTION1(_vm->_objectsManager._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); while (_vm->_objectsManager.getBobAnimDataIdx(5) < 12); -- cgit v1.2.3 From 3de056d3819cdc0612af5416808dbf12d99b06a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 8 Feb 2013 06:44:28 +0100 Subject: HOPKINS: Improve private/public scope in ObjectsManager --- engines/hopkins/lines.h | 26 +++--- engines/hopkins/objects.cpp | 6 ++ engines/hopkins/objects.h | 204 ++++++++++++++++++++++---------------------- 3 files changed, 121 insertions(+), 115 deletions(-) diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 066c8aeaa7..7eb73409a3 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -91,18 +91,19 @@ private: int _lastLine; int _linesNumb; - int CALC_PROPRE(int idx); int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); void removeLine(int idx); bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); + bool checkSmoothMove(int fromX, int fromY, int destX, int destY); + bool makeSmoothMove(int fromX, int fromY, int destX, int destY); + + int CALC_PROPRE(int idx); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); bool MIRACLE(int a1, int a2, int a3, int a4, int a5); int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); - bool checkSmoothMove(int fromX, int fromY, int destX, int destY); - bool makeSmoothMove(int fromX, int fromY, int destX, int destY); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); int colision(int xp, int yp); @@ -114,23 +115,24 @@ public: LinesManager(); ~LinesManager(); void setParent(HopkinsEngine *vm); + void clearAll(); + void setMaxLineIdx(int idx); int checkInventoryHotspots(int posX, int posY); - void loadLines(const Common::String &file); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); - int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); - void PACOURS_PROPRE(int16 *route); + void loadLines(const Common::String &file); + void addLine(int idx, int direction, int a3, int a4, int a5, int a6); + void initRoute(); int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); void clearAllZones(); void resetLines(); - void addLine(int idx, int direction, int a3, int a4, int a5, int a6); - void initRoute(); + void resetLinesNumb(); + void resetLastLine(); + int MZONE(); void CARRE_ZONE(); - void clearAll(); - void setMaxLineIdx(int idx); - void resetLastLine(); - void resetLinesNumb(); + int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); + void PACOURS_PROPRE(int16 *route); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7c30286e5e..febe74c8eb 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3755,6 +3755,9 @@ void ObjectsManager::lockAnimX(int idx, int x) { _vm->_globals._lockedAnims[idx]._posX = x; } +/** + * Game scene control method + */ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { _vm->_dialogsManager._inventFl = false; @@ -3840,6 +3843,9 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.iRegul = 0; } +/** + * Game scene control method + */ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { _vm->_dialogsManager._inventFl = false; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 816e616a3f..424b57de99 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -56,75 +56,23 @@ class ObjectsManager { private: HopkinsEngine *_vm; -public: - SpriteItem _sprite[6]; - bool _priorityFl; - Common::Point _oldBorderPos; int _oldBorderSpriteIndex; - Common::Point _borderPos; int _borderSpriteIndex; - int _saveLoadX, _saveLoadY; - int _oldInventoryPosX, _oldInventoryPosY; - int _oldCharacterPosX, _oldCharacterPosY; - int _mapCarPosX, _mapCarPosY; - int _eraseVisibleCounter; - byte *_saveLoadSprite; - byte *_saveLoadSprite2; byte *_spritePtr; - byte *_forestSprite; const byte *_oldSpriteData; - bool PERSO_ON; - bool _saveLoadFl; - bool _visibleFl; - bool BOBTOUS; - int _zoneNum; - bool _forceZoneFl; - bool _changeVerbFl; int _verb; - bool _changeHeadFl; - bool _disableFl; - bool _twoCharactersFl; - Common::Point _characterPos; - int _startSpriteIndex; - bool OBSSEUL; - int _jumpVerb; - int _jumpZone; int _oldSpriteIndex; bool _oldFlipFl; - int _curObjectIndex; - bool _helicopterFl; - bool _forestFl; -public: - ObjectsManager(); - ~ObjectsManager(); - - void setParent(HopkinsEngine *vm); - void clearAll(); - - void changeObject(int objIndex); - byte *CAPTURE_OBJET(int objIndex, bool mode); - void removeObject(int objIndex); - - int getWidth(const byte *objectData, int idx); - int getHeight(const byte *objectData, int idx); +private: void sprite_alone(const byte *objectData, byte *sprite, int objIndex); void DEL_FICHIER_OBJ(); - byte *loadSprite(const Common::String &file); - void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize); int getOffsetX(const byte *spriteData, int spriteIndex, bool isSize); int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize); - void displaySprite(); void capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex); - void addObject(int objIndex); - void initBob(); - void resetBob(int idx); void setBobInfo(int idx); - void BOB_VISU(int idx); - void BOB_OFF(int idx); - void BOB_OFFSET(int idx, int offset); void SCBOB(int idx); void CALCUL_BOB(int idx); @@ -136,26 +84,11 @@ public: void displayBobAnim(); void displayVBob(); - int getSpriteX(int idx); - int getSpriteY(int idx); void clearSprite(); - void animateSprite(int idx); - void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9); - void removeSprite(int idx); - void setSpriteX(int idx, int xp); - void setSpriteIndex(int idx, int spriteIndex); - void setSpriteY(int idx, int yp); void setSpriteZoom(int idx, int zoomFactor); - void setFlipSprite(int idx, bool flip); - - void checkZone(); - void GOHOME(); + void GOHOME2(); void loadZone(const Common::String &file); - void handleCityMap(); - void handleLeftButton(); - void PARADISE(); - void clearScreen(); /** * Change the currently active player @@ -164,59 +97,124 @@ public: */ void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); - void computeAndSetSpriteSize(); void nextVerbIcon(); - void handleRightButton(); + + int getBobFrameIndex(int idx); + + void SPECIAL_INI(); + + void ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl); + void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); +public: + bool _disableFl; + bool _forestFl; + bool _visibleFl; + bool _saveLoadFl; + bool _forceZoneFl; + bool _changeVerbFl; + bool _helicopterFl; + bool _twoCharactersFl; + bool _changeHeadFl; + bool _priorityFl; + int _jumpVerb; + int _jumpZone; + int _zoneNum; + int _eraseVisibleCounter; + int _curObjectIndex; + int _startSpriteIndex; + int _oldInventoryPosX, _oldInventoryPosY; + int _saveLoadX, _saveLoadY; + int _mapCarPosX, _mapCarPosY; + int _oldCharacterPosX, _oldCharacterPosY; + Common::Point _borderPos; + Common::Point _oldBorderPos; + Common::Point _characterPos; + byte *_forestSprite; + byte *_saveLoadSprite; + byte *_saveLoadSprite2; + SpriteItem _sprite[6]; + + bool PERSO_ON; + bool BOBTOUS; + bool OBSSEUL; + + ObjectsManager(); + ~ObjectsManager(); + + void setParent(HopkinsEngine *vm); + void clearAll(); + + int getWidth(const byte *objectData, int idx); + int getHeight(const byte *objectData, int idx); + byte *loadSprite(const Common::String &file); + void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9); + void animateSprite(int idx); + void removeSprite(int idx); + void setSpriteX(int idx, int xp); + void setSpriteY(int idx, int yp); + int getSpriteX(int idx); + int getSpriteY(int idx); + void setSpriteIndex(int idx, int spriteIndex); + void displaySprite(); + void computeAndSetSpriteSize(); + void setFlipSprite(int idx, bool flip); + + int getBobAnimDataIdx(int idx); void initBorder(int zoneIdx); void nextObjectIcon(int idx); void takeInventoryObject(int idx); - void OPTI_OBJET(); void handleSpecialGames(); - void BOB_VIVANT(int idx); - void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); - void VBOB_OFF(int idx); - void ACTION_DOS(int idx); - void ACTION_DROITE(int idx); - void Q_DROITE(int idx); - void ACTION_FACE(int idx); - void Q_GAUCHE(int idx); - void ACTION_GAUCHE(int idx); + void addObject(int objIndex); + void changeObject(int objIndex); + void removeObject(int objIndex); + + void checkZone(); void enableZone(int idx); void disableZone(int idx); - void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction); - int getBobAnimDataIdx(int idx); + + void resetBob(int idx); + void setBobAnimDataIdx(int idx, int animIdx); void setBobAnimation(int idx); void stopBobAnimation(int idx); - void setBobAnimDataIdx(int idx, int animIdx); int getBobPosX(int idx); int getBobPosY(int idx); - int getBobFrameIndex(int idx); - void INILINK(const Common::String &file); - void SPECIAL_INI(); - void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx); - void SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4); + void handleCityMap(); + void clearScreen(); void disableVerb(int idx, int a2); void enableVerb(int idx, int a2); - - void ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl); - void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); - void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); - void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); void lockAnimX(int idx, int x); + void handleLeftButton(); + void handleRightButton(); + void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize); - /** - * Game scene control method - */ void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); - - /** - * Game scene control method - */ + const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); + const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); + byte *CAPTURE_OBJET(int objIndex, bool mode); + void OPTI_OBJET(); + void BOB_OFF(int idx); + void BOB_VISU(int idx); + void INILINK(const Common::String &file); + void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); + void BOB_VIVANT(int idx); + void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); + void VBOB_OFF(int idx); + void ACTION_DOS(int idx); + void ACTION_DROITE(int idx); + void Q_DROITE(int idx); + void ACTION_FACE(int idx); + void Q_GAUCHE(int idx); + void ACTION_GAUCHE(int idx); + void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction); + void SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4); + void GOHOME(); + void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx); + void BOB_OFFSET(int idx, int offset); + void SPACTION1(byte *spriteData, const Common::String &animString, int a3, int a4, int speed); + void PARADISE(); }; } // End of namespace Hopkins -- cgit v1.2.3 From 6ce3e2187b6a2395b96b9f9a55c5c40d6b887333 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 8 Feb 2013 07:29:40 +0100 Subject: HOPKINS: Improve private/public scope in SoundManager and ScriptManager --- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/script.h | 6 +-- engines/hopkins/sound.cpp | 12 ++++-- engines/hopkins/sound.h | 91 ++++++++++++++++++++++----------------------- 4 files changed, 58 insertions(+), 55 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index f899ee3e61..d40d5de060 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2171,7 +2171,7 @@ void HopkinsEngine::playEnding() { _objectsManager.stopBobAnimation(7); if (_globals._saveData->_data[svField135] == 1) { _soundManager._specialSoundNum = 200; - _soundManager.skipRefreshFl = true; + _soundManager._skipRefreshFl = true; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BERM.ANM", 100, 24, 300); _graphicsManager.FIN_VISU(); @@ -2208,7 +2208,7 @@ void HopkinsEngine::playEnding() { _globals._disableInventFl = false; } else { _soundManager._specialSoundNum = 200; - _soundManager.skipRefreshFl = true; + _soundManager._skipRefreshFl = true; _animationManager.playAnim2("BERM.ANM", 100, 24, 300); _objectsManager.stopBobAnimation(7); _objectsManager.setBobAnimation(8); diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index f37baffdac..40b9612627 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -33,16 +33,16 @@ namespace Hopkins { class ScriptManager { private: HopkinsEngine *_vm; + int checkOpcode(const byte *dataP); public: bool TRAVAILOBJET; -public: + ScriptManager(); void setParent(HopkinsEngine *vm); int handleOpcode(byte *dataP); - int checkOpcode(const byte *dataP); - int handleGoto(const byte *dataP); int handleIf(const byte *dataP, int a2); + int handleGoto(const byte *dataP); }; } // End of namespace Hopkins diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 7b59f1ee62..e30e670b27 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -198,7 +198,7 @@ SoundManager::SoundManager() { _voiceOffFl = true; _textOffFl = false; _soundFl = false; - skipRefreshFl = false; + _skipRefreshFl = false; _currentSoundIndex = 0; _oldSoundNumber = 0; _modPlayingFl = false; @@ -457,6 +457,9 @@ void SoundManager::checkSounds() { checkVoiceActivity(); } +/** + * Checks voices to see if they're finished + */ void SoundManager::checkVoiceActivity() { // Check the status of each voice. bool hasActiveVoice = false; @@ -588,7 +591,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { // Loop for playing voice breakFlag = 0; do { - if (_specialSoundNum != 4 && !skipRefreshFl) + if (_specialSoundNum != 4 && !_skipRefreshFl) _vm->_eventsManager.VBL(); if (_vm->_eventsManager.getMouseButton()) break; @@ -609,7 +612,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); } _vm->_eventsManager._escKeyFl = false; - skipRefreshFl = false; + _skipRefreshFl = false; return true; } @@ -876,6 +879,9 @@ void SoundManager::updateScummVMSoundSettings() { ConfMan.flushToDisk(); } +/** + * Creates an audio stream based on a passed raw stream + */ Audio::RewindableAudioStream *SoundManager::makeSoundStream(Common::SeekableReadStream *stream) { if (_vm->getPlatform() == Common::kPlatformWindows) return Audio::makeAPCStream(stream, DisposeAfterUse::YES); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 081046d335..70c05a83fc 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -65,79 +65,76 @@ class SoundManager { private: HopkinsEngine *_vm; + Audio::SoundHandle _musicHandle; + int _currentSoundIndex; + bool _modPlayingFl; + int _oldSoundNumber; + + VoiceItem _voice[VOICE_COUNT]; + SwavItem Swav[SWAV_COUNT]; + SoundItem _sound[SOUND_COUNT]; + MusicItem _music; + + void playMod(const Common::String &file); + void loadMusic(const Common::String &file); + void playMusic(); + void stopMusic(); + void delMusic(); bool checkVoiceStatus(int voiceIndex); void stopVoice(int voiceIndex); - void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); void playVoice(); + void delWav(int wavIndex); + void checkVoiceActivity(); + Common::String setExtension(const Common::String &str, const Common::String &ext); + Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); + + void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); - void delWav(int wavIndex); void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); - /** - * Checks voices to see if they're finished - */ - void checkVoiceActivity(); - - /** - * Creates an audio stream based on a passed raw stream - */ - Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); public: - Audio::SoundHandle _musicHandle; - int _specialSoundNum; - int _soundVolume; - int _voiceVolume; - int _musicVolume; - bool _soundOffFl; bool _musicOffFl; + bool _soundOffFl; bool _voiceOffFl; bool _textOffFl; bool _soundFl; - bool skipRefreshFl; - int _currentSoundIndex; - bool _modPlayingFl; - int _oldSoundNumber; - - VoiceItem _voice[VOICE_COUNT]; - SwavItem Swav[SWAV_COUNT]; - SoundItem _sound[SOUND_COUNT]; - MusicItem _music; + bool _skipRefreshFl; + int _musicVolume; + int _soundVolume; + int _voiceVolume; + int _specialSoundNum; public: SoundManager(); ~SoundManager(); void setParent(HopkinsEngine *vm); - void checkSoundEnd(); void loadAnimSound(); void playAnimSound(int soundNumber); - void loadWav(const Common::String &file, int wavIndex); - void playWav(int wavIndex); - void WSOUND(int soundNumber); - void WSOUND_OFF(); - void playMod(const Common::String &file); - void loadMusic(const Common::String &file); - void playMusic(); - void stopMusic(); - void delMusic(); + void loadSample(int wavIndex, const Common::String &file); + void playSample(int wavIndex, int voiceMode); - bool mixVoice(int voiceId, int voiceMode); - void DEL_SAMPLE(int soundIndex); + void checkSoundEnd(); + void checkSounds(); void playSound(const Common::String &file); - void PLAY_SOUND2(const Common::String &file2); + void updateScummVMSoundSettings(); + void syncSoundSettings(); + bool mixVoice(int voiceId, int voiceMode); + + void MODSetMusicVolume(int volume); void MODSetSampleVolume(); void MODSetVoiceVolume(); - void MODSetMusicVolume(int volume); - void loadSample(int wavIndex, const Common::String &file); - void playSample(int wavIndex, int voiceMode); - void PLAY_SAMPLE2(int idx); - void syncSoundSettings(); - void updateScummVMSoundSettings(); - void checkSounds(); - Common::String setExtension(const Common::String &str, const Common::String &ext); + void loadWav(const Common::String &file, int wavIndex); + void playWav(int wavIndex); + + void DEL_SAMPLE(int soundIndex); + void WSOUND(int soundNumber); + void WSOUND_OFF(); + void PLAY_SOUND2(const Common::String &file2); + void PLAY_SAMPLE2(int idx); }; } // End of namespace Hopkins -- cgit v1.2.3 From c29f4c71b1b797ac78ca5b326cf4996ba7f08a20 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 8 Feb 2013 07:35:25 +0100 Subject: HOPKINS: Improve private/public scope in TalkManager --- engines/hopkins/talk.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 20b79f8015..05d5d97bcb 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -33,24 +33,17 @@ class HopkinsEngine; class TalkManager { private: HopkinsEngine *_vm; -public: + Common::String _questionsFilename; Common::String _answersFilename; byte *_characterBuffer; byte *_characterPalette; - byte *_characterSprite; - byte *_characterAnim; size_t _characterSize; bool STATI; int _dialogueMesgId1, _dialogueMesgId2; int _dialogueMesgId3, _dialogueMesgId4; int _paletteBufferIdx; -public: - TalkManager(); - void setParent(HopkinsEngine *vm); - void PARLER_PERSO2(const Common::String &filename); - void PARLER_PERSO(const Common::String &filename); void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData); int dialogQuestion(); int dialogAnswer(int idx); @@ -58,13 +51,24 @@ public: void dialogWait(); void dialogTalk(); void dialogEndTalk(); - int VERIF_BOITE(int a1, const Common::String &a2, int a3); - void VISU_PARLE(); - void BOB_VISU_PARLE(int idx); void startCharacterAnim0(int startIndedx, bool readOnlyFl); void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int idx, const byte *bufPerso, int animId, int bufferSize); + + int VERIF_BOITE(int a1, const Common::String &a2, int a3); + void VISU_PARLE(); + void BOB_VISU_PARLE(int idx); + +public: + byte *_characterAnim; + byte *_characterSprite; + + TalkManager(); + void setParent(HopkinsEngine *vm); + + void PARLER_PERSO2(const Common::String &filename); + void PARLER_PERSO(const Common::String &filename); void REPONSE(int zone, int verb); void REPONSE2(int a1, int a2); void OBJET_VIVANT(const Common::String &a2); -- cgit v1.2.3 From 6830416d866a30a1caab3d51f07d588774dfd596 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 8 Feb 2013 23:51:37 +0100 Subject: HOPKINS: Some refactoring. Remove a variable from TalkManager --- engines/hopkins/globals.cpp | 18 ++++++------------ engines/hopkins/talk.cpp | 37 +++++++++++++++++-------------------- engines/hopkins/talk.h | 7 +++---- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 837aad1313..68ff012076 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -437,22 +437,16 @@ void Globals::loadCache(const Common::String &file) { CACHE_BANQUE[1] = spriteData; int v15 = 60; for (int i = 0; i <= 21; i++) { - int v11 = (int16)READ_LE_UINT16((uint16 *)ptr + v15); - int v4 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); - int v5 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); - int v6 = i; - Cache[v6].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); - Cache[v6]._spriteIndex = v11; - Cache[v6]._x = v4; - Cache[v6]._y = v5; + Cache[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + v15); + Cache[i]._x = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); + Cache[i]._y = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); + Cache[i].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); if (spriteData == g_PTRNUL) { Cache[i]._useCount = 0; } else { - int v8 = _vm->_objectsManager.getWidth(spriteData, v11); - int v9 = _vm->_objectsManager.getHeight(spriteData, v11); Cache[i]._spriteData = spriteData; - Cache[i]._width = v8; - Cache[i]._height = v9; + Cache[i]._width = _vm->_objectsManager.getWidth(spriteData, Cache[i]._spriteIndex); + Cache[i]._height = _vm->_objectsManager.getHeight(spriteData, Cache[i]._spriteIndex); Cache[i]._useCount = 1; } diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index a05e42c2a9..74dd0c6b4f 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -39,7 +39,6 @@ TalkManager::TalkManager() { _characterSprite = NULL; _characterAnim = NULL; _characterSize = 0; - STATI = false; _dialogueMesgId1 = _dialogueMesgId2 = _dialogueMesgId3 = _dialogueMesgId4 = 0; _paletteBufferIdx = 0; } @@ -105,9 +104,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { int answer = 0; int dlgAnswer; do { - dlgAnswer = dialogQuestion(); + dlgAnswer = dialogQuestion(false); if (dlgAnswer != _dialogueMesgId4) - answer = dialogAnswer(dlgAnswer); + answer = dialogAnswer(dlgAnswer, false); if (answer == -1) dlgAnswer = _dialogueMesgId4; _vm->_eventsManager.VBL(); @@ -117,7 +116,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { int idx = 1; int answer; do - answer = dialogAnswer(idx++); + answer = dialogAnswer(idx++, false); while (answer != -1); } clearCharacterAnim(); @@ -153,7 +152,6 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { void TalkManager::PARLER_PERSO2(const Common::String &filename) { // TODO: The original disables the mouse cursor here - STATI = true; bool oldDisableInventFl = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; _characterBuffer = _vm->_fileManager.searchCat(filename, 5); @@ -195,9 +193,9 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { if (!_vm->_globals._introSpeechOffFl) { int answer; do { - answer = dialogQuestion(); + answer = dialogQuestion(true); if (answer != _dialogueMesgId4) { - if (dialogAnswer(answer) == -1) + if (dialogAnswer(answer, true) == -1) answer = _dialogueMesgId4; } } while (answer != _dialogueMesgId4); @@ -207,7 +205,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { int idx = 1; int answer; do - answer = dialogAnswer(idx++); + answer = dialogAnswer(idx++, true); while (answer != -1); } @@ -219,15 +217,14 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); // TODO: The original reenables the mouse cursor here _vm->_globals._disableInventFl = oldDisableInventFl; - STATI = false; } void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData) { dest = Common::String(srcData + srcStart); } -int TalkManager::dialogQuestion() { - if (STATI) { +int TalkManager::dialogQuestion(bool animatedFl) { + if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; int curVal = (int16)READ_LE_UINT16(bufPtr); if (curVal != 0) @@ -297,7 +294,7 @@ int TalkManager::dialogQuestion() { _vm->_fontManager.hideText(7); _vm->_fontManager.hideText(8); - if (STATI) { + if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; int curVal = (int16)READ_LE_UINT16(bufPtr); @@ -327,7 +324,7 @@ int TalkManager::dialogQuestion() { return retVal; } -int TalkManager::dialogAnswer(int idx) { +int TalkManager::dialogAnswer(int idx, bool animatedFl) { int charIdx; byte *charBuf; for (charBuf = _characterBuffer + 110, charIdx = 0; (int16)READ_LE_UINT16(charBuf) != idx; charBuf += 20) { @@ -351,7 +348,7 @@ int TalkManager::dialogAnswer(int idx) { if (!v6) v6 = 10; - if (STATI) { + if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; int curVal = (int16)READ_LE_UINT16(bufPtr); if (curVal) @@ -401,7 +398,7 @@ int TalkManager::dialogAnswer(int idx) { if (!_vm->_soundManager._textOffFl) _vm->_fontManager.hideText(9); - if (STATI) { + if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; int curVal = (int16)READ_LE_UINT16(bufPtr); if (curVal) @@ -876,16 +873,16 @@ void TalkManager::REPONSE(int zone, int verb) { return; } -void TalkManager::REPONSE2(int a1, int a2) { +void TalkManager::REPONSE2(int zone, int a2) { int indx = 0; if (a2 != 5 || _vm->_globals._saveData->_data[svField3] != 4) return; - if (a1 == 22 || a1 == 23) { + if (zone == 22 || zone == 23) { _vm->_objectsManager.setFlipSprite(0, false); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_objectsManager._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, false); - if (a1 == 22) { + if (zone == 22) { _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); } else { // a1 == 23 @@ -929,11 +926,11 @@ void TalkManager::REPONSE2(int a1, int a2) { _vm->_globals._saveData->_data[indx] = 2; _vm->_objectsManager.disableZone(22); _vm->_objectsManager.disableZone(23); - } else if (a1 == 20 || a1 == 21) { + } else if (zone == 20 || zone == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.SPACTION(_vm->_objectsManager._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, true); - if (a1 == 20) { + if (zone == 20) { _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); } else { // a1 == 21 diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index 05d5d97bcb..fad626ee54 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -39,14 +39,13 @@ private: byte *_characterBuffer; byte *_characterPalette; size_t _characterSize; - bool STATI; int _dialogueMesgId1, _dialogueMesgId2; int _dialogueMesgId3, _dialogueMesgId4; int _paletteBufferIdx; void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData); - int dialogQuestion(); - int dialogAnswer(int idx); + int dialogQuestion(bool animatedFl); + int dialogAnswer(int idx, bool animatedFl); void searchCharacterPalette(int startIdx, bool dark); void dialogWait(); void dialogTalk(); @@ -70,7 +69,7 @@ public: void PARLER_PERSO2(const Common::String &filename); void PARLER_PERSO(const Common::String &filename); void REPONSE(int zone, int verb); - void REPONSE2(int a1, int a2); + void REPONSE2(int zone, int a2); void OBJET_VIVANT(const Common::String &a2); }; -- cgit v1.2.3 From 7927babf21ad886d8e4f3e177c94274e7b58c2cd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 9 Feb 2013 14:52:37 +0100 Subject: HOPKINS: Some more renaming and refactoring in TalkManager --- engines/hopkins/talk.cpp | 168 ++++++++++++++++++++--------------------------- engines/hopkins/talk.h | 6 +- 2 files changed, 77 insertions(+), 97 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 74dd0c6b4f..2254ab37a0 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -241,10 +241,10 @@ int TalkManager::dialogQuestion(bool animatedFl) { dialogWait(); } - int sentence1LineNumb = VERIF_BOITE(_dialogueMesgId1, _questionsFilename, 65); - int sentence2LineNumb = VERIF_BOITE(_dialogueMesgId2, _questionsFilename, 65); - int sentence3LineNumb = VERIF_BOITE(_dialogueMesgId3, _questionsFilename, 65); - int sentence4LineNumb = VERIF_BOITE(_dialogueMesgId4, _questionsFilename, 65); + int sentence1LineNumb = countBoxLines(_dialogueMesgId1, _questionsFilename); + int sentence2LineNumb = countBoxLines(_dialogueMesgId2, _questionsFilename); + int sentence3LineNumb = countBoxLines(_dialogueMesgId3, _questionsFilename); + int sentence4LineNumb = countBoxLines(_dialogueMesgId4, _questionsFilename); int sentence4PosY = 420 - 20 * sentence4LineNumb; int sentence3PosY = sentence4PosY - 20 * sentence3LineNumb; @@ -498,34 +498,24 @@ void TalkManager::dialogEndTalk() { } } -int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { - int v9; - int v10; - char v11; - char v13; - int v15; - byte *ptr; - int v17; - byte *v19; - uint32 indexData[4047]; - Common::String filename; - Common::String dest; - Common::File f; - int filesize; - +int TalkManager::countBoxLines(int idx, const Common::String &file) { _vm->_fontManager._fontFixedWidth = 11; // Build up the filename + Common::String filename; + Common::String dest; filename = dest = file; while (filename.lastChar() != '.') filename.deleteLastChar(); filename += "IND"; + Common::File f; if (!f.open(filename)) error("Could not open file - %s", filename.c_str()); - filesize = f.size(); + int filesize = f.size(); assert(filesize < 16188); + uint32 indexData[4047]; for (int i = 0; i < (filesize / 4); ++i) indexData[i] = f.readUint32LE(); f.close(); @@ -534,61 +524,65 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { error("Error opening file - %s", dest.c_str()); f.seek(indexData[idx]); - ptr = _vm->_globals.allocMemory(2058); - if (ptr == g_PTRNUL) - error("temporary TEXT"); - f.read(ptr, 2048); + byte *decryptBuf = _vm->_globals.allocMemory(2058); + assert(decryptBuf != g_PTRNUL); + + f.read(decryptBuf, 2048); f.close(); - v19 = ptr; + // Decrypt buffer + byte *curDecryptPtr = decryptBuf; for (int i = 0; i < 2048; i++) { - v13 = *v19; - if ((byte)(*v19 + 46) > 27) { - if ((byte)(v13 + 80) > 27) { - if ((byte)(v13 - 65) <= 25 || (byte)(v13 - 97) <= 25) - v13 = 32; + char curByte = *curDecryptPtr; + if ((byte)(curByte + 46) > 27) { + if ((byte)(curByte + 80) > 27) { + if ((curByte >= 'A' && curByte <= 'Z') || (curByte >= 'a' && curByte <= 'z')) + curByte = ' '; } else { - v13 -= 79; + curByte -= 79; } } else { - v13 = *v19 + 111; + curByte += 111; } - *v19 = v13; - v19++; + *curDecryptPtr = curByte; + curDecryptPtr++; } + // Separate strings for (int i = 0; i < 2048; i++) { - if ( ptr[i] == 10 || ptr[i] == 13 ) - ptr[i] = 0; + if ( decryptBuf[i] == 10 || decryptBuf[i] == 13 ) + decryptBuf[i] = 0; } - v9 = 0; - v15 = (11 * a3) - 4; + // Check size of each strings in order to compute box width + int curBufIndx = 0; int lineCount = 0; + int lineSize = 0; + char curChar; do { - v10 = 0; + int curLineSize = 0; for (;;) { - v17 = v10; + lineSize = curLineSize; do { - v11 = ptr[v9 + v10]; - ++v10; - } while (v11 != ' ' && v11 != '%'); + curChar = decryptBuf[curBufIndx + curLineSize]; + ++curLineSize; + } while (curChar != ' ' && curChar != '%'); - if (v10 >= v15 / _vm->_fontManager._fontFixedWidth) { - if (v11 == '%') - v11 = ' '; + if (curLineSize >= MIN_LETTERS_PER_LINE - 1) { + if (curChar == '%') + curChar = ' '; break; } - if (v11 == '%') { - v17 = v10; + if (curChar == '%') { + lineSize = curLineSize; break; } } ++lineCount; - v9 += v17; - } while (v11 != '%'); - free(ptr); + curBufIndx += lineSize; + } while (curChar != '%'); + free(decryptBuf); return lineCount; } @@ -600,14 +594,11 @@ void TalkManager::VISU_PARLE() { } void TalkManager::BOB_VISU_PARLE(int idx) { - int v4; - byte *v5; - _vm->_objectsManager._priorityFl = true; if (!_vm->_globals._bob[idx].field0) { _vm->_objectsManager.resetBob(idx); - v5 = _vm->_globals.Bqe_Anim[idx]._data; - v4 = (int16)READ_LE_UINT16(v5 + 2); + byte *v5 = _vm->_globals.Bqe_Anim[idx]._data; + int v4 = (int16)READ_LE_UINT16(v5 + 2); if (!v4) v4 = 1; if ((int16)READ_LE_UINT16(v5 + 24)) { @@ -765,24 +756,14 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, } void TalkManager::REPONSE(int zone, int verb) { - uint16 v7; - byte *v8; - int opcodeType; - uint16 v11; - int v12; - int lastOpcodeResult; - bool tagFound; - bool v16; - bool innerLoopCond; - byte *ptr; - byte zoneObj = zone; byte verbObj = verb; bool outerLoopFl; + byte *ptr = g_PTRNUL; do { outerLoopFl = false; - tagFound = false; + bool tagFound = false; if (_vm->_globals._answerBuffer == g_PTRNUL) return; @@ -805,29 +786,29 @@ void TalkManager::REPONSE(int zone, int verb) { ptr = _vm->_globals.allocMemory(620); assert(ptr != g_PTRNUL); memset(ptr, 0, 620); - v7 = 0; - v12 = 0; - innerLoopCond = false; + uint16 v7 = 0; + int v12 = 0; + bool innerLoopCond = false; do { - v16 = false; + bool tagFound = false; if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'C')) { ++v12; assert(v12 < (620 / 20)); - v8 = (ptr + 20 * v12); - v11 = 0; + byte *v8 = (ptr + 20 * v12); + uint16 anwerIdx = 0; do { - assert(v11 < 20); - v8[v11++] = curAnswerBuf[v7++]; + assert(anwerIdx < 20); + v8[anwerIdx++] = curAnswerBuf[v7++]; if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'F')) { - v16 = true; - v8[v11] = 'F'; - v8[v11 + 1] = 'F'; + tagFound = true; + v8[anwerIdx] = 'F'; + v8[anwerIdx + 1] = 'F'; ++v7; } - } while (!v16); + } while (!tagFound); } - if (!v16) { + if (!tagFound) { uint32 signature24 = READ_BE_UINT24(&curAnswerBuf[v7]); if (signature24 == MKTAG24('C', 'O', 'D') || signature24 == MKTAG24('F', 'I', 'N')) innerLoopCond = true; @@ -836,9 +817,9 @@ void TalkManager::REPONSE(int zone, int verb) { v7 = 0; } while (!innerLoopCond); innerLoopCond = false; - lastOpcodeResult = 1; + int lastOpcodeResult = 1; do { - opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult); + int opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult); if (_vm->shouldQuit()) return; @@ -873,9 +854,9 @@ void TalkManager::REPONSE(int zone, int verb) { return; } -void TalkManager::REPONSE2(int zone, int a2) { +void TalkManager::REPONSE2(int zone, int verb) { int indx = 0; - if (a2 != 5 || _vm->_globals._saveData->_data[svField3] != 4) + if (verb != 5 || _vm->_globals._saveData->_data[svField3] != 4) return; if (zone == 22 || zone == 23) { @@ -885,7 +866,7 @@ void TalkManager::REPONSE2(int zone, int a2) { if (zone == 22) { _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); - } else { // a1 == 23 + } else { // zone == 23 _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(4)); _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(4)); } @@ -933,7 +914,7 @@ void TalkManager::REPONSE2(int zone, int a2) { if (zone == 20) { _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); - } else { // a1 == 21 + } else { // zone == 21 _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(2)); _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(2)); } @@ -977,12 +958,6 @@ void TalkManager::REPONSE2(int zone, int a2) { } void TalkManager::OBJET_VIVANT(const Common::String &a2) { - byte *v11; - Common::String s; - Common::String v20; - Common::String v22; - Common::String v23; - _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); @@ -1003,6 +978,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterBuffer = _vm->_fileManager.loadFile(a2); _characterSize = _vm->_fileManager.fileSize(a2); } + Common::String v22; + Common::String v23; + Common::String v20; getStringFromBuffer(40, v23, (const char *)_characterBuffer); getStringFromBuffer(0, v22, (const char *)_characterBuffer); getStringFromBuffer(20, v20, (const char *)_characterBuffer); @@ -1029,7 +1007,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, true); startCharacterAnim0(_paletteBufferIdx, false); - v11 = _vm->_globals._answerBuffer; + byte *oldAnswerBufferPtr = _vm->_globals._answerBuffer; _vm->_globals._answerBuffer = g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_objectsManager.INILINK(v22); @@ -1070,7 +1048,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.BOBZONE[i] = 0; _vm->_globals.freeMemory(_vm->_globals._answerBuffer); - _vm->_globals._answerBuffer = v11; + _vm->_globals._answerBuffer = oldAnswerBufferPtr; _vm->_objectsManager._disableFl = true; _vm->_objectsManager.INILINK(v20); _vm->_graphicsManager.INI_ECRAN2(v20, true); diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index fad626ee54..e0fe488c28 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -30,6 +30,8 @@ namespace Hopkins { class HopkinsEngine; +#define MIN_LETTERS_PER_LINE 65 + class TalkManager { private: HopkinsEngine *_vm; @@ -54,8 +56,8 @@ private: void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int idx, const byte *bufPerso, int animId, int bufferSize); + int countBoxLines(int idx, const Common::String &file); - int VERIF_BOITE(int a1, const Common::String &a2, int a3); void VISU_PARLE(); void BOB_VISU_PARLE(int idx); @@ -69,7 +71,7 @@ public: void PARLER_PERSO2(const Common::String &filename); void PARLER_PERSO(const Common::String &filename); void REPONSE(int zone, int verb); - void REPONSE2(int zone, int a2); + void REPONSE2(int zone, int verb); void OBJET_VIVANT(const Common::String &a2); }; -- cgit v1.2.3 From d102511da621426e7c8f31f8f0eacd9bda2ce29f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Feb 2013 11:14:22 +0100 Subject: HOPKINS: Some more renaming in TalkManager --- engines/hopkins/talk.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 2254ab37a0..338144b4b5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -978,19 +978,19 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _characterBuffer = _vm->_fileManager.loadFile(a2); _characterSize = _vm->_fileManager.fileSize(a2); } - Common::String v22; - Common::String v23; - Common::String v20; - getStringFromBuffer(40, v23, (const char *)_characterBuffer); - getStringFromBuffer(0, v22, (const char *)_characterBuffer); - getStringFromBuffer(20, v20, (const char *)_characterBuffer); + Common::String screenFilename; + Common::String spriteFilename; + Common::String curScreenFilename; + getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); + getStringFromBuffer(0, screenFilename, (const char *)_characterBuffer); + getStringFromBuffer(20, curScreenFilename, (const char *)_characterBuffer); - if (v20 == "NULL") - v20 = Common::String::format("IM%d", _vm->_globals._screenId); + if (curScreenFilename == "NULL") + curScreenFilename = Common::String::format("IM%d", _vm->_globals._screenId); - _characterSprite = _vm->_fileManager.searchCat(v23, 7); + _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) - _characterSprite = _vm->_objectsManager.loadSprite(v23); + _characterSprite = _vm->_objectsManager.loadSprite(spriteFilename); else _characterSprite = _vm->_objectsManager.loadSprite("RES_SAN.RES"); @@ -1010,14 +1010,14 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { byte *oldAnswerBufferPtr = _vm->_globals._answerBuffer; _vm->_globals._answerBuffer = g_PTRNUL; _vm->_globals.NOMARCHE = true; - _vm->_objectsManager.INILINK(v22); + _vm->_objectsManager.INILINK(screenFilename); _vm->_objectsManager.PERSO_ON = true; _vm->_globals.GOACTION = false; _vm->_objectsManager._zoneNum = -1; initCharacterAnim(); VISU_PARLE(); dialogWait(); - _vm->_graphicsManager.INI_ECRAN2(v22, true); + _vm->_graphicsManager.INI_ECRAN2(screenFilename, true); _vm->_globals.NOMARCHE = true; _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager._zoneNum = -1; @@ -1050,8 +1050,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals._answerBuffer = oldAnswerBufferPtr; _vm->_objectsManager._disableFl = true; - _vm->_objectsManager.INILINK(v20); - _vm->_graphicsManager.INI_ECRAN2(v20, true); + _vm->_objectsManager.INILINK(curScreenFilename); + _vm->_graphicsManager.INI_ECRAN2(curScreenFilename, true); _vm->_objectsManager._disableFl = false; _vm->_globals.NOMARCHE = false; if (_vm->_globals._exitId == 101) -- cgit v1.2.3 From 2044a71c27da1b45e0c0bcef22b2472a4f68009d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Feb 2013 11:15:19 +0100 Subject: HOPKINS: (mostly) fix the priority bug in the city map. Still rare visible glitches on the chimney, but the birds are ok!. --- engines/hopkins/globals.cpp | 13 ++++++------- engines/hopkins/globals.h | 4 ++-- engines/hopkins/objects.cpp | 6 +++--- engines/hopkins/script.cpp | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 68ff012076..5a44ce8788 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -405,11 +405,15 @@ void Globals::CACHE_ON() { _cacheFl = true; } -// TODO: Find why some calls have a parameter value -void Globals::CACHE_OFF(int v1) { +void Globals::CACHE_OFF() { _cacheFl = false; } +void Globals::B_CACHE_OFF(int idx) { + assert(idx < 36); + _bob[idx].field34 = true; +} + void Globals::CACHE_SUB(int idx) { Cache[idx]._useCount = 0; } @@ -459,9 +463,4 @@ void Globals::loadCache(const Common::String &file) { freeMemory(v2); } -void Globals::B_CACHE_OFF(int idx) { - _bob[idx].field34 = true; -} - - } // End of namespace Hopkins diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 9c730bb1da..ba42b9d0f2 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -275,7 +275,6 @@ private: void INIT_ANIM(); void INIT_VBOB(); - void B_CACHE_OFF(int idx); public: bool _disableInventFl; @@ -385,7 +384,8 @@ public: void CLEAR_VBOB(); void CACHE_ON(); - void CACHE_OFF(int v1 = 0); + void CACHE_OFF(); + void B_CACHE_OFF(int idx); void CACHE_SUB(int idx); void CACHE_ADD(int idx); }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index febe74c8eb..03ded6eb40 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1818,9 +1818,9 @@ void ObjectsManager::handleCityMap() { _vm->_graphicsManager.VISU_ALL(); _vm->_graphicsManager.INI_ECRAN2("PLAN", false); for (int i = 0; i <= 15; i++) - _vm->_globals.CACHE_OFF(i); - _vm->_globals.CACHE_OFF(19); - _vm->_globals.CACHE_OFF(20); + _vm->_globals.B_CACHE_OFF(i); + _vm->_globals.B_CACHE_OFF(19); + _vm->_globals.B_CACHE_OFF(20); _vm->_globals.CACHE_ON(); if (!_mapCarPosX && !_mapCarPosY) { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index f124280c75..e1c1a6cfb9 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -494,7 +494,7 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 5; break; case MKTAG24('B', 'C', 'A'): - _vm->_globals.CACHE_OFF((int16)READ_LE_UINT16(dataP + 5)); + _vm->_globals.B_CACHE_OFF((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('A', 'N', 'I'): { -- cgit v1.2.3 From f6456003e1153709788b306e4cd509576e8ab338 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 10 Feb 2013 12:19:41 +0100 Subject: HOPKINS: Fix cursor tranparency Before, cursor images were converted to 16 bpp, and anything that was the same as the first color in PAL_PIXELS[] was made transparent. Now, cursors images are drawn as 8 bpp with a cursor palette created from PAL_PIXELS[]. This preserves all the black parts of the cursor that weren't actually color index 0. It would be nice if we only regenerated the cursor/palette when they have actually changed, but that's for later. --- engines/hopkins/events.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index a52371368e..3cacd369b1 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -477,33 +477,30 @@ void EventsManager::updateCursor() { _vm->_graphicsManager._maxY = clipBounds.bottom; _vm->_graphicsManager._lineNbr2 = pitch; - // Convert the cursor to the pixel format. At the moment, it's hardcoded - // to expect the game to be in 16-bit mode - uint16 *cursorPixels = new uint16[_vm->_globals._objectHeight * _vm->_globals._objectWidth]; - const byte *srcP = cursorSurface; - uint16 *destP = cursorPixels; - - for (int yp = 0; yp < _vm->_globals._objectHeight; ++yp) { - const byte *lineSrcP = srcP; - uint16 *lineDestP = destP; + // Create a cursor palette + Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - for (int xp = 0; xp < _vm->_globals._objectWidth; ++xp) - *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2]; + byte *cursorPalette = new byte[3 * PALETTE_SIZE]; + uint16 *paletteColors = (uint16 *)_vm->_graphicsManager.PAL_PIXELS; - srcP += _vm->_globals._objectWidth; - destP += _vm->_globals._objectWidth; + for (int i = 0; i < PALETTE_SIZE; i++) { + uint8 r, g, b; + pixelFormat.colorToRGB(paletteColors[i], r, g, b); + cursorPalette[3 * i] = r; + cursorPalette[3 * i + 1] = g; + cursorPalette[3 * i + 2] = b; } // Calculate the X offset within the pointer image to the actual cursor data int xOffset = !_mouseLinuxFl ? 10 : 20; // Set the ScummVM cursor from the surface - Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - CursorMan.replaceCursor(cursorPixels, _vm->_globals._objectWidth, _vm->_globals._objectHeight, - xOffset, 0, *((uint16 *)cursorPixels), true, &pixelFormat); + CursorMan.replaceCursorPalette(cursorPalette, 0, PALETTE_SIZE - 1); + CursorMan.replaceCursor(cursorSurface, _vm->_globals._objectWidth, _vm->_globals._objectHeight, + xOffset, 0, 0, true); - // Delete the cursor surface - delete[] cursorPixels; + // Delete the cursor surface and palette + delete[] cursorPalette; delete[] cursorSurface; } -- cgit v1.2.3 From 3fc929d66cdec22a6f5cc185d3f6492bf7ea6011 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 10 Feb 2013 15:56:18 +0100 Subject: HOPKINS: Fix cursor endian issue (I think) I had assumed that PAL_PIXELS contained the colors encoded in native byte order, but looking again it appears that it's always encoded as little-endian. --- engines/hopkins/events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 3cacd369b1..c55d0c5395 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -485,7 +485,7 @@ void EventsManager::updateCursor() { for (int i = 0; i < PALETTE_SIZE; i++) { uint8 r, g, b; - pixelFormat.colorToRGB(paletteColors[i], r, g, b); + pixelFormat.colorToRGB(READ_LE_UINT16(&paletteColors[i]), r, g, b); cursorPalette[3 * i] = r; cursorPalette[3 * i + 1] = g; cursorPalette[3 * i + 2] = b; -- cgit v1.2.3 From e5c04b0f2669dc17218400b978a8bbf6e449a656 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 10 Feb 2013 22:26:12 +0100 Subject: HOPKINS: Hide cursor during cutscenes This hopefully fixes the regression that was recently introduced where the cursor would be visible, but black, during cutscenes. This was presumably because the color black in a mouse cursor no longer necessarily means that it's transparent. --- engines/hopkins/anim.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 16d6d581db..b7571d6aff 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -53,6 +53,8 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui if (_vm->shouldQuit()) return; + _vm->_eventsManager.mouseOff(); + bool hasScreenCopy = false; byte *screenP = _vm->_graphicsManager._vesaScreen; @@ -210,6 +212,8 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.FADE_LINUX = 0; f.close(); _vm->_graphicsManager._skipVideoLockFl = false; + + _vm->_eventsManager.mouseOn(); } /** @@ -224,6 +228,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u if (_vm->shouldQuit()) return; + _vm->_eventsManager.mouseOff(); + bool hasScreenCopy = false; while (!_vm->shouldQuit()) { memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769); @@ -394,6 +400,8 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.fadeInShort(); _vm->_graphicsManager.DD_VBL(); + + _vm->_eventsManager.mouseOn(); } /** -- cgit v1.2.3 From 0f09b3d79349caaa7c249a81c38d74e7d3a20089 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Feb 2013 22:38:49 +0100 Subject: HOPKINS: Remove obsolete TODOs --- engines/hopkins/hopkins.cpp | 22 +--------------------- engines/hopkins/script.cpp | 4 +--- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index d40d5de060..444c349d4d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -132,12 +132,7 @@ bool HopkinsEngine::runWin95Demo() { if (!_eventsManager._escKeyFl) playIntro(); - warning("TODO Fin_Interrupt()"); - warning("TODO TEST = 1;"); - warning("TODO no_vsync = 1;"); _eventsManager._rateCounter = 0; - warning("TODO Init_Interrupt_();"); - _globals.iRegul = 1; _globals._speed = 1; @@ -147,17 +142,10 @@ bool HopkinsEngine::runWin95Demo() { } _globals.iRegul = 0; - warning("TODO SPEEDJ = _globals._rateCounter;"); - warning("TODO no_vsync = 0;"); - warning("TODO TEST = 0;"); -// if (SPEEDJ > 475) if (_eventsManager._rateCounter > 475) _globals._speed = 2; -// if (SPEEDJ > 700) if (_eventsManager._rateCounter > 700) _globals._speed = 3; - warning("TODO Fin_Interrupt_();"); - warning("TODO Init_Interrupt_();"); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); @@ -746,7 +734,6 @@ bool HopkinsEngine::runLinuxDemo() { } bool HopkinsEngine::runFull() { - //warning("TODO: Init_Interrupt()"); // BeOS / Windows if (getPlatform() == Common::kPlatformLinux) _soundManager.WSOUND(16); @@ -1524,25 +1511,18 @@ bool HopkinsEngine::runFull() { _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; _soundManager.WSOUND_OFF(); - //warning("TODO: heapshrink();"); // Windows _soundManager.WSOUND(23); _globals._exitId = handleBaseMap(); // Handles the base map (non-Windows) //_globals._exitId = WBASE(); // Handles the 3D Doom level (Windows) _soundManager.WSOUND_OFF(); - //warning("TODO: heapshrink();"); // Windows _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; - //if (_globals._exitId == -1) - // error("FIN BASE SOUS MARINE"); break; } } _globals.PERSO = _globals.freeMemory(_globals.PERSO); - //warning("sub_33C70(v18);"); // OS/2 - //warning("sub_39460(v19);"); // OS/2 - //warning("sub_44134();"); // OS/2 restoreSystem(); return true; } @@ -2031,7 +2011,7 @@ void HopkinsEngine::BASE() { _animationManager.playAnim("base10a.anm", 10, 18, 18); if (!_eventsManager._escKeyFl) _animationManager.playAnim("base20a.anm", 10, 18, 18); - // CHECKME: The original code was doing the opposite test, which looks like a bug. + // CHECKME: The original code was doing the opposite test, which was a bug. if (!_eventsManager._escKeyFl) _animationManager.playAnim("base30a.anm", 10, 18, 18); if (!_eventsManager._escKeyFl) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index e1c1a6cfb9..af21b099fe 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -190,9 +190,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (v4); } - } else - // TODO: Remove this: - warning("Former AFFICHE_SPEED1: %d %d %d", vbobPosX, vbobPosY, vbobFrameIndex); + } } opcodeType = 1; break; -- cgit v1.2.3 From 705d00470a092da515e12e1f5c192d3ed36a0b42 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Feb 2013 00:15:00 +0100 Subject: HOPKINS: Move _bob to ObjectsManager --- engines/hopkins/globals.cpp | 4 +- engines/hopkins/globals.h | 31 ----- engines/hopkins/lines.cpp | 12 +- engines/hopkins/objects.cpp | 280 ++++++++++++++++++++++---------------------- engines/hopkins/objects.h | 31 +++++ engines/hopkins/talk.cpp | 22 ++-- 6 files changed, 190 insertions(+), 190 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 5a44ce8788..d4bbc89824 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -74,8 +74,6 @@ Globals::Globals() { Common::fill((byte *)&Bqe_Anim[i], (byte *)&Bqe_Anim[i] + sizeof(BqeAnimItem), 0); for (int i = 0; i < 8; ++i) Common::fill((byte *)&Bank[i], (byte *)&Bank[i] + sizeof(BankItem), 0); - for (int i = 0; i < 36; ++i) - Common::fill((byte *)&_bob[i], (byte *)&_bob[i] + sizeof(BobItem), 0); for (int i = 0; i < 6; ++i) Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0); for (int i = 0; i < 35; ++i) @@ -411,7 +409,7 @@ void Globals::CACHE_OFF() { void Globals::B_CACHE_OFF(int idx) { assert(idx < 36); - _bob[idx].field34 = true; + _vm->_objectsManager._bob[idx].field34 = true; } void Globals::CACHE_SUB(int idx) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index ba42b9d0f2..e50ec48324 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -68,36 +68,6 @@ struct ListeItem { int _height; }; -struct BobItem { - int field0; - byte *_spriteData; - int _xp; - int _yp; - int _frameIndex; - int _animDataIdx; - int field12; - int field14; - bool _disabledAnimationFl; - byte *_animData; - bool field1C; - int field1E; - int field20; - int field22; - int _offsetY; // Unused variable? - bool field34; // Set to true in B_CACHE_OFF() - int _zoomFactor; - bool _flipFl; - bool _isSpriteFl; - bool _activeFl; - int _oldX; - int _oldY; - int _oldWidth; - int _oldHeight; - int _oldX2; - int _zooInmFactor; - int _zoomOutFactor; -}; - struct LockAnimItem { bool _enableFl; int _posX; @@ -307,7 +277,6 @@ public: Sauvegarde *_saveData; Language _language; HopkinsItem Hopkins[70]; - BobItem _bob[36]; SortItem _sortedDisplay[51]; CreditItem _creditsItem[200]; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 32190d896f..93ffd5647c 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2966,17 +2966,17 @@ int LinesManager::MZONE() { if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) { int bobId = _vm->_globals.BOBZONE[bobZoneId]; - if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_globals._bob[bobId].field0 && _vm->_globals._bob[bobId]._frameIndex != 250 && - !_vm->_globals._bob[bobId]._disabledAnimationFl && xp > _vm->_globals._bob[bobId]._oldX && - xp < _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX && yp > _vm->_globals._bob[bobId]._oldY) { - if (yp < _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY) { + if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_objectsManager._bob[bobId].field0 && _vm->_objectsManager._bob[bobId]._frameIndex != 250 && + !_vm->_objectsManager._bob[bobId]._disabledAnimationFl && xp > _vm->_objectsManager._bob[bobId]._oldX && + xp < _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX && yp > _vm->_objectsManager._bob[bobId]._oldY) { + if (yp < _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY) { if (_vm->_globals.ZONEP[bobZoneId]._spriteIndex == -1) { _vm->_globals.ZONEP[bobZoneId]._destX = 0; _vm->_globals.ZONEP[bobZoneId]._destY = 0; } if (!_vm->_globals.ZONEP[bobZoneId]._destX && !_vm->_globals.ZONEP[bobZoneId]._destY) { - _vm->_globals.ZONEP[bobZoneId]._destX = _vm->_globals._bob[bobId]._oldWidth + _vm->_globals._bob[bobId]._oldX; - _vm->_globals.ZONEP[bobZoneId]._destY = _vm->_globals._bob[bobId]._oldHeight + _vm->_globals._bob[bobId]._oldY + 6; + _vm->_globals.ZONEP[bobZoneId]._destX = _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX; + _vm->_globals.ZONEP[bobZoneId]._destY = _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY + 6; _vm->_globals.ZONEP[bobZoneId]._spriteIndex = -1; } return bobZoneId; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 03ded6eb40..8173a1ff2b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -37,6 +37,8 @@ ObjectsManager::ObjectsManager() { for (int i = 0; i < 6; ++i) { Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0); } + for (int i = 0; i < 36; ++i) + Common::fill((byte *)&_bob[i], (byte *)&_bob[i] + sizeof(BobItem), 0); _helicopterFl = false; _priorityFl = false; @@ -482,7 +484,7 @@ void ObjectsManager::initBob() { } void ObjectsManager::resetBob(int idx) { - BobItem &bob = _vm->_globals._bob[idx]; + BobItem &bob = _bob[idx]; ListeItem &item = _vm->_globals.Liste2[idx]; bob.field0 = 0; @@ -513,27 +515,27 @@ void ObjectsManager::resetBob(int idx) { } void ObjectsManager::setBobInfo(int idx) { - if (!_vm->_globals._bob[idx]._activeFl) + if (!_bob[idx]._activeFl) return; - int xp = _vm->_globals._bob[idx]._oldX; - int yp = _vm->_globals._bob[idx]._oldY; + int xp = _bob[idx]._oldX; + int yp = _bob[idx]._oldY; - if (_vm->_globals._bob[idx]._isSpriteFl) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._bob[idx]._spriteData, - xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex); + if (_bob[idx]._isSpriteFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _bob[idx]._spriteData, + xp + 300, yp + 300, _bob[idx]._frameIndex); else _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, - _vm->_globals._bob[idx]._spriteData, xp + 300, yp + 300, _vm->_globals._bob[idx]._frameIndex, - _vm->_globals._bob[idx]._zoomOutFactor, _vm->_globals._bob[idx]._zooInmFactor, - _vm->_globals._bob[idx]._flipFl); + _bob[idx]._spriteData, xp + 300, yp + 300, _bob[idx]._frameIndex, + _bob[idx]._zoomOutFactor, _bob[idx]._zooInmFactor, + _bob[idx]._flipFl); _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._posX = xp; _vm->_globals.Liste2[idx]._posY = yp; - _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; - _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; + _vm->_globals.Liste2[idx]._width = _bob[idx]._oldWidth; + _vm->_globals.Liste2[idx]._height = _bob[idx]._oldHeight; if (_vm->_globals.Liste2[idx]._posX < _vm->_graphicsManager._minX) { _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste2[idx]._posX; @@ -565,7 +567,7 @@ void ObjectsManager::setBobInfo(int idx) { void ObjectsManager::BOB_VISU(int idx) { _priorityFl = true; - if (_vm->_globals._bob[idx].field0) + if (_bob[idx].field0) return; resetBob(idx); @@ -588,31 +590,31 @@ void ObjectsManager::BOB_VISU(int idx) { if (!v6) v6 = -1; - _vm->_globals._bob[idx]._isSpriteFl = false; + _bob[idx]._isSpriteFl = false; if (_vm->_globals.Bank[bankIdx]._fileHeader == 1) { - _vm->_globals._bob[idx]._isSpriteFl = true; - _vm->_globals._bob[idx]._zoomFactor = 0; - _vm->_globals._bob[idx]._flipFl = false; + _bob[idx]._isSpriteFl = true; + _bob[idx]._zoomFactor = 0; + _bob[idx]._flipFl = false; } - _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; - _vm->_globals._bob[idx].field0 = 10; - _vm->_globals._bob[idx]._spriteData = _vm->_globals.Bank[bankIdx]._data; + _bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _bob[idx].field0 = 10; + _bob[idx]._spriteData = _vm->_globals.Bank[bankIdx]._data; - _vm->_globals._bob[idx].field1E = v9; - _vm->_globals._bob[idx].field20 = v6; - _vm->_globals._bob[idx].field22 = v8; - _vm->_globals._bob[idx]._offsetY = offsetY; + _bob[idx].field1E = v9; + _bob[idx].field20 = v6; + _bob[idx].field22 = v8; + _bob[idx]._offsetY = offsetY; } void ObjectsManager::BOB_OFF(int idx) { - if ((_vm->_globals._bob[idx].field0 == 3) || (_vm->_globals._bob[idx].field0 == 10)) - _vm->_globals._bob[idx].field0++; + if ((_bob[idx].field0 == 3) || (_bob[idx].field0 == 10)) + _bob[idx].field0++; } void ObjectsManager::BOB_OFFSET(int idx, int offset) { - _vm->_globals._bob[idx]._oldX2 = offset; + _bob[idx]._oldX2 = offset; } void ObjectsManager::SCBOB(int idx) { @@ -620,17 +622,17 @@ void ObjectsManager::SCBOB(int idx) { return; for (int i = 0; i <= 20; i++) { - if ((_vm->_globals._bob[i].field0) && (!_vm->_globals._bob[i]._disabledAnimationFl) && (!_vm->_globals._bob[i].field34) && (_vm->_globals._bob[i]._frameIndex != 250)) { - int oldRight = _vm->_globals._bob[i]._oldX + _vm->_globals._bob[i]._oldWidth; - int oldBottom = _vm->_globals._bob[i]._oldY + _vm->_globals._bob[i]._oldHeight; + if ((_bob[i].field0) && (!_bob[i]._disabledAnimationFl) && (!_bob[i].field34) && (_bob[i]._frameIndex != 250)) { + int oldRight = _bob[i]._oldX + _bob[i]._oldWidth; + int oldBottom = _bob[i]._oldY + _bob[i]._oldHeight; int cachedRight = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x; if ((oldBottom > _vm->_globals.Cache[idx]._y) && (oldBottom < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) { if ((oldRight >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) - || (cachedRight >= _vm->_globals._bob[i]._oldWidth && _vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) - || (cachedRight >= _vm->_globals._bob[i]._oldWidth && _vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) - || (_vm->_globals._bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) - || (_vm->_globals._bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight)) + || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) + || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) + || (_bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) + || (_bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight)) ++_vm->_globals.Cache[idx]._useCount; } } @@ -638,33 +640,33 @@ void ObjectsManager::SCBOB(int idx) { } void ObjectsManager::CALCUL_BOB(int idx) { - _vm->_globals._bob[idx]._activeFl = false; - if (_vm->_globals._bob[idx]._isSpriteFl) { - _vm->_globals._bob[idx]._flipFl = false; - _vm->_globals._bob[idx]._zoomFactor = 0; + _bob[idx]._activeFl = false; + if (_bob[idx]._isSpriteFl) { + _bob[idx]._flipFl = false; + _bob[idx]._zoomFactor = 0; } - int spriteIdx = _vm->_globals._bob[idx]._frameIndex; + int spriteIdx = _bob[idx]._frameIndex; if (spriteIdx == 250) return; int deltaY, deltaX; - if (_vm->_globals._bob[idx]._flipFl) { - deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, spriteIdx, true); - deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, true); + if (_bob[idx]._flipFl) { + deltaX = getOffsetX(_bob[idx]._spriteData, spriteIdx, true); + deltaY = getOffsetY(_bob[idx]._spriteData, _bob[idx]._frameIndex, true); } else { - deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, spriteIdx, false); - deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, false); + deltaX = getOffsetX(_bob[idx]._spriteData, spriteIdx, false); + deltaY = getOffsetY(_bob[idx]._spriteData, _bob[idx]._frameIndex, false); } int negZoom = 0; int posZoom = 0; - if (_vm->_globals._bob[idx]._zoomFactor < 0) { - negZoom = -_vm->_globals._bob[idx]._zoomFactor; + if (_bob[idx]._zoomFactor < 0) { + negZoom = -_bob[idx]._zoomFactor; if (negZoom > 95) negZoom = 95; } else - posZoom = _vm->_globals._bob[idx]._zoomFactor; + posZoom = _bob[idx]._zoomFactor; if (posZoom) { if (deltaX >= 0) @@ -690,20 +692,20 @@ void ObjectsManager::CALCUL_BOB(int idx) { deltaY = -_vm->_graphicsManager.zoomOut(abs(deltaX), negZoom); } - int newX = _vm->_globals._bob[idx]._xp - deltaX; - int newY = _vm->_globals._bob[idx]._yp - deltaY; - _vm->_globals._bob[idx]._activeFl = true; - _vm->_globals._bob[idx]._oldX = newX; - _vm->_globals._bob[idx]._oldY = newY; - _vm->_globals._bob[idx]._zooInmFactor = posZoom; - _vm->_globals._bob[idx]._zoomOutFactor = negZoom; + int newX = _bob[idx]._xp - deltaX; + int newY = _bob[idx]._yp - deltaY; + _bob[idx]._activeFl = true; + _bob[idx]._oldX = newX; + _bob[idx]._oldY = newY; + _bob[idx]._zooInmFactor = posZoom; + _bob[idx]._zoomOutFactor = negZoom; _vm->_globals.Liste2[idx]._visibleFl = true; _vm->_globals.Liste2[idx]._posX = newX; _vm->_globals.Liste2[idx]._posY = newY; - int width = getWidth(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); - int height = getHeight(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex); + int width = getWidth(_bob[idx]._spriteData, _bob[idx]._frameIndex); + int height = getHeight(_bob[idx]._spriteData, _bob[idx]._frameIndex); if (posZoom) { width = _vm->_graphicsManager.zoomIn(width, posZoom); @@ -716,8 +718,8 @@ void ObjectsManager::CALCUL_BOB(int idx) { _vm->_globals.Liste2[idx]._width = width; _vm->_globals.Liste2[idx]._height = height; - _vm->_globals._bob[idx]._oldWidth = width; - _vm->_globals._bob[idx]._oldHeight = height; + _bob[idx]._oldWidth = width; + _bob[idx]._oldHeight = height; } void ObjectsManager::checkCache() { @@ -725,7 +727,7 @@ void ObjectsManager::checkCache() { if (_vm->_globals.Cache[cacheIdx]._useCount == 0) continue; - int _oldEnableCount = _vm->_globals.Cache[cacheIdx]._useCount; + int _oldUseCount = _vm->_globals.Cache[cacheIdx]._useCount; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; @@ -744,7 +746,7 @@ void ObjectsManager::checkCache() { } SCBOB(cacheIdx); - if (_vm->_globals.Cache[cacheIdx]._useCount == _oldEnableCount) { + if (_vm->_globals.Cache[cacheIdx]._useCount == _oldUseCount) { if (_vm->_globals.Cache[cacheIdx].field10) { _vm->_globals.Cache[cacheIdx].field10 = false; _vm->_globals.Cache[cacheIdx]._useCount = 1; @@ -906,106 +908,106 @@ void ObjectsManager::beforeSort(SortMode sortMode, int index, int priority) { void ObjectsManager::displayBobAnim() { for (int idx = 1; idx <= 35; idx++) { if (idx <= 20 && PERSO_ON) { - _vm->_globals._bob[idx].field1C = false; + _bob[idx].field1C = false; continue; } - if (_vm->_globals._bob[idx].field0 != 10) + if (_bob[idx].field0 != 10) continue; - _vm->_globals._bob[idx].field1C = false; - int v1 = _vm->_globals._bob[idx].field20; + _bob[idx].field1C = false; + int v1 = _bob[idx].field20; if (v1 == -1) v1 = 50; - if (_vm->_globals._bob[idx]._animData == g_PTRNUL || _vm->_globals._bob[idx]._disabledAnimationFl || v1 <= 0) { - if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) - _vm->_globals._bob[idx].field1C = true; + if (_bob[idx]._animData == g_PTRNUL || _bob[idx]._disabledAnimationFl || v1 <= 0) { + if (_bob[idx].field1E == 1 || _bob[idx].field1E == 2) + _bob[idx].field1C = true; continue; } - if (_vm->_globals._bob[idx].field12 == _vm->_globals._bob[idx].field14) { - _vm->_globals._bob[idx].field1C = true; + if (_bob[idx].field12 == _bob[idx].field14) { + _bob[idx].field1C = true; } else { - _vm->_globals._bob[idx].field14++; - _vm->_globals._bob[idx].field1C = false; + _bob[idx].field14++; + _bob[idx].field1C = false; } - if (!_vm->_globals._bob[idx].field1C) { - if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) - _vm->_globals._bob[idx].field1C = true; + if (!_bob[idx].field1C) { + if (_bob[idx].field1E == 1 || _bob[idx].field1E == 2) + _bob[idx].field1C = true; continue; } - byte *dataPtr = _vm->_globals._bob[idx]._animData + 20; - int dataIdx = _vm->_globals._bob[idx]._animDataIdx; - _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx); + byte *dataPtr = _bob[idx]._animData + 20; + int dataIdx = _bob[idx]._animDataIdx; + _bob[idx]._xp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx); if (_vm->_globals._lockedAnims[idx]._enableFl) - _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; + _bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if ( PERSO_ON && idx > 20 ) - _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; + _bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 2); - _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 4); - _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 6); - _vm->_globals._bob[idx]._frameIndex = dataPtr[2 * dataIdx + 8]; - _vm->_globals._bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0); - _vm->_globals._bob[idx]._animDataIdx += 5; + _bob[idx]._yp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 2); + _bob[idx].field12 = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 4); + _bob[idx]._zoomFactor = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 6); + _bob[idx]._frameIndex = dataPtr[2 * dataIdx + 8]; + _bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0); + _bob[idx]._animDataIdx += 5; - int v5 = _vm->_globals._bob[idx].field12; + int v5 = _bob[idx].field12; if (v5 > 0) { int v6 = v5 / _vm->_globals._speed; - _vm->_globals._bob[idx].field12 = v5 / _vm->_globals._speed; + _bob[idx].field12 = v5 / _vm->_globals._speed; if (v6 > 0) { - _vm->_globals._bob[idx].field14 = 1; - if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) - _vm->_globals._bob[idx].field1C = true; + _bob[idx].field14 = 1; + if (_bob[idx].field1E == 1 || _bob[idx].field1E == 2) + _bob[idx].field1C = true; continue; } - _vm->_globals._bob[idx].field12 = 1; + _bob[idx].field12 = 1; } - if (!_vm->_globals._bob[idx].field12) { - if (_vm->_globals._bob[idx].field20 > 0) - _vm->_globals._bob[idx].field20--; - if (_vm->_globals._bob[idx].field20 != -1 && _vm->_globals._bob[idx].field20 <= 0) { - _vm->_globals._bob[idx].field0 = 11; + if (!_bob[idx].field12) { + if (_bob[idx].field20 > 0) + _bob[idx].field20--; + if (_bob[idx].field20 != -1 && _bob[idx].field20 <= 0) { + _bob[idx].field0 = 11; } else { - _vm->_globals._bob[idx]._animDataIdx = 0; - byte *v21 = _vm->_globals._bob[idx]._animData + 20; - _vm->_globals._bob[idx]._xp = (int16)READ_LE_UINT16(v21); + _bob[idx]._animDataIdx = 0; + byte *v21 = _bob[idx]._animData + 20; + _bob[idx]._xp = (int16)READ_LE_UINT16(v21); if (_vm->_globals._lockedAnims[idx]._enableFl) - _vm->_globals._bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; + _bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if (PERSO_ON && idx > 20) - _vm->_globals._bob[idx]._xp += _vm->_eventsManager._startPos.x; + _bob[idx]._xp += _vm->_eventsManager._startPos.x; - _vm->_globals._bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); - _vm->_globals._bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); - _vm->_globals._bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6); - _vm->_globals._bob[idx]._frameIndex = v21[8]; - _vm->_globals._bob[idx]._flipFl = (v21[9] != 0); - _vm->_globals._bob[idx]._animDataIdx += 5; - int v10 = _vm->_globals._bob[idx].field12; + _bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); + _bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); + _bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6); + _bob[idx]._frameIndex = v21[8]; + _bob[idx]._flipFl = (v21[9] != 0); + _bob[idx]._animDataIdx += 5; + int v10 = _bob[idx].field12; if (v10 > 0) { int v11 = v10 / _vm->_globals._speed; - _vm->_globals._bob[idx].field12 = v11; + _bob[idx].field12 = v11; // Original code. It can't be negative, so the check is on == 0 if (v11 <= 0) - _vm->_globals._bob[idx].field12 = 1; + _bob[idx].field12 = 1; } } } - _vm->_globals._bob[idx].field14 = 1; - if (_vm->_globals._bob[idx].field1E == 1 || _vm->_globals._bob[idx].field1E == 2) - _vm->_globals._bob[idx].field1C = true; + _bob[idx].field14 = 1; + if (_bob[idx].field1E == 1 || _bob[idx].field1E == 2) + _bob[idx].field1C = true; } if (!PERSO_ON && BOBTOUS) { for (int i = 0; i < 35; i++) { - if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl) - _vm->_globals._bob[i].field1C = true; + if (_bob[i].field0 == 10 && !_bob[i]._disabledAnimationFl) + _bob[i].field1C = true; } } @@ -1013,8 +1015,8 @@ void ObjectsManager::displayBobAnim() { for (int i = 1; i <= 35; i++) { if (i > 20 || !PERSO_ON) { - if ((_vm->_globals._bob[i].field0 == 10) && (_vm->_globals._bob[i].field1C)) { - if ((_vm->_globals._bob[i].field1E != 2) && (_vm->_globals._bob[i].field1E != 4)) { + if ((_bob[i].field0 == 10) && (_bob[i].field1C)) { + if ((_bob[i].field1E != 2) && (_bob[i].field1E != 4)) { if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, @@ -1026,7 +1028,7 @@ void ObjectsManager::displayBobAnim() { } } - if (_vm->_globals._bob[i].field0 == 11) { + if (_bob[i].field0 == 11) { if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_globals.Liste2[i]._posX, _vm->_globals.Liste2[i]._posY, @@ -1036,21 +1038,21 @@ void ObjectsManager::displayBobAnim() { _vm->_globals.Liste2[i]._visibleFl = false; } - _vm->_globals._bob[i].field0 = 0; + _bob[i].field0 = 0; } } } for (int i = 1; i <= 35; i++) { - _vm->_globals._bob[i]._oldY = 0; - if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl && _vm->_globals._bob[i].field1C) { + _bob[i]._oldY = 0; + if (_bob[i].field0 == 10 && !_bob[i]._disabledAnimationFl && _bob[i].field1C) { CALCUL_BOB(i); - int v19 = _vm->_globals._bob[i]._oldX2 + _vm->_globals._bob[i]._oldHeight + _vm->_globals._bob[i]._oldY; + int v19 = _bob[i]._oldX2 + _bob[i]._oldHeight + _bob[i]._oldY; if (v19 > 450) v19 = 600; - if (_vm->_globals._bob[i]._activeFl) + if (_bob[i]._activeFl) beforeSort(SORT_BOB, i, v19); } } @@ -3080,57 +3082,57 @@ void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction if (!animAction) stopBobAnimation(idx); else if (animAction == 4) { - _vm->_graphicsManager.fastDisplay(_vm->_globals._bob[idx]._spriteData, - _vm->_globals._bob[idx]._oldX, _vm->_globals._bob[idx]._oldY, _vm->_globals._bob[idx]._frameIndex); + _vm->_graphicsManager.fastDisplay(_bob[idx]._spriteData, + _bob[idx]._oldX, _bob[idx]._oldY, _bob[idx]._frameIndex); stopBobAnimation(idx); _vm->_eventsManager.VBL(); } } int ObjectsManager::getBobAnimDataIdx(int idx) { - return _vm->_globals._bob[idx]._animDataIdx / 5; + return _bob[idx]._animDataIdx / 5; } void ObjectsManager::setBobAnimDataIdx(int idx, int animIdx) { - _vm->_globals._bob[idx]._animDataIdx = 5 * animIdx; - _vm->_globals._bob[idx].field12 = 0; - _vm->_globals._bob[idx].field14 = 0; + _bob[idx]._animDataIdx = 5 * animIdx; + _bob[idx].field12 = 0; + _bob[idx].field14 = 0; } /** * Set Hopkins animation */ void ObjectsManager::setBobAnimation(int idx) { - if (!_vm->_globals._bob[idx]._disabledAnimationFl) + if (!_bob[idx]._disabledAnimationFl) return; - _vm->_globals._bob[idx]._disabledAnimationFl = false; - _vm->_globals._bob[idx]._animDataIdx = 5; - _vm->_globals._bob[idx]._frameIndex = 250; - _vm->_globals._bob[idx].field12 = 0; - _vm->_globals._bob[idx].field14 = 0; + _bob[idx]._disabledAnimationFl = false; + _bob[idx]._animDataIdx = 5; + _bob[idx]._frameIndex = 250; + _bob[idx].field12 = 0; + _bob[idx].field14 = 0; } /** * Stop Hopkins animation */ void ObjectsManager::stopBobAnimation(int idx) { - _vm->_globals._bob[idx]._disabledAnimationFl = true; + _bob[idx]._disabledAnimationFl = true; } /** * Get X position */ int ObjectsManager::getBobPosX(int idx) { - return _vm->_globals._bob[idx]._xp; + return _bob[idx]._xp; } int ObjectsManager::getBobPosY(int idx) { - return _vm->_globals._bob[idx]._yp; + return _bob[idx]._yp; } int ObjectsManager::getBobFrameIndex(int idx) { - return _vm->_globals._bob[idx]._frameIndex; + return _bob[idx]._frameIndex; } void ObjectsManager::INILINK(const Common::String &file) { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 424b57de99..a75e36acd5 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -50,6 +50,36 @@ struct SpriteItem { int _reducePct; }; +struct BobItem { + int field0; + byte *_spriteData; + int _xp; + int _yp; + int _frameIndex; + int _animDataIdx; + int field12; + int field14; + bool _disabledAnimationFl; + byte *_animData; + bool field1C; + int field1E; + int field20; + int field22; + int _offsetY; // Unused variable? + bool field34; // Set to true in B_CACHE_OFF() + int _zoomFactor; + bool _flipFl; + bool _isSpriteFl; + bool _activeFl; + int _oldX; + int _oldY; + int _oldWidth; + int _oldHeight; + int _oldX2; + int _zooInmFactor; + int _zoomOutFactor; +}; + class HopkinsEngine; class ObjectsManager { @@ -133,6 +163,7 @@ public: byte *_saveLoadSprite; byte *_saveLoadSprite2; SpriteItem _sprite[6]; + BobItem _bob[36]; bool PERSO_ON; bool BOBTOUS; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 338144b4b5..f0d3a38bce 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -595,24 +595,24 @@ void TalkManager::VISU_PARLE() { void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_objectsManager._priorityFl = true; - if (!_vm->_globals._bob[idx].field0) { + if (!_vm->_objectsManager._bob[idx].field0) { _vm->_objectsManager.resetBob(idx); byte *v5 = _vm->_globals.Bqe_Anim[idx]._data; int v4 = (int16)READ_LE_UINT16(v5 + 2); if (!v4) v4 = 1; if ((int16)READ_LE_UINT16(v5 + 24)) { - _vm->_globals._bob[idx]._isSpriteFl = true; - _vm->_globals._bob[idx]._zoomFactor = 0; - _vm->_globals._bob[idx]._flipFl = false; - _vm->_globals._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; - _vm->_globals._bob[idx].field0 = 10; + _vm->_objectsManager._bob[idx]._isSpriteFl = true; + _vm->_objectsManager._bob[idx]._zoomFactor = 0; + _vm->_objectsManager._bob[idx]._flipFl = false; + _vm->_objectsManager._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _vm->_objectsManager._bob[idx].field0 = 10; v5 = _characterSprite; - _vm->_globals._bob[idx]._spriteData = _characterSprite; - _vm->_globals._bob[idx].field1E = v4; - _vm->_globals._bob[idx].field20 = -1; - _vm->_globals._bob[idx].field22 = 0; - _vm->_globals._bob[idx]._offsetY = 0; + _vm->_objectsManager._bob[idx]._spriteData = _characterSprite; + _vm->_objectsManager._bob[idx].field1E = v4; + _vm->_objectsManager._bob[idx].field20 = -1; + _vm->_objectsManager._bob[idx].field22 = 0; + _vm->_objectsManager._bob[idx]._offsetY = 0; } } } -- cgit v1.2.3 From 425830af878061967b4a8c4dbe41e8d146877d3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Feb 2013 00:36:43 +0100 Subject: HOPKINS: Some renaming and refactoring in ComputerManager and FontManager --- engines/hopkins/computer.cpp | 11 +++++------ engines/hopkins/font.cpp | 43 ++++++++++++++++++------------------------- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 12ac40e6d8..6a4459857e 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -706,8 +706,7 @@ void ComputerManager::displayLives() { * Main function for breakout game */ void ComputerManager::playBreakout() { - int v1 = 0; - + int lastBreakoutEvent = 0; while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) { // Set up the racket and ball @@ -747,10 +746,10 @@ void ComputerManager::playBreakout() { if (_padPositionX > 282) _padPositionX = 282; _vm->_objectsManager.setSpriteX(0, _padPositionX); - v1 = moveBall(); + lastBreakoutEvent = moveBall(); _vm->_eventsManager.VBL(); - } while (!_vm->shouldQuit() && !v1); - if (v1 != 1) + } while (!_vm->shouldQuit() && !lastBreakoutEvent); + if (lastBreakoutEvent != 1) break; _vm->_graphicsManager.fateOutBreakout(); --_breakoutLives; @@ -778,7 +777,7 @@ void ComputerManager::playBreakout() { loadHiscore(); newLevel(); } - if (v1 != 2) + if (lastBreakoutEvent != 2) return; _vm->_graphicsManager.fateOutBreakout(); newLevel(); diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index b9ee2d886f..679847174c 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -140,7 +140,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in Common::String file; Common::File f; - int v73 = xp; + int textPosX = xp; if (idx < 0) error("Bad number for text"); _fontFixedWidth = 11; @@ -259,7 +259,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (v17 < 0) v17 = -v17; _text[idx]._pos.x = 320 - v17; - v73 = _vm->_eventsManager._startPos.x + 320 - v17; + textPosX = _vm->_eventsManager._startPos.x + 320 - v17; lineCount = 1; // CHECKME: textLength should be always positive... if (textLength + 1 > 0) { @@ -289,7 +289,6 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in break; } } - int v20 = lineCount; // WORKAROUND: Perhaps due to the usage of ScummVM strings here, recalculate what the // actual length of the line to be copied will be. Otherwise, you can see artifacts, @@ -298,7 +297,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in while (actualSize < lineSize && _tempText[v65 + actualSize]) ++actualSize; - _text[idx]._lines[v20] = Common::String((const char *)_tempText + v65, actualSize); + _text[idx]._lines[lineCount] = Common::String((const char *)_tempText + v65, actualSize); _textSortArray[lineCount++] = lineSize; v65 += lineSize; @@ -320,8 +319,8 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } } for (int i = 0; i <= 19; i++) { - for (int v25 = i + 1; v25 != i; v25 = (v25 + 1) % 20) { - if (_textSortArray[i] < _textSortArray[v25]) + for (int j = i + 1; j != i; j = (j + 1) % 20) { + if (_textSortArray[i] < _textSortArray[j]) _textSortArray[i] = 0; } }; @@ -336,33 +335,27 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in for (i = xp - _vm->_eventsManager._startPos.x; _vm->_globals._boxWidth + i > 638 && i > -2 && _text[idx]._textType; i -= 2) ; _text[idx]._pos.x = i; - v73 = _vm->_eventsManager._startPos.x + i; + textPosX = _vm->_eventsManager._startPos.x + i; } else { if (_vm->_globals.nbrligne == (SCREEN_WIDTH - 1)) { - while (_vm->_globals._boxWidth + v73 > 638 && v73 > -2) - v73 -= 2; + while (_vm->_globals._boxWidth + textPosX > 638 && textPosX > -2) + textPosX -= 2; } if (_vm->_globals.nbrligne == (SCREEN_WIDTH * 2)) { - while (_vm->_globals._boxWidth + v73 > 1278 && v73 > -2) - v73 -= 2; + while (_vm->_globals._boxWidth + textPosX > 1278 && textPosX > -2) + textPosX -= 2; } - _text[idx]._pos.x = v73; + _text[idx]._pos.x = textPosX; } } - int posX = v73; + int posX = textPosX; int posY = yp; int saveWidth = _vm->_globals._boxWidth + 10; int saveHeight = (_fontFixedHeight + 1) * lineCount + 12; if (_text[idx]._textType == 6) { - int v27 = saveWidth / 2; - if (v27 < 0) - v27 = -v27; - _text[idx]._pos.x = 315 - v27; - int v28 = _vm->_eventsManager._startPos.x + 315 - v27; - v73 = _vm->_eventsManager._startPos.x + 315 - v27; - _text[idx]._pos.y = 50; - posY = 50; - posX = v28; + _text[idx]._pos.x = 315 - abs(saveWidth / 2); + textPosX = posX = _vm->_eventsManager._startPos.x + _text[idx]._pos.x; + _text[idx]._pos.y = posY = 50; } int textType = _text[idx]._textType; if (textType == 1 || textType == 3 || textType == 5 || textType == 6) { @@ -382,11 +375,11 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, saveWidth + posX, posY, saveHeight, (byte)-2); } _text[idx]._lineCount = lineCount; - int v71 = posY + 5; + int textPosY = posY + 5; for (int lineNum = 0; lineNum < lineCount; ++lineNum) { - displayText(v73 + 5, v71, _text[idx]._lines[lineNum], _text[idx]._color); - v71 += _fontFixedHeight + 1; + displayText(textPosX + 5, textPosY, _text[idx]._lines[lineNum], _text[idx]._color); + textPosY += _fontFixedHeight + 1; } int blockWidth = saveWidth + 1; -- cgit v1.2.3 From ccd688be8461bc525a350abf8b1342cc0f1ae348 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 11 Feb 2013 06:05:00 +0100 Subject: HOPKINS: Fix GCC warning --- engines/hopkins/talk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f0d3a38bce..ec5b1f518b 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -790,7 +790,7 @@ void TalkManager::REPONSE(int zone, int verb) { int v12 = 0; bool innerLoopCond = false; do { - bool tagFound = false; + tagFound = false; if (READ_BE_UINT16(&curAnswerBuf[v7]) == MKTAG16('F', 'C')) { ++v12; assert(v12 < (620 / 20)); -- cgit v1.2.3 From 89c1793865dfdfbe7661b89b9510f1e9e789bee2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Feb 2013 07:52:49 +0100 Subject: HOPKINS: Some more renaming and refactoring in FontManager --- engines/hopkins/font.cpp | 127 ++++++++++++++++++++--------------------------- 1 file changed, 54 insertions(+), 73 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 679847174c..90f73cfdbe 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -134,12 +134,6 @@ void FontManager::initTextBuffers(int idx, int messageId, const Common::String & // Box void FontManager::box(int idx, int messageId, const Common::String &filename, int xp, int yp) { - byte *v9; - byte *ptre; - Common::String s; - Common::String file; - Common::File f; - int textPosX = xp; if (idx < 0) error("Bad number for text"); @@ -168,17 +162,18 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } } else { int lineCount = 0; - for (int v62 = 0; v62 <= 19; v62++) - _textSortArray[v62] = 0; + for (int i = 0; i <= 19; i++) + _textSortArray[i] = 0; _text[idx]._textLoadedFl = true; - file = filename; + Common::String file = filename; if (strncmp(file.c_str(), _oldName.c_str(), strlen(file.c_str())) != 0) { // Starting to access a new file, so read in the index file for the file _oldName = file; _indexName = Common::String(file.c_str(), file.size() - 3); _indexName += "IND"; + Common::File f; if (!f.open(_indexName)) error("Error opening file - %s", _indexName.c_str()); int filesize = f.size(); @@ -186,12 +181,13 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _index[i] = f.readUint32LE(); f.close(); } - int v69; + int bufSize; if (filename[0] != 'Z' || filename[1] != 'O') { + Common::File f; if (!f.open(file)) error("Error opening file - %s", _indexName.c_str()); - v69 = 2048; + bufSize = 2048; f.seek(_index[messageId]); _tempText = _vm->_globals.allocMemory(2058); @@ -202,90 +198,76 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in f.read(_tempText, 2048); f.close(); } else { - v69 = 100; - v9 = _vm->_globals.allocMemory(110); - Common::fill(&v9[0], &v9[110], 0); - - _tempText = v9; - const byte *v10 = _vm->_globals.BUF_ZONE + _index[messageId]; - memcpy(v9, v10, 96); - WRITE_LE_UINT16((uint16 *)v9 + 48, (int16)READ_LE_UINT16(v10 + 96)); + bufSize = 100; + _tempText = _vm->_globals.allocMemory(110); + Common::fill(&_tempText[0], &_tempText[110], 0); + memcpy(_tempText, _vm->_globals.BUF_ZONE + _index[messageId], 96); + WRITE_LE_UINT16((uint16 *)_tempText + 48, (int16)READ_LE_UINT16(_vm->_globals.BUF_ZONE + _index[messageId] + 96)); } - byte *v59 = _tempText; - for (int v63 = 0; v63 < v69; v63++) { - byte v13 = *v59; - if ((byte)(*v59 + 46) > 27) { - if ((byte)(v13 + 80) > 27) { - if ((byte)(v13 - 65) <= 25 || (byte)(v13 - 97) <= 25) - v13 = 32; + byte *curTempTextPtr = _tempText; + for (int i = 0; i < bufSize; i++) { + byte curChar = *curTempTextPtr; + if ((byte)(*curTempTextPtr + 46) > 27) { + if ((byte)(curChar + 80) > 27) { + if ((byte)(curChar - 65) <= 25 || (byte)(curChar - 97) <= 25) + curChar = 32; } else { - v13 -= 79; + curChar -= 79; } } else { - v13 += 111; + curChar += 111; } - *v59 = v13; - v59++; + *curTempTextPtr = curChar; + curTempTextPtr++; }; - int textLength = 0; - if (v69) { - for (;;) { - byte curChar = _tempText[textLength]; - if (curChar == '\r' || curChar == '\n') { - _tempText[textLength] = 0; - if (!_text[idx]._length) - break; - } - ++textLength; - if (v69 <= textLength) + int textLength; + for (textLength = 0; textLength < bufSize; textLength++) { + byte curChar = _tempText[textLength]; + if (curChar == '\r' || curChar == '\n') { + _tempText[textLength] = 0; + if (!_text[idx]._length) break; } } - if (v69 && v69 > textLength) { + if (bufSize && bufSize > textLength) { _text[idx]._length = textLength; _vm->_globals._boxWidth = 0; - for (int v15 = 0; v15 < textLength + 1; v15++) { - byte v16 = _tempText[v15]; - if (v16 <= 31) - v16 = ' '; - _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_font, v16 - 32); + for (int curStrIdx = 0; curStrIdx < textLength + 1; curStrIdx++) { + byte curChar = _tempText[curStrIdx]; + if (curChar <= 31) + curChar = ' '; + _vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_font, curChar - 32); } _vm->_globals._boxWidth += 2; - int v17 = _vm->_globals._boxWidth / 2; - if (v17 < 0) - v17 = -v17; - _text[idx]._pos.x = 320 - v17; - textPosX = _vm->_eventsManager._startPos.x + 320 - v17; + _text[idx]._pos.x = 320 - abs(_vm->_globals._boxWidth / 2); + textPosX = _vm->_eventsManager._startPos.x + _text[idx]._pos.x; lineCount = 1; - // CHECKME: textLength should be always positive... - if (textLength + 1 > 0) { - _text[idx]._lines[0] = Common::String((const char *)_tempText, textLength); - } + _text[idx]._lines[0] = Common::String((const char *)_tempText, textLength); } else { if (!_vm->_globals._boxWidth) _vm->_globals._boxWidth = 240; - int v65 = 0; + int tempTextIdx = 0; int lineSize; byte curChar; do { - int v19 = 0; + int curLineSize = 0; int ptrb = _vm->_globals._boxWidth - 4; for (;;) { - lineSize = v19; + lineSize = curLineSize; do - curChar = _tempText[v65 + v19++]; + curChar = _tempText[tempTextIdx + curLineSize++]; while (curChar != ' ' && curChar != '%'); - if (v19 >= ptrb / _fontFixedWidth) { + if (curLineSize >= ptrb / _fontFixedWidth) { if (curChar == '%') curChar = ' '; break; } if (curChar == '%') { - lineSize = v19; + lineSize = curLineSize; break; } } @@ -294,13 +276,13 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in // actual length of the line to be copied will be. Otherwise, you can see artifacts, // such as a single character beyond the end of string NULL. int actualSize = 0; - while (actualSize < lineSize && _tempText[v65 + actualSize]) + while (actualSize < lineSize && _tempText[tempTextIdx + actualSize]) ++actualSize; - _text[idx]._lines[lineCount] = Common::String((const char *)_tempText + v65, actualSize); + _text[idx]._lines[lineCount] = Common::String((const char *)_tempText + tempTextIdx, actualSize); _textSortArray[lineCount++] = lineSize; - v65 += lineSize; + tempTextIdx += lineSize; } while (curChar != '%'); for (int i = 0; i <= 19; i++) { @@ -308,12 +290,12 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _textSortArray[i] = 0; } else { int ptrc = 0; - for (int v23 = 0; v23 < _textSortArray[i] - 1; v23++) { + for (int curIdx = 0; curIdx < _textSortArray[i] - 1; curIdx++) { Common::String &line = _text[idx]._lines[i]; - byte v24 = (v23 >= (int)line.size()) ? '\0' : line.c_str()[v23]; - if (v24 <= 32) - v24 = ' '; - ptrc += _vm->_objectsManager.getWidth(_font, (byte)v24 - 32); + byte curChar = (curIdx >= (int)line.size()) ? '\0' : line.c_str()[curIdx]; + if (curChar <= 31) + curChar = ' '; + ptrc += _vm->_objectsManager.getWidth(_font, (byte)curChar - 32); } _textSortArray[i] = ptrc; } @@ -391,7 +373,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (textType == 6 || textType == 1 || textType == 3 || textType == 5) { _text[idx]._textBlock = _vm->_globals.freeMemory(_text[idx]._textBlock); int blockSize = blockHeight * blockWidth; - ptre = _vm->_globals.allocMemory(blockSize + 20); + byte *ptre = _vm->_globals.allocMemory(blockSize + 20); if (ptre == g_PTRNUL) error("Cutting a block for text box (%d)", blockSize); @@ -408,13 +390,12 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in * Directly display text (using a VESA segment) */ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, int col) { - char currChar; int charIndex; int currentX = xp; const char *srcP = message.c_str(); for (;;) { - currChar = *srcP++; + char currChar = *srcP++; if (!currChar) break; if (currChar >= 32) { -- cgit v1.2.3 From c41a5fd1126dc88d7aef6efcafa6cd9f0a4cc4ee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Feb 2013 08:04:20 +0100 Subject: HOPKINS: Some more renaming and refactoring in Globals --- engines/hopkins/globals.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index d4bbc89824..bd20b82ec9 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -422,27 +422,22 @@ void Globals::CACHE_ADD(int idx) { // Load Cache void Globals::loadCache(const Common::String &file) { - byte *v2 = g_PTRNUL; - byte *spriteData; - byte *ptr; - Common::String v16; - Common::File f; - resetCache(); - ptr = _vm->_fileManager.loadFile(file); - v16 = Common::String((const char *)ptr); + byte *ptr = _vm->_fileManager.loadFile(file); + Common::String filename = Common::String((const char *)ptr); - if (!f.exists(v16)) + Common::File f; + if (!f.exists(filename)) return; - spriteData = _vm->_fileManager.loadFile(v16); + byte *spriteData = _vm->_fileManager.loadFile(filename); CACHE_BANQUE[1] = spriteData; - int v15 = 60; + int curBufIdx = 60; for (int i = 0; i <= 21; i++) { - Cache[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + v15); - Cache[i]._x = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 1); - Cache[i]._y = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 2); - Cache[i].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + v15 + 4); + Cache[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx); + Cache[i]._x = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 1); + Cache[i]._y = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 2); + Cache[i].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 4); if (spriteData == g_PTRNUL) { Cache[i]._useCount = 0; } else { @@ -454,11 +449,10 @@ void Globals::loadCache(const Common::String &file) { if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) Cache[i]._useCount = 0; - v15 += 5; + curBufIdx += 5; } CACHE_ON(); - v2 = ptr; - freeMemory(v2); + freeMemory(ptr); } } // End of namespace Hopkins -- cgit v1.2.3 From 2634c65d2ff4a83f745e9c204372991472eebb30 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Feb 2013 08:04:07 +0100 Subject: HOPKINS: Minor refactoring in GraphicManager --- engines/hopkins/graphics.cpp | 82 +++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 55 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 03d79e376e..221558f592 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -326,27 +326,18 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte } void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte *palette) { - size_t filesize; - int v4; - size_t v5; - size_t v7; - byte v9; - int v10; - char v12; - int v15; - int v16; - int32 v17; - byte *ptr; Common::File f; - if (!f.open(file)) error("File not found - %s", file.c_str()); - filesize = f.size(); + size_t filesize = f.size(); f.read(surface, 128); - v4 = filesize - 896; - ptr = _vm->_globals.allocMemory(65024); + int v4 = filesize - 896; + byte *ptr = _vm->_globals.allocMemory(65024); + size_t v5; + int v15; + int v17; if (v4 >= 64000) { v15 = v4 / 64000 + 1; v17 = 64000 * (v4 / 64000) - v4; @@ -360,8 +351,8 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte f.read(ptr, v4); v5 = v4; } - v16 = v15 - 1; - v7 = 0; + int v16 = v15 - 1; + size_t v7 = 0; for (int i = 0; i < 64000; i++) { if (v7 == v5) { v7 = 0; @@ -371,9 +362,9 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte v5 = v17; f.read(ptr, v5); } - v9 = ptr[v7++]; + byte v9 = ptr[v7++]; if (v9 > 192) { - v10 = v9 - 192; + int v10 = v9 - 192; if (v7 == v5) { v7 = 0; --v16; @@ -382,7 +373,7 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte v5 = v17; f.read(ptr, v5); } - v12 = ptr[v7++]; + char v12 = ptr[v7++]; do { surface[i++] = v12; --v10; @@ -440,9 +431,6 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width, // TODO: See if PAL_PIXELS can be converted to a uint16 array void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *srcP; - byte *destP; - int yNext; int xCtr; const byte *palette; int yCtr; @@ -450,9 +438,9 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width byte *destCopyP; assert(_videoPtr); - srcP = xs + _lineNbr2 * ys + surface; - destP = (byte *)_videoPtr->pixels + destX + destX + WinScan * destY; - yNext = height; + const byte *srcP = xs + _lineNbr2 * ys + surface; + byte *destP = (byte *)_videoPtr->pixels + destX + destX + WinScan * destY; + int yNext = height; Agr_x = 0; Agr_y = 0; Agr_Flag_y = false; @@ -500,8 +488,6 @@ void GraphicsManager::m_scroll16A(const byte *surface, int xs, int ys, int width } void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) { - int yCount; - int xCount; int xCtr; const byte *palette; int savedXCount; @@ -512,8 +498,8 @@ void GraphicsManager::Copy_Vga16(const byte *surface, int xp, int yp, int width, assert(_videoPtr); const byte *srcP = surface + xp + 320 * yp; byte *destP = (byte *)_videoPtr->pixels + 30 * WinScan + destX + destX + destX + destX + WinScan * 2 * destY; - yCount = height; - xCount = width; + int yCount = height; + int xCount = width; do { yCtr = yCount; @@ -740,18 +726,15 @@ void GraphicsManager::DD_VBL() { } void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { - int rleValue; - int destOffset; - const byte *srcP; byte srcByte; byte destLen1; byte *destSlice1P; byte destLen2; byte *destSlice2P; - rleValue = 0; - destOffset = 0; - srcP = srcData; + int rleValue = 0; + int destOffset = 0; + const byte *srcP = srcData; for (;;) { srcByte = srcP[0]; if (srcByte == kByteStop) @@ -1101,11 +1084,8 @@ void GraphicsManager::RESET_SEGMENT_VESA() { // Add VESA Segment void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { - int tempX; - bool addFlag; - - tempX = x1; - addFlag = true; + int tempX = x1; + bool addFlag = true; if (x2 > _maxX) x2 = _maxX; if (y2 > _maxY) @@ -1178,10 +1158,8 @@ void GraphicsManager::displayVesaSegment() { } void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment) { - int height, width; - - width = _vm->_objectsManager.getWidth(objectData, idx); - height = _vm->_objectsManager.getHeight(objectData, idx); + int width = _vm->_objectsManager.getWidth(objectData, idx); + int height = _vm->_objectsManager.getHeight(objectData, idx); if (*objectData == 78) { Affiche_Perfect(_vesaScreen, objectData, xp + 300, yp + 300, idx, 0, 0, false); Affiche_Perfect(_vesaBuffer, objectData, xp + 300, yp + 300, idx, 0, 0, false); @@ -1218,15 +1196,12 @@ void GraphicsManager::copy16bFromSurfaceScaleX2(const byte *surface) { } void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { - byte *destP; - int yNext; - const byte *srcP; int i; int yCtr; - destP = xp + _lineNbr2 * yp + destSurface; - yNext = height; - srcP = src; + byte *destP = xp + _lineNbr2 * yp + destSurface; + int yNext = height; + const byte *srcP = src; do { yCtr = yNext; if (width & 1) { @@ -1617,8 +1592,6 @@ void GraphicsManager::fastDisplay(const byte *spriteData, int xp, int yp, int sp } void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY) { - int xRight; - int left = x1; int top = y1; int croppedWidth = width; @@ -1635,8 +1608,7 @@ void GraphicsManager::copySurface(const byte *surface, int x1, int y1, int width if (top + croppedHeight > _maxY) croppedHeight = _maxY - top; - xRight = left + croppedWidth; - if (xRight > _maxX) + if (left + croppedWidth > _maxX) croppedWidth = _maxX - left; if (croppedWidth > 0 && croppedHeight > 0) { -- cgit v1.2.3 From e47d34f9512bb9b0124bc61547bd854563ac53d2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Feb 2013 08:34:49 +0100 Subject: HOPKINS: Fix transition glitch when skipping animations --- engines/hopkins/graphics.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 221558f592..6834d400fc 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -570,13 +570,8 @@ void GraphicsManager::fadeIn(const byte *palette, int step, const byte *surface) */ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface) { byte palData[PALETTE_BLOCK_SIZE]; - int fadeStep; - if (step > 1) - fadeStep = step; - else - fadeStep = 2; - - if (palette) { + if ((step > 1) && (palette) && (!_vm->_eventsManager._escKeyFl)) { + int fadeStep = step; for (int fadeIndex = 0; fadeIndex < fadeStep; fadeIndex++) { for (int palOffset = 0; palOffset < PALETTE_BLOCK_SIZE; palOffset += 3) { palData[palOffset + 0] = (fadeStep - fadeIndex - 1) * palette[palOffset + 0] / (fadeStep - 1); -- cgit v1.2.3 From 9223719f2a7ca153ada953fc12a717f9547476d2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Feb 2013 22:19:59 +0100 Subject: HOPKINS: Some renaming in GraphicManager --- engines/hopkins/graphics.cpp | 91 +++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 6834d400fc..ccdd8adb36 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -333,54 +333,51 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte size_t filesize = f.size(); f.read(surface, 128); - int v4 = filesize - 896; + int imageSize = filesize - 896; byte *ptr = _vm->_globals.allocMemory(65024); - size_t v5; - int v15; - int v17; - if (v4 >= 64000) { - v15 = v4 / 64000 + 1; - v17 = 64000 * (v4 / 64000) - v4; - if (v17 < 0) - v17 = -v17; + size_t curBufSize; + int imageNumb; + int imageDataSize; + if (imageSize >= 64000) { + imageNumb = imageSize / 64000 + 1; + imageDataSize = abs(64000 * (imageSize / 64000) - imageSize); f.read(ptr, 64000); - v5 = 64000; + curBufSize = 64000; } else { - v15 = 1; - v17 = v4; - f.read(ptr, v4); - v5 = v4; + imageNumb = 1; + imageDataSize = imageSize; + f.read(ptr, imageSize); + curBufSize = imageSize; } - int v16 = v15 - 1; - size_t v7 = 0; + imageNumb--; + size_t curByteIdx = 0; for (int i = 0; i < 64000; i++) { - if (v7 == v5) { - v7 = 0; - --v16; - v5 = 64000; - if (!v16) - v5 = v17; - f.read(ptr, v5); + if (curByteIdx == curBufSize) { + curByteIdx = 0; + --imageNumb; + curBufSize = 64000; + if (!imageNumb) + curBufSize = imageDataSize; + f.read(ptr, curBufSize); } - byte v9 = ptr[v7++]; - if (v9 > 192) { - int v10 = v9 - 192; - if (v7 == v5) { - v7 = 0; - --v16; - v5 = 64000; - if (v16 == 1) - v5 = v17; - f.read(ptr, v5); + byte curByte = ptr[curByteIdx++]; + if (curByte > 192) { + int repeatCount = curByte - 192; + if (curByteIdx == curBufSize) { + curByteIdx = 0; + --imageNumb; + curBufSize = 64000; + if (imageNumb == 1) + curBufSize = imageDataSize; + f.read(ptr, curBufSize); } - char v12 = ptr[v7++]; - do { - surface[i++] = v12; - --v10; - } while (v10); + curByte = ptr[curByteIdx++]; + for (; repeatCount; repeatCount--) + surface[i++] = curByte; + --i; } else { - surface[i] = v9; + surface[i] = curByte; } } @@ -1223,21 +1220,21 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in /** * Compute the value of a parameter plus a given percentage */ -int GraphicsManager::zoomIn(int v, int percentage ) { - if (v) - v += percentage * (long int)v / 100; +int GraphicsManager::zoomIn(int val, int percentage ) { + if (val) + val += percentage * (long int)val / 100; - return v; + return val; } /** * Compute the value of a parameter minus a given percentage */ -int GraphicsManager::zoomOut(int v, int percentage) { - if (v) - v -= percentage * (long int)v / 100; +int GraphicsManager::zoomOut(int val, int percentage) { + if (val) + val -= percentage * (long int)val / 100; - return v; + return val; } // Display 'Perfect?' -- cgit v1.2.3 From 2b865f6fe2603f25c7554cb19609e4ca72205d38 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Feb 2013 23:48:03 +0100 Subject: HOPKINS: Move some zone code to LinesManager --- engines/hopkins/globals.cpp | 12 -- engines/hopkins/globals.h | 20 --- engines/hopkins/hopkins.cpp | 10 +- engines/hopkins/lines.cpp | 158 +++++++++++++++-- engines/hopkins/lines.h | 25 +++ engines/hopkins/objects.cpp | 408 +++++++++++++++++--------------------------- engines/hopkins/objects.h | 5 +- engines/hopkins/script.cpp | 8 +- engines/hopkins/talk.cpp | 14 +- 9 files changed, 335 insertions(+), 325 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index bd20b82ec9..516eb4d1ac 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -68,8 +68,6 @@ Globals::Globals() { // Initialise array properties for (int i = 0; i < 6; ++i) CACHE_BANQUE[i] = g_PTRNUL; - for (int i = 0; i < 106; ++i) - Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0); for (int i = 0; i < 35; ++i) Common::fill((byte *)&Bqe_Anim[i], (byte *)&Bqe_Anim[i] + sizeof(BqeAnimItem), 0); for (int i = 0; i < 8; ++i) @@ -87,10 +85,6 @@ Globals::Globals() { for (int i = 0; i < 25; ++i) Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0); - for (int i = 0; i < 105; ++i) { - BOBZONE[i] = 0; - BOBZONE_FLAG[i] = false; - } for (int i = 0; i < 500; ++i) _spriteSize[i] = 0; for (int i = 0; i < 70; ++i) @@ -269,12 +263,6 @@ void Globals::clearAll() { _saveData = (Sauvegarde *)g_PTRNUL; _vm->_objectsManager._curObjectIndex = 0; - for (int idx = 0; idx < 105; ++idx) { - ZONEP[idx]._destX = 0; - ZONEP[idx]._destY = 0; - ZONEP[idx]._spriteIndex = 0; - } - _vm->_linesManager.clearAll(); _vm->_objectsManager.clearAll(); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e50ec48324..e3dd68046b 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -29,23 +29,6 @@ namespace Hopkins { -struct ZonePItem { - int _destX; - int _destY; - int _spriteIndex; - int field6; - int field7; - int field8; - int field9; - int fieldA; - int fieldB; - int fieldC; - int fieldD; - int fieldE; - int fieldF; - bool _enabledFl; - int field12; -}; struct BqeAnimItem { byte *_data; @@ -317,10 +300,7 @@ public: byte *SPRITE_ECRAN; byte *PERSO; int PERSO_TYPE; - int BOBZONE[105]; - bool BOBZONE_FLAG[105]; bool NOT_VERIF; - ZonePItem ZONEP[106]; ObjetWItem ObjetW[300]; int NUM_FICHIER_OBJ; byte *ADR_FICHIER_OBJ; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 444c349d4d..876acec78f 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2723,13 +2723,13 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _objectsManager.INILINK("ocean"); if (!exit1) - _objectsManager.disableZone(1); + _linesManager.disableZone(1); if (!exit2) - _objectsManager.disableZone(2); + _linesManager.disableZone(2); if (!exit3) - _objectsManager.disableZone(3); + _linesManager.disableZone(3); if (!exit4) - _objectsManager.disableZone(4); + _linesManager.disableZone(4); if (!_globals._oceanDirection) _globals._oceanDirection = defaultDirection; @@ -2775,7 +2775,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in int mouseButton = _eventsManager.getMouseButton(); if (mouseButton && mouseButton == 1) BTOCEAN(); - _objectsManager.checkZone(); + _linesManager.checkZone(); OCEAN_HOME(); _eventsManager.VBL(); if (_globals._exitId || g_system->getEventManager()->shouldQuit()) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 93ffd5647c..db9ea2f3eb 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -33,16 +33,26 @@ LinesManager::LinesManager() { Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0); Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0); } - for (int i = 0; i < 4000; ++i) { + + for (int i = 0; i < 4000; ++i) Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0); - } + for (int i = 0; i < 32002; ++i) super_parcours[i] = 0; + for (int i = 0; i < 101; ++i) { Common::fill((byte *)&_segment[i], (byte *)&_segment[i] + sizeof(SegmentItem), 0); Common::fill((byte *)&_squareZone[i], (byte *)&_squareZone[i] + sizeof(SquareZoneItem), 0); } + for (int i = 0; i < 105; ++i) { + BOBZONE[i] = 0; + BOBZONE_FLAG[i] = false; + } + + for (int i = 0; i < 106; ++i) + Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0); + _linesNumb = 0; NV_LIGNEDEP = 0; NV_LIGNEOFS = 0; @@ -160,8 +170,8 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ int16 *zoneData; if (a2 == a3 && a3 == a4 && a3 == a5) { - _vm->_globals.BOBZONE_FLAG[bobZoneIdx] = true; - _vm->_globals.BOBZONE[bobZoneIdx] = a3; + BOBZONE_FLAG[bobZoneIdx] = true; + BOBZONE[bobZoneIdx] = a3; } else { assert (idx <= MAX_LINES); _zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData); @@ -2965,19 +2975,19 @@ int LinesManager::MZONE() { int yp = _vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y; if ((_vm->_eventsManager._mousePos.y + _vm->_eventsManager._mouseOffset.y) > 19) { for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) { - int bobId = _vm->_globals.BOBZONE[bobZoneId]; - if (bobId && _vm->_globals.BOBZONE_FLAG[bobZoneId] && _vm->_objectsManager._bob[bobId].field0 && _vm->_objectsManager._bob[bobId]._frameIndex != 250 && + int bobId = BOBZONE[bobZoneId]; + if (bobId && BOBZONE_FLAG[bobZoneId] && _vm->_objectsManager._bob[bobId].field0 && _vm->_objectsManager._bob[bobId]._frameIndex != 250 && !_vm->_objectsManager._bob[bobId]._disabledAnimationFl && xp > _vm->_objectsManager._bob[bobId]._oldX && xp < _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX && yp > _vm->_objectsManager._bob[bobId]._oldY) { if (yp < _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY) { - if (_vm->_globals.ZONEP[bobZoneId]._spriteIndex == -1) { - _vm->_globals.ZONEP[bobZoneId]._destX = 0; - _vm->_globals.ZONEP[bobZoneId]._destY = 0; + if (ZONEP[bobZoneId]._spriteIndex == -1) { + ZONEP[bobZoneId]._destX = 0; + ZONEP[bobZoneId]._destY = 0; } - if (!_vm->_globals.ZONEP[bobZoneId]._destX && !_vm->_globals.ZONEP[bobZoneId]._destY) { - _vm->_globals.ZONEP[bobZoneId]._destX = _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX; - _vm->_globals.ZONEP[bobZoneId]._destY = _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY + 6; - _vm->_globals.ZONEP[bobZoneId]._spriteIndex = -1; + if (!ZONEP[bobZoneId]._destX && !ZONEP[bobZoneId]._destY) { + ZONEP[bobZoneId]._destX = _vm->_objectsManager._bob[bobId]._oldWidth + _vm->_objectsManager._bob[bobId]._oldX; + ZONEP[bobZoneId]._destY = _vm->_objectsManager._bob[bobId]._oldHeight + _vm->_objectsManager._bob[bobId]._oldY + 6; + ZONEP[bobZoneId]._spriteIndex = -1; } return bobZoneId; } @@ -2985,7 +2995,7 @@ int LinesManager::MZONE() { } _currentSegmentId = 0; for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { - if (_vm->_globals.ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1 + if (ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1 && _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp && _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) { if (_squareZone[squareZoneId]._squareZoneFl) @@ -3003,7 +3013,7 @@ int LinesManager::MZONE() { int colRes1 = 0; for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { colRes1 = colision(xp, yCurrent); - if (colRes1 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + if (colRes1 != -1 && ZONEP[colRes1]._enabledFl) break; } @@ -3013,7 +3023,7 @@ int LinesManager::MZONE() { int colRes2 = 0; for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { colRes2 = colision(xp, j); - if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + if (colRes2 != -1 && ZONEP[colRes1]._enabledFl) break; } @@ -3023,7 +3033,7 @@ int LinesManager::MZONE() { int colRes3 = 0; for (int k = xp; k >= 0; --k) { colRes3 = colision(k, yp); - if (colRes3 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + if (colRes3 != -1 && ZONEP[colRes1]._enabledFl) break; } if (colRes3 == -1) @@ -3032,7 +3042,7 @@ int LinesManager::MZONE() { int colRes4 = 0; for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { colRes4 = colision(xCurrent, yp); - if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1]._enabledFl) + if (colRes4 != -1 && ZONEP[colRes1]._enabledFl) break; } if (colRes1 == colRes2 && colRes1 == colRes3 && colRes1 == colRes4) @@ -3145,6 +3155,12 @@ void LinesManager::CARRE_ZONE() { } void LinesManager::clearAll() { + for (int idx = 0; idx < 105; ++idx) { + _vm->_linesManager.ZONEP[idx]._destX = 0; + _vm->_linesManager.ZONEP[idx]._destY = 0; + _vm->_linesManager.ZONEP[idx]._spriteIndex = 0; + } + _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; @@ -3217,4 +3233,110 @@ void LinesManager::resetLastLine() { void LinesManager::resetLinesNumb() { _linesNumb = 0; } + +void LinesManager::enableZone(int idx) { + if (BOBZONE[idx]) { + BOBZONE_FLAG[idx] = true; + } else { + ZONEP[idx]._enabledFl = true; + } +} + +void LinesManager::disableZone(int idx) { + if (BOBZONE[idx]) { + BOBZONE_FLAG[idx] = false; + } else { + ZONEP[idx]._enabledFl = false; + } +} + +void LinesManager::checkZone() { + int mouseX = _vm->_eventsManager.getMouseX(); + int mouseY = _vm->_eventsManager.getMouseY(); + int oldMouseY = mouseY; + if (_vm->_globals._cityMapEnabledFl + || _vm->_eventsManager._startPos.x >= mouseX + || (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY) + || (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) { + if (_vm->_objectsManager._visibleFl) + _vm->_objectsManager._eraseVisibleCounter = 4; + _vm->_objectsManager._visibleFl = false; + } else { + _vm->_objectsManager._visibleFl = true; + } + if (_vm->_objectsManager._forceZoneFl) { + _vm->_globals.compteur_71 = 100; + _vm->_globals._oldMouseZoneId = -1; + _vm->_globals._oldMouseX = -200; + _vm->_globals._oldMouseY = -220; + _vm->_objectsManager._forceZoneFl = false; + } + + _vm->_globals.compteur_71++; + if (_vm->_globals.compteur_71 <= 1) + return; + + if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + _vm->_globals.compteur_71 = 0; + int zoneId; + if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { + zoneId = _vm->_linesManager.MZONE(); + } else { + zoneId = _vm->_globals._oldMouseZoneId; + } + if (_vm->_globals._oldMouseZoneId != zoneId) { + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_eventsManager._mouseCursorId = 4; + _vm->_eventsManager.changeMouseCursor(4); + if (_vm->_globals._forceHideText) { + _vm->_fontManager.hideText(5); + _vm->_globals._forceHideText = false; + return; + } + } + if (zoneId != -1) { + if (ZONEP[zoneId].field6 || ZONEP[zoneId].field7 || + ZONEP[zoneId].field8 || ZONEP[zoneId].field9 || + ZONEP[zoneId].fieldA || ZONEP[zoneId].fieldB || + ZONEP[zoneId].fieldC || ZONEP[zoneId].fieldD || + ZONEP[zoneId].fieldE || ZONEP[zoneId].fieldF) { + if (_vm->_globals._oldMouseZoneId != zoneId) { + _vm->_fontManager.initTextBuffers(5, ZONEP[zoneId].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); + _vm->_fontManager.showText(5); + _vm->_globals._forceHideText = true; + } + _vm->_globals._hotspotTextColor += 25; + if (_vm->_globals._hotspotTextColor > 100) + _vm->_globals._hotspotTextColor = 0; + _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor, + _vm->_globals._hotspotTextColor); + if (_vm->_eventsManager._mouseCursorId == 4) { + if (ZONEP[zoneId].field6 == 2) { + _vm->_eventsManager.changeMouseCursor(16); + _vm->_eventsManager._mouseCursorId = 16; + _vm->_objectsManager.setVerb(16); + } + } + } else { + _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); + _vm->_eventsManager._mouseCursorId = 4; + _vm->_eventsManager.changeMouseCursor(4); + } + } + _vm->_objectsManager._zoneNum = zoneId; + _vm->_globals._oldMouseX = mouseX; + _vm->_globals._oldMouseY = oldMouseY; + _vm->_globals._oldMouseZoneId = zoneId; + if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) { + if (zoneId != -1 && zoneId != 0) + _vm->_objectsManager.handleRightButton(); + } + if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) { + _vm->_objectsManager.setVerb(0); + _vm->_eventsManager._mouseCursorId = 0; + _vm->_eventsManager.changeMouseCursor(0); + } + } +} + } // End of namespace Hopkins diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 7eb73409a3..b9ae3e6e31 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -65,6 +65,24 @@ struct SquareZoneItem { bool _squareZoneFl; }; +struct ZonePItem { + int _destX; + int _destY; + int _spriteIndex; + int field6; + int field7; + int field8; + int field9; + int fieldA; + int fieldB; + int fieldC; + int fieldD; + int fieldE; + int fieldF; + bool _enabledFl; + int field12; +}; + class LinesManager { private: HopkinsEngine *_vm; @@ -112,6 +130,10 @@ public: int16 *_route; int16 *essai2; + int BOBZONE[105]; + bool BOBZONE_FLAG[105]; + ZonePItem ZONEP[106]; + LinesManager(); ~LinesManager(); void setParent(HopkinsEngine *vm); @@ -128,6 +150,9 @@ public: void resetLines(); void resetLinesNumb(); void resetLastLine(); + void enableZone(int idx); + void disableZone(int idx); + void checkZone(); int MZONE(); void CARRE_ZONE(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8173a1ff2b..bd45bbc24b 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -34,9 +34,9 @@ namespace Hopkins { ObjectsManager::ObjectsManager() { - for (int i = 0; i < 6; ++i) { + for (int i = 0; i < 6; ++i) Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0); - } + for (int i = 0; i < 36; ++i) Common::fill((byte *)&_bob[i], (byte *)&_bob[i] + sizeof(BobItem), 0); @@ -1264,95 +1264,6 @@ void ObjectsManager::setFlipSprite(int idx, bool flipFl) { _sprite[idx]._flipFl = flipFl; } -void ObjectsManager::checkZone() { - int mouseX = _vm->_eventsManager.getMouseX(); - int mouseY = _vm->_eventsManager.getMouseY(); - int oldMouseY = mouseY; - if (_vm->_globals._cityMapEnabledFl - || _vm->_eventsManager._startPos.x >= mouseX - || (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY) - || (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) { - if (_visibleFl) - _eraseVisibleCounter = 4; - _visibleFl = false; - } else { - _visibleFl = true; - } - if (_forceZoneFl) { - _vm->_globals.compteur_71 = 100; - _vm->_globals._oldMouseZoneId = -1; - _vm->_globals._oldMouseX = -200; - _vm->_globals._oldMouseY = -220; - _forceZoneFl = false; - } - - _vm->_globals.compteur_71++; - if (_vm->_globals.compteur_71 <= 1) - return; - - if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { - _vm->_globals.compteur_71 = 0; - int zoneId; - if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { - zoneId = _vm->_linesManager.MZONE(); - } else { - zoneId = _vm->_globals._oldMouseZoneId; - } - if (_vm->_globals._oldMouseZoneId != zoneId) { - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_eventsManager._mouseCursorId = 4; - _vm->_eventsManager.changeMouseCursor(4); - if (_vm->_globals._forceHideText) { - _vm->_fontManager.hideText(5); - _vm->_globals._forceHideText = false; - return; - } - } - if (zoneId != -1) { - if (_vm->_globals.ZONEP[zoneId].field6 || _vm->_globals.ZONEP[zoneId].field7 || - _vm->_globals.ZONEP[zoneId].field8 || _vm->_globals.ZONEP[zoneId].field9 || - _vm->_globals.ZONEP[zoneId].fieldA || _vm->_globals.ZONEP[zoneId].fieldB || - _vm->_globals.ZONEP[zoneId].fieldC || _vm->_globals.ZONEP[zoneId].fieldD || - _vm->_globals.ZONEP[zoneId].fieldE || _vm->_globals.ZONEP[zoneId].fieldF) { - if (_vm->_globals._oldMouseZoneId != zoneId) { - _vm->_fontManager.initTextBuffers(5, _vm->_globals.ZONEP[zoneId].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); - _vm->_fontManager.showText(5); - _vm->_globals._forceHideText = true; - } - _vm->_globals._hotspotTextColor += 25; - if (_vm->_globals._hotspotTextColor > 100) - _vm->_globals._hotspotTextColor = 0; - _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor, - _vm->_globals._hotspotTextColor); - if (_vm->_eventsManager._mouseCursorId == 4) { - if (_vm->_globals.ZONEP[zoneId].field6 == 2) { - _vm->_eventsManager.changeMouseCursor(16); - _vm->_eventsManager._mouseCursorId = 16; - _verb = 16; - } - } - } else { - _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - _vm->_eventsManager._mouseCursorId = 4; - _vm->_eventsManager.changeMouseCursor(4); - } - } - _zoneNum = zoneId; - _vm->_globals._oldMouseX = mouseX; - _vm->_globals._oldMouseY = oldMouseY; - _vm->_globals._oldMouseZoneId = zoneId; - if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) { - if (zoneId != -1 && zoneId != 0) - handleRightButton(); - } - if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) { - _verb = 0; - _vm->_eventsManager._mouseCursorId = 0; - _vm->_eventsManager.changeMouseCursor(0); - } - } -} - void ObjectsManager::GOHOME() { int v0 = 0; int v58 = 0; @@ -1399,14 +1310,14 @@ void ObjectsManager::GOHOME() { _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; if (zoneId > 0) { - if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { - if (_vm->_globals.ZONEP[zoneId]._spriteIndex == -1) { - _vm->_globals.ZONEP[zoneId]._destX = 0; - _vm->_globals.ZONEP[zoneId]._destY = 0; - _vm->_globals.ZONEP[zoneId]._spriteIndex = 0; + if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) { + if (_vm->_linesManager.ZONEP[zoneId]._spriteIndex == -1) { + _vm->_linesManager.ZONEP[zoneId]._destX = 0; + _vm->_linesManager.ZONEP[zoneId]._destY = 0; + _vm->_linesManager.ZONEP[zoneId]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[zoneId]._spriteIndex); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[zoneId]._spriteIndex - 59; + setSpriteIndex(0, _vm->_linesManager.ZONEP[zoneId]._spriteIndex); + _vm->_globals._actionDirection = _vm->_linesManager.ZONEP[zoneId]._spriteIndex - 59; } } } @@ -1621,14 +1532,14 @@ void ObjectsManager::GOHOME() { _oldCharacterPosY = getSpriteY(0); if (zoneId > 0) { - if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { - if ( _vm->_globals.ZONEP[zoneId]._spriteIndex == -1) { - _vm->_globals.ZONEP[zoneId]._destX = 0; - _vm->_globals.ZONEP[zoneId]._destY = 0; - _vm->_globals.ZONEP[zoneId]._spriteIndex = 0; + if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) { + if ( _vm->_linesManager.ZONEP[zoneId]._spriteIndex == -1) { + _vm->_linesManager.ZONEP[zoneId]._destX = 0; + _vm->_linesManager.ZONEP[zoneId]._destY = 0; + _vm->_linesManager.ZONEP[zoneId]._spriteIndex = 0; } else { - setSpriteIndex(0, _vm->_globals.ZONEP[zoneId]._spriteIndex); - _vm->_globals._actionDirection = _vm->_globals.ZONEP[zoneId]._spriteIndex - 59; + setSpriteIndex(0, _vm->_linesManager.ZONEP[zoneId]._spriteIndex); + _vm->_globals._actionDirection = _vm->_linesManager.ZONEP[zoneId]._spriteIndex - 59; } } } @@ -1726,21 +1637,21 @@ void ObjectsManager::GOHOME2() { */ void ObjectsManager::loadZone(const Common::String &file) { for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i]._destX = 0; - _vm->_globals.ZONEP[i]._destY = 0; - _vm->_globals.ZONEP[i]._spriteIndex = 0; - _vm->_globals.ZONEP[i].field6 = 0; - _vm->_globals.ZONEP[i].field7 = 0; - _vm->_globals.ZONEP[i].field8 = 0; - _vm->_globals.ZONEP[i].field9 = 0; - _vm->_globals.ZONEP[i].fieldA = 0; - _vm->_globals.ZONEP[i].fieldB = 0; - _vm->_globals.ZONEP[i].fieldC = 0; - _vm->_globals.ZONEP[i].fieldD = 0; - _vm->_globals.ZONEP[i].fieldE = 0; - _vm->_globals.ZONEP[i].fieldF = 0; - _vm->_globals.ZONEP[i].field12 = 0; - _vm->_globals.ZONEP[i]._enabledFl = false; + _vm->_linesManager.ZONEP[i]._destX = 0; + _vm->_linesManager.ZONEP[i]._destY = 0; + _vm->_linesManager.ZONEP[i]._spriteIndex = 0; + _vm->_linesManager.ZONEP[i].field6 = 0; + _vm->_linesManager.ZONEP[i].field7 = 0; + _vm->_linesManager.ZONEP[i].field8 = 0; + _vm->_linesManager.ZONEP[i].field9 = 0; + _vm->_linesManager.ZONEP[i].fieldA = 0; + _vm->_linesManager.ZONEP[i].fieldB = 0; + _vm->_linesManager.ZONEP[i].fieldC = 0; + _vm->_linesManager.ZONEP[i].fieldD = 0; + _vm->_linesManager.ZONEP[i].fieldE = 0; + _vm->_linesManager.ZONEP[i].fieldF = 0; + _vm->_linesManager.ZONEP[i].field12 = 0; + _vm->_linesManager.ZONEP[i]._enabledFl = false; } Common::File f; @@ -1761,38 +1672,38 @@ void ObjectsManager::loadZone(const Common::String &file) { READ_LE_UINT16((uint16 *)ptr + bufId + 3), READ_LE_UINT16((uint16 *)ptr + bufId + 4), bobZoneIdx); - _vm->_globals.ZONEP[bobZoneIdx]._enabledFl = true; + _vm->_linesManager.ZONEP[bobZoneIdx]._enabledFl = true; } bufId += 5; ++zoneLineIdx; } while (bobZoneIdx != -1); for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); - _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1); - _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2); + _vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); + _vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1); + _vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2); bufId += 3; } byte *v9 = (ptr + 10 * zoneLineIdx + 606); bufId = 0; for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i].field6 = v9[bufId]; - _vm->_globals.ZONEP[i].field7 = v9[bufId + 1]; - _vm->_globals.ZONEP[i].field8 = v9[bufId + 2]; - _vm->_globals.ZONEP[i].field9 = v9[bufId + 3]; - _vm->_globals.ZONEP[i].fieldA = v9[bufId + 4]; - _vm->_globals.ZONEP[i].fieldB = v9[bufId + 5]; - _vm->_globals.ZONEP[i].fieldC = v9[bufId + 6]; - _vm->_globals.ZONEP[i].fieldD = v9[bufId + 7]; - _vm->_globals.ZONEP[i].fieldE = v9[bufId + 8]; - _vm->_globals.ZONEP[i].fieldF = v9[bufId + 9]; + _vm->_linesManager.ZONEP[i].field6 = v9[bufId]; + _vm->_linesManager.ZONEP[i].field7 = v9[bufId + 1]; + _vm->_linesManager.ZONEP[i].field8 = v9[bufId + 2]; + _vm->_linesManager.ZONEP[i].field9 = v9[bufId + 3]; + _vm->_linesManager.ZONEP[i].fieldA = v9[bufId + 4]; + _vm->_linesManager.ZONEP[i].fieldB = v9[bufId + 5]; + _vm->_linesManager.ZONEP[i].fieldC = v9[bufId + 6]; + _vm->_linesManager.ZONEP[i].fieldD = v9[bufId + 7]; + _vm->_linesManager.ZONEP[i].fieldE = v9[bufId + 8]; + _vm->_linesManager.ZONEP[i].fieldF = v9[bufId + 9]; bufId += 10; } v9 += 1010; for (int i = 0; i < 100; i++) - _vm->_globals.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i); + _vm->_linesManager.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i); _vm->_globals.freeMemory(ptr); _vm->_linesManager.CARRE_ZONE(); @@ -1872,7 +1783,7 @@ void ObjectsManager::handleCityMap() { handleLeftButton(); } - checkZone(); + _vm->_linesManager.checkZone(); GOHOME2(); if (_vm->_linesManager._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) @@ -1940,7 +1851,7 @@ void ObjectsManager::handleLeftButton() { } } if (_vm->_globals._cityMapEnabledFl && _vm->_globals.GOACTION) { - checkZone(); + _vm->_linesManager.checkZone(); if (_zoneNum <= 0) return; int routeIdx = 0; @@ -1956,7 +1867,7 @@ void ObjectsManager::handleLeftButton() { } if (_vm->_globals.GOACTION) { - checkZone(); + _vm->_linesManager.checkZone(); _vm->_globals.GOACTION = false; _vm->_globals._saveData->_data[svField1] = 0; _vm->_globals._saveData->_data[svField2] = 0; @@ -1965,9 +1876,9 @@ void ObjectsManager::handleLeftButton() { if (_vm->_globals._cityMapEnabledFl && (_vm->_eventsManager._mouseCursorId != 4 || _zoneNum <= 0)) return; if (_zoneNum != -1 && _zoneNum != 0) { - if (_vm->_globals.ZONEP[_zoneNum]._destX && _vm->_globals.ZONEP[_zoneNum]._destY && _vm->_globals.ZONEP[_zoneNum]._destY != 31) { - destX = _vm->_globals.ZONEP[_zoneNum]._destX; - destY = _vm->_globals.ZONEP[_zoneNum]._destY; + if (_vm->_linesManager.ZONEP[_zoneNum]._destX && _vm->_linesManager.ZONEP[_zoneNum]._destY && _vm->_linesManager.ZONEP[_zoneNum]._destY != 31) { + destX = _vm->_linesManager.ZONEP[_zoneNum]._destX; + destY = _vm->_linesManager.ZONEP[_zoneNum]._destY; } } _vm->_globals.GOACTION = false; @@ -2092,7 +2003,7 @@ void ObjectsManager::PARADISE() { _vm->_talkManager.REPONSE2(_vm->_globals._saveData->_data[svField2], _vm->_globals._saveData->_data[svField1]); } _vm->_eventsManager.changeMouseCursor(4); - if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_globals.ZONEP[_zoneNum]._enabledFl) { + if (_zoneNum != -1 && _zoneNum != 0 && !_vm->_linesManager.ZONEP[_zoneNum]._enabledFl) { _zoneNum = -1; _forceZoneFl = true; } @@ -2140,8 +2051,8 @@ void ObjectsManager::clearScreen() { _vm->_globals.resetCache(); for (int i = 0; i <= 48; i++) { - _vm->_globals.BOBZONE[i] = 0; - _vm->_globals.BOBZONE_FLAG[i] = false; + _vm->_linesManager.BOBZONE[i] = 0; + _vm->_linesManager.BOBZONE_FLAG[i] = false; } _vm->_eventsManager._mouseCursorId = 4; _verb = 4; @@ -2309,139 +2220,139 @@ void ObjectsManager::nextVerbIcon() { if (_vm->_eventsManager._mouseCursorId == 5 || _vm->_eventsManager._mouseCursorId == 6) { _vm->_eventsManager._mouseCursorId = 6; - if (_vm->_globals.ZONEP[_zoneNum].field6 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].field6 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 7) { - if (_vm->_globals.ZONEP[_zoneNum].field7 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].field7 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 8) { - if (_vm->_globals.ZONEP[_zoneNum].field8 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].field8 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 9) { - if (_vm->_globals.ZONEP[_zoneNum].field9 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 10) { - if (_vm->_globals.ZONEP[_zoneNum].fieldA == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldA == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 11) { - if (_vm->_globals.ZONEP[_zoneNum].fieldB == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldB == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 12) { - if (_vm->_globals.ZONEP[_zoneNum].fieldC == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldC == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 13) { - if (_vm->_globals.ZONEP[_zoneNum].fieldD == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldD == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 14) { - if (_vm->_globals.ZONEP[_zoneNum].fieldE == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldE == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 15) { - if (_vm->_globals.ZONEP[_zoneNum].fieldF == 1) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldF == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 16) { - if (_vm->_globals.ZONEP[_zoneNum].field6 == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].field6 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 17) { - if (_vm->_globals.ZONEP[_zoneNum].field9 == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 18) { - if (_vm->_globals.ZONEP[_zoneNum].fieldA == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldA == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 19) { - if (_vm->_globals.ZONEP[_zoneNum].fieldB == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldB == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 20) { - if (_vm->_globals.ZONEP[_zoneNum].fieldC == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldC == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 21) { - if (_vm->_globals.ZONEP[_zoneNum].fieldF == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldF == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 22) { - if (_vm->_globals.ZONEP[_zoneNum].fieldD == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldD == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 23) { - if (_vm->_globals.ZONEP[_zoneNum].field8 == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].field8 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 24) { - if (_vm->_globals.ZONEP[_zoneNum].field9 == 3) + if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 3) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 25) { - if (_vm->_globals.ZONEP[_zoneNum].fieldE == 2) + if (_vm->_linesManager.ZONEP[_zoneNum].fieldE == 2) return; } _vm->_eventsManager._mouseCursorId = 4; @@ -2744,14 +2655,14 @@ void ObjectsManager::handleSpecialGames() { setBobAnimDataIdx(5, 0); setBobAnimation(6); _vm->_globals._saveData->_data[svField261] = 2; - disableZone(15); + _vm->_linesManager.disableZone(15); _vm->_soundManager.playSound("SOUND75.WAV"); } if (_vm->_globals._saveData->_data[svField261] == 2 && getBobAnimDataIdx(6) == 6) { stopBobAnimation(6); setBobAnimDataIdx(6, 0); setBobAnimation(7); - enableZone(14); + _vm->_linesManager.enableZone(14); _vm->_globals._saveData->_data[svField261] = 3; } _vm->_globals._disableInventFl = false; @@ -3051,22 +2962,6 @@ void ObjectsManager::ACTION_GAUCHE(int idx) { } } -void ObjectsManager::enableZone(int idx) { - if (_vm->_globals.BOBZONE[idx]) { - _vm->_globals.BOBZONE_FLAG[idx] = true; - } else { - _vm->_globals.ZONEP[idx]._enabledFl = true; - } -} - -void ObjectsManager::disableZone(int idx) { - if (_vm->_globals.BOBZONE[idx]) { - _vm->_globals.BOBZONE_FLAG[idx] = false; - } else { - _vm->_globals.ZONEP[idx]._enabledFl = false; - } -} - void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction) { // Set Hopkins animation and position if (animAction != 3) { @@ -3226,20 +3121,20 @@ void ObjectsManager::INILINK(const Common::String &file) { byte *curDataPtr = &ptr[idx + 4]; int curDataIdx = 0; for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i]._destX = 0; - _vm->_globals.ZONEP[i]._destY = 0; - _vm->_globals.ZONEP[i]._spriteIndex = 0; - _vm->_globals.ZONEP[i].field6 = 0; - _vm->_globals.ZONEP[i].field7 = 0; - _vm->_globals.ZONEP[i].field8 = 0; - _vm->_globals.ZONEP[i].field9 = 0; - _vm->_globals.ZONEP[i].fieldA = 0; - _vm->_globals.ZONEP[i].fieldB = 0; - _vm->_globals.ZONEP[i].fieldC = 0; - _vm->_globals.ZONEP[i].fieldD = 0; - _vm->_globals.ZONEP[i].fieldE = 0; - _vm->_globals.ZONEP[i].fieldF = 0; - _vm->_globals.ZONEP[i].field12 = 0; + _vm->_linesManager.ZONEP[i]._destX = 0; + _vm->_linesManager.ZONEP[i]._destY = 0; + _vm->_linesManager.ZONEP[i]._spriteIndex = 0; + _vm->_linesManager.ZONEP[i].field6 = 0; + _vm->_linesManager.ZONEP[i].field7 = 0; + _vm->_linesManager.ZONEP[i].field8 = 0; + _vm->_linesManager.ZONEP[i].field9 = 0; + _vm->_linesManager.ZONEP[i].fieldA = 0; + _vm->_linesManager.ZONEP[i].fieldB = 0; + _vm->_linesManager.ZONEP[i].fieldC = 0; + _vm->_linesManager.ZONEP[i].fieldD = 0; + _vm->_linesManager.ZONEP[i].fieldE = 0; + _vm->_linesManager.ZONEP[i].fieldF = 0; + _vm->_linesManager.ZONEP[i].field12 = 0; } int curLineIdx = 0; @@ -3254,35 +3149,35 @@ void ObjectsManager::INILINK(const Common::String &file) { (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 6), (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 8), v28); - _vm->_globals.ZONEP[v28]._enabledFl = true; + _vm->_linesManager.ZONEP[v28]._enabledFl = true; } curDataIdx += 5; ++curLineIdx; } while (v28 != -1); for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); - _vm->_globals.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2); - _vm->_globals.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4); + _vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); + _vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2); + _vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4); curDataIdx += 3; } byte *v22 = ptr + idx + (10 * curLineIdx + 606) + 4; for (int i = 1; i <= 100; i++) { int j = (i - 1) * 10; - _vm->_globals.ZONEP[i].field6 = v22[j]; - _vm->_globals.ZONEP[i].field7 = v22[j + 1]; - _vm->_globals.ZONEP[i].field8 = v22[j + 2]; - _vm->_globals.ZONEP[i].field9 = v22[j + 3]; - _vm->_globals.ZONEP[i].fieldA = v22[j + 4]; - _vm->_globals.ZONEP[i].fieldB = v22[j + 5]; - _vm->_globals.ZONEP[i].fieldC = v22[j + 6]; - _vm->_globals.ZONEP[i].fieldD = v22[j + 7]; - _vm->_globals.ZONEP[i].fieldE = v22[j + 8]; - _vm->_globals.ZONEP[i].fieldF = v22[j + 9]; + _vm->_linesManager.ZONEP[i].field6 = v22[j]; + _vm->_linesManager.ZONEP[i].field7 = v22[j + 1]; + _vm->_linesManager.ZONEP[i].field8 = v22[j + 2]; + _vm->_linesManager.ZONEP[i].field9 = v22[j + 3]; + _vm->_linesManager.ZONEP[i].fieldA = v22[j + 4]; + _vm->_linesManager.ZONEP[i].fieldB = v22[j + 5]; + _vm->_linesManager.ZONEP[i].fieldC = v22[j + 6]; + _vm->_linesManager.ZONEP[i].fieldD = v22[j + 7]; + _vm->_linesManager.ZONEP[i].fieldE = v22[j + 8]; + _vm->_linesManager.ZONEP[i].fieldF = v22[j + 9]; } int dep = 1010; for (int i = 1; i <= 100; i++) { - _vm->_globals.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep); + _vm->_linesManager.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep); dep += 2; } _vm->_linesManager.CARRE_ZONE(); @@ -3355,22 +3250,22 @@ void ObjectsManager::SPECIAL_INI() { case 39: case 40: case 41: - _vm->_globals.BOBZONE[20] = 1; - _vm->_globals.BOBZONE[21] = 2; - _vm->_globals.BOBZONE[22] = 3; - _vm->_globals.BOBZONE[23] = 4; - _vm->_globals.BOBZONE_FLAG[20] = true; - _vm->_globals.BOBZONE_FLAG[21] = true; - _vm->_globals.BOBZONE_FLAG[22] = true; - _vm->_globals.BOBZONE_FLAG[23] = true; + _vm->_linesManager.BOBZONE[20] = 1; + _vm->_linesManager.BOBZONE[21] = 2; + _vm->_linesManager.BOBZONE[22] = 3; + _vm->_linesManager.BOBZONE[23] = 4; + _vm->_linesManager.BOBZONE_FLAG[20] = true; + _vm->_linesManager.BOBZONE_FLAG[21] = true; + _vm->_linesManager.BOBZONE_FLAG[22] = true; + _vm->_linesManager.BOBZONE_FLAG[23] = true; enableVerb(20, 5); enableVerb(21, 5); enableVerb(22, 5); enableVerb(23, 5); - _vm->_globals.ZONEP[20].field12 = 30; - _vm->_globals.ZONEP[21].field12 = 30; - _vm->_globals.ZONEP[22].field12 = 30; - _vm->_globals.ZONEP[23].field12 = 30; + _vm->_linesManager.ZONEP[20].field12 = 30; + _vm->_linesManager.ZONEP[21].field12 = 30; + _vm->_linesManager.ZONEP[22].field12 = 30; + _vm->_linesManager.ZONEP[23].field12 = 30; for (int i = 200; i <= 214; i++) { if (_vm->_globals._saveData->_data[i] != 2) _vm->_globals._saveData->_data[i] = 0; @@ -3428,42 +3323,42 @@ void ObjectsManager::disableVerb(int idx, int a2) { switch (a2) { case 6: case 16: - _vm->_globals.ZONEP[idx].field6 = 0; + _vm->_linesManager.ZONEP[idx].field6 = 0; break; case 7: - _vm->_globals.ZONEP[idx].field7 = 0; + _vm->_linesManager.ZONEP[idx].field7 = 0; break; case 5: case 8: - _vm->_globals.ZONEP[idx].field8 = 0; + _vm->_linesManager.ZONEP[idx].field8 = 0; break; case 9: case 17: case 24: - _vm->_globals.ZONEP[idx].field9 = 0; + _vm->_linesManager.ZONEP[idx].field9 = 0; break; case 10: case 18: - _vm->_globals.ZONEP[idx].fieldA = 0; + _vm->_linesManager.ZONEP[idx].fieldA = 0; break; case 11: case 19: - _vm->_globals.ZONEP[idx].fieldB = 0; + _vm->_linesManager.ZONEP[idx].fieldB = 0; break; case 12: case 20: - _vm->_globals.ZONEP[idx].fieldC = 0; + _vm->_linesManager.ZONEP[idx].fieldC = 0; break; case 13: case 22: - _vm->_globals.ZONEP[idx].fieldD = 0; + _vm->_linesManager.ZONEP[idx].fieldD = 0; case 14: case 21: case 25: - _vm->_globals.ZONEP[idx].fieldE = 0; + _vm->_linesManager.ZONEP[idx].fieldE = 0; break; case 15: - _vm->_globals.ZONEP[idx].fieldF = 0; + _vm->_linesManager.ZONEP[idx].fieldF = 0; break; } _changeVerbFl = true; @@ -3472,64 +3367,64 @@ void ObjectsManager::disableVerb(int idx, int a2) { void ObjectsManager::enableVerb(int idx, int a2) { switch (a2) { case 5: - _vm->_globals.ZONEP[idx].field8 = 2; + _vm->_linesManager.ZONEP[idx].field8 = 2; break; case 6: - _vm->_globals.ZONEP[idx].field6 = 1; + _vm->_linesManager.ZONEP[idx].field6 = 1; break; case 7: - _vm->_globals.ZONEP[idx].field7 = 1; + _vm->_linesManager.ZONEP[idx].field7 = 1; break; case 8: - _vm->_globals.ZONEP[idx].field8 = 1; + _vm->_linesManager.ZONEP[idx].field8 = 1; break; case 9: - _vm->_globals.ZONEP[idx].field9 = 1; + _vm->_linesManager.ZONEP[idx].field9 = 1; break; case 10: - _vm->_globals.ZONEP[idx].fieldA = 1; + _vm->_linesManager.ZONEP[idx].fieldA = 1; break; case 11: - _vm->_globals.ZONEP[idx].fieldB = 1; + _vm->_linesManager.ZONEP[idx].fieldB = 1; break; case 12: - _vm->_globals.ZONEP[idx].fieldC = 1; + _vm->_linesManager.ZONEP[idx].fieldC = 1; break; case 13: - _vm->_globals.ZONEP[idx].fieldD = 1; + _vm->_linesManager.ZONEP[idx].fieldD = 1; break; case 14: - _vm->_globals.ZONEP[idx].fieldD = 1; + _vm->_linesManager.ZONEP[idx].fieldD = 1; break; case 15: - _vm->_globals.ZONEP[idx].fieldE = 1; + _vm->_linesManager.ZONEP[idx].fieldE = 1; break; case 16: - _vm->_globals.ZONEP[idx].field6 = 2; + _vm->_linesManager.ZONEP[idx].field6 = 2; break; case 17: - _vm->_globals.ZONEP[idx].field9 = 2; + _vm->_linesManager.ZONEP[idx].field9 = 2; break; case 18: - _vm->_globals.ZONEP[idx].fieldA = 2; + _vm->_linesManager.ZONEP[idx].fieldA = 2; break; case 19: - _vm->_globals.ZONEP[idx].fieldB = 2; + _vm->_linesManager.ZONEP[idx].fieldB = 2; break; case 20: - _vm->_globals.ZONEP[idx].fieldC = 2; + _vm->_linesManager.ZONEP[idx].fieldC = 2; break; case 21: - _vm->_globals.ZONEP[idx].fieldE = 2; + _vm->_linesManager.ZONEP[idx].fieldE = 2; break; case 22: - _vm->_globals.ZONEP[idx].fieldD = 2; + _vm->_linesManager.ZONEP[idx].fieldD = 2; break; case 24: - _vm->_globals.ZONEP[idx].field9 = 3; + _vm->_linesManager.ZONEP[idx].field9 = 3; break; case 25: - _vm->_globals.ZONEP[idx].fieldE = 2; + _vm->_linesManager.ZONEP[idx].fieldE = 2; break; } } @@ -3824,7 +3719,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo } else if (mouseButton == 2) handleRightButton(); _vm->_dialogsManager.testDialogOpening(); - checkZone(); + _vm->_linesManager.checkZone(); if (_vm->_globals.GOACTION) PARADISE(); if (!_vm->_globals._exitId) @@ -3962,7 +3857,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm } if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); - checkZone(); + _vm->_linesManager.checkZone(); if (_vm->_linesManager._route == (int16 *)g_PTRNUL || (GOHOME(), _vm->_linesManager._route == (int16 *)g_PTRNUL)) { if (_vm->_globals.GOACTION) @@ -3994,4 +3889,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.iRegul = 0; } +void ObjectsManager::setVerb(int id) { + _verb = id; +} } // End of namespace Hopkins diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index a75e36acd5..7448040862 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -200,10 +200,6 @@ public: void changeObject(int objIndex); void removeObject(int objIndex); - void checkZone(); - void enableZone(int idx); - void disableZone(int idx); - void resetBob(int idx); void setBobAnimDataIdx(int idx, int animIdx); void setBobAnimation(int idx); @@ -219,6 +215,7 @@ public: void handleLeftButton(); void handleRightButton(); void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize); + void setVerb(int id); void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index af21b099fe..c75443ff8a 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -477,11 +477,11 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 2; break; case MKTAG24('Z', 'O', 'N'): - _vm->_objectsManager.enableZone((int16)READ_LE_UINT16(dataP + 5)); + _vm->_linesManager.enableZone((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('Z', 'O', 'F'): - _vm->_objectsManager.disableZone((int16)READ_LE_UINT16(dataP + 5)); + _vm->_linesManager.disableZone((int16)READ_LE_UINT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('E', 'X', 'I'): @@ -2229,7 +2229,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 245: _vm->_soundManager.playSound("SOUND89.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); - _vm->_globals.ZONEP[4]._destX = 276; + _vm->_linesManager.ZONEP[4]._destX = 276; _vm->_objectsManager.enableVerb(4, 19); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 285, 379, 0); _vm->_globals._saveData->_data[svField399] = 1; @@ -2390,7 +2390,7 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 1; break; case MKTAG24('Z', 'C', 'H'): - _vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); + _vm->_linesManager.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 1; break; case MKTAG24('J', 'U', 'M'): diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index ec5b1f518b..7b12ca301b 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -905,8 +905,8 @@ void TalkManager::REPONSE2(int zone, int verb) { break; } _vm->_globals._saveData->_data[indx] = 2; - _vm->_objectsManager.disableZone(22); - _vm->_objectsManager.disableZone(23); + _vm->_linesManager.disableZone(22); + _vm->_linesManager.disableZone(23); } else if (zone == 20 || zone == 21) { _vm->_objectsManager.setFlipSprite(0, true); _vm->_objectsManager.setSpriteIndex(0, 62); @@ -952,8 +952,8 @@ void TalkManager::REPONSE2(int zone, int verb) { break; } _vm->_globals._saveData->_data[indx] = 2; - _vm->_objectsManager.disableZone(21); - _vm->_objectsManager.disableZone(20); + _vm->_linesManager.disableZone(21); + _vm->_linesManager.disableZone(20); } } @@ -967,7 +967,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) - _vm->_globals.BOBZONE[i] = 0; + _vm->_linesManager.BOBZONE[i] = 0; _vm->_objectsManager._zoneNum = -1; _vm->_eventsManager._mouseCursorId = 4; @@ -1028,7 +1028,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { else if (mouseButton == 2) _vm->_objectsManager.handleRightButton(); - _vm->_objectsManager.checkZone(); + _vm->_linesManager.checkZone(); if (_vm->_globals.GOACTION) _vm->_objectsManager.PARADISE(); _vm->_eventsManager.VBL(); @@ -1045,7 +1045,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_linesManager.resetLines(); _vm->_globals.resetCache(); for (int i = 0; i <= 44; i++) - _vm->_globals.BOBZONE[i] = 0; + _vm->_linesManager.BOBZONE[i] = 0; _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals._answerBuffer = oldAnswerBufferPtr; -- cgit v1.2.3 From edd0a631fccbf847cbe257108950a8261dd97395 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Feb 2013 22:52:03 -0500 Subject: HOPKINS: Added a basic base map screen for the Windows version if a PBASE.PCX file can't be found --- engines/hopkins/font.h | 2 +- engines/hopkins/hopkins.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++- engines/hopkins/hopkins.h | 11 ++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 14aa4a7eae..5260025f27 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -61,7 +61,6 @@ private: HopkinsEngine *_vm; void setTextColor(int idx, byte colByte); - void displayText(int xp, int yp, const Common::String &message, int col); int _textSortArray[21]; Common::String _oldName; @@ -84,6 +83,7 @@ public: void showText(int idx); void hideText(int idx); void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color); + void displayText(int xp, int yp, const Common::String &message, int col); void displayTextVesa(int xp, int yp, const Common::String &message, int col); void renderTextDisplay(int xp, int yp, const Common::String &msg, int col); void setOptimalColor(int idx1, int idx2, int idx3, int idx4); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 876acec78f..296c863934 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2269,9 +2269,57 @@ void HopkinsEngine::displayPlane() { _animationManager._clearAnimationFl = false; } +void HopkinsEngine::loadBaseMap() { + Common::String filename = Common::String::format("%s.PCX", "PBASE"); + Common::File f; + + if (f.exists(filename)) { + // PBASE file exists, so go ahead and load it + _graphicsManager.loadImage("PBASE"); + } else { + // PBASE file doesn't exist, so draw a substitute screen + drawBaseMap(); + } +} + +void HopkinsEngine::drawBaseMap() { + memset(_graphicsManager._vesaScreen, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + + // List of rectangle areas to draw for exit points + const int rects[] = { + 181, 66, 181 + 16, 66 + 22, + 353, 116, 353 + 22, 116 + 16, + 483, 250, 483 + 20, 250 + 25, + 471, 326, 471 + 27, 326 + 20, + 162, 365, 162 + 21, 365 + 23, + 106, 267, 106 + 20, 267 + 26 + }; + + // Loop through displaying + const int *rectP = &rects[0]; + for (int rectIndex = 0; rectIndex < 6; ++rectIndex, rectP += 4) { + Common::Rect r(rectP[0], rectP[1], rectP[2], rectP[3]); + + for (int yp = r.top; yp <= r.bottom; ++yp) { + byte *pDest = _graphicsManager._vesaScreen + yp * SCREEN_WIDTH + r.left; + Common::fill(pDest, pDest + r.width(), 0xff); + } + } + + // Copy the calculated screen + memcpy(_graphicsManager._vesaBuffer, _graphicsManager._vesaScreen, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); + + // Write some explanatory text + _fontManager.displayText(40, 200, "ScummVM base map - select a square for different rooms", 255); +} + int HopkinsEngine::handleBaseMap() { _globals._disableInventFl = true; - _graphicsManager.loadImage("PBASE"); + + // Load the map image + loadBaseMap(); + + // Set needed colours _graphicsManager.SETCOLOR3(252, 100, 100, 100); _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 04b3558963..4a01dc0f92 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -106,6 +106,17 @@ private: */ int handleBaseMap(); + /** + * Loads the base map from the PBASE file + */ + void loadBaseMap(); + + /** + * Draws a simple base map for the Windows version, which implemented a 'Wolfenstein 3D' + * style shooter for the base, rather than having a map + */ + void drawBaseMap(); + void BTOCEAN(); void OCEAN_HOME(); void OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); -- cgit v1.2.3 From fb163db0bc2bfb9f7edea812bc25348dc0378d84 Mon Sep 17 00:00:00 2001 From: Dreammaster Date: Thu, 14 Feb 2013 21:08:00 -0500 Subject: HOPKINS: Fix freeze when playing some animations --- engines/hopkins/anim.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index b7571d6aff..bc09d421e4 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -858,13 +858,11 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u } if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl) { + // Wait for third rate delay + do { _vm->_eventsManager.refreshEvents(); _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter < rate3) { - break; - } - } + } while (!_vm->shouldQuit() && !_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate3); } _vm->_eventsManager._rateCounter = 0; -- cgit v1.2.3 From 078f950f386ac7bc204423c58b185b536d4b2edc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 07:54:54 +0100 Subject: HOPKINS: Renaming in ObjectsManager --- engines/hopkins/globals.cpp | 10 +-- engines/hopkins/globals.h | 4 +- engines/hopkins/objects.cpp | 168 ++++++++++++++++++++++---------------------- engines/hopkins/objects.h | 13 ++-- engines/hopkins/script.cpp | 146 +++++++++++++++++++------------------- 5 files changed, 171 insertions(+), 170 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 516eb4d1ac..d854c571be 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -150,7 +150,7 @@ Globals::Globals() { CACHE_BANQUE[idx] = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; - GESTE = NULL; + _gestureBuf = NULL; _inventoryObject = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; @@ -159,7 +159,7 @@ Globals::Globals() { // Reset flags _censorshipFl = false; - GESTE_FLAG = 0; + _curGestureFile = 0; _disableInventFl = false; NOMARCHE = false; _optionDialogFl = false; @@ -190,7 +190,7 @@ Globals::~Globals() { CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); - freeMemory(GESTE); + freeMemory(_gestureBuf); freeMemory(_inventoryObject); freeMemory(_answerBuffer); freeMemory(ADR_FICHIER_OBJ); @@ -276,8 +276,8 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; - GESTE = g_PTRNUL; - GESTE_FLAG = 0; + _gestureBuf = g_PTRNUL; + _curGestureFile = 0; } void Globals::loadCharacterData() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e3dd68046b..babd145cb9 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -315,8 +315,8 @@ public: Common::String FICH_ZONE; bool GOACTION; int j_104; - int GESTE_FLAG; - byte *GESTE; + int _curGestureFile; + byte *_gestureBuf; Common::String FICH_TEXTE; Globals(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bd45bbc24b..89f00df5b0 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2734,230 +2734,230 @@ void ObjectsManager::VBOB_OFF(int idx) { _vm->_globals.VBob[idx].field4 = 4; } -void ObjectsManager::ACTION_DOS(int idx) { - if (_vm->_globals.GESTE_FLAG != 1) { - _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 1; - _vm->_globals.GESTE = _vm->_fileManager.loadFile("DOS.SPR"); +void ObjectsManager::doActionBack(int idx) { + if (_vm->_globals._curGestureFile != 1) { + _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); + _vm->_globals._curGestureFile = 1; + _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("DOS.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 5: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); break; case 6: - SPACTION1(_vm->_globals.GESTE, "20,19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,16,15,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); break; case 8: - SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); break; case 10: - SPACTION1(_vm->_globals.GESTE, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); break; } } -void ObjectsManager::ACTION_DROITE(int idx) { - if (_vm->_globals.GESTE_FLAG != 3) { - _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 3; - _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); +void ObjectsManager::doActionRight(int idx) { + if (_vm->_globals._curGestureFile != 3) { + _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); + _vm->_globals._curGestureFile = 3; + _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false); break; case 5: - SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "23,24,25,-1,", 0, 0, 8, false); break; case 6: - SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "24,,23,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, false); break; case 8: - SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "26,25,24,23,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false); break; case 10: - SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8); break; } } -void ObjectsManager::Q_DROITE(int idx) { - if (_vm->_globals.GESTE_FLAG != 4) { - _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 4; - _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); +void ObjectsManager::doActionDiagRight(int idx) { + if (_vm->_globals._curGestureFile != 4) { + _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); + _vm->_globals._curGestureFile = 4; + _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("3Q.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 5: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,-1,", 0, 0, 8, false); break; case 6: - SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "17,16,15,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20-1,", 0, 0, 8, false); break; case 8: - SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); break; case 10: - SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8); break; } } -void ObjectsManager::ACTION_FACE(int idx) { - if (_vm->_globals.GESTE_FLAG != 2) { - _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 2; - _vm->_globals.GESTE = _vm->_fileManager.loadFile("FACE.SPR"); +void ObjectsManager::doActionFront(int idx) { + if (_vm->_globals._curGestureFile != 2) { + _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); + _vm->_globals._curGestureFile = 2; + _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("FACE.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false); + SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals.GESTE, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; } } -void ObjectsManager::Q_GAUCHE(int idx) { - if (_vm->_globals.GESTE_FLAG != 4) { - _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 4; - _vm->_globals.GESTE = _vm->_fileManager.loadFile("3Q.SPR"); +void ObjectsManager::doActionDiagLeft(int idx) { + if (_vm->_globals._curGestureFile != 4) { + _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); + _vm->_globals._curGestureFile = 4; + _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("3Q.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); break; case 2: - SPACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true); break; case 3: - SPACTION1(_vm->_globals.GESTE, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); + ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); break; case 5: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,-1,", 0, 0, 8, true); break; case 6: - SPACTION1(_vm->_globals.GESTE, "17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "17,16,15,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,-1,", 0, 0, 8, true); break; case 8: - SPACTION1(_vm->_globals.GESTE, "19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true); break; case 10: - SPACTION1(_vm->_globals.GESTE, "20,19,18,17,15,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8); break; } } -void ObjectsManager::ACTION_GAUCHE(int idx) { - if (_vm->_globals.GESTE_FLAG != 3) { - _vm->_globals.GESTE = _vm->_globals.freeMemory(_vm->_globals.GESTE); - _vm->_globals.GESTE_FLAG = 3; - _vm->_globals.GESTE = _vm->_fileManager.loadFile("PROFIL.SPR"); +void ObjectsManager::doActionLeft(int idx) { + if (_vm->_globals._curGestureFile != 3) { + _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); + _vm->_globals._curGestureFile = 3; + _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals.GESTE, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true); + ACTION(_vm->_globals._gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true); break; case 2: - SPACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true); break; case 3: - SPACTION1(_vm->_globals.GESTE, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals.GESTE, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true); + ACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true); break; case 5: - SPACTION(_vm->_globals.GESTE, "23,24,25,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "23,24,25,-1,", 0, 0, 8, true); break; case 6: - SPACTION1(_vm->_globals.GESTE, "24,,23,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "24,,23,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, true); break; case 8: - SPACTION1(_vm->_globals.GESTE, "26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "26,25,24,23,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals.GESTE, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true); + SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true); break; case 10: - SPACTION1(_vm->_globals.GESTE, "28,27,26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_vm->_globals._gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8); break; } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7448040862..7093092bc2 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -217,6 +217,11 @@ public: void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize); void setVerb(int id); + void doActionBack(int idx); + void doActionRight(int idx); + void doActionFront(int idx); + void doActionLeft(int idx); + void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, @@ -230,12 +235,8 @@ public: void BOB_VIVANT(int idx); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); - void ACTION_DOS(int idx); - void ACTION_DROITE(int idx); - void Q_DROITE(int idx); - void ACTION_FACE(int idx); - void Q_GAUCHE(int idx); - void ACTION_GAUCHE(int idx); + void doActionDiagRight(int idx); + void doActionDiagLeft(int idx); void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction); void SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4); void GOHOME(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c75443ff8a..04cacf6ec8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -277,172 +277,172 @@ int ScriptManager::handleOpcode(byte *dataP) { case 1: case 14: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(4); + _vm->_objectsManager.doActionBack(4); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(4); + _vm->_objectsManager.doActionRight(4); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(4); + _vm->_objectsManager.doActionDiagRight(4); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(4); + _vm->_objectsManager.doActionFront(4); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(4); + _vm->_objectsManager.doActionDiagLeft(4); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(4); + _vm->_objectsManager.doActionLeft(4); break; case 2: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(7); + _vm->_objectsManager.doActionBack(7); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(7); + _vm->_objectsManager.doActionRight(7); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(7); + _vm->_objectsManager.doActionDiagRight(7); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(7); + _vm->_objectsManager.doActionFront(7); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(7); + _vm->_objectsManager.doActionDiagLeft(7); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(7); + _vm->_objectsManager.doActionLeft(7); if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(8); + _vm->_objectsManager.doActionBack(8); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(8); + _vm->_objectsManager.doActionRight(8); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(8); + _vm->_objectsManager.doActionDiagRight(8); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(8); + _vm->_objectsManager.doActionFront(8); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(8); + _vm->_objectsManager.doActionDiagLeft(8); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(8); + _vm->_objectsManager.doActionLeft(8); break; case 19: case 4: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(1); + _vm->_objectsManager.doActionBack(1); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(1); + _vm->_objectsManager.doActionRight(1); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(1); + _vm->_objectsManager.doActionDiagRight(1); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(1); + _vm->_objectsManager.doActionFront(1); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(1); + _vm->_objectsManager.doActionDiagLeft(1); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(1); + _vm->_objectsManager.doActionLeft(1); break; case 5: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(5); + _vm->_objectsManager.doActionBack(5); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(5); + _vm->_objectsManager.doActionRight(5); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(5); + _vm->_objectsManager.doActionDiagRight(5); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(5); + _vm->_objectsManager.doActionFront(5); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(5); + _vm->_objectsManager.doActionDiagLeft(5); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(5); + _vm->_objectsManager.doActionLeft(5); if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(6); + _vm->_objectsManager.doActionBack(6); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(6); + _vm->_objectsManager.doActionRight(6); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(6); + _vm->_objectsManager.doActionDiagRight(6); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(6); + _vm->_objectsManager.doActionFront(6); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(6); + _vm->_objectsManager.doActionDiagLeft(6); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(6); + _vm->_objectsManager.doActionLeft(6); break; case 17: case 7: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(2); + _vm->_objectsManager.doActionBack(2); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(2); + _vm->_objectsManager.doActionRight(2); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(2); + _vm->_objectsManager.doActionDiagRight(2); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(2); + _vm->_objectsManager.doActionFront(2); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(2); + _vm->_objectsManager.doActionDiagLeft(2); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(2); + _vm->_objectsManager.doActionLeft(2); break; case 18: case 8: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(3); + _vm->_objectsManager.doActionBack(3); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(3); + _vm->_objectsManager.doActionRight(3); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(3); + _vm->_objectsManager.doActionDiagRight(3); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(3); + _vm->_objectsManager.doActionFront(3); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(3); + _vm->_objectsManager.doActionDiagLeft(3); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(3); + _vm->_objectsManager.doActionLeft(3); break; case 9: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(5); + _vm->_objectsManager.doActionBack(5); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(5); + _vm->_objectsManager.doActionRight(5); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(5); + _vm->_objectsManager.doActionDiagRight(5); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(5); + _vm->_objectsManager.doActionFront(5); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(5); + _vm->_objectsManager.doActionDiagLeft(5); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(5); + _vm->_objectsManager.doActionLeft(5); break; case 10: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(6); + _vm->_objectsManager.doActionBack(6); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(6); + _vm->_objectsManager.doActionRight(6); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(6); + _vm->_objectsManager.doActionDiagRight(6); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(6); + _vm->_objectsManager.doActionFront(6); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(6); + _vm->_objectsManager.doActionDiagLeft(6); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(6); + _vm->_objectsManager.doActionLeft(6); break; case 15: case 11: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(7); + _vm->_objectsManager.doActionBack(7); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(7); + _vm->_objectsManager.doActionRight(7); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(7); + _vm->_objectsManager.doActionDiagRight(7); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(7); + _vm->_objectsManager.doActionFront(7); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(7); + _vm->_objectsManager.doActionDiagLeft(7); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(7); + _vm->_objectsManager.doActionLeft(7); break; case 16: case 12: if (_vm->_globals._actionDirection == 1) - _vm->_objectsManager.ACTION_DOS(8); + _vm->_objectsManager.doActionBack(8); if (_vm->_globals._actionDirection == 3) - _vm->_objectsManager.ACTION_DROITE(8); + _vm->_objectsManager.doActionRight(8); if (_vm->_globals._actionDirection == 2) - _vm->_objectsManager.Q_DROITE(8); + _vm->_objectsManager.doActionDiagRight(8); if (_vm->_globals._actionDirection == 5) - _vm->_objectsManager.ACTION_FACE(8); + _vm->_objectsManager.doActionFront(8); if (_vm->_globals._actionDirection == 8) - _vm->_objectsManager.Q_GAUCHE(8); + _vm->_objectsManager.doActionDiagLeft(8); if (_vm->_globals._actionDirection == 7) - _vm->_objectsManager.ACTION_GAUCHE(8); + _vm->_objectsManager.doActionLeft(8); break; } } @@ -1482,7 +1482,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(5); } _vm->_objectsManager.animateSprite(0); - _vm->_objectsManager.ACTION_DOS(1); + _vm->_objectsManager.doActionBack(1); _vm->_soundManager.DEL_SAMPLE(1); break; -- cgit v1.2.3 From f5d3df3d2de8ecf32701ad76316bf196c40e0e0e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 08:03:59 +0100 Subject: HOPKINS: More gesture variables to ObjectsManager --- engines/hopkins/globals.cpp | 6 -- engines/hopkins/globals.h | 2 - engines/hopkins/objects.cpp | 161 +++++++++++++++++++++++--------------------- engines/hopkins/objects.h | 4 +- 4 files changed, 86 insertions(+), 87 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index d854c571be..fc45a9277b 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -150,7 +150,6 @@ Globals::Globals() { CACHE_BANQUE[idx] = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; - _gestureBuf = NULL; _inventoryObject = NULL; _answerBuffer = g_PTRNUL; ADR_FICHIER_OBJ = NULL; @@ -159,7 +158,6 @@ Globals::Globals() { // Reset flags _censorshipFl = false; - _curGestureFile = 0; _disableInventFl = false; NOMARCHE = false; _optionDialogFl = false; @@ -190,7 +188,6 @@ Globals::~Globals() { CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); - freeMemory(_gestureBuf); freeMemory(_inventoryObject); freeMemory(_answerBuffer); freeMemory(ADR_FICHIER_OBJ); @@ -275,9 +272,6 @@ void Globals::clearAll() { _inventoryObject = allocMemory(2500); ADR_FICHIER_OBJ = g_PTRNUL; - - _gestureBuf = g_PTRNUL; - _curGestureFile = 0; } void Globals::loadCharacterData() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index babd145cb9..7e46773caa 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -315,8 +315,6 @@ public: Common::String FICH_ZONE; bool GOACTION; int j_104; - int _curGestureFile; - byte *_gestureBuf; Common::String FICH_TEXTE; Globals(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 89f00df5b0..0f7ff52f9e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -76,10 +76,13 @@ ObjectsManager::ObjectsManager() { _forestFl = false; _mapCarPosX = _mapCarPosY = 0; _forestSprite = NULL; + _gestureBuf = NULL; + _curGestureFile = 0; } ObjectsManager::~ObjectsManager() { _vm->_globals.freeMemory(_forestSprite); + _vm->_globals.freeMemory(_gestureBuf); } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -89,6 +92,8 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { void ObjectsManager::clearAll() { _forestFl = false; _forestSprite = g_PTRNUL; + _curGestureFile = 0; + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); } /** @@ -2735,229 +2740,229 @@ void ObjectsManager::VBOB_OFF(int idx) { } void ObjectsManager::doActionBack(int idx) { - if (_vm->_globals._curGestureFile != 1) { - _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); - _vm->_globals._curGestureFile = 1; - _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("DOS.SPR"); + if (_curGestureFile != 1) { + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); + _curGestureFile = 1; + _gestureBuf = _vm->_fileManager.loadFile("DOS.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals._gestureBuf, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 5: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); break; case 6: - SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "20,19,18,17,16,15,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); break; case 8: - SPACTION1(_vm->_globals._gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "15,16,17,18,19,20,21,22,23,24,-1,", 0, 0, 8, false); break; case 10: - SPACTION1(_vm->_globals._gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "23,22,21,20,19,18,17,16,15,-1,", 0, 0, 8); break; } } void ObjectsManager::doActionRight(int idx) { - if (_vm->_globals._curGestureFile != 3) { - _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); - _vm->_globals._curGestureFile = 3; - _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR"); + if (_curGestureFile != 3) { + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); + _curGestureFile = 3; + _gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals._gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals._gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, false); break; case 5: - SPACTION(_vm->_globals._gestureBuf, "23,24,25,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "23,24,25,-1,", 0, 0, 8, false); break; case 6: - SPACTION1(_vm->_globals._gestureBuf, "24,,23,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "24,,23,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, false); break; case 8: - SPACTION1(_vm->_globals._gestureBuf, "26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "26,25,24,23,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, false); break; case 10: - SPACTION1(_vm->_globals._gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8); break; } } void ObjectsManager::doActionDiagRight(int idx) { - if (_vm->_globals._curGestureFile != 4) { - _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); - _vm->_globals._curGestureFile = 4; - _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("3Q.SPR"); + if (_curGestureFile != 4) { + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); + _curGestureFile = 4; + _gestureBuf = _vm->_fileManager.loadFile("3Q.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals._gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 5: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "15,16,17,18,-1,", 0, 0, 8, false); break; case 6: - SPACTION1(_vm->_globals._gestureBuf, "17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "17,16,15,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "15,16,17,18,19,20-1,", 0, 0, 8, false); break; case 8: - SPACTION1(_vm->_globals._gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, false); break; case 10: - SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8); break; } } void ObjectsManager::doActionFront(int idx) { - if (_vm->_globals._curGestureFile != 2) { - _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); - _vm->_globals._curGestureFile = 2; - _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("FACE.SPR"); + if (_curGestureFile != 2) { + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); + _curGestureFile = 2; + _gestureBuf = _vm->_fileManager.loadFile("FACE.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,9,9,9,9,9,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; case 2: - SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false); + SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,-1,", 0, 0, 8, false); break; case 3: - SPACTION1(_vm->_globals._gestureBuf, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,9,10,11,12,13,14,13,12,11,10,9,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, false); break; } } void ObjectsManager::doActionDiagLeft(int idx) { - if (_vm->_globals._curGestureFile != 4) { - _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); - _vm->_globals._curGestureFile = 4; - _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("3Q.SPR"); + if (_curGestureFile != 4) { + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); + _curGestureFile = 4; + _gestureBuf = _vm->_fileManager.loadFile("3Q.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,8,8,8,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); break; case 2: - SPACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 8, true); break; case 3: - SPACTION1(_vm->_globals._gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals._gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); + ACTION(_gestureBuf, "0,1,2,3,4,5,6,7,8,9,10,11,12,11,12,11,12,11,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, true); break; case 5: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "15,16,17,18,-1,", 0, 0, 8, true); break; case 6: - SPACTION1(_vm->_globals._gestureBuf, "17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "17,16,15,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "15,16,17,18,19,20,-1,", 0, 0, 8, true); break; case 8: - SPACTION1(_vm->_globals._gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "19,18,17,16,15,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals._gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "15,16,17,18,19,20,21,-1,", 0, 0, 8, true); break; case 10: - SPACTION1(_vm->_globals._gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "20,19,18,17,15,-1,", 0, 0, 8); break; } } void ObjectsManager::doActionLeft(int idx) { - if (_vm->_globals._curGestureFile != 3) { - _vm->_globals._gestureBuf = _vm->_globals.freeMemory(_vm->_globals._gestureBuf); - _vm->_globals._curGestureFile = 3; - _vm->_globals._gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR"); + if (_curGestureFile != 3) { + _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); + _curGestureFile = 3; + _gestureBuf = _vm->_fileManager.loadFile("PROFIL.SPR"); } switch (idx) { case 1: - ACTION(_vm->_globals._gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true); + ACTION(_gestureBuf, "20,19,18,17,16,15,14,13,13,13,13,13,14,15,16,17,18,19,20,-1,", 0, 0, 8, true); break; case 2: - SPACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "1,2,3,4,5,6,7,8,-1,", 0, 0, 8, true); break; case 3: - SPACTION1(_vm->_globals._gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "9,10,11,12,13,14,15,16,17,18,19,20,-1,", 0, 0, 8); break; case 4: - ACTION(_vm->_globals._gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true); + ACTION(_gestureBuf, "1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,-1,", 0, 0, 8, true); break; case 5: - SPACTION(_vm->_globals._gestureBuf, "23,24,25,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "23,24,25,-1,", 0, 0, 8, true); break; case 6: - SPACTION1(_vm->_globals._gestureBuf, "24,,23,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "24,,23,-1,", 0, 0, 8); break; case 7: - SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "23,24,25,26,27,-1,", 0, 0, 8, true); break; case 8: - SPACTION1(_vm->_globals._gestureBuf, "26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "26,25,24,23,-1,", 0, 0, 8); break; case 9: - SPACTION(_vm->_globals._gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true); + SPACTION(_gestureBuf, "23,24,25,26,27,28,29,-1,", 0, 0, 8, true); break; case 10: - SPACTION1(_vm->_globals._gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8); + SPACTION1(_gestureBuf, "28,27,26,25,24,23,-1,", 0, 0, 8); break; } } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7093092bc2..ccf2e7a6ad 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -93,7 +93,9 @@ private: int _verb; int _oldSpriteIndex; bool _oldFlipFl; -private: + int _curGestureFile; + byte *_gestureBuf; + void sprite_alone(const byte *objectData, byte *sprite, int objIndex); void DEL_FICHIER_OBJ(); -- cgit v1.2.3 From 0a1cc63abb4e4a43bc8b865fb50c753e7a6669af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 08:24:10 +0100 Subject: HOPKINS: More renaming and refactoring --- engines/hopkins/dialogs.cpp | 12 +++++++----- engines/hopkins/dialogs.h | 1 + engines/hopkins/globals.cpp | 6 +----- engines/hopkins/globals.h | 2 -- engines/hopkins/hopkins.cpp | 4 ++-- engines/hopkins/objects.cpp | 8 +++++--- engines/hopkins/objects.h | 1 + engines/hopkins/script.cpp | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 690093f22b..e13e820bb8 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -43,10 +43,12 @@ DialogsManager::DialogsManager() { _inventWidth = _inventHeight = 0; _inventWin1 = g_PTRNUL; _inventBuf2 = g_PTRNUL; + _inventoryIcons = NULL; } DialogsManager::~DialogsManager() { _vm->_globals.freeMemory(_inventWin1); + free(_inventoryIcons); } void DialogsManager::setParent(HopkinsEngine *vm) { @@ -491,26 +493,26 @@ void DialogsManager::inventAnim() { _vm->_graphicsManager.addVesaSegment(_vm->_objectsManager._oldInventoryPosX, 27, _vm->_objectsManager._oldInventoryPosX + 48, 65); int newOffset = _vm->_graphicsManager._scrollOffset + 2; - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.ICONE, newOffset + 300, 327, 0); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _inventoryIcons, newOffset + 300, 327, 0); _vm->_graphicsManager.addVesaSegment(newOffset, 27, newOffset + 45, 62); _vm->_objectsManager._oldInventoryPosX = newOffset; } if (_vm->_globals._saveData->_data[svField357] == 1) { if (_vm->_globals._saveData->_data[svField353] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false); if (_vm->_globals._saveData->_data[svField355] == 1) - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 866, 325, 1, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 866, 325, 1, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); _vm->_graphicsManager.addVesaSegment(566, 25, 594, 60); } if (_vm->_globals._saveData->_data[svField356] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } if (_vm->_globals._saveData->_data[svField354] == 1) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.TETE, 832, 325, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false); _vm->_graphicsManager.addVesaSegment(532, 25, 560, 60); } } diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index d0fd69250f..fd35eca687 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -48,6 +48,7 @@ public: bool _inventFl; int _inventX, _inventY; int _inventWidth, _inventHeight; + byte *_inventoryIcons; DialogsManager(); ~DialogsManager(); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index fc45a9277b..37dce104ed 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -65,7 +65,7 @@ Globals::Globals() { g_PTRNUL = (byte *)malloc(16); strcpy((char *)g_PTRNUL, "POINTERNULL"); - // Initialise array properties + // Initialize array properties for (int i = 0; i < 6; ++i) CACHE_BANQUE[i] = g_PTRNUL; for (int i = 0; i < 35; ++i) @@ -104,7 +104,6 @@ Globals::Globals() { _oldDirection = 0; _oldDirectionSpriteIdx = 59; _lastDirection = 0; - TETE = NULL; NUM_FICHIER_OBJ = 0; nbrligne = 0; _boxWidth = 0; @@ -144,7 +143,6 @@ Globals::Globals() { _oceanDirection = 0; // Initialize pointers - ICONE = NULL; BUF_ZONE = NULL; for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = NULL; @@ -181,8 +179,6 @@ Globals::Globals() { } Globals::~Globals() { - free(ICONE); - freeMemory(TETE); freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7e46773caa..0eed175462 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -290,8 +290,6 @@ public: int _oldRouteDestY; int _oldZoneNum; - byte *TETE; - byte *ICONE; bool NOMARCHE; int iRegul; byte *BUF_ZONE; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 296c863934..2b7c026111 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1593,8 +1593,8 @@ void HopkinsEngine::initializeSystem() { _fontManager._font = _fileManager.loadFile("FONTE3.SPR"); _fontManager._fontFixedWidth = 12; _fontManager._fontFixedHeight = 21; - _globals.ICONE = _fileManager.loadFile("ICONE.SPR"); - _globals.TETE = _fileManager.loadFile("TETE.SPR"); + _dialogsManager._inventoryIcons = _fileManager.loadFile("ICONE.SPR"); + _objectsManager._headSprites = _fileManager.loadFile("TETE.SPR"); switch (_globals._language) { case LANG_EN: diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0f7ff52f9e..e21eb7f347 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -78,11 +78,13 @@ ObjectsManager::ObjectsManager() { _forestSprite = NULL; _gestureBuf = NULL; _curGestureFile = 0; + _headSprites = NULL; } ObjectsManager::~ObjectsManager() { _vm->_globals.freeMemory(_forestSprite); _vm->_globals.freeMemory(_gestureBuf); + _vm->_globals.freeMemory(_headSprites); } void ObjectsManager::setParent(HopkinsEngine *vm) { @@ -91,7 +93,7 @@ void ObjectsManager::setParent(HopkinsEngine *vm) { void ObjectsManager::clearAll() { _forestFl = false; - _forestSprite = g_PTRNUL; + _forestSprite = _vm->_globals.freeMemory(_forestSprite); _curGestureFile = 0; _gestureBuf = _vm->_globals.freeMemory(_gestureBuf); } @@ -2103,7 +2105,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_zoomFactor = _sprite[0]._animationType; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 3, loc->_zoomFactor, false, 20, 127); + addStaticSprite(_headSprites, loc->_pos, 1, 3, loc->_zoomFactor, false, 20, 127); animateSprite(1); removeSprite(0); @@ -2128,7 +2130,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc->_zoomFactor = _sprite[0]._zoomFactor; removeSprite(1); - addStaticSprite(_vm->_globals.TETE, loc->_pos, 1, 2, loc->_zoomFactor, false, 34, 190); + addStaticSprite(_headSprites, loc->_pos, 1, 2, loc->_zoomFactor, false, 34, 190); animateSprite(1); removeSprite(0); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index ccf2e7a6ad..a39fe29772 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -164,6 +164,7 @@ public: byte *_forestSprite; byte *_saveLoadSprite; byte *_saveLoadSprite2; + byte *_headSprites; SpriteItem _sprite[6]; BobItem _bob[36]; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 04cacf6ec8..d4d008bb07 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -224,7 +224,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField356] == 1 && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { _vm->_objectsManager.addStaticSprite( - _vm->_globals.TETE, + _vm->_objectsManager._headSprites, _vm->_globals._saveData->_realHopkins._pos, 1, 2, @@ -239,7 +239,7 @@ int ScriptManager::handleOpcode(byte *dataP) { && _vm->_globals._saveData->_data[svField355] == 1 && _vm->_globals._saveData->_samantha._location == _vm->_globals._screenId) { _vm->_objectsManager.addStaticSprite( - _vm->_globals.TETE, + _vm->_objectsManager._headSprites, _vm->_globals._saveData->_samantha._pos, 1, 3, @@ -2210,7 +2210,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._saveData->_data[svField355] = 1; _vm->_objectsManager._twoCharactersFl = true; _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 373, 191, 3); - _vm->_objectsManager.addStaticSprite(_vm->_globals.TETE, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127); + _vm->_objectsManager.addStaticSprite(_vm->_objectsManager._headSprites, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127); _vm->_objectsManager.animateSprite(1); break; } -- cgit v1.2.3 From 93dc7c8e63f138a3d3bac4474cd3065b053ed22a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 08:33:42 +0100 Subject: HOPKINS: Move mouse data initialization to EventsManager, set mouse variable as private --- engines/hopkins/dialogs.cpp | 4 ++-- engines/hopkins/events.cpp | 33 +++++++++++++++++++++++++++++++++ engines/hopkins/events.h | 6 ++++-- engines/hopkins/hopkins.cpp | 31 +------------------------------ 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e13e820bb8..fe5f8cc2a5 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -43,12 +43,12 @@ DialogsManager::DialogsManager() { _inventWidth = _inventHeight = 0; _inventWin1 = g_PTRNUL; _inventBuf2 = g_PTRNUL; - _inventoryIcons = NULL; + _inventoryIcons = g_PTRNUL; } DialogsManager::~DialogsManager() { _vm->_globals.freeMemory(_inventWin1); - free(_inventoryIcons); + _vm->_globals.freeMemory(_inventoryIcons); } void DialogsManager::setParent(HopkinsEngine *vm) { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index c55d0c5395..769696e2a0 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -64,6 +64,39 @@ void EventsManager::setParent(HopkinsEngine *vm) { _vm = vm; } +void EventsManager::initMouseData() { + if (_vm->getPlatform() == Common::kPlatformLinux) + _mouseLinuxFl = true; + else + _mouseLinuxFl = false; + + if (_mouseLinuxFl) { + _mouseSizeX = 52; + _mouseSizeY = 32; + } else { + _mouseSizeX = 34; + _mouseSizeY = 20; + } + + switch (_vm->_globals._language) { + case LANG_EN: + if (!_mouseLinuxFl) + _mouseCursor = _vm->_fileManager.loadFile("SOUAN.SPR"); + else + _mouseCursor = _vm->_fileManager.loadFile("LSOUAN.SPR"); + break; + case LANG_FR: + if (!_mouseLinuxFl) + _mouseCursor = _vm->_fileManager.loadFile("SOUFR.SPR"); + else + _mouseCursor = _vm->_fileManager.loadFile("LSOUFR.SPR"); + break; + case LANG_SP: + _mouseCursor = _vm->_fileManager.loadFile("SOUES.SPR"); + break; + } +} + // Mouse On void EventsManager::setMouseOn() { _mouseFl = true; diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 03f8593091..d4759dfe1b 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -42,6 +42,8 @@ private: uint32 _priorCounterTime; uint32 _priorFrameTime; bool _keyState[256]; + bool _mouseLinuxFl; + int _mouseSizeX, _mouseSizeY; HopkinsEngine *_vm; @@ -56,7 +58,6 @@ public: uint32 _gameCounter; bool _escKeyFl; bool _mouseFl; - bool _mouseLinuxFl; bool _breakoutFl; Common::Point _startPos; Common::Point _mousePos; @@ -65,13 +66,14 @@ public: int _curMouseButton; int _mouseButton; int _mouseCursorId; - int _mouseSizeX, _mouseSizeY; byte *_objectBuf; byte *_mouseCursor; EventsManager(); ~EventsManager(); void setParent(HopkinsEngine *vm); + void initMouseData(); + void delay(int totalMilli); void changeMouseCursor(int id); void refreshEvents(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2b7c026111..a8695dbe70 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1557,36 +1557,7 @@ void HopkinsEngine::initializeSystem() { SearchMan.addSubDirectoryMatching(gameDataDir, "VOICE"); SearchMan.addSubDirectoryMatching(gameDataDir, "TSVGA"); - if (getPlatform() == Common::kPlatformLinux) - _eventsManager._mouseLinuxFl = true; - else - _eventsManager._mouseLinuxFl = false; - - if (_eventsManager._mouseLinuxFl) { - _eventsManager._mouseSizeX = 52; - _eventsManager._mouseSizeY = 32; - } else { - _eventsManager._mouseSizeX = 34; - _eventsManager._mouseSizeY = 20; - } - - switch (_globals._language) { - case LANG_EN: - if (!_eventsManager._mouseLinuxFl) - _eventsManager._mouseCursor = _fileManager.loadFile("SOUAN.SPR"); - else - _eventsManager._mouseCursor = _fileManager.loadFile("LSOUAN.SPR"); - break; - case LANG_FR: - if (!_eventsManager._mouseLinuxFl) - _eventsManager._mouseCursor = _fileManager.loadFile("SOUFR.SPR"); - else - _eventsManager._mouseCursor = _fileManager.loadFile("LSOUFR.SPR"); - break; - case LANG_SP: - _eventsManager._mouseCursor = _fileManager.loadFile("SOUES.SPR"); - break; - } + _eventsManager.initMouseData(); _globals.clearAll(); -- cgit v1.2.3 From 4c1047cb81ced0df18b5cedf72438576ad4e31e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 08:41:22 +0100 Subject: HOPKINS: Use freeMemory instead of free in some spaces --- engines/hopkins/files.cpp | 2 +- engines/hopkins/globals.cpp | 2 +- engines/hopkins/talk.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 71d06ddd22..bc4c8d2e56 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -78,7 +78,7 @@ void FileManager::initCensorship() { if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K')) _vm->_globals._censorshipFl = true; - free(data); + _vm->_globals.freeMemory((byte *)data); } } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 37dce104ed..1848e7fdb4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -339,7 +339,7 @@ void Globals::loadObjects() { ObjetW[idx].field7 = *srcP++; } - free(data); + freeMemory(data); } byte *Globals::allocMemory(int count) { diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 7b12ca301b..4c19856ad4 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -582,7 +582,7 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) { ++lineCount; curBufIndx += lineSize; } while (curChar != '%'); - free(decryptBuf); + _vm->_globals.freeMemory(decryptBuf); return lineCount; } -- cgit v1.2.3 From d1a19a1d4c3e20b57250e73141d81e8d9b44a2a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 08:47:33 +0100 Subject: HOPKINS: Move font initialization to FontsManager --- engines/hopkins/font.cpp | 6 ++++++ engines/hopkins/font.h | 3 ++- engines/hopkins/hopkins.cpp | 8 +++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 90f73cfdbe..83237846a2 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -71,6 +71,12 @@ void FontManager::clearAll() { _tempText = g_PTRNUL; } +void FontManager::initData() { + _font = _vm->_fileManager.loadFile("FONTE3.SPR"); + _fontFixedWidth = 12; + _fontFixedHeight = 21; + +} /** * Display Text */ diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h index 5260025f27..837539dd2f 100644 --- a/engines/hopkins/font.h +++ b/engines/hopkins/font.h @@ -78,8 +78,9 @@ public: FontManager(); ~FontManager(); void setParent(HopkinsEngine *vm); - void clearAll(); + void initData(); + void showText(int idx); void hideText(int idx); void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a8695dbe70..90bf6d98b0 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1557,13 +1557,11 @@ void HopkinsEngine::initializeSystem() { SearchMan.addSubDirectoryMatching(gameDataDir, "VOICE"); SearchMan.addSubDirectoryMatching(gameDataDir, "TSVGA"); - _eventsManager.initMouseData(); - _globals.clearAll(); - _fontManager._font = _fileManager.loadFile("FONTE3.SPR"); - _fontManager._fontFixedWidth = 12; - _fontManager._fontFixedHeight = 21; + _eventsManager.initMouseData(); + _fontManager.initData(); + _dialogsManager._inventoryIcons = _fileManager.loadFile("ICONE.SPR"); _objectsManager._headSprites = _fileManager.loadFile("TETE.SPR"); -- cgit v1.2.3 From 53beb9a26ca737873e01acfa820ef683e6f1e3e8 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 15 Feb 2013 18:34:06 +0100 Subject: HOPKINS: Add detection entry for uninstalled BeOS version It won't quite detect as it appears on the CD - you need to put the Hopkins.pkg file in the HOPDATA - and since that file isn't actually needed we may want to re-think that in the future. But at least it will make it easier to test this version. --- engines/hopkins/detection_tables.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h index a5a0242402..050bc82e6e 100644 --- a/engines/hopkins/detection_tables.h +++ b/engines/hopkins/detection_tables.h @@ -204,6 +204,23 @@ static const HopkinsGameDescription gameDescriptions[] = { }, }, + { + // Hopkins FBI BeOS, uninstalled, provided by eriktorbjorn + { + "hopkins", + 0, + { + {"ENG_VOI.RES", 0, "fa5789d1d8c19d160bce44a33e742fdf", 66860711}, + {"Hopkins.pkg", 0, "72f97806dd3d5fc0c0eb24196f180618", 285017}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformBeOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From bda951c5e2785cba6289123327c0cda9ab3f82a7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 21:34:08 +0100 Subject: HOPKINS: Fix 2 comments of LordHoto --- engines/hopkins/detection.cpp | 2 +- engines/hopkins/hopkins.h | 6 +++--- engines/hopkins/sound.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 2e122a17a2..7711a053b5 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -83,7 +83,7 @@ public: } virtual const char *getOriginalCopyright() const { - return "Hopkins Engine (C) ???"; + return "Hopkins FBI (c)1997-2003 MP Entertainment"; } virtual bool hasFeature(MetaEngineFeature f) const; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 4a01dc0f92..e058ce36c0 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -20,8 +20,8 @@ * */ -#ifndef HOPKINS_H -#define HOPKINS_H +#ifndef HOPKINS_HOPKINS_H +#define HOPKINS_HOPKINS_H #include "common/scummsys.h" #include "common/system.h" @@ -193,4 +193,4 @@ extern HopkinsEngine *g_vm; } // End of namespace Hopkins -#endif /* HOPKINS_H */ +#endif /* HOPKINS_HOPKINS_H */ diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index e30e670b27..1e9d02a3ae 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -330,7 +330,7 @@ void SoundManager::playAnimSound(int soundNumber) { } } -static const char *modSounds[] = { +static const char *const modSounds[] = { "appart", "ville", "Rock", "police", "deep", "purgat", "riviere", "SUSPENS", "labo", "cadavre", "cabane", "purgat2", "foret", "ile", "ile2", -- cgit v1.2.3 From 84e290eade13bfdff1e866d058af447893bee321 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 22:20:24 +0100 Subject: HOPKINS: Reorder includes --- engines/hopkins/anim.cpp | 12 +++++++----- engines/hopkins/computer.cpp | 8 +++++--- engines/hopkins/debugger.cpp | 1 + engines/hopkins/detection.cpp | 5 ++--- engines/hopkins/dialogs.cpp | 12 +++++++----- engines/hopkins/events.cpp | 8 +++++--- engines/hopkins/files.cpp | 2 ++ engines/hopkins/font.cpp | 8 +++++--- engines/hopkins/globals.cpp | 6 ++++-- engines/hopkins/graphics.cpp | 10 ++++++---- engines/hopkins/hopkins.cpp | 13 +++++++------ engines/hopkins/hopkins.h | 17 +++++++++-------- engines/hopkins/lines.cpp | 6 ++++-- engines/hopkins/menu.cpp | 10 ++++++---- engines/hopkins/objects.cpp | 12 +++++++----- engines/hopkins/objects.h | 3 ++- engines/hopkins/saveload.cpp | 12 +++++++----- engines/hopkins/saveload.h | 4 +++- engines/hopkins/script.cpp | 11 ++++++----- engines/hopkins/script.h | 3 ++- engines/hopkins/sound.cpp | 8 +++++--- engines/hopkins/talk.cpp | 10 ++++++---- 22 files changed, 108 insertions(+), 73 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index bc09d421e4..2186967922 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -20,17 +20,19 @@ * */ -#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" +#include "common/system.h" +#include "graphics/palette.h" +#include "common/file.h" +#include "common/rect.h" +#include "engines/util.h" + namespace Hopkins { AnimationManager::AnimationManager() { diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 6a4459857e..7d664acee9 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -20,10 +20,8 @@ * */ -#include "common/system.h" -#include "common/file.h" -#include "common/textconsole.h" #include "hopkins/computer.h" + #include "hopkins/font.h" #include "hopkins/files.h" #include "hopkins/globals.h" @@ -31,6 +29,10 @@ #include "hopkins/hopkins.h" #include "hopkins/objects.h" +#include "common/system.h" +#include "common/file.h" +#include "common/textconsole.h" + namespace Hopkins { ComputerManager::ComputerManager() { diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp index c53e9075b6..0abfd1f62e 100644 --- a/engines/hopkins/debugger.cpp +++ b/engines/hopkins/debugger.cpp @@ -21,6 +21,7 @@ */ #include "hopkins/debugger.h" + #include "hopkins/globals.h" #include "hopkins/graphics.h" #include "hopkins/hopkins.h" diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 7711a053b5..a42597415b 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -21,8 +21,9 @@ * */ -#include "base/plugins.h" +#include "hopkins/hopkins.h" +#include "base/plugins.h" #include "common/savefile.h" #include "common/str-array.h" #include "common/memstream.h" @@ -31,8 +32,6 @@ #include "graphics/colormasks.h" #include "graphics/surface.h" -#include "hopkins/hopkins.h" - #define MAX_SAVES 99 namespace Hopkins { diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index fe5f8cc2a5..574100e9df 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -20,12 +20,8 @@ * */ -#include "common/scummsys.h" -#include "common/config-manager.h" -#include "common/events.h" -#include "common/file.h" -#include "common/util.h" #include "hopkins/dialogs.h" + #include "hopkins/events.h" #include "hopkins/files.h" #include "hopkins/globals.h" @@ -33,6 +29,12 @@ #include "hopkins/hopkins.h" #include "hopkins/sound.h" +#include "common/scummsys.h" +#include "common/config-manager.h" +#include "common/events.h" +#include "common/file.h" +#include "common/util.h" + namespace Hopkins { DialogsManager::DialogsManager() { diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 769696e2a0..f097405394 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -20,15 +20,17 @@ * */ -#include "common/system.h" -#include "common/textconsole.h" -#include "graphics/cursorman.h" #include "hopkins/events.h" + #include "hopkins/files.h" #include "hopkins/globals.h" #include "hopkins/hopkins.h" #include "hopkins/sound.h" +#include "common/system.h" +#include "common/textconsole.h" +#include "graphics/cursorman.h" + namespace Hopkins { EventsManager::EventsManager() { diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index bc4c8d2e56..e0cd1a3995 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -21,8 +21,10 @@ */ #include "hopkins/files.h" + #include "hopkins/hopkins.h" #include "hopkins/globals.h" + #include "common/system.h" #include "common/debug.h" #include "common/file.h" diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 83237846a2..3343c2fd10 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -20,16 +20,18 @@ * */ -#include "common/system.h" -#include "common/file.h" -#include "common/textconsole.h" #include "hopkins/font.h" + #include "hopkins/files.h" #include "hopkins/globals.h" #include "hopkins/graphics.h" #include "hopkins/hopkins.h" #include "hopkins/objects.h" +#include "common/system.h" +#include "common/file.h" +#include "common/textconsole.h" + namespace Hopkins { FontManager::FontManager() { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 1848e7fdb4..06807b3940 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -20,14 +20,16 @@ * */ -#include "common/textconsole.h" -#include "common/file.h" #include "hopkins/globals.h" + #include "hopkins/files.h" #include "hopkins/font.h" #include "hopkins/graphics.h" #include "hopkins/hopkins.h" +#include "common/textconsole.h" +#include "common/file.h" + namespace Hopkins { // Global null pointer. This is needed by the engine to recognise NULL pointers, since diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ccdd8adb36..61af620769 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -20,16 +20,18 @@ * */ +#include "hopkins/graphics.h" + +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" + #include "common/system.h" #include "graphics/palette.h" #include "graphics/decoders/pcx.h" #include "common/file.h" #include "common/rect.h" #include "engines/util.h" -#include "hopkins/files.h" -#include "hopkins/globals.h" -#include "hopkins/graphics.h" -#include "hopkins/hopkins.h" namespace Hopkins { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 90bf6d98b0..ab3fe1fc56 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -20,18 +20,19 @@ * */ -#include "common/scummsys.h" -#include "common/config-manager.h" -#include "common/debug-channels.h" -#include "common/events.h" -#include "common/file.h" -#include "hopkins/graphics.h" #include "hopkins/hopkins.h" +#include "hopkins/graphics.h" #include "hopkins/files.h" #include "hopkins/saveload.h" #include "hopkins/sound.h" #include "hopkins/talk.h" +#include "common/scummsys.h" +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "common/events.h" +#include "common/file.h" + namespace Hopkins { HopkinsEngine *g_vm; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index e058ce36c0..d3e735df10 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -23,14 +23,6 @@ #ifndef HOPKINS_HOPKINS_H #define HOPKINS_HOPKINS_H -#include "common/scummsys.h" -#include "common/system.h" -#include "common/error.h" -#include "common/random.h" -#include "common/hash-str.h" -#include "common/util.h" -#include "engines/engine.h" -#include "graphics/surface.h" #include "hopkins/anim.h" #include "hopkins/computer.h" #include "hopkins/debugger.h" @@ -48,6 +40,15 @@ #include "hopkins/sound.h" #include "hopkins/talk.h" +#include "common/scummsys.h" +#include "common/system.h" +#include "common/error.h" +#include "common/random.h" +#include "common/hash-str.h" +#include "common/util.h" +#include "engines/engine.h" +#include "graphics/surface.h" + /** * This is the namespace of the Hopkins engine. * diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index db9ea2f3eb..38c42b8363 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -20,12 +20,14 @@ * */ -#include "common/system.h" -#include "common/textconsole.h" #include "hopkins/lines.h" + #include "hopkins/graphics.h" #include "hopkins/hopkins.h" +#include "common/system.h" +#include "common/textconsole.h" + namespace Hopkins { LinesManager::LinesManager() { diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index 798acc2a8e..f8868ddf27 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -20,11 +20,8 @@ * */ -#include "common/scummsys.h" -#include "common/events.h" -#include "common/file.h" -#include "common/util.h" #include "hopkins/menu.h" + #include "hopkins/dialogs.h" #include "hopkins/files.h" #include "hopkins/hopkins.h" @@ -33,6 +30,11 @@ #include "hopkins/graphics.h" #include "hopkins/sound.h" +#include "common/scummsys.h" +#include "common/events.h" +#include "common/file.h" +#include "common/util.h" + namespace Hopkins { void MenuManager::setParent(HopkinsEngine *vm) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e21eb7f347..bbb2e38ddb 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -20,17 +20,19 @@ * */ -#include "common/system.h" -#include "graphics/palette.h" -#include "common/file.h" -#include "common/rect.h" -#include "engines/util.h" #include "hopkins/objects.h" + #include "hopkins/dialogs.h" #include "hopkins/files.h" #include "hopkins/globals.h" #include "hopkins/hopkins.h" +#include "common/system.h" +#include "graphics/palette.h" +#include "common/file.h" +#include "common/rect.h" +#include "engines/util.h" + namespace Hopkins { ObjectsManager::ObjectsManager() { diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index a39fe29772..7dc58b0b10 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -23,10 +23,11 @@ #ifndef HOPKINS_OBJECTS_H #define HOPKINS_OBJECTS_H +#include "hopkins/globals.h" + #include "common/scummsys.h" #include "common/endian.h" #include "common/str.h" -#include "hopkins/globals.h" #define MAX_SPRITE 5 namespace Hopkins { diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 7f0dd9cd60..ab9ff33b1d 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -20,16 +20,18 @@ * */ +#include "hopkins/saveload.h" + +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" + + #include "common/system.h" #include "common/savefile.h" #include "graphics/surface.h" #include "graphics/scaler.h" #include "graphics/thumbnail.h" -#include "hopkins/saveload.h" -#include "hopkins/files.h" -#include "hopkins/globals.h" -#include "hopkins/graphics.h" -#include "hopkins/hopkins.h" namespace Hopkins { diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index b4cdf8ed02..2a7806e759 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -23,11 +23,13 @@ #ifndef HOPKINS_SAVELOAD_H #define HOPKINS_SAVELOAD_H +#include "hopkins/globals.h" +#include "hopkins/graphics.h" + #include "common/scummsys.h" #include "common/savefile.h" #include "common/serializer.h" #include "common/str.h" -#include "hopkins/globals.h" namespace Hopkins { diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d4d008bb07..aed99045c4 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -20,11 +20,6 @@ * */ -#include "common/system.h" -#include "graphics/palette.h" -#include "common/file.h" -#include "common/rect.h" -#include "engines/util.h" #include "hopkins/objects.h" #include "hopkins/dialogs.h" #include "hopkins/files.h" @@ -32,6 +27,12 @@ #include "hopkins/sound.h" #include "hopkins/hopkins.h" +#include "common/system.h" +#include "graphics/palette.h" +#include "common/file.h" +#include "common/rect.h" +#include "engines/util.h" + namespace Hopkins { ScriptManager::ScriptManager() { diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index 40b9612627..d29efee01e 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -23,10 +23,11 @@ #ifndef HOPKINS_SCRIPT_H #define HOPKINS_SCRIPT_H +#include "hopkins/globals.h" + #include "common/scummsys.h" #include "common/endian.h" #include "common/str.h" -#include "hopkins/globals.h" namespace Hopkins { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 1e9d02a3ae..87943872d4 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -20,14 +20,16 @@ * */ +#include "hopkins/sound.h" + +#include "hopkins/globals.h" +#include "hopkins/hopkins.h" + #include "audio/decoders/adpcm_intern.h" #include "common/system.h" #include "common/config-manager.h" #include "common/file.h" #include "common/textconsole.h" -#include "hopkins/sound.h" -#include "hopkins/globals.h" -#include "hopkins/hopkins.h" #include "audio/audiostream.h" #include "audio/mods/module.h" #include "audio/mods/protracker.h" diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 4c19856ad4..61ea1b6438 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -20,17 +20,19 @@ * */ -#include "common/system.h" -#include "common/endian.h" -#include "common/file.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" +#include "common/system.h" +#include "common/endian.h" +#include "common/file.h" +#include "common/textconsole.h" + namespace Hopkins { TalkManager::TalkManager() { -- cgit v1.2.3 From 2301dc8f3830cff05277692d1f8e9920814cbf94 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 23:41:05 +0100 Subject: HOPKINS: Start refactoring MIRACLE --- engines/hopkins/lines.cpp | 267 ++++++++++++++++++++-------------------------- 1 file changed, 115 insertions(+), 152 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 38c42b8363..030f9eba51 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -225,11 +225,9 @@ void LinesManager::addLine(int idx, int direction, int a3, int a4, int a5, int a _linesNumb = idx; Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); - int v7 = abs(a3 - a5); - int v8 = v7 + 1; - int v9 = abs(a4 - a6); - int v34 = v9 + 1; - int v33 = v9 + 1; + int v8 = abs(a3 - a5) + 1; + int v34 = abs(a4 - a6) + 1; + int v33 = v34; if (v8 > v34) v34 = v8; @@ -573,33 +571,8 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *rout } bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { - int v5; - int v6; - int v7; - int v9; - int v10; - int i; - int v12; - int v13; - int j; - int v15; - int v16; - int k; - int v18; - int v19; - int l; - int v21; - int v23; - int v26; - int v29; - int v32; int v35 = 0; int v36 = 0; - int v37; - int v38; - int v39; - int v40; - int v41; int v42 = 0; int v43 = 0; int v44 = 0; @@ -608,13 +581,12 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int v47 = 0; int v48 = 0; int v49 = 0; - int v50; - int v51; - v5 = a1; - v6 = a2; - v50 = a3; - v7 = a5; + int v5 = a1; + int v6 = a2; + int v50 = a3; + int v7 = a5; + int v51; if (checkCollisionLine(a1, a2, &v51, &v50, 0, _linesNumb)) { switch (Ligne[v50]._direction) { case 1: @@ -622,7 +594,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { break; case 2: v6 -= 2; - v5 = a1 + 2; + v5 += 2; break; case 3: v5 += 2; @@ -647,11 +619,11 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { break; } } - v41 = v5; - v40 = v6; - v9 = 0; - v10 = v40; - for (i = v40; v40 + 200 > v10; i = v10) { + int v41 = v5; + int v40 = v6; + int v9 = 0; + int v10 = v40; + for (int i = v40; v40 + 200 > v10; i = v10) { if (checkCollisionLine(v41, i, &v49, &v48, 0, _lastLine) == 1 && v48 <= _lastLine) break; v49 = 0; @@ -659,10 +631,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { ++v9; ++v10; } - v37 = v9; - v12 = 0; - v13 = v40; - for (j = v40; v40 - 200 < v13; j = v13) { + int v37 = v9; + int v12 = 0; + int v13 = v40; + for (int j = v40; v40 - 200 < v13; j = v13) { if (checkCollisionLine(v41, j, &v47, &v46, 0, _lastLine) == 1 && v46 <= _lastLine) break; v47 = 0; @@ -670,10 +642,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { ++v12; --v13; } - v39 = v12; - v15 = 0; - v16 = v41; - for (k = v41; v41 + 200 > v16; k = v16) { + int v39 = v12; + int v15 = 0; + int v16 = v41; + for (int k = v41; v41 + 200 > v16; k = v16) { if (checkCollisionLine(k, v40, &v45, &v44, 0, _lastLine) == 1 && v44 <= _lastLine) break; v45 = 0; @@ -681,10 +653,10 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { ++v15; ++v16; } - v38 = v15; - v18 = 0; - v19 = v41; - for (l = v41; v41 - 200 < v19; l = v19) { + int v38 = v15; + int v18 = 0; + int v19 = v41; + for (int l = v41; v41 - 200 < v19; l = v19) { if (checkCollisionLine(l, v40, &v43, &v42, 0, _lastLine) == 1 && v42 <= _lastLine) break; v43 = 0; @@ -709,8 +681,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v48 = -1; if (v42 != -1 && a4 < v42) v42 = -1; - } - if (a4 < v50) { + } else if (a4 < v50) { if (v46 != -1 && v46 >= v50) v46 = -1; if (v44 != -1 && v50 <= v44) @@ -729,7 +700,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v42 = -1; } if (v46 != -1 || v44 != -1 || v48 != -1 || v42 != -1) { - v21 = 0; + int v21 = 0; if (a4 > v50) { if (v48 <= v46 && v44 <= v46 && v42 <= v46 && v46 > v50) v21 = 1; @@ -739,8 +710,7 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { v21 = 5; if (v48 <= v42 && v44 <= v42 && v46 <= v42 && v50 < v42) v21 = 7; - } - if (a4 < v50) { + } else if (a4 < v50) { if (v46 == -1) v46 = 1300; if (v44 == -1) @@ -758,107 +728,100 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v42 != 1300 && v48 >= v42 && v44 >= v42 && v46 >= v42 && v50 > v42) v21 = 7; } - if (v21) { - if (v21 == 1) { - v36 = v46; - v35 = v47; - } - if (v21 == 3) { - v36 = v44; - v35 = v45; - } - if (v21 == 5) { - v36 = v48; - v35 = v49; - } - if (v21 == 7) { - v36 = v42; - v35 = v43; - } - if (v21 == 1) { - for (int v22 = 0; v22 < v39; v22++) { - if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &super_parcours[0], 4); - if (v23 == -1) - return false; - v7 = v23; - if (NVPY != -1) - v22 = NVPY - v40; - } - super_parcours[v7] = v41; - super_parcours[v7 + 1] = v40 - v22; - super_parcours[v7 + 2] = 1; - super_parcours[v7 + 3] = 0; - v7 += 4; + + switch(v21) { + case 1: + v36 = v46; + v35 = v47; + for (int v22 = 0; v22 < v39; v22++) { + if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { + int v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &super_parcours[0], 4); + if (v23 == -1) + return false; + v7 = v23; + if (NVPY != -1) + v22 = NVPY - v40; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; - return true; + super_parcours[v7] = v41; + super_parcours[v7 + 1] = v40 - v22; + super_parcours[v7 + 2] = 1; + super_parcours[v7 + 3] = 0; + v7 += 4; } - if (v21 == 5) { - for (int v25 = 0; v25 < v37; v25++) { - if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &super_parcours[0], 4); - if (v26 == -1) - return false; - v7 = v26; - if (NVPY != -1) - v25 = v40 - NVPY; - } - super_parcours[v7] = v41; - super_parcours[v7 + 1] = v25 + v40; - super_parcours[v7 + 2] = 5; - super_parcours[v7 + 3] = 0; - v7 += 4; + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; + break; + case 3: + v36 = v44; + v35 = v45; + for (int v31 = 0; v31 < v38; v31++) { + if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { + int v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &super_parcours[0], 4); + if (v32 == -1) + return false; + v7 = v32; + if (NVPX != -1) + v31 = NVPX - v41; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; - return true; + super_parcours[v7] = v31 + v41; + super_parcours[v7 + 1] = v40; + super_parcours[v7 + 2] = 3; + super_parcours[v7 + 3] = 0; + v7 += 4; } - if (v21 == 7) { - for (int v28 = 0; v28 < v18; v28++) { - if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &super_parcours[0], 4); - if (v29 == -1) - return false; - v7 = v29; - if (NVPX != -1) - v28 = v41 - NVPX; - } - super_parcours[v7] = v41 - v28; - super_parcours[v7 + 1] = v40; - super_parcours[v7 + 2] = 7; - super_parcours[v7 + 3] = 0; - v7 += 4; + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; + break; + case 5: + v36 = v48; + v35 = v49; + for (int v25 = 0; v25 < v37; v25++) { + if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { + int v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &super_parcours[0], 4); + if (v26 == -1) + return false; + v7 = v26; + if (NVPY != -1) + v25 = v40 - NVPY; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; - return true; + super_parcours[v7] = v41; + super_parcours[v7 + 1] = v25 + v40; + super_parcours[v7 + 2] = 5; + super_parcours[v7 + 3] = 0; + v7 += 4; } - if (v21 == 3) { - for (int v31 = 0; v31 < v38; v31++) { - if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &super_parcours[0], 4); - if (v32 == -1) - return false; - v7 = v32; - if (NVPX != -1) - v31 = NVPX - v41; - } - super_parcours[v7] = v31 + v41; - super_parcours[v7 + 1] = v40; - super_parcours[v7 + 2] = 3; - super_parcours[v7 + 3] = 0; - v7 += 4; + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; + break; + case 7: + v36 = v42; + v35 = v43; + for (int v28 = 0; v28 < v18; v28++) { + if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { + int v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &super_parcours[0], 4); + if (v29 == -1) + return false; + v7 = v29; + if (NVPX != -1) + v28 = v41 - NVPX; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; - return true; + super_parcours[v7] = v41 - v28; + super_parcours[v7 + 1] = v40; + super_parcours[v7 + 2] = 7; + super_parcours[v7 + 3] = 0; + v7 += 4; } + NV_LIGNEDEP = v36; + NV_LIGNEOFS = v35; + NV_POSI = v7; + return true; + break; } } return false; -- cgit v1.2.3 From c5f800af1b565ba266185adbe3f60d467e31b4bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Feb 2013 23:57:23 +0100 Subject: HOPKINS: Some renaming, remove useless self-accessing code pointed by wjp --- engines/hopkins/lines.cpp | 99 +++++++++++++++++++++++------------------------ engines/hopkins/lines.h | 2 +- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 030f9eba51..bdcf59de24 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -570,7 +570,7 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *rout return v40; } -bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { +bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { int v35 = 0; int v36 = 0; int v42 = 0; @@ -582,45 +582,45 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { int v48 = 0; int v49 = 0; - int v5 = a1; - int v6 = a2; + int curX = fromX; + int curY = fromY; int v50 = a3; int v7 = a5; int v51; - if (checkCollisionLine(a1, a2, &v51, &v50, 0, _linesNumb)) { + if (checkCollisionLine(fromX, fromY, &v51, &v50, 0, _linesNumb)) { switch (Ligne[v50]._direction) { case 1: - v6 = a2 - 2; + curY -= 2; break; case 2: - v6 -= 2; - v5 += 2; + curY -= 2; + curX += 2; break; case 3: - v5 += 2; + curX += 2; break; case 4: - v6 += 2; - v5 += 2; + curY += 2; + curX += 2; break; case 5: - v6 += 2; + curY += 2; break; case 6: - v6 += 2; - v5 -= 2; + curY += 2; + curX -= 2; break; case 7: - v5 -= 2; + curX -= 2; break; case 8: - v6 -= 2; - v5 -= 2; + curY -= 2; + curX -= 2; break; } } - int v41 = v5; - int v40 = v6; + int v41 = curX; + int v40 = curY; int v9 = 0; int v10 = v40; for (int i = v40; v40 + 200 > v10; i = v10) { @@ -3037,9 +3037,9 @@ int LinesManager::colision(int xp, int yp) { int yMin = yp - 4; do { - int16 *dataP = _vm->_linesManager._zoneLine[curZoneLineIdx]._zoneData; + int16 *dataP = _zoneLine[curZoneLineIdx]._zoneData; if (dataP != (int16 *)g_PTRNUL) { - int count = _vm->_linesManager._zoneLine[curZoneLineIdx]._count; + int count = _zoneLine[curZoneLineIdx]._count; int v1 = dataP[0]; int v2 = dataP[1]; int v3 = dataP[count * 2 - 2]; @@ -3055,13 +3055,13 @@ int LinesManager::colision(int xp, int yp) { if (v2 >= v4 && (yMin > v2 || yMax < v4)) flag = false; - if (flag && _vm->_linesManager._zoneLine[curZoneLineIdx]._count > 0) { + if (flag && _zoneLine[curZoneLineIdx]._count > 0) { for (int i = 0; i < count; ++i) { int xCheck = *dataP++; int yCheck = *dataP++; if ((xp == xCheck || (xp + 1) == xCheck) && (yp == yCheck)) - return _vm->_linesManager._zoneLine[curZoneLineIdx]._bobZoneIdx; + return _zoneLine[curZoneLineIdx]._bobZoneIdx; } } } @@ -3085,18 +3085,18 @@ void LinesManager::CARRE_ZONE() { } for (int idx = 0; idx < MAX_LINES; ++idx) { - int16 *dataP = _vm->_linesManager._zoneLine[idx]._zoneData; + int16 *dataP = _zoneLine[idx]._zoneData; if (dataP == (int16 *)g_PTRNUL) continue; - int carreZoneId = _vm->_linesManager._zoneLine[idx]._bobZoneIdx; + int carreZoneId = _zoneLine[idx]._bobZoneIdx; _squareZone[carreZoneId]._enabledFl = 1; if (_squareZone[carreZoneId]._maxZoneLineIdx < idx) _squareZone[carreZoneId]._maxZoneLineIdx = idx; if (_squareZone[carreZoneId]._minZoneLineIdx > idx) _squareZone[carreZoneId]._minZoneLineIdx = idx; - for (int i = 0; i < _vm->_linesManager._zoneLine[idx]._count; i++) { + for (int i = 0; i < _zoneLine[idx]._count; i++) { int zoneX = *dataP++; int zoneY = *dataP++; @@ -3121,39 +3121,38 @@ void LinesManager::CARRE_ZONE() { void LinesManager::clearAll() { for (int idx = 0; idx < 105; ++idx) { - _vm->_linesManager.ZONEP[idx]._destX = 0; - _vm->_linesManager.ZONEP[idx]._destY = 0; - _vm->_linesManager.ZONEP[idx]._spriteIndex = 0; + ZONEP[idx]._destX = 0; + ZONEP[idx]._destY = 0; + ZONEP[idx]._spriteIndex = 0; } - _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; - _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; - _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; - _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + essai0 = (int16 *)g_PTRNUL; + essai1 = (int16 *)g_PTRNUL; + essai2 = (int16 *)g_PTRNUL; + BufLig = (int16 *)g_PTRNUL; + _route = (int16 *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { - _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; - _vm->_linesManager.Ligne[idx]._direction = 0; - _vm->_linesManager.Ligne[idx].field6 = 0; - _vm->_linesManager.Ligne[idx].field8 = 0; - _vm->_linesManager.Ligne[idx]._lineData = (int16 *)g_PTRNUL; + Ligne[idx]._lineDataEndIdx = 0; + Ligne[idx]._direction = 0; + Ligne[idx].field6 = 0; + Ligne[idx].field8 = 0; + Ligne[idx]._lineData = (int16 *)g_PTRNUL; - _vm->_linesManager._zoneLine[idx]._count = 0; - _vm->_linesManager._zoneLine[idx]._bobZoneIdx = 0; - _vm->_linesManager._zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; + _zoneLine[idx]._count = 0; + _zoneLine[idx]._bobZoneIdx = 0; + _zoneLine[idx]._zoneData = (int16 *)g_PTRNUL; } - for (int idx = 0; idx < 100; ++idx) { - _vm->_linesManager._squareZone[idx]._enabledFl = 0; - } + for (int idx = 0; idx < 100; ++idx) + _squareZone[idx]._enabledFl = 0; BUFFERTAPE = _vm->_globals.allocMemory(85000); - _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; - _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); - _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); - _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE + 75000); + essai0 = (int16 *)BUFFERTAPE; + essai1 = (int16 *)(BUFFERTAPE + 25000); + essai2 = (int16 *)(BUFFERTAPE + 50000); + BufLig = (int16 *)(BUFFERTAPE + 75000); } /** @@ -3241,11 +3240,11 @@ void LinesManager::checkZone() { if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + if (_vm->_globals.NOMARCHE || (_route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { - zoneId = _vm->_linesManager.MZONE(); + zoneId = MZONE();- } else { zoneId = _vm->_globals._oldMouseZoneId; } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index b9ae3e6e31..3d064a56ca 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -119,7 +119,7 @@ private: int CALC_PROPRE(int idx); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); - bool MIRACLE(int a1, int a2, int a3, int a4, int a5); + bool MIRACLE(int fromX, int fromY, int a3, int a4, int a5); int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); -- cgit v1.2.3 From 355422455cc8e99fd5faab5811d45a18231d3e41 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 16 Feb 2013 00:06:45 +0100 Subject: HOPKINS: Some more similar cleanup --- engines/hopkins/dialogs.cpp | 30 +++++++++++++++--------------- engines/hopkins/lines.cpp | 2 +- engines/hopkins/sound.cpp | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 574100e9df..93f86598bc 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -320,7 +320,7 @@ void DialogsManager::showInventory() { _vm->_eventsManager.getMouseY(); _vm->_eventsManager.VBL(); } - _vm->_dialogsManager._inventWin1 = g_PTRNUL; + _inventWin1 = g_PTRNUL; bool loopFl; do { @@ -352,18 +352,18 @@ void DialogsManager::showInventory() { error("Error opening file - %s", filename.c_str()); size_t filesize = f.size(); - _vm->_dialogsManager._inventWin1 = _vm->_globals.allocMemory(filesize); - _vm->_fileManager.readStream(f, _vm->_dialogsManager._inventWin1, filesize); + _inventWin1 = _vm->_globals.allocMemory(filesize); + _vm->_fileManager.readStream(f, _inventWin1, filesize); f.close(); _inventBuf2 = _vm->_fileManager.loadFile("INVENT2.SPR"); _inventX = _vm->_graphicsManager._scrollOffset + 152; _inventY = 114; - _inventWidth = _vm->_objectsManager.getWidth(_vm->_dialogsManager._inventWin1, 0); - _inventHeight = _vm->_objectsManager.getHeight(_vm->_dialogsManager._inventWin1, 0); + _inventWidth = _vm->_objectsManager.getWidth(_inventWin1, 0); + _inventHeight = _vm->_objectsManager.getHeight(_inventWin1, 0); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX + 300, 414, 0, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _inventWin1, _inventX + 300, 414, 0, 0, 0, false); int curPosY = 0; int inventCount = 0; for (int inventLine = 1; inventLine <= 5; inventLine++) { @@ -382,7 +382,7 @@ void DialogsManager::showInventory() { }; curPosY += 38; } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager._curMouseButton = 0; int newInventoryItem = 0; @@ -433,7 +433,7 @@ void DialogsManager::showInventory() { _vm->_globals._exitId = 0; _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); - _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + _inventWin1 = _vm->_globals.freeMemory(_inventWin1); loopFl = true; break; } else @@ -455,15 +455,15 @@ void DialogsManager::showInventory() { _vm->_objectsManager.BOBTOUS = true; } - _vm->_dialogsManager._inventWin1 = _vm->_globals.freeMemory(_vm->_dialogsManager._inventWin1); + _inventWin1 = _vm->_globals.freeMemory(_inventWin1); _inventBuf2 = _vm->_globals.freeMemory(_inventBuf2); if (_vm->_eventsManager._mouseCursorId == 1) showOptionsDialog(); else if (_vm->_eventsManager._mouseCursorId == 3) - _vm->_dialogsManager.showLoadGame(); + showLoadGame(); else if (_vm->_eventsManager._mouseCursorId == 2) - _vm->_dialogsManager.showSaveGame(); + showSaveGame(); _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(4); @@ -535,21 +535,21 @@ void DialogsManager::testDialogOpening() { switch (key) { case KEY_INVENTORY: - _vm->_dialogsManager.showInventory(); + showInventory(); break; case KEY_OPTIONS: _vm->_graphicsManager._scrollStatus = 1; - _vm->_dialogsManager.showOptionsDialog(); + showOptionsDialog(); _vm->_graphicsManager._scrollStatus = 0; break; case KEY_LOAD: _vm->_graphicsManager._scrollStatus = 1; - _vm->_dialogsManager.showLoadGame(); + showLoadGame(); _vm->_graphicsManager._scrollStatus = 0; break; case KEY_SAVE: _vm->_graphicsManager._scrollStatus = 1; - _vm->_dialogsManager.showSaveGame(); + showSaveGame(); _vm->_graphicsManager._scrollStatus = 0; break; default: diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index bdcf59de24..4e57a1ee4c 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -3244,7 +3244,7 @@ void LinesManager::checkZone() { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { - zoneId = MZONE();- + zoneId = MZONE(); } else { zoneId = _vm->_globals._oldMouseZoneId; } diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 87943872d4..5d0442aaa5 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -361,7 +361,7 @@ void SoundManager::WSOUND_OFF() { stopVoice(0); stopVoice(1); stopVoice(2); - if (_vm->_soundManager._soundFl) + if (_soundFl) delWav(_currentSoundIndex); for (int i = 1; i <= 48; ++i) @@ -583,7 +583,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { oldMusicVol = _musicVolume; if (!_musicOffFl && _musicVolume > 2) { _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + MODSetMusicVolume(_musicVolume); } playVoice(); @@ -611,7 +611,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { // Speech is over, set the music volume back to normal _musicVolume = oldMusicVol; if (!_musicOffFl && _musicVolume > 2) { - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + MODSetMusicVolume(_musicVolume); } _vm->_eventsManager._escKeyFl = false; _skipRefreshFl = false; -- cgit v1.2.3 From 3e0739a49c49ed7aa56677dfbde79bbe84971a78 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 16 Feb 2013 14:57:25 +0100 Subject: HOPKINS: Some renaming and refactoring --- engines/hopkins/computer.cpp | 59 ++++++++------ engines/hopkins/objects.cpp | 190 +++++++++++++++++++++++-------------------- 2 files changed, 135 insertions(+), 114 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 7d664acee9..d101a67278 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -659,36 +659,46 @@ void ComputerManager::displayBricks() { _breakoutBrickNbr = 0; _breakoutSpeed = 1; int16 *level = _breakoutLevel; - int levelIdx = 0; int cellLeft; int cellTop; int cellType; - do { + for (int levelIdx = 0; ; levelIdx += 6) { cellLeft = level[levelIdx]; + if (cellLeft == -1) + break; cellTop = level[levelIdx + 1]; cellType = level[levelIdx + 4]; - if (cellLeft != -1) { - if (cellType <= 6) - ++_breakoutBrickNbr; - - if (cellType == 3) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 17); - else if (cellType == 6) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 18); - else if (cellType == 5) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 19); - else if (cellType == 4) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 20); - else if (cellType == 1) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 21); - else if (cellType == 2) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 22); - else if (cellType == 31) - _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 23); + + if (cellType <= 6) + ++_breakoutBrickNbr; + + switch (cellType) { + case 1: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 21); + break; + case 2: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 22); + break; + case 3: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 17); + break; + case 4: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 20); + break; + case 5: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 19); + break; + case 6: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 18); + break; + case 31: + _vm->_graphicsManager.AFFICHE_SPEEDVGA(_breakoutSpr, cellLeft, cellTop, 23); + break; } + levelIdx += 6; - } while (cellLeft != -1); + } displayScore(); } @@ -1042,18 +1052,17 @@ int ComputerManager::moveBall() { _vm->_soundManager.playSample(2, 6); _ballPosition.x = randVal + 6; _ballRightFl = !_ballRightFl; - } - if (_ballPosition.x > 307) { + } else if (_ballPosition.x > 307) { _vm->_soundManager.playSample(2, 6); _ballPosition.x = 307 - randVal; _ballRightFl = !_ballRightFl; } + if (_ballPosition.y <= 6) { _vm->_soundManager.playSample(2, 6); _ballPosition.y = randVal + 7; _ballUpFl = !_ballUpFl; - } - if (_ballPosition.y >= 186 && _ballPosition.y <= 194) { + } else if (_ballPosition.y >= 186 && _ballPosition.y <= 194) { _vm->_soundManager.playSample(2, 6); int ballPosXRight = _ballPosition.x + 6; if ((_ballPosition.x > _padPositionX - 2) && (ballPosXRight < _padPositionX + 36)) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bbb2e38ddb..ed3800f240 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1274,10 +1274,6 @@ void ObjectsManager::setFlipSprite(int idx, bool flipFl) { } void ObjectsManager::GOHOME() { - int v0 = 0; - int v58 = 0; - int v1 = 0; - if (_vm->_linesManager._route == (int16 *)g_PTRNUL) return; @@ -1290,6 +1286,9 @@ void ObjectsManager::GOHOME() { int newPosY; int newDirection; + int oldPosX = 0; + int oldPosY = 0; + int oldFrameIdx = 0; _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); @@ -1336,9 +1335,9 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection == 3) { if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 24; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 24; } else { int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; @@ -1350,19 +1349,19 @@ void ObjectsManager::GOHOME() { deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX + deltaX; - v58 = _oldCharacterPosY + deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 35) - v1 = 24; + oldPosX = _oldCharacterPosX + deltaX; + oldPosY = _oldCharacterPosY + deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 35) + oldFrameIdx = 24; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 7) { if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 24; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 24; } else { int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; @@ -1373,19 +1372,19 @@ void ObjectsManager::GOHOME() { deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX - deltaX; - v58 = _oldCharacterPosY - deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 35) - v1 = 24; + oldPosX = _oldCharacterPosX - deltaX; + oldPosY = _oldCharacterPosY - deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 35) + oldFrameIdx = 24; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 1) { if (_vm->_globals._oldFrameIndex > 11) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 0; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 0; } else { int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { @@ -1393,20 +1392,20 @@ void ObjectsManager::GOHOME() { } else if (_sprite[0]._zoomFactor > 0) { deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY - deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 11) - v1 = 0; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY - deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 11) + oldFrameIdx = 0; } _vm->_globals.Compteur = 4 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 5) { if (_vm->_globals._oldFrameIndex < 48 || _vm->_globals._oldFrameIndex > 59) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 48; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 48; } else { int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); if (_sprite[0]._zoomFactor < 0) { @@ -1414,19 +1413,19 @@ void ObjectsManager::GOHOME() { } else if (_sprite[0]._zoomFactor > 0) { deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX; - v58 = deltaY + _oldCharacterPosY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 59) - v1 = 48; + oldPosX = _oldCharacterPosX; + oldPosY = deltaY + _oldCharacterPosY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 59) + oldFrameIdx = 48; } _vm->_globals.Compteur = 4 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 2) { if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 12; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 12; } else { int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; @@ -1438,19 +1437,19 @@ void ObjectsManager::GOHOME() { deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = deltaX + _oldCharacterPosX; - v58 = _oldCharacterPosY + deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 23) - v1 = 12; + oldPosX = deltaX + _oldCharacterPosX; + oldPosY = _oldCharacterPosY + deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 23) + oldFrameIdx = 12; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 8) { if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 12; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 12; } else { int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; @@ -1461,19 +1460,19 @@ void ObjectsManager::GOHOME() { deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX - deltaX; - v58 = _oldCharacterPosY + deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 23) - v1 = 12; + oldPosX = _oldCharacterPosX - deltaX; + oldPosY = _oldCharacterPosY + deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 23) + oldFrameIdx = 12; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 4) { if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 36; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 36; } else { int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; @@ -1485,19 +1484,19 @@ void ObjectsManager::GOHOME() { deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = deltaX + _oldCharacterPosX; - v58 = _oldCharacterPosY + deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 47) - v1 = 36; + oldPosX = deltaX + _oldCharacterPosX; + oldPosY = _oldCharacterPosY + deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 47) + oldFrameIdx = 36; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } if (_vm->_globals._oldDirection == 6) { if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { - v0 = _oldCharacterPosX; - v58 = _oldCharacterPosY; - v1 = 36; + oldPosX = _oldCharacterPosX; + oldPosY = _oldCharacterPosY; + oldFrameIdx = 36; } else { int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; @@ -1509,11 +1508,11 @@ void ObjectsManager::GOHOME() { deltaX = _vm->_graphicsManager.zoomIn(deltaX, _sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomIn(deltaY, _sprite[0]._zoomFactor); } - v0 = _oldCharacterPosX - deltaX; - v58 = _oldCharacterPosY + deltaY; - v1 = _vm->_globals._oldFrameIndex + 1; - if (v1 > 47) - v1 = 36; + oldPosX = _oldCharacterPosX - deltaX; + oldPosY = _oldCharacterPosY + deltaY; + oldFrameIdx = _vm->_globals._oldFrameIndex + 1; + if (oldFrameIdx > 47) + oldFrameIdx = 36; } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } @@ -1557,10 +1556,10 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection != newDirection) break; - if ((newDirection == 3 && newPosX >= v0) || (_vm->_globals._oldDirection == 7 && newPosX <= v0) || - (_vm->_globals._oldDirection == 1 && newPosY <= v58) || (_vm->_globals._oldDirection == 5 && newPosY >= v58) || - (_vm->_globals._oldDirection == 2 && newPosX >= v0) || (_vm->_globals._oldDirection == 8 && newPosX <= v0) || - (_vm->_globals._oldDirection == 4 && newPosX >= v0) || (_vm->_globals._oldDirection == 6 && newPosX <= v0)) + if ((newDirection == 3 && newPosX >= oldPosX) || (_vm->_globals._oldDirection == 7 && newPosX <= oldPosX) || + (_vm->_globals._oldDirection == 1 && newPosY <= oldPosY) || (_vm->_globals._oldDirection == 5 && newPosY >= oldPosY) || + (_vm->_globals._oldDirection == 2 && newPosX >= oldPosX) || (_vm->_globals._oldDirection == 8 && newPosX <= oldPosX) || + (_vm->_globals._oldDirection == 4 && newPosX >= oldPosX) || (_vm->_globals._oldDirection == 6 && newPosX <= oldPosX)) loopCond = true; } while (!loopCond); if (loopCond) { @@ -1574,7 +1573,7 @@ void ObjectsManager::GOHOME() { setSpriteX(0, newPosX); setSpriteY(0, newPosY); - setSpriteIndex(0, v1); + setSpriteIndex(0, oldFrameIdx); } else { if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) setFlipSprite(0, true); @@ -1586,7 +1585,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals._oldDirection = newDirection; _vm->_globals._oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals._oldFrameIndex = v1; + _vm->_globals._oldFrameIndex = oldFrameIdx; _oldCharacterPosX = newPosX; _oldCharacterPosY = newPosY; } @@ -1617,26 +1616,39 @@ void ObjectsManager::GOHOME2() { _vm->_globals._lastDirection = newDirection; setSpriteX(0, nexPosX); setSpriteY(0, newPosY); - if (_vm->_globals._lastDirection == 1) + switch (_vm->_globals._lastDirection) { + case 1: setSpriteIndex(0, 4); - else if (_vm->_globals._lastDirection == 3) + break; + case 3: setSpriteIndex(0, 5); - else if (_vm->_globals._lastDirection == 5) + break; + case 5: setSpriteIndex(0, 6); - else if (_vm->_globals._lastDirection == 7) + break; + case 7: setSpriteIndex(0, 7); + break; + } return; } } - if (_vm->_globals._lastDirection == 1) + + switch (_vm->_globals._lastDirection) { + case 1: setSpriteIndex(0, 0); - else if (_vm->_globals._lastDirection == 3) + break; + case 3: setSpriteIndex(0, 1); - else if (_vm->_globals._lastDirection == 5) + break; + case 5: setSpriteIndex(0, 2); - else if (_vm->_globals._lastDirection == 7) + break; + case 7: setSpriteIndex(0, 3); + break; + } _vm->_linesManager._route = (int16 *)g_PTRNUL; } @@ -2426,16 +2438,16 @@ void ObjectsManager::initBorder(int zoneIdx) { if (!zoneIdx) _vm->_eventsManager._mouseCursorId = 0; - else if (zoneIdx == 32) - _vm->_eventsManager._mouseCursorId = 16; - else if (zoneIdx == 30) - _vm->_eventsManager._mouseCursorId = 2; - else if (zoneIdx == 31) - _vm->_eventsManager._mouseCursorId = 3; else if (zoneIdx >= 1 && zoneIdx <= 28) _vm->_eventsManager._mouseCursorId = 8; else if (zoneIdx == 29) _vm->_eventsManager._mouseCursorId = 1; + else if (zoneIdx == 30) + _vm->_eventsManager._mouseCursorId = 2; + else if (zoneIdx == 31) + _vm->_eventsManager._mouseCursorId = 3; + else if (zoneIdx == 32) + _vm->_eventsManager._mouseCursorId = 16; if (zoneIdx >= 1 && zoneIdx <= 28 && !_vm->_globals._inventory[zoneIdx]) { _vm->_eventsManager._mouseCursorId = 0; @@ -2557,7 +2569,7 @@ void ObjectsManager::OPTI_OBJET() { if (opcodeType == 1 || opcodeType == 4) ++lastOpcodeResult; - if (!opcodeType || opcodeType == 5) + else if (!opcodeType || opcodeType == 5) break; } -- cgit v1.2.3 From cccbd842041c3e6099dce790911d4c02da62874e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 16 Feb 2013 10:55:07 +0100 Subject: HOPKINS: Convert route lists into structs --- engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/lines.cpp | 634 ++++++++++++++++---------------------------- engines/hopkins/lines.h | 33 ++- engines/hopkins/objects.cpp | 81 +++--- engines/hopkins/script.cpp | 36 +-- 5 files changed, 309 insertions(+), 479 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ab3fe1fc56..c7bea38e03 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2050,7 +2050,7 @@ void HopkinsEngine::playEnding() { _globals._cityMapEnabledFl = false; _globals.iRegul = 1; _soundManager.WSOUND(26); - _linesManager._route = (int16 *)g_PTRNUL; + _linesManager._route = (RouteItem *)g_PTRNUL; _globals.NOMARCHE = true; _globals._exitId = 0; _soundManager.loadSample(1, "SOUND90.WAV"); @@ -2777,7 +2777,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _objectsManager.animateSprite(0); - _linesManager._route = (int16 *)g_PTRNUL; + _linesManager._route = (RouteItem *)g_PTRNUL; _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(4); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 38c42b8363..ffe8238d87 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -39,8 +39,8 @@ LinesManager::LinesManager() { for (int i = 0; i < 4000; ++i) Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0); - for (int i = 0; i < 32002; ++i) - super_parcours[i] = 0; + for (int i = 0; i < 8001; ++i) + super_parcours[i].set(0, 0, 0); for (int i = 0; i < 101; ++i) { Common::fill((byte *)&_segment[i], (byte *)&_segment[i] + sizeof(SegmentItem), 0); @@ -69,7 +69,7 @@ LinesManager::LinesManager() { essai1 = NULL; essai2 = NULL; BufLig = (int16 *)g_PTRNUL; - _route = (int16 *)g_PTRNUL; + _route = (RouteItem *)g_PTRNUL; _currentSegmentId = 0; BUFFERTAPE = NULL; } @@ -436,24 +436,20 @@ void LinesManager::initRoute() { } // Avoid -int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7) { +int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, RouteItem *route) { int v36 = a1; int v7 = a2; int v8 = a3; if (a1 < a4) { for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { - route[v8] = Ligne[a1]._lineData[2 * i]; - route[v8 + 1] = Ligne[a1]._lineData[2 * i + 1]; - route[v8 + 2] = Ligne[a1].field6; - v8 += a7; + route[v8].set(Ligne[a1]._lineData[2 * i], Ligne[a1]._lineData[2 * i + 1], Ligne[a1].field6); + v8++; } for (int i = a1 + 1; i < a4; i++) { for (int j = 0; j < Ligne[i]._lineDataEndIdx; j++) { - route[v8] = Ligne[i]._lineData[2 * j]; - route[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; - route[v8 + 2] = Ligne[i].field6; - v8 += a7; + route[v8].set(Ligne[i]._lineData[2 * j], Ligne[i]._lineData[2 * j + 1], Ligne[i].field6); + v8++; } } @@ -462,17 +458,13 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route } if (v36 > a4) { for (int i = v7; i > 0; --i) { - route[v8] = Ligne[v36]._lineData[2 * i]; - route[v8 + 1] = Ligne[v36]._lineData[2 * i + 1]; - route[v8 + 2] = Ligne[v36].field8; - v8 += a7; + route[v8].set(Ligne[v36]._lineData[2 * i], Ligne[v36]._lineData[2 * i + 1], Ligne[v36].field8); + v8++; } for (int i = v36 - 1; i > a4; i--) { for (int j = Ligne[i]._lineDataEndIdx - 1; j > 0; --j) { - route[v8] = Ligne[i]._lineData[2 * j]; - route[v8 + 1] = Ligne[i]._lineData[2 * j + 1]; - route[v8 + 2] = Ligne[i].field8; - v8 += a7; + route[v8].set(Ligne[i]._lineData[2 * j], Ligne[i]._lineData[2 * j + 1], Ligne[i].field8); + v8++; } } v7 = Ligne[a4]._lineDataEndIdx - 1; @@ -481,17 +473,13 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route if (v36 == a4) { if (a5 >= v7) { for (int i = v7; i < a5; i++) { - route[v8] = Ligne[a4]._lineData[2 * i]; - route[v8 + 1] = Ligne[a4]._lineData[2 * i + 1]; - route[v8 + 2] = Ligne[a4].field6; - v8 += a7; + route[v8].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i + 1], Ligne[a4].field6); + v8++; } } else { for (int i = v7; i > a5; --i) { - route[v8] = Ligne[a4]._lineData[2 * i]; - route[v8 + 1] = Ligne[a4]._lineData[2 * i+ 1]; - route[v8 + 2] = Ligne[a4].field8; - v8 += a7; + route[v8].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i+ 1], Ligne[a4].field8); + v8++; } } } @@ -499,26 +487,22 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route } // Avoid 1 -int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9) { +int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem *route, int a8, int a9) { int v9 = a1; int v10 = a2; int v40 = a3; if (a4 < a1) { for (int i = a2; i < Ligne[a1]._lineDataEndIdx; ++i) { - route[v40] = Ligne[a1]._lineData[2 * i]; - route[v40 + 1] = Ligne[a1]._lineData[2 * i + 1]; - route[v40 + 2] = Ligne[a1].field6; - v40 += a7; + route[v40].set(Ligne[a1]._lineData[2 * i], Ligne[a1]._lineData[2 * i + 1], Ligne[a1].field6); + v40++; } int v15 = a1 + 1; if (v15 == a9 + 1) v15 = a8; while (a4 != v15) { for (int i = 0; i < Ligne[v15]._lineDataEndIdx; i++) { - route[v40] = Ligne[v15]._lineData[2 * i]; - route[v40 + 1] = Ligne[v15]._lineData[2 * i + 1]; - route[v40 + 2] = Ligne[v15].field6; - v40 += a7; + route[v40].set(Ligne[v15]._lineData[2 * i], Ligne[v15]._lineData[2 * i + 1], Ligne[v15].field6); + v40++; } ++v15; @@ -530,20 +514,16 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *rout } if (a4 > v9) { for (int i = v10; i > 0; --i) { - route[v40] = Ligne[v9]._lineData[2 * i]; - route[v40 + 1] = Ligne[v9]._lineData[2 * i + 1]; - route[v40 + 2] = Ligne[v9].field8; - v40 += a7; + route[v40].set(Ligne[v9]._lineData[2 * i], Ligne[v9]._lineData[2 * i + 1], Ligne[v9].field8); + v40++; } int v24 = v9 - 1; if (v24 == a8 - 1) v24 = a9; while (a4 != v24) { for (int i = Ligne[v24]._lineDataEndIdx - 1; i > 0; --i) { - route[v40] = Ligne[v24]._lineData[2 * i]; - route[v40 + 1] = Ligne[v24]._lineData[2 * i + 1]; - route[v40 + 2] = Ligne[v24].field8; - v40 += a7; + route[v40].set(Ligne[v24]._lineData[2 * i], Ligne[v24]._lineData[2 * i + 1], Ligne[v24].field8); + v40++; } --v24; if (a8 - 1 == v24) @@ -555,17 +535,13 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *rout if (a4 == v9) { if (a5 >= v10) { for (int i = v10; i < a5; i++) { - route[v40] = Ligne[a4]._lineData[2 * i]; - route[v40 + 1] = Ligne[a4]._lineData[2 * i + 1]; - route[v40 + 2] = Ligne[a4].field6; - v40 += a7; + route[v40].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i + 1], Ligne[a4].field6); + v40++; } } else { for (int i = v10; i > a5; i--) { - route[v40] = Ligne[a4]._lineData[2 * i]; - route[v40 + 1] = Ligne[a4]._lineData[2 * i + 1]; - route[v40 + 2] = Ligne[a4].field8; - v40 += a7; + route[v40].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i + 1], Ligne[a4].field8); + v40++; } } } @@ -778,18 +754,15 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 1) { for (int v22 = 0; v22 < v39; v22++) { if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &super_parcours[0], 4); + v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &super_parcours[0]); if (v23 == -1) return false; v7 = v23; if (NVPY != -1) v22 = NVPY - v40; } - super_parcours[v7] = v41; - super_parcours[v7 + 1] = v40 - v22; - super_parcours[v7 + 2] = 1; - super_parcours[v7 + 3] = 0; - v7 += 4; + super_parcours[v7].set(v41, v40 - v22, 1); + v7++; } NV_LIGNEDEP = v36; NV_LIGNEOFS = v35; @@ -799,18 +772,15 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 5) { for (int v25 = 0; v25 < v37; v25++) { if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &super_parcours[0], 4); + v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &super_parcours[0]); if (v26 == -1) return false; v7 = v26; if (NVPY != -1) v25 = v40 - NVPY; } - super_parcours[v7] = v41; - super_parcours[v7 + 1] = v25 + v40; - super_parcours[v7 + 2] = 5; - super_parcours[v7 + 3] = 0; - v7 += 4; + super_parcours[v7].set(v41, v25 + v40, 5); + v7++; } NV_LIGNEDEP = v36; NV_LIGNEOFS = v35; @@ -820,18 +790,15 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 7) { for (int v28 = 0; v28 < v18; v28++) { if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &super_parcours[0], 4); + v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &super_parcours[0]); if (v29 == -1) return false; v7 = v29; if (NVPX != -1) v28 = v41 - NVPX; } - super_parcours[v7] = v41 - v28; - super_parcours[v7 + 1] = v40; - super_parcours[v7 + 2] = 7; - super_parcours[v7 + 3] = 0; - v7 += 4; + super_parcours[v7].set(v41 - v28, v40, 7); + v7++; } NV_LIGNEDEP = v36; NV_LIGNEOFS = v35; @@ -841,18 +808,15 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { if (v21 == 3) { for (int v31 = 0; v31 < v38; v31++) { if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &super_parcours[0], 4); + v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &super_parcours[0]); if (v32 == -1) return false; v7 = v32; if (NVPX != -1) v31 = NVPX - v41; } - super_parcours[v7] = v31 + v41; - super_parcours[v7 + 1] = v40; - super_parcours[v7 + 2] = 3; - super_parcours[v7 + 3] = 0; - v7 += 4; + super_parcours[v7].set(v31 + v41, v40, 3); + v7++; } NV_LIGNEDEP = v36; NV_LIGNEOFS = v35; @@ -864,15 +828,13 @@ bool LinesManager::MIRACLE(int a1, int a2, int a3, int a4, int a5) { return false; } -int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9) { +int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, RouteItem *route) { int result = a7; int v80 = -1; ++_pathFindingMaxDepth; if (_pathFindingMaxDepth > 10) { warning("PathFinding - Max depth reached"); - route[a7] = -1; - route[a7 + 1] = -1; - route[a7 + 2] = -1; + route[a7].invalidate(); return -1; } int16 *v10 = Ligne[lineIdx]._lineData; @@ -1078,9 +1040,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a break;; } if (v74 != -1 && v38 != -1 && v76 != -1 && v75 != -1) { - route[a7] = -1; - route[a7 + 1] = -1; - route[a7 + 2] = -1; + route[a7].invalidate(); return -1; } } @@ -1100,15 +1060,15 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a } while (v80 != v42); if (abs(v80 - lineIdx) == v43) { if (dataIdx > abs(Ligne[lineIdx]._lineDataEndIdx / 2)) { - result = CONTOURNE(lineIdx, dataIdx, a7, v80, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, a7, v80, v77, route); } else { - result = CONTOURNE1(lineIdx, dataIdx, a7, v80, v77, route, a9, v92, v91); + result = CONTOURNE1(lineIdx, dataIdx, a7, v80, v77, route, v92, v91); } } if (abs(v80 - lineIdx) < v43) - result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route); if (v43 < abs(v80 - lineIdx)) - result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, a9, v92, v91); + result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, v92, v91); } if (lineIdx > v80) { int v45 = abs(lineIdx - v80); @@ -1124,18 +1084,18 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a } while (v80 != v47); if (v45 == v48) { if (dataIdx > abs(Ligne[lineIdx]._lineDataEndIdx / 2)) { - result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, a9, v92, v91); + result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, v92, v91); } else { - result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route); } } if (v45 < v48) - result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route); if (v48 < v45) - result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, a9, v92, v91); + result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, v92, v91); } if (lineIdx == v80) - result = CONTOURNE(lineIdx, dataIdx, result, lineIdx, v77, route, a9); + result = CONTOURNE(lineIdx, dataIdx, result, lineIdx, v77, route); for(;;) { if (!checkCollisionLine(NVPX, NVPY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb)) break; @@ -1179,7 +1139,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a } // Avoid 2 -int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { +RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int foundLineIdx; int foundDataIdx; int v118 = 0; @@ -1202,13 +1162,13 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (!_vm->_globals.NOT_VERIF) { if (abs(fromX - _vm->_globals._oldRouteFromX) <= 4 && abs(fromY - _vm->_globals._oldRouteFromY) <= 4 && abs(_vm->_globals._oldRouteDestX - destX) <= 4 && abs(_vm->_globals._oldRouteDestY - clipDestY) <= 4) - return (int16 *)g_PTRNUL; + return (RouteItem *)g_PTRNUL; if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4) - return (int16 *)g_PTRNUL; + return (RouteItem *)g_PTRNUL; if (_vm->_globals._oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals._oldZoneNum == _vm->_objectsManager._zoneNum) - return (int16 *)g_PTRNUL; + return (RouteItem *)g_PTRNUL; } _vm->_globals.NOT_VERIF = false; _vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum; @@ -1228,7 +1188,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { clipDestY = _vm->_globals._characterMaxPosY; if (abs(fromX - clipDestX) <= 3 && abs(fromY - clipDestY) <= 3) - return (int16 *)g_PTRNUL; + return (RouteItem *)g_PTRNUL; for (int i = 0; i <= 8; ++i) { v141[i] = -1; @@ -1238,7 +1198,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } if (PARC_PERS(fromX, fromY, clipDestX, clipDestY, -1, -1, 0) == 1) - return &super_parcours[0]; + return super_parcours; int v14 = 0; for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { @@ -1307,7 +1267,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v141[7] < 0) v131[7] = 1300; if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) - return (int16 *)g_PTRNUL; + return (RouteItem *)g_PTRNUL; if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { v121 = v141[5]; @@ -1415,7 +1375,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v55 = PARC_PERS(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); if (v55 == 1) - return &super_parcours[0]; + return super_parcours; if (v55 == 2) { v115 = NV_LIGNEDEP; @@ -1425,90 +1385,66 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v113 == 1) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &super_parcours[0], 4); + int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, super_parcours); if (v58 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; + super_parcours[v112].invalidate(); return &super_parcours[0]; } v112 = v58; if (NVPY != -1) deltaY = fromY - NVPY; } - super_parcours[v112] = fromX; - super_parcours[v112 + 1] = fromY - deltaY; - super_parcours[v112 + 2] = 1; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(fromX, fromY - deltaY, 1); + v112++; } } if (v113 == 5) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &super_parcours[0], 4); + int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &super_parcours[0]); if (v61 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; + super_parcours[v112].invalidate(); return &super_parcours[0]; } v112 = v61; if (NVPY != -1) deltaY = NVPY - fromY; } - super_parcours[v112] = fromX; - super_parcours[v112 + 1] = deltaY + fromY; - super_parcours[v112 + 2] = 5; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(fromX, fromY + deltaY, 5); + v112++; } } if (v113 == 7) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0], 4); + int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0]); if (v64 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; + super_parcours[v112].invalidate(); return &super_parcours[0]; } v112 = v64; if (NVPX != -1) deltaX = fromX - NVPX; } - super_parcours[v112] = fromX - deltaX; - super_parcours[v112 + 1] = fromY; - super_parcours[v112 + 2] = 7; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(fromX - deltaX, fromY, 7); + v112++; } } if (v113 == 3) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0], 4); + int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0]); if (v67 == -1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; + super_parcours[v112].invalidate(); return &super_parcours[0]; } v112 = v67; if (NVPX != -1) deltaX = NVPX - fromX; } - super_parcours[v112] = deltaX + fromX; - super_parcours[v112 + 1] = fromY; - super_parcours[v112 + 2] = 3; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(fromX + deltaX, fromY, 3); + v112++; } } } @@ -1521,11 +1457,8 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { v119 = Ligne[v115]._lineData[2 * i]; v118 = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112] = Ligne[v115]._lineData[2 * i]; - super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112 + 2] = Ligne[v115].field6; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(Ligne[v115]._lineData[2 * i], Ligne[v115]._lineData[2 * i + 1], Ligne[v115].field6); + v112++; } for (int v116 = v115 + 1; v116 < v121; v116++) { int v72 = 0; @@ -1533,11 +1466,8 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { v119 = Ligne[v110]._lineData[2 * v72]; v118 = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112] = Ligne[v110]._lineData[2 * v72]; - super_parcours[v112 + 1] = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112 + 2] = Ligne[v110].field6; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], Ligne[v110].field6); + v112++; if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) @@ -1579,21 +1509,15 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v119 = Ligne[v115]._lineData[2 * dataIdx]; v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; - super_parcours[v112] = Ligne[v115]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v115]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v115].field8; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(Ligne[v115]._lineData[2 * dataIdx], Ligne[v115]._lineData[2 * dataIdx + 1], Ligne[v115].field8); + v112++; } for (int v117 = v115 - 1; v117 > v121; v117--) { for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { v119 = Ligne[v117]._lineData[2 * dataIdx]; v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112] = Ligne[v117]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v117].field8; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(Ligne[v117]._lineData[2 * dataIdx], Ligne[v117]._lineData[2 * dataIdx + 1], Ligne[v117].field8); + v112++; if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) @@ -1631,27 +1555,18 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v115 == v121) { if (v114 <= v120) { for (int dataIdx = v114; dataIdx < v120; dataIdx++) { - super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v121].field6; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(Ligne[v121]._lineData[2 * dataIdx], Ligne[v121]._lineData[2 * dataIdx + 1], Ligne[v121].field6); + v112++; } } else { for (int dataIdx = v114; dataIdx > v120; dataIdx--) { - super_parcours[v112] = Ligne[v121]._lineData[2 * dataIdx]; - super_parcours[v112 + 1] = Ligne[v121]._lineData[2 * dataIdx + 1]; - super_parcours[v112 + 2] = Ligne[v121].field8; - super_parcours[v112 + 3] = 0; - v112 += 4; + super_parcours[v112].set(Ligne[v121]._lineData[2 * dataIdx], Ligne[v121]._lineData[2 * dataIdx + 1], Ligne[v121].field8); + v112++; } } } - if (PARC_PERS(super_parcours[v112 - 4], super_parcours[v112 - 3], clipDestX, clipDestY, -1, -1, v112) != 1) { - super_parcours[v112] = -1; - super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; - super_parcours[v112 + 3] = -1; + if (PARC_PERS(super_parcours[v112 - 1]._X, super_parcours[v112 - 1]._Y, clipDestX, clipDestY, -1, -1, v112) != 1) { + super_parcours[v112].invalidate(); } return &super_parcours[0]; @@ -1768,29 +1683,21 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, v109 = curY; if (destX >= curX - 2 && destX <= curX + 2 && destY >= curY - 2 && destY <= curY + 2) { LABEL_149: - essai0[v115] = -1; - essai0[v115 + 1] = -1; - essai0[v115 + 2] = -1; + essai0[v115].invalidate(); LABEL_150: if (v115) { v116 = 0; for (;;) { super_parcours[v137] = essai0[v116]; - super_parcours[v137 + 1] = essai0[v116 + 1]; - super_parcours[v137 + 2] = essai0[v116 + 2]; - super_parcours[v137 + 3] = 0; - v116 += 3; - v137 += 4; + v116++; + v137++; - if (essai0[v116] == -1 && essai0[v116 + 1] == -1) + if (!essai0[v116].isValid()) break; } } - super_parcours[v137] = -1; - super_parcours[v137 + 1] = -1; - super_parcours[v137 + 2] = -1; - super_parcours[v137 + 3] = -1; + super_parcours[v137].invalidate(); return 1; } distX = abs(curX - destX); @@ -1917,21 +1824,19 @@ LABEL_72: if (v108 + 1 <= 0) goto LABEL_149; while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { - essai0[v115] = v104; - essai0[v115 + 1] = v103; - essai0[v115 + 2] = newDirection; + essai0[v115].set(v104, v103, newDirection); v106 += v102; v105 += v100; v104 = v106 / 1000; v103 = v105 / 1000; - v115 += 3; + v115++; ++v23; if (v23 >= v108 + 1) goto LABEL_149; } if (_lastLine >= v142) goto LABEL_157; - v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, essai0, 3); + v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, essai0); if (v24 == -1) goto LABEL_150; v115 = v24; @@ -1955,10 +1860,8 @@ LABEL_72: if (checkCollisionLine(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, &v143, &v142, 0, _linesNumb)) break; - essai0[v115] = _smoothRoute[v14]._posX; - essai0[v115 + 1] = _smoothRoute[v14]._posY; - essai0[v115 + 2] = newDirection; - v115 += 3; + essai0[v115].set(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, newDirection); + v115++; ++v14; if (v126) { v18 = v14 - 1; @@ -1971,9 +1874,7 @@ LABEL_72: v142 = -1; LABEL_157: - essai0[v115] = -1; - essai0[v115 + 1] = -1; - essai0[v115 + 2] = -1; + essai0[v115].invalidate(); v117 = 0; v33 = v98; @@ -1987,10 +1888,8 @@ LABEL_165: if (v113 > destX) { v36 = v113; while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) { - essai1[v117] = v36; - essai1[v117 + 1] = v92; - essai1[v117 + 2] = 7; - v117 += 3; + essai1[v117].set(v36, v92, 7); + v117++; --v36; if (destX >= v36) goto LABEL_171; @@ -2003,7 +1902,7 @@ LABEL_181: for (int v43 = v92; v43 > destY; v43--) { if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { if (_lastLine < v140) { - int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, essai1, 3); + int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, essai1); if (v44 == -1) goto LABEL_195; v117 = v44; @@ -2019,40 +1918,30 @@ LABEL_181: if (v140 <= _lastLine) goto LABEL_202; } - essai1[v117] = destX; - essai1[v117 + 1] = v43; - essai1[v117 + 2] = 1; - v117 += 3; + essai1[v117].set(destX, v43, 1); + v117++; } LABEL_194: - essai1[v117] = -1; - essai1[v117 + 1] = -1; - essai1[v117 + 2] = -1; + essai1[v117].invalidate(); LABEL_195: if (v117) { v118 = 0; for (;;) { super_parcours[v137] = essai1[v118]; - super_parcours[v137 + 1] = essai1[v118 + 1]; - super_parcours[v137 + 2] = essai1[v118 + 2]; - super_parcours[v137 + 3] = 0; - v118 += 3; - v137 += 4; - if (essai1[v118] == -1 && essai1[v118 + 1] == -1) + v118++; + v137++; + if (!essai1[v118].isValid()) break; } } - super_parcours[v137] = -1; - super_parcours[v137 + 1] = -1; - super_parcours[v137 + 2] = -1; - super_parcours[v137 + 3] = -1; + super_parcours[v137].invalidate(); return 1; } v39 = v92; for (;;) { if (checkCollisionLine(destX, v39, &v141, &v140, 0, _linesNumb)) { if (_lastLine < v140) { - v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, essai1, 3); + v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, essai1); if (v40 == -1) goto LABEL_195; v117 = v40; @@ -2069,20 +1958,16 @@ LABEL_195: goto LABEL_202; } - essai1[v117] = destX; - essai1[v117 + 1] = v39; - essai1[v117 + 2] = 5; - v117 += 3; + essai1[v117].set(destX, v39, 5); + v117++; ++v39; if (destY <= v39) goto LABEL_181; } } while (!checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { - essai1[v117] = v33; - essai1[v117 + 1] = v92; - essai1[v117 + 2] = 3; - v117 += 3; + essai1[v117].set(v33, v92, 3); + v117++; ++v33; if (destX <= v33) goto LABEL_165; @@ -2091,9 +1976,7 @@ LABEL_168: if (v140 > _lastLine) v140 = -1; LABEL_202: - essai1[v117] = -1; - essai1[v117 + 1] = -1; - essai1[v117 + 2] = -1; + essai1[v117].invalidate(); v117 = 0; v54 = v98; v93 = v97; @@ -2104,10 +1987,8 @@ LABEL_203: if (v93 < destY) { v55 = v93; while (!checkCollisionLine(v114, v55, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - essai2[v117] = v114; - essai2[v117 + 1] = v55; - essai2[v117 + 2] = 5; - v117 += 3; + essai2[v117].set(v114, v55, 5); + v117++; ++v55; if (destY <= v55) goto LABEL_211; @@ -2118,10 +1999,8 @@ LABEL_211: if (v93 > destY) { v58 = v93; while (!checkCollisionLine(v114, v58, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - essai2[v117] = v114; - essai2[v117 + 1] = v58; - essai2[v117 + 2] = 1; - v117 += 3; + essai2[v117].set(v114, v58, 1); + v117++; --v58; if (destY >= v58) goto LABEL_217; @@ -2130,61 +2009,50 @@ LABEL_214: if (collLineIdx > _lastLine) collLineIdx = -1; LABEL_249: - essai2[v117] = -1; - essai2[v117 + 1] = -1; - essai2[v117 + 2] = -1; + essai2[v117].invalidate(); if (!v136) { if (a6 > foundLineIdx) { - if (essai0[0] != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { + if (essai0[0]._X != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v120 = 0; for (;;) { super_parcours[v137] = essai0[v120]; - super_parcours[v137 + 1] = essai0[v120 + 1]; - super_parcours[v137 + 2] = essai0[v120 + 2]; - super_parcours[v137 + 3] = 0; - v120 += 3; - v137 += 4; - if (essai0[v120] == -1 && essai0[v120 + 1] == -1) + v120++; + v137++; + if (!essai0[v120].isValid()) break; } NV_POSI = v137; return 2; } - if (essai1[0] != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { + if (essai1[0]._X != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v121 = 0; for (;;) { - assert(v137 <= 32000); + assert(v137 <= 8000); super_parcours[v137] = essai1[v121]; - super_parcours[v137 + 1] = essai1[v121 + 1]; - super_parcours[v137 + 2] = essai1[v121 + 2]; - super_parcours[v137 + 3] = 0; - v121 += 3; - v137 += 4; - if (essai1[v121] == -1 && essai1[v121 + 1] == -1) + v121++; + v137++; + if (!essai1[v121].isValid()) break; } NV_POSI = v137; return 2; } - if (essai2[0] != -1) { + if (essai2[0]._X != -1) { if (foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { NV_LIGNEDEP = collLineIdx; NV_LIGNEOFS = collDataIdx; v122 = 0; for (;;) { - assert(v137 <= 32000); + assert(v137 <= 8000); super_parcours[v137] = essai2[v122]; - super_parcours[v137 + 1] = essai2[v122 + 1]; - super_parcours[v137 + 2] = essai2[v122 + 2]; - super_parcours[v137 + 3] = 0; - v122 += 3; - v137 += 4; - if (essai2[v122] == -1 && essai2[v122 + 1] == -1) + v122++; + v137++; + if (!essai2[v122].isValid()) break; }; NV_POSI = v137; @@ -2199,55 +2067,46 @@ LABEL_249: v142 = 1300; if (collLineIdx == -1) v142 = 1300; - if (essai1[0] != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { + if (essai1[0]._X != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; v123 = 0; for (;;) { - assert(137 <= 32000); + assert(137 <= 8000); super_parcours[v137] = essai1[v123]; - super_parcours[v137 + 1] = essai1[v123 + 1]; - super_parcours[v137 + 2] = essai1[v123 + 2]; - super_parcours[v137 + 3] = 0; - v123 += 3; - v137 += 4; - if (essai1[v123] == -1 && essai1[v123 + 1] == -1) + v123++; + v137++; + if (!essai1[v123].isValid()) break; } NV_POSI = v137; return 2; } - if (essai2[0] != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { + if (essai2[0]._X != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { NV_LIGNEDEP = collLineIdx; NV_LIGNEOFS = collDataIdx; v124 = 0; for (;;) { - assert(v137 <= 32000); + assert(v137 <= 8000); super_parcours[v137] = essai2[v124]; - super_parcours[v137 + 1] = essai2[v124 + 1]; - super_parcours[v137 + 2] = essai2[v124 + 2]; - super_parcours[v137 + 3] = 0; - v124 += 3; - v137 += 4; - if (essai2[v124] == -1 && essai2[v124 + 1] == -1) + v124++; + v137++; + if (!essai2[v124].isValid()) break; } NV_POSI = v137; return 2; } - if (essai1[0] != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { + if (essai1[0]._X != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; v125 = 0; for (;;) { - assert(137 <= 32000); + assert(137 <= 8000); super_parcours[v137] = essai0[v125]; - super_parcours[v137 + 1] = essai0[v125 + 1]; - super_parcours[v137 + 2] = essai0[v125 + 2]; - super_parcours[v137 + 3] = 0; - v125 += 3; - v137 += 4; - if (essai0[v125] == -1 && essai0[v125 + 1] == -1) + v125++; + v137++; + if (!essai0[v125].isValid()) break; } @@ -2263,7 +2122,7 @@ LABEL_217: for (int v61 = v114; v61 < destX; v61++) { if (checkCollisionLine(v61, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { if (_lastLine < collLineIdx) { - int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, essai2, 3); + int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, essai2); if (v62 == -1) goto LABEL_195; v117 = v62; @@ -2282,17 +2141,15 @@ LABEL_217: goto LABEL_249; } - essai2[v117] = v61; - essai2[v117 + 1] = destY; - essai2[v117 + 2] = 3; - v117 += 3; + essai2[v117].set(v61, destY, 3); + v117++; } } if (v114 > destX) { for (int v65 = v114; v65 > destX; v65--) { if (checkCollisionLine(v65, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { if (_lastLine < collLineIdx) { - v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, essai2, 3); + v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, essai2); if (v66 == -1) goto LABEL_242; v117 = v66; @@ -2308,40 +2165,30 @@ LABEL_217: if (collLineIdx <= _lastLine) goto LABEL_249; } - essai2[v117] = v65; - essai2[v117 + 1] = destY; - essai2[v117 + 2] = 7; - v117 += 3; + essai2[v117].set(v65, destY, 7); + v117++; } } collLineIdx = -1; LABEL_241: - essai2[v117] = -1; - essai2[v117 + 1] = -1; - essai2[v117 + 2] = -1; + essai2[v117].invalidate(); LABEL_242: if (v117) { v119 = 0; for (;;) { super_parcours[v137] = essai2[v119]; - super_parcours[v137 + 1] = essai2[v119 + 1]; - super_parcours[v137 + 2] = essai2[v119 + 2]; - super_parcours[v137 + 3] = 0; - v119 += 3; - v137 += 4; - if (essai2[v119] == -1 && essai2[v119 + 1] == -1) + v119++; + v137++; + if (!essai2[v119].isValid()) break; } } - super_parcours[v137] = -1; - super_parcours[v137 + 1] = -1; - super_parcours[v137 + 2] = -1; - super_parcours[v137 + 3] = -1; + super_parcours[v137].invalidate(); return 1; } -int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { - int16 *result; +RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { + RouteItem *result; int arrDelta[10]; int arrDataIdx[10]; int arrLineIdx[10]; @@ -2445,24 +2292,18 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int v27 = 0; int v28; for (;;) { - v28 = essai2[v27]; - int v29 = essai2[v27 + 1]; - int v66 = essai2[v27 + 2]; - v27 += 4; + v28 = essai2[v27]._X; + int v29 = essai2[v27]._Y; + int v66 = essai2[v27]._dir; + v27++; if (checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) break; - super_parcours[superRouteIdx] = v28; - super_parcours[superRouteIdx + 1] = v29; - super_parcours[superRouteIdx + 2] = v66; - super_parcours[superRouteIdx + 3] = 0; + super_parcours[superRouteIdx].set(v28, v29, v66); - essai0[superRouteIdx] = v28; - essai0[superRouteIdx + 1] = v29; - essai0[superRouteIdx + 2] = v66; - essai0[superRouteIdx + 3] = 0; - superRouteIdx += 4; + essai0[superRouteIdx].set(v28, v29, v66); + superRouteIdx++; if (v28 == -1) break;; } @@ -2480,12 +2321,10 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { loopFl = false; if (v69 < v73) { int v34 = v68; + // FIXME: This loop is encoded as a for-loop in a crazy way for (int i = Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = Ligne[v69]._lineDataEndIdx) { - super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * v34]; - super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * v34 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v69].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[v69]._lineData[2 * v34], Ligne[v69]._lineData[2 * v34 + 1], Ligne[v69].field6); + superRouteIdx++; ++v34; } for (int j = v69 + 1; j < v73; ++j) { @@ -2498,11 +2337,8 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } if (Ligne[j]._lineDataEndIdx - 2 > 0) { for (int v40 = 0; v40 < Ligne[j]._lineDataEndIdx - 2; v40++) { - super_parcours[superRouteIdx] = Ligne[j]._lineData[2 * v40]; - super_parcours[superRouteIdx + 1] = Ligne[j]._lineData[2 * v40 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[j].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[j]._lineData[2 * v40], Ligne[j]._lineData[2 * v40 + 1], Ligne[j].field6); + superRouteIdx++; } } } @@ -2513,28 +2349,22 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } if (v69 > v73) { for (int k = v68; k > 0; --k) { - super_parcours[superRouteIdx] = Ligne[v69]._lineData[2 * k]; - super_parcours[superRouteIdx + 1] = Ligne[v69]._lineData[2 * k + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v69].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[v69]._lineData[2 * k], Ligne[v69]._lineData[2 * k + 1], Ligne[v69].field8); + superRouteIdx++; } for (int l = v69 - 1; l > v73; --l) { int v48 = l; if (PLAN_TEST(Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 2], Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { v69 = NV_LIGNEDEP; v68 = NV_LIGNEOFS; - superRouteIdx = NV_POSI; + superRouteIdx = NV_POSI; loopFl = true; break; } for (int v49 = Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { - super_parcours[superRouteIdx] = Ligne[l]._lineData[2 * v49]; - super_parcours[superRouteIdx + 1] = Ligne[l]._lineData[2 * v49 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[l].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[l]._lineData[2 * v49], Ligne[l]._lineData[2 * v49 + 1], Ligne[l].field8); + superRouteIdx++; } } if (loopFl) @@ -2546,30 +2376,21 @@ int16 *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { if (v69 == v73) { if (v68 <= v72) { for (int v57 = v68; v57 < v72; v57++) { - super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v57]; - super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v57 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v73].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[v73]._lineData[2 * v57], Ligne[v73]._lineData[2 * v57 + 1], Ligne[v73].field6); + superRouteIdx++; } } else { for (int v53 = v68; v53 > v72; v53--) { - super_parcours[superRouteIdx] = Ligne[v73]._lineData[2 * v53]; - super_parcours[superRouteIdx + 1] = Ligne[v73]._lineData[2 * v53 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[v73].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[v73]._lineData[2 * v53], Ligne[v73]._lineData[2 * v53 + 1], Ligne[v73].field8); + superRouteIdx++; } } } } - super_parcours[superRouteIdx] = -1; - super_parcours[superRouteIdx + 1] = -1; - super_parcours[superRouteIdx + 2] = -1; - super_parcours[superRouteIdx + 3] = -1; + super_parcours[superRouteIdx].invalidate(); result = &super_parcours[0]; } else { - result = (int16 *)g_PTRNUL; + result = (RouteItem *)g_PTRNUL; } return result; } @@ -2834,19 +2655,13 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int superRouteIdx = a3; if (v33 == 1) { for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) { - super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * i]; - super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * i + 1]; - super_parcours[superRouteIdx + 2] = Ligne[idxTest].field6; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[idxTest]._lineData[2 * i], Ligne[idxTest]._lineData[2 * i + 1], Ligne[idxTest].field6); + superRouteIdx++; } } else if (v33 == 2) { for (int v19 = Ligne[idxTest]._lineDataEndIdx - 1; v19 > -1; v19--) { - super_parcours[superRouteIdx] = Ligne[idxTest]._lineData[2 * v19]; - super_parcours[superRouteIdx + 1] = Ligne[idxTest]._lineData[2 * v19 + 1]; - super_parcours[superRouteIdx + 2] = Ligne[idxTest].field8; - super_parcours[superRouteIdx + 3] = 0; - superRouteIdx += 4; + super_parcours[superRouteIdx].set(Ligne[idxTest]._lineData[2 * v19], Ligne[idxTest]._lineData[2 * v19 + 1], Ligne[idxTest].field8); + superRouteIdx++; } } NV_POSI = superRouteIdx; @@ -2916,7 +2731,7 @@ int LinesManager::CALC_PROPRE(int idx) { return retVal; } -void LinesManager::PACOURS_PROPRE(int16 *route) { +void LinesManager::PACOURS_PROPRE(RouteItem *route) { int v4; int v5; int v9; @@ -2926,9 +2741,9 @@ void LinesManager::PACOURS_PROPRE(int16 *route) { int v1 = 0; int v14 = -1; - int v2 = route[1]; - int v15 = route[2]; - if (route[0] == -1 && v2 == -1) + int v2 = route[0]._Y; + int v15 = route[0]._dir; + if (route[0]._X == -1 && v2 == -1) return; for (;;) { @@ -2936,24 +2751,24 @@ void LinesManager::PACOURS_PROPRE(int16 *route) { v11 = v1; v12 = 0; v10 = CALC_PROPRE(v2); - v4 = route[v1]; - v9 = route[v1]; - v5 = route[v1 + 1]; + v4 = route[v1]._X; + v9 = route[v1]._X; + v5 = route[v1]._Y; while (v4 != -1 || v5 != -1) { int idx = v1; - v1 += 4; + v1++; ++v12; - if (route[idx + 2] != v15) + if (route[idx]._dir != v15) break; - v4 = route[v1]; - v9 = route[v1]; - v5 = route[v1 + 1]; + v4 = route[v1]._X; + v9 = route[v1]._X; + v5 = route[v1]._Y; } if (v12 < v10) { int v7 = v11; for (int v8 = 0; v8 < v12; v8++) { - route[v7 + 2] = v14; - v7 += 4; + route[v7]._dir = v14; + v7++; } v15 = v14; } @@ -2961,11 +2776,11 @@ void LinesManager::PACOURS_PROPRE(int16 *route) { if (v9 == -1 && v5 == -1) break; } - v1 += 4; + v1++; v14 = v15; - v2 = route[v1 + 1]; - v15 = route[v1 + 2]; - if (route[v1] == -1 && v2 == -1) + v2 = route[v1]._Y; + v15 = route[v1]._dir; + if (route[v1]._X == -1 && v2 == -1) break; } } @@ -3163,11 +2978,11 @@ void LinesManager::clearAll() { _vm->_linesManager.ZONEP[idx]._spriteIndex = 0; } - _vm->_linesManager.essai0 = (int16 *)g_PTRNUL; - _vm->_linesManager.essai1 = (int16 *)g_PTRNUL; - _vm->_linesManager.essai2 = (int16 *)g_PTRNUL; + _vm->_linesManager.essai0 = (RouteItem *)g_PTRNUL; + _vm->_linesManager.essai1 = (RouteItem *)g_PTRNUL; + _vm->_linesManager.essai2 = (RouteItem *)g_PTRNUL; _vm->_linesManager.BufLig = (int16 *)g_PTRNUL; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; @@ -3185,12 +3000,19 @@ void LinesManager::clearAll() { _vm->_linesManager._squareZone[idx]._enabledFl = 0; } - BUFFERTAPE = _vm->_globals.allocMemory(85000); - - _vm->_linesManager.essai0 = (int16 *)BUFFERTAPE; - _vm->_linesManager.essai1 = (int16 *)(BUFFERTAPE + 25000); - _vm->_linesManager.essai2 = (int16 *)(BUFFERTAPE + 50000); - _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE + 75000); + // FIXME: Delete these somewhere + _vm->_linesManager.essai0 = new RouteItem[8334]; + _vm->_linesManager.essai1 = new RouteItem[8334]; + _vm->_linesManager.essai2 = new RouteItem[8334]; + if (!_vm->_linesManager.essai0) + _vm->_linesManager.essai0 = (RouteItem*)g_PTRNUL; + if (!_vm->_linesManager.essai1) + _vm->_linesManager.essai1 = (RouteItem*)g_PTRNUL; + if (!_vm->_linesManager.essai2) + _vm->_linesManager.essai2 = (RouteItem*)g_PTRNUL; + + BUFFERTAPE = _vm->_globals.allocMemory(10000); + _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE); } /** @@ -3278,7 +3100,7 @@ void LinesManager::checkZone() { if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + if (_vm->_globals.NOMARCHE || (_vm->_linesManager._route == (RouteItem *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index b9ae3e6e31..aecc56fbcd 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -83,6 +83,17 @@ struct ZonePItem { int field12; }; +struct RouteItem { + int16 _X; + int16 _Y; + int16 _dir; + int16 _unk; + bool isValid() const { return _X != -1 || _Y != -1; } + void invalidate() { _X = _Y = _dir = _unk = -1; } + void set(int16 X, int16 Y, int16 dir) { _X = X; _Y = Y; _dir = dir; _unk = 0; } +}; + + class LinesManager { private: HopkinsEngine *_vm; @@ -95,10 +106,10 @@ private: int NVPX; int NVPY; int _smoothMoveDirection; - int16 super_parcours[32002]; + RouteItem super_parcours[8001]; byte *BUFFERTAPE; - int16 *essai0; - int16 *essai1; + RouteItem *essai0; + RouteItem *essai1; int16 *BufLig; LigneZoneItem _zoneLine[401]; LigneItem Ligne[400]; @@ -117,18 +128,18 @@ private: bool makeSmoothMove(int fromX, int fromY, int destX, int destY); int CALC_PROPRE(int idx); - int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7, int a8, int a9); - int CONTOURNE(int a1, int a2, int a3, int a4, int a5, int16 *route, int a7); + int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem *route, int a8, int a9); + int CONTOURNE(int a1, int a2, int a3, int a4, int a5, RouteItem *route); bool MIRACLE(int a1, int a2, int a3, int a4, int a5); - int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, int16 *route, int a9); + int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, RouteItem *route); int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); int colision(int xp, int yp); public: - int16 *_route; - int16 *essai2; + RouteItem *_route; + RouteItem *essai2; int BOBZONE[105]; bool BOBZONE_FLAG[105]; @@ -145,7 +156,7 @@ public: void loadLines(const Common::String &file); void addLine(int idx, int direction, int a3, int a4, int a5, int a6); void initRoute(); - int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); + RouteItem *cityMapCarRoute(int x1, int y1, int x2, int y2); void clearAllZones(); void resetLines(); void resetLinesNumb(); @@ -156,8 +167,8 @@ public: int MZONE(); void CARRE_ZONE(); - int16 *PARCOURS2(int fromX, int fromY, int destX, int destY); - void PACOURS_PROPRE(int16 *route); + RouteItem *PARCOURS2(int fromX, int fromY, int destX, int destY); + void PACOURS_PROPRE(RouteItem *route); }; } // End of namespace Hopkins diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index bbb2e38ddb..3abb8d6634 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1278,7 +1278,7 @@ void ObjectsManager::GOHOME() { int v58 = 0; int v1 = 0; - if (_vm->_linesManager._route == (int16 *)g_PTRNUL) + if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL) return; if (_vm->_globals.Compteur > 1) { @@ -1293,9 +1293,9 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); - newPosX = *_vm->_linesManager._route++; - newPosY = *_vm->_linesManager._route++; - newDirection = *_vm->_linesManager._route++; + newPosX = _vm->_linesManager._route->_X; + newPosY = _vm->_linesManager._route->_Y; + newDirection = _vm->_linesManager._route->_dir; _vm->_linesManager._route++; if (newPosX != -1 || newPosY != -1) { @@ -1312,11 +1312,11 @@ void ObjectsManager::GOHOME() { zoneId = _vm->_globals._saveData->_data[svField2]; else zoneId = _zoneNum; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals._oldDirection = -1; if (zoneId > 0) { if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) { @@ -1519,9 +1519,9 @@ void ObjectsManager::GOHOME() { } bool loopCond = false; do { - newPosX = *_vm->_linesManager._route++; - newPosY = *_vm->_linesManager._route++; - newDirection = *_vm->_linesManager._route++; + newPosX = _vm->_linesManager._route->_X; + newPosY = _vm->_linesManager._route->_Y; + newDirection = _vm->_linesManager._route->_dir; _vm->_linesManager._route++; if (newPosX == -1 && newPosY == -1) { @@ -1532,7 +1532,7 @@ void ObjectsManager::GOHOME() { zoneId = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -1592,7 +1592,7 @@ void ObjectsManager::GOHOME() { } void ObjectsManager::GOHOME2() { - if (_vm->_linesManager._route == (int16 *)g_PTRNUL) + if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL) return; int v0 = 2; @@ -1604,9 +1604,9 @@ void ObjectsManager::GOHOME2() { _vm->_globals.j_104 = 0; for (;;) { - int nexPosX = *_vm->_linesManager._route++; - int newPosY = *_vm->_linesManager._route++; - int newDirection = *_vm->_linesManager._route++; + int nexPosX = _vm->_linesManager._route->_X; + int newPosY = _vm->_linesManager._route->_Y; + int newDirection = _vm->_linesManager._route->_dir; _vm->_linesManager._route++; if ((nexPosX == -1) && (newPosY == -1)) @@ -1638,7 +1638,7 @@ void ObjectsManager::GOHOME2() { else if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 3); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; } /** @@ -1755,7 +1755,7 @@ void ObjectsManager::handleCityMap() { _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; animateSprite(0); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -1795,7 +1795,7 @@ void ObjectsManager::handleCityMap() { _vm->_linesManager.checkZone(); GOHOME2(); - if (_vm->_linesManager._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) + if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL && _vm->_globals.GOACTION) PARADISE(); _vm->_eventsManager.VBL(); @@ -1867,12 +1867,9 @@ void ObjectsManager::handleLeftButton() { do { _vm->_linesManager.essai2[routeIdx] = _vm->_linesManager._route[routeIdx]; ++routeIdx; - } while (_vm->_linesManager._route[routeIdx] != -1); + } while (_vm->_linesManager._route[routeIdx]._X != -1); - _vm->_linesManager.essai2[routeIdx] = -1; - _vm->_linesManager.essai2[routeIdx + 1] = -1; - _vm->_linesManager.essai2[routeIdx + 2] = -1; - _vm->_linesManager.essai2[routeIdx + 3] = -1; + _vm->_linesManager.essai2[routeIdx].invalidate();; } if (_vm->_globals.GOACTION) { @@ -1891,26 +1888,26 @@ void ObjectsManager::handleLeftButton() { } } _vm->_globals.GOACTION = false; - int16 *oldRoute = _vm->_linesManager._route; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + RouteItem *oldRoute = _vm->_linesManager._route; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; if (_forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) { - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); _vm->_globals._actionDirection = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_globals._oldDirection = -1; } else { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); - if (_vm->_linesManager._route != (int16 *)g_PTRNUL) + if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) { + if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager._route) { _vm->_globals._oldDirection = -1; } else { _vm->_linesManager._route = oldRoute; @@ -1919,12 +1916,12 @@ void ObjectsManager::handleLeftButton() { } else { if (!_vm->_globals.NOMARCHE && !_vm->_globals._cityMapEnabledFl) { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); - if (_vm->_linesManager._route != (int16 *)g_PTRNUL) + if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) + if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL || oldRoute == _vm->_linesManager._route) _vm->_globals._oldDirection = -1; else _vm->_linesManager._route = oldRoute; @@ -1952,7 +1949,7 @@ void ObjectsManager::handleLeftButton() { && _curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; getSpriteX(0); getSpriteY(0); } @@ -2069,7 +2066,7 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _vm->_linesManager.resetLinesNumb(); _vm->_linesManager.resetLastLine(); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; @@ -2079,7 +2076,7 @@ void ObjectsManager::clearScreen() { _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals._oldDirection = -1; _vm->_graphicsManager.RESET_SEGMENT_VESA(); } @@ -2094,7 +2091,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); _vm->_globals.NOT_VERIF = true; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { @@ -3673,7 +3670,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals._cityMapEnabledFl = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals._exitId = 0; if (!backgroundFile.empty()) @@ -3693,7 +3690,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->_globals._screenId == 61) { addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -3711,13 +3708,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _oldCharacterPosX = getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); _vm->_globals.NOT_VERIF = true; do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); setSpriteIndex(0, 64); } do { @@ -3820,7 +3817,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm computeAndSetSpriteSize(); animateSprite(0); _vm->_globals.CACHE_ON(); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; @@ -3851,7 +3848,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm int yp = _vm->_eventsManager.getMouseY(); if ((xCheck == xp) && (yCheck == yp)) { - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; PARADISE(); if (_vm->_globals._exitId) breakFlag = true; @@ -3867,8 +3864,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); _vm->_linesManager.checkZone(); - if (_vm->_linesManager._route == (int16 *)g_PTRNUL - || (GOHOME(), _vm->_linesManager._route == (int16 *)g_PTRNUL)) { + if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL + || (GOHOME(), _vm->_linesManager._route == (RouteItem *)g_PTRNUL)) { if (_vm->_globals.GOACTION) PARADISE(); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index aed99045c4..33876f8293 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -745,7 +745,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 46: { _vm->_globals.NOT_VERIF = true; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); _vm->_objectsManager._zoneNum = -1; do { @@ -754,7 +754,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_globals.NOT_VERIF = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); @@ -957,7 +957,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); _vm->_globals.NOT_VERIF = true; do { @@ -966,7 +966,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.setBobAnimDataIdx(7, 0); @@ -1057,7 +1057,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); _vm->_globals.NOT_VERIF = true; do { @@ -1066,7 +1066,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); _vm->_objectsManager.setBobAnimation(8); @@ -1374,7 +1374,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; if (_vm->_globals._saveData->_data[svField253] == 1) { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); } @@ -1391,7 +1391,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.loadSample(1, "SOUND63.WAV"); @@ -1622,7 +1622,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; @@ -1632,7 +1632,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1650,7 +1650,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; @@ -1660,7 +1660,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1823,7 +1823,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager._specialSoundNum = 0; } _vm->_globals.NOT_VERIF = true; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = 0; @@ -1833,7 +1833,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_globals._exitId = _vm->_globals._saveData->_data[svField401]; _vm->_globals._disableInventFl = false; @@ -1853,7 +1853,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(1) != 9); _vm->_objectsManager.stopBobAnimation(1); - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); _vm->_objectsManager._zoneNum = 0; @@ -1864,7 +1864,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.playSound("SOUND66.WAV"); @@ -1952,7 +1952,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_linesManager._route = (int16 *)g_PTRNUL; + _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); _vm->_globals.NOT_VERIF = true; do { @@ -1961,7 +1961,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_linesManager._route != (int16 *)g_PTRNUL); + } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); int v45 = 0; _vm->_objectsManager.setBobAnimation(7); -- cgit v1.2.3 From f80cd6407c3281130c73d9a344a05d7d2b7ffa74 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 16 Feb 2013 13:46:13 +0100 Subject: HOPKINS: Extract utility function for appending linedata to route list --- engines/hopkins/lines.cpp | 137 +++++++++++++++------------------------------- engines/hopkins/lines.h | 5 ++ 2 files changed, 48 insertions(+), 94 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index ffe8238d87..326982d4eb 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -30,6 +30,25 @@ namespace Hopkins { + +int LigneItem::appendToRouteInc(int from, int to, RouteItem *route, int index) { + if (to == -1) + to = _lineDataEndIdx; + assert(from <= to); + for (int i = from; i < to; ++i) + route[index++].set(_lineData[2*i], _lineData[2*i+1], field6); + return index; +} +int LigneItem::appendToRouteDec(int from, int to, RouteItem *route, int index) { + if (from == -1) + from = _lineDataEndIdx - 1; + assert(from >= to); + for (int i = from; i > to; --i) + route[index++].set(_lineData[2*i], _lineData[2*i+1], field8); + return index; +} + + LinesManager::LinesManager() { for (int i = 0; i < MAX_LINES; ++i) { Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0); @@ -441,46 +460,26 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, RouteItem *r int v7 = a2; int v8 = a3; if (a1 < a4) { - for (int i = a2; Ligne[a1]._lineDataEndIdx > i; ++i) { - route[v8].set(Ligne[a1]._lineData[2 * i], Ligne[a1]._lineData[2 * i + 1], Ligne[a1].field6); - v8++; - } + v8 = Ligne[a1].appendToRouteInc(a2, -1, route, v8); - for (int i = a1 + 1; i < a4; i++) { - for (int j = 0; j < Ligne[i]._lineDataEndIdx; j++) { - route[v8].set(Ligne[i]._lineData[2 * j], Ligne[i]._lineData[2 * j + 1], Ligne[i].field6); - v8++; - } - } + for (int i = a1 + 1; i < a4; i++) + v8 = Ligne[i].appendToRouteInc(0, -1, route, v8); v7 = 0; v36 = a4; } if (v36 > a4) { - for (int i = v7; i > 0; --i) { - route[v8].set(Ligne[v36]._lineData[2 * i], Ligne[v36]._lineData[2 * i + 1], Ligne[v36].field8); - v8++; - } - for (int i = v36 - 1; i > a4; i--) { - for (int j = Ligne[i]._lineDataEndIdx - 1; j > 0; --j) { - route[v8].set(Ligne[i]._lineData[2 * j], Ligne[i]._lineData[2 * j + 1], Ligne[i].field8); - v8++; - } - } + v8 = Ligne[v36].appendToRouteDec(v7, 0, route, v8); + for (int i = v36 - 1; i > a4; i--) + v8 = Ligne[i].appendToRouteDec(-1, 0, route, v8); v7 = Ligne[a4]._lineDataEndIdx - 1; v36 = a4; } if (v36 == a4) { if (a5 >= v7) { - for (int i = v7; i < a5; i++) { - route[v8].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i + 1], Ligne[a4].field6); - v8++; - } + v8 = Ligne[a4].appendToRouteInc(v7, a5, route, v8); } else { - for (int i = v7; i > a5; --i) { - route[v8].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i+ 1], Ligne[a4].field8); - v8++; - } + v8 = Ligne[a4].appendToRouteDec(v7, a5, route, v8); } } return v8; @@ -492,19 +491,12 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem * int v10 = a2; int v40 = a3; if (a4 < a1) { - for (int i = a2; i < Ligne[a1]._lineDataEndIdx; ++i) { - route[v40].set(Ligne[a1]._lineData[2 * i], Ligne[a1]._lineData[2 * i + 1], Ligne[a1].field6); - v40++; - } + v40 = Ligne[a1].appendToRouteInc(a2, -1, route, v40); int v15 = a1 + 1; if (v15 == a9 + 1) v15 = a8; while (a4 != v15) { - for (int i = 0; i < Ligne[v15]._lineDataEndIdx; i++) { - route[v40].set(Ligne[v15]._lineData[2 * i], Ligne[v15]._lineData[2 * i + 1], Ligne[v15].field6); - v40++; - - } + v40 = Ligne[v15].appendToRouteInc(0, -1, route, v40); ++v15; if (a9 + 1 == v15) v15 = a8; @@ -513,18 +505,12 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem * v9 = a4; } if (a4 > v9) { - for (int i = v10; i > 0; --i) { - route[v40].set(Ligne[v9]._lineData[2 * i], Ligne[v9]._lineData[2 * i + 1], Ligne[v9].field8); - v40++; - } + v40 = Ligne[v9].appendToRouteDec(v10, 0, route, v40); int v24 = v9 - 1; if (v24 == a8 - 1) v24 = a9; while (a4 != v24) { - for (int i = Ligne[v24]._lineDataEndIdx - 1; i > 0; --i) { - route[v40].set(Ligne[v24]._lineData[2 * i], Ligne[v24]._lineData[2 * i + 1], Ligne[v24].field8); - v40++; - } + v40 = Ligne[v24].appendToRouteDec(-1, 0, route, v40); --v24; if (a8 - 1 == v24) v24 = a9; @@ -534,15 +520,9 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem * } if (a4 == v9) { if (a5 >= v10) { - for (int i = v10; i < a5; i++) { - route[v40].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i + 1], Ligne[a4].field6); - v40++; - } + v40 = Ligne[a4].appendToRouteInc(v10, a5, route, v40); } else { - for (int i = v10; i > a5; i--) { - route[v40].set(Ligne[a4]._lineData[2 * i], Ligne[a4]._lineData[2 * i + 1], Ligne[a4].field8); - v40++; - } + v40 = Ligne[a4].appendToRouteDec(v10, a5, route, v40); } } return v40; @@ -1554,15 +1534,9 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v115 == v121) { if (v114 <= v120) { - for (int dataIdx = v114; dataIdx < v120; dataIdx++) { - super_parcours[v112].set(Ligne[v121]._lineData[2 * dataIdx], Ligne[v121]._lineData[2 * dataIdx + 1], Ligne[v121].field6); - v112++; - } + v112 = Ligne[v121].appendToRouteInc(v114, v120, super_parcours, v112); } else { - for (int dataIdx = v114; dataIdx > v120; dataIdx--) { - super_parcours[v112].set(Ligne[v121]._lineData[2 * dataIdx], Ligne[v121]._lineData[2 * dataIdx + 1], Ligne[v121].field8); - v112++; - } + v112 = Ligne[v121].appendToRouteDec(v114, v120, super_parcours, v112); } } if (PARC_PERS(super_parcours[v112 - 1]._X, super_parcours[v112 - 1]._Y, clipDestX, clipDestY, -1, -1, v112) != 1) { @@ -2320,13 +2294,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { while (loopFl) { loopFl = false; if (v69 < v73) { - int v34 = v68; - // FIXME: This loop is encoded as a for-loop in a crazy way - for (int i = Ligne[v69]._lineDataEndIdx; v34 < i - 2; i = Ligne[v69]._lineDataEndIdx) { - super_parcours[superRouteIdx].set(Ligne[v69]._lineData[2 * v34], Ligne[v69]._lineData[2 * v34 + 1], Ligne[v69].field6); - superRouteIdx++; - ++v34; - } + superRouteIdx = Ligne[v69].appendToRouteInc(v68, Ligne[v69]._lineDataEndIdx - 2, super_parcours, superRouteIdx); for (int j = v69 + 1; j < v73; ++j) { if (PLAN_TEST(Ligne[j]._lineData[0], Ligne[j]._lineData[1], superRouteIdx, j, v73)) { v69 = NV_LIGNEDEP; @@ -2336,10 +2304,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { break; } if (Ligne[j]._lineDataEndIdx - 2 > 0) { - for (int v40 = 0; v40 < Ligne[j]._lineDataEndIdx - 2; v40++) { - super_parcours[superRouteIdx].set(Ligne[j]._lineData[2 * v40], Ligne[j]._lineData[2 * v40 + 1], Ligne[j].field6); - superRouteIdx++; - } + superRouteIdx = Ligne[j].appendToRouteInc(0, Ligne[j]._lineDataEndIdx - 2, super_parcours, superRouteIdx); } } if (loopFl) @@ -2353,8 +2318,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { superRouteIdx++; } for (int l = v69 - 1; l > v73; --l) { - int v48 = l; - if (PLAN_TEST(Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 2], Ligne[l]._lineData[2 * Ligne[v48]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { + if (PLAN_TEST(Ligne[l]._lineData[2 * Ligne[l]._lineDataEndIdx - 2], Ligne[l]._lineData[2 * Ligne[l]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { v69 = NV_LIGNEDEP; v68 = NV_LIGNEOFS; superRouteIdx = NV_POSI; @@ -2362,10 +2326,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { break; } - for (int v49 = Ligne[v48]._lineDataEndIdx - 2; v49 > 0; v49 --) { - super_parcours[superRouteIdx].set(Ligne[l]._lineData[2 * v49], Ligne[l]._lineData[2 * v49 + 1], Ligne[l].field8); - superRouteIdx++; - } + superRouteIdx = Ligne[l].appendToRouteDec(Ligne[l]._lineDataEndIdx - 2, 0, super_parcours, superRouteIdx); } if (loopFl) continue; @@ -2375,15 +2336,9 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } if (v69 == v73) { if (v68 <= v72) { - for (int v57 = v68; v57 < v72; v57++) { - super_parcours[superRouteIdx].set(Ligne[v73]._lineData[2 * v57], Ligne[v73]._lineData[2 * v57 + 1], Ligne[v73].field6); - superRouteIdx++; - } + superRouteIdx = Ligne[v73].appendToRouteInc(v68, v72, super_parcours, superRouteIdx); } else { - for (int v53 = v68; v53 > v72; v53--) { - super_parcours[superRouteIdx].set(Ligne[v73]._lineData[2 * v53], Ligne[v73]._lineData[2 * v53 + 1], Ligne[v73].field8); - superRouteIdx++; - } + superRouteIdx = Ligne[v73].appendToRouteDec(v68, v72, super_parcours, superRouteIdx); } } } @@ -2654,15 +2609,9 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int superRouteIdx = a3; if (v33 == 1) { - for (int i = 0; i < Ligne[idxTest]._lineDataEndIdx; i++) { - super_parcours[superRouteIdx].set(Ligne[idxTest]._lineData[2 * i], Ligne[idxTest]._lineData[2 * i + 1], Ligne[idxTest].field6); - superRouteIdx++; - } + superRouteIdx = Ligne[idxTest].appendToRouteInc(0, -1, super_parcours, superRouteIdx); } else if (v33 == 2) { - for (int v19 = Ligne[idxTest]._lineDataEndIdx - 1; v19 > -1; v19--) { - super_parcours[superRouteIdx].set(Ligne[idxTest]._lineData[2 * v19], Ligne[idxTest]._lineData[2 * v19 + 1], Ligne[idxTest].field8); - superRouteIdx++; - } + superRouteIdx = Ligne[idxTest].appendToRouteDec(-1, -1, super_parcours, superRouteIdx); } NV_POSI = superRouteIdx; return true; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index aecc56fbcd..b8cfb7442b 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -36,12 +36,17 @@ struct LigneZoneItem { int16 *_zoneData; }; +struct RouteItem; + struct LigneItem { int _lineDataEndIdx; int _direction; int field6; int field8; int16 *_lineData; + + int appendToRouteInc(int from, int to, RouteItem *route, int index); + int appendToRouteDec(int from, int to, RouteItem *route, int index); }; struct SmoothItem { -- cgit v1.2.3 From 979328ebdb1195fc7263c5ebea0e65531a472243 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 16 Feb 2013 18:48:55 +0100 Subject: HOPKINS: Introduce Directions enum --- engines/hopkins/globals.cpp | 7 ++-- engines/hopkins/globals.h | 23 +++++++++--- engines/hopkins/objects.cpp | 90 ++++++++++++++++++++++----------------------- engines/hopkins/script.cpp | 12 +++--- 4 files changed, 72 insertions(+), 60 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 06807b3940..dbd23709e6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -103,9 +103,9 @@ Globals::Globals() { _linuxEndDemoFl = false; _speed = 1; _oldFrameIndex = 0; - _oldDirection = 0; + _oldDirection = DIR_NONE; _oldDirectionSpriteIdx = 59; - _lastDirection = 0; + _lastDirection = DIR_NONE; NUM_FICHIER_OBJ = 0; nbrligne = 0; _boxWidth = 0; @@ -177,7 +177,6 @@ Globals::Globals() { _oldMouseY = 0; compteur_71 = 0; _forceHideText = false; - j_104 = 0; } Globals::~Globals() { @@ -284,7 +283,7 @@ void Globals::loadCharacterData() { } _oldFrameIndex = -1; - _oldDirection = -1; + _oldDirection = DIR_NONE; } void Globals::INIT_ANIM() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 0eed175462..f49d9180f1 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -192,8 +192,6 @@ enum SauvegardeOffset { , svField401 = 401 }; -enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 }; - // TODO: Sauvegrade1 fields should really be mapped into data array struct Sauvegarde { byte _data[2050]; @@ -215,6 +213,21 @@ struct CreditItem { enum Language { LANG_EN = 0, LANG_FR = 1, LANG_SP = 2}; +enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 }; + +enum Directions { + DIR_NONE = -1, + DIR_UP = 1, + DIR_UP_RIGHT = 2, + DIR_RIGHT = 3, + DIR_DOWN_RIGHT = 4, + DIR_DOWN = 5, + DIR_DOWN_LEFT = 6, + DIR_LEFT = 7, + DIR_UP_LEFT = 8 +}; + + class HopkinsEngine; /** @@ -239,9 +252,10 @@ public: bool _forceHideText; int _exitId; int _oceanDirection; - int _oldDirection, _oldDirectionSpriteIdx; + Directions _oldDirection; + int _oldDirectionSpriteIdx; int _actionDirection; - int _lastDirection; + Directions _lastDirection; int _oldFrameIndex; int _hotspotTextColor; int _inventory[36]; @@ -312,7 +326,6 @@ public: int compteur_71; Common::String FICH_ZONE; bool GOACTION; - int j_104; Common::String FICH_TEXTE; Globals(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index ed3800f240..7b7ffc2aef 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1284,17 +1284,17 @@ void ObjectsManager::GOHOME() { int newPosX; int newPosY; - int newDirection; + Directions newDirection; int oldPosX = 0; int oldPosY = 0; int oldFrameIdx = 0; _vm->_globals.Compteur = 0; - if (_vm->_globals._oldDirection == -1) { + if (_vm->_globals._oldDirection == DIR_NONE) { computeAndSetSpriteSize(); newPosX = *_vm->_linesManager._route++; newPosY = *_vm->_linesManager._route++; - newDirection = *_vm->_linesManager._route++; + newDirection = (Directions)*_vm->_linesManager._route++; _vm->_linesManager._route++; if (newPosX != -1 || newPosY != -1) { @@ -1316,7 +1316,7 @@ void ObjectsManager::GOHOME() { setFlipSprite(0, false); _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; if (zoneId > 0) { if (_vm->_linesManager.ZONEP[zoneId]._destX && _vm->_linesManager.ZONEP[zoneId]._destY && _vm->_linesManager.ZONEP[zoneId]._destY != 31) { if (_vm->_linesManager.ZONEP[zoneId]._spriteIndex == -1) { @@ -1333,7 +1333,7 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; return; } - if (_vm->_globals._oldDirection == 3) { + if (_vm->_globals._oldDirection == DIR_RIGHT) { if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1357,7 +1357,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 7) { + if (_vm->_globals._oldDirection == DIR_LEFT) { if (_vm->_globals._oldFrameIndex < 24 || _vm->_globals._oldFrameIndex > 35) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1380,7 +1380,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 1) { + if (_vm->_globals._oldDirection == DIR_UP) { if (_vm->_globals._oldFrameIndex > 11) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1401,7 +1401,7 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 4 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 5) { + if (_vm->_globals._oldDirection == DIR_DOWN) { if (_vm->_globals._oldFrameIndex < 48 || _vm->_globals._oldFrameIndex > 59) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1421,7 +1421,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 4 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 2) { + if (_vm->_globals._oldDirection == DIR_UP_RIGHT) { if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1445,7 +1445,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 8) { + if (_vm->_globals._oldDirection == DIR_UP_LEFT) { if (_vm->_globals._oldFrameIndex < 12 || _vm->_globals._oldFrameIndex > 23) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1468,7 +1468,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 4) { + if (_vm->_globals._oldDirection == DIR_DOWN_RIGHT) { if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1492,7 +1492,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals.Compteur = 5 / _vm->_globals._speed; } - if (_vm->_globals._oldDirection == 6) { + if (_vm->_globals._oldDirection == DIR_DOWN_LEFT) { if (_vm->_globals._oldFrameIndex < 36 || _vm->_globals._oldFrameIndex > 47) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; @@ -1520,7 +1520,7 @@ void ObjectsManager::GOHOME() { do { newPosX = *_vm->_linesManager._route++; newPosY = *_vm->_linesManager._route++; - newDirection = *_vm->_linesManager._route++; + newDirection = (Directions)*_vm->_linesManager._route++; _vm->_linesManager._route++; if (newPosX == -1 && newPosY == -1) { @@ -1535,7 +1535,7 @@ void ObjectsManager::GOHOME() { computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _oldCharacterPosX = getSpriteX(0); _oldCharacterPosY = getSpriteY(0); @@ -1556,30 +1556,30 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals._oldDirection != newDirection) break; - if ((newDirection == 3 && newPosX >= oldPosX) || (_vm->_globals._oldDirection == 7 && newPosX <= oldPosX) || - (_vm->_globals._oldDirection == 1 && newPosY <= oldPosY) || (_vm->_globals._oldDirection == 5 && newPosY >= oldPosY) || - (_vm->_globals._oldDirection == 2 && newPosX >= oldPosX) || (_vm->_globals._oldDirection == 8 && newPosX <= oldPosX) || - (_vm->_globals._oldDirection == 4 && newPosX >= oldPosX) || (_vm->_globals._oldDirection == 6 && newPosX <= oldPosX)) + if ((newDirection == DIR_RIGHT && newPosX >= oldPosX) || (_vm->_globals._oldDirection == DIR_LEFT && newPosX <= oldPosX) || + (_vm->_globals._oldDirection == DIR_UP && newPosY <= oldPosY) || (_vm->_globals._oldDirection == DIR_DOWN && newPosY >= oldPosY) || + (_vm->_globals._oldDirection == DIR_UP_RIGHT && newPosX >= oldPosX) || (_vm->_globals._oldDirection == DIR_UP_LEFT && newPosX <= oldPosX) || + (_vm->_globals._oldDirection == DIR_DOWN_RIGHT && newPosX >= oldPosX) || (_vm->_globals._oldDirection == DIR_DOWN_LEFT && newPosX <= oldPosX)) loopCond = true; } while (!loopCond); if (loopCond) { computeAndSetSpriteSize(); - if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) + if ((_vm->_globals._oldDirection == DIR_DOWN_LEFT) || (_vm->_globals._oldDirection == DIR_LEFT) || (_vm->_globals._oldDirection == DIR_UP_LEFT)) setFlipSprite(0, true); - if ((_vm->_globals._oldDirection == 1) || (_vm->_globals._oldDirection == 2) || (_vm->_globals._oldDirection == 3) || - (_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5)) + if ((_vm->_globals._oldDirection == DIR_UP) || (_vm->_globals._oldDirection == DIR_UP_RIGHT) || (_vm->_globals._oldDirection == DIR_RIGHT) || + (_vm->_globals._oldDirection == DIR_DOWN_RIGHT) || (_vm->_globals._oldDirection == DIR_DOWN)) setFlipSprite(0, false); setSpriteX(0, newPosX); setSpriteY(0, newPosY); setSpriteIndex(0, oldFrameIdx); } else { - if ((_vm->_globals._oldDirection == 6) || (_vm->_globals._oldDirection == 7) || (_vm->_globals._oldDirection == 8)) + if ((_vm->_globals._oldDirection == DIR_DOWN_LEFT) || (_vm->_globals._oldDirection == DIR_LEFT) || (_vm->_globals._oldDirection == DIR_UP_LEFT)) setFlipSprite(0, true); - if ((_vm->_globals._oldDirection == 1) || (_vm->_globals._oldDirection == 2) || (_vm->_globals._oldDirection == 3) || - (_vm->_globals._oldDirection == 4) || (_vm->_globals._oldDirection == 5)) + if ((_vm->_globals._oldDirection == DIR_UP) || (_vm->_globals._oldDirection == DIR_UP_RIGHT) || (_vm->_globals._oldDirection == DIR_RIGHT) || + (_vm->_globals._oldDirection == DIR_DOWN_RIGHT) || (_vm->_globals._oldDirection == DIR_DOWN)) setFlipSprite(0, false); _vm->_globals.Compteur = 0; } @@ -1594,39 +1594,39 @@ void ObjectsManager::GOHOME2() { if (_vm->_linesManager._route == (int16 *)g_PTRNUL) return; - int v0 = 2; + int realSpeed = 2; if (_vm->_globals._speed == 2) - v0 = 4; + realSpeed = 4; else if (_vm->_globals._speed == 3) - v0 = 6; + realSpeed = 6; - _vm->_globals.j_104 = 0; + int countColisionPixel = 0; for (;;) { int nexPosX = *_vm->_linesManager._route++; int newPosY = *_vm->_linesManager._route++; - int newDirection = *_vm->_linesManager._route++; + Directions newDirection = (Directions)*_vm->_linesManager._route++; _vm->_linesManager._route++; if ((nexPosX == -1) && (newPosY == -1)) break; - ++_vm->_globals.j_104; - if (_vm->_globals.j_104 >= v0) { + ++countColisionPixel; + if (countColisionPixel >= realSpeed) { _vm->_globals._lastDirection = newDirection; setSpriteX(0, nexPosX); setSpriteY(0, newPosY); switch (_vm->_globals._lastDirection) { - case 1: + case DIR_UP: setSpriteIndex(0, 4); break; - case 3: + case DIR_RIGHT: setSpriteIndex(0, 5); break; - case 5: + case DIR_DOWN: setSpriteIndex(0, 6); break; - case 7: + case DIR_LEFT: setSpriteIndex(0, 7); break; } @@ -1636,16 +1636,16 @@ void ObjectsManager::GOHOME2() { } switch (_vm->_globals._lastDirection) { - case 1: + case DIR_UP: setSpriteIndex(0, 0); break; - case 3: + case DIR_RIGHT: setSpriteIndex(0, 1); break; - case 5: + case DIR_DOWN: setSpriteIndex(0, 2); break; - case 7: + case DIR_LEFT: setSpriteIndex(0, 3); break; } @@ -1914,7 +1914,7 @@ void ObjectsManager::handleLeftButton() { computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; } else { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); if (_vm->_linesManager._route != (int16 *)g_PTRNUL) @@ -1923,7 +1923,7 @@ void ObjectsManager::handleLeftButton() { _oldCharacterPosY = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) { - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; } else { _vm->_linesManager._route = oldRoute; } @@ -1937,7 +1937,7 @@ void ObjectsManager::handleLeftButton() { _oldCharacterPosY = getSpriteY(0); _vm->_globals.Compteur = 0; if (_vm->_linesManager._route != (int16 *)g_PTRNUL || oldRoute == _vm->_linesManager._route) - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; else _vm->_linesManager._route = oldRoute; } @@ -2092,7 +2092,7 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _changeVerbFl = false; _vm->_linesManager._route = (int16 *)g_PTRNUL; - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_graphicsManager.RESET_SEGMENT_VESA(); } @@ -3721,7 +3721,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo stopBobAnimation(3); _vm->_globals.NOT_VERIF = true; _oldCharacterPosX = getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); @@ -3838,7 +3838,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_eventsManager._mouseSpriteId = 4; _oldCharacterPosX = _characterPos.x; _oldCharacterPosY = _characterPos.y; - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; for (int idx = 0; idx < 5; ++idx) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index aed99045c4..2d4f3e30ba 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -955,7 +955,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 59: { _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); @@ -1055,7 +1055,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 81: { _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); @@ -1372,7 +1372,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 105: _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (int16 *)g_PTRNUL; if (_vm->_globals._saveData->_data[svField253] == 1) { @@ -1619,7 +1619,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -1647,7 +1647,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; _vm->_linesManager._route = (int16 *)g_PTRNUL; @@ -1949,7 +1949,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); - _vm->_globals._oldDirection = -1; + _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; _vm->_linesManager._route = (int16 *)g_PTRNUL; -- cgit v1.2.3 From ccf07b8956aa6865f4b8c0ff52cbb89d50e0421f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Feb 2013 01:19:41 +0100 Subject: HOPKINS: More Direction refactoring --- engines/hopkins/globals.cpp | 5 +- engines/hopkins/globals.h | 2 +- engines/hopkins/hopkins.cpp | 92 +++++++++-------- engines/hopkins/hopkins.h | 2 +- engines/hopkins/lines.cpp | 236 ++++++++++++++++++++++---------------------- engines/hopkins/lines.h | 10 +- engines/hopkins/objects.cpp | 14 +-- engines/hopkins/script.cpp | 144 +++++++++++++-------------- 8 files changed, 256 insertions(+), 249 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index dbd23709e6..ac903ddd00 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -130,8 +130,7 @@ Globals::Globals() { PERSO_TYPE = 0; GOACTION = false; Compteur = 0; - _actionDirection = 0; - _actionDirection = 0; + _actionDirection = DIR_NONE; Credit_bx = -1; Credit_bx1 = -1; @@ -142,7 +141,7 @@ Globals::Globals() { memset(_creditsItem, 0, 12000); _creditsStep = 0; - _oceanDirection = 0; + _oceanDirection = DIR_NONE; // Initialize pointers BUF_ZONE = NULL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index f49d9180f1..bfd5d01307 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -251,7 +251,7 @@ public: bool _cacheFl; bool _forceHideText; int _exitId; - int _oceanDirection; + Directions _oceanDirection; Directions _oldDirection; int _oldDirectionSpriteIdx; int _actionDirection; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ab3fe1fc56..ece6271442 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1285,55 +1285,55 @@ bool HopkinsEngine::runFull() { break; case 77: - OCEAN(77, "OCEAN01", 3, 0, 84, 0, 0, 25); + OCEAN(77, "OCEAN01", DIR_RIGHT, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", 1, 0, 91, 84, 0, 25); + OCEAN(78, "OCEAN02", DIR_UP, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", 7, 87, 0, 0, 83, 25); + OCEAN(79, "OCEAN03", DIR_LEFT, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", 1, 86, 88, 0, 81, 25); + OCEAN(80, "OCEAN04", DIR_UP, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", 1, 91, 82, 80, 85, 25); + OCEAN(81, "OCEAN05", DIR_UP, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", 7, 81, 0, 88, 0, 25); + OCEAN(82, "OCEAN06", DIR_LEFT, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", 1, 89, 0, 79, 88, 25); + OCEAN(83, "OCEAN07", DIR_UP, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", 1, 77, 0, 0, 78, 25); + OCEAN(84, "OCEAN08", DIR_UP, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", 1, 0, 0, 81, 0, 25); + OCEAN(85, "OCEAN09", DIR_UP, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", 1, 0, 80, 0, 91, 25); + OCEAN(86, "OCEAN10", DIR_UP, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", 3, 0, 79, 90, 0, 25); + OCEAN(87, "OCEAN11", DIR_RIGHT, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", 1, 80, 0, 83, 82, 25); + OCEAN(88, "OCEAN12", DIR_UP, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", 3, 0, 83, 0, 0, 25); + OCEAN(89, "OCEAN13", DIR_RIGHT, 0, 83, 0, 0, 25); break; case 90: @@ -1341,7 +1341,7 @@ bool HopkinsEngine::runFull() { break; case 91: - OCEAN(91, "OCEAN15", 3, 78, 81, 86, 0, 25); + OCEAN(91, "OCEAN15", DIR_RIGHT, 78, 81, 86, 0, 25); break; case 93: @@ -2540,18 +2540,18 @@ void HopkinsEngine::BTOCEAN() { switch (_objectsManager._zoneNum) { case 1: switch (_globals._oceanDirection) { - case 1: - _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); - break; - case 3: + case DIR_UP: + _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,-1,", 0, 0, 6, false); + break; + case DIR_RIGHT: _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,-1,", 0, 0, 6, false); break; - case 5: + case DIR_DOWN: _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false); break; } - _globals._oceanDirection = 7; + _globals._oceanDirection = DIR_LEFT; _globals._exitId = 1; oldX = _objectsManager.getSpriteX(0); for (;;) { @@ -2575,17 +2575,17 @@ void HopkinsEngine::BTOCEAN() { break; case 2: switch (_globals._oceanDirection) { - case 1: + case DIR_UP: _objectsManager.SPACTION(_globals.PERSO, "27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); break; - case 5: + case DIR_DOWN: _objectsManager.SPACTION(_globals.PERSO, "9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 6, false); break; - case 7: + case DIR_LEFT: _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); break; } - _globals._oceanDirection = 3; + _globals._oceanDirection = DIR_RIGHT; _globals._exitId = 2; oldX = _objectsManager.getSpriteX(0); for (;;) { @@ -2608,7 +2608,7 @@ void HopkinsEngine::BTOCEAN() { break; case 3: switch (_globals._oceanDirection) { - case 3: + case DIR_RIGHT: oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) @@ -2628,10 +2628,10 @@ void HopkinsEngine::BTOCEAN() { if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "36,35,34,33,32,31,30,29,28,27,-1,", 0, 0, 6, false); break; - case 5: + case DIR_DOWN: _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); break; - case 7: + case DIR_LEFT: oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) @@ -2652,15 +2652,15 @@ void HopkinsEngine::BTOCEAN() { _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); break; } - _globals._oceanDirection = 1; + _globals._oceanDirection = DIR_UP; _globals._exitId = 3; break; case 4: switch (_globals._oceanDirection) { - case 1: + case DIR_UP: _objectsManager.SPACTION(_globals.PERSO, "27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,-1,", 0, 0, 6, false); break; - case 3: + case DIR_RIGHT: oldX = _objectsManager.getSpriteX(0); do { if (_globals._speed == 1) @@ -2680,7 +2680,7 @@ void HopkinsEngine::BTOCEAN() { if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "0,1,2,3,4,5,6,7,8,9,-1,", 0, 0, 6, false); break; - case 7: + case DIR_LEFT: oldX = _objectsManager.getSpriteX(0); for (;;) { if (_globals._speed == 1) @@ -2703,24 +2703,30 @@ void HopkinsEngine::BTOCEAN() { } break; } - _globals._oceanDirection = 5; + _globals._oceanDirection = DIR_DOWN; _globals._exitId = 4; break; } } void HopkinsEngine::OCEAN_HOME() { - if (_globals._oceanDirection == 3) - _objectsManager.setSpriteIndex(0, 0); - else if (_globals._oceanDirection == 7) - _objectsManager.setSpriteIndex(0, 18); - else if (_globals._oceanDirection == 1) + switch (_globals._oceanDirection) { + case DIR_UP: _objectsManager.setSpriteIndex(0, 27); - else if (_globals._oceanDirection == 5) + break; + case DIR_RIGHT: + _objectsManager.setSpriteIndex(0, 0); + break; + case DIR_DOWN: _objectsManager.setSpriteIndex(0, 9); + break; + case DIR_LEFT: + _objectsManager.setSpriteIndex(0, 18); + break; + } } -void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { +void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { _globals._cityMapEnabledFl = false; _graphicsManager._noFadingFl = false; _globals.NOMARCHE = false; @@ -2753,19 +2759,19 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _globals._oceanDirection = defaultDirection; switch (_globals._oceanDirection) { - case 1: + case DIR_UP: _objectsManager._characterPos.x = 236; _objectsManager._startSpriteIndex = 27; break; - case 3: + case DIR_RIGHT: _objectsManager._characterPos.x = -20; _objectsManager._startSpriteIndex = 0; break; - case 5: + case DIR_DOWN: _objectsManager._characterPos.x = 236; _objectsManager._startSpriteIndex = 9; break; - case 7: + case DIR_LEFT: _objectsManager._characterPos.x = 415; _objectsManager._startSpriteIndex = 18; break; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index d3e735df10..fe14b23a9a 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -120,7 +120,7 @@ private: void BTOCEAN(); void OCEAN_HOME(); - void OCEAN(int16 curExitId, Common::String backgroundFilename, int16 defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); + void OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); void loadCredits(); void displayCredits(int startPosY, byte *buffer, char colour); void displayCredits(); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 4e57a1ee4c..c4441e0da7 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -61,7 +61,7 @@ LinesManager::LinesManager() { NV_POSI = 0; NVPX = 0; NVPY = 0; - _smoothMoveDirection = 0; + _smoothMoveDirection = DIR_NONE; _lastLine = 0; _maxLineIdx = 0; _pathFindingMaxDepth = 0; @@ -92,7 +92,7 @@ void LinesManager::loadLines(const Common::String &file) { byte *ptr = _vm->_fileManager.loadFile(file); for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { addLine(idx, - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), + (Directions)(int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), @@ -218,7 +218,7 @@ void LinesManager::addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZ /** * Add Line */ -void LinesManager::addLine(int idx, int direction, int a3, int a4, int a5, int a6) { +void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5, int a6) { assert (idx <= MAX_LINES); if (_linesNumb < idx) @@ -249,59 +249,59 @@ void LinesManager::addLine(int idx, int direction, int a3, int a4, int a5, int a int v12 = (int)v37 / 1000; if (!v11) { if (v12 == -1) { - Ligne[idx].field6 = 1; + Ligne[idx].field6 = DIR_UP; Ligne[idx].field8 = 5; } if (v12 == 1) { - Ligne[idx].field6 = 5; + Ligne[idx].field6 = DIR_DOWN; Ligne[idx].field8 = 1; } } if (v11 == 1) { if (v12 == -1) { - Ligne[idx].field6 = 2; + Ligne[idx].field6 = DIR_UP_RIGHT; Ligne[idx].field8 = 6; } if (!v12) { - Ligne[idx].field6 = 3; + Ligne[idx].field6 = DIR_RIGHT; Ligne[idx].field8 = 7; } if (v12 == 1) { - Ligne[idx].field6 = 4; + Ligne[idx].field6 = DIR_DOWN_RIGHT; Ligne[idx].field8 = 8; } } if (v11 == -1) { if (v12 == 1) { - Ligne[idx].field6 = 6; + Ligne[idx].field6 = DIR_DOWN_LEFT; Ligne[idx].field8 = 2; } if (!v12) { - Ligne[idx].field6 = 7; + Ligne[idx].field6 = DIR_LEFT; Ligne[idx].field8 = 3; } if (v12 == -1) { - Ligne[idx].field6 = 8; + Ligne[idx].field6 = DIR_UP_LEFT; Ligne[idx].field8 = 4; } } if (v11 == 1 && v37 > 250 && v37 <= 999) { - Ligne[idx].field6 = 4; + Ligne[idx].field6 = DIR_DOWN_RIGHT; Ligne[idx].field8 = 8; } if (v11 == -1 && v37 > 250 && v37 <= 999) { - Ligne[idx].field6 = 6; + Ligne[idx].field6 = DIR_DOWN_LEFT; Ligne[idx].field8 = 2; } if (v11 == 1 && v37 < -250 && v37 > -1000) { - Ligne[idx].field6 = 2; + Ligne[idx].field6 = DIR_UP_RIGHT; Ligne[idx].field8 = 6; } // This condition is impossible to meet! // Code present in the Linux and BeOS executables // CHECKME: maybe it should be checking negative values? if (v11 == -1 && v37 <= 249 && v37 > 1000) { - Ligne[idx].field6 = 8; + Ligne[idx].field6 = DIR_UP_LEFT; Ligne[idx].field8 = 4; } int v40 = v36 / v34; @@ -589,31 +589,31 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { int v51; if (checkCollisionLine(fromX, fromY, &v51, &v50, 0, _linesNumb)) { switch (Ligne[v50]._direction) { - case 1: + case DIR_UP: curY -= 2; break; - case 2: + case DIR_UP_RIGHT: curY -= 2; curX += 2; break; - case 3: + case DIR_RIGHT: curX += 2; break; - case 4: + case DIR_DOWN_RIGHT: curY += 2; curX += 2; break; - case 5: + case DIR_DOWN: curY += 2; break; - case 6: + case DIR_DOWN_LEFT: curY += 2; curX -= 2; break; - case 7: + case DIR_LEFT: curX -= 2; break; - case 8: + case DIR_UP_LEFT: curY -= 2; curX -= 2; break; @@ -700,16 +700,16 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { v42 = -1; } if (v46 != -1 || v44 != -1 || v48 != -1 || v42 != -1) { - int v21 = 0; + Directions newDir = DIR_NONE; if (a4 > v50) { if (v48 <= v46 && v44 <= v46 && v42 <= v46 && v46 > v50) - v21 = 1; + newDir = DIR_UP; if (v48 <= v44 && v46 <= v44 && v42 <= v44 && v50 < v44) - v21 = 3; + newDir = DIR_RIGHT; if (v46 <= v48 && v44 <= v48 && v42 <= v48 && v50 < v48) - v21 = 5; + newDir = DIR_DOWN; if (v48 <= v42 && v44 <= v42 && v46 <= v42 && v50 < v42) - v21 = 7; + newDir = DIR_LEFT; } else if (a4 < v50) { if (v46 == -1) v46 = 1300; @@ -720,17 +720,17 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { if (v42 == -1) v42 = 1300; if (v46 != 1300 && v48 >= v46 && v44 >= v46 && v42 >= v46 && v46 < v50) - v21 = 1; + newDir = DIR_UP; if (v44 != 1300 && v48 >= v44 && v46 >= v44 && v42 >= v44 && v50 > v44) - v21 = 3; + newDir = DIR_RIGHT; if (v48 != 1300 && v46 >= v48 && v44 >= v48 && v42 >= v48 && v50 > v48) - v21 = 5; + newDir = DIR_DOWN; if (v42 != 1300 && v48 >= v42 && v44 >= v42 && v46 >= v42 && v50 > v42) - v21 = 7; + newDir = DIR_LEFT; } - switch(v21) { - case 1: + switch(newDir) { + case DIR_UP: v36 = v46; v35 = v47; for (int v22 = 0; v22 < v39; v22++) { @@ -744,7 +744,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { } super_parcours[v7] = v41; super_parcours[v7 + 1] = v40 - v22; - super_parcours[v7 + 2] = 1; + super_parcours[v7 + 2] = DIR_UP; super_parcours[v7 + 3] = 0; v7 += 4; } @@ -753,7 +753,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { NV_POSI = v7; return true; break; - case 3: + case DIR_RIGHT: v36 = v44; v35 = v45; for (int v31 = 0; v31 < v38; v31++) { @@ -767,7 +767,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { } super_parcours[v7] = v31 + v41; super_parcours[v7 + 1] = v40; - super_parcours[v7 + 2] = 3; + super_parcours[v7 + 2] = DIR_RIGHT; super_parcours[v7 + 3] = 0; v7 += 4; } @@ -776,7 +776,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { NV_POSI = v7; return true; break; - case 5: + case DIR_DOWN: v36 = v48; v35 = v49; for (int v25 = 0; v25 < v37; v25++) { @@ -790,7 +790,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { } super_parcours[v7] = v41; super_parcours[v7 + 1] = v25 + v40; - super_parcours[v7 + 2] = 5; + super_parcours[v7 + 2] = DIR_DOWN; super_parcours[v7 + 3] = 0; v7 += 4; } @@ -799,7 +799,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { NV_POSI = v7; return true; break; - case 7: + case DIR_LEFT: v36 = v42; v35 = v43; for (int v28 = 0; v28 < v18; v28++) { @@ -813,7 +813,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { } super_parcours[v7] = v41 - v28; super_parcours[v7 + 1] = v40; - super_parcours[v7 + 2] = 7; + super_parcours[v7 + 2] = DIR_LEFT; super_parcours[v7 + 3] = 0; v7 += 4; } @@ -1104,31 +1104,31 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a break; switch (Ligne[foundLineIdx]._direction) { - case 1: + case DIR_UP: --NVPY; break; - case 2: + case DIR_UP_RIGHT: --NVPY; ++NVPX; break; - case 3: + case DIR_RIGHT: ++NVPX; break; - case 4: + case DIR_DOWN_RIGHT: ++NVPY; ++NVPX; break; - case 5: + case DIR_DOWN: ++NVPY; break; - case 6: + case DIR_DOWN_LEFT: ++NVPY; --NVPX; break; - case 7: + case DIR_LEFT: --NVPX; break; - case 8: + case DIR_UP_LEFT: --NVPY; --NVPX; break; @@ -1158,7 +1158,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v120 = 0; int v115 = 0; int v114 = 0; - int v113 = 0; + Directions newDir = DIR_NONE; int v111 = 0; if (destY <= 24) clipDestY = 25; @@ -1356,22 +1356,22 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { v115 = v141[1]; v111 = v131[1]; - v113 = 1; + newDir = DIR_UP; v114 = v136[1]; } else if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { v115 = v141[5]; v111 = v131[5]; - v113 = 5; + newDir = DIR_DOWN; v114 = v136[5]; } else if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { v115 = v141[3]; v111 = v131[3]; - v113 = 3; + newDir = DIR_RIGHT; v114 = v136[3]; } else if (v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { v115 = v141[7]; v111 = v131[7]; - v113 = 7; + newDir = DIR_LEFT; v114 = v136[7]; } @@ -1385,14 +1385,14 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v114 = NV_LIGNEOFS; v112 = NV_POSI; } else { - if (v113 == 1) { + if (newDir == DIR_UP) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, &super_parcours[0], 4); if (v58 == -1) { super_parcours[v112] = -1; super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; + super_parcours[v112 + 2] = DIR_NONE; super_parcours[v112 + 3] = -1; return &super_parcours[0]; } @@ -1402,12 +1402,12 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } super_parcours[v112] = fromX; super_parcours[v112 + 1] = fromY - deltaY; - super_parcours[v112 + 2] = 1; + super_parcours[v112 + 2] = DIR_UP; super_parcours[v112 + 3] = 0; v112 += 4; } } - if (v113 == 5) { + if (newDir == DIR_DOWN) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { @@ -1415,7 +1415,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v61 == -1) { super_parcours[v112] = -1; super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; + super_parcours[v112 + 2] = DIR_NONE; super_parcours[v112 + 3] = -1; return &super_parcours[0]; } @@ -1425,19 +1425,19 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } super_parcours[v112] = fromX; super_parcours[v112 + 1] = deltaY + fromY; - super_parcours[v112 + 2] = 5; + super_parcours[v112 + 2] = DIR_DOWN; super_parcours[v112 + 3] = 0; v112 += 4; } } - if (v113 == 7) { + if (newDir == DIR_LEFT) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0], 4); if (v64 == -1) { super_parcours[v112] = -1; super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; + super_parcours[v112 + 2] = DIR_NONE; super_parcours[v112 + 3] = -1; return &super_parcours[0]; } @@ -1447,19 +1447,19 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } super_parcours[v112] = fromX - deltaX; super_parcours[v112 + 1] = fromY; - super_parcours[v112 + 2] = 7; + super_parcours[v112 + 2] = DIR_LEFT; super_parcours[v112 + 3] = 0; v112 += 4; } } - if (v113 == 3) { + if (newDir == DIR_RIGHT) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0], 4); if (v67 == -1) { super_parcours[v112] = -1; super_parcours[v112 + 1] = -1; - super_parcours[v112 + 2] = -1; + super_parcours[v112 + 2] = DIR_NONE; super_parcours[v112 + 3] = -1; return &super_parcours[0]; } @@ -1469,7 +1469,7 @@ int16 *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } super_parcours[v112] = deltaX + fromX; super_parcours[v112 + 1] = fromY; - super_parcours[v112 + 2] = 3; + super_parcours[v112 + 2] = DIR_RIGHT; super_parcours[v112 + 3] = 0; v112 += 4; } @@ -1637,7 +1637,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int v55; int v58; int v66; - int newDirection; + Directions newDirection; int v92; int v93; int v94; @@ -1689,30 +1689,30 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int foundLineIdx = a5; if (checkCollisionLine(fromX, fromY, &foundDataIdx, &foundLineIdx, 0, _linesNumb)) { switch (Ligne[foundLineIdx]._direction) { - case 1: + case DIR_UP: curY -= 2; break; - case 2: + case DIR_UP_RIGHT: curY -= 2; curX += 2; break; - case 3: + case DIR_RIGHT: curX += 2; break; - case 4: + case DIR_DOWN_RIGHT: curY += 2; curX += 2; - case 5: + case DIR_DOWN: curY += 2; break; - case 6: + case DIR_DOWN_LEFT: curY += 2; curX -= 2; break; - case 7: + case DIR_LEFT: curX -= 2; break; - case 8: + case DIR_UP_LEFT: curY -= 2; curX -= 2; break; @@ -1772,19 +1772,19 @@ LABEL_150: v99 = -v99; v13 = (int16)v101 / 1000; v94 = (int16)v99 / 1000; - newDirection = -1; + newDirection = DIR_NONE; if (v94 == -1 && (v101 >= 0 && v101 <= 150)) - newDirection = 1; + newDirection = DIR_UP; if (v13 == 1 && (v99 >= -1 && v99 <= 150)) - newDirection = 3; + newDirection = DIR_RIGHT; if (v94 == 1 && (v101 >= -150 && v101 <= 150)) - newDirection = 5; + newDirection = DIR_DOWN; if (v13 == -1 && (v99 >= -150 && v99 <= 150)) - newDirection = 7; + newDirection = DIR_LEFT; if (v94 == -1 && (v101 >= -150 && v101 <= 0)) - newDirection = 1; + newDirection = DIR_UP; - if (newDirection == -1 && !checkSmoothMove(curX, v109, destX, destY) && !makeSmoothMove(curX, v109, destX, destY)) + if (newDirection == DIR_NONE && !checkSmoothMove(curX, v109, destX, destY) && !makeSmoothMove(curX, v109, destX, destY)) break; LABEL_72: v19 = abs(v111 - destX); @@ -1809,72 +1809,72 @@ LABEL_72: v104 = 1000 * v111 / 1000; v103 = v105 / 1000; if (!(v102 / 1000) && v96 == -1) - newDirection = 1; + newDirection = DIR_UP; if (v22 == 1) { if (v96 == -1) - newDirection = 2; + newDirection = DIR_UP_RIGHT; if (!v96) - newDirection = 3; + newDirection = DIR_RIGHT; if (v96 == 1) - newDirection = 4; + newDirection = DIR_DOWN_RIGHT; } if (!v22 && v96 == 1) - newDirection = 5; + newDirection = DIR_DOWN; if ((v22 != -1) && (v96 == -1)) { if (v102 >= 0 && v102 < 510) - newDirection = 1; + newDirection = DIR_UP; else if (v102 >= 510 && v102 <= 1000) - newDirection = 2; + newDirection = DIR_UP_RIGHT; } else { if (v96 == 1) - newDirection = 6; + newDirection = DIR_DOWN_LEFT; else if (!v96) - newDirection = 7; + newDirection = DIR_LEFT; else if (v96 == -1) { if (v102 >= 0 && v102 < 510) - newDirection = 1; + newDirection = DIR_UP; else if (v102 >= 510 && v102 <= 1000) - newDirection = 2; + newDirection = DIR_UP_RIGHT; else - newDirection = 8; + newDirection = DIR_UP_LEFT; } } if (v22 == 1) { if (v100 >= -1 && v100 <= 510) - newDirection = 2; + newDirection = DIR_UP_RIGHT; if (v100 >= -510 && v100 <= 0) - newDirection = 3; + newDirection = DIR_RIGHT; if (v100 >= 0 && v100 <= 510) - newDirection = 3; + newDirection = DIR_RIGHT; if (v100 >= 510 && v100 <= 1000) - newDirection = 4; + newDirection = DIR_DOWN_RIGHT; } if (v96 == 1) { if (v102 >= 510 && v102 <= 1000) - newDirection = 4; + newDirection = DIR_DOWN_RIGHT; if (v102 >= 0 && v102 <= 510) - newDirection = 5; + newDirection = DIR_DOWN; // CHECKME: The two conditions on v102 are not compatible! if (v102 >= -1 && v102 <= -510) - newDirection = 6; + newDirection = DIR_DOWN_LEFT; if (v102 >= -510 && v102 <= 0) - newDirection = 5; + newDirection = DIR_DOWN; } if (v22 == -1) { if (v100 >= 510 && v100 <= 1000) - newDirection = 6; + newDirection = DIR_DOWN_LEFT; if (v100 >= 0 && v100 <= 510) - newDirection = 7; + newDirection = DIR_LEFT; if (v100 >= -1000 && v100 <= -510) - newDirection = 8; + newDirection = DIR_UP_LEFT; if (v100 >= -510 && v100 <= 0) - newDirection = 7; + newDirection = DIR_LEFT; } if (v96 == -1) { if (v102 >= -1000 && v102 <= -510) - newDirection = 8; + newDirection = DIR_UP_LEFT; if (v102 >= -510 && v102 <= 0) - newDirection = 1; + newDirection = DIR_UP; } v23 = 0; if (v108 + 1 <= 0) @@ -2610,7 +2610,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _smoothMoveDirection = 6; + _smoothMoveDirection = DIR_DOWN_LEFT; return false; } } else if (fromX < destX && destY > fromY) { @@ -2644,7 +2644,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _smoothMoveDirection = 4; + _smoothMoveDirection = DIR_DOWN_RIGHT; return false; } } else if (fromX > destX && destY < fromY) { @@ -2671,7 +2671,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _smoothMoveDirection = 8; + _smoothMoveDirection = DIR_UP_LEFT; return false; } } else if (fromX < destX && destY < fromY) { @@ -2699,7 +2699,7 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { if (stepCount > 5) { _smoothRoute[smoothIdx]._posX = -1; _smoothRoute[smoothIdx]._posY = -1; - _smoothMoveDirection = 2; + _smoothMoveDirection = DIR_UP_RIGHT; return false; } } @@ -2830,9 +2830,9 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, *a3 = 1; int posX = lineData[2 * (lineDataEndIdx - 1)]; int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; - if (Ligne[idx].field6 == 5 || Ligne[idx].field6 == 1) + if (Ligne[idx].field6 == DIR_DOWN || Ligne[idx].field6 == DIR_UP) posY += 2; - if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7) + if (Ligne[idx].field6 == DIR_RIGHT || Ligne[idx].field8 == 7) posX += 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2844,9 +2844,9 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, *a3 = 2; int posX = lineData[0]; int posY = lineData[1]; - if (Ligne[idx].field6 == 5 || Ligne[idx].field6 == 1) + if (Ligne[idx].field6 == DIR_DOWN || Ligne[idx].field6 == DIR_UP) posY -= 2; - if (Ligne[idx].field6 == 3 || Ligne[idx].field8 == 7) + if (Ligne[idx].field6 == DIR_RIGHT || Ligne[idx].field8 == 7) posX -= 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -3134,8 +3134,8 @@ void LinesManager::clearAll() { for (int idx = 0; idx < MAX_LINES; ++idx) { Ligne[idx]._lineDataEndIdx = 0; - Ligne[idx]._direction = 0; - Ligne[idx].field6 = 0; + Ligne[idx]._direction = DIR_NONE; + Ligne[idx].field6 = DIR_NONE; Ligne[idx].field8 = 0; Ligne[idx]._lineData = (int16 *)g_PTRNUL; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 3d064a56ca..8f02a9cb60 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -23,6 +23,8 @@ #ifndef HOPKINS_LINES_H #define HOPKINS_LINES_H +#include "hopkins/globals.h" + #include "common/scummsys.h" #include "common/str.h" @@ -38,8 +40,8 @@ struct LigneZoneItem { struct LigneItem { int _lineDataEndIdx; - int _direction; - int field6; + Directions _direction; + Directions field6; int field8; int16 *_lineData; }; @@ -94,7 +96,7 @@ private: int NV_POSI; int NVPX; int NVPY; - int _smoothMoveDirection; + Directions _smoothMoveDirection; int16 super_parcours[32002]; byte *BUFFERTAPE; int16 *essai0; @@ -143,7 +145,7 @@ public: int checkInventoryHotspots(int posX, int posY); void addZoneLine(int idx, int a2, int a3, int a4, int a5, int bobZoneIdx); void loadLines(const Common::String &file); - void addLine(int idx, int direction, int a3, int a4, int a5, int a6); + void addLine(int idx, Directions direction, int a3, int a4, int a5, int a6); void initRoute(); int16 *cityMapCarRoute(int x1, int y1, int x2, int y2); void clearAllZones(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7b7ffc2aef..7c39d271c4 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1305,7 +1305,7 @@ void ObjectsManager::GOHOME() { _oldCharacterPosY = newPosY; } else { setSpriteIndex(0, _vm->_globals._oldDirection + 59); - _vm->_globals._actionDirection = 0; + _vm->_globals._actionDirection = DIR_NONE; int zoneId; if (_vm->_globals.GOACTION) zoneId = _vm->_globals._saveData->_data[svField2]; @@ -1530,7 +1530,7 @@ void ObjectsManager::GOHOME() { else zoneId = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); - _vm->_globals._actionDirection = 0; + _vm->_globals._actionDirection = DIR_NONE; _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); @@ -1909,7 +1909,7 @@ void ObjectsManager::handleLeftButton() { if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) { _vm->_linesManager._route = (int16 *)g_PTRNUL; setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); - _vm->_globals._actionDirection = 0; + _vm->_globals._actionDirection = DIR_NONE; _vm->_linesManager._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); @@ -3117,10 +3117,10 @@ void ObjectsManager::INILINK(const Common::String &file) { int lineDataIdx = 0; int curLineIdx = 0; _vm->_linesManager.resetLinesNumb(); - int curDirection; + Directions curDirection; do { - curDirection = (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); - if (curDirection != -1) { + curDirection = (Directions)(int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); + if (curDirection != DIR_NONE) { _vm->_linesManager.addLine( curLineIdx, curDirection, @@ -3131,7 +3131,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } lineDataIdx += 5; ++curLineIdx; - } while (curDirection != -1); + } while (curDirection != DIR_NONE); _vm->_linesManager.initRoute(); } } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 2d4f3e30ba..80383aaf6e 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -277,172 +277,172 @@ int ScriptManager::handleOpcode(byte *dataP) { switch (specialOpcode) { case 1: case 14: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(4); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(4); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(4); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(4); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(4); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(4); break; case 2: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(7); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(7); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(7); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(7); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(7); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(7); - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(8); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(8); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(8); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(8); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(8); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(8); break; case 19: case 4: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(1); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(1); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(1); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(1); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(1); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(1); break; case 5: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(5); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(5); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(5); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(5); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(5); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(5); - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(6); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(6); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(6); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(6); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(6); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(6); break; case 17: case 7: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(2); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(2); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(2); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(2); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(2); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(2); break; case 18: case 8: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(3); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(3); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(3); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(3); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(3); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(3); break; case 9: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(5); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(5); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(5); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(5); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(5); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(5); break; case 10: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(6); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(6); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(6); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(6); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(6); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(6); break; case 15: case 11: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(7); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(7); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(7); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(7); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(7); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(7); break; case 16: case 12: - if (_vm->_globals._actionDirection == 1) + if (_vm->_globals._actionDirection == DIR_UP) _vm->_objectsManager.doActionBack(8); - if (_vm->_globals._actionDirection == 3) + if (_vm->_globals._actionDirection == DIR_RIGHT) _vm->_objectsManager.doActionRight(8); - if (_vm->_globals._actionDirection == 2) + if (_vm->_globals._actionDirection == DIR_UP_RIGHT) _vm->_objectsManager.doActionDiagRight(8); - if (_vm->_globals._actionDirection == 5) + if (_vm->_globals._actionDirection == DIR_DOWN) _vm->_objectsManager.doActionFront(8); - if (_vm->_globals._actionDirection == 8) + if (_vm->_globals._actionDirection == DIR_UP_LEFT) _vm->_objectsManager.doActionDiagLeft(8); - if (_vm->_globals._actionDirection == 7) + if (_vm->_globals._actionDirection == DIR_LEFT) _vm->_objectsManager.doActionLeft(8); break; } -- cgit v1.2.3 From 7428af9a4c612b59cee7f55d867a00464b3dae64 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Feb 2013 01:37:21 +0100 Subject: HOPKINS: Replace casted READ_LE_UINT16 by the equivalent macro to improve readability --- engines/hopkins/anim.cpp | 8 +-- engines/hopkins/font.cpp | 2 +- engines/hopkins/globals.cpp | 8 +-- engines/hopkins/graphics.cpp | 8 +-- engines/hopkins/hopkins.h | 2 + engines/hopkins/lines.cpp | 12 ++--- engines/hopkins/objects.cpp | 92 ++++++++++++++++----------------- engines/hopkins/script.cpp | 66 ++++++++++++------------ engines/hopkins/talk.cpp | 118 +++++++++++++++++++++---------------------- 9 files changed, 159 insertions(+), 157 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 2186967922..38f02c3fda 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -532,10 +532,10 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) { byte *ofsData = _vm->_fileManager.loadFile(ofsFilename); byte *curOfsData = ofsData; for (int objIdx = 0; objIdx < _vm->_globals.Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) { - int x1 = (int16)READ_LE_UINT16(curOfsData); - int y1 = (int16)READ_LE_UINT16(curOfsData + 2); - int x2 = (int16)READ_LE_UINT16(curOfsData + 4); - int y2 = (int16)READ_LE_UINT16(curOfsData + 6); + int x1 = READ_LE_INT16(curOfsData); + int y1 = READ_LE_INT16(curOfsData + 2); + int x2 = READ_LE_INT16(curOfsData + 4); + int y2 = READ_LE_INT16(curOfsData + 6); _vm->_objectsManager.setOffsetXY(_vm->_globals.Bank[idx]._data, objIdx, x1, y1, 0); if (_vm->_globals.Bank[idx]._fileHeader == 2) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 3343c2fd10..844bcb930d 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -210,7 +210,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _tempText = _vm->_globals.allocMemory(110); Common::fill(&_tempText[0], &_tempText[110], 0); memcpy(_tempText, _vm->_globals.BUF_ZONE + _index[messageId], 96); - WRITE_LE_UINT16((uint16 *)_tempText + 48, (int16)READ_LE_UINT16(_vm->_globals.BUF_ZONE + _index[messageId] + 96)); + WRITE_LE_UINT16((uint16 *)_tempText + 48, READ_LE_INT16(_vm->_globals.BUF_ZONE + _index[messageId] + 96)); } byte *curTempTextPtr = _tempText; for (int i = 0; i < bufSize; i++) { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index ac903ddd00..633f222092 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -412,10 +412,10 @@ void Globals::loadCache(const Common::String &file) { CACHE_BANQUE[1] = spriteData; int curBufIdx = 60; for (int i = 0; i <= 21; i++) { - Cache[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx); - Cache[i]._x = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 1); - Cache[i]._y = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 2); - Cache[i].field14 = (int16)READ_LE_UINT16((uint16 *)ptr + curBufIdx + 4); + Cache[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + curBufIdx); + Cache[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1); + Cache[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2); + Cache[i].field14 = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4); if (spriteData == g_PTRNUL) { Cache[i]._useCount = 0; } else { diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 61af620769..0e2df5e04a 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1246,9 +1246,9 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp spriteStartP += READ_LE_UINT32(spriteStartP) + 16; const byte *spriteSizeP = spriteStartP + 4; - int spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); + int spriteWidth = READ_LE_INT16(spriteSizeP); spriteSizeP += 2; - int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); + int spriteHeight2 = READ_LE_INT16(spriteSizeP); int spriteHeight1 = spriteHeight2; const byte *spritePixelsP = spriteSizeP + 10; _posXClipped = 0; @@ -1639,9 +1639,9 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, int spriteWidth = 0; int spriteHeight = 0; const byte *spriteSizeP = spriteDataP + 4; - spriteWidth = (int16)READ_LE_UINT16(spriteSizeP); + spriteWidth = READ_LE_INT16(spriteSizeP); spriteSizeP += 2; - spriteHeight = (int16)READ_LE_UINT16(spriteSizeP); + spriteHeight = READ_LE_INT16(spriteSizeP); const byte *spritePixelsP = spriteSizeP + 10; byte *destP = surface + xp + _lineNbr2 * yp; _width = spriteWidth; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index fe14b23a9a..0fd683375f 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -82,6 +82,8 @@ enum { */ #define MKTAG24(a0,a1,a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16))) +#define READ_LE_INT16(x) (int16) READ_LE_UINT16(x) + struct HopkinsGameDescription; class HopkinsEngine : public Engine { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c4441e0da7..4cb2dd3d09 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -90,13 +90,13 @@ void LinesManager::loadLines(const Common::String &file) { _linesNumb = 0; _lastLine = 0; byte *ptr = _vm->_fileManager.loadFile(file); - for (int idx = 0; (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { + for (int idx = 0; READ_LE_INT16((uint16 *)ptr + (idx * 5)) != -1; idx++) { addLine(idx, - (Directions)(int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5)), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 1), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 2), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 3), - (int16)READ_LE_UINT16((uint16 *)ptr + (idx * 5) + 4)); + (Directions)READ_LE_INT16((uint16 *)ptr + (idx * 5)), + READ_LE_INT16((uint16 *)ptr + (idx * 5) + 1), + READ_LE_INT16((uint16 *)ptr + (idx * 5) + 2), + READ_LE_INT16((uint16 *)ptr + (idx * 5) + 3), + READ_LE_INT16((uint16 *)ptr + (idx * 5) + 4)); } initRoute(); _vm->_globals.freeMemory(ptr); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7c39d271c4..ce2fae8f79 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -193,9 +193,9 @@ int ObjectsManager::getOffsetX(const byte *spriteData, int spriteIndex, bool isS v3 += READ_LE_UINT32(v3) + 16; const byte *v5 = v3 + 8; - int result = (int16)READ_LE_UINT16(v5); + int result = READ_LE_INT16(v5); if (isSize) - result = (int16)READ_LE_UINT16(v5 + 4); + result = READ_LE_INT16(v5 + 4); return result; } @@ -206,9 +206,9 @@ int ObjectsManager::getOffsetY(const byte *spriteData, int spriteIndex, bool isS v3 += READ_LE_UINT32(v3) + 16; const byte *v5 = v3 + 10; - int result = (int16)READ_LE_UINT16(v5); + int result = READ_LE_INT16(v5); if (isSize) - result = (int16)READ_LE_UINT16(v5 + 4); + result = READ_LE_INT16(v5 + 4); return result; } @@ -221,7 +221,7 @@ int ObjectsManager::getWidth(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)READ_LE_UINT16(rectP + 4); + return READ_LE_INT16(rectP + 4); } /** @@ -232,7 +232,7 @@ int ObjectsManager::getHeight(const byte *objectData, int idx) { for (int i = idx; i; --i) rectP += READ_LE_UINT32(rectP) + 16; - return (int16)READ_LE_UINT16(rectP + 6); + return READ_LE_INT16(rectP + 6); } void ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objIndex) { @@ -242,7 +242,7 @@ void ObjectsManager::sprite_alone(const byte *objectData, byte *sprite, int objI } objP += 4; - int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); + int result = READ_LE_INT16(objP) * READ_LE_INT16(objP + 2); memcpy(sprite + 3, objP - 4, result + 16); } @@ -254,7 +254,7 @@ void ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, in } objP += 4; - int result = (int16)READ_LE_UINT16(objP) * (int16)READ_LE_UINT16(objP + 2); + int result = READ_LE_INT16(objP) * READ_LE_INT16(objP + 2); memcpy(sprite, objP + 12, result); } @@ -582,17 +582,17 @@ void ObjectsManager::BOB_VISU(int idx) { resetBob(idx); const byte *data = _vm->_globals.Bqe_Anim[idx]._data; - int bankIdx = (int16)READ_LE_UINT16(data); + int bankIdx = READ_LE_INT16(data); if (!bankIdx) return; if ((!_vm->_globals.Bank[bankIdx]._loadedFl) || (!READ_LE_UINT16(data + 24))) return; - int16 v9 = (int16)READ_LE_UINT16(data + 2); - int16 v8 = (int16)READ_LE_UINT16(data + 4); - int16 offsetY = (int16)READ_LE_UINT16(data + 6); - int16 v6 = (int16)READ_LE_UINT16(data + 8); + int16 v9 = READ_LE_INT16(data + 2); + int16 v8 = READ_LE_INT16(data + 4); + int16 offsetY = READ_LE_INT16(data + 6); + int16 v6 = READ_LE_INT16(data + 8); if (!v9) v9 = 1; @@ -949,15 +949,15 @@ void ObjectsManager::displayBobAnim() { byte *dataPtr = _bob[idx]._animData + 20; int dataIdx = _bob[idx]._animDataIdx; - _bob[idx]._xp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx); + _bob[idx]._xp = READ_LE_INT16(dataPtr + 2 * dataIdx); if (_vm->_globals._lockedAnims[idx]._enableFl) _bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if ( PERSO_ON && idx > 20 ) _bob[idx]._xp += _vm->_eventsManager._startPos.x; - _bob[idx]._yp = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 2); - _bob[idx].field12 = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 4); - _bob[idx]._zoomFactor = (int16)READ_LE_UINT16(dataPtr + 2 * dataIdx + 6); + _bob[idx]._yp = READ_LE_INT16(dataPtr + 2 * dataIdx + 2); + _bob[idx].field12 = READ_LE_INT16(dataPtr + 2 * dataIdx + 4); + _bob[idx]._zoomFactor = READ_LE_INT16(dataPtr + 2 * dataIdx + 6); _bob[idx]._frameIndex = dataPtr[2 * dataIdx + 8]; _bob[idx]._flipFl = (dataPtr[2 * dataIdx + 9] != 0); _bob[idx]._animDataIdx += 5; @@ -983,16 +983,16 @@ void ObjectsManager::displayBobAnim() { } else { _bob[idx]._animDataIdx = 0; byte *v21 = _bob[idx]._animData + 20; - _bob[idx]._xp = (int16)READ_LE_UINT16(v21); + _bob[idx]._xp = READ_LE_INT16(v21); if (_vm->_globals._lockedAnims[idx]._enableFl) _bob[idx]._xp = _vm->_globals._lockedAnims[idx]._posX; if (PERSO_ON && idx > 20) _bob[idx]._xp += _vm->_eventsManager._startPos.x; - _bob[idx]._yp = (int16)READ_LE_UINT16(v21 + 2); - _bob[idx].field12 = (int16)READ_LE_UINT16(v21 + 4); - _bob[idx]._zoomFactor = (int16)READ_LE_UINT16(v21 + 6); + _bob[idx]._yp = READ_LE_INT16(v21 + 2); + _bob[idx].field12 = READ_LE_INT16(v21 + 4); + _bob[idx]._zoomFactor = READ_LE_INT16(v21 + 6); _bob[idx]._frameIndex = v21[8]; _bob[idx]._flipFl = (v21[9] != 0); _bob[idx]._animDataIdx += 5; @@ -1684,7 +1684,7 @@ void ObjectsManager::loadZone(const Common::String &file) { int zoneLineIdx = 0; int bobZoneIdx; do { - bobZoneIdx = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); + bobZoneIdx = READ_LE_INT16((uint16 *)ptr + bufId); if (bobZoneIdx != -1) { _vm->_linesManager.addZoneLine( zoneLineIdx, @@ -1700,9 +1700,9 @@ void ObjectsManager::loadZone(const Common::String &file) { } while (bobZoneIdx != -1); for (int i = 1; i <= 100; i++) { - _vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16((uint16 *)ptr + bufId); - _vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 1); - _vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16((uint16 *)ptr + bufId + 2); + _vm->_linesManager.ZONEP[i]._destX = READ_LE_INT16((uint16 *)ptr + bufId); + _vm->_linesManager.ZONEP[i]._destY = READ_LE_INT16((uint16 *)ptr + bufId + 1); + _vm->_linesManager.ZONEP[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + bufId + 2); bufId += 3; } @@ -2710,8 +2710,8 @@ void ObjectsManager::BOB_VIVANT(int idx) { if (!READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 4)) return; - int xp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos); - int yp = (int16)READ_LE_UINT16(_vm->_talkManager._characterAnim + startPos + 2); + int xp = READ_LE_INT16(_vm->_talkManager._characterAnim + startPos); + int yp = READ_LE_INT16(_vm->_talkManager._characterAnim + startPos + 2); int spriteIndex = _vm->_talkManager._characterAnim[startPos + 8]; _vm->_graphicsManager.fastDisplay(_vm->_talkManager._characterSprite, xp, yp, spriteIndex); @@ -3069,7 +3069,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } if (!OBSSEUL) { for (int idx = 0; idx < 500; ++idx) - _vm->_globals._spriteSize[idx] = (int16)READ_LE_UINT16((uint16 *)ptr + idx); + _vm->_globals._spriteSize[idx] = READ_LE_INT16((uint16 *)ptr + idx); _vm->_globals.resetCache(); @@ -3086,11 +3086,11 @@ void ObjectsManager::INILINK(const Common::String &file) { int curDataCacheId = 60; byte *curDataPtr = ptr + 1000; for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) { - int curSpriteId = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId); + int curSpriteId = READ_LE_INT16(curDataPtr + 2 * curDataCacheId); _vm->_globals.Cache[cacheIdx]._spriteIndex = curSpriteId; - _vm->_globals.Cache[cacheIdx]._x = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 2); - _vm->_globals.Cache[cacheIdx]._y = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 4); - _vm->_globals.Cache[cacheIdx].field14 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataCacheId + 8); + _vm->_globals.Cache[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2); + _vm->_globals.Cache[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4); + _vm->_globals.Cache[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8); if (!_vm->_globals.CACHE_BANQUE[1]) { _vm->_globals.Cache[cacheIdx]._useCount = 0; @@ -3119,15 +3119,15 @@ void ObjectsManager::INILINK(const Common::String &file) { _vm->_linesManager.resetLinesNumb(); Directions curDirection; do { - curDirection = (Directions)(int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx); + curDirection = (Directions)READ_LE_INT16(curDataPtr + 2 * lineDataIdx); if (curDirection != DIR_NONE) { _vm->_linesManager.addLine( curLineIdx, curDirection, - (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 2), - (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 4), - (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 6), - (int16)READ_LE_UINT16(curDataPtr + 2 * lineDataIdx + 8)); + READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 2), + READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 4), + READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 6), + READ_LE_INT16(curDataPtr + 2 * lineDataIdx + 8)); } lineDataIdx += 5; ++curLineIdx; @@ -3161,14 +3161,14 @@ void ObjectsManager::INILINK(const Common::String &file) { int curLineIdx = 0; int v28; do { - v28 = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); + v28 = READ_LE_INT16(curDataPtr + 2 * curDataIdx); if (v28 != -1) { _vm->_linesManager.addZoneLine( curLineIdx, - (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2), - (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4), - (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 6), - (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 8), + READ_LE_INT16(curDataPtr + 2 * curDataIdx + 2), + READ_LE_INT16(curDataPtr + 2 * curDataIdx + 4), + READ_LE_INT16(curDataPtr + 2 * curDataIdx + 6), + READ_LE_INT16(curDataPtr + 2 * curDataIdx + 8), v28); _vm->_linesManager.ZONEP[v28]._enabledFl = true; } @@ -3176,9 +3176,9 @@ void ObjectsManager::INILINK(const Common::String &file) { ++curLineIdx; } while (v28 != -1); for (int i = 1; i <= 100; i++) { - _vm->_linesManager.ZONEP[i]._destX = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx); - _vm->_linesManager.ZONEP[i]._destY = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 2); - _vm->_linesManager.ZONEP[i]._spriteIndex = (int16)READ_LE_UINT16(curDataPtr + 2 * curDataIdx + 4); + _vm->_linesManager.ZONEP[i]._destX = READ_LE_INT16(curDataPtr + 2 * curDataIdx); + _vm->_linesManager.ZONEP[i]._destY = READ_LE_INT16(curDataPtr + 2 * curDataIdx + 2); + _vm->_linesManager.ZONEP[i]._spriteIndex = READ_LE_INT16(curDataPtr + 2 * curDataIdx + 4); curDataIdx += 3; } @@ -3198,7 +3198,7 @@ void ObjectsManager::INILINK(const Common::String &file) { } int dep = 1010; for (int i = 1; i <= 100; i++) { - _vm->_linesManager.ZONEP[i].field12 = (int16)READ_LE_UINT16(v22 + dep); + _vm->_linesManager.ZONEP[i].field12 = READ_LE_INT16(v22 + dep); dep += 2; } _vm->_linesManager.CARRE_ZONE(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 80383aaf6e..03d0718501 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -54,7 +54,7 @@ int ScriptManager::handleOpcode(byte *dataP) { switch (signature24) { case MKTAG24('T', 'X', 'T'): { vbobFrameIndex = dataP[6]; - int mesgId = (int16)READ_LE_UINT16(dataP + 13); + int mesgId = READ_LE_INT16(dataP + 13); opcodeType = 1; if (!TRAVAILOBJET) { if (_vm->_globals._saveData->_data[svField356] == 1) { @@ -133,8 +133,8 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_soundManager._soundFl); } if (!_vm->_soundManager._textOffFl) { - int textPosX = (int16)READ_LE_UINT16(dataP + 9); - int textPosY = (int16)READ_LE_UINT16(dataP + 11); + int textPosX = READ_LE_INT16(dataP + 9); + int textPosY = READ_LE_INT16(dataP + 11); _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); @@ -149,7 +149,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(635, 4); } else { - int textPosX = (int16)READ_LE_UINT16(dataP + 9); + int textPosX = READ_LE_INT16(dataP + 9); if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl) _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * textPosX, 60, 6, dataP[7], 253); else if (_vm->_globals._language == LANG_EN && !_vm->_soundManager._textOffFl) @@ -172,10 +172,10 @@ int ScriptManager::handleOpcode(byte *dataP) { int vbobIdx = dataP[5]; vbobFrameIndex = dataP[6]; int v4 = dataP[7]; - int vbobPosX = (int16)READ_LE_UINT16(dataP + 8); - int vbobPosY = (int16)READ_LE_UINT16(dataP + 10); + int vbobPosX = READ_LE_INT16(dataP + 8); + int vbobPosY = READ_LE_INT16(dataP + 10); if (vbobIdx == 52) { - _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, vbobPosX, (int16)READ_LE_UINT16(dataP + 10), vbobFrameIndex); + _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, vbobPosX, READ_LE_INT16(dataP + 10), vbobFrameIndex); } else if (vbobIdx == 51) { _vm->_objectsManager.BOB_VIVANT(vbobFrameIndex); } else if (vbobIdx != 50) { @@ -198,8 +198,8 @@ int ScriptManager::handleOpcode(byte *dataP) { case MKTAG24('S', 'T', 'P'): if (!_vm->_objectsManager._disableFl) { _vm->_objectsManager._twoCharactersFl = false; - _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); - _vm->_objectsManager._characterPos.y = (int16)READ_LE_UINT16(dataP + 8); + _vm->_objectsManager._characterPos.x = READ_LE_INT16(dataP + 6); + _vm->_objectsManager._characterPos.y = READ_LE_INT16(dataP + 8); _vm->_objectsManager._startSpriteIndex = dataP[5]; if (_vm->_objectsManager._changeHeadFl) { if (_vm->_globals._saveData->_data[svField354] == 1 @@ -266,11 +266,11 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case MKTAG24('B', 'O', 'F'): if (!_vm->_objectsManager._disableFl) - _vm->_objectsManager.VBOB_OFF((int16)READ_LE_UINT16(dataP + 5)); + _vm->_objectsManager.VBOB_OFF(READ_LE_INT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('P', 'E', 'R'): { - int specialOpcode = (int16)READ_LE_UINT16(dataP + 5); + int specialOpcode = READ_LE_INT16(dataP + 5); if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) { vbobFrameIndex = 0; @@ -468,36 +468,36 @@ int ScriptManager::handleOpcode(byte *dataP) { } case MKTAG24('O', 'B', 'P'): opcodeType = 1; - _vm->_objectsManager.addObject((int16)READ_LE_UINT16(dataP + 5)); + _vm->_objectsManager.addObject(READ_LE_INT16(dataP + 5)); break; case MKTAG24('O', 'B', 'M'): opcodeType = 1; - _vm->_objectsManager.removeObject((int16)READ_LE_UINT16(dataP + 5)); + _vm->_objectsManager.removeObject(READ_LE_INT16(dataP + 5)); break; case MKTAG24('G', 'O', 'T'): opcodeType = 2; break; case MKTAG24('Z', 'O', 'N'): - _vm->_linesManager.enableZone((int16)READ_LE_UINT16(dataP + 5)); + _vm->_linesManager.enableZone(READ_LE_INT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('Z', 'O', 'F'): - _vm->_linesManager.disableZone((int16)READ_LE_UINT16(dataP + 5)); + _vm->_linesManager.disableZone(READ_LE_INT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('E', 'X', 'I'): opcodeType = 5; break; case MKTAG24('S', 'O', 'R'): - _vm->_globals._exitId = (int16)READ_LE_UINT16(dataP + 5); + _vm->_globals._exitId = READ_LE_INT16(dataP + 5); opcodeType = 5; break; case MKTAG24('B', 'C', 'A'): - _vm->_globals.B_CACHE_OFF((int16)READ_LE_UINT16(dataP + 5)); + _vm->_globals.B_CACHE_OFF(READ_LE_INT16(dataP + 5)); opcodeType = 1; break; case MKTAG24('A', 'N', 'I'): { - int animId = (int16)READ_LE_UINT16(dataP + 5); + int animId = READ_LE_INT16(dataP + 5); if (animId <= 100) _vm->_objectsManager.setBobAnimation(animId); else @@ -506,7 +506,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; } case MKTAG24('S', 'P', 'E'): - switch ((int16)READ_LE_UINT16(dataP + 5)) { + switch (READ_LE_INT16(dataP + 5)) { case 6: _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_ONE(20, 0, 14, 4); @@ -2373,34 +2373,34 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case MKTAG24('V', 'A', 'L'): { opcodeType = 1; - int idx = (int16)READ_LE_UINT16(dataP + 5); + int idx = READ_LE_INT16(dataP + 5); assert(idx >= 0 && idx < 2050); _vm->_globals._saveData->_data[idx] = dataP[7]; break; } case MKTAG24('A', 'D', 'D'): opcodeType = 1; - _vm->_globals._saveData->_data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; + _vm->_globals._saveData->_data[READ_LE_INT16(dataP + 5)] += dataP[7]; break; case MKTAG24('B', 'O', 'S'): opcodeType = 1; - _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + _vm->_objectsManager.BOB_OFFSET(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7)); break; case MKTAG24('V', 'O', 'N'): - _vm->_objectsManager.enableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + _vm->_objectsManager.enableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7)); opcodeType = 1; break; case MKTAG24('Z', 'C', 'H'): - _vm->_linesManager.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); + _vm->_linesManager.ZONEP[READ_LE_INT16(dataP + 5)].field12 = READ_LE_INT16(dataP + 7); opcodeType = 1; break; case MKTAG24('J', 'U', 'M'): - _vm->_objectsManager._jumpZone = (int16)READ_LE_UINT16(dataP + 5); - _vm->_objectsManager._jumpVerb = (int16)READ_LE_UINT16(dataP + 7); + _vm->_objectsManager._jumpZone = READ_LE_INT16(dataP + 5); + _vm->_objectsManager._jumpVerb = READ_LE_INT16(dataP + 7); opcodeType = 6; break; case MKTAG24('S', 'O', 'U'): { - int soundNum = (int16)READ_LE_UINT16(dataP + 5); + int soundNum = READ_LE_INT16(dataP + 5); Common::String file = Common::String::format("SOUND%d.WAV", soundNum); _vm->_soundManager.playSound(file); @@ -2408,7 +2408,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; } case MKTAG24('V', 'O', 'F'): - _vm->_objectsManager.disableVerb((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); + _vm->_objectsManager.disableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7)); opcodeType = 1; break; case MKTAG24('I', 'I', 'F'): @@ -2424,7 +2424,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int ScriptManager::handleGoto(const byte *dataP) { - return (int16)READ_LE_UINT16(dataP + 5); + return READ_LE_INT16(dataP + 5); } int ScriptManager::handleIf(const byte *dataP, int a2) { @@ -2468,8 +2468,8 @@ int ScriptManager::handleIf(const byte *dataP, int a2) { byte oper = buf[13]; byte oper2 = buf[14]; byte operType = buf[15]; - int saveDataIdx1 = (int16)READ_LE_UINT16(buf + 5); - int compVal1 = (int16)READ_LE_UINT16(buf + 7); + int saveDataIdx1 = READ_LE_INT16(buf + 5); + int compVal1 = READ_LE_INT16(buf + 7); bool check1Fl = false; if ((oper == 1 && _vm->_globals._saveData->_data[saveDataIdx1] == compVal1) || (oper == 2 && _vm->_globals._saveData->_data[saveDataIdx1] != compVal1) || @@ -2481,8 +2481,8 @@ int ScriptManager::handleIf(const byte *dataP, int a2) { bool check2Fl = false; if (operType != 3) { - int saveDataIdx2 = (int16)READ_LE_UINT16(buf + 9); - int compVal2 = (int16)READ_LE_UINT16(buf + 11); + int saveDataIdx2 = READ_LE_INT16(buf + 9); + int compVal2 = READ_LE_INT16(buf + 11); if ((oper2 == 1 && compVal2 == _vm->_globals._saveData->_data[saveDataIdx2]) || (oper2 == 2 && compVal2 != _vm->_globals._saveData->_data[saveDataIdx2]) || (oper2 == 3 && compVal2 >= _vm->_globals._saveData->_data[saveDataIdx2]) || diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 61ea1b6438..f22aa679e1 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -75,8 +75,8 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } else if (_vm->_globals._language == LANG_SP) { _answersFilename = _questionsFilename = "RUEES.TXT"; } - _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); - _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + _dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40); + _paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110; _characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7); if (_characterSprite) { _characterSprite = _vm->_objectsManager.loadSprite(spriteFilename); @@ -182,8 +182,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { break; } - _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); - _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + _dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40); + _paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110; searchCharacterPalette(_paletteBufferIdx, false); _dialogueMesgId2 = _dialogueMesgId1 + 1; _dialogueMesgId3 = _dialogueMesgId1 + 2; @@ -228,17 +228,17 @@ void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const int TalkManager::dialogQuestion(bool animatedFl) { if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; - int curVal = (int16)READ_LE_UINT16(bufPtr); + int curVal = READ_LE_INT16(bufPtr); if (curVal != 0) _vm->_objectsManager.setBobAnimation(curVal); if (curVal != 1) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 1)); + _vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 1)); if (curVal != 2) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 2)); + _vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 2)); if (curVal != 3) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 3)); + _vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 3)); if (curVal != 4) - _vm->_objectsManager.setBobAnimation((int16)READ_LE_UINT16(bufPtr + 4)); + _vm->_objectsManager.setBobAnimation(READ_LE_INT16(bufPtr + 4)); } else { dialogWait(); } @@ -299,23 +299,23 @@ int TalkManager::dialogQuestion(bool animatedFl) { if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; - int curVal = (int16)READ_LE_UINT16(bufPtr); + int curVal = READ_LE_INT16(bufPtr); if (curVal != 0) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 1); + curVal = READ_LE_INT16(bufPtr + 1); if (curVal != 1) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 2); + curVal = READ_LE_INT16(bufPtr + 2); if (curVal != 2) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 3); + curVal = READ_LE_INT16(bufPtr + 3); if (curVal != 3) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 4); + curVal = READ_LE_INT16(bufPtr + 4); if (curVal != 4) _vm->_objectsManager.stopBobAnimation(curVal); } else { @@ -329,21 +329,21 @@ int TalkManager::dialogQuestion(bool animatedFl) { int TalkManager::dialogAnswer(int idx, bool animatedFl) { int charIdx; byte *charBuf; - for (charBuf = _characterBuffer + 110, charIdx = 0; (int16)READ_LE_UINT16(charBuf) != idx; charBuf += 20) { + for (charBuf = _characterBuffer + 110, charIdx = 0; READ_LE_INT16(charBuf) != idx; charBuf += 20) { ++charIdx; - if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < charIdx) + if (READ_LE_INT16((uint16 *)_characterBuffer + 42) < charIdx) return -1; } - int mesgId = (int16)READ_LE_UINT16((uint16 *)charBuf + 1); - int mesgPosX = (int16)READ_LE_UINT16((uint16 *)charBuf + 2); - int mesgPosY = (int16)READ_LE_UINT16((uint16 *)charBuf + 3); - int mesgLength = (int16)READ_LE_UINT16((uint16 *)charBuf + 4); - _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)charBuf + 5); - _dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)charBuf + 6); - _dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)charBuf + 7); - int v6 = (int16)READ_LE_UINT16((uint16 *)charBuf + 8); - int v7 = (int16)READ_LE_UINT16((uint16 *)charBuf + 9); + int mesgId = READ_LE_INT16((uint16 *)charBuf + 1); + int mesgPosX = READ_LE_INT16((uint16 *)charBuf + 2); + int mesgPosY = READ_LE_INT16((uint16 *)charBuf + 3); + int mesgLength = READ_LE_INT16((uint16 *)charBuf + 4); + _dialogueMesgId1 = READ_LE_INT16((uint16 *)charBuf + 5); + _dialogueMesgId2 = READ_LE_INT16((uint16 *)charBuf + 6); + _dialogueMesgId3 = READ_LE_INT16((uint16 *)charBuf + 7); + int v6 = READ_LE_INT16((uint16 *)charBuf + 8); + int v7 = READ_LE_INT16((uint16 *)charBuf + 9); if (v7) _vm->_globals._saveData->_data[svField4] = v7; @@ -352,23 +352,23 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) { v6 = 10; if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; - int curVal = (int16)READ_LE_UINT16(bufPtr); + int curVal = READ_LE_INT16(bufPtr); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 1); + curVal = READ_LE_INT16(bufPtr + 1); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 2); + curVal = READ_LE_INT16(bufPtr + 2); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 3); + curVal = READ_LE_INT16(bufPtr + 3); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 4); + curVal = READ_LE_INT16(bufPtr + 4); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); } else { @@ -402,23 +402,23 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) { _vm->_fontManager.hideText(9); if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; - int curVal = (int16)READ_LE_UINT16(bufPtr); + int curVal = READ_LE_INT16(bufPtr); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 1); + curVal = READ_LE_INT16(bufPtr + 1); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 2); + curVal = READ_LE_INT16(bufPtr + 2); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 3); + curVal = READ_LE_INT16(bufPtr + 3); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); - curVal = (int16)READ_LE_UINT16(bufPtr + 4); + curVal = READ_LE_INT16(bufPtr + 4); if (curVal) _vm->_objectsManager.stopBobAnimation(curVal); } else { @@ -600,10 +600,10 @@ void TalkManager::BOB_VISU_PARLE(int idx) { if (!_vm->_objectsManager._bob[idx].field0) { _vm->_objectsManager.resetBob(idx); byte *v5 = _vm->_globals.Bqe_Anim[idx]._data; - int v4 = (int16)READ_LE_UINT16(v5 + 2); + int v4 = READ_LE_INT16(v5 + 2); if (!v4) v4 = 1; - if ((int16)READ_LE_UINT16(v5 + 24)) { + if (READ_LE_INT16(v5 + 24)) { _vm->_objectsManager._bob[idx]._isSpriteFl = true; _vm->_objectsManager._bob[idx]._zoomFactor = 0; _vm->_objectsManager._bob[idx]._flipFl = false; @@ -636,10 +636,10 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { int idx = 0; int v7; do { - v7 = (int16)READ_LE_UINT16(&_characterAnim[2 * idx + 4]); + v7 = READ_LE_INT16(&_characterAnim[2 * idx + 4]); if (v7 && _vm->_globals._speed != 501) - _vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + (int16)READ_LE_UINT16(&_characterAnim[2 * idx]), - (int16)READ_LE_UINT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]); + _vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager._startPos.x + READ_LE_INT16(&_characterAnim[2 * idx]), + READ_LE_INT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]); idx += 5; } while (_vm->_globals._speed != 501 && v7); } @@ -651,43 +651,43 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { void TalkManager::initCharacterAnim() { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; byte *animPtr = _characterBuffer + 110; - int curVal = (int16)READ_LE_UINT16(bufPtr); + int curVal = READ_LE_INT16(bufPtr); if (curVal) searchCharacterAnim(21, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 1); + curVal = READ_LE_INT16(bufPtr + 1); if (curVal) searchCharacterAnim(22, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 2); + curVal = READ_LE_INT16(bufPtr + 2); if (curVal) searchCharacterAnim(23, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 3); + curVal = READ_LE_INT16(bufPtr + 3); if (curVal) searchCharacterAnim(24, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 4); + curVal = READ_LE_INT16(bufPtr + 4); if (curVal) searchCharacterAnim(25, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 5); + curVal = READ_LE_INT16(bufPtr + 5); if (curVal) searchCharacterAnim(26, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 6); + curVal = READ_LE_INT16(bufPtr + 6); if (curVal) searchCharacterAnim(27, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 7); + curVal = READ_LE_INT16(bufPtr + 7); if (curVal) searchCharacterAnim(28, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 8); + curVal = READ_LE_INT16(bufPtr + 8); if (curVal) searchCharacterAnim(29, animPtr, curVal, _characterSize); - curVal = (int16)READ_LE_UINT16(bufPtr + 9); + curVal = READ_LE_INT16(bufPtr + 9); if (curVal) searchCharacterAnim(30, animPtr, curVal, _characterSize); } @@ -723,11 +723,11 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(animLength + 50); _vm->_globals.Bqe_Anim[idx]._enabledFl = true; memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20); - int v23 = (int16)READ_LE_UINT16(bufPos + bufPerso + 29); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 20, (int16)READ_LE_UINT16(bufPos + bufPerso + 25)); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 22, (int16)READ_LE_UINT16(bufPos + bufPerso + 27)); + int v23 = READ_LE_INT16(bufPos + bufPerso + 29); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25)); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27)); WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 24, v23); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 26, (int16)READ_LE_UINT16(bufPos + bufPerso + 31)); + WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31)); _vm->_globals.Bqe_Anim[idx]._data[28] = bufPerso[bufPos + 33]; _vm->_globals.Bqe_Anim[idx]._data[29] = bufPerso[bufPos + 34]; byte *bqeCurData = _vm->_globals.Bqe_Anim[idx]._data + 20; @@ -737,11 +737,11 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, curBufPerso += 10; if (!v23) break; - v23 = (int16)READ_LE_UINT16(curBufPerso + 4); - WRITE_LE_UINT16(bqeCurData, (int16)READ_LE_UINT16(curBufPerso)); - WRITE_LE_UINT16(bqeCurData + 2, (int16)READ_LE_UINT16(curBufPerso + 2)); + v23 = READ_LE_INT16(curBufPerso + 4); + WRITE_LE_UINT16(bqeCurData, READ_LE_INT16(curBufPerso)); + WRITE_LE_UINT16(bqeCurData + 2, READ_LE_INT16(curBufPerso + 2)); WRITE_LE_UINT16(bqeCurData + 4, v23); - WRITE_LE_UINT16(bqeCurData + 6, (int16)READ_LE_UINT16(curBufPerso + 6)); + WRITE_LE_UINT16(bqeCurData + 6, READ_LE_INT16(curBufPerso + 6)); bqeCurData[8] = curBufPerso[8]; bqeCurData[9] = curBufPerso[9]; } @@ -1004,7 +1004,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { if (!_vm->_graphicsManager._lineNbr) _vm->_graphicsManager._scrollOffset = 0; _vm->_graphicsManager.NB_SCREEN(true); - _paletteBufferIdx = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110; + _paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110; _vm->_graphicsManager.NB_SCREEN(true); _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, true); -- cgit v1.2.3 From 5ca0cc8fcd5d9cb92fff64b3b4071f6d8272ee60 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 16 Feb 2013 14:35:29 +0100 Subject: HOPKINS: Refactor loop structure in PARC_PERS --- engines/hopkins/lines.cpp | 598 +++++++++++++++++++--------------------------- 1 file changed, 250 insertions(+), 348 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 326982d4eb..99a2a422f0 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1555,14 +1555,9 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int v23; int v24; int v33; - int v36; - int v39; - int v40; bool v45; int v54; int v55; - int v58; - int v66; int newDirection; int v92; int v93; @@ -1583,20 +1578,9 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int v108; int v109; int v111; - int v113; int v114; int v115; - int v116; int v117; - int v118; - int v119; - int v120; - int v121; - int v122; - int v123; - int v124; - int v125; - bool v126 = false; int collLineIdx; int collDataIdx; int v140; @@ -1652,27 +1636,13 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, collLineIdx = -1; int distX, v10, distY, v12, v13, v14; + int repeatFlag = 0; for (;;) { v111 = curX; v109 = curY; if (destX >= curX - 2 && destX <= curX + 2 && destY >= curY - 2 && destY <= curY + 2) { -LABEL_149: essai0[v115].invalidate(); - -LABEL_150: - if (v115) { - v116 = 0; - for (;;) { - super_parcours[v137] = essai0[v116]; - v116++; - v137++; - - if (!essai0[v116].isValid()) - break; - } - } - super_parcours[v137].invalidate(); - return 1; + goto retLABEL_essai0; } distX = abs(curX - destX); v10 = distX + 1; @@ -1702,17 +1672,43 @@ LABEL_150: if (v94 == -1 && (v101 >= -150 && v101 <= 0)) newDirection = 1; - if (newDirection == -1 && !checkSmoothMove(curX, v109, destX, destY) && !makeSmoothMove(curX, v109, destX, destY)) - break; -LABEL_72: + if (newDirection == -1 && !checkSmoothMove(curX, v109, destX, destY) && !makeSmoothMove(curX, v109, destX, destY)) { + newDirection = _smoothMoveDirection; + v14 = 0; + for (v14 = 0; _smoothRoute[v14]._posX != -1 && _smoothRoute[v14]._posY != -1; ++v14) { + if (checkCollisionLine(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, &v143, &v142, 0, _linesNumb)) { + if (v142 > _lastLine) + v142 = -1; + break; + } + + essai0[v115].set(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, newDirection); + v115++; + + if (repeatFlag == 1) { + repeatFlag = 2; + break; + } + } + + if (repeatFlag != 2 && _smoothRoute[v14]._posX != -1 && _smoothRoute[v14]._posY != -1) + break; + + repeatFlag = 1; + v18 = v14 - 1; + v111 = _smoothRoute[v18]._posX; + v109 = _smoothRoute[v18]._posY; + } v19 = abs(v111 - destX); v20 = v19 + 1; v95 = abs(v109 - destY); v108 = v95 + 1; if (v20 > (v95 + 1)) v108 = v20; - if (v108 <= 10) - goto LABEL_149; + if (v108 <= 10) { + essai0[v115].invalidate(); + goto retLABEL_essai0; + } v21 = v108 - 1; v102 = 1000 * v20 / v21; v100 = 1000 * (v95 + 1) / v21; @@ -1758,6 +1754,7 @@ LABEL_72: } } if (v22 == 1) { + // CHECKME: Overlapping intervals if (v100 >= -1 && v100 <= 510) newDirection = 2; if (v100 >= -510 && v100 <= 0) @@ -1795,8 +1792,10 @@ LABEL_72: newDirection = 1; } v23 = 0; - if (v108 + 1 <= 0) - goto LABEL_149; + if (v108 + 1 <= 0) { + essai0[v115].invalidate(); + goto retLABEL_essai0; + } while (!checkCollisionLine(v104, v103, &v143, &v142, 0, _linesNumb)) { essai0[v115].set(v104, v103, newDirection); v106 += v102; @@ -1805,358 +1804,261 @@ LABEL_72: v103 = v105 / 1000; v115++; ++v23; - if (v23 >= v108 + 1) - goto LABEL_149; + if (v23 >= v108 + 1) { + essai0[v115].invalidate(); + goto retLABEL_essai0; + } } if (_lastLine >= v142) - goto LABEL_157; + break; v24 = GENIAL(v142, v143, v104, v103, destX, destY, v115, essai0); if (v24 == -1) - goto LABEL_150; + goto retLABEL_essai0; v115 = v24; if (NVPX != -1 || NVPY != -1) { v142 = -1; - goto LABEL_157; + break; } curX = -1; curY = -1; } - newDirection = _smoothMoveDirection; - v14 = 0; - for (;;) { - if (_smoothRoute[v14]._posX == -1 || _smoothRoute[v14]._posY == -1) { - v126 = true; - v18 = v14 - 1; - v111 = _smoothRoute[v18]._posX; - v109 = _smoothRoute[v18]._posY; - goto LABEL_72; - } - if (checkCollisionLine(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, &v143, &v142, 0, _linesNumb)) - break; - essai0[v115].set(_smoothRoute[v14]._posX, _smoothRoute[v14]._posY, newDirection); - v115++; - ++v14; - if (v126) { - v18 = v14 - 1; - v111 = _smoothRoute[v18]._posX; - v109 = _smoothRoute[v18]._posY; - goto LABEL_72; - } - } - if (v142 > _lastLine) - v142 = -1; - -LABEL_157: essai0[v115].invalidate(); v117 = 0; v33 = v98; v92 = v97; -LABEL_158: - v113 = v33; - if (destX >= v33 - 2 && destX <= v33 + 2 && destY >= v92 - 2 && destY <= v92 + 2) - goto LABEL_194; - if (v33 >= destX) { -LABEL_165: - if (v113 > destX) { - v36 = v113; - while (!checkCollisionLine(v36, v92, &v141, &v140, 0, _linesNumb)) { - essai1[v117].set(v36, v92, 7); - v117++; - --v36; - if (destX >= v36) - goto LABEL_171; - } - goto LABEL_168; - } -LABEL_171: - if (v92 >= destY) { -LABEL_181: - for (int v43 = v92; v43 > destY; v43--) { - if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { - if (_lastLine < v140) { - int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, essai1); - if (v44 == -1) - goto LABEL_195; - v117 = v44; - if (NVPX != -1 && NVPY != -1) { - v33 = NVPX; - v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _lastLine); - if (v45 && v140 <= _lastLine) - goto LABEL_202; - goto LABEL_158; - } - } - if (v140 <= _lastLine) - goto LABEL_202; - } - essai1[v117].set(destX, v43, 1); - v117++; - } -LABEL_194: + + while (true) { + + if (destX >= v33 - 2 && destX <= v33 + 2 && destY >= v92 - 2 && destY <= v92 + 2) { essai1[v117].invalidate(); -LABEL_195: - if (v117) { - v118 = 0; - for (;;) { - super_parcours[v137] = essai1[v118]; - v118++; - v137++; - if (!essai1[v118].isValid()) - break; - } + goto retLABEL_essai0; + } + while (v33 != destX) { + if (checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { + if (v140 > _lastLine) + v140 = -1; + break; } - super_parcours[v137].invalidate(); - return 1; + + if (v33 < destX) + essai1[v117++].set(v33++, v92, 3); + else + essai1[v117++].set(v33--, v92, 7); } - v39 = v92; - for (;;) { - if (checkCollisionLine(destX, v39, &v141, &v140, 0, _linesNumb)) { - if (_lastLine < v140) { - v40 = GENIAL(v140, v141, destX, v39, destX, destY, v117, essai1); - if (v40 == -1) - goto LABEL_195; - v117 = v40; - if (NVPX != -1 && NVPY != -1) { - v33 = NVPX; - v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _lastLine); - if (v45 && v140 <= _lastLine) - goto LABEL_202; - goto LABEL_158; - } - } + if (v33 != destX) + break; + + int v43 = v92; + while (v43 != destY) { + if (checkCollisionLine(destX, v43, &v141, &v140, 0, _linesNumb)) { if (v140 <= _lastLine) - goto LABEL_202; + break; + + int v44 = GENIAL(v140, v141, destX, v43, destX, destY, v117, essai1); + if (v44 == -1) + goto retLABEL_essai1; + v117 = v44; + if (NVPX != -1 && NVPY != -1) + break; } - essai1[v117].set(destX, v39, 5); - v117++; - ++v39; - if (destY <= v39) - goto LABEL_181; + if (v43 < destY) + essai1[v117++].set(destX, v43++, 5); + else + essai1[v117++].set(destX, v43--, 1); } + if (v43 == destY) { + essai1[v117].invalidate(); + goto retLABEL_essai1; + } + if (v140 <= _lastLine) + break; + v33 = NVPX; + v92 = NVPY; + v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _lastLine); + if (v45 && v140 <= _lastLine) + break; } - while (!checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { - essai1[v117].set(v33, v92, 3); - v117++; - ++v33; - if (destX <= v33) - goto LABEL_165; - } -LABEL_168: - if (v140 > _lastLine) - v140 = -1; -LABEL_202: + essai1[v117].invalidate(); v117 = 0; v54 = v98; v93 = v97; -LABEL_203: - v114 = v54; - if (destX >= v54 - 2 && destX <= v54 + 2 && destY >= v93 - 2 && destY <= v93 + 2) - goto LABEL_241; - if (v93 < destY) { + while (true) { + int v61; + v114 = v54; + if (destX >= v54 - 2 && destX <= v54 + 2 && destY >= v93 - 2 && destY <= v93 + 2) { + essai2[v117].invalidate(); + goto retLABEL_essai2; + } + v55 = v93; - while (!checkCollisionLine(v114, v55, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - essai2[v117].set(v114, v55, 5); - v117++; - ++v55; - if (destY <= v55) - goto LABEL_211; - } - goto LABEL_214; - } -LABEL_211: - if (v93 > destY) { - v58 = v93; - while (!checkCollisionLine(v114, v58, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - essai2[v117].set(v114, v58, 1); - v117++; - --v58; - if (destY >= v58) - goto LABEL_217; - } -LABEL_214: - if (collLineIdx > _lastLine) - collLineIdx = -1; -LABEL_249: - essai2[v117].invalidate(); - - if (!v136) { - if (a6 > foundLineIdx) { - if (essai0[0]._X != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { - NV_LIGNEDEP = v142; - NV_LIGNEOFS = v143; - v120 = 0; - for (;;) { - super_parcours[v137] = essai0[v120]; - v120++; - v137++; - if (!essai0[v120].isValid()) - break; - } - NV_POSI = v137; - return 2; - } - if (essai1[0]._X != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { - NV_LIGNEDEP = v140; - NV_LIGNEOFS = v141; - v121 = 0; - for (;;) { - assert(v137 <= 8000); - super_parcours[v137] = essai1[v121]; - v121++; - v137++; - if (!essai1[v121].isValid()) - break; - } - NV_POSI = v137; - return 2; - } - if (essai2[0]._X != -1) { - if (foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { - NV_LIGNEDEP = collLineIdx; - NV_LIGNEOFS = collDataIdx; - v122 = 0; - for (;;) { - assert(v137 <= 8000); - super_parcours[v137] = essai2[v122]; - v122++; - v137++; - if (!essai2[v122].isValid()) - break; - }; - NV_POSI = v137; - return 2; - } - } + while (v55 != destY) { + if (checkCollisionLine(v114, v55, &collDataIdx, &collLineIdx, 0, _linesNumb)) { + if (collLineIdx > _lastLine) + collLineIdx = -1; + break; } - if (a6 < foundLineIdx) { - if (v142 == -1) - v142 = 1300; - if (v140 == -1) - v142 = 1300; - if (collLineIdx == -1) - v142 = 1300; - if (essai1[0]._X != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { - NV_LIGNEDEP = v140; - NV_LIGNEOFS = v141; - v123 = 0; - for (;;) { - assert(137 <= 8000); - super_parcours[v137] = essai1[v123]; - v123++; - v137++; - if (!essai1[v123].isValid()) - break; - } - NV_POSI = v137; - return 2; - } - if (essai2[0]._X != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { - NV_LIGNEDEP = collLineIdx; - NV_LIGNEOFS = collDataIdx; - v124 = 0; - for (;;) { - assert(v137 <= 8000); - super_parcours[v137] = essai2[v124]; - v124++; - v137++; - if (!essai2[v124].isValid()) - break; - } - NV_POSI = v137; - return 2; - } - if (essai1[0]._X != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { - NV_LIGNEDEP = v142; - NV_LIGNEOFS = v143; - v125 = 0; - for (;;) { - assert(137 <= 8000); - super_parcours[v137] = essai0[v125]; - v125++; - v137++; - if (!essai0[v125].isValid()) - break; - } - NV_POSI = v137; - return 2; - } - } + if (v55 < destY) + essai2[v117++].set(v114, v55++, 5); + else + essai2[v117++].set(v114, v55--, 1); } - return 0; - } -LABEL_217: - if (v114 < destX) { - for (int v61 = v114; v61 < destX; v61++) { + if (v55 != destY) + break; + + v61 = v114; + while (v61 != destX) { if (checkCollisionLine(v61, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - if (_lastLine < collLineIdx) { - int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, essai2); - if (v62 == -1) - goto LABEL_195; - v117 = v62; - if (NVPX != -1) { - if (NVPY != -1) { - v54 = NVPX; - v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _lastLine); - if (colResult && collLineIdx <= _lastLine) - goto LABEL_249; - goto LABEL_203; - } - } - } if (collLineIdx <= _lastLine) - goto LABEL_249; - } + break; - essai2[v117].set(v61, destY, 3); - v117++; - } - } - if (v114 > destX) { - for (int v65 = v114; v65 > destX; v65--) { - if (checkCollisionLine(v65, destY, &collDataIdx, &collLineIdx, 0, _linesNumb)) { - if (_lastLine < collLineIdx) { - v66 = GENIAL(collLineIdx, collDataIdx, v65, destY, destX, destY, v117, essai2); - if (v66 == -1) - goto LABEL_242; - v117 = v66; - if (NVPX != -1 && NVPY != -1) { - v54 = NVPX; - v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _lastLine); - if (colResult && collLineIdx <= _lastLine) - goto LABEL_249; - goto LABEL_203; - } + int v62 = GENIAL(collLineIdx, collDataIdx, v61, destY, destX, destY, v117, essai2); + if (v62 == -1) { + // CHECKME: This goto was to retLABEL_essai1... + goto retLABEL_essai2; } - if (collLineIdx <= _lastLine) - goto LABEL_249; + v117 = v62; + if (NVPX != -1 && NVPY != -1) + break; } - essai2[v117].set(v65, destY, 7); - v117++; + + if (v61 < destX) + essai2[v117++].set(v61++, destY, 3); + else + essai2[v117++].set(v61--, destY, 7); } + if (v61 == destX) { + collLineIdx = -1; + essai2[v117].invalidate(); + goto retLABEL_essai2; + } + if (collLineIdx <= _lastLine) + break; + + v54 = NVPX; + v93 = NVPY; + colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _lastLine); + if (colResult && collLineIdx <= _lastLine) + break; } - collLineIdx = -1; -LABEL_241: + essai2[v117].invalidate(); -LABEL_242: - if (v117) { - v119 = 0; - for (;;) { - super_parcours[v137] = essai2[v119]; - v119++; - v137++; - if (!essai2[v119].isValid()) - break; + + if (!v136) { + if (a6 > foundLineIdx) { + if (essai0[0]._X != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { + NV_LIGNEDEP = v142; + NV_LIGNEOFS = v143; + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai0[i++]; + } while (essai0[i].isValid()); + NV_POSI = v137; + return 2; + } + if (essai1[0]._X != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { + NV_LIGNEDEP = v140; + NV_LIGNEOFS = v141; + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai1[i++]; + } while (essai1[i].isValid()); + NV_POSI = v137; + return 2; + } + if (essai2[0]._X != -1 && foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { + NV_LIGNEDEP = collLineIdx; + NV_LIGNEOFS = collDataIdx; + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai2[i++]; + } while (essai2[i].isValid()); + NV_POSI = v137; + return 2; + } + } + if (a6 < foundLineIdx) { + if (v142 == -1) + v142 = 1300; + if (v140 == -1) + v142 = 1300; + if (collLineIdx == -1) + v142 = 1300; + if (essai1[0]._X != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { + NV_LIGNEDEP = v140; + NV_LIGNEOFS = v141; + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai1[i++]; + } while (essai1[i].isValid()); + NV_POSI = v137; + return 2; + } + if (essai2[0]._X != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { + NV_LIGNEDEP = collLineIdx; + NV_LIGNEOFS = collDataIdx; + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai2[i++]; + } while (essai2[i].isValid()); + NV_POSI = v137; + return 2; + } + // CHECKME: Checking essai0[0]._X might make more sense here? + if (essai1[0]._X != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { + NV_LIGNEDEP = v142; + NV_LIGNEOFS = v143; + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai0[i++]; + } while (essai0[i].isValid()); + NV_POSI = v137; + return 2; + } } } + return 0; + +retLABEL_essai0: + if (v115) { + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai0[i++]; + } while (essai0[i].isValid()); + } + super_parcours[v137].invalidate(); + return 1; + +retLABEL_essai1: + if (v117) { + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai1[i++]; + } while (essai1[i].isValid()); + } + super_parcours[v137].invalidate(); + return 1; + +retLABEL_essai2: + if (v117) { + int i = 0; + do { + assert(v137 <= 8000); + super_parcours[v137++] = essai2[i++]; + } while (essai2[i].isValid()); + } super_parcours[v137].invalidate(); return 1; } -- cgit v1.2.3 From 6df59334b8998e25abdc46a2dfc718635f5a24df Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 16 Feb 2013 22:29:58 +0100 Subject: HOPKINS: Fix route direction This fixes pathfinding to the top right in some situations. --- engines/hopkins/lines.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 99a2a422f0..3334a76757 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1754,8 +1754,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, } } if (v22 == 1) { - // CHECKME: Overlapping intervals - if (v100 >= -1 && v100 <= 510) + if (v100 >= -1000 && v100 <= -510) newDirection = 2; if (v100 >= -510 && v100 <= 0) newDirection = 3; @@ -1769,21 +1768,20 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, newDirection = 4; if (v102 >= 0 && v102 <= 510) newDirection = 5; - // CHECKME: The two conditions on v102 are not compatible! - if (v102 >= -1 && v102 <= -510) - newDirection = 6; if (v102 >= -510 && v102 <= 0) newDirection = 5; + if (v102 >= -1000 && v102 <= -510) + newDirection = 6; } if (v22 == -1) { if (v100 >= 510 && v100 <= 1000) newDirection = 6; if (v100 >= 0 && v100 <= 510) newDirection = 7; - if (v100 >= -1000 && v100 <= -510) - newDirection = 8; if (v100 >= -510 && v100 <= 0) newDirection = 7; + if (v100 >= -1000 && v100 <= -510) + newDirection = 8; } if (v96 == -1) { if (v102 >= -1000 && v102 <= -510) -- cgit v1.2.3 From 95c44e0a515b316bcdfce6c251d96b2d95d38113 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 19 Feb 2013 00:39:43 +0100 Subject: HOPKINS: Fix typo --- engines/hopkins/lines.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 6870d1a0c1..3a7bc99f08 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1794,7 +1794,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (destX >= v33 - 2 && destX <= v33 + 2 && destY >= v92 - 2 && destY <= v92 + 2) { essai1[v117].invalidate(); - goto retLABEL_essai0; + goto retLABEL_essai1; } while (v33 != destX) { if (checkCollisionLine(v33, v92, &v141, &v140, 0, _linesNumb)) { -- cgit v1.2.3 From 71f70158e77201bdc42d3393fa11f78fe4e98ce0 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 19 Feb 2013 00:52:48 +0100 Subject: HOPKINS: Fix repeating route from pathfinder Regression from d7c8fe912. --- engines/hopkins/lines.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 3a7bc99f08..26419cd16b 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1474,17 +1474,19 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } } } - if (!loopCond) { - int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); - if (v89 == 1) - return &super_parcours[0]; - if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; - loopCond = true; - break; - } + + if (loopCond) + break; + + int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + if (v89 == 1) + return &super_parcours[0]; + if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { + v115 = NV_LIGNEDEP; + v114 = NV_LIGNEOFS; + v112 = NV_POSI; + loopCond = true; + break; } } -- cgit v1.2.3 From f92154dbe19ecca876ffcbeca1379c1651812fb0 Mon Sep 17 00:00:00 2001 From: Dreammaster Date: Mon, 18 Feb 2013 23:30:59 -0500 Subject: HOPKINS: Changed WinScan to use actual screen pitch --- engines/hopkins/graphics.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 0e2df5e04a..1009b1b3ed 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -112,7 +112,8 @@ void GraphicsManager::setGraphicalMode(int width, int height) { _screenWidth = width; _screenHeight = height; - WinScan = width * 2; // Refactor me + // Clear the screen pitch. This will be set on the first lockScreen call + WinScan = 0; PAL_PIXELS = SD_PIXELS; _lineNbr = width; @@ -128,9 +129,12 @@ void GraphicsManager::setGraphicalMode(int width, int height) { */ void GraphicsManager::lockScreen() { if (!_skipVideoLockFl) { - if (_lockCounter++ == 0) + if (_lockCounter++ == 0) { _videoPtr = g_system->lockScreen(); - } + if (WinScan == 0) + WinScan = _videoPtr->pitch; + } + } } /** -- cgit v1.2.3 From 7a73412fb6ac891a4ffc336abb956afc808ffb60 Mon Sep 17 00:00:00 2001 From: Dreammaster Date: Mon, 18 Feb 2013 23:43:19 -0500 Subject: HOPKINS: Fixed warnings about switch statements using DIR_ constants --- engines/hopkins/hopkins.cpp | 12 ++++++++++++ engines/hopkins/lines.cpp | 8 ++++++++ engines/hopkins/objects.cpp | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 880d2b6cd2..3a32c2c079 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2549,6 +2549,8 @@ void HopkinsEngine::BTOCEAN() { case DIR_DOWN: _objectsManager.SPACTION(_globals.PERSO, "9,10,11,12,13,14,15,16,17,18,-1,", 0, 0, 6, false); break; + default: + break; } _globals._oceanDirection = DIR_LEFT; @@ -2584,6 +2586,8 @@ void HopkinsEngine::BTOCEAN() { case DIR_LEFT: _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,-1,", 0, 0, 6, false); break; + default: + break; } _globals._oceanDirection = DIR_RIGHT; _globals._exitId = 2; @@ -2651,6 +2655,8 @@ void HopkinsEngine::BTOCEAN() { if (!displAnim) _objectsManager.SPACTION(_globals.PERSO, "18,19,20,21,22,23,24,25,26,27,-1,", 0, 0, 6, false); break; + default: + break; } _globals._oceanDirection = DIR_UP; _globals._exitId = 3; @@ -2702,6 +2708,8 @@ void HopkinsEngine::BTOCEAN() { } } break; + default: + break; } _globals._oceanDirection = DIR_DOWN; _globals._exitId = 4; @@ -2723,6 +2731,8 @@ void HopkinsEngine::OCEAN_HOME() { case DIR_LEFT: _objectsManager.setSpriteIndex(0, 18); break; + default: + break; } } @@ -2775,6 +2785,8 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Di _objectsManager._characterPos.x = 415; _objectsManager._startSpriteIndex = 18; break; + default: + break; } _objectsManager.addStaticSprite(_globals.PERSO, Common::Point(_objectsManager._characterPos.x, 110), 0, _objectsManager._startSpriteIndex, 0, false, 0, 0); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 26419cd16b..c51cf8e2e9 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -573,6 +573,8 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { curY -= 2; curX -= 2; break; + default: + break; } } int v41 = curX; @@ -766,6 +768,8 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { NV_POSI = v7; return true; break; + default: + break; } } return false; @@ -1072,6 +1076,8 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a --NVPY; --NVPX; break; + default: + break; } } } else { @@ -1591,6 +1597,8 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, curY -= 2; curX -= 2; break; + default: + break; } } v98 = curX; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b1be7c1abd..abc608c449 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1629,6 +1629,8 @@ void ObjectsManager::GOHOME2() { case DIR_LEFT: setSpriteIndex(0, 7); break; + default: + break; } return; @@ -1648,6 +1650,8 @@ void ObjectsManager::GOHOME2() { case DIR_LEFT: setSpriteIndex(0, 3); break; + default: + break; } _vm->_linesManager._route = (RouteItem *)g_PTRNUL; -- cgit v1.2.3 From 38e9dbfe3f641bfd4564a0103a5d97ec815904f3 Mon Sep 17 00:00:00 2001 From: Dreammaster Date: Mon, 18 Feb 2013 23:45:58 -0500 Subject: HOPKINS: Fixed shadowed variable warning --- engines/hopkins/font.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 844bcb930d..86a4352d04 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -300,10 +300,10 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in int ptrc = 0; for (int curIdx = 0; curIdx < _textSortArray[i] - 1; curIdx++) { Common::String &line = _text[idx]._lines[i]; - byte curChar = (curIdx >= (int)line.size()) ? '\0' : line.c_str()[curIdx]; - if (curChar <= 31) - curChar = ' '; - ptrc += _vm->_objectsManager.getWidth(_font, (byte)curChar - 32); + byte curChar2 = (curIdx >= (int)line.size()) ? '\0' : line.c_str()[curIdx]; + if (curChar2 <= 31) + curChar2 = ' '; + ptrc += _vm->_objectsManager.getWidth(_font, (byte)curChar2 - 32); } _textSortArray[i] = ptrc; } -- cgit v1.2.3 From 72f7421b6d156b9c0e43aff116f5471aca322296 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 07:54:57 +0100 Subject: HOPKINS: Remove a couple of useless variables and associated dead code --- engines/hopkins/font.cpp | 8 -------- engines/hopkins/globals.cpp | 2 -- engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.cpp | 1 - engines/hopkins/lines.h | 5 ++--- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 86a4352d04..ee1634a86f 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -327,14 +327,6 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._pos.x = i; textPosX = _vm->_eventsManager._startPos.x + i; } else { - if (_vm->_globals.nbrligne == (SCREEN_WIDTH - 1)) { - while (_vm->_globals._boxWidth + textPosX > 638 && textPosX > -2) - textPosX -= 2; - } - if (_vm->_globals.nbrligne == (SCREEN_WIDTH * 2)) { - while (_vm->_globals._boxWidth + textPosX > 1278 && textPosX > -2) - textPosX -= 2; - } _text[idx]._pos.x = textPosX; } } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 633f222092..f08dd59db6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -107,7 +107,6 @@ Globals::Globals() { _oldDirectionSpriteIdx = 59; _lastDirection = DIR_NONE; NUM_FICHIER_OBJ = 0; - nbrligne = 0; _boxWidth = 0; _objectWidth = _objectHeight = 0; _catalogPos = 0; @@ -238,7 +237,6 @@ void Globals::clearAll() { for (int idx = 0; idx < 6; ++idx) CACHE_BANQUE[idx] = g_PTRNUL; - nbrligne = 80; INIT_ANIM(); _boxWidth = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index bfd5d01307..7e063bf38c 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -307,7 +307,6 @@ public: bool NOMARCHE; int iRegul; byte *BUF_ZONE; - int nbrligne; // Useless variable? BqeAnimItem Bqe_Anim[35]; byte *SPRITE_ECRAN; byte *PERSO; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 3a32c2c079..de89ab52f8 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2196,7 +2196,6 @@ void HopkinsEngine::playEnding() { void HopkinsEngine::displayPlane() { _soundManager.WSOUND(28); _globals.iRegul = 1; - _globals.nbrligne = SCREEN_WIDTH; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 5df9a59daf..70fd5086bc 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -94,10 +94,9 @@ struct RouteItem { int16 _X; int16 _Y; Directions _dir; - int16 _unk; bool isValid() const { return _X != -1 || _Y != -1; } - void invalidate() { _X = _Y = _unk = -1; _dir = DIR_NONE; } - void set(int16 X, int16 Y, Directions dir) { _X = X; _Y = Y; _dir = dir; _unk = 0; } + void invalidate() { _X = _Y = -1; _dir = DIR_NONE; } + void set(int16 X, int16 Y, Directions dir) { _X = X; _Y = Y; _dir = dir; } }; -- cgit v1.2.3 From 5bbdbc0fadf250d14e6b289172c5359cd1179896 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 14:34:43 +0100 Subject: HOPKINS: Misc renaming, some sound refactoring --- engines/hopkins/computer.cpp | 6 +- engines/hopkins/dialogs.cpp | 12 ++-- engines/hopkins/graphics.cpp | 26 +++----- engines/hopkins/graphics.h | 4 +- engines/hopkins/hopkins.cpp | 126 +++++++++++++++++++------------------- engines/hopkins/menu.cpp | 2 +- engines/hopkins/objects.cpp | 30 +++++----- engines/hopkins/objects.h | 14 ++--- engines/hopkins/script.cpp | 140 +++++++++++++++++++++---------------------- engines/hopkins/sound.cpp | 90 ++++++++++++++-------------- engines/hopkins/sound.h | 15 +++-- engines/hopkins/talk.cpp | 12 ++-- 12 files changed, 229 insertions(+), 248 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index d101a67278..a70a8de615 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -564,9 +564,9 @@ void ComputerManager::displayGamesSubMenu() { _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); _vm->_objectsManager._sprite[0]._spriteData = oldSpriteData; - _vm->_soundManager.DEL_SAMPLE(1); - _vm->_soundManager.DEL_SAMPLE(2); - _vm->_soundManager.DEL_SAMPLE(3); + _vm->_soundManager.removeSample(1); + _vm->_soundManager.removeSample(2); + _vm->_soundManager.removeSample(3); _vm->_globals._speed = oldSpeed; _vm->_eventsManager._breakoutFl = false; setVideoMode(); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 93f86598bc..7695f8c829 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -88,7 +88,7 @@ void DialogsManager::showOptionsDialog() { ++_vm->_soundManager._musicVolume; if (_vm->_soundManager._musicVolume <= 12) - _vm->_soundManager.playSound("bruit2.wav"); + _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._musicVolume = 12; _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); @@ -99,7 +99,7 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 138) { --_vm->_soundManager._musicVolume; if (_vm->_soundManager._musicVolume >= 0) - _vm->_soundManager.playSound("bruit2.wav"); + _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._musicVolume = 0; @@ -112,7 +112,7 @@ void DialogsManager::showOptionsDialog() { if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 165) { ++_vm->_soundManager._soundVolume; if (_vm->_soundManager._soundVolume <= 16) - _vm->_soundManager.playSound("bruit2.wav"); + _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._soundVolume = 16; _vm->_soundManager.MODSetSampleVolume(); @@ -123,7 +123,7 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 165) { --_vm->_soundManager._soundVolume; if (_vm->_soundManager._soundVolume >= 0) - _vm->_soundManager.playSound("bruit2.wav"); + _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._soundVolume = 0; _vm->_soundManager.MODSetSampleVolume(); @@ -137,7 +137,7 @@ void DialogsManager::showOptionsDialog() { ++_vm->_soundManager._voiceVolume; if (_vm->_soundManager._voiceVolume <= 16) - _vm->_soundManager.playSound("bruit2.wav"); + _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._voiceVolume = 16; _vm->_soundManager.MODSetVoiceVolume(); @@ -148,7 +148,7 @@ void DialogsManager::showOptionsDialog() { if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 192) { --_vm->_soundManager._voiceVolume; if (_vm->_soundManager._voiceVolume >= 0) - _vm->_soundManager.playSound("bruit2.wav"); + _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._voiceVolume = 0; _vm->_soundManager.MODSetVoiceVolume(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 1009b1b3ed..108cad6f50 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1670,17 +1670,7 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, } while (yCtr != 1); } -// Init Screen -void GraphicsManager::INI_ECRAN(const Common::String &file, bool initializeScreen) { - OPTI_INI(file, 0, initializeScreen); -} - -// Init Screen 2 -void GraphicsManager::INI_ECRAN2(const Common::String &file, bool initializeScreen) { - OPTI_INI(file, 2, initializeScreen); -} - -void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initializeScreen) { +void GraphicsManager::initScreen(const Common::String &file, int mode, bool initializeScreen) { Common::String filename = file + ".ini"; byte *ptr = _vm->_fileManager.searchCat(filename, 1); @@ -1723,16 +1713,14 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia } while (!doneFlag); } _vm->_globals.freeMemory(ptr); - if (mode != 1) { - _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); + _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); - filename = file + ".rep"; - byte *dataP = _vm->_fileManager.searchCat(filename, 2); - if (dataP == g_PTRNUL) - dataP = _vm->_fileManager.loadFile(filename); + filename = file + ".rep"; + byte *dataP = _vm->_fileManager.searchCat(filename, 2); + if (dataP == g_PTRNUL) + dataP = _vm->_fileManager.loadFile(filename); - _vm->_globals._answerBuffer = dataP; - } + _vm->_globals._answerBuffer = dataP; _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager._changeVerbFl = false; } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index af06e8ce88..4b9d328956 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -145,6 +145,7 @@ public: void scrollScreen(int amount); int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); + void initScreen(const Common::String &file, int mode, bool initializeScreen); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); void addVesaSegment(int x1, int y1, int x2, int y2); @@ -164,11 +165,8 @@ public: void Trans_bloc2(byte *surface, byte *col, int size); void VISU_ALL(); void FIN_VISU(); - void INI_ECRAN(const Common::String &file, bool initializeScreen); - void INI_ECRAN2(const Common::String &file, bool initializeScreen); void NB_SCREEN(bool initPalette); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); - void OPTI_INI(const Common::String &file, int mode, bool initializeScreen); void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); void Copy_WinScan_Vbe(const byte *srcP, byte *destP); void Copy_Video_Vbe16(const byte *srcData); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index de89ab52f8..1a4d497ef3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -184,7 +184,7 @@ bool HopkinsEngine::runWin95Demo() { case 3: if (!_globals._saveData->_data[svField170]) { - _soundManager.WSOUND(3); + _soundManager.playSound(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) _graphicsManager.loadImage("fond"); else { @@ -209,10 +209,10 @@ bool HopkinsEngine::runWin95Demo() { else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); _soundManager._specialSoundNum = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); + _soundManager.removeSample(1); + _soundManager.removeSample(2); + _soundManager.removeSample(3); + _soundManager.removeSample(4); _graphicsManager.fadeOutLong(); _globals._saveData->_data[svField170] = 1; } @@ -371,7 +371,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 150: - _soundManager.WSOUND(28); + _soundManager.playSound(28); _globals.iRegul = 4; // CHECKME! _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -383,7 +383,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 151: - _soundManager.WSOUND(28); + _soundManager.playSound(28); _globals.iRegul = 4; // CHECKME! _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -398,7 +398,7 @@ bool HopkinsEngine::runWin95Demo() { break; case 152: - _soundManager.WSOUND(28); + _soundManager.playSound(28); _globals.iRegul = 4; // CHECKME! _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -489,7 +489,7 @@ bool HopkinsEngine::runLinuxDemo() { case 3: if (!_globals._saveData->_data[svField170]) { - _soundManager.WSOUND(3); + _soundManager.playSound(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) _graphicsManager.loadImage("fond"); else { @@ -517,10 +517,10 @@ bool HopkinsEngine::runLinuxDemo() { else _animationManager.playAnim("BANKUK.ANM", 200, 28, 200); _soundManager._specialSoundNum = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); + _soundManager.removeSample(1); + _soundManager.removeSample(2); + _soundManager.removeSample(3); + _soundManager.removeSample(4); _globals._saveData->_data[svField170] = 1; } @@ -689,7 +689,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 150: - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -703,7 +703,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 151: - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -717,7 +717,7 @@ bool HopkinsEngine::runLinuxDemo() { break; case 152: - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.iRegul = 1; _graphicsManager.lockScreen(); @@ -736,7 +736,7 @@ bool HopkinsEngine::runLinuxDemo() { bool HopkinsEngine::runFull() { if (getPlatform() == Common::kPlatformLinux) - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.loadObjects(); _objectsManager.changeObject(14); @@ -828,7 +828,7 @@ bool HopkinsEngine::runFull() { case 3: if (!_globals._saveData->_data[svField170]) { - _soundManager.WSOUND(3); + _soundManager.playSound(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) _graphicsManager.loadImage("fond"); else { @@ -860,10 +860,10 @@ bool HopkinsEngine::runFull() { _animationManager.playAnim("BANQUE.ANM", 200, 28, 200); } _soundManager._specialSoundNum = 0; - _soundManager.DEL_SAMPLE(1); - _soundManager.DEL_SAMPLE(2); - _soundManager.DEL_SAMPLE(3); - _soundManager.DEL_SAMPLE(4); + _soundManager.removeSample(1); + _soundManager.removeSample(2); + _soundManager.removeSample(3); + _soundManager.removeSample(4); if (getPlatform() != Common::kPlatformLinux) _graphicsManager.fadeOutLong(); _globals._saveData->_data[svField170] = 1; @@ -976,17 +976,17 @@ bool HopkinsEngine::runFull() { _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _soundManager.WSOUND_OFF(); + _soundManager.stopSound(); if (getPlatform() == Common::kPlatformLinux) { - _soundManager.WSOUND(29); + _soundManager.playSound(29); _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); } else if (getPlatform() == Common::kPlatformWindows) { - _soundManager.WSOUND(29); + _soundManager.playSound(29); _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); } else { - _soundManager.WSOUND(6); + _soundManager.playSound(6); _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); } @@ -1018,12 +1018,12 @@ bool HopkinsEngine::runFull() { _objectsManager.PERSONAGE2("IM20", "IM20", "ANIM20", "IM20", 6, true); if (_globals._exitId == 17) { _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); + _soundManager.stopSound(); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); + _soundManager.playSound(6); if (getPlatform() == Common::kPlatformLinux) _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("PURG2A.ANM", 12, 18, 50); @@ -1132,7 +1132,7 @@ bool HopkinsEngine::runFull() { _globals._disableInventFl = false; _objectsManager._forestFl = true; Common::String im = Common::String::format("IM%d", _globals._exitId); - _soundManager.WSOUND(13); + _soundManager.playSound(13); if (_objectsManager._forestSprite == g_PTRNUL) { _objectsManager._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR"); _soundManager.loadSample(1, "SOUND41.WAV"); @@ -1141,7 +1141,7 @@ bool HopkinsEngine::runFull() { if (_globals._exitId < 35 || _globals._exitId > 49) { _objectsManager._forestSprite = _globals.freeMemory(_objectsManager._forestSprite); _objectsManager._forestFl = false; - _soundManager.DEL_SAMPLE(1); + _soundManager.removeSample(1); } break; } @@ -1384,12 +1384,12 @@ bool HopkinsEngine::runFull() { _objectsManager.PERSONAGE2("IM97", "IM97", "ANIM97", "IM97", 19, false); if (_globals._exitId == 18) { _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); + _soundManager.stopSound(); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); - _soundManager.WSOUND(6); + _soundManager.playSound(6); _animationManager.playAnim("PURG1A.ANM", 12, 18, 50); _graphicsManager.fadeOutShort(); _globals.iRegul = 0; @@ -1462,7 +1462,7 @@ bool HopkinsEngine::runFull() { break; case 150: - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -1476,7 +1476,7 @@ bool HopkinsEngine::runFull() { break; case 151: - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -1490,7 +1490,7 @@ bool HopkinsEngine::runFull() { break; case 152: - _soundManager.WSOUND(16); + _soundManager.playSound(16); _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -1511,11 +1511,11 @@ bool HopkinsEngine::runFull() { case 199: _globals.PERSO = _globals.freeMemory(_globals.PERSO); _globals.iRegul = 1; - _soundManager.WSOUND_OFF(); - _soundManager.WSOUND(23); + _soundManager.stopSound(); + _soundManager.playSound(23); _globals._exitId = handleBaseMap(); // Handles the base map (non-Windows) //_globals._exitId = WBASE(); // Handles the 3D Doom level (Windows) - _soundManager.WSOUND_OFF(); + _soundManager.stopSound(); _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); _globals.PERSO_TYPE = 0; _globals.iRegul = 0; @@ -1603,7 +1603,7 @@ void HopkinsEngine::playIntro() { _eventsManager._mouseFl = false; _globals.iRegul = 1; _eventsManager.VBL(); - _soundManager.WSOUND(16); + _soundManager.playSound(16); _animationManager._clearAnimationFl = true; _animationManager.playAnim("J1.anm", 12, 12, 50); if (shouldQuit() || _eventsManager._escKeyFl) @@ -1627,7 +1627,7 @@ void HopkinsEngine::playIntro() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _graphicsManager.DD_VBL(); - _soundManager.WSOUND(11); + _soundManager.playSound(11); _graphicsManager.loadImage("intro1"); _graphicsManager.scrollScreen(0); _graphicsManager._scrollOffset = 0; @@ -1671,7 +1671,7 @@ void HopkinsEngine::playIntro() { _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); - _soundManager.WSOUND(23); + _soundManager.playSound(23); _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); _graphicsManager._scrollOffset = 0; @@ -1712,7 +1712,7 @@ void HopkinsEngine::playIntro() { _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); _graphicsManager.VISU_ALL(); - _soundManager.WSOUND(23); + _soundManager.playSound(23); _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); _objectsManager.stopBobAnimation(1); @@ -1787,7 +1787,7 @@ void HopkinsEngine::playIntro() { _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); _animationManager._clearAnimationFl = true; - _soundManager.WSOUND(3); + _soundManager.playSound(3); _soundManager._specialSoundNum = 1; _animationManager.playAnim("INTRO1.anm", 10, 24, 18); _soundManager._specialSoundNum = 0; @@ -1842,7 +1842,7 @@ void HopkinsEngine::handleNotAvailable(int sortie) { } void HopkinsEngine::displayEndDemo() { - _soundManager.WSOUND(28); + _soundManager.playSound(28); if (_globals._language == LANG_FR) _graphicsManager.loadImage("endfr"); else @@ -1910,7 +1910,7 @@ void HopkinsEngine::endLinuxDemo() { _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _graphicsManager.loadImage("BOX"); - _soundManager.WSOUND(28); + _soundManager.playSound(28); _graphicsManager.fadeInLong(); _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(0); @@ -1973,7 +1973,7 @@ void HopkinsEngine::BASE() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _animationManager._clearAnimationFl = true; - _soundManager.WSOUND(25); + _soundManager.playSound(25); _animationManager.playAnim("base00a.anm", 10, 18, 18); if (!_eventsManager._escKeyFl) _animationManager.playAnim("base05a.anm", 10, 18, 18); @@ -2012,7 +2012,7 @@ void HopkinsEngine::BASED() { _graphicsManager.unlockScreen(); _graphicsManager.clearPalette(); _animationManager.NO_SEQ = false; - _soundManager.WSOUND(26); + _soundManager.playSound(26); _globals.iRegul = 1; _globals._disableInventFl = true; _animationManager.NO_COUL = true; @@ -2022,7 +2022,7 @@ void HopkinsEngine::BASED() { _graphicsManager.loadImage("IM92"); _animationManager.loadAnim("ANIM92"); _graphicsManager.VISU_ALL(); - _objectsManager.INILINK("IM92"); + _objectsManager.loadLinkFile("IM92"); for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); @@ -2049,7 +2049,7 @@ void HopkinsEngine::playEnding() { _graphicsManager._scrollOffset = 0; _globals._cityMapEnabledFl = false; _globals.iRegul = 1; - _soundManager.WSOUND(26); + _soundManager.playSound(26); _linesManager._route = (RouteItem *)g_PTRNUL; _globals.NOMARCHE = true; _globals._exitId = 0; @@ -2089,7 +2089,7 @@ void HopkinsEngine::playEnding() { _eventsManager.VBL(); while (_objectsManager.getBobAnimDataIdx(7) != 54); - _soundManager.PLAY_SAMPLE2(1); + _soundManager.playSample(1); do _eventsManager.VBL(); @@ -2125,7 +2125,7 @@ void HopkinsEngine::playEnding() { _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BERM.ANM", 100, 24, 300); _graphicsManager.FIN_VISU(); - _soundManager.DEL_SAMPLE(1); + _soundManager.removeSample(1); _graphicsManager.loadImage("PLAN3"); _graphicsManager.fadeInLong(); @@ -2141,7 +2141,7 @@ void HopkinsEngine::playEnding() { _soundManager._specialSoundNum = 0; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("JOUR2A.anm", 12, 12, 1000); - _soundManager.WSOUND(11); + _soundManager.playSound(11); _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); _graphicsManager.unlockScreen(); @@ -2170,7 +2170,7 @@ void HopkinsEngine::playEnding() { _eventsManager.VBL(); while (_objectsManager.getBobAnimDataIdx(8) != 5); - _soundManager.PLAY_SOUND2("SOUND41.WAV"); + _soundManager.directPlayWav("SOUND41.WAV"); do _eventsManager.VBL(); @@ -2178,8 +2178,8 @@ void HopkinsEngine::playEnding() { _graphicsManager.fadeOutLong(); _graphicsManager.FIN_VISU(); - _soundManager.DEL_SAMPLE(1); - _soundManager.WSOUND(16); + _soundManager.removeSample(1); + _soundManager.playSound(16); _globals.iRegul = 1; _soundManager._specialSoundNum = 0; _dialogsManager._removeInventFl = false; @@ -2194,7 +2194,7 @@ void HopkinsEngine::playEnding() { } void HopkinsEngine::displayPlane() { - _soundManager.WSOUND(28); + _soundManager.playSound(28); _globals.iRegul = 1; _graphicsManager.lockScreen(); _graphicsManager.clearScreen(); @@ -2466,7 +2466,7 @@ void HopkinsEngine::displayCredits() { _globals._creditsPosY = 436; _graphicsManager.loadImage("GENERIC"); _graphicsManager.fadeInLong(); - _soundManager.WSOUND(28); + _soundManager.playSound(28); _eventsManager._mouseFl = false; _globals.iRegul = 3; _globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1; @@ -2511,7 +2511,7 @@ void HopkinsEngine::displayCredits() { ++soundId; if (soundId > 31) soundId = 28; - _soundManager.WSOUND(soundId); + _soundManager.playSound(soundId); } _globals.Credit_bx = -1; _globals.Credit_bx1 = -1; @@ -2741,19 +2741,19 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Di _globals.NOMARCHE = false; _globals._exitId = 0; _globals._disableInventFl = true; - _soundManager.WSOUND(soundId); + _soundManager.playSound(soundId); _globals.PERSO = _fileManager.loadFile("VAISSEAU.SPR"); if (backgroundFilename.size()) _graphicsManager.loadImage(backgroundFilename); if (curExitId == 77) - _objectsManager.INILINK("IM77"); + _objectsManager.loadLinkFile("IM77"); else if (curExitId == 84) - _objectsManager.INILINK("IM84"); + _objectsManager.loadLinkFile("IM84"); else if (curExitId == 91) - _objectsManager.INILINK("IM91"); + _objectsManager.loadLinkFile("IM91"); else - _objectsManager.INILINK("ocean"); + _objectsManager.loadLinkFile("ocean"); if (!exit1) _linesManager.disableZone(1); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index f8868ddf27..20b531ff7e 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -92,7 +92,7 @@ int MenuManager::menu() { _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager._mouseSpriteId = 0; - _vm->_soundManager.WSOUND(28); + _vm->_soundManager.playSound(28); // Loop to make menu selection bool selectionMade = false; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index abc608c449..4142913950 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1745,7 +1745,7 @@ void ObjectsManager::handleCityMap() { _spritePtr = g_PTRNUL; _vm->_globals._exitId = 0; _vm->_globals.NOT_VERIF = true; - _vm->_soundManager.WSOUND(31); + _vm->_soundManager.playSound(31); _vm->_globals.iRegul = 1; _vm->_graphicsManager.loadImage("PLAN"); _vm->_linesManager.loadLines("PLAN.OB2"); @@ -1754,7 +1754,7 @@ void ObjectsManager::handleCityMap() { _spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR"); _vm->_animationManager.loadAnim("PLAN"); _vm->_graphicsManager.VISU_ALL(); - _vm->_graphicsManager.INI_ECRAN2("PLAN", false); + _vm->_graphicsManager.initScreen("PLAN", 2, false); for (int i = 0; i <= 15; i++) _vm->_globals.B_CACHE_OFF(i); _vm->_globals.B_CACHE_OFF(19); @@ -2678,7 +2678,7 @@ void ObjectsManager::handleSpecialGames() { setBobAnimation(6); _vm->_globals._saveData->_data[svField261] = 2; _vm->_linesManager.disableZone(15); - _vm->_soundManager.playSound("SOUND75.WAV"); + _vm->_soundManager.playSoundFile("SOUND75.WAV"); } if (_vm->_globals._saveData->_data[svField261] == 2 && getBobAnimDataIdx(6) == 6) { stopBobAnimation(6); @@ -3052,7 +3052,7 @@ int ObjectsManager::getBobFrameIndex(int idx) { return _bob[idx]._frameIndex; } -void ObjectsManager::INILINK(const Common::String &file) { +void ObjectsManager::loadLinkFile(const Common::String &file) { Common::File f; Common::String filename = file + ".LNK"; byte *ptr = _vm->_fileManager.searchCat(filename, 3); @@ -3641,7 +3641,7 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in if (_vm->_globals._saveData->_data[savegameIdx] == 1) { if (((idx == 1 || idx == 2) && getBobAnimDataIdx(idx) == 26) || ((idx == 3 || idx == 4) && getBobAnimDataIdx(idx) == 27)) { _vm->_dialogsManager._removeInventFl = true; - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); _vm->_globals._saveData->_data[savegameIdx] = 4; } } @@ -3678,29 +3678,29 @@ void ObjectsManager::lockAnimX(int idx, int x) { * Game scene control method */ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { + const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen) { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _vm->_dialogsManager._removeInventFl = false; _vm->_graphicsManager._scrollOffset = 0; _vm->_globals._cityMapEnabledFl = false; _vm->_globals.iRegul = 1; - _vm->_soundManager.WSOUND(v); + _vm->_soundManager.playSound(soundNum); _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals._exitId = 0; if (!backgroundFile.empty()) _vm->_graphicsManager.loadImage(backgroundFile); if (!linkFile.empty()) - INILINK(linkFile); + loadLinkFile(linkFile); if (!animFile.empty()) _vm->_animationManager.loadAnim(animFile); _vm->_graphicsManager.VISU_ALL(); if (!s4.empty()) { if (initializeScreen) - _vm->_graphicsManager.INI_ECRAN(s4, initializeScreen); + _vm->_graphicsManager.initScreen(s4, 0, initializeScreen); else - _vm->_graphicsManager.INI_ECRAN2(s4, initializeScreen); + _vm->_graphicsManager.initScreen(s4, 2, initializeScreen); } _vm->_eventsManager.mouseOn(); if (_vm->_globals._screenId == 61) { @@ -3766,7 +3766,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo * Game scene control method */ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen) { + const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen) { _vm->_dialogsManager._inventFl = false; _vm->_eventsManager._gameKey = KEY_NONE; _verb = 4; @@ -3777,21 +3777,21 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_globals.NOMARCHE = false; _vm->_globals._exitId = 0; _vm->_globals.NOT_VERIF = true; - _vm->_soundManager.WSOUND(v); + _vm->_soundManager.playSound(soundNum); _vm->_globals.iRegul = 1; if (!backgroundFile.empty()) _vm->_graphicsManager.loadImage(backgroundFile); if (!linkFile.empty()) - INILINK(linkFile); + loadLinkFile(linkFile); if (!animFile.empty()) { _vm->_animationManager.loadAnim(animFile); _vm->_graphicsManager.VISU_ALL(); } if (!s4.empty()) { if (initializeScreen) - _vm->_graphicsManager.INI_ECRAN(s4, initializeScreen); + _vm->_graphicsManager.initScreen(s4, 0, initializeScreen); else - _vm->_graphicsManager.INI_ECRAN2(s4, initializeScreen); + _vm->_graphicsManager.initScreen(s4, 2, initializeScreen); } _vm->_eventsManager.mouseOn(); _vm->_eventsManager._mouseCursorId = 4; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7dc58b0b10..40726bf304 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -131,13 +131,11 @@ private: void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); void nextVerbIcon(); - int getBobFrameIndex(int idx); + void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); void SPECIAL_INI(); - void ACTION(const byte *spriteData, const Common::String &actionStr, int a3, int a4, int speed, bool flipFl); - void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx); public: bool _disableFl; bool _forestFl; @@ -182,6 +180,7 @@ public: int getWidth(const byte *objectData, int idx); int getHeight(const byte *objectData, int idx); byte *loadSprite(const Common::String &file); + void loadLinkFile(const Common::String &file); void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9); void animateSprite(int idx); void removeSprite(int idx); @@ -225,22 +224,21 @@ public: void doActionRight(int idx); void doActionFront(int idx); void doActionLeft(int idx); + void doActionDiagRight(int idx); + void doActionDiagLeft(int idx); void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); + const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen); void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, - const Common::String &animFile, const Common::String &s4, int v, bool initializeScreen); + const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen); byte *CAPTURE_OBJET(int objIndex, bool mode); void OPTI_OBJET(); void BOB_OFF(int idx); void BOB_VISU(int idx); - void INILINK(const Common::String &file); void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); void BOB_VIVANT(int idx); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); void VBOB_OFF(int idx); - void doActionDiagRight(int idx); - void doActionDiagLeft(int idx); void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction); void SCI_OPTI_ONE(int idx, int animIdx, int a3, int a4); void GOHOME(); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 64f5fe2a57..cf2b61c8bf 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -549,7 +549,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { _vm->_graphicsManager.fadeOutLong(); } else { - _vm->_soundManager.playSound("SOUND17.WAV"); + _vm->_soundManager.playSoundFile("SOUND17.WAV"); _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playSequence2("HELICO.SEQ", 10, 4, 10); } @@ -602,7 +602,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.FIN_VISU(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) - _vm->_soundManager.playSound("SOUND17.WAV"); + _vm->_soundManager.playSoundFile("SOUND17.WAV"); _vm->_soundManager._specialSoundNum = 14; _vm->_graphicsManager.FADE_LINUX = 2; @@ -713,9 +713,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager.FADE_LINUX = 2; _vm->_animationManager.playAnim("CREVE17.ANM", 24, 24, 200); - _vm->_soundManager.DEL_SAMPLE(1); - _vm->_soundManager.DEL_SAMPLE(2); - _vm->_soundManager.DEL_SAMPLE(3); + _vm->_soundManager.removeSample(1); + _vm->_soundManager.removeSample(2); + _vm->_soundManager.removeSample(3); _vm->_graphicsManager._noFadingFl = true; break; @@ -766,37 +766,37 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(9) == 4 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v15 = true; } if (_vm->_objectsManager.getBobAnimDataIdx(9) == 5) v15 = false; if (_vm->_objectsManager.getBobAnimDataIdx(9) == 16 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v15 = true; } if (_vm->_objectsManager.getBobAnimDataIdx(9) == 17) v15 = false; if (_vm->_objectsManager.getBobAnimDataIdx(9) == 28 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v15 = true; } if (_vm->_objectsManager.getBobAnimDataIdx(9) == 29) v15 = false; if (_vm->_objectsManager.getBobAnimDataIdx(10) == 10 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(2); + _vm->_soundManager.playSample(2); v15 = true; } if (_vm->_objectsManager.getBobAnimDataIdx(10) == 11) v15 = false; if (_vm->_objectsManager.getBobAnimDataIdx(10) == 22 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(2); + _vm->_soundManager.playSample(2); v15 = true; } if (_vm->_objectsManager.getBobAnimDataIdx(10) == 23) v15 = false; if (_vm->_objectsManager.getBobAnimDataIdx(10) == 33 && !v15) { - _vm->_soundManager.PLAY_SAMPLE2(2); + _vm->_soundManager.playSample(2); v15 = true; } if (_vm->_objectsManager.getBobAnimDataIdx(10) == 34) @@ -812,8 +812,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.stopBobAnimation(10); - _vm->_soundManager.DEL_SAMPLE(1); - _vm->_soundManager.DEL_SAMPLE(2); + _vm->_soundManager.removeSample(1); + _vm->_soundManager.removeSample(2); break; } @@ -838,19 +838,19 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(9) == 4 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND44.WAV"); + _vm->_soundManager.directPlayWav("SOUND44.WAV"); v20 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(9) == 5) v20 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(9) == 18 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND46.WAV"); + _vm->_soundManager.directPlayWav("SOUND46.WAV"); v20 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(9) == 19) v20 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(10) == 11 && !v20) { - _vm->_soundManager.PLAY_SOUND2("SOUND45.WAV"); + _vm->_soundManager.directPlayWav("SOUND45.WAV"); v20 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(10) == 12) @@ -866,7 +866,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 50: - _vm->_soundManager.playSound("SOUND46.WAv"); + _vm->_soundManager.playSoundFile("SOUND46.WAv"); _vm->_objectsManager.OPTI_ONE(11, 0, 23, 0); break; @@ -920,7 +920,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.OPTI_ONE(15, 0, 12, 0); _vm->_objectsManager.stopBobAnimation(15); _vm->_objectsManager.OBSSEUL = true; - _vm->_objectsManager.INILINK("IM19a"); + _vm->_objectsManager.loadLinkFile("IM19a"); _vm->_objectsManager.OBSSEUL = false; break; @@ -977,13 +977,13 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(7) == 10 && !v18) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v18 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(7) == 11) v18 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(7) == 18 && !v18) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v18 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(7) == 19) @@ -992,7 +992,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.setBobAnimation(3); _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(3) != 48); - _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.removeSample(1); _vm->_objectsManager.setSpriteIndex(0, 62); _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.setBobAnimation(6); @@ -1047,7 +1047,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.OBSSEUL = true; - _vm->_objectsManager.INILINK("IM27a"); + _vm->_objectsManager.loadLinkFile("IM27a"); _vm->_objectsManager.OBSSEUL = false; break; } @@ -1139,7 +1139,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(6); _vm->_objectsManager.OBSSEUL = true; - _vm->_objectsManager.INILINK("IM24a"); + _vm->_objectsManager.loadLinkFile("IM24a"); _vm->_objectsManager.OBSSEUL = false; break; @@ -1173,25 +1173,25 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(1) == 1 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v25 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 2) v25 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 3 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v25 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 4) v25 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 5 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v25 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 6) v25 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 7 && !v25) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v25 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 8) @@ -1201,7 +1201,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(2); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 160, 6); - _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.removeSample(1); } if (_vm->_globals._saveData->_data[svField183] == 2) { _vm->_objectsManager.setBobAnimDataIdx(1, 0); @@ -1215,25 +1215,25 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(1) == 1 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v26 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 2) v26 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 3 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v26 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 4) v26 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 5 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v26 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 6) v26 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 7 && !v26) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v26 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 8) @@ -1243,12 +1243,12 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(3); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 283, 161, 8); - _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.removeSample(1); } break; case 90: - _vm->_soundManager.playSound("SOUND52.WAV"); + _vm->_soundManager.playSoundFile("SOUND52.WAV"); if (!_vm->_globals._saveData->_data[svField186]) { _vm->_animationManager.playSequence("CIB5A.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); @@ -1261,7 +1261,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 91: - _vm->_soundManager.playSound("SOUND52.WAV"); + _vm->_soundManager.playSoundFile("SOUND52.WAV"); if (!_vm->_globals._saveData->_data[svField186]) { _vm->_animationManager.playSequence("CIB5B.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); @@ -1274,7 +1274,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 92: - _vm->_soundManager.playSound("SOUND52.WAV"); + _vm->_soundManager.playSoundFile("SOUND52.WAV"); if (!_vm->_globals._saveData->_data[svField184]) { _vm->_animationManager.playSequence("CIB6A.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 0); @@ -1287,7 +1287,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 93: - _vm->_soundManager.playSound("SOUND52.WAV"); + _vm->_soundManager.playSoundFile("SOUND52.WAV"); if (!_vm->_globals._saveData->_data[svField184]) { _vm->_animationManager.playSequence("CIB6B.SEQ", 1, 12, 1); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 155, 29, 5); @@ -1322,7 +1322,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.getBobAnimDataIdx(9) != 15); _vm->_objectsManager.stopBobAnimation(9); _vm->_objectsManager.animateSprite(0); - _vm->_soundManager.playSound("SOUND50.WAV"); + _vm->_soundManager.playSoundFile("SOUND50.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1403,19 +1403,19 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(4) == 9 && !v33) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v33 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(4) == 10) v33 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(4) == 32 && !v33) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v33 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(4) == 33) v33 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(4) == 55 && !v33) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v33 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(4) == 56) @@ -1432,19 +1432,19 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(6) == 9 && !v34) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v34 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(6) == 10) v34 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(6) == 32 && !v34) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v34 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(6) == 33) v34 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(6) == 55 && !v34) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v34 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(6) == 56) @@ -1461,19 +1461,19 @@ int ScriptManager::handleOpcode(byte *dataP) { return -1; // Exiting game if (_vm->_objectsManager.getBobAnimDataIdx(5) == 9 && !v35) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v35 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(5) == 10) v35 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(5) == 32 && !v35) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v35 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(5) == 33) v35 = 0; if (_vm->_objectsManager.getBobAnimDataIdx(5) == 55 && !v35) { - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); v35 = 1; } if (_vm->_objectsManager.getBobAnimDataIdx(5) == 56) @@ -1484,7 +1484,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.doActionBack(1); - _vm->_soundManager.DEL_SAMPLE(1); + _vm->_soundManager.removeSample(1); break; case 106: @@ -1675,7 +1675,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.setBobAnimation(10); _vm->_objectsManager.BOB_OFFSET(10, 300); - _vm->_soundManager.playSound("SOUND44.WAV"); + _vm->_soundManager.playSoundFile("SOUND44.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1690,7 +1690,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(6) != 10); - _vm->_soundManager.playSound("SOUND71.WAV"); + _vm->_soundManager.playSoundFile("SOUND71.WAV"); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.stopBobAnimation(4); do { @@ -1701,7 +1701,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.getBobAnimDataIdx(7) != 15); _vm->_objectsManager.stopBobAnimation(5); _vm->_objectsManager.setBobAnimation(8); - _vm->_soundManager.playSound("SOUND70.WAV"); + _vm->_soundManager.playSoundFile("SOUND70.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1867,7 +1867,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.setBobAnimation(2); - _vm->_soundManager.playSound("SOUND66.WAV"); + _vm->_soundManager.playSoundFile("SOUND66.WAV"); do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1887,7 +1887,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 192, 152, 0); _vm->_objectsManager.setBobAnimation(9); _vm->_objectsManager.OBSSEUL = true; - _vm->_objectsManager.INILINK("IM73a"); + _vm->_objectsManager.loadLinkFile("IM73a"); _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); _vm->_animationManager.NO_SEQ = false; @@ -1944,7 +1944,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 230: { _vm->_objectsManager.OBSSEUL = true; - _vm->_objectsManager.INILINK("IM93a"); + _vm->_objectsManager.loadLinkFile("IM93a"); _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); _vm->_globals.NOT_VERIF = true; @@ -1971,7 +1971,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_objectsManager.getBobAnimDataIdx(7) == 9 && !v45) { v45 = 1; - _vm->_soundManager.playSound("SOUND81.WAV"); + _vm->_soundManager.playSoundFile("SOUND81.WAV"); } _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(7) != 15); @@ -1981,7 +1981,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.animateSprite(0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 337, 154, 3); _vm->_objectsManager.OBSSEUL = true; - _vm->_objectsManager.INILINK("IM93c"); + _vm->_objectsManager.loadLinkFile("IM93c"); _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); break; @@ -2052,7 +2052,7 @@ int ScriptManager::handleOpcode(byte *dataP) { vbobFrameIndex = 4; else if (v47 == 1) vbobFrameIndex = 6; - _vm->_soundManager.playSound("SOUND83.WAV"); + _vm->_soundManager.playSoundFile("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(vbobFrameIndex, 26, 50, 0); if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -2067,7 +2067,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField341] == 3) _vm->_globals._saveData->_data[svField340] = 0; } - _vm->_soundManager.playSound("SOUND83.WAV"); + _vm->_soundManager.playSoundFile("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(6, 0, 23, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 1); break; @@ -2082,7 +2082,7 @@ int ScriptManager::handleOpcode(byte *dataP) { vbobFrameIndex = 4; if (v48 == 1) vbobFrameIndex = 6; - _vm->_soundManager.playSound("SOUND83.WAV"); + _vm->_soundManager.playSoundFile("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(vbobFrameIndex, 26, 50, 0); if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -2097,7 +2097,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField341] == 3) _vm->_globals._saveData->_data[svField340] = 0; } - _vm->_soundManager.playSound("SOUND83.WAV"); + _vm->_soundManager.playSoundFile("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 23, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 145, 166, 3); break; @@ -2112,7 +2112,7 @@ int ScriptManager::handleOpcode(byte *dataP) { vbobFrameIndex = 4; else if (v49 == 1) vbobFrameIndex = 6; - _vm->_soundManager.playSound("SOUND83.WAV"); + _vm->_soundManager.playSoundFile("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(vbobFrameIndex, 26, 50, 0); if (_vm->_globals._saveData->_data[svField341] == 1) _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 27, 117, 0); @@ -2127,7 +2127,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField341] == 3) _vm->_globals._saveData->_data[svField340] = 0; } - _vm->_soundManager.playSound("SOUND83.WAV"); + _vm->_soundManager.playSoundFile("SOUND83.WAV"); _vm->_objectsManager.OPTI_ONE(4, 0, 23, 0); _vm->_graphicsManager.fastDisplay(_vm->_globals.SPRITE_ECRAN, 296, 212, 5); break; @@ -2135,7 +2135,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 239: _vm->_objectsManager.removeSprite(0); - _vm->_soundManager.playSound("SOUND84.WAV"); + _vm->_soundManager.playSoundFile("SOUND84.WAV"); _vm->_objectsManager.OPTI_ONE(16, 0, 10, 0); break; @@ -2148,13 +2148,13 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); if (_vm->_objectsManager.getBobAnimDataIdx(1) == 12 && !soundFlag) { - _vm->_soundManager.playSound("SOUND86.WAV"); + _vm->_soundManager.playSoundFile("SOUND86.WAV"); soundFlag = true; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 13) soundFlag = false; if (_vm->_objectsManager.getBobAnimDataIdx(1) == 25 && !soundFlag) { - _vm->_soundManager.playSound("SOUND85.WAV"); + _vm->_soundManager.playSoundFile("SOUND85.WAV"); soundFlag = true; } if (_vm->_objectsManager.getBobAnimDataIdx(1) == 25) @@ -2193,7 +2193,7 @@ int ScriptManager::handleOpcode(byte *dataP) { // Resurrect Samantha's clone case 242: { - _vm->_soundManager.playSound("SOUND87.WAV"); + _vm->_soundManager.playSoundFile("SOUND87.WAV"); _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESUF.SEQ", 1, 24, 1); _vm->_animationManager.NO_SEQ = false; @@ -2217,7 +2217,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 243: - _vm->_soundManager.playSound("SOUND88.WAV"); + _vm->_soundManager.playSoundFile("SOUND88.WAV"); if (_vm->_globals._saveData->_data[svField341] == 2) { _vm->_animationManager.NO_SEQ = true; _vm->_animationManager.playSequence("RESU.SEQ", 2, 24, 2); @@ -2228,7 +2228,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 245: - _vm->_soundManager.playSound("SOUND89.WAV"); + _vm->_soundManager.playSoundFile("SOUND89.WAV"); _vm->_objectsManager.OPTI_ONE(5, 0, 6, 0); _vm->_linesManager.ZONEP[4]._destX = 276; _vm->_objectsManager.enableVerb(4, 19); @@ -2261,7 +2261,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - _vm->_graphicsManager.OPTI_INI("BOMBE", 2, true); + _vm->_graphicsManager.initScreen("BOMBE", 2, true); _vm->_graphicsManager.fadeInShort(); break; @@ -2403,7 +2403,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int soundNum = READ_LE_INT16(dataP + 5); Common::String file = Common::String::format("SOUND%d.WAV", soundNum); - _vm->_soundManager.playSound(file); + _vm->_soundManager.playSoundFile(file); opcodeType = 1; break; } diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 5d0442aaa5..5957cde960 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -282,25 +282,25 @@ void SoundManager::playAnimSound(int soundNumber) { if (!_vm->_globals._censorshipFl && _specialSoundNum == 2) { switch (soundNumber) { case 20: - PLAY_SAMPLE2(5); + playSample(5); break; case 57: case 63: case 69: - PLAY_SAMPLE2(1); + playSample(1); break; case 75: - PLAY_SAMPLE2(2); + playSample(2); break; case 109: - PLAY_SAMPLE2(3); + playSample(3); break; case 122: - PLAY_SAMPLE2(4); + playSample(4); break; } } else if (_specialSoundNum == 1 && soundNumber == 17) - playSound("SOUND42.WAV"); + playSoundFile("SOUND42.WAV"); else if (_specialSoundNum == 5 && soundNumber == 19) playWav(1); else if (_specialSoundNum == 14 && soundNumber == 625) @@ -309,11 +309,11 @@ void SoundManager::playAnimSound(int soundNumber) { playWav(1); else if (_specialSoundNum == 17) { if (soundNumber == 6) - PLAY_SAMPLE2(1); + playSample(1); else if (soundNumber == 14) - PLAY_SAMPLE2(2); + playSample(2); else if (soundNumber == 67) - PLAY_SAMPLE2(3); + playSample(3); } else if (_specialSoundNum == 198 && soundNumber == 15) playWav(1); else if (_specialSoundNum == 199 && soundNumber == 72) @@ -342,7 +342,7 @@ static const char *const modSounds[] = { "tobac" }; -void SoundManager::WSOUND(int soundNumber) { +void SoundManager::playSound(int soundNumber) { if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS) { if (soundNumber > 27) return; @@ -350,14 +350,14 @@ void SoundManager::WSOUND(int soundNumber) { if (_oldSoundNumber != soundNumber || !_modPlayingFl) { if (_modPlayingFl) - WSOUND_OFF(); + stopSound(); playMod(modSounds[soundNumber - 1]); _oldSoundNumber = soundNumber; } } -void SoundManager::WSOUND_OFF() { +void SoundManager::stopSound() { stopVoice(0); stopVoice(1); stopVoice(2); @@ -618,7 +618,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { return true; } -void SoundManager::DEL_SAMPLE(int soundIndex) { +void SoundManager::removeSample(int soundIndex) { if (checkVoiceStatus(1)) stopVoice(1); if (checkVoiceStatus(2)) @@ -629,7 +629,7 @@ void SoundManager::DEL_SAMPLE(int soundIndex) { _sound[soundIndex]._active = false; } -void SoundManager::playSound(const Common::String &file) { +void SoundManager::playSoundFile(const Common::String &file) { if (_soundOffFl) return; @@ -649,11 +649,12 @@ void SoundManager::playSound(const Common::String &file) { playWav(1); } -void SoundManager::PLAY_SOUND2(const Common::String &file) { - if (!_soundOffFl) { - loadWav(file, 1); - playWav(1); - } +void SoundManager::directPlayWav(const Common::String &file) { + if (_soundOffFl) + return; + + loadWav(file, 1); + playWav(1); } void SoundManager::MODSetSampleVolume() { @@ -683,36 +684,33 @@ void SoundManager::loadSample(int wavIndex, const Common::String &file) { } void SoundManager::playSample(int wavIndex, int voiceMode) { - if (!_soundOffFl && _sound[wavIndex]._active) { - if (_soundFl) - delWav(_currentSoundIndex); - if (voiceMode == 5) { - if (checkVoiceStatus(1)) - stopVoice(1); - PLAY_SAMPLE_SDL(1, wavIndex); - } else if (voiceMode == 6) { - if (checkVoiceStatus(2)) - stopVoice(1); - PLAY_SAMPLE_SDL(2, wavIndex); - } else if (voiceMode == 7) { - if (checkVoiceStatus(3)) - stopVoice(1); - PLAY_SAMPLE_SDL(3, wavIndex); - } else if (voiceMode == 8) { - if (checkVoiceStatus(1)) - stopVoice(1); - PLAY_SAMPLE_SDL(1, wavIndex); - } - } -} + if (_soundOffFl || !_sound[wavIndex]._active) + return; -void SoundManager::PLAY_SAMPLE2(int idx) { - if (!_soundOffFl && _sound[idx]._active) { - if (_soundFl) - delWav(_currentSoundIndex); + if (_soundFl) + delWav(_currentSoundIndex); + + switch (voiceMode) { + case 5: + case 8: + // Case added to identify the former PLAY_SAMPLE2 calls + case 9: if (checkVoiceStatus(1)) stopVoice(1); - PLAY_SAMPLE_SDL(1, idx); + PLAY_SAMPLE_SDL(1, wavIndex); + break; + case 6: + if (checkVoiceStatus(2)) + stopVoice(1); + PLAY_SAMPLE_SDL(2, wavIndex); + break; + case 7: + if (checkVoiceStatus(3)) + stopVoice(1); + PLAY_SAMPLE_SDL(3, wavIndex); + break; + default: + break; } } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 70c05a83fc..c4db17c86a 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -114,11 +114,15 @@ public: void playAnimSound(int soundNumber); void loadSample(int wavIndex, const Common::String &file); - void playSample(int wavIndex, int voiceMode); + void playSample(int wavIndex, int voiceMode = 9); + void removeSample(int soundIndex); void checkSoundEnd(); void checkSounds(); - void playSound(const Common::String &file); + void playSoundFile(const Common::String &file); + void playSound(int soundNumber); + void stopSound(); + void updateScummVMSoundSettings(); void syncSoundSettings(); bool mixVoice(int voiceId, int voiceMode); @@ -129,12 +133,7 @@ public: void loadWav(const Common::String &file, int wavIndex); void playWav(int wavIndex); - - void DEL_SAMPLE(int soundIndex); - void WSOUND(int soundNumber); - void WSOUND_OFF(); - void PLAY_SOUND2(const Common::String &file2); - void PLAY_SAMPLE2(int idx); + void directPlayWav(const Common::String &file2); }; } // End of namespace Hopkins diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f22aa679e1..c6d83ee8d3 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -875,7 +875,7 @@ void TalkManager::REPONSE2(int zone, int verb) { _vm->_objectsManager.stopBobAnimation(3); _vm->_objectsManager.stopBobAnimation(4); _vm->_objectsManager.setBobAnimation(6); - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); _vm->_objectsManager.SPACTION1(_vm->_objectsManager._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); @@ -923,7 +923,7 @@ void TalkManager::REPONSE2(int zone, int verb) { _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.stopBobAnimation(2); _vm->_objectsManager.setBobAnimation(5); - _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_soundManager.playSample(1); _vm->_objectsManager.SPACTION1(_vm->_objectsManager._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); do _vm->_eventsManager.VBL(); @@ -1012,14 +1012,14 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { byte *oldAnswerBufferPtr = _vm->_globals._answerBuffer; _vm->_globals._answerBuffer = g_PTRNUL; _vm->_globals.NOMARCHE = true; - _vm->_objectsManager.INILINK(screenFilename); + _vm->_objectsManager.loadLinkFile(screenFilename); _vm->_objectsManager.PERSO_ON = true; _vm->_globals.GOACTION = false; _vm->_objectsManager._zoneNum = -1; initCharacterAnim(); VISU_PARLE(); dialogWait(); - _vm->_graphicsManager.INI_ECRAN2(screenFilename, true); + _vm->_graphicsManager.initScreen(screenFilename, 2, true); _vm->_globals.NOMARCHE = true; _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager._zoneNum = -1; @@ -1052,8 +1052,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals._answerBuffer = oldAnswerBufferPtr; _vm->_objectsManager._disableFl = true; - _vm->_objectsManager.INILINK(curScreenFilename); - _vm->_graphicsManager.INI_ECRAN2(curScreenFilename, true); + _vm->_objectsManager.loadLinkFile(curScreenFilename); + _vm->_graphicsManager.initScreen(curScreenFilename, 2, true); _vm->_objectsManager._disableFl = false; _vm->_globals.NOMARCHE = false; if (_vm->_globals._exitId == 101) -- cgit v1.2.3 From a208f51db79ce642b4ca5936488e2cf33f398f73 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 15:08:12 +0100 Subject: HOPKINS: More renaming in SoundManager --- engines/hopkins/dialogs.cpp | 16 +++--- engines/hopkins/sound.cpp | 123 +++++++++++++++++++++----------------------- engines/hopkins/sound.h | 18 +++---- 3 files changed, 75 insertions(+), 82 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7695f8c829..623e109c1d 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -91,7 +91,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._musicVolume = 12; - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + _vm->_soundManager.setMODMusicVolume(_vm->_soundManager._musicVolume); _vm->_soundManager.updateScummVMSoundSettings(); } @@ -103,7 +103,7 @@ void DialogsManager::showOptionsDialog() { else _vm->_soundManager._musicVolume = 0; - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + _vm->_soundManager.setMODMusicVolume(_vm->_soundManager._musicVolume); _vm->_soundManager.updateScummVMSoundSettings(); } @@ -115,7 +115,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._soundVolume = 16; - _vm->_soundManager.MODSetSampleVolume(); + _vm->_soundManager.setMODSampleVolume(); _vm->_soundManager.updateScummVMSoundSettings(); } @@ -126,7 +126,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._soundVolume = 0; - _vm->_soundManager.MODSetSampleVolume(); + _vm->_soundManager.setMODSampleVolume(); _vm->_soundManager.updateScummVMSoundSettings(); } @@ -140,7 +140,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._voiceVolume = 16; - _vm->_soundManager.MODSetVoiceVolume(); + _vm->_soundManager.setMODVoiceVolume(); _vm->_soundManager.updateScummVMSoundSettings(); } @@ -151,7 +151,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.playSoundFile("bruit2.wav"); else _vm->_soundManager._voiceVolume = 0; - _vm->_soundManager.MODSetVoiceVolume(); + _vm->_soundManager.setMODVoiceVolume(); _vm->_soundManager.updateScummVMSoundSettings(); } @@ -171,10 +171,10 @@ void DialogsManager::showOptionsDialog() { if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 138) { if (_vm->_soundManager._musicOffFl) { _vm->_soundManager._musicOffFl = false; - _vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume); + _vm->_soundManager.setMODMusicVolume(_vm->_soundManager._musicVolume); } else { _vm->_soundManager._musicOffFl = true; - _vm->_soundManager.MODSetMusicVolume(0); + _vm->_soundManager.setMODMusicVolume(0); } _vm->_soundManager.updateScummVMSoundSettings(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 5957cde960..a2054eed18 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -208,7 +208,7 @@ SoundManager::SoundManager() { for (int i = 0; i < VOICE_COUNT; ++i) Common::fill((byte *)&_voice[i], (byte *)&_voice[i] + sizeof(VoiceItem), 0); for (int i = 0; i < SWAV_COUNT; ++i) - Common::fill((byte *)&Swav[i], (byte *)&Swav[i] + sizeof(SwavItem), 0); + Common::fill((byte *)&_sWav[i], (byte *)&_sWav[i] + sizeof(SwavItem), 0); for (int i = 0; i < SOUND_COUNT; ++i) Common::fill((byte *)&_sound[i], (byte *)&_sound[i] + sizeof(SoundItem), 0); Common::fill((byte *)&_music, (byte *)&_music + sizeof(MusicItem), 0); @@ -365,7 +365,7 @@ void SoundManager::stopSound() { delWav(_currentSoundIndex); for (int i = 1; i <= 48; ++i) - DEL_SAMPLE_SDL(i); + removeWavSample(i); if (_modPlayingFl) { stopMusic(); @@ -577,13 +577,16 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { catLen = 0; } - SDL_LVOICE(filename, catPos, catLen); + if (!loadVoice(filename, catPos, catLen, _sWav[20])) + error("Couldn't load sample: %s", filename.c_str()); + + _sWav[20]._active = true; // Reduce music volume during speech oldMusicVol = _musicVolume; if (!_musicOffFl && _musicVolume > 2) { _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); - MODSetMusicVolume(_musicVolume); + setMODMusicVolume(_musicVolume); } playVoice(); @@ -606,12 +609,12 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { stopVoice(2); - DEL_SAMPLE_SDL(20); + removeWavSample(20); // Speech is over, set the music volume back to normal _musicVolume = oldMusicVol; if (!_musicOffFl && _musicVolume > 2) { - MODSetMusicVolume(_musicVolume); + setMODMusicVolume(_musicVolume); } _vm->_eventsManager._escKeyFl = false; _skipRefreshFl = false; @@ -625,7 +628,7 @@ void SoundManager::removeSample(int soundIndex) { stopVoice(2); if (checkVoiceStatus(3)) stopVoice(3); - DEL_SAMPLE_SDL(soundIndex); + removeWavSample(soundIndex); _sound[soundIndex]._active = false; } @@ -657,29 +660,29 @@ void SoundManager::directPlayWav(const Common::String &file) { playWav(1); } -void SoundManager::MODSetSampleVolume() { +void SoundManager::setMODSampleVolume() { for (int idx = 0; idx < SWAV_COUNT; ++idx) { - if (idx != 20 && Swav[idx]._active) { + if (idx != 20 && _sWav[idx]._active) { int volume = _soundVolume * 255 / 16; - _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); + _vm->_mixer->setChannelVolume(_sWav[idx]._soundHandle, volume); } } } -void SoundManager::MODSetVoiceVolume() { - if (Swav[20]._active) { +void SoundManager::setMODVoiceVolume() { + if (_sWav[20]._active) { int volume = _voiceVolume * 255 / 16; - _vm->_mixer->setChannelVolume(Swav[20]._soundHandle, volume); + _vm->_mixer->setChannelVolume(_sWav[20]._soundHandle, volume); } } -void SoundManager::MODSetMusicVolume(int volume) { +void SoundManager::setMODMusicVolume(int volume) { if (_vm->_mixer->isSoundHandleActive(_musicHandle)) _vm->_mixer->setChannelVolume(_musicHandle, volume * 255 / 16); } void SoundManager::loadSample(int wavIndex, const Common::String &file) { - LOAD_SAMPLE2_SDL(wavIndex, file, 0); + loadWavSample(wavIndex, file, false); _sound[wavIndex]._active = true; } @@ -697,17 +700,17 @@ void SoundManager::playSample(int wavIndex, int voiceMode) { case 9: if (checkVoiceStatus(1)) stopVoice(1); - PLAY_SAMPLE_SDL(1, wavIndex); + playWavSample(1, wavIndex); break; case 6: if (checkVoiceStatus(2)) stopVoice(1); - PLAY_SAMPLE_SDL(2, wavIndex); + playWavSample(2, wavIndex); break; case 7: if (checkVoiceStatus(3)) stopVoice(1); - PLAY_SAMPLE_SDL(3, wavIndex); + playWavSample(3, wavIndex); break; default: break; @@ -717,7 +720,7 @@ void SoundManager::playSample(int wavIndex, int voiceMode) { bool SoundManager::checkVoiceStatus(int voiceIndex) { if (_voice[voiceIndex]._status) { int wavIndex = _voice[voiceIndex]._wavIndex; - if (Swav[wavIndex]._audioStream != NULL && Swav[wavIndex]._audioStream->endOfStream()) + if (_sWav[wavIndex]._audioStream != NULL && _sWav[wavIndex]._audioStream->endOfStream()) stopVoice(voiceIndex); } @@ -728,48 +731,40 @@ void SoundManager::stopVoice(int voiceIndex) { if (_voice[voiceIndex]._status) { _voice[voiceIndex]._status = false; int wavIndex = _voice[voiceIndex]._wavIndex; - if (Swav[wavIndex]._active) { - if (Swav[wavIndex]._freeSampleFl) - DEL_SAMPLE_SDL(wavIndex); + if (_sWav[wavIndex]._active) { + if (_sWav[wavIndex]._freeSampleFl) + removeWavSample(wavIndex); } } _voice[voiceIndex]._status = false; } -void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength) { - if (!SDL_LoadVoice(filename, filePosition, entryLength, Swav[20])) - error("Couldn't load the sample %s", filename.c_str()); - - Swav[20]._active = true; -} - void SoundManager::playVoice() { - if (!Swav[20]._active) + if (!_sWav[20]._active) error("Bad handle"); if (!_voice[2]._status) { int wavIndex = _voice[2]._wavIndex; - if (Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) - DEL_SAMPLE_SDL(wavIndex); + if (_sWav[wavIndex]._active && _sWav[wavIndex]._freeSampleFl) + removeWavSample(wavIndex); } - PLAY_SAMPLE_SDL(2, 20); + playWavSample(2, 20); } -bool SoundManager::DEL_SAMPLE_SDL(int wavIndex) { - if (Swav[wavIndex]._active) { - _vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle); - delete Swav[wavIndex]._audioStream; - Swav[wavIndex]._audioStream = NULL; - Swav[wavIndex]._active = false; - - return true; - } else { +bool SoundManager::removeWavSample(int wavIndex) { + if (!_sWav[wavIndex]._active) return false; - } + + _vm->_mixer->stopHandle(_sWav[wavIndex]._soundHandle); + delete _sWav[wavIndex]._audioStream; + _sWav[wavIndex]._audioStream = NULL; + _sWav[wavIndex]._active = false; + + return true; } -bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item) { +bool SoundManager::loadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item) { Common::File f; if (!f.open(filename)) { // Fallback from WAV to APC... @@ -784,29 +779,29 @@ bool SoundManager::SDL_LoadVoice(const Common::String &filename, size_t fileOffs return true; } -void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample) { - if (Swav[wavIndex]._active) - DEL_SAMPLE_SDL(wavIndex); +void SoundManager::loadWavSample(int wavIndex, const Common::String &filename, bool freeSample) { + if (_sWav[wavIndex]._active) + removeWavSample(wavIndex); - SDL_LoadVoice(filename, 0, 0, Swav[wavIndex]); - Swav[wavIndex]._active = true; - Swav[wavIndex]._freeSampleFl = freeSample; + loadVoice(filename, 0, 0, _sWav[wavIndex]); + _sWav[wavIndex]._active = true; + _sWav[wavIndex]._freeSampleFl = freeSample; } void SoundManager::loadWav(const Common::String &file, int wavIndex) { - LOAD_SAMPLE2_SDL(wavIndex, file, 1); + loadWavSample(wavIndex, file, true); } void SoundManager::playWav(int wavIndex) { if (!_soundFl && !_soundOffFl) { _soundFl = true; _currentSoundIndex = wavIndex; - PLAY_SAMPLE_SDL(1, wavIndex); + playWavSample(1, wavIndex); } } void SoundManager::delWav(int wavIndex) { - if (DEL_SAMPLE_SDL(wavIndex)) { + if (removeWavSample(wavIndex)) { if (checkVoiceStatus(1)) stopVoice(1); @@ -815,12 +810,12 @@ void SoundManager::delWav(int wavIndex) { } } -void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { - if (!Swav[wavIndex]._active) +void SoundManager::playWavSample(int voiceIndex, int wavIndex) { + if (!_sWav[wavIndex]._active) warning("Bad handle"); - if (_voice[voiceIndex]._status && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) - DEL_SAMPLE_SDL(wavIndex); + if (_voice[voiceIndex]._status && _sWav[wavIndex]._active && _sWav[wavIndex]._freeSampleFl) + removeWavSample(wavIndex); _voice[voiceIndex]._status = true; _voice[voiceIndex]._wavIndex = wavIndex; @@ -830,13 +825,13 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { // If the handle is still in use, stop it. Otherwise we'll lose the // handle to that sound. This can currently happen (but probably // shouldn't) when skipping a movie. - if (_vm->_mixer->isSoundHandleActive(Swav[wavIndex]._soundHandle)) - _vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle); + if (_vm->_mixer->isSoundHandleActive(_sWav[wavIndex]._soundHandle)) + _vm->_mixer->stopHandle(_sWav[wavIndex]._soundHandle); // Start the voice playing - Swav[wavIndex]._audioStream->rewind(); - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle, - Swav[wavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); + _sWav[wavIndex]._audioStream->rewind(); + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sWav[wavIndex]._soundHandle, + _sWav[wavIndex]._audioStream, -1, volume, 0, DisposeAfterUse::NO); } void SoundManager::syncSoundSettings() { @@ -856,9 +851,9 @@ void SoundManager::syncSoundSettings() { // Update any active sounds for (int idx = 0; idx < SWAV_COUNT; ++idx) { - if (Swav[idx]._active) { + if (_sWav[idx]._active) { int volume = (idx == 20) ? (_voiceVolume * 255 / 16) : (_soundVolume * 255 / 16); - _vm->_mixer->setChannelVolume(Swav[idx]._soundHandle, volume); + _vm->_mixer->setChannelVolume(_sWav[idx]._soundHandle, volume); } } if (_vm->_mixer->isSoundHandleActive(_musicHandle)) { diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index c4db17c86a..9e89d10110 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -71,7 +71,7 @@ private: int _oldSoundNumber; VoiceItem _voice[VOICE_COUNT]; - SwavItem Swav[SWAV_COUNT]; + SwavItem _sWav[SWAV_COUNT]; SoundItem _sound[SOUND_COUNT]; MusicItem _music; @@ -81,18 +81,16 @@ private: void stopMusic(); void delMusic(); bool checkVoiceStatus(int voiceIndex); + bool loadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); void stopVoice(int voiceIndex); void playVoice(); void delWav(int wavIndex); void checkVoiceActivity(); Common::String setExtension(const Common::String &str, const Common::String &ext); Audio::RewindableAudioStream *makeSoundStream(Common::SeekableReadStream *stream); - - void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); - bool DEL_SAMPLE_SDL(int wavIndex); - bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); - void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); - void PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex); + bool removeWavSample(int wavIndex); + void loadWavSample(int wavIndex, const Common::String &filename, bool freeSample); + void playWavSample(int voiceIndex, int wavIndex); public: bool _musicOffFl; @@ -127,9 +125,9 @@ public: void syncSoundSettings(); bool mixVoice(int voiceId, int voiceMode); - void MODSetMusicVolume(int volume); - void MODSetSampleVolume(); - void MODSetVoiceVolume(); + void setMODMusicVolume(int volume); + void setMODSampleVolume(); + void setMODVoiceVolume(); void loadWav(const Common::String &file, int wavIndex); void playWav(int wavIndex); -- cgit v1.2.3 From 471b8af48272ce1d58d4ea7def63d6ce0526a30a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 17:07:29 +0100 Subject: HOPKINS: Some renaming in LinesManager, remove a couple of problematic asserts --- engines/hopkins/lines.cpp | 85 +++++++++++++++++++++++------------------------ engines/hopkins/lines.h | 4 +-- 2 files changed, 43 insertions(+), 46 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c51cf8e2e9..35c3fda7bd 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -34,17 +34,17 @@ namespace Hopkins { int LigneItem::appendToRouteInc(int from, int to, RouteItem *route, int index) { if (to == -1) to = _lineDataEndIdx; - assert(from <= to); + for (int i = from; i < to; ++i) - route[index++].set(_lineData[2*i], _lineData[2*i+1], field6); + route[index++].set(_lineData[2*i], _lineData[2*i+1], _directionRouteInc); return index; } int LigneItem::appendToRouteDec(int from, int to, RouteItem *route, int index) { if (from == -1) from = _lineDataEndIdx - 1; - assert(from >= to); + for (int i = from; i > to; --i) - route[index++].set(_lineData[2*i], _lineData[2*i+1], field8); + route[index++].set(_lineData[2*i], _lineData[2*i+1], _directionRouteDec); return index; } @@ -268,60 +268,60 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5 int v12 = (int)v37 / 1000; if (!v11) { if (v12 == -1) { - Ligne[idx].field6 = DIR_UP; - Ligne[idx].field8 = DIR_DOWN; + Ligne[idx]._directionRouteInc = DIR_UP; + Ligne[idx]._directionRouteDec = DIR_DOWN; } if (v12 == 1) { - Ligne[idx].field6 = DIR_DOWN; - Ligne[idx].field8 = DIR_UP; + Ligne[idx]._directionRouteInc = DIR_DOWN; + Ligne[idx]._directionRouteDec = DIR_UP; } } if (v11 == 1) { if (v12 == -1) { - Ligne[idx].field6 = DIR_UP_RIGHT; - Ligne[idx].field8 = DIR_DOWN_LEFT; + Ligne[idx]._directionRouteInc = DIR_UP_RIGHT; + Ligne[idx]._directionRouteDec = DIR_DOWN_LEFT; } if (!v12) { - Ligne[idx].field6 = DIR_RIGHT; - Ligne[idx].field8 = DIR_LEFT; + Ligne[idx]._directionRouteInc = DIR_RIGHT; + Ligne[idx]._directionRouteDec = DIR_LEFT; } if (v12 == 1) { - Ligne[idx].field6 = DIR_DOWN_RIGHT; - Ligne[idx].field8 = DIR_UP_LEFT; + Ligne[idx]._directionRouteInc = DIR_DOWN_RIGHT; + Ligne[idx]._directionRouteDec = DIR_UP_LEFT; } } if (v11 == -1) { if (v12 == 1) { - Ligne[idx].field6 = DIR_DOWN_LEFT; - Ligne[idx].field8 = DIR_UP_RIGHT; + Ligne[idx]._directionRouteInc = DIR_DOWN_LEFT; + Ligne[idx]._directionRouteDec = DIR_UP_RIGHT; } if (!v12) { - Ligne[idx].field6 = DIR_LEFT; - Ligne[idx].field8 = DIR_RIGHT; + Ligne[idx]._directionRouteInc = DIR_LEFT; + Ligne[idx]._directionRouteDec = DIR_RIGHT; } if (v12 == -1) { - Ligne[idx].field6 = DIR_UP_LEFT; - Ligne[idx].field8 = DIR_DOWN_RIGHT; + Ligne[idx]._directionRouteInc = DIR_UP_LEFT; + Ligne[idx]._directionRouteDec = DIR_DOWN_RIGHT; } } if (v11 == 1 && v37 > 250 && v37 <= 999) { - Ligne[idx].field6 = DIR_DOWN_RIGHT; - Ligne[idx].field8 = DIR_UP_LEFT; + Ligne[idx]._directionRouteInc = DIR_DOWN_RIGHT; + Ligne[idx]._directionRouteDec = DIR_UP_LEFT; } if (v11 == -1 && v37 > 250 && v37 <= 999) { - Ligne[idx].field6 = DIR_DOWN_LEFT; - Ligne[idx].field8 = DIR_UP_RIGHT; + Ligne[idx]._directionRouteInc = DIR_DOWN_LEFT; + Ligne[idx]._directionRouteDec = DIR_UP_RIGHT; } if (v11 == 1 && v37 < -250 && v37 > -1000) { - Ligne[idx].field6 = DIR_UP_RIGHT; - Ligne[idx].field8 = DIR_DOWN_LEFT; + Ligne[idx]._directionRouteInc = DIR_UP_RIGHT; + Ligne[idx]._directionRouteDec = DIR_DOWN_LEFT; } // This condition is impossible to meet! // Code present in the Linux and BeOS executables // CHECKME: maybe it should be checking negative values? if (v11 == -1 && v37 <= 249 && v37 > 1000) { - Ligne[idx].field6 = DIR_UP_LEFT; - Ligne[idx].field8 = DIR_DOWN_RIGHT; + Ligne[idx]._directionRouteInc = DIR_UP_LEFT; + Ligne[idx]._directionRouteDec = DIR_DOWN_RIGHT; } int v40 = v36 / v34; int v38 = 1000 * v33 / v34; @@ -446,8 +446,8 @@ void LinesManager::initRoute() { _lastLine = lineIdx; for (int idx = 1; idx < MAX_LINES; idx++) { if ((Ligne[idx]._lineDataEndIdx < _maxLineIdx) && (idx != _lastLine + 1)) { - Ligne[idx].field6 = Ligne[idx - 1].field6; - Ligne[idx].field8 = Ligne[idx - 1].field8; + Ligne[idx]._directionRouteInc = Ligne[idx - 1]._directionRouteInc; + Ligne[idx]._directionRouteDec = Ligne[idx - 1]._directionRouteDec; } } } @@ -1406,7 +1406,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { v119 = Ligne[v115]._lineData[2 * i]; v118 = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112].set(Ligne[v115]._lineData[2 * i], Ligne[v115]._lineData[2 * i + 1], Ligne[v115].field6); + super_parcours[v112].set(Ligne[v115]._lineData[2 * i], Ligne[v115]._lineData[2 * i + 1], Ligne[v115]._directionRouteInc); v112++; } for (int v116 = v115 + 1; v116 < v121; v116++) { @@ -1415,7 +1415,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { v119 = Ligne[v110]._lineData[2 * v72]; v118 = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112].set(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], Ligne[v110].field6); + super_parcours[v112].set(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], Ligne[v110]._directionRouteInc); v112++; if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); @@ -1458,14 +1458,14 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v119 = Ligne[v115]._lineData[2 * dataIdx]; v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; - super_parcours[v112].set(Ligne[v115]._lineData[2 * dataIdx], Ligne[v115]._lineData[2 * dataIdx + 1], Ligne[v115].field8); + super_parcours[v112].set(Ligne[v115]._lineData[2 * dataIdx], Ligne[v115]._lineData[2 * dataIdx + 1], Ligne[v115]._directionRouteDec); v112++; } for (int v117 = v115 - 1; v117 > v121; v117--) { for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { v119 = Ligne[v117]._lineData[2 * dataIdx]; v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112].set(Ligne[v117]._lineData[2 * dataIdx], Ligne[v117]._lineData[2 * dataIdx + 1], Ligne[v117].field8); + super_parcours[v112].set(Ligne[v117]._lineData[2 * dataIdx], Ligne[v117]._lineData[2 * dataIdx + 1], Ligne[v117]._directionRouteDec); v112++; if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); @@ -2186,10 +2186,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { v69 = v73; } if (v69 > v73) { - for (int k = v68; k > 0; --k) { - super_parcours[superRouteIdx].set(Ligne[v69]._lineData[2 * k], Ligne[v69]._lineData[2 * k + 1], Ligne[v69].field8); - superRouteIdx++; - } + superRouteIdx = Ligne[v69].appendToRouteDec(v68, 0, super_parcours, superRouteIdx); for (int l = v69 - 1; l > v73; --l) { if (PLAN_TEST(Ligne[l]._lineData[2 * Ligne[l]._lineDataEndIdx - 2], Ligne[l]._lineData[2 * Ligne[l]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { v69 = NV_LIGNEDEP; @@ -2504,9 +2501,9 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, *a3 = 1; int posX = lineData[2 * (lineDataEndIdx - 1)]; int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; - if (Ligne[idx].field6 == DIR_DOWN || Ligne[idx].field6 == DIR_UP) + if (Ligne[idx]._directionRouteInc == DIR_DOWN || Ligne[idx]._directionRouteInc == DIR_UP) posY += 2; - if (Ligne[idx].field6 == DIR_RIGHT || Ligne[idx].field8 == 7) + if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == 7) posX += 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2518,9 +2515,9 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, *a3 = 2; int posX = lineData[0]; int posY = lineData[1]; - if (Ligne[idx].field6 == DIR_DOWN || Ligne[idx].field6 == DIR_UP) + if (Ligne[idx]._directionRouteInc == DIR_DOWN || Ligne[idx]._directionRouteInc == DIR_UP) posY -= 2; - if (Ligne[idx].field6 == DIR_RIGHT || Ligne[idx].field8 == 7) + if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == 7) posX -= 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2809,8 +2806,8 @@ void LinesManager::clearAll() { for (int idx = 0; idx < MAX_LINES; ++idx) { Ligne[idx]._lineDataEndIdx = 0; Ligne[idx]._direction = DIR_NONE; - Ligne[idx].field6 = DIR_NONE; - Ligne[idx].field8 = DIR_NONE; + Ligne[idx]._directionRouteInc = DIR_NONE; + Ligne[idx]._directionRouteDec = DIR_NONE; Ligne[idx]._lineData = (int16 *)g_PTRNUL; _zoneLine[idx]._count = 0; diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 70fd5086bc..922a76d035 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -43,8 +43,8 @@ struct RouteItem; struct LigneItem { int _lineDataEndIdx; Directions _direction; - Directions field6; - Directions field8; + Directions _directionRouteInc; + Directions _directionRouteDec; int16 *_lineData; int appendToRouteInc(int from, int to, RouteItem *route, int index); -- cgit v1.2.3 From 7db7f8fff089b635e2bad7935f2fb0585e83aeb7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 17:13:06 +0100 Subject: HOPKINS: Regroup some IF statements in linesManager --- engines/hopkins/lines.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 35c3fda7bd..8b92095549 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1729,9 +1729,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (v22 == 1) { if (v100 >= -1000 && v100 <= -510) newDirection = DIR_UP_RIGHT; - if (v100 >= -510 && v100 <= 0) - newDirection = DIR_RIGHT; - if (v100 >= 0 && v100 <= 510) + if (v100 >= -510 && v100 <= 510) newDirection = DIR_RIGHT; if (v100 >= 510 && v100 <= 1000) newDirection = DIR_DOWN_RIGHT; @@ -1739,9 +1737,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (v96 == 1) { if (v102 >= 510 && v102 <= 1000) newDirection = DIR_DOWN_RIGHT; - if (v102 >= 0 && v102 <= 510) - newDirection = DIR_DOWN; - if (v102 >= -510 && v102 <= 0) + if (v102 >= -510 && v102 <= 510) newDirection = DIR_DOWN; if (v102 >= -1000 && v102 <= -510) newDirection = DIR_DOWN_LEFT; @@ -1749,9 +1745,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (v22 == -1) { if (v100 >= 510 && v100 <= 1000) newDirection = DIR_DOWN_LEFT; - if (v100 >= 0 && v100 <= 510) - newDirection = DIR_LEFT; - if (v100 >= -510 && v100 <= 0) + if (v100 >= -510 && v100 <= 510) newDirection = DIR_LEFT; if (v100 >= -1000 && v100 <= -510) newDirection = DIR_UP_LEFT; -- cgit v1.2.3 From 0f786d83a2a23b7bc1d3789fa5d06facb68f6465 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 18:06:05 +0100 Subject: HOPKINS: More renaming in LinesManager --- engines/hopkins/lines.cpp | 89 ++++++++++++++++++++------------------------- engines/hopkins/lines.h | 10 ++--- engines/hopkins/objects.cpp | 14 +++---- 3 files changed, 52 insertions(+), 61 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 8b92095549..bedf5db73f 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1510,7 +1510,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v112 = Ligne[v121].appendToRouteDec(v114, v120, super_parcours, v112); } } - if (PARC_PERS(super_parcours[v112 - 1]._X, super_parcours[v112 - 1]._Y, clipDestX, clipDestY, -1, -1, v112) != 1) { + if (PARC_PERS(super_parcours[v112 - 1]._x, super_parcours[v112 - 1]._y, clipDestX, clipDestY, -1, -1, v112) != 1) { super_parcours[v112].invalidate(); } @@ -1915,7 +1915,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (!v136) { if (a6 > foundLineIdx) { - if (essai0[0]._X != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { + if (essai0[0]._x != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; int i = 0; @@ -1926,7 +1926,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, NV_POSI = v137; return 2; } - if (essai1[0]._X != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { + if (essai1[0]._x != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; int i = 0; @@ -1937,7 +1937,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, NV_POSI = v137; return 2; } - if (essai2[0]._X != -1 && foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { + if (essai2[0]._x != -1 && foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { NV_LIGNEDEP = collLineIdx; NV_LIGNEOFS = collDataIdx; int i = 0; @@ -1956,7 +1956,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, v142 = 1300; if (collLineIdx == -1) v142 = 1300; - if (essai1[0]._X != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { + if (essai1[0]._x != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { NV_LIGNEDEP = v140; NV_LIGNEOFS = v141; int i = 0; @@ -1967,7 +1967,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, NV_POSI = v137; return 2; } - if (essai2[0]._X != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { + if (essai2[0]._x != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { NV_LIGNEDEP = collLineIdx; NV_LIGNEOFS = collDataIdx; int i = 0; @@ -1979,7 +1979,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, return 2; } // CHECKME: Checking essai0[0]._X might make more sense here? - if (essai1[0]._X != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { + if (essai1[0]._x != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { NV_LIGNEDEP = v142; NV_LIGNEOFS = v143; int i = 0; @@ -2133,8 +2133,8 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { int v27 = 0; int v28; for (;;) { - v28 = essai2[v27]._X; - int v29 = essai2[v27]._Y; + v28 = essai2[v27]._x; + int v29 = essai2[v27]._y; Directions v66 = essai2[v27]._dir; v27++; @@ -2545,55 +2545,46 @@ int LinesManager::CALC_PROPRE(int idx) { } void LinesManager::PACOURS_PROPRE(RouteItem *route) { - int v4; - int v5; - int v9; - int v10; - int v11; - int v12; - - int v1 = 0; - Directions v14 = DIR_NONE; - int v2 = route[0]._Y; - Directions v15 = route[0]._dir; - if (route[0]._X == -1 && v2 == -1) + int routeIdx = 0; + Directions oldDir = DIR_NONE; + int route0Y = route[0]._y; + Directions curDir = route[0]._dir; + if (route[0]._x == -1 && route0Y == -1) return; for (;;) { - if (v14 != -1 && v15 != v14) { - v11 = v1; - v12 = 0; - v10 = CALC_PROPRE(v2); - v4 = route[v1]._X; - v9 = route[v1]._X; - v5 = route[v1]._Y; - while (v4 != -1 || v5 != -1) { - int idx = v1; - v1++; - ++v12; - if (route[idx]._dir != v15) + if (oldDir != DIR_NONE && curDir != oldDir) { + int oldRouteIdx = routeIdx; + int routeCount = 0; + int v10 = CALC_PROPRE(route0Y); + int curRouteX = route[routeIdx]._x; + int curRouteY = route[routeIdx]._y; + while (curRouteX != -1 || curRouteY != -1) { + int idx = routeIdx; + ++routeIdx; + ++routeCount; + if (route[idx]._dir != curDir) break; - v4 = route[v1]._X; - v9 = route[v1]._X; - v5 = route[v1]._Y; + curRouteX = route[routeIdx]._x; + curRouteY = route[routeIdx]._y; } - if (v12 < v10) { - int v7 = v11; - for (int v8 = 0; v8 < v12; v8++) { - route[v7]._dir = v14; - v7++; + if (routeCount < v10) { + int idx = oldRouteIdx; + for (int i = 0; i < routeCount; i++) { + route[idx]._dir = oldDir; + idx++; } - v15 = v14; + curDir = oldDir; } - v1 = v11; - if (v9 == -1 && v5 == -1) + routeIdx = oldRouteIdx; + if (curRouteX == -1 && curRouteY == -1) break; } - v1++; - v14 = v15; - v2 = route[v1]._Y; - v15 = route[v1]._dir; - if (route[v1]._X == -1 && v2 == -1) + routeIdx++; + oldDir = curDir; + route0Y = route[routeIdx]._y; + curDir = route[routeIdx]._dir; + if (route[routeIdx]._x == -1 && route0Y == -1) break; } } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 922a76d035..e38ce6a6b0 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -91,12 +91,12 @@ struct ZonePItem { }; struct RouteItem { - int16 _X; - int16 _Y; + int16 _x; + int16 _y; Directions _dir; - bool isValid() const { return _X != -1 || _Y != -1; } - void invalidate() { _X = _Y = -1; _dir = DIR_NONE; } - void set(int16 X, int16 Y, Directions dir) { _X = X; _Y = Y; _dir = dir; } + bool isValid() const { return _x != -1 || _y != -1; } + void invalidate() { _x = _y = -1; _dir = DIR_NONE; } + void set(int16 X, int16 Y, Directions dir) { _x = X; _y = Y; _dir = dir; } }; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 4142913950..0507d723ca 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1292,8 +1292,8 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == DIR_NONE) { computeAndSetSpriteSize(); - newPosX = _vm->_linesManager._route->_X; - newPosY = _vm->_linesManager._route->_Y; + newPosX = _vm->_linesManager._route->_x; + newPosY = _vm->_linesManager._route->_y; newDirection = _vm->_linesManager._route->_dir; _vm->_linesManager._route++; @@ -1518,8 +1518,8 @@ void ObjectsManager::GOHOME() { } bool loopCond = false; do { - newPosX = _vm->_linesManager._route->_X; - newPosY = _vm->_linesManager._route->_Y; + newPosX = _vm->_linesManager._route->_x; + newPosY = _vm->_linesManager._route->_y; newDirection = (Directions)_vm->_linesManager._route->_dir; _vm->_linesManager._route++; @@ -1603,8 +1603,8 @@ void ObjectsManager::GOHOME2() { int countColisionPixel = 0; for (;;) { - int nexPosX = _vm->_linesManager._route->_X; - int newPosY = _vm->_linesManager._route->_Y; + int nexPosX = _vm->_linesManager._route->_x; + int newPosY = _vm->_linesManager._route->_y; Directions newDirection = (Directions)_vm->_linesManager._route->_dir; _vm->_linesManager._route++; @@ -1883,7 +1883,7 @@ void ObjectsManager::handleLeftButton() { do { _vm->_linesManager.essai2[routeIdx] = _vm->_linesManager._route[routeIdx]; ++routeIdx; - } while (_vm->_linesManager._route[routeIdx]._X != -1); + } while (_vm->_linesManager._route[routeIdx]._x != -1); _vm->_linesManager.essai2[routeIdx].invalidate();; } -- cgit v1.2.3 From 213914c04538ce636007a1cd895f56ee56db3aca Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 21:12:57 +0100 Subject: HOPKINS: Some renaming in Globals --- engines/hopkins/globals.cpp | 14 ++++++------- engines/hopkins/globals.h | 10 ++++----- engines/hopkins/hopkins.cpp | 50 ++++++++++++++++++++++----------------------- engines/hopkins/lines.cpp | 10 ++++----- engines/hopkins/objects.cpp | 22 ++++++++++---------- engines/hopkins/script.cpp | 4 ++-- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index f08dd59db6..340b40ed46 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -126,15 +126,15 @@ Globals::Globals() { _menuDisplayType = 0; _sortedDisplayCount = 0; NOT_VERIF = false; - PERSO_TYPE = 0; + _characterType = 0; GOACTION = false; Compteur = 0; _actionDirection = DIR_NONE; - Credit_bx = -1; - Credit_bx1 = -1; - Credit_by = -1; - Credit_by1 = -1; + _creditsStartX = -1; + _creditsEndX = -1; + _creditsStartY = -1; + _creditsEndY = -1; _creditsPosY = 0; _creditsLineNumb = 0; memset(_creditsItem, 0, 12000); @@ -269,10 +269,10 @@ void Globals::clearAll() { } void Globals::loadCharacterData() { - assert(PERSO_TYPE >= 0 && PERSO_TYPE <= 2); + assert(_characterType >= 0 && _characterType <= 2); const int *srcList[] = { HOPKINS_PERSO_0, HOPKINS_PERSO_1, HOPKINS_PERSO_2 }; - const int *srcP = srcList[PERSO_TYPE]; + const int *srcP = srcList[_characterType]; for (int idx = 0; idx < 240 / 4; ++idx) { Hopkins[idx].field0 = *srcP++; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 7e063bf38c..241beb5a8e 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -269,6 +269,7 @@ public: int _sortedDisplayCount; int _oldMouseZoneId; int _oldMouseX, _oldMouseY; + int _characterType; uint _speed; byte *_answerBuffer; Sauvegarde *_saveData; @@ -280,10 +281,10 @@ public: int _creditsLineNumb; int _creditsStep; int _creditsPosY; - int Credit_bx; - int Credit_bx1; - int Credit_by; - int Credit_by1; + int _creditsStartX; + int _creditsEndX; + int _creditsStartY; + int _creditsEndY; int _menuSpeed; int _menuSoundOff; @@ -310,7 +311,6 @@ public: BqeAnimItem Bqe_Anim[35]; byte *SPRITE_ECRAN; byte *PERSO; - int PERSO_TYPE; bool NOT_VERIF; ObjetWItem ObjetW[300]; int NUM_FICHIER_OBJ; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 1a4d497ef3..ded9be606d 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -150,7 +150,7 @@ bool HopkinsEngine::runWin95Demo() { _graphicsManager.fadeOutLong(); _globals.iRegul = 1; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); - _globals.PERSO_TYPE = 0; + _globals._characterType = 0; _objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -440,7 +440,7 @@ bool HopkinsEngine::runLinuxDemo() { _globals.iRegul = 0; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); - _globals.PERSO_TYPE = 0; + _globals._characterType = 0; _objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); _globals._exitId = 0; @@ -798,7 +798,7 @@ bool HopkinsEngine::runFull() { } _globals.iRegul = 0; _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); - _globals.PERSO_TYPE = 0; + _globals._characterType = 0; _objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0; memset(_globals._saveData, 0, 2000); @@ -1517,7 +1517,7 @@ bool HopkinsEngine::runFull() { //_globals._exitId = WBASE(); // Handles the 3D Doom level (Windows) _soundManager.stopSound(); _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); - _globals.PERSO_TYPE = 0; + _globals._characterType = 0; _globals.iRegul = 0; _graphicsManager._lineNbr = SCREEN_WIDTH; break; @@ -2189,7 +2189,7 @@ void HopkinsEngine::playEnding() { _globals._exitId = 300; } _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); - _globals.PERSO_TYPE = 0; + _globals._characterType = 0; _globals.iRegul = 0; } @@ -2434,20 +2434,20 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char colour) { int startPosX = 320 - strWidth / 2; int endPosX = strWidth + startPosX; int endPosY = startPosY + 12; - if ((_globals.Credit_bx == -1) && (_globals.Credit_bx1 == -1) && (_globals.Credit_by == -1) && (_globals.Credit_by1 == -1)) { - _globals.Credit_bx = startPosX; - _globals.Credit_bx1 = endPosX; - _globals.Credit_by = startPosY; - _globals.Credit_by1 = endPosY; + if ((_globals._creditsStartX == -1) && (_globals._creditsEndX == -1) && (_globals._creditsStartY == -1) && (_globals._creditsEndY == -1)) { + _globals._creditsStartX = startPosX; + _globals._creditsEndX = endPosX; + _globals._creditsStartY = startPosY; + _globals._creditsEndY = endPosY; } - if (startPosX < _globals.Credit_bx) - _globals.Credit_bx = startPosX; - if (endPosX > _globals.Credit_bx1) - _globals.Credit_bx1 = endPosX; - if (_globals.Credit_by > startPosY) - _globals.Credit_by = startPosY; - if (endPosY > _globals.Credit_by1) - _globals.Credit_by1 = endPosY; + if (startPosX < _globals._creditsStartX) + _globals._creditsStartX = startPosX; + if (endPosX > _globals._creditsEndX) + _globals._creditsEndX = endPosX; + if (_globals._creditsStartY > startPosY) + _globals._creditsStartY = startPosY; + if (endPosY > _globals._creditsEndY) + _globals._creditsEndY = endPosY; bufPtr = buffer; for (;;) { @@ -2469,7 +2469,7 @@ void HopkinsEngine::displayCredits() { _soundManager.playSound(28); _eventsManager._mouseFl = false; _globals.iRegul = 3; - _globals.Credit_bx = _globals.Credit_bx1 = _globals.Credit_by = _globals.Credit_by1 = -1; + _globals._creditsStartX = _globals._creditsEndX = _globals._creditsStartY = _globals._creditsEndY = -1; int soundId = 28; do { for (int i = 0; i < _globals._creditsLineNumb; ++i) { @@ -2500,7 +2500,7 @@ void HopkinsEngine::displayCredits() { } } --_globals._creditsPosY; - if (_globals.Credit_bx != -1 || _globals.Credit_bx1 != -1 || _globals.Credit_by != -1 || _globals.Credit_by1 != -1) { + if (_globals._creditsStartX != -1 || _globals._creditsEndX != -1 || _globals._creditsStartY != -1 || _globals._creditsEndY != -1) { _eventsManager.VBL(); _graphicsManager.copySurface(_graphicsManager._vesaScreen, 60, 50, 520, 380, _graphicsManager._vesaBuffer, 60, 50); } else { @@ -2513,10 +2513,10 @@ void HopkinsEngine::displayCredits() { soundId = 28; _soundManager.playSound(soundId); } - _globals.Credit_bx = -1; - _globals.Credit_bx1 = -1; - _globals.Credit_by = -1; - _globals.Credit_by1 = -1; + _globals._creditsStartX = -1; + _globals._creditsEndX = -1; + _globals._creditsStartY = -1; + _globals._creditsEndY = -1; } while ((_eventsManager.getMouseButton() != 1) && (!g_system->getEventManager()->shouldQuit())); _graphicsManager.fadeOutLong(); _globals.iRegul = 1; @@ -2829,7 +2829,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Di _objectsManager.removeSprite(0); _objectsManager.clearScreen(); _globals.PERSO = _fileManager.loadFile("PERSO.SPR"); - _globals.PERSO_TYPE = 0; + _globals._characterType = 0; } void HopkinsEngine::syncSoundSettings() { diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index bedf5db73f..f63b4a2adc 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2497,7 +2497,7 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; if (Ligne[idx]._directionRouteInc == DIR_DOWN || Ligne[idx]._directionRouteInc == DIR_UP) posY += 2; - if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == 7) + if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == DIR_LEFT) posX += 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2511,7 +2511,7 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int posY = lineData[1]; if (Ligne[idx]._directionRouteInc == DIR_DOWN || Ligne[idx]._directionRouteInc == DIR_UP) posY -= 2; - if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == 7) + if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == DIR_LEFT) posX -= 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2524,18 +2524,18 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, } int LinesManager::CALC_PROPRE(int idx) { - int retVal = 25; int size = _vm->_globals._spriteSize[idx]; - if (_vm->_globals.PERSO_TYPE == 1) { + if (_vm->_globals._characterType == 1) { if (size < 0) size = -size; size = 20 * (5 * size - 100) / -80; - } else if (_vm->_globals.PERSO_TYPE == 2) { + } else if (_vm->_globals._characterType == 2) { if (size < 0) size = -size; size = 20 * (5 * size - 165) / -67; } + int retVal = 25; if (size < 0) retVal = _vm->_graphicsManager.zoomOut(25, -size); else if (size > 0) diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 0507d723ca..575c34caa7 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2130,7 +2130,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_realHopkins; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); - _vm->_globals.PERSO_TYPE = 0; + _vm->_globals._characterType = 0; addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, false, 34, 190); animateSprite(0); _vm->_globals.loadCharacterData(); @@ -2155,7 +2155,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha loc = &_vm->_globals._saveData->_samantha; _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); - _vm->_globals.PERSO_TYPE = 2; + _vm->_globals._characterType = 2; addStaticSprite(_vm->_globals.PERSO, loc->_pos, 0, 64, loc->_zoomFactor, false, 20, 127); animateSprite(0); _vm->_globals.loadCharacterData(); @@ -2218,9 +2218,9 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha // Check Size void ObjectsManager::computeAndSetSpriteSize() { int size = _vm->_globals._spriteSize[getSpriteY(0)]; - if (_vm->_globals.PERSO_TYPE == 1) { + if (_vm->_globals._characterType == 1) { size = 20 * (5 * abs(size) - 100) / -80; - } else if (_vm->_globals.PERSO_TYPE == 2) { + } else if (_vm->_globals._characterType == 2) { size = 20 * (5 * abs(size) - 165) / -67; } setSpriteZoom(0, size); @@ -3799,24 +3799,24 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0); - if (_vm->_globals.PERSO_TYPE) { + if (_vm->_globals._characterType) { if (!_vm->_globals._saveData->_data[svField122] && !_vm->_globals._saveData->_data[svField356]) { _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); - _vm->_globals.PERSO_TYPE = 0; + _vm->_globals._characterType = 0; } } - if (!_vm->_globals.PERSO_TYPE) { + if (!_vm->_globals._characterType) { if (_vm->_globals._saveData->_data[svField122] == 1) { _vm->_globals.PERSO = _vm->_fileManager.loadFile("HOPFEM.SPR"); - _vm->_globals.PERSO_TYPE = 1; + _vm->_globals._characterType = 1; } } - if (_vm->_globals.PERSO_TYPE != 2 && _vm->_globals._saveData->_data[svField356] == 1) { + if (_vm->_globals._characterType != 2 && _vm->_globals._saveData->_data[svField356] == 1) { _vm->_globals.PERSO = _vm->_fileManager.loadFile("PSAMAN.SPR"); - _vm->_globals.PERSO_TYPE = 2; + _vm->_globals._characterType = 2; } _vm->_globals.loadCharacterData(); - switch (_vm->_globals.PERSO_TYPE) { + switch (_vm->_globals._characterType) { case 0: addStaticSprite(_vm->_globals.PERSO, _characterPos, 0, _startSpriteIndex, 0, false, 34, 190); break; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index cf2b61c8bf..ea0c728c49 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -926,7 +926,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 56: _vm->_globals.PERSO = _vm->_fileManager.loadFile("HOPFEM.SPR"); - _vm->_globals.PERSO_TYPE = 1; + _vm->_globals._characterType = 1; _vm->_globals._saveData->_data[svField122] = 1; _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 28; @@ -936,7 +936,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 57: _vm->_globals.PERSO = _vm->_fileManager.loadFile("PERSO.SPR"); - _vm->_globals.PERSO_TYPE = 0; + _vm->_globals._characterType = 0; _vm->_globals._saveData->_data[svField122] = 0; _vm->_globals.loadCharacterData(); _vm->_objectsManager._sprite[0].field12 = 34; -- cgit v1.2.3 From 9aa7e136f85073b16542f67d5b1fd696eff77fa6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Feb 2013 23:18:43 +0100 Subject: HOPKINS: Some more renaming in TalkManager and Globals --- engines/hopkins/globals.cpp | 6 +- engines/hopkins/globals.h | 6 +- engines/hopkins/hopkins.cpp | 14 ++-- engines/hopkins/lines.cpp | 16 ++--- engines/hopkins/objects.cpp | 38 +++++------ engines/hopkins/script.cpp | 152 ++++++++++++++++++++++---------------------- engines/hopkins/talk.cpp | 27 ++++---- engines/hopkins/talk.h | 6 +- 8 files changed, 135 insertions(+), 130 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 340b40ed46..2e24ac5c7a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -90,7 +90,7 @@ Globals::Globals() { for (int i = 0; i < 500; ++i) _spriteSize[i] = 0; for (int i = 0; i < 70; ++i) - Common::fill((byte *)&Hopkins[i], (byte *)&Hopkins[i] + sizeof(HopkinsItem), 0); + Common::fill((byte *)&_hopkinsItem[i], (byte *)&_hopkinsItem[i] + sizeof(HopkinsItem), 0); for (int i = 0; i < 36; ++i) _inventory[i] = 0; @@ -275,8 +275,8 @@ void Globals::loadCharacterData() { const int *srcP = srcList[_characterType]; for (int idx = 0; idx < 240 / 4; ++idx) { - Hopkins[idx].field0 = *srcP++; - Hopkins[idx].field2 = *srcP++; + _hopkinsItem[idx]._speedX = *srcP++; + _hopkinsItem[idx]._speedY = *srcP++; } _oldFrameIndex = -1; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 241beb5a8e..6ac029d963 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -107,8 +107,8 @@ struct CacheItem { }; struct HopkinsItem { - int field0; - int field2; + int _speedX; + int _speedY; }; struct CharacterLocation { @@ -274,7 +274,7 @@ public: byte *_answerBuffer; Sauvegarde *_saveData; Language _language; - HopkinsItem Hopkins[70]; + HopkinsItem _hopkinsItem[70]; SortItem _sortedDisplay[51]; CreditItem _creditsItem[200]; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ded9be606d..fd937e3ad1 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1884,7 +1884,7 @@ void HopkinsEngine::bombExplosion() { } _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO2("vire.pe2"); + _talkManager.startStaticCharacterDialogue("vire.pe2"); _globals._introSpeechOffFl = false; _objectsManager.setBobAnimation(7); @@ -1953,7 +1953,7 @@ void HopkinsEngine::handleConflagration() { _eventsManager.VBL(); _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO("SVGARD1.pe2"); + _talkManager.startAnimatedCharacterDialogue("SVGARD1.pe2"); _globals._introSpeechOffFl = false; for (int cpt = 0; cpt <= 49; cpt++) @@ -2078,7 +2078,7 @@ void HopkinsEngine::playEnding() { while (_objectsManager.getBobAnimDataIdx(6) != 54); _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO("GM4.PE2"); + _talkManager.startAnimatedCharacterDialogue("GM4.PE2"); _globals._disableInventFl = true; _objectsManager.stopBobAnimation(6); _objectsManager.stopBobAnimation(10); @@ -2096,7 +2096,7 @@ void HopkinsEngine::playEnding() { while (_objectsManager.getBobAnimDataIdx(7) != 65); _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO("DUELB4.PE2"); + _talkManager.startAnimatedCharacterDialogue("DUELB4.PE2"); _eventsManager.mouseOff(); _globals._disableInventFl = true; @@ -2105,14 +2105,14 @@ void HopkinsEngine::playEnding() { while (_objectsManager.getBobAnimDataIdx(7) != 72); _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO("DUELH1.PE2"); + _talkManager.startAnimatedCharacterDialogue("DUELH1.PE2"); do _eventsManager.VBL(); while (_objectsManager.getBobAnimDataIdx(7) != 81); _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO("DUELB5.PE2"); + _talkManager.startAnimatedCharacterDialogue("DUELB5.PE2"); do _eventsManager.VBL(); @@ -2163,7 +2163,7 @@ void HopkinsEngine::playEnding() { _objectsManager.stopBobAnimation(7); _objectsManager.setBobAnimation(8); _globals._introSpeechOffFl = true; - _talkManager.PARLER_PERSO("GM5.PE2"); + _talkManager.startAnimatedCharacterDialogue("GM5.PE2"); _globals._disableInventFl = true; do diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index f63b4a2adc..912980ce69 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2261,8 +2261,8 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { int smoothIdx = 0; int stepCount = 0; while (curX > destX && destY > curY) { - int v25 = _vm->_globals.Hopkins[hopkinsIdx].field0; - int v40 = _vm->_globals.Hopkins[hopkinsIdx].field2; + int v25 = _vm->_globals._hopkinsItem[hopkinsIdx]._speedX; + int v40 = _vm->_globals._hopkinsItem[hopkinsIdx]._speedY; int spriteSize = _vm->_globals._spriteSize[curY]; if (spriteSize < 0) { v25 = _vm->_graphicsManager.zoomOut(v25, -spriteSize); @@ -2295,8 +2295,8 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { int smoothIdx = 0; int stepCount = 0; while (curX < destX && destY > curY) { - int v14 = _vm->_globals.Hopkins[hopkinsIdx].field0; - int v39 = _vm->_globals.Hopkins[hopkinsIdx].field2; + int v14 = _vm->_globals._hopkinsItem[hopkinsIdx]._speedX; + int v39 = _vm->_globals._hopkinsItem[hopkinsIdx]._speedY; int spriteSize = _vm->_globals._spriteSize[curY]; if (spriteSize < 0) { v14 = _vm->_graphicsManager.zoomOut(v14, -spriteSize); @@ -2329,8 +2329,8 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { int smoothIdx = 0; int stepCount = 0; while (curX > destX && destY < curY) { - int v11 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field0, 25); - int v38 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field2, 25); + int v11 = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedX, 25); + int v38 = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedY, 25); int oldY = curY; for (int v12 = 0; v12 < v11; v12++) { --curX; @@ -2357,8 +2357,8 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) { int stepCount = 0; while (curX < destX && destY < curY) { int oldY = curY; - int v7 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field0, 25); - int v37 = _vm->_graphicsManager.zoomOut(_vm->_globals.Hopkins[hopkinsIdx].field2, 25); + int v7 = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedX, 25); + int v37 = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedY, 25); for (int i = 0; i < v7; i++) { ++curX; _smoothRoute[smoothIdx]._posX = curX; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 575c34caa7..db9020b455 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1339,8 +1339,8 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 24; } else { - int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedX; + int deltaY = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); @@ -1363,8 +1363,8 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 24; } else { - int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedX; + int deltaY = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1386,7 +1386,7 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 0; } else { - int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); + int deltaY = abs(_vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY); if (_sprite[0]._zoomFactor < 0) { deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1407,7 +1407,7 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 48; } else { - int deltaY = abs(_vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2); + int deltaY = abs(_vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY); if (_sprite[0]._zoomFactor < 0) { deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1427,8 +1427,8 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 12; } else { - int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedX; + int deltaY = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1451,8 +1451,8 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 12; } else { - int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedX; + int deltaY = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1474,8 +1474,8 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 36; } else { - int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedX; + int deltaY = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1498,8 +1498,8 @@ void ObjectsManager::GOHOME() { oldPosY = _oldCharacterPosY; oldFrameIdx = 36; } else { - int deltaX = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field0; - int deltaY = _vm->_globals.Hopkins[_vm->_globals._oldFrameIndex].field2; + int deltaX = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedX; + int deltaY = _vm->_globals._hopkinsItem[_vm->_globals._oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager.zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager.zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1792,14 +1792,14 @@ void ObjectsManager::handleCityMap() { if (_vm->_globals._saveData->_data[svField170] == 1 && !_vm->_globals._saveData->_data[svField171]) { _vm->_globals._saveData->_data[svField171] = 1; _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("APPEL1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("APPEL1.pe2"); _vm->_globals._introSpeechOffFl = false; mouseButton = 0; } if (_vm->_globals._saveData->_data[svField80] == 1 && !_vm->_globals._saveData->_data[svField172]) { _vm->_globals._saveData->_data[svField172] = 1; _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("APPEL2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("APPEL2.pe2"); _vm->_globals._introSpeechOffFl = false; mouseButton = 0; _vm->_eventsManager._curMouseButton = 0; @@ -2587,7 +2587,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_globals._saveData->_data[svField173] = 1; _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("flicspe1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("flicspe1.pe2"); _vm->_globals._introSpeechOffFl = false; if (_vm->_globals._censorshipFl) @@ -2698,7 +2698,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_eventsManager.VBL(); while (getBobAnimDataIdx(8) != 3); _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("GM3.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("GM3.PE2"); stopBobAnimation(8); _vm->_globals._saveData->_data[svField333] = 1; _vm->_globals._disableInventFl = false; @@ -3259,7 +3259,7 @@ void ObjectsManager::SPECIAL_INI() { _vm->_globals._disableInventFl = false; _vm->_graphicsManager._noFadingFl = true; _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("MAGE1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MAGE1.pe2"); _vm->_graphicsManager._noFadingFl = true; _vm->_globals._disableInventFl = false; } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index ea0c728c49..1d12cf1d0f 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -513,26 +513,26 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 7: - _vm->_talkManager.PARLER_PERSO("rueh1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("rueh1.pe2"); break; case 8: - _vm->_talkManager.PARLER_PERSO("ruef1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("ruef1.pe2"); break; case 10: - _vm->_talkManager.PARLER_PERSO("bqeflic1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("bqeflic1.pe2"); break; case 11: - _vm->_talkManager.PARLER_PERSO("bqeflic2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("bqeflic2.pe2"); break; case 12: _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); - _vm->_talkManager.PARLER_PERSO("bqetueur.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("bqetueur.pe2"); break; case 13: @@ -617,56 +617,56 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 16: - _vm->_talkManager.PARLER_PERSO("ftoubib.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("ftoubib.pe2"); break; case 17: - _vm->_talkManager.PARLER_PERSO("flic2b.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("flic2b.pe2"); break; case 18: - _vm->_talkManager.PARLER_PERSO("fjour.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("fjour.pe2"); break; case 20: - _vm->_talkManager.PARLER_PERSO("PUNK.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("PUNK.pe2"); break; case 21: - _vm->_talkManager.PARLER_PERSO("MEDLEG.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MEDLEG.pe2"); break; case 22: - _vm->_talkManager.OBJET_VIVANT("CADAVRE1.pe2"); + _vm->_talkManager.animateObject("CADAVRE1.pe2"); break; case 23: - _vm->_talkManager.PARLER_PERSO2("CHERCHE1.pe2"); + _vm->_talkManager.startStaticCharacterDialogue("CHERCHE1.pe2"); break; case 25: - _vm->_talkManager.PARLER_PERSO("AGENT1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("AGENT1.pe2"); break; case 26: - _vm->_talkManager.PARLER_PERSO("AGENT2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("AGENT2.pe2"); break; case 27: if (_vm->_globals._saveData->_data[svField94] != 1 || _vm->_globals._saveData->_data[svField95] != 1) - _vm->_talkManager.PARLER_PERSO("STANDAR.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("STANDAR.pe2"); else - _vm->_talkManager.PARLER_PERSO("STANDAR1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("STANDAR1.pe2"); break; case 29: _vm->_globals._disableInventFl = true; - _vm->_talkManager.OBJET_VIVANT("TELEP.pe2"); + _vm->_talkManager.animateObject("TELEP.pe2"); _vm->_globals._disableInventFl = false; break; case 32: - _vm->_talkManager.PARLER_PERSO("SAMAN.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("SAMAN.pe2"); break; case 35: @@ -678,22 +678,22 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_soundManager._soundFl); } - _vm->_talkManager.PARLER_PERSO("PTLAB.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("PTLAB.pe2"); break; case 36: if (_vm->_globals._saveData->_data[svField270] == 2 && _vm->_globals._saveData->_data[svField94] == 1 && _vm->_globals._saveData->_data[svField95] == 1) _vm->_globals._saveData->_data[svField270] = 3; if (!_vm->_globals._saveData->_data[svField270]) - _vm->_talkManager.PARLER_PERSO2("PATRON0.pe2"); + _vm->_talkManager.startStaticCharacterDialogue("PATRON0.pe2"); if (_vm->_globals._saveData->_data[svField270] == 1) - _vm->_talkManager.PARLER_PERSO2("PATRON1.pe2"); + _vm->_talkManager.startStaticCharacterDialogue("PATRON1.pe2"); if (_vm->_globals._saveData->_data[svField270] == 2) - _vm->_talkManager.PARLER_PERSO2("PATRON2.pe2"); + _vm->_talkManager.startStaticCharacterDialogue("PATRON2.pe2"); if (_vm->_globals._saveData->_data[svField270] == 3) - _vm->_talkManager.PARLER_PERSO2("PATRON3.pe2"); + _vm->_talkManager.startStaticCharacterDialogue("PATRON3.pe2"); if (_vm->_globals._saveData->_data[svField270] > 3) { - _vm->_talkManager.PARLER_PERSO2("PATRON4.pe2"); + _vm->_talkManager.startStaticCharacterDialogue("PATRON4.pe2"); _vm->_globals._saveData->_data[svField270] = 5; } break; @@ -720,27 +720,27 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 40: - _vm->_talkManager.PARLER_PERSO("MAGE.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MAGE.pe2"); break; case 41: - _vm->_talkManager.PARLER_PERSO("MORT3.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MORT3.pe2"); break; case 42: - _vm->_talkManager.PARLER_PERSO("MORT2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MORT2.pe2"); break; case 43: - _vm->_talkManager.PARLER_PERSO("MORT1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MORT1.pe2"); break; case 44: - _vm->_talkManager.PARLER_PERSO("MORT3A.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("MORT3A.pe2"); break; case 45: - _vm->_talkManager.PARLER_PERSO("FEM3.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("FEM3.pe2"); break; case 46: { @@ -818,11 +818,11 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 47: - _vm->_talkManager.PARLER_PERSO("BARMAN.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("BARMAN.pe2"); break; case 48: - _vm->_talkManager.PARLER_PERSO("SAMAN2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("SAMAN2.pe2"); break; case 49: { @@ -903,16 +903,16 @@ int ScriptManager::handleOpcode(byte *dataP) { case 52: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("GARDE.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("GARDE.PE2"); _vm->_globals._introSpeechOffFl = false; break; case 53: - _vm->_talkManager.PARLER_PERSO("GARDE1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("GARDE1.pe2"); break; case 54: - _vm->_talkManager.PARLER_PERSO("GARDE2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("GARDE2.pe2"); break; case 55: @@ -946,7 +946,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 58: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("Gm1.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("Gm1.PE2"); _vm->_globals._saveData->_data[svField176] = 1; _vm->_globals._saveData->_data[svField270] = 2; _vm->_globals._introSpeechOffFl = false; @@ -1002,11 +1002,11 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 62: - _vm->_talkManager.OBJET_VIVANT("SBCADA.pe2"); + _vm->_talkManager.animateObject("SBCADA.pe2"); break; case 65: - _vm->_talkManager.OBJET_VIVANT("ScCADA.pe2"); + _vm->_talkManager.animateObject("ScCADA.pe2"); break; case 80: { @@ -1117,12 +1117,12 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 83: - _vm->_talkManager.PARLER_PERSO("CVIGIL.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("CVIGIL.pe2"); break; case 84: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("CVIGIL1.PE2"); _vm->_globals._introSpeechOffFl = false; break; @@ -1145,19 +1145,19 @@ int ScriptManager::handleOpcode(byte *dataP) { case 86: if (_vm->_globals._saveData->_data[svField231] == 1) { - _vm->_talkManager.PARLER_PERSO("chotess1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("chotess1.pe2"); } else { _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("chotesse.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("chotesse.pe2"); _vm->_globals._introSpeechOffFl = false; } break; case 87: if (_vm->_globals._saveData->_data[svField188]) - _vm->_talkManager.PARLER_PERSO("stand2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("stand2.pe2"); else - _vm->_talkManager.PARLER_PERSO("stand1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("stand1.pe2"); break; case 88: @@ -1301,9 +1301,9 @@ int ScriptManager::handleOpcode(byte *dataP) { case 94: if (!_vm->_globals._saveData->_data[svField228]) - _vm->_talkManager.PARLER_PERSO("flicn.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("flicn.pe2"); if (_vm->_globals._saveData->_data[svField228] == 1) - _vm->_talkManager.PARLER_PERSO("flicn1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("flicn1.pe2"); break; case 95: @@ -1337,35 +1337,35 @@ int ScriptManager::handleOpcode(byte *dataP) { case 98: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("CVIGIL2.PE2"); _vm->_globals._introSpeechOffFl = false; break; case 100: - _vm->_talkManager.PARLER_PERSO("tourist.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("tourist.pe2"); break; case 101: - _vm->_talkManager.PARLER_PERSO("tahi1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("tahi1.pe2"); break; case 103: // Dice game _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("tourist1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("tourist1.pe2"); _vm->_globals._introSpeechOffFl = false; _vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("tourist2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("tourist2.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 104: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("tourist3.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("tourist3.pe2"); _vm->_globals._introSpeechOffFl = false; break; @@ -1565,57 +1565,57 @@ int ScriptManager::handleOpcode(byte *dataP) { case 108: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("peche1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("peche1.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 109: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("peche2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("peche2.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 110: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("peche3.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("peche3.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 111: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("peche4.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("peche4.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 112: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("teint1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("teint1.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 113: - _vm->_talkManager.PARLER_PERSO("teint.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("teint.pe2"); break; case 114: - _vm->_talkManager.PARLER_PERSO("tahibar.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("tahibar.pe2"); break; case 115: - _vm->_talkManager.PARLER_PERSO("ilebar.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("ilebar.pe2"); break; case 116: - _vm->_talkManager.PARLER_PERSO("Profred.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("Profred.pe2"); break; case 170: - _vm->_talkManager.PARLER_PERSO("GRED.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("GRED.pe2"); break; case 171: { _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("gred1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("gred1.pe2"); _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); @@ -1638,12 +1638,12 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 172: - _vm->_talkManager.PARLER_PERSO("GBLEU.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("GBLEU.pe2"); break; case 173: { _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("gbleu1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("gbleu1.pe2"); _vm->_globals._introSpeechOffFl = false; _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); @@ -1666,7 +1666,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 174: - _vm->_talkManager.PARLER_PERSO("Profbl.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("Profbl.pe2"); break; case 175: @@ -1718,19 +1718,19 @@ int ScriptManager::handleOpcode(byte *dataP) { case 176: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("gred2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("gred2.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 177: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("gbleu2.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("gbleu2.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 200: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("Gm2.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("Gm2.PE2"); _vm->_globals._introSpeechOffFl = false; break; @@ -1748,7 +1748,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 202: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("SVGARD2.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("SVGARD2.PE2"); _vm->_globals._introSpeechOffFl = false; break; @@ -1812,7 +1812,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 207: - _vm->_talkManager.OBJET_VIVANT("PANNEAU.PE2"); + _vm->_talkManager.animateObject("PANNEAU.PE2"); break; case 208: { @@ -1925,13 +1925,13 @@ int ScriptManager::handleOpcode(byte *dataP) { case 215: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("aviat.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("aviat.pe2"); _vm->_globals._introSpeechOffFl = false; break; case 216: _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("aviat1.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("aviat1.pe2"); _vm->_globals._introSpeechOffFl = false; break; @@ -1998,7 +1998,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(12) != 6); _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("PRMORT.pe2"); + _vm->_talkManager.startAnimatedCharacterDialogue("PRMORT.pe2"); _vm->_globals._introSpeechOffFl = false; do { if (_vm->shouldQuit()) @@ -2034,7 +2034,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(13) != 48); _vm->_globals._introSpeechOffFl = true; - _vm->_talkManager.PARLER_PERSO("HRADIO.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("HRADIO.PE2"); _vm->_globals._introSpeechOffFl = false; _vm->_graphicsManager.fadeOutLong(); _vm->_objectsManager.stopBobAnimation(13); @@ -2188,7 +2188,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 241: - _vm->_talkManager.PARLER_PERSO("RECEP.PE2"); + _vm->_talkManager.startAnimatedCharacterDialogue("RECEP.PE2"); break; // Resurrect Samantha's clone diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index c6d83ee8d3..f3d753e3e5 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -49,7 +49,7 @@ void TalkManager::setParent(HopkinsEngine *vm) { _vm = vm; } -void TalkManager::PARLER_PERSO(const Common::String &filename) { +void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) { Common::String spriteFilename; _vm->_fontManager.hideText(5); @@ -64,7 +64,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _characterBuffer = _vm->_fileManager.loadFile(filename); _characterSize = _vm->_fileManager.fileSize(filename); } + // CHECKME:_data[svField4] is useless? _vm->_globals._saveData->_data[svField4] = 0; + getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); @@ -152,7 +154,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager._scrollStatus = 0; } -void TalkManager::PARLER_PERSO2(const Common::String &filename) { +void TalkManager::startStaticCharacterDialogue(const Common::String &filename) { // TODO: The original disables the mouse cursor here bool oldDisableInventFl = _vm->_globals._disableInventFl; _vm->_globals._disableInventFl = true; @@ -163,7 +165,9 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _characterSize = _vm->_fileManager.fileSize(filename); } + // CHECKME:_data[svField4] is useless? _vm->_globals._saveData->_data[svField4] = 0; + getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); @@ -217,7 +221,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { _vm->_eventsManager.changeMouseCursor(oldMouseCursorId); _vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette); _vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette); - // TODO: The original reenables the mouse cursor here + // TODO: The original re-enables the mouse cursor here _vm->_globals._disableInventFl = oldDisableInventFl; } @@ -342,14 +346,15 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) { _dialogueMesgId1 = READ_LE_INT16((uint16 *)charBuf + 5); _dialogueMesgId2 = READ_LE_INT16((uint16 *)charBuf + 6); _dialogueMesgId3 = READ_LE_INT16((uint16 *)charBuf + 7); - int v6 = READ_LE_INT16((uint16 *)charBuf + 8); - int v7 = READ_LE_INT16((uint16 *)charBuf + 9); + int frameNumb = READ_LE_INT16((uint16 *)charBuf + 8); + // CHECKME:_data[svField4] is useless? + int v7 = READ_LE_INT16((uint16 *)charBuf + 9); if (v7) _vm->_globals._saveData->_data[svField4] = v7; - if (!v6) - v6 = 10; + if (!frameNumb) + frameNumb = 10; if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; int curVal = READ_LE_INT16(bufPtr); @@ -384,15 +389,15 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) { _vm->_eventsManager._mouseButton = 0; if (_vm->getIsDemo()) { - for (int i = 0; i < v6; i++) { + for (int i = 0; i < frameNumb; i++) { _vm->_eventsManager.VBL(); } } else { - for (int i = 0; i < v6; i++) { + for (int i = 0; i < frameNumb; i++) { _vm->_eventsManager.VBL(); if (_vm->_eventsManager._mouseButton || _vm->_eventsManager._curMouseButton) break; - if (_vm->_eventsManager.getMouseButton() && i + 1 > abs(v6 / 5)) + if (_vm->_eventsManager.getMouseButton() && i + 1 > abs(frameNumb / 5)) break; } } @@ -959,7 +964,7 @@ void TalkManager::REPONSE2(int zone, int verb) { } } -void TalkManager::OBJET_VIVANT(const Common::String &a2) { +void TalkManager::animateObject(const Common::String &a2) { _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_eventsManager.VBL(); diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index e0fe488c28..aa5f57eaa6 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -68,11 +68,11 @@ public: TalkManager(); void setParent(HopkinsEngine *vm); - void PARLER_PERSO2(const Common::String &filename); - void PARLER_PERSO(const Common::String &filename); + void startStaticCharacterDialogue(const Common::String &filename); + void startAnimatedCharacterDialogue(const Common::String &filename); void REPONSE(int zone, int verb); void REPONSE2(int zone, int verb); - void OBJET_VIVANT(const Common::String &a2); + void animateObject(const Common::String &a2); }; } // End of namespace Hopkins -- cgit v1.2.3 From f9f6133851b22826f8522b045107563494befad0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Feb 2013 01:23:39 +0100 Subject: HOPKINS: Misc renaming --- engines/hopkins/anim.cpp | 16 +++++++-------- engines/hopkins/dialogs.cpp | 4 ++-- engines/hopkins/globals.cpp | 6 +++--- engines/hopkins/globals.h | 2 +- engines/hopkins/graphics.cpp | 16 +++++++-------- engines/hopkins/graphics.h | 8 ++++---- engines/hopkins/hopkins.cpp | 26 ++++++++++++------------ engines/hopkins/objects.cpp | 32 +++++++++++++++-------------- engines/hopkins/objects.h | 10 ++------- engines/hopkins/script.cpp | 18 ++++++++--------- engines/hopkins/script.h | 2 +- engines/hopkins/talk.cpp | 48 ++++++++++++++++++++++---------------------- engines/hopkins/talk.h | 3 ++- 13 files changed, 94 insertions(+), 97 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 38f02c3fda..767c061564 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -468,8 +468,8 @@ void AnimationManager::loadAnim(const Common::String &animName) { */ void AnimationManager::clearAnim() { for (int idx = 0; idx < 35; ++idx) { - _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx]._data); - _vm->_globals.Bqe_Anim[idx]._enabledFl = false; + _vm->_globals._animBqe[idx]._data = _vm->_globals.freeMemory(_vm->_globals._animBqe[idx]._data); + _vm->_globals._animBqe[idx]._enabledFl = false; } for (int idx = 0; idx < 8; ++idx) { @@ -564,18 +564,18 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) if (READ_BE_UINT32(&data[curBufferPos]) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(&data[curBufferPos]) == MKTAG24('F', 'I', 'N')) innerLoopCond = true; if (bufSize < curBufferPos) { - _vm->_globals.Bqe_Anim[animIndex]._enabledFl = false; - _vm->_globals.Bqe_Anim[animIndex]._data = g_PTRNUL; + _vm->_globals._animBqe[animIndex]._enabledFl = false; + _vm->_globals._animBqe[animIndex]._data = g_PTRNUL; return; } ++curBufferPos; ++count; } while (!innerLoopCond); - _vm->_globals.Bqe_Anim[animIndex]._data = _vm->_globals.allocMemory(count + 50); - _vm->_globals.Bqe_Anim[animIndex]._enabledFl = true; - memcpy(_vm->_globals.Bqe_Anim[animIndex]._data, data + dataIdx + 5, 20); + _vm->_globals._animBqe[animIndex]._data = _vm->_globals.allocMemory(count + 50); + _vm->_globals._animBqe[animIndex]._enabledFl = true; + memcpy(_vm->_globals._animBqe[animIndex]._data, data + dataIdx + 5, 20); - byte *dataP = _vm->_globals.Bqe_Anim[animIndex]._data; + byte *dataP = _vm->_globals._animBqe[animIndex]._data; int curDestDataIndx = 20; int curSrcDataIndx = dataIdx + 25; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 623e109c1d..a33d034044 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -412,12 +412,12 @@ void DialogsManager::showInventory() { if (_vm->_eventsManager._mouseCursorId == 8) break; - _vm->_scriptManager.TRAVAILOBJET = true; + _vm->_scriptManager._tempObjectFl = true; _vm->_globals._saveData->_data[svField3] = _vm->_objectsManager._curObjectIndex; _vm->_globals._saveData->_data[svField8] = _vm->_globals._inventory[newInventoryItem]; _vm->_globals._saveData->_data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = false; + _vm->_scriptManager._tempObjectFl = false; if (_vm->_soundManager._voiceOffFl) { do diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2e24ac5c7a..264a53a30d 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -71,7 +71,7 @@ Globals::Globals() { for (int i = 0; i < 6; ++i) CACHE_BANQUE[i] = g_PTRNUL; for (int i = 0; i < 35; ++i) - Common::fill((byte *)&Bqe_Anim[i], (byte *)&Bqe_Anim[i] + sizeof(BqeAnimItem), 0); + Common::fill((byte *)&_animBqe[i], (byte *)&_animBqe[i] + sizeof(BqeAnimItem), 0); for (int i = 0; i < 8; ++i) Common::fill((byte *)&Bank[i], (byte *)&Bank[i] + sizeof(BankItem), 0); for (int i = 0; i < 6; ++i) @@ -285,8 +285,8 @@ void Globals::loadCharacterData() { void Globals::INIT_ANIM() { for (int idx = 0; idx < 35; ++idx) { - Bqe_Anim[idx]._data = g_PTRNUL; - Bqe_Anim[idx]._enabledFl = false; + _animBqe[idx]._data = g_PTRNUL; + _animBqe[idx]._enabledFl = false; } for (int idx = 0; idx < 8; ++idx) { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 6ac029d963..95dae8b922 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -308,7 +308,7 @@ public: bool NOMARCHE; int iRegul; byte *BUF_ZONE; - BqeAnimItem Bqe_Anim[35]; + BqeAnimItem _animBqe[35]; byte *SPRITE_ECRAN; byte *PERSO; bool NOT_VERIF; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 108cad6f50..890db20f13 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1043,17 +1043,17 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } } -void GraphicsManager::FIN_VISU() { +void GraphicsManager::endDisplayBob() { for (int idx = 1; idx <= 20; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_OFF(idx); + if (_vm->_globals._animBqe[idx]._enabledFl) + _vm->_objectsManager.hideBob(idx); } _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); for (int idx = 1; idx <= 20; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) + if (_vm->_globals._animBqe[idx]._enabledFl) _vm->_objectsManager.resetBob(idx); } @@ -1062,14 +1062,14 @@ void GraphicsManager::FIN_VISU() { } for (int idx = 1; idx <= 20; ++idx) { - _vm->_globals.Bqe_Anim[idx]._enabledFl = false; + _vm->_globals._animBqe[idx]._enabledFl = false; } } -void GraphicsManager::VISU_ALL() { +void GraphicsManager::displayAllBob() { for (int idx = 1; idx <= 20; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_VISU(idx); + if (_vm->_globals._animBqe[idx]._enabledFl) + _vm->_objectsManager.displayBob(idx); } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 4b9d328956..d3a3fb4f2f 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -123,6 +123,8 @@ public: void unlockScreen(); void clearPalette(); void clearScreen(); + void addVesaSegment(int x1, int y1, int x2, int y2); + void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void loadImage(const Common::String &file); void loadVgaImage(const Common::String &file); void fadeInLong(); @@ -146,10 +148,10 @@ public: int zoomIn(int v, int percentage); int zoomOut(int v, int percentage); void initScreen(const Common::String &file, int mode, bool initializeScreen); + void displayAllBob(); + void endDisplayBob(); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); - void addVesaSegment(int x1, int y1, int x2, int y2); - void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true); @@ -163,8 +165,6 @@ public: void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void Trans_bloc2(byte *surface, byte *col, int size); - void VISU_ALL(); - void FIN_VISU(); void NB_SCREEN(bool initPalette); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index fd937e3ad1..146b25065a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1670,7 +1670,7 @@ void HopkinsEngine::playIntro() { _graphicsManager.loadImage("intro2"); _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); - _graphicsManager.VISU_ALL(); + _graphicsManager.displayAllBob(); _soundManager.playSound(23); _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); @@ -1695,7 +1695,7 @@ void HopkinsEngine::playIntro() { memcpy(&paletteData2, _graphicsManager._palette, 796); _graphicsManager.setPaletteVGA256WithRefresh(paletteData, _graphicsManager._vesaBuffer); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); if (shouldQuit() || _eventsManager._escKeyFl) return; @@ -1711,7 +1711,7 @@ void HopkinsEngine::playIntro() { _graphicsManager.loadImage("intro2"); _graphicsManager.scrollScreen(0); _animationManager.loadAnim("INTRO2"); - _graphicsManager.VISU_ALL(); + _graphicsManager.displayAllBob(); _soundManager.playSound(23); _objectsManager.stopBobAnimation(3); _objectsManager.stopBobAnimation(5); @@ -1785,7 +1785,7 @@ void HopkinsEngine::playIntro() { } _graphicsManager.fadeOutLong(); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); _animationManager._clearAnimationFl = true; _soundManager.playSound(3); _soundManager._specialSoundNum = 1; @@ -1869,7 +1869,7 @@ void HopkinsEngine::bombExplosion() { _soundManager._specialSoundNum = 0; _graphicsManager.loadImage("IM15"); _animationManager.loadAnim("ANIM15"); - _graphicsManager.VISU_ALL(); + _graphicsManager.displayAllBob(); _objectsManager.stopBobAnimation(7); for (int idx = 0; idx < 5; ++idx) { @@ -1893,7 +1893,7 @@ void HopkinsEngine::bombExplosion() { } _graphicsManager.fadeOutLong(); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); _globals.iRegul = 0; _globals._exitId = 151; } @@ -1941,7 +1941,7 @@ void HopkinsEngine::handleConflagration() { _graphicsManager.SETCOLOR3(253, 100, 100, 100); _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); - _graphicsManager.VISU_ALL(); + _graphicsManager.displayAllBob(); for (int cpt = 0; cpt <= 4; cpt++) _eventsManager.VBL(); @@ -1960,7 +1960,7 @@ void HopkinsEngine::handleConflagration() { _eventsManager.VBL(); _graphicsManager.fadeOutLong(); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); _globals._saveData->_data[svField312] = 1; _globals._disableInventFl = false; } @@ -2021,7 +2021,7 @@ void HopkinsEngine::BASED() { _animationManager.NO_COUL = false; _graphicsManager.loadImage("IM92"); _animationManager.loadAnim("ANIM92"); - _graphicsManager.VISU_ALL(); + _graphicsManager.displayAllBob(); _objectsManager.loadLinkFile("IM92"); for (int cpt = 0; cpt <= 4; cpt++) @@ -2035,7 +2035,7 @@ void HopkinsEngine::BASED() { while (_objectsManager.getBobAnimDataIdx(8) != 22); _graphicsManager.fadeOutLong(); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); _globals.resetCache(); _globals._disableInventFl = false; _globals._exitId = 93; @@ -2056,7 +2056,7 @@ void HopkinsEngine::playEnding() { _soundManager.loadSample(1, "SOUND90.WAV"); _graphicsManager.loadImage("IM100"); _animationManager.loadAnim("ANIM100"); - _graphicsManager.VISU_ALL(); + _graphicsManager.displayAllBob(); _eventsManager.mouseOn(); _objectsManager.stopBobAnimation(7); _objectsManager.stopBobAnimation(8); @@ -2124,7 +2124,7 @@ void HopkinsEngine::playEnding() { _soundManager._skipRefreshFl = true; _graphicsManager.FADE_LINUX = 2; _animationManager.playAnim("BERM.ANM", 100, 24, 300); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); _soundManager.removeSample(1); _graphicsManager.loadImage("PLAN3"); _graphicsManager.fadeInLong(); @@ -2177,7 +2177,7 @@ void HopkinsEngine::playEnding() { while (_objectsManager.getBobAnimDataIdx(8) != 21); _graphicsManager.fadeOutLong(); - _graphicsManager.FIN_VISU(); + _graphicsManager.endDisplayBob(); _soundManager.removeSample(1); _soundManager.playSound(16); _globals.iRegul = 1; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index db9020b455..de10775e01 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -573,7 +573,7 @@ void ObjectsManager::setBobInfo(int idx) { _vm->_globals.Liste2[idx]._posY + _vm->_globals.Liste2[idx]._height); } -void ObjectsManager::BOB_VISU(int idx) { +void ObjectsManager::displayBob(int idx) { _priorityFl = true; if (_bob[idx].field0) @@ -581,7 +581,7 @@ void ObjectsManager::BOB_VISU(int idx) { resetBob(idx); - const byte *data = _vm->_globals.Bqe_Anim[idx]._data; + const byte *data = _vm->_globals._animBqe[idx]._data; int bankIdx = READ_LE_INT16(data); if (!bankIdx) return; @@ -607,7 +607,7 @@ void ObjectsManager::BOB_VISU(int idx) { _bob[idx]._flipFl = false; } - _bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _bob[idx]._animData = _vm->_globals._animBqe[idx]._data; _bob[idx].field0 = 10; _bob[idx]._spriteData = _vm->_globals.Bank[bankIdx]._data; @@ -617,7 +617,7 @@ void ObjectsManager::BOB_VISU(int idx) { _bob[idx]._offsetY = offsetY; } -void ObjectsManager::BOB_OFF(int idx) { +void ObjectsManager::hideBob(int idx) { if ((_bob[idx].field0 == 3) || (_bob[idx].field0 == 10)) _bob[idx].field0++; } @@ -1753,7 +1753,7 @@ void ObjectsManager::handleCityMap() { loadZone("PLAN.ZO2"); _spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR"); _vm->_animationManager.loadAnim("PLAN"); - _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.displayAllBob(); _vm->_graphicsManager.initScreen("PLAN", 2, false); for (int i = 0; i <= 15; i++) _vm->_globals.B_CACHE_OFF(i); @@ -2063,7 +2063,7 @@ void ObjectsManager::PARADISE() { */ void ObjectsManager::clearScreen() { clearSprite(); - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); _vm->_globals.CLEAR_VBOB(); @@ -2098,7 +2098,9 @@ void ObjectsManager::clearScreen() { } /** - * Change character Face / Head + * Change the currently active player face / Head + * @param oldCharacter Previously played character + * @param newCharacter New character to play */ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter) { CharacterLocation *loc; @@ -3654,10 +3656,10 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in _vm->_animationManager.playAnim("CREVE2.ANM", 100, 24, 500); _vm->_globals._exitId = 150; _vm->_graphicsManager._noFadingFl = true; - BOB_OFF(1); - BOB_OFF(2); - BOB_OFF(3); - BOB_OFF(4); + hideBob(1); + hideBob(2); + hideBob(3); + hideBob(4); } } else if (minX < getSpriteX(0) && maxX > getSpriteX(0) @@ -3695,7 +3697,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo loadLinkFile(linkFile); if (!animFile.empty()) _vm->_animationManager.loadAnim(animFile); - _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.displayAllBob(); if (!s4.empty()) { if (initializeScreen) _vm->_graphicsManager.initScreen(s4, 0, initializeScreen); @@ -3755,7 +3757,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_graphicsManager.fadeOutLong(); if (!animFile.empty()) - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); if (_vm->_globals._screenId == 61) removeSprite(0); clearScreen(); @@ -3785,7 +3787,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm loadLinkFile(linkFile); if (!animFile.empty()) { _vm->_animationManager.loadAnim(animFile); - _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.displayAllBob(); } if (!s4.empty()) { if (initializeScreen) @@ -3903,7 +3905,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _twoCharactersFl = false; } if (!animFile.empty()) - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); clearScreen(); } else { _helicopterFl = false; diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 40726bf304..b20d1e2ad7 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -122,12 +122,6 @@ private: void GOHOME2(); void loadZone(const Common::String &file); - - /** - * Change the currently active player - * @param oldCharacter Previously played character - * @param newCharacter New character to play - */ void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); void nextVerbIcon(); @@ -233,8 +227,8 @@ public: const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen); byte *CAPTURE_OBJET(int objIndex, bool mode); void OPTI_OBJET(); - void BOB_OFF(int idx); - void BOB_VISU(int idx); + void hideBob(int idx); + void displayBob(int idx); void SPACTION(byte *spriteData, const Common::String &animationSeq, int a3, int a4, int speed, bool flipFl); void BOB_VIVANT(int idx); void VBOB(byte *src, int idx, int xp, int yp, int frameIndex); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 1d12cf1d0f..aa6abfa5ec 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -36,7 +36,7 @@ namespace Hopkins { ScriptManager::ScriptManager() { - TRAVAILOBJET = false; + _tempObjectFl = false; } void ScriptManager::setParent(HopkinsEngine *vm) { @@ -56,7 +56,7 @@ int ScriptManager::handleOpcode(byte *dataP) { vbobFrameIndex = dataP[6]; int mesgId = READ_LE_INT16(dataP + 13); opcodeType = 1; - if (!TRAVAILOBJET) { + if (!_tempObjectFl) { if (_vm->_globals._saveData->_data[svField356] == 1) { if (mesgId == 53) mesgId = 644; @@ -543,7 +543,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); _vm->_objectsManager.clearScreen(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { @@ -556,7 +556,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_animationManager.loadAnim("otage"); _vm->_graphicsManager.loadImage("IM05"); - _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.displayAllBob(); for (int i = 0; i <= 4; i++) { if (_vm->shouldQuit()) @@ -574,7 +574,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.getBobAnimDataIdx(3) != 100); _vm->_graphicsManager.fadeOutDefaultLength(_vm->_graphicsManager._vesaBuffer); - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); // If uncensored, rip the throat of the hostage if (!_vm->_globals._censorshipFl) { @@ -586,7 +586,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_animationManager.loadAnim("ASCEN"); _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.loadImage("ASCEN"); - _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.displayAllBob(); for (int i = 0; i <= 4; i++) { if (_vm->shouldQuit()) @@ -599,7 +599,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_graphicsManager.fadeInDefaultLength(_vm->_graphicsManager._vesaBuffer); _vm->_objectsManager.SCI_OPTI_ONE(1, 0, 17, 3); _vm->_graphicsManager.fadeOutDefaultLength(_vm->_graphicsManager._vesaBuffer); - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) _vm->_soundManager.playSoundFile("SOUND17.WAV"); @@ -876,10 +876,10 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); - _vm->_graphicsManager.FIN_VISU(); + _vm->_graphicsManager.endDisplayBob(); _vm->_graphicsManager.loadImage("IM20f"); _vm->_animationManager.loadAnim("ANIM20f"); - _vm->_graphicsManager.VISU_ALL(); + _vm->_graphicsManager.displayAllBob(); _vm->_eventsManager.mouseOff(); _vm->_graphicsManager.fadeInLong(); bool v52 = false; diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index d29efee01e..cf719f52ce 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -36,7 +36,7 @@ private: HopkinsEngine *_vm; int checkOpcode(const byte *dataP); public: - bool TRAVAILOBJET; + bool _tempObjectFl; ScriptManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index f3d753e3e5..00bc4b3e08 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -473,34 +473,34 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) { void TalkManager::dialogWait() { for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) + if (_vm->_globals._animBqe[idx]._enabledFl) BOB_VISU_PARLE(idx); } } void TalkManager::dialogTalk() { for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_OFF(idx); + if (_vm->_globals._animBqe[idx]._enabledFl) + _vm->_objectsManager.hideBob(idx); } for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) + if (_vm->_globals._animBqe[idx]._enabledFl) _vm->_objectsManager.resetBob(idx); } } void TalkManager::dialogEndTalk() { for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) - _vm->_objectsManager.BOB_OFF(idx); + if (_vm->_globals._animBqe[idx]._enabledFl) + _vm->_objectsManager.hideBob(idx); } _vm->_eventsManager.VBL(); _vm->_eventsManager.VBL(); for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) + if (_vm->_globals._animBqe[idx]._enabledFl) _vm->_objectsManager.resetBob(idx); } } @@ -595,7 +595,7 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) { void TalkManager::VISU_PARLE() { for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_globals.Bqe_Anim[idx]._enabledFl) + if (_vm->_globals._animBqe[idx]._enabledFl) BOB_VISU_PARLE(idx); } } @@ -604,7 +604,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_objectsManager._priorityFl = true; if (!_vm->_objectsManager._bob[idx].field0) { _vm->_objectsManager.resetBob(idx); - byte *v5 = _vm->_globals.Bqe_Anim[idx]._data; + byte *v5 = _vm->_globals._animBqe[idx]._data; int v4 = READ_LE_INT16(v5 + 2); if (!v4) v4 = 1; @@ -612,7 +612,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_objectsManager._bob[idx]._isSpriteFl = true; _vm->_objectsManager._bob[idx]._zoomFactor = 0; _vm->_objectsManager._bob[idx]._flipFl = false; - _vm->_objectsManager._bob[idx]._animData = _vm->_globals.Bqe_Anim[idx]._data; + _vm->_objectsManager._bob[idx]._animData = _vm->_globals._animBqe[idx]._data; _vm->_objectsManager._bob[idx].field0 = 10; v5 = _characterSprite; _vm->_objectsManager._bob[idx]._spriteData = _characterSprite; @@ -699,8 +699,8 @@ void TalkManager::initCharacterAnim() { void TalkManager::clearCharacterAnim() { for (int idx = 21; idx <= 34; ++idx) { - _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.freeMemory(_vm->_globals.Bqe_Anim[idx]._data); - _vm->_globals.Bqe_Anim[idx]._enabledFl = false; + _vm->_globals._animBqe[idx]._data = _vm->_globals.freeMemory(_vm->_globals._animBqe[idx]._data); + _vm->_globals._animBqe[idx]._enabledFl = false; } } @@ -717,25 +717,25 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, if (READ_BE_UINT32(curPtr) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(curPtr) == MKTAG24('F', 'I', 'N')) loopCond = true; if (bufIndx > bufferSize) { - _vm->_globals.Bqe_Anim[idx]._enabledFl = false; - _vm->_globals.Bqe_Anim[idx]._data = g_PTRNUL; + _vm->_globals._animBqe[idx]._enabledFl = false; + _vm->_globals._animBqe[idx]._data = g_PTRNUL; return false; } ++bufIndx; ++animLength; ++curPtr; } while (!loopCond); - _vm->_globals.Bqe_Anim[idx]._data = _vm->_globals.allocMemory(animLength + 50); - _vm->_globals.Bqe_Anim[idx]._enabledFl = true; - memcpy(_vm->_globals.Bqe_Anim[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20); + _vm->_globals._animBqe[idx]._data = _vm->_globals.allocMemory(animLength + 50); + _vm->_globals._animBqe[idx]._enabledFl = true; + memcpy(_vm->_globals._animBqe[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20); int v23 = READ_LE_INT16(bufPos + bufPerso + 29); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25)); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27)); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 24, v23); - WRITE_LE_UINT16(_vm->_globals.Bqe_Anim[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31)); - _vm->_globals.Bqe_Anim[idx]._data[28] = bufPerso[bufPos + 33]; - _vm->_globals.Bqe_Anim[idx]._data[29] = bufPerso[bufPos + 34]; - byte *bqeCurData = _vm->_globals.Bqe_Anim[idx]._data + 20; + WRITE_LE_UINT16(_vm->_globals._animBqe[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25)); + WRITE_LE_UINT16(_vm->_globals._animBqe[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27)); + WRITE_LE_UINT16(_vm->_globals._animBqe[idx]._data + 24, v23); + WRITE_LE_UINT16(_vm->_globals._animBqe[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31)); + _vm->_globals._animBqe[idx]._data[28] = bufPerso[bufPos + 33]; + _vm->_globals._animBqe[idx]._data[29] = bufPerso[bufPos + 34]; + byte *bqeCurData = _vm->_globals._animBqe[idx]._data + 20; const byte *curBufPerso = bufPos + bufPerso + 25; for (int i = 1; i < 5000; i++) { bqeCurData += 10; diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index aa5f57eaa6..e93c47fd38 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -70,9 +70,10 @@ public: void startStaticCharacterDialogue(const Common::String &filename); void startAnimatedCharacterDialogue(const Common::String &filename); + void animateObject(const Common::String &a2); + void REPONSE(int zone, int verb); void REPONSE2(int zone, int verb); - void animateObject(const Common::String &a2); }; } // End of namespace Hopkins -- cgit v1.2.3 From 8457c00457eac275c11bc5023b1ced8441e626b5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Feb 2013 08:30:16 +0100 Subject: HOPKINS: More misc renaming --- engines/hopkins/anim.cpp | 22 +- engines/hopkins/computer.cpp | 14 +- engines/hopkins/dialogs.cpp | 18 +- engines/hopkins/events.cpp | 2 +- engines/hopkins/font.cpp | 8 +- engines/hopkins/graphics.cpp | 17 +- engines/hopkins/graphics.h | 14 +- engines/hopkins/hopkins.cpp | 8 +- engines/hopkins/lines.cpp | 630 +++++++++++++++++++++---------------------- engines/hopkins/lines.h | 45 ++-- engines/hopkins/objects.cpp | 212 +++++++-------- engines/hopkins/script.cpp | 2 +- 12 files changed, 496 insertions(+), 496 deletions(-) diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 767c061564..fa6dd1c394 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -148,11 +148,11 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) { if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy); _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); + _vm->_graphicsManager.copyVideoVbe16(screenP); } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); @@ -200,7 +200,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (*screenP != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy); } _vm->_graphicsManager.fadeOutDefaultLength(screenCopy); screenCopy = _vm->_globals.freeMemory(screenCopy); @@ -322,10 +322,10 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u _vm->_graphicsManager.lockScreen(); if (*screenP != kByteStop) { if (hasScreenCopy) { - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy); + _vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy); _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { - _vm->_graphicsManager.Copy_Video_Vbe16(screenP); + _vm->_graphicsManager.copyVideoVbe16(screenP); } } _vm->_graphicsManager.unlockScreen(); @@ -365,7 +365,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (*screenP != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, ptra); + _vm->_graphicsManager.copyWinscanVbe3(screenP, ptra); } _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); @@ -721,11 +721,11 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_graphicsManager.lockScreen(); if (hasScreenCopy) { if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.copyWinscanVbe(screenP, screenCopy); _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); + _vm->_graphicsManager.copyVideoVbe16a(screenP); } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); @@ -847,11 +847,11 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_graphicsManager.lockScreen(); if (multiScreenFl) { if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.copyWinscanVbe(screenP, screenCopy); _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); + _vm->_graphicsManager.copyVideoVbe16a(screenP); } _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.DD_VBL(); @@ -891,7 +891,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u f.read(screenP, READ_LE_UINT32(imageStr + 8)); if (*screenP != kByteStop) - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, ptra); + _vm->_graphicsManager.copyWinscanVbe(screenP, ptra); } _vm->_graphicsManager.fadeOutDefaultLength(ptra); ptra = _vm->_globals.freeMemory(ptra); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index a70a8de615..2e911152bb 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -127,7 +127,7 @@ void ComputerManager::setTextPosition(int yp, int xp) { */ void ComputerManager::showComputer(ComputerEnum mode) { _vm->_eventsManager._escKeyFl = false; - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); setVideoMode(); setTextColor(4); setTextPosition(2, 4); @@ -287,7 +287,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { else // Free access or Samantha _vm->_globals._exitId = 14; - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); } static const char _englishText[] = @@ -557,9 +557,9 @@ void ComputerManager::displayGamesSubMenu() { loadHiscore(); setModeVGA256(); newLevel(); - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); playBreakout(); - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); _breakoutSpr = _vm->_globals.freeMemory(_breakoutSpr); _breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel); _vm->_objectsManager._sprite[0]._spriteData = oldSpriteData; @@ -726,7 +726,7 @@ void ComputerManager::playBreakout() { _ballPosition = Common::Point(_padPositionX + 14, 187); _vm->_objectsManager.setSpriteY(1, 187); _vm->_objectsManager.setSpriteX(1, _ballPosition.x); - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); _vm->_eventsManager.VBL(); _vm->_graphicsManager.fadeInBreakout(); @@ -801,7 +801,7 @@ void ComputerManager::playBreakout() { * @return The selected button index: 1 = Game, 2 = Quit */ int ComputerManager::displayHiscores() { - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); loadHiscore(); _vm->_graphicsManager.loadVgaImage("HISCORE.PCX"); byte *ptr = _vm->_fileManager.loadFile("ALPHA.SPR"); @@ -827,7 +827,7 @@ int ComputerManager::displayHiscores() { } _vm->_graphicsManager.fadeInBreakout(); - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); int buttonIndex = 0; do { _vm->_eventsManager.refreshEvents(); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index a33d034044..9fe7be68cc 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -374,7 +374,7 @@ void DialogsManager::showInventory() { // The last two zones are not reserved for the inventory: Options and Save/Load if (inventIdx && inventCount <= 29) { byte *obj = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6, + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6, curPosY + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); _vm->_globals.freeMemory(obj); } @@ -382,7 +382,7 @@ void DialogsManager::showInventory() { }; curPosY += 38; } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); + _vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); _vm->_eventsManager._curMouseButton = 0; int newInventoryItem = 0; @@ -667,22 +667,22 @@ void DialogsManager::showSaveLoad(int a1) { switch (slotNumber) { case 1: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 112, 128, 87); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 112, 128, 87); break; case 2: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 112, 128, 87); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 112, 128, 87); break; case 3: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 203, 128, 87); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 203, 128, 87); break; case 4: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 203, 128, 87); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 203, 128, 87); break; case 5: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 294, 128, 87); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 190, 294, 128, 87); break; case 6: - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 294, 128, 87); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, thumb, _vm->_eventsManager._startPos.x + 323, 294, 128, 87); break; } @@ -692,7 +692,7 @@ void DialogsManager::showSaveLoad(int a1) { } } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); + _vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); _vm->_objectsManager._saveLoadFl = true; _vm->_objectsManager._saveLoadX = 0; _vm->_objectsManager._saveLoadY = 0; diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index f097405394..050935d783 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -467,7 +467,7 @@ void EventsManager::VBL() { _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); _startPos.x = _vm->_graphicsManager._scrollPosX; _vm->_graphicsManager._scrollOffset = _vm->_graphicsManager._scrollPosX; diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index ee1634a86f..89d197b46b 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -159,7 +159,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in } else { int height = _text[idx]._height; int width = _text[idx]._width; - _vm->_graphicsManager.Restore_Mem( + _vm->_graphicsManager.restoreSurfaceRect( _vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, xp, @@ -346,9 +346,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in if (ptrd == g_PTRNUL) error("Cutting a block for text box (%d)", size); - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); + _vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, size); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); _vm->_globals.freeMemory(ptrd); _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, posY, saveWidth, (byte)-2); @@ -380,7 +380,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in _text[idx]._textBlock = ptre; _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, posX, posY, _text[idx]._width, blockHeight); + _vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, posX, posY, _text[idx]._width, blockHeight); } _tempText = _vm->_globals.freeMemory(_tempText); } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 890db20f13..9429939720 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -723,7 +723,7 @@ void GraphicsManager::DD_VBL() { g_system->updateScreen(); } -void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) { +void GraphicsManager::copyWinscanVbe3(const byte *srcData, byte *destSurface) { byte srcByte; byte destLen1; byte *destSlice1P; @@ -773,7 +773,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) } } -void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { +void GraphicsManager::copyVideoVbe16(const byte *srcData) { const byte *srcP = srcData; int destOffset = 0; assert(_videoPtr); @@ -844,7 +844,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { } } -void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { +void GraphicsManager::copyVideoVbe16a(const byte *srcData) { byte srcByte; int destOffset = 0; const byte *srcP = srcData; @@ -875,7 +875,7 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { } } -void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height) { +void GraphicsManager::copySurfaceRect(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height) { const byte *srcP; byte *destP; int rowCount; @@ -1073,7 +1073,7 @@ void GraphicsManager::displayAllBob() { } } -void GraphicsManager::RESET_SEGMENT_VESA() { +void GraphicsManager::resetVesaSegment() { for (int idx = 0; idx <= NBBLOC; idx++) BLOC[idx]._activeFl = false; @@ -1193,8 +1193,7 @@ void GraphicsManager::copy16bFromSurfaceScaleX2(const byte *surface) { } } -void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { - int i; +void GraphicsManager::restoreSurfaceRect(byte *destSurface, const byte *src, int xp, int yp, int width, int height) { int yCtr; byte *destP = xp + _lineNbr2 * yp + destSurface; @@ -1207,7 +1206,7 @@ void GraphicsManager::Restore_Mem(byte *destSurface, const byte *src, int xp, in srcP += width; destP += width; } else if (width & 2) { - for (i = width >> 1; i; --i) { + for (int i = width >> 1; i; --i) { destP[0] = srcP[0]; destP[1] = srcP[1]; srcP += 2; @@ -1742,7 +1741,7 @@ void GraphicsManager::NB_SCREEN(bool initPalette) { DD_VBL(); } -void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { +void GraphicsManager::copyWinscanVbe(const byte *src, byte *dest) { int destOffset = 0; const byte *srcPtr = src; for (;;) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index d3a3fb4f2f..6dc8ec6849 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -137,6 +137,13 @@ public: void fadeOutShort(); void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); void displayVesaSegment(); + void resetVesaSegment(); + void copyWinscanVbe3(const byte *srcData, byte *destSurface); + void copyWinscanVbe(const byte *srcP, byte *destP); + void copyVideoVbe16(const byte *srcData); + void copyVideoVbe16a(const byte *srcData); + void copySurfaceRect(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height); + void restoreSurfaceRect(byte *destSurface, const byte *src, int xp, int yp, int width, int height); void displayFont(byte *surface, const byte *spriteData, int xp, int yp, int characterIndex, int colour); void drawHorizontalLine(byte *surface, int xp, int yp, uint16 width, byte col); void drawVerticalLine(byte *surface, int xp, int yp, int height, byte col); @@ -151,13 +158,10 @@ public: void displayAllBob(); void endDisplayBob(); - void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true); - void RESET_SEGMENT_VESA(); void DD_VBL(); - void Capture_Mem(const byte *srcSurface, byte *destSurface, int xs, int ys, int width, int height); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl); void Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY); void SCANLINE(int pitch); @@ -167,10 +171,6 @@ public: void Trans_bloc2(byte *surface, byte *col, int size); void NB_SCREEN(bool initPalette); void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); - void Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface); - void Copy_WinScan_Vbe(const byte *srcP, byte *destP); - void Copy_Video_Vbe16(const byte *srcData); - void Copy_Video_Vbe16a(const byte *srcData); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 146b25065a..b761e99164 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -343,7 +343,7 @@ bool HopkinsEngine::runWin95Demo() { memset(_graphicsManager._vesaBuffer, 0, 307200); memset(_graphicsManager._vesaScreen, 0, 307200); _graphicsManager.clearPalette(); - _graphicsManager.RESET_SEGMENT_VESA(); + _graphicsManager.resetVesaSegment(); break; case 114: @@ -661,7 +661,7 @@ bool HopkinsEngine::runLinuxDemo() { memset(_graphicsManager._vesaBuffer, 0, 307200); memset(_graphicsManager._vesaScreen, 0, 307200); _graphicsManager.clearPalette(); - _graphicsManager.RESET_SEGMENT_VESA(); + _graphicsManager.resetVesaSegment(); break; case 114: @@ -1434,7 +1434,7 @@ bool HopkinsEngine::runFull() { memset(_graphicsManager._vesaBuffer, 0, 307200); memset(_graphicsManager._vesaScreen, 0, 307200); _graphicsManager.clearPalette(); - _graphicsManager.RESET_SEGMENT_VESA(); + _graphicsManager.resetVesaSegment(); break; case 114: @@ -1905,7 +1905,7 @@ void HopkinsEngine::restoreSystem() { void HopkinsEngine::endLinuxDemo() { _globals._linuxEndDemoFl = true; - _graphicsManager.RESET_SEGMENT_VESA(); + _graphicsManager.resetVesaSegment(); _objectsManager._forestFl = false; _eventsManager._breakoutFl = false; _globals._disableInventFl = true; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 912980ce69..428a4b0482 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -52,14 +52,14 @@ int LigneItem::appendToRouteDec(int from, int to, RouteItem *route, int index) { LinesManager::LinesManager() { for (int i = 0; i < MAX_LINES; ++i) { Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0); - Common::fill((byte *)&Ligne[i], (byte *)&Ligne[i] + sizeof(LigneItem), 0); + Common::fill((byte *)&_lineItem[i], (byte *)&_lineItem[i] + sizeof(LigneItem), 0); } for (int i = 0; i < 4000; ++i) Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0); for (int i = 0; i < 8001; ++i) - super_parcours[i].set(0, 0, DIR_NONE); + _bestRoute[i].set(0, 0, DIR_NONE); for (int i = 0; i < 101; ++i) { Common::fill((byte *)&_segment[i], (byte *)&_segment[i] + sizeof(SegmentItem), 0); @@ -75,11 +75,11 @@ LinesManager::LinesManager() { Common::fill((byte *)&ZONEP[i], (byte *)&ZONEP[i] + sizeof(ZonePItem), 0); _linesNumb = 0; - NV_LIGNEDEP = 0; - NV_LIGNEOFS = 0; - NV_POSI = 0; - NVPX = 0; - NVPY = 0; + _newLineIdx = 0; + _newLineDataIdx = 0; + _newRouteIdx = 0; + _newPosX = 0; + _newPosY = 0; _smoothMoveDirection = DIR_NONE; _lastLine = 0; _maxLineIdx = 0; @@ -87,14 +87,14 @@ LinesManager::LinesManager() { essai0 = NULL; essai1 = NULL; essai2 = NULL; - BufLig = (int16 *)g_PTRNUL; + _lineBuf = (int16 *)g_PTRNUL; _route = (RouteItem *)g_PTRNUL; _currentSegmentId = 0; - BUFFERTAPE = NULL; + _largeBuf = g_PTRNUL; } LinesManager::~LinesManager() { - _vm->_globals.freeMemory(BUFFERTAPE); + _vm->_globals.freeMemory(_largeBuf); } void LinesManager::setParent(HopkinsEngine *vm) { @@ -243,7 +243,7 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5 if (_linesNumb < idx) _linesNumb = idx; - Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); + _lineItem[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)_lineItem[idx]._lineData); int v8 = abs(a3 - a5) + 1; int v34 = abs(a4 - a6) + 1; int v33 = v34; @@ -254,9 +254,9 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5 assert (v10 != g_PTRNUL); Common::fill(v10, v10 + 4 * v34 + 8, 0); - Ligne[idx]._lineData = (int16 *)v10; + _lineItem[idx]._lineData = (int16 *)v10; - int16 *v32 = Ligne[idx]._lineData; + int16 *v32 = _lineItem[idx]._lineData; int v36 = 1000 * v8; int v39 = 1000 * v8 / (v34 - 1); int v37 = 1000 * v33 / (v34 - 1); @@ -268,60 +268,60 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5 int v12 = (int)v37 / 1000; if (!v11) { if (v12 == -1) { - Ligne[idx]._directionRouteInc = DIR_UP; - Ligne[idx]._directionRouteDec = DIR_DOWN; + _lineItem[idx]._directionRouteInc = DIR_UP; + _lineItem[idx]._directionRouteDec = DIR_DOWN; } if (v12 == 1) { - Ligne[idx]._directionRouteInc = DIR_DOWN; - Ligne[idx]._directionRouteDec = DIR_UP; + _lineItem[idx]._directionRouteInc = DIR_DOWN; + _lineItem[idx]._directionRouteDec = DIR_UP; } } if (v11 == 1) { if (v12 == -1) { - Ligne[idx]._directionRouteInc = DIR_UP_RIGHT; - Ligne[idx]._directionRouteDec = DIR_DOWN_LEFT; + _lineItem[idx]._directionRouteInc = DIR_UP_RIGHT; + _lineItem[idx]._directionRouteDec = DIR_DOWN_LEFT; } if (!v12) { - Ligne[idx]._directionRouteInc = DIR_RIGHT; - Ligne[idx]._directionRouteDec = DIR_LEFT; + _lineItem[idx]._directionRouteInc = DIR_RIGHT; + _lineItem[idx]._directionRouteDec = DIR_LEFT; } if (v12 == 1) { - Ligne[idx]._directionRouteInc = DIR_DOWN_RIGHT; - Ligne[idx]._directionRouteDec = DIR_UP_LEFT; + _lineItem[idx]._directionRouteInc = DIR_DOWN_RIGHT; + _lineItem[idx]._directionRouteDec = DIR_UP_LEFT; } } if (v11 == -1) { if (v12 == 1) { - Ligne[idx]._directionRouteInc = DIR_DOWN_LEFT; - Ligne[idx]._directionRouteDec = DIR_UP_RIGHT; + _lineItem[idx]._directionRouteInc = DIR_DOWN_LEFT; + _lineItem[idx]._directionRouteDec = DIR_UP_RIGHT; } if (!v12) { - Ligne[idx]._directionRouteInc = DIR_LEFT; - Ligne[idx]._directionRouteDec = DIR_RIGHT; + _lineItem[idx]._directionRouteInc = DIR_LEFT; + _lineItem[idx]._directionRouteDec = DIR_RIGHT; } if (v12 == -1) { - Ligne[idx]._directionRouteInc = DIR_UP_LEFT; - Ligne[idx]._directionRouteDec = DIR_DOWN_RIGHT; + _lineItem[idx]._directionRouteInc = DIR_UP_LEFT; + _lineItem[idx]._directionRouteDec = DIR_DOWN_RIGHT; } } if (v11 == 1 && v37 > 250 && v37 <= 999) { - Ligne[idx]._directionRouteInc = DIR_DOWN_RIGHT; - Ligne[idx]._directionRouteDec = DIR_UP_LEFT; + _lineItem[idx]._directionRouteInc = DIR_DOWN_RIGHT; + _lineItem[idx]._directionRouteDec = DIR_UP_LEFT; } if (v11 == -1 && v37 > 250 && v37 <= 999) { - Ligne[idx]._directionRouteInc = DIR_DOWN_LEFT; - Ligne[idx]._directionRouteDec = DIR_UP_RIGHT; + _lineItem[idx]._directionRouteInc = DIR_DOWN_LEFT; + _lineItem[idx]._directionRouteDec = DIR_UP_RIGHT; } if (v11 == 1 && v37 < -250 && v37 > -1000) { - Ligne[idx]._directionRouteInc = DIR_UP_RIGHT; - Ligne[idx]._directionRouteDec = DIR_DOWN_LEFT; + _lineItem[idx]._directionRouteInc = DIR_UP_RIGHT; + _lineItem[idx]._directionRouteDec = DIR_DOWN_LEFT; } // This condition is impossible to meet! // Code present in the Linux and BeOS executables // CHECKME: maybe it should be checking negative values? if (v11 == -1 && v37 <= 249 && v37 > 1000) { - Ligne[idx]._directionRouteInc = DIR_UP_LEFT; - Ligne[idx]._directionRouteDec = DIR_DOWN_RIGHT; + _lineItem[idx]._directionRouteInc = DIR_UP_LEFT; + _lineItem[idx]._directionRouteDec = DIR_DOWN_RIGHT; } int v40 = v36 / v34; int v38 = 1000 * v33 / v34; @@ -351,8 +351,8 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5 v32[0] = -1; v32[1] = -1; - Ligne[idx]._lineDataEndIdx = v35 + 1; - Ligne[idx]._direction = direction; + _lineItem[idx]._lineDataEndIdx = v35 + 1; + _lineItem[idx]._direction = direction; ++_linesNumb; } @@ -372,7 +372,7 @@ bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *fo *foundLineIdx = -1; for (int curLineIdx = startLineIdx; curLineIdx <= endLineIdx; curLineIdx++) { - lineData = Ligne[curLineIdx]._lineData; + lineData = _lineItem[curLineIdx]._lineData; if (lineData == (int16 *)g_PTRNUL) continue; @@ -380,7 +380,7 @@ bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *fo bool collisionFl = true; int lineStartX = lineData[0]; int lineStartY = lineData[1]; - int lineDataIdx = 2 * Ligne[curLineIdx]._lineDataEndIdx; + int lineDataIdx = 2 * _lineItem[curLineIdx]._lineDataEndIdx; int lineEndX = lineData[lineDataIdx - 2]; int lineEndY = lineData[lineDataIdx - 1]; if (lineStartX >= lineEndX) { @@ -401,7 +401,7 @@ bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *fo if (!collisionFl) continue; - for (int idx = 0; idx < Ligne[curLineIdx]._lineDataEndIdx; idx++) { + for (int idx = 0; idx < _lineItem[curLineIdx]._lineDataEndIdx; idx++) { int lineX = lineData[0]; int lineY = lineData[1]; lineData += 2; @@ -420,13 +420,13 @@ bool LinesManager::checkCollisionLine(int xp, int yp, int *foundDataIdx, int *fo * Init route */ void LinesManager::initRoute() { - int lineX = Ligne[0]._lineData[0]; - int lineY = Ligne[0]._lineData[1]; + int lineX = _lineItem[0]._lineData[0]; + int lineY = _lineItem[0]._lineData[1]; int lineIdx = 1; for (;;) { - int curDataIdx = Ligne[lineIdx]._lineDataEndIdx; - int16 *curLineData = Ligne[lineIdx]._lineData; + int curDataIdx = _lineItem[lineIdx]._lineDataEndIdx; + int16 *curLineData = _lineItem[lineIdx]._lineData; int curLineX = curLineData[2 * curDataIdx - 2]; int curLineY = curLineData[2 * curDataIdx - 1]; @@ -437,7 +437,7 @@ void LinesManager::initRoute() { if (lineIdx == MAX_LINES) error("ERROR - LAST LINE NOT FOUND"); - int16 *nextLineData = Ligne[lineIdx + 1]._lineData; + int16 *nextLineData = _lineItem[lineIdx + 1]._lineData; if (nextLineData[0] != curLineX && nextLineData[1] != curLineY) break; ++lineIdx; @@ -445,9 +445,9 @@ void LinesManager::initRoute() { _lastLine = lineIdx; for (int idx = 1; idx < MAX_LINES; idx++) { - if ((Ligne[idx]._lineDataEndIdx < _maxLineIdx) && (idx != _lastLine + 1)) { - Ligne[idx]._directionRouteInc = Ligne[idx - 1]._directionRouteInc; - Ligne[idx]._directionRouteDec = Ligne[idx - 1]._directionRouteDec; + if ((_lineItem[idx]._lineDataEndIdx < _maxLineIdx) && (idx != _lastLine + 1)) { + _lineItem[idx]._directionRouteInc = _lineItem[idx - 1]._directionRouteInc; + _lineItem[idx]._directionRouteDec = _lineItem[idx - 1]._directionRouteDec; } } } @@ -458,26 +458,26 @@ int LinesManager::CONTOURNE(int a1, int a2, int a3, int a4, int a5, RouteItem *r int v7 = a2; int v8 = a3; if (a1 < a4) { - v8 = Ligne[a1].appendToRouteInc(a2, -1, route, v8); + v8 = _lineItem[a1].appendToRouteInc(a2, -1, route, v8); for (int i = a1 + 1; i < a4; i++) - v8 = Ligne[i].appendToRouteInc(0, -1, route, v8); + v8 = _lineItem[i].appendToRouteInc(0, -1, route, v8); v7 = 0; v36 = a4; } if (v36 > a4) { - v8 = Ligne[v36].appendToRouteDec(v7, 0, route, v8); + v8 = _lineItem[v36].appendToRouteDec(v7, 0, route, v8); for (int i = v36 - 1; i > a4; i--) - v8 = Ligne[i].appendToRouteDec(-1, 0, route, v8); - v7 = Ligne[a4]._lineDataEndIdx - 1; + v8 = _lineItem[i].appendToRouteDec(-1, 0, route, v8); + v7 = _lineItem[a4]._lineDataEndIdx - 1; v36 = a4; } if (v36 == a4) { if (a5 >= v7) { - v8 = Ligne[a4].appendToRouteInc(v7, a5, route, v8); + v8 = _lineItem[a4].appendToRouteInc(v7, a5, route, v8); } else { - v8 = Ligne[a4].appendToRouteDec(v7, a5, route, v8); + v8 = _lineItem[a4].appendToRouteDec(v7, a5, route, v8); } } return v8; @@ -489,12 +489,12 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem * int v10 = a2; int v40 = a3; if (a4 < a1) { - v40 = Ligne[a1].appendToRouteInc(a2, -1, route, v40); + v40 = _lineItem[a1].appendToRouteInc(a2, -1, route, v40); int v15 = a1 + 1; if (v15 == a9 + 1) v15 = a8; while (a4 != v15) { - v40 = Ligne[v15].appendToRouteInc(0, -1, route, v40); + v40 = _lineItem[v15].appendToRouteInc(0, -1, route, v40); ++v15; if (a9 + 1 == v15) v15 = a8; @@ -503,24 +503,24 @@ int LinesManager::CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem * v9 = a4; } if (a4 > v9) { - v40 = Ligne[v9].appendToRouteDec(v10, 0, route, v40); + v40 = _lineItem[v9].appendToRouteDec(v10, 0, route, v40); int v24 = v9 - 1; if (v24 == a8 - 1) v24 = a9; while (a4 != v24) { - v40 = Ligne[v24].appendToRouteDec(-1, 0, route, v40); + v40 = _lineItem[v24].appendToRouteDec(-1, 0, route, v40); --v24; if (a8 - 1 == v24) v24 = a9; } - v10 = Ligne[a4]._lineDataEndIdx - 1; + v10 = _lineItem[a4]._lineDataEndIdx - 1; v9 = a4; } if (a4 == v9) { if (a5 >= v10) { - v40 = Ligne[a4].appendToRouteInc(v10, a5, route, v40); + v40 = _lineItem[a4].appendToRouteInc(v10, a5, route, v40); } else { - v40 = Ligne[a4].appendToRouteDec(v10, a5, route, v40); + v40 = _lineItem[a4].appendToRouteDec(v10, a5, route, v40); } } return v40; @@ -544,7 +544,7 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { int v7 = a5; int v51; if (checkCollisionLine(fromX, fromY, &v51, &v50, 0, _linesNumb)) { - switch (Ligne[v50]._direction) { + switch (_lineItem[v50]._direction) { case DIR_UP: curY -= 2; break; @@ -693,19 +693,19 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { v35 = v47; for (int v22 = 0; v22 < v39; v22++) { if (checkCollisionLine(v41, v40 - v22, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - int v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &super_parcours[0]); + int v23 = GENIAL(v46, v47, v41, v40 - v22, v41, v40 - v39, v7, &_bestRoute[0]); if (v23 == -1) return false; v7 = v23; - if (NVPY != -1) - v22 = NVPY - v40; + if (_newPosY != -1) + v22 = _newPosY - v40; } - super_parcours[v7].set(v41, v40 - v22, DIR_UP); + _bestRoute[v7].set(v41, v40 - v22, DIR_UP); v7++; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; + _newLineIdx = v36; + _newLineDataIdx = v35; + _newRouteIdx = v7; return true; break; case DIR_RIGHT: @@ -713,19 +713,19 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { v35 = v45; for (int v31 = 0; v31 < v38; v31++) { if (checkCollisionLine(v31 + v41, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - int v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &super_parcours[0]); + int v32 = GENIAL(v46, v47, v31 + v41, v40, v38 + v41, v40, v7, &_bestRoute[0]); if (v32 == -1) return false; v7 = v32; - if (NVPX != -1) - v31 = NVPX - v41; + if (_newPosX != -1) + v31 = _newPosX - v41; } - super_parcours[v7].set(v31 + v41, v40, DIR_RIGHT); + _bestRoute[v7].set(v31 + v41, v40, DIR_RIGHT); v7++; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; + _newLineIdx = v36; + _newLineDataIdx = v35; + _newRouteIdx = v7; return true; break; case DIR_DOWN: @@ -733,19 +733,19 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { v35 = v49; for (int v25 = 0; v25 < v37; v25++) { if (checkCollisionLine(v41, v25 + v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - int v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &super_parcours[0]); + int v26 = GENIAL(v46, v47, v41, v25 + v40, v41, v37 + v40, v7, &_bestRoute[0]); if (v26 == -1) return false; v7 = v26; - if (NVPY != -1) - v25 = v40 - NVPY; + if (_newPosY != -1) + v25 = v40 - _newPosY; } - super_parcours[v7].set(v41, v25 + v40, DIR_DOWN); + _bestRoute[v7].set(v41, v25 + v40, DIR_DOWN); v7++; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; + _newLineIdx = v36; + _newLineDataIdx = v35; + _newRouteIdx = v7; return true; break; case DIR_LEFT: @@ -753,19 +753,19 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int a3, int a4, int a5) { v35 = v43; for (int v28 = 0; v28 < v18; v28++) { if (checkCollisionLine(v41 - v28, v40, &v47, &v46, _lastLine + 1, _linesNumb) && _lastLine < v46) { - int v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &super_parcours[0]); + int v29 = GENIAL(v46, v47, v41 - v28, v40, v41 - v18, v40, v7, &_bestRoute[0]); if (v29 == -1) return false; v7 = v29; - if (NVPX != -1) - v28 = v41 - NVPX; + if (_newPosX != -1) + v28 = v41 - _newPosX; } - super_parcours[v7].set(v41 - v28, v40, DIR_LEFT); + _bestRoute[v7].set(v41 - v28, v40, DIR_LEFT); v7++; } - NV_LIGNEDEP = v36; - NV_LIGNEOFS = v35; - NV_POSI = v7; + _newLineIdx = v36; + _newLineDataIdx = v35; + _newRouteIdx = v7; return true; break; default: @@ -784,7 +784,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a route[a7].invalidate(); return -1; } - int16 *v10 = Ligne[lineIdx]._lineData; + int16 *v10 = _lineItem[lineIdx]._lineData; int v98 = v10[0]; int v97 = v10[1]; int v92 = lineIdx; @@ -793,16 +793,16 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a bool loopCond = false; for (;;) { int v86 = v92 - 1; - int v11 = 2 * Ligne[v92 - 1]._lineDataEndIdx; + int v11 = 2 * _lineItem[v92 - 1]._lineDataEndIdx; - int16 *v12 = Ligne[v92 - 1]._lineData; + int16 *v12 = _lineItem[v92 - 1]._lineData; if (v12 == (int16 *)g_PTRNUL) break; while (v12[v11 - 2] != v98 || v97 != v12[v11 - 1]) { --v86; if (_lastLine - 1 != v86) { - v11 = 2 * Ligne[v86]._lineDataEndIdx; - v12 = Ligne[v86]._lineData; + v11 = 2 * _lineItem[v86]._lineDataEndIdx; + v12 = _lineItem[v86]._lineData; if (v12 != (int16 *)g_PTRNUL) continue; } @@ -817,16 +817,16 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a v97 = v12[1]; } - int16 *v13 = Ligne[lineIdx]._lineData; - int v95 = v13[2 * Ligne[lineIdx]._lineDataEndIdx - 2]; - int v93 = v13[2 * Ligne[lineIdx]._lineDataEndIdx - 1]; + int16 *v13 = _lineItem[lineIdx]._lineData; + int v95 = v13[2 * _lineItem[lineIdx]._lineDataEndIdx - 2]; + int v93 = v13[2 * _lineItem[lineIdx]._lineDataEndIdx - 1]; int v91 = lineIdx; int foundLineIdx, foundDataIdx; loopCond = false; for (;;) { int v87 = v91 + 1; - int v15 = 2 * Ligne[v91 + 1]._lineDataEndIdx; - int16 *v16 = Ligne[v91 + 1]._lineData; + int v15 = 2 * _lineItem[v91 + 1]._lineDataEndIdx; + int16 *v16 = _lineItem[v91 + 1]._lineData; if (v16 == (int16 *)g_PTRNUL) break; int v17; @@ -838,8 +838,8 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a ++v87; if (v87 != _linesNumb + 1) { - v15 = 2 * Ligne[v87]._lineDataEndIdx; - v16 = Ligne[v87]._lineData; + v15 = 2 * _lineItem[v87]._lineDataEndIdx; + v16 = _lineItem[v87]._lineData; if (v16 != (int16 *)g_PTRNUL) continue; } @@ -872,11 +872,11 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a if (v85 > 800) v85 = 800; - Common::fill(&BufLig[0], &BufLig[1000], 0); + Common::fill(&_lineBuf[0], &_lineBuf[1000], 0); int bugLigIdx = 0; for (int v88 = 0; v88 < v85 + 1; v88++) { - BufLig[bugLigIdx] = v82; - BufLig[bugLigIdx + 1] = v81; + _lineBuf[bugLigIdx] = v82; + _lineBuf[bugLigIdx + 1] = v81; v21 += v84; v22 += v83; v82 = v21 / 1000; @@ -888,11 +888,11 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a int v78 = 0; int v79 = 0; for (int v89 = v85 + 1; v89 > 0; v89--) { - if (checkCollisionLine(BufLig[bugLigIdx], BufLig[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { + if (checkCollisionLine(_lineBuf[bugLigIdx], _lineBuf[bugLigIdx + 1], &foundDataIdx, &foundLineIdx, v92, v91) && _lastLine < foundLineIdx) { v80 = foundLineIdx; v77 = foundDataIdx; - v78 = BufLig[bugLigIdx]; - v79 = BufLig[bugLigIdx + 1]; + v78 = _lineBuf[bugLigIdx]; + v79 = _lineBuf[bugLigIdx + 1]; break; } bugLigIdx -= 2; @@ -902,39 +902,39 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a int v70 = 0; int v72 = 0; for (int i = v92; i <= v91; ++i) { - int16 *lineData = Ligne[i]._lineData; + int16 *lineData = _lineItem[i]._lineData; if (lineData == (int16 *)g_PTRNUL) error("error in genial routine"); if (i == v92) { - v72 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; - if (lineData[1] <= lineData[2 * Ligne[i]._lineDataEndIdx - 1]) + v72 = lineData[2 * _lineItem[i]._lineDataEndIdx - 1]; + if (lineData[1] <= lineData[2 * _lineItem[i]._lineDataEndIdx - 1]) v72 = lineData[1]; - v70 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; - if (lineData[1] >= lineData[2 * Ligne[i]._lineDataEndIdx - 1]) + v70 = lineData[2 * _lineItem[i]._lineDataEndIdx - 1]; + if (lineData[1] >= lineData[2 * _lineItem[i]._lineDataEndIdx - 1]) v70 = lineData[1]; - v68 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; - if (lineData[0] <= lineData[2 * Ligne[i]._lineDataEndIdx - 2]) + v68 = lineData[2 * _lineItem[i]._lineDataEndIdx - 2]; + if (lineData[0] <= lineData[2 * _lineItem[i]._lineDataEndIdx - 2]) v68 = lineData[0]; - v66 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; - if (lineData[0] >= lineData[2 * Ligne[i]._lineDataEndIdx - 2]) + v66 = lineData[2 * _lineItem[i]._lineDataEndIdx - 2]; + if (lineData[0] >= lineData[2 * _lineItem[i]._lineDataEndIdx - 2]) v66 = lineData[0]; } else { - if (lineData[1] < lineData[2 * Ligne[i]._lineDataEndIdx - 1] && lineData[1] < v72) + if (lineData[1] < lineData[2 * _lineItem[i]._lineDataEndIdx - 1] && lineData[1] < v72) v72 = lineData[1]; - if (lineData[2 * Ligne[i]._lineDataEndIdx - 1] < lineData[1] && lineData[2 * Ligne[i]._lineDataEndIdx - 1] < v72) - v72 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; - if (lineData[1] > lineData[2 * Ligne[i]._lineDataEndIdx - 1] && lineData[1] > v70) + if (lineData[2 * _lineItem[i]._lineDataEndIdx - 1] < lineData[1] && lineData[2 * _lineItem[i]._lineDataEndIdx - 1] < v72) + v72 = lineData[2 * _lineItem[i]._lineDataEndIdx - 1]; + if (lineData[1] > lineData[2 * _lineItem[i]._lineDataEndIdx - 1] && lineData[1] > v70) v70 = lineData[1]; - if (lineData[2 * Ligne[i]._lineDataEndIdx - 1] > lineData[1] && lineData[2 * Ligne[i]._lineDataEndIdx - 1] > v70) - v70 = lineData[2 * Ligne[i]._lineDataEndIdx - 1]; - if (lineData[0] < lineData[2 * Ligne[i]._lineDataEndIdx - 2] && v68 > lineData[0]) + if (lineData[2 * _lineItem[i]._lineDataEndIdx - 1] > lineData[1] && lineData[2 * _lineItem[i]._lineDataEndIdx - 1] > v70) + v70 = lineData[2 * _lineItem[i]._lineDataEndIdx - 1]; + if (lineData[0] < lineData[2 * _lineItem[i]._lineDataEndIdx - 2] && v68 > lineData[0]) v68 = lineData[0]; - if (lineData[2 * Ligne[i]._lineDataEndIdx - 2] < lineData[0] && v68 > lineData[2 * Ligne[i]._lineDataEndIdx - 2]) - v68 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; - if (lineData[0] > lineData[2 * Ligne[i]._lineDataEndIdx - 2] && v66 < lineData[0]) + if (lineData[2 * _lineItem[i]._lineDataEndIdx - 2] < lineData[0] && v68 > lineData[2 * _lineItem[i]._lineDataEndIdx - 2]) + v68 = lineData[2 * _lineItem[i]._lineDataEndIdx - 2]; + if (lineData[0] > lineData[2 * _lineItem[i]._lineDataEndIdx - 2] && v66 < lineData[0]) v66 = lineData[0]; - if (lineData[2 * Ligne[i]._lineDataEndIdx - 2] > lineData[0] && v66 < lineData[2 * Ligne[i]._lineDataEndIdx - 2]) - v66 = lineData[2 * Ligne[i]._lineDataEndIdx - 2]; + if (lineData[2 * _lineItem[i]._lineDataEndIdx - 2] > lineData[0] && v66 < lineData[2 * _lineItem[i]._lineDataEndIdx - 2]) + v66 = lineData[2 * _lineItem[i]._lineDataEndIdx - 2]; } } int v69 = v68 - 2; @@ -992,8 +992,8 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a } } if (v78 < a3 - 1 || v78 > a3 + 1 || v79 < a4 - 1 || v79 > a4 + 1) { - NVPX = v78; - NVPY = v79; + _newPosX = v78; + _newPosY = v79; if (lineIdx < v80) { int v43 = 0; int v42 = lineIdx; @@ -1006,7 +1006,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a v42 = v91; } while (v80 != v42); if (abs(v80 - lineIdx) == v43) { - if (dataIdx > abs(Ligne[lineIdx]._lineDataEndIdx / 2)) { + if (dataIdx > abs(_lineItem[lineIdx]._lineDataEndIdx / 2)) { result = CONTOURNE(lineIdx, dataIdx, a7, v80, v77, route); } else { result = CONTOURNE1(lineIdx, dataIdx, a7, v80, v77, route, v92, v91); @@ -1030,7 +1030,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a v47 = v92; } while (v80 != v47); if (v45 == v48) { - if (dataIdx > abs(Ligne[lineIdx]._lineDataEndIdx / 2)) { + if (dataIdx > abs(_lineItem[lineIdx]._lineDataEndIdx / 2)) { result = CONTOURNE1(lineIdx, dataIdx, result, v80, v77, route, v92, v91); } else { result = CONTOURNE(lineIdx, dataIdx, result, v80, v77, route); @@ -1044,45 +1044,45 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a if (lineIdx == v80) result = CONTOURNE(lineIdx, dataIdx, result, lineIdx, v77, route); for(;;) { - if (!checkCollisionLine(NVPX, NVPY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb)) + if (!checkCollisionLine(_newPosX, _newPosY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb)) break; - switch (Ligne[foundLineIdx]._direction) { + switch (_lineItem[foundLineIdx]._direction) { case DIR_UP: - --NVPY; + --_newPosY; break; case DIR_UP_RIGHT: - --NVPY; - ++NVPX; + --_newPosY; + ++_newPosX; break; case DIR_RIGHT: - ++NVPX; + ++_newPosX; break; case DIR_DOWN_RIGHT: - ++NVPY; - ++NVPX; + ++_newPosY; + ++_newPosX; break; case DIR_DOWN: - ++NVPY; + ++_newPosY; break; case DIR_DOWN_LEFT: - ++NVPY; - --NVPX; + ++_newPosY; + --_newPosX; break; case DIR_LEFT: - --NVPX; + --_newPosX; break; case DIR_UP_LEFT: - --NVPY; - --NVPX; + --_newPosY; + --_newPosX; break; default: break; } } } else { - NVPX = -1; - NVPY = -1; + _newPosX = -1; + _newPosY = -1; } return result; } @@ -1147,7 +1147,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } if (PARC_PERS(fromX, fromY, clipDestX, clipDestY, -1, -1, 0) == 1) - return super_parcours; + return _bestRoute; int v14 = 0; for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { @@ -1324,26 +1324,26 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v55 = PARC_PERS(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); if (v55 == 1) - return super_parcours; + return _bestRoute; if (v55 == 2) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; + v115 = _newLineIdx; + v114 = _newLineDataIdx; + v112 = _newRouteIdx; } else { if (newDir == DIR_UP) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, super_parcours); + int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, _bestRoute); if (v58 == -1) { - super_parcours[v112].invalidate(); - return &super_parcours[0]; + _bestRoute[v112].invalidate(); + return &_bestRoute[0]; } v112 = v58; - if (NVPY != -1) - deltaY = fromY - NVPY; + if (_newPosY != -1) + deltaY = fromY - _newPosY; } - super_parcours[v112].set(fromX, fromY - deltaY, DIR_UP); + _bestRoute[v112].set(fromX, fromY - deltaY, DIR_UP); v112++; } } @@ -1351,48 +1351,48 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &super_parcours[0]); + int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &_bestRoute[0]); if (v61 == -1) { - super_parcours[v112].invalidate(); - return &super_parcours[0]; + _bestRoute[v112].invalidate(); + return &_bestRoute[0]; } v112 = v61; - if (NVPY != -1) - deltaY = NVPY - fromY; + if (_newPosY != -1) + deltaY = _newPosY - fromY; } - super_parcours[v112].set(fromX, fromY + deltaY, DIR_DOWN); + _bestRoute[v112].set(fromX, fromY + deltaY, DIR_DOWN); v112++; } } if (newDir == DIR_LEFT) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &super_parcours[0]); + int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &_bestRoute[0]); if (v64 == -1) { - super_parcours[v112].invalidate(); - return &super_parcours[0]; + _bestRoute[v112].invalidate(); + return &_bestRoute[0]; } v112 = v64; - if (NVPX != -1) - deltaX = fromX - NVPX; + if (_newPosX != -1) + deltaX = fromX - _newPosX; } - super_parcours[v112].set(fromX - deltaX, fromY, DIR_LEFT); + _bestRoute[v112].set(fromX - deltaX, fromY, DIR_LEFT); v112++; } } if (newDir == DIR_RIGHT) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &super_parcours[0]); + int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &_bestRoute[0]); if (v67 == -1) { - super_parcours[v112].invalidate(); - return &super_parcours[0]; + _bestRoute[v112].invalidate(); + return &_bestRoute[0]; } v112 = v67; - if (NVPX != -1) - deltaX = NVPX - fromX; + if (_newPosX != -1) + deltaX = _newPosX - fromX; } - super_parcours[v112].set(fromX + deltaX, fromY, DIR_RIGHT); + _bestRoute[v112].set(fromX + deltaX, fromY, DIR_RIGHT); v112++; } } @@ -1403,28 +1403,28 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { do { loopCond = false; if (v115 < v121) { - for (int i = v114; Ligne[v115]._lineDataEndIdx > i; ++i) { - v119 = Ligne[v115]._lineData[2 * i]; - v118 = Ligne[v115]._lineData[2 * i + 1]; - super_parcours[v112].set(Ligne[v115]._lineData[2 * i], Ligne[v115]._lineData[2 * i + 1], Ligne[v115]._directionRouteInc); + for (int i = v114; _lineItem[v115]._lineDataEndIdx > i; ++i) { + v119 = _lineItem[v115]._lineData[2 * i]; + v118 = _lineItem[v115]._lineData[2 * i + 1]; + _bestRoute[v112].set(_lineItem[v115]._lineData[2 * i], _lineItem[v115]._lineData[2 * i + 1], _lineItem[v115]._directionRouteInc); v112++; } for (int v116 = v115 + 1; v116 < v121; v116++) { int v72 = 0; int v110 = v116; - for (int j = v116; Ligne[j]._lineDataEndIdx > v72; j = v116) { - v119 = Ligne[v110]._lineData[2 * v72]; - v118 = Ligne[v110]._lineData[2 * v72 + 1]; - super_parcours[v112].set(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], Ligne[v110]._directionRouteInc); + for (int j = v116; _lineItem[j]._lineDataEndIdx > v72; j = v116) { + v119 = _lineItem[v110]._lineData[2 * v72]; + v118 = _lineItem[v110]._lineData[2 * v72 + 1]; + _bestRoute[v112].set(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], _lineItem[v110]._directionRouteInc); v112++; - if (Ligne[v110]._lineDataEndIdx > 30 && v72 == Ligne[v110]._lineDataEndIdx / 2) { - int v78 = PARC_PERS(Ligne[v110]._lineData[2 * v72], Ligne[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); + if (_lineItem[v110]._lineDataEndIdx > 30 && v72 == _lineItem[v110]._lineDataEndIdx / 2) { + int v78 = PARC_PERS(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) - return &super_parcours[0]; + return &_bestRoute[0]; if (v78 == 2 || MIRACLE(v119, v118, v110, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; + v115 = _newLineIdx; + v114 = _newLineDataIdx; + v112 = _newRouteIdx; loopCond = true; break; } @@ -1438,11 +1438,11 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); if (v79 == 1) - return &super_parcours[0]; + return &_bestRoute[0]; if (v79 == 2 || MIRACLE(v119, v118, v116, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; + v115 = _newLineIdx; + v114 = _newLineDataIdx; + v112 = _newRouteIdx; loopCond = true; break; } @@ -1455,26 +1455,26 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { } if (v115 > v121) { for (int dataIdx = v114; dataIdx > 0; dataIdx--) { - v119 = Ligne[v115]._lineData[2 * dataIdx]; - v118 = Ligne[v115]._lineData[2 * dataIdx + 1]; + v119 = _lineItem[v115]._lineData[2 * dataIdx]; + v118 = _lineItem[v115]._lineData[2 * dataIdx + 1]; - super_parcours[v112].set(Ligne[v115]._lineData[2 * dataIdx], Ligne[v115]._lineData[2 * dataIdx + 1], Ligne[v115]._directionRouteDec); + _bestRoute[v112].set(_lineItem[v115]._lineData[2 * dataIdx], _lineItem[v115]._lineData[2 * dataIdx + 1], _lineItem[v115]._directionRouteDec); v112++; } for (int v117 = v115 - 1; v117 > v121; v117--) { - for (int dataIdx = Ligne[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { - v119 = Ligne[v117]._lineData[2 * dataIdx]; - v118 = Ligne[v117]._lineData[2 * dataIdx + 1]; - super_parcours[v112].set(Ligne[v117]._lineData[2 * dataIdx], Ligne[v117]._lineData[2 * dataIdx + 1], Ligne[v117]._directionRouteDec); + for (int dataIdx = _lineItem[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { + v119 = _lineItem[v117]._lineData[2 * dataIdx]; + v118 = _lineItem[v117]._lineData[2 * dataIdx + 1]; + _bestRoute[v112].set(_lineItem[v117]._lineData[2 * dataIdx], _lineItem[v117]._lineData[2 * dataIdx + 1], _lineItem[v117]._directionRouteDec); v112++; - if (Ligne[v117]._lineDataEndIdx > 30 && dataIdx == Ligne[v117]._lineDataEndIdx / 2) { + if (_lineItem[v117]._lineDataEndIdx > 30 && dataIdx == _lineItem[v117]._lineDataEndIdx / 2) { int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) - return &super_parcours[0]; + return &_bestRoute[0]; if (v88 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; + v115 = _newLineIdx; + v114 = _newLineDataIdx; + v112 = _newRouteIdx; loopCond = true; break; } @@ -1486,18 +1486,18 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v89 == 1) - return &super_parcours[0]; + return &_bestRoute[0]; if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { - v115 = NV_LIGNEDEP; - v114 = NV_LIGNEOFS; - v112 = NV_POSI; + v115 = _newLineIdx; + v114 = _newLineDataIdx; + v112 = _newRouteIdx; loopCond = true; break; } } if (!loopCond) { - v114 = Ligne[v121]._lineDataEndIdx - 1; + v114 = _lineItem[v121]._lineDataEndIdx - 1; v115 = v121; } } @@ -1505,16 +1505,16 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (v115 == v121) { if (v114 <= v120) { - v112 = Ligne[v121].appendToRouteInc(v114, v120, super_parcours, v112); + v112 = _lineItem[v121].appendToRouteInc(v114, v120, _bestRoute, v112); } else { - v112 = Ligne[v121].appendToRouteDec(v114, v120, super_parcours, v112); + v112 = _lineItem[v121].appendToRouteDec(v114, v120, _bestRoute, v112); } } - if (PARC_PERS(super_parcours[v112 - 1]._x, super_parcours[v112 - 1]._y, clipDestX, clipDestY, -1, -1, v112) != 1) { - super_parcours[v112].invalidate(); + if (PARC_PERS(_bestRoute[v112 - 1]._x, _bestRoute[v112 - 1]._y, clipDestX, clipDestY, -1, -1, v112) != 1) { + _bestRoute[v112].invalidate(); } - return &super_parcours[0]; + return &_bestRoute[0]; } int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7) { @@ -1569,7 +1569,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int foundDataIdx; int foundLineIdx = a5; if (checkCollisionLine(fromX, fromY, &foundDataIdx, &foundLineIdx, 0, _linesNumb)) { - switch (Ligne[foundLineIdx]._direction) { + switch (_lineItem[foundLineIdx]._direction) { case DIR_UP: curY -= 2; break; @@ -1780,7 +1780,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (v24 == -1) goto retLABEL_essai0; v115 = v24; - if (NVPX != -1 || NVPY != -1) { + if (_newPosX != -1 || _newPosY != -1) { v142 = -1; break; } @@ -1825,7 +1825,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (v44 == -1) goto retLABEL_essai1; v117 = v44; - if (NVPX != -1 && NVPY != -1) + if (_newPosX != -1 && _newPosY != -1) break; } @@ -1840,9 +1840,9 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, } if (v140 <= _lastLine) break; - v33 = NVPX; - v92 = NVPY; - v45 = checkCollisionLine(NVPX, NVPY, &v141, &v140, 0, _lastLine); + v33 = _newPosX; + v92 = _newPosY; + v45 = checkCollisionLine(_newPosX, _newPosY, &v141, &v140, 0, _lastLine); if (v45 && v140 <= _lastLine) break; } @@ -1887,7 +1887,7 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, goto retLABEL_essai2; } v117 = v62; - if (NVPX != -1 && NVPY != -1) + if (_newPosX != -1 && _newPosY != -1) break; } @@ -1904,9 +1904,9 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (collLineIdx <= _lastLine) break; - v54 = NVPX; - v93 = NVPY; - colResult = checkCollisionLine(NVPX, NVPY, &collDataIdx, &collLineIdx, 0, _lastLine); + v54 = _newPosX; + v93 = _newPosY; + colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdx, &collLineIdx, 0, _lastLine); if (colResult && collLineIdx <= _lastLine) break; } @@ -1916,36 +1916,36 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (!v136) { if (a6 > foundLineIdx) { if (essai0[0]._x != -1 && v142 > foundLineIdx && v140 <= v142 && collLineIdx <= v142 && a6 >= v142) { - NV_LIGNEDEP = v142; - NV_LIGNEOFS = v143; + _newLineIdx = v142; + _newLineDataIdx = v143; int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai0[i++]; + _bestRoute[v137++] = essai0[i++]; } while (essai0[i].isValid()); - NV_POSI = v137; + _newRouteIdx = v137; return 2; } if (essai1[0]._x != -1 && foundLineIdx < v140 && collLineIdx <= v140 && v142 <= v140 && a6 >= v140) { - NV_LIGNEDEP = v140; - NV_LIGNEOFS = v141; + _newLineIdx = v140; + _newLineDataIdx = v141; int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai1[i++]; + _bestRoute[v137++] = essai1[i++]; } while (essai1[i].isValid()); - NV_POSI = v137; + _newRouteIdx = v137; return 2; } if (essai2[0]._x != -1 && foundLineIdx < collLineIdx && v140 < collLineIdx && v142 < collLineIdx && a6 >= collLineIdx) { - NV_LIGNEDEP = collLineIdx; - NV_LIGNEOFS = collDataIdx; + _newLineIdx = collLineIdx; + _newLineDataIdx = collDataIdx; int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai2[i++]; + _bestRoute[v137++] = essai2[i++]; } while (essai2[i].isValid()); - NV_POSI = v137; + _newRouteIdx = v137; return 2; } } @@ -1957,37 +1957,37 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, if (collLineIdx == -1) v142 = 1300; if (essai1[0]._x != -1 && v140 < foundLineIdx && collLineIdx >= v140 && v142 >= v140 && a6 <= v140) { - NV_LIGNEDEP = v140; - NV_LIGNEOFS = v141; + _newLineIdx = v140; + _newLineDataIdx = v141; int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai1[i++]; + _bestRoute[v137++] = essai1[i++]; } while (essai1[i].isValid()); - NV_POSI = v137; + _newRouteIdx = v137; return 2; } if (essai2[0]._x != -1 && foundLineIdx > collLineIdx && v140 >= collLineIdx && v142 >= collLineIdx && a6 <= collLineIdx) { - NV_LIGNEDEP = collLineIdx; - NV_LIGNEOFS = collDataIdx; + _newLineIdx = collLineIdx; + _newLineDataIdx = collDataIdx; int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai2[i++]; + _bestRoute[v137++] = essai2[i++]; } while (essai2[i].isValid()); - NV_POSI = v137; + _newRouteIdx = v137; return 2; } // CHECKME: Checking essai0[0]._X might make more sense here? if (essai1[0]._x != -1 && foundLineIdx > v142 && v140 >= v142 && collLineIdx >= v142 && a6 <= v142) { - NV_LIGNEDEP = v142; - NV_LIGNEOFS = v143; + _newLineIdx = v142; + _newLineDataIdx = v143; int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai0[i++]; + _bestRoute[v137++] = essai0[i++]; } while (essai0[i].isValid()); - NV_POSI = v137; + _newRouteIdx = v137; return 2; } } @@ -1999,10 +1999,10 @@ retLABEL_essai0: int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai0[i++]; + _bestRoute[v137++] = essai0[i++]; } while (essai0[i].isValid()); } - super_parcours[v137].invalidate(); + _bestRoute[v137].invalidate(); return 1; retLABEL_essai1: @@ -2010,10 +2010,10 @@ retLABEL_essai1: int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai1[i++]; + _bestRoute[v137++] = essai1[i++]; } while (essai1[i].isValid()); } - super_parcours[v137].invalidate(); + _bestRoute[v137].invalidate(); return 1; retLABEL_essai2: @@ -2021,10 +2021,10 @@ retLABEL_essai2: int i = 0; do { assert(v137 <= 8000); - super_parcours[v137++] = essai2[i++]; + _bestRoute[v137++] = essai2[i++]; } while (essai2[i].isValid()); } - super_parcours[v137].invalidate(); + _bestRoute[v137].invalidate(); return 1; } @@ -2141,7 +2141,7 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { if (checkCollisionLine(v28, v29, &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine)) break; - super_parcours[superRouteIdx].set(v28, v29, v66); + _bestRoute[superRouteIdx].set(v28, v29, v66); essai0[superRouteIdx].set(v28, v29, v66); superRouteIdx++; @@ -2161,17 +2161,17 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { while (loopFl) { loopFl = false; if (v69 < v73) { - superRouteIdx = Ligne[v69].appendToRouteInc(v68, Ligne[v69]._lineDataEndIdx - 2, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[v69].appendToRouteInc(v68, _lineItem[v69]._lineDataEndIdx - 2, _bestRoute, superRouteIdx); for (int j = v69 + 1; j < v73; ++j) { - if (PLAN_TEST(Ligne[j]._lineData[0], Ligne[j]._lineData[1], superRouteIdx, j, v73)) { - v69 = NV_LIGNEDEP; - v68 = NV_LIGNEOFS; - superRouteIdx = NV_POSI; + if (PLAN_TEST(_lineItem[j]._lineData[0], _lineItem[j]._lineData[1], superRouteIdx, j, v73)) { + v69 = _newLineIdx; + v68 = _newLineDataIdx; + superRouteIdx = _newRouteIdx; loopFl = true; break; } - if (Ligne[j]._lineDataEndIdx - 2 > 0) { - superRouteIdx = Ligne[j].appendToRouteInc(0, Ligne[j]._lineDataEndIdx - 2, super_parcours, superRouteIdx); + if (_lineItem[j]._lineDataEndIdx - 2 > 0) { + superRouteIdx = _lineItem[j].appendToRouteInc(0, _lineItem[j]._lineDataEndIdx - 2, _bestRoute, superRouteIdx); } } if (loopFl) @@ -2180,34 +2180,34 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { v69 = v73; } if (v69 > v73) { - superRouteIdx = Ligne[v69].appendToRouteDec(v68, 0, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[v69].appendToRouteDec(v68, 0, _bestRoute, superRouteIdx); for (int l = v69 - 1; l > v73; --l) { - if (PLAN_TEST(Ligne[l]._lineData[2 * Ligne[l]._lineDataEndIdx - 2], Ligne[l]._lineData[2 * Ligne[l]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { - v69 = NV_LIGNEDEP; - v68 = NV_LIGNEOFS; - superRouteIdx = NV_POSI; + if (PLAN_TEST(_lineItem[l]._lineData[2 * _lineItem[l]._lineDataEndIdx - 2], _lineItem[l]._lineData[2 * _lineItem[l]._lineDataEndIdx - 1], superRouteIdx, l, v73)) { + v69 = _newLineIdx; + v68 = _newLineDataIdx; + superRouteIdx = _newRouteIdx; loopFl = true; break; } - superRouteIdx = Ligne[l].appendToRouteDec(Ligne[l]._lineDataEndIdx - 2, 0, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[l].appendToRouteDec(_lineItem[l]._lineDataEndIdx - 2, 0, _bestRoute, superRouteIdx); } if (loopFl) continue; - v68 = Ligne[v73]._lineDataEndIdx - 1; + v68 = _lineItem[v73]._lineDataEndIdx - 1; v69 = v73; } if (v69 == v73) { if (v68 <= v72) { - superRouteIdx = Ligne[v73].appendToRouteInc(v68, v72, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[v73].appendToRouteInc(v68, v72, _bestRoute, superRouteIdx); } else { - superRouteIdx = Ligne[v73].appendToRouteDec(v68, v72, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[v73].appendToRouteDec(v68, v72, _bestRoute, superRouteIdx); } } } - super_parcours[superRouteIdx].invalidate(); - result = &super_parcours[0]; + _bestRoute[superRouteIdx].invalidate(); + result = &_bestRoute[0]; } else { result = (RouteItem *)g_PTRNUL; } @@ -2452,32 +2452,32 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { if (v8 == 1) { idxTest = idxTestUp; v33 = v42; - NV_LIGNEDEP = lineIdxTestUp; - NV_LIGNEOFS = dataIdxTestUp; + _newLineIdx = lineIdxTestUp; + _newLineDataIdx = dataIdxTestUp; } else if (v8 == 2) { idxTest = idxTestDown; v33 = v43; - NV_LIGNEDEP = lineIdxTestDown; - NV_LIGNEOFS = dataIdxTestDown; + _newLineIdx = lineIdxTestDown; + _newLineDataIdx = dataIdxTestDown; } else if (v8 == 3) { idxTest = idxTestLeft; v33 = v44; - NV_LIGNEDEP = lineIdxTestLeft; - NV_LIGNEOFS = dataIdxTestLeft; + _newLineIdx = lineIdxTestLeft; + _newLineDataIdx = dataIdxTestLeft; } else if (v8 == 4) { idxTest = idxTestRight; v33 = v45; - NV_LIGNEDEP = lineIdxTestRight; - NV_LIGNEOFS = dataIdxTestRight; + _newLineIdx = lineIdxTestRight; + _newLineDataIdx = dataIdxTestRight; } int superRouteIdx = a3; if (v33 == 1) { - superRouteIdx = Ligne[idxTest].appendToRouteInc(0, -1, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[idxTest].appendToRouteInc(0, -1, _bestRoute, superRouteIdx); } else if (v33 == 2) { - superRouteIdx = Ligne[idxTest].appendToRouteDec(-1, -1, super_parcours, superRouteIdx); + superRouteIdx = _lineItem[idxTest].appendToRouteDec(-1, -1, _bestRoute, superRouteIdx); } - NV_POSI = superRouteIdx; + _newRouteIdx = superRouteIdx; return true; } @@ -2489,15 +2489,15 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int collDataIdx; for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) { - lineData = Ligne[idx]._lineData; - lineDataEndIdx = Ligne[idx]._lineDataEndIdx; + lineData = _lineItem[idx]._lineData; + lineDataEndIdx = _lineItem[idx]._lineDataEndIdx; if (lineData[0] == paramX && lineData[1] == paramY) { *a3 = 1; int posX = lineData[2 * (lineDataEndIdx - 1)]; int posY = lineData[2 * (lineDataEndIdx - 1) + 1]; - if (Ligne[idx]._directionRouteInc == DIR_DOWN || Ligne[idx]._directionRouteInc == DIR_UP) + if (_lineItem[idx]._directionRouteInc == DIR_DOWN || _lineItem[idx]._directionRouteInc == DIR_UP) posY += 2; - if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == DIR_LEFT) + if (_lineItem[idx]._directionRouteInc == DIR_RIGHT || _lineItem[idx]._directionRouteDec == DIR_LEFT) posX += 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2509,9 +2509,9 @@ int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, *a3 = 2; int posX = lineData[0]; int posY = lineData[1]; - if (Ligne[idx]._directionRouteInc == DIR_DOWN || Ligne[idx]._directionRouteInc == DIR_UP) + if (_lineItem[idx]._directionRouteInc == DIR_DOWN || _lineItem[idx]._directionRouteInc == DIR_UP) posY -= 2; - if (Ligne[idx]._directionRouteInc == DIR_RIGHT || Ligne[idx]._directionRouteDec == DIR_LEFT) + if (_lineItem[idx]._directionRouteInc == DIR_RIGHT || _lineItem[idx]._directionRouteDec == DIR_LEFT) posX -= 2; if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine)) error("Error in test line"); @@ -2785,15 +2785,15 @@ void LinesManager::clearAll() { essai0 = (RouteItem *)g_PTRNUL; essai1 = (RouteItem *)g_PTRNUL; essai2 = (RouteItem *)g_PTRNUL; - BufLig = (int16 *)g_PTRNUL; + _lineBuf = (int16 *)g_PTRNUL; _route = (RouteItem *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { - Ligne[idx]._lineDataEndIdx = 0; - Ligne[idx]._direction = DIR_NONE; - Ligne[idx]._directionRouteInc = DIR_NONE; - Ligne[idx]._directionRouteDec = DIR_NONE; - Ligne[idx]._lineData = (int16 *)g_PTRNUL; + _lineItem[idx]._lineDataEndIdx = 0; + _lineItem[idx]._direction = DIR_NONE; + _lineItem[idx]._directionRouteInc = DIR_NONE; + _lineItem[idx]._directionRouteDec = DIR_NONE; + _lineItem[idx]._lineData = (int16 *)g_PTRNUL; _zoneLine[idx]._count = 0; _zoneLine[idx]._bobZoneIdx = 0; @@ -2814,8 +2814,8 @@ void LinesManager::clearAll() { if (!_vm->_linesManager.essai2) _vm->_linesManager.essai2 = (RouteItem*)g_PTRNUL; - BUFFERTAPE = _vm->_globals.allocMemory(10000); - _vm->_linesManager.BufLig = (int16 *)(BUFFERTAPE); + _largeBuf = _vm->_globals.allocMemory(10000); + _vm->_linesManager._lineBuf = (int16 *)(_largeBuf); } /** @@ -2837,8 +2837,8 @@ void LinesManager::removeZoneLine(int idx) { void LinesManager::resetLines() { for (int idx = 0; idx < MAX_LINES; ++idx) { removeLine(idx); - Ligne[idx]._lineDataEndIdx = 0; - Ligne[idx]._lineData = (int16 *)g_PTRNUL; + _lineItem[idx]._lineDataEndIdx = 0; + _lineItem[idx]._lineData = (int16 *)g_PTRNUL; } } @@ -2846,7 +2846,7 @@ void LinesManager::resetLines() { void LinesManager::removeLine(int idx) { if (idx > MAX_LINES) error("Attempting to add a line obstacle > MAX_LIGNE."); - Ligne[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)Ligne[idx]._lineData); + _lineItem[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)_lineItem[idx]._lineData); } void LinesManager::setMaxLineIdx(int idx) { @@ -2922,13 +2922,13 @@ void LinesManager::checkZone() { } } if (zoneId != -1) { - if (ZONEP[zoneId].field6 || ZONEP[zoneId].field7 || - ZONEP[zoneId].field8 || ZONEP[zoneId].field9 || - ZONEP[zoneId].fieldA || ZONEP[zoneId].fieldB || - ZONEP[zoneId].fieldC || ZONEP[zoneId].fieldD || - ZONEP[zoneId].fieldE || ZONEP[zoneId].fieldF) { + if (ZONEP[zoneId]._verbFl1 || ZONEP[zoneId]._verbFl2 || + ZONEP[zoneId]._verbFl3 || ZONEP[zoneId]._verbFl4 || + ZONEP[zoneId]._verbFl5 || ZONEP[zoneId]._verbFl6 || + ZONEP[zoneId]._verbFl7 || ZONEP[zoneId]._verbFl8 || + ZONEP[zoneId]._verbFl9 || ZONEP[zoneId]._verbFl10) { if (_vm->_globals._oldMouseZoneId != zoneId) { - _vm->_fontManager.initTextBuffers(5, ZONEP[zoneId].field12, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); + _vm->_fontManager.initTextBuffers(5, ZONEP[zoneId]._messageId, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); _vm->_fontManager.showText(5); _vm->_globals._forceHideText = true; } @@ -2938,7 +2938,7 @@ void LinesManager::checkZone() { _vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor); if (_vm->_eventsManager._mouseCursorId == 4) { - if (ZONEP[zoneId].field6 == 2) { + if (ZONEP[zoneId]._verbFl1 == 2) { _vm->_eventsManager.changeMouseCursor(16); _vm->_eventsManager._mouseCursorId = 16; _vm->_objectsManager.setVerb(16); diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index e38ce6a6b0..ec36746f10 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -76,18 +76,18 @@ struct ZonePItem { int _destX; int _destY; int _spriteIndex; - int field6; - int field7; - int field8; - int field9; - int fieldA; - int fieldB; - int fieldC; - int fieldD; - int fieldE; - int fieldF; + int _verbFl1; + int _verbFl2; + int _verbFl3; + int _verbFl4; + int _verbFl5; + int _verbFl6; + int _verbFl7; + int _verbFl8; + int _verbFl9; + int _verbFl10; bool _enabledFl; - int field12; + int _messageId; }; struct RouteItem { @@ -106,25 +106,26 @@ private: int _pathFindingMaxDepth; SmoothItem _smoothRoute[4000]; - int NV_LIGNEDEP; - int NV_LIGNEOFS; - int NV_POSI; - int NVPX; - int NVPY; Directions _smoothMoveDirection; - RouteItem super_parcours[8001]; - byte *BUFFERTAPE; - RouteItem *essai0; - RouteItem *essai1; - int16 *BufLig; LigneZoneItem _zoneLine[401]; - LigneItem Ligne[400]; SegmentItem _segment[101]; SquareZoneItem _squareZone[101]; int _currentSegmentId; int _maxLineIdx; int _lastLine; int _linesNumb; + int _newLineIdx; + int _newLineDataIdx; + int _newRouteIdx; + int _newPosX; + int _newPosY; + + byte *_largeBuf; + RouteItem *essai0; + RouteItem *essai1; + int16 *_lineBuf; + LigneItem _lineItem[400]; + RouteItem _bestRoute[8001]; int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index de10775e01..b83de7230f 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -409,7 +409,7 @@ void ObjectsManager::displaySprite() { _vm->_globals._sortedDisplayCount = 0; if (_vm->_dialogsManager._inventDisplayedFl) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventWin1, _vm->_dialogsManager._inventX, _vm->_dialogsManager._inventY, _vm->_dialogsManager._inventWidth, _vm->_dialogsManager._inventHeight); if (_oldBorderPos.x && _oldBorderPos.y) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_dialogsManager._inventBuf2, _oldBorderPos.x + 300, _oldBorderPos.y + 300, _oldBorderSpriteIndex + 1); if (_borderPos.x && _borderPos.y) @@ -418,7 +418,7 @@ void ObjectsManager::displaySprite() { } if (_saveLoadFl) { - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, _saveLoadSprite, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, _saveLoadSprite, _vm->_eventsManager._startPos.x + 183, 60, 274, 353); if (_saveLoadX && _saveLoadY) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _saveLoadSprite2, _saveLoadX + _vm->_eventsManager._startPos.x + 300, _saveLoadY + 300, 0); @@ -1076,11 +1076,11 @@ void ObjectsManager::displayVBob() { width = getWidth(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); height = getHeight(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaScreen, + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); - _vm->_graphicsManager.Restore_Mem( + _vm->_graphicsManager.restoreSurfaceRect( _vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); @@ -1106,12 +1106,12 @@ void ObjectsManager::displayVBob() { width = getWidth(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); height = getHeight(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaScreen, + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, _vm->_globals.VBob[idx]._oldY, width, height); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, _vm->_globals.VBob[idx]._oldY, width, height); @@ -1138,7 +1138,7 @@ void ObjectsManager::displayVBob() { byte *surface = _vm->_globals.allocMemory(height * width); _vm->_globals.VBob[idx]._surface = surface; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaScreen, surface, + _vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaScreen, surface, _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); byte *v10 = _vm->_globals.VBob[idx]._spriteData; @@ -1665,17 +1665,17 @@ void ObjectsManager::loadZone(const Common::String &file) { _vm->_linesManager.ZONEP[i]._destX = 0; _vm->_linesManager.ZONEP[i]._destY = 0; _vm->_linesManager.ZONEP[i]._spriteIndex = 0; - _vm->_linesManager.ZONEP[i].field6 = 0; - _vm->_linesManager.ZONEP[i].field7 = 0; - _vm->_linesManager.ZONEP[i].field8 = 0; - _vm->_linesManager.ZONEP[i].field9 = 0; - _vm->_linesManager.ZONEP[i].fieldA = 0; - _vm->_linesManager.ZONEP[i].fieldB = 0; - _vm->_linesManager.ZONEP[i].fieldC = 0; - _vm->_linesManager.ZONEP[i].fieldD = 0; - _vm->_linesManager.ZONEP[i].fieldE = 0; - _vm->_linesManager.ZONEP[i].fieldF = 0; - _vm->_linesManager.ZONEP[i].field12 = 0; + _vm->_linesManager.ZONEP[i]._verbFl1 = 0; + _vm->_linesManager.ZONEP[i]._verbFl2 = 0; + _vm->_linesManager.ZONEP[i]._verbFl3 = 0; + _vm->_linesManager.ZONEP[i]._verbFl4 = 0; + _vm->_linesManager.ZONEP[i]._verbFl5 = 0; + _vm->_linesManager.ZONEP[i]._verbFl6 = 0; + _vm->_linesManager.ZONEP[i]._verbFl7 = 0; + _vm->_linesManager.ZONEP[i]._verbFl8 = 0; + _vm->_linesManager.ZONEP[i]._verbFl9 = 0; + _vm->_linesManager.ZONEP[i]._verbFl10 = 0; + _vm->_linesManager.ZONEP[i]._messageId = 0; _vm->_linesManager.ZONEP[i]._enabledFl = false; } @@ -1713,22 +1713,22 @@ void ObjectsManager::loadZone(const Common::String &file) { byte *v9 = (ptr + 10 * zoneLineIdx + 606); bufId = 0; for (int i = 1; i <= 100; i++) { - _vm->_linesManager.ZONEP[i].field6 = v9[bufId]; - _vm->_linesManager.ZONEP[i].field7 = v9[bufId + 1]; - _vm->_linesManager.ZONEP[i].field8 = v9[bufId + 2]; - _vm->_linesManager.ZONEP[i].field9 = v9[bufId + 3]; - _vm->_linesManager.ZONEP[i].fieldA = v9[bufId + 4]; - _vm->_linesManager.ZONEP[i].fieldB = v9[bufId + 5]; - _vm->_linesManager.ZONEP[i].fieldC = v9[bufId + 6]; - _vm->_linesManager.ZONEP[i].fieldD = v9[bufId + 7]; - _vm->_linesManager.ZONEP[i].fieldE = v9[bufId + 8]; - _vm->_linesManager.ZONEP[i].fieldF = v9[bufId + 9]; + _vm->_linesManager.ZONEP[i]._verbFl1 = v9[bufId]; + _vm->_linesManager.ZONEP[i]._verbFl2 = v9[bufId + 1]; + _vm->_linesManager.ZONEP[i]._verbFl3 = v9[bufId + 2]; + _vm->_linesManager.ZONEP[i]._verbFl4 = v9[bufId + 3]; + _vm->_linesManager.ZONEP[i]._verbFl5 = v9[bufId + 4]; + _vm->_linesManager.ZONEP[i]._verbFl6 = v9[bufId + 5]; + _vm->_linesManager.ZONEP[i]._verbFl7 = v9[bufId + 6]; + _vm->_linesManager.ZONEP[i]._verbFl8 = v9[bufId + 7]; + _vm->_linesManager.ZONEP[i]._verbFl9 = v9[bufId + 8]; + _vm->_linesManager.ZONEP[i]._verbFl10 = v9[bufId + 9]; bufId += 10; } v9 += 1010; for (int i = 0; i < 100; i++) - _vm->_linesManager.ZONEP[i + 1].field12 = READ_LE_UINT16(v9 + 2 * i); + _vm->_linesManager.ZONEP[i + 1]._messageId = READ_LE_UINT16(v9 + 2 * i); _vm->_globals.freeMemory(ptr); _vm->_linesManager.CARRE_ZONE(); @@ -2094,7 +2094,7 @@ void ObjectsManager::clearScreen() { _changeVerbFl = false; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_globals._oldDirection = DIR_NONE; - _vm->_graphicsManager.RESET_SEGMENT_VESA(); + _vm->_graphicsManager.resetVesaSegment(); } /** @@ -2244,139 +2244,139 @@ void ObjectsManager::nextVerbIcon() { if (_vm->_eventsManager._mouseCursorId == 5 || _vm->_eventsManager._mouseCursorId == 6) { _vm->_eventsManager._mouseCursorId = 6; - if (_vm->_linesManager.ZONEP[_zoneNum].field6 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl1 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 7) { - if (_vm->_linesManager.ZONEP[_zoneNum].field7 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl2 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 8) { - if (_vm->_linesManager.ZONEP[_zoneNum].field8 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl3 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 9) { - if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl4 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 10) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldA == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl5 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 11) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldB == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl6 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 12) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldC == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl7 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 13) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldD == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl8 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 14) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldE == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl9 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 15) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldF == 1) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl10 == 1) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 16) { - if (_vm->_linesManager.ZONEP[_zoneNum].field6 == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl1 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 17) { - if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl4 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 18) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldA == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl5 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 19) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldB == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl6 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 20) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldC == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl7 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 21) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldF == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl10 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 22) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldD == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl8 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 23) { - if (_vm->_linesManager.ZONEP[_zoneNum].field8 == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl3 == 2) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 24) { - if (_vm->_linesManager.ZONEP[_zoneNum].field9 == 3) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl4 == 3) return; ++_vm->_eventsManager._mouseCursorId; } if (_vm->_eventsManager._mouseCursorId == 25) { - if (_vm->_linesManager.ZONEP[_zoneNum].fieldE == 2) + if (_vm->_linesManager.ZONEP[_zoneNum]._verbFl9 == 2) return; } _vm->_eventsManager._mouseCursorId = 4; @@ -3148,17 +3148,17 @@ void ObjectsManager::loadLinkFile(const Common::String &file) { _vm->_linesManager.ZONEP[i]._destX = 0; _vm->_linesManager.ZONEP[i]._destY = 0; _vm->_linesManager.ZONEP[i]._spriteIndex = 0; - _vm->_linesManager.ZONEP[i].field6 = 0; - _vm->_linesManager.ZONEP[i].field7 = 0; - _vm->_linesManager.ZONEP[i].field8 = 0; - _vm->_linesManager.ZONEP[i].field9 = 0; - _vm->_linesManager.ZONEP[i].fieldA = 0; - _vm->_linesManager.ZONEP[i].fieldB = 0; - _vm->_linesManager.ZONEP[i].fieldC = 0; - _vm->_linesManager.ZONEP[i].fieldD = 0; - _vm->_linesManager.ZONEP[i].fieldE = 0; - _vm->_linesManager.ZONEP[i].fieldF = 0; - _vm->_linesManager.ZONEP[i].field12 = 0; + _vm->_linesManager.ZONEP[i]._verbFl1 = 0; + _vm->_linesManager.ZONEP[i]._verbFl2 = 0; + _vm->_linesManager.ZONEP[i]._verbFl3 = 0; + _vm->_linesManager.ZONEP[i]._verbFl4 = 0; + _vm->_linesManager.ZONEP[i]._verbFl5 = 0; + _vm->_linesManager.ZONEP[i]._verbFl6 = 0; + _vm->_linesManager.ZONEP[i]._verbFl7 = 0; + _vm->_linesManager.ZONEP[i]._verbFl8 = 0; + _vm->_linesManager.ZONEP[i]._verbFl9 = 0; + _vm->_linesManager.ZONEP[i]._verbFl10 = 0; + _vm->_linesManager.ZONEP[i]._messageId = 0; } int curLineIdx = 0; @@ -3188,20 +3188,20 @@ void ObjectsManager::loadLinkFile(const Common::String &file) { byte *v22 = ptr + idx + (10 * curLineIdx + 606) + 4; for (int i = 1; i <= 100; i++) { int j = (i - 1) * 10; - _vm->_linesManager.ZONEP[i].field6 = v22[j]; - _vm->_linesManager.ZONEP[i].field7 = v22[j + 1]; - _vm->_linesManager.ZONEP[i].field8 = v22[j + 2]; - _vm->_linesManager.ZONEP[i].field9 = v22[j + 3]; - _vm->_linesManager.ZONEP[i].fieldA = v22[j + 4]; - _vm->_linesManager.ZONEP[i].fieldB = v22[j + 5]; - _vm->_linesManager.ZONEP[i].fieldC = v22[j + 6]; - _vm->_linesManager.ZONEP[i].fieldD = v22[j + 7]; - _vm->_linesManager.ZONEP[i].fieldE = v22[j + 8]; - _vm->_linesManager.ZONEP[i].fieldF = v22[j + 9]; + _vm->_linesManager.ZONEP[i]._verbFl1 = v22[j]; + _vm->_linesManager.ZONEP[i]._verbFl2 = v22[j + 1]; + _vm->_linesManager.ZONEP[i]._verbFl3 = v22[j + 2]; + _vm->_linesManager.ZONEP[i]._verbFl4 = v22[j + 3]; + _vm->_linesManager.ZONEP[i]._verbFl5 = v22[j + 4]; + _vm->_linesManager.ZONEP[i]._verbFl6 = v22[j + 5]; + _vm->_linesManager.ZONEP[i]._verbFl7 = v22[j + 6]; + _vm->_linesManager.ZONEP[i]._verbFl8 = v22[j + 7]; + _vm->_linesManager.ZONEP[i]._verbFl9 = v22[j + 8]; + _vm->_linesManager.ZONEP[i]._verbFl10 = v22[j + 9]; } int dep = 1010; for (int i = 1; i <= 100; i++) { - _vm->_linesManager.ZONEP[i].field12 = READ_LE_INT16(v22 + dep); + _vm->_linesManager.ZONEP[i]._messageId = READ_LE_INT16(v22 + dep); dep += 2; } _vm->_linesManager.CARRE_ZONE(); @@ -3286,10 +3286,10 @@ void ObjectsManager::SPECIAL_INI() { enableVerb(21, 5); enableVerb(22, 5); enableVerb(23, 5); - _vm->_linesManager.ZONEP[20].field12 = 30; - _vm->_linesManager.ZONEP[21].field12 = 30; - _vm->_linesManager.ZONEP[22].field12 = 30; - _vm->_linesManager.ZONEP[23].field12 = 30; + _vm->_linesManager.ZONEP[20]._messageId = 30; + _vm->_linesManager.ZONEP[21]._messageId = 30; + _vm->_linesManager.ZONEP[22]._messageId = 30; + _vm->_linesManager.ZONEP[23]._messageId = 30; for (int i = 200; i <= 214; i++) { if (_vm->_globals._saveData->_data[i] != 2) _vm->_globals._saveData->_data[i] = 0; @@ -3347,42 +3347,42 @@ void ObjectsManager::disableVerb(int idx, int a2) { switch (a2) { case 6: case 16: - _vm->_linesManager.ZONEP[idx].field6 = 0; + _vm->_linesManager.ZONEP[idx]._verbFl1 = 0; break; case 7: - _vm->_linesManager.ZONEP[idx].field7 = 0; + _vm->_linesManager.ZONEP[idx]._verbFl2 = 0; break; case 5: case 8: - _vm->_linesManager.ZONEP[idx].field8 = 0; + _vm->_linesManager.ZONEP[idx]._verbFl3 = 0; break; case 9: case 17: case 24: - _vm->_linesManager.ZONEP[idx].field9 = 0; + _vm->_linesManager.ZONEP[idx]._verbFl4 = 0; break; case 10: case 18: - _vm->_linesManager.ZONEP[idx].fieldA = 0; + _vm->_linesManager.ZONEP[idx]._verbFl5 = 0; break; case 11: case 19: - _vm->_linesManager.ZONEP[idx].fieldB = 0; + _vm->_linesManager.ZONEP[idx]._verbFl6 = 0; break; case 12: case 20: - _vm->_linesManager.ZONEP[idx].fieldC = 0; + _vm->_linesManager.ZONEP[idx]._verbFl7 = 0; break; case 13: case 22: - _vm->_linesManager.ZONEP[idx].fieldD = 0; + _vm->_linesManager.ZONEP[idx]._verbFl8 = 0; case 14: case 21: case 25: - _vm->_linesManager.ZONEP[idx].fieldE = 0; + _vm->_linesManager.ZONEP[idx]._verbFl9 = 0; break; case 15: - _vm->_linesManager.ZONEP[idx].fieldF = 0; + _vm->_linesManager.ZONEP[idx]._verbFl10 = 0; break; } _changeVerbFl = true; @@ -3391,64 +3391,64 @@ void ObjectsManager::disableVerb(int idx, int a2) { void ObjectsManager::enableVerb(int idx, int a2) { switch (a2) { case 5: - _vm->_linesManager.ZONEP[idx].field8 = 2; + _vm->_linesManager.ZONEP[idx]._verbFl3 = 2; break; case 6: - _vm->_linesManager.ZONEP[idx].field6 = 1; + _vm->_linesManager.ZONEP[idx]._verbFl1 = 1; break; case 7: - _vm->_linesManager.ZONEP[idx].field7 = 1; + _vm->_linesManager.ZONEP[idx]._verbFl2 = 1; break; case 8: - _vm->_linesManager.ZONEP[idx].field8 = 1; + _vm->_linesManager.ZONEP[idx]._verbFl3 = 1; break; case 9: - _vm->_linesManager.ZONEP[idx].field9 = 1; + _vm->_linesManager.ZONEP[idx]._verbFl4 = 1; break; case 10: - _vm->_linesManager.ZONEP[idx].fieldA = 1; + _vm->_linesManager.ZONEP[idx]._verbFl5 = 1; break; case 11: - _vm->_linesManager.ZONEP[idx].fieldB = 1; + _vm->_linesManager.ZONEP[idx]._verbFl6 = 1; break; case 12: - _vm->_linesManager.ZONEP[idx].fieldC = 1; + _vm->_linesManager.ZONEP[idx]._verbFl7 = 1; break; case 13: - _vm->_linesManager.ZONEP[idx].fieldD = 1; + _vm->_linesManager.ZONEP[idx]._verbFl8 = 1; break; case 14: - _vm->_linesManager.ZONEP[idx].fieldD = 1; + _vm->_linesManager.ZONEP[idx]._verbFl8 = 1; break; case 15: - _vm->_linesManager.ZONEP[idx].fieldE = 1; + _vm->_linesManager.ZONEP[idx]._verbFl9 = 1; break; case 16: - _vm->_linesManager.ZONEP[idx].field6 = 2; + _vm->_linesManager.ZONEP[idx]._verbFl1 = 2; break; case 17: - _vm->_linesManager.ZONEP[idx].field9 = 2; + _vm->_linesManager.ZONEP[idx]._verbFl4 = 2; break; case 18: - _vm->_linesManager.ZONEP[idx].fieldA = 2; + _vm->_linesManager.ZONEP[idx]._verbFl5 = 2; break; case 19: - _vm->_linesManager.ZONEP[idx].fieldB = 2; + _vm->_linesManager.ZONEP[idx]._verbFl6 = 2; break; case 20: - _vm->_linesManager.ZONEP[idx].fieldC = 2; + _vm->_linesManager.ZONEP[idx]._verbFl7 = 2; break; case 21: - _vm->_linesManager.ZONEP[idx].fieldE = 2; + _vm->_linesManager.ZONEP[idx]._verbFl9 = 2; break; case 22: - _vm->_linesManager.ZONEP[idx].fieldD = 2; + _vm->_linesManager.ZONEP[idx]._verbFl8 = 2; break; case 24: - _vm->_linesManager.ZONEP[idx].field9 = 3; + _vm->_linesManager.ZONEP[idx]._verbFl4 = 3; break; case 25: - _vm->_linesManager.ZONEP[idx].fieldE = 2; + _vm->_linesManager.ZONEP[idx]._verbFl9 = 2; break; } } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index aa6abfa5ec..5a1c302a2e 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2391,7 +2391,7 @@ int ScriptManager::handleOpcode(byte *dataP) { opcodeType = 1; break; case MKTAG24('Z', 'C', 'H'): - _vm->_linesManager.ZONEP[READ_LE_INT16(dataP + 5)].field12 = READ_LE_INT16(dataP + 7); + _vm->_linesManager.ZONEP[READ_LE_INT16(dataP + 5)]._messageId = READ_LE_INT16(dataP + 7); opcodeType = 1; break; case MKTAG24('J', 'U', 'M'): -- cgit v1.2.3 From 691f21da96e17a0019e8473881e7d9a8dee2bfd1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Feb 2013 08:23:38 +0100 Subject: HOPKINS: Some renaming and refactoring in Globals and LinesManager --- engines/hopkins/events.cpp | 2 +- engines/hopkins/globals.cpp | 4 ++-- engines/hopkins/globals.h | 5 +++-- engines/hopkins/hopkins.cpp | 4 ++-- engines/hopkins/lines.cpp | 54 ++++++++++++++++++++++----------------------- engines/hopkins/lines.h | 8 +++---- engines/hopkins/objects.cpp | 38 +++++++++++++++---------------- engines/hopkins/talk.cpp | 10 ++++----- 8 files changed, 63 insertions(+), 62 deletions(-) diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 050935d783..d13f545eb5 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -188,7 +188,7 @@ void EventsManager::changeMouseCursor(int id) { if (_mouseCursorId == 23) return; - if (id == 4 && _mouseCursorId == 4 && _vm->_globals.NOMARCHE) + if (id == 4 && _mouseCursorId == 4 && _vm->_globals._freezeCharacterFl) cursorId = 0; if (cursorId == 25) cursorId = 5; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 264a53a30d..c725b4f98a 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -127,7 +127,7 @@ Globals::Globals() { _sortedDisplayCount = 0; NOT_VERIF = false; _characterType = 0; - GOACTION = false; + _actionMoveTo = false; Compteur = 0; _actionDirection = DIR_NONE; @@ -157,7 +157,7 @@ Globals::Globals() { // Reset flags _censorshipFl = false; _disableInventFl = false; - NOMARCHE = false; + _freezeCharacterFl = false; _optionDialogFl = false; _cacheFl = false; _introSpeechOffFl = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 95dae8b922..27a2fe4995 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -305,7 +305,9 @@ public: int _oldRouteDestY; int _oldZoneNum; - bool NOMARCHE; + bool _actionMoveTo; + bool _freezeCharacterFl; + int iRegul; byte *BUF_ZONE; BqeAnimItem _animBqe[35]; @@ -324,7 +326,6 @@ public: int Compteur; int compteur_71; Common::String FICH_ZONE; - bool GOACTION; Common::String FICH_TEXTE; Globals(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b761e99164..162d49fb20 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2051,7 +2051,7 @@ void HopkinsEngine::playEnding() { _globals.iRegul = 1; _soundManager.playSound(26); _linesManager._route = (RouteItem *)g_PTRNUL; - _globals.NOMARCHE = true; + _globals._freezeCharacterFl = true; _globals._exitId = 0; _soundManager.loadSample(1, "SOUND90.WAV"); _graphicsManager.loadImage("IM100"); @@ -2738,7 +2738,7 @@ void HopkinsEngine::OCEAN_HOME() { void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { _globals._cityMapEnabledFl = false; _graphicsManager._noFadingFl = false; - _globals.NOMARCHE = false; + _globals._freezeCharacterFl = false; _globals._exitId = 0; _globals._disableInventFl = true; _soundManager.playSound(soundId); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 428a4b0482..085e6b1856 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1146,7 +1146,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v126[i] = 1300; } - if (PARC_PERS(fromX, fromY, clipDestX, clipDestY, -1, -1, 0) == 1) + if (characterRoute(fromX, fromY, clipDestX, clipDestY, -1, -1, 0) == 1) return _bestRoute; int v14 = 0; @@ -1321,7 +1321,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v114 = v136[7]; } - int v55 = PARC_PERS(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); + int v55 = characterRoute(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); if (v55 == 1) return _bestRoute; @@ -1418,7 +1418,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { _bestRoute[v112].set(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], _lineItem[v110]._directionRouteInc); v112++; if (_lineItem[v110]._lineDataEndIdx > 30 && v72 == _lineItem[v110]._lineDataEndIdx / 2) { - int v78 = PARC_PERS(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); + int v78 = characterRoute(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); if (v78 == 1) return &_bestRoute[0]; if (v78 == 2 || MIRACLE(v119, v118, v110, v121, v112)) { @@ -1436,7 +1436,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (loopCond) break; - int v79 = PARC_PERS(v119, v118, clipDestX, clipDestY, v116, v121, v112); + int v79 = characterRoute(v119, v118, clipDestX, clipDestY, v116, v121, v112); if (v79 == 1) return &_bestRoute[0]; if (v79 == 2 || MIRACLE(v119, v118, v116, v121, v112)) { @@ -1468,7 +1468,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { _bestRoute[v112].set(_lineItem[v117]._lineData[2 * dataIdx], _lineItem[v117]._lineData[2 * dataIdx + 1], _lineItem[v117]._directionRouteDec); v112++; if (_lineItem[v117]._lineDataEndIdx > 30 && dataIdx == _lineItem[v117]._lineDataEndIdx / 2) { - int v88 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + int v88 = characterRoute(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v88 == 1) return &_bestRoute[0]; if (v88 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { @@ -1484,7 +1484,7 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (loopCond) break; - int v89 = PARC_PERS(v119, v118, clipDestX, clipDestY, v117, v121, v112); + int v89 = characterRoute(v119, v118, clipDestX, clipDestY, v117, v121, v112); if (v89 == 1) return &_bestRoute[0]; if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { @@ -1510,14 +1510,14 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { v112 = _lineItem[v121].appendToRouteDec(v114, v120, _bestRoute, v112); } } - if (PARC_PERS(_bestRoute[v112 - 1]._x, _bestRoute[v112 - 1]._y, clipDestX, clipDestY, -1, -1, v112) != 1) { + if (characterRoute(_bestRoute[v112 - 1]._x, _bestRoute[v112 - 1]._y, clipDestX, clipDestY, -1, -1, v112) != 1) { _bestRoute[v112].invalidate(); } return &_bestRoute[0]; } -int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7) { +int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7) { int v18; int v19; int v20; @@ -1553,11 +1553,9 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int v115; int v117; int collLineIdx; - int collDataIdx; + int collDataIdx = 0; int v140; - int v141; int v142; - int v143; bool colResult = false; int curX = fromX; @@ -1610,6 +1608,8 @@ int LinesManager::PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int distX, v10, distY, v12, v13, v14; int repeatFlag = 0; + int v143 = 0; + int v141 = 0; for (;;) { v111 = curX; v109 = curY; @@ -2397,10 +2397,10 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { int lineIdxTestLeft; int lineIdxTestRight; - int idxTestUp = TEST_LIGNE(paramX, paramY - 2, &v42, &lineIdxTestUp, &dataIdxTestUp); - int idxTestDown = TEST_LIGNE(paramX, paramY + 2, &v43, &lineIdxTestDown, &dataIdxTestDown); - int idxTestLeft = TEST_LIGNE(paramX - 2, paramY, &v44, &lineIdxTestLeft, &dataIdxTestLeft); - int idxTestRight = TEST_LIGNE(paramX + 2, paramY, &v45, &lineIdxTestRight, &dataIdxTestRight); + int idxTestUp = testLine(paramX, paramY - 2, &v42, &lineIdxTestUp, &dataIdxTestUp); + int idxTestDown = testLine(paramX, paramY + 2, &v43, &lineIdxTestDown, &dataIdxTestDown); + int idxTestLeft = testLine(paramX - 2, paramY, &v44, &lineIdxTestLeft, &dataIdxTestLeft); + int idxTestRight = testLine(paramX + 2, paramY, &v45, &lineIdxTestRight, &dataIdxTestRight); if (idxTestUp == -1 && idxTestDown == -1 && idxTestLeft == -1 && idxTestRight == -1) return false; @@ -2482,7 +2482,7 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5) { } // Test line -int LinesManager::TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx) { +int LinesManager::testLine(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx) { int16 *lineData; int lineDataEndIdx; int collLineIdx; @@ -2616,7 +2616,7 @@ int LinesManager::MZONE() { } _currentSegmentId = 0; for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { - if (ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl == 1 + if (ZONEP[squareZoneId]._enabledFl && _squareZone[squareZoneId]._enabledFl && _squareZone[squareZoneId]._left <= xp && _squareZone[squareZoneId]._right >= xp && _squareZone[squareZoneId]._top <= yp && _squareZone[squareZoneId]._bottom >= yp) { if (_squareZone[squareZoneId]._squareZoneFl) @@ -2633,7 +2633,7 @@ int LinesManager::MZONE() { int colRes1 = 0; for (int yCurrent = yp; yCurrent >= 0; --yCurrent) { - colRes1 = colision(xp, yCurrent); + colRes1 = checkCollision(xp, yCurrent); if (colRes1 != -1 && ZONEP[colRes1]._enabledFl) break; } @@ -2643,7 +2643,7 @@ int LinesManager::MZONE() { int colRes2 = 0; for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { - colRes2 = colision(xp, j); + colRes2 = checkCollision(xp, j); if (colRes2 != -1 && ZONEP[colRes1]._enabledFl) break; } @@ -2653,7 +2653,7 @@ int LinesManager::MZONE() { int colRes3 = 0; for (int k = xp; k >= 0; --k) { - colRes3 = colision(k, yp); + colRes3 = checkCollision(k, yp); if (colRes3 != -1 && ZONEP[colRes1]._enabledFl) break; } @@ -2662,7 +2662,7 @@ int LinesManager::MZONE() { int colRes4 = 0; for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { - colRes4 = colision(xCurrent, yp); + colRes4 = checkCollision(xCurrent, yp); if (colRes4 != -1 && ZONEP[colRes1]._enabledFl) break; } @@ -2677,7 +2677,7 @@ int LinesManager::MZONE() { return result; } -int LinesManager::colision(int xp, int yp) { +int LinesManager::checkCollision(int xp, int yp) { if (_currentSegmentId <= 0) return -1; @@ -2730,7 +2730,7 @@ int LinesManager::colision(int xp, int yp) { // Square Zone void LinesManager::CARRE_ZONE() { for (int idx = 0; idx < 100; ++idx) { - _squareZone[idx]._enabledFl = 0; + _squareZone[idx]._enabledFl = false; _squareZone[idx]._squareZoneFl = false; _squareZone[idx]._left = 1280; _squareZone[idx]._right = 0; @@ -2746,7 +2746,7 @@ void LinesManager::CARRE_ZONE() { continue; int carreZoneId = _zoneLine[idx]._bobZoneIdx; - _squareZone[carreZoneId]._enabledFl = 1; + _squareZone[carreZoneId]._enabledFl = true; if (_squareZone[carreZoneId]._maxZoneLineIdx < idx) _squareZone[carreZoneId]._maxZoneLineIdx = idx; if (_squareZone[carreZoneId]._minZoneLineIdx > idx) @@ -2801,7 +2801,7 @@ void LinesManager::clearAll() { } for (int idx = 0; idx < 100; ++idx) - _squareZone[idx]._enabledFl = 0; + _squareZone[idx]._enabledFl = false; // FIXME: Delete these somewhere _vm->_linesManager.essai0 = new RouteItem[8334]; @@ -2903,7 +2903,7 @@ void LinesManager::checkZone() { if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_route == (RouteItem *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + if (_vm->_globals._freezeCharacterFl || (_route == (RouteItem *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { @@ -2954,7 +2954,7 @@ void LinesManager::checkZone() { _vm->_globals._oldMouseX = mouseX; _vm->_globals._oldMouseY = oldMouseY; _vm->_globals._oldMouseZoneId = zoneId; - if (_vm->_globals.NOMARCHE && (_vm->_eventsManager._mouseCursorId == 4)) { + if (_vm->_globals._freezeCharacterFl && (_vm->_eventsManager._mouseCursorId == 4)) { if (zoneId != -1 && zoneId != 0) _vm->_objectsManager.handleRightButton(); } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index ec36746f10..a42089a98b 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -62,7 +62,7 @@ struct SegmentItem { }; struct SquareZoneItem { - int _enabledFl; + bool _enabledFl; int _left; int _right; int _top; @@ -130,19 +130,19 @@ private: int checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow); void removeZoneLine(int idx); void removeLine(int idx); + int checkCollision(int xp, int yp); bool checkCollisionLine(int xp, int yp, int *foundDataIdx, int *foundLineIdx, int startLineIdx, int endLineIdx); bool checkSmoothMove(int fromX, int fromY, int destX, int destY); bool makeSmoothMove(int fromX, int fromY, int destX, int destY); + int characterRoute(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); + int testLine(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); int CALC_PROPRE(int idx); int CONTOURNE1(int a1, int a2, int a3, int a4, int a5, RouteItem *route, int a8, int a9); int CONTOURNE(int a1, int a2, int a3, int a4, int a5, RouteItem *route); bool MIRACLE(int fromX, int fromY, int a3, int a4, int a5); int GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a6, int a7, RouteItem *route); - int PARC_PERS(int fromX, int fromY, int destX, int destY, int a5, int a6, int a7); bool PLAN_TEST(int paramX, int paramY, int a3, int a4, int a5); - int TEST_LIGNE(int paramX, int paramY, int *a3, int *foundLineIdx, int *foundDataIdx); - int colision(int xp, int yp); public: RouteItem *_route; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index b83de7230f..e4ca428cd9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1307,7 +1307,7 @@ void ObjectsManager::GOHOME() { setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = DIR_NONE; int zoneId; - if (_vm->_globals.GOACTION) + if (_vm->_globals._actionMoveTo) zoneId = _vm->_globals._saveData->_data[svField2]; else zoneId = _zoneNum; @@ -1525,7 +1525,7 @@ void ObjectsManager::GOHOME() { if (newPosX == -1 && newPosY == -1) { int zoneId; - if (_vm->_globals.GOACTION) + if (_vm->_globals._actionMoveTo) zoneId = _vm->_globals._saveData->_data[svField2]; else zoneId = _zoneNum; @@ -1741,7 +1741,7 @@ void ObjectsManager::handleCityMap() { _vm->_globals._characterMaxPosY = 440; _vm->_globals._cityMapEnabledFl = true; _vm->_graphicsManager._noFadingFl = false; - _vm->_globals.NOMARCHE = false; + _vm->_globals._freezeCharacterFl = false; _spritePtr = g_PTRNUL; _vm->_globals._exitId = 0; _vm->_globals.NOT_VERIF = true; @@ -1811,7 +1811,7 @@ void ObjectsManager::handleCityMap() { _vm->_linesManager.checkZone(); GOHOME2(); - if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL && _vm->_globals.GOACTION) + if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL && _vm->_globals._actionMoveTo) PARADISE(); _vm->_eventsManager.VBL(); @@ -1875,7 +1875,7 @@ void ObjectsManager::handleLeftButton() { return; } } - if (_vm->_globals._cityMapEnabledFl && _vm->_globals.GOACTION) { + if (_vm->_globals._cityMapEnabledFl && _vm->_globals._actionMoveTo) { _vm->_linesManager.checkZone(); if (_zoneNum <= 0) return; @@ -1888,9 +1888,9 @@ void ObjectsManager::handleLeftButton() { _vm->_linesManager.essai2[routeIdx].invalidate();; } - if (_vm->_globals.GOACTION) { + if (_vm->_globals._actionMoveTo) { _vm->_linesManager.checkZone(); - _vm->_globals.GOACTION = false; + _vm->_globals._actionMoveTo = false; _vm->_globals._saveData->_data[svField1] = 0; _vm->_globals._saveData->_data[svField2] = 0; } @@ -1903,7 +1903,7 @@ void ObjectsManager::handleLeftButton() { destY = _vm->_linesManager.ZONEP[_zoneNum]._destY; } } - _vm->_globals.GOACTION = false; + _vm->_globals._actionMoveTo = false; RouteItem *oldRoute = _vm->_linesManager._route; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; if (_forestFl && _zoneNum >= 20 && _zoneNum <= 23) { @@ -1930,7 +1930,7 @@ void ObjectsManager::handleLeftButton() { } } } else { - if (!_vm->_globals.NOMARCHE && !_vm->_globals._cityMapEnabledFl) { + if (!_vm->_globals._freezeCharacterFl && !_vm->_globals._cityMapEnabledFl) { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); if (_vm->_linesManager._route != (RouteItem *)g_PTRNUL) _vm->_linesManager.PACOURS_PROPRE(_vm->_linesManager._route); @@ -1944,7 +1944,7 @@ void ObjectsManager::handleLeftButton() { } } - if (!_vm->_globals.NOMARCHE && _vm->_globals._cityMapEnabledFl) + if (!_vm->_globals._freezeCharacterFl && _vm->_globals._cityMapEnabledFl) _vm->_linesManager._route = _vm->_linesManager.cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); if (_zoneNum != -1 && _zoneNum != 0) { @@ -1957,7 +1957,7 @@ void ObjectsManager::handleLeftButton() { _vm->_globals._saveData->_data[svField1] = 6; _vm->_globals._saveData->_data[svField2] = _zoneNum; _vm->_globals._saveData->_data[svField3] = _curObjectIndex; - _vm->_globals.GOACTION = true; + _vm->_globals._actionMoveTo = true; } _vm->_fontManager.hideText(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -2051,11 +2051,11 @@ void ObjectsManager::PARADISE() { _vm->_eventsManager._mouseCursorId = 0; _vm->_eventsManager.changeMouseCursor(0); } - if (_vm->_globals.NOMARCHE && _vm->_eventsManager._mouseCursorId == 4) { + if (_vm->_globals._freezeCharacterFl && _vm->_eventsManager._mouseCursorId == 4) { if (_zoneNum != -1 && _zoneNum != 0) handleRightButton(); } - _vm->_globals.GOACTION = false; + _vm->_globals._actionMoveTo = false; } /** @@ -2089,7 +2089,7 @@ void ObjectsManager::clearScreen() { _vm->_eventsManager._mouseSpriteId = 0; _vm->_globals._saveData->_data[svField1] = 0; _vm->_globals._saveData->_data[svField2] = 0; - _vm->_globals.GOACTION = false; + _vm->_globals._actionMoveTo = false; _forceZoneFl = true; _changeVerbFl = false; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; @@ -2236,7 +2236,7 @@ void ObjectsManager::nextVerbIcon() { for(;;) { if (_vm->_eventsManager._mouseCursorId == 4) { - if (!_vm->_globals.NOMARCHE || _zoneNum == -1 || _zoneNum == 0) + if (!_vm->_globals._freezeCharacterFl || _zoneNum == -1 || _zoneNum == 0) return; ++_vm->_eventsManager._mouseCursorId; @@ -3689,7 +3689,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.iRegul = 1; _vm->_soundManager.playSound(soundNum); _vm->_linesManager._route = (RouteItem *)g_PTRNUL; - _vm->_globals.NOMARCHE = true; + _vm->_globals._freezeCharacterFl = true; _vm->_globals._exitId = 0; if (!backgroundFile.empty()) _vm->_graphicsManager.loadImage(backgroundFile); @@ -3744,7 +3744,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo handleRightButton(); _vm->_dialogsManager.testDialogOpening(); _vm->_linesManager.checkZone(); - if (_vm->_globals.GOACTION) + if (_vm->_globals._actionMoveTo) PARADISE(); if (!_vm->_globals._exitId) _vm->_eventsManager.VBL(); @@ -3776,7 +3776,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_dialogsManager._removeInventFl = false; _vm->_globals._cityMapEnabledFl = false; _vm->_graphicsManager._noFadingFl = false; - _vm->_globals.NOMARCHE = false; + _vm->_globals._freezeCharacterFl = false; _vm->_globals._exitId = 0; _vm->_globals.NOT_VERIF = true; _vm->_soundManager.playSound(soundNum); @@ -3884,7 +3884,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_linesManager.checkZone(); if (_vm->_linesManager._route == (RouteItem *)g_PTRNUL || (GOHOME(), _vm->_linesManager._route == (RouteItem *)g_PTRNUL)) { - if (_vm->_globals.GOACTION) + if (_vm->_globals._actionMoveTo) PARADISE(); } handleSpecialGames(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index 00bc4b3e08..e9b292b813 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -1016,16 +1016,16 @@ void TalkManager::animateObject(const Common::String &a2) { startCharacterAnim0(_paletteBufferIdx, false); byte *oldAnswerBufferPtr = _vm->_globals._answerBuffer; _vm->_globals._answerBuffer = g_PTRNUL; - _vm->_globals.NOMARCHE = true; + _vm->_globals._freezeCharacterFl = true; _vm->_objectsManager.loadLinkFile(screenFilename); _vm->_objectsManager.PERSO_ON = true; - _vm->_globals.GOACTION = false; + _vm->_globals._actionMoveTo = false; _vm->_objectsManager._zoneNum = -1; initCharacterAnim(); VISU_PARLE(); dialogWait(); _vm->_graphicsManager.initScreen(screenFilename, 2, true); - _vm->_globals.NOMARCHE = true; + _vm->_globals._freezeCharacterFl = true; _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1036,7 +1036,7 @@ void TalkManager::animateObject(const Common::String &a2) { _vm->_objectsManager.handleRightButton(); _vm->_linesManager.checkZone(); - if (_vm->_globals.GOACTION) + if (_vm->_globals._actionMoveTo) _vm->_objectsManager.PARADISE(); _vm->_eventsManager.VBL(); } while (!_vm->_globals._exitId); @@ -1060,7 +1060,7 @@ void TalkManager::animateObject(const Common::String &a2) { _vm->_objectsManager.loadLinkFile(curScreenFilename); _vm->_graphicsManager.initScreen(curScreenFilename, 2, true); _vm->_objectsManager._disableFl = false; - _vm->_globals.NOMARCHE = false; + _vm->_globals._freezeCharacterFl = false; if (_vm->_globals._exitId == 101) _vm->_globals._exitId = 0; -- cgit v1.2.3 From 5d36b5fb6ea01dbff27e7c7ae67a4e8ddf02bf6e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 21 Feb 2013 18:37:15 +0100 Subject: HOPKINS: Pre-convert palette --- engines/hopkins/saveload.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index ab9ff33b1d..f934c4c018 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -288,9 +288,13 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su thumb8->create(thumb16->w, thumb16->h, Graphics::PixelFormat::createFormatCLUT8()); Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); - uint16 palette[PALETTE_SIZE]; - for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) - palette[palIndex] = READ_LE_UINT16(&_vm->_graphicsManager.PAL_PIXELS[palIndex * 2]); + byte paletteR[PALETTE_SIZE]; + byte paletteG[PALETTE_SIZE]; + byte paletteB[PALETTE_SIZE]; + for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) { + uint16 p = READ_LE_UINT16(&_vm->_graphicsManager.PAL_PIXELS[palIndex * 2]); + pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]); + } const uint16 *srcP = (const uint16 *)thumb16->pixels; byte *destP = (byte *)thumb8->pixels; @@ -306,8 +310,9 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su // Scan the palette for the closest match int difference = 99999, foundIndex = 0; for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) { - byte rCurrent, gCurrent, bCurrent; - pixelFormat16.colorToRGB(palette[palIndex], rCurrent, gCurrent, bCurrent); + byte rCurrent = paletteR[palIndex]; + byte gCurrent = paletteG[palIndex]; + byte bCurrent = paletteB[palIndex]; int diff = ABS((int)r - (int)rCurrent) + ABS((int)g - (int)gCurrent) + ABS((int)b - (int)bCurrent); if (diff < difference) { -- cgit v1.2.3 From b0a55e7a4f8917c5d2811c721550d4f15bf71e2d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 08:18:13 +0100 Subject: HOPKINS: Renaming in LinesManager and Globals --- engines/hopkins/globals.cpp | 2 +- engines/hopkins/globals.h | 2 +- engines/hopkins/lines.cpp | 360 ++++++++++++++++++++++---------------------- engines/hopkins/lines.h | 2 +- engines/hopkins/objects.cpp | 10 +- engines/hopkins/script.cpp | 42 +++--- 6 files changed, 207 insertions(+), 211 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index c725b4f98a..4e5ea6a4c2 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -125,7 +125,7 @@ Globals::Globals() { _menuTextOff = 0; _menuDisplayType = 0; _sortedDisplayCount = 0; - NOT_VERIF = false; + _checkDistanceFl = false; _characterType = 0; _actionMoveTo = false; Compteur = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 27a2fe4995..61fb3f880f 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -307,13 +307,13 @@ public: bool _actionMoveTo; bool _freezeCharacterFl; + bool _checkDistanceFl; int iRegul; byte *BUF_ZONE; BqeAnimItem _animBqe[35]; byte *SPRITE_ECRAN; byte *PERSO; - bool NOT_VERIF; ObjetWItem ObjetW[300]; int NUM_FICHIER_OBJ; byte *ADR_FICHIER_OBJ; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 085e6b1856..8fa0f1febe 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -1091,24 +1091,24 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int a3, int a4, int a5, int a RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int foundLineIdx; int foundDataIdx; - int v118 = 0; - int v119 = 0; + int curLineY = 0; + int curLineX = 0; int v126[9]; int v131[9]; - int v136[9]; - int v141[9]; + int collLineDataIdxArr[9]; + int collLineIdxArr[9]; int clipDestX = destX; int clipDestY = destY; - int v121 = 0; - int v120 = 0; - int v115 = 0; - int v114 = 0; + int curLineIdx = 0; + int curLineDataIdx = 0; + int lineIdx = 0; + int lineDataIdx = 0; Directions newDir = DIR_NONE; int v111 = 0; if (destY <= 24) clipDestY = 25; - if (!_vm->_globals.NOT_VERIF) { + if (!_vm->_globals._checkDistanceFl) { if (abs(fromX - _vm->_globals._oldRouteFromX) <= 4 && abs(fromY - _vm->_globals._oldRouteFromY) <= 4 && abs(_vm->_globals._oldRouteDestX - destX) <= 4 && abs(_vm->_globals._oldRouteDestY - clipDestY) <= 4) return (RouteItem *)g_PTRNUL; @@ -1119,14 +1119,14 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (_vm->_globals._oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals._oldZoneNum == _vm->_objectsManager._zoneNum) return (RouteItem *)g_PTRNUL; } - _vm->_globals.NOT_VERIF = false; + _vm->_globals._checkDistanceFl = false; _vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum; _vm->_globals._oldRouteFromX = fromX; _vm->_globals._oldRouteDestX = destX; _vm->_globals._oldRouteFromY = fromY; _vm->_globals._oldRouteDestY = clipDestY; _pathFindingMaxDepth = 0; - int v112 = 0; + int routeIdx = 0; if (destX <= 19) clipDestX = 20; if (clipDestY <= 19) @@ -1140,8 +1140,8 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { return (RouteItem *)g_PTRNUL; for (int i = 0; i <= 8; ++i) { - v141[i] = -1; - v136[i] = 0; + collLineIdxArr[i] = -1; + collLineDataIdxArr[i] = 0; v131[i] = 1300; v126[i] = 1300; } @@ -1151,249 +1151,249 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { int v14 = 0; for (int tmpY = clipDestY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { - if (checkCollisionLine(clipDestX, tmpY, &v136[5], &v141[5], 0, _lastLine) && v141[5] <= _lastLine) + if (checkCollisionLine(clipDestX, tmpY, &collLineDataIdxArr[5], &collLineIdxArr[5], 0, _lastLine) && collLineIdxArr[5] <= _lastLine) break; - v136[5] = 0; - v141[5] = -1; + collLineDataIdxArr[5] = 0; + collLineIdxArr[5] = -1; } v131[5] = v14; v14 = 0; for (int tmpY = clipDestY; tmpY > _vm->_graphicsManager._minY; tmpY--, v14++) { - if (checkCollisionLine(clipDestX, tmpY, &v136[1], &v141[1], 0, _lastLine) && v141[1] <= _lastLine) + if (checkCollisionLine(clipDestX, tmpY, &collLineDataIdxArr[1], &collLineIdxArr[1], 0, _lastLine) && collLineIdxArr[1] <= _lastLine) break; - v136[1] = 0; - v141[1] = -1; - if (v131[5] < v14 && v141[5] != -1) + collLineDataIdxArr[1] = 0; + collLineIdxArr[1] = -1; + if (v131[5] < v14 && collLineIdxArr[5] != -1) break; } v131[1] = v14; v14 = 0; for (int tmpX = clipDestX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { - if (checkCollisionLine(tmpX, clipDestY, &v136[3], &v141[3], 0, _lastLine) && v141[3] <= _lastLine) + if (checkCollisionLine(tmpX, clipDestY, &collLineDataIdxArr[3], &collLineIdxArr[3], 0, _lastLine) && collLineIdxArr[3] <= _lastLine) break; - v136[3] = 0; - v141[3] = -1; + collLineDataIdxArr[3] = 0; + collLineIdxArr[3] = -1; ++v14; - if (v131[1] < v14 && v141[1] != -1) + if (v131[1] < v14 && collLineIdxArr[1] != -1) break; - if (v131[5] < v14 && v141[5] != -1) + if (v131[5] < v14 && collLineIdxArr[5] != -1) break; } v131[3] = v14; v14 = 0; for (int tmpX = clipDestX; tmpX > _vm->_graphicsManager._minX; tmpX--) { - if (checkCollisionLine(tmpX, clipDestY, &v136[7], &v141[7], 0, _lastLine) && v141[7] <= _lastLine) + if (checkCollisionLine(tmpX, clipDestY, &collLineDataIdxArr[7], &collLineIdxArr[7], 0, _lastLine) && collLineIdxArr[7] <= _lastLine) break; - v136[7] = 0; - v141[7] = -1; + collLineDataIdxArr[7] = 0; + collLineIdxArr[7] = -1; ++v14; - if (v131[1] < v14 && v141[1] != -1) + if (v131[1] < v14 && collLineIdxArr[1] != -1) break; - if (v131[5] < v14 && v141[5] != -1) + if (v131[5] < v14 && collLineIdxArr[5] != -1) break; - if (v131[3] < v14 && v141[3] != -1) + if (v131[3] < v14 && collLineIdxArr[3] != -1) break; } v131[7] = v14; - if (v141[1] < 0 || _lastLine < v141[1]) - v141[1] = -1; - if (v141[3] < 0 || _lastLine < v141[3]) - v141[3] = -1; - if (v141[5] < 0 || _lastLine < v141[5]) - v141[5] = -1; - if (v141[7] < 0 || _lastLine < v141[7]) - v141[7] = -1; - if (v141[1] < 0) + if (collLineIdxArr[1] < 0 || _lastLine < collLineIdxArr[1]) + collLineIdxArr[1] = -1; + if (collLineIdxArr[3] < 0 || _lastLine < collLineIdxArr[3]) + collLineIdxArr[3] = -1; + if (collLineIdxArr[5] < 0 || _lastLine < collLineIdxArr[5]) + collLineIdxArr[5] = -1; + if (collLineIdxArr[7] < 0 || _lastLine < collLineIdxArr[7]) + collLineIdxArr[7] = -1; + if (collLineIdxArr[1] < 0) v131[1] = 1300; - if (v141[3] < 0) + if (collLineIdxArr[3] < 0) v131[3] = 1300; - if (v141[5] < 0) + if (collLineIdxArr[5] < 0) v131[5] = 1300; - if (v141[7] < 0) + if (collLineIdxArr[7] < 0) v131[7] = 1300; - if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) + if (collLineIdxArr[1] == -1 && collLineIdxArr[3] == -1 && collLineIdxArr[5] == -1 && collLineIdxArr[7] == -1) return (RouteItem *)g_PTRNUL; - if (v141[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { - v121 = v141[5]; - v120 = v136[5]; - } else if (v141[1] != -1 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { - v121 = v141[1]; - v120 = v136[1]; - } else if (v141[3] != -1 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { - v121 = v141[3]; - v120 = v136[3]; - } else if (v141[7] != -1 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { - v121 = v141[7]; - v120 = v136[7]; + if (collLineIdxArr[5] != -1 && v131[1] >= v131[5] && v131[3] >= v131[5] && v131[7] >= v131[5]) { + curLineIdx = collLineIdxArr[5]; + curLineDataIdx = collLineDataIdxArr[5]; + } else if (collLineIdxArr[1] != -1 && v131[5] >= v131[1] && v131[3] >= v131[1] && v131[7] >= v131[1]) { + curLineIdx = collLineIdxArr[1]; + curLineDataIdx = collLineDataIdxArr[1]; + } else if (collLineIdxArr[3] != -1 && v131[1] >= v131[3] && v131[5] >= v131[3] && v131[7] >= v131[3]) { + curLineIdx = collLineIdxArr[3]; + curLineDataIdx = collLineDataIdxArr[3]; + } else if (collLineIdxArr[7] != -1 && v131[5] >= v131[7] && v131[3] >= v131[7] && v131[1] >= v131[7]) { + curLineIdx = collLineIdxArr[7]; + curLineDataIdx = collLineDataIdxArr[7]; } for (int i = 0; i <= 8; ++i) { - v141[i] = -1; - v136[i] = 0; + collLineIdxArr[i] = -1; + collLineDataIdxArr[i] = 0; v131[i] = 1300; v126[i] = 1300; } v14 = 0; for (int tmpY = fromY; tmpY < _vm->_graphicsManager._maxY; tmpY++, v14++) { - if (checkCollisionLine(fromX, tmpY, &v136[5], &v141[5], 0, _lastLine) && v141[5] <= _lastLine) + if (checkCollisionLine(fromX, tmpY, &collLineDataIdxArr[5], &collLineIdxArr[5], 0, _lastLine) && collLineIdxArr[5] <= _lastLine) break; - v136[5] = 0; - v141[5] = -1; + collLineDataIdxArr[5] = 0; + collLineIdxArr[5] = -1; } v131[5] = v14 + 1; v14 = 0; for (int tmpY = fromY; tmpY > _vm->_graphicsManager._minY; tmpY--) { - if (checkCollisionLine(fromX, tmpY, &v136[1], &v141[1], 0, _lastLine) && v141[1] <= _lastLine) + if (checkCollisionLine(fromX, tmpY, &collLineDataIdxArr[1], &collLineIdxArr[1], 0, _lastLine) && collLineIdxArr[1] <= _lastLine) break; - v136[1] = 0; - v141[1] = -1; + collLineDataIdxArr[1] = 0; + collLineIdxArr[1] = -1; ++v14; - if (v141[5] != -1 && v14 > 80) + if (collLineIdxArr[5] != -1 && v14 > 80) break; } v131[1] = v14 + 1; v14 = 0; for (int tmpX = fromX; tmpX < _vm->_graphicsManager._maxX; tmpX++) { - if (checkCollisionLine(tmpX, fromY, &v136[3], &v141[3], 0, _lastLine) && v141[3] <= _lastLine) + if (checkCollisionLine(tmpX, fromY, &collLineDataIdxArr[3], &collLineIdxArr[3], 0, _lastLine) && collLineIdxArr[3] <= _lastLine) break; - v136[3] = 0; - v141[3] = -1; + collLineDataIdxArr[3] = 0; + collLineIdxArr[3] = -1; ++v14; - if ((v141[5] != -1 || v141[1] != -1) && (v14 > 100)) + if ((collLineIdxArr[5] != -1 || collLineIdxArr[1] != -1) && (v14 > 100)) break; } v131[3] = v14 + 1; v14 = 0; for (int tmpX = fromX; tmpX > _vm->_graphicsManager._minX; tmpX--) { - if (checkCollisionLine(tmpX, fromY, &v136[7], &v141[7], 0, _lastLine) && v141[7] <= _lastLine) + if (checkCollisionLine(tmpX, fromY, &collLineDataIdxArr[7], &collLineIdxArr[7], 0, _lastLine) && collLineIdxArr[7] <= _lastLine) break; - v136[7] = 0; - v141[7] = -1; + collLineDataIdxArr[7] = 0; + collLineIdxArr[7] = -1; ++v14; - if ((v141[5] != -1 || v141[1] != -1 || v141[3] != -1) && (v14 > 100)) + if ((collLineIdxArr[5] != -1 || collLineIdxArr[1] != -1 || collLineIdxArr[3] != -1) && (v14 > 100)) break; } v131[7] = v14 + 1; - if (v141[1] != -1) - v126[1] = abs(v141[1] - v121); + if (collLineIdxArr[1] != -1) + v126[1] = abs(collLineIdxArr[1] - curLineIdx); - if (v141[3] != -1) - v126[3] = abs(v141[3] - v121); + if (collLineIdxArr[3] != -1) + v126[3] = abs(collLineIdxArr[3] - curLineIdx); - if (v141[5] != -1) - v126[5] = abs(v141[5] - v121); + if (collLineIdxArr[5] != -1) + v126[5] = abs(collLineIdxArr[5] - curLineIdx); - if (v141[7] != -1) - v126[7] = abs(v141[7] - v121); + if (collLineIdxArr[7] != -1) + v126[7] = abs(collLineIdxArr[7] - curLineIdx); - if (v141[1] == -1 && v141[3] == -1 && v141[5] == -1 && v141[7] == -1) + if (collLineIdxArr[1] == -1 && collLineIdxArr[3] == -1 && collLineIdxArr[5] == -1 && collLineIdxArr[7] == -1) error("Nearest point not found"); - if (v141[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { - v115 = v141[1]; + if (collLineIdxArr[1] != -1 && v126[3] >= v126[1] && v126[5] >= v126[1] && v126[7] >= v126[1]) { + lineIdx = collLineIdxArr[1]; v111 = v131[1]; newDir = DIR_UP; - v114 = v136[1]; - } else if (v141[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { - v115 = v141[5]; + lineDataIdx = collLineDataIdxArr[1]; + } else if (collLineIdxArr[5] != -1 && v126[3] >= v126[5] && v126[1] >= v126[5] && v126[7] >= v126[5]) { + lineIdx = collLineIdxArr[5]; v111 = v131[5]; newDir = DIR_DOWN; - v114 = v136[5]; - } else if (v141[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { - v115 = v141[3]; + lineDataIdx = collLineDataIdxArr[5]; + } else if (collLineIdxArr[3] != -1 && v126[1] >= v126[3] && v126[5] >= v126[3] && v126[7] >= v126[3]) { + lineIdx = collLineIdxArr[3]; v111 = v131[3]; newDir = DIR_RIGHT; - v114 = v136[3]; - } else if (v141[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { - v115 = v141[7]; + lineDataIdx = collLineDataIdxArr[3]; + } else if (collLineIdxArr[7] != -1 && v126[1] >= v126[7] && v126[5] >= v126[7] && v126[3] >= v126[7]) { + lineIdx = collLineIdxArr[7]; v111 = v131[7]; newDir = DIR_LEFT; - v114 = v136[7]; + lineDataIdx = collLineDataIdxArr[7]; } - int v55 = characterRoute(fromX, fromY, clipDestX, clipDestY, v115, v121, 0); + int v55 = characterRoute(fromX, fromY, clipDestX, clipDestY, lineIdx, curLineIdx, 0); if (v55 == 1) return _bestRoute; if (v55 == 2) { - v115 = _newLineIdx; - v114 = _newLineDataIdx; - v112 = _newRouteIdx; + lineIdx = _newLineIdx; + lineDataIdx = _newLineDataIdx; + routeIdx = _newRouteIdx; } else { if (newDir == DIR_UP) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, fromY - deltaY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v58 = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, v112, _bestRoute); - if (v58 == -1) { - _bestRoute[v112].invalidate(); + int tmpRouteIdx = GENIAL(foundLineIdx, foundDataIdx, fromX, fromY - deltaY, fromX, fromY - v111, routeIdx, _bestRoute); + if (tmpRouteIdx == -1) { + _bestRoute[routeIdx].invalidate(); return &_bestRoute[0]; } - v112 = v58; + routeIdx = tmpRouteIdx; if (_newPosY != -1) deltaY = fromY - _newPosY; } - _bestRoute[v112].set(fromX, fromY - deltaY, DIR_UP); - v112++; + _bestRoute[routeIdx].set(fromX, fromY - deltaY, DIR_UP); + routeIdx++; } } if (newDir == DIR_DOWN) { for (int deltaY = 0; deltaY < v111; deltaY++) { if (checkCollisionLine(fromX, deltaY + fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v61 = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, v112, &_bestRoute[0]); - if (v61 == -1) { - _bestRoute[v112].invalidate(); + int tmpRouteIdx = GENIAL(foundLineIdx, foundDataIdx, fromX, deltaY + fromY, fromX, v111 + fromY, routeIdx, &_bestRoute[0]); + if (tmpRouteIdx == -1) { + _bestRoute[routeIdx].invalidate(); return &_bestRoute[0]; } - v112 = v61; + routeIdx = tmpRouteIdx; if (_newPosY != -1) deltaY = _newPosY - fromY; } - _bestRoute[v112].set(fromX, fromY + deltaY, DIR_DOWN); - v112++; + _bestRoute[routeIdx].set(fromX, fromY + deltaY, DIR_DOWN); + routeIdx++; } } if (newDir == DIR_LEFT) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(fromX - deltaX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v64 = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, v112, &_bestRoute[0]); - if (v64 == -1) { - _bestRoute[v112].invalidate(); + int tmpRouteIdx = GENIAL(foundLineIdx, foundDataIdx, fromX - deltaX, fromY, fromX - v111, fromY, routeIdx, &_bestRoute[0]); + if (tmpRouteIdx == -1) { + _bestRoute[routeIdx].invalidate(); return &_bestRoute[0]; } - v112 = v64; + routeIdx = tmpRouteIdx; if (_newPosX != -1) deltaX = fromX - _newPosX; } - _bestRoute[v112].set(fromX - deltaX, fromY, DIR_LEFT); - v112++; + _bestRoute[routeIdx].set(fromX - deltaX, fromY, DIR_LEFT); + routeIdx++; } } if (newDir == DIR_RIGHT) { for (int deltaX = 0; deltaX < v111; deltaX++) { if (checkCollisionLine(deltaX + fromX, fromY, &foundDataIdx, &foundLineIdx, _lastLine + 1, _linesNumb) && _lastLine < foundLineIdx) { - int v67 = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, v112, &_bestRoute[0]); - if (v67 == -1) { - _bestRoute[v112].invalidate(); + int tmpRouteIdx = GENIAL(foundLineIdx, foundDataIdx, deltaX + fromX, fromY, v111 + fromX, fromY, routeIdx, &_bestRoute[0]); + if (tmpRouteIdx == -1) { + _bestRoute[routeIdx].invalidate(); return &_bestRoute[0]; } - v112 = v67; + routeIdx = tmpRouteIdx; if (_newPosX != -1) deltaX = _newPosX - fromX; } - _bestRoute[v112].set(fromX + deltaX, fromY, DIR_RIGHT); - v112++; + _bestRoute[routeIdx].set(fromX + deltaX, fromY, DIR_RIGHT); + routeIdx++; } } } @@ -1402,47 +1402,43 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { bool loopCond; do { loopCond = false; - if (v115 < v121) { - for (int i = v114; _lineItem[v115]._lineDataEndIdx > i; ++i) { - v119 = _lineItem[v115]._lineData[2 * i]; - v118 = _lineItem[v115]._lineData[2 * i + 1]; - _bestRoute[v112].set(_lineItem[v115]._lineData[2 * i], _lineItem[v115]._lineData[2 * i + 1], _lineItem[v115]._directionRouteInc); - v112++; + if (lineIdx < curLineIdx) { + for (int i = lineDataIdx; _lineItem[lineIdx]._lineDataEndIdx > i; ++i) { + curLineX = _lineItem[lineIdx]._lineData[2 * i]; + curLineY = _lineItem[lineIdx]._lineData[2 * i + 1]; + _bestRoute[routeIdx].set(_lineItem[lineIdx]._lineData[2 * i], _lineItem[lineIdx]._lineData[2 * i + 1], _lineItem[lineIdx]._directionRouteInc); + routeIdx++; } - for (int v116 = v115 + 1; v116 < v121; v116++) { - int v72 = 0; - int v110 = v116; - for (int j = v116; _lineItem[j]._lineDataEndIdx > v72; j = v116) { - v119 = _lineItem[v110]._lineData[2 * v72]; - v118 = _lineItem[v110]._lineData[2 * v72 + 1]; - _bestRoute[v112].set(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], _lineItem[v110]._directionRouteInc); - v112++; - if (_lineItem[v110]._lineDataEndIdx > 30 && v72 == _lineItem[v110]._lineDataEndIdx / 2) { - int v78 = characterRoute(_lineItem[v110]._lineData[2 * v72], _lineItem[v110]._lineData[2 * v72 + 1], clipDestX, clipDestY, v110, v121, v112); + for (int idx = lineIdx + 1; idx < curLineIdx; idx++) { + for (int dataIdx = 0; _lineItem[idx]._lineDataEndIdx > dataIdx; dataIdx++) { + curLineX = _lineItem[idx]._lineData[2 * dataIdx]; + curLineY = _lineItem[idx]._lineData[2 * dataIdx + 1]; + _bestRoute[routeIdx].set(_lineItem[idx]._lineData[2 * dataIdx], _lineItem[idx]._lineData[2 * dataIdx + 1], _lineItem[idx]._directionRouteInc); + routeIdx++; + if (_lineItem[idx]._lineDataEndIdx > 30 && dataIdx == _lineItem[idx]._lineDataEndIdx / 2) { + int v78 = characterRoute(_lineItem[idx]._lineData[2 * dataIdx], _lineItem[idx]._lineData[2 * dataIdx + 1], clipDestX, clipDestY, idx, curLineIdx, routeIdx); if (v78 == 1) return &_bestRoute[0]; - if (v78 == 2 || MIRACLE(v119, v118, v110, v121, v112)) { - v115 = _newLineIdx; - v114 = _newLineDataIdx; - v112 = _newRouteIdx; + if (v78 == 2 || MIRACLE(curLineX, curLineY, idx, curLineIdx, routeIdx)) { + lineIdx = _newLineIdx; + lineDataIdx = _newLineDataIdx; + routeIdx = _newRouteIdx; loopCond = true; break; } } - ++v72; - v110 = v116; } if (loopCond) break; - int v79 = characterRoute(v119, v118, clipDestX, clipDestY, v116, v121, v112); + int v79 = characterRoute(curLineX, curLineY, clipDestX, clipDestY, idx, curLineIdx, routeIdx); if (v79 == 1) return &_bestRoute[0]; - if (v79 == 2 || MIRACLE(v119, v118, v116, v121, v112)) { - v115 = _newLineIdx; - v114 = _newLineDataIdx; - v112 = _newRouteIdx; + if (v79 == 2 || MIRACLE(curLineX, curLineY, idx, curLineIdx, routeIdx)) { + lineIdx = _newLineIdx; + lineDataIdx = _newLineDataIdx; + routeIdx = _newRouteIdx; loopCond = true; break; } @@ -1450,31 +1446,31 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (loopCond) continue; - v114 = 0; - v115 = v121; + lineDataIdx = 0; + lineIdx = curLineIdx; } - if (v115 > v121) { - for (int dataIdx = v114; dataIdx > 0; dataIdx--) { - v119 = _lineItem[v115]._lineData[2 * dataIdx]; - v118 = _lineItem[v115]._lineData[2 * dataIdx + 1]; + if (lineIdx > curLineIdx) { + for (int dataIdx = lineDataIdx; dataIdx > 0; dataIdx--) { + curLineX = _lineItem[lineIdx]._lineData[2 * dataIdx]; + curLineY = _lineItem[lineIdx]._lineData[2 * dataIdx + 1]; - _bestRoute[v112].set(_lineItem[v115]._lineData[2 * dataIdx], _lineItem[v115]._lineData[2 * dataIdx + 1], _lineItem[v115]._directionRouteDec); - v112++; + _bestRoute[routeIdx].set(_lineItem[lineIdx]._lineData[2 * dataIdx], _lineItem[lineIdx]._lineData[2 * dataIdx + 1], _lineItem[lineIdx]._directionRouteDec); + routeIdx++; } - for (int v117 = v115 - 1; v117 > v121; v117--) { + for (int v117 = lineIdx - 1; v117 > curLineIdx; v117--) { for (int dataIdx = _lineItem[v117]._lineDataEndIdx - 1; dataIdx > -1; dataIdx--) { - v119 = _lineItem[v117]._lineData[2 * dataIdx]; - v118 = _lineItem[v117]._lineData[2 * dataIdx + 1]; - _bestRoute[v112].set(_lineItem[v117]._lineData[2 * dataIdx], _lineItem[v117]._lineData[2 * dataIdx + 1], _lineItem[v117]._directionRouteDec); - v112++; + curLineX = _lineItem[v117]._lineData[2 * dataIdx]; + curLineY = _lineItem[v117]._lineData[2 * dataIdx + 1]; + _bestRoute[routeIdx].set(_lineItem[v117]._lineData[2 * dataIdx], _lineItem[v117]._lineData[2 * dataIdx + 1], _lineItem[v117]._directionRouteDec); + routeIdx++; if (_lineItem[v117]._lineDataEndIdx > 30 && dataIdx == _lineItem[v117]._lineDataEndIdx / 2) { - int v88 = characterRoute(v119, v118, clipDestX, clipDestY, v117, v121, v112); + int v88 = characterRoute(curLineX, curLineY, clipDestX, clipDestY, v117, curLineIdx, routeIdx); if (v88 == 1) return &_bestRoute[0]; - if (v88 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { - v115 = _newLineIdx; - v114 = _newLineDataIdx; - v112 = _newRouteIdx; + if (v88 == 2 || MIRACLE(curLineX, curLineY, v117, curLineIdx, routeIdx)) { + lineIdx = _newLineIdx; + lineDataIdx = _newLineDataIdx; + routeIdx = _newRouteIdx; loopCond = true; break; } @@ -1484,34 +1480,34 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) { if (loopCond) break; - int v89 = characterRoute(v119, v118, clipDestX, clipDestY, v117, v121, v112); + int v89 = characterRoute(curLineX, curLineY, clipDestX, clipDestY, v117, curLineIdx, routeIdx); if (v89 == 1) return &_bestRoute[0]; - if (v89 == 2 || MIRACLE(v119, v118, v117, v121, v112)) { - v115 = _newLineIdx; - v114 = _newLineDataIdx; - v112 = _newRouteIdx; + if (v89 == 2 || MIRACLE(curLineX, curLineY, v117, curLineIdx, routeIdx)) { + lineIdx = _newLineIdx; + lineDataIdx = _newLineDataIdx; + routeIdx = _newRouteIdx; loopCond = true; break; } } if (!loopCond) { - v114 = _lineItem[v121]._lineDataEndIdx - 1; - v115 = v121; + lineDataIdx = _lineItem[curLineIdx]._lineDataEndIdx - 1; + lineIdx = curLineIdx; } } } while (loopCond); - if (v115 == v121) { - if (v114 <= v120) { - v112 = _lineItem[v121].appendToRouteInc(v114, v120, _bestRoute, v112); + if (lineIdx == curLineIdx) { + if (lineDataIdx <= curLineDataIdx) { + routeIdx = _lineItem[curLineIdx].appendToRouteInc(lineDataIdx, curLineDataIdx, _bestRoute, routeIdx); } else { - v112 = _lineItem[v121].appendToRouteDec(v114, v120, _bestRoute, v112); + routeIdx = _lineItem[curLineIdx].appendToRouteDec(lineDataIdx, curLineDataIdx, _bestRoute, routeIdx); } } - if (characterRoute(_bestRoute[v112 - 1]._x, _bestRoute[v112 - 1]._y, clipDestX, clipDestY, -1, -1, v112) != 1) { - _bestRoute[v112].invalidate(); + if (characterRoute(_bestRoute[routeIdx - 1]._x, _bestRoute[routeIdx - 1]._y, clipDestX, clipDestY, -1, -1, routeIdx) != 1) { + _bestRoute[routeIdx].invalidate(); } return &_bestRoute[0]; @@ -2589,7 +2585,7 @@ void LinesManager::PACOURS_PROPRE(RouteItem *route) { } } -int LinesManager::MZONE() { +int LinesManager::getMouseZone() { int result; int xp = _vm->_eventsManager._mousePos.x + _vm->_eventsManager._mouseOffset.x; @@ -2907,7 +2903,7 @@ void LinesManager::checkZone() { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { - zoneId = MZONE(); + zoneId = getMouseZone(); } else { zoneId = _vm->_globals._oldMouseZoneId; } diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index a42089a98b..3d07aea91c 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -171,8 +171,8 @@ public: void enableZone(int idx); void disableZone(int idx); void checkZone(); + int getMouseZone(); - int MZONE(); void CARRE_ZONE(); RouteItem *PARCOURS2(int fromX, int fromY, int destX, int destY); void PACOURS_PROPRE(RouteItem *route); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index e4ca428cd9..41b176c713 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1744,7 +1744,7 @@ void ObjectsManager::handleCityMap() { _vm->_globals._freezeCharacterFl = false; _spritePtr = g_PTRNUL; _vm->_globals._exitId = 0; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_soundManager.playSound(31); _vm->_globals.iRegul = 1; _vm->_graphicsManager.loadImage("PLAN"); @@ -2108,7 +2108,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _changeHeadFl = true; _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS @@ -3722,13 +3722,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->_globals._screenId == 61) { _vm->_animationManager.playSequence("OUVRE.SEQ", 10, 4, 10); stopBobAnimation(3); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _oldCharacterPosX = getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; do { GOHOME(); _vm->_eventsManager.VBL(); @@ -3778,7 +3778,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager._noFadingFl = false; _vm->_globals._freezeCharacterFl = false; _vm->_globals._exitId = 0; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_soundManager.playSound(soundNum); _vm->_globals.iRegul = 1; if (!backgroundFile.empty()) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 5a1c302a2e..4d6d5d22c7 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -744,7 +744,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 46: { - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); _vm->_objectsManager._zoneNum = -1; @@ -756,7 +756,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_linesManager._route != (RouteItem *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); _vm->_soundManager.loadSample(2, "SOUND45.WAV"); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0); @@ -953,13 +953,13 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 59: { - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1053,13 +1053,13 @@ int ScriptManager::handleOpcode(byte *dataP) { } case 81: { - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1370,7 +1370,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 105: - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; @@ -1384,7 +1384,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (_vm->_globals._saveData->_data[svField253] > 2) { _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); } - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1617,14 +1617,14 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.startAnimatedCharacterDialogue("gred1.pe2"); _vm->_globals._introSpeechOffFl = false; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) @@ -1645,14 +1645,14 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._introSpeechOffFl = true; _vm->_talkManager.startAnimatedCharacterDialogue("gbleu1.pe2"); _vm->_globals._introSpeechOffFl = false; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) @@ -1822,10 +1822,10 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_animationManager.playSequence("SORT.SEQ", 10, 4, 10, true); _vm->_soundManager._specialSoundNum = 0; } - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._zoneNum = 0; do { if (_vm->shouldQuit()) @@ -1854,10 +1854,10 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.getBobAnimDataIdx(1) != 9); _vm->_objectsManager.stopBobAnimation(1); _vm->_linesManager._route = (RouteItem *)g_PTRNUL; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); _vm->_objectsManager._zoneNum = 0; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; do { if (_vm->shouldQuit()) return -1; // Exiting game @@ -1947,14 +1947,14 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.loadLinkFile("IM93a"); _vm->_objectsManager.OBSSEUL = false; _vm->_globals.CACHE_ON(); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; _vm->_globals.Compteur = 0; - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; _vm->_linesManager._route = (RouteItem *)g_PTRNUL; _vm->_linesManager._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); - _vm->_globals.NOT_VERIF = true; + _vm->_globals._checkDistanceFl = true; do { if (_vm->shouldQuit()) return -1; // Exiting game -- cgit v1.2.3 From e4edf542091a31357437d30dc20bc89d008438db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 09:10:45 +0100 Subject: HOPKINS: Some renaming in Globals and ObjectsManager. Remove a couple of useless variables. --- engines/hopkins/globals.cpp | 100 +++++++++++++++++------------------ engines/hopkins/globals.h | 30 +++++------ engines/hopkins/hopkins.cpp | 4 +- engines/hopkins/objects.cpp | 124 ++++++++++++++++++++++---------------------- engines/hopkins/objects.h | 1 - engines/hopkins/script.cpp | 28 +++++----- engines/hopkins/talk.cpp | 5 +- 7 files changed, 143 insertions(+), 149 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 4e5ea6a4c2..2497f3281e 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -68,8 +68,6 @@ Globals::Globals() { strcpy((char *)g_PTRNUL, "POINTERNULL"); // Initialize array properties - for (int i = 0; i < 6; ++i) - CACHE_BANQUE[i] = g_PTRNUL; for (int i = 0; i < 35; ++i) Common::fill((byte *)&_animBqe[i], (byte *)&_animBqe[i] + sizeof(BqeAnimItem), 0); for (int i = 0; i < 8; ++i) @@ -85,7 +83,7 @@ Globals::Globals() { for (int i = 0; i < 300; ++i) Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0); for (int i = 0; i < 25; ++i) - Common::fill((byte *)&Cache[i], (byte *)&Cache[i] + sizeof(CacheItem), 0); + Common::fill((byte *)&_hidingItem[i], (byte *)&_hidingItem[i] + sizeof(HidingItem), 0); for (int i = 0; i < 500; ++i) _spriteSize[i] = 0; @@ -143,9 +141,9 @@ Globals::Globals() { _oceanDirection = DIR_NONE; // Initialize pointers + for (int i = 0; i < 6; ++i) + _hidingItemData[i] = g_PTRNUL; BUF_ZONE = NULL; - for (int idx = 0; idx < 6; ++idx) - CACHE_BANQUE[idx] = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; _inventoryObject = NULL; @@ -159,7 +157,7 @@ Globals::Globals() { _disableInventFl = false; _freezeCharacterFl = false; _optionDialogFl = false; - _cacheFl = false; + _hidingActiveFl = false; _introSpeechOffFl = false; _baseMapColor = 50; @@ -180,7 +178,7 @@ Globals::Globals() { Globals::~Globals() { freeMemory(BUF_ZONE); for (int idx = 0; idx < 6; ++idx) - CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); + _hidingItemData[idx] = freeMemory(_hidingItemData[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); freeMemory(_inventoryObject); @@ -188,7 +186,7 @@ Globals::~Globals() { freeMemory(ADR_FICHIER_OBJ); freeMemory(PERSO); - CLEAR_VBOB(); + clearVBob(); free(g_PTRNUL); } @@ -235,15 +233,15 @@ void Globals::setConfig() { void Globals::clearAll() { for (int idx = 0; idx < 6; ++idx) - CACHE_BANQUE[idx] = g_PTRNUL; + _hidingItemData[idx] = g_PTRNUL; - INIT_ANIM(); + initAnimBqe(); _boxWidth = 0; _vm->_fontManager.clearAll(); - INIT_VBOB(); + initVBob(); ADR_FICHIER_OBJ = g_PTRNUL; NUM_FICHIER_OBJ = 0; _vm->_eventsManager._objectBuf = g_PTRNUL; @@ -283,7 +281,7 @@ void Globals::loadCharacterData() { _oldDirection = DIR_NONE; } -void Globals::INIT_ANIM() { +void Globals::initAnimBqe() { for (int idx = 0; idx < 35; ++idx) { _animBqe[idx]._data = g_PTRNUL; _animBqe[idx]._enabledFl = false; @@ -297,7 +295,7 @@ void Globals::INIT_ANIM() { } } -void Globals::INIT_VBOB() { +void Globals::initVBob() { for (int idx = 0; idx < 30; ++idx) { VBob[idx].field4 = 0; VBob[idx]._xp = 0; @@ -309,7 +307,7 @@ void Globals::INIT_VBOB() { } } -void Globals::CLEAR_VBOB() { +void Globals::clearVBob() { for (int idx = 0; idx < 30; ++idx) { VBob[idx].field4 = 0; VBob[idx]._xp = 0; @@ -353,34 +351,34 @@ byte *Globals::freeMemory(byte *p) { return g_PTRNUL; } -// Reset Cache -void Globals::resetCache() { +// Reset Hiding Items +void Globals::resetHidingItems() { for (int idx = 1; idx <= 5; ++idx) { - CACHE_BANQUE[idx] = freeMemory(CACHE_BANQUE[idx]); + _hidingItemData[idx] = freeMemory(_hidingItemData[idx]); } for (int idx = 0; idx <= 20; ++idx) { - Cache[idx]._spriteData = g_PTRNUL; - Cache[idx]._x = 0; - Cache[idx]._y = 0; - Cache[idx]._spriteIndex = 0; - Cache[idx]._useCount = 0; - Cache[idx]._width = 0; - Cache[idx]._height = 0; - Cache[idx].field10 = false; - Cache[idx].field14 = 0; + _hidingItem[idx]._spriteData = g_PTRNUL; + _hidingItem[idx]._x = 0; + _hidingItem[idx]._y = 0; + _hidingItem[idx]._spriteIndex = 0; + _hidingItem[idx]._useCount = 0; + _hidingItem[idx]._width = 0; + _hidingItem[idx]._height = 0; + _hidingItem[idx].field10 = false; + _hidingItem[idx].field14 = 0; } - _cacheFl = false; + _hidingActiveFl = false; } -void Globals::CACHE_ON() { - _cacheFl = true; +void Globals::enableHiding() { + _hidingActiveFl = true; } -void Globals::CACHE_OFF() { - _cacheFl = false; +void Globals::disableHiding() { + _hidingActiveFl = false; } void Globals::B_CACHE_OFF(int idx) { @@ -388,17 +386,17 @@ void Globals::B_CACHE_OFF(int idx) { _vm->_objectsManager._bob[idx].field34 = true; } -void Globals::CACHE_SUB(int idx) { - Cache[idx]._useCount = 0; +void Globals::resetHidingUseCount(int idx) { + _hidingItem[idx]._useCount = 0; } -void Globals::CACHE_ADD(int idx) { - Cache[idx]._useCount = 1; +void Globals::setHidingUseCount(int idx) { + _hidingItem[idx]._useCount = 1; } -// Load Cache -void Globals::loadCache(const Common::String &file) { - resetCache(); +// Load Hiding Items +void Globals::loadHidingItems(const Common::String &file) { + resetHidingItems(); byte *ptr = _vm->_fileManager.loadFile(file); Common::String filename = Common::String((const char *)ptr); @@ -407,27 +405,27 @@ void Globals::loadCache(const Common::String &file) { return; byte *spriteData = _vm->_fileManager.loadFile(filename); - CACHE_BANQUE[1] = spriteData; + _hidingItemData[1] = spriteData; int curBufIdx = 60; for (int i = 0; i <= 21; i++) { - Cache[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + curBufIdx); - Cache[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1); - Cache[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2); - Cache[i].field14 = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4); + _hidingItem[i]._spriteIndex = READ_LE_INT16((uint16 *)ptr + curBufIdx); + _hidingItem[i]._x = READ_LE_INT16((uint16 *)ptr + curBufIdx + 1); + _hidingItem[i]._y = READ_LE_INT16((uint16 *)ptr + curBufIdx + 2); + _hidingItem[i].field14 = READ_LE_INT16((uint16 *)ptr + curBufIdx + 4); if (spriteData == g_PTRNUL) { - Cache[i]._useCount = 0; + _hidingItem[i]._useCount = 0; } else { - Cache[i]._spriteData = spriteData; - Cache[i]._width = _vm->_objectsManager.getWidth(spriteData, Cache[i]._spriteIndex); - Cache[i]._height = _vm->_objectsManager.getHeight(spriteData, Cache[i]._spriteIndex); - Cache[i]._useCount = 1; + _hidingItem[i]._spriteData = spriteData; + _hidingItem[i]._width = _vm->_objectsManager.getWidth(spriteData, _hidingItem[i]._spriteIndex); + _hidingItem[i]._height = _vm->_objectsManager.getHeight(spriteData, _hidingItem[i]._spriteIndex); + _hidingItem[i]._useCount = 1; } - if ( !Cache[i]._x && !Cache[i]._y && !Cache[i]._spriteIndex) - Cache[i]._useCount = 0; + if ( !_hidingItem[i]._x && !_hidingItem[i]._y && !_hidingItem[i]._spriteIndex) + _hidingItem[i]._useCount = 0; curBufIdx += 5; } - CACHE_ON(); + enableHiding(); freeMemory(ptr); } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 61fb3f880f..700fead351 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -94,7 +94,7 @@ struct SortItem { int _priority; }; -struct CacheItem { +struct HidingItem { int _x; int _spriteIndex; int _y; @@ -239,8 +239,8 @@ private: byte *_inventoryObject; - void INIT_ANIM(); - void INIT_VBOB(); + void initAnimBqe(); + void initVBob(); public: bool _disableInventFl; @@ -248,7 +248,7 @@ public: bool _linuxEndDemoFl; bool _censorshipFl; bool _introSpeechOffFl; - bool _cacheFl; + bool _hidingActiveFl; bool _forceHideText; int _exitId; Directions _oceanDirection; @@ -308,10 +308,12 @@ public: bool _actionMoveTo; bool _freezeCharacterFl; bool _checkDistanceFl; + byte *_hidingItemData[6]; + HidingItem _hidingItem[25]; + BqeAnimItem _animBqe[35]; int iRegul; byte *BUF_ZONE; - BqeAnimItem _animBqe[35]; byte *SPRITE_ECRAN; byte *PERSO; ObjetWItem ObjetW[300]; @@ -320,8 +322,6 @@ public: ListeItem Liste[6]; ListeItem Liste2[35]; BankItem Bank[8]; - byte *CACHE_BANQUE[6]; - CacheItem Cache[25]; VBobItem VBob[30]; int Compteur; int compteur_71; @@ -337,15 +337,15 @@ public: void loadObjects(); void clearAll(); void loadCharacterData(); - void resetCache(); - void loadCache(const Common::String &file); - - void CLEAR_VBOB(); - void CACHE_ON(); - void CACHE_OFF(); + void resetHidingItems(); + void loadHidingItems(const Common::String &file); + void enableHiding(); + void disableHiding(); + void resetHidingUseCount(int idx); + void setHidingUseCount(int idx); + + void clearVBob(); void B_CACHE_OFF(int idx); - void CACHE_SUB(int idx); - void CACHE_ADD(int idx); }; // Global null pointer diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 162d49fb20..ccf431422e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2028,7 +2028,7 @@ void HopkinsEngine::BASED() { _eventsManager.VBL(); _graphicsManager.fadeInLong(); - _globals.CACHE_ON(); + _globals.enableHiding(); do _eventsManager.VBL(); @@ -2036,7 +2036,7 @@ void HopkinsEngine::BASED() { _graphicsManager.fadeOutLong(); _graphicsManager.endDisplayBob(); - _globals.resetCache(); + _globals.resetHidingItems(); _globals._disableInventFl = false; _globals._exitId = 93; _globals.iRegul = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 41b176c713..66b5135f69 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -346,7 +346,7 @@ void ObjectsManager::displaySprite() { } } - if (_vm->_globals._cacheFl) + if (_vm->_globals._hidingActiveFl) checkCache(); } @@ -510,7 +510,6 @@ void ObjectsManager::resetBob(int idx) { bob.field1E = 0; bob.field20 = 0; bob.field22 = 0; - bob._offsetY = 0; bob.field34 = false; bob._zoomFactor = 0; bob._flipFl = false; @@ -591,7 +590,7 @@ void ObjectsManager::displayBob(int idx) { int16 v9 = READ_LE_INT16(data + 2); int16 v8 = READ_LE_INT16(data + 4); - int16 offsetY = READ_LE_INT16(data + 6); + // data[6] isn't used, read skipped int16 v6 = READ_LE_INT16(data + 8); if (!v9) @@ -614,7 +613,6 @@ void ObjectsManager::displayBob(int idx) { _bob[idx].field1E = v9; _bob[idx].field20 = v6; _bob[idx].field22 = v8; - _bob[idx]._offsetY = offsetY; } void ObjectsManager::hideBob(int idx) { @@ -627,22 +625,22 @@ void ObjectsManager::BOB_OFFSET(int idx, int offset) { } void ObjectsManager::SCBOB(int idx) { - if (_vm->_globals.Cache[idx]._useCount == 0) + if (_vm->_globals._hidingItem[idx]._useCount == 0) return; for (int i = 0; i <= 20; i++) { if ((_bob[i].field0) && (!_bob[i]._disabledAnimationFl) && (!_bob[i].field34) && (_bob[i]._frameIndex != 250)) { int oldRight = _bob[i]._oldX + _bob[i]._oldWidth; int oldBottom = _bob[i]._oldY + _bob[i]._oldHeight; - int cachedRight = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x; - - if ((oldBottom > _vm->_globals.Cache[idx]._y) && (oldBottom < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) { - if ((oldRight >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) - || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) - || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x) - || (_bob[i]._oldWidth >= _vm->_globals.Cache[idx]._x && oldRight <= cachedRight) - || (_bob[i]._oldWidth <= _vm->_globals.Cache[idx]._x && oldRight >= cachedRight)) - ++_vm->_globals.Cache[idx]._useCount; + int cachedRight = _vm->_globals._hidingItem[idx]._width + _vm->_globals._hidingItem[idx]._x; + + if ((oldBottom > _vm->_globals._hidingItem[idx]._y) && (oldBottom < _vm->_globals._hidingItem[idx].field14 +_vm->_globals._hidingItem[idx]._height + _vm->_globals._hidingItem[idx]._y)) { + if ((oldRight >= _vm->_globals._hidingItem[idx]._x && oldRight <= cachedRight) + || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x) + || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x) + || (_bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x && oldRight <= cachedRight) + || (_bob[i]._oldWidth <= _vm->_globals._hidingItem[idx]._x && oldRight >= cachedRight)) + ++_vm->_globals._hidingItem[idx]._useCount; } } } @@ -733,41 +731,41 @@ void ObjectsManager::CALCUL_BOB(int idx) { void ObjectsManager::checkCache() { for (int cacheIdx = 0; cacheIdx <= 19; cacheIdx++) { - if (_vm->_globals.Cache[cacheIdx]._useCount == 0) + if (_vm->_globals._hidingItem[cacheIdx]._useCount == 0) continue; - int _oldUseCount = _vm->_globals.Cache[cacheIdx]._useCount; + int _oldUseCount = _vm->_globals._hidingItem[cacheIdx]._useCount; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx]._destY; - int cachedRight = _vm->_globals.Cache[cacheIdx]._width + _vm->_globals.Cache[cacheIdx]._x; - - if (bottom > _vm->_globals.Cache[cacheIdx]._y && bottom < (_vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y)) { - if ((right >= _vm->_globals.Cache[cacheIdx]._x && right <= cachedRight) - || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX) - || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX) - || (_vm->_globals.Cache[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) - || (_vm->_globals.Cache[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) - ++_vm->_globals.Cache[cacheIdx]._useCount; + int cachedRight = _vm->_globals._hidingItem[cacheIdx]._width + _vm->_globals._hidingItem[cacheIdx]._x; + + if (bottom > _vm->_globals._hidingItem[cacheIdx]._y && bottom < (_vm->_globals._hidingItem[cacheIdx].field14 + _vm->_globals._hidingItem[cacheIdx]._height + _vm->_globals._hidingItem[cacheIdx]._y)) { + if ((right >= _vm->_globals._hidingItem[cacheIdx]._x && right <= cachedRight) + || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX) + || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX) + || (_vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) + || (_vm->_globals._hidingItem[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) + ++_vm->_globals._hidingItem[cacheIdx]._useCount; } } } SCBOB(cacheIdx); - if (_vm->_globals.Cache[cacheIdx]._useCount == _oldUseCount) { - if (_vm->_globals.Cache[cacheIdx].field10) { - _vm->_globals.Cache[cacheIdx].field10 = false; - _vm->_globals.Cache[cacheIdx]._useCount = 1; + if (_vm->_globals._hidingItem[cacheIdx]._useCount == _oldUseCount) { + if (_vm->_globals._hidingItem[cacheIdx].field10) { + _vm->_globals._hidingItem[cacheIdx].field10 = false; + _vm->_globals._hidingItem[cacheIdx]._useCount = 1; } } else { - int priority = _vm->_globals.Cache[cacheIdx].field14 + _vm->_globals.Cache[cacheIdx]._height + _vm->_globals.Cache[cacheIdx]._y; + int priority = _vm->_globals._hidingItem[cacheIdx].field14 + _vm->_globals._hidingItem[cacheIdx]._height + _vm->_globals._hidingItem[cacheIdx]._y; if (priority > 440) priority = 500; beforeSort(SORT_CACHE, cacheIdx, priority); - _vm->_globals.Cache[cacheIdx]._useCount = 1; - _vm->_globals.Cache[cacheIdx].field10 = true; + _vm->_globals._hidingItem[cacheIdx]._useCount = 1; + _vm->_globals._hidingItem[cacheIdx].field10 = true; } } } @@ -811,12 +809,12 @@ void ObjectsManager::DEF_SPRITE(int idx) { } void ObjectsManager::displayCache(int idx) { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals.CACHE_BANQUE[1], - _vm->_globals.Cache[idx]._x + 300, _vm->_globals.Cache[idx]._y + 300, - _vm->_globals.Cache[idx]._spriteIndex); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._hidingItemData[1], + _vm->_globals._hidingItem[idx]._x + 300, _vm->_globals._hidingItem[idx]._y + 300, + _vm->_globals._hidingItem[idx]._spriteIndex); - _vm->_graphicsManager.addVesaSegment(_vm->_globals.Cache[idx]._x, _vm->_globals.Cache[idx]._y, - _vm->_globals.Cache[idx]._x + _vm->_globals.Cache[idx]._width, _vm->_globals.Cache[idx]._y + _vm->_globals.Cache[idx]._height); + _vm->_graphicsManager.addVesaSegment(_vm->_globals._hidingItem[idx]._x, _vm->_globals._hidingItem[idx]._y, + _vm->_globals._hidingItem[idx]._x + _vm->_globals._hidingItem[idx]._width, _vm->_globals._hidingItem[idx]._y + _vm->_globals._hidingItem[idx]._height); } // Compute Sprite @@ -1749,7 +1747,7 @@ void ObjectsManager::handleCityMap() { _vm->_globals.iRegul = 1; _vm->_graphicsManager.loadImage("PLAN"); _vm->_linesManager.loadLines("PLAN.OB2"); - _vm->_globals.loadCache("PLAN.CA2"); + _vm->_globals.loadHidingItems("PLAN.CA2"); loadZone("PLAN.ZO2"); _spritePtr = _vm->_fileManager.loadFile("VOITURE.SPR"); _vm->_animationManager.loadAnim("PLAN"); @@ -1759,7 +1757,7 @@ void ObjectsManager::handleCityMap() { _vm->_globals.B_CACHE_OFF(i); _vm->_globals.B_CACHE_OFF(19); _vm->_globals.B_CACHE_OFF(20); - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); if (!_mapCarPosX && !_mapCarPosY) { _mapCarPosX = 900; @@ -2066,11 +2064,11 @@ void ObjectsManager::clearScreen() { _vm->_graphicsManager.endDisplayBob(); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); - _vm->_globals.CLEAR_VBOB(); + _vm->_globals.clearVBob(); _vm->_animationManager.clearAnim(); _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); - _vm->_globals.resetCache(); + _vm->_globals.resetHidingItems(); for (int i = 0; i <= 48; i++) { _vm->_linesManager.BOBZONE[i] = 0; @@ -3074,42 +3072,42 @@ void ObjectsManager::loadLinkFile(const Common::String &file) { for (int idx = 0; idx < 500; ++idx) _vm->_globals._spriteSize[idx] = READ_LE_INT16((uint16 *)ptr + idx); - _vm->_globals.resetCache(); + _vm->_globals.resetHidingItems(); Common::String filename2 = Common::String((const char *)ptr + 1000); if (!filename2.empty()) { - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.searchCat(filename2, 8); + _vm->_globals._hidingItemData[1] = _vm->_fileManager.searchCat(filename2, 8); - if (_vm->_globals.CACHE_BANQUE[1] || _vm->_globals.CACHE_BANQUE[1] == g_PTRNUL) { - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile(filename2); + if (_vm->_globals._hidingItemData[1] || _vm->_globals._hidingItemData[1] == g_PTRNUL) { + _vm->_globals._hidingItemData[1] = _vm->_fileManager.loadFile(filename2); } else { - _vm->_globals.CACHE_BANQUE[1] = _vm->_fileManager.loadFile("RES_SLI.RES"); + _vm->_globals._hidingItemData[1] = _vm->_fileManager.loadFile("RES_SLI.RES"); } int curDataCacheId = 60; byte *curDataPtr = ptr + 1000; for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) { int curSpriteId = READ_LE_INT16(curDataPtr + 2 * curDataCacheId); - _vm->_globals.Cache[cacheIdx]._spriteIndex = curSpriteId; - _vm->_globals.Cache[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2); - _vm->_globals.Cache[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4); - _vm->_globals.Cache[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8); + _vm->_globals._hidingItem[cacheIdx]._spriteIndex = curSpriteId; + _vm->_globals._hidingItem[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2); + _vm->_globals._hidingItem[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4); + _vm->_globals._hidingItem[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8); - if (!_vm->_globals.CACHE_BANQUE[1]) { - _vm->_globals.Cache[cacheIdx]._useCount = 0; + if (!_vm->_globals._hidingItemData[1]) { + _vm->_globals._hidingItem[cacheIdx]._useCount = 0; } else { - _vm->_globals.Cache[cacheIdx]._spriteData = _vm->_globals.CACHE_BANQUE[1]; - _vm->_globals.Cache[cacheIdx]._width = getWidth(_vm->_globals.CACHE_BANQUE[1], curSpriteId); - _vm->_globals.Cache[cacheIdx]._height = getHeight(_vm->_globals.CACHE_BANQUE[1], curSpriteId); - _vm->_globals.Cache[cacheIdx]._useCount = 1; + _vm->_globals._hidingItem[cacheIdx]._spriteData = _vm->_globals._hidingItemData[1]; + _vm->_globals._hidingItem[cacheIdx]._width = getWidth(_vm->_globals._hidingItemData[1], curSpriteId); + _vm->_globals._hidingItem[cacheIdx]._height = getHeight(_vm->_globals._hidingItemData[1], curSpriteId); + _vm->_globals._hidingItem[cacheIdx]._useCount = 1; } - if (!_vm->_globals.Cache[cacheIdx]._x && !_vm->_globals.Cache[cacheIdx]._y - && !_vm->_globals.Cache[cacheIdx]._spriteIndex) - _vm->_globals.Cache[cacheIdx]._useCount = 0; + if (!_vm->_globals._hidingItem[cacheIdx]._x && !_vm->_globals._hidingItem[cacheIdx]._y + && !_vm->_globals._hidingItem[cacheIdx]._spriteIndex) + _vm->_globals._hidingItem[cacheIdx]._useCount = 0; curDataCacheId += 5; } - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); } } @@ -3298,8 +3296,8 @@ void ObjectsManager::SPECIAL_INI() { case 73: if (!_vm->_globals._saveData->_data[svField318]) { - _vm->_globals.CACHE_SUB(0); - _vm->_globals.CACHE_SUB(1); + _vm->_globals.resetHidingUseCount(0); + _vm->_globals.resetHidingUseCount(1); } break; @@ -3834,7 +3832,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_graphicsManager._scrollPosX = (int16)getSpriteX(0) - 320; computeAndSetSpriteSize(); animateSprite(0); - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); _vm->_linesManager._route = (RouteItem *)g_PTRNUL; computeAndSetSpriteSize(); SPECIAL_INI(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index b20d1e2ad7..8ccc345104 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -66,7 +66,6 @@ struct BobItem { int field1E; int field20; int field22; - int _offsetY; // Unused variable? bool field34; // Set to true in B_CACHE_OFF() int _zoomFactor; bool _flipFl; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 4d6d5d22c7..012033190a 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -539,7 +539,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager._mouseButton = _vm->_eventsManager._curMouseButton; _vm->_globals._disableInventFl = true; _vm->_graphicsManager.fadeOutLong(); - _vm->_globals.CACHE_OFF(); + _vm->_globals.disableHiding(); _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); @@ -826,7 +826,7 @@ int ScriptManager::handleOpcode(byte *dataP) { break; case 49: { - _vm->_globals.CACHE_OFF(); + _vm->_globals.disableHiding(); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.OPTI_BOBON(9, 10, -1, 0, 0, 0); int v19 = 12; @@ -861,7 +861,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(9); } - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); break; } @@ -872,7 +872,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 51: { _vm->_graphicsManager.fadeOutLong(); - _vm->_globals.CACHE_OFF(); + _vm->_globals.disableHiding(); _vm->_objectsManager.removeSprite(0); _vm->_fontManager.hideText(5); _vm->_fontManager.hideText(9); @@ -1889,10 +1889,10 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.loadLinkFile("IM73a"); _vm->_objectsManager.OBSSEUL = false; - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); _vm->_animationManager.NO_SEQ = false; - _vm->_globals.CACHE_ADD(0); - _vm->_globals.CACHE_ADD(1); + _vm->_globals.setHidingUseCount(0); + _vm->_globals.setHidingUseCount(1); _vm->_graphicsManager.SETCOLOR4(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR4(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -1901,7 +1901,7 @@ int ScriptManager::handleOpcode(byte *dataP) { case 211: _vm->_objectsManager.removeSprite(0); - _vm->_globals.CACHE_OFF(); + _vm->_globals.disableHiding(); _vm->_animationManager.NO_SEQ = true; _vm->_soundManager._specialSoundNum = 211; _vm->_animationManager.playSequence("SECRET2.SEQ", 1, 12, 100); @@ -1946,7 +1946,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.loadLinkFile("IM93a"); _vm->_objectsManager.OBSSEUL = false; - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); _vm->_globals._checkDistanceFl = true; _vm->_objectsManager._oldCharacterPosX = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = DIR_NONE; @@ -1983,12 +1983,12 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.OBSSEUL = true; _vm->_objectsManager.loadLinkFile("IM93c"); _vm->_objectsManager.OBSSEUL = false; - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); break; } case 231: - _vm->_globals.CACHE_OFF(); + _vm->_globals.disableHiding(); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(12); do { @@ -2008,11 +2008,11 @@ int ScriptManager::handleOpcode(byte *dataP) { } while (_vm->_objectsManager.getBobAnimDataIdx(12) != 12); _vm->_objectsManager.animateSprite(0); _vm->_objectsManager.stopBobAnimation(12); - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); break; case 233: { - _vm->_globals.CACHE_OFF(); + _vm->_globals.disableHiding(); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); int v46 = 0; @@ -2025,7 +2025,7 @@ int ScriptManager::handleOpcode(byte *dataP) { v46 = 1; } while (_vm->_objectsManager.getBobAnimDataIdx(11) != 13); _vm->_objectsManager.stopBobAnimation(11); - _vm->_globals.CACHE_ON(); + _vm->_globals.enableHiding(); _vm->_objectsManager.setBobAnimation(13); do { if (_vm->shouldQuit()) diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e9b292b813..d8e37924fe 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -619,7 +619,6 @@ void TalkManager::BOB_VISU_PARLE(int idx) { _vm->_objectsManager._bob[idx].field1E = v4; _vm->_objectsManager._bob[idx].field20 = -1; _vm->_objectsManager._bob[idx].field22 = 0; - _vm->_objectsManager._bob[idx]._offsetY = 0; } } } @@ -971,7 +970,7 @@ void TalkManager::animateObject(const Common::String &a2) { _vm->_graphicsManager._scrollStatus = 1; _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); - _vm->_globals.resetCache(); + _vm->_globals.resetHidingItems(); for (int i = 0; i <= 44; i++) _vm->_linesManager.BOBZONE[i] = 0; @@ -1050,7 +1049,7 @@ void TalkManager::animateObject(const Common::String &a2) { _vm->_graphicsManager.NB_SCREEN(false); _vm->_linesManager.clearAllZones(); _vm->_linesManager.resetLines(); - _vm->_globals.resetCache(); + _vm->_globals.resetHidingItems(); for (int i = 0; i <= 44; i++) _vm->_linesManager.BOBZONE[i] = 0; -- cgit v1.2.3 From 577f904055a1f75fe265b7a65e9de0dee1b39ac2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 10:36:54 +0100 Subject: HOPKINS: More renaming in Globals and ObjectsManager --- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/globals.cpp | 42 +++++++-------- engines/hopkins/globals.h | 33 ++++++------ engines/hopkins/lines.cpp | 2 +- engines/hopkins/objects.cpp | 123 ++++++++++++++++++++++---------------------- engines/hopkins/objects.h | 10 ++-- engines/hopkins/script.cpp | 6 +-- 7 files changed, 108 insertions(+), 110 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 9fe7be68cc..6102c8645a 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -373,7 +373,7 @@ void DialogsManager::showInventory() { int inventIdx = _vm->_globals._inventory[inventCount]; // The last two zones are not reserved for the inventory: Options and Save/Load if (inventIdx && inventCount <= 29) { - byte *obj = _vm->_objectsManager.CAPTURE_OBJET(inventIdx, false); + byte *obj = _vm->_objectsManager.loadObjectFromFile(inventIdx, false); _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6, curPosY + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight); _vm->_globals.freeMemory(obj); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 2497f3281e..45caa926b4 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -81,7 +81,7 @@ Globals::Globals() { Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0); } for (int i = 0; i < 300; ++i) - Common::fill((byte *)&ObjetW[i], (byte *)&ObjetW[i] + sizeof(ObjetWItem), 0); + Common::fill((byte *)&_objectAuthIcons[i], (byte *)&_objectAuthIcons[i] + sizeof(ObjectAuthIcon), 0); for (int i = 0; i < 25; ++i) Common::fill((byte *)&_hidingItem[i], (byte *)&_hidingItem[i] + sizeof(HidingItem), 0); @@ -104,7 +104,7 @@ Globals::Globals() { _oldDirection = DIR_NONE; _oldDirectionSpriteIdx = 59; _lastDirection = DIR_NONE; - NUM_FICHIER_OBJ = 0; + _curObjectFileNum = 0; _boxWidth = 0; _objectWidth = _objectHeight = 0; _catalogPos = 0; @@ -148,7 +148,7 @@ Globals::Globals() { _saveData = NULL; _inventoryObject = NULL; _answerBuffer = g_PTRNUL; - ADR_FICHIER_OBJ = NULL; + _objectDataBuf = NULL; PERSO = NULL; _optionDialogSpr = NULL; @@ -183,7 +183,7 @@ Globals::~Globals() { freeMemory((byte *)_saveData); freeMemory(_inventoryObject); freeMemory(_answerBuffer); - freeMemory(ADR_FICHIER_OBJ); + freeMemory(_objectDataBuf); freeMemory(PERSO); clearVBob(); @@ -217,16 +217,16 @@ void Globals::setConfig() { switch (_language) { case LANG_EN: - FICH_ZONE = "ZONEAN.TXT"; - FICH_TEXTE = "TEXTEAN.TXT"; + _zoneFilename = "ZONEAN.TXT"; + _textFilename = "TEXTEAN.TXT"; break; case LANG_FR: - FICH_ZONE = "ZONE01.TXT"; - FICH_TEXTE = "TEXTE01.TXT"; + _zoneFilename = "ZONE01.TXT"; + _textFilename = "TEXTE01.TXT"; break; case LANG_SP: - FICH_ZONE = "ZONEES.TXT"; - FICH_TEXTE = "TEXTEES.TXT"; + _zoneFilename = "ZONEES.TXT"; + _textFilename = "TEXTEES.TXT"; break; } } @@ -242,8 +242,8 @@ void Globals::clearAll() { _vm->_fontManager.clearAll(); initVBob(); - ADR_FICHIER_OBJ = g_PTRNUL; - NUM_FICHIER_OBJ = 0; + _objectDataBuf = g_PTRNUL; + _curObjectFileNum = 0; _vm->_eventsManager._objectBuf = g_PTRNUL; _vm->_dialogsManager._inventWin1 = g_PTRNUL; _vm->_dialogsManager._inventBuf2 = g_PTRNUL; @@ -263,7 +263,7 @@ void Globals::clearAll() { _vm->_eventsManager._objectBuf = allocMemory(2500); _inventoryObject = allocMemory(2500); - ADR_FICHIER_OBJ = g_PTRNUL; + _objectDataBuf = g_PTRNUL; } void Globals::loadCharacterData() { @@ -325,14 +325,14 @@ void Globals::loadObjects() { byte *srcP = data; for (int idx = 0; idx < 300; ++idx) { - ObjetW[idx].field0 = *srcP++; - ObjetW[idx]._idx = *srcP++; - ObjetW[idx].field2 = *srcP++; - ObjetW[idx].field3 = *srcP++; - ObjetW[idx].field4 = *srcP++; - ObjetW[idx].field5 = *srcP++; - ObjetW[idx].field6 = *srcP++; - ObjetW[idx].field7 = *srcP++; + _objectAuthIcons[idx]._objectFileNum = *srcP++; + _objectAuthIcons[idx]._idx = *srcP++; + _objectAuthIcons[idx]._flag1 = *srcP++; + _objectAuthIcons[idx]._flag2 = *srcP++; + _objectAuthIcons[idx]._flag3 = *srcP++; + _objectAuthIcons[idx]._flag4 = *srcP++; + _objectAuthIcons[idx]._flag5 = *srcP++; + _objectAuthIcons[idx]._flag6 = *srcP++; } freeMemory(data); diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 700fead351..cd566a2134 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -29,7 +29,6 @@ namespace Hopkins { - struct BqeAnimItem { byte *_data; bool _enabledFl; @@ -69,21 +68,21 @@ struct VBobItem { byte *_oldSpriteData; }; -struct ObjetWItem { - byte field0; +struct ObjectAuthIcon { + byte _objectFileNum; byte _idx; - byte field2; - byte field3; - byte field4; - byte field5; - byte field6; - byte field7; + byte _flag1; + byte _flag2; + byte _flag3; + byte _flag4; + byte _flag5; + byte _flag6; }; /** * Mode for SortItem records */ -enum SortMode { SORT_NONE = 0, SORT_BOB = 1, SORT_SPRITE = 2, SORT_CACHE = 3 }; +enum SortMode { SORT_NONE = 0, SORT_BOB = 1, SORT_SPRITE = 2, SORT_HIDING = 3 }; /** * Structure to represent a pending display of either a Bob, Sprite, or Cache Item. @@ -96,8 +95,8 @@ struct SortItem { struct HidingItem { int _x; - int _spriteIndex; int _y; + int _spriteIndex; int _width; int _height; int _useCount; @@ -311,22 +310,22 @@ public: byte *_hidingItemData[6]; HidingItem _hidingItem[25]; BqeAnimItem _animBqe[35]; + ObjectAuthIcon _objectAuthIcons[300]; + int _curObjectFileNum; + byte *_objectDataBuf; + Common::String _zoneFilename; + Common::String _textFilename; int iRegul; byte *BUF_ZONE; byte *SPRITE_ECRAN; byte *PERSO; - ObjetWItem ObjetW[300]; - int NUM_FICHIER_OBJ; - byte *ADR_FICHIER_OBJ; ListeItem Liste[6]; ListeItem Liste2[35]; BankItem Bank[8]; VBobItem VBob[30]; int Compteur; int compteur_71; - Common::String FICH_ZONE; - Common::String FICH_TEXTE; Globals(); ~Globals(); @@ -343,8 +342,8 @@ public: void disableHiding(); void resetHidingUseCount(int idx); void setHidingUseCount(int idx); - void clearVBob(); + void B_CACHE_OFF(int idx); }; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 8fa0f1febe..77b9d4b6cd 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2924,7 +2924,7 @@ void LinesManager::checkZone() { ZONEP[zoneId]._verbFl7 || ZONEP[zoneId]._verbFl8 || ZONEP[zoneId]._verbFl9 || ZONEP[zoneId]._verbFl10) { if (_vm->_globals._oldMouseZoneId != zoneId) { - _vm->_fontManager.initTextBuffers(5, ZONEP[zoneId]._messageId, _vm->_globals.FICH_ZONE, 0, 430, 0, 0, 252); + _vm->_fontManager.initTextBuffers(5, ZONEP[zoneId]._messageId, _vm->_globals._zoneFilename, 0, 430, 0, 0, 252); _vm->_fontManager.showText(5); _vm->_globals._forceHideText = true; } diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 66b5135f69..a187f59d4a 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -104,41 +104,41 @@ void ObjectsManager::clearAll() { * Change Object */ void ObjectsManager::changeObject(int objIndex) { - _vm->_eventsManager._objectBuf = CAPTURE_OBJET(objIndex, true); + _vm->_eventsManager._objectBuf = loadObjectFromFile(objIndex, true); _curObjectIndex = objIndex; } -byte *ObjectsManager::CAPTURE_OBJET(int objIndex, bool mode) { +byte *ObjectsManager::loadObjectFromFile(int objIndex, bool mode) { byte *dataP = NULL; - int val1 = _vm->_globals.ObjetW[objIndex].field0; - int val2 = _vm->_globals.ObjetW[objIndex]._idx; + int objectFileNum = _vm->_globals._objectAuthIcons[objIndex]._objectFileNum; + int idx = _vm->_globals._objectAuthIcons[objIndex]._idx; if (mode) - ++val2; + ++idx; - if (val1 != _vm->_globals.NUM_FICHIER_OBJ) { - if (_vm->_globals.ADR_FICHIER_OBJ != g_PTRNUL) - ObjectsManager::DEL_FICHIER_OBJ(); - if (val1 == 1) { - _vm->_globals.ADR_FICHIER_OBJ = ObjectsManager::loadSprite("OBJET1.SPR"); + if (objectFileNum != _vm->_globals._curObjectFileNum) { + if (_vm->_globals._objectDataBuf != g_PTRNUL) + ObjectsManager::removeObjectDataBuf(); + if (objectFileNum == 1) { + _vm->_globals._objectDataBuf = ObjectsManager::loadSprite("OBJET1.SPR"); } - _vm->_globals.NUM_FICHIER_OBJ = val1; + _vm->_globals._curObjectFileNum = objectFileNum; } - int width = ObjectsManager::getWidth(_vm->_globals.ADR_FICHIER_OBJ, val2); - int height = ObjectsManager::getHeight(_vm->_globals.ADR_FICHIER_OBJ, val2); + int width = ObjectsManager::getWidth(_vm->_globals._objectDataBuf, idx); + int height = ObjectsManager::getHeight(_vm->_globals._objectDataBuf, idx); _vm->_globals._objectWidth = width; _vm->_globals._objectHeight = height; if (mode) { - sprite_alone(_vm->_globals.ADR_FICHIER_OBJ, _vm->_eventsManager._objectBuf, val2); + sprite_alone(_vm->_globals._objectDataBuf, _vm->_eventsManager._objectBuf, idx); dataP = _vm->_eventsManager._objectBuf; } else { dataP = _vm->_globals.allocMemory(height * width); if (dataP == g_PTRNUL) error("CAPTURE_OBJET"); - capture_mem_sprite(_vm->_globals.ADR_FICHIER_OBJ, dataP, val2); + capture_mem_sprite(_vm->_globals._objectDataBuf, dataP, idx); } return dataP; @@ -258,9 +258,9 @@ void ObjectsManager::capture_mem_sprite(const byte *objectData, byte *sprite, in memcpy(sprite, objP + 12, result); } -void ObjectsManager::DEL_FICHIER_OBJ() { - _vm->_globals.NUM_FICHIER_OBJ = 0; - _vm->_globals.ADR_FICHIER_OBJ = _vm->_globals.freeMemory(_vm->_globals.ADR_FICHIER_OBJ); +void ObjectsManager::removeObjectDataBuf() { + _vm->_globals._curObjectFileNum = 0; + _vm->_globals._objectDataBuf = _vm->_globals.freeMemory(_vm->_globals._objectDataBuf); } /** @@ -341,13 +341,13 @@ void ObjectsManager::displaySprite() { _vm->_globals.Liste[idx]._visibleFl = false; if (_sprite[idx]._animationType == 1) { computeSprite(idx); - if (_sprite[idx].field2A) + if (_sprite[idx]._activeFl) beforeSort(SORT_SPRITE, idx, _sprite[idx]._height + _sprite[idx]._destY); } } if (_vm->_globals._hidingActiveFl) - checkCache(); + checkHidingItem(); } if (_priorityFl && _vm->_globals._sortedDisplayCount) { @@ -373,8 +373,8 @@ void ObjectsManager::displaySprite() { case SORT_SPRITE: DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; - case SORT_CACHE: - displayCache(_vm->_globals._sortedDisplay[idx]._index); + case SORT_HIDING: + displayHiding(_vm->_globals._sortedDisplay[idx]._index); break; default: break; @@ -382,7 +382,7 @@ void ObjectsManager::displaySprite() { _vm->_globals._sortedDisplay[idx]._sortMode = SORT_NONE; } } else { - for (int idx = 1; idx < (_vm->_globals._sortedDisplayCount + 1); ++idx) { + for (int idx = 1; idx < _vm->_globals._sortedDisplayCount + 1; ++idx) { switch (_vm->_globals._sortedDisplay[idx]._sortMode) { case SORT_BOB: setBobInfo(_vm->_globals._sortedDisplay[idx]._index); @@ -390,8 +390,8 @@ void ObjectsManager::displaySprite() { case SORT_SPRITE: DEF_SPRITE(_vm->_globals._sortedDisplay[idx]._index); break; - case SORT_CACHE: - displayCache(_vm->_globals._sortedDisplay[idx]._index); + case SORT_HIDING: + displayHiding(_vm->_globals._sortedDisplay[idx]._index); break; default: break; @@ -729,49 +729,48 @@ void ObjectsManager::CALCUL_BOB(int idx) { _bob[idx]._oldHeight = height; } -void ObjectsManager::checkCache() { - for (int cacheIdx = 0; cacheIdx <= 19; cacheIdx++) { - if (_vm->_globals._hidingItem[cacheIdx]._useCount == 0) +void ObjectsManager::checkHidingItem() { + for (int hidingItemIdx = 0; hidingItemIdx <= 19; hidingItemIdx++) { + if (_vm->_globals._hidingItem[hidingItemIdx]._useCount == 0) continue; - int _oldUseCount = _vm->_globals._hidingItem[cacheIdx]._useCount; + int _oldUseCount = _vm->_globals._hidingItem[hidingItemIdx]._useCount; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx]._destY; - int cachedRight = _vm->_globals._hidingItem[cacheIdx]._width + _vm->_globals._hidingItem[cacheIdx]._x; - - if (bottom > _vm->_globals._hidingItem[cacheIdx]._y && bottom < (_vm->_globals._hidingItem[cacheIdx].field14 + _vm->_globals._hidingItem[cacheIdx]._height + _vm->_globals._hidingItem[cacheIdx]._y)) { - if ((right >= _vm->_globals._hidingItem[cacheIdx]._x && right <= cachedRight) - || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX) - || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX) - || (_vm->_globals._hidingItem[cacheIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) - || (_vm->_globals._hidingItem[cacheIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) - ++_vm->_globals._hidingItem[cacheIdx]._useCount; + int cachedRight = _vm->_globals._hidingItem[hidingItemIdx]._width + _vm->_globals._hidingItem[hidingItemIdx]._x; + + if (bottom > _vm->_globals._hidingItem[hidingItemIdx]._y && bottom < (_vm->_globals._hidingItem[hidingItemIdx].field14 + _vm->_globals._hidingItem[hidingItemIdx]._height + _vm->_globals._hidingItem[hidingItemIdx]._y)) { + if ((right >= _vm->_globals._hidingItem[hidingItemIdx]._x && right <= cachedRight) + || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[hidingItemIdx]._x <= _sprite[spriteIdx]._destX) + || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[hidingItemIdx]._x <= _sprite[spriteIdx]._destX) + || (_vm->_globals._hidingItem[hidingItemIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) + || (_vm->_globals._hidingItem[hidingItemIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) + ++_vm->_globals._hidingItem[hidingItemIdx]._useCount; } } } - SCBOB(cacheIdx); - if (_vm->_globals._hidingItem[cacheIdx]._useCount == _oldUseCount) { - if (_vm->_globals._hidingItem[cacheIdx].field10) { - _vm->_globals._hidingItem[cacheIdx].field10 = false; - _vm->_globals._hidingItem[cacheIdx]._useCount = 1; - } - } else { - int priority = _vm->_globals._hidingItem[cacheIdx].field14 + _vm->_globals._hidingItem[cacheIdx]._height + _vm->_globals._hidingItem[cacheIdx]._y; + SCBOB(hidingItemIdx); + if (_vm->_globals._hidingItem[hidingItemIdx]._useCount != _oldUseCount) { + int priority = _vm->_globals._hidingItem[hidingItemIdx].field14 + _vm->_globals._hidingItem[hidingItemIdx]._height + _vm->_globals._hidingItem[hidingItemIdx]._y; if (priority > 440) priority = 500; - beforeSort(SORT_CACHE, cacheIdx, priority); - _vm->_globals._hidingItem[cacheIdx]._useCount = 1; - _vm->_globals._hidingItem[cacheIdx].field10 = true; + beforeSort(SORT_HIDING, hidingItemIdx, priority); + _vm->_globals._hidingItem[hidingItemIdx]._useCount = 1; + _vm->_globals._hidingItem[hidingItemIdx].field10 = true; + } else if (_vm->_globals._hidingItem[hidingItemIdx].field10) { + _vm->_globals._hidingItem[hidingItemIdx].field10 = false; + _vm->_globals._hidingItem[hidingItemIdx]._useCount = 1; } + } } void ObjectsManager::DEF_SPRITE(int idx) { - if (!_sprite[idx].field2A) + if (!_sprite[idx]._activeFl) return; if (_sprite[idx]._rleFl) @@ -808,7 +807,7 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx]._posX + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx]._posY + _vm->_globals.Liste[idx]._height); } -void ObjectsManager::displayCache(int idx) { +void ObjectsManager::displayHiding(int idx) { _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._hidingItemData[1], _vm->_globals._hidingItem[idx]._x + 300, _vm->_globals._hidingItem[idx]._y + 300, _vm->_globals._hidingItem[idx]._spriteIndex); @@ -819,7 +818,7 @@ void ObjectsManager::displayCache(int idx) { // Compute Sprite void ObjectsManager::computeSprite(int idx) { - _sprite[idx].field2A = false; + _sprite[idx]._activeFl = false; int spriteIndex = _sprite[idx]._spriteIndex; if (spriteIndex == 250) return; @@ -878,7 +877,7 @@ void ObjectsManager::computeSprite(int idx) { int newPosY = _sprite[idx]._spritePos.y - deltaY; _sprite[idx]._destX = newPosX; _sprite[idx]._destY = newPosY; - _sprite[idx].field2A = true; + _sprite[idx]._activeFl = true; _sprite[idx]._zoomPct = zoomPercent; _sprite[idx]._reducePct = reducePercent; @@ -2477,13 +2476,13 @@ void ObjectsManager::nextObjectIcon(int idx) { do { if (nextCursorId == 2 || nextCursorId == 5 || nextCursorId == 6) { _vm->_eventsManager._mouseCursorId = 6; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field2 == 1) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag1 == 1) return; nextCursorId++; } if (nextCursorId == 7) { _vm->_eventsManager._mouseCursorId = 7; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field3 == 1) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag2 == 1) return; nextCursorId++; } @@ -2493,35 +2492,35 @@ void ObjectsManager::nextObjectIcon(int idx) { } if (nextCursorId == 9 || nextCursorId == 10) { _vm->_eventsManager._mouseCursorId = 10; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 == 1) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag6 == 1) return; nextCursorId = 11; } if (nextCursorId == 11) { _vm->_eventsManager._mouseCursorId = 11; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field4 == 1) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag3 == 1) return; nextCursorId++; } if (nextCursorId == 12 || nextCursorId == 13) { _vm->_eventsManager._mouseCursorId = 13; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field5 == 1) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag4 == 1) return; nextCursorId = 14; } if (nextCursorId == 14 || nextCursorId == 15) { _vm->_eventsManager._mouseCursorId = 15; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 1) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag5 == 1) return; nextCursorId = 23; } if (nextCursorId >= 16 && nextCursorId <= 23) { _vm->_eventsManager._mouseCursorId = 23; - if (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field6 == 2) + if (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag5 == 2) return; nextCursorId = 24; } @@ -2531,7 +2530,7 @@ void ObjectsManager::nextObjectIcon(int idx) { } nextCursorId = 6; - } while (_vm->_globals.ObjetW[_vm->_globals._inventory[idx]].field7 != 2); + } while (_vm->_globals._objectAuthIcons[_vm->_globals._inventory[idx]]._flag6 != 2); } void ObjectsManager::takeInventoryObject(int idx) { @@ -3227,7 +3226,7 @@ void ObjectsManager::SPECIAL_INI() { VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); _vm->_fontManager.hideText(9); if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 6, 36, 253); + _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals._textFilename, 220, 72, 6, 36, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 8ccc345104..5b4e80cbf8 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -42,7 +42,7 @@ struct SpriteItem { int field12; int field14; bool _rleFl; - bool field2A; + bool _activeFl; int _destX; int _destY; int _width; @@ -97,7 +97,7 @@ private: byte *_gestureBuf; void sprite_alone(const byte *objectData, byte *sprite, int objIndex); - void DEL_FICHIER_OBJ(); + void removeObjectDataBuf(); int getOffsetX(const byte *spriteData, int spriteIndex, bool isSize); int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize); @@ -108,9 +108,9 @@ private: void SCBOB(int idx); void CALCUL_BOB(int idx); - void checkCache(); + void checkHidingItem(); void DEF_SPRITE(int idx); - void displayCache(int idx); + void displayHiding(int idx); void computeSprite(int idx); void beforeSort(SortMode sortMode, int index, int priority); void displayBobAnim(); @@ -224,7 +224,7 @@ public: const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen); void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile, const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen); - byte *CAPTURE_OBJET(int objIndex, bool mode); + byte *loadObjectFromFile(int objIndex, bool mode); void OPTI_OBJET(); void hideBob(int idx); void displayBob(int idx); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 012033190a..691a9ec65f 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -135,7 +135,7 @@ int ScriptManager::handleOpcode(byte *dataP) { if (!_vm->_soundManager._textOffFl) { int textPosX = READ_LE_INT16(dataP + 9); int textPosY = READ_LE_INT16(dataP + 11); - _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253); + _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals._textFilename, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } @@ -143,7 +143,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager.mixVoice(mesgId, 4); } else { // if (TRAVAILOBJET) if (_vm->_globals._saveData->_data[svField356]) { - _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, dataP[8], 35, 253); + _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals._textFilename, 55, 20, dataP[8], 35, 253); if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); if (!_vm->_soundManager._voiceOffFl) @@ -2164,7 +2164,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); if (!_vm->_soundManager._textOffFl) { - _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 3, 30, 253); + _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals._textFilename, 91, 41, 3, 30, 253); _vm->_fontManager.showText(9); } if (!_vm->_soundManager._voiceOffFl) -- cgit v1.2.3 From 3625aed6f61ac70d5f72708be6059779afd569d2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 12:18:20 +0100 Subject: HOPKINS: Start making code a bit less verbose --- engines/hopkins/globals.cpp | 17 +- engines/hopkins/objects.cpp | 397 ++++++++++++++++++++++---------------------- engines/hopkins/objects.h | 4 +- 3 files changed, 206 insertions(+), 212 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 45caa926b4..69927c999f 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -325,14 +325,15 @@ void Globals::loadObjects() { byte *srcP = data; for (int idx = 0; idx < 300; ++idx) { - _objectAuthIcons[idx]._objectFileNum = *srcP++; - _objectAuthIcons[idx]._idx = *srcP++; - _objectAuthIcons[idx]._flag1 = *srcP++; - _objectAuthIcons[idx]._flag2 = *srcP++; - _objectAuthIcons[idx]._flag3 = *srcP++; - _objectAuthIcons[idx]._flag4 = *srcP++; - _objectAuthIcons[idx]._flag5 = *srcP++; - _objectAuthIcons[idx]._flag6 = *srcP++; + ObjectAuthIcon *objectAuthIcon = &_objectAuthIcons[idx]; + objectAuthIcon->_objectFileNum = *srcP++; + objectAuthIcon->_idx = *srcP++; + objectAuthIcon->_flag1 = *srcP++; + objectAuthIcon->_flag2 = *srcP++; + objectAuthIcon->_flag3 = *srcP++; + objectAuthIcon->_flag4 = *srcP++; + objectAuthIcon->_flag5 = *srcP++; + objectAuthIcon->_flag6 = *srcP++; } freeMemory(data); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index a187f59d4a..959d1e9046 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -625,22 +625,23 @@ void ObjectsManager::BOB_OFFSET(int idx, int offset) { } void ObjectsManager::SCBOB(int idx) { - if (_vm->_globals._hidingItem[idx]._useCount == 0) + HidingItem *hid = &_vm->_globals._hidingItem[idx]; + if (hid->_useCount == 0) return; for (int i = 0; i <= 20; i++) { if ((_bob[i].field0) && (!_bob[i]._disabledAnimationFl) && (!_bob[i].field34) && (_bob[i]._frameIndex != 250)) { int oldRight = _bob[i]._oldX + _bob[i]._oldWidth; int oldBottom = _bob[i]._oldY + _bob[i]._oldHeight; - int cachedRight = _vm->_globals._hidingItem[idx]._width + _vm->_globals._hidingItem[idx]._x; - - if ((oldBottom > _vm->_globals._hidingItem[idx]._y) && (oldBottom < _vm->_globals._hidingItem[idx].field14 +_vm->_globals._hidingItem[idx]._height + _vm->_globals._hidingItem[idx]._y)) { - if ((oldRight >= _vm->_globals._hidingItem[idx]._x && oldRight <= cachedRight) - || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x) - || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x) - || (_bob[i]._oldWidth >= _vm->_globals._hidingItem[idx]._x && oldRight <= cachedRight) - || (_bob[i]._oldWidth <= _vm->_globals._hidingItem[idx]._x && oldRight >= cachedRight)) - ++_vm->_globals._hidingItem[idx]._useCount; + int cachedRight = hid->_width + hid->_x; + + if ((oldBottom > hid->_y) && (oldBottom < hid->field14 +hid->_height + hid->_y)) { + if ((oldRight >= hid->_x && oldRight <= cachedRight) + || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= hid->_x) + || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= hid->_x) + || (_bob[i]._oldWidth >= hid->_x && oldRight <= cachedRight) + || (_bob[i]._oldWidth <= hid->_x && oldRight >= cachedRight)) + ++hid->_useCount; } } } @@ -731,121 +732,125 @@ void ObjectsManager::CALCUL_BOB(int idx) { void ObjectsManager::checkHidingItem() { for (int hidingItemIdx = 0; hidingItemIdx <= 19; hidingItemIdx++) { - if (_vm->_globals._hidingItem[hidingItemIdx]._useCount == 0) + HidingItem *hid = &_vm->_globals._hidingItem[hidingItemIdx]; + if (hid->_useCount == 0) continue; - int _oldUseCount = _vm->_globals._hidingItem[hidingItemIdx]._useCount; + int _oldUseCount = hid->_useCount; for (int spriteIdx = 0; spriteIdx <= 4; spriteIdx++) { - if (_sprite[spriteIdx]._animationType == 1 && _sprite[spriteIdx]._spriteIndex != 250) { - int right = _sprite[spriteIdx]._width + _sprite[spriteIdx]._destX; - int bottom = _sprite[spriteIdx]._height + _sprite[spriteIdx]._destY; - int cachedRight = _vm->_globals._hidingItem[hidingItemIdx]._width + _vm->_globals._hidingItem[hidingItemIdx]._x; - - if (bottom > _vm->_globals._hidingItem[hidingItemIdx]._y && bottom < (_vm->_globals._hidingItem[hidingItemIdx].field14 + _vm->_globals._hidingItem[hidingItemIdx]._height + _vm->_globals._hidingItem[hidingItemIdx]._y)) { - if ((right >= _vm->_globals._hidingItem[hidingItemIdx]._x && right <= cachedRight) - || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[hidingItemIdx]._x <= _sprite[spriteIdx]._destX) - || (cachedRight >= _sprite[spriteIdx]._destX && _vm->_globals._hidingItem[hidingItemIdx]._x <= _sprite[spriteIdx]._destX) - || (_vm->_globals._hidingItem[hidingItemIdx]._x <= _sprite[spriteIdx]._destX && right <= cachedRight) - || (_vm->_globals._hidingItem[hidingItemIdx]._x >= _sprite[spriteIdx]._destX && right >= cachedRight)) - ++_vm->_globals._hidingItem[hidingItemIdx]._useCount; + const SpriteItem *spr = &_sprite[spriteIdx]; + if (spr->_animationType == 1 && spr->_spriteIndex != 250) { + int right = spr->_width + spr->_destX; + int bottom = spr->_height + spr->_destY; + int hidingRight = hid->_width + hid->_x; + + if (bottom > hid->_y && bottom < (hid->field14 + hid->_height + hid->_y)) { + if ((right >= hid->_x && right <= hidingRight) + || (hidingRight >= spr->_destX && hid->_x <= spr->_destX) + || (hidingRight >= spr->_destX && hid->_x <= spr->_destX) + || (hid->_x <= spr->_destX && right <= hidingRight) + || (hid->_x >= spr->_destX && right >= hidingRight)) + ++hid->_useCount; } } } SCBOB(hidingItemIdx); - if (_vm->_globals._hidingItem[hidingItemIdx]._useCount != _oldUseCount) { - int priority = _vm->_globals._hidingItem[hidingItemIdx].field14 + _vm->_globals._hidingItem[hidingItemIdx]._height + _vm->_globals._hidingItem[hidingItemIdx]._y; + if (hid->_useCount != _oldUseCount) { + int priority = hid->field14 + hid->_height + hid->_y; if (priority > 440) priority = 500; beforeSort(SORT_HIDING, hidingItemIdx, priority); - _vm->_globals._hidingItem[hidingItemIdx]._useCount = 1; - _vm->_globals._hidingItem[hidingItemIdx].field10 = true; - } else if (_vm->_globals._hidingItem[hidingItemIdx].field10) { - _vm->_globals._hidingItem[hidingItemIdx].field10 = false; - _vm->_globals._hidingItem[hidingItemIdx]._useCount = 1; + hid->_useCount = 1; + hid->field10 = true; + } else if (hid->field10) { + hid->field10 = false; + hid->_useCount = 1; } } } void ObjectsManager::DEF_SPRITE(int idx) { - if (!_sprite[idx]._activeFl) + SpriteItem *spr = &_sprite[idx]; + if (!spr->_activeFl) return; - if (_sprite[idx]._rleFl) - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex); + if (spr->_rleFl) + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, spr->_spriteData, + spr->_destX + 300, spr->_destY + 300, spr->_spriteIndex); else - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _sprite[idx]._spriteData, - _sprite[idx]._destX + 300, _sprite[idx]._destY + 300, _sprite[idx]._spriteIndex, _sprite[idx]._reducePct, _sprite[idx]._zoomPct, _sprite[idx]._flipFl); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, spr->_spriteData, + spr->_destX + 300, spr->_destY + 300, spr->_spriteIndex, spr->_reducePct, spr->_zoomPct, spr->_flipFl); - _vm->_globals.Liste[idx]._width = _sprite[idx]._width; - _vm->_globals.Liste[idx]._height = _sprite[idx]._height; + ListeItem *list = &_vm->_globals.Liste[idx]; + list->_width = spr->_width; + list->_height = spr->_height; - if (_vm->_globals.Liste[idx]._posX < _vm->_graphicsManager._minX) { - _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste[idx]._posX; - _vm->_globals.Liste[idx]._posX = _vm->_graphicsManager._minX; + if (list->_posX < _vm->_graphicsManager._minX) { + list->_width -= _vm->_graphicsManager._minX - list->_posX; + list->_posX = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste[idx]._posY < _vm->_graphicsManager._minY) { - _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste[idx]._posY; - _vm->_globals.Liste[idx]._posY = _vm->_graphicsManager._minY; + if (list->_posY < _vm->_graphicsManager._minY) { + list->_height -= _vm->_graphicsManager._minY - list->_posY; + list->_posY = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx]._posX > _vm->_graphicsManager._maxX) - _vm->_globals.Liste[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste[idx]._posX; + if (list->_width + list->_posX > _vm->_graphicsManager._maxX) + list->_width = _vm->_graphicsManager._maxX - list->_posX; - if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx]._posY > _vm->_graphicsManager._maxY) - _vm->_globals.Liste[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste[idx]._posY; + if (list->_height + list->_posY > _vm->_graphicsManager._maxY) + list->_height = _vm->_graphicsManager._maxY - list->_posY; - if (_vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) - _vm->_globals.Liste[idx]._visibleFl = false; + if (list->_width <= 0 || list->_height <= 0) + list->_visibleFl = false; - if (_vm->_globals.Liste[idx]._visibleFl) - _vm->_graphicsManager.addVesaSegment( _vm->_globals.Liste[idx]._posX, _vm->_globals.Liste[idx]._posY, - _vm->_globals.Liste[idx]._posX + _vm->_globals.Liste[idx]._width, _vm->_globals.Liste[idx]._posY + _vm->_globals.Liste[idx]._height); + if (list->_visibleFl) + _vm->_graphicsManager.addVesaSegment( list->_posX, list->_posY, list->_posX + list->_width, list->_posY + list->_height); } void ObjectsManager::displayHiding(int idx) { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._hidingItemData[1], - _vm->_globals._hidingItem[idx]._x + 300, _vm->_globals._hidingItem[idx]._y + 300, - _vm->_globals._hidingItem[idx]._spriteIndex); + HidingItem *hid = &_vm->_globals._hidingItem[idx]; - _vm->_graphicsManager.addVesaSegment(_vm->_globals._hidingItem[idx]._x, _vm->_globals._hidingItem[idx]._y, - _vm->_globals._hidingItem[idx]._x + _vm->_globals._hidingItem[idx]._width, _vm->_globals._hidingItem[idx]._y + _vm->_globals._hidingItem[idx]._height); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_globals._hidingItemData[1], + hid->_x + 300, hid->_y + 300, hid->_spriteIndex); + _vm->_graphicsManager.addVesaSegment(hid->_x, hid->_y, hid->_x + hid->_width, hid->_y + hid->_height); } // Compute Sprite void ObjectsManager::computeSprite(int idx) { - _sprite[idx]._activeFl = false; - int spriteIndex = _sprite[idx]._spriteIndex; + SpriteItem *spr = &_sprite[idx]; + + spr->_activeFl = false; + int spriteIndex = spr->_spriteIndex; if (spriteIndex == 250) return; int offX; int offY; - if (_sprite[idx]._flipFl) { - offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, true); - offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, true); + if (spr->_flipFl) { + offX = getOffsetX(spr->_spriteData, spriteIndex, true); + offY = getOffsetY(spr->_spriteData, spr->_spriteIndex, true); } else { - offX = getOffsetX(_sprite[idx]._spriteData, spriteIndex, false); - offY = getOffsetY(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex, false); + offX = getOffsetX(spr->_spriteData, spriteIndex, false); + offY = getOffsetY(spr->_spriteData, spr->_spriteIndex, false); } - int tmpX = _sprite[idx].field12 + offX; + int tmpX = spr->field12 + offX; int deltaX = tmpX; - int tmpY = _sprite[idx].field14 + offY; + int tmpY = spr->field14 + offY; int deltaY = tmpY; int zoomPercent = 0; int reducePercent = 0; - if (_sprite[idx]._zoomFactor < 0) { - reducePercent = -_sprite[idx]._zoomFactor; + if (spr->_zoomFactor < 0) { + reducePercent = -spr->_zoomFactor; if (reducePercent > 95) reducePercent = 95; } else - zoomPercent = _sprite[idx]._zoomFactor; + zoomPercent = spr->_zoomFactor; if (zoomPercent) { if (tmpX >= 0) @@ -873,20 +878,20 @@ void ObjectsManager::computeSprite(int idx) { } } - int newPosX = _sprite[idx]._spritePos.x - deltaX; - int newPosY = _sprite[idx]._spritePos.y - deltaY; - _sprite[idx]._destX = newPosX; - _sprite[idx]._destY = newPosY; - _sprite[idx]._activeFl = true; - _sprite[idx]._zoomPct = zoomPercent; - _sprite[idx]._reducePct = reducePercent; + int newPosX = spr->_spritePos.x - deltaX; + int newPosY = spr->_spritePos.y - deltaY; + spr->_destX = newPosX; + spr->_destY = newPosY; + spr->_activeFl = true; + spr->_zoomPct = zoomPercent; + spr->_reducePct = reducePercent; _vm->_globals.Liste[idx]._visibleFl = true; _vm->_globals.Liste[idx]._posX = newPosX; _vm->_globals.Liste[idx]._posY = newPosY; - int width = getWidth(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); - int height = getHeight(_sprite[idx]._spriteData, _sprite[idx]._spriteIndex); + int width = getWidth(spr->_spriteData, spr->_spriteIndex); + int height = getHeight(spr->_spriteData, spr->_spriteIndex); if (zoomPercent) { width = _vm->_graphicsManager.zoomIn(width, zoomPercent); @@ -896,8 +901,8 @@ void ObjectsManager::computeSprite(int idx) { width = _vm->_graphicsManager.zoomOut(width, reducePercent); } - _sprite[idx]._width = width; - _sprite[idx]._height = height; + spr->_width = width; + spr->_height = height; } // Before Sort @@ -1069,99 +1074,82 @@ void ObjectsManager::displayVBob() { int width, height; for (int idx = 0; idx <= 29; idx++) { - if (_vm->_globals.VBob[idx].field4 == 4) { - width = getWidth(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); - height = getHeight(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); - - _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaScreen, - _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._xp, - _vm->_globals.VBob[idx]._yp, width, height); + VBobItem *vbob = &_vm->_globals.VBob[idx]; + if (vbob->field4 == 4) { + width = getWidth(vbob->_spriteData, vbob->_frameIndex); + height = getHeight(vbob->_spriteData, vbob->_frameIndex); - _vm->_graphicsManager.restoreSurfaceRect( - _vm->_graphicsManager._vesaBuffer, _vm->_globals.VBob[idx]._surface, - _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, - width, height); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaScreen, vbob->_surface, + vbob->_xp, vbob->_yp, width, height); - _vm->_graphicsManager.addVesaSegment( - _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, - _vm->_globals.VBob[idx]._xp + width, height + _vm->_globals.VBob[idx]._yp); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, vbob->_surface, + vbob->_xp, vbob->_yp, width, height); - _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); + _vm->_graphicsManager.addVesaSegment(vbob->_xp, vbob->_yp, vbob->_xp + width, height + vbob->_yp); + vbob->_surface = _vm->_globals.freeMemory(vbob->_surface); - _vm->_globals.VBob[idx].field4 = 0; - _vm->_globals.VBob[idx]._spriteData = g_PTRNUL; - _vm->_globals.VBob[idx]._xp = 0; - _vm->_globals.VBob[idx]._yp = 0; - _vm->_globals.VBob[idx]._oldX = 0; - _vm->_globals.VBob[idx]._oldY = 0; - _vm->_globals.VBob[idx]._frameIndex = 0; - _vm->_globals.VBob[idx]._oldFrameIndex = 0; - _vm->_globals.VBob[idx]._oldSpriteData = g_PTRNUL; + vbob->field4 = 0; + vbob->_spriteData = g_PTRNUL; + vbob->_xp = 0; + vbob->_yp = 0; + vbob->_oldX = 0; + vbob->_oldY = 0; + vbob->_frameIndex = 0; + vbob->_oldFrameIndex = 0; + vbob->_oldSpriteData = g_PTRNUL; } - if (_vm->_globals.VBob[idx].field4 == 3) { - width = getWidth(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); - height = getHeight(_vm->_globals.VBob[idx]._oldSpriteData, _vm->_globals.VBob[idx]._oldFrameIndex); + if (vbob->field4 == 3) { + width = getWidth(vbob->_oldSpriteData, vbob->_oldFrameIndex); + height = getHeight(vbob->_oldSpriteData, vbob->_oldFrameIndex); - _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaScreen, - _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, - _vm->_globals.VBob[idx]._oldY, - width, height); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaScreen, vbob->_surface, + vbob->_oldX, vbob->_oldY, width, height); - _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, - _vm->_globals.VBob[idx]._surface, _vm->_globals.VBob[idx]._oldX, - _vm->_globals.VBob[idx]._oldY, width, height); + _vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, vbob->_surface, + vbob->_oldX, vbob->_oldY, width, height); - _vm->_graphicsManager.addVesaSegment(_vm->_globals.VBob[idx]._oldX, - _vm->_globals.VBob[idx]._oldY, _vm->_globals.VBob[idx]._oldX + width, - _vm->_globals.VBob[idx]._oldY + height); + _vm->_graphicsManager.addVesaSegment(vbob->_oldX, vbob->_oldY, vbob->_oldX + width, vbob->_oldY + height); - _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx]._spriteData; + vbob->field4 = 1; + vbob->_oldSpriteData = vbob->_spriteData; - _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); + vbob->_surface = _vm->_globals.freeMemory(vbob->_surface); - _vm->_globals.VBob[idx]._oldX = _vm->_globals.VBob[idx]._xp; - _vm->_globals.VBob[idx]._oldY = _vm->_globals.VBob[idx]._yp; - _vm->_globals.VBob[idx]._oldFrameIndex = _vm->_globals.VBob[idx]._frameIndex; + vbob->_oldX = vbob->_xp; + vbob->_oldY = vbob->_yp; + vbob->_oldFrameIndex = vbob->_frameIndex; } - if (_vm->_globals.VBob[idx].field4 == 1) { - width = getWidth(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); - height = getHeight(_vm->_globals.VBob[idx]._spriteData, _vm->_globals.VBob[idx]._frameIndex); + if (vbob->field4 == 1) { + width = getWidth(vbob->_spriteData, vbob->_frameIndex); + height = getHeight(vbob->_spriteData, vbob->_frameIndex); - _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); + vbob->_surface = _vm->_globals.freeMemory(vbob->_surface); byte *surface = _vm->_globals.allocMemory(height * width); - _vm->_globals.VBob[idx]._surface = surface; + vbob->_surface = surface; _vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaScreen, surface, - _vm->_globals.VBob[idx]._xp, _vm->_globals.VBob[idx]._yp, width, height); + vbob->_xp, vbob->_yp, width, height); - byte *v10 = _vm->_globals.VBob[idx]._spriteData; + byte *v10 = vbob->_spriteData; if (*v10 == 78) { _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaScreen, v10, - _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, - _vm->_globals.VBob[idx]._frameIndex, 0, 0, false); + vbob->_xp + 300, vbob->_yp + 300, vbob->_frameIndex, 0, 0, false); - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, - _vm->_globals.VBob[idx]._spriteData, - _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, - _vm->_globals.VBob[idx]._frameIndex, 0, 0, false); + _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, vbob->_spriteData, + vbob->_xp + 300, vbob->_yp + 300, vbob->_frameIndex, 0, 0, false); } else { - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, - v10, _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, - _vm->_globals.VBob[idx]._frameIndex); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, v10, + vbob->_xp + 300, vbob->_yp + 300, vbob->_frameIndex); - _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaScreen, _vm->_globals.VBob[idx]._spriteData, - _vm->_globals.VBob[idx]._xp + 300, _vm->_globals.VBob[idx]._yp + 300, - _vm->_globals.VBob[idx]._frameIndex); + _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaScreen, vbob->_spriteData, + vbob->_xp + 300, vbob->_yp + 300, vbob->_frameIndex); } - _vm->_graphicsManager.addVesaSegment(_vm->_globals.VBob[idx]._xp, - _vm->_globals.VBob[idx]._yp , _vm->_globals.VBob[idx]._xp + width, - _vm->_globals.VBob[idx]._yp + height); - _vm->_globals.VBob[idx].field4 = 2; + _vm->_graphicsManager.addVesaSegment(vbob->_xp, vbob->_yp , vbob->_xp + width, vbob->_yp + height); + vbob->field4 = 2; } } } @@ -1192,11 +1180,12 @@ void ObjectsManager::clearSprite() { } for (int idx = 0; idx < MAX_SPRITE; idx++) { - _vm->_globals.Liste[idx]._visibleFl = false; - _vm->_globals.Liste[idx]._posX = 0; - _vm->_globals.Liste[idx]._posY = 0; - _vm->_globals.Liste[idx]._width = 0; - _vm->_globals.Liste[idx]._height = 0; + ListeItem *list = &_vm->_globals.Liste[idx]; + list->_visibleFl = false; + list->_posX = 0; + list->_posY = 0; + list->_width = 0; + list->_height = 0; } } @@ -1207,21 +1196,23 @@ void ObjectsManager::animateSprite(int idx) { void ObjectsManager::addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int a8, int a9) { assert (idx <= MAX_SPRITE); - _sprite[idx]._spriteData = spriteData; - _sprite[idx]._spritePos = pos; - _sprite[idx]._spriteIndex = spriteIndex; - _sprite[idx]._zoomFactor = zoomFactor; - _sprite[idx]._flipFl = flipFl; - _sprite[idx].field12 = a8; - _sprite[idx].field14 = a9; - _sprite[idx]._animationType = 0; + + SpriteItem *spr = &_sprite[idx]; + spr->_spriteData = spriteData; + spr->_spritePos = pos; + spr->_spriteIndex = spriteIndex; + spr->_zoomFactor = zoomFactor; + spr->_flipFl = flipFl; + spr->field12 = a8; + spr->field14 = a9; + spr->_animationType = 0; if (READ_BE_UINT24(spriteData) == MKTAG24('R', 'L', 'E')) { - _sprite[idx]._rleFl = true; - _sprite[idx]._zoomFactor = 0; - _sprite[idx]._flipFl = false; + spr->_rleFl = true; + spr->_zoomFactor = 0; + spr->_flipFl = false; } else - _sprite[idx]._rleFl = false; + spr->_rleFl = false; } @@ -2721,27 +2712,28 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) { if (idx > 29) error("MAX_VBOB exceeded"); - if (_vm->_globals.VBob[idx].field4 <= 1) { - _vm->_globals.VBob[idx].field4 = 1; - _vm->_globals.VBob[idx]._xp = xp; - _vm->_globals.VBob[idx]._yp = yp; - _vm->_globals.VBob[idx]._frameIndex = frameIndex; - _vm->_globals.VBob[idx]._oldX = xp; - _vm->_globals.VBob[idx]._oldY = yp; - _vm->_globals.VBob[idx]._oldFrameIndex = frameIndex; - _vm->_globals.VBob[idx]._spriteData = src; - _vm->_globals.VBob[idx]._oldSpriteData = src; - _vm->_globals.VBob[idx]._surface = _vm->_globals.freeMemory(_vm->_globals.VBob[idx]._surface); - } else if (_vm->_globals.VBob[idx].field4 == 2 || _vm->_globals.VBob[idx].field4 == 4) { - _vm->_globals.VBob[idx].field4 = 3; - _vm->_globals.VBob[idx]._oldX = _vm->_globals.VBob[idx]._xp; - _vm->_globals.VBob[idx]._oldY = _vm->_globals.VBob[idx]._yp; - _vm->_globals.VBob[idx]._oldSpriteData = _vm->_globals.VBob[idx]._spriteData; - _vm->_globals.VBob[idx]._oldFrameIndex = _vm->_globals.VBob[idx]._frameIndex; - _vm->_globals.VBob[idx]._xp = xp; - _vm->_globals.VBob[idx]._yp = yp; - _vm->_globals.VBob[idx]._frameIndex = frameIndex; - _vm->_globals.VBob[idx]._spriteData = src; + VBobItem *vbob = &_vm->_globals.VBob[idx]; + if (vbob->field4 <= 1) { + vbob->field4 = 1; + vbob->_xp = xp; + vbob->_yp = yp; + vbob->_frameIndex = frameIndex; + vbob->_oldX = xp; + vbob->_oldY = yp; + vbob->_oldFrameIndex = frameIndex; + vbob->_spriteData = src; + vbob->_oldSpriteData = src; + vbob->_surface = _vm->_globals.freeMemory(vbob->_surface); + } else if (vbob->field4 == 2 || vbob->field4 == 4) { + vbob->field4 = 3; + vbob->_oldX = vbob->_xp; + vbob->_oldY = vbob->_yp; + vbob->_oldSpriteData = vbob->_spriteData; + vbob->_oldFrameIndex = vbob->_frameIndex; + vbob->_xp = xp; + vbob->_yp = yp; + vbob->_frameIndex = frameIndex; + vbob->_spriteData = src; } } @@ -2749,10 +2741,11 @@ void ObjectsManager::VBOB_OFF(int idx) { if (idx > 29) error("MAX_VBOB exceeded"); - if (_vm->_globals.VBob[idx].field4 <= 1) - _vm->_globals.VBob[idx].field4 = 0; + VBobItem *vbob = &_vm->_globals.VBob[idx]; + if (vbob->field4 <= 1) + vbob->field4 = 0; else - _vm->_globals.VBob[idx].field4 = 4; + vbob->field4 = 4; } void ObjectsManager::doActionBack(int idx) { @@ -3085,24 +3078,24 @@ void ObjectsManager::loadLinkFile(const Common::String &file) { int curDataCacheId = 60; byte *curDataPtr = ptr + 1000; - for (int cacheIdx = 0; cacheIdx <= 21; cacheIdx++) { + for (int hidingIdx = 0; hidingIdx <= 21; hidingIdx++) { + HidingItem *hid = &_vm->_globals._hidingItem[hidingIdx]; int curSpriteId = READ_LE_INT16(curDataPtr + 2 * curDataCacheId); - _vm->_globals._hidingItem[cacheIdx]._spriteIndex = curSpriteId; - _vm->_globals._hidingItem[cacheIdx]._x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2); - _vm->_globals._hidingItem[cacheIdx]._y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4); - _vm->_globals._hidingItem[cacheIdx].field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8); + hid->_spriteIndex = curSpriteId; + hid->_x = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 2); + hid->_y = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 4); + hid->field14 = READ_LE_INT16(curDataPtr + 2 * curDataCacheId + 8); if (!_vm->_globals._hidingItemData[1]) { - _vm->_globals._hidingItem[cacheIdx]._useCount = 0; + hid->_useCount = 0; } else { - _vm->_globals._hidingItem[cacheIdx]._spriteData = _vm->_globals._hidingItemData[1]; - _vm->_globals._hidingItem[cacheIdx]._width = getWidth(_vm->_globals._hidingItemData[1], curSpriteId); - _vm->_globals._hidingItem[cacheIdx]._height = getHeight(_vm->_globals._hidingItemData[1], curSpriteId); - _vm->_globals._hidingItem[cacheIdx]._useCount = 1; + hid->_spriteData = _vm->_globals._hidingItemData[1]; + hid->_width = getWidth(_vm->_globals._hidingItemData[1], curSpriteId); + hid->_height = getHeight(_vm->_globals._hidingItemData[1], curSpriteId); + hid->_useCount = 1; } - if (!_vm->_globals._hidingItem[cacheIdx]._x && !_vm->_globals._hidingItem[cacheIdx]._y - && !_vm->_globals._hidingItem[cacheIdx]._spriteIndex) - _vm->_globals._hidingItem[cacheIdx]._useCount = 0; + if (!hid->_x && !hid->_y && !hid->_spriteIndex) + hid->_useCount = 0; curDataCacheId += 5; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 5b4e80cbf8..1c82ab0662 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -109,19 +109,19 @@ private: void CALCUL_BOB(int idx); void checkHidingItem(); - void DEF_SPRITE(int idx); void displayHiding(int idx); void computeSprite(int idx); void beforeSort(SortMode sortMode, int index, int priority); void displayBobAnim(); void displayVBob(); + void DEF_SPRITE(int idx); void clearSprite(); void setSpriteZoom(int idx, int zoomFactor); - void GOHOME2(); void loadZone(const Common::String &file); void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter); + void GOHOME2(); void nextVerbIcon(); int getBobFrameIndex(int idx); -- cgit v1.2.3 From 29c664a6966cd333862f2d1d3cd09a182be7f985 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 17:18:44 +0100 Subject: HOPKINS: Implement a more proper function to clear the palette. --- engines/hopkins/graphics.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9429939720..b299082394 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -395,8 +395,14 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte } // Clear Palette +// CHECKME: Some versions of the game don't include it, some contains nothing more than +// than a loop doing nothing, some others just map the last value. While debugging, it +// seems that this function is called once the palette is already cleared, so it would be useless +// This code could most likely be removed. void GraphicsManager::clearPalette() { - SD_PIXELS[0] = 0; + uint16 col0 = mapRGB(0, 0, 0); + for (int i = 0; i < 512; i += 2) + WRITE_LE_UINT16(&SD_PIXELS[i], col0); } void GraphicsManager::SCANLINE(int pitch) { -- cgit v1.2.3 From 5297f6370749dfaff9b6b80ea9f10b855cd1b58f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 19:23:21 +0100 Subject: HOPKINS: Fix the crash related to the missing speech file in the Win95 English demo --- engines/hopkins/lines.cpp | 1 + engines/hopkins/objects.cpp | 7 ++++--- engines/hopkins/script.cpp | 26 ++++++++++++++++-------- engines/hopkins/sound.cpp | 48 ++++++++++++++++++++++++++------------------- engines/hopkins/sound.h | 2 +- engines/hopkins/talk.cpp | 4 +++- 6 files changed, 55 insertions(+), 33 deletions(-) diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index 77b9d4b6cd..ebf48a7d21 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -153,6 +153,7 @@ int LinesManager::checkInventoryHotspots(int posX, int posY) { */ int LinesManager::checkInventoryHotspotsRow(int posX, int minZoneNum, bool lastRow) { int result = minZoneNum; + if (posX >= _vm->_graphicsManager._scrollOffset + 158 && posX < _vm->_graphicsManager._scrollOffset + 208) return result; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 959d1e9046..b37dac2f6e 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -3218,13 +3218,14 @@ void ObjectsManager::SPECIAL_INI() { _vm->_eventsManager.VBL(); VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); _vm->_fontManager.hideText(9); + bool displayedTxtFl = false; if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals._textFilename, 220, 72, 6, 36, 253); - if (!_vm->_soundManager._textOffFl) - _vm->_fontManager.showText(9); + _vm->_fontManager.showText(9); + displayedTxtFl = true; } if (!_vm->_soundManager._voiceOffFl) - _vm->_soundManager.mixVoice(383, 4); + _vm->_soundManager.mixVoice(383, 4, displayedTxtFl); _vm->_globals._saveData->_data[svField270] = 1; _vm->_globals._saveData->_data[svField300] = 1; _vm->_globals._saveData->_data[svField320] = 1; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 691a9ec65f..c133b3e9d8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -132,22 +132,27 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_soundManager._soundFl); } + bool displayedTxtFl = false; if (!_vm->_soundManager._textOffFl) { int textPosX = READ_LE_INT16(dataP + 9); int textPosY = READ_LE_INT16(dataP + 11); _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals._textFilename, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253); - if (!_vm->_soundManager._textOffFl) - _vm->_fontManager.showText(9); + _vm->_fontManager.showText(9); + displayedTxtFl = true; } if (!_vm->_soundManager._voiceOffFl) - _vm->_soundManager.mixVoice(mesgId, 4); + _vm->_soundManager.mixVoice(mesgId, 4, displayedTxtFl); } else { // if (TRAVAILOBJET) if (_vm->_globals._saveData->_data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals._textFilename, 55, 20, dataP[8], 35, 253); - if (!_vm->_soundManager._textOffFl) + bool displayedTxtFl = false; + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.showText(9); + displayedTxtFl = true; + } + if (!_vm->_soundManager._voiceOffFl) - _vm->_soundManager.mixVoice(635, 4); + _vm->_soundManager.mixVoice(635, 4, displayedTxtFl); } else { int textPosX = READ_LE_INT16(dataP + 9); if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl) @@ -158,11 +163,14 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * textPosX, 60, 6, dataP[7], 253); } - if (!_vm->_soundManager._textOffFl) + bool displayedTxtFl = false; + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.showText(9); + displayedTxtFl = true; + } if (!_vm->_soundManager._voiceOffFl) - _vm->_soundManager.mixVoice(mesgId, 5); + _vm->_soundManager.mixVoice(mesgId, 5, displayedTxtFl); } } break; @@ -2163,12 +2171,14 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); + bool displayedTxtFl = false; if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals._textFilename, 91, 41, 3, 30, 253); _vm->_fontManager.showText(9); + displayedTxtFl = true; } if (!_vm->_soundManager._voiceOffFl) - _vm->_soundManager.mixVoice(617, 4); + _vm->_soundManager.mixVoice(617, 4, displayedTxtFl); for (int i = 0; i <= 29; i++) { if (_vm->shouldQuit()) return -1; // Exiting game diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index a2054eed18..b6322b49c0 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -476,7 +476,7 @@ void SoundManager::checkVoiceActivity() { } } -bool SoundManager::mixVoice(int voiceId, int voiceMode) { +bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) { int fileNumber; int oldMusicVol; bool breakFlag; @@ -577,24 +577,25 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { catLen = 0; } - if (!loadVoice(filename, catPos, catLen, _sWav[20])) - error("Couldn't load sample: %s", filename.c_str()); - - _sWav[20]._active = true; - - // Reduce music volume during speech oldMusicVol = _musicVolume; - if (!_musicOffFl && _musicVolume > 2) { - _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); - setMODMusicVolume(_musicVolume); - } + if (!loadVoice(filename, catPos, catLen, _sWav[20])) { + warning("Couldn't load sample: %s", filename.c_str()); + _sWav[20]._active = false; + } else { + _sWav[20]._active = true; + // Reduce music volume during speech + if (!_musicOffFl && _musicVolume > 2) { + _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); + setMODMusicVolume(_musicVolume); + } + } playVoice(); _vm->_eventsManager._escKeyFl = false; // Loop for playing voice - breakFlag = 0; + breakFlag = false; do { if (_specialSoundNum != 4 && !_skipRefreshFl) _vm->_eventsManager.VBL(); @@ -603,8 +604,10 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { _vm->_eventsManager.refreshEvents(); if (_vm->_eventsManager._escKeyFl) break; - if (!checkVoiceStatus(2)) + if (!checkVoiceStatus(2) && _sWav[20]._active) breakFlag = true; + if (!_sWav[20]._active && !dispTxtFl) + break; } while (!_vm->shouldQuit() && !breakFlag); @@ -741,7 +744,7 @@ void SoundManager::stopVoice(int voiceIndex) { void SoundManager::playVoice() { if (!_sWav[20]._active) - error("Bad handle"); + return; if (!_voice[2]._status) { int wavIndex = _voice[2]._wavIndex; @@ -767,9 +770,11 @@ bool SoundManager::removeWavSample(int wavIndex) { bool SoundManager::loadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item) { Common::File f; if (!f.open(filename)) { - // Fallback from WAV to APC... - if (!f.open(setExtension(filename, ".APC"))) - error("Could not open %s for reading", filename.c_str()); + // Fallback to APC... + if (!f.open(setExtension(filename, ".APC"))) { + warning("Could not open %s for reading", filename.c_str()); + return false; + } } f.seek(fileOffset); @@ -783,9 +788,12 @@ void SoundManager::loadWavSample(int wavIndex, const Common::String &filename, b if (_sWav[wavIndex]._active) removeWavSample(wavIndex); - loadVoice(filename, 0, 0, _sWav[wavIndex]); - _sWav[wavIndex]._active = true; - _sWav[wavIndex]._freeSampleFl = freeSample; + if (loadVoice(filename, 0, 0, _sWav[wavIndex])) { + _sWav[wavIndex]._active = true; + _sWav[wavIndex]._freeSampleFl = freeSample; + } else{ + _sWav[wavIndex]._active = false; + } } void SoundManager::loadWav(const Common::String &file, int wavIndex) { diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 9e89d10110..1a3060264a 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -123,7 +123,7 @@ public: void updateScummVMSoundSettings(); void syncSoundSettings(); - bool mixVoice(int voiceId, int voiceMode); + bool mixVoice(int voiceId, int voiceMode, bool displTxtFl = false); void setMODMusicVolume(int volume); void setMODSampleVolume(); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index d8e37924fe..d3c60a056e 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -380,11 +380,13 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) { VISU_PARLE(); } + bool displayedTxtFl = false; if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, mesgId, _answersFilename, mesgPosX, mesgPosY, 5, mesgLength, 252); _vm->_fontManager.showText(9); + displayedTxtFl = true; } - if (!_vm->_soundManager.mixVoice(mesgId, 1)) { + if (!_vm->_soundManager.mixVoice(mesgId, 1, displayedTxtFl)) { _vm->_eventsManager._curMouseButton = 0; _vm->_eventsManager._mouseButton = 0; -- cgit v1.2.3 From 9a535ac9f610e8209654fd1f3fdda244f47abe79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 23:51:29 +0100 Subject: HOPKINS: Remove verbose error messages when the English demo skips the speech loading --- engines/hopkins/script.cpp | 2 +- engines/hopkins/sound.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c133b3e9d8..09555bd236 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -142,7 +142,7 @@ int ScriptManager::handleOpcode(byte *dataP) { } if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(mesgId, 4, displayedTxtFl); - } else { // if (TRAVAILOBJET) + } else { // if (_tempObjectFl) if (_vm->_globals._saveData->_data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals._textFilename, 55, 20, dataP[8], 35, 253); bool displayedTxtFl = false; diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index b6322b49c0..4df2a2d7d8 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -579,7 +579,6 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) { oldMusicVol = _musicVolume; if (!loadVoice(filename, catPos, catLen, _sWav[20])) { - warning("Couldn't load sample: %s", filename.c_str()); _sWav[20]._active = false; } else { _sWav[20]._active = true; @@ -772,7 +771,8 @@ bool SoundManager::loadVoice(const Common::String &filename, size_t fileOffset, if (!f.open(filename)) { // Fallback to APC... if (!f.open(setExtension(filename, ".APC"))) { - warning("Could not open %s for reading", filename.c_str()); + if (!_vm->getIsDemo()) + error("Could not open %s for reading", filename.c_str()); return false; } } -- cgit v1.2.3 From 3787e69e7bca8e207a9e7e2b462027376ad268e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Feb 2013 10:23:44 +0100 Subject: HOPKINS: Add comments concerning the Win95 UK demo fix --- engines/hopkins/sound.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 4df2a2d7d8..0ea33cd218 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -579,6 +579,10 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) { oldMusicVol = _musicVolume; if (!loadVoice(filename, catPos, catLen, _sWav[20])) { + // This case only concerns the English Win95 demo + // If it's not possible to load the voice, we force the active flag + // to false in order to make sure the missing buffer won't be played + // accidentally later _sWav[20]._active = false; } else { _sWav[20]._active = true; @@ -603,8 +607,12 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) { _vm->_eventsManager.refreshEvents(); if (_vm->_eventsManager._escKeyFl) break; + // We only check the voice status if the file has been loaded properly + // This avoids skipping completely the talk animations in the Win95 UK Demo if (!checkVoiceStatus(2) && _sWav[20]._active) breakFlag = true; + // This is specific to the Win95 UK Demo again: if nothing is displayed, + // don't wait for a click event. if (!_sWav[20]._active && !dispTxtFl) break; } while (!_vm->shouldQuit() && !breakFlag); @@ -771,6 +779,8 @@ bool SoundManager::loadVoice(const Common::String &filename, size_t fileOffset, if (!f.open(filename)) { // Fallback to APC... if (!f.open(setExtension(filename, ".APC"))) { + // The English demo doesn't include the speech file. + // This avoids it to crash when discussing with other characters if (!_vm->getIsDemo()) error("Could not open %s for reading", filename.c_str()); return false; -- cgit v1.2.3 From 79bbd015ab30740f4630b5fa707b6983106a14ee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Feb 2013 10:55:41 +0100 Subject: HOPKINS: Remove a useless variable, some renaming in HopkinsEngine --- engines/hopkins/globals.cpp | 22 +++++++++----------- engines/hopkins/globals.h | 2 -- engines/hopkins/hopkins.cpp | 50 ++++++++++++++++++++++----------------------- engines/hopkins/hopkins.h | 6 +++--- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 69927c999f..a9a39e2b50 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -146,7 +146,6 @@ Globals::Globals() { BUF_ZONE = NULL; SPRITE_ECRAN = NULL; _saveData = NULL; - _inventoryObject = NULL; _answerBuffer = g_PTRNUL; _objectDataBuf = NULL; PERSO = NULL; @@ -181,7 +180,6 @@ Globals::~Globals() { _hidingItemData[idx] = freeMemory(_hidingItemData[idx]); freeMemory(SPRITE_ECRAN); freeMemory((byte *)_saveData); - freeMemory(_inventoryObject); freeMemory(_answerBuffer); freeMemory(_objectDataBuf); freeMemory(PERSO); @@ -261,7 +259,6 @@ void Globals::clearAll() { _boxWidth = 240; _vm->_eventsManager._objectBuf = allocMemory(2500); - _inventoryObject = allocMemory(2500); _objectDataBuf = g_PTRNUL; } @@ -360,15 +357,16 @@ void Globals::resetHidingItems() { } for (int idx = 0; idx <= 20; ++idx) { - _hidingItem[idx]._spriteData = g_PTRNUL; - _hidingItem[idx]._x = 0; - _hidingItem[idx]._y = 0; - _hidingItem[idx]._spriteIndex = 0; - _hidingItem[idx]._useCount = 0; - _hidingItem[idx]._width = 0; - _hidingItem[idx]._height = 0; - _hidingItem[idx].field10 = false; - _hidingItem[idx].field14 = 0; + HidingItem *hid = &_hidingItem[idx]; + hid->_spriteData = g_PTRNUL; + hid->_x = 0; + hid->_y = 0; + hid->_spriteIndex = 0; + hid->_useCount = 0; + hid->_width = 0; + hid->_height = 0; + hid->field10 = false; + hid->field14 = 0; } _hidingActiveFl = false; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index cd566a2134..9986abb810 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -236,8 +236,6 @@ class Globals { private: HopkinsEngine *_vm; - byte *_inventoryObject; - void initAnimBqe(); void initVBob(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ccf431422e..3d4d152229 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1285,55 +1285,55 @@ bool HopkinsEngine::runFull() { break; case 77: - OCEAN(77, "OCEAN01", DIR_RIGHT, 0, 84, 0, 0, 25); + handleOceanMaze(77, "OCEAN01", DIR_RIGHT, 0, 84, 0, 0, 25); break; case 78: - OCEAN(78, "OCEAN02", DIR_UP, 0, 91, 84, 0, 25); + handleOceanMaze(78, "OCEAN02", DIR_UP, 0, 91, 84, 0, 25); break; case 79: - OCEAN(79, "OCEAN03", DIR_LEFT, 87, 0, 0, 83, 25); + handleOceanMaze(79, "OCEAN03", DIR_LEFT, 87, 0, 0, 83, 25); break; case 80: - OCEAN(80, "OCEAN04", DIR_UP, 86, 88, 0, 81, 25); + handleOceanMaze(80, "OCEAN04", DIR_UP, 86, 88, 0, 81, 25); break; case 81: - OCEAN(81, "OCEAN05", DIR_UP, 91, 82, 80, 85, 25); + handleOceanMaze(81, "OCEAN05", DIR_UP, 91, 82, 80, 85, 25); break; case 82: - OCEAN(82, "OCEAN06", DIR_LEFT, 81, 0, 88, 0, 25); + handleOceanMaze(82, "OCEAN06", DIR_LEFT, 81, 0, 88, 0, 25); break; case 83: - OCEAN(83, "OCEAN07", DIR_UP, 89, 0, 79, 88, 25); + handleOceanMaze(83, "OCEAN07", DIR_UP, 89, 0, 79, 88, 25); break; case 84: - OCEAN(84, "OCEAN08", DIR_UP, 77, 0, 0, 78, 25); + handleOceanMaze(84, "OCEAN08", DIR_UP, 77, 0, 0, 78, 25); break; case 85: - OCEAN(85, "OCEAN09", DIR_UP, 0, 0, 81, 0, 25); + handleOceanMaze(85, "OCEAN09", DIR_UP, 0, 0, 81, 0, 25); break; case 86: - OCEAN(86, "OCEAN10", DIR_UP, 0, 80, 0, 91, 25); + handleOceanMaze(86, "OCEAN10", DIR_UP, 0, 80, 0, 91, 25); break; case 87: - OCEAN(87, "OCEAN11", DIR_RIGHT, 0, 79, 90, 0, 25); + handleOceanMaze(87, "OCEAN11", DIR_RIGHT, 0, 79, 90, 0, 25); break; case 88: - OCEAN(88, "OCEAN12", DIR_UP, 80, 0, 83, 82, 25); + handleOceanMaze(88, "OCEAN12", DIR_UP, 80, 0, 83, 82, 25); break; case 89: - OCEAN(89, "OCEAN13", DIR_RIGHT, 0, 83, 0, 0, 25); + handleOceanMaze(89, "OCEAN13", DIR_RIGHT, 0, 83, 0, 0, 25); break; case 90: @@ -1341,7 +1341,7 @@ bool HopkinsEngine::runFull() { break; case 91: - OCEAN(91, "OCEAN15", DIR_RIGHT, 78, 81, 86, 0, 25); + handleOceanMaze(91, "OCEAN15", DIR_RIGHT, 78, 81, 86, 0, 25); break; case 93: @@ -2523,7 +2523,7 @@ void HopkinsEngine::displayCredits() { _eventsManager._mouseFl = true; } -void HopkinsEngine::BTOCEAN() { +void HopkinsEngine::handleOceanMouseEvents() { _fontManager.hideText(9); if (_eventsManager._mouseCursorId != 16) return; @@ -2563,7 +2563,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; @@ -2599,7 +2599,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; @@ -2621,7 +2621,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; @@ -2644,7 +2644,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; @@ -2675,7 +2675,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals._speed == 3) oldX += 6; _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) { displAnim = true; @@ -2695,7 +2695,7 @@ void HopkinsEngine::BTOCEAN() { else if (_globals._speed == 3) oldX -= 6; _objectsManager.setSpriteX(0, oldX); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_eventsManager.getMouseButton() == 1 && oldPosX == _eventsManager.getMouseX() && _eventsManager.getMouseY() == oldPosY) break; @@ -2716,7 +2716,7 @@ void HopkinsEngine::BTOCEAN() { } } -void HopkinsEngine::OCEAN_HOME() { +void HopkinsEngine::setSubmarineSprites() { switch (_globals._oceanDirection) { case DIR_UP: _objectsManager.setSpriteIndex(0, 27); @@ -2735,7 +2735,7 @@ void HopkinsEngine::OCEAN_HOME() { } } -void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { +void HopkinsEngine::handleOceanMaze(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId) { _globals._cityMapEnabledFl = false; _graphicsManager._noFadingFl = false; _globals._freezeCharacterFl = false; @@ -2809,9 +2809,9 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, Di for (;;) { int mouseButton = _eventsManager.getMouseButton(); if (mouseButton && mouseButton == 1) - BTOCEAN(); + handleOceanMouseEvents(); _linesManager.checkZone(); - OCEAN_HOME(); + setSubmarineSprites(); _eventsManager.VBL(); if (_globals._exitId || g_system->getEventManager()->shouldQuit()) break; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 0fd683375f..324d36bbea 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -120,9 +120,9 @@ private: */ void drawBaseMap(); - void BTOCEAN(); - void OCEAN_HOME(); - void OCEAN(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); + void handleOceanMouseEvents(); + void setSubmarineSprites(); + void handleOceanMaze(int16 curExitId, Common::String backgroundFilename, Directions defaultDirection, int16 exit1, int16 exit2, int16 exit3, int16 exit4, int16 soundId); void loadCredits(); void displayCredits(int startPosY, byte *buffer, char colour); void displayCredits(); -- cgit v1.2.3